create-principles-disciple 1.150.3 → 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 (646) hide show
  1. package/_release/product-identity.json +1 -1
  2. package/codex-adapter/dist/ingestion/admission.js +2 -0
  3. package/codex-adapter/dist/ingestion/ingestion.js +25 -4
  4. package/codex-adapter/dist/ingestion/transcript-decoder.d.ts +5 -3
  5. package/codex-adapter/dist/ingestion/transcript-decoder.js +61 -5
  6. package/codex-adapter/dist/pd-hook.d.ts +7 -5
  7. package/codex-adapter/dist/pd-hook.js +18 -7
  8. package/codex-adapter/dist/tool-semantics.js +5 -1
  9. package/codex-adapter/dist/worker/workspace-worker.js +4 -2
  10. package/codex-adapter/package.json +1 -1
  11. package/console/dist/lib/utils.js +16 -1
  12. package/console/dist/server/index.js +14 -2
  13. package/console/dist/server/models/ActivationsConsoleModel.js +3 -2
  14. package/console/dist/server/models/ApprovalsConsoleModel.js +2 -1
  15. package/console/dist/server/models/ApprovalsGroupedConsoleModel.js +2 -1
  16. package/console/dist/server/models/EvidenceChainConsoleModel.d.ts +46 -0
  17. package/console/dist/server/models/EvidenceChainConsoleModel.js +121 -2
  18. package/console/dist/server/models/GovernanceConsoleModel.js +3 -2
  19. package/console/dist/server/models/GovernanceExperienceCollector.js +2 -1
  20. package/console/dist/server/models/GovernanceProjectionCollector.js +2 -1
  21. package/console/dist/server/models/IngestionHealthModel.d.ts +34 -0
  22. package/console/dist/server/models/IngestionHealthModel.js +254 -0
  23. package/console/dist/server/models/IntentDecisionModel.js +2 -2
  24. package/console/dist/server/models/IntentPageModel.js +2 -1
  25. package/console/dist/server/models/OwnerDecisionConsoleModel.js +3 -3
  26. package/console/dist/server/models/OwnerDecisionViewModel.js +2 -2
  27. package/console/dist/server/models/PrincipleTrajectoryModel.js +2 -1
  28. package/console/dist/server/models/ReceiptsConsoleModel.js +2 -2
  29. package/console/dist/server/models/RuleCandidateBindingConsoleModel.js +3 -2
  30. package/console/dist/server/routes/diagnostician.js +2 -1
  31. package/console/dist/server/routes/evidence-chain.d.ts +4 -0
  32. package/console/dist/server/routes/evidence-chain.js +22 -0
  33. package/console/dist/server/routes/failed-tasks.js +78 -2
  34. package/console/dist/server/routes/health.d.ts +8 -0
  35. package/console/dist/server/routes/health.js +72 -0
  36. package/console/dist/server/routes/owner-identity.d.ts +6 -0
  37. package/console/dist/server/routes/owner-identity.js +7 -3
  38. package/console/dist/server/routes/principles.js +3 -3
  39. package/console/dist/web/assets/app.css +150 -46
  40. package/console/dist/web/assets/app.js +37 -32
  41. package/console/package.json +2 -0
  42. package/core/dist/runtime/activation/adaptive-selection-output.d.ts +0 -21
  43. package/core/dist/runtime/activation/adaptive-selection-output.d.ts.map +1 -1
  44. package/core/dist/runtime/activation/adaptive-selection-output.js.map +1 -1
  45. package/core/dist/runtime/activation/index.d.ts +2 -6
  46. package/core/dist/runtime/activation/index.d.ts.map +1 -1
  47. package/core/dist/runtime/activation/index.js.map +1 -1
  48. package/core/dist/runtime/activation/production-gate-deps.d.ts +2 -1
  49. package/core/dist/runtime/activation/production-gate-deps.d.ts.map +1 -1
  50. package/core/dist/runtime/activation/prompt-activation-reader-contract.d.ts +2 -1
  51. package/core/dist/runtime/activation/prompt-activation-reader-contract.d.ts.map +1 -1
  52. package/core/dist/runtime/activation/writers/index.d.ts +0 -1
  53. package/core/dist/runtime/activation/writers/index.d.ts.map +1 -1
  54. package/core/dist/runtime/activation/writers/rule-host-writer.d.ts.map +1 -1
  55. package/core/dist/runtime/activation/writers/rule-host-writer.js +15 -6
  56. package/core/dist/runtime/activation/writers/rule-host-writer.js.map +1 -1
  57. package/core/dist/runtime/activation-compatibility-read-model.d.ts +3 -2
  58. package/core/dist/runtime/activation-compatibility-read-model.d.ts.map +1 -1
  59. package/core/dist/runtime/activation-compatibility-read-model.js +2 -1
  60. package/core/dist/runtime/activation-compatibility-read-model.js.map +1 -1
  61. package/core/dist/runtime/adapter/context-budget.d.ts +3 -14
  62. package/core/dist/runtime/adapter/context-budget.d.ts.map +1 -1
  63. package/core/dist/runtime/adapter/context-budget.js +2 -2
  64. package/core/dist/runtime/adapter/context-budget.js.map +1 -1
  65. package/core/dist/runtime/adapter/index.d.ts +1 -2
  66. package/core/dist/runtime/adapter/index.d.ts.map +1 -1
  67. package/core/dist/runtime/adapter/index.js +1 -1
  68. package/core/dist/runtime/adapter/index.js.map +1 -1
  69. package/core/dist/runtime/adapter/output-repair-contract.d.ts +18 -1
  70. package/core/dist/runtime/adapter/output-repair-contract.d.ts.map +1 -1
  71. package/core/dist/runtime/adapter/output-repair-contract.js +94 -0
  72. package/core/dist/runtime/adapter/output-repair-contract.js.map +1 -1
  73. package/core/dist/runtime/adapter/pi-ai-runtime-adapter.d.ts +2 -3
  74. package/core/dist/runtime/adapter/pi-ai-runtime-adapter.d.ts.map +1 -1
  75. package/core/dist/runtime/adapter/pi-ai-runtime-adapter.js +111 -21
  76. package/core/dist/runtime/adapter/pi-ai-runtime-adapter.js.map +1 -1
  77. package/core/dist/runtime/adapter/principle-tree-ledger-adapter.d.ts +1 -1
  78. package/core/dist/runtime/adapter/principle-tree-ledger-adapter.d.ts.map +1 -1
  79. package/core/dist/runtime/adapter/schema-prompt-adapter.d.ts +0 -1
  80. package/core/dist/runtime/adapter/schema-prompt-adapter.d.ts.map +1 -1
  81. package/core/dist/runtime/adapter/schema-prompt-adapter.js +43 -1
  82. package/core/dist/runtime/adapter/schema-prompt-adapter.js.map +1 -1
  83. package/core/dist/runtime/bridge-result-shaper.d.ts +1 -1
  84. package/core/dist/runtime/bridge-result-shaper.d.ts.map +1 -1
  85. package/core/dist/runtime/candidate-audit.d.ts.map +1 -1
  86. package/core/dist/runtime/candidate-audit.js +2 -1
  87. package/core/dist/runtime/candidate-audit.js.map +1 -1
  88. package/core/dist/runtime/candidate-intake-service.d.ts +2 -1
  89. package/core/dist/runtime/candidate-intake-service.d.ts.map +1 -1
  90. package/core/dist/runtime/cli/diagnose.d.ts +4 -3
  91. package/core/dist/runtime/cli/diagnose.d.ts.map +1 -1
  92. package/core/dist/runtime/config/index.d.ts +2 -2
  93. package/core/dist/runtime/config/index.d.ts.map +1 -1
  94. package/core/dist/runtime/config/index.js +3 -3
  95. package/core/dist/runtime/config/index.js.map +1 -1
  96. package/core/dist/runtime/config/pd-config-defaults.d.ts +0 -2
  97. package/core/dist/runtime/config/pd-config-defaults.d.ts.map +1 -1
  98. package/core/dist/runtime/config/pd-config-defaults.js +2 -2
  99. package/core/dist/runtime/config/pd-config-defaults.js.map +1 -1
  100. package/core/dist/runtime/config/pd-config-effective.d.ts.map +1 -1
  101. package/core/dist/runtime/config/pd-config-effective.js +2 -0
  102. package/core/dist/runtime/config/pd-config-effective.js.map +1 -1
  103. package/core/dist/runtime/config/pd-config-types.d.ts +54 -0
  104. package/core/dist/runtime/config/pd-config-types.d.ts.map +1 -1
  105. package/core/dist/runtime/config/pd-config-types.js.map +1 -1
  106. package/core/dist/runtime/config/pd-config-validate.d.ts.map +1 -1
  107. package/core/dist/runtime/config/pd-config-validate.js +143 -0
  108. package/core/dist/runtime/config/pd-config-validate.js.map +1 -1
  109. package/core/dist/runtime/config/pd-profile-constants.d.ts +1 -7
  110. package/core/dist/runtime/config/pd-profile-constants.d.ts.map +1 -1
  111. package/core/dist/runtime/config/pd-profile-constants.js +5 -6
  112. package/core/dist/runtime/config/pd-profile-constants.js.map +1 -1
  113. package/core/dist/runtime/config/pd-validate-profile.d.ts +3 -2
  114. package/core/dist/runtime/config/pd-validate-profile.d.ts.map +1 -1
  115. package/core/dist/runtime/context-payload.d.ts +0 -7
  116. package/core/dist/runtime/context-payload.d.ts.map +1 -1
  117. package/core/dist/runtime/context-payload.js +1 -1
  118. package/core/dist/runtime/context-payload.js.map +1 -1
  119. package/core/dist/runtime/core-principles/index.d.ts +1 -1
  120. package/core/dist/runtime/core-principles/index.d.ts.map +1 -1
  121. package/core/dist/runtime/correction/correction-types.d.ts +0 -10
  122. package/core/dist/runtime/correction/correction-types.d.ts.map +1 -1
  123. package/core/dist/runtime/correction/correction-types.js.map +1 -1
  124. package/core/dist/runtime/diagnostician/diag-distiller-output.d.ts +0 -3
  125. package/core/dist/runtime/diagnostician/diag-distiller-output.d.ts.map +1 -1
  126. package/core/dist/runtime/diagnostician/diag-distiller-output.js +1 -1
  127. package/core/dist/runtime/diagnostician/diag-distiller-output.js.map +1 -1
  128. package/core/dist/runtime/diagnostician/diag-rootcause-output.d.ts +3 -11
  129. package/core/dist/runtime/diagnostician/diag-rootcause-output.d.ts.map +1 -1
  130. package/core/dist/runtime/diagnostician/diag-rootcause-output.js +3 -3
  131. package/core/dist/runtime/diagnostician/diag-rootcause-output.js.map +1 -1
  132. package/core/dist/runtime/diagnostician/distiller-prompt-builder.d.ts +5 -4
  133. package/core/dist/runtime/diagnostician/distiller-prompt-builder.d.ts.map +1 -1
  134. package/core/dist/runtime/diagnostician/evidence-ref-binding.d.ts +2 -1
  135. package/core/dist/runtime/diagnostician/evidence-ref-binding.d.ts.map +1 -1
  136. package/core/dist/runtime/diagnostician/rootcause-prompt-builder.d.ts +2 -1
  137. package/core/dist/runtime/diagnostician/rootcause-prompt-builder.d.ts.map +1 -1
  138. package/core/dist/runtime/diagnostician/router-prompt-builder.d.ts +22 -3
  139. package/core/dist/runtime/diagnostician/router-prompt-builder.d.ts.map +1 -1
  140. package/core/dist/runtime/diagnostician/router-prompt-builder.js +11 -1
  141. package/core/dist/runtime/diagnostician/router-prompt-builder.js.map +1 -1
  142. package/core/dist/runtime/diagnostician-association-shadow.d.ts +2 -2
  143. package/core/dist/runtime/diagnostician-association-shadow.d.ts.map +1 -1
  144. package/core/dist/runtime/diagnostician-association-validation.d.ts +3 -2
  145. package/core/dist/runtime/diagnostician-association-validation.d.ts.map +1 -1
  146. package/core/dist/runtime/diagnostician-output.d.ts +32 -5
  147. package/core/dist/runtime/diagnostician-output.d.ts.map +1 -1
  148. package/core/dist/runtime/diagnostician-output.js +47 -4
  149. package/core/dist/runtime/diagnostician-output.js.map +1 -1
  150. package/core/dist/runtime/diagnostician-prompt-builder.d.ts +2 -1
  151. package/core/dist/runtime/diagnostician-prompt-builder.d.ts.map +1 -1
  152. package/core/dist/runtime/error-categories.d.ts.map +1 -1
  153. package/core/dist/runtime/error-categories.js +10 -1
  154. package/core/dist/runtime/error-categories.js.map +1 -1
  155. package/core/dist/runtime/evidence-sanitizer.d.ts +8 -1
  156. package/core/dist/runtime/evidence-sanitizer.d.ts.map +1 -1
  157. package/core/dist/runtime/evidence-sanitizer.js +10 -3
  158. package/core/dist/runtime/evidence-sanitizer.js.map +1 -1
  159. package/core/dist/runtime/evolution/evolution-types.d.ts +0 -26
  160. package/core/dist/runtime/evolution/evolution-types.d.ts.map +1 -1
  161. package/core/dist/runtime/evolution/evolution-types.js.map +1 -1
  162. package/core/dist/runtime/feature-flags/feature-flag-contract.d.ts.map +1 -1
  163. package/core/dist/runtime/feature-flags/feature-flag-contract.js +8 -0
  164. package/core/dist/runtime/feature-flags/feature-flag-contract.js.map +1 -1
  165. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.d.ts.map +1 -1
  166. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js +24 -0
  167. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js.map +1 -1
  168. package/core/dist/runtime/feature-flags/index.d.ts +0 -1
  169. package/core/dist/runtime/feature-flags/index.d.ts.map +1 -1
  170. package/core/dist/runtime/feature-flags/index.js.map +1 -1
  171. package/core/dist/runtime/golden-trace.d.ts +9 -1
  172. package/core/dist/runtime/golden-trace.d.ts.map +1 -1
  173. package/core/dist/runtime/golden-trace.js +7 -0
  174. package/core/dist/runtime/golden-trace.js.map +1 -1
  175. package/core/dist/runtime/governance-projection-contract.d.ts +0 -6
  176. package/core/dist/runtime/governance-projection-contract.d.ts.map +1 -1
  177. package/core/dist/runtime/governance-projection-contract.js +3 -3
  178. package/core/dist/runtime/governance-projection-contract.js.map +1 -1
  179. package/core/dist/runtime/index.d.ts +2 -0
  180. package/core/dist/runtime/index.d.ts.map +1 -1
  181. package/core/dist/runtime/index.js +2 -0
  182. package/core/dist/runtime/index.js.map +1 -1
  183. package/core/dist/runtime/internalization/artifact-summary.d.ts +5 -4
  184. package/core/dist/runtime/internalization/artifact-summary.d.ts.map +1 -1
  185. package/core/dist/runtime/internalization/artifact-summary.js +1 -1
  186. package/core/dist/runtime/internalization/artifact-summary.js.map +1 -1
  187. package/core/dist/runtime/internalization/artificer-intent-preflight.d.ts +1 -1
  188. package/core/dist/runtime/internalization/artificer-intent-preflight.d.ts.map +1 -1
  189. package/core/dist/runtime/internalization/artificer-output.d.ts +0 -2
  190. package/core/dist/runtime/internalization/artificer-output.d.ts.map +1 -1
  191. package/core/dist/runtime/internalization/artificer-output.js +17 -0
  192. package/core/dist/runtime/internalization/artificer-output.js.map +1 -1
  193. package/core/dist/runtime/internalization/artificer-prompt-builder.d.ts +14 -3
  194. package/core/dist/runtime/internalization/artificer-prompt-builder.d.ts.map +1 -1
  195. package/core/dist/runtime/internalization/artificer-prompt-builder.js +13 -1
  196. package/core/dist/runtime/internalization/artificer-prompt-builder.js.map +1 -1
  197. package/core/dist/runtime/internalization/artificer-run-correlation.d.ts +3 -2
  198. package/core/dist/runtime/internalization/artificer-run-correlation.d.ts.map +1 -1
  199. package/core/dist/runtime/internalization/consumer-evidence-preflight.d.ts +2 -1
  200. package/core/dist/runtime/internalization/consumer-evidence-preflight.d.ts.map +1 -1
  201. package/core/dist/runtime/internalization/diag-distiller-runner.d.ts +1 -1
  202. package/core/dist/runtime/internalization/diag-distiller-runner.d.ts.map +1 -1
  203. package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts +1 -1
  204. package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts.map +1 -1
  205. package/core/dist/runtime/internalization/diag-router-runner.d.ts +11 -1
  206. package/core/dist/runtime/internalization/diag-router-runner.d.ts.map +1 -1
  207. package/core/dist/runtime/internalization/diag-router-runner.js +105 -1
  208. package/core/dist/runtime/internalization/diag-router-runner.js.map +1 -1
  209. package/core/dist/runtime/internalization/dreamer-output.d.ts +0 -9
  210. package/core/dist/runtime/internalization/dreamer-output.d.ts.map +1 -1
  211. package/core/dist/runtime/internalization/dreamer-output.js +1 -1
  212. package/core/dist/runtime/internalization/dreamer-output.js.map +1 -1
  213. package/core/dist/runtime/internalization/dreamer-prompt-builder.d.ts +3 -2
  214. package/core/dist/runtime/internalization/dreamer-prompt-builder.d.ts.map +1 -1
  215. package/core/dist/runtime/internalization/dreamer-runner.d.ts +1 -1
  216. package/core/dist/runtime/internalization/dreamer-runner.d.ts.map +1 -1
  217. package/core/dist/runtime/internalization/evaluator-output.d.ts +7 -17
  218. package/core/dist/runtime/internalization/evaluator-output.d.ts.map +1 -1
  219. package/core/dist/runtime/internalization/evaluator-output.js +2 -2
  220. package/core/dist/runtime/internalization/evaluator-output.js.map +1 -1
  221. package/core/dist/runtime/internalization/evaluator-prompt-builder.d.ts +3 -9
  222. package/core/dist/runtime/internalization/evaluator-prompt-builder.d.ts.map +1 -1
  223. package/core/dist/runtime/internalization/evaluator-prompt-builder.js +1 -1
  224. package/core/dist/runtime/internalization/evaluator-prompt-builder.js.map +1 -1
  225. package/core/dist/runtime/internalization/formation-context.d.ts +4 -6
  226. package/core/dist/runtime/internalization/formation-context.d.ts.map +1 -1
  227. package/core/dist/runtime/internalization/formation-context.js +3 -3
  228. package/core/dist/runtime/internalization/formation-context.js.map +1 -1
  229. package/core/dist/runtime/internalization/index.d.ts +2 -4
  230. package/core/dist/runtime/internalization/index.d.ts.map +1 -1
  231. package/core/dist/runtime/internalization/index.js +8 -1
  232. package/core/dist/runtime/internalization/index.js.map +1 -1
  233. package/core/dist/runtime/internalization/intake-to-internalization-bridge.d.ts +2 -1
  234. package/core/dist/runtime/internalization/intake-to-internalization-bridge.d.ts.map +1 -1
  235. package/core/dist/runtime/internalization/intent-contract.d.ts +2 -1
  236. package/core/dist/runtime/internalization/intent-contract.d.ts.map +1 -1
  237. package/core/dist/runtime/internalization/internalization-job-graph.d.ts +1 -1
  238. package/core/dist/runtime/internalization/internalization-job-graph.d.ts.map +1 -1
  239. package/core/dist/runtime/internalization/internalization-route.d.ts +2 -1
  240. package/core/dist/runtime/internalization/internalization-route.d.ts.map +1 -1
  241. package/core/dist/runtime/internalization/owner-decision-review.d.ts +3 -2
  242. package/core/dist/runtime/internalization/owner-decision-review.d.ts.map +1 -1
  243. package/core/dist/runtime/internalization/owner-resolution-service.d.ts +2 -1
  244. package/core/dist/runtime/internalization/owner-resolution-service.d.ts.map +1 -1
  245. package/core/dist/runtime/internalization/owner-retry.d.ts +2 -1
  246. package/core/dist/runtime/internalization/owner-retry.d.ts.map +1 -1
  247. package/core/dist/runtime/internalization/owner-review.d.ts +2 -21
  248. package/core/dist/runtime/internalization/owner-review.d.ts.map +1 -1
  249. package/core/dist/runtime/internalization/owner-review.js +2 -2
  250. package/core/dist/runtime/internalization/owner-review.js.map +1 -1
  251. package/core/dist/runtime/internalization/peer-runner-contracts.d.ts +2 -5
  252. package/core/dist/runtime/internalization/peer-runner-contracts.d.ts.map +1 -1
  253. package/core/dist/runtime/internalization/peer-runner-contracts.js +1 -1
  254. package/core/dist/runtime/internalization/peer-runner-contracts.js.map +1 -1
  255. package/core/dist/runtime/internalization/philosopher-output.d.ts +0 -8
  256. package/core/dist/runtime/internalization/philosopher-output.d.ts.map +1 -1
  257. package/core/dist/runtime/internalization/philosopher-output.js +1 -1
  258. package/core/dist/runtime/internalization/philosopher-output.js.map +1 -1
  259. package/core/dist/runtime/internalization/philosopher-prompt-builder.d.ts +3 -2
  260. package/core/dist/runtime/internalization/philosopher-prompt-builder.d.ts.map +1 -1
  261. package/core/dist/runtime/internalization/pitask-metadata.d.ts +1 -1
  262. package/core/dist/runtime/internalization/pitask-metadata.d.ts.map +1 -1
  263. package/core/dist/runtime/internalization/repair-replay-resolver.d.ts +4 -3
  264. package/core/dist/runtime/internalization/repair-replay-resolver.d.ts.map +1 -1
  265. package/core/dist/runtime/internalization/rollout-reviewer-output.d.ts +2 -3
  266. package/core/dist/runtime/internalization/rollout-reviewer-output.d.ts.map +1 -1
  267. package/core/dist/runtime/internalization/rollout-reviewer-output.js.map +1 -1
  268. package/core/dist/runtime/internalization/rollout-reviewer-prompt-builder.d.ts +0 -1
  269. package/core/dist/runtime/internalization/rollout-reviewer-prompt-builder.d.ts.map +1 -1
  270. package/core/dist/runtime/internalization/rollout-reviewer-prompt-builder.js +1 -1
  271. package/core/dist/runtime/internalization/rollout-reviewer-prompt-builder.js.map +1 -1
  272. package/core/dist/runtime/internalization/router-context-reconstruction.d.ts +3 -3
  273. package/core/dist/runtime/internalization/router-context-reconstruction.d.ts.map +1 -1
  274. package/core/dist/runtime/internalization/rule-activation-contract.d.ts +3 -2
  275. package/core/dist/runtime/internalization/rule-activation-contract.d.ts.map +1 -1
  276. package/core/dist/runtime/internalization/rule-host-input-builder.d.ts +16 -0
  277. package/core/dist/runtime/internalization/rule-host-input-builder.d.ts.map +1 -1
  278. package/core/dist/runtime/internalization/rule-host-input-builder.js +18 -0
  279. package/core/dist/runtime/internalization/rule-host-input-builder.js.map +1 -1
  280. package/core/dist/runtime/internalization/rule-reliability-validation.d.ts +13 -18
  281. package/core/dist/runtime/internalization/rule-reliability-validation.d.ts.map +1 -1
  282. package/core/dist/runtime/internalization/rule-reliability-validation.js +43 -1
  283. package/core/dist/runtime/internalization/rule-reliability-validation.js.map +1 -1
  284. package/core/dist/runtime/internalization/scribe-output.d.ts +2 -15
  285. package/core/dist/runtime/internalization/scribe-output.d.ts.map +1 -1
  286. package/core/dist/runtime/internalization/scribe-output.js +2 -2
  287. package/core/dist/runtime/internalization/scribe-output.js.map +1 -1
  288. package/core/dist/runtime/internalization/scribe-prompt-builder.d.ts +3 -3
  289. package/core/dist/runtime/internalization/scribe-prompt-builder.d.ts.map +1 -1
  290. package/core/dist/runtime/internalization/scribe-prompt-builder.js +0 -1
  291. package/core/dist/runtime/internalization/scribe-prompt-builder.js.map +1 -1
  292. package/core/dist/runtime/internalization/split-diagnostician-runner.d.ts +25 -1
  293. package/core/dist/runtime/internalization/split-diagnostician-runner.d.ts.map +1 -1
  294. package/core/dist/runtime/internalization/split-diagnostician-runner.js +122 -5
  295. package/core/dist/runtime/internalization/split-diagnostician-runner.js.map +1 -1
  296. package/core/dist/runtime/internalization/textual-basis-anchor.d.ts +3 -6
  297. package/core/dist/runtime/internalization/textual-basis-anchor.d.ts.map +1 -1
  298. package/core/dist/runtime/internalization/textual-basis-anchor.js +2 -2
  299. package/core/dist/runtime/internalization/textual-basis-anchor.js.map +1 -1
  300. package/core/dist/runtime/internalization/tool-semantic-registry.d.ts +26 -0
  301. package/core/dist/runtime/internalization/tool-semantic-registry.d.ts.map +1 -1
  302. package/core/dist/runtime/internalization/tool-semantic-registry.js +55 -5
  303. package/core/dist/runtime/internalization/tool-semantic-registry.js.map +1 -1
  304. package/core/dist/runtime/internalization-chain-integrity-read-model.d.ts.map +1 -1
  305. package/core/dist/runtime/internalization-chain-integrity-read-model.js +2 -2
  306. package/core/dist/runtime/internalization-chain-integrity-read-model.js.map +1 -1
  307. package/core/dist/runtime/internalization-integrity-remediation.d.ts.map +1 -1
  308. package/core/dist/runtime/internalization-integrity-remediation.js +2 -2
  309. package/core/dist/runtime/internalization-integrity-remediation.js.map +1 -1
  310. package/core/dist/runtime/language-directive.d.ts +2 -1
  311. package/core/dist/runtime/language-directive.d.ts.map +1 -1
  312. package/core/dist/runtime/operator-health-read-model.d.ts.map +1 -1
  313. package/core/dist/runtime/operator-health-read-model.js +2 -2
  314. package/core/dist/runtime/operator-health-read-model.js.map +1 -1
  315. package/core/dist/runtime/owner-decision/owner-decision-view-contract.d.ts +3 -29
  316. package/core/dist/runtime/owner-decision/owner-decision-view-contract.d.ts.map +1 -1
  317. package/core/dist/runtime/owner-decision/owner-decision-view-contract.js +4 -5
  318. package/core/dist/runtime/owner-decision/owner-decision-view-contract.js.map +1 -1
  319. package/core/dist/runtime/owner-decision/owner-decision-view.d.ts +0 -49
  320. package/core/dist/runtime/owner-decision/owner-decision-view.d.ts.map +1 -1
  321. package/core/dist/runtime/owner-decision/owner-decision-view.js +5 -5
  322. package/core/dist/runtime/owner-decision/owner-decision-view.js.map +1 -1
  323. package/core/dist/runtime/owner-decision/semantic-selector.d.ts +3 -2
  324. package/core/dist/runtime/owner-decision/semantic-selector.d.ts.map +1 -1
  325. package/core/dist/runtime/owner-identity.d.ts +12 -1
  326. package/core/dist/runtime/owner-identity.d.ts.map +1 -1
  327. package/core/dist/runtime/owner-identity.js +19 -1
  328. package/core/dist/runtime/owner-identity.js.map +1 -1
  329. package/core/dist/runtime/pain-ingress-payload.d.ts +0 -39
  330. package/core/dist/runtime/pain-ingress-payload.d.ts.map +1 -1
  331. package/core/dist/runtime/pain-ingress-payload.js +4 -4
  332. package/core/dist/runtime/pain-ingress-payload.js.map +1 -1
  333. package/core/dist/runtime/pain-ingress.d.ts +1 -1
  334. package/core/dist/runtime/pain-ingress.d.ts.map +1 -1
  335. package/core/dist/runtime/pain-ingress.js.map +1 -1
  336. package/core/dist/runtime/pain-recall-read-model.d.ts.map +1 -1
  337. package/core/dist/runtime/pain-recall-read-model.js +4 -3
  338. package/core/dist/runtime/pain-recall-read-model.js.map +1 -1
  339. package/core/dist/runtime/pain-signal-bridge.d.ts +0 -2
  340. package/core/dist/runtime/pain-signal-bridge.d.ts.map +1 -1
  341. package/core/dist/runtime/pain-signal-bridge.js +1 -1
  342. package/core/dist/runtime/pain-signal-bridge.js.map +1 -1
  343. package/core/dist/runtime/pain-signal-runtime-factory.d.ts +3 -3
  344. package/core/dist/runtime/pain-signal-runtime-factory.d.ts.map +1 -1
  345. package/core/dist/runtime/pain-signal-runtime-factory.js +1 -1
  346. package/core/dist/runtime/pain-signal-runtime-factory.js.map +1 -1
  347. package/core/dist/runtime/principle-reuse/reuse-proposal.d.ts +3 -2
  348. package/core/dist/runtime/principle-reuse/reuse-proposal.d.ts.map +1 -1
  349. package/core/dist/runtime/principle-reuse/reuse-retrieval.d.ts +0 -10
  350. package/core/dist/runtime/principle-reuse/reuse-retrieval.d.ts.map +1 -1
  351. package/core/dist/runtime/principle-reuse/reuse-retrieval.js +1 -1
  352. package/core/dist/runtime/principle-reuse/reuse-retrieval.js.map +1 -1
  353. package/core/dist/runtime/principle-reuse/reuse-shortlist.d.ts +1 -8
  354. package/core/dist/runtime/principle-reuse/reuse-shortlist.d.ts.map +1 -1
  355. package/core/dist/runtime/principle-reuse/reuse-shortlist.js +1 -1
  356. package/core/dist/runtime/principle-reuse/reuse-shortlist.js.map +1 -1
  357. package/core/dist/runtime/product-telemetry/snapshot-contract.d.ts +3 -2
  358. package/core/dist/runtime/product-telemetry/snapshot-contract.d.ts.map +1 -1
  359. package/core/dist/runtime/pruning-read-model.d.ts.map +1 -1
  360. package/core/dist/runtime/pruning-read-model.js +3 -2
  361. package/core/dist/runtime/pruning-read-model.js.map +1 -1
  362. package/core/dist/runtime/risk/risk-calculator-policy.d.ts +12 -2
  363. package/core/dist/runtime/risk/risk-calculator-policy.d.ts.map +1 -1
  364. package/core/dist/runtime/risk/risk-calculator-policy.js +33 -22
  365. package/core/dist/runtime/risk/risk-calculator-policy.js.map +1 -1
  366. package/core/dist/runtime/runner/base-peer-runner.d.ts +32 -0
  367. package/core/dist/runtime/runner/base-peer-runner.d.ts.map +1 -1
  368. package/core/dist/runtime/runner/base-peer-runner.js +168 -16
  369. package/core/dist/runtime/runner/base-peer-runner.js.map +1 -1
  370. package/core/dist/runtime/runner/default-validator.d.ts +0 -1
  371. package/core/dist/runtime/runner/default-validator.d.ts.map +1 -1
  372. package/core/dist/runtime/runner/default-validator.js +11 -3
  373. package/core/dist/runtime/runner/default-validator.js.map +1 -1
  374. package/core/dist/runtime/runner/peer-runner-types.d.ts +11 -0
  375. package/core/dist/runtime/runner/peer-runner-types.d.ts.map +1 -1
  376. package/core/dist/runtime/schema-conformance-read-model.js +2 -2
  377. package/core/dist/runtime/schema-conformance-read-model.js.map +1 -1
  378. package/core/dist/runtime/storage-paths.d.ts +15 -0
  379. package/core/dist/runtime/storage-paths.d.ts.map +1 -0
  380. package/core/dist/runtime/storage-paths.js +15 -0
  381. package/core/dist/runtime/storage-paths.js.map +1 -0
  382. package/core/dist/runtime/store/artifact/index.d.ts +1 -1
  383. package/core/dist/runtime/store/artifact/index.d.ts.map +1 -1
  384. package/core/dist/runtime/store/candidate/admission-document.d.ts +4 -3
  385. package/core/dist/runtime/store/candidate/admission-document.d.ts.map +1 -1
  386. package/core/dist/runtime/store/commit/index.d.ts +0 -1
  387. package/core/dist/runtime/store/commit/index.d.ts.map +1 -1
  388. package/core/dist/runtime/store/commit/index.js.map +1 -1
  389. package/core/dist/runtime/store/design-gate/sqlite-design-gate-store.d.ts +4 -3
  390. package/core/dist/runtime/store/design-gate/sqlite-design-gate-store.d.ts.map +1 -1
  391. package/core/dist/runtime/store/lifecycle/lease-manager.d.ts +2 -1
  392. package/core/dist/runtime/store/lifecycle/lease-manager.d.ts.map +1 -1
  393. package/core/dist/runtime/store/runtime-state-manager.d.ts +1 -2
  394. package/core/dist/runtime/store/runtime-state-manager.d.ts.map +1 -1
  395. package/core/dist/runtime/store/runtime-state-manager.js.map +1 -1
  396. package/core/dist/runtime/store/sqlite-connection.d.ts +2 -6
  397. package/core/dist/runtime/store/sqlite-connection.d.ts.map +1 -1
  398. package/core/dist/runtime/store/sqlite-connection.js +4 -12
  399. package/core/dist/runtime/store/sqlite-connection.js.map +1 -1
  400. package/core/dist/runtime/store/storage-paths.d.ts +17 -0
  401. package/core/dist/runtime/store/storage-paths.d.ts.map +1 -0
  402. package/core/dist/runtime/store/storage-paths.js +52 -0
  403. package/core/dist/runtime/store/storage-paths.js.map +1 -0
  404. package/core/dist/runtime/store/task/sqlite-family-reopen.d.ts +2 -1
  405. package/core/dist/runtime/store/task/sqlite-family-reopen.d.ts.map +1 -1
  406. package/core/dist/runtime/store/task/sqlite-task-store.d.ts +2 -1
  407. package/core/dist/runtime/store/task/sqlite-task-store.d.ts.map +1 -1
  408. package/core/dist/runtime/story-a-demo.d.ts.map +1 -1
  409. package/core/dist/runtime/story-a-demo.js +4 -1
  410. package/core/dist/runtime/story-a-demo.js.map +1 -1
  411. package/core/dist/runtime/tools/agent-tool-contract.d.ts +1 -2
  412. package/core/dist/runtime/tools/agent-tool-contract.d.ts.map +1 -1
  413. package/core/dist/runtime/tools/agent-tool-contract.js +0 -2
  414. package/core/dist/runtime/tools/agent-tool-contract.js.map +1 -1
  415. package/core/dist/runtime/tools/artificer-l2-tool-contract.d.ts +0 -2
  416. package/core/dist/runtime/tools/artificer-l2-tool-contract.d.ts.map +1 -1
  417. package/core/dist/runtime/tools/artificer-l2-tool-contract.js +0 -2
  418. package/core/dist/runtime/tools/artificer-l2-tool-contract.js.map +1 -1
  419. package/core/dist/runtime/trajectory-retention.d.ts +257 -0
  420. package/core/dist/runtime/trajectory-retention.d.ts.map +1 -0
  421. package/core/dist/runtime/trajectory-retention.js +598 -0
  422. package/core/dist/runtime/trajectory-retention.js.map +1 -0
  423. package/core/dist/runtime/types/event-payload.d.ts +0 -2
  424. package/core/dist/runtime/types/event-payload.d.ts.map +1 -1
  425. package/core/dist/runtime/types/event-payload.js.map +1 -1
  426. package/core/dist/runtime/types/evidence-chain-contract.d.ts +66 -2
  427. package/core/dist/runtime/types/evidence-chain-contract.d.ts.map +1 -1
  428. package/core/dist/runtime/types/evidence-chain-contract.js +69 -4
  429. package/core/dist/runtime/types/evidence-chain-contract.js.map +1 -1
  430. package/core/dist/runtime/types/hygiene-types.d.ts +0 -6
  431. package/core/dist/runtime/types/hygiene-types.d.ts.map +1 -1
  432. package/core/dist/runtime/types/hygiene-types.js.map +1 -1
  433. package/core/dist/runtime/types/index.d.ts +1 -1
  434. package/core/dist/runtime/types/index.d.ts.map +1 -1
  435. package/core/dist/runtime/types/index.js.map +1 -1
  436. package/core/dist/runtime/types/intervention-evidence-contract.d.ts +5 -5
  437. package/core/dist/runtime/types/intervention-evidence-contract.d.ts.map +1 -1
  438. package/core/dist/runtime/types/intervention-evidence-contract.js +0 -2
  439. package/core/dist/runtime/types/intervention-evidence-contract.js.map +1 -1
  440. package/core/dist/runtime/types/principle-dependency.d.ts +0 -2
  441. package/core/dist/runtime/types/principle-dependency.d.ts.map +1 -1
  442. package/core/dist/runtime/types/principle-dependency.js.map +1 -1
  443. package/core/dist/runtime/types/principle-lifecycle-event.d.ts +0 -2
  444. package/core/dist/runtime/types/principle-lifecycle-event.d.ts.map +1 -1
  445. package/core/dist/runtime/types/principle-lifecycle-event.js.map +1 -1
  446. package/core/dist/runtime/types/principle-schema.d.ts +0 -26
  447. package/core/dist/runtime/types/principle-schema.d.ts.map +1 -1
  448. package/core/dist/runtime/types/principle-schema.js +2 -2
  449. package/core/dist/runtime/types/principle-schema.js.map +1 -1
  450. package/core/dist/runtime/types/principle-tree-store.d.ts +0 -2
  451. package/core/dist/runtime/types/principle-tree-store.d.ts.map +1 -1
  452. package/core/dist/runtime/types/principle-tree-store.js.map +1 -1
  453. package/core/dist/runtime/types/principle-value-metrics.d.ts +0 -2
  454. package/core/dist/runtime/types/principle-value-metrics.d.ts.map +1 -1
  455. package/core/dist/runtime/types/principle-value-metrics.js.map +1 -1
  456. package/core/dist/runtime/types/rule-candidate-binding.d.ts +2 -1
  457. package/core/dist/runtime/types/rule-candidate-binding.d.ts.map +1 -1
  458. package/core/dist/telemetry-event.d.ts +2 -2
  459. package/core/dist/telemetry-event.d.ts.map +1 -1
  460. package/core/dist/telemetry-event.js +11 -0
  461. package/core/dist/telemetry-event.js.map +1 -1
  462. package/core/dist/trajectory-store.d.ts +9 -9
  463. package/core/dist/trajectory-store.d.ts.map +1 -1
  464. package/core/dist/trajectory-store.js +9 -12
  465. package/core/dist/trajectory-store.js.map +1 -1
  466. package/core/package.json +5 -1
  467. package/dist/installers/codex-host-installer.d.ts +9 -0
  468. package/dist/installers/codex-host-installer.d.ts.map +1 -1
  469. package/dist/installers/codex-host-installer.js +127 -6
  470. package/dist/installers/codex-host-installer.js.map +1 -1
  471. package/dist/installers/mcp-binding-shape-mirror.d.ts +27 -0
  472. package/dist/installers/mcp-binding-shape-mirror.d.ts.map +1 -0
  473. package/dist/installers/mcp-binding-shape-mirror.js +105 -0
  474. package/dist/installers/mcp-binding-shape-mirror.js.map +1 -0
  475. package/dist/skill-catalog.d.ts +35 -0
  476. package/dist/skill-catalog.d.ts.map +1 -0
  477. package/dist/skill-catalog.js +85 -0
  478. package/dist/skill-catalog.js.map +1 -0
  479. package/dist/skill-delivery-parity.d.ts +22 -0
  480. package/dist/skill-delivery-parity.d.ts.map +1 -0
  481. package/dist/skill-delivery-parity.js +31 -0
  482. package/dist/skill-delivery-parity.js.map +1 -0
  483. package/dist/update/product-identity.d.ts.map +1 -1
  484. package/dist/update/product-identity.js +5 -1
  485. package/dist/update/product-identity.js.map +1 -1
  486. package/host-runtime/dist/active-principle-prompt.d.ts +13 -0
  487. package/host-runtime/dist/active-principle-prompt.js +87 -10
  488. package/host-runtime/dist/adaptive-decision-protocol.d.ts +129 -0
  489. package/host-runtime/dist/adaptive-decision-protocol.js +176 -0
  490. package/host-runtime/dist/adaptive-priority-provider.d.ts +38 -13
  491. package/host-runtime/dist/adaptive-priority-provider.js +70 -66
  492. package/host-runtime/dist/adaptive-selection.d.ts +71 -64
  493. package/host-runtime/dist/adaptive-selection.js +220 -329
  494. package/host-runtime/dist/adaptive-skip-decision.d.ts +26 -14
  495. package/host-runtime/dist/adaptive-skip-decision.js +33 -29
  496. package/host-runtime/dist/codex-disclosure.d.ts +12 -7
  497. package/host-runtime/dist/codex-disclosure.js +12 -7
  498. package/host-runtime/dist/codex-rule-context-provider.js +4 -1
  499. package/host-runtime/dist/conversation-ingestion/pipeline.d.ts +8 -0
  500. package/host-runtime/dist/conversation-ingestion/pipeline.js +6 -1
  501. package/host-runtime/dist/conversation-ingestion/text-policy.d.ts +3 -4
  502. package/host-runtime/dist/conversation-ingestion/text-policy.js +3 -4
  503. package/host-runtime/dist/governance-observation-store.d.ts +73 -1
  504. package/host-runtime/dist/governance-observation-store.js +251 -14
  505. package/host-runtime/dist/governance-signal-admission.d.ts +19 -3
  506. package/host-runtime/dist/governance-signal-admission.js +12 -4
  507. package/host-runtime/dist/host-tool-declaration.d.ts +18 -2
  508. package/host-runtime/dist/host-tool-declaration.js +67 -11
  509. package/host-runtime/dist/host-tool-semantic-resolver.d.ts +7 -0
  510. package/host-runtime/dist/host-tool-semantic-resolver.js +22 -2
  511. package/host-runtime/dist/index.d.ts +3 -0
  512. package/host-runtime/dist/index.js +17 -0
  513. package/host-runtime/dist/production-rulehost-gate.d.ts +36 -1
  514. package/host-runtime/dist/production-rulehost-gate.js +106 -4
  515. package/host-runtime/dist/trajectory-retention.d.ts +147 -0
  516. package/host-runtime/dist/trajectory-retention.js +907 -0
  517. package/host-runtime/package.json +1 -1
  518. package/install-layout/dist/index.d.ts +9 -2
  519. package/install-layout/dist/index.js +26 -9
  520. package/install-layout/dist/mcp-binding-contract.d.ts +91 -0
  521. package/install-layout/dist/mcp-binding-contract.js +230 -0
  522. package/install-layout/package.json +1 -1
  523. package/package.json +4 -4
  524. package/pd-cli/dist/commands/build-trajectory-evidence.d.ts.map +1 -1
  525. package/pd-cli/dist/commands/build-trajectory-evidence.js +17 -11
  526. package/pd-cli/dist/commands/build-trajectory-evidence.js.map +1 -1
  527. package/pd-cli/dist/commands/codex-reconcile.d.ts +7 -0
  528. package/pd-cli/dist/commands/codex-reconcile.d.ts.map +1 -1
  529. package/pd-cli/dist/commands/codex-reconcile.js +11 -2
  530. package/pd-cli/dist/commands/codex-reconcile.js.map +1 -1
  531. package/pd-cli/dist/commands/codex-worker.d.ts.map +1 -1
  532. package/pd-cli/dist/commands/codex-worker.js +35 -0
  533. package/pd-cli/dist/commands/codex-worker.js.map +1 -1
  534. package/pd-cli/dist/commands/command-helpers.d.ts +1 -1
  535. package/pd-cli/dist/commands/command-helpers.js +1 -1
  536. package/pd-cli/dist/commands/diagnose.js +1 -1
  537. package/pd-cli/dist/commands/diagnose.js.map +1 -1
  538. package/pd-cli/dist/commands/errors-list.d.ts +1 -1
  539. package/pd-cli/dist/commands/errors-list.js +1 -1
  540. package/pd-cli/dist/commands/health-ingestion.d.ts +96 -0
  541. package/pd-cli/dist/commands/health-ingestion.d.ts.map +1 -0
  542. package/pd-cli/dist/commands/health-ingestion.js +473 -0
  543. package/pd-cli/dist/commands/health-ingestion.js.map +1 -0
  544. package/pd-cli/dist/commands/health-mcp.d.ts +23 -1
  545. package/pd-cli/dist/commands/health-mcp.d.ts.map +1 -1
  546. package/pd-cli/dist/commands/health-mcp.js +81 -22
  547. package/pd-cli/dist/commands/health-mcp.js.map +1 -1
  548. package/pd-cli/dist/commands/health.d.ts +1 -1
  549. package/pd-cli/dist/commands/health.d.ts.map +1 -1
  550. package/pd-cli/dist/commands/health.js +22 -5
  551. package/pd-cli/dist/commands/health.js.map +1 -1
  552. package/pd-cli/dist/commands/principles-stats.d.ts +1 -1
  553. package/pd-cli/dist/commands/principles-stats.js +1 -1
  554. package/pd-cli/dist/commands/trajectory-retention.d.ts +23 -0
  555. package/pd-cli/dist/commands/trajectory-retention.d.ts.map +1 -0
  556. package/pd-cli/dist/commands/trajectory-retention.js +159 -0
  557. package/pd-cli/dist/commands/trajectory-retention.js.map +1 -0
  558. package/pd-cli/dist/commands/workbuddy-setup.d.ts +69 -0
  559. package/pd-cli/dist/commands/workbuddy-setup.d.ts.map +1 -0
  560. package/pd-cli/dist/commands/workbuddy-setup.js +379 -0
  561. package/pd-cli/dist/commands/workbuddy-setup.js.map +1 -0
  562. package/pd-cli/dist/commands/workbuddy-worker.d.ts.map +1 -1
  563. package/pd-cli/dist/commands/workbuddy-worker.js +42 -6
  564. package/pd-cli/dist/commands/workbuddy-worker.js.map +1 -1
  565. package/pd-cli/dist/index.d.ts +1 -7
  566. package/pd-cli/dist/index.d.ts.map +1 -1
  567. package/pd-cli/dist/index.js +15 -1201
  568. package/pd-cli/dist/index.js.map +1 -1
  569. package/pd-cli/dist/program.d.ts +17 -0
  570. package/pd-cli/dist/program.d.ts.map +1 -0
  571. package/pd-cli/dist/program.js +1263 -0
  572. package/pd-cli/dist/program.js.map +1 -0
  573. package/pd-cli/dist/services/delivery-surfaces.d.ts.map +1 -1
  574. package/pd-cli/dist/services/delivery-surfaces.js +7 -5
  575. package/pd-cli/dist/services/delivery-surfaces.js.map +1 -1
  576. package/pd-cli/dist/services/demo-story-a-runner.js +1 -1
  577. package/pd-cli/dist/services/demo-story-a-runner.js.map +1 -1
  578. package/pd-cli/dist/services/version-report.d.ts.map +1 -1
  579. package/pd-cli/dist/services/version-report.js +35 -5
  580. package/pd-cli/dist/services/version-report.js.map +1 -1
  581. package/pd-cli/package.json +1 -1
  582. package/pd-mcp-server/dist/version.d.ts +1 -1
  583. package/pd-mcp-server/dist/version.js +1 -1
  584. package/pd-mcp-server/package.json +3 -1
  585. package/plugin/dist/bundle.js +529 -468
  586. package/plugin/dist/constants/tools.d.ts +8 -1
  587. package/plugin/dist/core/experiment-workspace-guard.d.ts +25 -0
  588. package/plugin/dist/core/trajectory-retention-trigger.d.ts +13 -0
  589. package/plugin/dist/core/trajectory.d.ts +14 -0
  590. package/plugin/dist/hooks/gate-block-helper.d.ts +17 -0
  591. package/plugin/dist/hooks/gate.d.ts +6 -1
  592. package/plugin/dist/host-runtime/openclaw-host-runtime.d.ts +1 -0
  593. package/plugin/dist/index.d.ts +5 -0
  594. package/plugin/dist/openclaw.plugin.json +1 -1
  595. package/plugin/dist/rulehost-evidence.js +29 -23
  596. package/plugin/dist/templates/langs/en/skills/pd-cli-operator/SKILL.md +16 -5
  597. package/plugin/dist/templates/langs/en/skills/pd-control/SKILL.md +7 -6
  598. package/plugin/dist/templates/langs/en/skills/pd-pain-signal/SKILL.md +141 -28
  599. package/plugin/dist/templates/langs/en/skills/pd-review/SKILL.md +15 -1
  600. package/plugin/dist/templates/langs/zh/skills/pd-cli-operator/SKILL.md +16 -5
  601. package/plugin/dist/templates/langs/zh/skills/pd-control/SKILL.md +7 -6
  602. package/plugin/dist/templates/langs/zh/skills/pd-pain-signal/SKILL.md +142 -29
  603. package/plugin/dist/templates/langs/zh/skills/pd-review/SKILL.md +15 -1
  604. package/plugin/openclaw.plugin.json +1 -1
  605. package/plugin/package.json +1 -1
  606. package/plugin/templates/langs/en/skills/pd-cli-operator/SKILL.md +16 -5
  607. package/plugin/templates/langs/en/skills/pd-control/SKILL.md +7 -6
  608. package/plugin/templates/langs/en/skills/pd-pain-signal/SKILL.md +141 -28
  609. package/plugin/templates/langs/en/skills/pd-review/SKILL.md +15 -1
  610. package/plugin/templates/langs/zh/skills/pd-cli-operator/SKILL.md +16 -5
  611. package/plugin/templates/langs/zh/skills/pd-control/SKILL.md +7 -6
  612. package/plugin/templates/langs/zh/skills/pd-pain-signal/SKILL.md +142 -29
  613. package/plugin/templates/langs/zh/skills/pd-review/SKILL.md +15 -1
  614. package/release-manager/dist/installers/codex-host-installer.js +127 -6
  615. package/release-manager/dist/installers/mcp-binding-shape-mirror.js +105 -0
  616. package/release-manager/dist/update/product-identity.js +5 -1
  617. package/release-manager/package.json +1 -1
  618. package/workbuddy-adapter/dist/codec/input-decoder.d.ts +10 -0
  619. package/workbuddy-adapter/dist/codec/input-decoder.js +62 -5
  620. package/workbuddy-adapter/dist/host-adapter.js +1 -0
  621. package/workbuddy-adapter/dist/index.d.ts +1 -0
  622. package/workbuddy-adapter/dist/index.js +1 -0
  623. package/workbuddy-adapter/dist/ingestion/catch-up.d.ts +36 -0
  624. package/workbuddy-adapter/dist/ingestion/catch-up.js +166 -0
  625. package/workbuddy-adapter/dist/ingestion/encode-cwd.d.ts +6 -0
  626. package/workbuddy-adapter/dist/ingestion/encode-cwd.js +39 -0
  627. package/workbuddy-adapter/dist/ingestion/index.d.ts +13 -0
  628. package/workbuddy-adapter/dist/ingestion/index.js +13 -0
  629. package/workbuddy-adapter/dist/ingestion/ingestion.d.ts +46 -0
  630. package/workbuddy-adapter/dist/ingestion/ingestion.js +135 -0
  631. package/workbuddy-adapter/dist/ingestion/transcript-decoder.d.ts +70 -0
  632. package/workbuddy-adapter/dist/ingestion/transcript-decoder.js +554 -0
  633. package/workbuddy-adapter/dist/ingestion/transcript-path.d.ts +39 -0
  634. package/workbuddy-adapter/dist/ingestion/transcript-path.js +117 -0
  635. package/workbuddy-adapter/dist/ingestion/transcript-source.d.ts +15 -0
  636. package/workbuddy-adapter/dist/ingestion/transcript-source.js +152 -0
  637. package/workbuddy-adapter/dist/pd-hook.d.ts +8 -0
  638. package/workbuddy-adapter/dist/pd-hook.js +59 -2
  639. package/workbuddy-adapter/dist/worker/workspace-worker.d.ts +9 -0
  640. package/workbuddy-adapter/dist/worker/workspace-worker.js +46 -17
  641. package/workbuddy-adapter/package.json +1 -1
  642. package/workbuddy-adapter/plugin/hooks/hooks.json +11 -0
  643. package/workbuddy-adapter/plugin/skills/pd-cli-operator/SKILL.md +57 -19
  644. package/workbuddy-adapter/plugin/skills/pd-control/SKILL.md +21 -9
  645. package/workbuddy-adapter/plugin/skills/pd-pain-signal/SKILL.md +72 -61
  646. package/workbuddy-adapter/plugin/skills/pd-review/SKILL.md +27 -12
