oneie 3.4.2 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/agent-director.md +902 -22
- package/.claude/agents/agent-onboard-example-output.md +600 -0
- package/.claude/agents/agent-onboard.md +576 -0
- package/.claude/commands/ONBOARDING_ENHANCEMENT_SUMMARY.md +266 -0
- package/.claude/commands/one.md +411 -10
- package/.claude/commands/release.md +64 -3
- package/CLAUDE.md +55 -69
- package/dist/commands/init.d.ts +5 -6
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +101 -101
- package/dist/commands/init.js.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/utils/installation-setup.d.ts +24 -1
- package/dist/utils/installation-setup.d.ts.map +1 -1
- package/dist/utils/installation-setup.js +85 -1
- package/dist/utils/installation-setup.js.map +1 -1
- package/dist/utils/launch-claude.d.ts +6 -0
- package/dist/utils/launch-claude.d.ts.map +1 -0
- package/dist/utils/launch-claude.js +51 -0
- package/dist/utils/launch-claude.js.map +1 -0
- package/dist/utils/validation.d.ts +48 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +73 -0
- package/dist/utils/validation.js.map +1 -0
- package/folders.yaml +1 -1
- package/one/.obsidian/app.json +8 -0
- package/one/.obsidian/appearance.json +1 -0
- package/one/.obsidian/community-plugins.json +3 -0
- package/one/.obsidian/core-plugins.json +33 -0
- package/one/.obsidian/plugins/easy-bake/main.js +361 -0
- package/one/.obsidian/plugins/easy-bake/manifest.json +11 -0
- package/one/.obsidian/plugins/easy-bake/styles.css +10 -0
- package/one/.obsidian/workspace.json +240 -0
- package/one/connections/workflow-onboarding.md +683 -0
- package/one/events/CART-DRAWER-INTEGRATION-GUIDE.md +354 -0
- package/one/events/CRITICAL-FIXES-COMPLETE.md +504 -0
- package/one/events/DEPLOYMENT.md +178 -0
- package/one/events/ECOMMERCE-DEMO-PLAN.md +225 -0
- package/one/events/ECOMMERCE-LIVE-DEMO.md +363 -0
- package/one/events/ECOMMERCE-TEMPLATE-COMPLETE.md +735 -0
- package/one/events/ECOMMERCE-TEMPLATES-SUMMARY.md +923 -0
- package/one/events/GRADIENT-TEXT-PERMANENT-FIX.md +223 -0
- package/one/events/HANDOFF.md +313 -0
- package/one/events/IMPLEMENTATION-SUMMARY-FINAL.md +503 -0
- package/one/events/IMPLEMENTATION_SUMMARY.md +529 -0
- package/one/events/LANDING-PAGE-EXAMPLE-OUTPUT.md +666 -0
- package/one/events/LANDING-PAGE-IMPLEMENTATION.md +642 -0
- package/one/events/LANDING-PAGE-QUICKSTART.md +407 -0
- package/one/events/MULTI-ONTOLOGY-COMPLETE-GUIDE.md +1627 -0
- package/one/events/MULTI-ONTOLOGY-IMPLEMENTATION-COMPLETE.md +573 -0
- package/one/events/ONBOARDING-IMPLEMENTATION-COMPLETE copy.md +398 -0
- package/one/events/ONTOLOGY-TUTORIALS-SUMMARY.md +525 -0
- package/one/events/ONTOLOGY-TYPE-GENERATOR-SUMMARY.md +455 -0
- package/one/events/ONTOLOGY_DISCOVERY_IMPLEMENTATION.md +486 -0
- package/one/events/ONTOLOGY_DISCOVERY_QUICKSTART.md +203 -0
- package/one/events/SECURITY-AUDIT-FIXES.md +376 -0
- package/one/events/SECURITY-SCAN-COMPLETE.md +281 -0
- package/one/events/SHOP-BUILD-STATUS.md +114 -0
- package/one/events/SHOP-PREMIUM-UPDATE.md +149 -0
- package/one/events/SITE-WIDE-GRADIENT-FIX.md +299 -0
- package/one/events/STORE-PRODUCTION-READY-STATUS.md +359 -0
- package/one/events/STRIPE-PAYMENT-METHODS-GUIDE.md +429 -0
- package/one/events/agent-director-enhancement-summary.md +386 -0
- package/one/events/agent-onboard-implementation-summary.md +457 -0
- package/one/events/clean-agent-ontology-cleanup-report.md +353 -0
- package/one/events/landing-page-generator.md +458 -0
- package/one/events/onboarding-implementation-complete.md +505 -0
- package/one/events/release.md +254 -0
- package/one/events/separate-implementation-status.md +537 -0
- package/one/groups/nine-padle-contents.baked.md +1252 -0
- package/one/groups/nine-padle-contents.md +6 -0
- package/one/knowledge/100-inference-quick-reference.md +431 -0
- package/one/knowledge/agent-onboard-usage.md +612 -0
- package/one/knowledge/cli-claude-handoff.md +718 -0
- package/one/knowledge/installation-folders.md +45 -1
- package/one/knowledge/ontology-blog.yaml +31 -0
- package/one/knowledge/ontology-cheatsheet.md +591 -0
- package/one/knowledge/ontology-community.yaml +42 -0
- package/one/knowledge/ontology-core-universal.md +722 -0
- package/one/knowledge/ontology-core.yaml +50 -0
- package/one/knowledge/ontology-courses.yaml +53 -0
- package/one/knowledge/ontology-creator.md +376 -0
- package/one/knowledge/ontology-developer-guide.md +789 -0
- package/one/knowledge/ontology-education.md +920 -0
- package/one/knowledge/ontology-index.md +354 -0
- package/one/knowledge/ontology-migration-guide.md +811 -0
- package/one/knowledge/ontology-minimal.yaml +1 -1
- package/one/knowledge/ontology-portfolio.yaml +31 -0
- package/one/knowledge/ontology-quickstart.md +576 -0
- package/one/knowledge/ontology-shop.yaml +121 -0
- package/one/knowledge/ontology-tokens.yaml +32 -0
- package/one/knowledge/ontology-tutorial.md +434 -0
- package/one/knowledge/ontology-video-script.md +890 -0
- package/one/things/docs/ecommerce/ARCHITECTURE-DIAGRAM.md +467 -0
- package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-IMPLEMENTATION.md +408 -0
- package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-SUMMARY.md +369 -0
- package/one/things/docs/ecommerce/CONVERSION-UX-IMPLEMENTATION-SUMMARY.md +396 -0
- package/one/things/docs/ecommerce/FEATURE-SUMMARY.md +468 -0
- package/one/things/docs/ecommerce/IMPLEMENTATION-NOTES.md +582 -0
- package/one/things/docs/ecommerce/INTEGRATION-EXAMPLE.md +449 -0
- package/one/things/docs/ecommerce/QUICK-START.md +368 -0
- package/one/things/docs/ecommerce/URGENCY-IMPLEMENTATION-SUMMARY.md +498 -0
- package/one/things/docs/ecommerce/URGENCY-QUICK-REFERENCE.md +237 -0
- package/one/things/docs/ecommerce/USAGE-EXAMPLE.astro +171 -0
- package/one/things/docs/ecommerce/demo.astro +309 -0
- package/one/things/plans/agent-director-100-inference-plans.md +410 -0
- package/one/things/plans/dual-website-strategy.md +612 -0
- package/one/things/plans/feature-based-sites.md +821 -0
- package/one/things/plans/multi-ontology-architecture.md +836 -0
- package/one/things/plans/onboarding.md +32 -0
- package/one/things/plans/separate.md +15 -17
- package/one/things/plans/start-new.md +738 -0
- package/one/things/templates.md +254 -0
- package/one/things/todo.md +23 -5
- package/package.json +2 -2
- package/one/things/claude/hooks/agent-hook-manager.js +0 -525
- package/one/things/claude/hooks/agent-load-balancer.js +0 -271
- package/one/things/claude/hooks/agent-request-interceptor.js +0 -70
- package/one/things/claude/hooks/cascade-feedback.js +0 -297
- package/one/things/claude/hooks/cascade-integration-hooks.js +0 -648
- package/one/things/claude/hooks/continuous-improvement-monitor.js +0 -510
- package/one/things/claude/hooks/file-organization-engine.js +0 -427
- package/one/things/claude/hooks/file-organization-monitor.js +0 -269
- package/one/things/claude/hooks/hook-config-manager.js +0 -202
- package/one/things/claude/hooks/hook-orchestrator.js +0 -662
- package/one/things/claude/hooks/hook-performance-report.js +0 -120
- package/one/things/claude/hooks/mcp-cascade-integration.js +0 -816
- package/one/things/claude/hooks/memory-optimizer.js +0 -510
- package/one/things/claude/hooks/ontology-compliance.js +0 -394
- package/one/things/claude/hooks/ontology-hook-manager.js +0 -316
- package/one/things/claude/hooks/ontology-validation-engine.js +0 -317
- package/one/things/claude/hooks/performance-monitoring-hook.js +0 -422
- package/one/things/claude/hooks/quality-scoring-engine.js +0 -834
- package/one/things/claude/hooks/simple-load-balancer.js +0 -238
- package/one/things/claude/hooks/startup-optimizer.js +0 -625
- package/one/things/claude/hooks/story-scoring-system.js +0 -445
- package/one/things/claude/hooks/story-validation-engine.js +0 -473
- package/one/things/claude/hooks/structure-synchronizer.js +0 -194
- package/one/things/claude/hooks/sub-agent-output-validator.js +0 -647
- package/one/things/claude/hooks/sub-agent-validation-hook.js +0 -343
- package/one/things/claude/hooks/trinity-validation-system.js +0 -392
- package/one/things/plans/organizations-to-groups.md +0 -705
|
@@ -1,343 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Sub-Agent Validation Hook
|
|
5
|
-
* Validates outputs from Claude Code sub-agents using R.O.C.K.E.T. framework
|
|
6
|
-
* Integrates with existing quality validation while adapting for agent-specific requirements
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import fs from 'fs';
|
|
10
|
-
import path from 'path';
|
|
11
|
-
import { fileURLToPath } from 'url';
|
|
12
|
-
|
|
13
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
14
|
-
const __dirname = path.dirname(__filename);
|
|
15
|
-
|
|
16
|
-
// Agent-specific validation rules
|
|
17
|
-
const AGENT_VALIDATION_RULES = {
|
|
18
|
-
'marketing-director': {
|
|
19
|
-
framework: 'strategic-marketing',
|
|
20
|
-
qualityGate: 7.0,
|
|
21
|
-
requiredElements: ['Foundation', 'Strategy', 'Metrics'],
|
|
22
|
-
irishPersonality: true
|
|
23
|
-
},
|
|
24
|
-
'engineering-director': {
|
|
25
|
-
framework: 'technical-architecture',
|
|
26
|
-
qualityGate: 8.0,
|
|
27
|
-
requiredElements: ['Architecture', 'Implementation', 'Testing'],
|
|
28
|
-
irishPersonality: true
|
|
29
|
-
},
|
|
30
|
-
'marketing-content-hooks': {
|
|
31
|
-
framework: 'content-engagement',
|
|
32
|
-
qualityGate: 7.5,
|
|
33
|
-
requiredElements: ['Hook', 'Value', 'Call-to-Action'],
|
|
34
|
-
irishPersonality: true
|
|
35
|
-
},
|
|
36
|
-
'marketing-viral-growth': {
|
|
37
|
-
framework: 'viral-mechanics',
|
|
38
|
-
qualityGate: 7.5,
|
|
39
|
-
requiredElements: ['K-Factor', 'Share-Triggers', 'Network-Effects'],
|
|
40
|
-
irishPersonality: true
|
|
41
|
-
},
|
|
42
|
-
'engineering-developer': {
|
|
43
|
-
framework: 'code-quality',
|
|
44
|
-
qualityGate: 8.0,
|
|
45
|
-
requiredElements: ['Implementation', 'Testing', 'Documentation'],
|
|
46
|
-
irishPersonality: true
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
// R.O.C.K.E.T. Framework validation components
|
|
51
|
-
const ROCKET_COMPONENTS = {
|
|
52
|
-
Role: 'Agent identity and capabilities clearly demonstrated',
|
|
53
|
-
Objective: 'Output aligned with stated goals and agent purpose',
|
|
54
|
-
Context: 'Appropriate use of available information and frameworks',
|
|
55
|
-
KeyInstructions: 'Compliance with agent-specific guidelines and standards',
|
|
56
|
-
Examples: 'Quality benchmarking against established patterns',
|
|
57
|
-
Tone: 'Professional expertise with authentic Irish personality integration'
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
class SubAgentValidator {
|
|
61
|
-
constructor() {
|
|
62
|
-
this.logFile = path.join(__dirname, 'validation.log');
|
|
63
|
-
this.initializeLogger();
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
initializeLogger() {
|
|
67
|
-
if (!fs.existsSync(this.logFile)) {
|
|
68
|
-
fs.writeFileSync(this.logFile, '');
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
log(level, message, agentName = 'unknown') {
|
|
73
|
-
const timestamp = new Date().toISOString();
|
|
74
|
-
const logEntry = `[${timestamp}] [${level.toUpperCase()}] [${agentName}] ${message}\n`;
|
|
75
|
-
fs.appendFileSync(this.logFile, logEntry);
|
|
76
|
-
|
|
77
|
-
if (level === 'error' || level === 'warn') {
|
|
78
|
-
console.error(logEntry.trim());
|
|
79
|
-
} else {
|
|
80
|
-
console.log(logEntry.trim());
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
detectAgentFromContext(content, context = {}) {
|
|
85
|
-
// Try to identify agent from various sources
|
|
86
|
-
if (context.agentName) {
|
|
87
|
-
return context.agentName;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// Look for agent signatures in content
|
|
91
|
-
const agentSignatures = Object.keys(AGENT_VALIDATION_RULES);
|
|
92
|
-
for (const agentName of agentSignatures) {
|
|
93
|
-
if (content.includes(agentName) || content.includes(agentName.replace('-', ' '))) {
|
|
94
|
-
return agentName;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Look for Irish names that might indicate specific agents
|
|
99
|
-
const irishNamePatterns = [
|
|
100
|
-
'Siobhan O\'Brien', 'Declan Murphy', 'Cormac Byrne', 'Róisín Kelly'
|
|
101
|
-
];
|
|
102
|
-
|
|
103
|
-
for (const name of irishNamePatterns) {
|
|
104
|
-
if (content.includes(name)) {
|
|
105
|
-
// Map names to agents (simplified mapping)
|
|
106
|
-
if (name.includes('Siobhan')) return 'marketing-director';
|
|
107
|
-
if (name.includes('Declan')) return 'engineering-director';
|
|
108
|
-
if (name.includes('Cormac')) return 'marketing-content-hooks';
|
|
109
|
-
if (name.includes('Róisín')) return 'marketing-viral-growth';
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
return 'generic-agent';
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
validateROCKETFramework(content, agentName) {
|
|
117
|
-
const validationResults = {};
|
|
118
|
-
let totalScore = 10; // Start with perfect score
|
|
119
|
-
|
|
120
|
-
// Role validation
|
|
121
|
-
const hasRoleClarity = content.includes('I\'m ') || content.includes('I am ') ||
|
|
122
|
-
content.includes('specialist') || content.includes('expert');
|
|
123
|
-
validationResults.Role = {
|
|
124
|
-
passed: hasRoleClarity,
|
|
125
|
-
score: hasRoleClarity ? 1.0 : 0.5,
|
|
126
|
-
message: hasRoleClarity ? 'Agent role clearly defined' : 'Role clarity could be improved'
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
// Objective validation
|
|
130
|
-
const hasObjective = content.includes('specialize') || content.includes('focus') ||
|
|
131
|
-
content.includes('objective') || content.includes('goal');
|
|
132
|
-
validationResults.Objective = {
|
|
133
|
-
passed: hasObjective,
|
|
134
|
-
score: hasObjective ? 1.0 : 0.6,
|
|
135
|
-
message: hasObjective ? 'Clear objectives present' : 'Objectives could be more explicit'
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
// Context validation
|
|
139
|
-
const hasContext = content.includes('experience') || content.includes('expertise') ||
|
|
140
|
-
content.includes('approach') || content.includes('methodology');
|
|
141
|
-
validationResults.Context = {
|
|
142
|
-
passed: hasContext,
|
|
143
|
-
score: hasContext ? 1.0 : 0.7,
|
|
144
|
-
message: hasContext ? 'Good contextual information' : 'More context would improve quality'
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
// Key Instructions validation (agent-specific)
|
|
148
|
-
const agentRules = AGENT_VALIDATION_RULES[agentName] || AGENT_VALIDATION_RULES['generic-agent'];
|
|
149
|
-
const hasKeyInstructions = agentRules?.requiredElements?.some(element =>
|
|
150
|
-
content.toLowerCase().includes(element.toLowerCase())
|
|
151
|
-
) || true; // Default to true for unknown agents
|
|
152
|
-
|
|
153
|
-
validationResults.KeyInstructions = {
|
|
154
|
-
passed: hasKeyInstructions,
|
|
155
|
-
score: hasKeyInstructions ? 1.0 : 0.4,
|
|
156
|
-
message: hasKeyInstructions ? 'Key instructions followed' : 'Missing key required elements'
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
// Examples validation
|
|
160
|
-
const hasExamples = content.includes('example') || content.includes('such as') ||
|
|
161
|
-
content.includes('including') || content.includes('like');
|
|
162
|
-
validationResults.Examples = {
|
|
163
|
-
passed: hasExamples,
|
|
164
|
-
score: hasExamples ? 1.0 : 0.8,
|
|
165
|
-
message: hasExamples ? 'Good use of examples' : 'Examples would enhance clarity'
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
// Tone validation (Irish personality + professionalism)
|
|
169
|
-
const hasIrishElements = content.includes('Irish') ||
|
|
170
|
-
content.match(/[ÁÉÍÓÚáéíóú]/) || // Irish characters
|
|
171
|
-
content.includes('Dublin') || content.includes('Ireland');
|
|
172
|
-
const isProfessional = !content.includes('slang') &&
|
|
173
|
-
(content.includes('expertise') || content.includes('professional'));
|
|
174
|
-
|
|
175
|
-
validationResults.Tone = {
|
|
176
|
-
passed: hasIrishElements && isProfessional,
|
|
177
|
-
score: (hasIrishElements && isProfessional) ? 1.0 : 0.7,
|
|
178
|
-
message: (hasIrishElements && isProfessional) ?
|
|
179
|
-
'Excellent Irish professional tone' :
|
|
180
|
-
'Tone could better balance Irish personality with professionalism'
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
// Calculate overall score
|
|
184
|
-
const componentScores = Object.values(validationResults).map(r => r.score);
|
|
185
|
-
const averageScore = componentScores.reduce((a, b) => a + b, 0) / componentScores.length;
|
|
186
|
-
const finalScore = Math.round(averageScore * 10 * 100) / 100; // Scale to 10 and round
|
|
187
|
-
|
|
188
|
-
return {
|
|
189
|
-
agentName,
|
|
190
|
-
score: finalScore,
|
|
191
|
-
components: validationResults,
|
|
192
|
-
passed: finalScore >= (agentRules?.qualityGate || 6.0),
|
|
193
|
-
qualityGate: agentRules?.qualityGate || 6.0
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
validateAntiHallucination(content, agentName) {
|
|
198
|
-
// Check for common hallucination patterns
|
|
199
|
-
const hallucinationWarnings = [];
|
|
200
|
-
|
|
201
|
-
// Check for fake URLs or references
|
|
202
|
-
const urlPattern = /https?:\/\/[^\s]+/g;
|
|
203
|
-
const urls = content.match(urlPattern) || [];
|
|
204
|
-
for (const url of urls) {
|
|
205
|
-
if (!url.includes('claude.ai') && !url.includes('anthropic.com') &&
|
|
206
|
-
!url.includes('github.com') && !url.includes('one.ie')) {
|
|
207
|
-
hallucinationWarnings.push(`External URL detected: ${url}`);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// Check for specific technical claims that should be verified
|
|
212
|
-
const technicalClaims = [
|
|
213
|
-
'API endpoint', 'database schema', 'specific version numbers',
|
|
214
|
-
'exact statistics', 'precise dates'
|
|
215
|
-
];
|
|
216
|
-
|
|
217
|
-
for (const claim of technicalClaims) {
|
|
218
|
-
if (content.toLowerCase().includes(claim.toLowerCase())) {
|
|
219
|
-
hallucinationWarnings.push(`Technical claim requires verification: ${claim}`);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
return {
|
|
224
|
-
passed: hallucinationWarnings.length === 0,
|
|
225
|
-
warnings: hallucinationWarnings,
|
|
226
|
-
riskLevel: hallucinationWarnings.length > 2 ? 'high' :
|
|
227
|
-
hallucinationWarnings.length > 0 ? 'medium' : 'low'
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
async validateOutput(content, context = {}) {
|
|
232
|
-
try {
|
|
233
|
-
const agentName = this.detectAgentFromContext(content, context);
|
|
234
|
-
this.log('info', `Starting validation for agent: ${agentName}`, agentName);
|
|
235
|
-
|
|
236
|
-
// R.O.C.K.E.T. Framework validation
|
|
237
|
-
const rocketValidation = this.validateROCKETFramework(content, agentName);
|
|
238
|
-
|
|
239
|
-
// Anti-hallucination detection
|
|
240
|
-
const hallucinationCheck = this.validateAntiHallucination(content, agentName);
|
|
241
|
-
|
|
242
|
-
// Content quality checks
|
|
243
|
-
const wordCount = content.split(/\s+/).length;
|
|
244
|
-
const hasStructure = content.includes('#') || content.includes('##') ||
|
|
245
|
-
content.includes('- ') || content.includes('1. ');
|
|
246
|
-
|
|
247
|
-
const qualityMetrics = {
|
|
248
|
-
wordCount,
|
|
249
|
-
hasStructure,
|
|
250
|
-
readability: wordCount > 50 && hasStructure ? 'good' : 'needs-improvement',
|
|
251
|
-
completeness: wordCount > 100 ? 'complete' : 'brief'
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
// Overall assessment
|
|
255
|
-
const overallScore = rocketValidation.score;
|
|
256
|
-
const qualityGate = AGENT_VALIDATION_RULES[agentName]?.qualityGate || 6.0;
|
|
257
|
-
const passed = overallScore >= qualityGate && hallucinationCheck.passed;
|
|
258
|
-
|
|
259
|
-
const result = {
|
|
260
|
-
agentName,
|
|
261
|
-
timestamp: new Date().toISOString(),
|
|
262
|
-
overallScore,
|
|
263
|
-
qualityGate,
|
|
264
|
-
passed,
|
|
265
|
-
rocketValidation,
|
|
266
|
-
hallucinationCheck,
|
|
267
|
-
qualityMetrics,
|
|
268
|
-
recommendations: this.generateRecommendations(rocketValidation, hallucinationCheck, qualityMetrics)
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
this.log(passed ? 'info' : 'warn',
|
|
272
|
-
`Validation ${passed ? 'PASSED' : 'FAILED'} - Score: ${overallScore}/${qualityGate}`,
|
|
273
|
-
agentName);
|
|
274
|
-
|
|
275
|
-
return result;
|
|
276
|
-
|
|
277
|
-
} catch (error) {
|
|
278
|
-
this.log('error', `Validation error: ${error.message}`, 'system');
|
|
279
|
-
return {
|
|
280
|
-
agentName: 'unknown',
|
|
281
|
-
passed: false,
|
|
282
|
-
error: error.message,
|
|
283
|
-
timestamp: new Date().toISOString()
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
generateRecommendations(rocketValidation, hallucinationCheck, qualityMetrics) {
|
|
289
|
-
const recommendations = [];
|
|
290
|
-
|
|
291
|
-
// R.O.C.K.E.T. specific recommendations
|
|
292
|
-
Object.entries(rocketValidation.components).forEach(([component, result]) => {
|
|
293
|
-
if (result.score < 0.8) {
|
|
294
|
-
recommendations.push(`Improve ${component}: ${result.message}`);
|
|
295
|
-
}
|
|
296
|
-
});
|
|
297
|
-
|
|
298
|
-
// Hallucination warnings
|
|
299
|
-
if (hallucinationCheck.warnings.length > 0) {
|
|
300
|
-
recommendations.push('Verify technical claims and external references');
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
// Quality improvements
|
|
304
|
-
if (qualityMetrics.wordCount < 100) {
|
|
305
|
-
recommendations.push('Consider expanding content for better completeness');
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
if (!qualityMetrics.hasStructure) {
|
|
309
|
-
recommendations.push('Add structure with headers, lists, or bullet points');
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
return recommendations;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
// Main execution
|
|
317
|
-
async function main() {
|
|
318
|
-
if (process.argv.length < 3) {
|
|
319
|
-
console.error('Usage: sub-agent-validation-hook.js <content> [agent-name]');
|
|
320
|
-
process.exit(1);
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
const content = process.argv[2];
|
|
324
|
-
const agentName = process.argv[3];
|
|
325
|
-
|
|
326
|
-
const validator = new SubAgentValidator();
|
|
327
|
-
const result = await validator.validateOutput(content, { agentName });
|
|
328
|
-
|
|
329
|
-
// Output results
|
|
330
|
-
console.log(JSON.stringify(result, null, 2));
|
|
331
|
-
|
|
332
|
-
// Exit with appropriate code
|
|
333
|
-
process.exit(result.passed ? 0 : 2);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
337
|
-
main().catch(error => {
|
|
338
|
-
console.error('Fatal error:', error);
|
|
339
|
-
process.exit(1);
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
export { SubAgentValidator };
|