create-principles-disciple 1.148.10 → 1.149.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.
Files changed (53) hide show
  1. package/_release/product-identity.json +1 -1
  2. package/codex-adapter/package.json +1 -1
  3. package/console/dist/server/index.js +7 -0
  4. package/console/dist/server/models/OwnerDecisionConsoleModel.d.ts +18 -0
  5. package/console/dist/server/models/OwnerDecisionConsoleModel.js +42 -6
  6. package/console/dist/server/routes/compatibility-scan.d.ts +18 -0
  7. package/console/dist/server/routes/compatibility-scan.js +33 -0
  8. package/console/dist/shared/compatibility-scan-contract.d.ts +26 -0
  9. package/console/dist/shared/compatibility-scan-contract.js +1 -0
  10. package/console/dist/web/assets/app.js +31 -31
  11. package/core/dist/runtime/activation/index.d.ts +2 -2
  12. package/core/dist/runtime/activation/index.d.ts.map +1 -1
  13. package/core/dist/runtime/activation/index.js +1 -1
  14. package/core/dist/runtime/activation/index.js.map +1 -1
  15. package/core/dist/runtime/activation/promotion-readiness-evaluator.d.ts +34 -0
  16. package/core/dist/runtime/activation/promotion-readiness-evaluator.d.ts.map +1 -1
  17. package/core/dist/runtime/activation/promotion-readiness-evaluator.js +49 -8
  18. package/core/dist/runtime/activation/promotion-readiness-evaluator.js.map +1 -1
  19. package/core/dist/runtime/activation-compatibility-read-model.d.ts +33 -2
  20. package/core/dist/runtime/activation-compatibility-read-model.d.ts.map +1 -1
  21. package/core/dist/runtime/activation-compatibility-read-model.js +46 -6
  22. package/core/dist/runtime/activation-compatibility-read-model.js.map +1 -1
  23. package/core/dist/runtime/config/pd-config-types.d.ts +0 -2
  24. package/core/dist/runtime/config/pd-config-types.d.ts.map +1 -1
  25. package/core/dist/runtime/config/pd-config-types.js.map +1 -1
  26. package/core/dist/runtime/config/pd-config-validate.d.ts.map +1 -1
  27. package/core/dist/runtime/config/pd-config-validate.js +82 -0
  28. package/core/dist/runtime/config/pd-config-validate.js.map +1 -1
  29. package/core/package.json +1 -1
  30. package/dist/installer.d.ts +58 -7
  31. package/dist/installer.d.ts.map +1 -1
  32. package/dist/installer.js +131 -6
  33. package/dist/installer.js.map +1 -1
  34. package/host-runtime/package.json +1 -1
  35. package/install-layout/dist/index.d.ts +1 -1
  36. package/install-layout/dist/index.js +1 -1
  37. package/install-layout/dist/pd-home.d.ts +9 -2
  38. package/install-layout/dist/pd-home.js +77 -14
  39. package/install-layout/package.json +1 -1
  40. package/package.json +3 -3
  41. package/pd-cli/dist/commands/runtime-compatibility-scan.d.ts +5 -2
  42. package/pd-cli/dist/commands/runtime-compatibility-scan.d.ts.map +1 -1
  43. package/pd-cli/dist/commands/runtime-compatibility-scan.js +28 -2
  44. package/pd-cli/dist/commands/runtime-compatibility-scan.js.map +1 -1
  45. package/pd-cli/dist/services/config-doctor.d.ts +9 -0
  46. package/pd-cli/dist/services/config-doctor.d.ts.map +1 -1
  47. package/pd-cli/dist/services/config-doctor.js +15 -0
  48. package/pd-cli/dist/services/config-doctor.js.map +1 -1
  49. package/pd-cli/package.json +1 -1
  50. package/plugin/dist/bundle.js +284 -284
  51. package/release-manager/dist/installer.js +131 -6
  52. package/release-manager/package.json +1 -1
  53. package/workbuddy-adapter/package.json +1 -1
