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
@@ -0,0 +1,85 @@
1
+ /**
2
+ * PD 内置技能的全局清单(唯一事实源)。
3
+ *
4
+ * 该清单回答两个问题,且只回答这两个问题:
5
+ * - 哪些技能存在(`status`):active 必须在每个宿主各交付一份,retired 不得出现在任何宿主;
6
+ * - 哪些技能不允许退场(`retirable`):false 表示永远不得改成 retired。
7
+ *
8
+ * 宿主路径、命令、能力差异都**不在**这里声明 —— 那些属于 `hosts/<id>.json`(见设计 §4.2)。
9
+ * 校验采用 fail-loud:不完整或互相矛盾的清单必须显式报错,不允许静默跳过(rc-3 / rc-9)。
10
+ */
11
+ /** 清单自身的结构性错误(区别于"文件不存在"这类 I/O 错误)。 */
12
+ export class SkillCatalogError extends Error {
13
+ problems;
14
+ constructor(problems) {
15
+ super(`invalid skill catalog: ${problems.join('; ')}`);
16
+ this.problems = problems;
17
+ this.name = 'SkillCatalogError';
18
+ }
19
+ }
20
+ const SKILL_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
21
+ const STATUSES = ['active', 'retired'];
22
+ function isRecord(value) {
23
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
24
+ }
25
+ function isSkillStatus(value) {
26
+ return value === 'active' || value === 'retired';
27
+ }
28
+ /**
29
+ * 把外部数据(JSON.parse 结果、测试夹具、未来渲染器的输入)校验成清单。
30
+ * 未知值一律先当作 unknown,不使用 `as` 绕过校验(rc-1 / rc-2)。
31
+ */
32
+ export function parseSkillCatalog(value) {
33
+ if (!isRecord(value))
34
+ throw new SkillCatalogError(['root must be an object']);
35
+ const rawSkills = value.skills;
36
+ if (!Array.isArray(rawSkills))
37
+ throw new SkillCatalogError(['`skills` must be an array']);
38
+ if (rawSkills.length === 0)
39
+ throw new SkillCatalogError(['`skills` must not be empty']);
40
+ const problems = [];
41
+ const entries = [];
42
+ const seen = new Set();
43
+ rawSkills.forEach((raw, index) => {
44
+ const at = `skills[${index}]`;
45
+ if (!isRecord(raw)) {
46
+ problems.push(`${at} must be an object`);
47
+ return;
48
+ }
49
+ const { name, status, retirable, retirementCondition } = raw;
50
+ if (typeof name !== 'string' || !SKILL_NAME.test(name)) {
51
+ problems.push(`${at}.name must be a kebab-case skill name`);
52
+ return;
53
+ }
54
+ if (!isSkillStatus(status)) {
55
+ problems.push(`${at}.status must be one of ${STATUSES.join('|')}`);
56
+ }
57
+ if (typeof retirable !== 'boolean') {
58
+ problems.push(`${at}.retirable must be a boolean`);
59
+ }
60
+ if (retirementCondition !== undefined &&
61
+ (typeof retirementCondition !== 'string' || retirementCondition.trim() === '')) {
62
+ problems.push(`${at}.retirementCondition must be a non-empty string when present`);
63
+ }
64
+ if (seen.has(name)) {
65
+ problems.push(`${at}.name duplicates "${name}"`);
66
+ }
67
+ seen.add(name);
68
+ if (!isSkillStatus(status) || typeof retirable !== 'boolean')
69
+ return;
70
+ if (status === 'retired' && retirable === false) {
71
+ problems.push(`${name} is marked retirable=false but status=retired`);
72
+ return;
73
+ }
74
+ entries.push({
75
+ name,
76
+ status,
77
+ retirable,
78
+ ...(typeof retirementCondition === 'string' ? { retirementCondition } : {}),
79
+ });
80
+ });
81
+ if (problems.length > 0)
82
+ throw new SkillCatalogError(problems);
83
+ return { skills: entries };
84
+ }
85
+ //# sourceMappingURL=skill-catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-catalog.js","sourceRoot":"","sources":["../src/skill-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAmBH,uCAAuC;AACvC,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IACrB,QAAQ;IAA7B,YAAqB,QAA2B;QAC9C,KAAK,CAAC,0BAA0B,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;wBADpC,QAAQ;QAE3B,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED,MAAM,UAAU,GAAG,4BAA4B,CAAC;AAChD,MAAM,QAAQ,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAU,CAAC;AAEhD,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,SAAS,CAAC;AACnD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,iBAAiB,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC;IAC9E,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC;IAC/B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;QAAE,MAAM,IAAI,iBAAiB,CAAC,CAAC,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CAAC,IAAI,CAAC,GAAG,EAAE,8DAA8D,CAAC,CAAC;QACrF,CAAC;QACD,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACnB,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,qBAAqB,IAAI,GAAG,CAAC,CAAC;QACnD,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACf,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,OAAO,SAAS,KAAK,SAAS;YAAE,OAAO;QACrE,IAAI,MAAM,KAAK,SAAS,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;YAChD,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,+CAA+C,CAAC,CAAC;YACtE,OAAO;QACT,CAAC;QACD,OAAO,CAAC,IAAI,CAAC;YACX,IAAI;YACJ,MAAM;YACN,SAAS;YACT,GAAG,CAAC,OAAO,mBAAmB,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC5E,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,IAAI,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAC/D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * 跨宿主技能交付一致性判定(纯逻辑,不做文件 I/O)。
3
+ *
4
+ * 判定口径全部来自全局清单(`skill-catalog.json`),调用方只负责把每个宿主
5
+ * 实际交付的技能目录读成 `DeliveredHost`。这样测试、迁移脚本与未来的渲染器
6
+ * 校验共用同一条规则,而不是各写一份"四个目录"的比较。
7
+ *
8
+ * 该规则**只**回答"发了几份、声明是否一致",不回答"内容是否同源"——
9
+ * 后者属于渲染 `--check` 的职责(设计 §7.3)。
10
+ */
11
+ import type { SkillCatalog } from './skill-catalog.js';
12
+ export interface DeliveredHost {
13
+ /** 交付面标识,例如 `openclaw-zh` / `codex` / `workbuddy`。 */
14
+ readonly id: string;
15
+ /** 该宿主实际交付的技能目录名。 */
16
+ readonly skills: readonly string[];
17
+ /** 其中 `SKILL.md` 缺失或为空的技能名。 */
18
+ readonly emptySkills: readonly string[];
19
+ }
20
+ /** 返回全部偏差;空数组表示一致。 */
21
+ export declare function checkSkillParity(catalog: SkillCatalog, hosts: readonly DeliveredHost[]): readonly string[];
22
+ //# sourceMappingURL=skill-delivery-parity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-delivery-parity.d.ts","sourceRoot":"","sources":["../src/skill-delivery-parity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,WAAW,aAAa;IAC5B,sDAAsD;IACtD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,qBAAqB;IACrB,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,+BAA+B;IAC/B,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC;AAED,sBAAsB;AACtB,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,YAAY,EACrB,KAAK,EAAE,SAAS,aAAa,EAAE,GAC9B,SAAS,MAAM,EAAE,CAgCnB"}
@@ -0,0 +1,31 @@
1
+ /** 返回全部偏差;空数组表示一致。 */
2
+ export function checkSkillParity(catalog, hosts) {
3
+ const problems = [];
4
+ const declared = new Set(catalog.skills.map((skill) => skill.name));
5
+ for (const { name, status, retirable } of catalog.skills) {
6
+ const hits = hosts.filter((host) => host.skills.includes(name)).map((host) => host.id);
7
+ const expected = status === 'active' ? hosts.length : 0;
8
+ if (hits.length !== expected) {
9
+ problems.push(`${name} (${status}): expected ${expected} host(s), found ${hits.length} [${hits.join(', ') || 'none'}]`);
10
+ }
11
+ if (!retirable && status !== 'active') {
12
+ problems.push(`${name}: retirable=false but status=${status}`);
13
+ }
14
+ if (status !== 'active')
15
+ continue;
16
+ for (const host of hosts) {
17
+ if (host.emptySkills.includes(name)) {
18
+ problems.push(`${name} (${host.id}): SKILL.md is missing or empty`);
19
+ }
20
+ }
21
+ }
22
+ for (const host of hosts) {
23
+ for (const name of host.skills) {
24
+ if (!declared.has(name)) {
25
+ problems.push(`${name} (${host.id}): delivered but not declared in skill-catalog.json`);
26
+ }
27
+ }
28
+ }
29
+ return problems;
30
+ }
31
+ //# sourceMappingURL=skill-delivery-parity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-delivery-parity.js","sourceRoot":"","sources":["../src/skill-delivery-parity.ts"],"names":[],"mappings":"AAqBA,sBAAsB;AACtB,MAAM,UAAU,gBAAgB,CAC9B,OAAqB,EACrB,KAA+B;IAE/B,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAEpE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACzD,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACvF,MAAM,QAAQ,GAAG,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACxD,IAAI,IAAI,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC7B,QAAQ,CAAC,IAAI,CACX,GAAG,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,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,IAAI,CAAC;CAC1F;AAED,uGAAuG;AACvG,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,gBAAgB,GAAG,WAAW,CAAC,GAAG,MAAM,CAMtG"}
@@ -73,6 +73,10 @@ export function parseEmbeddedProductIdentity(value) {
73
73
  }
