create-principles-disciple 1.152.5 → 1.153.1

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 (258) hide show
  1. package/_release/product-identity.json +1 -1
  2. package/agent-skill/pd-setup/SKILL.md +70 -0
  3. package/codex-adapter/dist/background-selection.d.ts +9 -0
  4. package/codex-adapter/dist/background-selection.js +142 -0
  5. package/codex-adapter/dist/ingestion/adaptive-append-state.d.ts +209 -0
  6. package/codex-adapter/dist/ingestion/adaptive-append-state.js +544 -0
  7. package/codex-adapter/dist/pd-hook.js +329 -5
  8. package/codex-adapter/package.json +1 -1
  9. package/console/dist/server/config/pd-config-store.d.ts +11 -15
  10. package/console/dist/server/config/pd-config-store.js +92 -17
  11. package/console/dist/server/models/ActivationsConsoleModel.d.ts +8 -0
  12. package/console/dist/server/models/ActivationsConsoleModel.js +3 -2
  13. package/console/dist/server/models/AdaptiveActivationConsoleModel.d.ts +43 -4
  14. package/console/dist/server/models/AdaptiveActivationConsoleModel.js +36 -7
  15. package/console/dist/server/models/ExaminerEvidenceModel.d.ts +6 -2
  16. package/console/dist/server/models/ExaminerEvidenceModel.js +13 -2
  17. package/console/dist/server/routes/config.js +34 -8
  18. package/console/dist/server/routes/examiner-executor.d.ts +33 -0
  19. package/console/dist/server/routes/examiner-executor.js +95 -0
  20. package/console/dist/server/routes/examiner.js +12 -9
  21. package/console/dist/web/assets/app.css +14 -10
  22. package/console/dist/web/assets/app.js +27 -27
  23. package/core/dist/ledger-file-lock.d.ts +38 -0
  24. package/core/dist/ledger-file-lock.d.ts.map +1 -0
  25. package/core/dist/ledger-file-lock.js +240 -0
  26. package/core/dist/ledger-file-lock.js.map +1 -0
  27. package/core/dist/principle-text-normalization.d.ts +32 -0
  28. package/core/dist/principle-text-normalization.d.ts.map +1 -0
  29. package/core/dist/principle-text-normalization.js +34 -0
  30. package/core/dist/principle-text-normalization.js.map +1 -0
  31. package/core/dist/principle-tree-ledger.d.ts +22 -21
  32. package/core/dist/principle-tree-ledger.d.ts.map +1 -1
  33. package/core/dist/principle-tree-ledger.js +77 -204
  34. package/core/dist/principle-tree-ledger.js.map +1 -1
  35. package/core/dist/runtime/activation/sqlite-approval-store.d.ts.map +1 -1
  36. package/core/dist/runtime/activation/sqlite-approval-store.js +7 -1
  37. package/core/dist/runtime/activation/sqlite-approval-store.js.map +1 -1
  38. package/core/dist/runtime/adapter/principle-tree-ledger-adapter.d.ts +13 -0
  39. package/core/dist/runtime/adapter/principle-tree-ledger-adapter.d.ts.map +1 -1
  40. package/core/dist/runtime/adapter/principle-tree-ledger-adapter.js +90 -1
  41. package/core/dist/runtime/adapter/principle-tree-ledger-adapter.js.map +1 -1
  42. package/core/dist/runtime/adapter/schema-prompt-adapter.d.ts.map +1 -1
  43. package/core/dist/runtime/adapter/schema-prompt-adapter.js +21 -30
  44. package/core/dist/runtime/adapter/schema-prompt-adapter.js.map +1 -1
  45. package/core/dist/runtime/candidate-intake-service.d.ts +40 -1
  46. package/core/dist/runtime/candidate-intake-service.d.ts.map +1 -1
  47. package/core/dist/runtime/candidate-intake-service.js +548 -110
  48. package/core/dist/runtime/candidate-intake-service.js.map +1 -1
  49. package/core/dist/runtime/candidate-intake.d.ts +59 -2
  50. package/core/dist/runtime/candidate-intake.d.ts.map +1 -1
  51. package/core/dist/runtime/candidate-intake.js +23 -0
  52. package/core/dist/runtime/candidate-intake.js.map +1 -1
  53. package/core/dist/runtime/candidate-seed-suppression.d.ts +63 -0
  54. package/core/dist/runtime/candidate-seed-suppression.d.ts.map +1 -0
  55. package/core/dist/runtime/candidate-seed-suppression.js +29 -0
  56. package/core/dist/runtime/candidate-seed-suppression.js.map +1 -0
  57. package/core/dist/runtime/config/pd-config-agent-binding.d.ts +5 -5
  58. package/core/dist/runtime/config/pd-config-agent-binding.d.ts.map +1 -1
  59. package/core/dist/runtime/config/pd-config-agent-binding.js +22 -16
  60. package/core/dist/runtime/config/pd-config-agent-binding.js.map +1 -1
  61. package/core/dist/runtime/config/pd-config-feature-flags.d.ts +10 -0
  62. package/core/dist/runtime/config/pd-config-feature-flags.d.ts.map +1 -1
  63. package/core/dist/runtime/config/pd-config-feature-flags.js +14 -0
  64. package/core/dist/runtime/config/pd-config-feature-flags.js.map +1 -1
  65. package/core/dist/runtime/config/pd-config-types.d.ts +9 -0
  66. package/core/dist/runtime/config/pd-config-types.d.ts.map +1 -1
  67. package/core/dist/runtime/config/pd-config-types.js.map +1 -1
  68. package/core/dist/runtime/config/pd-config-validate.d.ts.map +1 -1
  69. package/core/dist/runtime/config/pd-config-validate.js +10 -2
  70. package/core/dist/runtime/config/pd-config-validate.js.map +1 -1
  71. package/core/dist/runtime/config/pd-credentials.d.ts.map +1 -1
  72. package/core/dist/runtime/config/pd-credentials.js +7 -1
  73. package/core/dist/runtime/config/pd-credentials.js.map +1 -1
  74. package/core/dist/runtime/diagnostician/distiller-prompt-builder.d.ts.map +1 -1
  75. package/core/dist/runtime/diagnostician/distiller-prompt-builder.js +30 -3
  76. package/core/dist/runtime/diagnostician/distiller-prompt-builder.js.map +1 -1
  77. package/core/dist/runtime/diagnostician/rootcause-prompt-builder.d.ts.map +1 -1
  78. package/core/dist/runtime/diagnostician/rootcause-prompt-builder.js +16 -5
  79. package/core/dist/runtime/diagnostician/rootcause-prompt-builder.js.map +1 -1
  80. package/core/dist/runtime/diagnostician/router-prompt-builder.d.ts.map +1 -1
  81. package/core/dist/runtime/diagnostician/router-prompt-builder.js +16 -4
  82. package/core/dist/runtime/diagnostician/router-prompt-builder.js.map +1 -1
  83. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.d.ts.map +1 -1
  84. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js +13 -2
  85. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js.map +1 -1
  86. package/core/dist/runtime/index.d.ts +4 -2
  87. package/core/dist/runtime/index.d.ts.map +1 -1
  88. package/core/dist/runtime/index.js +3 -1
  89. package/core/dist/runtime/index.js.map +1 -1
  90. package/core/dist/runtime/intent/intent-doc.d.ts +22 -0
  91. package/core/dist/runtime/intent/intent-doc.d.ts.map +1 -1
  92. package/core/dist/runtime/intent/intent-doc.js +79 -0
  93. package/core/dist/runtime/intent/intent-doc.js.map +1 -1
  94. package/core/dist/runtime/intent/intent-friction-block.d.ts +7 -0
  95. package/core/dist/runtime/intent/intent-friction-block.d.ts.map +1 -1
  96. package/core/dist/runtime/intent/intent-friction-block.js +34 -1
  97. package/core/dist/runtime/intent/intent-friction-block.js.map +1 -1
  98. package/core/dist/runtime/intent/intent-snapshot.d.ts +44 -5
  99. package/core/dist/runtime/intent/intent-snapshot.d.ts.map +1 -1
  100. package/core/dist/runtime/intent/intent-snapshot.js +83 -15
  101. package/core/dist/runtime/intent/intent-snapshot.js.map +1 -1
  102. package/core/dist/runtime/intent/strategic-conflict-gate.d.ts +19 -0
  103. package/core/dist/runtime/intent/strategic-conflict-gate.d.ts.map +1 -1
  104. package/core/dist/runtime/intent/strategic-conflict-gate.js +94 -26
  105. package/core/dist/runtime/intent/strategic-conflict-gate.js.map +1 -1
  106. package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts +22 -11
  107. package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts.map +1 -1
  108. package/core/dist/runtime/internalization/diag-rootcause-runner.js +101 -28
  109. package/core/dist/runtime/internalization/diag-rootcause-runner.js.map +1 -1
  110. package/core/dist/runtime/internalization/dreamer-prompt-builder.d.ts.map +1 -1
  111. package/core/dist/runtime/internalization/dreamer-prompt-builder.js +177 -28
  112. package/core/dist/runtime/internalization/dreamer-prompt-builder.js.map +1 -1
  113. package/core/dist/runtime/internalization/dreamer-runner.d.ts +9 -2
  114. package/core/dist/runtime/internalization/dreamer-runner.d.ts.map +1 -1
  115. package/core/dist/runtime/internalization/dreamer-runner.js +11 -1
  116. package/core/dist/runtime/internalization/dreamer-runner.js.map +1 -1
  117. package/core/dist/runtime/internalization/evaluator-runner.d.ts.map +1 -1
  118. package/core/dist/runtime/internalization/evaluator-runner.js +7 -0
  119. package/core/dist/runtime/internalization/evaluator-runner.js.map +1 -1
  120. package/core/dist/runtime/internalization/formation-context.d.ts +16 -0
  121. package/core/dist/runtime/internalization/formation-context.d.ts.map +1 -1
  122. package/core/dist/runtime/internalization/formation-context.js +109 -8
  123. package/core/dist/runtime/internalization/formation-context.js.map +1 -1
  124. package/core/dist/runtime/internalization/index.d.ts +2 -2
  125. package/core/dist/runtime/internalization/index.d.ts.map +1 -1
  126. package/core/dist/runtime/internalization/index.js +1 -1
  127. package/core/dist/runtime/internalization/index.js.map +1 -1
  128. package/core/dist/runtime/internalization/intent-contract.d.ts +55 -4
  129. package/core/dist/runtime/internalization/intent-contract.d.ts.map +1 -1
  130. package/core/dist/runtime/internalization/intent-contract.js +111 -30
  131. package/core/dist/runtime/internalization/intent-contract.js.map +1 -1
  132. package/core/dist/runtime/internalization/internalization-orchestrator.d.ts +16 -2
  133. package/core/dist/runtime/internalization/internalization-orchestrator.d.ts.map +1 -1
  134. package/core/dist/runtime/internalization/internalization-orchestrator.js +48 -14
  135. package/core/dist/runtime/internalization/internalization-orchestrator.js.map +1 -1
  136. package/core/dist/runtime/internalization/philosopher-prompt-builder.d.ts.map +1 -1
  137. package/core/dist/runtime/internalization/philosopher-prompt-builder.js +7 -6
  138. package/core/dist/runtime/internalization/philosopher-prompt-builder.js.map +1 -1
  139. package/core/dist/runtime/internalization/philosopher-runner.d.ts +9 -2
  140. package/core/dist/runtime/internalization/philosopher-runner.d.ts.map +1 -1
  141. package/core/dist/runtime/internalization/philosopher-runner.js +11 -1
  142. package/core/dist/runtime/internalization/philosopher-runner.js.map +1 -1
  143. package/core/dist/runtime/internalization/scribe-prompt-builder.d.ts +13 -6
  144. package/core/dist/runtime/internalization/scribe-prompt-builder.d.ts.map +1 -1
  145. package/core/dist/runtime/internalization/scribe-prompt-builder.js +15 -10
  146. package/core/dist/runtime/internalization/scribe-prompt-builder.js.map +1 -1
  147. package/core/dist/runtime/internalization/scribe-runner.d.ts.map +1 -1
  148. package/core/dist/runtime/internalization/scribe-runner.js +17 -7
  149. package/core/dist/runtime/internalization/scribe-runner.js.map +1 -1
  150. package/core/dist/runtime/pain-signal-bridge.d.ts +3 -0
  151. package/core/dist/runtime/pain-signal-bridge.d.ts.map +1 -1
  152. package/core/dist/runtime/pain-signal-bridge.js +224 -93
  153. package/core/dist/runtime/pain-signal-bridge.js.map +1 -1
  154. package/core/dist/runtime/pain-submit-capability.d.ts.map +1 -1
  155. package/core/dist/runtime/pain-submit-capability.js +3 -5
  156. package/core/dist/runtime/pain-submit-capability.js.map +1 -1
  157. package/core/dist/runtime/pain-to-principle-service.d.ts.map +1 -1
  158. package/core/dist/runtime/pain-to-principle-service.js +18 -21
  159. package/core/dist/runtime/pain-to-principle-service.js.map +1 -1
  160. package/core/dist/runtime/store/candidate/admission-document.d.ts +129 -0
  161. package/core/dist/runtime/store/candidate/admission-document.d.ts.map +1 -1
  162. package/core/dist/runtime/store/candidate/admission-document.js +196 -0
  163. package/core/dist/runtime/store/candidate/admission-document.js.map +1 -1
  164. package/core/dist/runtime/store/candidate/candidate-store.d.ts +54 -1
  165. package/core/dist/runtime/store/candidate/candidate-store.d.ts.map +1 -1
  166. package/core/dist/runtime/store/candidate/memory-candidate-store.d.ts +32 -1
  167. package/core/dist/runtime/store/candidate/memory-candidate-store.d.ts.map +1 -1
  168. package/core/dist/runtime/store/candidate/memory-candidate-store.js +24 -1
  169. package/core/dist/runtime/store/candidate/memory-candidate-store.js.map +1 -1
  170. package/core/dist/runtime/store/candidate/sqlite-candidate-store.d.ts +32 -1
  171. package/core/dist/runtime/store/candidate/sqlite-candidate-store.d.ts.map +1 -1
  172. package/core/dist/runtime/store/candidate/sqlite-candidate-store.js +76 -1
  173. package/core/dist/runtime/store/candidate/sqlite-candidate-store.js.map +1 -1
  174. package/core/dist/runtime/store/intent/sqlite-intent-decision-store.d.ts +10 -0
  175. package/core/dist/runtime/store/intent/sqlite-intent-decision-store.d.ts.map +1 -1
  176. package/core/dist/runtime/store/intent/sqlite-intent-decision-store.js +15 -4
  177. package/core/dist/runtime/store/intent/sqlite-intent-decision-store.js.map +1 -1
  178. package/core/dist/runtime/store/runtime-state-manager.d.ts +34 -1
  179. package/core/dist/runtime/store/runtime-state-manager.d.ts.map +1 -1
  180. package/core/dist/runtime/store/runtime-state-manager.js +10 -0
  181. package/core/dist/runtime/store/runtime-state-manager.js.map +1 -1
  182. package/core/dist/telemetry-event.d.ts +2 -2
  183. package/core/dist/telemetry-event.d.ts.map +1 -1
  184. package/core/dist/telemetry-event.js +6 -0
  185. package/core/dist/telemetry-event.js.map +1 -1
  186. package/core/package.json +1 -1
  187. package/dist/agent-skill.d.ts +59 -0
  188. package/dist/agent-skill.d.ts.map +1 -0
  189. package/dist/agent-skill.js +198 -0
  190. package/dist/agent-skill.js.map +1 -0
  191. package/dist/i18n.d.ts.map +1 -1
  192. package/dist/i18n.js +12 -0
  193. package/dist/i18n.js.map +1 -1
  194. package/dist/index.d.ts +3 -1
  195. package/dist/index.d.ts.map +1 -1
  196. package/dist/index.js +171 -3
  197. package/dist/index.js.map +1 -1
  198. package/dist/install-summary.d.ts +52 -0
  199. package/dist/install-summary.d.ts.map +1 -1
  200. package/dist/install-summary.js +104 -0
  201. package/dist/install-summary.js.map +1 -1
  202. package/host-runtime/dist/adaptive-background-append.d.ts +70 -0
  203. package/host-runtime/dist/adaptive-background-append.js +165 -0
  204. package/host-runtime/dist/governance-signal-admission.js +1 -5
  205. package/host-runtime/dist/index.d.ts +1 -0
  206. package/host-runtime/dist/index.js +5 -0
  207. package/host-runtime/package.json +1 -1
  208. package/package.json +3 -2
  209. package/pd-cli/dist/commands/candidate.d.ts.map +1 -1
  210. package/pd-cli/dist/commands/candidate.js +243 -28
  211. package/pd-cli/dist/commands/candidate.js.map +1 -1
  212. package/pd-cli/dist/commands/diagnose.d.ts.map +1 -1
  213. package/pd-cli/dist/commands/diagnose.js +110 -7
  214. package/pd-cli/dist/commands/diagnose.js.map +1 -1
  215. package/pd-cli/dist/commands/health-console.d.ts +21 -0
  216. package/pd-cli/dist/commands/health-console.d.ts.map +1 -0
  217. package/pd-cli/dist/commands/health-console.js +106 -0
  218. package/pd-cli/dist/commands/health-console.js.map +1 -0
  219. package/pd-cli/dist/commands/health.d.ts +159 -0
  220. package/pd-cli/dist/commands/health.d.ts.map +1 -1
  221. package/pd-cli/dist/commands/health.js +162 -2
  222. package/pd-cli/dist/commands/health.js.map +1 -1
  223. package/pd-cli/dist/commands/mcp-probe.d.ts +48 -0
  224. package/pd-cli/dist/commands/mcp-probe.d.ts.map +1 -0
  225. package/pd-cli/dist/commands/mcp-probe.js +479 -0
  226. package/pd-cli/dist/commands/mcp-probe.js.map +1 -0
  227. package/pd-cli/dist/commands/pain-retry.d.ts.map +1 -1
  228. package/pd-cli/dist/commands/pain-retry.js +3 -0
  229. package/pd-cli/dist/commands/pain-retry.js.map +1 -1
  230. package/pd-cli/dist/commands/runtime-internalization-run-once.d.ts.map +1 -1
  231. package/pd-cli/dist/commands/runtime-internalization-run-once.js +70 -4
  232. package/pd-cli/dist/commands/runtime-internalization-run-once.js.map +1 -1
  233. package/pd-cli/dist/program.d.ts.map +1 -1
  234. package/pd-cli/dist/program.js +68 -1
  235. package/pd-cli/dist/program.js.map +1 -1
  236. package/pd-cli/dist/services/admission-write-gate.d.ts.map +1 -1
  237. package/pd-cli/dist/services/admission-write-gate.js +18 -7
  238. package/pd-cli/dist/services/admission-write-gate.js.map +1 -1
  239. package/pd-cli/dist/services/console-launcher.d.ts +3 -0
  240. package/pd-cli/dist/services/console-launcher.d.ts.map +1 -1
  241. package/pd-cli/dist/services/console-launcher.js +3 -2
  242. package/pd-cli/dist/services/console-launcher.js.map +1 -1
  243. package/pd-cli/dist/services/demo-story-a-runner.d.ts.map +1 -1
  244. package/pd-cli/dist/services/demo-story-a-runner.js +8 -3
  245. package/pd-cli/dist/services/demo-story-a-runner.js.map +1 -1
  246. package/pd-cli/dist/services/reuse-park-release.d.ts +142 -0
  247. package/pd-cli/dist/services/reuse-park-release.d.ts.map +1 -0
  248. package/pd-cli/dist/services/reuse-park-release.js +201 -0
  249. package/pd-cli/dist/services/reuse-park-release.js.map +1 -0
  250. package/pd-cli/package.json +1 -1
  251. package/plugin/dist/bundle.js +914 -640
  252. package/plugin/dist/openclaw.plugin.json +1 -1
  253. package/plugin/openclaw.plugin.json +1 -1
  254. package/plugin/package.json +1 -1
  255. package/release-manager/dist/i18n.js +12 -0
  256. package/release-manager/package.json +2 -1
  257. package/workbuddy-adapter/dist/pd-hook.js +37 -3
  258. package/workbuddy-adapter/package.json +1 -1
