principles-disciple 1.209.4 → 1.209.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.
Files changed (132) hide show
  1. package/README.md +73 -0
  2. package/dist/bundle.js +13 -11
  3. package/dist/constants/tools.d.ts +1 -1
  4. package/dist/hooks/prompt-helpers.d.ts +5 -5
  5. package/dist/openclaw.plugin.json +1 -1
  6. package/dist/templates/langs/en/core/AGENTS.md +40 -180
  7. package/dist/templates/langs/en/core/BOOT.md +19 -47
  8. package/dist/templates/langs/en/core/HEARTBEAT.md +26 -58
  9. package/dist/templates/langs/en/core/IDENTITY.md +15 -8
  10. package/dist/templates/langs/en/core/PRINCIPLES.md +6 -7
  11. package/dist/templates/langs/en/core/SOUL.md +10 -41
  12. package/dist/templates/langs/en/core/TOOLS.md +18 -10
  13. package/dist/templates/langs/en/core/USER.md +13 -8
  14. package/dist/templates/langs/en/skills/pd-auditor/SKILL.md +1 -1
  15. package/dist/templates/langs/en/skills/pd-explorer/SKILL.md +1 -1
  16. package/dist/templates/langs/en/skills/pd-implementer/SKILL.md +1 -1
  17. package/dist/templates/langs/en/skills/pd-mentor/SKILL.md +6 -30
  18. package/dist/templates/langs/en/skills/pd-planner/SKILL.md +1 -1
  19. package/dist/templates/langs/zh/core/AGENTS.md +38 -173
  20. package/dist/templates/langs/zh/core/BOOT.md +14 -46
  21. package/dist/templates/langs/zh/core/HEARTBEAT.md +20 -82
  22. package/dist/templates/langs/zh/core/IDENTITY.md +15 -8
  23. package/dist/templates/langs/zh/core/PRINCIPLES.md +7 -7
  24. package/dist/templates/langs/zh/core/SOUL.md +9 -41
  25. package/dist/templates/langs/zh/core/TOOLS.md +14 -10
  26. package/dist/templates/langs/zh/core/USER.md +12 -8
  27. package/dist/templates/langs/zh/skills/pd-auditor/SKILL.md +1 -1
  28. package/dist/templates/langs/zh/skills/pd-explorer/SKILL.md +1 -1
  29. package/dist/templates/langs/zh/skills/pd-implementer/SKILL.md +1 -1
  30. package/dist/templates/langs/zh/skills/pd-mentor/SKILL.md +6 -30
  31. package/dist/templates/langs/zh/skills/pd-planner/SKILL.md +1 -1
  32. package/dist/templates/pain_settings.json +1 -2
  33. package/openclaw.plugin.json +1 -1
  34. package/package.json +1 -2
  35. package/templates/langs/en/core/AGENTS.md +40 -180
  36. package/templates/langs/en/core/BOOT.md +19 -47
  37. package/templates/langs/en/core/HEARTBEAT.md +26 -58
  38. package/templates/langs/en/core/IDENTITY.md +15 -8
  39. package/templates/langs/en/core/PRINCIPLES.md +6 -7
  40. package/templates/langs/en/core/SOUL.md +10 -41
  41. package/templates/langs/en/core/TOOLS.md +18 -10
  42. package/templates/langs/en/core/USER.md +13 -8
  43. package/templates/langs/en/skills/pd-auditor/SKILL.md +1 -1
  44. package/templates/langs/en/skills/pd-explorer/SKILL.md +1 -1
  45. package/templates/langs/en/skills/pd-implementer/SKILL.md +1 -1
  46. package/templates/langs/en/skills/pd-mentor/SKILL.md +6 -30
  47. package/templates/langs/en/skills/pd-planner/SKILL.md +1 -1
  48. package/templates/langs/zh/core/AGENTS.md +38 -173
  49. package/templates/langs/zh/core/BOOT.md +14 -46
  50. package/templates/langs/zh/core/HEARTBEAT.md +20 -82
  51. package/templates/langs/zh/core/IDENTITY.md +15 -8
  52. package/templates/langs/zh/core/PRINCIPLES.md +7 -7
  53. package/templates/langs/zh/core/SOUL.md +9 -41
  54. package/templates/langs/zh/core/TOOLS.md +14 -10
  55. package/templates/langs/zh/core/USER.md +12 -8
  56. package/templates/langs/zh/skills/pd-auditor/SKILL.md +1 -1
  57. package/templates/langs/zh/skills/pd-explorer/SKILL.md +1 -1
  58. package/templates/langs/zh/skills/pd-implementer/SKILL.md +1 -1
  59. package/templates/langs/zh/skills/pd-mentor/SKILL.md +6 -30
  60. package/templates/langs/zh/skills/pd-planner/SKILL.md +1 -1
  61. package/templates/pain_settings.json +1 -2
  62. package/dist/templates/langs/en/core/BOOTSTRAP.md +0 -259
  63. package/dist/templates/langs/en/skills/admin/SKILL.md +0 -39
  64. package/dist/templates/langs/en/skills/bootstrap-tools/SKILL.md +0 -53
  65. package/dist/templates/langs/en/skills/deductive-audit/SKILL.md +0 -36
  66. package/dist/templates/langs/en/skills/evolution-framework-update/SKILL.md +0 -31
  67. package/dist/templates/langs/en/skills/evolve-task/SKILL.md +0 -83
  68. package/dist/templates/langs/en/skills/feedback/SKILL.md +0 -51
  69. package/dist/templates/langs/en/skills/init-strategy/SKILL.md +0 -54
  70. package/dist/templates/langs/en/skills/inject-rule/SKILL.md +0 -19
  71. package/dist/templates/langs/en/skills/profile/SKILL.md +0 -24
  72. package/dist/templates/langs/en/skills/reflection/SKILL.md +0 -40
  73. package/dist/templates/langs/en/skills/reflection-log/SKILL.md +0 -37
  74. package/dist/templates/langs/en/skills/report/SKILL.md +0 -13
  75. package/dist/templates/langs/en/skills/root-cause/SKILL.md +0 -33
  76. package/dist/templates/langs/en/skills/triage/SKILL.md +0 -29
  77. package/dist/templates/langs/en/skills/watch-evolution/SKILL.md +0 -33
  78. package/dist/templates/langs/zh/core/BOOTSTRAP.md +0 -260
  79. package/dist/templates/langs/zh/skills/admin/SKILL.md +0 -41
  80. package/dist/templates/langs/zh/skills/bootstrap-tools/SKILL.md +0 -52
  81. package/dist/templates/langs/zh/skills/deductive-audit/SKILL.md +0 -36
  82. package/dist/templates/langs/zh/skills/evolution-framework-update/SKILL.md +0 -31
  83. package/dist/templates/langs/zh/skills/evolve-task/SKILL.md +0 -83
  84. package/dist/templates/langs/zh/skills/feedback/SKILL.md +0 -53
  85. package/dist/templates/langs/zh/skills/init-strategy/SKILL.md +0 -54
  86. package/dist/templates/langs/zh/skills/inject-rule/SKILL.md +0 -19
  87. package/dist/templates/langs/zh/skills/profile/SKILL.md +0 -24
  88. package/dist/templates/langs/zh/skills/reflection/SKILL.md +0 -40
  89. package/dist/templates/langs/zh/skills/reflection-log/SKILL.md +0 -37
  90. package/dist/templates/langs/zh/skills/report/SKILL.md +0 -13
  91. package/dist/templates/langs/zh/skills/root-cause/SKILL.md +0 -33
  92. package/dist/templates/langs/zh/skills/triage/SKILL.md +0 -29
  93. package/dist/templates/langs/zh/skills/watch-evolution/SKILL.md +0 -33
  94. package/scripts/acceptance-test.mjs +0 -257
  95. package/scripts/bootstrap-rules.mjs +0 -70
  96. package/scripts/compile-principles.mjs +0 -104
  97. package/scripts/install-dependencies.cjs +0 -47
  98. package/scripts/postinstall.cjs +0 -177
  99. package/scripts/sync-plugin.mjs +0 -1442
  100. package/scripts/verify-build.mjs +0 -120
  101. package/templates/langs/en/core/BOOTSTRAP.md +0 -259
  102. package/templates/langs/en/skills/admin/SKILL.md +0 -39
  103. package/templates/langs/en/skills/bootstrap-tools/SKILL.md +0 -53
  104. package/templates/langs/en/skills/deductive-audit/SKILL.md +0 -36
  105. package/templates/langs/en/skills/evolution-framework-update/SKILL.md +0 -31
  106. package/templates/langs/en/skills/evolve-task/SKILL.md +0 -83
  107. package/templates/langs/en/skills/feedback/SKILL.md +0 -51
  108. package/templates/langs/en/skills/init-strategy/SKILL.md +0 -54
  109. package/templates/langs/en/skills/inject-rule/SKILL.md +0 -19
  110. package/templates/langs/en/skills/profile/SKILL.md +0 -24
  111. package/templates/langs/en/skills/reflection/SKILL.md +0 -40
  112. package/templates/langs/en/skills/reflection-log/SKILL.md +0 -37
  113. package/templates/langs/en/skills/report/SKILL.md +0 -13
  114. package/templates/langs/en/skills/root-cause/SKILL.md +0 -33
  115. package/templates/langs/en/skills/triage/SKILL.md +0 -29
  116. package/templates/langs/en/skills/watch-evolution/SKILL.md +0 -33
  117. package/templates/langs/zh/core/BOOTSTRAP.md +0 -260
  118. package/templates/langs/zh/skills/admin/SKILL.md +0 -41
  119. package/templates/langs/zh/skills/bootstrap-tools/SKILL.md +0 -52
  120. package/templates/langs/zh/skills/deductive-audit/SKILL.md +0 -36
  121. package/templates/langs/zh/skills/evolution-framework-update/SKILL.md +0 -31
  122. package/templates/langs/zh/skills/evolve-task/SKILL.md +0 -83
  123. package/templates/langs/zh/skills/feedback/SKILL.md +0 -53
  124. package/templates/langs/zh/skills/init-strategy/SKILL.md +0 -54
  125. package/templates/langs/zh/skills/inject-rule/SKILL.md +0 -19
  126. package/templates/langs/zh/skills/profile/SKILL.md +0 -24
  127. package/templates/langs/zh/skills/reflection/SKILL.md +0 -40
  128. package/templates/langs/zh/skills/reflection-log/SKILL.md +0 -37
  129. package/templates/langs/zh/skills/report/SKILL.md +0 -13
  130. package/templates/langs/zh/skills/root-cause/SKILL.md +0 -33
  131. package/templates/langs/zh/skills/triage/SKILL.md +0 -29
  132. package/templates/langs/zh/skills/watch-evolution/SKILL.md +0 -33
