oneie 3.5.0 → 3.6.3

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 (141) hide show
  1. package/.claude/agents/agent-director.md +902 -22
  2. package/.claude/agents/agent-onboard-example-output.md +600 -0
  3. package/.claude/agents/agent-onboard.md +576 -0
  4. package/.claude/commands/ONBOARDING_ENHANCEMENT_SUMMARY.md +266 -0
  5. package/.claude/commands/deploy.md +77 -150
  6. package/.claude/commands/one.md +375 -5
  7. package/.claude/commands/release.md +64 -3
  8. package/.mcp.json +57 -0
  9. package/CLAUDE.md +55 -69
  10. package/CREATE-WEBSITE.md +442 -0
  11. package/SECURITY.md +31 -0
  12. package/TESTING-ONBOARDING.md +185 -0
  13. package/dist/commands/create-website.d.ts +19 -0
  14. package/dist/commands/create-website.d.ts.map +1 -0
  15. package/dist/commands/create-website.js +231 -0
  16. package/dist/commands/create-website.js.map +1 -0
  17. package/dist/commands/init.d.ts +5 -6
  18. package/dist/commands/init.d.ts.map +1 -1
  19. package/dist/commands/init.js +213 -103
  20. package/dist/commands/init.js.map +1 -1
  21. package/dist/index.js +7 -5
  22. package/dist/index.js.map +1 -1
  23. package/dist/utils/installation-setup.d.ts +24 -1
  24. package/dist/utils/installation-setup.d.ts.map +1 -1
  25. package/dist/utils/installation-setup.js +85 -1
  26. package/dist/utils/installation-setup.js.map +1 -1
  27. package/dist/utils/launch-claude.d.ts +6 -0
  28. package/dist/utils/launch-claude.d.ts.map +1 -0
  29. package/dist/utils/launch-claude.js +51 -0
  30. package/dist/utils/launch-claude.js.map +1 -0
  31. package/dist/utils/validation.d.ts +48 -0
  32. package/dist/utils/validation.d.ts.map +1 -0
  33. package/dist/utils/validation.js +73 -0
  34. package/dist/utils/validation.js.map +1 -0
  35. package/folders.yaml +1 -1
  36. package/one/.obsidian/core-plugins.json +33 -0
  37. package/one/.obsidian/workspace.json +20 -20
  38. package/one/connections/workflow-onboarding.md +683 -0
  39. package/one/events/CART-DRAWER-INTEGRATION-GUIDE.md +354 -0
  40. package/one/events/CRITICAL-FIXES-COMPLETE.md +504 -0
  41. package/one/events/DEPLOYMENT.md +178 -0
  42. package/one/events/ECOMMERCE-DEMO-PLAN.md +225 -0
  43. package/one/events/ECOMMERCE-LIVE-DEMO.md +363 -0
  44. package/one/events/ECOMMERCE-TEMPLATE-COMPLETE.md +735 -0
  45. package/one/events/ECOMMERCE-TEMPLATES-SUMMARY.md +923 -0
  46. package/one/events/GRADIENT-TEXT-PERMANENT-FIX.md +223 -0
  47. package/one/events/HANDOFF.md +313 -0
  48. package/one/events/IMPLEMENTATION-SUMMARY-FINAL.md +503 -0
  49. package/one/events/IMPLEMENTATION_SUMMARY.md +529 -0
  50. package/one/events/LANDING-PAGE-EXAMPLE-OUTPUT.md +666 -0
  51. package/one/events/LANDING-PAGE-IMPLEMENTATION.md +642 -0
  52. package/one/events/LANDING-PAGE-QUICKSTART.md +407 -0
  53. package/one/events/MULTI-ONTOLOGY-COMPLETE-GUIDE.md +1627 -0
  54. package/one/events/MULTI-ONTOLOGY-IMPLEMENTATION-COMPLETE.md +573 -0
  55. package/one/events/ONBOARDING-IMPLEMENTATION-COMPLETE copy.md +398 -0
  56. package/one/events/ONTOLOGY-TUTORIALS-SUMMARY.md +525 -0
  57. package/one/events/ONTOLOGY-TYPE-GENERATOR-SUMMARY.md +455 -0
  58. package/one/events/ONTOLOGY_DISCOVERY_IMPLEMENTATION.md +486 -0
  59. package/one/events/ONTOLOGY_DISCOVERY_QUICKSTART.md +203 -0
  60. package/one/events/SECURITY-AUDIT-FIXES.md +376 -0
  61. package/one/events/SECURITY-SCAN-COMPLETE.md +281 -0
  62. package/one/events/SHOP-BUILD-STATUS.md +114 -0
  63. package/one/events/SHOP-PREMIUM-UPDATE.md +149 -0
  64. package/one/events/SITE-WIDE-GRADIENT-FIX.md +299 -0
  65. package/one/events/STORE-PRODUCTION-READY-STATUS.md +359 -0
  66. package/one/events/STRIPE-PAYMENT-METHODS-GUIDE.md +429 -0
  67. package/one/events/agent-director-enhancement-summary.md +386 -0
  68. package/one/events/agent-onboard-implementation-summary.md +457 -0
  69. package/one/events/clean-agent-ontology-cleanup-report.md +353 -0
  70. package/one/events/landing-page-generator.md +458 -0
  71. package/one/events/onboarding-implementation-complete.md +505 -0
  72. package/one/events/release.md +254 -0
  73. package/one/events/separate-implementation-status.md +537 -0
  74. package/one/knowledge/100-inference-quick-reference.md +431 -0
  75. package/one/knowledge/agent-onboard-usage.md +612 -0
  76. package/one/knowledge/cli-claude-handoff.md +718 -0
  77. package/one/knowledge/ontology-blog.yaml +31 -0
  78. package/one/knowledge/ontology-cheatsheet.md +591 -0
  79. package/one/knowledge/ontology-community.yaml +42 -0
  80. package/one/knowledge/ontology-core-universal.md +722 -0
  81. package/one/knowledge/ontology-core.yaml +50 -0
  82. package/one/knowledge/ontology-courses.yaml +53 -0
  83. package/one/knowledge/ontology-creator.md +376 -0
  84. package/one/knowledge/ontology-developer-guide.md +789 -0
  85. package/one/knowledge/ontology-education.md +920 -0
  86. package/one/knowledge/ontology-index.md +354 -0
  87. package/one/knowledge/ontology-migration-guide.md +811 -0
  88. package/one/knowledge/ontology-minimal.yaml +1 -1
  89. package/one/knowledge/ontology-portfolio.yaml +31 -0
  90. package/one/knowledge/ontology-quickstart.md +576 -0
  91. package/one/knowledge/ontology-shop.yaml +121 -0
  92. package/one/knowledge/ontology-tokens.yaml +32 -0
  93. package/one/knowledge/ontology-tutorial.md +434 -0
  94. package/one/knowledge/ontology-video-script.md +890 -0
  95. package/one/things/docs/ecommerce/ARCHITECTURE-DIAGRAM.md +467 -0
  96. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-IMPLEMENTATION.md +408 -0
  97. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-SUMMARY.md +369 -0
  98. package/one/things/docs/ecommerce/CONVERSION-UX-IMPLEMENTATION-SUMMARY.md +396 -0
  99. package/one/things/docs/ecommerce/FEATURE-SUMMARY.md +468 -0
  100. package/one/things/docs/ecommerce/IMPLEMENTATION-NOTES.md +582 -0
  101. package/one/things/docs/ecommerce/INTEGRATION-EXAMPLE.md +449 -0
  102. package/one/things/docs/ecommerce/QUICK-START.md +368 -0
  103. package/one/things/docs/ecommerce/URGENCY-IMPLEMENTATION-SUMMARY.md +498 -0
  104. package/one/things/docs/ecommerce/URGENCY-QUICK-REFERENCE.md +237 -0
  105. package/one/things/docs/ecommerce/USAGE-EXAMPLE.astro +171 -0
  106. package/one/things/docs/ecommerce/demo.astro +309 -0
  107. package/one/things/plans/agent-director-100-inference-plans.md +410 -0
  108. package/one/things/plans/dual-website-strategy.md +612 -0
  109. package/one/things/plans/feature-based-sites.md +821 -0
  110. package/one/things/plans/multi-ontology-architecture.md +836 -0
  111. package/one/things/plans/onboarding.md +32 -0
  112. package/one/things/plans/separate.md +15 -17
  113. package/one/things/plans/start-new.md +738 -0
  114. package/package.json +7 -2
  115. package/one/things/claude/hooks/agent-hook-manager.js +0 -525
  116. package/one/things/claude/hooks/agent-load-balancer.js +0 -271
  117. package/one/things/claude/hooks/agent-request-interceptor.js +0 -70
  118. package/one/things/claude/hooks/cascade-feedback.js +0 -297
  119. package/one/things/claude/hooks/cascade-integration-hooks.js +0 -648
  120. package/one/things/claude/hooks/continuous-improvement-monitor.js +0 -510
  121. package/one/things/claude/hooks/file-organization-engine.js +0 -427
  122. package/one/things/claude/hooks/file-organization-monitor.js +0 -269
  123. package/one/things/claude/hooks/hook-config-manager.js +0 -202
  124. package/one/things/claude/hooks/hook-orchestrator.js +0 -662
  125. package/one/things/claude/hooks/hook-performance-report.js +0 -120
  126. package/one/things/claude/hooks/mcp-cascade-integration.js +0 -816
  127. package/one/things/claude/hooks/memory-optimizer.js +0 -510
  128. package/one/things/claude/hooks/ontology-compliance.js +0 -394
  129. package/one/things/claude/hooks/ontology-hook-manager.js +0 -316
  130. package/one/things/claude/hooks/ontology-validation-engine.js +0 -317
  131. package/one/things/claude/hooks/performance-monitoring-hook.js +0 -422
  132. package/one/things/claude/hooks/quality-scoring-engine.js +0 -834
  133. package/one/things/claude/hooks/simple-load-balancer.js +0 -238
  134. package/one/things/claude/hooks/startup-optimizer.js +0 -625
  135. package/one/things/claude/hooks/story-scoring-system.js +0 -445
  136. package/one/things/claude/hooks/story-validation-engine.js +0 -473
  137. package/one/things/claude/hooks/structure-synchronizer.js +0 -194
  138. package/one/things/claude/hooks/sub-agent-output-validator.js +0 -647
  139. package/one/things/claude/hooks/sub-agent-validation-hook.js +0 -343
  140. package/one/things/claude/hooks/trinity-validation-system.js +0 -392
  141. package/one/things/plans/organizations-to-groups.md +0 -705
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oneie",
3
- "version": "3.5.0",
3
+ "version": "3.6.3",
4
4
  "type": "module",
