create-principles-disciple 1.153.4 → 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 +67 -9
- package/console/dist/web/assets/app.js +37 -37
- 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/installer.d.ts +113 -9
- package/dist/installer.d.ts.map +1 -1
- package/dist/installer.js +596 -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.js +7 -7
- 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 +596 -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 +7 -7
- 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
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Rules: CODEX_HOME, when set and non-empty, MUST already exist and be a
|
|
6
6
|
* directory and is canonicalized; a missing path or a file path is an error.
|
|
7
|
-
* When unset, the home comes from
|
|
8
|
-
*
|
|
7
|
+
* When unset, the home comes from PD Home resolution (production: OS home
|
|
8
|
+
* plus `.codex`; experiment: <PD_EXPERIMENT_ROOT>/.codex), and existence is
|
|
9
|
+
* NOT verified. There is one OS-generic implementation.
|
|
9
10
|
*/
|
|
10
11
|
import fs from 'node:fs';
|
|
11
|
-
import
|
|
12
|
-
import path from 'node:path';
|
|
12
|
+
import { resolvePdHome } from '@principles/install-layout';
|
|
13
13
|
/**
|
|
14
14
|
* Canonicalize a Windows path to its final long form. Node's JS realpath
|
|
15
15
|
* preserves 8.3 short-name segments (ADMINI~1), while hook payloads carry
|
|
@@ -26,18 +26,30 @@ export function canonicalizePath(target) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
export function resolveCodexHome(env = process.env) {
|
|
29
|
+
const pdHome = resolvePdHome({ env });
|
|
30
|
+
if (!pdHome.ok) {
|
|
31
|
+
return {
|
|
32
|
+
ok: false,
|
|
33
|
+
reason: 'pd_home_resolution_failed',
|
|
34
|
+
nextAction: `PD home resolution refused (${pdHome.reason}): ${pdHome.message} ${pdHome.nextAction}`,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
29
37
|
const configured = env.CODEX_HOME;
|
|
30
38
|
if (configured !== undefined && configured.trim() !== '') {
|
|
39
|
+
// Validation and canonicalization run on the path resolvePdHome VERIFIED
|
|
40
|
+
// and returned (pdHome.codexHome), never on the raw env string: a symlinked
|
|
41
|
+
// CODEX_HOME must not pass its existence check on one path and then be
|
|
42
|
+
// consumed via another (validated path == used path).
|
|
31
43
|
try {
|
|
32
|
-
const stats = fs.statSync(
|
|
44
|
+
const stats = fs.statSync(pdHome.codexHome);
|
|
33
45
|
if (!stats.isDirectory()) {
|
|
34
46
|
return { ok: false, reason: 'codex_home_not_directory', nextAction: 'CODEX_HOME must point at an existing directory (Codex fatal-error contract).' };
|
|
35
47
|
}
|
|
36
|
-
return { ok: true, home: canonicalizePath(
|
|
48
|
+
return { ok: true, home: canonicalizePath(pdHome.codexHome) };
|
|
37
49
|
}
|
|
38
50
|
catch {
|
|
39
51
|
return { ok: false, reason: 'codex_home_unavailable', nextAction: 'CODEX_HOME is set but does not exist; unset it or create the directory.' };
|
|
40
52
|
}
|
|
41
53
|
}
|
|
42
|
-
return { ok: true, home:
|
|
54
|
+
return { ok: true, home: pdHome.codexHome };
|
|
43
55
|
}
|
|
@@ -155,20 +155,31 @@ function codexVerifiedOutcomesPreIngest({ workspaceDir, delta, now: _now }) {
|
|
|
155
155
|
}
|
|
156
156
|
return { ok: true };
|
|
157
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* PRI-1262: live and catch-up ingestion reuse the FORMAL consent judgment —
|
|
160
|
+
* the same v3 ledger `pd health` reads (`readConversationIngestionConsent`).
|
|
161
|
+
* The PRI-1171 phasing invariant 'granted' made the runtime ingest even when
|
|
162
|
+
* health reported `flag_on_without_grant`; now a missing / revoked / failed
|
|
163
|
+
* record degrades with `consent_not_granted:<decision>` BEFORE any transcript
|
|
164
|
+
* read, so runtime and health can no longer disagree. An unreadable ledger
|
|
165
|
+
* resolves to 'not_present' (fail closed — nothing is read).
|
|
166
|
+
*/
|
|
167
|
+
function resolveCodexConsentGate(workspaceDir) {
|
|
168
|
+
const read = readConversationIngestionConsent(workspaceDir, 'codex');
|
|
169
|
+
const record = read.ok ? read.record : null;
|
|
170
|
+
return { decision: record?.decision ?? 'not_present' };
|
|
171
|
+
}
|
|
158
172
|
function ingestTranscriptDelta({ fallbackRootSessionId, transcriptPath, workspaceDir, env, now, port }) {
|
|
159
173
|
const outcome = runConversationIngestion({
|
|
160
174
|
workspaceDir,
|
|
161
175
|
source: createCodexTranscriptSource({ env, fallbackRootSessionId, now }),
|
|
162
176
|
session: { sessionId: fallbackRootSessionId },
|
|
163
177
|
hints: { transcriptPath },
|
|
164
|
-
//
|
|
165
|
-
//
|
|
166
|
-
//
|
|
167
|
-
// record the setup flow enforces (v2 authority model — the runtime gate
|
|
168
|
-
// reads only the flags). The pipeline's consent gate therefore keeps
|
|
169
|
-
// receiving the setup-flow invariant 'granted'.
|
|
178
|
+
// The double FLAG gate (host.codex ∧ codex_conversation_ingestion) is
|
|
179
|
+
// checked by pd-hook / catch-up BEFORE this module is entered; the consent
|
|
180
|
+
// LEDGER gate below is the PRI-1262 formal judgment.
|
|
170
181
|
flags: { ingestionEnabled: true },
|
|
171
|
-
consent:
|
|
182
|
+
consent: resolveCodexConsentGate(workspaceDir),
|
|
172
183
|
// PRI-1179: the STORED TEXT bound is a separate fact from the gate above —
|
|
173
184
|
// it comes from the recorded v3 consent record, so a stale disclosure or a
|
|
174
185
|
// revoke can only ever narrow what is stored, never widen it.
|
|
@@ -206,6 +217,22 @@ export function ingestCodexConversation(rawPayload, kind, options) {
|
|
|
206
217
|
}
|
|
207
218
|
const now = options.now ?? new Date();
|
|
208
219
|
if (kind === 'before_prompt_build' || kind === 'after_tool_call') {
|
|
220
|
+
// PRI-1262 review fix (2026-11-18): the live path used to write the user
|
|
221
|
+
// prompt (and tool facts) WITHOUT the formal consent ledger judgment,
|
|
222
|
+
// contradicting this module's own contract comment — a revoked / pending /
|
|
223
|
+
// failed / absent ledger still captured the prompt as a bounded
|
|
224
|
+
// `user_turn`. Now the SAME `resolveCodexConsentGate` verdict the catch-up
|
|
225
|
+
// path applies gates the live write too: not granted → degrade with
|
|
226
|
+
// `consent_not_granted:<decision>` BEFORE any observation is stored.
|
|
227
|
+
const consent = resolveCodexConsentGate(options.workspaceDir);
|
|
228
|
+
if (consent.decision !== 'granted') {
|
|
229
|
+
return {
|
|
230
|
+
status: 'degraded',
|
|
231
|
+
reason: `consent_not_granted:${consent.decision}`,
|
|
232
|
+
nextAction: 'conversation ingestion consent is not granted for this workspace; grant it via the PD consent flow (or re-grant after revoke) before live PD behavior is captured.',
|
|
233
|
+
warnings: [],
|
|
234
|
+
};
|
|
235
|
+
}
|
|
209
236
|
// Live observations key on the rollout identity derived from the SAME
|
|
210
237
|
// validated transcript reference the Stop replay later converges with
|
|
211
238
|
// (SPEC §10) — validate here exactly as before the seam migration.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { readFileSync, realpathSync, statSync } from 'node:fs';
|
|
3
|
-
import os from 'node:os';
|
|
4
3
|
import path from 'node:path';
|
|
5
4
|
import process from 'node:process';
|
|
6
5
|
import { pathToFileURL, fileURLToPath } from 'node:url';
|
|
7
6
|
import { appendEventLogLine, redactTelemetryString, isRuleHostEvaluatedEventData } from '@principles/core/runtime';
|
|
8
7
|
import { ADAPTIVE_SELECTION_LIMITS, createAdaptivePriorityProviderForConfig, createCodexRuleContextProvider, createProductionHostRuntime, loadPdConfigForPlugin, renderAcceptedAdaptiveAppend, resolveHostToolSemanticsForHook, resolveNearestPdWorkspace } from '@principles/host-runtime';
|
|
8
|
+
import { resolvePdHome } from '@principles/install-layout';
|
|
9
9
|
import { classifyBashRisk } from '@principles/core/runtime/internalization/bash-risk';
|
|
10
10
|
import { CODEX_TOOL_SEMANTIC_MAPPINGS, CODEX_TOOL_SEMANTICS } from './tool-semantics.js';
|
|
11
11
|
import { computeFeatureFlagsFromConfig } from '@principles/core/runtime';
|
|
@@ -48,7 +48,7 @@ function adaptiveSelectionDiagnostic(line) {
|
|
|
48
48
|
const decision = line.decision === null
|
|
49
49
|
? 'unknown'
|
|
50
50
|
: `${line.decision.status}:${line.decision.reason}:${line.decision.ref ?? 'none'}`;
|
|
51
|
-
return `[PD] status=${status} reason=adaptive_selection_${line.status}:${line.reason} stage=${line.stage} sends=${line.sends} requestSentAt=${line.requestSentAt ?? 'unknown'} firstByteAt=${line.firstByteAt ?? 'unknown'} generationEndedAt=${line.generationEndedAt ?? 'unknown'} validatedAt=${line.validatedAt ?? 'unknown'} cancelledAt=${line.cancelledAt ?? 'unknown'} httpStatus=${line.httpStatus ?? 'unknown'} finishReason=${line.finishReason} modelObserved=${line.modelObserved ?? 'unknown'} providerObserved=${line.providerObserved ?? 'absent'} decision=${decision} scores=${scores} failures=${failures}`
|
|
51
|
+
return `[PD] status=${status} reason=adaptive_selection_${line.status}:${line.reason} stage=${line.stage} sends=${line.sends} principleContext=${line.principleContext ?? 'not_reached'} requestSentAt=${line.requestSentAt ?? 'unknown'} firstByteAt=${line.firstByteAt ?? 'unknown'} generationEndedAt=${line.generationEndedAt ?? 'unknown'} validatedAt=${line.validatedAt ?? 'unknown'} cancelledAt=${line.cancelledAt ?? 'unknown'} httpStatus=${line.httpStatus ?? 'unknown'} finishReason=${line.finishReason} modelObserved=${line.modelObserved ?? 'unknown'} providerObserved=${line.providerObserved ?? 'absent'} decision=${decision} scores=${scores} failures=${failures}`
|
|
52
52
|
.replace(/\s+/g, ' ')
|
|
53
53
|
.trim()
|
|
54
54
|
.slice(0, MAX_DIAGNOSTIC * 2);
|
|
@@ -381,10 +381,17 @@ export async function processHookInvocation(rawStdin, _env = process.env, cwd =
|
|
|
381
381
|
const requestedCwd = event.context.workspaceDir || cwd;
|
|
382
382
|
if (!path.isAbsolute(requestedCwd))
|
|
383
383
|
return { stdout: {}, exitCode: 0, stderr: [diagnostic('cwd_not_absolute', 'Provide the absolute Codex project directory.')] };
|
|
384
|
-
// Resolve
|
|
385
|
-
//
|
|
386
|
-
//
|
|
387
|
-
|
|
384
|
+
// Resolve the Codex user workspace through the same PD Home authority used
|
|
385
|
+
// by the installer and CLI, with the SAME home precedence (no explicit
|
|
386
|
+
// os.homedir() injection: that would bypass the HOME-first default and split
|
|
387
|
+
// the host config root from the installer's when HOME ≠ OS home — Devin
|
|
388
|
+
// review #2699-0006). In experiment mode this derives from the lab root and
|
|
389
|
+
// refuses inherited host paths that escape it.
|
|
390
|
+
const pdHome = resolvePdHome({ env: _env });
|
|
391
|
+
if (!pdHome.ok) {
|
|
392
|
+
return { stdout: {}, exitCode: 0, stderr: [diagnostic(pdHome.reason, pdHome.nextAction)] };
|
|
393
|
+
}
|
|
394
|
+
const userWorkspace = pdHome.codexWorkspaceDir;
|
|
388
395
|
let userWorkspaceInitialized = false;
|
|
389
396
|
try {
|
|
390
397
|
userWorkspaceInitialized = statSync(path.join(userWorkspace, '.pd', 'config.yaml')).isFile();
|
|
@@ -590,6 +597,7 @@ export async function processHookInvocation(rawStdin, _env = process.env, cwd =
|
|
|
590
597
|
reason: line.reason,
|
|
591
598
|
sends: line.sends,
|
|
592
599
|
targetActivationId: line.targetActivationId,
|
|
600
|
+
...(line.principleContext !== undefined ? { principleContext: line.principleContext } : {}),
|
|
593
601
|
};
|
|
594
602
|
},
|
|
595
603
|
});
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
import fs from 'node:fs';
|
|
29
29
|
import path from 'node:path';
|
|
30
30
|
import { computeFeatureFlagsFromConfig, createRuntimeStateHandle, createPainSignalBridge, isRetryWaitBackoffElapsed, pickDiagnosticianCandidate, PrincipleTreeLedgerAdapter, resolveDiagnosticianCapability, } from '@principles/core/runtime';
|
|
31
|
-
import { createWorkspaceBehaviorEvidencePort, createCodexArtificerTrustedFactsPort, loadPdConfigForPlugin, loadFeatureFlagFromConfig, reconcileGovernanceContinuation, runInternalizationConsumerCycle, runStage2CorrectionCycle, createSignalClassifierForWorkspace, createHostIntentDocReader, saveHostToolDeclaration, HOST_TOOL_DECLARATION_VERSION, } from '@principles/host-runtime';
|
|
31
|
+
import { createWorkspaceBehaviorEvidencePort, createCodexArtificerTrustedFactsPort, loadPdConfigForPlugin, loadFeatureFlagFromConfig, reconcileGovernanceContinuation, runInternalizationConsumerCycle, runStage2CorrectionCycle, createSignalClassifierForWorkspace, createGovernanceTrajectoryTurnReader, createHostIntentDocReader, saveHostToolDeclaration, HOST_TOOL_DECLARATION_VERSION, } from '@principles/host-runtime';
|
|
32
32
|
import { catchUpCodexIngestion } from '../ingestion/catch-up.js';
|
|
33
33
|
import { CODEX_TOOL_SEMANTIC_MAPPINGS, CODEX_TOOL_SEMANTICS } from '../tool-semantics.js';
|
|
34
34
|
const WORKER_OWNER = 'companion-worker';
|
|
@@ -147,6 +147,22 @@ export async function runCodexWorkspaceWorkerCycle(options) {
|
|
|
147
147
|
}
|
|
148
148
|
const { flags } = computeFeatureFlagsFromConfig(config.effective);
|
|
149
149
|
if (flags['host.codex']?.enabled !== true) {
|
|
150
|
+
// PRI-1264 review round (2026-11-18): an intentional CONFIG pause must
|
|
151
|
+
// keep the liveness heartbeat alive — the worker process IS alive and
|
|
152
|
+
// cycling, it is just deliberately idle. Without this heartbeat the
|
|
153
|
+
// Companion's stall detector (completion age > 2× interval) read the stale
|
|
154
|
+
// pre-pause record and raised a false `workspace_worker_stalled`
|
|
155
|
+
// notification whose "restart Companion" guidance could never fix the
|
|
156
|
+
// config pause. The workspace directory and config were already proven
|
|
157
|
+
// readable above (CR-08 ordering), so the write is legitimate.
|
|
158
|
+
writeLiveness(workspaceDir, {
|
|
159
|
+
runningStage: 'paused',
|
|
160
|
+
// Explicit null: a paused state has no in-flight stage, and the merge
|
|
161
|
+
// must not leave the PRE-pause cycle's deadline behind.
|
|
162
|
+
stageDeadline: null,
|
|
163
|
+
lastCycleStartedAt: cycleStartedAt.toISOString(),
|
|
164
|
+
lastCycleDriver: process.env.PD_INVOCATION_SOURCE === 'companion' ? 'companion' : 'manual',
|
|
165
|
+
});
|
|
150
166
|
// PRI-1063 (review fix): single-line flow mapping — see catch-up.ts.
|
|
151
167
|
return { ...base, mode: 'paused', reason: 'host.codex_disabled', nextAction: 'Enable Codex PD behavior in the Workspace .pd/config.yaml — in the existing "features:" block set host.codex: {enabled: true} (one flat key, not nested).' };
|
|
152
168
|
}
|
|
@@ -156,6 +172,11 @@ export async function runCodexWorkspaceWorkerCycle(options) {
|
|
|
156
172
|
lastCycleStartedAt: cycleStartedAt.toISOString(),
|
|
157
173
|
runningStage: 'catch_up',
|
|
158
174
|
stageDeadline: new Date(cycleStartedAt.getTime() + LIVENESS_STAGE_DEADLINE_MS.catch_up).toISOString(),
|
|
175
|
+
// PRI-1264: record WHO drove this cycle. `pd codex worker --status` reads
|
|
176
|
+
// the marker so the Owner can tell a companion-driven (resident, should
|
|
177
|
+
// keep cycling) worker from a manual one-shot — "registered" alone said
|
|
178
|
+
// nothing about whether a driver is actually alive.
|
|
179
|
+
lastCycleDriver: process.env.PD_INVOCATION_SOURCE === 'companion' ? 'companion' : 'manual',
|
|
159
180
|
});
|
|
160
181
|
const consumerFlag = loadFeatureFlagFromConfig(workspaceDir, 'internalization_auto_consumer', { info: (m) => logger.info(m), warn: (m) => logger.warn(m) });
|
|
161
182
|
// PRI-638 P1-C: the Diagnostician capability gate is resolved from the same
|
|
@@ -234,6 +255,9 @@ export async function runCodexWorkspaceWorkerCycle(options) {
|
|
|
234
255
|
// for governance-admitted Codex pains — the neutral host reader
|
|
235
256
|
// must ride along (flag-off = zero filesystem access inside it).
|
|
236
257
|
intentDocReader: createHostIntentDocReader({ workspaceDir, effectiveConfig: config.effective }),
|
|
258
|
+
// PRI-1265: the worker's Stage A gets the bound session's ORIGINAL
|
|
259
|
+
// turns from the workspace's own consent-tiered governance store.
|
|
260
|
+
trajectoryTurnReader: createGovernanceTrajectoryTurnReader({ workspaceDir }),
|
|
237
261
|
});
|
|
238
262
|
const executed = await bridge.executePendingDiagnosis({ taskId: candidate.taskId });
|
|
239
263
|
// PRI-917 v0.3.3 review fix (P2-2): forward the parked-candidate
|
|
@@ -313,6 +337,9 @@ export async function runCodexWorkspaceWorkerCycle(options) {
|
|
|
313
337
|
owner: WORKER_OWNER,
|
|
314
338
|
effectiveConfig: config.effective,
|
|
315
339
|
getEnvVar: (name) => process.env[name],
|
|
340
|
+
// PRI-1265: post-processing resumes see the same authorized
|
|
341
|
+
// trajectory context as the initial diagnosis run.
|
|
342
|
+
trajectoryTurnReader: createGovernanceTrajectoryTurnReader({ workspaceDir }),
|
|
316
343
|
});
|
|
317
344
|
for (const item of backlog) {
|
|
318
345
|
const resumed = await bridge.resumeSucceededDiagnosisPostProcessing({ taskId: item.taskId });
|
|
@@ -436,6 +463,9 @@ export async function runCodexWorkspaceWorkerCycle(options) {
|
|
|
436
463
|
lastCycleCompletedAt: new Date().toISOString(),
|
|
437
464
|
lastCycleDurationMs: Date.now() - cycleStartedAt.getTime(),
|
|
438
465
|
lastCycleMode: degradedReason !== undefined ? 'degraded' : 'ready',
|
|
466
|
+
// PRI-1264: driver of the last COMPLETED cycle — the stall verdict reads
|
|
467
|
+
// this so a no_recent_cycle report names WHO stopped driving.
|
|
468
|
+
lastCycleDriver: process.env.PD_INVOCATION_SOURCE === 'companion' ? 'companion' : 'manual',
|
|
439
469
|
...(degradedReason !== undefined ? { lastDegradedReason: degradedReason } : {}),
|
|
440
470
|
});
|
|
441
471
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@principles/codex-adapter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
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",
|
|
@@ -42,7 +42,6 @@ import { handleUpdateHistoryRoute, handleUpdateHistoryPruneRoute, reconcileUpdat
|
|
|
42
42
|
import { handleUpdateTransactionRoute } from './routes/update-transaction.js';
|
|
43
43
|
import { handleConfigRoute } from './routes/config.js';
|
|
44
44
|
import { sendJson, sendNotFound, sendError } from './utils/response.js';
|
|
45
|
-
import { migrateLegacyExtensionBackups, resolvePdBackupsRoot } from './utils/pd-backups.js';
|
|
46
45
|
const __filename = fileURLToPath(import.meta.url);
|
|
47
46
|
const __dirname = path.dirname(__filename);
|
|
48
47
|
// WEB_ROOT calculation: server is at PKG_ROOT/dist/server/index.js
|
|
@@ -708,21 +707,11 @@ export async function main() {
|
|
|
708
707
|
// application-level credential, so it must never be reachable off-machine.
|
|
709
708
|
assertLoopbackBind(host);
|
|
710
709
|
const services = await initServices(workspace);
|
|
711
|
-
//
|
|
712
|
-
//
|
|
713
|
-
//
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
if (legacy.movedFrom.length > 0) {
|
|
717
|
-
console.log(`[pd-console] Migrated ${legacy.movedFrom.length} legacy PD backup dir(s) out of the extensions dir to ${resolvePdBackupsRoot()}`);
|
|
718
|
-
}
|
|
719
|
-
for (const failure of legacy.failed) {
|
|
720
|
-
console.warn(`[pd-console] Could not migrate legacy PD backup "${failure.name}" out of the extensions dir: ${failure.reason}. Move it out manually to silence the OpenClaw "duplicate plugin id" warning.`);
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
catch (err) {
|
|
724
|
-
console.warn('[pd-console] Legacy backup migration failed:', err instanceof Error ? err.message : err);
|
|
725
|
-
}
|
|
710
|
+
// Backups live in the canonical <PD_HOME>/.pd/backups root and the Console
|
|
711
|
+
// only ever reads/uses that location. Relocating legacy backup directories
|
|
712
|
+
// (the old <openclawHome>/pd-backups root, extensions/ siblings) is an
|
|
713
|
+
// EXPLICIT installer operation — never an implicit console-startup move of
|
|
714
|
+
// Owner files.
|
|
726
715
|
const server = http.createServer(handleRequest(services));
|
|
727
716
|
// Anonymous Product Telemetry v1 (PRI-595~603): one fire-and-forget export
|
|
728
717
|
// attempt per console startup. The console process is the long-lived PD
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import * as fs from 'fs';
|
|
14
14
|
import * as path from 'path';
|
|
15
|
-
import {
|
|
15
|
+
import { getInstallLayoutPathsFromPdHome, resolveInstallLayout } from '@principles/install-layout';
|
|
16
16
|
import { resolveOpenClawHome } from './pd-backups.js';
|
|
17
17
|
import { getPdHome } from './pd-home.js';
|
|
18
18
|
export function resolveExtensionsDir() {
|
|
@@ -44,8 +44,9 @@ function resolveCanonicalCodexAdapterDir(paths) {
|
|
|
44
44
|
export function resolveUpdateLayout() {
|
|
45
45
|
// PRI-872: the home comes from the process-wide resolution, so an experiment
|
|
46
46
|
// console inspects the EXPERIMENT install instead of the production one.
|
|
47
|
-
const
|
|
48
|
-
const
|
|
47
|
+
const homePaths = getPdHome();
|
|
48
|
+
const { homeDir } = homePaths;
|
|
49
|
+
const paths = getInstallLayoutPathsFromPdHome(homePaths);
|
|
49
50
|
const legacyPluginDir = path.join(resolveExtensionsDir(), 'principles-disciple');
|
|
50
51
|
let manifest;
|
|
51
52
|
try {
|
|
@@ -56,6 +57,7 @@ export function resolveUpdateLayout() {
|
|
|
56
57
|
}
|
|
57
58
|
const resolution = resolveInstallLayout({
|
|
58
59
|
homeDir,
|
|
60
|
+
homePaths,
|
|
59
61
|
manifest,
|
|
60
62
|
canonicalRuntimeExists: fs.existsSync(paths.runtimeDir),
|
|
61
63
|
legacyExtensionExists: fs.existsSync(legacyPluginDir),
|
|
@@ -101,7 +103,7 @@ export function resolvePluginDir(_workspaceDir) {
|
|
|
101
103
|
* guard allow-root even when the install resolves to legacy mode.
|
|
102
104
|
*/
|
|
103
105
|
export function resolveCanonicalRuntimeRoot() {
|
|
104
|
-
return
|
|
106
|
+
return getPdHome().runtimeDir;
|
|
105
107
|
}
|
|
106
108
|
// rc-2: type-guard the parsed JSON instead of an `as` cast (ERR-001).
|
|
107
109
|
function isRecord(value) {
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
export interface LegacyBackupMigrationResult {
|
|
2
|
-
movedFrom: string[];
|
|
3
|
-
failed: {
|
|
4
|
-
name: string;
|
|
5
|
-
reason: string;
|
|
6
|
-
}[];
|
|
7
|
-
}
|
|
8
1
|
/**
|
|
9
2
|
* Resolve the OpenClaw install home.
|
|
10
3
|
*
|
|
@@ -16,7 +9,7 @@ export interface LegacyBackupMigrationResult {
|
|
|
16
9
|
* `utils/installed-layout.ts` both derive from it.
|
|
17
10
|
*/
|
|
18
11
|
export declare function resolveOpenClawHome(): string;
|
|
19
|
-
/**
|
|
12
|
+
/** Host-neutral backup root — outside every host plugin discovery directory. */
|
|
20
13
|
export declare function resolvePdBackupsRoot(): string;
|
|
21
14
|
/**
|
|
22
15
|
* Reserve a unique backup destination under the backups root:
|
|
@@ -27,9 +20,3 @@ export declare function resolvePdBackupsRoot(): string;
|
|
|
27
20
|
* unbounded).
|
|
28
21
|
*/
|
|
29
22
|
export declare function reservePdBackupDestination(targetName: string): string;
|
|
30
|
-
/**
|
|
31
|
-
* Move legacy PD backup directories out of the extensions dir into the
|
|
32
|
-
* backups root, so OpenClaw stops discovering them as duplicate plugins.
|
|
33
|
-
* Best-effort per entry (rc-9: failures are reported, never silent).
|
|
34
|
-
*/
|
|
35
|
-
export declare function migrateLegacyExtensionBackups(): LegacyBackupMigrationResult;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* PD plugin backup location utilities.
|
|
3
3
|
*
|
|
4
|
-
* Backups must NEVER live inside
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* plugin" on every gateway startup.
|
|
4
|
+
* Backups must NEVER live inside any host plugin discovery tree. OpenClaw scans
|
|
5
|
+
* every child directory of its extensions root, so a backup containing
|
|
6
|
+
* package.json (openclaw.extensions) + dist/bundle.js would be discovered as a
|
|
7
|
+
* second plugin. All host and runtime backups therefore live in the shared
|
|
8
|
+
* <PD_HOME>/.pd/backups directory.
|
|
10
9
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
10
|
+
* The Console only ever USES this canonical root. Migrating legacy backups out
|
|
11
|
+
* of the old <openclawHome>/pd-backups root and the extensions/ siblings is an
|
|
12
|
+
* EXPLICIT installer operation (create-principles-disciple
|
|
13
|
+
* migrateLegacyPdBackups) — the Console never relocates user files on startup
|
|
14
|
+
* (PD迁移策略: 安装器显式迁移; Companion/Console 不隐式搬迁).
|
|
16
15
|
*/
|
|
17
16
|
import * as fs from 'fs';
|
|
18
17
|
import * as path from 'path';
|
|
@@ -31,9 +30,9 @@ import { getPdHome } from './pd-home.js';
|
|
|
31
30
|
export function resolveOpenClawHome() {
|
|
32
31
|
return getPdHome().openclawHome;
|
|
33
32
|
}
|
|
34
|
-
/**
|
|
33
|
+
/** Host-neutral backup root — outside every host plugin discovery directory. */
|
|
35
34
|
export function resolvePdBackupsRoot() {
|
|
36
|
-
return
|
|
35
|
+
return getPdHome().pdRuntimeBackupsDir;
|
|
37
36
|
}
|
|
38
37
|
/**
|
|
39
38
|
* Extract a POSIX errno code from a thrown fs error (rc-2: type guard, no
|
|
@@ -76,54 +75,3 @@ export function reservePdBackupDestination(targetName) {
|
|
|
76
75
|
}
|
|
77
76
|
throw new Error(`Could not reserve a unique backup directory under ${root}: ${errorMessage(lastError)}`);
|
|
78
77
|
}
|
|
79
|
-
/**
|
|
80
|
-
* Backup directory names older PD versions created as siblings of the plugin
|
|
81
|
-
* inside the extensions dir (both are re-discovered as duplicate plugins).
|
|
82
|
-
*/
|
|
83
|
-
function isLegacyPdBackupName(name) {
|
|
84
|
-
// Console updater (<= 2026-08): ".pd-backup-<ISO ts>" sibling.
|
|
85
|
-
if (name.startsWith('.pd-backup-'))
|
|
86
|
-
return true;
|
|
87
|
-
// Installer (<= 2026-08): "<extDir>.backup.<epoch ms>" sibling.
|
|
88
|
-
return /^principles-disciple\.backup\.\d+$/.test(name);
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Move legacy PD backup directories out of the extensions dir into the
|
|
92
|
-
* backups root, so OpenClaw stops discovering them as duplicate plugins.
|
|
93
|
-
* Best-effort per entry (rc-9: failures are reported, never silent).
|
|
94
|
-
*/
|
|
95
|
-
export function migrateLegacyExtensionBackups() {
|
|
96
|
-
const result = { movedFrom: [], failed: [] };
|
|
97
|
-
const extensionsDir = path.join(resolveOpenClawHome(), 'extensions');
|
|
98
|
-
let entries;
|
|
99
|
-
try {
|
|
100
|
-
entries = fs.readdirSync(extensionsDir, { withFileTypes: true });
|
|
101
|
-
}
|
|
102
|
-
catch {
|
|
103
|
-
return result; // no extensions dir — nothing to migrate
|
|
104
|
-
}
|
|
105
|
-
const root = resolvePdBackupsRoot();
|
|
106
|
-
for (const entry of entries) {
|
|
107
|
-
if (!entry.isDirectory() || !isLegacyPdBackupName(entry.name))
|
|
108
|
-
continue;
|
|
109
|
-
const from = path.join(extensionsDir, entry.name);
|
|
110
|
-
let to = path.join(root, entry.name);
|
|
111
|
-
let suffix = 1;
|
|
112
|
-
while (fs.existsSync(to)) {
|
|
113
|
-
to = path.join(root, `${entry.name}-${suffix}`);
|
|
114
|
-
suffix += 1;
|
|
115
|
-
}
|
|
116
|
-
try {
|
|
117
|
-
fs.mkdirSync(root, { recursive: true });
|
|
118
|
-
fs.renameSync(from, to);
|
|
119
|
-
result.movedFrom.push(from);
|
|
120
|
-
}
|
|
121
|
-
catch (err) {
|
|
122
|
-
result.failed.push({
|
|
123
|
-
name: entry.name,
|
|
124
|
-
reason: errorMessage(err),
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return result;
|
|
129
|
-
}
|
|
@@ -33,6 +33,8 @@
|
|
|
33
33
|
--color-sky-500: oklch(68.5% 0.169 237.323);
|
|
34
34
|
--color-sky-600: oklch(58.8% 0.158 241.966);
|
|
35
35
|
--color-sky-700: oklch(50% 0.134 242.749);
|
|
36
|
+
--color-neutral-400: oklch(70.8% 0 none);
|
|
37
|
+
--color-neutral-600: oklch(43.9% 0 none);
|
|
36
38
|
--color-black: #000;
|
|
37
39
|
--color-white: #fff;
|
|
38
40
|
--spacing: 0.25rem;
|
|
@@ -482,6 +484,9 @@
|
|
|
482
484
|
.mt-12 {
|
|
483
485
|
margin-top: calc(var(--spacing) * 12);
|
|
484
486
|
}
|
|
487
|
+
.mt-\[1px\] {
|
|
488
|
+
margin-top: 1px;
|
|
489
|
+
}
|
|
485
490
|
.mt-\[2px\] {
|
|
486
491
|
margin-top: 2px;
|
|
487
492
|
}
|
|
@@ -491,6 +496,9 @@
|
|
|
491
496
|
.mt-\[4px\] {
|
|
492
497
|
margin-top: 4px;
|
|
493
498
|
}
|
|
499
|
+
.mt-\[6px\] {
|
|
500
|
+
margin-top: 6px;
|
|
501
|
+
}
|
|
494
502
|
.mt-\[10px\] {
|
|
495
503
|
margin-top: 10px;
|
|
496
504
|
}
|
|
@@ -674,15 +682,27 @@
|
|
|
674
682
|
.h-\[14px\] {
|
|
675
683
|
height: 14px;
|
|
676
684
|
}
|
|
685
|
+
.h-\[16px\] {
|
|
686
|
+
height: 16px;
|
|
687
|
+
}
|
|
677
688
|
.h-\[18px\] {
|
|
678
689
|
height: 18px;
|
|
679
690
|
}
|
|
680
|
-
.h-\[
|
|
681
|
-
height:
|
|
691
|
+
.h-\[22px\] {
|
|
692
|
+
height: 22px;
|
|
693
|
+
}
|
|
694
|
+
.h-\[26px\] {
|
|
695
|
+
height: 26px;
|
|
696
|
+
}
|
|
697
|
+
.h-\[28px\] {
|
|
698
|
+
height: 28px;
|
|
682
699
|
}
|
|
683
700
|
.h-\[34px\] {
|
|
684
701
|
height: 34px;
|
|
685
702
|
}
|
|
703
|
+
.h-\[44px\] {
|
|
704
|
+
height: 44px;
|
|
705
|
+
}
|
|
686
706
|
.h-\[120px\] {
|
|
687
707
|
height: 120px;
|
|
688
708
|
}
|
|
@@ -809,11 +829,20 @@
|
|
|
809
829
|
.w-\[14px\] {
|
|
810
830
|
width: 14px;
|
|
811
831
|
}
|
|
832
|
+
.w-\[16px\] {
|
|
833
|
+
width: 16px;
|
|
834
|
+
}
|
|
812
835
|
.w-\[18px\] {
|
|
813
836
|
width: 18px;
|
|
814
837
|
}
|
|
815
|
-
.w-\[
|
|
816
|
-
width:
|
|
838
|
+
.w-\[22px\] {
|
|
839
|
+
width: 22px;
|
|
840
|
+
}
|
|
841
|
+
.w-\[26px\] {
|
|
842
|
+
width: 26px;
|
|
843
|
+
}
|
|
844
|
+
.w-\[28px\] {
|
|
845
|
+
width: 28px;
|
|
817
846
|
}
|
|
818
847
|
.w-\[34px\] {
|
|
819
848
|
width: 34px;
|
|
@@ -821,6 +850,9 @@
|
|
|
821
850
|
.w-\[40\%\] {
|
|
822
851
|
width: 40%;
|
|
823
852
|
}
|
|
853
|
+
.w-\[44px\] {
|
|
854
|
+
width: 44px;
|
|
855
|
+
}
|
|
824
856
|
.w-\[50\%\] {
|
|
825
857
|
width: 50%;
|
|
826
858
|
}
|
|
@@ -1058,6 +1090,9 @@
|
|
|
1058
1090
|
.grid-cols-\[max-content_1fr\] {
|
|
1059
1091
|
grid-template-columns: max-content 1fr;
|
|
1060
1092
|
}
|
|
1093
|
+
.grid-cols-\[repeat\(auto-fill\,minmax\(232px\,1fr\)\)\] {
|
|
1094
|
+
grid-template-columns: repeat(auto-fill,minmax(232px,1fr));
|
|
1095
|
+
}
|
|
1061
1096
|
.flex-col {
|
|
1062
1097
|
flex-direction: column;
|
|
1063
1098
|
}
|
|
@@ -1124,6 +1159,9 @@
|
|
|
1124
1159
|
.gap-6 {
|
|
1125
1160
|
gap: calc(var(--spacing) * 6);
|
|
1126
1161
|
}
|
|
1162
|
+
.gap-\[4px\] {
|
|
1163
|
+
gap: 4px;
|
|
1164
|
+
}
|
|
1127
1165
|
.gap-\[5px\] {
|
|
1128
1166
|
gap: 5px;
|
|
1129
1167
|
}
|
|
@@ -1413,6 +1451,12 @@
|
|
|
1413
1451
|
border-color: color-mix(in oklab, var(--color-amber) 45%, transparent);
|
|
1414
1452
|
}
|
|
1415
1453
|
}
|
|
1454
|
+
.border-black\/10 {
|
|
1455
|
+
border-color: color-mix(in srgb, #000 10%, transparent);
|
|
1456
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
1457
|
+
border-color: color-mix(in oklab, var(--color-black) 10%, transparent);
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1416
1460
|
.border-border {
|
|
1417
1461
|
border-color: var(--color-border);
|
|
1418
1462
|
}
|
|
@@ -1905,6 +1949,13 @@
|
|
|
1905
1949
|
.bg-transparent {
|
|
1906
1950
|
background-color: transparent;
|
|
1907
1951
|
}
|
|
1952
|
+
.bg-white {
|
|
1953
|
+
background-color: var(--color-white);
|
|
1954
|
+
}
|
|
1955
|
+
.object-contain {
|
|
1956
|
+
-o-object-fit: contain;
|
|
1957
|
+
object-fit: contain;
|
|
1958
|
+
}
|
|
1908
1959
|
.p-0 {
|
|
1909
1960
|
padding: 0px;
|
|
1910
1961
|
}
|
|
@@ -2448,6 +2499,12 @@
|
|
|
2448
2499
|
.text-muted-foreground {
|
|
2449
2500
|
color: var(--color-muted-foreground);
|
|
2450
2501
|
}
|
|
2502
|
+
.text-neutral-400 {
|
|
2503
|
+
color: var(--color-neutral-400);
|
|
2504
|
+
}
|
|
2505
|
+
.text-neutral-600 {
|
|
2506
|
+
color: var(--color-neutral-600);
|
|
2507
|
+
}
|
|
2451
2508
|
.text-paper {
|
|
2452
2509
|
color: var(--color-paper);
|
|
2453
2510
|
}
|
|
@@ -2804,6 +2861,9 @@
|
|
|
2804
2861
|
.hover\:border-ink-3:hover {
|
|
2805
2862
|
border-color: var(--color-ink-3);
|
|
2806
2863
|
}
|
|
2864
|
+
.hover\:border-ink-4:hover {
|
|
2865
|
+
border-color: var(--color-ink-4);
|
|
2866
|
+
}
|
|
2807
2867
|
.hover\:border-line:hover {
|
|
2808
2868
|
border-color: var(--color-line);
|
|
2809
2869
|
}
|
|
@@ -2872,6 +2932,9 @@
|
|
|
2872
2932
|
background-color: color-mix(in oklab, var(--color-muted) 50%, transparent);
|
|
2873
2933
|
}
|
|
2874
2934
|
}
|
|
2935
|
+
.hover\:bg-panel:hover {
|
|
2936
|
+
background-color: var(--color-panel);
|
|
2937
|
+
}
|
|
2875
2938
|
.hover\:bg-paper-2:hover {
|
|
2876
2939
|
background-color: var(--color-paper-2);
|
|
2877
2940
|
}
|
|
@@ -3285,11 +3348,6 @@
|
|
|
3285
3348
|
padding-top: 0px;
|
|
3286
3349
|
}
|
|
3287
3350
|
}
|
|
3288
|
-
@media (width >= 80rem) {
|
|
3289
|
-
.xl\:grid-cols-3 {
|
|
3290
|
-
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
3291
|
-
}
|
|
3292
|
-
}
|
|
3293
3351
|
.dark\:text-amber-400:is([data-theme="dark"] *) {
|
|
3294
3352
|
color: var(--color-amber-400);
|
|
3295
3353
|
}
|