create-principles-disciple 1.148.8 → 1.148.10

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 (180) hide show
  1. package/_release/product-identity.json +1 -1
  2. package/codex-adapter/package.json +1 -1
  3. package/console/dist/server/config/WorkspaceConfigStore.js +4 -3
  4. package/console/dist/server/console-ports.d.ts +13 -0
  5. package/console/dist/server/console-ports.js +15 -0
  6. package/console/dist/server/index.js +51 -5
  7. package/console/dist/server/routes/update-transaction.js +4 -4
  8. package/console/dist/server/routes/update.js +37 -21
  9. package/console/dist/server/utils/gateway.js +23 -6
  10. package/console/dist/server/utils/installed-layout.js +5 -3
  11. package/console/dist/server/utils/pd-backups.d.ts +6 -4
  12. package/console/dist/server/utils/pd-backups.js +8 -9
  13. package/console/dist/server/utils/pd-home.d.ts +34 -0
  14. package/console/dist/server/utils/pd-home.js +47 -0
  15. package/console/dist/web/assets/app.js +1 -1
  16. package/console/package.json +1 -1
  17. package/core/dist/index.d.ts +2 -2
  18. package/core/dist/index.d.ts.map +1 -1
  19. package/core/dist/index.js +2 -2
  20. package/core/dist/index.js.map +1 -1
  21. package/core/dist/runtime/adapter/output-schema-registry.d.ts +4 -3
  22. package/core/dist/runtime/adapter/output-schema-registry.d.ts.map +1 -1
  23. package/core/dist/runtime/adapter/output-schema-registry.js +9 -5
  24. package/core/dist/runtime/adapter/output-schema-registry.js.map +1 -1
  25. package/core/dist/runtime/adapter/pi-ai-runtime-adapter.d.ts +1 -1
  26. package/core/dist/runtime/adapter/pi-ai-runtime-adapter.d.ts.map +1 -1
  27. package/core/dist/runtime/adapter/pi-ai-runtime-adapter.js +10 -3
  28. package/core/dist/runtime/adapter/pi-ai-runtime-adapter.js.map +1 -1
  29. package/core/dist/runtime/adapter/principle-tree-ledger-adapter.d.ts +31 -0
  30. package/core/dist/runtime/adapter/principle-tree-ledger-adapter.d.ts.map +1 -1
  31. package/core/dist/runtime/adapter/principle-tree-ledger-adapter.js +55 -0
  32. package/core/dist/runtime/adapter/principle-tree-ledger-adapter.js.map +1 -1
  33. package/core/dist/runtime/adapter/schema-prompt-adapter.d.ts.map +1 -1
  34. package/core/dist/runtime/adapter/schema-prompt-adapter.js +48 -9
  35. package/core/dist/runtime/adapter/schema-prompt-adapter.js.map +1 -1
  36. package/core/dist/runtime/adapter/split-pipeline-fixtures.d.ts +2 -2
  37. package/core/dist/runtime/adapter/split-pipeline-fixtures.d.ts.map +1 -1
  38. package/core/dist/runtime/adapter/split-pipeline-fixtures.js +11 -0
  39. package/core/dist/runtime/adapter/split-pipeline-fixtures.js.map +1 -1
  40. package/core/dist/runtime/adapter/test-double-runtime-adapter.d.ts +3 -3
  41. package/core/dist/runtime/adapter/test-double-runtime-adapter.d.ts.map +1 -1
  42. package/core/dist/runtime/adapter/test-double-runtime-adapter.js +9 -3
  43. package/core/dist/runtime/adapter/test-double-runtime-adapter.js.map +1 -1
  44. package/core/dist/runtime/admission-gate.d.ts +2 -2
  45. package/core/dist/runtime/candidate-intake-service.d.ts.map +1 -1
  46. package/core/dist/runtime/candidate-intake-service.js +176 -13
  47. package/core/dist/runtime/candidate-intake-service.js.map +1 -1
  48. package/core/dist/runtime/diagnostician/router-prompt-builder.d.ts +42 -7
  49. package/core/dist/runtime/diagnostician/router-prompt-builder.d.ts.map +1 -1
  50. package/core/dist/runtime/diagnostician/router-prompt-builder.js +53 -10
  51. package/core/dist/runtime/diagnostician/router-prompt-builder.js.map +1 -1
  52. package/core/dist/runtime/diagnostician-association-shadow.d.ts +111 -4
  53. package/core/dist/runtime/diagnostician-association-shadow.d.ts.map +1 -1
  54. package/core/dist/runtime/diagnostician-association-shadow.js +206 -3
  55. package/core/dist/runtime/diagnostician-association-shadow.js.map +1 -1
  56. package/core/dist/runtime/diagnostician-output.d.ts +67 -84
  57. package/core/dist/runtime/diagnostician-output.d.ts.map +1 -1
  58. package/core/dist/runtime/diagnostician-output.js +90 -41
  59. package/core/dist/runtime/diagnostician-output.js.map +1 -1
  60. package/core/dist/runtime/index.d.ts +3 -3
  61. package/core/dist/runtime/index.d.ts.map +1 -1
  62. package/core/dist/runtime/index.js +3 -3
  63. package/core/dist/runtime/index.js.map +1 -1
  64. package/core/dist/runtime/internalization/artifact-summary.js +1 -1
  65. package/core/dist/runtime/internalization/diag-router-runner.d.ts +49 -12
  66. package/core/dist/runtime/internalization/diag-router-runner.d.ts.map +1 -1
  67. package/core/dist/runtime/internalization/diag-router-runner.js +135 -30
  68. package/core/dist/runtime/internalization/diag-router-runner.js.map +1 -1
  69. package/core/dist/runtime/internalization/formation-context.d.ts +2 -2
  70. package/core/dist/runtime/internalization/formation-context.js +2 -2
  71. package/core/dist/runtime/internalization/internalization-route.d.ts +15 -2
  72. package/core/dist/runtime/internalization/internalization-route.d.ts.map +1 -1
  73. package/core/dist/runtime/internalization/internalization-route.js +5 -2
  74. package/core/dist/runtime/internalization/internalization-route.js.map +1 -1
  75. package/core/dist/runtime/internalization/router-context-evidence.d.ts +148 -6
  76. package/core/dist/runtime/internalization/router-context-evidence.d.ts.map +1 -1
  77. package/core/dist/runtime/internalization/router-context-evidence.js +156 -11
  78. package/core/dist/runtime/internalization/router-context-evidence.js.map +1 -1
  79. package/core/dist/runtime/internalization/router-context-reconstruction.d.ts +64 -0
  80. package/core/dist/runtime/internalization/router-context-reconstruction.d.ts.map +1 -0
  81. package/core/dist/runtime/internalization/router-context-reconstruction.js +124 -0
  82. package/core/dist/runtime/internalization/router-context-reconstruction.js.map +1 -0
  83. package/core/dist/runtime/pain-signal-bridge.d.ts +3 -3
  84. package/core/dist/runtime/pain-signal-bridge.d.ts.map +1 -1
  85. package/core/dist/runtime/pain-signal-bridge.js +35 -9
  86. package/core/dist/runtime/pain-signal-bridge.js.map +1 -1
  87. package/core/dist/runtime/pain-signal-runtime-factory.d.ts.map +1 -1
  88. package/core/dist/runtime/pain-signal-runtime-factory.js +32 -4
  89. package/core/dist/runtime/pain-signal-runtime-factory.js.map +1 -1
  90. package/core/dist/runtime/principle-tree/rule-candidate-binding.d.ts.map +1 -1
  91. package/core/dist/runtime/principle-tree/rule-candidate-binding.js +9 -5
  92. package/core/dist/runtime/principle-tree/rule-candidate-binding.js.map +1 -1
  93. package/core/dist/runtime/runner/base-peer-runner.d.ts +18 -4
  94. package/core/dist/runtime/runner/base-peer-runner.d.ts.map +1 -1
  95. package/core/dist/runtime/runner/base-peer-runner.js +32 -9
  96. package/core/dist/runtime/runner/base-peer-runner.js.map +1 -1
  97. package/core/dist/runtime/runner/context-hash.d.ts +9 -0
  98. package/core/dist/runtime/runner/context-hash.d.ts.map +1 -0
  99. package/core/dist/runtime/runner/context-hash.js +18 -0
  100. package/core/dist/runtime/runner/context-hash.js.map +1 -0
  101. package/core/dist/runtime/runner/default-validator.d.ts +3 -3
  102. package/core/dist/runtime/runner/default-validator.d.ts.map +1 -1
  103. package/core/dist/runtime/runner/default-validator.js +149 -85
  104. package/core/dist/runtime/runner/default-validator.js.map +1 -1
  105. package/core/dist/runtime/runner/diagnostician-validator.d.ts +11 -9
  106. package/core/dist/runtime/runner/diagnostician-validator.d.ts.map +1 -1
  107. package/core/dist/runtime/runner/peer-runner-types.d.ts +14 -2
  108. package/core/dist/runtime/runner/peer-runner-types.d.ts.map +1 -1
  109. package/core/dist/runtime/runner/runner-result.d.ts +2 -2
  110. package/core/dist/runtime/runtime-protocol.d.ts +8 -0
  111. package/core/dist/runtime/runtime-protocol.d.ts.map +1 -1
  112. package/core/dist/runtime/runtime-protocol.js +8 -0
  113. package/core/dist/runtime/runtime-protocol.js.map +1 -1
  114. package/core/dist/runtime/store/commit/diagnostician-committer.d.ts +4 -4
  115. package/core/dist/runtime/store/commit/diagnostician-committer.d.ts.map +1 -1
  116. package/core/dist/runtime/store/commit/diagnostician-committer.js +27 -8
  117. package/core/dist/runtime/store/commit/diagnostician-committer.js.map +1 -1
  118. package/core/dist/runtime/store/pain-diagnosis/pain-diagnosis-store.d.ts +2 -2
  119. package/core/dist/runtime/store/pain-diagnosis/pain-diagnosis-store.js +1 -1
  120. package/core/dist/runtime/store/run/memory-run-store.d.ts +1 -1
  121. package/core/dist/runtime/store/run/memory-run-store.d.ts.map +1 -1
  122. package/core/dist/runtime/store/run/memory-run-store.js.map +1 -1
  123. package/core/dist/runtime/store/run/run-store.d.ts +1 -1
  124. package/core/dist/runtime/store/run/run-store.d.ts.map +1 -1
  125. package/core/dist/runtime/store/run/sqlite-run-store.d.ts +1 -1
  126. package/core/dist/runtime/store/run/sqlite-run-store.d.ts.map +1 -1
  127. package/core/dist/runtime/store/run/sqlite-run-store.js +4 -0
  128. package/core/dist/runtime/store/run/sqlite-run-store.js.map +1 -1
  129. package/core/dist/runtime/store/runtime-state-manager.d.ts +1 -1
  130. package/core/dist/runtime/store/runtime-state-manager.js +1 -1
  131. package/core/dist/runtime/synthetic-baseline.d.ts +2 -2
  132. package/core/dist/runtime/synthetic-baseline.d.ts.map +1 -1
  133. package/core/dist/runtime/synthetic-baseline.js +2 -0
  134. package/core/dist/runtime/synthetic-baseline.js.map +1 -1
  135. package/core/dist/runtime/types/evidence-chain-contract.d.ts +1 -1
  136. package/core/dist/runtime/types/evidence-chain-contract.js +2 -2
  137. package/core/dist/runtime/types/evidence-chain-contract.js.map +1 -1
  138. package/core/dist/runtime/types/rule-candidate-binding.d.ts +10 -2
  139. package/core/dist/runtime/types/rule-candidate-binding.d.ts.map +1 -1
  140. package/core/dist/telemetry-event.d.ts +2 -2
  141. package/core/dist/telemetry-event.d.ts.map +1 -1
  142. package/core/dist/telemetry-event.js +19 -0
  143. package/core/dist/telemetry-event.js.map +1 -1
  144. package/core/package.json +1 -1
  145. package/dist/update/bootstrap-executor.d.ts.map +1 -1
  146. package/dist/update/bootstrap-executor.js +33 -19
  147. package/dist/update/bootstrap-executor.js.map +1 -1
  148. package/host-runtime/dist/workspace-telemetry-emitter.js +13 -0
  149. package/host-runtime/package.json +1 -1
  150. package/install-layout/dist/index.d.ts +7 -0
  151. package/install-layout/dist/index.js +7 -0
  152. package/install-layout/dist/pd-home.d.ts +55 -0
  153. package/install-layout/dist/pd-home.js +226 -0
  154. package/install-layout/package.json +1 -1
  155. package/package.json +4 -4
  156. package/pd-cli/dist/commands/candidate.js.map +1 -1
  157. package/pd-cli/dist/commands/diagnose.d.ts.map +1 -1
  158. package/pd-cli/dist/commands/diagnose.js +14 -5
  159. package/pd-cli/dist/commands/diagnose.js.map +1 -1
  160. package/pd-cli/dist/commands/pain-retry.d.ts.map +1 -1
  161. package/pd-cli/dist/commands/pain-retry.js +18 -7
  162. package/pd-cli/dist/commands/pain-retry.js.map +1 -1
  163. package/pd-cli/dist/services/demo-story-a-runner.js +2 -2
  164. package/pd-cli/dist/services/demo-story-a-runner.js.map +1 -1
  165. package/pd-cli/dist/services/pain-flood-simulation-runner.d.ts.map +1 -1
  166. package/pd-cli/dist/services/pain-flood-simulation-runner.js +4 -1
  167. package/pd-cli/dist/services/pain-flood-simulation-runner.js.map +1 -1
  168. package/pd-cli/dist/services/synthetic-baseline-runner.d.ts.map +1 -1
  169. package/pd-cli/dist/services/synthetic-baseline-runner.js +5 -1
  170. package/pd-cli/dist/services/synthetic-baseline-runner.js.map +1 -1
  171. package/pd-cli/package.json +1 -1
  172. package/pd-mcp-server/dist/version.d.ts +1 -1
  173. package/pd-mcp-server/dist/version.js +1 -1
  174. package/pd-mcp-server/package.json +1 -1
  175. package/plugin/dist/bundle.js +472 -448
  176. package/plugin/openclaw.plugin.json +1 -1
  177. package/plugin/package.json +1 -1
  178. package/release-manager/dist/update/bootstrap-executor.js +33 -19
  179. package/release-manager/package.json +1 -1
  180. package/workbuddy-adapter/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "productVersion": "2.8.6",