74
74
  /** `pd --version` short stable text contract: `Principles Disciple <version> (<releaseId prefix>)`. */
75
75
  export function formatShortVersion(report) {
76
- return `Principles Disciple ${report.productVersion} (${report.releaseId.slice(0, 12)})`;
76
+ // Bundled ids already carry a readable `bundled-<version>-<digest12>` form; the
77
+ // generic prefix slice cut them to `bundled-2.8.` and dropped the digest. Only
78
+ // raw hex ids need abbreviating.
79
+ const shown = report.releaseId.startsWith('bundled-') ? report.releaseId : report.releaseId.slice(0, 12);
80
+ return `Principles Disciple ${report.productVersion} (${shown})`;
77
81
  }
78
82
  //# sourceMappingURL=product-identity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"product-identity.js","sourceRoot":"","sources":["../../src/update/product-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,uBAAuB,GAAG,4CAA4C,CAAC;AAC7E,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AAC5C,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AAS5C,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACpC,KAAK,CAAS;IAEvB,YAAY,KAAa,EAAE,OAAe;QACxC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AAED,kFAAkF;AAClF,MAAM,UAAU,mBAAmB,CAAC,KAAc,EAAE,KAAK,GAAG,gBAAgB;IAC1E,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,uBAA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AiC;IACjC,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACzG,OAAO,uBAAuB,MAAM,CAAC,cAAc,KAAK,KAAK,GAAG,CAAC;AACnE,CAAC"}
