create-principles-disciple 1.153.3 → 1.154.0
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.
- package/_release/product-identity.json +1 -1
- package/codex-adapter/dist/ingestion/codex-home.d.ts +1 -0
- package/codex-adapter/dist/ingestion/codex-home.js +19 -7
- package/codex-adapter/dist/ingestion/ingestion.js +34 -7
- package/codex-adapter/dist/pd-hook.js +14 -6
- package/codex-adapter/dist/worker/workspace-worker.js +31 -1
- package/codex-adapter/package.json +1 -1
- package/console/dist/server/index.js +5 -16
- package/console/dist/server/utils/installed-layout.js +6 -4
- package/console/dist/server/utils/pd-backups.d.ts +1 -14
- package/console/dist/server/utils/pd-backups.js +12 -64
- package/console/dist/web/assets/app.css +153 -9
- package/console/dist/web/assets/app.js +41 -37
- package/console/dist/web/assets/intent-reflection.webp +3 -0
- package/console/dist/web/assets/providers/anthropic.png +0 -0
- package/console/dist/web/assets/providers/deepseek.png +0 -0
- package/console/dist/web/assets/providers/google.png +0 -0
- package/console/dist/web/assets/providers/groq.svg +1 -0
- package/console/dist/web/assets/providers/kimi.png +0 -0
- package/console/dist/web/assets/providers/minimax.png +0 -0
- package/console/dist/web/assets/providers/mistral.svg +28 -0
- package/console/dist/web/assets/providers/nvidia.png +0 -0
- package/console/dist/web/assets/providers/openai.svg +1 -0
- package/console/dist/web/assets/providers/openrouter.svg +3 -0
- package/console/dist/web/assets/providers/qwen.png +0 -0
- package/console/dist/web/assets/providers/together.svg +21 -0
- package/console/dist/web/assets/providers/xai.svg +1 -0
- package/console/dist/web/assets/providers/xiaomi.png +0 -0
- package/console/dist/web/assets/providers/zai.svg +219 -0
- package/core/dist/index.d.ts +1 -2
- package/core/dist/index.d.ts.map +1 -1
- package/core/dist/index.js +4 -2
- package/core/dist/index.js.map +1 -1
- package/core/dist/prompt-builder/focus-compression.d.ts +8 -60
- package/core/dist/prompt-builder/focus-compression.d.ts.map +1 -1
- package/core/dist/prompt-builder/focus-compression.js +8 -434
- package/core/dist/prompt-builder/focus-compression.js.map +1 -1
- package/core/dist/prompt-builder/index.d.ts +1 -2
- package/core/dist/prompt-builder/index.d.ts.map +1 -1
- package/core/dist/prompt-builder/index.js +3 -2
- package/core/dist/prompt-builder/index.js.map +1 -1
- package/core/dist/runtime/activation/production-gate-deps.d.ts +7 -3
- package/core/dist/runtime/activation/production-gate-deps.d.ts.map +1 -1
- package/core/dist/runtime/activation/production-gate-deps.js +15 -6
- package/core/dist/runtime/activation/production-gate-deps.js.map +1 -1
- package/core/dist/runtime/adapter/principle-tree-ledger-adapter.d.ts +2 -0
- package/core/dist/runtime/adapter/principle-tree-ledger-adapter.d.ts.map +1 -1
- package/core/dist/runtime/adapter/principle-tree-ledger-adapter.js +9 -1
- package/core/dist/runtime/adapter/principle-tree-ledger-adapter.js.map +1 -1
- package/core/dist/runtime/config/pd-config-types.d.ts +20 -1
- package/core/dist/runtime/config/pd-config-types.d.ts.map +1 -1
- package/core/dist/runtime/config/pd-config-types.js.map +1 -1
- package/core/dist/runtime/config/pd-config-validate.d.ts.map +1 -1
- package/core/dist/runtime/config/pd-config-validate.js +12 -1
- package/core/dist/runtime/config/pd-config-validate.js.map +1 -1
- package/core/dist/runtime/internalization/bash-risk.d.ts.map +1 -1
- package/core/dist/runtime/internalization/bash-risk.js +6 -3
- package/core/dist/runtime/internalization/bash-risk.js.map +1 -1
- package/core/dist/runtime/internalization/internalization-orchestrator.d.ts +28 -1
- package/core/dist/runtime/internalization/internalization-orchestrator.d.ts.map +1 -1
- package/core/dist/runtime/internalization/internalization-orchestrator.js +109 -13
- package/core/dist/runtime/internalization/internalization-orchestrator.js.map +1 -1
- package/core/dist/runtime/internalization/split-diagnostician-runner.d.ts +10 -0
- package/core/dist/runtime/internalization/split-diagnostician-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/split-diagnostician-runner.js +6 -1
- package/core/dist/runtime/internalization/split-diagnostician-runner.js.map +1 -1
- package/core/dist/runtime/pain-chain-read-model.d.ts +14 -0
- package/core/dist/runtime/pain-chain-read-model.d.ts.map +1 -1
- package/core/dist/runtime/pain-chain-read-model.js +91 -3
- package/core/dist/runtime/pain-chain-read-model.js.map +1 -1
- package/core/dist/runtime/pain-ingress-payload.d.ts +15 -0
- package/core/dist/runtime/pain-ingress-payload.d.ts.map +1 -1
- package/core/dist/runtime/pain-ingress-payload.js +32 -3
- package/core/dist/runtime/pain-ingress-payload.js.map +1 -1
- package/core/dist/runtime/pain-signal-bridge.d.ts +8 -0
- package/core/dist/runtime/pain-signal-bridge.d.ts.map +1 -1
- package/core/dist/runtime/pain-signal-bridge.js +11 -0
- package/core/dist/runtime/pain-signal-bridge.js.map +1 -1
- package/core/dist/runtime/pain-signal-runtime-factory.d.ts.map +1 -1
- package/core/dist/runtime/pain-signal-runtime-factory.js +3 -0
- package/core/dist/runtime/pain-signal-runtime-factory.js.map +1 -1
- package/core/dist/runtime/pain-submit-capability.d.ts +54 -0
- package/core/dist/runtime/pain-submit-capability.d.ts.map +1 -1
- package/core/dist/runtime/pain-submit-capability.js +49 -1
- package/core/dist/runtime/pain-submit-capability.js.map +1 -1
- package/core/dist/runtime/storage-paths.d.ts +9 -10
- package/core/dist/runtime/storage-paths.d.ts.map +1 -1
- package/core/dist/runtime/storage-paths.js +9 -10
- package/core/dist/runtime/storage-paths.js.map +1 -1
- package/core/dist/runtime/store/context/sqlite-context-assembler.d.ts.map +1 -1
- package/core/dist/runtime/store/context/sqlite-context-assembler.js +10 -2
- package/core/dist/runtime/store/context/sqlite-context-assembler.js.map +1 -1
- package/core/dist/runtime/store/storage-paths.d.ts +65 -12
- package/core/dist/runtime/store/storage-paths.d.ts.map +1 -1
- package/core/dist/runtime/store/storage-paths.js +92 -39
- package/core/dist/runtime/store/storage-paths.js.map +1 -1
- package/core/package.json +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/installer.d.ts +137 -9
- package/dist/installer.d.ts.map +1 -1
- package/dist/installer.js +627 -100
- package/dist/installer.js.map +1 -1
- package/dist/installers/codex-host-installer.d.ts +23 -3
- package/dist/installers/codex-host-installer.d.ts.map +1 -1
- package/dist/installers/codex-host-installer.js +36 -20
- package/dist/installers/codex-host-installer.js.map +1 -1
- package/dist/installers/index.d.ts.map +1 -1
- package/dist/installers/index.js +24 -3
- package/dist/installers/index.js.map +1 -1
- package/dist/installers/mcp-registration-conflict.d.ts.map +1 -1
- package/dist/installers/mcp-registration-conflict.js +23 -16
- package/dist/installers/mcp-registration-conflict.js.map +1 -1
- package/dist/installers/openclaw-host-installer.d.ts.map +1 -1
- package/dist/installers/openclaw-host-installer.js +1 -8
- package/dist/installers/openclaw-host-installer.js.map +1 -1
- package/dist/installers/workbuddy-host-installer.d.ts.map +1 -1
- package/dist/installers/workbuddy-host-installer.js +51 -15
- package/dist/installers/workbuddy-host-installer.js.map +1 -1
- package/dist/mvp-config.d.ts +30 -5
- package/dist/mvp-config.d.ts.map +1 -1
- package/dist/mvp-config.js +49 -16
- package/dist/mvp-config.js.map +1 -1
- package/dist/prompts.js +1 -1
- package/dist/prompts.js.map +1 -1
- package/dist/uninstaller.d.ts.map +1 -1
- package/dist/uninstaller.js +142 -5
- package/dist/uninstaller.js.map +1 -1
- package/dist/update/release-manager.d.ts.map +1 -1
- package/dist/update/release-manager.js +5 -2
- package/dist/update/release-manager.js.map +1 -1
- package/dist/utils/env.d.ts +5 -10
- package/dist/utils/env.d.ts.map +1 -1
- package/dist/utils/env.js +91 -34
- package/dist/utils/env.js.map +1 -1
- package/dist/utils/host-workspace-ownership.d.ts +25 -0
- package/dist/utils/host-workspace-ownership.d.ts.map +1 -1
- package/dist/utils/host-workspace-ownership.js +153 -2
- package/dist/utils/host-workspace-ownership.js.map +1 -1
- package/host-runtime/dist/adaptive-background-append.d.ts +6 -0
- package/host-runtime/dist/adaptive-background-append.js +4 -1
- package/host-runtime/dist/adaptive-decision-protocol.d.ts +18 -2
- package/host-runtime/dist/adaptive-decision-protocol.js +39 -9
- package/host-runtime/dist/adaptive-principle-context-reader.d.ts +79 -0
- package/host-runtime/dist/adaptive-principle-context-reader.js +303 -0
- package/host-runtime/dist/adaptive-priority-provider.d.ts +33 -0
- package/host-runtime/dist/adaptive-priority-provider.js +68 -2
- package/host-runtime/dist/adaptive-selection.d.ts +16 -0
- package/host-runtime/dist/adaptive-selection.js +23 -1
- package/host-runtime/dist/codex-legacy-registration.js +10 -2
- package/host-runtime/dist/conversation-ingestion/pipeline.d.ts +8 -0
- package/host-runtime/dist/conversation-ingestion/pipeline.js +179 -7
- package/host-runtime/dist/degraded-enforcement-marker.js +16 -2
- package/host-runtime/dist/diagnostician-auto-run.js +4 -0
- package/host-runtime/dist/governance-observation-store.d.ts +44 -0
- package/host-runtime/dist/governance-observation-store.js +84 -1
- package/host-runtime/dist/governance-trajectory-turn-reader.d.ts +30 -0
- package/host-runtime/dist/governance-trajectory-turn-reader.js +47 -0
- package/host-runtime/dist/index.d.ts +2 -0
- package/host-runtime/dist/index.js +6 -0
- package/host-runtime/dist/product-telemetry/service.js +86 -20
- package/host-runtime/package.json +1 -1
- package/install-layout/dist/index.d.ts +23 -9
- package/install-layout/dist/index.js +49 -24
- package/install-layout/dist/mcp-binding-contract.d.ts +62 -0
- package/install-layout/dist/mcp-binding-contract.js +175 -3
- package/install-layout/dist/pd-home.d.ts +35 -5
- package/install-layout/dist/pd-home.js +138 -23
- package/install-layout/package.json +1 -1
- package/package.json +4 -4
- package/pd-cli/dist/commands/candidate.d.ts.map +1 -1
- package/pd-cli/dist/commands/candidate.js +134 -8
- package/pd-cli/dist/commands/candidate.js.map +1 -1
- package/pd-cli/dist/commands/codex-worker.d.ts.map +1 -1
- package/pd-cli/dist/commands/codex-worker.js +36 -2
- package/pd-cli/dist/commands/codex-worker.js.map +1 -1
- package/pd-cli/dist/commands/diagnose.d.ts.map +1 -1
- package/pd-cli/dist/commands/diagnose.js +34 -8
- package/pd-cli/dist/commands/diagnose.js.map +1 -1
- package/pd-cli/dist/commands/health-codex-install.d.ts +1 -3
- package/pd-cli/dist/commands/health-codex-install.d.ts.map +1 -1
- package/pd-cli/dist/commands/health-codex-install.js +19 -6
- package/pd-cli/dist/commands/health-codex-install.js.map +1 -1
- package/pd-cli/dist/commands/health-codex.d.ts.map +1 -1
- package/pd-cli/dist/commands/health-codex.js +27 -9
- package/pd-cli/dist/commands/health-codex.js.map +1 -1
- package/pd-cli/dist/commands/health-console.d.ts +2 -1
- package/pd-cli/dist/commands/health-console.d.ts.map +1 -1
- package/pd-cli/dist/commands/health-console.js +12 -3
- package/pd-cli/dist/commands/health-console.js.map +1 -1
- package/pd-cli/dist/commands/health-ingestion.d.ts +10 -2
- package/pd-cli/dist/commands/health-ingestion.d.ts.map +1 -1
- package/pd-cli/dist/commands/health-ingestion.js +56 -14
- package/pd-cli/dist/commands/health-ingestion.js.map +1 -1
- package/pd-cli/dist/commands/health-mcp.d.ts +19 -7
- package/pd-cli/dist/commands/health-mcp.d.ts.map +1 -1
- package/pd-cli/dist/commands/health-mcp.js +131 -45
- package/pd-cli/dist/commands/health-mcp.js.map +1 -1
- package/pd-cli/dist/commands/health-workbuddy.d.ts +2 -1
- package/pd-cli/dist/commands/health-workbuddy.d.ts.map +1 -1
- package/pd-cli/dist/commands/health-workbuddy.js +17 -8
- package/pd-cli/dist/commands/health-workbuddy.js.map +1 -1
- package/pd-cli/dist/commands/health.d.ts.map +1 -1
- package/pd-cli/dist/commands/health.js +12 -5
- package/pd-cli/dist/commands/health.js.map +1 -1
- package/pd-cli/dist/commands/mcp-probe.d.ts +6 -0
- package/pd-cli/dist/commands/mcp-probe.d.ts.map +1 -1
- package/pd-cli/dist/commands/mcp-probe.js +35 -7
- package/pd-cli/dist/commands/mcp-probe.js.map +1 -1
- package/pd-cli/dist/commands/pain-retry.d.ts.map +1 -1
- package/pd-cli/dist/commands/pain-retry.js +10 -2
- package/pd-cli/dist/commands/pain-retry.js.map +1 -1
- package/pd-cli/dist/commands/trace.d.ts.map +1 -1
- package/pd-cli/dist/commands/trace.js +8 -0
- package/pd-cli/dist/commands/trace.js.map +1 -1
- package/pd-cli/dist/commands/workbuddy-setup.d.ts.map +1 -1
- package/pd-cli/dist/commands/workbuddy-setup.js +7 -3
- package/pd-cli/dist/commands/workbuddy-setup.js.map +1 -1
- package/pd-cli/dist/commands/workbuddy-worker.d.ts.map +1 -1
- package/pd-cli/dist/commands/workbuddy-worker.js +21 -6
- package/pd-cli/dist/commands/workbuddy-worker.js.map +1 -1
- package/pd-cli/dist/services/admission-write-gate.d.ts +10 -1
- package/pd-cli/dist/services/admission-write-gate.d.ts.map +1 -1
- package/pd-cli/dist/services/admission-write-gate.js +12 -2
- package/pd-cli/dist/services/admission-write-gate.js.map +1 -1
- package/pd-cli/dist/services/codex-plugin-install.d.ts +1 -3
- package/pd-cli/dist/services/codex-plugin-install.d.ts.map +1 -1
- package/pd-cli/dist/services/codex-plugin-install.js +10 -3
- package/pd-cli/dist/services/codex-plugin-install.js.map +1 -1
- package/pd-cli/dist/services/pain-flood-simulation-runner.d.ts.map +1 -1
- package/pd-cli/dist/services/pain-flood-simulation-runner.js +2 -0
- package/pd-cli/dist/services/pain-flood-simulation-runner.js.map +1 -1
- package/pd-cli/dist/services/pd-config-loader.d.ts +2 -2
- package/pd-cli/dist/services/pd-config-loader.d.ts.map +1 -1
- package/pd-cli/dist/services/pd-config-loader.js +28 -20
- package/pd-cli/dist/services/pd-config-loader.js.map +1 -1
- package/pd-cli/dist/services/synthetic-baseline-runner.d.ts.map +1 -1
- package/pd-cli/dist/services/synthetic-baseline-runner.js +2 -0
- package/pd-cli/dist/services/synthetic-baseline-runner.js.map +1 -1
- package/pd-cli/package.json +1 -1
- package/pd-mcp-server/dist/log-file.js +9 -2
- package/pd-mcp-server/dist/server.d.ts +52 -2
- package/pd-mcp-server/dist/server.js +40 -4
- package/pd-mcp-server/dist/submit-assembly.js +85 -12
- package/pd-mcp-server/dist/version.d.ts +1 -1
- package/pd-mcp-server/dist/version.js +1 -1
- package/pd-mcp-server/package.json +1 -1
- package/plugin/dist/bundle.js +761 -722
- package/plugin/dist/commands/focus.d.ts +10 -7
- package/plugin/dist/commands/strategy.d.ts +10 -0
- package/plugin/dist/core/focus-history.d.ts +9 -49
- package/plugin/dist/core/paths.d.ts +6 -53
- package/plugin/dist/governance-audit.js +2 -2
- package/plugin/dist/hooks/prompt-helpers.d.ts +6 -5
- package/plugin/dist/hooks/prompt-types.d.ts +6 -6
- package/plugin/dist/openclaw.plugin.json +1 -1
- package/plugin/dist/rulehost-evidence.js +29 -29
- package/plugin/dist/templates/workspace/okr/RECOVERY_PROTOCOL.md +8 -7
- package/plugin/dist/utils/io.d.ts +1 -1
- package/plugin/dist/utils/workspace-resolver.d.ts +0 -20
- package/plugin/mcp/launcher.cjs +159 -35
- package/plugin/openclaw.plugin.json +1 -1
- package/plugin/package.json +1 -1
- package/plugin/templates/workspace/okr/RECOVERY_PROTOCOL.md +8 -7
- package/release-manager/dist/installer.js +627 -100
- package/release-manager/dist/installers/codex-host-installer.js +36 -20
- package/release-manager/dist/installers/index.js +24 -3
- package/release-manager/dist/installers/mcp-registration-conflict.js +23 -16
- package/release-manager/dist/installers/openclaw-host-installer.js +1 -8
- package/release-manager/dist/installers/workbuddy-host-installer.js +51 -15
- package/release-manager/dist/mvp-config.js +49 -16
- package/release-manager/dist/update/release-manager.js +5 -2
- package/release-manager/dist/utils/env.js +91 -34
- package/release-manager/dist/utils/host-workspace-ownership.js +153 -2
- package/release-manager/package.json +2 -2
- package/workbuddy-adapter/dist/index.d.ts +1 -1
- package/workbuddy-adapter/dist/index.js +1 -1
- package/workbuddy-adapter/dist/ingestion/catch-up.js +15 -3
- package/workbuddy-adapter/dist/ingestion/index.d.ts +1 -1
- package/workbuddy-adapter/dist/ingestion/index.js +1 -1
- package/workbuddy-adapter/dist/ingestion/ingestion.d.ts +18 -0
- package/workbuddy-adapter/dist/ingestion/ingestion.js +20 -2
- package/workbuddy-adapter/dist/ingestion/transcript-path.d.ts +13 -4
- package/workbuddy-adapter/dist/ingestion/transcript-path.js +102 -4
- package/workbuddy-adapter/dist/ingestion/transcript-source.js +76 -58
- package/workbuddy-adapter/dist/pd-hook.js +10 -3
- package/workbuddy-adapter/dist/worker/workspace-worker.js +4 -1
- package/workbuddy-adapter/dist/workspace-resolution.d.ts +9 -2
- package/workbuddy-adapter/dist/workspace-resolution.js +19 -3
- package/workbuddy-adapter/package.json +1 -1
- package/workbuddy-adapter/plugin/mcp/launcher.cjs +159 -35
- package/plugin/dist/templates/workspace/okr/CURRENT_FOCUS.md +0 -56
- package/plugin/dist/templates/workspace/okr/TASK_CHANGES.jsonl +0 -6
- package/plugin/dist/templates/workspace/okr/WEEK_TASKS.json +0 -6
- package/plugin/templates/workspace/okr/CURRENT_FOCUS.md +0 -56
- package/plugin/templates/workspace/okr/TASK_CHANGES.jsonl +0 -6
- package/plugin/templates/workspace/okr/WEEK_TASKS.json +0 -6
|
@@ -26,13 +26,12 @@
|
|
|
26
26
|
import { existsSync, readdirSync, readFileSync, statSync, writeFileSync } from 'fs';
|
|
27
27
|
import { execSync, spawnSync } from 'child_process';
|
|
28
28
|
import * as path from 'path';
|
|
29
|
-
import * as os from 'os';
|
|
30
29
|
import { createRequire } from 'module';
|
|
31
30
|
import { pathToFileURL } from 'url';
|
|
32
31
|
import { isNpmDependencyResolutionEnabled } from '../installer.js';
|
|
33
32
|
import { isSameMcpBindingPath, validateMcpBinding, } from '@principles/install-layout';
|
|
34
|
-
import {
|
|
35
|
-
import { getPdRuntimeDir } from '../mvp-config.js';
|
|
33
|
+
import { findForeignWorkspaceOwner } from '../utils/host-workspace-ownership.js';
|
|
34
|
+
import { getCodexHomeDir, getHomeDir, getOpenClawDir, getPdDir, getPdRuntimeDir } from '../mvp-config.js';
|
|
36
35
|
// NOTE (PRI-625 review round 3 / PRI-669 gate): this installer ships as the
|
|
37
36
|
// self-contained npx package — @principles/core is NOT in its dependencies,
|
|
38
37
|
// and type-only imports are erased at compile time, so the import above is
|
|
@@ -64,18 +63,14 @@ function getErrorCode(err) {
|
|
|
64
63
|
}
|
|
65
64
|
// ─── Path helpers ───────────────────────────────────────────────────────────
|
|
66
65
|
function getCodexDir() {
|
|
67
|
-
// Shared authority for Marketplace observation and
|
|
68
|
-
|
|
69
|
-
const override = process.env.CODEX_HOME;
|
|
70
|
-
return typeof override === 'string' && override.length > 0
|
|
71
|
-
? path.resolve(override)
|
|
72
|
-
: path.join(os.homedir(), '.codex');
|
|
66
|
+
// Shared PD Home authority for Marketplace observation and legacy hook detection.
|
|
67
|
+
return getCodexHomeDir();
|
|
73
68
|
}
|
|
74
69
|
function getCodexHooksJsonPath() {
|
|
75
70
|
return path.join(getCodexDir(), 'hooks.json');
|
|
76
71
|
}
|
|
77
72
|
function getPdCodexDir() {
|
|
78
|
-
return path.join(
|
|
73
|
+
return path.join(getPdDir(), 'codex');
|
|
79
74
|
}
|
|
80
75
|
function getPdHookMarkerPath() {
|
|
81
76
|
return path.join(getPdCodexDir(), PD_HOOK_MARKER);
|
|
@@ -542,14 +537,19 @@ function isMcpBindingHealthy(input) {
|
|
|
542
537
|
const verdict = validateMcpBinding(binding, 'codex', process.platform);
|
|
543
538
|
if (!verdict.ok)
|
|
544
539
|
return false;
|
|
545
|
-
// PRI-1247: an existing, readable workspace that belongs to ANOTHER
|
|
546
|
-
// is a cross-host misbinding, not a healthy binding
|
|
547
|
-
//
|
|
548
|
-
|
|
540
|
+
// PRI-1247 (reopen): an existing, readable workspace that belongs to ANOTHER
|
|
541
|
+
// PD host is a cross-host misbinding, not a healthy binding — including a
|
|
542
|
+
// NON-DEFAULT workspace that host formally declared in its
|
|
543
|
+
// `principles-disciple.json` or payload binding (the original incident's
|
|
544
|
+
// target passed the defaults-only check). Treat it as repair-needed so the
|
|
545
|
+
// installer rewrites it with this host's workspace.
|
|
546
|
+
if (findForeignWorkspaceOwner('codex', verdict.binding.workspaceDir, {
|
|
549
547
|
homeDir,
|
|
550
548
|
codexHome,
|
|
549
|
+
...(input.openclawHome !== undefined ? { openclawHome: input.openclawHome } : {}),
|
|
550
|
+
...(input.workbuddyConfigDir !== undefined ? { workbuddyConfigDir: input.workbuddyConfigDir } : {}),
|
|
551
551
|
platform: process.platform,
|
|
552
|
-
})
|
|
552
|
+
}).owners.length > 0)
|
|
553
553
|
return false;
|
|
554
554
|
// Installer-only context the shape contract cannot know: the binding must
|
|
555
555
|
// describe THIS payload's runtime at THIS payload's pin. The comparison uses
|
|
@@ -579,7 +579,25 @@ export class CodexHostInstaller {
|
|
|
579
579
|
return this.deps.codexHome ?? getCodexDir();
|
|
580
580
|
}
|
|
581
581
|
ownershipHome() {
|
|
582
|
-
return this.deps.homeDir ??
|
|
582
|
+
return this.deps.homeDir ?? getHomeDir();
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* The FOUR host roots the cross-host ownership verdict needs, honoring the
|
|
586
|
+
* user's custom OPENCLAW_STATE_DIR / OPENCLAW_HOME / WORKBUDDY_CONFIG_DIR
|
|
587
|
+
* through the shared resolver (§5.6) — omitting them would miss foreign
|
|
588
|
+
* bindings under custom host roots and skip a needed repair.
|
|
589
|
+
*/
|
|
590
|
+
hostOwnershipRoots() {
|
|
591
|
+
const workbuddyOverride = process.env.WORKBUDDY_CONFIG_DIR?.trim();
|
|
592
|
+
return {
|
|
593
|
+
homeDir: this.ownershipHome(),
|
|
594
|
+
codexHome: this.codexHome(),
|
|
595
|
+
openclawHome: this.deps.openclawHome ?? getOpenClawDir(),
|
|
596
|
+
workbuddyConfigDir: this.deps.workbuddyConfigDir
|
|
597
|
+
?? (workbuddyOverride !== undefined && workbuddyOverride.length > 0
|
|
598
|
+
? path.resolve(workbuddyOverride)
|
|
599
|
+
: path.join(this.ownershipHome(), '.workbuddy')),
|
|
600
|
+
};
|
|
583
601
|
}
|
|
584
602
|
/**
|
|
585
603
|
* Run `codex plugin add <plugin>@<marketplace>`. Re-adding an installed
|
|
@@ -747,8 +765,7 @@ export class CodexHostInstaller {
|
|
|
747
765
|
pluginRoot: current.versionDir,
|
|
748
766
|
runtimeDir,
|
|
749
767
|
pin,
|
|
750
|
-
|
|
751
|
-
homeDir: this.ownershipHome(),
|
|
768
|
+
...this.hostOwnershipRoots(),
|
|
752
769
|
});
|
|
753
770
|
let runtimeReconciled = false;
|
|
754
771
|
let bindingRepaired = false;
|
|
@@ -772,8 +789,7 @@ export class CodexHostInstaller {
|
|
|
772
789
|
pluginRoot: current.versionDir,
|
|
773
790
|
runtimeDir,
|
|
774
791
|
pin,
|
|
775
|
-
|
|
776
|
-
homeDir: this.ownershipHome(),
|
|
792
|
+
...this.hostOwnershipRoots(),
|
|
777
793
|
})) {
|
|
778
794
|
return {
|
|
779
795
|
success: false,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from 'fs';
|
|
2
2
|
import * as path from 'path';
|
|
3
3
|
import * as os from 'os';
|
|
4
|
+
import { resolvePdHome } from '@principles/install-layout';
|
|
4
5
|
import { OpenClawHostInstaller } from './openclaw-host-installer.js';
|
|
5
6
|
import { CodexHostInstaller, detectCodexMarketplaceState } from './codex-host-installer.js';
|
|
6
7
|
import { WorkBuddyHostInstaller, readWorkbuddyHostState, resolveWorkbuddyPaths } from './workbuddy-host-installer.js';
|
|
@@ -62,7 +63,18 @@ export function getHostInstallers(target) {
|
|
|
62
63
|
*/
|
|
63
64
|
export function detectInstalledHosts(homeDir = os.homedir(), codexHome) {
|
|
64
65
|
const detected = [];
|
|
65
|
-
|
|
66
|
+
// The OpenClaw extension lives in the ACTIVE state dir (OPENCLAW_STATE_DIR >
|
|
67
|
+
// OPENCLAW_HOME > <homeDir>/.openclaw) — the same resolution the host
|
|
68
|
+
// installer registers into. A fixed <homeDir>/.openclaw read misjudges a
|
|
69
|
+
// custom-state-dir install as absent, letting a manifest repair drop the
|
|
70
|
+
// record and a sibling-host uninstall remove the shared runtime (Devin
|
|
71
|
+
// review #2699-0004). Base fields only (registry surface compatibility).
|
|
72
|
+
const resolution = resolvePdHome({ homeDir });
|
|
73
|
+
if (!resolution.ok) {
|
|
74
|
+
// Fail-closed: an unusable PD home must not read as "no hosts installed".
|
|
75
|
+
throw new Error(`PD home resolution refused (${resolution.reason}): ${resolution.message} Next action: ${resolution.nextAction}`);
|
|
76
|
+
}
|
|
77
|
+
const openclawExtension = path.join(resolution.openclawHome, 'extensions', 'principles-disciple');
|
|
66
78
|
if (existsSync(openclawExtension)) {
|
|
67
79
|
detected.push({ hostId: 'openclaw', evidence: openclawExtension });
|
|
68
80
|
}
|
|
@@ -74,7 +86,9 @@ export function detectInstalledHosts(homeDir = os.homedir(), codexHome) {
|
|
|
74
86
|
}
|
|
75
87
|
const workbuddy = readWorkbuddyHostState(homeDir);
|
|
76
88
|
if (workbuddy.pluginState !== undefined && workbuddy.pluginState.registryReadable && workbuddy.pluginState.registered) {
|
|
77
|
-
|
|
89
|
+
// Evidence follows the same WORKBUDDY_CONFIG_DIR-aware root the installer
|
|
90
|
+
// registered into (resolveWorkbuddyPaths), not a fixed home literal.
|
|
91
|
+
detected.push({ hostId: 'workbuddy', evidence: resolveWorkbuddyPaths(homeDir).registryPath });
|
|
78
92
|
}
|
|
79
93
|
return detected;
|
|
80
94
|
}
|
|
@@ -98,7 +112,14 @@ export function evaluateRecordedHostPresence(host, homeDir = os.homedir()) {
|
|
|
98
112
|
return { status: 'installed', evidence: detected.evidence };
|
|
99
113
|
}
|
|
100
114
|
if (host === 'openclaw') {
|
|
101
|
-
|
|
115
|
+
// Same active-state-dir resolution the installer registers into (Devin
|
|
116
|
+
// review #2699-0004). A REFUSED resolution is 'undecidable' by the safety
|
|
117
|
+
// inversion: absence cannot be proven, so the manifest record stays.
|
|
118
|
+
const presenceResolution = resolvePdHome({ homeDir });
|
|
119
|
+
if (!presenceResolution.ok) {
|
|
120
|
+
return { status: 'undecidable', reason: `PD home resolution refused (${presenceResolution.reason}): ${presenceResolution.message}` };
|
|
121
|
+
}
|
|
122
|
+
const openclawDir = presenceResolution.openclawHome;
|
|
102
123
|
const configPath = path.join(openclawDir, 'openclaw.json');
|
|
103
124
|
let raw;
|
|
104
125
|
try {
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
* `pd health` reports the same verdict.
|
|
26
26
|
*/
|
|
27
27
|
import * as fs from 'fs';
|
|
28
|
-
import * as os from 'os';
|
|
29
28
|
import * as path from 'path';
|
|
29
|
+
import { resolvePdHome } from '@principles/install-layout';
|
|
30
30
|
export const PD_MCP_SERVER_NAME = 'pd-recall';
|
|
31
31
|
/** Stamp carried by PD's own launcher (see mcp/launcher.cjs `PD_LAUNCHER_ID`). */
|
|
32
32
|
const PD_LAUNCHER_ID = 'pd-mcp-launcher.v1';
|
|
@@ -37,24 +37,31 @@ const MAX_LAUNCHER_BYTES = 512 * 1024;
|
|
|
37
37
|
function isRecord(value) {
|
|
38
38
|
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
|
|
40
|
+
function resolveHostPathRoots(options) {
|
|
41
|
+
const env = { ...process.env };
|
|
42
|
+
if (options.codexHome !== undefined)
|
|
43
|
+
env.CODEX_HOME = options.codexHome;
|
|
44
|
+
if (options.workbuddyConfigDir !== undefined)
|
|
45
|
+
env.WORKBUDDY_CONFIG_DIR = options.workbuddyConfigDir;
|
|
46
|
+
// No explicit homeDir → let the shared resolver decide (HOME-first). Pinning
|
|
47
|
+
// os.homedir() here would make the conflict check inspect a DIFFERENT
|
|
48
|
+
// install than the one the installer writes to when HOME ≠ os.homedir()
|
|
49
|
+
// (review N27).
|
|
50
|
+
const resolution = options.homeDir !== undefined
|
|
51
|
+
? resolvePdHome({ homeDir: options.homeDir, env })
|
|
52
|
+
: resolvePdHome({ env });
|
|
53
|
+
if (!resolution.ok) {
|
|
54
|
+
throw new Error(`PD home resolution refused (${resolution.reason}): ${resolution.message} Next action: ${resolution.nextAction}`);
|
|
55
|
+
}
|
|
56
|
+
return resolution;
|
|
42
57
|
}
|
|
43
58
|
export function resolveMcpRegistrationConfigPath(host, options = {}) {
|
|
44
|
-
const home =
|
|
45
|
-
if (host === 'codex')
|
|
46
|
-
|
|
47
|
-
? process.env.CODEX_HOME
|
|
48
|
-
: path.join(home, '.codex'));
|
|
49
|
-
return path.join(codexHome, 'config.toml');
|
|
50
|
-
}
|
|
59
|
+
const home = resolveHostPathRoots(options);
|
|
60
|
+
if (host === 'codex')
|
|
61
|
+
return path.join(home.codexHome, 'config.toml');
|
|
51
62
|
if (host === 'openclaw')
|
|
52
|
-
return path.join(home
|
|
53
|
-
|
|
54
|
-
?? (process.env.WORKBUDDY_CONFIG_DIR && process.env.WORKBUDDY_CONFIG_DIR.length > 0
|
|
55
|
-
? process.env.WORKBUDDY_CONFIG_DIR
|
|
56
|
-
: path.join(home, '.workbuddy'));
|
|
57
|
-
return path.join(configDir, 'mcp.json');
|
|
63
|
+
return path.join(home.openclawHome, 'openclaw.json');
|
|
64
|
+
return path.join(home.workbuddyConfigDir, 'mcp.json');
|
|
58
65
|
}
|
|
59
66
|
const HOST_MARKER_PATHS = {
|
|
60
67
|
codex: ['.codex-plugin', 'plugin.json'],
|
|
@@ -20,8 +20,7 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import { existsSync, readFileSync, writeFileSync } from 'fs';
|
|
22
22
|
import * as path from 'path';
|
|
23
|
-
import
|
|
24
|
-
import { validateOpenClawConfig } from '../mvp-config.js';
|
|
23
|
+
import { getOpenClawDir, getPluginExtDir, validateOpenClawConfig } from '../mvp-config.js';
|
|
25
24
|
import { classifyOpenClawConfigObject } from './mcp-registration-conflict.js';
|
|
26
25
|
// PRI-343: Keep in sync with @principles/core CONVERSATION_ACCESS_CONFIG_KEY
|
|
27
26
|
const CONVERSATION_ACCESS_CONFIG_KEY = 'allowConversationAccess';
|
|
@@ -68,12 +67,6 @@ function ensureConversationAccess(config) {
|
|
|
68
67
|
result.plugins = plugins;
|
|
69
68
|
return result;
|
|
70
69
|
}
|
|
71
|
-
function getOpenClawDir() {
|
|
72
|
-
return path.join(os.homedir(), '.openclaw');
|
|
73
|
-
}
|
|
74
|
-
function getPluginExtDir() {
|
|
75
|
-
return path.join(getOpenClawDir(), 'extensions', 'principles-disciple');
|
|
76
|
-
}
|
|
77
70
|
/**
|
|
78
71
|
* OpenClaw host installer — writes/merges ~/.openclaw/openclaw.json only.
|
|
79
72
|
* Plugin installation records belong to the OpenClaw host; PD must not write
|
|
@@ -193,8 +193,9 @@ function missingWorkbuddyPayloadFile(root) {
|
|
|
193
193
|
}
|
|
194
194
|
export function resolveWorkbuddyPaths(homeDir) {
|
|
195
195
|
const layout = getInstallLayoutPaths(homeDir);
|
|
196
|
-
// The
|
|
197
|
-
//
|
|
196
|
+
// The governance workspace and host config root are derived together so
|
|
197
|
+
// an explicit WORKBUDDY_CONFIG_DIR cannot split PD's database from the host
|
|
198
|
+
// registration it is installed beside. The host-owned tree remains in place.
|
|
198
199
|
//
|
|
199
200
|
// HOST BOUNDARY (review P3, probe P0 fact): this installer targets the
|
|
200
201
|
// WorkBuddy DESKTOP host, whose registration root is ~/.workbuddy (real
|
|
@@ -202,9 +203,8 @@ export function resolveWorkbuddyPaths(homeDir) {
|
|
|
202
203
|
// root is ~/.codebuddy (CODEBUDDY_CONFIG_DIR); a CLI-only user's engine
|
|
203
204
|
// will not read a registration written here. WORKBUDDY_CONFIG_DIR remains
|
|
204
205
|
// the isolation override (Phase 0 lab discipline).
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
: path.dirname(getWorkbuddyWorkspaceDir(homeDir));
|
|
206
|
+
const governanceDir = getWorkbuddyWorkspaceDir(homeDir, process.env.WORKBUDDY_CONFIG_DIR);
|
|
207
|
+
const configDir = path.dirname(governanceDir);
|
|
208
208
|
return {
|
|
209
209
|
homeDir: layout.homeDir,
|
|
210
210
|
configDir,
|
|
@@ -212,7 +212,7 @@ export function resolveWorkbuddyPaths(homeDir) {
|
|
|
212
212
|
registryPath: path.join(configDir, 'plugins', 'installed_plugins.json'),
|
|
213
213
|
cachePluginRoot: path.join(configDir, 'plugins', 'cache', WORKBUDDY_MARKETPLACE_NAME, WORKBUDDY_PLUGIN_NAME),
|
|
214
214
|
marketplaceRoot: path.join(layout.pdDir, 'workbuddy-marketplace'),
|
|
215
|
-
governanceDir
|
|
215
|
+
governanceDir,
|
|
216
216
|
runtimeAdapterDir: layout.workbuddyAdapterDir,
|
|
217
217
|
installManifestPath: layout.manifest,
|
|
218
218
|
};
|
|
@@ -2168,7 +2168,7 @@ function writeWorkbuddyMcpBinding(marketplaceRoot, homeDir) {
|
|
|
2168
2168
|
const binding = {
|
|
2169
2169
|
schemaVersion: 'pd.mcp-binding.v1',
|
|
2170
2170
|
host: 'workbuddy',
|
|
2171
|
-
workspaceDir: getWorkbuddyWorkspaceDir(homeDir),
|
|
2171
|
+
workspaceDir: getWorkbuddyWorkspaceDir(homeDir, process.env.WORKBUDDY_CONFIG_DIR),
|
|
2172
2172
|
runtimeDir: layout.runtimeDir,
|
|
2173
2173
|
serverEntry,
|
|
2174
2174
|
versions: { mcpServer: mcpServerVersion },
|
|
@@ -2307,26 +2307,58 @@ export class WorkBuddyHostInstaller {
|
|
|
2307
2307
|
};
|
|
2308
2308
|
}
|
|
2309
2309
|
const { payload } = payloadFind;
|
|
2310
|
-
// 3b. SPEC §7.5/§11.3: a same-name user-level MCP server must
|
|
2311
|
-
//
|
|
2312
|
-
//
|
|
2313
|
-
|
|
2310
|
+
// 3b. SPEC §7.5/§11.3: a same-name user-level MCP server must never be
|
|
2311
|
+
// adopted or overwritten. The check is read-only and leaves the file alone.
|
|
2312
|
+
//
|
|
2313
|
+
// PRI-1249: a PROVEN foreign entry (`conflict`) always stops the install.
|
|
2314
|
+
// An entry whose ownership cannot be proven (`unverifiable` — in practice a
|
|
2315
|
+
// dead absolute `mcp/launcher.cjs` left behind by an older registration)
|
|
2316
|
+
// used to stop it too, and because `writeWorkbuddyMcpBinding` runs later in
|
|
2317
|
+
// this method, a host that was ALREADY installed could never be re-bound to
|
|
2318
|
+
// a new shared runtime: the launcher then failed closed forever with
|
|
2319
|
+
// `binding_version_mismatch`, and every official remedy (install / update /
|
|
2320
|
+
// repair) re-hit this same gate.
|
|
2321
|
+
//
|
|
2322
|
+
// The deadlock only exists for hosts PD has already bound, so only those
|
|
2323
|
+
// are allowed past an unprovable entry. A first registration keeps Gate 4's
|
|
2324
|
+
// hard stop: there the entry may belong to someone else entirely.
|
|
2325
|
+
//
|
|
2326
|
+
// "Already bound" must be read from a fact this run does NOT destroy:
|
|
2327
|
+
// `materializeMarketplace()` wipes the marketplace payload before copying,
|
|
2328
|
+
// so a copy failure would erase the binding that authorises the retry and
|
|
2329
|
+
// re-create the very deadlock this fix removes. The host's own registration
|
|
2330
|
+
// record survives that, so either signal counts.
|
|
2331
|
+
//
|
|
2332
|
+
// Why proceeding is not a user-config write: this installer writes no part
|
|
2333
|
+
// of `~/.workbuddy/mcp.json` — no writer for it exists anywhere in this
|
|
2334
|
+
// repository, and the classifier beside this code is read-only. The bytes
|
|
2335
|
+
// stay identical whether the install proceeds or not (the test asserts the
|
|
2336
|
+
// sha256). What PD itself does write is its own payload + binding.
|
|
2337
|
+
const pdMcpBindingPresent = existsSync(path.join(p.marketplaceRoot, WORKBUDDY_PLUGIN_NAME, 'mcp-binding.json'));
|
|
2338
|
+
const pdAlreadyInstalledForHost = pdMcpBindingPresent || details.registered;
|
|
2339
|
+
const mcpRegistration = checkMcpRegistrationConflict('workbuddy', {
|
|
2314
2340
|
homeDir: this.deps.homeDir(),
|
|
2315
2341
|
workbuddyConfigDir: p.configDir,
|
|
2316
2342
|
// Ownership is proven by the payload PD ships OR by launcher content
|
|
2317
2343
|
// stamps — never by the `mcp/launcher.cjs` file NAME alone.
|
|
2318
2344
|
pdLauncherRoots: [payload.pluginDir],
|
|
2319
2345
|
});
|
|
2320
|
-
if (!
|
|
2346
|
+
if (!mcpRegistration.ok && (mcpRegistration.kind === 'conflict' || !pdAlreadyInstalledForHost)) {
|
|
2321
2347
|
return {
|
|
2322
2348
|
success: false,
|
|
2323
2349
|
hostId: this.hostId,
|
|
2324
2350
|
configPath: p.settingsPath,
|
|
2325
2351
|
configAction: 'skipped',
|
|
2326
|
-
reason:
|
|
2327
|
-
nextAction:
|
|
2352
|
+
reason: mcpRegistration.reason,
|
|
2353
|
+
nextAction: mcpRegistration.nextAction,
|
|
2328
2354
|
};
|
|
2329
2355
|
}
|
|
2356
|
+
// Not a failure: this host already carries a PD MCP payload, and PD writes
|
|
2357
|
+
// none of that user file. The Owner still needs the exact path and the
|
|
2358
|
+
// recovery step (rc-9: reason + nextAction, never a bare "something was odd").
|
|
2359
|
+
const mcpRegistrationWarning = mcpRegistration.ok
|
|
2360
|
+
? undefined
|
|
2361
|
+
: `${mcpRegistration.reason} PD left that entry untouched and continued so this host is not left bound to the previous MCP server version. ${mcpRegistration.nextAction}`;
|
|
2330
2362
|
// 4. Materialize the PD-owned marketplace (source stays inside its root).
|
|
2331
2363
|
try {
|
|
2332
2364
|
materializeMarketplace(p.marketplaceRoot, payload.pluginDir);
|
|
@@ -2560,12 +2592,16 @@ export class WorkBuddyHostInstaller {
|
|
|
2560
2592
|
// pd-review). Idempotent and preservation-first: a copy that is not
|
|
2561
2593
|
// provably a published payload is reported, never overwritten or deleted.
|
|
2562
2594
|
const legacySkill = deprecateAllLegacyWorkbuddySkills({ configDir: p.configDir });
|
|
2595
|
+
const installWarnings = [
|
|
2596
|
+
...legacySkill.warnings,
|
|
2597
|
+
...(mcpRegistrationWarning === undefined ? [] : [mcpRegistrationWarning]),
|
|
2598
|
+
];
|
|
2563
2599
|
return {
|
|
2564
2600
|
success: true,
|
|
2565
2601
|
hostId: this.hostId,
|
|
2566
2602
|
configPath: p.settingsPath,
|
|
2567
2603
|
configAction: registration.settingsAction,
|
|
2568
|
-
warnings:
|
|
2604
|
+
warnings: installWarnings.length > 0 ? installWarnings : undefined,
|
|
2569
2605
|
pluginState: this.readInstalledPluginState(),
|
|
2570
2606
|
governance: governanceDefaults === null
|
|
2571
2607
|
? undefined
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as yaml from 'js-yaml';
|
|
2
2
|
import * as path from 'path';
|
|
3
|
-
import * as os from 'os';
|
|
4
3
|
import { existsSync, readFileSync } from 'fs';
|
|
4
|
+
import { homedir as osHomedir } from 'os';
|
|
5
5
|
import { execSync } from 'child_process';
|
|
6
6
|
import { errnoCode } from './utils/config-file-io.js';
|
|
7
|
+
import { resolvePdHome } from '@principles/install-layout';
|
|
7
8
|
export const MVP_CHANNELS = ['prompt', 'code_tool_hook', 'defer_archive'];
|
|
8
9
|
// GFI retired 2026-11-04 (GFI-COMPLETE-REMOVAL-001): its flag became a `gone`
|
|
9
10
|
// tombstone, so no quiet flag remains.
|
|
@@ -171,22 +172,55 @@ export function buildFailureOutput(reason, nextAction) {
|
|
|
171
172
|
export function isMvpChannel(value) {
|
|
172
173
|
return MVP_CHANNELS.includes(value);
|
|
173
174
|
}
|
|
175
|
+
function requirePdHome() {
|
|
176
|
+
const resolution = resolvePdHome();
|
|
177
|
+
if (!resolution.ok) {
|
|
178
|
+
throw new Error(`PD home resolution refused (${resolution.reason}): ${resolution.message} Next action: ${resolution.nextAction}`);
|
|
179
|
+
}
|
|
180
|
+
return resolution;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* The real user home, not the effective PD Home. PD-owned paths must go
|
|
184
|
+
* through requirePdHome()/getPdDir()/getOpenClawDir(); this value is passed to
|
|
185
|
+
* those resolvers as their production-home input and must not be replaced by
|
|
186
|
+
* PD_EXPERIMENT_ROOT (which is a separate isolation boundary).
|
|
187
|
+
*
|
|
188
|
+
* Precedence mirrors install-layout's resolvePdHome default (resolveRealUserHome):
|
|
189
|
+
* an explicit `HOME` wins (the POSIX semantics plus the established
|
|
190
|
+
* installer-family test-sandbox contract), then `os.homedir()` (USERPROFILE on
|
|
191
|
+
* Windows). The mirror is inline because the packaged installer must keep
|
|
192
|
+
* working against the PUBLISHED @principles/install-layout surface (the
|
|
193
|
+
* smoke-packaged-install registry-parity gate resolves the registry version,
|
|
194
|
+
* which does not export the helper yet) — the two implementations are pinned
|
|
195
|
+
* together semantically, not by import (ERR-083 OCC-20261117T190516Z: letting
|
|
196
|
+
* them diverge lands HOME-sandboxed tests on the real production home).
|
|
197
|
+
*/
|
|
174
198
|
export function getHomeDir() {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|| (process.env.HOMEDRIVE && process.env.HOMEPATH ? process.env.HOMEDRIVE + process.env.HOMEPATH : null)
|
|
178
|
-
|| '.';
|
|
199
|
+
const home = process.env.HOME?.trim();
|
|
200
|
+
return home !== undefined && home.length > 0 ? home : osHomedir();
|
|
179
201
|
}
|
|
180
202
|
export function getOpenClawDir() {
|
|
181
|
-
return
|
|
203
|
+
return requirePdHome().openclawHome;
|
|
204
|
+
}
|
|
205
|
+
export function getCodexHomeDir() {
|
|
206
|
+
return requirePdHome().codexHome;
|
|
182
207
|
}
|
|
183
208
|
/** Host-neutral PD installation root. Shared runtime must not live under a
|
|
184
209
|
* host's discovery directory (ADR-0020 / ERR-097). */
|
|
185
210
|
export function getPdDir() {
|
|
186
|
-
return
|
|
211
|
+
return requirePdHome().pdHome;
|
|
187
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* The derived paths below are composed from the BASE PdHomePaths fields only
|
|
215
|
+
* (pdHome/openclawHome/codexHome — present since install-layout 0.8.3). The
|
|
216
|
+
* packaged installer must keep working against the PUBLISHED install-layout
|
|
217
|
+
* surface (smoke-packaged-install resolves the registry version), which does
|
|
218
|
+
* not yet carry the newer fields (runtimeDir/pdRuntimeBackupsDir/
|
|
219
|
+
* openclawExtensionDir). The derivations are the same constants resolvePdHome
|
|
220
|
+
* computes, so the two stay semantically pinned (Devin review #2699-0003).
|
|
221
|
+
*/
|
|
188
222
|
export function getPdRuntimeDir() {
|
|
189
|
-
return path.join(
|
|
223
|
+
return path.join(requirePdHome().pdHome, 'runtime');
|
|
190
224
|
}
|
|
191
225
|
export function getInstallManifestPath() {
|
|
192
226
|
return path.join(getPdDir(), 'install.json');
|
|
@@ -195,7 +229,7 @@ export function getPdRuntimeBackupsDir() {
|
|
|
195
229
|
return path.join(getPdDir(), 'backups');
|
|
196
230
|
}
|
|
197
231
|
export function getPluginExtDir() {
|
|
198
|
-
return path.join(
|
|
232
|
+
return path.join(requirePdHome().openclawHome, 'extensions', 'principles-disciple');
|
|
199
233
|
}
|
|
200
234
|
/** Common plugin package used by pd-cli/console. OpenClaw gets an adapter copy
|
|
201
235
|
* under getPluginExtDir(); Codex-only installs use this host-neutral copy. */
|
|
@@ -206,14 +240,13 @@ export function getInstalledLayoutPackageDir() {
|
|
|
206
240
|
return path.join(getPdRuntimeDir(), 'install-layout');
|
|
207
241
|
}
|
|
208
242
|
/**
|
|
209
|
-
* PD
|
|
210
|
-
* OpenClaw
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
* "duplicate plugin id detected" 告警。备份一律放这里,禁止放 extensions/ 内。
|
|
243
|
+
* Host-neutral PD backup root (<PD_HOME>/.pd/backups). It is outside every
|
|
244
|
+
* host's plugin discovery tree; OpenClaw extension backups and shared-runtime
|
|
245
|
+
* backups use the same owner-controlled location. Derived from the base
|
|
246
|
+
* pdHome field for registry-surface compatibility (see getPdRuntimeDir).
|
|
214
247
|
*/
|
|
215
248
|
export function getPdBackupsDir() {
|
|
216
|
-
return
|
|
249
|
+
return getPdRuntimeBackupsDir();
|
|
217
250
|
}
|
|
218
251
|
export function getInstalledPdCliDir() {
|
|
219
252
|
return path.join(getPdRuntimeDir(), 'pd-cli');
|
|
@@ -557,7 +590,7 @@ export function getGlobalShimPaths() {
|
|
|
557
590
|
paths.push(path.join(globalBin, 'pd'));
|
|
558
591
|
}
|
|
559
592
|
}
|
|
560
|
-
const homeBin = path.join(
|
|
593
|
+
const homeBin = path.join(osHomedir(), 'bin');
|
|
561
594
|
if (isWindows()) {
|
|
562
595
|
paths.push(path.join(homeBin, 'pd.cmd'), path.join(homeBin, 'pd.ps1'), path.join(homeBin, 'pd'));
|
|
563
596
|
}
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { randomUUID } from 'node:crypto';
|
|
11
11
|
import * as fs from 'node:fs';
|
|
12
|
-
import * as os from 'node:os';
|
|
13
12
|
import * as path from 'node:path';
|
|
13
|
+
import { getOpenClawDir } from '../mvp-config.js';
|
|
14
14
|
import { resolveTrustedReleaseTarget, downloadTrustedReleasePayload, ReleaseTrustError } from './trust-metadata.js';
|
|
15
15
|
import { parseChannelMetadata } from './channel-metadata.js';
|
|
16
16
|
import { buildReleaseMetadata, isReleaseMetadataExpired, parseReleaseMetadata, verifyReleaseMetadataIdentity, } from './release-metadata.js';
|
|
@@ -581,8 +581,11 @@ export class ReleaseManager {
|
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
583
|
legacyOverlayMarker() {
|
|
584
|
+
// Same active OpenClaw state dir the installer and plugin resolver use
|
|
585
|
+
// (OPENCLAW_STATE_DIR > OPENCLAW_HOME > ~/.openclaw via the PD Home
|
|
586
|
+
// authority) — an experiment update inspects its own lab overlay.
|
|
584
587
|
const openclawRoot = this.options.openclawHome
|
|
585
|
-
??
|
|
588
|
+
?? getOpenClawDir();
|
|
586
589
|
return path.join(openclawRoot, 'extensions', 'principles-disciple');
|
|
587
590
|
}
|
|
588
591
|
readChannelMetadataPayload(channel) {
|