@@ -0,0 +1,479 @@
1
+ /**
2
+ * `pd mcp probe` — active (liveness) probe of the installed PD MCP server.
3
+ *
4
+ * `pd health` is deliberately read-only (SPEC §7.8 / PRI-1130: "health never
5
+ * spawns the server"); this command is its active complement for the ONE case
6
+ * where spawning is the point: post-install acceptance. An agent that just
7
+ * installed PD (or restarted a host) needs evidence that the installed bytes
8
+ * actually complete the MCP handshake and expose the contract tool — static
9
+ * checks cannot prove that.
10
+ *
11
+ * Reuses `assessMcpHealth` (health-mcp.ts) as the single layout/binding
12
+ * resolution authority — no second resolution truth (P4). The probe refuses to
13
+ * spawn unless the static layers are verified (status HEALTHY or
14
+ * RESTART_REQUIRED — the restart tri-state describes the HOST process, not
15
+ * spawnability), so it never "verifies" bytes whose install layer already
16
+ * failed (cli-5: failed validation performs no side effect).
17
+ *
18
+ * Protocol: newline-delimited JSON-RPC over stdio — the same wire format the
19
+ * pinned SDK transport (@modelcontextprotocol/*@2.4.0) uses. Kept dependency-
20
+ * free by writing the three frames by hand: initialize → initialized →
21
+ * tools/list. No tool is CALLED (read-only acceptance; recall needs a
22
+ * principleId and would touch workspace business data).
23
+ *
24
+ * Runtime Contract Rules:
25
+ * - rc-1/rc-4: responses parsed as unknown, every tool element validated.
26
+ * - rc-8: stderr captured as a bounded tail, never echoed raw.
27
+ * - rc-9/cli-6: every refusal carries a structured reason + nextAction.
28
+ * - ERR-156: child/stream failures handled BOTH synchronously and via the
29
+ * async 'error' events.
30
+ * - ERR-181: exit paths set `process.exitCode` and return.
31
+ */
32
+ import { spawn } from 'child_process';
33
+ import { createRequire } from 'module';
34
+ import * as path from 'path';
35
+ import { resolveWorkspaceDir } from '../resolve-workspace.js';
36
+ import { assessMcpHealth, resolveHealthHome, selectMcpHostForWorkspace, } from './health-mcp.js';
37
+ /** The tool contract every PD MCP server must expose (pd-mcp-server/src/server.ts). */
38
+ const EXPECTED_TOOL_NAME = 'pd_recall_principle_pains';
39
+ /** The OG-4 host-gated submit tool; presence is REPORTED, never required. */
40
+ const SUBMIT_TOOL_NAME = 'pd_submit_pain';
41
+ /**
42
+ * The SDK's DEFAULT_NEGOTIATED_PROTOCOL_VERSION for the pinned family
43
+ * (@modelcontextprotocol/*@2.4.0, see pd-mcp-server/src/version.ts MCP_SDK_PIN).
44
+ * The server echoes its own negotiated version, which the probe reports.
45
+ */
46
+ const PROTOCOL_VERSION = '2025-03-26';
47
+ const CLIENT_NAME = 'pd-cli-mcp-probe';
48
+ const DEFAULT_TIMEOUT_MS = 10_000;
49
+ const MIN_TIMEOUT_MS = 1_000;
50
+ const MAX_TIMEOUT_MS = 60_000;
51
+ const STDERR_TAIL_LIMIT = 2_000;
52
+ const STDOUT_BUFFER_LIMIT = 65_536;
53
+ const SHUTDOWN_GRACE_MS = 1_500;
54
+ /** Static statuses whose install/binding layers are verified enough to spawn. */
55
+ const SPAWNABLE_STATUSES = new Set(['HEALTHY', 'RESTART_REQUIRED']);
56
+ const requireFromMeta = createRequire(import.meta.url);
57
+ function readCliVersion() {
58
+ // Same pattern as runtime-canary.ts: read the package version without a
59
+ // registry hit; 'unknown' never blocks the probe.
60
+ try {
61
+ const meta = requireFromMeta('../../package.json');
62
+ if (typeof meta === 'object' && meta !== null && Object.hasOwn(meta, 'version')) {
63
+ const version = Reflect.get(meta, 'version');
64
+ if (typeof version === 'string' && version.length > 0)
65
+ return version;
66
+ }
67
+ }
68
+ catch {
69
+ // fall through
70
+ }
71
+ return 'unknown';
72
+ }
73
+ function isRecord(value) {
74
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
75
+ }
76
+ /** Clamp the operator-supplied timeout into the API's supported domain (ERR-191). */
77
+ function clampTimeoutMs(raw) {
78
+ if (raw === undefined || !Number.isFinite(raw))
79
+ return DEFAULT_TIMEOUT_MS;
80
+ return Math.min(Math.max(Math.round(raw), MIN_TIMEOUT_MS), MAX_TIMEOUT_MS);
81
+ }
82
+ function parseJsonRpcResponse(line) {
83
+ let parsed;
84
+ try {
85
+ parsed = JSON.parse(line);
86
+ }
87
+ catch {
88
+ return null;
89
+ }
90
+ if (!isRecord(parsed))
91
+ return null;
92
+ const id = Reflect.get(parsed, 'id');
93
+ if (typeof id !== 'number' && typeof id !== 'string')
94
+ return null;
95
+ const record = { id };
96
+ const result = Reflect.get(parsed, 'result');
97
+ if (result !== undefined)
98
+ record.result = result;
99
+ const error = Reflect.get(parsed, 'error');
100
+ if (isRecord(error)) {
101
+ record.error = {
102
+ ...(Object.hasOwn(error, 'code') ? { code: Reflect.get(error, 'code') } : {}),
103
+ ...(Object.hasOwn(error, 'message') ? { message: Reflect.get(error, 'message') } : {}),
104
+ };
105
+ }
106
+ return record;
107
+ }
108
+ /** Extract validated tool names from a tools/list result (rc-1/rc-4). */
109
+ function parseToolNames(result) {
110
+ if (!isRecord(result))
111
+ return { ok: false, reason: 'tools/list result is not an object' };
112
+ const tools = Reflect.get(result, 'tools');
113
+ if (!Array.isArray(tools))
114
+ return { ok: false, reason: 'tools/list result has no tools array' };
115
+ const names = [];
116
+ for (const [index, entry] of tools.entries()) {
117
+ // rc-2: the validated value flows onward as a string — no `as` cast.
118
+ const name = isRecord(entry) ? Reflect.get(entry, 'name') : undefined;
119
+ if (typeof name !== 'string') {
120
+ return { ok: false, reason: `tools[${index}] is not a tool object with a string name` };
121
+ }
122
+ names.push(name);
123
+ }
124
+ return { ok: true, tools: names };
125
+ }
126
+ function parseInitializeResult(result) {
127
+ if (!isRecord(result))
128
+ return { protocolVersion: null, serverName: null, serverVersion: null };
129
+ const readString = (key) => {
130
+ const value = Reflect.get(result, key);
131
+ return typeof value === 'string' && value.length > 0 ? value : null;
132
+ };
133
+ const serverInfo = Reflect.get(result, 'serverInfo');
134
+ let serverName = null;
135
+ let serverVersion = null;
136
+ if (isRecord(serverInfo)) {
137
+ const name = Reflect.get(serverInfo, 'name');
138
+ const version = Reflect.get(serverInfo, 'version');
139
+ if (typeof name === 'string' && name.length > 0)
140
+ serverName = name;
141
+ if (typeof version === 'string' && version.length > 0)
142
+ serverVersion = version;
143
+ }
144
+ return { protocolVersion: readString('protocolVersion'), serverName, serverVersion };
145
+ }
146
+ function describeJsonRpcError(error) {
147
+ const message = typeof error.message === 'string' ? error.message : '';
148
+ const code = typeof error.code === 'number' || typeof error.code === 'string' ? String(error.code) : 'unknown';
149
+ return message.length > 0 ? `${message} (code ${code})` : `code ${code}`;
150
+ }
151
+ /**
152
+ * Spawn the installed entry with the SAME two env vars the plugin launcher
153
+ * injects (PD_MCP_WORKSPACE_DIR / PD_MCP_HOST — pd-mcp-server/src/workspace.ts),
154
+ * complete the handshake, validate the tool contract, and shut down cleanly.
155
+ */
156
+ async function spawnAndHandshake(input) {
157
+ const { base, startedAt, timeoutMs, serverEntry, boundHost, boundWorkspace } = input;
158
+ const env = { ...process.env, PD_MCP_WORKSPACE_DIR: boundWorkspace };
159
+ // A MISSING host marker keeps the server recall-only; a host string that is
160
+ // not one of the three known hosts fails its startup — only inject knowns.
161
+ if (boundHost === 'codex' || boundHost === 'openclaw' || boundHost === 'workbuddy') {
162
+ env.PD_MCP_HOST = boundHost;
163
+ }
164
+ return new Promise((resolve) => {
165
+ // Declared before `finish` so every closure below only references
166
+ // already-defined bindings (no-use-before-define).
167
+ let child;
168
+ let timer;
169
+ let settled = false;
170
+ let phase = 'spawn';
171
+ let exitCode = null;
172
+ let stderrTail = '';
173
+ let stdoutBuffer = '';
174
+ let initializeResult = null;
175
+ let toolNames = null;
176
+ const finish = (result) => {
177
+ if (settled)
178
+ return;
179
+ settled = true;
180
+ if (timer !== undefined)
181
+ clearTimeout(timer);
182
+ // Best-effort shutdown: close stdin (the server's clean-shutdown
183
+ // trigger), then SIGKILL after a grace period. Failures here never
184
+ // change the verdict.
185
+ try {
186
+ child.stdin?.end();
187
+ }
188
+ catch { /* already closed */ }
189
+ const killTimer = setTimeout(() => {
190
+ try {
191
+ child.kill('SIGKILL');
192
+ }
193
+ catch { /* already dead */ }
194
+ }, SHUTDOWN_GRACE_MS);
195
+ child.once('exit', () => clearTimeout(killTimer));
196
+ const finalize = () => {
197
+ clearTimeout(killTimer);
198
+ const ok = result.ok === true;
199
+ const tools = toolNames ?? [];
200
+ const expectedToolPresent = toolNames === null ? null : tools.includes(EXPECTED_TOOL_NAME);
201
+ const submitToolPresent = toolNames === null ? null : tools.includes(SUBMIT_TOOL_NAME);
202
+ const handshakeInfo = initializeResult ?? { protocolVersion: null, serverName: null, serverVersion: null };
203
+ resolve({
204
+ ...base,
205
+ ...result,
206
+ ok,
207
+ phase,
208
+ tools,
209
+ expectedToolPresent,
210
+ submitToolPresent,
211
+ protocolVersion: handshakeInfo.protocolVersion,
212
+ serverInfo: { name: handshakeInfo.serverName, version: handshakeInfo.serverVersion },
213
+ durationMs: Date.now() - startedAt,
214
+ exitCode,
215
+ ...(stderrTail.length > 0 ? { stderrTail } : {}),
216
+ });
217
+ };
218
+ // Give the child a moment to exit on its own so exitCode is truthful;
219
+ // resolve regardless — the verdict never depends on waiting longer.
220
+ const graceTimer = setTimeout(finalize, SHUTDOWN_GRACE_MS);
221
+ child.once('exit', () => { clearTimeout(graceTimer); finalize(); });
222
+ };
223
+ try {
224
+ child = spawn(process.execPath, [serverEntry], {
225
+ stdio: ['pipe', 'pipe', 'pipe'],
226
+ env,
227
+ });
228
+ }
229
+ catch (err) {
230
+ // Synchronous spawn failure (ERR-156: lexical catch cannot reach the
231
+ // async 'error' event, which is handled separately below).
232
+ const message = err instanceof Error ? err.message : String(err);
233
+ resolve({
234
+ ...base,
235
+ phase: 'spawn',
236
+ durationMs: Date.now() - startedAt,
237
+ reason: `failed to spawn the MCP server: ${message}`,
238
+ nextAction: `Check Node.js and the server entry (${serverEntry}); re-run the PD host setup if it persists.`,
239
+ });
240
+ return;
241
+ }
242
+ timer = setTimeout(() => {
243
+ try {
244
+ child.kill('SIGTERM');
245
+ }
246
+ catch { /* already dead */ }
247
+ finish({
248
+ reason: `probe timed out after ${timeoutMs}ms in phase "${phase}"`,
249
+ nextAction: 'The server did not complete the MCP handshake in time. Re-run the PD host setup; if it persists, collect diagnostics with: pd mcp logs export',
250
+ });
251
+ }, timeoutMs);
252
+ // ERR-156: async failure surfaces — spawn errors (ENOENT etc.) and stream
253
+ // errors must both resolve the probe, never leave it hanging.
254
+ child.on('error', (err) => {
255
+ finish({
256
+ reason: `MCP server process error: ${err.message}`,
257
+ nextAction: 'Check Node.js and the installed runtime; re-run the PD host setup for this host.',
258
+ });
259
+ });
260
+ child.on('exit', (code) => {
261
+ exitCode = code;
262
+ if (!settled) {
263
+ finish({
264
+ reason: `MCP server exited early with code ${code ?? 'null'} in phase "${phase}"`,
265
+ nextAction: 'The server failed before completing the handshake. Check the stderr tail in this result and re-run the PD host setup.',
266
+ });
267
+ }
268
+ });
269
+ child.stdout?.on('error', () => {
270
+ finish({
271
+ reason: `MCP server stdout stream failed in phase "${phase}"`,
272
+ nextAction: 'Re-run the probe; if it persists, collect diagnostics with: pd mcp logs export',
273
+ });
274
+ });
275
+ child.stderr?.on('error', () => {
276
+ // stderr is diagnostic-only (rc-8): losing it never fails the probe.
277
+ });
278
+ child.stderr?.on('data', (chunk) => {
279
+ stderrTail = (stderrTail + chunk.toString('utf8')).slice(-STDERR_TAIL_LIMIT);
280
+ });
281
+ const send = (message) => {
282
+ try {
283
+ child.stdin?.write(`${JSON.stringify(message)}\n`);
284
+ return true;
285
+ }
286
+ catch {
287
+ return false;
288
+ }
289
+ };
290
+ const dispatch = (line) => {
291
+ const response = parseJsonRpcResponse(line);
292
+ if (response === null)
293
+ return; // notification or noise — only responses carry ids we sent
294
+ if (response.error !== undefined) {
295
+ finish({
296
+ reason: `JSON-RPC error in phase "${phase}": ${describeJsonRpcError(response.error)}`,
297
+ nextAction: 'The server rejected the handshake. Check the stderr tail in this result and re-run the PD host setup.',
298
+ });
299
+ return;
300
+ }
301
+ if (response.id === 1) {
302
+ phase = 'initialize';
303
+ initializeResult = parseInitializeResult(response.result);
304
+ // Notification: no id, no response expected.
305
+ send({ jsonrpc: '2.0', method: 'notifications/initialized' });
306
+ phase = 'tools_list';
307
+ if (!send({ jsonrpc: '2.0', id: 2, method: 'tools/list', params: {} })) {
308
+ finish({
309
+ reason: 'failed to write the tools/list request (stdin closed)',
310
+ nextAction: 'The server closed stdin after initialize. Check the stderr tail and re-run the PD host setup.',
311
+ });
312
+ }
313
+ return;
314
+ }
315
+ if (response.id === 2) {
316
+ phase = 'validate';
317
+ const parsed = parseToolNames(response.result);
318
+ if (!parsed.ok) {
319
+ finish({ reason: parsed.reason, nextAction: 'The installed server violates the tool contract. Re-run the PD host setup for this host.' });
320
+ return;
321
+ }
322
+ toolNames = parsed.tools;
323
+ if (!parsed.tools.includes(EXPECTED_TOOL_NAME)) {
324
+ finish({
325
+ reason: `tools/list does not expose the contract tool "${EXPECTED_TOOL_NAME}" (got: ${parsed.tools.join(', ') || '(none)'})`,
326
+ nextAction: 'The installed server violates the tool contract. Re-run the PD host setup for this host.',
327
+ });
328
+ return;
329
+ }
330
+ phase = 'shutdown';
331
+ finish({ ok: true });
332
+ }
333
+ };
334
+ child.stdout?.on('data', (chunk) => {
335
+ stdoutBuffer += chunk.toString('utf8');
336
+ // Newline-delimited framing: process every complete line, keep the tail.
337
+ let newlineIndex = stdoutBuffer.indexOf('\n');
338
+ while (newlineIndex !== -1) {
339
+ const line = stdoutBuffer.slice(0, newlineIndex).trim();
340
+ stdoutBuffer = stdoutBuffer.slice(newlineIndex + 1);
341
+ if (line.length > 0)
342
+ dispatch(line);
343
+ if (settled)
344
+ return;
345
+ newlineIndex = stdoutBuffer.indexOf('\n');
346
+ }
347
+ // Bounded buffer: a server that streams garbage without newlines must
348
+ // not grow this unbounded (rc-8).
349
+ if (stdoutBuffer.length > STDOUT_BUFFER_LIMIT)
350
+ stdoutBuffer = stdoutBuffer.slice(-4_096);
351
+ });
352
+ phase = 'initialize';
353
+ if (!send({
354
+ jsonrpc: '2.0',
355
+ id: 1,
356
+ method: 'initialize',
357
+ params: {
358
+ protocolVersion: PROTOCOL_VERSION,
359
+ capabilities: {},
360
+ clientInfo: { name: CLIENT_NAME, version: readCliVersion() },
361
+ },
362
+ })) {
363
+ finish({
364
+ reason: 'failed to write the initialize request (stdin closed)',
365
+ nextAction: 'The server exited before accepting the handshake. Check the stderr tail in this result.',
366
+ });
367
+ }
368
+ });
369
+ }
370
+ /**
371
+ * Run the active probe. Resolves with the full result (never throws — every
372
+ * failure is a structured result so --json callers get one parseable doc).
373
+ */
374
+ export async function runMcpProbe(opts) {
375
+ const startedAt = Date.now();
376
+ const timeoutMs = clampTimeoutMs(opts.timeoutMs);
377
+ const workspaceDir = opts.workspace ? path.resolve(opts.workspace) : resolveWorkspaceDir();
378
+ const healthHome = opts.homeDir !== undefined
379
+ ? { homeDir: path.resolve(opts.homeDir), unresolvedReason: null }
380
+ : resolveHealthHome();
381
+ const hostSelection = opts.host !== undefined
382
+ ? { host: opts.host, selectedBy: 'explicit-flag', matchedHosts: [] }
383
+ : selectMcpHostForWorkspace(workspaceDir, { homeDir: healthHome.homeDir });
384
+ const { host } = hostSelection;
385
+ const staticSection = assessMcpHealth({ host, homeDir: healthHome.homeDir });
386
+ const base = {
387
+ ok: false,
388
+ host,
389
+ workspace: workspaceDir,
390
+ serverEntry: staticSection.server.entry,
391
+ phase: 'static',
392
+ tools: [],
393
+ expectedToolPresent: null,
394
+ submitToolPresent: null,
395
+ protocolVersion: null,
396
+ serverInfo: { name: null, version: null },
397
+ durationMs: 0,
398
+ exitCode: null,
399
+ staticStatus: staticSection.status,
400
+ };
401
+ // "Home unresolved" and "MCP not installed" are different facts (same split
402
+ // as pd health): surface the resolver's own reason over the section's.
403
+ if (healthHome.unresolvedReason) {
404
+ return {
405
+ ...base,
406
+ durationMs: Date.now() - startedAt,
407
+ reason: healthHome.unresolvedReason,
408
+ nextAction: 'Fix the PD home inputs (PD_EXPERIMENT_ROOT / PD_WORKSPACE_DIR or OPENCLAW_STATE_DIR), then rerun pd mcp probe.',
409
+ };
410
+ }
411
+ // Static gate (cli-5): never spawn on top of a broken install layer.
412
+ if (!SPAWNABLE_STATUSES.has(staticSection.status)) {
413
+ return {
414
+ ...base,
415
+ durationMs: Date.now() - startedAt,
416
+ reason: staticSection.reason ?? `static install health is ${staticSection.status}`,
417
+ nextAction: staticSection.nextAction ?? 'Re-run the PD host setup for this host, then rerun pd mcp probe.',
418
+ };
419
+ }
420
+ if (!staticSection.server.entryExists) {
421
+ return {
422
+ ...base,
423
+ durationMs: Date.now() - startedAt,
424
+ reason: 'installed MCP server entry is missing',
425
+ nextAction: 'Re-run the PD host setup for this host so the pinned MCP server is reinstalled, then rerun pd mcp probe.',
426
+ };
427
+ }
428
+ const boundWorkspace = staticSection.workspace.dir;
429
+ if (boundWorkspace === null || staticSection.workspace.exists !== true) {
430
+ return {
431
+ ...base,
432
+ durationMs: Date.now() - startedAt,
433
+ reason: boundWorkspace === null
434
+ ? 'mcp-binding.json records no workspaceDir'
435
+ : 'the workspace recorded in mcp-binding.json does not exist',
436
+ nextAction: 'Re-run the PD host setup for this host so mcp-binding.json points at the governance workspace, then rerun pd mcp probe.',
437
+ };
438
+ }
439
+ return spawnAndHandshake({
440
+ base,
441
+ startedAt,
442
+ timeoutMs,
443
+ serverEntry: staticSection.server.entry,
444
+ boundHost: staticSection.binding.host,
445
+ boundWorkspace,
446
+ });
447
+ }
448
+ /** `pd mcp probe` handler: run the probe, print, set exit code (cli-1/cli-2/cli-6). */
449
+ export async function handleMcpProbe(opts = {}) {
450
+ const result = await runMcpProbe(opts);
451
+ if (opts.json) {
452
+ console.log(JSON.stringify(result, null, 2));
453
+ }
454
+ else {
455
+ console.log(`host: ${result.host}`);
456
+ console.log(`workspace: ${result.workspace}`);
457
+ console.log(`serverEntry: ${result.serverEntry}`);
458
+ console.log(`staticStatus: ${result.staticStatus}`);
459
+ console.log(`phase: ${result.phase}`);
460
+ console.log(`protocolVersion: ${result.protocolVersion ?? '(not reached)'}`);
461
+ console.log(`server: ${result.serverInfo.name ?? '?'} ${result.serverInfo.version ?? ''}`.trimEnd());
462
+ console.log(`tools: ${result.tools.length > 0 ? result.tools.join(', ') : '(none listed)'}`);
463
+ console.log(`expectedTool: ${result.expectedToolPresent === null ? '(not reached)' : result.expectedToolPresent ? `present (${EXPECTED_TOOL_NAME})` : 'MISSING'}`);
464
+ console.log(`submitTool: ${result.submitToolPresent === null ? '(not reached)' : result.submitToolPresent ? 'present (host-gated)' : 'absent (recall-only)'}`);
465
+ console.log(`durationMs: ${result.durationMs}`);
466
+ console.log(`exitCode: ${result.exitCode ?? '(killed or not exited)'}`);
467
+ if (result.reason)
468
+ console.log(`reason: ${result.reason}`);
469
+ if (result.nextAction)
470
+ console.log(`nextAction: ${result.nextAction}`);
471
+ if (result.stderrTail)
472
+ console.log(`stderrTail: ${result.stderrTail.replace(/\n/g, ' | ')}`);
473
+ }
474
+ if (!result.ok) {
475
+ process.exitCode = 1;
476
+ return;
477
+ }
478
+ }
479
+ //# sourceMappingURL=mcp-probe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-probe.js","sourceRoot":"","sources":["../../src/commands/mcp-probe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,EAAE,KAAK,EAAqB,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,mBA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QAAQ,GAAG,CAAC,CAAC;QACrB,OAAO;IACT,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"pain-retry.d.ts","sourceRoot":"","sources":["../../src/commands/pain-retry.ts"],"names":[],"mappings":"AAiDA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAazC,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,2FAA2F;IAC3F,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,6CAA6C;IAC7C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAwKD,wBAAsB,eAAe,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAmhC3E;AAED,wFAAwF;AACxF,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,OAAO,EAChB,OAAO,GAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAmB,GACnE,OAAO,CAsBT"}
1
+ {"version":3,"file":"pain-retry.d.ts","sourceRoot":"","sources":["../../src/commands/pain-retry.ts"],"names":[],"mappings":"AAiDA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAazC,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,2FAA2F;IAC3F,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,6CAA6C;IAC7C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAwKD,wBAAsB,eAAe,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAshC3E;AAED,wFAAwF;AACxF,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,OAAO,EAChB,OAAO,GAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAmB,GACnE,OAAO,CAsBT"}
@@ -959,6 +959,9 @@ export async function handlePainRetry(opts) {
959
959
  const intakeResult = await intakeService.intake(candidate.candidateId);
960
960
  // PRI-917 v0.3.3: a parked candidate stays PENDING — no consumed
961
961
  // marking. The Owner resolves it via `pd candidate review --decide`.
962
+ // Phase 7.2 B2: the intake service persists the park on the
963
+ // candidate's admission processing; this telemetry stays
964
+ // observability-only.
962
965
  if (intakeResult.outcome === 'refused' && intakeResult.reason === 'reuse_pending_owner') {
963
966
  const recommended = intakeResult.reuseRecommendation?.status === 'recommended' ? intakeResult.reuseRecommendation : undefined;
964
967
  // PRI-939 review fix (CodeRabbit): the park observation reaches the