create-principles-disciple 1.150.3 → 1.150.4

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 (248) 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/pd-hook.d.ts +7 -5
  4. package/codex-adapter/dist/pd-hook.js +18 -7
  5. package/codex-adapter/dist/tool-semantics.js +5 -1
  6. package/codex-adapter/dist/worker/workspace-worker.js +4 -2
  7. package/codex-adapter/package.json +1 -1
  8. package/console/dist/lib/utils.js +16 -1
  9. package/console/dist/web/assets/app.css +147 -46
  10. package/console/dist/web/assets/app.js +35 -32
  11. package/console/package.json +2 -0
  12. package/core/dist/runtime/activation-compatibility-read-model.d.ts.map +1 -1
  13. package/core/dist/runtime/activation-compatibility-read-model.js +2 -1
  14. package/core/dist/runtime/activation-compatibility-read-model.js.map +1 -1
  15. package/core/dist/runtime/adapter/pi-ai-runtime-adapter.d.ts.map +1 -1
  16. package/core/dist/runtime/adapter/pi-ai-runtime-adapter.js +106 -19
  17. package/core/dist/runtime/adapter/pi-ai-runtime-adapter.js.map +1 -1
  18. package/core/dist/runtime/candidate-audit.d.ts.map +1 -1
  19. package/core/dist/runtime/candidate-audit.js +2 -1
  20. package/core/dist/runtime/candidate-audit.js.map +1 -1
  21. package/core/dist/runtime/config/pd-config-effective.d.ts.map +1 -1
  22. package/core/dist/runtime/config/pd-config-effective.js +2 -0
  23. package/core/dist/runtime/config/pd-config-effective.js.map +1 -1
  24. package/core/dist/runtime/config/pd-config-types.d.ts +52 -0
  25. package/core/dist/runtime/config/pd-config-types.d.ts.map +1 -1
  26. package/core/dist/runtime/config/pd-config-types.js.map +1 -1
  27. package/core/dist/runtime/config/pd-config-validate.d.ts.map +1 -1
  28. package/core/dist/runtime/config/pd-config-validate.js +134 -0
  29. package/core/dist/runtime/config/pd-config-validate.js.map +1 -1
  30. package/core/dist/runtime/feature-flags/feature-flag-contract.d.ts.map +1 -1
  31. package/core/dist/runtime/feature-flags/feature-flag-contract.js +8 -0
  32. package/core/dist/runtime/feature-flags/feature-flag-contract.js.map +1 -1
  33. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.d.ts.map +1 -1
  34. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js +24 -0
  35. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js.map +1 -1
  36. package/core/dist/runtime/index.d.ts +2 -0
  37. package/core/dist/runtime/index.d.ts.map +1 -1
  38. package/core/dist/runtime/index.js +2 -0
  39. package/core/dist/runtime/index.js.map +1 -1
  40. package/core/dist/runtime/internalization/rule-host-input-builder.d.ts +16 -0
  41. package/core/dist/runtime/internalization/rule-host-input-builder.d.ts.map +1 -1
  42. package/core/dist/runtime/internalization/rule-host-input-builder.js +18 -0
  43. package/core/dist/runtime/internalization/rule-host-input-builder.js.map +1 -1
  44. package/core/dist/runtime/internalization/split-diagnostician-runner.d.ts +8 -0
  45. package/core/dist/runtime/internalization/split-diagnostician-runner.d.ts.map +1 -1
  46. package/core/dist/runtime/internalization/split-diagnostician-runner.js +24 -2
  47. package/core/dist/runtime/internalization/split-diagnostician-runner.js.map +1 -1
  48. package/core/dist/runtime/internalization/tool-semantic-registry.d.ts +26 -0
  49. package/core/dist/runtime/internalization/tool-semantic-registry.d.ts.map +1 -1
  50. package/core/dist/runtime/internalization/tool-semantic-registry.js +55 -5
  51. package/core/dist/runtime/internalization/tool-semantic-registry.js.map +1 -1
  52. package/core/dist/runtime/internalization-chain-integrity-read-model.d.ts.map +1 -1
  53. package/core/dist/runtime/internalization-chain-integrity-read-model.js +2 -2
  54. package/core/dist/runtime/internalization-chain-integrity-read-model.js.map +1 -1
  55. package/core/dist/runtime/internalization-integrity-remediation.d.ts.map +1 -1
  56. package/core/dist/runtime/internalization-integrity-remediation.js +2 -2
  57. package/core/dist/runtime/internalization-integrity-remediation.js.map +1 -1
  58. package/core/dist/runtime/operator-health-read-model.d.ts.map +1 -1
  59. package/core/dist/runtime/operator-health-read-model.js +2 -2
  60. package/core/dist/runtime/operator-health-read-model.js.map +1 -1
  61. package/core/dist/runtime/pain-recall-read-model.d.ts.map +1 -1
  62. package/core/dist/runtime/pain-recall-read-model.js +4 -3
  63. package/core/dist/runtime/pain-recall-read-model.js.map +1 -1
  64. package/core/dist/runtime/pruning-read-model.d.ts.map +1 -1
  65. package/core/dist/runtime/pruning-read-model.js +3 -2
  66. package/core/dist/runtime/pruning-read-model.js.map +1 -1
  67. package/core/dist/runtime/risk/risk-calculator-policy.d.ts +12 -2
  68. package/core/dist/runtime/risk/risk-calculator-policy.d.ts.map +1 -1
  69. package/core/dist/runtime/risk/risk-calculator-policy.js +33 -22
  70. package/core/dist/runtime/risk/risk-calculator-policy.js.map +1 -1
  71. package/core/dist/runtime/schema-conformance-read-model.js +2 -2
  72. package/core/dist/runtime/schema-conformance-read-model.js.map +1 -1
  73. package/core/dist/runtime/store/sqlite-connection.d.ts +0 -5
  74. package/core/dist/runtime/store/sqlite-connection.d.ts.map +1 -1
  75. package/core/dist/runtime/store/sqlite-connection.js +4 -12
  76. package/core/dist/runtime/store/sqlite-connection.js.map +1 -1
  77. package/core/dist/runtime/store/storage-paths.d.ts +17 -0
  78. package/core/dist/runtime/store/storage-paths.d.ts.map +1 -0
  79. package/core/dist/runtime/store/storage-paths.js +52 -0
  80. package/core/dist/runtime/store/storage-paths.js.map +1 -0
  81. package/core/dist/runtime/trajectory-retention.d.ts +257 -0
  82. package/core/dist/runtime/trajectory-retention.d.ts.map +1 -0
  83. package/core/dist/runtime/trajectory-retention.js +598 -0
  84. package/core/dist/runtime/trajectory-retention.js.map +1 -0
  85. package/core/dist/trajectory-store.d.ts +9 -9
  86. package/core/dist/trajectory-store.d.ts.map +1 -1
  87. package/core/dist/trajectory-store.js +9 -12
  88. package/core/dist/trajectory-store.js.map +1 -1
  89. package/core/package.json +1 -1
  90. package/dist/installers/codex-host-installer.d.ts.map +1 -1
  91. package/dist/installers/codex-host-installer.js +92 -5
  92. package/dist/installers/codex-host-installer.js.map +1 -1
  93. package/dist/installers/mcp-binding-shape-mirror.d.ts +27 -0
  94. package/dist/installers/mcp-binding-shape-mirror.d.ts.map +1 -0
  95. package/dist/installers/mcp-binding-shape-mirror.js +105 -0
  96. package/dist/installers/mcp-binding-shape-mirror.js.map +1 -0
  97. package/dist/skill-catalog.d.ts +35 -0
  98. package/dist/skill-catalog.d.ts.map +1 -0
  99. package/dist/skill-catalog.js +85 -0
  100. package/dist/skill-catalog.js.map +1 -0
  101. package/dist/skill-delivery-parity.d.ts +22 -0
  102. package/dist/skill-delivery-parity.d.ts.map +1 -0
  103. package/dist/skill-delivery-parity.js +31 -0
  104. package/dist/skill-delivery-parity.js.map +1 -0
  105. package/host-runtime/dist/active-principle-prompt.d.ts +8 -0
  106. package/host-runtime/dist/active-principle-prompt.js +15 -5
  107. package/host-runtime/dist/adaptive-decision-protocol.d.ts +142 -0
  108. package/host-runtime/dist/adaptive-decision-protocol.js +190 -0
  109. package/host-runtime/dist/adaptive-priority-provider.d.ts +37 -13
  110. package/host-runtime/dist/adaptive-priority-provider.js +65 -62
  111. package/host-runtime/dist/adaptive-selection.d.ts +67 -64
  112. package/host-runtime/dist/adaptive-selection.js +215 -327
  113. package/host-runtime/dist/adaptive-skip-decision.d.ts +26 -14
  114. package/host-runtime/dist/adaptive-skip-decision.js +33 -29
  115. package/host-runtime/dist/codex-rule-context-provider.js +4 -1
  116. package/host-runtime/dist/governance-observation-store.d.ts +40 -1
  117. package/host-runtime/dist/governance-observation-store.js +188 -9
  118. package/host-runtime/dist/governance-signal-admission.d.ts +19 -3
  119. package/host-runtime/dist/governance-signal-admission.js +12 -4
  120. package/host-runtime/dist/host-tool-declaration.d.ts +18 -2
  121. package/host-runtime/dist/host-tool-declaration.js +67 -11
  122. package/host-runtime/dist/host-tool-semantic-resolver.d.ts +7 -0
  123. package/host-runtime/dist/host-tool-semantic-resolver.js +22 -2
  124. package/host-runtime/dist/index.d.ts +3 -0
  125. package/host-runtime/dist/index.js +14 -0
  126. package/host-runtime/dist/production-rulehost-gate.js +15 -3
  127. package/host-runtime/dist/trajectory-retention.d.ts +147 -0
  128. package/host-runtime/dist/trajectory-retention.js +907 -0
  129. package/host-runtime/package.json +1 -1
  130. package/install-layout/dist/index.d.ts +9 -2
  131. package/install-layout/dist/index.js +26 -9
  132. package/install-layout/dist/mcp-binding-contract.d.ts +91 -0
  133. package/install-layout/dist/mcp-binding-contract.js +230 -0
  134. package/install-layout/package.json +1 -1
  135. package/package.json +4 -4
  136. package/pd-cli/dist/commands/build-trajectory-evidence.d.ts.map +1 -1
  137. package/pd-cli/dist/commands/build-trajectory-evidence.js +17 -11
  138. package/pd-cli/dist/commands/build-trajectory-evidence.js.map +1 -1
  139. package/pd-cli/dist/commands/codex-reconcile.d.ts +7 -0
  140. package/pd-cli/dist/commands/codex-reconcile.d.ts.map +1 -1
  141. package/pd-cli/dist/commands/codex-reconcile.js +11 -2
  142. package/pd-cli/dist/commands/codex-reconcile.js.map +1 -1
  143. package/pd-cli/dist/commands/codex-worker.d.ts.map +1 -1
  144. package/pd-cli/dist/commands/codex-worker.js +35 -0
  145. package/pd-cli/dist/commands/codex-worker.js.map +1 -1
  146. package/pd-cli/dist/commands/command-helpers.d.ts +1 -1
  147. package/pd-cli/dist/commands/command-helpers.js +1 -1
  148. package/pd-cli/dist/commands/errors-list.d.ts +1 -1
  149. package/pd-cli/dist/commands/errors-list.js +1 -1
  150. package/pd-cli/dist/commands/health-mcp.d.ts +23 -1
  151. package/pd-cli/dist/commands/health-mcp.d.ts.map +1 -1
  152. package/pd-cli/dist/commands/health-mcp.js +81 -22
  153. package/pd-cli/dist/commands/health-mcp.js.map +1 -1
  154. package/pd-cli/dist/commands/health.d.ts +1 -1
  155. package/pd-cli/dist/commands/health.d.ts.map +1 -1
  156. package/pd-cli/dist/commands/health.js +12 -5
  157. package/pd-cli/dist/commands/health.js.map +1 -1
  158. package/pd-cli/dist/commands/principles-stats.d.ts +1 -1
  159. package/pd-cli/dist/commands/principles-stats.js +1 -1
  160. package/pd-cli/dist/commands/trajectory-retention.d.ts +23 -0
  161. package/pd-cli/dist/commands/trajectory-retention.d.ts.map +1 -0
  162. package/pd-cli/dist/commands/trajectory-retention.js +159 -0
  163. package/pd-cli/dist/commands/trajectory-retention.js.map +1 -0
  164. package/pd-cli/dist/commands/workbuddy-setup.d.ts +69 -0
  165. package/pd-cli/dist/commands/workbuddy-setup.d.ts.map +1 -0
  166. package/pd-cli/dist/commands/workbuddy-setup.js +379 -0
  167. package/pd-cli/dist/commands/workbuddy-setup.js.map +1 -0
  168. package/pd-cli/dist/commands/workbuddy-worker.d.ts.map +1 -1
  169. package/pd-cli/dist/commands/workbuddy-worker.js +42 -6
  170. package/pd-cli/dist/commands/workbuddy-worker.js.map +1 -1
  171. package/pd-cli/dist/index.d.ts +1 -7
  172. package/pd-cli/dist/index.d.ts.map +1 -1
  173. package/pd-cli/dist/index.js +15 -1201
  174. package/pd-cli/dist/index.js.map +1 -1
  175. package/pd-cli/dist/program.d.ts +17 -0
  176. package/pd-cli/dist/program.d.ts.map +1 -0
  177. package/pd-cli/dist/program.js +1263 -0
  178. package/pd-cli/dist/program.js.map +1 -0
  179. package/pd-cli/dist/services/delivery-surfaces.d.ts.map +1 -1
  180. package/pd-cli/dist/services/delivery-surfaces.js +7 -5
  181. package/pd-cli/dist/services/delivery-surfaces.js.map +1 -1
  182. package/pd-cli/dist/services/version-report.d.ts.map +1 -1
  183. package/pd-cli/dist/services/version-report.js +30 -4
  184. package/pd-cli/dist/services/version-report.js.map +1 -1
  185. package/pd-cli/package.json +1 -1
  186. package/pd-mcp-server/dist/version.d.ts +1 -1
  187. package/pd-mcp-server/dist/version.js +1 -1
  188. package/pd-mcp-server/package.json +3 -1
  189. package/plugin/dist/bundle.js +544 -494
  190. package/plugin/dist/constants/tools.d.ts +8 -1
  191. package/plugin/dist/core/trajectory-retention-trigger.d.ts +13 -0
  192. package/plugin/dist/core/trajectory.d.ts +14 -0
  193. package/plugin/dist/hooks/gate-block-helper.d.ts +17 -0
  194. package/plugin/dist/hooks/gate.d.ts +6 -1
  195. package/plugin/dist/host-runtime/openclaw-host-runtime.d.ts +1 -0
  196. package/plugin/dist/index.d.ts +5 -0
  197. package/plugin/dist/openclaw.plugin.json +1 -1
  198. package/plugin/dist/rulehost-evidence.js +29 -23
  199. package/plugin/dist/templates/langs/en/skills/pd-cli-operator/SKILL.md +16 -5
  200. package/plugin/dist/templates/langs/en/skills/pd-control/SKILL.md +7 -6
  201. package/plugin/dist/templates/langs/en/skills/pd-pain-signal/SKILL.md +141 -28
  202. package/plugin/dist/templates/langs/en/skills/pd-review/SKILL.md +15 -1
  203. package/plugin/dist/templates/langs/zh/skills/pd-cli-operator/SKILL.md +16 -5
  204. package/plugin/dist/templates/langs/zh/skills/pd-control/SKILL.md +7 -6
  205. package/plugin/dist/templates/langs/zh/skills/pd-pain-signal/SKILL.md +142 -29
  206. package/plugin/dist/templates/langs/zh/skills/pd-review/SKILL.md +15 -1
  207. package/plugin/openclaw.plugin.json +1 -1
  208. package/plugin/package.json +1 -1
  209. package/plugin/templates/langs/en/skills/pd-cli-operator/SKILL.md +16 -5
  210. package/plugin/templates/langs/en/skills/pd-control/SKILL.md +7 -6
  211. package/plugin/templates/langs/en/skills/pd-pain-signal/SKILL.md +141 -28
  212. package/plugin/templates/langs/en/skills/pd-review/SKILL.md +15 -1
  213. package/plugin/templates/langs/zh/skills/pd-cli-operator/SKILL.md +16 -5
  214. package/plugin/templates/langs/zh/skills/pd-control/SKILL.md +7 -6
  215. package/plugin/templates/langs/zh/skills/pd-pain-signal/SKILL.md +142 -29
  216. package/plugin/templates/langs/zh/skills/pd-review/SKILL.md +15 -1
  217. package/release-manager/dist/installers/codex-host-installer.js +92 -5
  218. package/release-manager/dist/installers/mcp-binding-shape-mirror.js +105 -0
  219. package/release-manager/package.json +1 -1
  220. package/workbuddy-adapter/dist/codec/input-decoder.d.ts +10 -0
  221. package/workbuddy-adapter/dist/codec/input-decoder.js +62 -5
  222. package/workbuddy-adapter/dist/host-adapter.js +1 -0
  223. package/workbuddy-adapter/dist/index.d.ts +1 -0
  224. package/workbuddy-adapter/dist/index.js +1 -0
  225. package/workbuddy-adapter/dist/ingestion/catch-up.d.ts +25 -0
  226. package/workbuddy-adapter/dist/ingestion/catch-up.js +161 -0
  227. package/workbuddy-adapter/dist/ingestion/encode-cwd.d.ts +6 -0
  228. package/workbuddy-adapter/dist/ingestion/encode-cwd.js +39 -0
  229. package/workbuddy-adapter/dist/ingestion/index.d.ts +13 -0
  230. package/workbuddy-adapter/dist/ingestion/index.js +13 -0
  231. package/workbuddy-adapter/dist/ingestion/ingestion.d.ts +46 -0
  232. package/workbuddy-adapter/dist/ingestion/ingestion.js +135 -0
  233. package/workbuddy-adapter/dist/ingestion/transcript-decoder.d.ts +70 -0
  234. package/workbuddy-adapter/dist/ingestion/transcript-decoder.js +554 -0
  235. package/workbuddy-adapter/dist/ingestion/transcript-path.d.ts +39 -0
  236. package/workbuddy-adapter/dist/ingestion/transcript-path.js +117 -0
  237. package/workbuddy-adapter/dist/ingestion/transcript-source.d.ts +15 -0
  238. package/workbuddy-adapter/dist/ingestion/transcript-source.js +152 -0
  239. package/workbuddy-adapter/dist/pd-hook.d.ts +8 -0
  240. package/workbuddy-adapter/dist/pd-hook.js +59 -2
  241. package/workbuddy-adapter/dist/worker/workspace-worker.d.ts +9 -0
  242. package/workbuddy-adapter/dist/worker/workspace-worker.js +46 -17
  243. package/workbuddy-adapter/package.json +1 -1
  244. package/workbuddy-adapter/plugin/hooks/hooks.json +11 -0
  245. package/workbuddy-adapter/plugin/skills/pd-cli-operator/SKILL.md +57 -19
  246. package/workbuddy-adapter/plugin/skills/pd-control/SKILL.md +21 -9
  247. package/workbuddy-adapter/plugin/skills/pd-pain-signal/SKILL.md +72 -61
  248. package/workbuddy-adapter/plugin/skills/pd-review/SKILL.md +27 -12
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principles/host-runtime",
3
- "version": "3.4.0",
3
+ "version": "3.5.0",
4
4
  "description": "Shared host-neutral orchestration for Principles Disciple MVP-Core hook paths.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -98,7 +98,7 @@ export interface ResolveInstallLayoutOptions {