4
- "sourceCommit": "716789d80d4308eac4f3d224ea68a6961331b047"
4
+ "sourceCommit": "80e8f5e27a6b7b395f73d2334477eb34317c3cc0"
5
5
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principles/codex-adapter",
3
- "version": "0.8.5",
3
+ "version": "0.8.7",
4
4
  "description": "Codex CLI host adapter for Principles Disciple — implements HostAdapter interface for OpenAI Codex CLI's stdin/stdout JSON hook model (ADR-0020).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,14 +1,15 @@
1
1
  import * as fs from 'fs';
2
2
  import * as path from 'path';
3
- import * as os from 'os';
4
- const CONFIG_DIR_NAME = '.pd-console';
3
+ import { getPdHome } from '../utils/pd-home.js';
5
4
  const WORKSPACES_FILE = 'workspaces.json';
6
5
  export class WorkspaceConfigStore {
7
6
  configDir;
8
7
  configPath;
9
8
  entries;
10
9
  constructor(configDir) {
11
- this.configDir = configDir ?? path.join(os.homedir(), CONFIG_DIR_NAME);
10
+ // PRI-872: the registry lives in the console's PD home, never in a
11
+ // hard-coded `os.homedir()` — an experiment instance must own its own list.
12
+ this.configDir = configDir ?? getPdHome().consoleConfigDir;
12
13
  this.configPath = path.join(this.configDir, WORKSPACES_FILE);
13
14
  this.entries = this.load();
14
15
  }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Console port contract (PRI-872 / SPEC `install-mjs-dev-prod-isolation-review`
3
+ * §6.3). Production keeps the historical 3100; an experiment instance defaults
4
+ * to 13100 so a bare dev start can never take the production port.
5
+ *
6
+ * The paired gateway ports are 18789 (production, read from
7
+ * `<openclawHome>/openclaw.json`) and 19789 (experiment, foreground
8
+ * `openclaw gateway run` owned by the experiment launcher).
9
+ */
10
+ export declare const PRODUCTION_CONSOLE_PORT = 3100;
11
+ export declare const EXPERIMENT_CONSOLE_PORT = 13100;
12
+ export declare const EXPERIMENT_GATEWAY_PORT = 19789;
13
+ export declare function defaultConsolePort(mode: 'production' | 'experiment'): number;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Console port contract (PRI-872 / SPEC `install-mjs-dev-prod-isolation-review`
3
+ * §6.3). Production keeps the historical 3100; an experiment instance defaults
4
+ * to 13100 so a bare dev start can never take the production port.
5
+ *
6
+ * The paired gateway ports are 18789 (production, read from
7
+ * `<openclawHome>/openclaw.json`) and 19789 (experiment, foreground
8
+ * `openclaw gateway run` owned by the experiment launcher).
9
+ */
10
+ export const PRODUCTION_CONSOLE_PORT = 3100;
11
+ export const EXPERIMENT_CONSOLE_PORT = 13100;
12
+ export const EXPERIMENT_GATEWAY_PORT = 19789;
13
+ export function defaultConsolePort(mode) {
14
+ return mode === 'experiment' ? EXPERIMENT_CONSOLE_PORT : PRODUCTION_CONSOLE_PORT;
15
+ }
@@ -1,6 +1,5 @@
1
1
  import * as http from 'http';
2
2
  import * as fs from 'fs';
3
- import * as os from 'os';
4
3
  import * as path from 'path';
5
4
  import { fileURLToPath, pathToFileURL } from 'url';
6
5
  import { resolveApplyFullTimeoutMs, resolveCheckTimeoutMs } from './update-timeout.js';
@@ -10,6 +9,8 @@ import { createProductTelemetryService, scheduleProductTelemetryExport } from '@
10
9
  import { AuthConfig } from './config/AuthConfig.js';
11
10
  import { assertLoopbackBindForUnauthenticatedServer } from './bind-guard.js';
12
11
  import { WorkspaceConfigStore } from './config/WorkspaceConfigStore.js';
12
+ import { getPdHome, PdHomeConfigurationError } from './utils/pd-home.js';
13
+ import { EXPERIMENT_CONSOLE_PORT, defaultConsolePort } from './console-ports.js';
13
14
  import { WorkspaceService } from './models/WorkspaceService.js';
14
15
  import { handleFeedbackReportsRoute, handleFeedbackChannelsRoute, disposeFeedbackReportModels, } from './routes/feedback-reports.js';
15
16
  import { handleFailedTasksRoute, disposeFailedTasksModels } from './routes/failed-tasks.js';
@@ -94,10 +95,12 @@ function resolveWorkspaceDir(argv) {
94
95
  }
95
96
  return process.cwd();
96
97
  }