@@ -68,6 +68,7 @@ export interface ActivePrinciplePromptResult {
68
68
  injectedExpectationsOverflow?: number;
69
69
  }
70
70
  export interface AdaptivePackingReport {
71
+ source?: 'native_gap';
71
72
  status: 'target_present' | 'prioritized' | 'unavailable';
72
73
  reason?: string;
73
74
  targetActivationId: string;
@@ -76,6 +77,7 @@ export interface AdaptivePackingReport {
76
77
  displacedActivationIds: string[];
77
78
  /** Internal return-boundary checks; these snapshots are not delivery evidence. */
78
79
  targetSnapshot?: ActivatedPrinciple;
80
+ displacedSnapshot?: ActivatedPrinciple;
79
81
  targetBody?: string;
80
82
  nativeBaseline?: ActivePrinciplePromptResult;
81
83
  deadlineAt?: number;
@@ -202,6 +204,10 @@ export declare function packSharedDirectives(input: {
202
204
  /** Fair rotation continues past a non-fit; legacy FIFO stops at the first one. */
203
205
  continueOnNonFit: boolean;
204
206
  }): SharedDirectivePacking;
207
+ export interface AdaptiveGapOptions {
208
+ readonly excludedByBudget: boolean;
209
+ readonly replacementByActivationId: ReadonlyMap<string, ActivatedPrinciple>;
210
+ }
205
211
  export declare function buildActivePrinciplePromptContext(input: {
206
212
  workspaceDir: string;
207
213
  /**
@@ -223,6 +229,13 @@ export declare function buildActivePrinciplePromptContext(input: {
223
229
  artifactId: string;
224
230
  activationId: string;
225
231
  };
232
+ /** Select only from omitted principles with a feasible plan in the current budget. */
233
+ selectNativeGap?: (candidates: readonly ActivatedPrinciple[], options: AdaptiveGapOptions) => Promise<{
234
+ artifactId: string;
235
+ activationId: string;
236
+ signal?: AbortSignal;
237
+ deadlineAt?: number;
238
+ } | undefined>;
226
239
  /**
227
240
  * PRI-1140 (Owner supplementary condition): additive-only adaptive packing.
228
241
  * Only meaningful together with `adaptivePriority`. When true, the
@@ -7,6 +7,7 @@ import path from 'node:path';
7
7
  import { escapeXml } from '@principles/core/prompt-builder';
8
8
  import { loadPdConfigForPlugin } from './pd-config.js';
9
9
  import { readPromptActivationAuthority } from './prompt-activation-authority.js';
10
+ import { ADAPTIVE_DECISION_MAX_CANDIDATE_CHARS } from './adaptive-decision-protocol.js';
10
11
  import { revalidateAdaptivePrinciple } from './adaptive-principle-revalidation.js';
11
12
  /** PRI-904 SPEC §10: bounded diagnostic id lists (mirrors the core selector's cap of 16). */
12
13
  export const MAX_SHARED_DIAGNOSTIC_IDS = 16;
@@ -345,22 +346,68 @@ export async function buildActivePrinciplePromptContext(input) {
345
346
  };
346
347
  const nativePacking = pack(nativeScanOrder);
347
348
  const nativeResult = makeResult(nativePacking, principles);
348
- const priority = input.adaptivePriority;
349
+ let gapPriority;
350
+ const mandatoryIds = input.mandatoryPrincipleIds ?? [];
351
+ let feasible = [];
352
+ const replacements = new Map();
353
+ if (input.adaptivePriority === undefined && input.selectNativeGap && warnings.length === 0) {
354
+ const omitted = principles.filter((principle) => !nativeResult.principleIds.includes(principle.principleId));
355
+ const renderOptions = { escapeFn: escapeXml, selfReportInstruction: selfReportEnabled };
356
+ const nativeChars = nativePacking.additionalContext.length || sharedDirectiveBaseChars(renderOptions);
357
+ const remaining = budgetChars - nativeChars;
358
+ const config = loadPdConfigForPlugin(input.workspaceDir);
359
+ const replaceableIds = new Set(config.ok ? config.effective.config.adaptiveActivation?.replaceableActivationIds : undefined);
360
+ // Prefer the last explicitly replaceable Native directive that can cover
361
+ // the shortfall. Each question scores one concrete plan, never a free-form removal.
362
+ const replaceable = nativePacking.included.slice().reverse()
363
+ .filter((p) => replaceableIds.has(p.activationId) && p.authority === 'owner'
364
+ && p.artifactContentSha256 && Array.isArray(mandatoryIds) && !mandatoryIds.includes(p.principleId)
365
+ && principles.filter((candidate) => candidate.principleId === p.principleId).length === 1)
366
+ .map((principle) => ({ principle, chars: measureSharedDirectiveBlockChars(principle, renderOptions) }));
367
+ feasible = omitted.filter((principle) => {
368
+ const shortfall = measureSharedDirectiveBlockChars(principle, renderOptions) - remaining;
369
+ if (shortfall <= 0)
370
+ return true;
371
+ // Compare complete directives. A truncated excerpt cannot establish
372
+ // that removing a constraint is appropriate for this task.
373
+ if (principle.authority !== 'owner' || !principle.artifactContentSha256
374
+ || principle.text.trim().length > ADAPTIVE_DECISION_MAX_CANDIDATE_CHARS)
375
+ return false;
376
+ const outgoing = replaceable.find(({ principle: p, chars }) => chars >= shortfall && p.text.trim().length <= ADAPTIVE_DECISION_MAX_CANDIDATE_CHARS);
377
+ if (!outgoing)
378
+ return false;
379
+ replacements.set(principle.activationId, outgoing.principle);
380
+ return true;
381
+ });
382
+ gapPriority = await input.selectNativeGap(feasible, {
383
+ excludedByBudget: feasible.length < omitted.length,
384
+ replacementByActivationId: replacements,
385
+ });
386
+ }
387
+ const priority = input.adaptivePriority ?? gapPriority;
349
388
  if (priority === undefined)
350
389
  return nativeResult;
390
+ const signal = gapPriority?.signal ?? input.signal ?? new AbortController().signal;
391
+ const deadlineAt = gapPriority?.deadlineAt ?? input.deadlineAt;
392
+ const outgoing = gapPriority ? replacements.get(priority.activationId) : undefined;
393
+ const additiveOnly = (gapPriority !== undefined && outgoing === undefined) || input.additiveOnly === true;
351
394
  const report = (status, reason, displacedActivationIds = []) => ({
352
395
  status,
396
+ ...(gapPriority ? { source: 'native_gap' } : {}),
353
397
  ...(reason ? { reason } : {}),
354
398
  targetActivationId: typeof priority.activationId === 'string' ? priority.activationId : '',
355
399
  targetArtifactId: typeof priority.artifactId === 'string' ? priority.artifactId : '',
356
400
  ...(input.hookInvocationId ? { hookInvocationId: input.hookInvocationId } : {}),
357
401
  displacedActivationIds,
358
402
  });
403
+ if (gapPriority && (signal.aborted || (deadlineAt !== undefined && Date.now() >= deadlineAt))) {
404
+ return { ...nativeResult, adaptivePacking: report('unavailable', 'deadline') };
405
+ }
359
406
  const nativeTargetMatches = principles.filter((principle) => principle.artifactId === priority.artifactId && principle.activationId === priority.activationId);
360
407
  const [nativeTarget] = nativeTargetMatches;
361
408
  const baselineHasTarget = nativePacking.included.some((principle) => principle.artifactId === priority.artifactId && principle.activationId === priority.activationId);
362
409
  const withoutTarget = (reason) => {
363
- if (nativeTargetMatches.length !== 1 || !nativeTarget)
410
+ if (gapPriority || nativeTargetMatches.length !== 1 || !nativeTarget)
364
411
  return { ...nativeResult, adaptivePacking: report('unavailable', reason) };
365
412
  const targetPrincipleId = nativeTarget.principleId;
366
413
  const safePrinciples = principles.filter((principle) => principle.principleId !== targetPrincipleId);
@@ -381,6 +428,9 @@ export async function buildActivePrinciplePromptContext(input) {
381
428
  if (principles.filter((principle) => principle.principleId === nativeTarget.principleId).length !== 1) {
382
429
  return { ...nativeResult, adaptivePacking: report('unavailable', 'target_ambiguous') };
383
430
  }
431
+ if (gapPriority && !feasible.includes(nativeTarget)) {
432
+ return { ...nativeResult, adaptivePacking: report('unavailable', 'target_not_in_feasible_gap') };
433
+ }
384
434
  const authorityRead = await readPromptActivationCandidates({ workspaceDir: input.workspaceDir, includeAuthority: true, noBusyWait: true });
385
435
  const authorizedMatches = authorityRead.principles.filter((principle) => principle.artifactId === priority.artifactId && principle.activationId === priority.activationId);
386
436
  const [authorizedTarget] = authorizedMatches;
@@ -402,12 +452,12 @@ export async function buildActivePrinciplePromptContext(input) {
402
452
  || authorizedTarget.artifactContentSha256 !== nativeTarget.artifactContentSha256) {
403
453
  return withoutTarget('target_changed');
404
454
  }
405
- const signal = input.signal ?? new AbortController().signal;
406
455
  const targetRendered = renderPrinciplesToDirectives([nativeTarget], new Set([nativeTarget.principleId]), { escapeFn: escapeXml });
407
456
  const targetBody = targetRendered.slice(targetRendered.indexOf('<directive '), targetRendered.indexOf('</directive>') + '</directive>'.length);
408
457
  const prepared = (status, displaced = []) => ({
409
458
  ...report(status, undefined, displaced), targetSnapshot: authorizedTarget, targetBody,
410
- nativeBaseline: nativeResult, ...(input.deadlineAt !== undefined ? { deadlineAt: input.deadlineAt } : {}),
459
+ ...(outgoing ? { displacedSnapshot: outgoing } : {}),
460
+ nativeBaseline: nativeResult, ...(deadlineAt !== undefined ? { deadlineAt } : {}),
411
461
  });
412
462
  if (baselineHasTarget) {
413
463
  const stillValid = await revalidateAdaptivePrinciple(input.workspaceDir, authorizedTarget, signal);
@@ -415,13 +465,21 @@ export async function buildActivePrinciplePromptContext(input) {
415
465
  return withoutTarget('target_changed');
416
466
  return { ...nativeResult, adaptivePacking: prepared('target_present') };
417
467
  }
418
- const targetIndex = nativeScanOrder.indexOf(nativeTarget);
419
- const targetFirstScan = [nativeTarget, ...nativeScanOrder.filter((principle, index) => index !== targetIndex && principle.principleId !== nativeTarget.principleId)];
420
- const prioritizedPacking = pack(targetFirstScan);
468
+ // Apply only the scored plan to the exact Native selection.
469
+ const prioritizedPacking = gapPriority
470
+ ? {
471
+ ...pack([...nativePacking.included.filter((p) => p !== outgoing), nativeTarget]),
472
+ truncated: nativePacking.truncated,
473
+ dropped: [
474
+ ...(outgoing ? [outgoing.activationId] : []),
475
+ ...nativePacking.dropped.filter((id) => id !== nativeTarget.activationId),
476
+ ].slice(0, MAX_SHARED_DIAGNOSTIC_IDS),
477
+ oversized: nativePacking.oversized,
478
+ }
479
+ : pack([nativeTarget, ...nativeScanOrder.filter((principle) => principle.principleId !== nativeTarget.principleId)]);
421
480
  if (!prioritizedPacking.included.some((principle) => principle.principleId === nativeTarget.principleId)) {
422
481
  return { ...nativeResult, adaptivePacking: report('unavailable', 'target_does_not_fit') };
423
482
  }
424
- const mandatoryIds = input.mandatoryPrincipleIds ?? [];
425
483
  if (!Array.isArray(mandatoryIds) || mandatoryIds.some((id) => typeof id !== 'string')
426
484
  || mandatoryIds.some((id) => !prioritizedPacking.included.some((principle) => principle.principleId === id))) {
427
485
  return { ...nativeResult, adaptivePacking: report('unavailable', 'mandatory_constraint_displaced') };
@@ -430,19 +488,38 @@ export async function buildActivePrinciplePromptContext(input) {
430
488
  const displacedActivationIds = nativePacking.included
431
489
  .filter((principle) => !prioritizedActivationIds.has(principle.activationId))
432
490
  .map((principle) => principle.activationId);
491
+ if (outgoing && (displacedActivationIds.length !== 1 || displacedActivationIds[0] !== outgoing.activationId)) {
492
+ return withoutTarget('unexpected_replacement');
493
+ }
433
494
  // PRI-1140: an additive-only target may never squeeze out content the
434
495
  // native baseline already assembled. Decided BEFORE the revalidation read so
435
496
  // a refused placement costs no further I/O; the would-be displacement is the
436
497
  // recorded reason (bounded like the other diagnostic id lists).
437
- if (input.additiveOnly === true && displacedActivationIds.length > 0) {
498
+ if (additiveOnly && displacedActivationIds.length > 0) {
438
499
  return {
439
500
  ...nativeResult,
440
501
  adaptivePacking: report('unavailable', 'would_displace_native_assembly', displacedActivationIds.slice(0, MAX_SHARED_DIAGNOSTIC_IDS)),
441
502
  };
442
503
  }
443
- const stillValid = await revalidateAdaptivePrinciple(input.workspaceDir, authorizedTarget, signal);
504
+ const [stillValid, outgoingValid] = await Promise.all([
505
+ revalidateAdaptivePrinciple(input.workspaceDir, authorizedTarget, signal),
506
+ outgoing ? revalidateAdaptivePrinciple(input.workspaceDir, outgoing, signal) : true,
507
+ ]);
508
+ if (gapPriority && (signal.aborted || (deadlineAt !== undefined && Date.now() >= deadlineAt))) {
509
+ return { ...nativeResult, adaptivePacking: report('unavailable', 'deadline') };
510
+ }
444
511
  if (!stillValid)
445
512
  return { ...nativeResult, adaptivePacking: report('unavailable', 'target_changed') };
513
+ if (!outgoingValid)
514
+ return withoutTarget('replacement_changed');
515
+ if (outgoing) {
516
+ const config = loadPdConfigForPlugin(input.workspaceDir);
517
+ if (!config.ok || !config.effective.config.adaptiveActivation?.replaceableActivationIds?.includes(outgoing.activationId)) {
518
+ return withoutTarget('replacement_permission_changed');
519
+ }
520
+ if (signal.aborted || (deadlineAt !== undefined && Date.now() >= deadlineAt))
521
+ return withoutTarget('deadline');
522
+ }
446
523
  const result = makeResult(prioritizedPacking, principles, prepared('prioritized', displacedActivationIds));
447
524
  // Adaptive assembly is deliberately limited to the existing renderer's Native budget cap.
448
525
  return result;
@@ -0,0 +1,129 @@
1
+ /**
2
+ * PRI-1182 — Adaptive Activation: the real Decisions scoring protocol.
3
+ *
4
+ * Extracted from the already-verified lab implementation
5
+ * (`scripts/dev/adaptive-selector-lab/diagnostic.mjs`): one POST with
6
+ * `{model, state, questions, provider}`, one `{model, answers}` response.
7
+ *
8
+ * The difference from the lab experiment is the QUESTION SET: the lab asked
9
+ * four task-level questions, while production asks one independent
10
+ * applicability condition per candidate plus one "insufficient context"
11
+ * condition. Each answer is an independent `noul` score in [0, 1] — not a
12
+ * distribution — so PD adjudicates locally instead of trusting the model to
13
+ * emit a decision.
14
+ *
15
+ * Everything here is pure: no I/O, no clock, no transport. The caller owns
16
+ * scheduling, cancellation and diagnostics.
17
+ */
18
+ export declare const ADAPTIVE_DECISION_MAX_CANDIDATE_CHARS = 600;
19
+ export declare const ADAPTIVE_DECISION_INSUFFICIENT_QUESTION = "insufficient_context";
20
+ /** Preset applicability and context guards. Scores are model judgments, not calibrated probabilities. */
21
+ export declare const ADAPTIVE_DECISION_CRITERIA: {
22
+ readonly version: 'v2-20261112';
23
+ /** A candidate must reach this independent score to be eligible. */
24
+ readonly selectThreshold: 0.7;
25
+ /** Above this "information is insufficient" score, PD refuses to select. */
26
+ readonly insufficientThreshold: 0.6;
27
+ };
28
+ export interface DecisionQuestion {
29
+ readonly type: 'noul';
30
+ readonly instructions: string;
31
+ }
32
+ export type DecisionQuestions = Record<string, DecisionQuestion>;
33
+ export interface DecisionRequestEnvelope {
34
+ readonly model: string;
35
+ readonly state: string;
36
+ readonly questions: DecisionQuestions;
37
+ readonly provider?: {
38
+ readonly only: readonly string[];
39
+ readonly allow_fallbacks: false;
40
+ };
41
+ }
42
+ export type DecisionProtocolError = 'DECISION_MODEL_MISMATCH' | 'DECISION_PROVIDER_MISMATCH' | 'DECISION_OUTPUT_INVALID' | 'DECISION_QUESTION_MISMATCH' | 'DECISION_SCORE_INVALID' | 'INPUT_REFUSED';
43
+ export interface BuildDecisionRequestInput {
44
+ readonly model: string;
45
+ readonly provider?: string;
46
+ readonly currentInstruction: string;
47
+ readonly priorMessages: readonly {
48
+ readonly text: string;
49
+ readonly source: string;
50
+ readonly index: number;
51
+ }[];
52
+ readonly candidates: readonly {
53
+ readonly ref: string;
54
+ readonly text: string;
55
+ readonly digest: string;
56
+ readonly replaces?: string;
57
+ }[];
58
+ /** Bounded by the caller; a request larger than this is refused locally. */
59
+ readonly maxPayloadChars: number;
60
+ }
61
+ export type BuildDecisionRequestResult = {
62
+ readonly ok: true;
63
+ readonly body: DecisionRequestEnvelope;
64
+ readonly questionIds: readonly string[];
65
+ } | {
66
+ readonly ok: false;
67
+ readonly reason: DecisionProtocolError;
68
+ };
69
+ export declare function candidateQuestionId(ref: string): string;
70
+ /**
71
+ * One question per candidate (its applicability condition) plus one
72
+ * "insufficient context" question. Instructions refer to the snapshot by ref;
73
+ * the candidate text itself travels once, in `state`.
74
+ */
75
+ export declare function buildDecisionQuestions(candidates: readonly {
76
+ readonly ref: string;
77
+ readonly text: string;
78
+ readonly replaces?: string;
79
+ }[]): DecisionQuestions;
80
+ export declare function buildDecisionRequest(input: BuildDecisionRequestInput): BuildDecisionRequestResult;
81
+ /**
82
+ * Model identity is exact against an explicit allowlist when one is frozen
83
+ * (the acceptance batch does this). Otherwise one bounded alias class is
84
+ * accepted: a `:free` tag may be absent, and a dated canonical slug
85
+ * (`<base>-YYYYMMDD`) is accepted — the two aliases the lab verified.
86
+ *
87
+ * An unregistered DATE is never accepted through the allowlist path: the
88
+ * observed id must be one of the frozen strings, so a same-prefix slug with a
89
+ * different date is a mismatch.
90
+ */
91
+ export declare function isDecisionModelIdentity(configured: string, observed: string, allowedResponseModels?: readonly string[]): boolean;
92
+ export type DecisionValidationResult = {
93
+ readonly ok: true;
94
+ readonly scores: Readonly<Record<string, number>>;
95
+ } | {
96
+ readonly ok: false;
97
+ readonly reason: DecisionProtocolError;
98
+ };
99
+ /**
100
+ * Validates model identity, provider identity (when configured), completeness
101
+ * of the exact question set, and every score range. Any missing, extra or
102
+ * malformed answer is a rejected turn — never a partial score table.
103
+ */
104
+ export declare function validateDecisionResponse(value: unknown, expected: {
105
+ readonly model: string;
106
+ readonly questionIds: readonly string[];
107
+ readonly provider?: string;
108
+ /** Frozen exact response-model allowlist. Present = exact membership only. */
109
+ readonly allowedResponseModels?: readonly string[];
110
+ }): DecisionValidationResult;
111
+ export type DecisionOutcome = {
112
+ readonly status: 'selected';
113
+ readonly ref: string;
114
+ readonly reason: 'selected';
115
+ readonly scores: Readonly<Record<string, number>>;
116
+ } | {
117
+ readonly status: 'none_applicable' | 'uncertain';
118
+ readonly ref: null;
119
+ readonly reason: 'below_selection_threshold' | 'candidate_tied' | 'information_insufficient';
120
+ readonly scores: Readonly<Record<string, number>>;
121
+ };
122
+ /**
123
+ * Local adjudication of the INDEPENDENT condition scores. Order matters:
124
+ * insufficient information first (it invalidates any candidate ranking), then
125
+ * the applicability threshold. An exact tie leaves no unique winner.
126
+ */
127
+ export declare function adjudicateDecision(scores: Readonly<Record<string, number>>, candidates: readonly {
128
+ readonly ref: string;
129
+ }[], criteria?: typeof ADAPTIVE_DECISION_CRITERIA): DecisionOutcome;