create-principles-disciple 1.147.8 → 1.147.9

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 (58) hide show
  1. package/_release/product-identity.json +2 -2
  2. package/core/dist/runtime-v2/activation/adaptive-delivery-record.d.ts +37 -0
  3. package/core/dist/runtime-v2/activation/adaptive-delivery-record.d.ts.map +1 -0
  4. package/core/dist/runtime-v2/activation/adaptive-delivery-record.js +126 -0
  5. package/core/dist/runtime-v2/activation/adaptive-delivery-record.js.map +1 -0
  6. package/core/dist/runtime-v2/activation/adaptive-principle-intervention.d.ts +46 -0
  7. package/core/dist/runtime-v2/activation/adaptive-principle-intervention.d.ts.map +1 -0
  8. package/core/dist/runtime-v2/activation/adaptive-principle-intervention.js +91 -0
  9. package/core/dist/runtime-v2/activation/adaptive-principle-intervention.js.map +1 -0
  10. package/core/dist/runtime-v2/activation/prompt-activation-reader-contract.d.ts +2 -0
  11. package/core/dist/runtime-v2/activation/prompt-activation-reader-contract.d.ts.map +1 -1
  12. package/core/dist/runtime-v2/activation/prompt-activation-reader-contract.js +2 -0
  13. package/core/dist/runtime-v2/activation/prompt-activation-reader-contract.js.map +1 -1
  14. package/core/dist/runtime-v2/index.d.ts +3 -0
  15. package/core/dist/runtime-v2/index.d.ts.map +1 -1
  16. package/core/dist/runtime-v2/index.js +2 -0
  17. package/core/dist/runtime-v2/index.js.map +1 -1
  18. package/core/dist/runtime-v2/store/sqlite-connection.js +1 -1
  19. package/core/dist/runtime-v2/store/sqlite-connection.js.map +1 -1
  20. package/core/dist/runtime-v2/types/event-types.d.ts +6 -3
  21. package/core/dist/runtime-v2/types/event-types.d.ts.map +1 -1
  22. package/core/dist/runtime-v2/types/event-types.js +2 -0
  23. package/core/dist/runtime-v2/types/event-types.js.map +1 -1
  24. package/core/package.json +5 -1
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +9 -0
  27. package/dist/index.js.map +1 -1
  28. package/dist/install-summary.d.ts +3 -0
  29. package/dist/install-summary.d.ts.map +1 -1
  30. package/dist/install-summary.js +17 -9
  31. package/dist/install-summary.js.map +1 -1
  32. package/dist/installers/workbuddy-host-installer.d.ts +20 -1
  33. package/dist/installers/workbuddy-host-installer.d.ts.map +1 -1
  34. package/dist/installers/workbuddy-host-installer.js +75 -14
  35. package/dist/installers/workbuddy-host-installer.js.map +1 -1
  36. package/host-runtime/dist/active-principle-prompt.d.ts +28 -0
  37. package/host-runtime/dist/active-principle-prompt.js +163 -50
  38. package/host-runtime/dist/adaptive-principle-revalidation.d.ts +8 -0
  39. package/host-runtime/dist/adaptive-principle-revalidation.js +52 -0
  40. package/host-runtime/dist/index.d.ts +16 -0
  41. package/host-runtime/dist/index.js +34 -0
  42. package/host-runtime/dist/prompt-activation-authority.d.ts +7 -0
  43. package/host-runtime/dist/prompt-activation-authority.js +16 -0
  44. package/package.json +2 -2
  45. package/pd-cli/package.json +1 -1
  46. package/plugin/dist/bundle.js +446 -446
  47. package/plugin/dist/core/event-log.d.ts +3 -0
  48. package/plugin/dist/governance-audit.js +3 -3
  49. package/plugin/dist/hooks/adaptive-activation-config.d.ts +8 -0
  50. package/plugin/dist/hooks/prompt-helpers.d.ts +5 -0
  51. package/plugin/dist/hooks/prompt-types.d.ts +1 -0
  52. package/plugin/dist/hooks/prompt.d.ts +8 -1
  53. package/plugin/dist/host-runtime/openclaw-host-runtime.d.ts +13 -0
  54. package/plugin/dist/openclaw-sdk.d.ts +4 -0
  55. package/plugin/dist/openclaw.plugin.json +33 -1
  56. package/plugin/openclaw.plugin.json +32 -0
  57. package/release-manager/dist/installers/workbuddy-host-installer.js +75 -14
  58. package/release-manager/package.json +1 -1