@@ -1331,16 +1331,52 @@ function protocolInvalid(detail) {
1331
1331
  remediation: 'The compatibility scanner returned an unexpected result. Re-download/rebuild the installer before upgrading. The current installation has not been replaced.',
1332
1332
  };
1333
1333
  }
1334
+ const MAX_SKIP_BUCKETS = 50;
1335
+ /** Sentinel so "absent scannedActivations" stays distinguishable from 0. */
1336
+ const INVALID_COUNT = Symbol('invalid-count');
1337
+ /** rc-4: validate every bucket field, not just "is an array". */
1338
+ function parseSkippedBuckets(value) {
1339
+ if (value === undefined)
1340
+ return [];
1341
+ if (!Array.isArray(value) || value.length > MAX_SKIP_BUCKETS)
1342
+ return null;
1343
+ const buckets = [];
1344
+ for (const entry of value) {
1345
+ if (!isRecord(entry))
1346
+ return null;
1347
+ const { reason } = entry;
1348
+ const { count } = entry;
1349
+ const samples = entry.sampleActivationIds;
1350
+ if (typeof reason !== 'string' || reason.length === 0)
1351
+ return null;
1352
+ if (typeof count !== 'number' || !Number.isInteger(count) || count <= 0)
1353
+ return null;
1354
+ if (!Array.isArray(samples) || !samples.every((id) => typeof id === 'string'))
1355
+ return null;
1356
+ buckets.push({ reason, count, sampleActivationIds: [...samples] });
1357
+ }
1358
+ return buckets;
1359
+ }
1360
+ function parseScannedActivations(value) {
1361
+ if (value === undefined)
1362
+ return undefined;
1363
+ if (typeof value !== 'number' || !Number.isInteger(value) || value < 0)
1364
+ return INVALID_COUNT;
1365
+ return value;
1366
+ }
1334
1367
  /**
1335
1368
  * Strict (ok, status) protocol parse (P2, 2026-08-20).
1336
1369
  *
1337
1370
  * Boolean `ok` alone is NOT authoritative — the (ok, status) pair is the
1338
- * contract. Only ok=true + (clean|no_state_db) is a successful scan. Every
1339
- * other combination fails closed:
1340
- * - ok=true + refusal/success-impossible status → protocol invalid
1341
- * - ok=false + clean|no_state_db/unknown → protocol invalid
1371
+ * contract. Only ok=true + (clean|no_state_db|incomplete) is a successful
1372
+ * scan. Every other combination fails closed:
1373
+ * - ok=true + refusal status → protocol invalid
1374
+ * - ok=true + clean/no_state_db + skipped rows → protocol invalid (a
1375
+ * consumer may never quietly downgrade `incomplete` to `clean`)
1376
+ * - ok=true + incomplete + empty skipped → protocol invalid
1377
+ * - ok=false + clean|no_state_db|incomplete/unknown → protocol invalid
1342
1378
  * - ok=false + legacy_dependency|scan_failed|scan_unavailable → refusal
1343
- * - non-boolean / missing ok → protocol invalid
1379
+ * - non-boolean / missing ok → protocol invalid
1344
1380
  * The payload is never trusted to self-describe a pass.
1345
1381
  */
