mcp-adr-analysis-server 2.0.9 → 2.0.10
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/dist/src/index.d.ts +8 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +434 -5
- package/dist/src/index.js.map +1 -1
- package/dist/src/resources/index.d.ts.map +1 -1
- package/dist/src/resources/index.js +71 -1
- package/dist/src/resources/index.js.map +1 -1
- package/dist/src/tools/human-override-tool.d.ts +42 -0
- package/dist/src/tools/human-override-tool.d.ts.map +1 -0
- package/dist/src/tools/human-override-tool.js +431 -0
- package/dist/src/tools/human-override-tool.js.map +1 -0
- package/dist/src/tools/smart-git-push-tool.d.ts +5 -1
- package/dist/src/tools/smart-git-push-tool.d.ts.map +1 -1
- package/dist/src/tools/smart-git-push-tool.js +70 -25
- package/dist/src/tools/smart-git-push-tool.js.map +1 -1
- package/dist/src/tools/smart-score-tool.d.ts +138 -0
- package/dist/src/tools/smart-score-tool.d.ts.map +1 -0
- package/dist/src/tools/smart-score-tool.js +602 -0
- package/dist/src/tools/smart-score-tool.js.map +1 -0
- package/dist/src/tools/todo-management-tool.d.ts +184 -6
- package/dist/src/tools/todo-management-tool.d.ts.map +1 -1
- package/dist/src/tools/todo-management-tool.js +819 -42
- package/dist/src/tools/todo-management-tool.js.map +1 -1
- package/dist/src/tools/tool-chain-orchestrator.d.ts +164 -0
- package/dist/src/tools/tool-chain-orchestrator.d.ts.map +1 -0
- package/dist/src/tools/tool-chain-orchestrator.js +738 -0
- package/dist/src/tools/tool-chain-orchestrator.js.map +1 -0
- package/dist/src/tools/troubleshoot-guided-workflow-tool.d.ts +150 -0
- package/dist/src/tools/troubleshoot-guided-workflow-tool.d.ts.map +1 -0
- package/dist/src/tools/troubleshoot-guided-workflow-tool.js +520 -0
- package/dist/src/tools/troubleshoot-guided-workflow-tool.js.map +1 -0
- package/dist/src/types/knowledge-graph-schemas.d.ts +481 -0
- package/dist/src/types/knowledge-graph-schemas.d.ts.map +1 -0
- package/dist/src/types/knowledge-graph-schemas.js +59 -0
- package/dist/src/types/knowledge-graph-schemas.js.map +1 -0
- package/dist/src/utils/json-safe.d.ts +38 -0
- package/dist/src/utils/json-safe.d.ts.map +1 -0
- package/dist/src/utils/json-safe.js +86 -0
- package/dist/src/utils/json-safe.js.map +1 -0
- package/dist/src/utils/knowledge-graph-manager.d.ts +28 -0
- package/dist/src/utils/knowledge-graph-manager.d.ts.map +1 -0
- package/dist/src/utils/knowledge-graph-manager.js +192 -0
- package/dist/src/utils/knowledge-graph-manager.js.map +1 -0
- package/dist/src/utils/mcp-response-validator.d.ts +30 -0
- package/dist/src/utils/mcp-response-validator.d.ts.map +1 -0
- package/dist/src/utils/mcp-response-validator.js +197 -0
- package/dist/src/utils/mcp-response-validator.js.map +1 -0
- package/dist/src/utils/project-health-scoring.d.ts +177 -0
- package/dist/src/utils/project-health-scoring.d.ts.map +1 -0
- package/dist/src/utils/project-health-scoring.js +370 -0
- package/dist/src/utils/project-health-scoring.js.map +1 -0
- package/dist/src/utils/release-readiness-detector.d.ts +2 -0
- package/dist/src/utils/release-readiness-detector.d.ts.map +1 -1
- package/dist/src/utils/release-readiness-detector.js +2 -0
- package/dist/src/utils/release-readiness-detector.js.map +1 -1
- package/dist/src/utils/todo-file-watcher.d.ts +26 -0
- package/dist/src/utils/todo-file-watcher.d.ts.map +1 -0
- package/dist/src/utils/todo-file-watcher.js +163 -0
- package/dist/src/utils/todo-file-watcher.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ToolExecutionSnapshotSchema: z.ZodObject<{
|
|
3
|
+
toolName: z.ZodString;
|
|
4
|
+
parameters: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
5
|
+
result: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
6
|
+
todoTasksCreated: z.ZodArray<z.ZodString, "many">;
|
|
7
|
+
todoTasksModified: z.ZodArray<z.ZodString, "many">;
|
|
8
|
+
executionTime: z.ZodString;
|
|
9
|
+
success: z.ZodBoolean;
|
|
10
|
+
error: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
success: boolean;
|
|
13
|
+
result: Record<string, any>;
|
|
14
|
+
executionTime: string;
|
|
15
|
+
toolName: string;
|
|
16
|
+
parameters: Record<string, any>;
|
|
17
|
+
todoTasksCreated: string[];
|
|
18
|
+
todoTasksModified: string[];
|
|
19
|
+
error?: string | undefined;
|
|
20
|
+
}, {
|
|
21
|
+
success: boolean;
|
|
22
|
+
result: Record<string, any>;
|
|
23
|
+
executionTime: string;
|
|
24
|
+
toolName: string;
|
|
25
|
+
parameters: Record<string, any>;
|
|
26
|
+
todoTasksCreated: string[];
|
|
27
|
+
todoTasksModified: string[];
|
|
28
|
+
error?: string | undefined;
|
|
29
|
+
}>;
|
|
30
|
+
export declare const IntentSnapshotSchema: z.ZodObject<{
|
|
31
|
+
intentId: z.ZodString;
|
|
32
|
+
humanRequest: z.ZodString;
|
|
33
|
+
parsedGoals: z.ZodArray<z.ZodString, "many">;
|
|
34
|
+
priority: z.ZodEnum<["high", "medium", "low"]>;
|
|
35
|
+
timestamp: z.ZodString;
|
|
36
|
+
toolChain: z.ZodArray<z.ZodObject<{
|
|
37
|
+
toolName: z.ZodString;
|
|
38
|
+
parameters: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
39
|
+
result: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
40
|
+
todoTasksCreated: z.ZodArray<z.ZodString, "many">;
|
|
41
|
+
todoTasksModified: z.ZodArray<z.ZodString, "many">;
|
|
42
|
+
executionTime: z.ZodString;
|
|
43
|
+
success: z.ZodBoolean;
|
|
44
|
+
error: z.ZodOptional<z.ZodString>;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
success: boolean;
|
|
47
|
+
result: Record<string, any>;
|
|
48
|
+
executionTime: string;
|
|
49
|
+
toolName: string;
|
|
50
|
+
parameters: Record<string, any>;
|
|
51
|
+
todoTasksCreated: string[];
|
|
52
|
+
todoTasksModified: string[];
|
|
53
|
+
error?: string | undefined;
|
|
54
|
+
}, {
|
|
55
|
+
success: boolean;
|
|
56
|
+
result: Record<string, any>;
|
|
57
|
+
executionTime: string;
|
|
58
|
+
toolName: string;
|
|
59
|
+
parameters: Record<string, any>;
|
|
60
|
+
todoTasksCreated: string[];
|
|
61
|
+
todoTasksModified: string[];
|
|
62
|
+
error?: string | undefined;
|
|
63
|
+
}>, "many">;
|
|
64
|
+
currentStatus: z.ZodEnum<["planning", "executing", "completed", "failed"]>;
|
|
65
|
+
todoMdSnapshot: z.ZodString;
|
|
66
|
+
parentIntentId: z.ZodOptional<z.ZodString>;
|
|
67
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
timestamp: string;
|
|
70
|
+
priority: "medium" | "low" | "high";
|
|
71
|
+
intentId: string;
|
|
72
|
+
humanRequest: string;
|
|
73
|
+
parsedGoals: string[];
|
|
74
|
+
toolChain: {
|
|
75
|
+
success: boolean;
|
|
76
|
+
result: Record<string, any>;
|
|
77
|
+
executionTime: string;
|
|
78
|
+
toolName: string;
|
|
79
|
+
parameters: Record<string, any>;
|
|
80
|
+
todoTasksCreated: string[];
|
|
81
|
+
todoTasksModified: string[];
|
|
82
|
+
error?: string | undefined;
|
|
83
|
+
}[];
|
|
84
|
+
currentStatus: "completed" | "failed" | "planning" | "executing";
|
|
85
|
+
todoMdSnapshot: string;
|
|
86
|
+
tags?: string[] | undefined;
|
|
87
|
+
parentIntentId?: string | undefined;
|
|
88
|
+
}, {
|
|
89
|
+
timestamp: string;
|
|
90
|
+
priority: "medium" | "low" | "high";
|
|
91
|
+
intentId: string;
|
|
92
|
+
humanRequest: string;
|
|
93
|
+
parsedGoals: string[];
|
|
94
|
+
toolChain: {
|
|
95
|
+
success: boolean;
|
|
96
|
+
result: Record<string, any>;
|
|
97
|
+
executionTime: string;
|
|
98
|
+
toolName: string;
|
|
99
|
+
parameters: Record<string, any>;
|
|
100
|
+
todoTasksCreated: string[];
|
|
101
|
+
todoTasksModified: string[];
|
|
102
|
+
error?: string | undefined;
|
|
103
|
+
}[];
|
|
104
|
+
currentStatus: "completed" | "failed" | "planning" | "executing";
|
|
105
|
+
todoMdSnapshot: string;
|
|
106
|
+
tags?: string[] | undefined;
|
|
107
|
+
parentIntentId?: string | undefined;
|
|
108
|
+
}>;
|
|
109
|
+
export declare const TodoSyncStateSchema: z.ZodObject<{
|
|
110
|
+
lastSyncTimestamp: z.ZodString;
|
|
111
|
+
todoMdHash: z.ZodString;
|
|
112
|
+
knowledgeGraphHash: z.ZodString;
|
|
113
|
+
syncStatus: z.ZodEnum<["synced", "pending", "conflict", "error"]>;
|
|
114
|
+
conflictDetails: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
115
|
+
taskId: z.ZodString;
|
|
116
|
+
conflict: z.ZodString;
|
|
117
|
+
todoVersion: z.ZodString;
|
|
118
|
+
kgVersion: z.ZodString;
|
|
119
|
+
}, "strip", z.ZodTypeAny, {
|
|
120
|
+
conflict: string;
|
|
121
|
+
taskId: string;
|
|
122
|
+
todoVersion: string;
|
|
123
|
+
kgVersion: string;
|
|
124
|
+
}, {
|
|
125
|
+
conflict: string;
|
|
126
|
+
taskId: string;
|
|
127
|
+
todoVersion: string;
|
|
128
|
+
kgVersion: string;
|
|
129
|
+
}>, "many">>;
|
|
130
|
+
lastModifiedBy: z.ZodEnum<["human", "tool", "sync"]>;
|
|
131
|
+
version: z.ZodNumber;
|
|
132
|
+
}, "strip", z.ZodTypeAny, {
|
|
133
|
+
version: number;
|
|
134
|
+
lastSyncTimestamp: string;
|
|
135
|
+
todoMdHash: string;
|
|
136
|
+
knowledgeGraphHash: string;
|
|
137
|
+
syncStatus: "error" | "pending" | "synced" | "conflict";
|
|
138
|
+
lastModifiedBy: "tool" | "human" | "sync";
|
|
139
|
+
conflictDetails?: {
|
|
140
|
+
conflict: string;
|
|
141
|
+
taskId: string;
|
|
142
|
+
todoVersion: string;
|
|
143
|
+
kgVersion: string;
|
|
144
|
+
}[] | undefined;
|
|
145
|
+
}, {
|
|
146
|
+
version: number;
|
|
147
|
+
lastSyncTimestamp: string;
|
|
148
|
+
todoMdHash: string;
|
|
149
|
+
knowledgeGraphHash: string;
|
|
150
|
+
syncStatus: "error" | "pending" | "synced" | "conflict";
|
|
151
|
+
lastModifiedBy: "tool" | "human" | "sync";
|
|
152
|
+
conflictDetails?: {
|
|
153
|
+
conflict: string;
|
|
154
|
+
taskId: string;
|
|
155
|
+
todoVersion: string;
|
|
156
|
+
kgVersion: string;
|
|
157
|
+
}[] | undefined;
|
|
158
|
+
}>;
|
|
159
|
+
export declare const KnowledgeGraphSnapshotSchema: z.ZodObject<{
|
|
160
|
+
version: z.ZodString;
|
|
161
|
+
timestamp: z.ZodString;
|
|
162
|
+
intents: z.ZodArray<z.ZodObject<{
|
|
163
|
+
intentId: z.ZodString;
|
|
164
|
+
humanRequest: z.ZodString;
|
|
165
|
+
parsedGoals: z.ZodArray<z.ZodString, "many">;
|
|
166
|
+
priority: z.ZodEnum<["high", "medium", "low"]>;
|
|
167
|
+
timestamp: z.ZodString;
|
|
168
|
+
toolChain: z.ZodArray<z.ZodObject<{
|
|
169
|
+
toolName: z.ZodString;
|
|
170
|
+
parameters: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
171
|
+
result: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
172
|
+
todoTasksCreated: z.ZodArray<z.ZodString, "many">;
|
|
173
|
+
todoTasksModified: z.ZodArray<z.ZodString, "many">;
|
|
174
|
+
executionTime: z.ZodString;
|
|
175
|
+
success: z.ZodBoolean;
|
|
176
|
+
error: z.ZodOptional<z.ZodString>;
|
|
177
|
+
}, "strip", z.ZodTypeAny, {
|
|
178
|
+
success: boolean;
|
|
179
|
+
result: Record<string, any>;
|
|
180
|
+
executionTime: string;
|
|
181
|
+
toolName: string;
|
|
182
|
+
parameters: Record<string, any>;
|
|
183
|
+
todoTasksCreated: string[];
|
|
184
|
+
todoTasksModified: string[];
|
|
185
|
+
error?: string | undefined;
|
|
186
|
+
}, {
|
|
187
|
+
success: boolean;
|
|
188
|
+
result: Record<string, any>;
|
|
189
|
+
executionTime: string;
|
|
190
|
+
toolName: string;
|
|
191
|
+
parameters: Record<string, any>;
|
|
192
|
+
todoTasksCreated: string[];
|
|
193
|
+
todoTasksModified: string[];
|
|
194
|
+
error?: string | undefined;
|
|
195
|
+
}>, "many">;
|
|
196
|
+
currentStatus: z.ZodEnum<["planning", "executing", "completed", "failed"]>;
|
|
197
|
+
todoMdSnapshot: z.ZodString;
|
|
198
|
+
parentIntentId: z.ZodOptional<z.ZodString>;
|
|
199
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
200
|
+
}, "strip", z.ZodTypeAny, {
|
|
201
|
+
timestamp: string;
|
|
202
|
+
priority: "medium" | "low" | "high";
|
|
203
|
+
intentId: string;
|
|
204
|
+
humanRequest: string;
|
|
205
|
+
parsedGoals: string[];
|
|
206
|
+
toolChain: {
|
|
207
|
+
success: boolean;
|
|
208
|
+
result: Record<string, any>;
|
|
209
|
+
executionTime: string;
|
|
210
|
+
toolName: string;
|
|
211
|
+
parameters: Record<string, any>;
|
|
212
|
+
todoTasksCreated: string[];
|
|
213
|
+
todoTasksModified: string[];
|
|
214
|
+
error?: string | undefined;
|
|
215
|
+
}[];
|
|
216
|
+
currentStatus: "completed" | "failed" | "planning" | "executing";
|
|
217
|
+
todoMdSnapshot: string;
|
|
218
|
+
tags?: string[] | undefined;
|
|
219
|
+
parentIntentId?: string | undefined;
|
|
220
|
+
}, {
|
|
221
|
+
timestamp: string;
|
|
222
|
+
priority: "medium" | "low" | "high";
|
|
223
|
+
intentId: string;
|
|
224
|
+
humanRequest: string;
|
|
225
|
+
parsedGoals: string[];
|
|
226
|
+
toolChain: {
|
|
227
|
+
success: boolean;
|
|
228
|
+
result: Record<string, any>;
|
|
229
|
+
executionTime: string;
|
|
230
|
+
toolName: string;
|
|
231
|
+
parameters: Record<string, any>;
|
|
232
|
+
todoTasksCreated: string[];
|
|
233
|
+
todoTasksModified: string[];
|
|
234
|
+
error?: string | undefined;
|
|
235
|
+
}[];
|
|
236
|
+
currentStatus: "completed" | "failed" | "planning" | "executing";
|
|
237
|
+
todoMdSnapshot: string;
|
|
238
|
+
tags?: string[] | undefined;
|
|
239
|
+
parentIntentId?: string | undefined;
|
|
240
|
+
}>, "many">;
|
|
241
|
+
todoSyncState: z.ZodObject<{
|
|
242
|
+
lastSyncTimestamp: z.ZodString;
|
|
243
|
+
todoMdHash: z.ZodString;
|
|
244
|
+
knowledgeGraphHash: z.ZodString;
|
|
245
|
+
syncStatus: z.ZodEnum<["synced", "pending", "conflict", "error"]>;
|
|
246
|
+
conflictDetails: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
247
|
+
taskId: z.ZodString;
|
|
248
|
+
conflict: z.ZodString;
|
|
249
|
+
todoVersion: z.ZodString;
|
|
250
|
+
kgVersion: z.ZodString;
|
|
251
|
+
}, "strip", z.ZodTypeAny, {
|
|
252
|
+
conflict: string;
|
|
253
|
+
taskId: string;
|
|
254
|
+
todoVersion: string;
|
|
255
|
+
kgVersion: string;
|
|
256
|
+
}, {
|
|
257
|
+
conflict: string;
|
|
258
|
+
taskId: string;
|
|
259
|
+
todoVersion: string;
|
|
260
|
+
kgVersion: string;
|
|
261
|
+
}>, "many">>;
|
|
262
|
+
lastModifiedBy: z.ZodEnum<["human", "tool", "sync"]>;
|
|
263
|
+
version: z.ZodNumber;
|
|
264
|
+
}, "strip", z.ZodTypeAny, {
|
|
265
|
+
version: number;
|
|
266
|
+
lastSyncTimestamp: string;
|
|
267
|
+
todoMdHash: string;
|
|
268
|
+
knowledgeGraphHash: string;
|
|
269
|
+
syncStatus: "error" | "pending" | "synced" | "conflict";
|
|
270
|
+
lastModifiedBy: "tool" | "human" | "sync";
|
|
271
|
+
conflictDetails?: {
|
|
272
|
+
conflict: string;
|
|
273
|
+
taskId: string;
|
|
274
|
+
todoVersion: string;
|
|
275
|
+
kgVersion: string;
|
|
276
|
+
}[] | undefined;
|
|
277
|
+
}, {
|
|
278
|
+
version: number;
|
|
279
|
+
lastSyncTimestamp: string;
|
|
280
|
+
todoMdHash: string;
|
|
281
|
+
knowledgeGraphHash: string;
|
|
282
|
+
syncStatus: "error" | "pending" | "synced" | "conflict";
|
|
283
|
+
lastModifiedBy: "tool" | "human" | "sync";
|
|
284
|
+
conflictDetails?: {
|
|
285
|
+
conflict: string;
|
|
286
|
+
taskId: string;
|
|
287
|
+
todoVersion: string;
|
|
288
|
+
kgVersion: string;
|
|
289
|
+
}[] | undefined;
|
|
290
|
+
}>;
|
|
291
|
+
analytics: z.ZodObject<{
|
|
292
|
+
totalIntents: z.ZodNumber;
|
|
293
|
+
completedIntents: z.ZodNumber;
|
|
294
|
+
activeIntents: z.ZodNumber;
|
|
295
|
+
averageGoalCompletion: z.ZodNumber;
|
|
296
|
+
mostUsedTools: z.ZodArray<z.ZodObject<{
|
|
297
|
+
toolName: z.ZodString;
|
|
298
|
+
usageCount: z.ZodNumber;
|
|
299
|
+
}, "strip", z.ZodTypeAny, {
|
|
300
|
+
toolName: string;
|
|
301
|
+
usageCount: number;
|
|
302
|
+
}, {
|
|
303
|
+
toolName: string;
|
|
304
|
+
usageCount: number;
|
|
305
|
+
}>, "many">;
|
|
306
|
+
successfulPatterns: z.ZodArray<z.ZodObject<{
|
|
307
|
+
pattern: z.ZodString;
|
|
308
|
+
successRate: z.ZodNumber;
|
|
309
|
+
examples: z.ZodArray<z.ZodString, "many">;
|
|
310
|
+
}, "strip", z.ZodTypeAny, {
|
|
311
|
+
successRate: number;
|
|
312
|
+
pattern: string;
|
|
313
|
+
examples: string[];
|
|
314
|
+
}, {
|
|
315
|
+
successRate: number;
|
|
316
|
+
pattern: string;
|
|
317
|
+
examples: string[];
|
|
318
|
+
}>, "many">;
|
|
319
|
+
}, "strip", z.ZodTypeAny, {
|
|
320
|
+
totalIntents: number;
|
|
321
|
+
completedIntents: number;
|
|
322
|
+
activeIntents: number;
|
|
323
|
+
averageGoalCompletion: number;
|
|
324
|
+
mostUsedTools: {
|
|
325
|
+
toolName: string;
|
|
326
|
+
usageCount: number;
|
|
327
|
+
}[];
|
|
328
|
+
successfulPatterns: {
|
|
329
|
+
successRate: number;
|
|
330
|
+
pattern: string;
|
|
331
|
+
examples: string[];
|
|
332
|
+
}[];
|
|
333
|
+
}, {
|
|
334
|
+
totalIntents: number;
|
|
335
|
+
completedIntents: number;
|
|
336
|
+
activeIntents: number;
|
|
337
|
+
averageGoalCompletion: number;
|
|
338
|
+
mostUsedTools: {
|
|
339
|
+
toolName: string;
|
|
340
|
+
usageCount: number;
|
|
341
|
+
}[];
|
|
342
|
+
successfulPatterns: {
|
|
343
|
+
successRate: number;
|
|
344
|
+
pattern: string;
|
|
345
|
+
examples: string[];
|
|
346
|
+
}[];
|
|
347
|
+
}>;
|
|
348
|
+
}, "strip", z.ZodTypeAny, {
|
|
349
|
+
timestamp: string;
|
|
350
|
+
version: string;
|
|
351
|
+
intents: {
|
|
352
|
+
timestamp: string;
|
|
353
|
+
priority: "medium" | "low" | "high";
|
|
354
|
+
intentId: string;
|
|
355
|
+
humanRequest: string;
|
|
356
|
+
parsedGoals: string[];
|
|
357
|
+
toolChain: {
|
|
358
|
+
success: boolean;
|
|
359
|
+
result: Record<string, any>;
|
|
360
|
+
executionTime: string;
|
|
361
|
+
toolName: string;
|
|
362
|
+
parameters: Record<string, any>;
|
|
363
|
+
todoTasksCreated: string[];
|
|
364
|
+
todoTasksModified: string[];
|
|
365
|
+
error?: string | undefined;
|
|
366
|
+
}[];
|
|
367
|
+
currentStatus: "completed" | "failed" | "planning" | "executing";
|
|
368
|
+
todoMdSnapshot: string;
|
|
369
|
+
tags?: string[] | undefined;
|
|
370
|
+
parentIntentId?: string | undefined;
|
|
371
|
+
}[];
|
|
372
|
+
todoSyncState: {
|
|
373
|
+
version: number;
|
|
374
|
+
lastSyncTimestamp: string;
|
|
375
|
+
todoMdHash: string;
|
|
376
|
+
knowledgeGraphHash: string;
|
|
377
|
+
syncStatus: "error" | "pending" | "synced" | "conflict";
|
|
378
|
+
lastModifiedBy: "tool" | "human" | "sync";
|
|
379
|
+
conflictDetails?: {
|
|
380
|
+
conflict: string;
|
|
381
|
+
taskId: string;
|
|
382
|
+
todoVersion: string;
|
|
383
|
+
kgVersion: string;
|
|
384
|
+
}[] | undefined;
|
|
385
|
+
};
|
|
386
|
+
analytics: {
|
|
387
|
+
totalIntents: number;
|
|
388
|
+
completedIntents: number;
|
|
389
|
+
activeIntents: number;
|
|
390
|
+
averageGoalCompletion: number;
|
|
391
|
+
mostUsedTools: {
|
|
392
|
+
toolName: string;
|
|
393
|
+
usageCount: number;
|
|
394
|
+
}[];
|
|
395
|
+
successfulPatterns: {
|
|
396
|
+
successRate: number;
|
|
397
|
+
pattern: string;
|
|
398
|
+
examples: string[];
|
|
399
|
+
}[];
|
|
400
|
+
};
|
|
401
|
+
}, {
|
|
402
|
+
timestamp: string;
|
|
403
|
+
version: string;
|
|
404
|
+
intents: {
|
|
405
|
+
timestamp: string;
|
|
406
|
+
priority: "medium" | "low" | "high";
|
|
407
|
+
intentId: string;
|
|
408
|
+
humanRequest: string;
|
|
409
|
+
parsedGoals: string[];
|
|
410
|
+
toolChain: {
|
|
411
|
+
success: boolean;
|
|
412
|
+
result: Record<string, any>;
|
|
413
|
+
executionTime: string;
|
|
414
|
+
toolName: string;
|
|
415
|
+
parameters: Record<string, any>;
|
|
416
|
+
todoTasksCreated: string[];
|
|
417
|
+
todoTasksModified: string[];
|
|
418
|
+
error?: string | undefined;
|
|
419
|
+
}[];
|
|
420
|
+
currentStatus: "completed" | "failed" | "planning" | "executing";
|
|
421
|
+
todoMdSnapshot: string;
|
|
422
|
+
tags?: string[] | undefined;
|
|
423
|
+
parentIntentId?: string | undefined;
|
|
424
|
+
}[];
|
|
425
|
+
todoSyncState: {
|
|
426
|
+
version: number;
|
|
427
|
+
lastSyncTimestamp: string;
|
|
428
|
+
todoMdHash: string;
|
|
429
|
+
knowledgeGraphHash: string;
|
|
430
|
+
syncStatus: "error" | "pending" | "synced" | "conflict";
|
|
431
|
+
lastModifiedBy: "tool" | "human" | "sync";
|
|
432
|
+
conflictDetails?: {
|
|
433
|
+
conflict: string;
|
|
434
|
+
taskId: string;
|
|
435
|
+
todoVersion: string;
|
|
436
|
+
kgVersion: string;
|
|
437
|
+
}[] | undefined;
|
|
438
|
+
};
|
|
439
|
+
analytics: {
|
|
440
|
+
totalIntents: number;
|
|
441
|
+
completedIntents: number;
|
|
442
|
+
activeIntents: number;
|
|
443
|
+
averageGoalCompletion: number;
|
|
444
|
+
mostUsedTools: {
|
|
445
|
+
toolName: string;
|
|
446
|
+
usageCount: number;
|
|
447
|
+
}[];
|
|
448
|
+
successfulPatterns: {
|
|
449
|
+
successRate: number;
|
|
450
|
+
pattern: string;
|
|
451
|
+
examples: string[];
|
|
452
|
+
}[];
|
|
453
|
+
};
|
|
454
|
+
}>;
|
|
455
|
+
export type ToolExecutionSnapshot = z.infer<typeof ToolExecutionSnapshotSchema>;
|
|
456
|
+
export type IntentSnapshot = z.infer<typeof IntentSnapshotSchema>;
|
|
457
|
+
export type TodoSyncState = z.infer<typeof TodoSyncStateSchema>;
|
|
458
|
+
export type KnowledgeGraphSnapshot = z.infer<typeof KnowledgeGraphSnapshotSchema>;
|
|
459
|
+
export interface IntentGoal {
|
|
460
|
+
id: string;
|
|
461
|
+
description: string;
|
|
462
|
+
status: 'pending' | 'in_progress' | 'completed' | 'blocked';
|
|
463
|
+
completionPercentage: number;
|
|
464
|
+
linkedTasks: string[];
|
|
465
|
+
linkedAdrs: string[];
|
|
466
|
+
}
|
|
467
|
+
export interface ToolChainPattern {
|
|
468
|
+
id: string;
|
|
469
|
+
name: string;
|
|
470
|
+
tools: string[];
|
|
471
|
+
successRate: number;
|
|
472
|
+
averageExecutionTime: number;
|
|
473
|
+
commonGoalTypes: string[];
|
|
474
|
+
lastUsed: string;
|
|
475
|
+
}
|
|
476
|
+
export interface ConflictResolutionStrategy {
|
|
477
|
+
type: 'timestamp' | 'manual' | 'merge' | 'preserve_human';
|
|
478
|
+
description: string;
|
|
479
|
+
autoResolve: boolean;
|
|
480
|
+
}
|
|
481
|
+
//# sourceMappingURL=knowledge-graph-schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knowledge-graph-schemas.d.ts","sourceRoot":"","sources":["../../../src/types/knowledge-graph-schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;EAStC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAW/B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAa9B,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBvC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAChF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,SAAS,GAAG,aAAa,GAAG,WAAW,GAAG,SAAS,CAAC;IAC5D,oBAAoB,EAAE,MAAM,CAAC;IAC7B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,WAAW,GAAG,QAAQ,GAAG,OAAO,GAAG,gBAAgB,CAAC;IAC1D,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;CACtB"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const ToolExecutionSnapshotSchema = z.object({
|
|
3
|
+
toolName: z.string(),
|
|
4
|
+
parameters: z.record(z.any()),
|
|
5
|
+
result: z.record(z.any()),
|
|
6
|
+
todoTasksCreated: z.array(z.string()),
|
|
7
|
+
todoTasksModified: z.array(z.string()),
|
|
8
|
+
executionTime: z.string(),
|
|
9
|
+
success: z.boolean(),
|
|
10
|
+
error: z.string().optional()
|
|
11
|
+
});
|
|
12
|
+
export const IntentSnapshotSchema = z.object({
|
|
13
|
+
intentId: z.string(),
|
|
14
|
+
humanRequest: z.string(),
|
|
15
|
+
parsedGoals: z.array(z.string()),
|
|
16
|
+
priority: z.enum(['high', 'medium', 'low']),
|
|
17
|
+
timestamp: z.string(),
|
|
18
|
+
toolChain: z.array(ToolExecutionSnapshotSchema),
|
|
19
|
+
currentStatus: z.enum(['planning', 'executing', 'completed', 'failed']),
|
|
20
|
+
todoMdSnapshot: z.string(),
|
|
21
|
+
parentIntentId: z.string().optional(),
|
|
22
|
+
tags: z.array(z.string()).optional()
|
|
23
|
+
});
|
|
24
|
+
export const TodoSyncStateSchema = z.object({
|
|
25
|
+
lastSyncTimestamp: z.string(),
|
|
26
|
+
todoMdHash: z.string(),
|
|
27
|
+
knowledgeGraphHash: z.string(),
|
|
28
|
+
syncStatus: z.enum(['synced', 'pending', 'conflict', 'error']),
|
|
29
|
+
conflictDetails: z.array(z.object({
|
|
30
|
+
taskId: z.string(),
|
|
31
|
+
conflict: z.string(),
|
|
32
|
+
todoVersion: z.string(),
|
|
33
|
+
kgVersion: z.string()
|
|
34
|
+
})).optional(),
|
|
35
|
+
lastModifiedBy: z.enum(['human', 'tool', 'sync']),
|
|
36
|
+
version: z.number()
|
|
37
|
+
});
|
|
38
|
+
export const KnowledgeGraphSnapshotSchema = z.object({
|
|
39
|
+
version: z.string(),
|
|
40
|
+
timestamp: z.string(),
|
|
41
|
+
intents: z.array(IntentSnapshotSchema),
|
|
42
|
+
todoSyncState: TodoSyncStateSchema,
|
|
43
|
+
analytics: z.object({
|
|
44
|
+
totalIntents: z.number(),
|
|
45
|
+
completedIntents: z.number(),
|
|
46
|
+
activeIntents: z.number(),
|
|
47
|
+
averageGoalCompletion: z.number(),
|
|
48
|
+
mostUsedTools: z.array(z.object({
|
|
49
|
+
toolName: z.string(),
|
|
50
|
+
usageCount: z.number()
|
|
51
|
+
})),
|
|
52
|
+
successfulPatterns: z.array(z.object({
|
|
53
|
+
pattern: z.string(),
|
|
54
|
+
successRate: z.number(),
|
|
55
|
+
examples: z.array(z.string())
|
|
56
|
+
}))
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=knowledge-graph-schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knowledge-graph-schemas.js","sourceRoot":"","sources":["../../../src/types/knowledge-graph-schemas.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON-Safe String Utilities
|
|
3
|
+
*
|
|
4
|
+
* Utilities for safely escaping strings in JSON-RPC 2.0 responses
|
|
5
|
+
* to prevent parse errors in MCP communication
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Escape a string to be JSON-safe for MCP responses
|
|
9
|
+
* Only escapes actual control characters and problematic JSON chars
|
|
10
|
+
*/
|
|
11
|
+
export declare function jsonSafe(str: string | undefined | null): string;
|
|
12
|
+
/**
|
|
13
|
+
* Escape an array of strings to be JSON-safe
|
|
14
|
+
*/
|
|
15
|
+
export declare function jsonSafeArray(arr: (string | undefined | null)[]): string[];
|
|
16
|
+
/**
|
|
17
|
+
* Safely join an array of strings with JSON-safe escaping
|
|
18
|
+
*/
|
|
19
|
+
export declare function jsonSafeJoin(arr: (string | undefined | null)[], separator?: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Create a JSON-safe markdown list from an array of items
|
|
22
|
+
*/
|
|
23
|
+
export declare function jsonSafeMarkdownList(items: (string | undefined | null)[], prefix?: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Safely escape file paths for JSON output - minimal escaping for display
|
|
26
|
+
* Only normalizes path separators and escapes quotes
|
|
27
|
+
*/
|
|
28
|
+
export declare function jsonSafeFilePath(filePath: string | undefined | null): string;
|
|
29
|
+
/**
|
|
30
|
+
* Safely escape user input content that might contain dangerous characters
|
|
31
|
+
* Use this for content that comes from external sources or user input
|
|
32
|
+
*/
|
|
33
|
+
export declare function jsonSafeUserInput(str: string | undefined | null): string;
|
|
34
|
+
/**
|
|
35
|
+
* Safely escape error messages that might contain quotes or special chars
|
|
36
|
+
*/
|
|
37
|
+
export declare function jsonSafeError(error: unknown): string;
|
|
38
|
+
//# sourceMappingURL=json-safe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-safe.d.ts","sourceRoot":"","sources":["../../../src/utils/json-safe.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAwB/D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,EAAE,GAAG,MAAM,EAAE,CAE1E;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,EAAE,EAAE,SAAS,GAAE,MAAa,GAAG,MAAM,CAEjG;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,EAAE,EAAE,MAAM,GAAE,MAAa,GAAG,MAAM,CAKxG;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAS5E;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAExE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAOpD"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON-Safe String Utilities
|
|
3
|
+
*
|
|
4
|
+
* Utilities for safely escaping strings in JSON-RPC 2.0 responses
|
|
5
|
+
* to prevent parse errors in MCP communication
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Escape a string to be JSON-safe for MCP responses
|
|
9
|
+
* Only escapes actual control characters and problematic JSON chars
|
|
10
|
+
*/
|
|
11
|
+
export function jsonSafe(str) {
|
|
12
|
+
if (str == null) {
|
|
13
|
+
return '';
|
|
14
|
+
}
|
|
15
|
+
return String(str)
|
|
16
|
+
// Escape backslashes first (before escaping quotes)
|
|
17
|
+
.replace(/\\/g, '\\\\')
|
|
18
|
+
// Escape double quotes
|
|
19
|
+
.replace(/"/g, '\\"')
|
|
20
|
+
// Only escape actual control characters (not regex \b)
|
|
21
|
+
.replace(/\n/g, '\\n')
|
|
22
|
+
.replace(/\r/g, '\\r')
|
|
23
|
+
.replace(/\t/g, '\\t')
|
|
24
|
+
// Escape other potentially problematic control characters (but not \b word boundary)
|
|
25
|
+
.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F]/g, (char) => {
|
|
26
|
+
const code = char.charCodeAt(0);
|
|
27
|
+
switch (code) {
|
|
28
|
+
case 0x08: return '\\b'; // actual backspace character
|
|
29
|
+
case 0x0C: return '\\f'; // form feed
|
|
30
|
+
default:
|
|
31
|
+
return '\\u' + ('0000' + code.toString(16)).slice(-4);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Escape an array of strings to be JSON-safe
|
|
37
|
+
*/
|
|
38
|
+
export function jsonSafeArray(arr) {
|
|
39
|
+
return arr.map(jsonSafe);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Safely join an array of strings with JSON-safe escaping
|
|
43
|
+
*/
|
|
44
|
+
export function jsonSafeJoin(arr, separator = '\n') {
|
|
45
|
+
return jsonSafeArray(arr).join(separator);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Create a JSON-safe markdown list from an array of items
|
|
49
|
+
*/
|
|
50
|
+
export function jsonSafeMarkdownList(items, prefix = '- ') {
|
|
51
|
+
return jsonSafeArray(items)
|
|
52
|
+
.filter(item => item.length > 0)
|
|
53
|
+
.map(item => `${prefix}${item}`)
|
|
54
|
+
.join('\n');
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Safely escape file paths for JSON output - minimal escaping for display
|
|
58
|
+
* Only normalizes path separators and escapes quotes
|
|
59
|
+
*/
|
|
60
|
+
export function jsonSafeFilePath(filePath) {
|
|
61
|
+
if (!filePath) {
|
|
62
|
+
return '';
|
|
63
|
+
}
|
|
64
|
+
// For file paths, only escape quotes and backslashes, normalize separators
|
|
65
|
+
return String(filePath)
|
|
66
|
+
.replace(/\\/g, '/') // Normalize Windows paths
|
|
67
|
+
.replace(/"/g, '\\"'); // Only escape quotes for JSON safety
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Safely escape user input content that might contain dangerous characters
|
|
71
|
+
* Use this for content that comes from external sources or user input
|
|
72
|
+
*/
|
|
73
|
+
export function jsonSafeUserInput(str) {
|
|
74
|
+
return jsonSafe(str);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Safely escape error messages that might contain quotes or special chars
|
|
78
|
+
*/
|
|
79
|
+
export function jsonSafeError(error) {
|
|
80
|
+
if (!error) {
|
|
81
|
+
return 'Unknown error';
|
|
82
|
+
}
|
|
83
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
84
|
+
return jsonSafe(message);
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=json-safe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-safe.js","sourceRoot":"","sources":["../../../src/utils/json-safe.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,GAA8B;IACrD,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QAChB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,MAAM,CAAC,GAAG,CAAC;QAChB,oDAAoD;SACnD,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,uBAAuB;SACtB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;QACrB,uDAAuD;SACtD,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;QACtB,qFAAqF;SACpF,OAAO,CAAC,wDAAwD,EAAE,CAAC,IAAI,EAAE,EAAE;QAC1E,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAChC,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,IAAI,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,6BAA6B;YACtD,KAAK,IAAI,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,YAAY;YACrC;gBACE,OAAO,KAAK,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,GAAkC;IAC9D,OAAO,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,GAAkC,EAAE,YAAoB,IAAI;IACvF,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAC5C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAoC,EAAE,SAAiB,IAAI;IAC9F,OAAO,aAAa,CAAC,KAAK,CAAC;SACxB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;SAC/B,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,MAAM,GAAG,IAAI,EAAE,CAAC;SAC/B,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAmC;IAClE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,2EAA2E;IAC3E,OAAO,MAAM,CAAC,QAAQ,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,0BAA0B;SAC9C,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,qCAAqC;AAChE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAA8B;IAC9D,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC;AACvB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,eAAe,CAAC;IACzB,CAAC;IAED,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC"}
|