@@ -867,7 +867,8 @@ function applyFeatureFlagLineEdit(raw, request) {
867
867
  * (it is part of the feature-flag contract and may exist in old configs), but
868
868
  * the installer never turns it on.
869
869
  */
870
- export function ensureWorkbuddyGovernanceEnabled(governanceDir) {
870
+ export function ensureWorkbuddyGovernanceEnabled(governanceDir, options = {}) {
871
+ const persist = options.persist !== false;
871
872
  const configPath = path.join(governanceDir, '.pd', 'config.yaml');
872
873
  let rawText;
873
874
  try {
@@ -906,6 +907,18 @@ export function ensureWorkbuddyGovernanceEnabled(governanceDir) {
906
907
  const oldKeyword = raw.features.workbuddy_live_keyword_pain;
907
908
  const hostExplicitOff = isRecord(oldHost) && oldHost.enabled === false;
908
909
  const keywordExplicitOff = isRecord(oldKeyword) && oldKeyword.enabled === false;
910
+ // Read-only mode (`status`): report the gates the config ACTUALLY holds and
911
+ // never write. A flag that is absent is OFF (the registry default), never the
912
+ // install-time projection — guessing ON would misreport a config that does
913
+ // not set the gate. The install path keeps its migration below.
914
+ if (!persist) {
915
+ return {
916
+ ok: true, configPath,
917
+ enabled: isRecord(oldHost) && oldHost.enabled === true,
918
+ hostExplicitOff, keywordExplicitOff,
919
+ keywordPainEnabled: isRecord(oldKeyword) && oldKeyword.enabled === true, changed: false,
920
+ };
921
+ }
909
922
  const alreadyCorrect = isRecord(oldHost) && oldHost.enabled === !hostExplicitOff && oldHost.category === WORKBUDDY_FLAG_CATEGORY
910
923
  && isRecord(oldKeyword) && oldKeyword.enabled === false && oldKeyword.category === WORKBUDDY_FLAG_CATEGORY;
911
924
  if (alreadyCorrect) {
@@ -945,6 +958,66 @@ export function ensureWorkbuddyGovernanceEnabled(governanceDir) {
945
958
  }
946
959
  return { ok: true, configPath, enabled: !hostExplicitOff, hostExplicitOff, keywordExplicitOff, keywordPainEnabled, changed: true };
947
960
  }
961
+ /**
962
+ * The single plugin-state judgment: registration (registry) and enablement
963
+ * (settings) are INDEPENDENT facts and neither may be inferred from the other
964
+ * (OD-03). Extracted so the install path and the read-only `status` path share
965
+ * exactly one implementation.
966
+ */
967
+ export function readWorkbuddyPluginState(p) {
968
+ const registry = readHostJsonFile(p.registryPath);
969
+ const registered = registry.ok && registry.existed && isRecord(registry.value.plugins)
970
+ ? Object.hasOwn(registry.value.plugins, WORKBUDDY_PLUGIN_KEY)
971
+ : false;
972
+ const settings = readHostJsonFile(p.settingsPath);
973
+ const enabledPlugins = settings.ok && isRecord(settings.value?.enabledPlugins) ? settings.value.enabledPlugins : undefined;
974
+ const raw = enabledPlugins === undefined ? undefined : enabledPlugins[WORKBUDDY_PLUGIN_KEY];
975
+ return {
976
+ registered,
977
+ registryReadable: registry.ok,
978
+ enabled: typeof raw === 'boolean' ? raw : null,
979
+ };
980
+ }
981
+ /**
982
+ * Read-only host state projection for the installer's `status` command.
983
+ *
984
+ * It reports the SAME three independent facts the install summary reports —
985
+ * registry presence, enablement, governance gates — and is rendered by the
986
+ * SAME authority (`formatHostStateSummary`). It never writes: an unreadable
987
+ * source becomes UNKNOWN/UNREADABLE, never a guessed value.
988
+ */
989
+ export function readWorkbuddyHostState(homeDir) {
990
+ const p = resolveWorkbuddyPaths(homeDir);
991
+ const pluginState = readWorkbuddyPluginState(p);
992
+ const governance = ensureWorkbuddyGovernanceEnabled(p.governanceDir, { persist: false });
993
+ if (!governance.ok) {
994
+ const configPath = path.join(p.governanceDir, '.pd', 'config.yaml');
995
+ return {
996
+ success: true,
997
+ hostId: 'workbuddy',
998
+ pluginState,
999
+ governance: {
1000
+ enabled: false,
1001
+ explicitOptOut: false,
1002
+ configPath,
1003
+ readable: false,
1004
+ unreadableReason: `${governance.reason} (${configPath})`,
1005
+ },
1006
+ };
1007
+ }
1008
+ return {
1009
+ success: true,
1010
+ hostId: 'workbuddy',
1011
+ pluginState,
1012
+ governance: {
1013
+ enabled: governance.enabled,
1014
+ explicitOptOut: governance.hostExplicitOff,
1015
+ keywordPainEnabled: governance.keywordPainEnabled,
1016
+ configPath: governance.configPath,
1017
+ readable: true,
1018
+ },
1019
+ };
1020
+ }
948
1021
  /**
949
1022
  * PRI-1064 review: the install summary must state the governance gate
950
1023
  * truthfully.
@@ -1947,19 +2020,7 @@ export class WorkBuddyHostInstaller {
1947
2020
  * "installed" (rc-9).
1948
2021
  */
1949
2022
  readInstalledPluginState() {
1950
- const p = this.paths();
1951
- const registry = readHostJsonFile(p.registryPath);
1952
- const registered = registry.ok && registry.existed && isRecord(registry.value.plugins)
1953
- ? Object.hasOwn(registry.value.plugins, WORKBUDDY_PLUGIN_KEY)
1954
- : false;
1955
- const settings = readHostJsonFile(p.settingsPath);
1956
- const enabledPlugins = settings.ok && isRecord(settings.value?.enabledPlugins) ? settings.value.enabledPlugins : undefined;
1957
- const raw = enabledPlugins === undefined ? undefined : enabledPlugins[WORKBUDDY_PLUGIN_KEY];
1958
- return {
1959
- registered,
1960
- registryReadable: registry.ok,
1961
- enabled: typeof raw === 'boolean' ? raw : null,
1962
- };
2023
+ return readWorkbuddyPluginState(this.paths());
1963
2024
  }
1964
2025
  /**
1965
2026
  * Direct-write registration for engine-unreachable machines, aligned with the
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-principles-disciple",
3
- "version": "1.147.8",
3
+ "version": "1.147.9",
4
4
  "description": "Interactive CLI installer for Principles Disciple OpenClaw plugin",
5
5
  "type": "module",
6
6
  "bin": {