1346
1382
  export function parseCompatibilityScanStdout(stdout) {
@@ -1360,9 +1396,34 @@ export function parseCompatibilityScanStdout(stdout) {
1360
1396
  const status = typeof parsed.status === 'string' ? parsed.status : 'unknown';
1361
1397
  const reason = typeof parsed.reason === 'string' ? parsed.reason : undefined;
1362
1398
  const remediation = typeof parsed.remediation === 'string' ? parsed.remediation : undefined;
1399
+ const skipped = parseSkippedBuckets(parsed.skipped);
1400
+ if (skipped === null) {
1401
+ return protocolInvalid('skipped is not a valid [{reason,count,sampleActivationIds}] array');
1402
+ }
1403
+ const scannedActivations = parseScannedActivations(parsed.scannedActivations);
1404
+ if (scannedActivations === INVALID_COUNT) {
1405
+ return protocolInvalid('scannedActivations is not a non-negative integer');
1406
+ }
1407
+ const skippedTotal = skipped.reduce((sum, bucket) => sum + bucket.count, 0);
1408
+ const visibility = {
1409
+ skipped,
1410
+ ...(scannedActivations !== undefined ? { scannedActivations } : {}),
1411
+ };
1363
1412
  if (parsed.ok === true) {
1364
1413
  if (status === 'clean' || status === 'no_state_db') {
1365
- return { ok: true, status };
1414
+ // Hard constraint (5B): `incomplete` must never be degraded to `clean`
1415
+ // by a consumer. A payload that admits it skipped rows while claiming
1416
+ // clean is self-contradictory, not a pass.
1417
+ if (skipped.length > 0) {
1418
+ return protocolInvalid(`ok=true with status=${status} but skipped=${skippedTotal}`);
1419
+ }
1420
+ return { ok: true, status, ...visibility };
1421
+ }
1422
+ if (status === 'incomplete') {
1423
+ if (skipped.length === 0) {
1424
+ return protocolInvalid('ok=true with status=incomplete but skipped is empty');
1425
+ }
1426
+ return { ok: true, status, ...visibility };
1366
1427
  }
1367
1428
  return protocolInvalid(`ok=true with status=${status}`);
1368
1429
  }
@@ -1374,6 +1435,52 @@ export function parseCompatibilityScanStdout(stdout) {
1374
1435
  }
1375
1436
  return protocolInvalid(`ok is not a boolean`);
1376
1437
  }
1438
+ /**
1439
+ * 5B: turn the scan's `skipped` buckets into operator-facing lines.
1440
+ *
1441
+ * INTENTIONAL CHOICE — these are warnings, never a refusal. A non-interactive
1442
+ * install that hard-failed here would strand the user: the old installation is
1443
+ * untouched, but the upgrade is blocked with no in-product repair path (they
1444
+ * would have to hand-edit the workspace DB before the installer would run).
1445
+ * Escalate to a hard failure only if a real incident is attributed to an
1446
+ * upgrade that ran with unverified ACTIVE rules; the escalation condition is
1447
+ * then `level === 'critical'` (zero rules verified) and belongs here.
1448
+ */
1449
+ export function summarizeCompatibilityVisibility(outcome, workspaceDir) {
1450
+ const skipped = outcome.skipped ?? [];
1451
+ if (skipped.length === 0)
1452
+ return { level: 'none', lines: [] };
1453
+ const total = skipped.reduce((sum, bucket) => sum + bucket.count, 0);
1454
+ const rows = skipped.map((bucket) => {
1455
+ const sample = bucket.sampleActivationIds.length > 0 ? ` (sample: ${bucket.sampleActivationIds.join(', ')})` : '';
1456
+ return `${bucket.reason}=${bucket.count}${sample}`;
1457
+ });
1458
+ const nextCommand = `pd runtime compatibility-scan --workspace "${workspaceDir}" --json`;
1459
+ if (outcome.scannedActivations === 0) {
1460
+ const border = '!'.repeat(74);
1461
+ return {
1462
+ level: 'critical',
1463
+ lines: [
1464
+ border,
1465
+ '!! WARNING: THIS UPGRADE DID NOT VERIFY ANY RULE COMPATIBILITY',
1466
+ `!! ${total} ACTIVE rule(s) could not be read and 0 ACTIVE rule(s) were scanned,`,
1467
+ '!! so no ACTIVE rule was checked for retired-contract dependencies.',
1468
+ `!! ${rows.join(' | ')}`,
1469
+ '!! The upgrade proceeds; verify now:',
1470
+ `!! ${nextCommand}`,
1471
+ border,
1472
+ ],
1473
+ };
1474
+ }
1475
+ return {
1476
+ level: 'warning',
1477
+ lines: [
1478
+ `warning: ${total} ACTIVE rule(s) could not be read during the compatibility check — their compatibility is NOT verified.`,
1479
+ ...rows.map((row) => ` ${row}`),
1480
+ `next: ${nextCommand}`,
1481
+ ],
1482
+ };
1483
+ }
1377
1484
  /**
1378
1485
  * PRI-693 / PRI-1060: materialize node_modules links for the BUNDLED (not yet
1379
1486
  * deployed) components so the pre-deployment compatibility scan can execute
@@ -4034,6 +4141,11 @@ transaction) {
4034
4141
  // a refusal leaves the existing installation completely untouched. Only
4035
4142
  // meaningful when the target workspace already has PD state; fresh
4036
4143
  // workspaces scan clean (no state.db → nothing persisted to conflict).
4144
+ //
4145
+ // 5B: rows the scan could not read are surfaced as warnings, never as a
4146
+ // refusal — see summarizeCompatibilityVisibility for why, and for the
4147
+ // condition under which that choice should be revisited.
4148
+ let compatibilityVisibility = { level: 'none', lines: [] };
4037
4149
  if (existsSync(path.join(path.resolve(options.workspaceDir), '.pd', 'state.db'))) {
4038
4150
  if (spinner)
4039
4151
  updateProgress(spinner, stepIndex, 'Checking workspace rule compatibility...');
@@ -4043,6 +4155,11 @@ transaction) {
4043
4155
  logger.error(compat.reason ?? 'legacy_rule_contract_dependency');
4044
4156
  return buildCompatibilityRefusalResult(options, compat);
4045
4157
  }
4158
+ compatibilityVisibility = summarizeCompatibilityVisibility(compat, options.workspaceDir);
4159
+ if (!quiet) {
4160
+ for (const line of compatibilityVisibility.lines)
4161
+ logger.warn(line);
4162
+ }
4046
4163
  }
4047
4164
  stepIndex++;
4048
4165
  if (spinner)
@@ -4522,6 +4639,13 @@ transaction) {
4522
4639
  spinner.warn(`Install partially complete — ${hostManualActions.length} manual step(s) pending (details below)`);
4523
4640
  }
4524
4641
  }
4642
+ // 5B: the preflight warning scrolls away during a multi-minute install, so
4643
+ // the end summary repeats the zero-visibility block verbatim. This is
4644
+ // still a warning: the install completed and success is unchanged.
4645
+ if (!quiet && compatibilityVisibility.level === 'critical') {
4646
+ for (const line of compatibilityVisibility.lines)
4647
+ logger.warn(line);
4648
+ }
4525
4649
  // P0-2: terminate + join the verified child before any later step that
4526
4650
  // may touch the runtime tree (here: none destructive, but a wedged child
4527
4651
  // must not leak past the install either).
@@ -4588,6 +4712,7 @@ transaction) {
4588
4712
  nextAction: nextActions.join(' | '),
4589
4713
  consoleUrl: launchResult.consoleUrl,
4590
4714
  hostResults,
4715
+ ...(compatibilityVisibility.lines.length > 0 ? { compatibilityWarnings: compatibilityVisibility.lines } : {}),
4591
4716
  ...(manualActionReason !== undefined ? { reason: manualActionReason, manualActions: hostManualActions } : {}),
4592
4717
  journal: installerJournalRecord(journal),
4593
4718
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-principles-disciple",
3
- "version": "1.148.10",
3
+ "version": "1.149.0",
4
4
  "description": "Interactive CLI installer for Principles Disciple OpenClaw plugin",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principles/workbuddy-adapter",
3
- "version": "0.5.9",
3
+ "version": "0.5.10",
4
4
  "description": "WorkBuddy host adapter for Principles Disciple — implements the HostAdapter interface for WorkBuddy's Git Bash command-hook model (ADR-0020 third host, SPEC workbuddy-host-adapter v0.3.0).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",