create-principles-disciple 1.144.2 → 1.144.6
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 +2 -2
- package/console/dist/server/models/ApprovalsConsoleModel.js +23 -0
- package/console/dist/server/routes/update-transaction.js +0 -2
- package/core/dist/runtime-v2/activation/activation-dispatcher.d.ts +27 -0
- package/core/dist/runtime-v2/activation/activation-dispatcher.d.ts.map +1 -1
- package/core/dist/runtime-v2/activation/activation-dispatcher.js +61 -7
- package/core/dist/runtime-v2/activation/activation-dispatcher.js.map +1 -1
- package/core/dist/runtime-v2/activation/index.d.ts +2 -0
- package/core/dist/runtime-v2/activation/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/activation/index.js +2 -0
- package/core/dist/runtime-v2/activation/index.js.map +1 -1
- package/core/dist/runtime-v2/activation/ledger-identity.d.ts +67 -0
- package/core/dist/runtime-v2/activation/ledger-identity.d.ts.map +1 -0
- package/core/dist/runtime-v2/activation/ledger-identity.js +105 -0
- package/core/dist/runtime-v2/activation/ledger-identity.js.map +1 -0
- package/core/dist/runtime-v2/activation/low-risk-writers.d.ts +48 -0
- package/core/dist/runtime-v2/activation/low-risk-writers.d.ts.map +1 -1
- package/core/dist/runtime-v2/activation/low-risk-writers.js +68 -8
- package/core/dist/runtime-v2/activation/low-risk-writers.js.map +1 -1
- package/core/dist/runtime-v2/bridge-result-shaper.d.ts +12 -0
- package/core/dist/runtime-v2/bridge-result-shaper.d.ts.map +1 -1
- package/core/dist/runtime-v2/bridge-result-shaper.js +8 -4
- package/core/dist/runtime-v2/bridge-result-shaper.js.map +1 -1
- package/core/dist/runtime-v2/candidate-intake-service.d.ts +54 -3
- package/core/dist/runtime-v2/candidate-intake-service.d.ts.map +1 -1
- package/core/dist/runtime-v2/candidate-intake-service.js +56 -4
- package/core/dist/runtime-v2/candidate-intake-service.js.map +1 -1
- package/core/dist/runtime-v2/index.d.ts +2 -2
- package/core/dist/runtime-v2/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/index.js +1 -1
- package/core/dist/runtime-v2/index.js.map +1 -1
- package/core/dist/runtime-v2/internalization/dreamer-runner.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/dreamer-runner.js +19 -4
- package/core/dist/runtime-v2/internalization/dreamer-runner.js.map +1 -1
- package/core/dist/runtime-v2/internalization/evaluator-runner.d.ts +46 -11
- package/core/dist/runtime-v2/internalization/evaluator-runner.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/evaluator-runner.js +73 -41
- package/core/dist/runtime-v2/internalization/evaluator-runner.js.map +1 -1
- package/core/dist/runtime-v2/internalization/scribe-runner.d.ts +30 -0
- package/core/dist/runtime-v2/internalization/scribe-runner.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/scribe-runner.js +68 -0
- package/core/dist/runtime-v2/internalization/scribe-runner.js.map +1 -1
- package/core/dist/runtime-v2/pain-signal-bridge.d.ts.map +1 -1
- package/core/dist/runtime-v2/pain-signal-bridge.js +22 -2
- package/core/dist/runtime-v2/pain-signal-bridge.js.map +1 -1
- package/core/dist/runtime-v2/proven-channel-baseline.d.ts.map +1 -1
- package/core/dist/runtime-v2/proven-channel-baseline.js +4 -1
- package/core/dist/runtime-v2/proven-channel-baseline.js.map +1 -1
- package/core/dist/runtime-v2/store/artifact/sqlite-artifact-store.d.ts.map +1 -1
- package/core/dist/runtime-v2/store/artifact/sqlite-artifact-store.js +4 -0
- package/core/dist/runtime-v2/store/artifact/sqlite-artifact-store.js.map +1 -1
- package/core/dist/runtime-v2/store/candidate/candidate-store.d.ts +19 -0
- package/core/dist/runtime-v2/store/candidate/candidate-store.d.ts.map +1 -1
- package/core/dist/runtime-v2/store/candidate/recommendation-kind-resolver.d.ts +39 -0
- package/core/dist/runtime-v2/store/candidate/recommendation-kind-resolver.d.ts.map +1 -1
- package/core/dist/runtime-v2/store/candidate/recommendation-kind-resolver.js +46 -0
- package/core/dist/runtime-v2/store/candidate/recommendation-kind-resolver.js.map +1 -1
- package/core/dist/runtime-v2/store/candidate/sqlite-candidate-store.d.ts.map +1 -1
- package/core/dist/runtime-v2/store/candidate/sqlite-candidate-store.js +4 -0
- package/core/dist/runtime-v2/store/candidate/sqlite-candidate-store.js.map +1 -1
- package/core/dist/runtime-v2/story-a-demo.d.ts +11 -1
- package/core/dist/runtime-v2/story-a-demo.d.ts.map +1 -1
- package/core/dist/runtime-v2/story-a-demo.js +12 -2
- package/core/dist/runtime-v2/story-a-demo.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 +20 -0
- package/core/dist/telemetry-event.js.map +1 -1
- package/core/package.json +33 -1
- package/dist/installer.d.ts +43 -0
- package/dist/installer.d.ts.map +1 -1
- package/dist/installer.js +226 -0
- package/dist/installer.js.map +1 -1
- package/dist/update/install-layout.d.ts +1 -2
- package/dist/update/install-layout.d.ts.map +1 -1
- package/dist/update/install-layout.js +1 -2
- package/dist/update/install-layout.js.map +1 -1
- package/dist/update/transaction-journal.d.ts +4 -4
- package/dist/update/transaction-journal.d.ts.map +1 -1
- package/dist/update/transaction-journal.js +18 -23
- package/dist/update/transaction-journal.js.map +1 -1
- package/host-runtime/dist/internalization-consumer-cycle.js +21 -2
- package/host-runtime/dist/internalization-consumer-governance.js +23 -1
- package/host-runtime/package.json +1 -1
- package/package.json +3 -3
- package/pd-cli/dist/commands/candidate.d.ts.map +1 -1
- package/pd-cli/dist/commands/candidate.js +34 -7
- package/pd-cli/dist/commands/candidate.js.map +1 -1
- package/pd-cli/dist/commands/diagnose.d.ts.map +1 -1
- package/pd-cli/dist/commands/diagnose.js +23 -7
- package/pd-cli/dist/commands/diagnose.js.map +1 -1
- package/pd-cli/dist/commands/pain-retry.d.ts.map +1 -1
- package/pd-cli/dist/commands/pain-retry.js +21 -7
- package/pd-cli/dist/commands/pain-retry.js.map +1 -1
- package/pd-cli/dist/commands/runtime-activation.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-activation.js +29 -1
- package/pd-cli/dist/commands/runtime-activation.js.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-once.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-once.js +10 -2
- package/pd-cli/dist/commands/runtime-internalization-run-once.js.map +1 -1
- package/pd-cli/dist/services/demo-story-a-runner.d.ts.map +1 -1
- package/pd-cli/dist/services/demo-story-a-runner.js +48 -6
- package/pd-cli/dist/services/demo-story-a-runner.js.map +1 -1
- package/pd-cli/dist/services/rulehost-pipeline-runner.d.ts +9 -3
- package/pd-cli/dist/services/rulehost-pipeline-runner.d.ts.map +1 -1
- package/pd-cli/dist/services/rulehost-pipeline-runner.js +23 -4
- package/pd-cli/dist/services/rulehost-pipeline-runner.js.map +1 -1
- package/pd-cli/package.json +1 -1
- package/plugin/dist/bundle.js +459 -459
- package/plugin/dist/constants/tool-semantics.d.ts +1 -1
- package/plugin/dist/governance-audit.js +3 -522
- package/plugin/dist/openclaw.plugin.json +1 -1
- package/plugin/dist/rulehost-evidence.js +54 -573
- package/plugin/dist/types/event-types.d.ts +1 -1
- package/plugin/openclaw.plugin.json +1 -1
- package/plugin/package.json +1 -1
- package/release-manager/dist/installer.d.ts +43 -0
- package/release-manager/dist/installer.d.ts.map +1 -1
- package/release-manager/dist/installer.js +226 -0
- package/release-manager/dist/installer.js.map +1 -1
- package/release-manager/dist/update/install-layout.d.ts +1 -2
- package/release-manager/dist/update/install-layout.d.ts.map +1 -1
- package/release-manager/dist/update/install-layout.js +1 -2
- package/release-manager/dist/update/install-layout.js.map +1 -1
- package/release-manager/dist/update/transaction-journal.d.ts +4 -4
- package/release-manager/dist/update/transaction-journal.d.ts.map +1 -1
- package/release-manager/dist/update/transaction-journal.js +18 -23
- package/release-manager/dist/update/transaction-journal.js.map +1 -1
- package/release-manager/package.json +3 -3
package/dist/installer.d.ts
CHANGED
|
@@ -298,6 +298,49 @@ export declare function tryUpgradePdCliFromNpm(installedPdCliDir: string): void;
|
|
|
298
298
|
* payload or a call-order regression, which fails the install loudly.
|
|
299
299
|
*/
|
|
300
300
|
export declare function ensureCodexAdapterResolution(): void;
|
|
301
|
+
/**
|
|
302
|
+
* PRI-912 (SPEC-P1′-A): canonical junction reconciliation for the plugin's
|
|
303
|
+
* bundled @principles/core copy. The self-contained release asset must ship
|
|
304
|
+
* node_modules materialized (the asset builder refuses symlinks), so every
|
|
305
|
+
* deployed plugin carries a full physical duplicate of the runtime root core
|
|
306
|
+
* (~119MB / 17k files on a real install). This pass runs once ALL components
|
|
307
|
+
* are deployed and BEFORE the journal 'staged' transition — a conversion that
|
|
308
|
+
* breaks runtime resolution must surface through the EXISTING console-probe →
|
|
309
|
+
* rollback channel, not a new one.
|
|
310
|
+
*
|
|
311
|
+
* The ONLY candidate is <pluginDir>/node_modules/@principles/core with the
|
|
312
|
+
* runtime root core (<runtime>/core) as canonical source. A materialized copy
|
|
313
|
+
* is converted to a junction (Windows) / relative symlink (Unix) only when
|
|
314
|
+
* ALL three gates hold:
|
|
315
|
+
* 1. package identity — the copy's and the source's package.json `name`
|
|
316
|
+
* agree (evidence-based; never name-matching alone),
|
|
317
|
+
* 2. declared relationship — the plugin manifest declares
|
|
318
|
+
* `@principles/core` as a `file:` dependency whose declared path stays
|
|
319
|
+
* inside the plugin dir (rc-1) and RESOLVES to the canonical runtime
|
|
320
|
+
* core (the <plugin>/core slot installPluginToStaging creates),
|
|
321
|
+
* 3. content digest — digestDirectory(copy) === digestDirectory(source).
|
|
322
|
+
* Any gate failure (or an unreadable/partial state) SKIPS the copy with a
|
|
323
|
+
* structured reason (rc-9) and never mutates it — dedup must never make an
|
|
324
|
+
* install worse. Conversion is rename-swap with verification and restore:
|
|
325
|
+
* a failed link creation/verification puts the materialized copy back; only
|
|
326
|
+
* a restore failure (which WOULD break resolution) fails the install loud
|
|
327
|
+
* into the existing fail → rollback channel. Idempotent: an existing link
|
|
328
|
+
* that already resolves to the canonical core is a no-op. The canonical
|
|
329
|
+
* target itself is never deleted: removing a converted tree unlinks the
|
|
330
|
+
* junction, it does not follow it (rmSync/fse.remove symlink semantics).
|
|
331
|
+
*/
|
|
332
|
+
export interface CoreJunctionReconciliation {
|
|
333
|
+
/** Materialized copies replaced by a verified canonical junction. */
|
|
334
|
+
readonly converted: readonly string[];
|
|
335
|
+
/** Existing links already resolving to the canonical core (idempotent no-op). */
|
|
336
|
+
readonly alreadyCanonical: readonly string[];
|
|
337
|
+
/** Structured skip records — every non-conversion carries a reason (rc-9). */
|
|
338
|
+
readonly skipped: readonly {
|
|
339
|
+
dir: string;
|
|
340
|
+
reason: string;
|
|
341
|
+
}[];
|
|
342
|
+
}
|
|
343
|
+
export declare function reconcilePluginCoreCanonicalJunction(): CoreJunctionReconciliation;
|
|
301
344
|
export interface InstallResult {
|
|
302
345
|
success: boolean;
|
|
303
346
|
workspaceDir: string;
|
package/dist/installer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../src/installer.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAmBL,KAAK,eAAe,EACpB,KAAK,kBAAkB,EAExB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAAsB,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAGnF,OAAO,EAA+B,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAoBtF,OAAO,EAKL,KAAK,2BAA2B,EAChC,KAAK,gBAAgB,EACtB,MAAM,iCAAiC,CAAC;AAEzC,iFAAiF;AACjF,eAAO,MAAM,8BAA8B,EAAG,yBAAkC,CAAC;AAEjF;gFACgF;AAChF,eAAO,MAAM,4BAA4B,0CAA0C,CAAC;AAMpF;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,MAA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ACH;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,6BAA6B,GAAG,UAAU,GAAG,gBAAgB,CAAC;AAE1E,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,oBAAoB,EAAE,6BAA6B,CAAC;IAC7D,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,2BAA2B,EAAE,2BAA2B,CAAC;CACnE;AAqDD,mFAAmF;AACnF,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,mBAAmB,CAAC,EAAE,wBAAwB,GAAG,gBAAgB,CAYzH;AAED;;;;GAIG;AAEH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,gBAAgB,GAAG,IAAI,EAC7B,EAAE,EAAE,gBAAgB,EACpB,MAAM,EAAE,MAAM,GACb,IAAI,CAqBN;AAED,oFAAoF;AAEpF,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,gBAAgB,GAAG,IAAI,EAC7B,EAAE,EAAE,gBAAgB,EACpB,MAAM,EAAE,MAAM,GACb,IAAI,CAYN;AAQD,wBAAsB,OAAO,CAC3B,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,MAAM,EACjB,IAAI,GAAE,cAAmB,EAMzB,WAAW,CAAC,EAAE,gBAAgB,GAC7B,OAAO,CAAC,aAAa,CAAC,CAivBxB"}
|
package/dist/installer.js
CHANGED
|
@@ -832,6 +832,7 @@ const INSTALL_STEPS = [
|
|
|
832
832
|
{ name: 'Installing pd-console', weight: 8 },
|
|
833
833
|
{ name: 'Preparing core library for console', weight: 3 },
|
|
834
834
|
{ name: 'Validating bundled console dependencies', weight: 5 },
|
|
835
|
+
{ name: 'Reconciling canonical core junction', weight: 1 },
|
|
835
836
|
{ name: 'Verifying pd-console', weight: 3 },
|
|
836
837
|
{ name: 'Copying templates', weight: 3 },
|
|
837
838
|
{ name: 'Generating config.yaml', weight: 2 },
|
|
@@ -2101,6 +2102,221 @@ export function ensureCodexAdapterResolution() {
|
|
|
2101
2102
|
}
|
|
2102
2103
|
}
|
|
2103
2104
|
}
|
|
2105
|
+
const CORE_JUNCTION_PACKAGE = '@principles/core';
|
|
2106
|
+
/** Reads a package.json `name` as untrusted input (rc-1); null when absent/malformed. */
|
|
2107
|
+
function readPackageJsonName(manifestPath) {
|
|
2108
|
+
try {
|
|
2109
|
+
const parsed = JSON.parse(readFileSync(manifestPath, 'utf8'));
|
|
2110
|
+
if (!isRecord(parsed))
|
|
2111
|
+
return null;
|
|
2112
|
+
const { name } = parsed;
|
|
2113
|
+
return typeof name === 'string' && name.length > 0 ? name : null;
|
|
2114
|
+
}
|
|
2115
|
+
catch {
|
|
2116
|
+
return null;
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
export function reconcilePluginCoreCanonicalJunction() {
|
|
2120
|
+
const converted = [];
|
|
2121
|
+
const alreadyCanonical = [];
|
|
2122
|
+
const skipped = [];
|
|
2123
|
+
const runtimeCoreDir = getInstalledCoreDir();
|
|
2124
|
+
const runtimeCoreReal = (() => {
|
|
2125
|
+
try {
|
|
2126
|
+
return realpathSync(runtimeCoreDir);
|
|
2127
|
+
}
|
|
2128
|
+
catch {
|
|
2129
|
+
return null;
|
|
2130
|
+
}
|
|
2131
|
+
})();
|
|
2132
|
+
if (runtimeCoreReal === null) {
|
|
2133
|
+
// No canonical source → nothing safe to link to; the copies still work.
|
|
2134
|
+
for (const pluginDir of pluginInstallDirs()) {
|
|
2135
|
+
skipped.push({ dir: path.join(pluginDir, 'node_modules', CORE_JUNCTION_PACKAGE), reason: 'canonical_runtime_core_missing' });
|
|
2136
|
+
}
|
|
2137
|
+
return { converted, alreadyCanonical, skipped };
|
|
2138
|
+
}
|
|
2139
|
+
// Computed at most once, only when a materialized candidate reaches gate 3.
|
|
2140
|
+
let runtimeCoreDigest = null;
|
|
2141
|
+
for (const pluginDir of pluginInstallDirs()) {
|
|
2142
|
+
const coreSlot = path.join(pluginDir, 'node_modules', CORE_JUNCTION_PACKAGE);
|
|
2143
|
+
// lstat (never existsSync): a dangling link must be reported as a link
|
|
2144
|
+
// problem, not misread as an absent copy.
|
|
2145
|
+
let slotStat;
|
|
2146
|
+
try {
|
|
2147
|
+
slotStat = lstatSync(coreSlot);
|
|
2148
|
+
}
|
|
2149
|
+
catch {
|
|
2150
|
+
skipped.push({ dir: coreSlot, reason: 'copy_absent' });
|
|
2151
|
+
continue;
|
|
2152
|
+
}
|
|
2153
|
+
try {
|
|
2154
|
+
if (slotStat.isSymbolicLink()) {
|
|
2155
|
+
try {
|
|
2156
|
+
if (realpathSync(coreSlot) === runtimeCoreReal) {
|
|
2157
|
+
alreadyCanonical.push(coreSlot);
|
|
2158
|
+
}
|
|
2159
|
+
else {
|
|
2160
|
+
skipped.push({ dir: coreSlot, reason: 'existing_link_resolves_elsewhere' });
|
|
2161
|
+
}
|
|
2162
|
+
}
|
|
2163
|
+
catch {
|
|
2164
|
+
skipped.push({ dir: coreSlot, reason: 'existing_link_target_unreadable' });
|
|
2165
|
+
}
|
|
2166
|
+
continue;
|
|
2167
|
+
}
|
|
2168
|
+
if (!slotStat.isDirectory()) {
|
|
2169
|
+
skipped.push({ dir: coreSlot, reason: 'copy_not_a_directory' });
|
|
2170
|
+
continue;
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
catch (error) {
|
|
2174
|
+
// An unreadable/partial slot state is never mutated and never fails
|
|
2175
|
+
// the install — dedup is an optimization over a working copy (rc-9).
|
|
2176
|
+
skipped.push({ dir: coreSlot, reason: `copy_unreadable: ${error instanceof Error ? error.message : String(error)}` });
|
|
2177
|
+
continue;
|
|
2178
|
+
}
|
|
2179
|
+
// Gate 1 — package identity from both manifests.
|
|
2180
|
+
const copyName = readPackageJsonName(path.join(coreSlot, 'package.json'));
|
|
2181
|
+
const sourceName = readPackageJsonName(path.join(runtimeCoreDir, 'package.json'));
|
|
2182
|
+
if (copyName === null || sourceName === null || copyName !== sourceName) {
|
|
2183
|
+
skipped.push({ dir: coreSlot, reason: `package_identity_mismatch: copy=${JSON.stringify(copyName)} source=${JSON.stringify(sourceName)}` });
|
|
2184
|
+
continue;
|
|
2185
|
+
}
|
|
2186
|
+
// Gate 2 — the declared file: dependency binds the copy slot to the
|
|
2187
|
+
// canonical core. The ref is untrusted (rc-1): only relative refs that
|
|
2188
|
+
// stay inside the plugin dir are considered.
|
|
2189
|
+
const pluginManifestPath = path.join(pluginDir, 'package.json');
|
|
2190
|
+
let declaredRef;
|
|
2191
|
+
try {
|
|
2192
|
+
const parsed = JSON.parse(readFileSync(pluginManifestPath, 'utf8'));
|
|
2193
|
+
if (!isRecord(parsed) || !isRecord(parsed.dependencies)) {
|
|
2194
|
+
skipped.push({ dir: coreSlot, reason: 'plugin_manifest_dependencies_unreadable' });
|
|
2195
|
+
continue;
|
|
2196
|
+
}
|
|
2197
|
+
declaredRef = parsed.dependencies[CORE_JUNCTION_PACKAGE];
|
|
2198
|
+
}
|
|
2199
|
+
catch (error) {
|
|
2200
|
+
skipped.push({ dir: coreSlot, reason: `plugin_manifest_unreadable: ${error instanceof Error ? error.message : String(error)}` });
|
|
2201
|
+
continue;
|
|
2202
|
+
}
|
|
2203
|
+
if (typeof declaredRef !== 'string' || !declaredRef.startsWith('file:')) {
|
|
2204
|
+
skipped.push({ dir: coreSlot, reason: `declared_dependency_not_file_ref: ${JSON.stringify(declaredRef ?? null)}` });
|
|
2205
|
+
continue;
|
|
2206
|
+
}
|
|
2207
|
+
const declaredDir = path.resolve(pluginDir, declaredRef.slice('file:'.length));
|
|
2208
|
+
if (declaredDir !== pluginDir && !declaredDir.startsWith(pluginDir + path.sep)) {
|
|
2209
|
+
skipped.push({ dir: coreSlot, reason: `declared_dependency_escapes_plugin_dir: ${declaredRef}` });
|
|
2210
|
+
continue;
|
|
2211
|
+
}
|
|
2212
|
+
let declaredResolvesToCore;
|
|
2213
|
+
try {
|
|
2214
|
+
declaredResolvesToCore = existsSync(declaredDir) && realpathSync(declaredDir) === runtimeCoreReal;
|
|
2215
|
+
}
|
|
2216
|
+
catch {
|
|
2217
|
+
// Unreadable declared slot — treat as not resolving to the canonical core.
|
|
2218
|
+
declaredResolvesToCore = false;
|
|
2219
|
+
}
|
|
2220
|
+
if (!declaredResolvesToCore) {
|
|
2221
|
+
skipped.push({ dir: coreSlot, reason: `declared_file_dep_does_not_resolve_to_runtime_core: ${declaredRef}` });
|
|
2222
|
+
continue;
|
|
2223
|
+
}
|
|
2224
|
+
// Gate 3 — content digest equality. Either side failing to digest is a
|
|
2225
|
+
// skip (rc-9), never an install failure.
|
|
2226
|
+
if (runtimeCoreDigest === null) {
|
|
2227
|
+
try {
|
|
2228
|
+
runtimeCoreDigest = digestDirectory(runtimeCoreDir);
|
|
2229
|
+
}
|
|
2230
|
+
catch (error) {
|
|
2231
|
+
skipped.push({ dir: coreSlot, reason: `canonical_core_unreadable: ${error instanceof Error ? error.message : String(error)}` });
|
|
2232
|
+
continue;
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2235
|
+
let copyDigest;
|
|
2236
|
+
try {
|
|
2237
|
+
copyDigest = digestDirectory(coreSlot);
|
|
2238
|
+
}
|
|
2239
|
+
catch (error) {
|
|
2240
|
+
skipped.push({ dir: coreSlot, reason: `copy_unreadable: ${error instanceof Error ? error.message : String(error)}` });
|
|
2241
|
+
continue;
|
|
2242
|
+
}
|
|
2243
|
+
if (copyDigest !== runtimeCoreDigest) {
|
|
2244
|
+
skipped.push({ dir: coreSlot, reason: 'content_digest_mismatch' });
|
|
2245
|
+
continue;
|
|
2246
|
+
}
|
|
2247
|
+
// All gates hold: rename-swap the materialized copy for a canonical link.
|
|
2248
|
+
const backupPath = `${coreSlot}.pri912-materialized`;
|
|
2249
|
+
// The backup name is reserved by this pass; clear our own stale residue
|
|
2250
|
+
// so the swap below can never collide with it. If the residue cannot be
|
|
2251
|
+
// removed (e.g. Windows EBUSY from an AV scan holding the ~17k-file tree),
|
|
2252
|
+
// the swap would collide anyway — skip with the working copy intact
|
|
2253
|
+
// rather than throw out of the pass and fail a healthy install (rc-9).
|
|
2254
|
+
try {
|
|
2255
|
+
rmSync(backupPath, { recursive: true, force: true });
|
|
2256
|
+
}
|
|
2257
|
+
catch (error) {
|
|
2258
|
+
skipped.push({ dir: coreSlot, reason: `stale_backup_unremovable: ${error instanceof Error ? error.message : String(error)}` });
|
|
2259
|
+
continue;
|
|
2260
|
+
}
|
|
2261
|
+
try {
|
|
2262
|
+
renameSync(coreSlot, backupPath);
|
|
2263
|
+
}
|
|
2264
|
+
catch (error) {
|
|
2265
|
+
skipped.push({ dir: coreSlot, reason: `rename_aside_failed: ${error instanceof Error ? error.message : String(error)}` });
|
|
2266
|
+
continue;
|
|
2267
|
+
}
|
|
2268
|
+
try {
|
|
2269
|
+
if (isWindows()) {
|
|
2270
|
+
symlinkSync(runtimeCoreDir, coreSlot, 'junction');
|
|
2271
|
+
}
|
|
2272
|
+
else {
|
|
2273
|
+
symlinkSync(path.relative(path.dirname(coreSlot), runtimeCoreDir), coreSlot, 'dir');
|
|
2274
|
+
}
|
|
2275
|
+
if (realpathSync(coreSlot) !== runtimeCoreReal) {
|
|
2276
|
+
throw new Error('fresh link does not resolve to the canonical core');
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2279
|
+
catch (error) {
|
|
2280
|
+
// Conversion failed — put the proven-identical copy back. The slot must
|
|
2281
|
+
// never be left empty or dangling; only a failed RESTORE breaks
|
|
2282
|
+
// resolution and deserves the fail → rollback channel. Remove the slot
|
|
2283
|
+
// unconditionally (force handles absent, lstat semantics unlinks a
|
|
2284
|
+
// dangling link without following it); guarding on existsSync would MISS
|
|
2285
|
+
// a dangling link — existsSync follows it to a missing target and returns
|
|
2286
|
+
// false — leaving it to make the restore renameSync fail.
|
|
2287
|
+
try {
|
|
2288
|
+
rmSync(coreSlot, { recursive: true, force: true });
|
|
2289
|
+
renameSync(backupPath, coreSlot);
|
|
2290
|
+
}
|
|
2291
|
+
catch (restoreError) {
|
|
2292
|
+
throw new Error(`PRI-912 core junction conversion failed at ${coreSlot} AND the materialized copy could not be restored: `
|
|
2293
|
+
+ `${restoreError instanceof Error ? restoreError.message : String(restoreError)}`
|
|
2294
|
+
+ ` (original conversion failure: ${error instanceof Error ? error.message : String(error)})`, { cause: restoreError });
|
|
2295
|
+
}
|
|
2296
|
+
skipped.push({ dir: coreSlot, reason: `conversion_failed_restored: ${error instanceof Error ? error.message : String(error)}` });
|
|
2297
|
+
continue;
|
|
2298
|
+
}
|
|
2299
|
+
// The link is created and verified — the conversion is a success. Removing
|
|
2300
|
+
// the now-redundant materialized backup is only disk reclamation; if it
|
|
2301
|
+
// fails (Windows EBUSY/EPERM on ~17k files) we must NOT roll back a
|
|
2302
|
+
// working install. Leave the residue, warn, and keep the converted slot.
|
|
2303
|
+
try {
|
|
2304
|
+
rmSync(backupPath, { recursive: true, force: true });
|
|
2305
|
+
}
|
|
2306
|
+
catch (error) {
|
|
2307
|
+
logger.warn(`PRI-912: converted ${coreSlot} to a canonical junction but could not remove the redundant materialized backup at ${backupPath}: `
|
|
2308
|
+
+ `${error instanceof Error ? error.message : String(error)} — reclamation deferred, install is healthy.`);
|
|
2309
|
+
}
|
|
2310
|
+
converted.push(coreSlot);
|
|
2311
|
+
}
|
|
2312
|
+
if (converted.length > 0) {
|
|
2313
|
+
logger.info(`PRI-912: converted ${converted.length} materialized @principles/core plugin copy/copies to canonical junctions.`);
|
|
2314
|
+
}
|
|
2315
|
+
for (const skip of skipped) {
|
|
2316
|
+
logger.warn(`PRI-912: core dedup skipped at ${skip.dir}: ${skip.reason}`);
|
|
2317
|
+
}
|
|
2318
|
+
return { converted, alreadyCanonical, skipped };
|
|
2319
|
+
}
|
|
2104
2320
|
function ensureCoreDependency(_targetDir) {
|
|
2105
2321
|
const coreDir = getInstalledCoreDir();
|
|
2106
2322
|
if (!existsSync(coreDir)) {
|
|
@@ -3012,6 +3228,16 @@ transaction) {
|
|
|
3012
3228
|
updateProgress(spinner, stepIndex, 'Validating bundled console dependencies...');
|
|
3013
3229
|
await installConsoleDependencies();
|
|
3014
3230
|
stepIndex++;
|
|
3231
|
+
// PRI-912 (SPEC-P1′-A): dedup the plugin's bundled @principles/core copy
|
|
3232
|
+
// into a canonical junction only after EVERY component is deployed, so a
|
|
3233
|
+
// conversion that breaks runtime resolution fails the console probe below
|
|
3234
|
+
// and lands in the EXISTING fail → restoreBackup channel (no new
|
|
3235
|
+
// rollback mechanism). Runs before the journal 'staged' transition: an
|
|
3236
|
+
// install that failed here is still fully covered by the backups.
|
|
3237
|
+
if (spinner)
|
|
3238
|
+
updateProgress(spinner, stepIndex, 'Reconciling canonical core junction...');
|
|
3239
|
+
reconcilePluginCoreCanonicalJunction();
|
|
3240
|
+
stepIndex++;
|
|
3015
3241
|
// ADR-0024 D-2: all runtime content is laid down — the new installation
|
|
3016
3242
|
// is staged (nothing has been discarded yet; backups still hold the old one).
|
|
3017
3243
|
journalInstallerTransitionDegrading(journal, journal.lastState, 'staged', 'runtime components installed');
|