@@ -49,6 +49,22 @@ function mergeDeclarations(declarations) {
49
49
  nextAction: 'each raw tool name must resolve to one canonical kind across all co-installed hosts — fix the conflicting host declaration',
50
50
  };
51
51
  }
52
+ // ADR-0030: the payload encoding is part of the same identity. Two hosts
53
+ // claiming the same write tool with different encodings cannot both be
54
+ // right, and picking by startup order would make parsing order-dependent.
55
+ //
56
+ // An ABSENT format is a claim of plain content, not "no opinion": with a
57
+ // single-value enum this is the only reading under which the guard can
58
+ // fire, so "host A omits / host B declares the patch envelope" is a real
59
+ // disagreement (fail loud) rather than silently resolved drift. The fix
60
+ // belongs in the host declaration, never here.
61
+ if (existing && existing.writePayloadFormat !== mapping.writePayloadFormat) {
62
+ return {
63
+ ok: false,
64
+ reason: `host_tool_declaration_invalid (conflicting writePayloadFormat for '${mapping.rawToolName}': ${existing.writePayloadFormat ?? 'unset'} vs ${mapping.writePayloadFormat ?? 'unset'})`,
65
+ nextAction: 'each raw tool name must resolve to one write payload format across all co-installed hosts — fix the conflicting host declaration',
66
+ };
67
+ }
52
68
  if (!existing)