98
98
  }
99
99
  /**
100
100
  * Merge one Workspace into a manifest's workspace list (installer write path). Idempotent by canonical path. */
101
- export declare function mergeInstallManifestWorkspaces(current: InstallManifest | undefined, workspaceDir: string): string[];
101
+ export declare function mergeInstallManifestWorkspaces(current: InstallManifest | undefined, workspaceDir: string, platform?: string): string[];
102
102
  /**
103
103
  * The `hosts` array a manifest WRITER must persist: every registration the
104
104
  * reader recognized plus every unknown one, deduped, known hosts first.
@@ -113,7 +113,7 @@ export declare function installManifestHostsForPersist(manifest: InstallManifest
113
113
  * a host string this reader version does not know is a `warnings` entry and
114
114
  * the manifest still parses (forward compatibility — see `InstallManifest.unknownHosts`).
115
115
  */
116
- export declare function parseInstallManifest(value: unknown): {
116
+ export declare function parseInstallManifest(value: unknown, platform?: string): {
117
117
  manifest?: InstallManifest;
118
118
  warnings?: readonly InstallManifestWarning[];
119
119
  error?: string;
@@ -196,3 +196,10 @@ export declare function getPdCliEntry(paths: InstallLayoutPaths, mode: InstallLa
196
196
  * must not re-derive it locally.
197
197
  */
198
198
  export { PD_EXPERIMENT_ROOT_ENV, PD_OPENCLAW_HOME_ENV, PD_OPENCLAW_STATE_DIR_ENV, PD_HOME_MODES, PD_HOME_FAILURE_REASONS, resolvePdHome, isPathWithinRoot, type PdHomeMode, type PdHomePaths, type PdHomeFailure, type PdHomeFailureReason, type PdHomeSuccess, type PdHomeResolution, type ResolvePdHomeOptions, } from './pd-home.js';
199
+ /**
200
+ * MCP binding contract (schema `pd.mcp-binding.v1`). This is the single
201
+ * declaration of a valid binding; the launcher's payload copies are verified
202
+ * against it by the parity test, and the installer / `pd health` import it
203
+ * directly so neither can drift into a more permissive check.
204
+ */
205
+ export { MCP_BINDING_SCHEMA_VERSION, MCP_BINDING_HOSTS, MCP_BINDING_SERVER_ENTRY_SEGMENTS, MCP_BINDING_SHAPE_CODES, MCP_BINDING_LAUNCHER_ONLY_REASONS, MCP_BINDING_FIXTURES, getCanonicalMcpServerEntry, isSameMcpBindingPath, validateMcpBinding, buildMcpBindingFixture, isMcpBindingHost, isSupportedBindingSchemaVersion, isSemverVersion, type McpBindingHost, type McpBindingRecord, type McpBindingVerdict, type McpBindingShapeCode, type McpBindingFixture, type McpBindingFixtureId, type McpBindingFixtureContext, } from './mcp-binding-contract.js';
@@ -11,18 +11,27 @@ function isHost(value) {
11
11
  function isNonEmptyString(value) {
12
12
  return typeof value === 'string' && value.length > 0;
13
13
  }
14
- /** Workspace entries must be non-empty absolute paths — the Companion spawns per-Workspace workers keyed by canonical path. */
15
- function parseWorkspaceList(value) {
14
+ /**
15
+ * Path rules are selected by an injected platform rather than the ambient one,
16
+ * so the win32 rule can be exercised on POSIX CI (same pattern as
17
+ * `isSameMcpBindingPath` in the MCP binding contract). Production callers keep
18
+ * the default `process.platform` and therefore behave exactly as before.
19
+ */
20
+ function workspacePathApi(platform) {
21
+ return platform === 'win32' ? path.win32 : path.posix;
22
+ }
23
+ function parseWorkspaceList(value, platform) {
16
24
  if (value === undefined)
17
25
  return { workspaces: [] };
18
26
  if (!Array.isArray(value))
19
27
  return { error: 'install_manifest_malformed: workspaces must be non-empty absolute paths' };
28
+ const api = workspacePathApi(platform);
20
29
  const resolved = [];
21
30
  for (const entry of value) {
22
- if (typeof entry !== 'string' || entry.length === 0 || !path.isAbsolute(entry)) {
31
+ if (typeof entry !== 'string' || entry.length === 0 || !api.isAbsolute(entry)) {
23
32
  return { error: 'install_manifest_malformed: workspaces must be non-empty absolute paths' };
24
33
  }
25
- const canonical = path.resolve(entry);
34
+ const canonical = api.resolve(entry);
26
35
  if (!resolved.includes(canonical))
27
36
  resolved.push(canonical);
28
37
  }
@@ -30,11 +39,12 @@ function parseWorkspaceList(value) {
30
39
  }
31
40
  /**
32
41
  * Merge one Workspace into a manifest's workspace list (installer write path). Idempotent by canonical path. */
33
- export function mergeInstallManifestWorkspaces(current, workspaceDir) {
34
- const canonical = path.resolve(workspaceDir);
42
+ export function mergeInstallManifestWorkspaces(current, workspaceDir, platform = process.platform) {
43
+ const api = workspacePathApi(platform);
44
+ const canonical = api.resolve(workspaceDir);
35
45
  const resolved = [];
36
46
  for (const entry of current?.workspaces ?? []) {
37
- const normalized = path.resolve(entry);
47
+ const normalized = api.resolve(entry);
38
48
  if (!resolved.includes(normalized))
39
49
  resolved.push(normalized);
40
50
  }
@@ -58,7 +68,7 @@ export function installManifestHostsForPersist(manifest) {
58
68
  * a host string this reader version does not know is a `warnings` entry and
59
69
  * the manifest still parses (forward compatibility — see `InstallManifest.unknownHosts`).
60
70
  */
61
- export function parseInstallManifest(value) {
71
+ export function parseInstallManifest(value, platform = process.platform) {
62
72
  if (!isRecord(value))
63
73
  return { error: 'install_manifest_malformed: expected an object' };
64
74
  if (value.layoutVersion !== INSTALL_LAYOUT_VERSION) {
@@ -103,7 +113,7 @@ export function parseInstallManifest(value) {
103
113
  warnings.push({ code: 'install_manifest_unknown_host', host });
104
114
  }
105
115
  }
106
- const workspaces = parseWorkspaceList(value.workspaces);
116
+ const workspaces = parseWorkspaceList(value.workspaces, platform);
107
117
  if (workspaces.error)
108
118
  return { error: workspaces.error };
109
119
  return {
@@ -285,3 +295,10 @@ export function getPdCliEntry(paths, mode) {
285
295
  * must not re-derive it locally.
286
296
  */
287
297
  export { PD_EXPERIMENT_ROOT_ENV, PD_OPENCLAW_HOME_ENV, PD_OPENCLAW_STATE_DIR_ENV, PD_HOME_MODES, PD_HOME_FAILURE_REASONS, resolvePdHome, isPathWithinRoot, } from './pd-home.js';
298
+ /**
299
+ * MCP binding contract (schema `pd.mcp-binding.v1`). This is the single
300
+ * declaration of a valid binding; the launcher's payload copies are verified
301
+ * against it by the parity test, and the installer / `pd health` import it
302
+ * directly so neither can drift into a more permissive check.
303
+ */
304
+ export { MCP_BINDING_SCHEMA_VERSION, MCP_BINDING_HOSTS, MCP_BINDING_SERVER_ENTRY_SEGMENTS, MCP_BINDING_SHAPE_CODES, MCP_BINDING_LAUNCHER_ONLY_REASONS, MCP_BINDING_FIXTURES, getCanonicalMcpServerEntry, isSameMcpBindingPath, validateMcpBinding, buildMcpBindingFixture, isMcpBindingHost, isSupportedBindingSchemaVersion, isSemverVersion, } from './mcp-binding-contract.js';
@@ -0,0 +1,91 @@
1
+ export declare const MCP_BINDING_SCHEMA_VERSION = "pd.mcp-binding.v1";
2
+ export declare const MCP_BINDING_HOSTS: readonly ['codex', 'openclaw', 'workbuddy'];
3
+ export type McpBindingHost = (typeof MCP_BINDING_HOSTS)[number];
4
+ /**
5
+ * Canonical server entry per host, relative to the binding's `runtimeDir`.
6
+ * Codex installs into its plugin-data npm layout; OpenClaw/WorkBuddy bind the
7
+ * shared ~/.pd/runtime component layout.
8
+ */
9
+ export declare const MCP_BINDING_SERVER_ENTRY_SEGMENTS: Readonly<Record<McpBindingHost, readonly string[]>>;
10
+ export declare function getCanonicalMcpServerEntry(host: McpBindingHost, runtimeDir: string): string;
11
+ /** Shape-level rejection codes the shared validator can emit. */
12
+ export type McpBindingShapeCode = 'binding_invalid' | 'binding_schema_unsupported' | 'binding_host_invalid' | 'binding_host_mismatch' | 'binding_workspace_invalid' | 'binding_runtime_dir_invalid' | 'binding_server_entry_invalid' | 'binding_versions_invalid' | 'server_entry_not_canonical';
13
+ export interface McpBindingRecord {
14
+ readonly schemaVersion: string;
15
+ readonly host: McpBindingHost;
16
+ readonly workspaceDir: string;
17
+ readonly runtimeDir: string;
18
+ readonly serverEntry: string;
19
+ readonly versions: {
20
+ readonly mcpServer: string;
21
+ readonly core?: string;
22
+ };
23
+ }
24
+ export type McpBindingVerdict = {
25
+ readonly ok: true;
26
+ readonly binding: McpBindingRecord;
27
+ } | {
28
+ readonly ok: false;
29
+ readonly code: McpBindingShapeCode;
30
+ readonly reason: string;
31
+ readonly nextAction: string;
32
+ };
33
+ export declare function isMcpBindingHost(value: unknown): value is McpBindingHost;
34
+ export declare function isSupportedBindingSchemaVersion(value: unknown): boolean;
35
+ export declare function isSemverVersion(value: unknown): value is string;
36
+ /**
37
+ * Compare two binding paths with the LAUNCHER's rule: Windows paths are
38
+ * case-insensitive (`samePath` in launcher.cjs lowercases both sides), every
39
+ * other platform is exact. `platform` is injected (Node's `process.platform`
40
+ * value) instead of read here so the win32 branch is exercised on Linux CI.
41
+ */
42
+ export declare function isSameMcpBindingPath(left: string, right: string, platform: string): boolean;
43
+ /**
44
+ * Validate the binding SHAPE (and the canonical-entry rule) exactly as the
45
+ * launcher does. Filesystem facts — file present/readable, runtime dir and
46
+ * entry existing, realpath escapes, installed package identity/version — are
47
+ * deliberately NOT part of this function: each consumer observes those
48
+ * separately (see MCP_BINDING_LAUNCHER_ONLY_REASONS).
49
+ *
50
+ * `platform` is Node's `process.platform` value, injected by the caller so the
51
+ * Windows case-insensitive path rule of the launcher's `samePath()` is
52
+ * exercised on Linux CI.
53
+ */
54
+ export declare function validateMcpBinding(raw: unknown, expectedHost: McpBindingHost, platform: string): McpBindingVerdict;
55
+ export declare const MCP_BINDING_SHAPE_CODES: readonly McpBindingShapeCode[];
56
+ /**
57
+ * Launcher failure codes that are NOT part of the shared shape contract.
58
+ * Each one observes something the shape validator deliberately cannot: the
59
+ * file itself, the filesystem, the payload marker, or the installed package.
60
+ * Enumerated (with a reason) so a NEW launcher code cannot appear unnoticed.
61
+ */
62
+ export declare const MCP_BINDING_LAUNCHER_ONLY_REASONS: readonly {
63
+ readonly code: string;
64
+ readonly why: string;
65
+ }[];
66
+ export type McpBindingFixtureId = 'valid' | 'missing-workspace' | 'missing-server-entry' | 'relative-workspace' | 'foreign-server-entry' | 'relative-runtime' | 'foreign-host' | 'unknown-host' | 'unsupported-schema' | 'invalid-versions' | 'not-an-object';
67
+ export interface McpBindingFixture {
68
+ readonly id: McpBindingFixtureId;
69
+ readonly description: string;
70
+ /** null = must be accepted; otherwise the reason prefix both sides must report. */
71
+ readonly expectedReasonPrefix: string | null;
72
+ }
73
+ /**
74
+ * Table-driven matrix shared by the contract test, the launcher parity test and
75
+ * the installer self-heal test. Covers every host because each host has its own
76
+ * canonical entry layout, and every shape reason code so a new code cannot be
77
+ * added without a sample.
78
+ */
79
+ export declare const MCP_BINDING_FIXTURES: readonly McpBindingFixture[];
80
+ export interface McpBindingFixtureContext {
81
+ readonly host: McpBindingHost;
82
+ readonly runtimeDir: string;
83
+ readonly workspaceDir: string;
84
+ /** An absolute path that is NOT this host's canonical entry. */
85
+ readonly foreignServerEntry: string;
86
+ readonly versions?: {
87
+ readonly mcpServer: string;
88
+ readonly core?: string;
89
+ };
90
+ }
91
+ export declare function buildMcpBindingFixture(id: McpBindingFixtureId, ctx: McpBindingFixtureContext): unknown;
@@ -0,0 +1,230 @@
1
+ /**
2
+ * MCP binding contract — the ONE declaration of what a valid
3
+ * `<payload>/mcp-binding.json` looks like (schema `pd.mcp-binding.v1`).
4
+ *
5
+ * The fail-closed launcher is the runtime authority for this file. Its three
6
+ * payload copies must stay dependency-free (they are executed before any PD
7
+ * package is installed), so they cannot import this module. Instead:
8
+ *
9
+ * - the launcher's binding gate and this declaration must produce the SAME
10
+ * verdict for the SAME input — `mcp-binding-contract-parity.test.ts` runs
11
+ * the real launcher over the fixtures below and fails on any divergence;
12
+ * - `pd health` consumes this module directly, so it can never be more
13
+ * permissive than the launcher; the packaged installer consumes the pinned
14
+ * mirror noted below instead of importing this module at runtime.
15
+ *
16
+ * SAME-SOURCE POINTER — a pinned mirror of this declaration lives at
17
+ * packages/create-principles-disciple/src/installers/mcp-binding-shape-mirror.ts
18
+ * The packaged installer cannot import this module at runtime (it must load
19
+ * against the PUBLISHED install-layout, PRI-669/RF-02, and a normal PR may not
20
+ * raise the dependency floor), so it mirrors these rules verbatim. The two
21
+ * files MUST change together, in the same commit; the 33-cell parity test
22
+ * (`mcp-binding-shape-mirror-parity.test.ts`) pins identical verdicts. The
23
+ * mirror is retired by PRI-1191 once the export is published and the installer
24
+ * floor is raised.
25
+ *
26
+ * Adding a reason code on either side without a fixture/exemption makes that
27
+ * parity test red — divergence is a defect, not something to remember.
28
+ */
29
+ import * as path from 'node:path';
30
+ export const MCP_BINDING_SCHEMA_VERSION = 'pd.mcp-binding.v1';
31
+ export const MCP_BINDING_HOSTS = ['codex', 'openclaw', 'workbuddy'];
32
+ /**
33
+ * Canonical server entry per host, relative to the binding's `runtimeDir`.
34
+ * Codex installs into its plugin-data npm layout; OpenClaw/WorkBuddy bind the
35
+ * shared ~/.pd/runtime component layout.
36
+ */
37
+ export const MCP_BINDING_SERVER_ENTRY_SEGMENTS = {
38
+ codex: ['node_modules', '@principles', 'pd-mcp-server', 'dist', 'index.js'],
39
+ openclaw: ['pd-mcp-server', 'dist', 'index.js'],
40
+ workbuddy: ['pd-mcp-server', 'dist', 'index.js'],
41
+ };
42
+ export function getCanonicalMcpServerEntry(host, runtimeDir) {
43
+ return path.join(runtimeDir, ...MCP_BINDING_SERVER_ENTRY_SEGMENTS[host]);
44
+ }
45
+ const SEMVER = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
46
+ function isRecord(value) {
47
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
48
+ }
49
+ function isAbsolutePath(value) {
50
+ return typeof value === 'string' && path.isAbsolute(value);
51
+ }
52
+ export function isMcpBindingHost(value) {
53
+ return typeof value === 'string' && MCP_BINDING_HOSTS.includes(value);
54
+ }
55
+ export function isSupportedBindingSchemaVersion(value) {
56
+ return value === MCP_BINDING_SCHEMA_VERSION;
57
+ }
58
+ export function isSemverVersion(value) {
59
+ return typeof value === 'string' && SEMVER.test(value);
60
+ }
61
+ /**
62
+ * Compare two binding paths with the LAUNCHER's rule: Windows paths are
63
+ * case-insensitive (`samePath` in launcher.cjs lowercases both sides), every
64
+ * other platform is exact. `platform` is injected (Node's `process.platform`
65
+ * value) instead of read here so the win32 branch is exercised on Linux CI.
66
+ */
67
+ export function isSameMcpBindingPath(left, right, platform) {
68
+ const a = path.resolve(left);
69
+ const b = path.resolve(right);
70
+ return platform === 'win32' ? a.toLowerCase() === b.toLowerCase() : a === b;
71
+ }
72
+ function reject(code, reason, nextAction) {
73
+ return { ok: false, code, reason, nextAction };
74
+ }
75
+ /**
76
+ * Validate the binding SHAPE (and the canonical-entry rule) exactly as the
77
+ * launcher does. Filesystem facts — file present/readable, runtime dir and
78
+ * entry existing, realpath escapes, installed package identity/version — are
79
+ * deliberately NOT part of this function: each consumer observes those
80
+ * separately (see MCP_BINDING_LAUNCHER_ONLY_REASONS).
81
+ *
82
+ * `platform` is Node's `process.platform` value, injected by the caller so the
83
+ * Windows case-insensitive path rule of the launcher's `samePath()` is
84
+ * exercised on Linux CI.
85
+ */
86
+ export function validateMcpBinding(raw, expectedHost, platform) {
87
+ if (!isRecord(raw)) {
88
+ return reject('binding_invalid', 'binding_invalid', 'Re-run the PD host setup to regenerate a valid mcp-binding.json.');
89
+ }
90
+ if (!isSupportedBindingSchemaVersion(raw.schemaVersion)) {
91
+ // rc-8/rc-9: this value is untrusted and the reason reaches host logs.
92
+ const schemaKind = typeof raw.schemaVersion === 'string'
93
+ ? raw.schemaVersion.replace(/[^A-Za-z0-9._-]/g, '').slice(0, 60)
94
+ : 'non-string';
95
+ return reject('binding_schema_unsupported', `binding_schema_unsupported:${schemaKind}`, 'The plugin and the PD installation come from different generations. Re-run the PD host setup after updating PD.');
96
+ }
97
+ if (!isMcpBindingHost(raw.host)) {
98
+ return reject('binding_host_invalid', 'binding_host_invalid', 'Re-run the PD host setup; the host marker is written by the PD installer and must not be edited.');
99
+ }
100
+ if (raw.host !== expectedHost) {
101
+ return reject('binding_host_mismatch', `binding_host_mismatch:${raw.host}!=${expectedHost}`, 'This mcp-binding.json belongs to a different host payload. Re-run the PD host setup for THIS host.');
102
+ }
103
+ if (!isAbsolutePath(raw.workspaceDir)) {
104
+ return reject('binding_workspace_invalid', 'binding_workspace_invalid', 'Re-run the PD host setup so the binding records the absolute governance workspace directory.');
105
+ }
106
+ if (!isAbsolutePath(raw.runtimeDir)) {
107
+ return reject('binding_runtime_dir_invalid', 'binding_runtime_dir_invalid', 'Re-run the PD host setup so the binding records the absolute pinned-runtime directory.');
108
+ }
109
+ if (!isAbsolutePath(raw.serverEntry)) {
110
+ return reject('binding_server_entry_invalid', 'binding_server_entry_invalid', 'Re-run the PD host setup so the binding records the absolute MCP server entry path.');
111
+ }
112
+ const { versions } = raw;
113
+ if (!isRecord(versions) || !isSemverVersion(versions.mcpServer)) {
114
+ return reject('binding_versions_invalid', 'binding_versions_invalid', 'Re-run the PD host setup to regenerate the binding version record.');
115
+ }
116
+ const canonicalEntry = getCanonicalMcpServerEntry(expectedHost, raw.runtimeDir);
117
+ if (!isSameMcpBindingPath(raw.serverEntry, canonicalEntry, platform)) {
118
+ return reject('server_entry_not_canonical', `server_entry_not_canonical:${expectedHost}`, 'The binding points outside the documented MCP server entry. Re-run the PD host setup; do not edit mcp-binding.json by hand.');
119
+ }
120
+ const { mcpServer } = versions;
121
+ const binding = {
122
+ schemaVersion: MCP_BINDING_SCHEMA_VERSION,
123
+ host: expectedHost,
124
+ workspaceDir: raw.workspaceDir,
125
+ runtimeDir: raw.runtimeDir,
126
+ serverEntry: raw.serverEntry,
127
+ versions: {
128
+ mcpServer,
129
+ ...(typeof versions.core === 'string' ? { core: versions.core } : {}),
130
+ },
131
+ };
132
+ return { ok: true, binding };
133
+ }
134
+ export const MCP_BINDING_SHAPE_CODES = [
135
+ 'binding_invalid',
136
+ 'binding_schema_unsupported',
137
+ 'binding_host_invalid',
138
+ 'binding_host_mismatch',
139
+ 'binding_workspace_invalid',
140
+ 'binding_runtime_dir_invalid',
141
+ 'binding_server_entry_invalid',
142
+ 'binding_versions_invalid',
143
+ 'server_entry_not_canonical',
144
+ ];
145
+ /**
146
+ * Launcher failure codes that are NOT part of the shared shape contract.
147
+ * Each one observes something the shape validator deliberately cannot: the
148
+ * file itself, the filesystem, the payload marker, or the installed package.
149
+ * Enumerated (with a reason) so a NEW launcher code cannot appear unnoticed.
150
+ */
151
+ export const MCP_BINDING_LAUNCHER_ONLY_REASONS = [
152
+ { code: 'binding_missing', why: 'The binding file is absent — a filesystem fact, not a shape fact.' },
153
+ { code: 'binding_unreadable', why: 'The file could not be read or parsed as JSON.' },
154
+ { code: 'host_marker_missing', why: 'The payload marker decides which host owns this launcher.' },
155
+ { code: 'host_marker_ambiguous', why: 'More than one payload marker would make host ownership ambiguous.' },
156
+ { code: 'runtime_dir_missing', why: 'The recorded runtime directory must exist on this machine.' },
157
+ { code: 'server_entry_missing', why: 'The canonical entry file must exist on this machine.' },
158
+ { code: 'server_entry_escape', why: 'symlink/junction resolution must stay inside the runtime directory.' },
159
+ { code: 'server_package_identity_mismatch', why: 'The installed package.json must identify @principles/pd-mcp-server.' },
160
+ { code: 'server_package_version_invalid', why: 'The installed package version must be readable.' },
161
+ { code: 'binding_version_mismatch', why: 'Binding and installed package versions must agree.' },
162
+ { code: 'runtime_pin_invalid', why: 'The Codex payload pin must exist and be well formed.' },
163
+ { code: 'runtime_pin_mismatch', why: 'The installed runtime must match the payload pin.' },
164
+ { code: 'binding_workspace_missing', why: 'The bound workspace must exist on this machine.' },
165
+ { code: 'binding_workspace_not_directory', why: 'The bound workspace must be a directory.' },
166
+ { code: 'binding_workspace_not_declared', why: 'OpenClaw requires an explicit workspace declaration matching the binding.' },
167
+ { code: 'workspace_declaration_missing', why: 'OpenClaw declaration sources produced no workspace (dynamic reason from the declaration resolver).' },
168
+ { code: 'workspace_declaration_invalid', why: 'OpenClaw declaration sources produced a value that is not a usable absolute workspace directory (dynamic reason from the declaration resolver).' },
169
+ { code: 'server_entry_invalid', why: 'The entry module must actually export main().' },
170
+ { code: 'server_startup_failed', why: 'The server process itself failed to start.' },
171
+ ];
172
+ /**
173
+ * Table-driven matrix shared by the contract test, the launcher parity test and
174
+ * the installer self-heal test. Covers every host because each host has its own
175
+ * canonical entry layout, and every shape reason code so a new code cannot be
176
+ * added without a sample.
177
+ */
178
+ export const MCP_BINDING_FIXTURES = [
179
+ { id: 'valid', description: 'complete binding pointing at the canonical entry', expectedReasonPrefix: null },
180
+ { id: 'missing-workspace', description: 'workspaceDir is absent', expectedReasonPrefix: 'binding_workspace_invalid' },
181
+ { id: 'missing-server-entry', description: 'serverEntry is absent', expectedReasonPrefix: 'binding_server_entry_invalid' },
182
+ { id: 'relative-workspace', description: 'workspaceDir is a relative path', expectedReasonPrefix: 'binding_workspace_invalid' },
183
+ { id: 'foreign-server-entry', description: 'serverEntry points somewhere other than the canonical entry', expectedReasonPrefix: 'server_entry_not_canonical' },
184
+ { id: 'relative-runtime', description: 'runtimeDir is a relative path', expectedReasonPrefix: 'binding_runtime_dir_invalid' },
185
+ { id: 'foreign-host', description: 'binding was written by a different host payload', expectedReasonPrefix: 'binding_host_mismatch' },
186
+ { id: 'unknown-host', description: 'host is not a known PD host', expectedReasonPrefix: 'binding_host_invalid' },
187
+ { id: 'unsupported-schema', description: 'schemaVersion belongs to another binding generation', expectedReasonPrefix: 'binding_schema_unsupported' },
188
+ { id: 'invalid-versions', description: 'versions.mcpServer is not a semver', expectedReasonPrefix: 'binding_versions_invalid' },
189
+ { id: 'not-an-object', description: 'the binding file is not a JSON object', expectedReasonPrefix: 'binding_invalid' },
190
+ ];
191
+ export function buildMcpBindingFixture(id, ctx) {
192
+ const base = {
193
+ schemaVersion: MCP_BINDING_SCHEMA_VERSION,
194
+ host: ctx.host,
195
+ workspaceDir: ctx.workspaceDir,
196
+ runtimeDir: ctx.runtimeDir,
197
+ serverEntry: getCanonicalMcpServerEntry(ctx.host, ctx.runtimeDir),
198
+ versions: ctx.versions ?? { mcpServer: '0.0.0' },
199
+ };
200
+ switch (id) {
201
+ case 'valid':
202
+ return base;
203
+ case 'missing-workspace': {
204
+ const copy = { ...base };
205
+ delete copy.workspaceDir;
206
+ return copy;
207
+ }
208
+ case 'missing-server-entry': {
209
+ const copy = { ...base };
210
+ delete copy.serverEntry;
211
+ return copy;
212
+ }
213
+ case 'relative-workspace':
214
+ return { ...base, workspaceDir: path.join('relative', 'workspace') };
215
+ case 'foreign-server-entry':
216
+ return { ...base, serverEntry: ctx.foreignServerEntry };
217
+ case 'relative-runtime':
218
+ return { ...base, runtimeDir: path.join('relative', 'runtime') };
219
+ case 'foreign-host':
220
+ return { ...base, host: ctx.host === 'codex' ? 'openclaw' : 'codex' };
221
+ case 'unknown-host':
222
+ return { ...base, host: 'vscode' };
223
+ case 'unsupported-schema':
224
+ return { ...base, schemaVersion: 'pd.mcp-binding.v0' };
225
+ case 'invalid-versions':
226
+ return { ...base, versions: { mcpServer: 'not-a-semver' } };
227
+ case 'not-an-object':
228
+ return [base];
229
+ }
230
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principles/install-layout",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-principles-disciple",
3
- "version": "1.150.3",
3
+ "version": "1.150.4",
4
4
  "description": "Interactive CLI installer for Principles Disciple OpenClaw plugin",
5
5
  "type": "module",
6
6
  "bin": {
@@ -63,7 +63,7 @@
63
63
  "dependencies": {
64
64
  "@earendil-works/pi-agent-core": "1.2.0",
65
65
  "@earendil-works/pi-ai": "1.4.0",
66
- "@principles/install-layout": "^0.7.0",
66
+ "@principles/install-layout": "^0.8.0",
67
67
  "@sinclair/typebox": "^0.34.52",
68
68
  "@tufjs/models": "3.0.1",
69
69
  "@inquirer/prompts": "^8.7.2",
@@ -99,7 +99,7 @@
99
99
  "directory": "packages/create-principles-disciple"
100
100
  },
101
101
  "pd": {
102
- "bundledPluginVersion": "3.2.1"
102
+ "bundledPluginVersion": "2.2.13"
103
103
  },
104
- "gitHead": "1851ac671ffc4391a0e732af2bca991e199d483e"
104
+ "gitHead": "5c7389e72a6409efb00891327a63dfc01a2009cb"
105
105
  }
@@ -1 +1 @@
1
- {"version":3,"file":"build-trajectory-evidence.d.ts","sourceRoot":"","sources":["../../src/commands/build-trajectory-evidence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAUH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,6BAA6B,GACrC;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,iBAAiB,EAAE,CAAA;CAAE,GACrD;IACE,MAAM,EAAE,aAAa,CAAC;IACtB,UAAU,EAAE,wBAAwB,GAAG,mBAAmB,GAAG,kBAAkB,GAAG,sBAAsB,CAAC;IACzG,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,UAAU,GAAG,YAAY,CAAC;CACpC,CAAC;AAqMN;;;;;;;;;;;;GAYG;AACH,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,YAAY,CAAC,EAAE,MAAM,GACpB,6BAA6B,CAgF/B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qCAAqC,CACnD,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,YAAY,CAAC,EAAE,MAAM,GACpB,6BAA6B,CAyD/B"}
1
+ {"version":3,"file":"build-trajectory-evidence.d.ts","sourceRoot":"","sources":["../../src/commands/build-trajectory-evidence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAUH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,6BAA6B,GACrC;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,iBAAiB,EAAE,CAAA;CAAE,GACrD;IACE,MAAM,EAAE,aAAa,CAAC;IACtB,UAAU,EAAE,wBAAwB,GAAG,mBAAmB,GAAG,kBAAkB,GAAG,sBAAsB,CAAC;IACzG,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,UAAU,GAAG,YAAY,CAAC;CACpC,CAAC;AA2MN;;;;;;;;;;;;GAYG;AACH,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,YAAY,CAAC,EAAE,MAAM,GACpB,6BAA6B,CAgF/B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qCAAqC,CACnD,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,YAAY,CAAC,EAAE,MAAM,GACpB,6BAA6B,CAyD/B"}
@@ -73,15 +73,18 @@ function readToolFailureEvidence(db, sessionId, workspaceDir) {
73
73
  function collectEvidenceFromDb(db, sessionId, workspaceDir) {
74
74
  const evidence = [];
75
75
  let readFailed = false;
76
- // Try to read user turns with correction detection
76
+ // Try to read the most recent correction turn.
77
+ // SPEC-PD-TR-001 §5.1: bounded in SQL. The previous version materialised
78
+ // every user turn of the session and reversed the array in memory, so cost
79
+ // grew with conversation length.
77
80
  try {
78
- const userTurns = db.prepare(`
81
+ const lastCorrectionTurn = db.prepare(`
79
82
  SELECT id, raw_excerpt, correction_detected, correction_cue, created_at
80
83
  FROM user_turns
81
- WHERE session_id = ?
82
- ORDER BY id ASC
83
- `).all(sessionId);
84
- const lastCorrectionTurn = [...userTurns].reverse().find(t => Boolean(t.correction_detected));
84
+ WHERE session_id = ? AND correction_detected = 1
85
+ ORDER BY id DESC
86
+ LIMIT 1
87
+ `).get(sessionId);
85
88
  if (lastCorrectionTurn) {
86
89
  const rawExcerpt = typeof lastCorrectionTurn.raw_excerpt === 'string'
87
90
  ? lastCorrectionTurn.raw_excerpt
@@ -103,16 +106,19 @@ function collectEvidenceFromDb(db, sessionId, workspaceDir) {
103
106
  });
104
107
  }
105
108
  }
106
- // Try to read assistant turns (last 3)
109
+ // Try to read the last 3 assistant turns.
110
+ // SPEC-PD-TR-001 §5.1: `ORDER BY id DESC LIMIT 3` + reverse gives the same
111
+ // chronological window as `slice(-3)` without materialising the session.
107
112
  try {
108
- const assistantTurns = db.prepare(`
113
+ const assistantTurnsDesc = db.prepare(`
109
114
  SELECT id, sanitized_text, stop_reason, created_at
110
115
  FROM assistant_turns
111
116
  WHERE session_id = ?
112
- ORDER BY id ASC
117
+ ORDER BY id DESC
118
+ LIMIT 3
113
119
  `).all(sessionId);
114
- const recentAssistant = assistantTurns.slice(-3);
115
- for (const turn of recentAssistant) {
120
+ const assistantTurns = [...assistantTurnsDesc].reverse();
121
+ for (const turn of assistantTurns) {
116
122
  if (evidence.length >= MAX_EVIDENCE_ENTRIES)
117
123
  break;
118
124
  const sanitizedText = typeof turn.sanitized_text === 'string'
@@ -1 +1 @@
1
- {"version":3,"file":"build-trajectory-evidence.js","sourceRoot":"","sources":["../../src/commands/build-trajectory-evidence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,GACf,MAAM,0BAA0B,CAAC;AA2BlC,gFAAgF;AAChF,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC;IACtC,oBAAoB;IACpB,2BAA2B;IAC3B,wBAAwB;IACxB,+BAA+B;IAC/B,kBAAkB;CACnB,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,SAAS,uBAAuB,CAC9B,EAAqB,EACrB,SAAiB,EACjB,YAAqB;IAErB,MAAM,OAAO,GAAwB,EAAE,CAAC;IACxC,IAAI,UAAU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J,CAAC;IAED,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,uBAAuB,CAAC,EAAE,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;QACzE,sEAAsE;QACtE,oEAAoE;QACpE,oEAAoE;QACpE,IAAI,WAAW,CAAC,UAAU,EAAE,CAAC;YAC3B,OAAO;gBACL,MAAM,EAAE,aAAa;gBACrB,UAAU,EAAE,sBAAsB;gBAClC,MAAM,EAAE,6BAA6B;gBACrC,OAAO,EAAE,YAAY;aACtB,CAAC;QACJ,CAAC;QACD,IAAI,WAAW,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrC,OAAO;gBACL,MAAM,EAAE,aAAa;gBACrB,UAAU,EAAE,kBAAkB;gBAC9B,MAAM,EAAE,wBAAwB;gBAChC,OAAO,EAAE,YAAY;aACtB,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,CAAC;IAC/D,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"build-trajectory-evidence.js","sourceRoot":"","sources":["../../src/commands/build-trajectory-evidence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,GACf,MAAM,0BAA0B,CAAC;AA2BlC,gFAAgF;AAChF,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC;IACtC,oBAAoB;IACpB,2BAA2B;IAC3B,wBAAwB;IACxB,+BAA+B;IAC/B,kBAAkB;CACnB,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,SAAS,uBAAuB,CAC9B,EAAqB,EACrB,SA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CAAC;IAED,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,uBAAuB,CAAC,EAAE,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;QACzE,sEAAsE;QACtE,oEAAoE;QACpE,oEAAoE;QACpE,IAAI,WAAW,CAAC,UAAU,EAAE,CAAC;YAC3B,OAAO;gBACL,MAAM,EAAE,aAAa;gBACrB,UAAU,EAAE,sBAAsB;gBAClC,MAAM,EAAE,6BAA6B;gBACrC,OAAO,EAAE,YAAY;aACtB,CAAC;QACJ,CAAC;QACD,IAAI,WAAW,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrC,OAAO;gBACL,MAAM,EAAE,aAAa;gBACrB,UAAU,EAAE,kBAAkB;gBAC9B,MAAM,EAAE,wBAAwB;gBAChC,OAAO,EAAE,YAAY;aACtB,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,CAAC;IAC/D,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
@@ -17,6 +17,13 @@ export interface CodexReconcileReport {
17
17
  staleTails: number;
18
18
  degradations: string[];
19
19
  }
20
+ /**
21
+ * `pd codex-reconcile` entry point: repair Codex governance task/link state.
22
+ *
23
+ * Resolves the workspace and consent config first; an invalid config degrades
24
+ * with a structured reason/nextAction and performs no mutation (cli-5). Emits
25
+ * exactly one JSON object under `--json` (cli-1).
26
+ */
20
27
  export declare function handleCodexReconcile(options: CodexReconcileOptions): Promise<void>;
21
28
  export {};
22
29
  //# sourceMappingURL=codex-reconcile.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"codex-reconcile.d.ts","sourceRoot":"","sources":["../../src/commands/codex-reconcile.ts"],"names":[],"mappings":"AAoBA,UAAU,qBAAqB;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqExF"}
1
+ {"version":3,"file":"codex-reconcile.d.ts","sourceRoot":"","sources":["../../src/commands/codex-reconcile.ts"],"names":[],"mappings":"AAoBA,UAAU,qBAAqB;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAuExF"}
@@ -17,6 +17,13 @@
17
17
  import { resolveWorkspaceDir } from '../resolve-workspace.js';
18
18
  import { loadPdConfigForPlugin, reconcileGovernanceContinuation } from '@principles/host-runtime';
19
19
  import { computeFeatureFlagsFromConfig } from '@principles/core/runtime';
20
+ /**
21
+ * `pd codex-reconcile` entry point: repair Codex governance task/link state.
22
+ *
23
+ * Resolves the workspace and consent config first; an invalid config degrades
24
+ * with a structured reason/nextAction and performs no mutation (cli-5). Emits
25
+ * exactly one JSON object under `--json` (cli-1).
26
+ */
20
27
  export async function handleCodexReconcile(options) {
21
28
  const generatedAt = new Date().toISOString();
22
29
  const workspace = resolveWorkspaceDir(options.workspace);
@@ -46,10 +53,12 @@ export async function handleCodexReconcile(options) {
46
53
  process.exitCode = 1;
47
54
  return;
48
55
  }
49
- const conversationIngestionEnabled = computeFeatureFlagsFromConfig(config.effective).flags.codex_conversation_ingestion?.enabled === true;
56
+ const codexConversationIngestionEnabled = computeFeatureFlagsFromConfig(config.effective).flags.codex_conversation_ingestion?.enabled === true;
50
57
  const result = await reconcileGovernanceContinuation({
51
58
  workspaceDir: workspace,
52
- conversationIngestionEnabled,
59
+ codexConversationIngestionEnabled,
60
+ // Legacy alias for an older installed host-runtime (P2 review).
61
+ conversationIngestionEnabled: codexConversationIngestionEnabled,
53
62
  ...(typeof options.limit === 'number' ? { limit: options.limit } : {}),
54
63
  });
55
64
  const report = {