@@ -1,177 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * PRI-343: postinstall hook — auto-configure allowConversationAccess.
4
- *
5
- * Runs during `npm install` (i.e. `openclaw plugins install principles-disciple`).
6
- * Sets plugins.entries['principles-disciple'].hooks.allowConversationAccess = true
7
- * in ~/.openclaw/openclaw.json so users never need to manually run
8
- * `openclaw config set ... allowConversationAccess true`.
9
- *
10
- * Design constraints:
11
- * - Idempotent: safe to run multiple times.
12
- * - BOM-resistant: strip U+FEFF before JSON.parse (PowerShell UTF8 writes add BOM).
13
- * - Atomic write: temp file + rename to avoid partial writes.
14
- * - File-locked: uses O_EXCL lock file to prevent races with concurrent writers.
15
- * - Never fail the install: all errors are caught and logged to stderr.
16
- * - No dependencies: pure Node.js built-ins (fs, path, os).
17
- */
18
- 'use strict';
19
-
20
- const { existsSync, readFileSync, writeFileSync, renameSync, unlinkSync, openSync, closeSync, statSync, writeSync, fsyncSync, constants } = require('fs');
21
- const { join } = require('path');
22
- const { homedir } = require('os');
23
-
24
- const PLUGIN_ID = 'principles-disciple';
25
- const CONFIG_PATH = join(homedir(), '.openclaw', 'openclaw.json');
26
- const LOCK_PATH = CONFIG_PATH + '.lock';
27
- const LOCK_MAX_RETRIES = 20;
28
- const LOCK_BASE_DELAY_MS = 25;
29
-
30
- function log(msg) {
31
- process.stderr.write(`[PD:postinstall] ${msg}\n`);
32
- }
33
-
34
- function isRecord(value) {
35
- return value !== null && typeof value === 'object' && !Array.isArray(value);
36
- }
37
-
38
- function isProcessAlive(pid) {
39
- try {
40
- process.kill(pid, 0);
41
- return true;
42
- } catch {
43
- return false;
44
- }
45
- }
46
-
47
- function tryAcquireLock() {
48
- try {
49
- const flags = constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL;
50
- const fd = openSync(LOCK_PATH, flags, 0o600);
51
- try {
52
- writeSync(fd, String(process.pid));
53
- fsyncSync(fd);
54
- } finally {
55
- closeSync(fd);
56
- }
57
- return true;
58
- } catch (err) {
59
- if (err.code === 'EEXIST') return false;
60
- throw err;
61
- }
62
- }
63
-
64
- function readLockPid() {
65
- try {
66
- const content = readFileSync(LOCK_PATH, 'utf8');
67
- const pid = parseInt(content.trim(), 10);
68
- return Number.isNaN(pid) ? null : pid;
69
- } catch {
70
- return null;
71
- }
72
- }
73
-
74
- function cleanupStaleLock() {
75
- try {
76
- const stat = statSync(LOCK_PATH);
77
- const pid = readLockPid();
78
- const isStale = Date.now() - stat.mtimeMs > 10000;
79
- const isDead = pid === null || !isProcessAlive(pid);
80
- if (isStale || isDead) {
81
- try {
82
- unlinkSync(LOCK_PATH);
83
- return true;
84
- } catch {
85
- return false;
86
- }
87
- }
88
- return false;
89
- } catch {
90
- return false;
91
- }
92
- }
93
-
94
- function acquireLockSync() {
95
- for (let attempt = 0; attempt < LOCK_MAX_RETRIES; attempt++) {
96
- if (tryAcquireLock()) return true;
97
- if (!cleanupStaleLock()) {
98
- const delay = LOCK_BASE_DELAY_MS * Math.pow(2, Math.min(attempt, 5));
99
- const jitter = delay * 0.2 * Math.random();
100
- const waitUntil = Date.now() + delay + jitter;
101
- while (Date.now() < waitUntil) { /* spin */ }
102
- continue;
103
- }
104
- if (tryAcquireLock()) return true;
105
- }
106
- return false;
107
- }
108
-
109
- function releaseLock() {
110
- try {
111
- const pid = readLockPid();
112
- if (pid === process.pid) {
113
- unlinkSync(LOCK_PATH);
114
- }
115
- } catch {
116
- // best effort
117
- }
118
- }
119
-
120
- try {
121
- if (!existsSync(CONFIG_PATH)) {
122
- log(`No openclaw.json at ${CONFIG_PATH} — skipping (will auto-fix on first load).`);
123
- process.exit(0);
124
- }
125
-
126
- const locked = acquireLockSync();
127
- if (!locked) {
128
- log(`Could not acquire config lock — skipping (will auto-fix on first load).`);
129
- process.exit(0);
130
- }
131
-
132
- let exitCode = 0;
133
- try {
134
- // BOM-resistant read
135
- const raw = readFileSync(CONFIG_PATH, 'utf8').replace(/^\uFEFF/, '');
136
- const cfg = JSON.parse(raw);
137
-
138
- if (!isRecord(cfg)) {
139
- log(`openclaw.json is not a JSON object — skipping.`);
140
- } else {
141
- // Ensure plugins.entries path exists
142
- if (!isRecord(cfg.plugins)) cfg.plugins = {};
143
- if (!isRecord(cfg.plugins.entries)) cfg.plugins.entries = {};
144
-
145
- const rawEntry = cfg.plugins.entries[PLUGIN_ID];
146
- const entry = isRecord(rawEntry) ? rawEntry : { enabled: true };
147
-
148
- if (!isRecord(entry.hooks)) entry.hooks = {};
149
-
150
- if (entry.hooks.allowConversationAccess !== true) {
151
- // Set allowConversationAccess = true
152
- entry.hooks.allowConversationAccess = true;
153
- cfg.plugins.entries[PLUGIN_ID] = entry;
154
-
155
- // Atomic write: temp file + rename
156
- const tmpPath = CONFIG_PATH + '.tmp.' + Date.now();
157
- writeFileSync(tmpPath, JSON.stringify(cfg, null, 2), 'utf8');
158
- renameSync(tmpPath, CONFIG_PATH);
159
-
160
- log(`allowConversationAccess auto-configured to true in ${CONFIG_PATH}`);
161
- }
162
- }
163
- } catch (innerErr) {
164
- log(`Auto-configuration failed: ${innerErr instanceof Error ? innerErr.message : String(innerErr)}`);
165
- log(`The plugin will retry on first load. If it still fails, run:`);
166
- log(` openclaw config set plugins.entries.principles-disciple.hooks.allowConversationAccess true`);
167
- } finally {
168
- releaseLock();
169
- }
170
- process.exit(exitCode);
171
- } catch (err) {
172
- // Never fail the install — the plugin's module-level auto-fix will retry on load.
173
- log(`Auto-configuration failed: ${err instanceof Error ? err.message : String(err)}`);
174
- log(`The plugin will retry on first load. If it still fails, run:`);
175
- log(` openclaw config set plugins.entries.principles-disciple.hooks.allowConversationAccess true`);
176
- process.exit(0);
177
- }