midnight-mcp 0.1.16 → 0.1.18

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.
@@ -0,0 +1,628 @@
1
+ /**
2
+ * Contract validation handlers
3
+ * Pre-compilation validation for Compact contracts using the Compact CLI
4
+ */
5
+ import type { ValidateContractInput, ExtractContractStructureInput } from "./schemas.js";
6
+ /**
7
+ * Validate a Compact contract by running the compiler
8
+ * This provides pre-compilation validation with detailed error diagnostics
9
+ */
10
+ export declare function validateContract(input: ValidateContractInput): Promise<{
11
+ success: boolean;
12
+ errorType: string;
13
+ error: string;
14
+ message: string;
15
+ userAction: {
16
+ problem: string | undefined;
17
+ solution: string;
18
+ example: {
19
+ filePath: string;
20
+ withCode?: undefined;
21
+ withFile?: undefined;
22
+ instead?: undefined;
23
+ use?: undefined;
24
+ };
25
+ isUserFault: boolean;
26
+ details?: undefined;
27
+ detectedIncludes?: undefined;
28
+ fix?: undefined;
29
+ command?: undefined;
30
+ possibleCauses?: undefined;
31
+ };
32
+ detectedIssues?: undefined;
33
+ compilerInstalled?: undefined;
34
+ installation?: undefined;
35
+ compilerVersion?: undefined;
36
+ systemError?: undefined;
37
+ compilerPath?: undefined;
38
+ output?: undefined;
39
+ warnings?: undefined;
40
+ localIncludes?: undefined;
41
+ contractInfo?: undefined;
42
+ nextSteps?: undefined;
43
+ errorCategory?: undefined;
44
+ errors?: undefined;
45
+ errorCount?: undefined;
46
+ rawOutput?: undefined;
47
+ suggestions?: undefined;
48
+ commonFixes?: undefined;
49
+ } | {
50
+ success: boolean;
51
+ errorType: string;
52
+ error: string;
53
+ message: string;
54
+ userAction: {
55
+ problem: string;
56
+ solution: string;
57
+ isUserFault: boolean;
58
+ example?: undefined;
59
+ details?: undefined;
60
+ detectedIncludes?: undefined;
61
+ fix?: undefined;
62
+ command?: undefined;
63
+ possibleCauses?: undefined;
64
+ };
65
+ detectedIssues?: undefined;
66
+ compilerInstalled?: undefined;
67
+ installation?: undefined;
68
+ compilerVersion?: undefined;
69
+ systemError?: undefined;
70
+ compilerPath?: undefined;
71
+ output?: undefined;
72
+ warnings?: undefined;
73
+ localIncludes?: undefined;
74
+ contractInfo?: undefined;
75
+ nextSteps?: undefined;
76
+ errorCategory?: undefined;
77
+ errors?: undefined;
78
+ errorCount?: undefined;
79
+ rawOutput?: undefined;
80
+ suggestions?: undefined;
81
+ commonFixes?: undefined;
82
+ } | {
83
+ success: boolean;
84
+ errorType: string;
85
+ error: string;
86
+ message: string;
87
+ userAction: {
88
+ problem: string;
89
+ solution: string;
90
+ details: string | undefined;
91
+ isUserFault: boolean;
92
+ example?: undefined;
93
+ detectedIncludes?: undefined;
94
+ fix?: undefined;
95
+ command?: undefined;
96
+ possibleCauses?: undefined;
97
+ };
98
+ detectedIssues?: undefined;
99
+ compilerInstalled?: undefined;
100
+ installation?: undefined;
101
+ compilerVersion?: undefined;
102
+ systemError?: undefined;
103
+ compilerPath?: undefined;
104
+ output?: undefined;
105
+ warnings?: undefined;
106
+ localIncludes?: undefined;
107
+ contractInfo?: undefined;
108
+ nextSteps?: undefined;
109
+ errorCategory?: undefined;
110
+ errors?: undefined;
111
+ errorCount?: undefined;
112
+ rawOutput?: undefined;
113
+ suggestions?: undefined;
114
+ commonFixes?: undefined;
115
+ } | {
116
+ success: boolean;
117
+ errorType: string;
118
+ error: string;
119
+ message: string;
120
+ userAction: {
121
+ problem: string;
122
+ solution: string;
123
+ example: {
124
+ withCode: {
125
+ code: string;
126
+ };
127
+ withFile: {
128
+ filePath: string;
129
+ };
130
+ filePath?: undefined;
131
+ instead?: undefined;
132
+ use?: undefined;
133
+ };
134
+ isUserFault: boolean;
135
+ details?: undefined;
136
+ detectedIncludes?: undefined;
137
+ fix?: undefined;
138
+ command?: undefined;
139
+ possibleCauses?: undefined;
140
+ };
141
+ detectedIssues?: undefined;
142
+ compilerInstalled?: undefined;
143
+ installation?: undefined;
144
+ compilerVersion?: undefined;
145
+ systemError?: undefined;
146
+ compilerPath?: undefined;
147
+ output?: undefined;
148
+ warnings?: undefined;
149
+ localIncludes?: undefined;
150
+ contractInfo?: undefined;
151
+ nextSteps?: undefined;
152
+ errorCategory?: undefined;
153
+ errors?: undefined;
154
+ errorCount?: undefined;
155
+ rawOutput?: undefined;
156
+ suggestions?: undefined;
157
+ commonFixes?: undefined;
158
+ } | {
159
+ success: boolean;
160
+ errorType: string;
161
+ error: string;
162
+ message: string;
163
+ userAction: {
164
+ problem: string;
165
+ solution: string;
166
+ detectedIncludes: string[];
167
+ example: {
168
+ instead: string;
169
+ use: string;
170
+ filePath?: undefined;
171
+ withCode?: undefined;
172
+ withFile?: undefined;
173
+ };
174
+ isUserFault: boolean;
175
+ details?: undefined;
176
+ fix?: undefined;
177
+ command?: undefined;
178
+ possibleCauses?: undefined;
179
+ };
180
+ detectedIssues?: undefined;
181
+ compilerInstalled?: undefined;
182
+ installation?: undefined;
183
+ compilerVersion?: undefined;
184
+ systemError?: undefined;
185
+ compilerPath?: undefined;
186
+ output?: undefined;
187
+ warnings?: undefined;
188
+ localIncludes?: undefined;
189
+ contractInfo?: undefined;
190
+ nextSteps?: undefined;
191
+ errorCategory?: undefined;
192
+ errors?: undefined;
193
+ errorCount?: undefined;
194
+ rawOutput?: undefined;
195
+ suggestions?: undefined;
196
+ commonFixes?: undefined;
197
+ } | {
198
+ success: boolean;
199
+ errorType: string;
200
+ error: string;
201
+ message: string;
202
+ userAction: {
203
+ problem: string;
204
+ solution: string;
205
+ example: string;
206
+ isUserFault?: undefined;
207
+ details?: undefined;
208
+ detectedIncludes?: undefined;
209
+ fix?: undefined;
210
+ command?: undefined;
211
+ possibleCauses?: undefined;
212
+ };
213
+ detectedIssues?: undefined;
214
+ compilerInstalled?: undefined;
215
+ installation?: undefined;
216
+ compilerVersion?: undefined;
217
+ systemError?: undefined;
218
+ compilerPath?: undefined;
219
+ output?: undefined;
220
+ warnings?: undefined;
221
+ localIncludes?: undefined;
222
+ contractInfo?: undefined;
223
+ nextSteps?: undefined;
224
+ errorCategory?: undefined;
225
+ errors?: undefined;
226
+ errorCount?: undefined;
227
+ rawOutput?: undefined;
228
+ suggestions?: undefined;
229
+ commonFixes?: undefined;
230
+ } | {
231
+ success: boolean;
232
+ errorType: string;
233
+ error: string;
234
+ message: string;
235
+ userAction: {
236
+ problem: string;
237
+ solution: string;
238
+ example?: undefined;
239
+ isUserFault?: undefined;
240
+ details?: undefined;
241
+ detectedIncludes?: undefined;
242
+ fix?: undefined;
243
+ command?: undefined;
244
+ possibleCauses?: undefined;
245
+ };
246
+ detectedIssues?: undefined;
247
+ compilerInstalled?: undefined;
248
+ installation?: undefined;
249
+ compilerVersion?: undefined;
250
+ systemError?: undefined;
251
+ compilerPath?: undefined;
252
+ output?: undefined;
253
+ warnings?: undefined;
254
+ localIncludes?: undefined;
255
+ contractInfo?: undefined;
256
+ nextSteps?: undefined;
257
+ errorCategory?: undefined;
258
+ errors?: undefined;
259
+ errorCount?: undefined;
260
+ rawOutput?: undefined;
261
+ suggestions?: undefined;
262
+ commonFixes?: undefined;
263
+ } | {
264
+ success: boolean;
265
+ errorType: string;
266
+ error: string;
267
+ message: string;
268
+ userAction: {
269
+ problem: string;
270
+ solution: string;
271
+ fix: string;
272
+ example: string;
273
+ isUserFault?: undefined;
274
+ details?: undefined;
275
+ detectedIncludes?: undefined;
276
+ command?: undefined;
277
+ possibleCauses?: undefined;
278
+ };
279
+ detectedIssues: string[];
280
+ compilerInstalled?: undefined;
281
+ installation?: undefined;
282
+ compilerVersion?: undefined;
283
+ systemError?: undefined;
284
+ compilerPath?: undefined;
285
+ output?: undefined;
286
+ warnings?: undefined;
287
+ localIncludes?: undefined;
288
+ contractInfo?: undefined;
289
+ nextSteps?: undefined;
290
+ errorCategory?: undefined;
291
+ errors?: undefined;
292
+ errorCount?: undefined;
293
+ rawOutput?: undefined;
294
+ suggestions?: undefined;
295
+ commonFixes?: undefined;
296
+ } | {
297
+ success: boolean;
298
+ errorType: string;
299
+ compilerInstalled: boolean;
300
+ error: string;
301
+ message: string;
302
+ installation: {
303
+ message: string;
304
+ command: string;
305
+ postInstall: string[];
306
+ docs: string;
307
+ };
308
+ userAction: {
309
+ problem: string;
310
+ solution: string;
311
+ isUserFault: boolean;
312
+ example?: undefined;
313
+ details?: undefined;
314
+ detectedIncludes?: undefined;
315
+ fix?: undefined;
316
+ command?: undefined;
317
+ possibleCauses?: undefined;
318
+ };
319
+ detectedIssues?: undefined;
320
+ compilerVersion?: undefined;
321
+ systemError?: undefined;
322
+ compilerPath?: undefined;
323
+ output?: undefined;
324
+ warnings?: undefined;
325
+ localIncludes?: undefined;
326
+ contractInfo?: undefined;
327
+ nextSteps?: undefined;
328
+ errorCategory?: undefined;
329
+ errors?: undefined;
330
+ errorCount?: undefined;
331
+ rawOutput?: undefined;
332
+ suggestions?: undefined;
333
+ commonFixes?: undefined;
334
+ } | {
335
+ success: boolean;
336
+ errorType: string;
337
+ compilerInstalled: boolean;
338
+ compilerVersion: string;
339
+ error: string;
340
+ message: string;
341
+ userAction: {
342
+ problem: string;
343
+ solution: string;
344
+ command: string;
345
+ isUserFault: boolean;
346
+ example?: undefined;
347
+ details?: undefined;
348
+ detectedIncludes?: undefined;
349
+ fix?: undefined;
350
+ possibleCauses?: undefined;
351
+ };
352
+ detectedIssues?: undefined;
353
+ installation?: undefined;
354
+ systemError?: undefined;
355
+ compilerPath?: undefined;
356
+ output?: undefined;
357
+ warnings?: undefined;
358
+ localIncludes?: undefined;
359
+ contractInfo?: undefined;
360
+ nextSteps?: undefined;
361
+ errorCategory?: undefined;
362
+ errors?: undefined;
363
+ errorCount?: undefined;
364
+ rawOutput?: undefined;
365
+ suggestions?: undefined;
366
+ commonFixes?: undefined;
367
+ } | {
368
+ success: boolean;
369
+ errorType: string;
370
+ error: string;
371
+ message: string;
372
+ systemError: {
373
+ code: string | undefined;
374
+ details: string | undefined;
375
+ problem: string;
376
+ solution: string;
377
+ isUserFault: boolean;
378
+ };
379
+ userAction?: undefined;
380
+ detectedIssues?: undefined;
381
+ compilerInstalled?: undefined;
382
+ installation?: undefined;
383
+ compilerVersion?: undefined;
384
+ compilerPath?: undefined;
385
+ output?: undefined;
386
+ warnings?: undefined;
387
+ localIncludes?: undefined;
388
+ contractInfo?: undefined;
389
+ nextSteps?: undefined;
390
+ errorCategory?: undefined;
391
+ errors?: undefined;
392
+ errorCount?: undefined;
393
+ rawOutput?: undefined;
394
+ suggestions?: undefined;
395
+ commonFixes?: undefined;
396
+ } | {
397
+ success: boolean;
398
+ errorType: string;
399
+ error: string;
400
+ message: string;
401
+ systemError: {
402
+ code: string | undefined;
403
+ details: string | undefined;
404
+ isUserFault: boolean;
405
+ problem?: undefined;
406
+ solution?: undefined;
407
+ };
408
+ userAction?: undefined;
409
+ detectedIssues?: undefined;
410
+ compilerInstalled?: undefined;
411
+ installation?: undefined;
412
+ compilerVersion?: undefined;
413
+ compilerPath?: undefined;
414
+ output?: undefined;
415
+ warnings?: undefined;
416
+ localIncludes?: undefined;
417
+ contractInfo?: undefined;
418
+ nextSteps?: undefined;
419
+ errorCategory?: undefined;
420
+ errors?: undefined;
421
+ errorCount?: undefined;
422
+ rawOutput?: undefined;
423
+ suggestions?: undefined;
424
+ commonFixes?: undefined;
425
+ } | {
426
+ success: boolean;
427
+ errorType: null;
428
+ compilerInstalled: boolean;
429
+ compilerVersion: string;
430
+ compilerPath: string;
431
+ message: string;
432
+ output: string;
433
+ warnings: string[];
434
+ localIncludes: string[] | undefined;
435
+ contractInfo: {
436
+ filename: string;
437
+ codeLength: number;
438
+ lineCount: number;
439
+ };
440
+ nextSteps: string[];
441
+ error?: undefined;
442
+ userAction?: undefined;
443
+ detectedIssues?: undefined;
444
+ installation?: undefined;
445
+ systemError?: undefined;
446
+ errorCategory?: undefined;
447
+ errors?: undefined;
448
+ errorCount?: undefined;
449
+ rawOutput?: undefined;
450
+ suggestions?: undefined;
451
+ commonFixes?: undefined;
452
+ } | {
453
+ success: boolean;
454
+ errorType: string;
455
+ compilerInstalled: boolean;
456
+ compilerVersion: string;
457
+ error: string;
458
+ message: string;
459
+ userAction: {
460
+ problem: string;
461
+ solution: string;
462
+ possibleCauses: string[];
463
+ isUserFault: boolean;
464
+ example?: undefined;
465
+ details?: undefined;
466
+ detectedIncludes?: undefined;
467
+ fix?: undefined;
468
+ command?: undefined;
469
+ };
470
+ detectedIssues?: undefined;
471
+ installation?: undefined;
472
+ systemError?: undefined;
473
+ compilerPath?: undefined;
474
+ output?: undefined;
475
+ warnings?: undefined;
476
+ localIncludes?: undefined;
477
+ contractInfo?: undefined;
478
+ nextSteps?: undefined;
479
+ errorCategory?: undefined;
480
+ errors?: undefined;
481
+ errorCount?: undefined;
482
+ rawOutput?: undefined;
483
+ suggestions?: undefined;
484
+ commonFixes?: undefined;
485
+ } | {
486
+ success: boolean;
487
+ errorType: string;
488
+ errorCategory: {
489
+ category: string;
490
+ title: string;
491
+ explanation: string;
492
+ solution: string;
493
+ };
494
+ compilerInstalled: boolean;
495
+ compilerVersion: string;
496
+ compilerPath: string;
497
+ message: string;
498
+ errors: {
499
+ line?: number;
500
+ column?: number;
501
+ message: string;
502
+ severity: "error" | "warning";
503
+ context?: string;
504
+ }[];
505
+ errorCount: number;
506
+ rawOutput: string;
507
+ contractInfo: {
508
+ filename: string;
509
+ codeLength: number;
510
+ lineCount: number;
511
+ };
512
+ userAction: {
513
+ problem: string;
514
+ solution: string;
515
+ isUserFault: boolean;
516
+ example?: undefined;
517
+ details?: undefined;
518
+ detectedIncludes?: undefined;
519
+ fix?: undefined;
520
+ command?: undefined;
521
+ possibleCauses?: undefined;
522
+ };
523
+ suggestions: string[];
524
+ commonFixes: {
525
+ pattern: string;
526
+ fix: string;
527
+ }[];
528
+ error?: undefined;
529
+ detectedIssues?: undefined;
530
+ installation?: undefined;
531
+ systemError?: undefined;
532
+ output?: undefined;
533
+ warnings?: undefined;
534
+ localIncludes?: undefined;
535
+ nextSteps?: undefined;
536
+ }>;
537
+ /**
538
+ * Extract the structure of a Compact contract (circuits, witnesses, ledger, etc.)
539
+ * This helps agents understand what a contract does without parsing it themselves
540
+ */
541
+ export declare function extractContractStructure(input: ExtractContractStructureInput): Promise<{
542
+ success: boolean;
543
+ error: string;
544
+ message: string | undefined;
545
+ details?: undefined;
546
+ filename?: undefined;
547
+ languageVersion?: undefined;
548
+ imports?: undefined;
549
+ structure?: undefined;
550
+ exports?: undefined;
551
+ stats?: undefined;
552
+ summary?: undefined;
553
+ } | {
554
+ success: boolean;
555
+ error: string;
556
+ message: string;
557
+ details: string | undefined;
558
+ filename?: undefined;
559
+ languageVersion?: undefined;
560
+ imports?: undefined;
561
+ structure?: undefined;
562
+ exports?: undefined;
563
+ stats?: undefined;
564
+ summary?: undefined;
565
+ } | {
566
+ success: boolean;
567
+ filename: string;
568
+ languageVersion: string | null;
569
+ imports: string[];
570
+ structure: {
571
+ circuits: {
572
+ name: string;
573
+ params: string[];
574
+ returnType: string;
575
+ isExport: boolean;
576
+ line: number;
577
+ }[];
578
+ witnesses: {
579
+ name: string;
580
+ type: string;
581
+ isExport: boolean;
582
+ line: number;
583
+ }[];
584
+ ledgerItems: {
585
+ name: string;
586
+ type: string;
587
+ isExport: boolean;
588
+ line: number;
589
+ }[];
590
+ types: {
591
+ name: string;
592
+ definition: string;
593
+ line: number;
594
+ }[];
595
+ structs: {
596
+ name: string;
597
+ fields: string[];
598
+ line: number;
599
+ }[];
600
+ enums: {
601
+ name: string;
602
+ variants: string[];
603
+ line: number;
604
+ }[];
605
+ };
606
+ exports: {
607
+ circuits: string[];
608
+ witnesses: string[];
609
+ ledger: string[];
610
+ };
611
+ stats: {
612
+ lineCount: number;
613
+ circuitCount: number;
614
+ witnessCount: number;
615
+ ledgerCount: number;
616
+ typeCount: number;
617
+ structCount: number;
618
+ enumCount: number;
619
+ exportedCircuits: number;
620
+ exportedWitnesses: number;
621
+ exportedLedger: number;
622
+ };
623
+ summary: string;
624
+ message: string;
625
+ error?: undefined;
626
+ details?: undefined;
627
+ }>;
628
+ //# sourceMappingURL=validation.d.ts.map