principles-disciple 1.141.0 → 1.142.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.
@@ -2,7 +2,7 @@
2
2
  "id": "principles-disciple",
3
3
  "name": "Principles Disciple",
4
4
  "description": "Evolutionary programming agent framework with strategic guardrails and reflection loops.",
5
- "version": "1.141.0",
5
+ "version": "1.142.0",
6
6
  "activation": {
7
7
  "onCapabilities": [
8
8
  "hook"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "principles-disciple",
3
- "version": "1.141.0",
3
+ "version": "1.142.0",
4
4
  "description": "Native OpenClaw plugin for Principles Disciple",
5
5
  "type": "module",
6
6
  "main": "./dist/bundle.js",
@@ -871,9 +871,9 @@ function copyDir(src, dest) {
871
871
  }
872
872
 
873
873
  /**
874
- * Inject local workspace packages (monorepo) into node_modules before npm install.
875
- * @principles/core is a workspace package, not published to npm — we must copy it
876
- * from the monorepo's node_modules so npm install --production doesn't 404 it.
874
+ * Inject local workspace packages (monorepo) into node_modules after npm install.
875
+ * @principles/core from the local monorepo is authoritative because the
876
+ * npm-published package line lacks exports required by the current pd-cli.
877
877
  */
878
878
  function injectLocalWorkspacePackages() {
879
879
  const monorepoModules = join(SOURCE_DIR, '..', '..', 'node_modules', '@principles', 'core');
@@ -885,24 +885,25 @@ function injectLocalWorkspacePackages() {
885
885
  }
886
886
 
887
887
  console.log(' 📦 Injecting local workspace packages (@principles/core)...');
888
+
889
+ // Remove the target FIRST, because cp -rL on Windows copies the source
890
+ // directory INTO the existing target, creating a nested core/core/ that
891
+ // leaves the original npm-version package.json untouched. We must start
892
+ // with a clean slate so the local version is authoritative.
893
+ if (existsSync(targetModules)) {
894
+ rmSync(targetModules, { recursive: true, force: true });
895
+ }
896
+
888
897
  mkdirSync(dirname(targetModules), { recursive: true });
889
- // cpSync creates symlinks on Windows for symlinked dirs — use cp -rL (dereference) via exec
890
- let injected = false;
898
+ // Use copyDir (Node-based, no cp -rL semantics trap) for reliable
899
+ // cross-platform overwrite. cpSync creates symlinks on Windows for
900
+ // symlinked dirs — copyDir dereferences by reading file contents.
891
901
  try {
892
- execSync(`cp -rL "${monorepoModules}" "${targetModules}"`, { stdio: 'ignore' });
893
- injected = true;
894
- } catch {
895
- // Fallback: manual copy via node (Windows-compatible)
896
- try {
897
- copyDir(monorepoModules, targetModules);
898
- injected = true;
899
- } catch (copyErr) {
900
- console.warn(' ⚠️ Failed to inject @principles/core from monorepo: ' + copyErr.message);
901
- console.warn(' ⚠️ npm install --production may fail if @principles/core is not published');
902
- }
903
- }
904
- if (injected && !existsSync(targetModules)) {
905
- console.warn(' ⚠️ Injection reported success but target not found: ' + targetModules);
902
+ copyDir(monorepoModules, targetModules);
903
+ console.log(' ✅ @principles/core local build injected');
904
+ } catch (copyErr) {
905
+ console.warn(' ⚠️ Failed to inject @principles/core from monorepo: ' + copyErr.message);
906
+ console.warn(' ⚠️ npm version remains in place — pd-cli may fail if exports differ');
906
907
  }
907
908
  }
908
909
 
@@ -1309,8 +1310,18 @@ function main() {
1309
1310
  syncFilteredManifest(args.lang);
1310
1311
  syncPdCli();
1311
1312
 
1312
- injectLocalWorkspacePackages();
1313
+ // IMPORTANT: npm install must run FIRST, then injectLocalWorkspacePackages
1314
+ // overwrites @principles/core with the local monorepo version.
1315
+ //
1316
+ // Why: @principles/core on npm (v1.164.0-1.174.0, from a different publish
1317
+ // line) is semantically "^1.74.1"-compatible but its exports field does NOT
1318
+ // include ./principle-tree-ledger that pd-cli/health.js requires. The npm
1319
+ // registry version must never be used — only the local monorepo build has
1320
+ // the correct exports. Injecting BEFORE npm install is useless because npm
1321
+ // overwrites the injected copy. The authoritative source is always the
1322
+ // local monorepo, applied AFTER npm install.
1313
1323
  installTargetDependencies();
1324
+ injectLocalWorkspacePackages();
1314
1325
  verifyInjectedWorkspaceDeps();
1315
1326
  verifyPdCliShim();
1316
1327