97
- function parseArgs(argv) {
98
+ function parseArgs(argv, mode = 'production') {
98
99
  const args = argv.slice(2);
99
100
  let workspace = resolveWorkspaceDir(argv);
100
- let port = 3100;
101
+ // PRI-872 §3: production keeps 3100; an experiment instance defaults to
102
+ // 13100 so a bare dev start cannot grab the production port. --port wins.
103
+ let port = defaultConsolePort(mode);
101
104
  let host = '127.0.0.1';
102
105
  let noAuth = false;
103
106
  let token = undefined;
@@ -269,7 +272,7 @@ export async function initServices(workspaceDir, authConfig) {
269
272
  // missing Owner-facing history entries from the transaction journal. Best
270
273
  // effort only: history reconciliation never blocks console startup.
271
274
  try {
272
- reconcileUpdateHistoryFromJournals(workspaceDir, path.join(os.homedir(), '.pd'));
275
+ reconcileUpdateHistoryFromJournals(workspaceDir, getPdHome().pdHome);
273
276
  }
274
277
  catch (error) {
275
278
  console.warn('[pd-console] update history reconciliation skipped:', error instanceof Error ? error.message : error);
@@ -599,7 +602,36 @@ export function handleRequest(services) {
599
602
  }
600
603
  // ── Server startup ───────────────────────────────────────────────────────────
601
604
  export async function main() {
602
- const { workspace, port, host, noAuth, token } = parseArgs(process.argv);
605
+ // PRI-872: resolve the PD home BEFORE anything else. Everything below
606
+ // (registry, update history, backups, gateway probes) derives from it, and a
607
+ // broken experiment configuration must stop the process here instead of
608
+ // silently serving the production install.
609
+ let pdHome;
610
+ try {
611
+ pdHome = getPdHome();
612
+ }
613
+ catch (error) {
614
+ if (error instanceof PdHomeConfigurationError) {
615
+ console.error(`[pd-console] Refusing to start: ${error.reason}`);
616
+ console.error(`[pd-console] ${error.message}`);
617
+ console.error(`[pd-console] Next: ${error.nextAction}`);
618
+ for (const [key, value] of Object.entries(error.details)) {
619
+ console.error(`[pd-console] ${key}=${value}`);
620
+ }
621
+ process.exit(1);
622
+ }
623
+ throw error;
624
+ }
625
+ const { workspace, port, host, noAuth, token } = parseArgs(process.argv, pdHome.mode);
626
+ if (pdHome.mode === 'experiment') {
627
+ console.log(`[pd-console] Environment: experiment (PD_EXPERIMENT_ROOT=${pdHome.experimentRoot ?? ''})`);
628
+ console.log(`[pd-console] PD home: ${pdHome.pdHome}`);
629
+ console.log(`[pd-console] Workspace registry: ${pdHome.consoleConfigDir}`);
630
+ console.log(`[pd-console] OpenClaw home: ${pdHome.openclawHome}`);
631
+ }
632
+ else {
633
+ console.log(`[pd-console] Environment: production (PD home: ${pdHome.pdHome})`);
634
+ }
603
635
  const authConfig = new AuthConfig({
604
636
  cliToken: token,
605
637
  envToken: process.env.PD_CONSOLE_TOKEN,
@@ -645,6 +677,20 @@ export async function main() {
645
677
  };
646
678
  process.on('SIGTERM', () => { void shutdown('SIGTERM'); });
647
679
  process.on('SIGINT', () => { void shutdown('SIGINT'); });
680
+ // PRI-872: a second instance on an occupied port must fail with an
681
+ // actionable message, not an unhandled 'error' stack. The usual cause is the
682
+ // production console already listening on 3100.
683
+ server.on('error', (error) => {
684
+ if (error.code === 'EADDRINUSE') {
685
+ console.error(`[pd-console] Port ${port} is already in use on ${host}.`);
686
+ console.error(pdHome.mode === 'production'
687
+ ? `[pd-console] Another console is probably serving this installation. Stop it, or pick another port with --port.`
688
+ : `[pd-console] Stop the process holding the port, or pass a different --port (the experiment default is ${EXPERIMENT_CONSOLE_PORT}).`);
689
+ process.exit(1);
690
+ }
691
+ console.error('[pd-console] Server error:', error);
692
+ process.exit(1);
693
+ });
648
694
  server.listen(port, host, () => {
649
695
  console.log('[pd-console] Listening on http://' + host + ':' + port);
650
696
  console.log('[pd-console] Workspace: ' + workspace);
@@ -1,7 +1,7 @@
1
1
  import * as fs from 'node:fs';
2
2
  import * as path from 'node:path';
3
- import * as os from 'node:os';
4
3
  import { sendSuccess, sendMethodNotAllowed, sendNotFound, errorMessage } from '../utils/response.js';
4
+ import { getPdHome } from '../utils/pd-home.js';
5
5
  /** Transaction ids are installer/console-generated (`<word>-<ts>-<hex>`); this
6
6
  * pattern doubles as the path-traversal guard for the journal file name (rc-1). */
7
7
  const TRANSACTION_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/;
@@ -36,7 +36,7 @@ async function transactionStatus(res, transactionId) {
36
36
  }
37
37
  const journal = await import('create-principles-disciple/update-console');
38
38
  const layout = journal;
39
- const paths = layout.resolvePdHomePaths(path.join(os.homedir(), '.pd'));
39
+ const paths = layout.resolvePdHomePaths(getPdHome().pdHome);
40
40
  const journalPath = path.join(paths.transactionsDir, `${transactionId}.jsonl`);
41
41
  if (!fs.existsSync(journalPath)) {
42
42
  sendSuccess(res, { transactionId, exists: false });
@@ -65,7 +65,7 @@ async function transactionStatus(res, transactionId) {
65
65
  async function recoveryStatus(res) {
66
66
  const journal = await import('create-principles-disciple/update-console');
67
67
  const layout = journal;
68
- const paths = layout.resolvePdHomePaths(path.join(os.homedir(), '.pd'));
68
+ const paths = layout.resolvePdHomePaths(getPdHome().pdHome);
69
69
  const entries = (() => {
70
70
  try {
71
71
  return fs.readdirSync(paths.transactionsDir, { withFileTypes: true })
@@ -209,7 +209,7 @@ async function recoveryResolve(res, req) {
209
209
  }
210
210
  const journal = await import('create-principles-disciple/update-console');
211
211
  const layout = journal;
212
- const paths = layout.resolvePdHomePaths(path.join(os.homedir(), '.pd'));
212
+ const paths = layout.resolvePdHomePaths(getPdHome().pdHome);
213
213
  const journalPath = path.join(paths.transactionsDir, `${transactionId}.jsonl`);
214
214
  if (!fs.existsSync(journalPath)) {
215
215
  sendSuccess(res, { ok: false, reason: 'unknown_transaction', message: `No journal exists for transaction ${transactionId}.` });
@@ -4,6 +4,7 @@ import * as os from 'node:os';
4
4
  import { spawn } from 'node:child_process';
5
5
  import { randomUUID } from 'node:crypto';
6
6
  import { sendSuccess, sendMethodNotAllowed, sendNotFound, errorMessage } from '../utils/response.js';
7
+ import { getPdHome, isExperimentInstance } from '../utils/pd-home.js';
7
8
  import { appendUpdateHistory } from './update-history.js';
8
9
  const REPAIR_ACTION = 'Resolve the reported cause, or run the official installer (npx create-principles-disciple) to repair the installation, then retry.';
9
10
  function appendGovernedUpdateHistory(workspaceDir, entry) {
@@ -56,7 +57,7 @@ async function checkUpdate(authority, res) {
56
57
  */
57
58
  async function applyFullUpdate(authority, res, workspaceDir) {
58
59
  const layout = await import('create-principles-disciple/update-console');
59
- const pdHomePaths = layout.resolvePdHomePaths(path.join(os.homedir(), '.pd'));
60
+ const pdHomePaths = layout.resolvePdHomePaths(getPdHome().pdHome);
60
61
  const entryPath = path.join(pdHomePaths.bootstrapExecutorDir, 'dist', 'bootstrap-entry.js');
61
62
  // Readiness already re-verified the registration digest, but the route owns
62
63
  // the spawn-level guard: no executor file → repair next action (this is the
@@ -190,29 +191,44 @@ export async function handleUpdateRoute(req, res, workspaceDir, subPath) {
190
191
  let mod;
191
192
  let authority;
192
193
  let failure = { reason: 'installer_missing', message: 'ReleaseManager is unavailable.', nextAction: REPAIR_ACTION, transactionOpened: false };
193
- try {
194
- mod = await import('create-principles-disciple/update-console');
195
- authority = mod.createReleaseManagerAuthority({
196
- pdHome: path.join(os.homedir(), '.pd'),
197
- metadataBaseUrl: process.env.PD_RELEASE_METADATA_URL,
198
- });
199
- const readiness = authority.kinds[subPath === '/check' ? 'check' : 'apply-full'];
200
- if (!readiness.ready || authority.installStatus === null) {
201
- failure = { ...failure, reason: readiness.reasons.join(',') || 'install_state_corrupt', message: 'The installation is not ready for a signed release update.' };
194
+ // PRI-872: an experiment console owns `<root>/.pd`, which is not a signed
195
+ // install. Refuse explicitly instead of letting the readiness gate report a
196
+ // misleading `install_state_corrupt` — and, above all, keep the real
197
+ // installer (which stops the machine-level gateway and swaps the production
198
+ // runtime) unreachable from a second instance.
199
+ if (isExperimentInstance()) {
200
+ failure = {
201
+ reason: 'experimental_instance',
202
+ message: 'This console is an experiment instance; product updates apply to the production installation only.',
203
+ nextAction: 'Run the update from the production console, or install the experiment build with the official installer while PD_EXPERIMENT_ROOT points at this root.',
204
+ transactionOpened: false,
205
+ };
206
+ }
207
+ else {
208
+ try {
209
+ mod = await import('create-principles-disciple/update-console');
210
+ authority = mod.createReleaseManagerAuthority({
211
+ pdHome: getPdHome().pdHome,
212
+ metadataBaseUrl: process.env.PD_RELEASE_METADATA_URL,
213
+ });
214
+ const readiness = authority.kinds[subPath === '/check' ? 'check' : 'apply-full'];
215
+ if (!readiness.ready || authority.installStatus === null) {
216
+ failure = { ...failure, reason: readiness.reasons.join(',') || 'install_state_corrupt', message: 'The installation is not ready for a signed release update.' };
217
+ }
218
+ else {
219
+ if (subPath === '/check')
220
+ await checkUpdate(authority, res);
221
+ else
222
+ await applyFullUpdate(authority, res, workspaceDir);
223
+ return;
224
+ }
202
225
  }
203
- else {
204
- if (subPath === '/check')
205
- await checkUpdate(authority, res);
206
- else
207
- await applyFullUpdate(authority, res, workspaceDir);
208
- return;
226
+ catch (error) {
227
+ failure = mod
228
+ ? mod.mapReleaseManagerError(error)
229
+ : { ...failure, message: errorMessage(error) };
209
230
  }
210
231
  }
211
- catch (error) {
212
- failure = mod
213
- ? mod.mapReleaseManagerError(error)
214
- : { ...failure, message: errorMessage(error) };
215
- }
216
232
  console.error(`[update] ${subPath} refused (${failure.reason}): ${failure.message}`);
217
233
  if (subPath === '/check') {
218
234
  // SPEC §12.1: a check that cannot complete is check_failed — it must never
@@ -10,9 +10,9 @@
10
10
  import { execFileSync } from 'child_process';
11
11
  import * as fs from 'fs';
12
12
  import * as path from 'path';
13
- import * as os from 'os';
14
13
  import * as net from 'net';
15
14
  import { errorMessage } from './response.js';
15
+ import { getPdHome, getPdHomeResolution } from './pd-home.js';
16
16
  // rc-2: type guard instead of `as` cast on parsed JSON.
17
17
  function isRecord(v) {
18
18
  return typeof v === 'object' && v !== null && !Array.isArray(v);
@@ -22,13 +22,14 @@ function isRecord(v) {
22
22
  // ---------------------------------------------------------------------------
23
23
  /**
24
24
  * Resolve the OpenClaw config directory.
25
- * Priority: OPENCLAW_HOME env var > ~/.openclaw
25
+ *
26
+ * PRI-872: derived from the process-wide PD home (production keeps
27
+ * OPENCLAW_HOME > ~/.openclaw; an experiment instance reads its own root), so
28
+ * the console never reports or probes the production gateway from a second
29
+ * instance.
26
30
  */
27
31
  function resolveOpenClawConfigDir() {
28
- const envHome = process.env.OPENCLAW_HOME;
29
- if (envHome && envHome.trim().length > 0)
30
- return path.resolve(envHome);
31
- return path.join(os.homedir(), '.openclaw');
32
+ return getPdHome().openclawHome;
32
33
  }
33
34
  /**
34
35
  * Read the gateway port from ~/.openclaw/openclaw.json → { gateway: { port } }.
@@ -112,6 +113,22 @@ export async function checkOpenClawGateway() {
112
113
  * with a structured reason + nextAction instead of crashing mid-update.
113
114
  */
114
115
  function runGatewayServiceCommand(subcommand, extraArgs = []) {
116
+ // PRI-872: `openclaw gateway stop|start` drives the MACHINE-LEVEL service
117
+ // (launchd/systemd/schtasks), not a process this console owns. An experiment
118
+ // instance must never stop the production gateway — its own gateway is a
119
+ // foreground `openclaw gateway run` owned by the experiment launcher.
120
+ // Resolution failure is reported, not thrown: this helper's contract is
121
+ // "never throws" (rc-9), so callers degrade on a structured result.
122
+ const pdHome = getPdHomeResolution();
123
+ if (!pdHome.ok) {
124
+ return { ok: false, error: `pd_home_invalid (${pdHome.reason}): ${pdHome.message}` };
125
+ }
126
+ if (pdHome.mode === 'experiment') {
127
+ return {
128
+ ok: false,
129
+ error: 'experimental_instance: the machine-level OpenClaw service belongs to the production install; the experiment gateway runs in the foreground under the experiment launcher and must be restarted there.',
130
+ };
131
+ }
115
132
  try {
116
133
  // EP-08: argv array + typed subcommand union — every argv is a constant
117
134
  // literal, so no external input can reach the command line. shell:true is
@@ -12,9 +12,9 @@
12
12
  */
13
13
  import * as fs from 'fs';
14
14
  import * as path from 'path';
15
- import * as os from 'os';
16
15
  import { getInstallLayoutPaths, resolveInstallLayout } from '@principles/install-layout';
17
16
  import { resolveOpenClawHome } from './pd-backups.js';
17
+ import { getPdHome } from './pd-home.js';
18
18
  export function resolveExtensionsDir() {
19
19
  return path.join(resolveOpenClawHome(), 'extensions');
20
20
  }
@@ -42,7 +42,9 @@ function resolveCanonicalCodexAdapterDir(paths) {
42
42
  : undefined;
43
43
  }
44
44
  export function resolveUpdateLayout() {
45
- const homeDir = os.homedir();
45
+ // PRI-872: the home comes from the process-wide resolution, so an experiment
46
+ // console inspects the EXPERIMENT install instead of the production one.
47
+ const { homeDir } = getPdHome();
46
48
  const paths = getInstallLayoutPaths(homeDir);
47
49
  const legacyPluginDir = path.join(resolveExtensionsDir(), 'principles-disciple');
48
50
  let manifest;
@@ -99,7 +101,7 @@ export function resolvePluginDir(_workspaceDir) {
99
101
  * guard allow-root even when the install resolves to legacy mode.
100
102
  */
101
103
  export function resolveCanonicalRuntimeRoot() {
102
- return getInstallLayoutPaths(os.homedir()).runtimeDir;
104
+ return getInstallLayoutPaths(getPdHome().homeDir).runtimeDir;
103
105
  }
104
106
  // rc-2: type-guard the parsed JSON instead of an `as` cast (ERR-001).
105
107
  function isRecord(value) {
@@ -7,11 +7,13 @@ export interface LegacyBackupMigrationResult {
7
7
  }
8
8
  /**
9
9
  * Resolve the OpenClaw install home.
10
- * Priority: OPENCLAW_HOME env var (explicit override) > ~/.openclaw
11
10
  *
12
- * Single authority for home resolution — backup placement
13
- * (`resolvePdBackupsRoot`) and installed-layout resolution
14
- * (`utils/installed-layout.ts`) both derive from it.
11
+ * PRI-872: delegated to the process-wide PD home resolution. In production it
12
+ * keeps the historical priority (OPENCLAW_HOME env var > ~/.openclaw); in an
13
+ * experiment instance it points at the experiment root, so backup placement
14
+ * and installed-layout resolution can never read the production host.
15
+ * Single authority for home resolution — `resolvePdBackupsRoot` and
16
+ * `utils/installed-layout.ts` both derive from it.
15
17
  */
16
18
  export declare function resolveOpenClawHome(): string;
17
19
  /** Backups root — outside the extensions dir OpenClaw scans for plugins. */
@@ -16,21 +16,20 @@
16
16
  */
17
17
  import * as fs from 'fs';
18
18
  import * as path from 'path';
19
- import * as os from 'os';
20
19
  import { errorMessage } from './response.js';
20
+ import { getPdHome } from './pd-home.js';
21
21
  /**
22
22
  * Resolve the OpenClaw install home.
23
- * Priority: OPENCLAW_HOME env var (explicit override) > ~/.openclaw
24
23
  *
25
- * Single authority for home resolution — backup placement
26
- * (`resolvePdBackupsRoot`) and installed-layout resolution
27
- * (`utils/installed-layout.ts`) both derive from it.
24
+ * PRI-872: delegated to the process-wide PD home resolution. In production it
25
+ * keeps the historical priority (OPENCLAW_HOME env var > ~/.openclaw); in an
26
+ * experiment instance it points at the experiment root, so backup placement
27
+ * and installed-layout resolution can never read the production host.
28
+ * Single authority for home resolution — `resolvePdBackupsRoot` and
29
+ * `utils/installed-layout.ts` both derive from it.
28
30
  */
29
31
  export function resolveOpenClawHome() {
30
- const envHome = process.env.OPENCLAW_HOME;
31
- if (envHome && envHome.trim().length > 0)
32
- return path.resolve(envHome);
33
- return path.join(os.homedir(), '.openclaw');
32
+ return getPdHome().openclawHome;
34
33
  }
35
34
  /** Backups root — outside the extensions dir OpenClaw scans for plugins. */
36
35
  export function resolvePdBackupsRoot() {
@@ -0,0 +1,34 @@
1
+ /**
2
+ * The console's single entry point for "which PD home am I serving?".
3
+ *
4
+ * PRI-872: every route and store used to call `os.homedir()` directly, so a
5
+ * second console (a dev/experiment instance) silently read and MUTATED the
6
+ * production install: the update page resolved `~/.pd`, "apply" spawned the
7
+ * production bootstrap executor, and both instances shared
8
+ * `~/.pd-console/workspaces.json`.
9
+ *
10
+ * Deliberately NOT cached: the resolver is a pure derivation from the
11
+ * environment plus a handful of path syscalls, and caching would pin the
12
+ * answer for the process lifetime — including across tests and across a
13
+ * launcher that re-points the root. The failure mode stays fail-closed either
14
+ * way: an unusable `PD_EXPERIMENT_ROOT` throws, it never falls back to the
15
+ * real user home.
16
+ */
17
+ import { type PdHomeFailureReason, type PdHomePaths, type PdHomeResolution } from '@principles/install-layout';
18
+ export declare class PdHomeConfigurationError extends Error {
19
+ readonly reason: PdHomeFailureReason;
20
+ readonly nextAction: string;
21
+ readonly details: Readonly<Record<string, string>>;
22
+ constructor(failure: Extract<PdHomeResolution, {
23
+ ok: false;
24
+ }>);
25
+ }
26
+ export declare function getPdHomeResolution(): PdHomeResolution;
27
+ /** Throws `PdHomeConfigurationError` when the environment is unusable. */
28
+ export declare function getPdHome(): PdHomePaths;
29
+ /**
30
+ * True only for an explicitly declared experiment instance. A broken
31
+ * configuration throws rather than answering `false` — "cannot tell" must not
32
+ * be reported as "production".
33
+ */
34
+ export declare function isExperimentInstance(): boolean;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * The console's single entry point for "which PD home am I serving?".
3
+ *
4
+ * PRI-872: every route and store used to call `os.homedir()` directly, so a
5
+ * second console (a dev/experiment instance) silently read and MUTATED the
6
+ * production install: the update page resolved `~/.pd`, "apply" spawned the
7
+ * production bootstrap executor, and both instances shared
8
+ * `~/.pd-console/workspaces.json`.
9
+ *
10
+ * Deliberately NOT cached: the resolver is a pure derivation from the
11
+ * environment plus a handful of path syscalls, and caching would pin the
12
+ * answer for the process lifetime — including across tests and across a
13
+ * launcher that re-points the root. The failure mode stays fail-closed either
14
+ * way: an unusable `PD_EXPERIMENT_ROOT` throws, it never falls back to the
15
+ * real user home.
16
+ */
17
+ import { resolvePdHome, } from '@principles/install-layout';
18
+ export class PdHomeConfigurationError extends Error {
19
+ reason;
20
+ nextAction;
21
+ details;
22
+ constructor(failure) {
23
+ super(failure.message);
24
+ this.name = 'PdHomeConfigurationError';
25
+ this.reason = failure.reason;
26
+ this.nextAction = failure.nextAction;
27
+ this.details = failure.details;
28
+ }
29
+ }
30
+ export function getPdHomeResolution() {
31
+ return resolvePdHome();
32
+ }
33
+ /** Throws `PdHomeConfigurationError` when the environment is unusable. */
34
+ export function getPdHome() {
35
+ const resolution = getPdHomeResolution();
36
+ if (!resolution.ok)
37
+ throw new PdHomeConfigurationError(resolution);
38
+ return resolution;
39
+ }
40
+ /**
41
+ * True only for an explicitly declared experiment instance. A broken
42
+ * configuration throws rather than answering `false` — "cannot tell" must not
43
+ * be reported as "production".
44
+ */
45
+ export function isExperimentInstance() {
46
+ return getPdHome().mode === 'experiment';
47
+ }
@@ -75,7 +75,7 @@ ${ua.detail}`,children:ua.detail}),ua.associationStatus==="pending_association"&
75
75
 
76
76
  \u5B83\u5176\u5B9E\u662F 3 \u4E2A\u5B50\u9636\u6BB5\u4E32\u8054\uFF1A\u627E\u6839\u56E0 \u2192 \u62BD\u8C61\u539F\u5219 \u2192 \u51B3\u5B9A\u600E\u4E48\u5904\u7406\u3002`,detailEn:`When an Agent makes a mistake, the Diagnostician runs a post-mortem asking "why" to find the root cause \u2014 not just recording "it failed". It then abstracts the cause into a principle candidate.
77
77
 
78
- It is actually 3 sub-stages chained: find root cause \u2192 abstract principle \u2192 decide how to handle.`,impactLevel:"danger",impactZh:"Pain \u4FE1\u53F7\u65E0\u6CD5\u8FDB\u5165\u5185\u5316\u7BA1\u9053\u3002\u8BCA\u65AD\u662F\u5165\u53E3\uFF0C\u5173\u6389\u540E\u6574\u4E2A\u6D41\u7A0B\u762B\u75EA\uFF0C\u65E0\u6CD5\u751F\u6210\u65B0\u7684\u539F\u5219\u5019\u9009\u3002",impactEn:"Pain signals cannot enter the internalization pipeline. Diagnosis is the entry point; disabling paralyzes the entire flow \u2014 no new principle candidates can be generated.",techDetailZh:{\u8F93\u5165:"`DiagnosticianContextPayload`\uFF08pain \u4FE1\u53F7\u4E0A\u4E0B\u6587\uFF09",\u8F93\u51FA:"`DiagnosticianOutputV1` \xB7 rootCause / violatedPrinciples / recommendations[] / confidence",\u7F16\u6392:"\u7531 `PainSignalBridge` \u89E6\u53D1\uFF1B\u5F00\u5173 = \u672C\u9875\u9762\u7684\u4EE3\u7406\u542F\u7528\u5F00\u5173\uFF08`internalAgents.agents.diagnostician.enabled`\uFF09",\u9636\u6BB5:"`diag_rootcause` \u2192 `diag_distiller` \u2192 `diag_router`"},techDetailEn:{Input:"`DiagnosticianContextPayload` (pain signal context)",Output:"`DiagnosticianOutputV1` \xB7 rootCause / violatedPrinciples / recommendations[] / confidence",Orchestration:"Triggered by `PainSignalBridge`; switch = this agent's enable toggle (`internalAgents.agents.diagnostician.enabled`)",Stages:"`diag_rootcause` \u2192 `diag_distiller` \u2192 `diag_router`"},isCore:!0},dreamer:{name:"dreamer",group:"core_trio",displayNameZh:"\u68A6\u60F3\u5BB6",displayNameEn:"Dreamer",roleZh:"\u60F3\u51FA 2-3 \u79CD\u4E0D\u540C\u7684\u7EA0\u6B63\u65B9\u6848",roleEn:"Proposes 2-3 distinct correction options",detailZh:`\u8BCA\u65AD\u5B8C\u6210\u540E\uFF0C\u68A6\u60F3\u5BB6\u4ECE\u4E0D\u540C\u89D2\u5EA6\u63D0\u51FA\u591A\u4E2A\u7EA0\u6B63\u65B9\u6848\u2014\u2014\u5C31\u50CF brainstorming\uFF0C\u5148\u53D1\u6563\u518D\u6536\u655B\u3002\u6BCF\u4E2A\u65B9\u6848\u90FD\u5305\u542B"\u5F53\u65F6\u505A\u9519\u4E86\u4EC0\u4E48 / \u5E94\u8BE5\u600E\u4E48\u505A / \u4E3A\u4EC0\u4E48"\u3002
78
+ It is actually 3 sub-stages chained: find root cause \u2192 abstract principle \u2192 decide how to handle.`,impactLevel:"danger",impactZh:"Pain \u4FE1\u53F7\u65E0\u6CD5\u8FDB\u5165\u5185\u5316\u7BA1\u9053\u3002\u8BCA\u65AD\u662F\u5165\u53E3\uFF0C\u5173\u6389\u540E\u6574\u4E2A\u6D41\u7A0B\u762B\u75EA\uFF0C\u65E0\u6CD5\u751F\u6210\u65B0\u7684\u539F\u5219\u5019\u9009\u3002",impactEn:"Pain signals cannot enter the internalization pipeline. Diagnosis is the entry point; disabling paralyzes the entire flow \u2014 no new principle candidates can be generated.",techDetailZh:{\u8F93\u5165:"`DiagnosticianContextPayload`\uFF08pain \u4FE1\u53F7\u4E0A\u4E0B\u6587\uFF09",\u8F93\u51FA:"`DiagnosticianOutputV2` \xB7 schemaVersion / rootCause / violatedPrinciples / recommendations[]\uFF08\u542B recommendationRef + principleAssociation\uFF09/ confidence",\u7F16\u6392:"\u7531 `PainSignalBridge` \u89E6\u53D1\uFF1B\u5F00\u5173 = \u672C\u9875\u9762\u7684\u4EE3\u7406\u542F\u7528\u5F00\u5173\uFF08`internalAgents.agents.diagnostician.enabled`\uFF09",\u9636\u6BB5:"`diag_rootcause` \u2192 `diag_distiller` \u2192 `diag_router`"},techDetailEn:{Input:"`DiagnosticianContextPayload` (pain signal context)",Output:"`DiagnosticianOutputV2` \xB7 schemaVersion / rootCause / violatedPrinciples / recommendations[] (with recommendationRef + principleAssociation) / confidence",Orchestration:"Triggered by `PainSignalBridge`; switch = this agent's enable toggle (`internalAgents.agents.diagnostician.enabled`)",Stages:"`diag_rootcause` \u2192 `diag_distiller` \u2192 `diag_router`"},isCore:!0},dreamer:{name:"dreamer",group:"core_trio",displayNameZh:"\u68A6\u60F3\u5BB6",displayNameEn:"Dreamer",roleZh:"\u60F3\u51FA 2-3 \u79CD\u4E0D\u540C\u7684\u7EA0\u6B63\u65B9\u6848",roleEn:"Proposes 2-3 distinct correction options",detailZh:`\u8BCA\u65AD\u5B8C\u6210\u540E\uFF0C\u68A6\u60F3\u5BB6\u4ECE\u4E0D\u540C\u89D2\u5EA6\u63D0\u51FA\u591A\u4E2A\u7EA0\u6B63\u65B9\u6848\u2014\u2014\u5C31\u50CF brainstorming\uFF0C\u5148\u53D1\u6563\u518D\u6536\u655B\u3002\u6BCF\u4E2A\u65B9\u6848\u90FD\u5305\u542B"\u5F53\u65F6\u505A\u9519\u4E86\u4EC0\u4E48 / \u5E94\u8BE5\u600E\u4E48\u505A / \u4E3A\u4EC0\u4E48"\u3002
79
79
 
80
80
  \u5B83\u662F\u5185\u5316\u5F15\u64CE\u7684\u7B2C\u4E00\u7AD9\uFF0C\u63A5\u6536\u8BCA\u65AD\u4EA7\u7269\uFF0C\u8F93\u51FA\u5019\u9009\u65B9\u6848\u3002`,detailEn:`After diagnosis, the Dreamer proposes multiple correction options from different angles \u2014 like brainstorming, diverge first then converge. Each option includes "what went wrong / what should be done / why".
81
81
 
@@ -8,7 +8,7 @@
8
8
  "build:ui:production": "node scripts/build-ui.mjs --production",
9
9
  "build": "npm run clean && npm run build:ui:production && tsc -p tsconfig.build.json && node ../../scripts/build/check-dist-hygiene.mjs",
10
10
  "clean": "node ../../scripts/build/clean-dist.mjs",
11
- "dev": "npx tsx src/server/index.ts --port 3100",
11
+ "dev": "npx tsx src/server/index.ts",
12
12
  "start": "node dist/server.js",
13
13
  "test": "vitest run",
14
14
  "test:watch": "vitest",
@@ -24,8 +24,8 @@ export { AGENT_IDS, AgentCapabilityRequirementsSchema, AgentTimeoutPolicySchema,
24
24
  export { RuntimeKindSchema, RuntimeCapabilitiesSchema, RuntimeHealthSchema, RunHandleSchema, RunExecutionStatusSchema, RunStatusSchema, ContextItemSchema, AgentSpecRefSchema, WorkflowRefSchema, TaskRefSchema, StartRunInputSchema, StructuredRunOutputSchema, RuntimeArtifactRefSchema, } from './runtime/index.js';
25
25
  export { PDTaskStatusSchema, TaskRecordSchema, DiagnosticianTaskRecordSchema, } from './runtime/index.js';
26
26
  export { HistoryQueryEntrySchema, TrajectoryLocateQuerySchema, TrajectoryCandidateSchema, TrajectoryLocateResultSchema, HistoryQueryResultSchema, DiagnosisTargetSchema, ContextPayloadSchema, DiagnosticianContextPayloadSchema, } from './runtime/index.js';
27
- export { DiagnosticianViolatedPrincipleSchema, DiagnosticianEvidenceSchema, RecommendationKindSchema, DiagnosticianRecommendationSchema, DiagnosticianOutputV1Schema, DiagnosticianInvocationInputSchema, } from './runtime/index.js';
28
- export type { PDErrorCategory, AgentSpec, AgentCapabilityRequirements, AgentTimeoutPolicy, AgentRetryPolicy, WellKnownAgentId, RuntimeKind, RuntimeCapabilities, RuntimeHealth, RunHandle, RunExecutionStatus, RunStatus, ContextItem, AgentSpecRef, WorkflowRef, TaskRef, StartRunInput, StructuredRunOutput, RuntimeArtifactRef, PDRuntimeAdapter, PDTaskStatus, TaskRecord, DiagnosticianTaskRecord, HistoryQueryEntry, TrajectoryLocateQuery, TrajectoryCandidate, TrajectoryLocateResult, HistoryQueryResult, DiagnosisTarget, ContextPayload, DiagnosticianContextPayload, DiagnosticianOutputV1, DiagnosticianViolatedPrinciple, DiagnosticianEvidence, RecommendationKind, DiagnosticianRecommendation, DiagnosticianInvocationInput, } from './runtime/index.js';
27
+ export { DiagnosticianViolatedPrincipleSchema, DiagnosticianEvidenceSchema, RecommendationKindSchema, PrincipleAssociationSchema, DiagnosticianRecommendationV2Schema, DiagnosticianOutputV2Schema, DiagnosticianInvocationInputSchema, DIAGNOSTICIAN_ENVELOPE_KEYS, readDiagnosticianOutputFromEnvelope, } from './runtime/index.js';
28
+ export type { PDErrorCategory, AgentSpec, AgentCapabilityRequirements, AgentTimeoutPolicy, AgentRetryPolicy, WellKnownAgentId, RuntimeKind, RuntimeCapabilities, RuntimeHealth, RunHandle, RunExecutionStatus, RunStatus, ContextItem, AgentSpecRef, WorkflowRef, TaskRef, StartRunInput, StructuredRunOutput, RuntimeArtifactRef, PDRuntimeAdapter, PDTaskStatus, TaskRecord, DiagnosticianTaskRecord, HistoryQueryEntry, TrajectoryLocateQuery, TrajectoryCandidate, TrajectoryLocateResult, HistoryQueryResult, DiagnosisTarget, ContextPayload, DiagnosticianContextPayload, DiagnosticianOutputV2, DiagnosticianRecommendationV2, DiagnosticianViolatedPrinciple, DiagnosticianEvidence, RecommendationKind, PrincipleAssociation, DiagnosticianInvocationInput, } from './runtime/index.js';
29
29
  export { RuntimeStateManager } from './runtime/index.js';
30
30
  export type { RuntimeStateManagerOptions } from './runtime/index.js';
31
31
  export { SqliteTaskStore, SqliteRunStore, MalformedRunError, SqliteConnection, SqliteTrajectoryLocator, SqliteSourceTraceLocator, SqliteHistoryQuery, SqliteContextAssembler, ResilientContextAssembler, ResilientHistoryQuery, DEFAULT_HISTORY_PAGE_SIZE, MAX_HISTORY_PAGE_SIZE, DEFAULT_TIME_WINDOW_MS, } from './runtime/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EACL,mBAAmB,EACnB,SAAS,EACT,qBAAqB,EACrB,gBAAgB,EAChB,yBAAyB,EACzB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAGjG,OAAO,EAC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ACL,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EACL,mBAAmB,EACnB,SAAS,EACT,qBAAqB,EACrB,gBAAgB,EAChB,yBAAyB,EACzB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAGjG,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,mBAAmB,EACnB,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,EACrB,8BAA8B,EAC9B,eAAe,EACf,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,yBAAyB,EACzB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,cAAc,EACd,WAAW,EACX,cAAc,EACd,yBAAyB,EACzB,wBAAwB,EACxB,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,iCAAiC,GAClC,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACV,YAAY,EACZ,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AACpH,YAAY,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAQlG,OAAO,EACL,+BAA+B,EAC/B,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AAM,oBAAoB,CAAC;AAGrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,YAAY,EACV,aAAa,EACb,cAAc,EACd,YAAY,EACZ,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AAGrC,YAAY,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAMtE,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,aAAa,GACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC"}
@@ -33,8 +33,8 @@ export { RuntimeKindSchema, RuntimeCapabilitiesSchema, RuntimeHealthSchema, RunH
33
33
  export { PDTaskStatusSchema, TaskRecordSchema, DiagnosticianTaskRecordSchema, } from './runtime/index.js';
34
34
  // Context payload schemas (Phase 2)
35
35
  export { HistoryQueryEntrySchema, TrajectoryLocateQuerySchema, TrajectoryCandidateSchema, TrajectoryLocateResultSchema, HistoryQueryResultSchema, DiagnosisTargetSchema, ContextPayloadSchema, DiagnosticianContextPayloadSchema, } from './runtime/index.js';
36
- // Diagnostician output schemas (Phase 2)
37
- export { DiagnosticianViolatedPrincipleSchema, DiagnosticianEvidenceSchema, RecommendationKindSchema, DiagnosticianRecommendationSchema, DiagnosticianOutputV1Schema, DiagnosticianInvocationInputSchema, } from './runtime/index.js';
36
+ // Diagnostician output schemas (V2 Only — PRI-1146)
37
+ export { DiagnosticianViolatedPrincipleSchema, DiagnosticianEvidenceSchema, RecommendationKindSchema, PrincipleAssociationSchema, DiagnosticianRecommendationV2Schema, DiagnosticianOutputV2Schema, DiagnosticianInvocationInputSchema, DIAGNOSTICIAN_ENVELOPE_KEYS, readDiagnosticianOutputFromEnvelope, } from './runtime/index.js';
38
38
  // Runtime integration layer
39
39
  export { RuntimeStateManager } from './runtime/index.js';
40
40
  // Store exports (for pd-cli and openclaw-plugin direct usage)
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,iGAAiG;AACjG,OAAO,EACL,mBAAmB,EACnB,SAAS,EACT,qBAAqB,EACrB,gBAAgB,EAChB,yBAAyB,EACzB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AAGnC,6DAA6D;AAC7D,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,mBAAmB,EACnB,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,EACrB,8BAA8B,EAC9B,eAAe,EACf,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,2BAA2B,CAAC;AAYnC,sDAAsD;AACtD,OAAO,EACL,cAAc,EACd,WAAW,EACX,cAAc,EACd,yBAAyB,EACzB,wBAAwB,EACxB,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,iCAAiC,GAClC,MAAM,2BAA2B,CAAC;AAQnC,0EAA0E;AAC1E,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAGpH,uCAAuC;AACvC,mEAAmE;AACnE,kEAAkE;AAElE,8EAA8E;AAC9E,oDAAoD;AACpD,OAAO,EACL,+BAA+B,EAC/B,sCAAsC,EACtC,kCAAkC,EAClC,8BAA8B,EAE9B,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAE5B,8BA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;AAG1D,gBAAgB;AAChB,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAErE,yBAAyB;AACzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAUnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAuBtE,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,iGAAiG;AACjG,OAAO,EACL,mBAAmB,EACnB,SAAS,EACT,qBAAqB,EACrB,gBAAgB,EAChB,yBAAyB,EACzB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AAGnC,6DAA6D;AAC7D,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,mBAAmB,EACnB,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,EACrB,8BAA8B,EAC9B,eAAe,EACf,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,2BAA2B,CAAC;AAYnC,sDAAsD;AACtD,OAAO,EACL,cAAc,EACd,WAAW,EACX,cAAc,EACd,yBAAyB,EACzB,wBAAwB,EACxB,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,iCAAiC,GAClC,MAAM,2BAA2B,CAAC;AAQnC,0EAA0E;AAC1E,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAGpH,uCAAuC;AACvC,mEAAmE;AACnE,kEAAkE;AAElE,8EAA8E;AAC9E,oDAAoD;AACpD,OAAO,EACL,+BAA+B,EAC/B,sCAAsC,EACtC,kCAAkC,EAClC,8BAA8B,EAE9B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EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAG1D,gBAAgB;AAChB,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAErE,yBAAyB;AACzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAUnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAuBtE,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC"}
@@ -5,16 +5,17 @@
5
5
  * Single source of truth for PiAiRuntimeAdapter (and any future
6
6
  * PDRuntimeAdapter). Extracted from pi-ai-runtime-adapter.ts so every caller
7
7
  * validates Stage A/B outputs against the correct schema
8
- * instead of hardcoding DiagnosticianOutputV1Schema.
8
+ * instead of hardcoding a stage-specific schema.
9
9
  *
10
10
  * Why this matters: the split diagnostician pipeline runs three stages, each
11
11
  * producing a DIFFERENT output shape:
12
12
  * - Stage A (diag_rootcause) → DiagRootCauseOutputV1 (causalChain, rootCauseCategory)
13
13
  * - Stage B (diag_distiller) → DiagDistillerOutputV1 (abstractedPrinciple, rationale)
14
- * - Stage C (diag_router) → DiagnosticianOutputV1 (violatedPrinciples, recommendations)
14
+ * - Stage C (diag_router) → DiagnosticianOutputV2 (violatedPrinciples,
15
+ * recommendations with recommendationRef + principleAssociation — PRI-1146 V2 Only)
15
16
  * Stage runners pass `outputSchemaRef` on StartRunInput to name which shape they
16
17
  * expect; adapters MUST resolve the schema from this registry rather than assume
17
- * DiagnosticianOutputV1 (which only matches Stage C).
18
+ * a single stage's shape.
18
19
  */
19
20
  import type { TSchema } from '@sinclair/typebox';
20
21
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"output-schema-registry.d.ts","sourceRoot":"","sources":["../../../src/runtime/adapter/output-schema-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAejD;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAwB9D,CAAC;AAyCH,eAAO,MAAM,yBAAyB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAyB,CAAC;AAE5F;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,GAAG,SAAS,CAMvF"}
1
+ {"version":3,"file":"output-schema-registry.d.ts","sourceRoot":"","sources":["../../../src/runtime/adapter/output-schema-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAejD;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CA4B9D,CAAC;AAyCH,eAAO,MAAM,yBAAyB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAyB,CAAC;AAE5F;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,GAAG,SAAS,CAMvF"}