@wundr.io/cli 1.0.11 → 1.0.12

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 (269) hide show
  1. package/bin/wundr.js +8 -4
  2. package/package.json +23 -23
  3. package/src/ai/ai-service.ts +16 -17
  4. package/src/ai/claude-client.ts +16 -16
  5. package/src/ai/conversation-manager.ts +29 -29
  6. package/src/cli.ts +4 -4
  7. package/src/commands/ai.ts +246 -78
  8. package/src/commands/alignment.ts +74 -74
  9. package/src/commands/analyze-optimized.ts +111 -78
  10. package/src/commands/analyze.ts +14 -14
  11. package/src/commands/batch.ts +179 -42
  12. package/src/commands/chat.ts +37 -30
  13. package/src/commands/claude-init.ts +41 -45
  14. package/src/commands/claude-setup.ts +204 -119
  15. package/src/commands/computer-setup.ts +85 -43
  16. package/src/commands/create-command.ts +4 -4
  17. package/src/commands/create.ts +27 -27
  18. package/src/commands/dashboard.ts +24 -24
  19. package/src/commands/govern.ts +25 -25
  20. package/src/commands/governance.ts +34 -34
  21. package/src/commands/guardian.ts +56 -56
  22. package/src/commands/init.ts +25 -22
  23. package/src/commands/orchestrator.ts +68 -41
  24. package/src/commands/performance-optimizer.ts +34 -35
  25. package/src/commands/plugins.ts +27 -27
  26. package/src/commands/project-update.ts +175 -72
  27. package/src/commands/rag.ts +185 -78
  28. package/src/commands/session.ts +35 -35
  29. package/src/commands/setup.ts +40 -344
  30. package/src/commands/test-init.ts +3 -3
  31. package/src/commands/test.ts +4 -4
  32. package/src/commands/watch.ts +28 -29
  33. package/src/commands/worktree.ts +49 -49
  34. package/src/context/context-manager.ts +10 -10
  35. package/src/context/session-manager.ts +41 -41
  36. package/src/framework/command-interface.ts +520 -0
  37. package/src/framework/command-registry.ts +942 -0
  38. package/src/framework/completion-exporter.ts +383 -0
  39. package/src/framework/debug-logger.ts +519 -0
  40. package/src/framework/error-handler.ts +867 -0
  41. package/src/framework/help-generator.ts +540 -0
  42. package/src/framework/index.ts +169 -0
  43. package/src/framework/interactive-repl.ts +703 -0
  44. package/src/framework/output-formatter.ts +834 -0
  45. package/src/framework/progress-manager.ts +539 -0
  46. package/src/index.ts +4 -4
  47. package/src/interactive/interactive-mode.ts +16 -16
  48. package/src/lib/conflict-resolution.ts +799 -9
  49. package/src/lib/merge-strategy.ts +529 -7
  50. package/src/lib/safety-mechanisms.ts +422 -18
  51. package/src/lib/state-detection.ts +1015 -13
  52. package/src/nlp/command-mapper.ts +29 -29
  53. package/src/nlp/command-parser.ts +17 -17
  54. package/src/nlp/intent-classifier.ts +7 -7
  55. package/src/nlp/intent-parser.ts +54 -52
  56. package/src/plugins/plugin-manager.ts +61 -39
  57. package/src/tests/computer-setup-integration.test.ts +46 -15
  58. package/src/types/modules.d.ts +424 -1
  59. package/src/utils/backup-rollback-manager.ts +11 -8
  60. package/src/utils/config-manager.ts +3 -3
  61. package/src/utils/error-handler.ts +2 -2
  62. package/src/utils/logger.ts +22 -22
  63. package/templates/batch/ci-cd.yaml +7 -7
  64. package/test-suites/api/health.spec.ts +20 -23
  65. package/test-suites/helpers/test-config.ts +14 -13
  66. package/test-suites/ui/accessibility.spec.ts +27 -22
  67. package/test-suites/ui/smoke.spec.ts +26 -21
  68. package/LICENSE +0 -21
  69. package/dist/ai/ai-service.d.ts +0 -152
  70. package/dist/ai/ai-service.d.ts.map +0 -1
  71. package/dist/ai/ai-service.js +0 -430
  72. package/dist/ai/ai-service.js.map +0 -1
  73. package/dist/ai/claude-client.d.ts +0 -130
  74. package/dist/ai/claude-client.d.ts.map +0 -1
  75. package/dist/ai/claude-client.js +0 -340
  76. package/dist/ai/claude-client.js.map +0 -1
  77. package/dist/ai/conversation-manager.d.ts +0 -164
  78. package/dist/ai/conversation-manager.d.ts.map +0 -1
  79. package/dist/ai/conversation-manager.js +0 -614
  80. package/dist/ai/conversation-manager.js.map +0 -1
  81. package/dist/ai/index.d.ts +0 -5
  82. package/dist/ai/index.d.ts.map +0 -1
  83. package/dist/ai/index.js +0 -8
  84. package/dist/ai/index.js.map +0 -1
  85. package/dist/cli.d.ts +0 -36
  86. package/dist/cli.d.ts.map +0 -1
  87. package/dist/cli.js +0 -192
  88. package/dist/cli.js.map +0 -1
  89. package/dist/commands/ai.d.ts +0 -89
  90. package/dist/commands/ai.d.ts.map +0 -1
  91. package/dist/commands/ai.js +0 -799
  92. package/dist/commands/ai.js.map +0 -1
  93. package/dist/commands/alignment.d.ts +0 -78
  94. package/dist/commands/alignment.d.ts.map +0 -1
  95. package/dist/commands/alignment.js +0 -817
  96. package/dist/commands/alignment.js.map +0 -1
  97. package/dist/commands/analyze-optimized.d.ts +0 -14
  98. package/dist/commands/analyze-optimized.d.ts.map +0 -1
  99. package/dist/commands/analyze-optimized.js +0 -600
  100. package/dist/commands/analyze-optimized.js.map +0 -1
  101. package/dist/commands/analyze.d.ts +0 -65
  102. package/dist/commands/analyze.d.ts.map +0 -1
  103. package/dist/commands/analyze.js +0 -435
  104. package/dist/commands/analyze.js.map +0 -1
  105. package/dist/commands/batch.d.ts +0 -71
  106. package/dist/commands/batch.d.ts.map +0 -1
  107. package/dist/commands/batch.js +0 -738
  108. package/dist/commands/batch.js.map +0 -1
  109. package/dist/commands/chat.d.ts +0 -71
  110. package/dist/commands/chat.d.ts.map +0 -1
  111. package/dist/commands/chat.js +0 -674
  112. package/dist/commands/chat.js.map +0 -1
  113. package/dist/commands/claude-init.d.ts +0 -28
  114. package/dist/commands/claude-init.d.ts.map +0 -1
  115. package/dist/commands/claude-init.js +0 -591
  116. package/dist/commands/claude-init.js.map +0 -1
  117. package/dist/commands/claude-setup.d.ts +0 -119
  118. package/dist/commands/claude-setup.d.ts.map +0 -1
  119. package/dist/commands/claude-setup.js +0 -1073
  120. package/dist/commands/claude-setup.js.map +0 -1
  121. package/dist/commands/computer-setup-commands.d.ts +0 -53
  122. package/dist/commands/computer-setup-commands.d.ts.map +0 -1
  123. package/dist/commands/computer-setup-commands.js +0 -705
  124. package/dist/commands/computer-setup-commands.js.map +0 -1
  125. package/dist/commands/computer-setup.d.ts +0 -7
  126. package/dist/commands/computer-setup.d.ts.map +0 -1
  127. package/dist/commands/computer-setup.js +0 -849
  128. package/dist/commands/computer-setup.js.map +0 -1
  129. package/dist/commands/create-command.d.ts +0 -7
  130. package/dist/commands/create-command.d.ts.map +0 -1
  131. package/dist/commands/create-command.js +0 -158
  132. package/dist/commands/create-command.js.map +0 -1
  133. package/dist/commands/create.d.ts +0 -74
  134. package/dist/commands/create.d.ts.map +0 -1
  135. package/dist/commands/create.js +0 -556
  136. package/dist/commands/create.js.map +0 -1
  137. package/dist/commands/dashboard.d.ts +0 -91
  138. package/dist/commands/dashboard.d.ts.map +0 -1
  139. package/dist/commands/dashboard.js +0 -538
  140. package/dist/commands/dashboard.js.map +0 -1
  141. package/dist/commands/govern.d.ts +0 -70
  142. package/dist/commands/govern.d.ts.map +0 -1
  143. package/dist/commands/govern.js +0 -481
  144. package/dist/commands/govern.js.map +0 -1
  145. package/dist/commands/governance.d.ts +0 -17
  146. package/dist/commands/governance.d.ts.map +0 -1
  147. package/dist/commands/governance.js +0 -703
  148. package/dist/commands/governance.js.map +0 -1
  149. package/dist/commands/guardian.d.ts +0 -20
  150. package/dist/commands/guardian.d.ts.map +0 -1
  151. package/dist/commands/guardian.js +0 -597
  152. package/dist/commands/guardian.js.map +0 -1
  153. package/dist/commands/init.d.ts +0 -59
  154. package/dist/commands/init.d.ts.map +0 -1
  155. package/dist/commands/init.js +0 -650
  156. package/dist/commands/init.js.map +0 -1
  157. package/dist/commands/orchestrator.d.ts +0 -7
  158. package/dist/commands/orchestrator.d.ts.map +0 -1
  159. package/dist/commands/orchestrator.js +0 -571
  160. package/dist/commands/orchestrator.js.map +0 -1
  161. package/dist/commands/performance-optimizer.d.ts +0 -30
  162. package/dist/commands/performance-optimizer.d.ts.map +0 -1
  163. package/dist/commands/performance-optimizer.js +0 -650
  164. package/dist/commands/performance-optimizer.js.map +0 -1
  165. package/dist/commands/plugins.d.ts +0 -87
  166. package/dist/commands/plugins.d.ts.map +0 -1
  167. package/dist/commands/plugins.js +0 -685
  168. package/dist/commands/plugins.js.map +0 -1
  169. package/dist/commands/rag.d.ts +0 -7
  170. package/dist/commands/rag.d.ts.map +0 -1
  171. package/dist/commands/rag.js +0 -748
  172. package/dist/commands/rag.js.map +0 -1
  173. package/dist/commands/session.d.ts +0 -41
  174. package/dist/commands/session.d.ts.map +0 -1
  175. package/dist/commands/session.js +0 -441
  176. package/dist/commands/session.js.map +0 -1
  177. package/dist/commands/setup.d.ts +0 -29
  178. package/dist/commands/setup.d.ts.map +0 -1
  179. package/dist/commands/setup.js +0 -397
  180. package/dist/commands/setup.js.map +0 -1
  181. package/dist/commands/test-init.d.ts +0 -9
  182. package/dist/commands/test-init.d.ts.map +0 -1
  183. package/dist/commands/test-init.js +0 -222
  184. package/dist/commands/test-init.js.map +0 -1
  185. package/dist/commands/test.d.ts +0 -25
  186. package/dist/commands/test.d.ts.map +0 -1
  187. package/dist/commands/test.js +0 -217
  188. package/dist/commands/test.js.map +0 -1
  189. package/dist/commands/vp.d.ts +0 -7
  190. package/dist/commands/vp.d.ts.map +0 -1
  191. package/dist/commands/vp.js +0 -571
  192. package/dist/commands/vp.js.map +0 -1
  193. package/dist/commands/watch.d.ts +0 -76
  194. package/dist/commands/watch.d.ts.map +0 -1
  195. package/dist/commands/watch.js +0 -613
  196. package/dist/commands/watch.js.map +0 -1
  197. package/dist/commands/worktree.d.ts +0 -63
  198. package/dist/commands/worktree.d.ts.map +0 -1
  199. package/dist/commands/worktree.js +0 -774
  200. package/dist/commands/worktree.js.map +0 -1
  201. package/dist/context/context-manager.d.ts +0 -155
  202. package/dist/context/context-manager.d.ts.map +0 -1
  203. package/dist/context/context-manager.js +0 -383
  204. package/dist/context/context-manager.js.map +0 -1
  205. package/dist/context/index.d.ts +0 -3
  206. package/dist/context/index.d.ts.map +0 -1
  207. package/dist/context/index.js +0 -6
  208. package/dist/context/index.js.map +0 -1
  209. package/dist/context/session-manager.d.ts +0 -207
  210. package/dist/context/session-manager.d.ts.map +0 -1
  211. package/dist/context/session-manager.js +0 -686
  212. package/dist/context/session-manager.js.map +0 -1
  213. package/dist/index.d.ts +0 -8
  214. package/dist/index.d.ts.map +0 -1
  215. package/dist/index.js +0 -51
  216. package/dist/index.js.map +0 -1
  217. package/dist/interactive/interactive-mode.d.ts +0 -76
  218. package/dist/interactive/interactive-mode.d.ts.map +0 -1
  219. package/dist/interactive/interactive-mode.js +0 -732
  220. package/dist/interactive/interactive-mode.js.map +0 -1
  221. package/dist/nlp/command-mapper.d.ts +0 -174
  222. package/dist/nlp/command-mapper.d.ts.map +0 -1
  223. package/dist/nlp/command-mapper.js +0 -624
  224. package/dist/nlp/command-mapper.js.map +0 -1
  225. package/dist/nlp/command-parser.d.ts +0 -106
  226. package/dist/nlp/command-parser.d.ts.map +0 -1
  227. package/dist/nlp/command-parser.js +0 -417
  228. package/dist/nlp/command-parser.js.map +0 -1
  229. package/dist/nlp/index.d.ts +0 -5
  230. package/dist/nlp/index.d.ts.map +0 -1
  231. package/dist/nlp/index.js +0 -8
  232. package/dist/nlp/index.js.map +0 -1
  233. package/dist/nlp/intent-classifier.d.ts +0 -59
  234. package/dist/nlp/intent-classifier.d.ts.map +0 -1
  235. package/dist/nlp/intent-classifier.js +0 -384
  236. package/dist/nlp/intent-classifier.js.map +0 -1
  237. package/dist/nlp/intent-parser.d.ts +0 -152
  238. package/dist/nlp/intent-parser.d.ts.map +0 -1
  239. package/dist/nlp/intent-parser.js +0 -744
  240. package/dist/nlp/intent-parser.js.map +0 -1
  241. package/dist/plugins/plugin-manager.d.ts +0 -120
  242. package/dist/plugins/plugin-manager.d.ts.map +0 -1
  243. package/dist/plugins/plugin-manager.js +0 -595
  244. package/dist/plugins/plugin-manager.js.map +0 -1
  245. package/dist/types/index.d.ts +0 -224
  246. package/dist/types/index.d.ts.map +0 -1
  247. package/dist/types/index.js +0 -3
  248. package/dist/types/index.js.map +0 -1
  249. package/dist/utils/backup-rollback-manager.d.ts +0 -72
  250. package/dist/utils/backup-rollback-manager.d.ts.map +0 -1
  251. package/dist/utils/backup-rollback-manager.js +0 -289
  252. package/dist/utils/backup-rollback-manager.js.map +0 -1
  253. package/dist/utils/claude-config-installer.d.ts +0 -98
  254. package/dist/utils/claude-config-installer.d.ts.map +0 -1
  255. package/dist/utils/claude-config-installer.js +0 -678
  256. package/dist/utils/claude-config-installer.js.map +0 -1
  257. package/dist/utils/config-manager.d.ts +0 -73
  258. package/dist/utils/config-manager.d.ts.map +0 -1
  259. package/dist/utils/config-manager.js +0 -339
  260. package/dist/utils/config-manager.js.map +0 -1
  261. package/dist/utils/error-handler.d.ts +0 -46
  262. package/dist/utils/error-handler.d.ts.map +0 -1
  263. package/dist/utils/error-handler.js +0 -169
  264. package/dist/utils/error-handler.js.map +0 -1
  265. package/dist/utils/logger.d.ts +0 -25
  266. package/dist/utils/logger.d.ts.map +0 -1
  267. package/dist/utils/logger.js +0 -105
  268. package/dist/utils/logger.js.map +0 -1
  269. package/src/commands/computer-setup-commands.ts +0 -872
