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
package/plugin/mcp/launcher.cjs
CHANGED
|
@@ -359,32 +359,108 @@ function isInside(parent, child) {
|
|
|
359
359
|
// governance workspace (the Codex installer used to inherit the OpenClaw
|
|
360
360
|
// detection result). This mirrors `findForeignWorkspaceHost` in
|
|
361
361
|
// @principles/install-layout; the parity test pins both sides together.
|
|
362
|
-
function hostOwnedWorkspaces(bindingHost,
|
|
362
|
+
function hostOwnedWorkspaces(bindingHost, roots) {
|
|
363
363
|
switch (bindingHost) {
|
|
364
364
|
case 'openclaw':
|
|
365
|
-
return [path.join(homeDir, 'clawd'), path.join(
|
|
365
|
+
return [path.join(roots.homeDir, 'clawd'), path.join(roots.openclawHome, 'workspace')];
|
|
366
366
|
case 'codex':
|
|
367
|
-
return [path.join(codexHome, 'pd-workspace')];
|
|
367
|
+
return [path.join(roots.codexHome, 'pd-workspace')];
|
|
368
368
|
case 'workbuddy':
|
|
369
|
-
return [path.join(
|
|
369
|
+
return [path.join(roots.workbuddyConfigDir, 'pd-workspace')];
|
|
370
370
|
default:
|
|
371
371
|
return [];
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
374
|
|
|
375
|
-
function findForeignWorkspaceOwner(bindingHost, workspaceDir,
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
375
|
+
function findForeignWorkspaceOwner(bindingHost, workspaceDir, roots) {
|
|
376
|
+
if (typeof workspaceDir !== 'string' || workspaceDir.trim().length === 0) return [];
|
|
377
|
+
// Final directory identity: a binding whose path reaches another host's tree
|
|
378
|
+
// through a junction, alias or case difference must not escape the check.
|
|
379
|
+
// Identity NORMALIZATION only — every directory SOURCE stays the #2699 PD
|
|
380
|
+
// Home roots authority (no second layout source).
|
|
381
|
+
const target = canonicalDirIdentity(workspaceDir);
|
|
382
|
+
const owners = [];
|
|
383
|
+
const claim = (other) => { if (!owners.includes(other)) owners.push(other); };
|
|
381
384
|
for (const other of KNOWN_HOSTS) {
|
|
382
385
|
if (other === bindingHost) continue;
|
|
383
|
-
for (const owned of hostOwnedWorkspaces(other,
|
|
384
|
-
if (isInsideOrSame(
|
|
386
|
+
for (const owned of hostOwnedWorkspaces(other, roots)) {
|
|
387
|
+
if (isInsideOrSame(canonicalDirIdentity(owned), target)) claim(other);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
// PRI-1247 reopen: default-dir enumeration alone accepted a NON-DEFAULT
|
|
391
|
+
// workspace another host FORMALLY declared (`~/.openclaw/principles-disciple.json`
|
|
392
|
+
// `workspace`, or the host payload's own mcp-binding.json `workspaceDir`).
|
|
393
|
+
// Those declarations close the hole the original incident used. This mirrors
|
|
394
|
+
// `findForeignWorkspaceOwner` in @principles/install-layout; the parity test
|
|
395
|
+
// pins both sides together.
|
|
396
|
+
for (const declared of hostDeclaredWorkspaceClaims(roots)) {
|
|
397
|
+
if (declared.host === bindingHost) continue;
|
|
398
|
+
if (isInsideOrSame(canonicalDirIdentity(declared.workspaceDir), target)) claim(declared.host);
|
|
399
|
+
}
|
|
400
|
+
return owners;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
// Final directory identity: the realpath when it resolves (junctions/symlinks
|
|
404
|
+
// and case folded by the OS), else the resolved lexical form — the same rule
|
|
405
|
+
// as `workspaceIdentity` in @principles/install-layout.
|
|
406
|
+
function canonicalDirIdentity(dir) {
|
|
407
|
+
let resolved;
|
|
408
|
+
try {
|
|
409
|
+
resolved = fs.realpathSync.native(dir);
|
|
410
|
+
} catch {
|
|
411
|
+
resolved = path.resolve(dir);
|
|
412
|
+
}
|
|
413
|
+
return process.platform === 'win32' ? resolved.toLowerCase() : resolved;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
function readAbsoluteWorkspaceField(parsed, field) {
|
|
417
|
+
if (parsed === undefined) return undefined;
|
|
418
|
+
const value = parsed[field];
|
|
419
|
+
if (typeof value !== 'string' || value.trim().length === 0) return undefined;
|
|
420
|
+
if (!path.isAbsolute(value.trim())) return undefined;
|
|
421
|
+
return path.resolve(value.trim());
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* The hosts' FORMAL workspace declarations (dependency-free mirror of
|
|
426
|
+
* `collectHostWorkspaceClaims`' declaration part in @principles/install-layout):
|
|
427
|
+
* - OpenClaw: the `workspace` field of `~/.openclaw/principles-disciple.json`
|
|
428
|
+
* (fallback `~/.principles/principles-disciple.json`) — the Owner's explicit
|
|
429
|
+
* PD declaration, which may point at a NON-DEFAULT directory;
|
|
430
|
+
* - Codex: every PLUGIN_DATA payload binding (`plugins/data` child directories
|
|
431
|
+
* named `principles-disciple-<marketplace>`, file `mcp-binding.json`,
|
|
432
|
+
* field `workspaceDir`);
|
|
433
|
+
* - WorkBuddy: the marketplace payload binding
|
|
434
|
+
* (`~/.pd/workbuddy-marketplace/principles-disciple/mcp-binding.json`).
|
|
435
|
+
* Comparison uses canonical directory identity so a junction, alias or case
|
|
436
|
+
* difference cannot smuggle one host's tree past another host's claim.
|
|
437
|
+
*/
|
|
438
|
+
function hostDeclaredWorkspaceClaims(roots) {
|
|
439
|
+
const claims = [];
|
|
440
|
+
const declarationFiles = [
|
|
441
|
+
path.join(roots.openclawHome, 'principles-disciple.json'),
|
|
442
|
+
path.join(roots.homeDir, '.principles', 'principles-disciple.json'),
|
|
443
|
+
];
|
|
444
|
+
for (const file of declarationFiles) {
|
|
445
|
+
const declared = readAbsoluteWorkspaceField(readJson(file), 'workspace');
|
|
446
|
+
if (declared !== undefined) claims.push({ host: 'openclaw', workspaceDir: declared });
|
|
447
|
+
}
|
|
448
|
+
try {
|
|
449
|
+
const dataRoot = path.join(roots.codexHome, 'plugins', 'data');
|
|
450
|
+
for (const entry of fs.readdirSync(dataRoot)) {
|
|
451
|
+
if (typeof entry !== 'string' || !entry.startsWith('principles-disciple-')) continue;
|
|
452
|
+
const bound = readAbsoluteWorkspaceField(readJson(path.join(dataRoot, entry, 'mcp-binding.json')), 'workspaceDir');
|
|
453
|
+
if (bound !== undefined) claims.push({ host: 'codex', workspaceDir: bound });
|
|
385
454
|
}
|
|
455
|
+
} catch {
|
|
456
|
+
// No Codex plugin data on this machine — nothing to claim.
|
|
386
457
|
}
|
|
387
|
-
|
|
458
|
+
const wbBound = readAbsoluteWorkspaceField(
|
|
459
|
+
readJson(path.join(roots.homeDir, '.pd', 'workbuddy-marketplace', 'principles-disciple', 'mcp-binding.json')),
|
|
460
|
+
'workspaceDir',
|
|
461
|
+
);
|
|
462
|
+
if (wbBound !== undefined) claims.push({ host: 'workbuddy', workspaceDir: wbBound });
|
|
463
|
+
return claims;
|
|
388
464
|
}
|
|
389
465
|
|
|
390
466
|
/**
|
|
@@ -437,11 +513,63 @@ function codexPersistentBindingCandidates(root) {
|
|
|
437
513
|
|
|
438
514
|
const PD_CONFIG_FILENAME = 'principles-disciple.json';
|
|
439
515
|
|
|
440
|
-
/**
|
|
441
|
-
|
|
516
|
+
/**
|
|
517
|
+
* Resolve the same effective host roots as PD Home. The launcher is a
|
|
518
|
+
* dependency-free CJS payload, so this small boundary mirrors the resolver's
|
|
519
|
+
* environment precedence and experiment containment rather than importing
|
|
520
|
+
* the ESM install-layout package.
|
|
521
|
+
*/
|
|
522
|
+
function resolveHostConfigOverride(name, fallback, experimentRoot) {
|
|
523
|
+
const raw = typeof process.env[name] === 'string' ? process.env[name].trim() : '';
|
|
524
|
+
if (name === 'OPENCLAW_STATE_DIR' && raw !== '' && !path.isAbsolute(raw)) {
|
|
525
|
+
fail('openclaw_state_dir_not_absolute', 'OPENCLAW_STATE_DIR must be an absolute path.');
|
|
526
|
+
}
|
|
527
|
+
// The DEFAULT host dir must satisfy the same experiment containment as an
|
|
528
|
+
// override: a `<PD_EXPERIMENT_ROOT>/.openclaw` that is itself a link into
|
|
529
|
+
// production must be refused, never returned unchecked just because no
|
|
530
|
+
// override env var is set.
|
|
531
|
+
const candidate = raw !== '' ? raw : fallback;
|
|
532
|
+
if (experimentRoot !== null) {
|
|
533
|
+
if (!path.isAbsolute(candidate)) {
|
|
534
|
+
fail('experiment_host_config_invalid', `${name} host dir must be an absolute path inside PD_EXPERIMENT_ROOT (got "${candidate}").`);
|
|
535
|
+
}
|
|
536
|
+
if (!isInsideOrSame(experimentRoot, canonicalExisting(path.resolve(candidate)))) {
|
|
537
|
+
fail('experiment_host_config_invalid', `${name} host dir resolves outside PD_EXPERIMENT_ROOT; refusing to inspect or serve another host's production state.`);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
return path.resolve(candidate);
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* HOME-first real-user-home resolution, mirroring the shared resolver's
|
|
545
|
+
* `resolveRealUserHome()` (install-layout): an explicit non-empty HOME wins,
|
|
546
|
+
* `os.homedir()` is the fallback. `os.homedir()` alone would ignore a sandboxed
|
|
547
|
+
* HOME on Windows (the OS home there ignores a sandboxed HOME) and diverge
|
|
548
|
+
* from the installer.
|
|
549
|
+
*/
|
|
550
|
+
function resolveRealUserHomeLikeSharedResolver() {
|
|
551
|
+
const home = typeof process.env.HOME === 'string' ? process.env.HOME.trim() : '';
|
|
552
|
+
return home !== '' ? path.resolve(home) : path.resolve(os.homedir());
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
function resolveHostRoots(host, pluginRoot) {
|
|
556
|
+
const experimentRoot = EXPERIMENT_ROOT === '' ? null : experimentRootRealPath();
|
|
557
|
+
const homeDir = experimentRoot ?? resolveRealUserHomeLikeSharedResolver();
|
|
558
|
+
const stateDir = typeof process.env.OPENCLAW_STATE_DIR === 'string' ? process.env.OPENCLAW_STATE_DIR.trim() : '';
|
|
559
|
+
const openclawHome = stateDir !== ''
|
|
560
|
+
? resolveHostConfigOverride('OPENCLAW_STATE_DIR', path.join(homeDir, '.openclaw'), experimentRoot)
|
|
561
|
+
: resolveHostConfigOverride('OPENCLAW_HOME', path.join(homeDir, '.openclaw'), experimentRoot);
|
|
562
|
+
const codexHomeFromPayload = host === 'codex' ? deriveCodexHomeFromPayload(pluginRoot) : null;
|
|
563
|
+
const codexHome = resolveHostConfigOverride('CODEX_HOME', codexHomeFromPayload ?? path.join(homeDir, '.codex'), experimentRoot);
|
|
564
|
+
const workbuddyConfigDir = resolveHostConfigOverride('WORKBUDDY_CONFIG_DIR', path.join(homeDir, '.workbuddy'), experimentRoot);
|
|
565
|
+
return { homeDir, openclawHome, codexHome, workbuddyConfigDir };
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
/** A declared workspace must be one fixed, real directory — never the effective HOME or a drive root. */
|
|
569
|
+
function isUsableWorkspaceDir(candidate, homeDir) {
|
|
442
570
|
if (typeof candidate !== 'string' || candidate.length === 0 || !path.isAbsolute(candidate)) return false;
|
|
443
571
|
const resolved = path.resolve(candidate);
|
|
444
|
-
if (samePath(resolved,
|
|
572
|
+
if (samePath(resolved, homeDir)) return false;
|
|
445
573
|
if (samePath(resolved, path.parse(resolved).root)) return false;
|
|
446
574
|
try {
|
|
447
575
|
return fs.statSync(resolved).isDirectory();
|
|
@@ -480,14 +608,13 @@ function readConfigWorkspace(files) {
|
|
|
480
608
|
* inference: those describe where a session runs, not which state tree owns
|
|
481
609
|
* governance for every agent of the host (SPEC §3.5).
|
|
482
610
|
*/
|
|
483
|
-
function resolveDeclaredWorkspaceDir() {
|
|
484
|
-
const home = os.homedir();
|
|
611
|
+
function resolveDeclaredWorkspaceDir(roots) {
|
|
485
612
|
const readers = [
|
|
486
613
|
() => process.env.PD_WORKSPACE_DIR,
|
|
487
614
|
() => process.env.OPENCLAW_WORKSPACE,
|
|
488
615
|
() => readConfigWorkspace([
|
|
489
|
-
path.join(
|
|
490
|
-
path.join(
|
|
616
|
+
path.join(roots.openclawHome, PD_CONFIG_FILENAME),
|
|
617
|
+
path.join(roots.homeDir, '.principles', PD_CONFIG_FILENAME),
|
|
491
618
|
]),
|
|
492
619
|
];
|
|
493
620
|
let sawDeclaration = false;
|
|
@@ -500,7 +627,7 @@ function resolveDeclaredWorkspaceDir() {
|
|
|
500
627
|
}
|
|
501
628
|
if (typeof value !== 'string' || value.trim().length === 0) continue;
|
|
502
629
|
sawDeclaration = true;
|
|
503
|
-
if (isUsableWorkspaceDir(value.trim())) return { workspaceDir: path.resolve(value.trim()) };
|
|
630
|
+
if (isUsableWorkspaceDir(value.trim(), roots.homeDir)) return { workspaceDir: path.resolve(value.trim()) };
|
|
504
631
|
}
|
|
505
632
|
return { reason: sawDeclaration ? 'workspace_declaration_invalid' : 'workspace_declaration_missing' };
|
|
506
633
|
}
|
|
@@ -526,6 +653,7 @@ if (detectedHosts.length !== 1) {
|
|
|
526
653
|
}
|
|
527
654
|
const host = detectedHosts[0];
|
|
528
655
|
logState.host = host;
|
|
656
|
+
const hostRoots = resolveHostRoots(host, pluginRoot);
|
|
529
657
|
|
|
530
658
|
// rc-1/rc-3/rc-5: the binding file is read as untrusted; every field is
|
|
531
659
|
// validated before use and unknown content is never coerced.
|
|
@@ -677,20 +805,16 @@ logState.workspaceResolution = 'ok';
|
|
|
677
805
|
// the old OpenClaw-oriented detection points Codex at OpenClaw's governance
|
|
678
806
|
// tree, so pain evidence would land in the wrong database. Refuse that before
|
|
679
807
|
// any MCP traffic; the OpenClaw declaration gate below is unchanged.
|
|
680
|
-
//
|
|
681
|
-
// Codex
|
|
682
|
-
//
|
|
683
|
-
//
|
|
684
|
-
const
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
? path.resolve(process.env.CODEX_HOME)
|
|
688
|
-
: path.join(ownershipHome, '.codex'));
|
|
689
|
-
const foreignWorkspaceHost = findForeignWorkspaceOwner(host, binding.workspaceDir, ownershipHome, ownershipCodexHome);
|
|
690
|
-
if (foreignWorkspaceHost !== null) {
|
|
808
|
+
// Directory SOURCES are the #2699 PD-Home roots authority only (payload/env
|
|
809
|
+
// Codex-home derivation already lives inside resolveHostRoots) — this check
|
|
810
|
+
// adds ownership VERDICT semantics (declarations, payload bindings, canonical
|
|
811
|
+
// identity, multi-owner report), never a second layout source.
|
|
812
|
+
const foreignWorkspaceOwners = findForeignWorkspaceOwner(host, binding.workspaceDir, hostRoots);
|
|
813
|
+
if (foreignWorkspaceOwners.length > 0) {
|
|
814
|
+
const owners = foreignWorkspaceOwners.join(',');
|
|
691
815
|
fail(
|
|
692
|
-
`binding_workspace_foreign_host:${
|
|
693
|
-
`mcp-binding.json binds ${
|
|
816
|
+
`binding_workspace_foreign_host:${owners}`,
|
|
817
|
+
`mcp-binding.json binds a workspace owned by ${owners} (default tree, formal declaration or payload binding). Re-run the PD host setup for ${host} with ITS OWN workspace (or an explicit supported --workspace), so pain evidence is not written into another host's database.`,
|
|
694
818
|
);
|
|
695
819
|
}
|
|
696
820
|
|
|
@@ -718,7 +842,7 @@ if (EXPERIMENT_ROOT !== '') {
|
|
|
718
842
|
// evidence to another agent. Codex/WorkBuddy have a single user-level workspace
|
|
719
843
|
// and their binding writer is the authority; the gate is OpenClaw-only.
|
|
720
844
|
if (host === 'openclaw') {
|
|
721
|
-
const declared = resolveDeclaredWorkspaceDir();
|
|
845
|
+
const declared = resolveDeclaredWorkspaceDir(hostRoots);
|
|
722
846
|
if (declared.workspaceDir === undefined) {
|
|
723
847
|
fail(
|
|
724
848
|
declared.reason,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "principles-disciple",
|
|
3
3
|
"name": "Principles Disciple",
|
|
4
4
|
"description": "Principles Disciple is an AI Agent Governance System. Stop correcting the same AI behavior across sessions. Turn repeated Agent corrections into Owner-approved, observable, reversible behavior principles.",
|
|
5
|
-
"version": "4.
|
|
5
|
+
"version": "4.2.0",
|
|
6
6
|
"activation": {
|
|
7
7
|
"onStartup": true,
|
|
8
8
|
"onCapabilities": [
|
package/plugin/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "principles-disciple",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "Principles Disciple is an AI Agent Governance System. Stop correcting the same AI behavior across sessions. Turn repeated Agent corrections into Owner-approved, observable, reversible behavior principles.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -32,13 +32,15 @@ For each `in_progress` or `done` task:
|
|
|
32
32
|
When task queue is empty:
|
|
33
33
|
|
|
34
34
|
1. Read `memory/STRATEGY.md` → Project vision and strategy
|
|
35
|
-
2.
|
|
36
|
-
3.
|
|
37
|
-
4.
|
|
38
|
-
5. Notify user: "I have planned tasks for this week, please confirm"
|
|
35
|
+
2. Identify incomplete OKR milestones → Derive 3-5 concrete tasks
|
|
36
|
+
3. Write to `WEEK_TASKS.json`
|
|
37
|
+
4. Notify user: "I have planned tasks for this week, please confirm"
|
|
39
38
|
|
|
40
39
|
**Important**: Do NOT invent new goals without user confirmation. Only derive tasks from existing OKRs and strategy.
|
|
41
40
|
|
|
41
|
+
> `memory/okr/CURRENT_FOCUS.md`(如存在)是 Owner 手动维护的 Principle Context
|
|
42
|
+
> 长期背景文件:PD 只读、不自动压缩、不当任务里程碑来源(Principle Context SPEC v1.1)。
|
|
43
|
+
|
|
42
44
|
---
|
|
43
45
|
|
|
44
46
|
## Files to Check
|
|
@@ -46,11 +48,10 @@ When task queue is empty:
|
|
|
46
48
|
| File | Purpose | Update Frequency |
|
|
47
49
|
|------|---------|-----------------|
|
|
48
50
|
| `WEEK_TASKS.json` | Structured task list | On task changes |
|
|
49
|
-
| `TASK_CHANGES.jsonl` | Append-only change log | On every change |
|
|
51
|
+
| `TASK_CHANGES.jsonl` | Append-only change log | On every task change |
|
|
50
52
|
| `WEEK_STATE.json` | Week progress metrics | Weekly governance |
|
|
51
53
|
| `WEEK_EVENTS.jsonl` | System events | On events |
|
|
52
|
-
| `CURRENT_FOCUS.md` | Human-readable summary | Weekly governance |
|
|
53
54
|
|
|
54
55
|
---
|
|
55
56
|
|
|
56
|
-
*Last updated: 2026-
|
|
57
|
+
*Last updated: 2026-11-18*
|