53
69
  mappings.push(mapping);
54
70
  }
@@ -81,6 +97,7 @@ export function resolveWorkspaceHostToolSemantics(workspaceDir) {
81
97
  ok: true,
82
98
  registry: built.registry,
83
99
  hostKinds: loaded.declarations.map((d) => d.hostKind).sort(),
100
+ warnings: loaded.warnings,
84
101
  };
85
102
  }
86
103
  /**
@@ -101,6 +118,9 @@ export function resolveWorkspaceHostToolSemantics(workspaceDir) {
101
118
  * - malformed / conflicting declaration → typed refusal, never a silent
102
119
  * static fallback and never an empty registry. Consumers must surface the
103
120
  * reason (rc-9) and may fall back to their static registry for availability.
121
+ * - legacy declaration version (v1 read by a v2 build) → NOT a refusal: the
122
+ * file is read with v1 semantics (`writePayloadFormat` unset) and the
123
+ * result carries `warnings`, which consumers must surface (rc-9).
104
124
  */
105
125
  export function resolveHostToolSemanticsForHook(options) {
106
126
  const builtStatic = buildToolSemanticRegistry(options.staticMappings);
@@ -114,7 +134,7 @@ export function resolveHostToolSemanticsForHook(options) {
114
134
  const loaded = loadHostToolDeclarations(options.workspaceDir);
115
135
  if (!loaded.ok) {
116
136
  if (loaded.reason === 'host_tool_declaration_missing') {
117
- return { ok: true, registry: builtStatic.registry, source: 'host-static' };
137
+ return { ok: true, registry: builtStatic.registry, source: 'host-static', warnings: [] };
118
138
  }
119
139
  return { ok: false, reason: loaded.reason, nextAction: loaded.nextAction };
120
140
  }
@@ -134,6 +154,6 @@ export function resolveHostToolSemanticsForHook(options) {
134
154
  nextAction: `merged tool mappings invalid: ${built.errors.slice(0, 3).join('; ')}`,
135
155
  };
136
156
  }
137
- return { ok: true, registry: built.registry, source: 'workspace-declaration' };
157
+ return { ok: true, registry: built.registry, source: 'workspace-declaration', warnings: loaded.warnings };
138
158
  }
