@x12i/ai-gateway 7.9.1
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/README.md +4259 -0
- package/config.defaults.json +31 -0
- package/dist/activity-manager.d.ts +206 -0
- package/dist/activity-manager.js +1051 -0
- package/dist/config/activity-tracking-config.d.ts +11 -0
- package/dist/config/activity-tracking-config.js +15 -0
- package/dist/config.defaults.json +31 -0
- package/dist/content-normalizer/content-normalizer.d.ts +46 -0
- package/dist/content-normalizer/content-normalizer.js +393 -0
- package/dist/content-normalizer/index.d.ts +7 -0
- package/dist/content-normalizer/index.js +6 -0
- package/dist/content-normalizer/types.d.ts +33 -0
- package/dist/content-normalizer/types.js +4 -0
- package/dist/defaults/instructions-blocks.json +61 -0
- package/dist/defaults/model-config.json +16 -0
- package/dist/defaults/template-rendering.json +6 -0
- package/dist/flex-md-loader.d.ts +109 -0
- package/dist/flex-md-loader.js +940 -0
- package/dist/gateway-config.d.ts +49 -0
- package/dist/gateway-config.js +292 -0
- package/dist/gateway-conversion.d.ts +29 -0
- package/dist/gateway-conversion.js +174 -0
- package/dist/gateway-instructions.d.ts +30 -0
- package/dist/gateway-instructions.js +62 -0
- package/dist/gateway-memory.d.ts +51 -0
- package/dist/gateway-memory.js +207 -0
- package/dist/gateway-messages.d.ts +23 -0
- package/dist/gateway-messages.js +83 -0
- package/dist/gateway-meta.d.ts +25 -0
- package/dist/gateway-meta.js +87 -0
- package/dist/gateway-provider-auto-register.d.ts +17 -0
- package/dist/gateway-provider-auto-register.js +159 -0
- package/dist/gateway-provider.d.ts +54 -0
- package/dist/gateway-provider.js +202 -0
- package/dist/gateway-rate-limiter-constants.d.ts +16 -0
- package/dist/gateway-rate-limiter-constants.js +16 -0
- package/dist/gateway-rate-limiter.d.ts +56 -0
- package/dist/gateway-rate-limiter.js +107 -0
- package/dist/gateway-retry.d.ts +49 -0
- package/dist/gateway-retry.js +204 -0
- package/dist/gateway-utils.d.ts +21 -0
- package/dist/gateway-utils.js +181 -0
- package/dist/gateway-validation.d.ts +13 -0
- package/dist/gateway-validation.js +50 -0
- package/dist/gateway.d.ts +39 -0
- package/dist/gateway.js +430 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +55 -0
- package/dist/instruction-errors.d.ts +16 -0
- package/dist/instruction-errors.js +29 -0
- package/dist/instruction-optimizer.d.ts +113 -0
- package/dist/instruction-optimizer.js +293 -0
- package/dist/instructions-parser.d.ts +31 -0
- package/dist/instructions-parser.js +56 -0
- package/dist/logger-factory.d.ts +17 -0
- package/dist/logger-factory.js +42 -0
- package/dist/message-builder.d.ts +41 -0
- package/dist/message-builder.js +522 -0
- package/dist/object-types-library-integration.d.ts +22 -0
- package/dist/object-types-library-integration.js +27 -0
- package/dist/object-types-library.d.ts +351 -0
- package/dist/object-types-library.js +210 -0
- package/dist/output-auditor.d.ts +44 -0
- package/dist/output-auditor.js +49 -0
- package/dist/request-report-generator.d.ts +60 -0
- package/dist/request-report-generator.js +169 -0
- package/dist/response-analyzer/format-type-detector.d.ts +35 -0
- package/dist/response-analyzer/format-type-detector.js +115 -0
- package/dist/response-analyzer/index.d.ts +9 -0
- package/dist/response-analyzer/index.js +8 -0
- package/dist/response-analyzer/object-type-detector.d.ts +42 -0
- package/dist/response-analyzer/object-type-detector.js +95 -0
- package/dist/response-analyzer/response-analyzer.d.ts +38 -0
- package/dist/response-analyzer/response-analyzer.js +97 -0
- package/dist/response-analyzer/types.d.ts +97 -0
- package/dist/response-analyzer/types.js +4 -0
- package/dist/response-fallback-fixer.d.ts +11 -0
- package/dist/response-fallback-fixer.js +123 -0
- package/dist/runtime-objects.d.ts +52 -0
- package/dist/runtime-objects.js +46 -0
- package/dist/template-parser.d.ts +58 -0
- package/dist/template-parser.js +99 -0
- package/dist/template-render-merge.d.ts +9 -0
- package/dist/template-render-merge.js +40 -0
- package/dist/troubleshooting-helper.d.ts +123 -0
- package/dist/troubleshooting-helper.js +596 -0
- package/dist/types.d.ts +1173 -0
- package/dist/types.js +6 -0
- package/dist/usage-tracker.d.ts +78 -0
- package/dist/usage-tracker.js +79 -0
- package/dist-cjs/activity-manager.cjs +1056 -0
- package/dist-cjs/activity-manager.d.ts +206 -0
- package/dist-cjs/config/activity-tracking-config.cjs +18 -0
- package/dist-cjs/config/activity-tracking-config.d.ts +11 -0
- package/dist-cjs/config.defaults.json +31 -0
- package/dist-cjs/content-normalizer/content-normalizer.cjs +398 -0
- package/dist-cjs/content-normalizer/content-normalizer.d.ts +46 -0
- package/dist-cjs/content-normalizer/index.cjs +12 -0
- package/dist-cjs/content-normalizer/index.d.ts +7 -0
- package/dist-cjs/content-normalizer/types.cjs +5 -0
- package/dist-cjs/content-normalizer/types.d.ts +33 -0
- package/dist-cjs/defaults/instructions-blocks.json +61 -0
- package/dist-cjs/defaults/model-config.json +16 -0
- package/dist-cjs/defaults/template-rendering.json +6 -0
- package/dist-cjs/flex-md-loader.cjs +986 -0
- package/dist-cjs/flex-md-loader.d.ts +109 -0
- package/dist-cjs/gateway-config.cjs +331 -0
- package/dist-cjs/gateway-config.d.ts +49 -0
- package/dist-cjs/gateway-conversion.cjs +212 -0
- package/dist-cjs/gateway-conversion.d.ts +29 -0
- package/dist-cjs/gateway-instructions.cjs +67 -0
- package/dist-cjs/gateway-instructions.d.ts +30 -0
- package/dist-cjs/gateway-memory.cjs +211 -0
- package/dist-cjs/gateway-memory.d.ts +51 -0
- package/dist-cjs/gateway-messages.cjs +86 -0
- package/dist-cjs/gateway-messages.d.ts +23 -0
- package/dist-cjs/gateway-meta.cjs +90 -0
- package/dist-cjs/gateway-meta.d.ts +25 -0
- package/dist-cjs/gateway-provider-auto-register.cjs +195 -0
- package/dist-cjs/gateway-provider-auto-register.d.ts +17 -0
- package/dist-cjs/gateway-provider.cjs +214 -0
- package/dist-cjs/gateway-provider.d.ts +54 -0
- package/dist-cjs/gateway-rate-limiter-constants.cjs +19 -0
- package/dist-cjs/gateway-rate-limiter-constants.d.ts +16 -0
- package/dist-cjs/gateway-rate-limiter.cjs +111 -0
- package/dist-cjs/gateway-rate-limiter.d.ts +56 -0
- package/dist-cjs/gateway-retry.cjs +212 -0
- package/dist-cjs/gateway-retry.d.ts +49 -0
- package/dist-cjs/gateway-utils.cjs +219 -0
- package/dist-cjs/gateway-utils.d.ts +21 -0
- package/dist-cjs/gateway-validation.cjs +54 -0
- package/dist-cjs/gateway-validation.d.ts +13 -0
- package/dist-cjs/gateway.cjs +434 -0
- package/dist-cjs/gateway.d.ts +39 -0
- package/dist-cjs/index.cjs +108 -0
- package/dist-cjs/index.d.ts +36 -0
- package/dist-cjs/instruction-errors.cjs +34 -0
- package/dist-cjs/instruction-errors.d.ts +16 -0
- package/dist-cjs/instruction-optimizer.cjs +299 -0
- package/dist-cjs/instruction-optimizer.d.ts +113 -0
- package/dist-cjs/instructions-parser.cjs +61 -0
- package/dist-cjs/instructions-parser.d.ts +31 -0
- package/dist-cjs/logger-factory.cjs +45 -0
- package/dist-cjs/logger-factory.d.ts +17 -0
- package/dist-cjs/message-builder.cjs +558 -0
- package/dist-cjs/message-builder.d.ts +41 -0
- package/dist-cjs/object-types-library-integration.cjs +32 -0
- package/dist-cjs/object-types-library-integration.d.ts +22 -0
- package/dist-cjs/object-types-library.cjs +215 -0
- package/dist-cjs/object-types-library.d.ts +351 -0
- package/dist-cjs/output-auditor.cjs +52 -0
- package/dist-cjs/output-auditor.d.ts +44 -0
- package/dist-cjs/request-report-generator.cjs +172 -0
- package/dist-cjs/request-report-generator.d.ts +60 -0
- package/dist-cjs/response-analyzer/format-type-detector.cjs +119 -0
- package/dist-cjs/response-analyzer/format-type-detector.d.ts +35 -0
- package/dist-cjs/response-analyzer/index.cjs +14 -0
- package/dist-cjs/response-analyzer/index.d.ts +9 -0
- package/dist-cjs/response-analyzer/object-type-detector.cjs +99 -0
- package/dist-cjs/response-analyzer/object-type-detector.d.ts +42 -0
- package/dist-cjs/response-analyzer/response-analyzer.cjs +101 -0
- package/dist-cjs/response-analyzer/response-analyzer.d.ts +38 -0
- package/dist-cjs/response-analyzer/types.cjs +5 -0
- package/dist-cjs/response-analyzer/types.d.ts +97 -0
- package/dist-cjs/response-fallback-fixer.cjs +126 -0
- package/dist-cjs/response-fallback-fixer.d.ts +11 -0
- package/dist-cjs/runtime-objects.cjs +52 -0
- package/dist-cjs/runtime-objects.d.ts +52 -0
- package/dist-cjs/template-parser.cjs +136 -0
- package/dist-cjs/template-parser.d.ts +58 -0
- package/dist-cjs/template-render-merge.cjs +43 -0
- package/dist-cjs/template-render-merge.d.ts +9 -0
- package/dist-cjs/troubleshooting-helper.cjs +611 -0
- package/dist-cjs/troubleshooting-helper.d.ts +123 -0
- package/dist-cjs/types.cjs +7 -0
- package/dist-cjs/types.d.ts +1173 -0
- package/dist-cjs/usage-tracker.cjs +83 -0
- package/dist-cjs/usage-tracker.d.ts +78 -0
- package/package.json +91 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Object Types Library
|
|
4
|
+
*
|
|
5
|
+
* Standard object type definitions for AI Gateway structured outputs.
|
|
6
|
+
* Each agent type has corresponding object types with JSON schemas.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.OBJECT_TYPES_LIBRARY = void 0;
|
|
10
|
+
exports.getObjectType = getObjectType;
|
|
11
|
+
exports.getObjectTypesForAgent = getObjectTypesForAgent;
|
|
12
|
+
exports.OBJECT_TYPES_LIBRARY = {
|
|
13
|
+
/**
|
|
14
|
+
* AI Reasoner - General reasoning and analysis
|
|
15
|
+
*/
|
|
16
|
+
'reasoning-result': {
|
|
17
|
+
type: 'reasoning-result',
|
|
18
|
+
whenToUse: 'For general reasoning and analysis tasks',
|
|
19
|
+
description: 'Structured reasoning output with analysis and conclusion',
|
|
20
|
+
schema: {
|
|
21
|
+
analysis: '<string> Detailed analysis of the problem',
|
|
22
|
+
reasoning: [
|
|
23
|
+
'<string> Step-by-step reasoning process'
|
|
24
|
+
],
|
|
25
|
+
conclusion: '<string> Final conclusion or recommendation',
|
|
26
|
+
confidence: '<number> Confidence score (0-1)'
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* AI Auditor - Code and process auditing
|
|
31
|
+
*/
|
|
32
|
+
'audit-report': {
|
|
33
|
+
type: 'audit-report',
|
|
34
|
+
whenToUse: 'For auditing code, processes, or compliance',
|
|
35
|
+
description: 'Structured audit findings and recommendations',
|
|
36
|
+
schema: {
|
|
37
|
+
summary: '<string> Executive summary of audit findings',
|
|
38
|
+
findings: [
|
|
39
|
+
'<object> Audit finding with structure:\n{\n "severity": "<string> critical|high|medium|low|info",\n "category": "<string> Category of the finding",\n "description": "<string> Description of the finding",\n "location": "<string> Location where the finding was identified",\n "recommendation": "<string> Recommended action to address the finding"\n}'
|
|
40
|
+
],
|
|
41
|
+
overallScore: '<number> Overall audit score (0-100)',
|
|
42
|
+
recommendations: [
|
|
43
|
+
'<string> Recommended action or improvement'
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
/**
|
|
48
|
+
* AI Scoper - Project scoping and requirements
|
|
49
|
+
*/
|
|
50
|
+
'scope-definition': {
|
|
51
|
+
type: 'scope-definition',
|
|
52
|
+
whenToUse: 'For defining project scope and requirements',
|
|
53
|
+
description: 'Structured project scope with requirements and constraints',
|
|
54
|
+
schema: {
|
|
55
|
+
projectName: '<string> Name of the project',
|
|
56
|
+
objectives: [
|
|
57
|
+
'<string> Project objective'
|
|
58
|
+
],
|
|
59
|
+
requirements: {
|
|
60
|
+
functional: [
|
|
61
|
+
'<string> Functional requirement'
|
|
62
|
+
],
|
|
63
|
+
nonFunctional: [
|
|
64
|
+
'<string> Non-functional requirement'
|
|
65
|
+
],
|
|
66
|
+
technical: [
|
|
67
|
+
'<string> Technical requirement'
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
constraints: [
|
|
71
|
+
'<object> Constraint with structure:\n{\n "type": "<string> Type of constraint",\n "description": "<string> Description of the constraint"\n}'
|
|
72
|
+
],
|
|
73
|
+
estimatedEffort: {
|
|
74
|
+
hours: '<number> Estimated hours',
|
|
75
|
+
complexity: '<string> low|medium|high|very-high'
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
/**
|
|
80
|
+
* AI Discovery - Research and information discovery
|
|
81
|
+
*/
|
|
82
|
+
'discovery-findings': {
|
|
83
|
+
type: 'discovery-findings',
|
|
84
|
+
whenToUse: 'For research and information discovery tasks',
|
|
85
|
+
description: 'Structured discovery results with insights and sources',
|
|
86
|
+
schema: {
|
|
87
|
+
topic: '<string> Topic of the discovery',
|
|
88
|
+
keyFindings: [
|
|
89
|
+
'<object> Key finding with structure:\n{\n "finding": "<string> The finding",\n "importance": "<string> critical|high|medium|low",\n "source": "<string> Source of the finding",\n "confidence": "<number> Confidence score (0-1)"\n}'
|
|
90
|
+
],
|
|
91
|
+
insights: [
|
|
92
|
+
'<string> Insight or observation'
|
|
93
|
+
],
|
|
94
|
+
relatedTopics: [
|
|
95
|
+
'<string> Related topic'
|
|
96
|
+
],
|
|
97
|
+
nextSteps: [
|
|
98
|
+
'<string> Recommended next step'
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
/**
|
|
103
|
+
* AI Planner - Planning and strategy
|
|
104
|
+
*/
|
|
105
|
+
'action-plan': {
|
|
106
|
+
type: 'action-plan',
|
|
107
|
+
whenToUse: 'For creating action plans and strategies',
|
|
108
|
+
description: 'Structured action plan with tasks and timeline',
|
|
109
|
+
schema: {
|
|
110
|
+
goal: '<string> Goal of the action plan',
|
|
111
|
+
strategy: '<string> Strategy to achieve the goal',
|
|
112
|
+
phases: [
|
|
113
|
+
'<object> Phase with structure:\n{\n "name": "<string> Phase name",\n "description": "<string> Phase description",\n "duration": "<string> Estimated duration",\n "tasks": [\n "<object> Task with structure:\n {\n \"id\": \"<string> Task ID\",\n \"title\": \"<string> Task title\",\n \"description\": \"<string> Task description\",\n \"priority\": \"<string> critical|high|medium|low\",\n \"estimatedHours\": \"<number> Estimated hours\",\n \"dependencies\": [\"<string> Task ID dependency\"]\n }"\n ]\n}'
|
|
114
|
+
],
|
|
115
|
+
risks: [
|
|
116
|
+
'<object> Risk with structure:\n{\n "risk": "<string> Description of the risk",\n "impact": "<string> high|medium|low",\n "mitigation": "<string> Mitigation strategy"\n}'
|
|
117
|
+
],
|
|
118
|
+
successCriteria: [
|
|
119
|
+
'<string> Success criterion'
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
/**
|
|
124
|
+
* AI Executor - Task execution
|
|
125
|
+
*/
|
|
126
|
+
'execution-result': {
|
|
127
|
+
type: 'execution-result',
|
|
128
|
+
whenToUse: 'For task execution and implementation results',
|
|
129
|
+
description: 'Structured execution results with status and outputs',
|
|
130
|
+
schema: {
|
|
131
|
+
taskId: '<string> Task identifier',
|
|
132
|
+
status: '<string> completed|partial|failed|blocked',
|
|
133
|
+
outputs: [
|
|
134
|
+
'<object> Output with structure:\n{\n "type": "<string> Type of output",\n "description": "<string> Description of the output",\n "content": "<string> Output content",\n "metadata": "<object> Additional metadata"\n}'
|
|
135
|
+
],
|
|
136
|
+
stepsCompleted: [
|
|
137
|
+
'<object> Completed step with structure:\n{\n "step": "<string> Step name",\n "status": "<string> Step status",\n "timestamp": "<string> Timestamp",\n "notes": "<string> Additional notes"\n}'
|
|
138
|
+
],
|
|
139
|
+
errors: [
|
|
140
|
+
'<object> Error with structure:\n{\n "code": "<string> Error code",\n "message": "<string> Error message",\n "severity": "<string> Error severity"\n}'
|
|
141
|
+
],
|
|
142
|
+
nextActions: [
|
|
143
|
+
'<string> Recommended next action'
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
/**
|
|
148
|
+
* Common: Classification
|
|
149
|
+
*/
|
|
150
|
+
'classification': {
|
|
151
|
+
type: 'classification',
|
|
152
|
+
whenToUse: 'For classification and categorization tasks',
|
|
153
|
+
description: 'Classification result with classes and confidence scores',
|
|
154
|
+
schema: {
|
|
155
|
+
classes: [
|
|
156
|
+
'<string> Classification class'
|
|
157
|
+
],
|
|
158
|
+
confidence: '<object> Confidence scores for each class (key-value pairs)',
|
|
159
|
+
primaryClass: '<string> Primary classification class'
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
/**
|
|
163
|
+
* Common: Extraction
|
|
164
|
+
*/
|
|
165
|
+
'extraction': {
|
|
166
|
+
type: 'extraction',
|
|
167
|
+
whenToUse: 'For extracting structured data from text',
|
|
168
|
+
description: 'Extracted structured data with metadata',
|
|
169
|
+
schema: {
|
|
170
|
+
extracted: '<object> Extracted key-value pairs',
|
|
171
|
+
metadata: {
|
|
172
|
+
source: '<string> Source of the extracted data',
|
|
173
|
+
confidence: '<number> Confidence score of the extraction'
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
/**
|
|
178
|
+
* Common: Question-Answer
|
|
179
|
+
*/
|
|
180
|
+
'question-answer': {
|
|
181
|
+
type: 'question-answer',
|
|
182
|
+
whenToUse: 'For answering questions',
|
|
183
|
+
description: 'Question answer with reasoning and sources',
|
|
184
|
+
schema: {
|
|
185
|
+
answer: '<string> Answer to the question',
|
|
186
|
+
reasoning: '<string> Reasoning behind the answer',
|
|
187
|
+
sources: [
|
|
188
|
+
'<string> Source reference'
|
|
189
|
+
],
|
|
190
|
+
confidence: '<number> Confidence score (0-1)'
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Get object type definition by name
|
|
196
|
+
*/
|
|
197
|
+
function getObjectType(typeName) {
|
|
198
|
+
return exports.OBJECT_TYPES_LIBRARY[typeName];
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Get all object types for a specific agent type
|
|
202
|
+
*/
|
|
203
|
+
function getObjectTypesForAgent(agentType) {
|
|
204
|
+
const mapping = {
|
|
205
|
+
'ai-reasoner': ['reasoning-result', 'classification', 'question-answer'],
|
|
206
|
+
'ai-auditor': ['audit-report'],
|
|
207
|
+
'ai-scoper': ['scope-definition'],
|
|
208
|
+
'ai-discovery': ['discovery-findings'],
|
|
209
|
+
'ai-planner': ['action-plan'],
|
|
210
|
+
'ai-executor': ['execution-result'],
|
|
211
|
+
'chat': [] // Chat doesn't use structured outputs
|
|
212
|
+
};
|
|
213
|
+
const typeNames = mapping[agentType] || [];
|
|
214
|
+
return typeNames.map(name => exports.OBJECT_TYPES_LIBRARY[name]);
|
|
215
|
+
}
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Object Types Library
|
|
3
|
+
*
|
|
4
|
+
* Standard object type definitions for AI Gateway structured outputs.
|
|
5
|
+
* Each agent type has corresponding object types with JSON schemas.
|
|
6
|
+
*/
|
|
7
|
+
export declare const OBJECT_TYPES_LIBRARY: {
|
|
8
|
+
/**
|
|
9
|
+
* AI Reasoner - General reasoning and analysis
|
|
10
|
+
*/
|
|
11
|
+
readonly 'reasoning-result': {
|
|
12
|
+
readonly type: "reasoning-result";
|
|
13
|
+
readonly whenToUse: "For general reasoning and analysis tasks";
|
|
14
|
+
readonly description: "Structured reasoning output with analysis and conclusion";
|
|
15
|
+
readonly schema: {
|
|
16
|
+
readonly analysis: "<string> Detailed analysis of the problem";
|
|
17
|
+
readonly reasoning: readonly ["<string> Step-by-step reasoning process"];
|
|
18
|
+
readonly conclusion: "<string> Final conclusion or recommendation";
|
|
19
|
+
readonly confidence: "<number> Confidence score (0-1)";
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* AI Auditor - Code and process auditing
|
|
24
|
+
*/
|
|
25
|
+
readonly 'audit-report': {
|
|
26
|
+
readonly type: "audit-report";
|
|
27
|
+
readonly whenToUse: "For auditing code, processes, or compliance";
|
|
28
|
+
readonly description: "Structured audit findings and recommendations";
|
|
29
|
+
readonly schema: {
|
|
30
|
+
readonly summary: "<string> Executive summary of audit findings";
|
|
31
|
+
readonly findings: readonly ["<object> Audit finding with structure:\n{\n \"severity\": \"<string> critical|high|medium|low|info\",\n \"category\": \"<string> Category of the finding\",\n \"description\": \"<string> Description of the finding\",\n \"location\": \"<string> Location where the finding was identified\",\n \"recommendation\": \"<string> Recommended action to address the finding\"\n}"];
|
|
32
|
+
readonly overallScore: "<number> Overall audit score (0-100)";
|
|
33
|
+
readonly recommendations: readonly ["<string> Recommended action or improvement"];
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* AI Scoper - Project scoping and requirements
|
|
38
|
+
*/
|
|
39
|
+
readonly 'scope-definition': {
|
|
40
|
+
readonly type: "scope-definition";
|
|
41
|
+
readonly whenToUse: "For defining project scope and requirements";
|
|
42
|
+
readonly description: "Structured project scope with requirements and constraints";
|
|
43
|
+
readonly schema: {
|
|
44
|
+
readonly projectName: "<string> Name of the project";
|
|
45
|
+
readonly objectives: readonly ["<string> Project objective"];
|
|
46
|
+
readonly requirements: {
|
|
47
|
+
readonly functional: readonly ["<string> Functional requirement"];
|
|
48
|
+
readonly nonFunctional: readonly ["<string> Non-functional requirement"];
|
|
49
|
+
readonly technical: readonly ["<string> Technical requirement"];
|
|
50
|
+
};
|
|
51
|
+
readonly constraints: readonly ["<object> Constraint with structure:\n{\n \"type\": \"<string> Type of constraint\",\n \"description\": \"<string> Description of the constraint\"\n}"];
|
|
52
|
+
readonly estimatedEffort: {
|
|
53
|
+
readonly hours: "<number> Estimated hours";
|
|
54
|
+
readonly complexity: "<string> low|medium|high|very-high";
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* AI Discovery - Research and information discovery
|
|
60
|
+
*/
|
|
61
|
+
readonly 'discovery-findings': {
|
|
62
|
+
readonly type: "discovery-findings";
|
|
63
|
+
readonly whenToUse: "For research and information discovery tasks";
|
|
64
|
+
readonly description: "Structured discovery results with insights and sources";
|
|
65
|
+
readonly schema: {
|
|
66
|
+
readonly topic: "<string> Topic of the discovery";
|
|
67
|
+
readonly keyFindings: readonly ["<object> Key finding with structure:\n{\n \"finding\": \"<string> The finding\",\n \"importance\": \"<string> critical|high|medium|low\",\n \"source\": \"<string> Source of the finding\",\n \"confidence\": \"<number> Confidence score (0-1)\"\n}"];
|
|
68
|
+
readonly insights: readonly ["<string> Insight or observation"];
|
|
69
|
+
readonly relatedTopics: readonly ["<string> Related topic"];
|
|
70
|
+
readonly nextSteps: readonly ["<string> Recommended next step"];
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* AI Planner - Planning and strategy
|
|
75
|
+
*/
|
|
76
|
+
readonly 'action-plan': {
|
|
77
|
+
readonly type: "action-plan";
|
|
78
|
+
readonly whenToUse: "For creating action plans and strategies";
|
|
79
|
+
readonly description: "Structured action plan with tasks and timeline";
|
|
80
|
+
readonly schema: {
|
|
81
|
+
readonly goal: "<string> Goal of the action plan";
|
|
82
|
+
readonly strategy: "<string> Strategy to achieve the goal";
|
|
83
|
+
readonly phases: readonly ["<object> Phase with structure:\n{\n \"name\": \"<string> Phase name\",\n \"description\": \"<string> Phase description\",\n \"duration\": \"<string> Estimated duration\",\n \"tasks\": [\n \"<object> Task with structure:\n {\n \"id\": \"<string> Task ID\",\n \"title\": \"<string> Task title\",\n \"description\": \"<string> Task description\",\n \"priority\": \"<string> critical|high|medium|low\",\n \"estimatedHours\": \"<number> Estimated hours\",\n \"dependencies\": [\"<string> Task ID dependency\"]\n }\"\n ]\n}"];
|
|
84
|
+
readonly risks: readonly ["<object> Risk with structure:\n{\n \"risk\": \"<string> Description of the risk\",\n \"impact\": \"<string> high|medium|low\",\n \"mitigation\": \"<string> Mitigation strategy\"\n}"];
|
|
85
|
+
readonly successCriteria: readonly ["<string> Success criterion"];
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* AI Executor - Task execution
|
|
90
|
+
*/
|
|
91
|
+
readonly 'execution-result': {
|
|
92
|
+
readonly type: "execution-result";
|
|
93
|
+
readonly whenToUse: "For task execution and implementation results";
|
|
94
|
+
readonly description: "Structured execution results with status and outputs";
|
|
95
|
+
readonly schema: {
|
|
96
|
+
readonly taskId: "<string> Task identifier";
|
|
97
|
+
readonly status: "<string> completed|partial|failed|blocked";
|
|
98
|
+
readonly outputs: readonly ["<object> Output with structure:\n{\n \"type\": \"<string> Type of output\",\n \"description\": \"<string> Description of the output\",\n \"content\": \"<string> Output content\",\n \"metadata\": \"<object> Additional metadata\"\n}"];
|
|
99
|
+
readonly stepsCompleted: readonly ["<object> Completed step with structure:\n{\n \"step\": \"<string> Step name\",\n \"status\": \"<string> Step status\",\n \"timestamp\": \"<string> Timestamp\",\n \"notes\": \"<string> Additional notes\"\n}"];
|
|
100
|
+
readonly errors: readonly ["<object> Error with structure:\n{\n \"code\": \"<string> Error code\",\n \"message\": \"<string> Error message\",\n \"severity\": \"<string> Error severity\"\n}"];
|
|
101
|
+
readonly nextActions: readonly ["<string> Recommended next action"];
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Common: Classification
|
|
106
|
+
*/
|
|
107
|
+
readonly classification: {
|
|
108
|
+
readonly type: "classification";
|
|
109
|
+
readonly whenToUse: "For classification and categorization tasks";
|
|
110
|
+
readonly description: "Classification result with classes and confidence scores";
|
|
111
|
+
readonly schema: {
|
|
112
|
+
readonly classes: readonly ["<string> Classification class"];
|
|
113
|
+
readonly confidence: "<object> Confidence scores for each class (key-value pairs)";
|
|
114
|
+
readonly primaryClass: "<string> Primary classification class";
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Common: Extraction
|
|
119
|
+
*/
|
|
120
|
+
readonly extraction: {
|
|
121
|
+
readonly type: "extraction";
|
|
122
|
+
readonly whenToUse: "For extracting structured data from text";
|
|
123
|
+
readonly description: "Extracted structured data with metadata";
|
|
124
|
+
readonly schema: {
|
|
125
|
+
readonly extracted: "<object> Extracted key-value pairs";
|
|
126
|
+
readonly metadata: {
|
|
127
|
+
readonly source: "<string> Source of the extracted data";
|
|
128
|
+
readonly confidence: "<number> Confidence score of the extraction";
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Common: Question-Answer
|
|
134
|
+
*/
|
|
135
|
+
readonly 'question-answer': {
|
|
136
|
+
readonly type: "question-answer";
|
|
137
|
+
readonly whenToUse: "For answering questions";
|
|
138
|
+
readonly description: "Question answer with reasoning and sources";
|
|
139
|
+
readonly schema: {
|
|
140
|
+
readonly answer: "<string> Answer to the question";
|
|
141
|
+
readonly reasoning: "<string> Reasoning behind the answer";
|
|
142
|
+
readonly sources: readonly ["<string> Source reference"];
|
|
143
|
+
readonly confidence: "<number> Confidence score (0-1)";
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Get object type definition by name
|
|
149
|
+
*/
|
|
150
|
+
export declare function getObjectType(typeName: keyof typeof OBJECT_TYPES_LIBRARY): {
|
|
151
|
+
readonly type: "reasoning-result";
|
|
152
|
+
readonly whenToUse: "For general reasoning and analysis tasks";
|
|
153
|
+
readonly description: "Structured reasoning output with analysis and conclusion";
|
|
154
|
+
readonly schema: {
|
|
155
|
+
readonly analysis: "<string> Detailed analysis of the problem";
|
|
156
|
+
readonly reasoning: readonly ["<string> Step-by-step reasoning process"];
|
|
157
|
+
readonly conclusion: "<string> Final conclusion or recommendation";
|
|
158
|
+
readonly confidence: "<number> Confidence score (0-1)";
|
|
159
|
+
};
|
|
160
|
+
} | {
|
|
161
|
+
readonly type: "audit-report";
|
|
162
|
+
readonly whenToUse: "For auditing code, processes, or compliance";
|
|
163
|
+
readonly description: "Structured audit findings and recommendations";
|
|
164
|
+
readonly schema: {
|
|
165
|
+
readonly summary: "<string> Executive summary of audit findings";
|
|
166
|
+
readonly findings: readonly ["<object> Audit finding with structure:\n{\n \"severity\": \"<string> critical|high|medium|low|info\",\n \"category\": \"<string> Category of the finding\",\n \"description\": \"<string> Description of the finding\",\n \"location\": \"<string> Location where the finding was identified\",\n \"recommendation\": \"<string> Recommended action to address the finding\"\n}"];
|
|
167
|
+
readonly overallScore: "<number> Overall audit score (0-100)";
|
|
168
|
+
readonly recommendations: readonly ["<string> Recommended action or improvement"];
|
|
169
|
+
};
|
|
170
|
+
} | {
|
|
171
|
+
readonly type: "scope-definition";
|
|
172
|
+
readonly whenToUse: "For defining project scope and requirements";
|
|
173
|
+
readonly description: "Structured project scope with requirements and constraints";
|
|
174
|
+
readonly schema: {
|
|
175
|
+
readonly projectName: "<string> Name of the project";
|
|
176
|
+
readonly objectives: readonly ["<string> Project objective"];
|
|
177
|
+
readonly requirements: {
|
|
178
|
+
readonly functional: readonly ["<string> Functional requirement"];
|
|
179
|
+
readonly nonFunctional: readonly ["<string> Non-functional requirement"];
|
|
180
|
+
readonly technical: readonly ["<string> Technical requirement"];
|
|
181
|
+
};
|
|
182
|
+
readonly constraints: readonly ["<object> Constraint with structure:\n{\n \"type\": \"<string> Type of constraint\",\n \"description\": \"<string> Description of the constraint\"\n}"];
|
|
183
|
+
readonly estimatedEffort: {
|
|
184
|
+
readonly hours: "<number> Estimated hours";
|
|
185
|
+
readonly complexity: "<string> low|medium|high|very-high";
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
} | {
|
|
189
|
+
readonly type: "discovery-findings";
|
|
190
|
+
readonly whenToUse: "For research and information discovery tasks";
|
|
191
|
+
readonly description: "Structured discovery results with insights and sources";
|
|
192
|
+
readonly schema: {
|
|
193
|
+
readonly topic: "<string> Topic of the discovery";
|
|
194
|
+
readonly keyFindings: readonly ["<object> Key finding with structure:\n{\n \"finding\": \"<string> The finding\",\n \"importance\": \"<string> critical|high|medium|low\",\n \"source\": \"<string> Source of the finding\",\n \"confidence\": \"<number> Confidence score (0-1)\"\n}"];
|
|
195
|
+
readonly insights: readonly ["<string> Insight or observation"];
|
|
196
|
+
readonly relatedTopics: readonly ["<string> Related topic"];
|
|
197
|
+
readonly nextSteps: readonly ["<string> Recommended next step"];
|
|
198
|
+
};
|
|
199
|
+
} | {
|
|
200
|
+
readonly type: "action-plan";
|
|
201
|
+
readonly whenToUse: "For creating action plans and strategies";
|
|
202
|
+
readonly description: "Structured action plan with tasks and timeline";
|
|
203
|
+
readonly schema: {
|
|
204
|
+
readonly goal: "<string> Goal of the action plan";
|
|
205
|
+
readonly strategy: "<string> Strategy to achieve the goal";
|
|
206
|
+
readonly phases: readonly ["<object> Phase with structure:\n{\n \"name\": \"<string> Phase name\",\n \"description\": \"<string> Phase description\",\n \"duration\": \"<string> Estimated duration\",\n \"tasks\": [\n \"<object> Task with structure:\n {\n \"id\": \"<string> Task ID\",\n \"title\": \"<string> Task title\",\n \"description\": \"<string> Task description\",\n \"priority\": \"<string> critical|high|medium|low\",\n \"estimatedHours\": \"<number> Estimated hours\",\n \"dependencies\": [\"<string> Task ID dependency\"]\n }\"\n ]\n}"];
|
|
207
|
+
readonly risks: readonly ["<object> Risk with structure:\n{\n \"risk\": \"<string> Description of the risk\",\n \"impact\": \"<string> high|medium|low\",\n \"mitigation\": \"<string> Mitigation strategy\"\n}"];
|
|
208
|
+
readonly successCriteria: readonly ["<string> Success criterion"];
|
|
209
|
+
};
|
|
210
|
+
} | {
|
|
211
|
+
readonly type: "execution-result";
|
|
212
|
+
readonly whenToUse: "For task execution and implementation results";
|
|
213
|
+
readonly description: "Structured execution results with status and outputs";
|
|
214
|
+
readonly schema: {
|
|
215
|
+
readonly taskId: "<string> Task identifier";
|
|
216
|
+
readonly status: "<string> completed|partial|failed|blocked";
|
|
217
|
+
readonly outputs: readonly ["<object> Output with structure:\n{\n \"type\": \"<string> Type of output\",\n \"description\": \"<string> Description of the output\",\n \"content\": \"<string> Output content\",\n \"metadata\": \"<object> Additional metadata\"\n}"];
|
|
218
|
+
readonly stepsCompleted: readonly ["<object> Completed step with structure:\n{\n \"step\": \"<string> Step name\",\n \"status\": \"<string> Step status\",\n \"timestamp\": \"<string> Timestamp\",\n \"notes\": \"<string> Additional notes\"\n}"];
|
|
219
|
+
readonly errors: readonly ["<object> Error with structure:\n{\n \"code\": \"<string> Error code\",\n \"message\": \"<string> Error message\",\n \"severity\": \"<string> Error severity\"\n}"];
|
|
220
|
+
readonly nextActions: readonly ["<string> Recommended next action"];
|
|
221
|
+
};
|
|
222
|
+
} | {
|
|
223
|
+
readonly type: "classification";
|
|
224
|
+
readonly whenToUse: "For classification and categorization tasks";
|
|
225
|
+
readonly description: "Classification result with classes and confidence scores";
|
|
226
|
+
readonly schema: {
|
|
227
|
+
readonly classes: readonly ["<string> Classification class"];
|
|
228
|
+
readonly confidence: "<object> Confidence scores for each class (key-value pairs)";
|
|
229
|
+
readonly primaryClass: "<string> Primary classification class";
|
|
230
|
+
};
|
|
231
|
+
} | {
|
|
232
|
+
readonly type: "extraction";
|
|
233
|
+
readonly whenToUse: "For extracting structured data from text";
|
|
234
|
+
readonly description: "Extracted structured data with metadata";
|
|
235
|
+
readonly schema: {
|
|
236
|
+
readonly extracted: "<object> Extracted key-value pairs";
|
|
237
|
+
readonly metadata: {
|
|
238
|
+
readonly source: "<string> Source of the extracted data";
|
|
239
|
+
readonly confidence: "<number> Confidence score of the extraction";
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
} | {
|
|
243
|
+
readonly type: "question-answer";
|
|
244
|
+
readonly whenToUse: "For answering questions";
|
|
245
|
+
readonly description: "Question answer with reasoning and sources";
|
|
246
|
+
readonly schema: {
|
|
247
|
+
readonly answer: "<string> Answer to the question";
|
|
248
|
+
readonly reasoning: "<string> Reasoning behind the answer";
|
|
249
|
+
readonly sources: readonly ["<string> Source reference"];
|
|
250
|
+
readonly confidence: "<number> Confidence score (0-1)";
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
* Get all object types for a specific agent type
|
|
255
|
+
*/
|
|
256
|
+
export declare function getObjectTypesForAgent(agentType: string): Array<typeof OBJECT_TYPES_LIBRARY[keyof typeof OBJECT_TYPES_LIBRARY]>;
|
|
257
|
+
/**
|
|
258
|
+
* Type definitions for object type results
|
|
259
|
+
*/
|
|
260
|
+
export type ReasoningResult = {
|
|
261
|
+
analysis: string;
|
|
262
|
+
reasoning?: string[];
|
|
263
|
+
conclusion: string;
|
|
264
|
+
confidence?: number;
|
|
265
|
+
};
|
|
266
|
+
export type AuditReport = {
|
|
267
|
+
summary: string;
|
|
268
|
+
findings: Array<{
|
|
269
|
+
severity: 'critical' | 'high' | 'medium' | 'low' | 'info';
|
|
270
|
+
category?: string;
|
|
271
|
+
description: string;
|
|
272
|
+
location?: string;
|
|
273
|
+
recommendation?: string;
|
|
274
|
+
}>;
|
|
275
|
+
overallScore?: number;
|
|
276
|
+
recommendations?: string[];
|
|
277
|
+
};
|
|
278
|
+
export type ScopeDefinition = {
|
|
279
|
+
projectName: string;
|
|
280
|
+
objectives: string[];
|
|
281
|
+
requirements: {
|
|
282
|
+
functional?: string[];
|
|
283
|
+
nonFunctional?: string[];
|
|
284
|
+
technical?: string[];
|
|
285
|
+
};
|
|
286
|
+
constraints?: Array<{
|
|
287
|
+
type: string;
|
|
288
|
+
description: string;
|
|
289
|
+
}>;
|
|
290
|
+
estimatedEffort?: {
|
|
291
|
+
hours: number;
|
|
292
|
+
complexity: 'low' | 'medium' | 'high' | 'very-high';
|
|
293
|
+
};
|
|
294
|
+
};
|
|
295
|
+
export type DiscoveryFindings = {
|
|
296
|
+
topic: string;
|
|
297
|
+
keyFindings: Array<{
|
|
298
|
+
finding: string;
|
|
299
|
+
importance: 'critical' | 'high' | 'medium' | 'low';
|
|
300
|
+
source?: string;
|
|
301
|
+
confidence?: number;
|
|
302
|
+
}>;
|
|
303
|
+
insights?: string[];
|
|
304
|
+
relatedTopics?: string[];
|
|
305
|
+
nextSteps?: string[];
|
|
306
|
+
};
|
|
307
|
+
export type ActionPlan = {
|
|
308
|
+
goal: string;
|
|
309
|
+
strategy?: string;
|
|
310
|
+
phases: Array<{
|
|
311
|
+
name: string;
|
|
312
|
+
description?: string;
|
|
313
|
+
duration?: string;
|
|
314
|
+
tasks: Array<{
|
|
315
|
+
id: string;
|
|
316
|
+
title: string;
|
|
317
|
+
description?: string;
|
|
318
|
+
priority: 'critical' | 'high' | 'medium' | 'low';
|
|
319
|
+
estimatedHours?: number;
|
|
320
|
+
dependencies?: string[];
|
|
321
|
+
}>;
|
|
322
|
+
}>;
|
|
323
|
+
risks?: Array<{
|
|
324
|
+
risk: string;
|
|
325
|
+
impact: 'high' | 'medium' | 'low';
|
|
326
|
+
mitigation?: string;
|
|
327
|
+
}>;
|
|
328
|
+
successCriteria?: string[];
|
|
329
|
+
};
|
|
330
|
+
export type ExecutionResult = {
|
|
331
|
+
taskId: string;
|
|
332
|
+
status: 'completed' | 'partial' | 'failed' | 'blocked';
|
|
333
|
+
outputs: Array<{
|
|
334
|
+
type: string;
|
|
335
|
+
description: string;
|
|
336
|
+
content?: string;
|
|
337
|
+
metadata?: Record<string, unknown>;
|
|
338
|
+
}>;
|
|
339
|
+
stepsCompleted?: Array<{
|
|
340
|
+
step: string;
|
|
341
|
+
status: string;
|
|
342
|
+
timestamp?: string;
|
|
343
|
+
notes?: string;
|
|
344
|
+
}>;
|
|
345
|
+
errors?: Array<{
|
|
346
|
+
code: string;
|
|
347
|
+
message: string;
|
|
348
|
+
severity?: string;
|
|
349
|
+
}>;
|
|
350
|
+
nextActions?: string[];
|
|
351
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Output Structure Auditor
|
|
4
|
+
*
|
|
5
|
+
* Audits the structure of parsed output against the expected schema.
|
|
6
|
+
* Provides detailed analysis of what fields are present, missing, or extra.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.auditOutputStructure = auditOutputStructure;
|
|
10
|
+
/**
|
|
11
|
+
* Audits the structure of parsed output against the expected schema
|
|
12
|
+
*
|
|
13
|
+
* @param parsedOutput - The parsed output object to audit
|
|
14
|
+
* @param schema - The JSON schema to compare against
|
|
15
|
+
* @returns Audit result with detailed structure analysis
|
|
16
|
+
*/
|
|
17
|
+
function auditOutputStructure(parsedOutput, schema) {
|
|
18
|
+
// Only audit if we have both parsedOutput and schema
|
|
19
|
+
if (!parsedOutput || !schema) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
// Only audit objects (not arrays or primitives)
|
|
23
|
+
if (typeof parsedOutput !== 'object' || Array.isArray(parsedOutput) || parsedOutput === null) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
const output = parsedOutput;
|
|
27
|
+
const schemaProperties = schema?.properties || {};
|
|
28
|
+
const requiredFields = schema?.required || [];
|
|
29
|
+
// Get all fields from response
|
|
30
|
+
const responseFields = new Set(Object.keys(output));
|
|
31
|
+
// Get all fields from schema
|
|
32
|
+
const schemaFields = new Set(Object.keys(schemaProperties));
|
|
33
|
+
// Find missing required fields
|
|
34
|
+
const missingRequired = requiredFields.filter((field) => !responseFields.has(field));
|
|
35
|
+
// Find extra fields (in response but not in schema)
|
|
36
|
+
const extra = Array.from(responseFields).filter(field => !schemaFields.has(field));
|
|
37
|
+
// Find matching fields (in both response and schema)
|
|
38
|
+
const matching = Array.from(responseFields).filter(field => schemaFields.has(field));
|
|
39
|
+
// Check if structure matches
|
|
40
|
+
const hasAllRequired = missingRequired.length === 0;
|
|
41
|
+
const hasNoExtra = extra.length === 0;
|
|
42
|
+
const structureMatches = hasAllRequired && hasNoExtra;
|
|
43
|
+
return {
|
|
44
|
+
hasAllRequiredFields: hasAllRequired,
|
|
45
|
+
missingRequiredFields: missingRequired.length > 0 ? missingRequired : undefined,
|
|
46
|
+
extraFields: extra.length > 0 ? extra : undefined,
|
|
47
|
+
matchingFields: matching.length > 0 ? matching : undefined,
|
|
48
|
+
responseFieldCount: responseFields.size,
|
|
49
|
+
schemaFieldCount: schemaFields.size,
|
|
50
|
+
structureMatches
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output Structure Auditor
|
|
3
|
+
*
|
|
4
|
+
* Audits the structure of parsed output against the expected schema.
|
|
5
|
+
* Provides detailed analysis of what fields are present, missing, or extra.
|
|
6
|
+
*/
|
|
7
|
+
export interface OutputAuditResult {
|
|
8
|
+
/**
|
|
9
|
+
* Whether all required fields from schema are present
|
|
10
|
+
*/
|
|
11
|
+
hasAllRequiredFields: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Missing required fields (if any)
|
|
14
|
+
*/
|
|
15
|
+
missingRequiredFields?: string[];
|
|
16
|
+
/**
|
|
17
|
+
* Fields present in response but not in schema (extra fields)
|
|
18
|
+
*/
|
|
19
|
+
extraFields?: string[];
|
|
20
|
+
/**
|
|
21
|
+
* Fields present in both response and schema
|
|
22
|
+
*/
|
|
23
|
+
matchingFields?: string[];
|
|
24
|
+
/**
|
|
25
|
+
* Total number of fields in the response
|
|
26
|
+
*/
|
|
27
|
+
responseFieldCount: number;
|
|
28
|
+
/**
|
|
29
|
+
* Total number of fields expected in schema
|
|
30
|
+
*/
|
|
31
|
+
schemaFieldCount: number;
|
|
32
|
+
/**
|
|
33
|
+
* Whether the structure matches the schema exactly (all required fields present, no extra fields)
|
|
34
|
+
*/
|
|
35
|
+
structureMatches: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Audits the structure of parsed output against the expected schema
|
|
39
|
+
*
|
|
40
|
+
* @param parsedOutput - The parsed output object to audit
|
|
41
|
+
* @param schema - The JSON schema to compare against
|
|
42
|
+
* @returns Audit result with detailed structure analysis
|
|
43
|
+
*/
|
|
44
|
+
export declare function auditOutputStructure(parsedOutput: unknown, schema: Record<string, unknown>): OutputAuditResult | undefined;
|