5
5
  "description": "Build apps, websites, and AI agents in English. Download to your computer, run in the cloud, deploy to the edge. Open source and free forever.",
6
6
  "bin": {
@@ -40,7 +40,7 @@
40
40
  "url": "https://github.com/one-ie/one/issues"
41
41
  },
42
42
  "engines": {
43
- "node": ">=18.0.0"
43
+ "node": ">=22.16.0"
44
44
  },
45
45
  "dependencies": {
46
46
  "prompts": "^2.4.2",
@@ -57,6 +57,11 @@
57
57
  "files": [
58
58
  "dist",
59
59
  "README.md",
60
+ "LICENSE.md",
61
+ "SECURITY.md",
62
+ "TESTING-ONBOARDING.md",
63
+ "CREATE-WEBSITE.md",
64
+ ".mcp.json",
60
65
  "folders.yaml",
61
66
  "CLAUDE.md",
62
67
  "AGENTS.md",
@@ -1,525 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Agent Hook Configuration Manager
5
- * Manages agent-specific hook configurations and coordinates hook execution
6
- */
7
-
8
- import fs from 'fs';
9
- import path from 'path';
10
- import { fileURLToPath } from 'url';
11
-
12
- const __filename = fileURLToPath(import.meta.url);
13
- const __dirname = path.dirname(__filename);
14
-
15
- class AgentHookManager {
16
- constructor() {
17
- this.configPath = path.join(__dirname, 'agent-hook-config.json');
18
- this.config = null;
19
- this.loadConfiguration();
20
- }
21
-
22
- loadConfiguration() {
23
- try {
24
- if (fs.existsSync(this.configPath)) {
25
- const configContent = fs.readFileSync(this.configPath, 'utf8');
26
- this.config = JSON.parse(configContent);
27
- } else {
28
- console.warn('Agent hook configuration file not found, using defaults');
29
- this.config = this.getDefaultConfiguration();
30
- }
31
- } catch (error) {
32
- console.error('Error loading agent hook configuration:', error);
33
- this.config = this.getDefaultConfiguration();
34
- }
35
- }
36
-
37
- getDefaultConfiguration() {
38
- return {
39
- version: "1.0",
40
- globalDefaults: {
41
- enableStoryValidation: true,
42
- enableSecurityValidation: true,
43
- enablePerformanceMonitoring: true,
44
- enableQualityScoring: true,
45
- qualityThreshold: 7.0,
46
- performanceThreshold: 2000,
47
- enableNotifications: true
48
- },
49
- agentConfigurations: {},
50
- hookExecutionOrder: [
51
- "securityValidation",
52
- "storyValidation",
53
- "qualityScoring",
54
- "performanceMonitoring",
55
- "notifications"
56
- ]
57
- };
58
- }
59
-
60
- getAgentConfiguration(agentName) {
61
- if (!this.config) {
62
- this.loadConfiguration();
63
- }
64
-
65
- // Get agent-specific configuration or fall back to defaults
66
- const agentConfig = this.config.agentConfigurations[agentName];
67
-
68
- if (!agentConfig) {
69
- console.warn(`No configuration found for agent: ${agentName}, using defaults`);
70
- return this.createDefaultAgentConfig(agentName);
71
- }
72
-
73
- // Merge with global defaults
74
- return this.mergeWithDefaults(agentConfig);
75
- }
76
-
77
- createDefaultAgentConfig(agentName) {
78
- const teamPrefix = this.extractTeamPrefix(agentName);
79
-
80
- return {
81
- displayName: this.formatDisplayName(agentName),
82
- teamPrefix: teamPrefix,
83
- specialization: "general",
84
- hooks: {
85
- storyValidation: {
86
- enabled: this.config.globalDefaults.enableStoryValidation,
87
- qualityThreshold: this.config.globalDefaults.qualityThreshold
88
- },
89
- securityValidation: {
90
- enabled: this.config.globalDefaults.enableSecurityValidation,
91
- allowedTools: this.getDefaultToolsForTeam(teamPrefix),
92
- enforceToolRestrictions: true
93
- },
94
- performanceMonitoring: {
95
- enabled: this.config.globalDefaults.enablePerformanceMonitoring,
96
- responseTimeThreshold: this.config.globalDefaults.performanceThreshold
97
- },
98
- qualityScoring: {
99
- enabled: this.config.globalDefaults.enableQualityScoring,
100
- qualityThreshold: this.config.globalDefaults.qualityThreshold
101
- },
102
- notifications: {
103
- enabled: this.config.globalDefaults.enableNotifications,
104
- channels: ["console", "file"]
105
- }
106
- }
107
- };
108
- }
109
-
110
- extractTeamPrefix(agentName) {
111
- const prefixes = ['marketing', 'engineering', 'research', 'content', 'crypto', 'service', 'sales', 'company', 'framework'];
112
-
113
- for (const prefix of prefixes) {
114
- if (agentName.startsWith(prefix + '-')) {
115
- return prefix;
116
- }
117
- }
118
-
119
- return 'general';
120
- }
121
-
122
- formatDisplayName(agentName) {
123
- // Convert kebab-case to Title Case
124
- return agentName
125
- .split('-')
126
- .map(word => word.charAt(0).toUpperCase() + word.slice(1))
127
- .join(' ');
128
- }
129
-
130
- getDefaultToolsForTeam(teamPrefix) {
131
- const toolMap = {
132
- 'marketing': ['Read', 'Write', 'Edit', 'Grep', 'WebSearch', 'WebFetch'],
133
- 'engineering': ['Read', 'Write', 'Edit', 'MultiEdit', 'Bash', 'Glob', 'Grep'],
134
- 'research': ['Read', 'Grep', 'WebSearch', 'WebFetch'],
135
- 'content': ['Read', 'Write', 'Edit', 'Grep', 'WebSearch'],
136
- 'crypto': ['Read', 'Write', 'Edit', 'Grep', 'WebSearch', 'WebFetch'],
137
- 'service': ['Read', 'Write', 'Edit', 'Grep'],
138
- 'sales': ['Read', 'Write', 'Edit', 'Grep'],
139
- 'company': ['Read', 'Write', 'Edit', 'Bash', 'Glob', 'Grep', 'WebSearch'],
140
- 'framework': ['Read', 'Write', 'Edit', 'Task', 'Bash', 'Glob', 'Grep']
141
- };
142
-
143
- return toolMap[teamPrefix] || ['Read', 'Write', 'Edit', 'Grep'];
144
- }
145
-
146
- mergeWithDefaults(agentConfig) {
147
- const defaults = this.config.globalDefaults;
148
-
149
- // Deep merge agent config with defaults
150
- const merged = JSON.parse(JSON.stringify(agentConfig));
151
-
152
- if (!merged.hooks.storyValidation) {
153
- merged.hooks.storyValidation = { enabled: defaults.enableStoryValidation };
154
- }
155
-
156
- if (!merged.hooks.securityValidation) {
157
- merged.hooks.securityValidation = { enabled: defaults.enableSecurityValidation };
158
- }
159
-
160
- if (!merged.hooks.performanceMonitoring) {
161
- merged.hooks.performanceMonitoring = { enabled: defaults.enablePerformanceMonitoring };
162
- }
163
-
164
- if (!merged.hooks.qualityScoring) {
165
- merged.hooks.qualityScoring = { enabled: defaults.enableQualityScoring };
166
- }
167
-
168
- if (!merged.hooks.notifications) {
169
- merged.hooks.notifications = { enabled: defaults.enableNotifications };
170
- }
171
-
172
- return merged;
173
- }
174
-
175
- validateToolUsage(agentName, requestedTool) {
176
- const config = this.getAgentConfiguration(agentName);
177
-
178
- if (!config.hooks.securityValidation.enabled) {
179
- return { allowed: true, reason: 'Security validation disabled' };
180
- }
181
-
182
- const allowedTools = config.hooks.securityValidation.allowedTools || [];
183
-
184
- if (allowedTools.includes(requestedTool)) {
185
- return { allowed: true, reason: 'Tool authorized' };
186
- } else {
187
- return {
188
- allowed: false,
189
- reason: `Tool '${requestedTool}' not authorized for agent '${agentName}'`,
190
- allowedTools: allowedTools
191
- };
192
- }
193
- }
194
-
195
- shouldExecuteHook(agentName, hookType) {
196
- const config = this.getAgentConfiguration(agentName);
197
-
198
- switch (hookType) {
199
- case 'storyValidation':
200
- return config.hooks.storyValidation?.enabled ?? true;
201
- case 'securityValidation':
202
- return config.hooks.securityValidation?.enabled ?? true;
203
- case 'performanceMonitoring':
204
- return config.hooks.performanceMonitoring?.enabled ?? true;
205
- case 'qualityScoring':
206
- return config.hooks.qualityScoring?.enabled ?? true;
207
- case 'notifications':
208
- return config.hooks.notifications?.enabled ?? true;
209
- default:
210
- return false;
211
- }
212
- }
213
-
214
- getHookConfiguration(agentName, hookType) {
215
- const config = this.getAgentConfiguration(agentName);
216
- return config.hooks[hookType] || {};
217
- }
218
-
219
- getQualityThreshold(agentName) {
220
- const config = this.getAgentConfiguration(agentName);
221
- return config.hooks.qualityScoring?.qualityThreshold ||
222
- this.config.globalDefaults.qualityThreshold;
223
- }
224
-
225
- getPerformanceThreshold(agentName) {
226
- const config = this.getAgentConfiguration(agentName);
227
- return config.hooks.performanceMonitoring?.responseTimeThreshold ||
228
- this.config.globalDefaults.performanceThreshold;
229
- }
230
-
231
- getHookExecutionOrder() {
232
- return this.config.hookExecutionOrder || [
233
- "securityValidation",
234
- "storyValidation",
235
- "qualityScoring",
236
- "performanceMonitoring",
237
- "notifications"
238
- ];
239
- }
240
-
241
- async executeHooksForAgent(agentName, context = {}) {
242
- const executionOrder = this.getHookExecutionOrder();
243
- const results = {
244
- agentName,
245
- timestamp: new Date().toISOString(),
246
- executionOrder,
247
- hookResults: {},
248
- overallSuccess: true,
249
- totalExecutionTime: 0
250
- };
251
-
252
- const startTime = Date.now();
253
-
254
- for (const hookType of executionOrder) {
255
- if (!this.shouldExecuteHook(agentName, hookType)) {
256
- results.hookResults[hookType] = {
257
- executed: false,
258
- reason: 'Hook disabled for this agent'
259
- };
260
- continue;
261
- }
262
-
263
- try {
264
- const hookStartTime = Date.now();
265
- const hookResult = await this.executeSpecificHook(agentName, hookType, context);
266
- const hookExecutionTime = Date.now() - hookStartTime;
267
-
268
- results.hookResults[hookType] = {
269
- executed: true,
270
- success: hookResult.success,
271
- result: hookResult,
272
- executionTime: hookExecutionTime
273
- };
274
-
275
- if (!hookResult.success) {
276
- results.overallSuccess = false;
277
-
278
- // Check if this is a blocking hook
279
- if (hookResult.blocking) {
280
- console.log(`Blocking hook ${hookType} failed for agent ${agentName}, stopping execution`);
281
- break;
282
- }
283
- }
284
-
285
- } catch (error) {
286
- results.hookResults[hookType] = {
287
- executed: true,
288
- success: false,
289
- error: error.message,
290
- executionTime: 0
291
- };
292
- results.overallSuccess = false;
293
- }
294
- }
295
-
296
- results.totalExecutionTime = Date.now() - startTime;
297
- return results;
298
- }
299
-
300
- async executeSpecificHook(agentName, hookType, context) {
301
- const hookConfig = this.getHookConfiguration(agentName, hookType);
302
-
303
- // This is a simplified implementation - in practice, you'd call the actual hook scripts
304
- switch (hookType) {
305
- case 'securityValidation':
306
- return await this.executeSecurityHook(agentName, hookConfig, context);
307
- case 'storyValidation':
308
- return await this.executeStoryValidationHook(agentName, hookConfig, context);
309
- case 'qualityScoring':
310
- return await this.executeQualityScoringHook(agentName, hookConfig, context);
311
- case 'performanceMonitoring':
312
- return await this.executePerformanceHook(agentName, hookConfig, context);
313
- case 'notifications':
314
- return await this.executeNotificationHook(agentName, hookConfig, context);
315
- default:
316
- return { success: false, message: `Unknown hook type: ${hookType}` };
317
- }
318
- }
319
-
320
- async executeSecurityHook(agentName, config, context) {
321
- // Simplified security validation
322
- if (context.toolRequested) {
323
- const validation = this.validateToolUsage(agentName, context.toolRequested);
324
- return {
325
- success: validation.allowed,
326
- message: validation.reason,
327
- blocking: !validation.allowed,
328
- allowedTools: validation.allowedTools
329
- };
330
- }
331
-
332
- return { success: true, message: 'Security validation passed' };
333
- }
334
-
335
- async executeStoryValidationHook(agentName, config, context) {
336
- // This would integrate with the actual story validation engine
337
- const threshold = config.qualityThreshold || 7.0;
338
-
339
- // Simulate validation score
340
- const score = context.storyScore || 8.0;
341
-
342
- return {
343
- success: score >= threshold,
344
- message: `Story validation ${score >= threshold ? 'passed' : 'failed'} with score ${score}/${threshold}`,
345
- score: score,
346
- threshold: threshold
347
- };
348
- }
349
-
350
- async executeQualityScoringHook(agentName, config, context) {
351
- // This would integrate with the quality scoring engine
352
- const threshold = config.qualityThreshold || 7.0;
353
-
354
- // Simulate quality score
355
- const score = context.qualityScore || 7.5;
356
-
357
- return {
358
- success: score >= threshold,
359
- message: `Quality scoring ${score >= threshold ? 'passed' : 'failed'} with score ${score}/${threshold}`,
360
- score: score,
361
- threshold: threshold
362
- };
363
- }
364
-
365
- async executePerformanceHook(agentName, config, context) {
366
- // This would integrate with the performance monitoring hook
367
- const responseTime = context.responseTime || 1000;
368
- const threshold = config.responseTimeThreshold || 2000;
369
-
370
- return {
371
- success: responseTime <= threshold,
372
- message: `Performance monitoring: ${responseTime}ms (threshold: ${threshold}ms)`,
373
- responseTime: responseTime,
374
- threshold: threshold
375
- };
376
- }
377
-
378
- async executeNotificationHook(agentName, config, context) {
379
- // This would send notifications based on configuration
380
- const channels = config.channels || ['console'];
381
-
382
- if (context.notification) {
383
- console.log(`[NOTIFICATION] [${agentName}] ${context.notification.message}`);
384
- }
385
-
386
- return {
387
- success: true,
388
- message: `Notifications sent via channels: ${channels.join(', ')}`
389
- };
390
- }
391
-
392
- updateAgentConfiguration(agentName, configUpdate) {
393
- if (!this.config.agentConfigurations[agentName]) {
394
- this.config.agentConfigurations[agentName] = this.createDefaultAgentConfig(agentName);
395
- }
396
-
397
- // Deep merge configuration update
398
- this.config.agentConfigurations[agentName] = this.deepMerge(
399
- this.config.agentConfigurations[agentName],
400
- configUpdate
401
- );
402
-
403
- this.saveConfiguration();
404
- }
405
-
406
- deepMerge(target, source) {
407
- const result = { ...target };
408
-
409
- for (const key in source) {
410
- if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) {
411
- result[key] = this.deepMerge(result[key] || {}, source[key]);
412
- } else {
413
- result[key] = source[key];
414
- }
415
- }
416
-
417
- return result;
418
- }
419
-
420
- saveConfiguration() {
421
- try {
422
- fs.writeFileSync(this.configPath, JSON.stringify(this.config, null, 2));
423
- } catch (error) {
424
- console.error('Error saving agent hook configuration:', error);
425
- }
426
- }
427
-
428
- listAgentConfigurations() {
429
- return Object.keys(this.config.agentConfigurations).map(agentName => ({
430
- agentName,
431
- displayName: this.config.agentConfigurations[agentName].displayName,
432
- teamPrefix: this.config.agentConfigurations[agentName].teamPrefix,
433
- specialization: this.config.agentConfigurations[agentName].specialization,
434
- hooksEnabled: Object.keys(this.config.agentConfigurations[agentName].hooks).filter(
435
- hookType => this.config.agentConfigurations[agentName].hooks[hookType].enabled
436
- )
437
- }));
438
- }
439
-
440
- generateConfigurationReport() {
441
- const report = {
442
- configurationVersion: this.config.version,
443
- totalAgents: Object.keys(this.config.agentConfigurations).length,
444
- globalDefaults: this.config.globalDefaults,
445
- agentSummary: this.listAgentConfigurations(),
446
- hookExecutionOrder: this.config.hookExecutionOrder,
447
- auditSettings: this.config.auditSettings
448
- };
449
-
450
- return report;
451
- }
452
- }
453
-
454
- // CLI interface
455
- async function main() {
456
- const manager = new AgentHookManager();
457
- const command = process.argv[2];
458
- const agentName = process.argv[3];
459
-
460
- switch (command) {
461
- case 'list':
462
- const agents = manager.listAgentConfigurations();
463
- console.log('Configured Agents:');
464
- agents.forEach(agent => {
465
- console.log(` ${agent.agentName} (${agent.displayName})`);
466
- console.log(` Team: ${agent.teamPrefix}, Specialization: ${agent.specialization}`);
467
- console.log(` Enabled Hooks: ${agent.hooksEnabled.join(', ')}`);
468
- console.log();
469
- });
470
- break;
471
-
472
- case 'config':
473
- if (!agentName) {
474
- console.error('Agent name required for config command');
475
- process.exit(1);
476
- }
477
- const config = manager.getAgentConfiguration(agentName);
478
- console.log(JSON.stringify(config, null, 2));
479
- break;
480
-
481
- case 'validate-tool':
482
- const toolName = process.argv[4];
483
- if (!agentName || !toolName) {
484
- console.error('Agent name and tool name required');
485
- process.exit(1);
486
- }
487
- const validation = manager.validateToolUsage(agentName, toolName);
488
- console.log(JSON.stringify(validation, null, 2));
489
- break;
490
-
491
- case 'execute':
492
- if (!agentName) {
493
- console.error('Agent name required for execute command');
494
- process.exit(1);
495
- }
496
- const context = process.argv[4] ? JSON.parse(process.argv[4]) : {};
497
- const results = await manager.executeHooksForAgent(agentName, context);
498
- console.log(JSON.stringify(results, null, 2));
499
- break;
500
-
501
- case 'report':
502
- const report = manager.generateConfigurationReport();
503
- console.log(JSON.stringify(report, null, 2));
504
- break;
505
-
506
- default:
507
- console.log('Usage: agent-hook-manager.js <command> [args...]');
508
- console.log('Commands:');
509
- console.log(' list - List all configured agents');
510
- console.log(' config <agent-name> - Show configuration for agent');
511
- console.log(' validate-tool <agent> <tool> - Validate tool usage for agent');
512
- console.log(' execute <agent> [context] - Execute hooks for agent');
513
- console.log(' report - Generate configuration report');
514
- process.exit(1);
515
- }
516
- }
517
-
518
- if (import.meta.url === `file://${process.argv[1]}`) {
519
- main().catch(error => {
520
- console.error('Error:', error);
521
- process.exit(1);
522
- });
523
- }
524
-
525
- export default AgentHookManager;