create-principles-disciple 1.152.3 → 1.152.4
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/console/dist/server/config/pd-config-store.js +9 -3
- package/console/dist/server/index.js +5 -1
- package/console/dist/server/models/AdaptiveActivationConsoleModel.js +3 -1
- package/console/dist/server/models/ApprovalsConsoleModel.d.ts +6 -0
- package/console/dist/server/models/ApprovalsConsoleModel.js +3 -0
- package/console/dist/server/models/ApprovalsGroupedConsoleModel.d.ts +21 -1
- package/console/dist/server/models/ApprovalsGroupedConsoleModel.js +28 -2
- package/console/dist/server/models/IntentDecisionModel.d.ts +6 -1
- package/console/dist/server/models/IntentDecisionModel.js +17 -9
- package/console/dist/server/routes/approvals.js +7 -0
- package/console/dist/server/routes/config.js +172 -0
- package/console/dist/server/routes/intent-decisions.js +19 -1
- package/console/dist/web/assets/app.css +65 -35
- package/console/dist/web/assets/app.js +32 -32
- package/core/dist/runtime/activation/activation-types.d.ts +6 -0
- package/core/dist/runtime/activation/activation-types.d.ts.map +1 -1
- package/core/dist/runtime/activation/activation-types.js.map +1 -1
- package/core/dist/runtime/activation/index.d.ts +2 -1
- package/core/dist/runtime/activation/index.d.ts.map +1 -1
- package/core/dist/runtime/activation/index.js +1 -1
- package/core/dist/runtime/activation/index.js.map +1 -1
- package/core/dist/runtime/activation/ledger-identity.d.ts +8 -0
- package/core/dist/runtime/activation/ledger-identity.d.ts.map +1 -1
- package/core/dist/runtime/activation/ledger-identity.js +20 -1
- package/core/dist/runtime/activation/ledger-identity.js.map +1 -1
- package/core/dist/runtime/activation/sqlite-approval-store.d.ts +18 -0
- package/core/dist/runtime/activation/sqlite-approval-store.d.ts.map +1 -1
- package/core/dist/runtime/activation/sqlite-approval-store.js +146 -20
- package/core/dist/runtime/activation/sqlite-approval-store.js.map +1 -1
- package/core/dist/runtime/adapter/artificer-l2-adapter.d.ts.map +1 -1
- package/core/dist/runtime/adapter/artificer-l2-adapter.js +11 -4
- package/core/dist/runtime/adapter/artificer-l2-adapter.js.map +1 -1
- package/core/dist/runtime/adapter/l2-agent-loop-adapter.d.ts.map +1 -1
- package/core/dist/runtime/adapter/l2-agent-loop-adapter.js +11 -4
- package/core/dist/runtime/adapter/l2-agent-loop-adapter.js.map +1 -1
- package/core/dist/runtime/adapter/pi-ai-catalog.d.ts +42 -0
- package/core/dist/runtime/adapter/pi-ai-catalog.d.ts.map +1 -1
- package/core/dist/runtime/adapter/pi-ai-catalog.js +68 -0
- package/core/dist/runtime/adapter/pi-ai-catalog.js.map +1 -1
- package/core/dist/runtime/adapter/pi-ai-connection-probe.d.ts +45 -0
- package/core/dist/runtime/adapter/pi-ai-connection-probe.d.ts.map +1 -0
- package/core/dist/runtime/adapter/pi-ai-connection-probe.js +321 -0
- package/core/dist/runtime/adapter/pi-ai-connection-probe.js.map +1 -0
- package/core/dist/runtime/adapter/pi-ai-runtime-adapter.d.ts +18 -1
- package/core/dist/runtime/adapter/pi-ai-runtime-adapter.d.ts.map +1 -1
- package/core/dist/runtime/adapter/pi-ai-runtime-adapter.js +14 -7
- package/core/dist/runtime/adapter/pi-ai-runtime-adapter.js.map +1 -1
- package/core/dist/runtime/config/index.d.ts +2 -0
- package/core/dist/runtime/config/index.d.ts.map +1 -1
- package/core/dist/runtime/config/index.js +1 -0
- package/core/dist/runtime/config/index.js.map +1 -1
- package/core/dist/runtime/config/pd-config-redaction.d.ts.map +1 -1
- package/core/dist/runtime/config/pd-config-redaction.js +4 -0
- package/core/dist/runtime/config/pd-config-redaction.js.map +1 -1
- package/core/dist/runtime/config/pd-config-types.d.ts +5 -0
- 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-credentials.d.ts +105 -0
- package/core/dist/runtime/config/pd-credentials.d.ts.map +1 -0
- package/core/dist/runtime/config/pd-credentials.js +409 -0
- package/core/dist/runtime/config/pd-credentials.js.map +1 -0
- package/core/dist/runtime/diagnostician/diag-rootcause-output.d.ts +13 -2
- package/core/dist/runtime/diagnostician/diag-rootcause-output.d.ts.map +1 -1
- package/core/dist/runtime/diagnostician/diag-rootcause-output.js.map +1 -1
- package/core/dist/runtime/diagnostician-output.d.ts +1 -1
- package/core/dist/runtime/diagnostician-output.d.ts.map +1 -1
- package/core/dist/runtime/diagnostician-output.js +2 -2
- package/core/dist/runtime/diagnostician-output.js.map +1 -1
- package/core/dist/runtime/index.d.ts +5 -2
- package/core/dist/runtime/index.d.ts.map +1 -1
- package/core/dist/runtime/index.js +11 -1
- package/core/dist/runtime/index.js.map +1 -1
- package/core/dist/runtime/intent/index.d.ts +2 -0
- package/core/dist/runtime/intent/index.d.ts.map +1 -1
- package/core/dist/runtime/intent/index.js +2 -0
- package/core/dist/runtime/intent/index.js.map +1 -1
- package/core/dist/runtime/intent/intent-decision-record.d.ts +51 -3
- package/core/dist/runtime/intent/intent-decision-record.d.ts.map +1 -1
- package/core/dist/runtime/intent/intent-snapshot.d.ts +104 -0
- package/core/dist/runtime/intent/intent-snapshot.d.ts.map +1 -0
- package/core/dist/runtime/intent/intent-snapshot.js +164 -0
- package/core/dist/runtime/intent/intent-snapshot.js.map +1 -0
- package/core/dist/runtime/intent/strategic-conflict-gate.d.ts +70 -0
- package/core/dist/runtime/intent/strategic-conflict-gate.d.ts.map +1 -0
- package/core/dist/runtime/intent/strategic-conflict-gate.js +148 -0
- package/core/dist/runtime/intent/strategic-conflict-gate.js.map +1 -0
- package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts +41 -1
- package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/diag-rootcause-runner.js +189 -42
- package/core/dist/runtime/internalization/diag-rootcause-runner.js.map +1 -1
- package/core/dist/runtime/internalization/diag-router-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/diag-router-runner.js +10 -0
- package/core/dist/runtime/internalization/diag-router-runner.js.map +1 -1
- package/core/dist/runtime/internalization/dreamer-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime/internalization/dreamer-prompt-builder.js +3 -0
- package/core/dist/runtime/internalization/dreamer-prompt-builder.js.map +1 -1
- package/core/dist/runtime/internalization/formation-context.d.ts +54 -0
- package/core/dist/runtime/internalization/formation-context.d.ts.map +1 -1
- package/core/dist/runtime/internalization/formation-context.js +135 -3
- package/core/dist/runtime/internalization/formation-context.js.map +1 -1
- package/core/dist/runtime/internalization/index.d.ts +2 -2
- package/core/dist/runtime/internalization/index.d.ts.map +1 -1
- package/core/dist/runtime/internalization/index.js +1 -1
- package/core/dist/runtime/internalization/index.js.map +1 -1
- package/core/dist/runtime/internalization/intent-contract.d.ts +107 -0
- package/core/dist/runtime/internalization/intent-contract.d.ts.map +1 -1
- package/core/dist/runtime/internalization/intent-contract.js +315 -4
- package/core/dist/runtime/internalization/intent-contract.js.map +1 -1
- package/core/dist/runtime/internalization/peer-runner-contracts.d.ts +8 -0
- package/core/dist/runtime/internalization/peer-runner-contracts.d.ts.map +1 -1
- package/core/dist/runtime/internalization/peer-runner-contracts.js.map +1 -1
- package/core/dist/runtime/internalization/philosopher-prompt-builder.d.ts +22 -1
- package/core/dist/runtime/internalization/philosopher-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime/internalization/philosopher-prompt-builder.js +22 -3
- package/core/dist/runtime/internalization/philosopher-prompt-builder.js.map +1 -1
- package/core/dist/runtime/internalization/philosopher-runner.d.ts +15 -0
- package/core/dist/runtime/internalization/philosopher-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/philosopher-runner.js +73 -1
- package/core/dist/runtime/internalization/philosopher-runner.js.map +1 -1
- package/core/dist/runtime/internalization/pitask-metadata.d.ts +32 -0
- package/core/dist/runtime/internalization/pitask-metadata.d.ts.map +1 -1
- package/core/dist/runtime/internalization/pitask-metadata.js +44 -0
- package/core/dist/runtime/internalization/pitask-metadata.js.map +1 -1
- package/core/dist/runtime/internalization/scribe-output.d.ts +21 -0
- package/core/dist/runtime/internalization/scribe-output.d.ts.map +1 -1
- package/core/dist/runtime/internalization/scribe-output.js +125 -2
- package/core/dist/runtime/internalization/scribe-output.js.map +1 -1
- package/core/dist/runtime/internalization/scribe-prompt-builder.d.ts +26 -1
- package/core/dist/runtime/internalization/scribe-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime/internalization/scribe-prompt-builder.js +33 -3
- package/core/dist/runtime/internalization/scribe-prompt-builder.js.map +1 -1
- package/core/dist/runtime/internalization/scribe-runner.d.ts +32 -2
- package/core/dist/runtime/internalization/scribe-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/scribe-runner.js +105 -7
- package/core/dist/runtime/internalization/scribe-runner.js.map +1 -1
- package/core/dist/runtime/store/artifact/sqlite-pi-artifact-store.d.ts +7 -0
- package/core/dist/runtime/store/artifact/sqlite-pi-artifact-store.d.ts.map +1 -1
- package/core/dist/runtime/store/artifact/sqlite-pi-artifact-store.js +7 -1
- package/core/dist/runtime/store/artifact/sqlite-pi-artifact-store.js.map +1 -1
- package/core/dist/runtime/store/intent/sqlite-intent-decision-store.d.ts +2 -2
- package/core/dist/runtime/store/intent/sqlite-intent-decision-store.d.ts.map +1 -1
- package/core/dist/runtime/store/intent/sqlite-intent-decision-store.js +285 -35
- package/core/dist/runtime/store/intent/sqlite-intent-decision-store.js.map +1 -1
- package/core/dist/runtime/store/sqlite-connection.d.ts.map +1 -1
- package/core/dist/runtime/store/sqlite-connection.js +38 -3
- package/core/dist/runtime/store/sqlite-connection.js.map +1 -1
- package/core/dist/telemetry-event.d.ts +2 -2
- package/core/dist/telemetry-event.d.ts.map +1 -1
- package/core/dist/telemetry-event.js +9 -0
- package/core/dist/telemetry-event.js.map +1 -1
- package/core/package.json +1 -1
- package/dist/installers/codex-host-installer.d.ts.map +1 -1
- package/dist/installers/codex-host-installer.js +9 -12
- package/dist/installers/codex-host-installer.js.map +1 -1
- package/host-runtime/dist/adaptive-priority-provider.d.ts +1 -1
- package/host-runtime/dist/adaptive-priority-provider.js +4 -3
- package/host-runtime/dist/adaptive-selection.d.ts +1 -1
- package/host-runtime/dist/adaptive-selection.js +2 -1
- package/host-runtime/dist/signal-classifier.js +4 -4
- package/host-runtime/package.json +1 -1
- package/install-layout/dist/mcp-binding-contract.js +4 -15
- package/install-layout/package.json +1 -1
- package/package.json +3 -3
- package/pd-cli/dist/commands/pain-retry.d.ts.map +1 -1
- package/pd-cli/dist/commands/pain-retry.js +6 -4
- package/pd-cli/dist/commands/pain-retry.js.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-once.js +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-once.js.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-rulehost.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-rulehost.js +5 -5
- package/pd-cli/dist/commands/runtime-internalization-run-rulehost.js.map +1 -1
- package/pd-cli/dist/commands/runtime.js +6 -6
- package/pd-cli/dist/commands/runtime.js.map +1 -1
- package/pd-cli/dist/services/config-doctor.d.ts.map +1 -1
- package/pd-cli/dist/services/config-doctor.js +5 -4
- package/pd-cli/dist/services/config-doctor.js.map +1 -1
- package/pd-cli/dist/services/runtime-adapter-resolver.d.ts.map +1 -1
- package/pd-cli/dist/services/runtime-adapter-resolver.js +5 -5
- package/pd-cli/dist/services/runtime-adapter-resolver.js.map +1 -1
- package/pd-cli/package.json +1 -1
- package/plugin/dist/bundle.js +521 -497
- package/release-manager/dist/installers/codex-host-installer.js +9 -12
- package/release-manager/package.json +1 -1
- package/dist/installers/mcp-binding-shape-mirror.d.ts +0 -27
- package/dist/installers/mcp-binding-shape-mirror.d.ts.map +0 -1
- package/dist/installers/mcp-binding-shape-mirror.js +0 -105
- package/dist/installers/mcp-binding-shape-mirror.js.map +0 -1
- package/release-manager/dist/installers/mcp-binding-shape-mirror.js +0 -105
|
@@ -30,7 +30,7 @@ import * as os from 'os';
|
|
|
30
30
|
import { createRequire } from 'module';
|
|
31
31
|
import { pathToFileURL } from 'url';
|
|
32
32
|
import { isNpmDependencyResolutionEnabled } from '../installer.js';
|
|
33
|
-
import { isSameMcpBindingPath,
|
|
33
|
+
import { isSameMcpBindingPath, validateMcpBinding } from '@principles/install-layout';
|
|
34
34
|
import { getPdRuntimeDir } from '../mvp-config.js';
|
|
35
35
|
// NOTE (PRI-625 review round 3 / PRI-669 gate): this installer ships as the
|
|
36
36
|
// self-contained npx package — @principles/core is NOT in its dependencies,
|
|
@@ -508,17 +508,14 @@ function isMcpBindingHealthy(pluginRoot, runtimeDir, pin) {
|
|
|
508
508
|
catch {
|
|
509
509
|
return false;
|
|
510
510
|
}
|
|
511
|
-
// Use the
|
|
512
|
-
//
|
|
513
|
-
//
|
|
514
|
-
//
|
|
515
|
-
//
|
|
516
|
-
//
|
|
517
|
-
//
|
|
518
|
-
|
|
519
|
-
// skipped and the launcher stays dead on binding_workspace_invalid /
|
|
520
|
-
// binding_server_entry_invalid / server_entry_not_canonical.
|
|
521
|
-
const verdict = validateMcpBindingShape(binding, 'codex', process.platform);
|
|
511
|
+
// Use the launcher's own shape gate: the shared @principles/install-layout
|
|
512
|
+
// declaration, which the installer's published dependency floor now carries.
|
|
513
|
+
// A binding the launcher would refuse ON SHAPE — workspaceDir/serverEntry
|
|
514
|
+
// missing, a relative path, or a non-canonical serverEntry — must never count
|
|
515
|
+
// as healthy, or setup is skipped and the launcher stays dead on
|
|
516
|
+
// binding_workspace_invalid / binding_server_entry_invalid /
|
|
517
|
+
// server_entry_not_canonical.
|
|
518
|
+
const verdict = validateMcpBinding(binding, 'codex', process.platform);
|
|
522
519
|
if (!verdict.ok)
|
|
523
520
|
return false;
|
|
524
521
|
// Installer-only context the shape contract cannot know: the binding must
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
declare const MCP_BINDING_HOSTS: readonly ['codex', 'openclaw', 'workbuddy'];
|
|
2
|
-
type McpBindingHost = (typeof MCP_BINDING_HOSTS)[number];
|
|
3
|
-
/** The subset of the shared verdict the installer actually consumes. */
|
|
4
|
-
export type PinnedMcpBindingVerdict = {
|
|
5
|
-
readonly ok: true;
|
|
6
|
-
readonly binding: {
|
|
7
|
-
readonly workspaceDir: string;
|
|
8
|
-
readonly runtimeDir: string;
|
|
9
|
-
readonly serverEntry: string;
|
|
10
|
-
readonly versions: {
|
|
11
|
-
readonly mcpServer: string;
|
|
12
|
-
readonly core?: string;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
} | {
|
|
16
|
-
readonly ok: false;
|
|
17
|
-
readonly reason: string;
|
|
18
|
-
};
|
|
19
|
-
/** Mirrors the shared `isSameMcpBindingPath` — see the SAME-SOURCE POINTER above. */
|
|
20
|
-
export declare function isSameMcpBindingPath(left: string, right: string, platform: string): boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Validate the binding SHAPE (and the canonical-entry rule) exactly as the
|
|
23
|
-
* launcher and `validateMcpBinding` do. Filesystem facts stay outside.
|
|
24
|
-
*/
|
|
25
|
-
export declare function validateMcpBindingShape(raw: unknown, expectedHost: McpBindingHost, platform: string): PinnedMcpBindingVerdict;
|
|
26
|
-
export {};
|
|
27
|
-
//# sourceMappingURL=mcp-binding-shape-mirror.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-binding-shape-mirror.d.ts","sourceRoot":"","sources":["../../src/installers/mcp-binding-shape-mirror.ts"],"names":[],"mappings":"AA8BA,QAAA,MAAM,iBAAiB,YAAI,OAAO,EAAE,UAAU,EAAE,WAAW,CAAU,CAAC;AACtE,KAAK,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAYzD,wEAAwE;AACxE,MAAM,MAAM,uBAAuB,GAC/B;IACE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAClB,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;QAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;QAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,QAAQ,EAAE;YAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KAC3E,CAAC;CACH,GACD;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAoBpD,qFAAqF;AACrF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAI3F;AAMD;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,GAAG,uBAAuB,CAiC7H"}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PINNED MIRROR of `@principles/install-layout`'s `validateMcpBinding`.
|
|
3
|
-
*
|
|
4
|
-
* Why a mirror instead of a runtime import: the packaged installer dist is
|
|
5
|
-
* installed from the npm registry, so it must keep loading against the
|
|
6
|
-
* PUBLISHED @principles/install-layout (registry-parity smoke, PRI-669/RF-02).
|
|
7
|
-
* A normal PR may not raise the dependency floor (release-intent guard
|
|
8
|
-
* N-version), so a brand-new export cannot be imported here at runtime — the
|
|
9
|
-
* published package does not carry it yet.
|
|
10
|
-
*
|
|
11
|
-
* This is NOT a second declaration and NOT a looser gate. The declaration
|
|
12
|
-
* lives in `@principles/install-layout` (`mcp-binding-contract.ts`); this file
|
|
13
|
-
* mirrors it verbatim, and `mcp-binding-shape-mirror-parity.test.ts` pins the
|
|
14
|
-
* two to identical verdicts (ok + reason) over
|
|
15
|
-
* `MCP_BINDING_HOSTS × MCP_BINDING_FIXTURES`. A new reason code, a reordered
|
|
16
|
-
* check or a relaxed comparison on either side turns that test red.
|
|
17
|
-
*
|
|
18
|
-
* SAME-SOURCE POINTER — the authoritative declaration is
|
|
19
|
-
* packages/install-layout/src/mcp-binding-contract.ts
|
|
20
|
-
* The two files MUST change together, in the same commit. Retiring this mirror
|
|
21
|
-
* (restoring the single implementation) is tracked by PRI-1191 and is blocked
|
|
22
|
-
* until the export is published to the registry AND the installer's
|
|
23
|
-
* install-layout dependency floor reaches that version.
|
|
24
|
-
*
|
|
25
|
-
* Same discipline as the WorkBuddy plugin-state mirror (2026-11-08).
|
|
26
|
-
*/
|
|
27
|
-
import * as path from 'node:path';
|
|
28
|
-
const MCP_BINDING_SCHEMA_VERSION = 'pd.mcp-binding.v1';
|
|
29
|
-
const MCP_BINDING_HOSTS = ['codex', 'openclaw', 'workbuddy'];
|
|
30
|
-
const MCP_BINDING_SERVER_ENTRY_SEGMENTS = {
|
|
31
|
-
codex: ['node_modules', '@principles', 'pd-mcp-server', 'dist', 'index.js'],
|
|
32
|
-
openclaw: ['pd-mcp-server', 'dist', 'index.js'],
|
|
33
|
-
workbuddy: ['pd-mcp-server', 'dist', 'index.js'],
|
|
34
|
-
};
|
|
35
|
-
function getCanonicalMcpServerEntry(host, runtimeDir) {
|
|
36
|
-
return path.join(runtimeDir, ...MCP_BINDING_SERVER_ENTRY_SEGMENTS[host]);
|
|
37
|
-
}
|
|
38
|
-
const SEMVER = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
|
|
39
|
-
function isRecord(value) {
|
|
40
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
41
|
-
}
|
|
42
|
-
function isAbsolutePath(value) {
|
|
43
|
-
return typeof value === 'string' && path.isAbsolute(value);
|
|
44
|
-
}
|
|
45
|
-
function isMcpBindingHost(value) {
|
|
46
|
-
return typeof value === 'string' && MCP_BINDING_HOSTS.includes(value);
|
|
47
|
-
}
|
|
48
|
-
function isSemverVersion(value) {
|
|
49
|
-
return typeof value === 'string' && SEMVER.test(value);
|
|
50
|
-
}
|
|
51
|
-
/** Mirrors the shared `isSameMcpBindingPath` — see the SAME-SOURCE POINTER above. */
|
|
52
|
-
export function isSameMcpBindingPath(left, right, platform) {
|
|
53
|
-
const a = path.resolve(left);
|
|
54
|
-
const b = path.resolve(right);
|
|
55
|
-
return platform === 'win32' ? a.toLowerCase() === b.toLowerCase() : a === b;
|
|
56
|
-
}
|
|
57
|
-
function reject(reason) {
|
|
58
|
-
return { ok: false, reason };
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Validate the binding SHAPE (and the canonical-entry rule) exactly as the
|
|
62
|
-
* launcher and `validateMcpBinding` do. Filesystem facts stay outside.
|
|
63
|
-
*/
|
|
64
|
-
export function validateMcpBindingShape(raw, expectedHost, platform) {
|
|
65
|
-
if (!isRecord(raw))
|
|
66
|
-
return reject('binding_invalid');
|
|
67
|
-
if (raw.schemaVersion !== MCP_BINDING_SCHEMA_VERSION) {
|
|
68
|
-
// rc-8: untrusted value reaches host logs; keep the launcher's exact shape.
|
|
69
|
-
const schemaKind = typeof raw.schemaVersion === 'string'
|
|
70
|
-
? raw.schemaVersion.replace(/[^A-Za-z0-9._-]/g, '').slice(0, 60)
|
|
71
|
-
: 'non-string';
|
|
72
|
-
return reject(`binding_schema_unsupported:${schemaKind}`);
|
|
73
|
-
}
|
|
74
|
-
if (!isMcpBindingHost(raw.host))
|
|
75
|
-
return reject('binding_host_invalid');
|
|
76
|
-
if (raw.host !== expectedHost)
|
|
77
|
-
return reject(`binding_host_mismatch:${raw.host}!=${expectedHost}`);
|
|
78
|
-
if (!isAbsolutePath(raw.workspaceDir))
|
|
79
|
-
return reject('binding_workspace_invalid');
|
|
80
|
-
if (!isAbsolutePath(raw.runtimeDir))
|
|
81
|
-
return reject('binding_runtime_dir_invalid');
|
|
82
|
-
if (!isAbsolutePath(raw.serverEntry))
|
|
83
|
-
return reject('binding_server_entry_invalid');
|
|
84
|
-
const { versions } = raw;
|
|
85
|
-
if (!isRecord(versions) || !isSemverVersion(versions.mcpServer))
|
|
86
|
-
return reject('binding_versions_invalid');
|
|
87
|
-
const canonicalEntry = getCanonicalMcpServerEntry(expectedHost, raw.runtimeDir);
|
|
88
|
-
if (!isSameMcpBindingPath(raw.serverEntry, canonicalEntry, platform)) {
|
|
89
|
-
return reject(`server_entry_not_canonical:${expectedHost}`);
|
|
90
|
-
}
|
|
91
|
-
const { mcpServer } = versions;
|
|
92
|
-
return {
|
|
93
|
-
ok: true,
|
|
94
|
-
binding: {
|
|
95
|
-
workspaceDir: raw.workspaceDir,
|
|
96
|
-
runtimeDir: raw.runtimeDir,
|
|
97
|
-
serverEntry: raw.serverEntry,
|
|
98
|
-
versions: {
|
|
99
|
-
mcpServer,
|
|
100
|
-
...(typeof versions.core === 'string' ? { core: versions.core } : {}),
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=mcp-binding-shape-mirror.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-binding-shape-mirror.js","sourceRoot":"","sources":["../../src/installers/mcp-binding-shape-mirror.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,MAAM,0BAA0B,GAAG,mBAAmB,CAAC;AAEvD,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,WAAW,CAAU,CAAC;AAGtE,MAAM,iCAAiC,GAAwD;IAC7F,KAAK,EAAE,CAAC,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,EAAE,UAAU,CAAC;IAC3E,QAAQ,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,UAAU,CAAC;IAC/C,SAAS,EAAE,CAAC,eAAe,EAAE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A0B,CAAC,CAAC;IAC3G,MAAM,cAAc,GAAG,0BAA0B,CAAC,YAAY,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC;IAChF,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,WAAW,EAAE,cAAc,EAAE,QAAQ,CAAC,EAAE,CAAC;QACrE,OAAO,MAAM,CAAC,8BAA8B,YAAY,EAAE,CAAC,CAAC;IAC9D,CAAC;IACD,MAAM,EAAC,SAAS,EAAC,GAAG,QAAQ,CAAC;IAC7B,OAAO;QACL,EAAE,EAAE,IAAI;QACR,OAAO,EAAE;YACP,YAAY,EAAE,GAAG,CAAC,YAAY;YAC9B,UAAU,EAAE,GAAG,CAAC,UAAU;YAC1B,WAAW,EAAE,GAAG,CAAC,WAAW;YAC5B,QAAQ,EAAE;gBACR,SAAS;gBACT,GAAG,CAAC,OAAO,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;aACpE;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PINNED MIRROR of `@principles/install-layout`'s `validateMcpBinding`.
|
|
3
|
-
*
|
|
4
|
-
* Why a mirror instead of a runtime import: the packaged installer dist is
|
|
5
|
-
* installed from the npm registry, so it must keep loading against the
|
|
6
|
-
* PUBLISHED @principles/install-layout (registry-parity smoke, PRI-669/RF-02).
|
|
7
|
-
* A normal PR may not raise the dependency floor (release-intent guard
|
|
8
|
-
* N-version), so a brand-new export cannot be imported here at runtime — the
|
|
9
|
-
* published package does not carry it yet.
|
|
10
|
-
*
|
|
11
|
-
* This is NOT a second declaration and NOT a looser gate. The declaration
|
|
12
|
-
* lives in `@principles/install-layout` (`mcp-binding-contract.ts`); this file
|
|
13
|
-
* mirrors it verbatim, and `mcp-binding-shape-mirror-parity.test.ts` pins the
|
|
14
|
-
* two to identical verdicts (ok + reason) over
|
|
15
|
-
* `MCP_BINDING_HOSTS × MCP_BINDING_FIXTURES`. A new reason code, a reordered
|
|
16
|
-
* check or a relaxed comparison on either side turns that test red.
|
|
17
|
-
*
|
|
18
|
-
* SAME-SOURCE POINTER — the authoritative declaration is
|
|
19
|
-
* packages/install-layout/src/mcp-binding-contract.ts
|
|
20
|
-
* The two files MUST change together, in the same commit. Retiring this mirror
|
|
21
|
-
* (restoring the single implementation) is tracked by PRI-1191 and is blocked
|
|
22
|
-
* until the export is published to the registry AND the installer's
|
|
23
|
-
* install-layout dependency floor reaches that version.
|
|
24
|
-
*
|
|
25
|
-
* Same discipline as the WorkBuddy plugin-state mirror (2026-11-08).
|
|
26
|
-
*/
|
|
27
|
-
import * as path from 'node:path';
|
|
28
|
-
const MCP_BINDING_SCHEMA_VERSION = 'pd.mcp-binding.v1';
|
|
29
|
-
const MCP_BINDING_HOSTS = ['codex', 'openclaw', 'workbuddy'];
|
|
30
|
-
const MCP_BINDING_SERVER_ENTRY_SEGMENTS = {
|
|
31
|
-
codex: ['node_modules', '@principles', 'pd-mcp-server', 'dist', 'index.js'],
|
|
32
|
-
openclaw: ['pd-mcp-server', 'dist', 'index.js'],
|
|
33
|
-
workbuddy: ['pd-mcp-server', 'dist', 'index.js'],
|
|
34
|
-
};
|
|
35
|
-
function getCanonicalMcpServerEntry(host, runtimeDir) {
|
|
36
|
-
return path.join(runtimeDir, ...MCP_BINDING_SERVER_ENTRY_SEGMENTS[host]);
|
|
37
|
-
}
|
|
38
|
-
const SEMVER = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
|
|
39
|
-
function isRecord(value) {
|
|
40
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
41
|
-
}
|
|
42
|
-
function isAbsolutePath(value) {
|
|
43
|
-
return typeof value === 'string' && path.isAbsolute(value);
|
|
44
|
-
}
|
|
45
|
-
function isMcpBindingHost(value) {
|
|
46
|
-
return typeof value === 'string' && MCP_BINDING_HOSTS.includes(value);
|
|
47
|
-
}
|
|
48
|
-
function isSemverVersion(value) {
|
|
49
|
-
return typeof value === 'string' && SEMVER.test(value);
|
|
50
|
-
}
|
|
51
|
-
/** Mirrors the shared `isSameMcpBindingPath` — see the SAME-SOURCE POINTER above. */
|
|
52
|
-
export function isSameMcpBindingPath(left, right, platform) {
|
|
53
|
-
const a = path.resolve(left);
|
|
54
|
-
const b = path.resolve(right);
|
|
55
|
-
return platform === 'win32' ? a.toLowerCase() === b.toLowerCase() : a === b;
|
|
56
|
-
}
|
|
57
|
-
function reject(reason) {
|
|
58
|
-
return { ok: false, reason };
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Validate the binding SHAPE (and the canonical-entry rule) exactly as the
|
|
62
|
-
* launcher and `validateMcpBinding` do. Filesystem facts stay outside.
|
|
63
|
-
*/
|
|
64
|
-
export function validateMcpBindingShape(raw, expectedHost, platform) {
|
|
65
|
-
if (!isRecord(raw))
|
|
66
|
-
return reject('binding_invalid');
|
|
67
|
-
if (raw.schemaVersion !== MCP_BINDING_SCHEMA_VERSION) {
|
|
68
|
-
// rc-8: untrusted value reaches host logs; keep the launcher's exact shape.
|
|
69
|
-
const schemaKind = typeof raw.schemaVersion === 'string'
|
|
70
|
-
? raw.schemaVersion.replace(/[^A-Za-z0-9._-]/g, '').slice(0, 60)
|
|
71
|
-
: 'non-string';
|
|
72
|
-
return reject(`binding_schema_unsupported:${schemaKind}`);
|
|
73
|
-
}
|
|
74
|
-
if (!isMcpBindingHost(raw.host))
|
|
75
|
-
return reject('binding_host_invalid');
|
|
76
|
-
if (raw.host !== expectedHost)
|
|
77
|
-
return reject(`binding_host_mismatch:${raw.host}!=${expectedHost}`);
|
|
78
|
-
if (!isAbsolutePath(raw.workspaceDir))
|
|
79
|
-
return reject('binding_workspace_invalid');
|
|
80
|
-
if (!isAbsolutePath(raw.runtimeDir))
|
|
81
|
-
return reject('binding_runtime_dir_invalid');
|
|
82
|
-
if (!isAbsolutePath(raw.serverEntry))
|
|
83
|
-
return reject('binding_server_entry_invalid');
|
|
84
|
-
const { versions } = raw;
|
|
85
|
-
if (!isRecord(versions) || !isSemverVersion(versions.mcpServer))
|
|
86
|
-
return reject('binding_versions_invalid');
|
|
87
|
-
const canonicalEntry = getCanonicalMcpServerEntry(expectedHost, raw.runtimeDir);
|
|
88
|
-
if (!isSameMcpBindingPath(raw.serverEntry, canonicalEntry, platform)) {
|
|
89
|
-
return reject(`server_entry_not_canonical:${expectedHost}`);
|
|
90
|
-
}
|
|
91
|
-
const { mcpServer } = versions;
|
|
92
|
-
return {
|
|
93
|
-
ok: true,
|
|
94
|
-
binding: {
|
|
95
|
-
workspaceDir: raw.workspaceDir,
|
|
96
|
-
runtimeDir: raw.runtimeDir,
|
|
97
|
-
serverEntry: raw.serverEntry,
|
|
98
|
-
versions: {
|
|
99
|
-
mcpServer,
|
|
100
|
-
...(typeof versions.core === 'string' ? { core: versions.core } : {}),
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=mcp-binding-shape-mirror.js.map
|