139
159
  export { saveHostToolDeclaration };
@@ -1,4 +1,5 @@
1
1
  import { type HostEvent, type HostEventResult, type HostEventEmitter } from '@principles/core/host';
2
+ import type { AdaptivePriorityProvider } from './adaptive-priority-provider.js';
2
3
  import { buildActivePrinciplePromptContext } from './active-principle-prompt.js';
3
4
  import { type RuleContextProvider, type RuleInputEnrichmentProvider } from './production-rulehost-gate.js';
4
5
  import type { RuleImplementationRuntime } from './rule-implementation-runtime.js';
@@ -17,6 +18,7 @@ export * from './production-rulehost-gate.js';
17
18
  export * from './rule-implementation-runtime.js';
18
19
  export * from './production-pain-evidence.js';
19
20
  export * from './governance-observation-store.js';
21
+ export * from './trajectory-retention.js';
20
22
  export * from './conversation-ingestion/index.js';
21
23
  export * from './governance-signal-admission.js';
22
24
  export * from './signal-classifier.js';
@@ -92,6 +94,7 @@ export declare function createProductionHostRuntime(options?: Partial<Pick<HostR
92
94
  * before this convergence. Must be a positive integer when present.
93
95
  */
94
96
  roundKeyProvider?: (event: HostEvent) => number | undefined | Promise<number | undefined>;
97
+ adaptiveGapProvider?: AdaptivePriorityProvider;
95
98
  /** Optional, already-scoped single prompt target from the host adapter. Errors fail closed to Native. */
96
99
  adaptivePriorityProvider?: (event: HostEvent) => {
97
100
  artifactId: string;
@@ -29,6 +29,10 @@ export * from './production-rulehost-gate.js';
29
29
  export * from './rule-implementation-runtime.js';
30
30
  export * from './production-pain-evidence.js';
31
31
  export * from './governance-observation-store.js';
32
+ // SPEC-PD-TR-001: trajectory retention I/O boundary (lock + marker + export
33
+ // list + explicit VACUUM). The policy/batch engine is pure and lives in
34
+ // `@principles/core/runtime`.
35
+ export * from './trajectory-retention.js';
32
36
  // PRI-1171: unified conversation-ingestion seam — the ONE host-neutral entry
33
37
  // for transcript trajectory ingestion (source contract + shared pipeline +
34
38
  // consent ledger v3 + text policy). Host decoders stay in their adapter
@@ -279,6 +283,16 @@ export function createProductionHostRuntime(options = {}) {
279
283
  const prompt = await buildActivePrinciplePromptContext({
280
284
  workspaceDir: event.context.workspaceDir,
281
285
  ...(roundKey !== undefined ? { roundKey } : {}),
286
+ ...(options.adaptiveGapProvider ? {
287
+ async selectNativeGap(candidates, gapOptions) {
288
+ try {
289
+ return await options.adaptiveGapProvider?.(event, candidates, gapOptions);
290
+ }
291
+ catch {
292
+ return undefined;
293
+ }
294
+ },
295
+ } : {}),
282
296
  ...(adaptivePriority ? {
283
297
  adaptivePriority: { artifactId: adaptivePriority.artifactId, activationId: adaptivePriority.activationId },
284
298
  ...(adaptivePriority.additiveOnly === true ? { additiveOnly: true } : {}),
@@ -323,6 +337,9 @@ export function createProductionHostRuntime(options = {}) {
323
337
  // failure must not block the prompt result — it degrades to an
324
338
  // observable warning (rc-9).
325
339
  const emissionWarnings = [];
340
+ if (prompt.adaptivePacking?.source === 'native_gap' && prompt.adaptivePacking.status === 'unavailable') {
341
+ emissionWarnings.push(`adaptive_assembly_unavailable:${prompt.adaptivePacking.reason}`);
342
+ }
326
343
  try {
327
344
  options.events?.recordRuntimeActivationsInjected({
328
345
  sessionId: event.context.sessionId,
@@ -1,4 +1,4 @@
1
- import { type ToolSemanticRegistry, type GovernanceHostKind } from '@principles/core/runtime';
1
+ import { type RuleHostResult, type ToolSemanticRegistry, type GovernanceHostKind } from '@principles/core/runtime';
2
2
  import type { HostEvent, HostEventResult } from '@principles/core/host';
3
3
  import { type RuleImplementationRuntime } from './rule-implementation-runtime.js';
4
4
  export interface ProductionRuleContextRequest {
@@ -29,5 +29,40 @@ export interface ProductionRuleHostGateOptions {
29
29
  * (shell/cmd/insert/patch/delete_file/move_file were never hinted).
30
30
  */
31
31
  toolSemantics?: ToolSemanticRegistry;
32
+ /**
33
+ * PRI-1187: observation-only signal for the accepted "over-block" tradeoff.
34
+ *
35
+ * When a rule declares `affectedTools` and the current action family is NOT
36
+ * in that declaration, the rule is still evaluated (never skipped). This
37
+ * sink records one structured event per such evaluation so we can measure
38
+ * how much over-blocking exists and which rules cause it.
39
+ *
40
+ * Defaults ON. Silence it with `{ enabled: false }` or the environment
41
+ * variable `PD_AFFECTED_TOOLS_OBSERVABILITY=0`. The sink is called inside a
42
+ * try/catch and can never alter the decision.
43
+ */
44
+ affectedToolsObservability?: AffectedToolsObservabilityOptions;
45
+ }
46
+ /** One observation-only "declared scope does not cover the action" record. */
47
+ export interface AffectedToolsMismatchEvent {
48
+ ruleId: string;
49
+ activationId: string;
50
+ activationMode: 'live' | 'shadow';
51
+ toolName: string;
52
+ /** Action family resolved by the ToolSemanticRegistry (write/execute/agent…). */
53
+ actionFamily: string;
54
+ /** Raw declaration, verbatim from the artifact. */
55
+ declaredTools: string[];
56
+ /** Resolved families of `declaredTools` (never empty when emitted). */
57
+ declaredFamilies: string[];
58
+ /** The rule's own decision for this call (not the merged verdict). */
59
+ decision: RuleHostResult['decision'];
60
+ hostKind?: GovernanceHostKind;
61
+ }
62
+ export interface AffectedToolsObservabilityOptions {
63
+ /** Defaults to `PD_AFFECTED_TOOLS_OBSERVABILITY !== '0' | 'false' | 'off'`. */
64
+ enabled?: boolean;
65
+ /** Defaults to one structured JSON line on `console.warn`. */
66
+ sink?: (event: AffectedToolsMismatchEvent) => void;
32
67
  }
33
68
  export declare function createProductionRuleHostGate(options?: ProductionRuleHostGateOptions): (event: HostEvent) => Promise<HostEventResult>;
@@ -1,7 +1,7 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import { buildRuleHostAction, buildToolSemanticRegistry, deriveToolHintsFromCanonicalKind, estimateLineChanges, mergeDecisions, normalizeRuleHostResult, SqliteConnection, UNAVAILABLE_RULE_CONTEXT, validateRuleContextV2, verifyPiArtifactRowDigest, RECOVERY_CONTROL_SURFACES, } from '@principles/core/runtime';
4
- import { isSensitiveSystemPath } from '@principles/core/runtime/internalization/rule-host-input-builder';
4
+ import { isRuleHostEvaluableKind, isSensitiveSystemPath } from '@principles/core/runtime/internalization/rule-host-input-builder';
5
5
  import { classifyBashRisk } from '@principles/core/runtime/internalization/bash-risk';
6
6
  import { scanRetiredContractSymbols } from './legacy-rule-contract-symbols.js';
7
7
  import { recordDegradedEnforcement } from './degraded-enforcement-marker.js';
@@ -10,6 +10,27 @@ const WARNING_LIMIT = 500;
10
10
  const MAX_WARNINGS = 16;
11
11
  const GATE_DEADLINE_MS = 3_000;
12
12
  const ARTIFACT_CONTENT_BYTES = 512 * 1024;
13
+ /**
14
+ * Production RuleHost gate — the shared decision path for every supported host.
15
+ *
16
+ * PRI-1187 (Owner decision 2026-11-12): rules are NEVER filtered by
17
+ * `affectedTools`. Over-blocking (a write-only rule also observing exec) is
18
+ * accepted noise; under-blocking is not. `affectedTools` is the DECLARED
19
+ * SCOPE used by activation (`validateRuleReliability`: golden-trace tool
20
+ * families must be a subset of the declared families) and by approval/audit
21
+ * surfaces — it is NOT an execution bound.
22
+ *
23
+ * DO NOT re-add a runtime filter here. Three review rounds each found a way to
24
+ * skip a call the rule was validated to block: the reserved `host-liveness:`
25
+ * prefix, a narrow declaration with a broad implementation, and a guard that
26
+ * only inspected the golden trace. The decision and the follow-up ticket live
27
+ * in docs/proposals/PRI-1187-write-only-rule-exec-false-positive.md.
28
+ *
29
+ * The only affectedTools runtime code allowed in this file is the
30
+ * observation-only mismatch signal below: it logs, it never changes the
31
+ * evaluation set or the verdict.
32
+ */
33
+ const AFFECTED_TOOLS_OBSERVABILITY_ENV = 'PD_AFFECTED_TOOLS_OBSERVABILITY';
13
34
  // Check the actual imported builder, not an installed-package version string:
14
35
  // a mixed host-runtime/core deployment must not claim input-v2 support.
15
36
  const RECOVERY_INPUT_V2_AVAILABLE = RECOVERY_CONTROL_SURFACES
@@ -82,9 +103,73 @@ if (!baselineToolSemanticsResult.ok) {
82
103
  throw new Error(`baseline tool semantic registry failed to build: ${baselineToolSemanticsResult.errors.join('; ')}`);
83
104
  }
84
105
  const BASELINE_TOOL_SEMANTICS = baselineToolSemanticsResult.registry;
106
+ /**
107
+ * Resolve a rule's declared scope for OBSERVATION ONLY.
108
+ *
109
+ * Returns `null` when the declaration cannot prove a mismatch (absent, not an
110
+ * array, empty, malformed entry, or a name the registry cannot classify). A
111
+ * `null` declaration therefore emits nothing — the signal must never guess,
112
+ * because a false positive would misdirect the follow-up work that decides
113
+ * whether the no-filter tradeoff stays.
114
+ */
115
+ function resolveDeclaredFamilies(affectedTools, toolSemantics) {
116
+ if (!Array.isArray(affectedTools) || affectedTools.length === 0)
117
+ return null;
118
+ const tools = [];
119
+ const families = new Set();
120
+ for (const declared of affectedTools) {
121
+ if (typeof declared !== 'string' || declared.trim().length === 0)
122
+ return null;
123
+ const kind = toolSemantics.lookup(declared);
124
+ if (kind === null)
125
+ return null;
126
+ tools.push(declared);
127
+ families.add(kind);
128
+ }
129
+ return families.size === 0 ? null : { tools, families: [...families] };
130
+ }
131
+ function affectedToolsObservabilityDisabledByEnv() {
132
+ const raw = process.env[AFFECTED_TOOLS_OBSERVABILITY_ENV]?.trim().toLowerCase();
133
+ return raw === '0' || raw === 'false' || raw === 'off';
134
+ }
135
+ function defaultAffectedToolsSink(event) {
136
+ console.warn(`[PD:RuleHost] affected_tools_mismatch ${JSON.stringify(event)}`);
137
+ }
85
138
  export function createProductionRuleHostGate(options = {}) {
86
139
  const implementationRuntime = options.implementationRuntime ?? createNodeRuleImplementationRuntime();
87
140
  const toolSemantics = options.toolSemantics ?? BASELINE_TOOL_SEMANTICS;
141
+ const observabilityEnabled = options.affectedToolsObservability?.enabled
142
+ ?? !affectedToolsObservabilityDisabledByEnv();
143
+ const observabilitySink = options.affectedToolsObservability?.sink ?? defaultAffectedToolsSink;
144
+ /**
145
+ * PRI-1187 observation-only: record that a declared scope did not cover the
146
+ * action while the rule was still evaluated. MUST NOT skip, reorder, or
147
+ * mutate anything. Sink failures are swallowed for the same reason.
148
+ */
149
+ const emitAffectedToolsMismatch = (candidate, observation) => {
150
+ if (!observabilityEnabled)
151
+ return;
152
+ if (candidate.declaredTools === null || candidate.declaredFamilies === null)
153
+ return;
154
+ if (candidate.declaredFamilies.includes(observation.actionFamily))
155
+ return;
156
+ try {
157
+ observabilitySink({
158
+ ruleId: candidate.ruleId,
159
+ activationId: candidate.implId,
160
+ activationMode: candidate.activationMode,
161
+ toolName: observation.toolName,
162
+ actionFamily: observation.actionFamily,
163
+ declaredTools: candidate.declaredTools,
164
+ declaredFamilies: candidate.declaredFamilies,
165
+ decision: observation.decision,
166
+ ...(options.hostKind !== undefined ? { hostKind: options.hostKind } : {}),
167
+ });
168
+ }
169
+ catch {
170
+ // Observation must never affect enforcement.
171
+ }
172
+ };
88
173
  return async (event) => {
89
174
  const startedAt = Date.now();
90
175
  const warnings = [];
@@ -93,9 +178,21 @@ export function createProductionRuleHostGate(options = {}) {
93
178
  return { decision: 'allow', source: event.source, warnings: [boundedWarning('tool_input_invalid', 'decode and validate toolName and params before dispatch')] };
94
179
  }
95
180
  const canonicalKind = toolSemantics.resolve(input.toolName);
181
+ // PRI-1184 / F3': restore the RuleHost routing contract. Only the write,
182
+ // execute and agent families enter rule evaluation; read/search and every
183
+ // other canonical kind are allowed without touching the RuleCode engine.
184
+ // The kind comes from the same ToolSemanticRegistry that supplies the
185
+ // extraction hints below — never a tool-name allowlist.
186
+ if (!isRuleHostEvaluableKind(canonicalKind)) {
187
+ return { decision: 'allow', source: event.source, metadata: { evaluatedLiveRules: 0 } };
188
+ }
96
189
  const { isBashTool: isBash, isWriteTool: isWrite } = deriveToolHintsFromCanonicalKind(canonicalKind);
97
190
  const action = buildRuleHostAction(input.toolName, input.params, options.projectDir ?? event.context.workspaceDir, { isBashTool: isBash, isWriteTool: isWrite, canonicalKind });
98
- if (action.normalizedPath === null)
191
+ // F3': normalizePathPure returns '' when no path could be extracted, so the
192
+ // old `=== null` guard never fired. Both null and '' mean "no action
193
+ // target": a pathless tool is not evaluated rather than treating an empty
194
+ // string as a path.
195
+ if (action.normalizedPath === null || action.normalizedPath === '')
99
196
  return { decision: 'allow', source: event.source, metadata: { evaluatedLiveRules: 0 } };
100
197
  let context;
101
198
  /**
@@ -509,7 +606,10 @@ export function createProductionRuleHostGate(options = {}) {
509
606
  continue;
510
607
  }
511
608
  const fallbackMeta = { name: activationId, version: '1', ruleId, coversCondition: 'all' };
512
- candidates.push({ implId: activationId, ruleId, principleId, meta: isRuleMeta(content.meta) ? content.meta : fallbackMeta, source: content.implementationCode, activationMode });
609
+ // PRI-1187: resolved for the observation-only mismatch signal; it
610
+ // is attached to the candidate but never filters the batch.
611
+ const declaredScope = resolveDeclaredFamilies(content.affectedTools, toolSemantics);
612
+ candidates.push({ implId: activationId, ruleId, principleId, meta: isRuleMeta(content.meta) ? content.meta : fallbackMeta, source: content.implementationCode, activationMode, declaredTools: declaredScope?.tools ?? null, declaredFamilies: declaredScope?.families ?? null });
513
613
  }
514
614
  catch (error) {
515
615
  addWarning(warnings, `implementation_unhealthy: ${error instanceof Error ? error.message : String(error)}`, 'fix the RuleCode and reactivate the rule');
@@ -521,7 +621,7 @@ export function createProductionRuleHostGate(options = {}) {
521
621
  workspace: { isRiskPath: isSensitiveSystemPath(action.normalizedPath) },
522
622
  session: { sessionId: event.context.sessionId },
523
623
  evolution: { epTier: enrichment.epTier },
524
- derived: { estimatedLineChanges: estimateLineChanges({ toolName: input.toolName, params: input.params }), bashRisk: enrichment.bashRisk },
624
+ derived: { estimatedLineChanges: estimateLineChanges({ toolName: input.toolName, params: input.params }, toolSemantics), bashRisk: enrichment.bashRisk },
525
625
  ...(context ? { context } : {}),
526
626
  };
527
627
  // CodeRabbit CR-3: live and shadow evaluate in SEPARATE batches so a
@@ -593,6 +693,7 @@ export function createProductionRuleHostGate(options = {}) {
593
693
  const shadowResult = normalized.matched
594
694
  ? { ...normalized, ruleId: candidate.ruleId, principleId: candidate.principleId }
595
695
  : normalized;
696
+ emitAffectedToolsMismatch(candidate, { decision: shadowResult.decision, actionFamily: canonicalKind, toolName: input.toolName });
596
697
  shadowEvaluations.push({
597
698
  toolName: input.toolName,
598
699
  filePath: action.normalizedPath,
@@ -633,6 +734,7 @@ export function createProductionRuleHostGate(options = {}) {
633
734
  : normalized;
634
735
  implementations.push({ ...candidate, evaluate: () => validatedResult });
635
736
  liveEvaluatedResults.push(validatedResult);
737
+ emitAffectedToolsMismatch(candidate, { decision: validatedResult.decision, actionFamily: canonicalKind, toolName: input.toolName });
636
738
  }
637
739
  const result = mergeDecisions(implementations, hostInput, {
638
740
  warn(message) { addWarning(warnings, message, 'inspect the unhealthy activation and RuleCode output'); },
@@ -0,0 +1,147 @@
1
+ import { type RetentionIndexReport, type TrajectoryRetentionMarker, type TrajectoryRetentionPolicy } from '@principles/core/runtime';
2
+ export declare const TRAJECTORY_RETENTION_MARKER_FILENAME = "trajectory-retention.json";
3
+ export declare const TRAJECTORY_RETENTION_LOCK_FILENAME = "trajectory-retention.lock";
4
+ /** 10 minutes: far above the 3 s run budget, so a live run is never taken over. */
5
+ export declare const TRAJECTORY_RETENTION_LOCK_STALE_MS: number;
6
+ /**
7
+ * The maintenance connection waits at most this long for the write lock.
8
+ *
9
+ * SPEC §4.2 says `busy_timeout = 5000`; acceptance criterion A8 requires the
10
+ * maintenance run to yield within 300 ms when another writer holds the lock.
11
+ * Those two cannot both hold, and A8 is the measurable one, so the write lock
12
+ * wait wins: a sweeper that queues behind the user's writer turns a background
13
+ * chore into user-visible latency. Reads in WAL mode do not need this wait.
14
+ *
15
+ * 100 ms (not 250) because SQLite's busy handler overshoots its timeout by up
16
+ * to one sleep step (~100 ms): a 250 ms timeout was measured at ~355 ms
17
+ * wall-clock, which breaks A8. Ordinary host writes hold the lock for
18
+ * milliseconds, so 100 ms is still enough to ride out normal contention.
19
+ */
20
+ export declare const TRAJECTORY_RETENTION_WRITE_LOCK_WAIT_MS = 100;
21
+ /**
22
+ * Index DDL is NOT the hot path and is NEVER attempted by a regular sweep
23
+ * (F2: a 5 s wait at the start of every run stalled the host). Creation only
24
+ * happens in the explicit maintenance entry, which may use this longer wait.
25
+ */
26
+ export declare const TRAJECTORY_RETENTION_DDL_BUSY_TIMEOUT_MS = 5000;
27
+ /** VACUUM is a foreground, explicit action; it may wait properly. */
28
+ export declare const TRAJECTORY_RETENTION_VACUUM_BUSY_TIMEOUT_MS = 5000;
29
+ export type TrajectoryRetentionTrigger = 'worker' | 'manual';
30
+ export type TrajectoryRetentionReportOutcome = 'completed' | 'partial' | 'deadline' | 'invariant_violation' | 'deferred:busy' | 'skipped';
31
+ export interface TrajectoryRetentionReport {
32
+ outcome: TrajectoryRetentionReportOutcome;
33
+ reason: string | null;
34
+ workspaceDir: string;
35
+ cutoff: string | null;
36
+ deletedByTable: Record<string, number>;
37
+ batches: number;
38
+ /** Batch-engine wall clock only. */
39
+ durationMs: number;
40
+ /** Whole run, including DB open, WAL check, index DDL and marker write (A1). */
41
+ totalDurationMs: number;
42
+ maxBatchDurationMs: number;
43
+ partial: boolean;
44
+ backoffUntil: string | null;
45
+ policy: TrajectoryRetentionPolicy;
46
+ indexes: RetentionIndexReport | null;
47
+ /** Non-null when index creation failed but the sweep continued anyway. */
48
+ indexesError: string | null;
49
+ /** Present on refused/failed outcomes (cli-6). */
50
+ nextAction?: string;
51
+ }
52
+ export interface RunTrajectoryRetentionOptions {
53
+ workspaceDir: string;
54
+ trigger?: TrajectoryRetentionTrigger;
55
+ /** Injectable clock (tests, deterministic marker/cutoff assertions). */
56
+ now?: () => number;
57
+ }
58
+ export declare function trajectoryRetentionPaths(workspaceDir: string): {
59
+ stateDir: string;
60
+ dbPath: string;
61
+ markerPath: string;
62
+ lockPath: string;
63
+ exportsDir: string;
64
+ };
65
+ /**
66
+ * One retention attempt for one workspace.
67
+ *
68
+ * Synchronous on purpose: callers are a worker cycle and a CLI command, both
69
+ * of which already own their concurrency, and a fire-and-forget promise in a
70
+ * worker loop is a crash risk with no upside.
71
+ */
72
+ export declare function runTrajectoryRetention(options: RunTrajectoryRetentionOptions): TrajectoryRetentionReport;
73
+ export interface TrajectoryRetentionLogger {
74
+ info?: (message: string) => void;
75
+ warn?: (message: string) => void;
76
+ }
77
+ /**
78
+ * Long-lived failure reasons repeat on every worker cycle. Return a message
79
+ * only when the reason for THIS workspace changed, so a permanently wrong
80
+ * `journal_mode` or a failing index DDL is visible once, not every 120 s
81
+ * (review finding 7).
82
+ */
83
+ export declare function retentionWarning(report: TrajectoryRetentionReport): string | null;
84
+ /**
85
+ * Schedule the periodic retention run for a long-lived host process.
86
+ *
87
+ * SPEC §4.1: an unref'd interval in the gateway process. Deliberately does NOT
88
+ * run at scheduling time — that call happens inside `before_prompt_build`, and
89
+ * a 3 s sweep there would be exactly the hook latency A3 forbids. The first
90
+ * attempt happens one minute later, off the hook path.
91
+ *
92
+ * Idempotent per workspace: repeated plugin initialisation cannot stack timers.
93
+ * Config is read once here (interval); the runner re-reads it every cycle, so
94
+ * `enabled`/range changes still take effect.
95
+ */
96
+ export declare function scheduleTrajectoryRetention(workspaceDirInput: string, logger?: TrajectoryRetentionLogger): void;
97
+ export interface TrajectoryRetentionStatus {
98
+ workspaceDir: string;
99
+ dbPath: string;
100
+ dbExists: boolean;
101
+ marker: TrajectoryRetentionMarker;
102
+ markerError: string | null;
103
+ policy: TrajectoryRetentionPolicy;
104
+ /** Cutoff the NEXT run will use; null when no sweep can run. */
105
+ nextCutoff: string | null;
106
+ /** Rows the NEXT run's cutoff would select (same rule, same predicate). */
107
+ expiredByTable: Record<string, number> | null;
108
+ /** Retention indexes absent from the database (created by `vacuum --yes`). */
109
+ indexesMissing: string[];
110
+ dbError: string | null;
111
+ }
112
+ /**
113
+ * Read-only status: never creates the marker, never opens the database for
114
+ * writing, never creates an index.
115
+ *
116
+ * `now` is injectable so the projected next cutoff can be asserted exactly
117
+ * against the run that follows it (F4: one definition of "expired").
118
+ */
119
+ export declare function readTrajectoryRetentionStatus(workspaceDirInput: string, now?: () => number): TrajectoryRetentionStatus;
120
+ export interface TrajectoryVacuumReport {
121
+ workspaceDir: string;
122
+ dbPath: string;
123
+ applied: boolean;
124
+ refusedReason: string | null;
125
+ nextAction?: string;
126
+ sizeBeforeBytes: number;
127
+ sizeAfterBytes: number | null;
128
+ freeBytes: number | null;
129
+ requiredBytes: number | null;
130
+ freelistBefore: number | null;
131
+ freelistAfter: number | null;
132
+ /** Retention indexes created here — the ONLY place DDL may run (F2). */
133
+ indexes: RetentionIndexReport | null;
134
+ durationMs: number;
135
+ }
136
+ /**
137
+ * `pd trajectory vacuum` — the ONLY place VACUUM may run (SPEC §6).
138
+ *
139
+ * VACUUM takes an exclusive lock and cannot be interrupted, which is why it is
140
+ * never scheduled. Default is a dry run: it reports the space requirement and
141
+ * refuses to start when the filesystem cannot hold `2 × size + 10%`.
142
+ */
143
+ export declare function vacuumTrajectoryDatabase(args: {
144
+ workspaceDir: string;
145
+ apply: boolean;
146
+ now?: () => number;
147
+ }): TrajectoryVacuumReport;