@@ -1,817 +0,0 @@
1
- "use strict";
2
- /**
3
- * Alignment Monitoring CLI Commands
4
- *
5
- * Provides commands for monitoring AI agent alignment drift across five dimensions:
6
- * - Policy Violation Rate
7
- * - Intent-Outcome Gap
8
- * - Evaluator Disagreement
9
- * - Escalation Suppression
10
- * - Reward Hacking
11
- */
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.createAlignmentCommand = createAlignmentCommand;
14
- const tslib_1 = require("tslib");
15
- const os = tslib_1.__importStar(require("os"));
16
- const path = tslib_1.__importStar(require("path"));
17
- const chalk_1 = tslib_1.__importDefault(require("chalk"));
18
- const commander_1 = require("commander");
19
- const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
20
- const ora_1 = tslib_1.__importDefault(require("ora"));
21
- // ============================================================================
22
- // AlignmentDriftDetector - Embedded Implementation
23
- // ============================================================================
24
- class AlignmentDriftDetector {
25
- dataDir;
26
- historyFile;
27
- // Thresholds from Three-Tier Architecture spec
28
- thresholds = {
29
- policyViolation: 0.005, // >0.5% daily violations triggers alert
30
- intentOutcomeGap: 0.15, // >15% divergence is concerning
31
- evaluatorDisagreement: 0.2, // >20% monthly overrides
32
- escalationSuppression: 0.4, // >40% drop from baseline
33
- rewardHacking: 5, // >5 instances/month
34
- };
35
- constructor(dataDir) {
36
- this.dataDir = dataDir || path.join(os.homedir(), '.wundr', 'alignment');
37
- this.historyFile = path.join(this.dataDir, 'history.json');
38
- }
39
- async initialize() {
40
- await fs_extra_1.default.ensureDir(this.dataDir);
41
- if (!(await fs_extra_1.default.pathExists(this.historyFile))) {
42
- await fs_extra_1.default.writeJson(this.historyFile, { entries: [] }, { spaces: 2 });
43
- }
44
- }
45
- async calculateAlignmentDebt(sessionId) {
46
- const metrics = await this.collectMetrics(sessionId);
47
- return this.calculateScore(metrics);
48
- }
49
- async getAlignmentReport(sessionId) {
50
- await this.initialize();
51
- const metrics = await this.collectMetrics(sessionId);
52
- const score = this.calculateScore(metrics);
53
- const status = this.determineStatus(score);
54
- const dimensions = this.analyzeDimensions(metrics);
55
- const recommendations = this.generateRecommendations(dimensions, status);
56
- const report = {
57
- timestamp: new Date().toISOString(),
58
- sessionId,
59
- overallScore: score,
60
- status,
61
- metrics,
62
- dimensions,
63
- recommendations,
64
- };
65
- // Store in history
66
- await this.storeHistoryEntry({
67
- timestamp: report.timestamp,
68
- sessionId,
69
- score,
70
- status,
71
- metrics,
72
- });
73
- return report;
74
- }
75
- async getAlignmentScore(sessionId) {
76
- const score = await this.calculateAlignmentDebt(sessionId);
77
- const status = this.determineStatus(score);
78
- return {
79
- score,
80
- status,
81
- color: status === 'healthy'
82
- ? 'green'
83
- : status === 'warning'
84
- ? 'yellow'
85
- : 'red',
86
- };
87
- }
88
- async getHistory(days = 30) {
89
- await this.initialize();
90
- const history = await this.loadHistory();
91
- const cutoffDate = new Date();
92
- cutoffDate.setDate(cutoffDate.getDate() - days);
93
- return history.entries
94
- .filter((entry) => new Date(entry.timestamp) >= cutoffDate)
95
- .sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime());
96
- }
97
- async getDimensionBreakdown() {
98
- const metrics = await this.collectMetrics();
99
- return this.analyzeDimensions(metrics);
100
- }
101
- async generateDebtReport(days = 7, sessionId, outputFile) {
102
- await this.initialize();
103
- const history = await this.getHistory(days);
104
- const filteredHistory = sessionId
105
- ? history.filter(h => h.sessionId === sessionId)
106
- : history;
107
- const endDate = new Date();
108
- const startDate = new Date();
109
- startDate.setDate(startDate.getDate() - days);
110
- // Calculate summary statistics
111
- const scores = filteredHistory.map(h => h.score);
112
- const averageScore = scores.length > 0
113
- ? scores.reduce((a, b) => a + b, 0) / scores.length
114
- : 100;
115
- const lowestScore = scores.length > 0 ? Math.min(...scores) : 100;
116
- const highestScore = scores.length > 0 ? Math.max(...scores) : 100;
117
- // Calculate trend
118
- let trend = 'stable';
119
- if (scores.length >= 2) {
120
- const firstHalf = scores.slice(0, Math.floor(scores.length / 2));
121
- const secondHalf = scores.slice(Math.floor(scores.length / 2));
122
- const firstAvg = firstHalf.reduce((a, b) => a + b, 0) / firstHalf.length;
123
- const secondAvg = secondHalf.reduce((a, b) => a + b, 0) / secondHalf.length;
124
- if (secondAvg > firstAvg + 5) {
125
- trend = 'improving';
126
- }
127
- else if (secondAvg < firstAvg - 5) {
128
- trend = 'degrading';
129
- }
130
- }
131
- // Analyze dimensions across history
132
- const dimensionAnalysis = {};
133
- const dimensionKeys = [
134
- 'policyViolationRate',
135
- 'intentOutcomeGap',
136
- 'evaluatorDisagreement',
137
- 'escalationSuppression',
138
- 'rewardHacking',
139
- ];
140
- for (const key of dimensionKeys) {
141
- const values = filteredHistory.map(h => h.metrics[key]);
142
- const threshold = this.getThresholdForKey(key);
143
- dimensionAnalysis[key] = {
144
- average: values.length > 0
145
- ? values.reduce((a, b) => a + b, 0) / values.length
146
- : 0,
147
- max: values.length > 0 ? Math.max(...values) : 0,
148
- exceedances: values.filter(v => v > threshold).length,
149
- };
150
- }
151
- // Find critical events
152
- const criticalEvents = [];
153
- for (const entry of filteredHistory) {
154
- for (const key of dimensionKeys) {
155
- const threshold = this.getThresholdForKey(key);
156
- if (entry.metrics[key] > threshold * 2) {
157
- criticalEvents.push({
158
- timestamp: entry.timestamp,
159
- dimension: key,
160
- value: entry.metrics[key],
161
- threshold,
162
- });
163
- }
164
- }
165
- }
166
- // Calculate total violations
167
- const totalViolations = Object.values(dimensionAnalysis).reduce((sum, dim) => sum + dim.exceedances, 0);
168
- // Generate recommendations
169
- const recommendations = this.generateDebtRecommendations(dimensionAnalysis, trend);
170
- const report = {
171
- generatedAt: new Date().toISOString(),
172
- period: {
173
- start: startDate.toISOString(),
174
- end: endDate.toISOString(),
175
- days,
176
- },
177
- summary: {
178
- averageScore,
179
- lowestScore,
180
- highestScore,
181
- trend,
182
- totalViolations,
183
- },
184
- dimensionAnalysis,
185
- criticalEvents: criticalEvents.slice(0, 20),
186
- recommendations,
187
- };
188
- if (outputFile) {
189
- await fs_extra_1.default.writeJson(outputFile, report, { spaces: 2 });
190
- }
191
- return report;
192
- }
193
- getThresholds() {
194
- return { ...this.thresholds };
195
- }
196
- async collectMetrics(sessionId) {
197
- const sessionMetricsFile = sessionId
198
- ? path.join(this.dataDir, 'sessions', `${sessionId}.json`)
199
- : path.join(this.dataDir, 'current-metrics.json');
200
- if (await fs_extra_1.default.pathExists(sessionMetricsFile)) {
201
- try {
202
- const data = await fs_extra_1.default.readJson(sessionMetricsFile);
203
- return {
204
- policyViolationRate: data.policyViolationRate ?? 0,
205
- intentOutcomeGap: data.intentOutcomeGap ?? 0,
206
- evaluatorDisagreement: data.evaluatorDisagreement ?? 0,
207
- escalationSuppression: data.escalationSuppression ?? 0,
208
- rewardHacking: data.rewardHacking ?? 0,
209
- };
210
- }
211
- catch {
212
- // Fall through to defaults
213
- }
214
- }
215
- return {
216
- policyViolationRate: 0,
217
- intentOutcomeGap: 0,
218
- evaluatorDisagreement: 0,
219
- escalationSuppression: 0,
220
- rewardHacking: 0,
221
- };
222
- }
223
- calculateScore(metrics) {
224
- const normalizedPolicyViolation = Math.min(metrics.policyViolationRate / this.thresholds.policyViolation, 2);
225
- const normalizedIntentGap = Math.min(metrics.intentOutcomeGap / this.thresholds.intentOutcomeGap, 2);
226
- const normalizedEvaluatorDisagreement = Math.min(metrics.evaluatorDisagreement / this.thresholds.evaluatorDisagreement, 2);
227
- const normalizedEscalationSuppression = Math.min(metrics.escalationSuppression / this.thresholds.escalationSuppression, 2);
228
- const normalizedRewardHacking = Math.min(metrics.rewardHacking / this.thresholds.rewardHacking, 2);
229
- const weights = {
230
- policyViolation: 0.25,
231
- intentOutcomeGap: 0.25,
232
- evaluatorDisagreement: 0.2,
233
- escalationSuppression: 0.15,
234
- rewardHacking: 0.15,
235
- };
236
- const penalty = normalizedPolicyViolation * weights.policyViolation +
237
- normalizedIntentGap * weights.intentOutcomeGap +
238
- normalizedEvaluatorDisagreement * weights.evaluatorDisagreement +
239
- normalizedEscalationSuppression * weights.escalationSuppression +
240
- normalizedRewardHacking * weights.rewardHacking;
241
- const score = Math.max(0, Math.min(100, 100 - penalty * 50));
242
- return Math.round(score * 10) / 10;
243
- }
244
- determineStatus(score) {
245
- if (score >= 80) {
246
- return 'healthy';
247
- }
248
- if (score >= 50) {
249
- return 'warning';
250
- }
251
- return 'critical';
252
- }
253
- analyzeDimensions(metrics) {
254
- return [
255
- {
256
- name: 'Policy Violation Rate',
257
- key: 'policyViolationRate',
258
- threshold: this.thresholds.policyViolation,
259
- description: 'Percentage of actions violating defined constraints',
260
- currentValue: metrics.policyViolationRate,
261
- status: this.getDimensionStatus(metrics.policyViolationRate, this.thresholds.policyViolation),
262
- },
263
- {
264
- name: 'Intent-Outcome Gap',
265
- key: 'intentOutcomeGap',
266
- threshold: this.thresholds.intentOutcomeGap,
267
- description: 'Divergence between stated goals and actual outcomes',
268
- currentValue: metrics.intentOutcomeGap,
269
- status: this.getDimensionStatus(metrics.intentOutcomeGap, this.thresholds.intentOutcomeGap),
270
- },
271
- {
272
- name: 'Evaluator Disagreement',
273
- key: 'evaluatorDisagreement',
274
- threshold: this.thresholds.evaluatorDisagreement,
275
- description: 'Rate of human overrides on agent decisions',
276
- currentValue: metrics.evaluatorDisagreement,
277
- status: this.getDimensionStatus(metrics.evaluatorDisagreement, this.thresholds.evaluatorDisagreement),
278
- },
279
- {
280
- name: 'Escalation Suppression',
281
- key: 'escalationSuppression',
282
- threshold: this.thresholds.escalationSuppression,
283
- description: 'Drop in escalation triggers compared to baseline',
284
- currentValue: metrics.escalationSuppression,
285
- status: this.getDimensionStatus(metrics.escalationSuppression, this.thresholds.escalationSuppression),
286
- },
287
- {
288
- name: 'Reward Hacking',
289
- key: 'rewardHacking',
290
- threshold: this.thresholds.rewardHacking,
291
- description: 'Instances of gaming metrics without achieving intent',
292
- currentValue: metrics.rewardHacking,
293
- status: this.getDimensionStatus(metrics.rewardHacking, this.thresholds.rewardHacking),
294
- },
295
- ];
296
- }
297
- getDimensionStatus(value, threshold) {
298
- if (value <= threshold) {
299
- return 'healthy';
300
- }
301
- if (value <= threshold * 2) {
302
- return 'warning';
303
- }
304
- return 'critical';
305
- }
306
- getThresholdForKey(key) {
307
- const thresholdMap = {
308
- policyViolationRate: this.thresholds.policyViolation,
309
- intentOutcomeGap: this.thresholds.intentOutcomeGap,
310
- evaluatorDisagreement: this.thresholds.evaluatorDisagreement,
311
- escalationSuppression: this.thresholds.escalationSuppression,
312
- rewardHacking: this.thresholds.rewardHacking,
313
- };
314
- return thresholdMap[key];
315
- }
316
- generateRecommendations(dimensions, status) {
317
- const recommendations = [];
318
- for (const dim of dimensions) {
319
- if (dim.status === 'critical') {
320
- recommendations.push(`CRITICAL: ${dim.name} at ${this.formatValue(dim.currentValue, dim.key)} exceeds threshold (${this.formatValue(dim.threshold, dim.key)}). Immediate action required.`);
321
- }
322
- else if (dim.status === 'warning') {
323
- recommendations.push(`WARNING: ${dim.name} at ${this.formatValue(dim.currentValue, dim.key)} approaching threshold (${this.formatValue(dim.threshold, dim.key)}). Monitor closely.`);
324
- }
325
- }
326
- if (status === 'critical') {
327
- recommendations.push('Consider pausing autonomous operations until alignment issues are resolved.');
328
- recommendations.push('Schedule immediate review with Guardian role.');
329
- }
330
- else if (status === 'warning') {
331
- recommendations.push('Review recent agent decisions for potential alignment drift.');
332
- recommendations.push('Consider tightening constraints or adding checkpoints.');
333
- }
334
- if (recommendations.length === 0) {
335
- recommendations.push('All alignment metrics within acceptable thresholds.');
336
- }
337
- return recommendations;
338
- }
339
- generateDebtRecommendations(dimensionAnalysis, trend) {
340
- const recommendations = [];
341
- if (trend === 'degrading') {
342
- recommendations.push('Alignment score is degrading over time. Review recent changes to agent configurations.');
343
- }
344
- else if (trend === 'improving') {
345
- recommendations.push('Alignment score is improving. Continue current governance practices.');
346
- }
347
- for (const [key, analysis] of Object.entries(dimensionAnalysis)) {
348
- if (analysis.exceedances > 0) {
349
- const friendlyName = this.getFriendlyDimensionName(key);
350
- const entry = analysis;
351
- recommendations.push(`${friendlyName}: ${entry.exceedances} threshold exceedance(s) detected. Average: ${entry.average.toFixed(3)}`);
352
- }
353
- }
354
- return recommendations;
355
- }
356
- getFriendlyDimensionName(key) {
357
- const names = {
358
- policyViolationRate: 'Policy Violation Rate',
359
- intentOutcomeGap: 'Intent-Outcome Gap',
360
- evaluatorDisagreement: 'Evaluator Disagreement',
361
- escalationSuppression: 'Escalation Suppression',
362
- rewardHacking: 'Reward Hacking',
363
- };
364
- return names[key] || key;
365
- }
366
- formatValue(value, key) {
367
- if (key === 'rewardHacking') {
368
- return `${value} instances`;
369
- }
370
- return `${(value * 100).toFixed(1)}%`;
371
- }
372
- async storeHistoryEntry(entry) {
373
- const history = await this.loadHistory();
374
- history.entries.push(entry);
375
- if (history.entries.length > 1000) {
376
- history.entries = history.entries.slice(-1000);
377
- }
378
- await fs_extra_1.default.writeJson(this.historyFile, history, { spaces: 2 });
379
- }
380
- async loadHistory() {
381
- try {
382
- if (await fs_extra_1.default.pathExists(this.historyFile)) {
383
- return await fs_extra_1.default.readJson(this.historyFile);
384
- }
385
- }
386
- catch {
387
- // Fall through to default
388
- }
389
- return { entries: [] };
390
- }
391
- }
392
- // ============================================================================
393
- // Utility Functions
394
- // ============================================================================
395
- function padRight(str, length) {
396
- return str.length >= length
397
- ? str.substring(0, length)
398
- : str + ' '.repeat(length - str.length);
399
- }
400
- function getStatusColor(status) {
401
- switch (status) {
402
- case 'healthy':
403
- return chalk_1.default.green;
404
- case 'warning':
405
- return chalk_1.default.yellow;
406
- case 'critical':
407
- return chalk_1.default.red;
408
- default:
409
- return chalk_1.default.white;
410
- }
411
- }
412
- function getStatusIcon(status) {
413
- switch (status) {
414
- case 'healthy':
415
- return '[HEALTHY]';
416
- case 'warning':
417
- return '[WARNING]';
418
- case 'critical':
419
- return '[CRITICAL]';
420
- default:
421
- return '[UNKNOWN]';
422
- }
423
- }
424
- function formatScore(score) {
425
- if (score >= 80) {
426
- return chalk_1.default.green(`${score.toFixed(1)}/100`);
427
- }
428
- if (score >= 50) {
429
- return chalk_1.default.yellow(`${score.toFixed(1)}/100`);
430
- }
431
- return chalk_1.default.red(`${score.toFixed(1)}/100`);
432
- }
433
- function formatTrend(trend) {
434
- switch (trend) {
435
- case 'improving':
436
- return chalk_1.default.green('Improving [^]');
437
- case 'degrading':
438
- return chalk_1.default.red('Degrading [v]');
439
- case 'stable':
440
- return chalk_1.default.gray('Stable [-]');
441
- default:
442
- return chalk_1.default.gray('Unknown');
443
- }
444
- }
445
- function formatPercentage(value) {
446
- return `${(value * 100).toFixed(2)}%`;
447
- }
448
- function formatDimensionValue(value, key) {
449
- if (key === 'rewardHacking') {
450
- return `${value} instances`;
451
- }
452
- return formatPercentage(value);
453
- }
454
- // ============================================================================
455
- // Command Factory
456
- // ============================================================================
457
- /**
458
- * Create the alignment command with subcommands
459
- */
460
- function createAlignmentCommand() {
461
- const command = new commander_1.Command('alignment')
462
- .description('Alignment drift monitoring and reporting')
463
- .addHelpText('after', chalk_1.default.gray(`
464
- Examples:
465
- ${chalk_1.default.green('wundr alignment report')} Generate alignment debt report
466
- ${chalk_1.default.green('wundr alignment score')} Get current alignment score
467
- ${chalk_1.default.green('wundr alignment history --days 7')} Show alignment history for past week
468
- ${chalk_1.default.green('wundr alignment dimensions')} Show breakdown by dimension
469
- `));
470
- // Report subcommand
471
- command
472
- .command('report')
473
- .description('Generate alignment debt report')
474
- .option('-s, --session <id>', 'Filter by session ID')
475
- .option('-d, --days <n>', 'Number of days to analyze', '7')
476
- .option('-o, --output <file>', 'Output file path for JSON report')
477
- .action(async (options) => {
478
- await generateAlignmentReport(options);
479
- });
480
- // Score subcommand
481
- command
482
- .command('score')
483
- .description('Get current alignment score')
484
- .option('-s, --session <id>', 'Get score for specific session')
485
- .action(async (options) => {
486
- await showAlignmentScore(options);
487
- });
488
- // History subcommand
489
- command
490
- .command('history')
491
- .description('Show alignment history')
492
- .option('-d, --days <n>', 'Number of days to show', '30')
493
- .option('-f, --format <type>', 'Output format (table, json, chart)', 'table')
494
- .action(async (options) => {
495
- await showAlignmentHistory(options);
496
- });
497
- // Dimensions subcommand
498
- command
499
- .command('dimensions')
500
- .description('Show breakdown by dimension')
501
- .option('-s, --session <id>', 'Get dimensions for specific session')
502
- .action(async (options) => {
503
- await showDimensionBreakdown(options);
504
- });
505
- return command;
506
- }
507
- // ============================================================================
508
- // Command Implementations
509
- // ============================================================================
510
- async function generateAlignmentReport(options) {
511
- const spinner = (0, ora_1.default)('Generating alignment debt report...').start();
512
- try {
513
- const detector = new AlignmentDriftDetector();
514
- await detector.initialize();
515
- const days = parseInt(options.days || '7', 10);
516
- const report = await detector.generateDebtReport(days, options.session, options.output);
517
- spinner.stop();
518
- // Display report header
519
- console.log(chalk_1.default.cyan('\nAlignment Debt Report'));
520
- console.log(chalk_1.default.gray('='.repeat(70)));
521
- console.log(chalk_1.default.white('Generated: ') +
522
- chalk_1.default.gray(new Date(report.generatedAt).toLocaleString()));
523
- console.log(chalk_1.default.white('Period: ') +
524
- chalk_1.default.gray(`${days} days (${new Date(report.period.start).toLocaleDateString()} - ${new Date(report.period.end).toLocaleDateString()})`));
525
- if (options.session) {
526
- console.log(chalk_1.default.white('Session: ') + chalk_1.default.gray(options.session));
527
- }
528
- // Summary section
529
- console.log(chalk_1.default.gray('\n' + '-'.repeat(70)));
530
- console.log(chalk_1.default.cyan('Summary'));
531
- console.log(chalk_1.default.white('Average Score: ') +
532
- formatScore(report.summary.averageScore));
533
- console.log(chalk_1.default.white('Lowest Score: ') +
534
- formatScore(report.summary.lowestScore));
535
- console.log(chalk_1.default.white('Highest Score: ') +
536
- formatScore(report.summary.highestScore));
537
- console.log(chalk_1.default.white('Trend: ') + formatTrend(report.summary.trend));
538
- console.log(chalk_1.default.white('Total Violations: ') +
539
- (report.summary.totalViolations > 0
540
- ? chalk_1.default.red(String(report.summary.totalViolations))
541
- : chalk_1.default.green('0')));
542
- // Dimension analysis section
543
- console.log(chalk_1.default.gray('\n' + '-'.repeat(70)));
544
- console.log(chalk_1.default.cyan('Dimension Analysis'));
545
- console.log(chalk_1.default.cyan(padRight('Dimension', 25) +
546
- padRight('Average', 12) +
547
- padRight('Max', 12) +
548
- padRight('Exceedances', 12)));
549
- console.log(chalk_1.default.gray('-'.repeat(61)));
550
- const dimensionNames = {
551
- policyViolationRate: 'Policy Violation Rate',
552
- intentOutcomeGap: 'Intent-Outcome Gap',
553
- evaluatorDisagreement: 'Evaluator Disagreement',
554
- escalationSuppression: 'Escalation Suppression',
555
- rewardHacking: 'Reward Hacking',
556
- };
557
- for (const [key, analysis] of Object.entries(report.dimensionAnalysis)) {
558
- const name = dimensionNames[key] || key;
559
- const entry = analysis;
560
- const exceedanceColor = entry.exceedances > 0 ? chalk_1.default.red : chalk_1.default.green;
561
- console.log(padRight(name, 25) +
562
- padRight(formatDimensionValue(entry.average, key), 12) +
563
- padRight(formatDimensionValue(entry.max, key), 12) +
564
- exceedanceColor(padRight(String(entry.exceedances), 12)));
565
- }
566
- // Critical events section
567
- if (report.criticalEvents.length > 0) {
568
- console.log(chalk_1.default.gray('\n' + '-'.repeat(70)));
569
- console.log(chalk_1.default.red('Critical Events'));
570
- for (const event of report.criticalEvents.slice(0, 5)) {
571
- const dimName = dimensionNames[event.dimension] || event.dimension;
572
- console.log(chalk_1.default.red(' [!] ') +
573
- chalk_1.default.gray(new Date(event.timestamp).toLocaleString()) +
574
- chalk_1.default.white(` ${dimName}: `) +
575
- chalk_1.default.red(formatDimensionValue(event.value, event.dimension)) +
576
- chalk_1.default.gray(` (threshold: ${formatDimensionValue(event.threshold, event.dimension)})`));
577
- }
578
- if (report.criticalEvents.length > 5) {
579
- console.log(chalk_1.default.gray(` ... and ${report.criticalEvents.length - 5} more`));
580
- }
581
- }
582
- // Recommendations section
583
- console.log(chalk_1.default.gray('\n' + '-'.repeat(70)));
584
- console.log(chalk_1.default.cyan('Recommendations'));
585
- for (const rec of report.recommendations) {
586
- const color = rec.startsWith('CRITICAL')
587
- ? chalk_1.default.red
588
- : rec.startsWith('WARNING')
589
- ? chalk_1.default.yellow
590
- : chalk_1.default.white;
591
- console.log(color(` - ${rec}`));
592
- }
593
- console.log(chalk_1.default.gray('='.repeat(70)));
594
- // Show output file if saved
595
- if (options.output) {
596
- console.log(chalk_1.default.green(`\nReport saved to: ${options.output}`));
597
- }
598
- console.log('');
599
- }
600
- catch (error) {
601
- spinner.fail('Failed to generate alignment report');
602
- console.error(chalk_1.default.red(error instanceof Error ? error.message : String(error)));
603
- }
604
- }
605
- async function showAlignmentScore(options) {
606
- const spinner = (0, ora_1.default)('Calculating alignment score...').start();
607
- try {
608
- const detector = new AlignmentDriftDetector();
609
- await detector.initialize();
610
- const result = await detector.getAlignmentScore(options.session);
611
- spinner.stop();
612
- console.log(chalk_1.default.cyan('\nAlignment Score'));
613
- console.log(chalk_1.default.gray('='.repeat(40)));
614
- // Large score display with color
615
- const scoreColor = result.color === 'green'
616
- ? chalk_1.default.green
617
- : result.color === 'yellow'
618
- ? chalk_1.default.yellow
619
- : chalk_1.default.red;
620
- const scoreDisplay = `
621
- ${scoreColor(' +-----------------+')}
622
- ${scoreColor(' | |')}
623
- ${scoreColor(' |')} ${chalk_1.default.bold(scoreColor(result.score.toFixed(1)))} ${scoreColor('|')}
624
- ${scoreColor(' |')} ${chalk_1.default.gray('/100')} ${scoreColor('|')}
625
- ${scoreColor(' | |')}
626
- ${scoreColor(' +-----------------+')}
627
- `;
628
- console.log(scoreDisplay);
629
- const statusColor = getStatusColor(result.status);
630
- console.log(chalk_1.default.white('Status: ') + statusColor(getStatusIcon(result.status)));
631
- if (options.session) {
632
- console.log(chalk_1.default.white('Session: ') + chalk_1.default.gray(options.session));
633
- }
634
- // Show quick dimension summary
635
- const report = await detector.getAlignmentReport(options.session);
636
- console.log(chalk_1.default.gray('\n' + '-'.repeat(40)));
637
- console.log(chalk_1.default.cyan('Quick Dimension Status'));
638
- for (const dim of report.dimensions) {
639
- const dimStatusColor = getStatusColor(dim.status);
640
- const icon = dim.status === 'healthy'
641
- ? '[OK]'
642
- : dim.status === 'warning'
643
- ? '[!]'
644
- : '[X]';
645
- console.log(dimStatusColor(` ${icon} `) +
646
- chalk_1.default.white(padRight(dim.name, 25)) +
647
- dimStatusColor(formatDimensionValue(dim.currentValue, dim.key)));
648
- }
649
- console.log(chalk_1.default.gray('='.repeat(40)));
650
- console.log('');
651
- }
652
- catch (error) {
653
- spinner.fail('Failed to get alignment score');
654
- console.error(chalk_1.default.red(error instanceof Error ? error.message : String(error)));
655
- }
656
- }
657
- async function showAlignmentHistory(options) {
658
- const spinner = (0, ora_1.default)('Loading alignment history...').start();
659
- try {
660
- const detector = new AlignmentDriftDetector();
661
- await detector.initialize();
662
- const days = parseInt(options.days || '30', 10);
663
- const history = await detector.getHistory(days);
664
- spinner.stop();
665
- if (options.format === 'json') {
666
- console.log(JSON.stringify({
667
- timestamp: new Date().toISOString(),
668
- days,
669
- count: history.length,
670
- entries: history,
671
- }, null, 2));
672
- return;
673
- }
674
- console.log(chalk_1.default.cyan('\nAlignment History'));
675
- console.log(chalk_1.default.gray('='.repeat(80)));
676
- console.log(chalk_1.default.gray(`Showing last ${days} days (${history.length} entries)`));
677
- if (history.length === 0) {
678
- console.log(chalk_1.default.yellow('\nNo alignment history found.'));
679
- console.log(chalk_1.default.gray('Run "wundr alignment score" to start tracking.'));
680
- console.log('');
681
- return;
682
- }
683
- if (options.format === 'chart') {
684
- displayHistoryChart(history);
685
- }
686
- else {
687
- // Table format (default)
688
- console.log(chalk_1.default.gray('\n' + '-'.repeat(80)));
689
- console.log(chalk_1.default.cyan(padRight('Timestamp', 22) +
690
- padRight('Score', 10) +
691
- padRight('Status', 12) +
692
- padRight('Session', 20) +
693
- padRight('Policy', 10)));
694
- console.log(chalk_1.default.gray('-'.repeat(80)));
695
- for (const entry of history.slice(0, 20)) {
696
- const statusColor = getStatusColor(entry.status);
697
- const timestamp = new Date(entry.timestamp).toLocaleString();
698
- console.log(padRight(timestamp, 22) +
699
- formatScore(entry.score).padEnd(19) + // Account for ANSI codes
700
- statusColor(padRight(getStatusIcon(entry.status), 12)) +
701
- chalk_1.default.gray(padRight(entry.sessionId || '-', 20)) +
702
- padRight(formatPercentage(entry.metrics.policyViolationRate), 10));
703
- }
704
- if (history.length > 20) {
705
- console.log(chalk_1.default.gray(`... and ${history.length - 20} more entries`));
706
- }
707
- }
708
- console.log(chalk_1.default.gray('='.repeat(80)));
709
- console.log('');
710
- }
711
- catch (error) {
712
- spinner.fail('Failed to load alignment history');
713
- console.error(chalk_1.default.red(error instanceof Error ? error.message : String(error)));
714
- }
715
- }
716
- function displayHistoryChart(history) {
717
- const chartHeight = 10;
718
- const chartWidth = Math.min(60, history.length);
719
- const step = Math.ceil(history.length / chartWidth);
720
- const sampledHistory = history
721
- .filter((_, i) => i % step === 0)
722
- .slice(0, chartWidth);
723
- console.log(chalk_1.default.gray('\n Score Trend:'));
724
- console.log(chalk_1.default.gray(' 100 |'));
725
- for (let row = chartHeight; row >= 0; row--) {
726
- const threshold = (row / chartHeight) * 100;
727
- let line = ` ${String(Math.round(threshold)).padStart(3)} |`;
728
- for (const entry of sampledHistory) {
729
- if (entry.score >= threshold &&
730
- entry.score < threshold + 100 / chartHeight) {
731
- const color = entry.score >= 80
732
- ? chalk_1.default.green
733
- : entry.score >= 50
734
- ? chalk_1.default.yellow
735
- : chalk_1.default.red;
736
- line += color('*');
737
- }
738
- else if (entry.score >= threshold) {
739
- line += chalk_1.default.gray('|');
740
- }
741
- else {
742
- line += ' ';
743
- }
744
- }
745
- console.log(line);
746
- }
747
- console.log(chalk_1.default.gray(' 0 +' + '-'.repeat(chartWidth)));
748
- console.log(chalk_1.default.gray(' ' +
749
- 'oldest'.padEnd(chartWidth / 2) +
750
- 'newest'.padStart(chartWidth / 2)));
751
- }
752
- async function showDimensionBreakdown(options) {
753
- const spinner = (0, ora_1.default)('Loading dimension breakdown...').start();
754
- try {
755
- const detector = new AlignmentDriftDetector();
756
- await detector.initialize();
757
- const dimensions = await detector.getDimensionBreakdown();
758
- const thresholds = detector.getThresholds();
759
- spinner.stop();
760
- console.log(chalk_1.default.cyan('\nAlignment Dimensions'));
761
- console.log(chalk_1.default.gray('='.repeat(90)));
762
- if (options.session) {
763
- console.log(chalk_1.default.white('Session: ') + chalk_1.default.gray(options.session));
764
- console.log('');
765
- }
766
- // Display each dimension in detail
767
- for (const dim of dimensions) {
768
- const statusColor = getStatusColor(dim.status);
769
- const icon = dim.status === 'healthy'
770
- ? '[OK]'
771
- : dim.status === 'warning'
772
- ? '[!!]'
773
- : '[XX]';
774
- console.log(chalk_1.default.gray('-'.repeat(90)));
775
- console.log(chalk_1.default.bold(statusColor(`${icon} ${dim.name}`)));
776
- console.log(chalk_1.default.gray(` ${dim.description}`));
777
- console.log('');
778
- // Value bar visualization
779
- const barWidth = 40;
780
- const valueRatio = Math.min(dim.currentValue / (dim.threshold * 3), 1);
781
- const thresholdPos = Math.floor((dim.threshold / (dim.threshold * 3)) * barWidth);
782
- const valuePos = Math.floor(valueRatio * barWidth);
783
- let bar = '';
784
- for (let i = 0; i < barWidth; i++) {
785
- if (i === thresholdPos) {
786
- bar += chalk_1.default.yellow('|');
787
- }
788
- else if (i < valuePos) {
789
- bar += statusColor('#');
790
- }
791
- else {
792
- bar += chalk_1.default.gray('-');
793
- }
794
- }
795
- console.log(` [${bar}]`);
796
- console.log(` ${chalk_1.default.white('Current:')} ${statusColor(formatDimensionValue(dim.currentValue, dim.key))} ${chalk_1.default.white('Threshold:')} ${chalk_1.default.yellow(formatDimensionValue(dim.threshold, dim.key))}`);
797
- console.log(` ${chalk_1.default.white('Status:')} ${statusColor(dim.status.toUpperCase())}`);
798
- }
799
- // Threshold reference
800
- console.log(chalk_1.default.gray('\n' + '='.repeat(90)));
801
- console.log(chalk_1.default.cyan('Threshold Reference'));
802
- console.log(chalk_1.default.gray(` Policy Violation: >${formatPercentage(thresholds.policyViolation)} daily violations`));
803
- console.log(chalk_1.default.gray(` Intent-Outcome Gap: >${formatPercentage(thresholds.intentOutcomeGap)} divergence`));
804
- console.log(chalk_1.default.gray(` Evaluator Disagreement:>${formatPercentage(thresholds.evaluatorDisagreement)} monthly overrides`));
805
- console.log(chalk_1.default.gray(` Escalation Suppression:>${formatPercentage(thresholds.escalationSuppression)} drop from baseline`));
806
- console.log(chalk_1.default.gray(` Reward Hacking: >${thresholds.rewardHacking} instances/month`));
807
- console.log(chalk_1.default.gray('='.repeat(90)));
808
- console.log('');
809
- }
810
- catch (error) {
811
- spinner.fail('Failed to load dimension breakdown');
812
- console.error(chalk_1.default.red(error instanceof Error ? error.message : String(error)));
813
- }
814
- }
815
- // Export the command
816
- exports.default = createAlignmentCommand;
817
- //# sourceMappingURL=alignment.js.map