@claude-flow/plugin-financial-risk 3.0.0-alpha.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.
@@ -0,0 +1,792 @@
1
+ /**
2
+ * Financial Risk Plugin - Type Definitions
3
+ *
4
+ * Core types for financial risk analysis including portfolio risk,
5
+ * anomaly detection, market regime classification, compliance checking,
6
+ * and stress testing.
7
+ */
8
+ import { z } from 'zod';
9
+ /**
10
+ * MCP Tool definition
11
+ */
12
+ export interface MCPTool {
13
+ name: string;
14
+ description: string;
15
+ category: string;
16
+ version: string;
17
+ tags: string[];
18
+ cacheable: boolean;
19
+ cacheTTL: number;
20
+ inputSchema: {
21
+ type: 'object';
22
+ properties: Record<string, unknown>;
23
+ required: string[];
24
+ };
25
+ handler: (input: Record<string, unknown>, context?: ToolContext) => Promise<MCPToolResult>;
26
+ }
27
+ /**
28
+ * MCP Tool result
29
+ */
30
+ export interface MCPToolResult {
31
+ success: boolean;
32
+ data?: unknown;
33
+ error?: string;
34
+ metadata?: {
35
+ durationMs?: number;
36
+ cached?: boolean;
37
+ wasmUsed?: boolean;
38
+ };
39
+ }
40
+ /**
41
+ * Tool execution context
42
+ */
43
+ export interface ToolContext {
44
+ logger?: Logger;
45
+ config?: FinancialConfig;
46
+ bridge?: FinancialBridge;
47
+ userId?: string;
48
+ userRoles?: FinancialRole[];
49
+ auditLogger?: FinancialAuditLogger;
50
+ }
51
+ /**
52
+ * Simple logger interface
53
+ */
54
+ export interface Logger {
55
+ debug: (msg: string, meta?: Record<string, unknown>) => void;
56
+ info: (msg: string, meta?: Record<string, unknown>) => void;
57
+ warn: (msg: string, meta?: Record<string, unknown>) => void;
58
+ error: (msg: string, meta?: Record<string, unknown>) => void;
59
+ }
60
+ /**
61
+ * Portfolio holding
62
+ */
63
+ export interface PortfolioHolding {
64
+ symbol: string;
65
+ quantity: number;
66
+ assetClass?: string;
67
+ sector?: string;
68
+ currency?: string;
69
+ marketValue?: number;
70
+ costBasis?: number;
71
+ }
72
+ /**
73
+ * Portfolio
74
+ */
75
+ export interface Portfolio {
76
+ id: string;
77
+ name?: string;
78
+ holdings: PortfolioHolding[];
79
+ totalValue?: number;
80
+ currency?: string;
81
+ asOfDate?: string;
82
+ }
83
+ /**
84
+ * Risk metric types
85
+ */
86
+ export type RiskMetricType = 'var' | 'cvar' | 'sharpe' | 'sortino' | 'max_drawdown' | 'beta' | 'volatility';
87
+ /**
88
+ * Time horizon for risk calculations
89
+ */
90
+ export type TimeHorizon = '1d' | '1w' | '1m' | '3m' | '1y';
91
+ /**
92
+ * Risk metrics result
93
+ */
94
+ export interface RiskMetrics {
95
+ var?: number;
96
+ cvar?: number;
97
+ sharpe?: number;
98
+ sortino?: number;
99
+ maxDrawdown?: number;
100
+ beta?: number;
101
+ volatility?: number;
102
+ confidenceLevel: number;
103
+ horizon: TimeHorizon;
104
+ }
105
+ /**
106
+ * Portfolio risk result
107
+ */
108
+ export interface PortfolioRiskResult {
109
+ portfolio: Portfolio;
110
+ metrics: RiskMetrics;
111
+ concentrationRisk: {
112
+ topHoldings: Array<{
113
+ symbol: string;
114
+ weight: number;
115
+ }>;
116
+ sectorExposure: Record<string, number>;
117
+ geographicExposure?: Record<string, number>;
118
+ };
119
+ recommendations: string[];
120
+ analysisTime: number;
121
+ modelVersion: string;
122
+ }
123
+ /**
124
+ * Financial transaction
125
+ */
126
+ export interface FinancialTransaction {
127
+ id: string;
128
+ amount: number;
129
+ timestamp: string;
130
+ parties: string[];
131
+ type?: string;
132
+ currency?: string;
133
+ metadata?: Record<string, unknown>;
134
+ }
135
+ /**
136
+ * Anomaly context types
137
+ */
138
+ export type AnomalyContext = 'fraud' | 'aml' | 'market_manipulation' | 'all';
139
+ /**
140
+ * Anomaly severity
141
+ */
142
+ export type AnomalySeverity = 'critical' | 'high' | 'medium' | 'low';
143
+ /**
144
+ * Detected anomaly
145
+ */
146
+ export interface DetectedAnomaly {
147
+ transactionId: string;
148
+ score: number;
149
+ severity: AnomalySeverity;
150
+ type: string;
151
+ description: string;
152
+ indicators: string[];
153
+ relatedTransactions?: string[];
154
+ recommendedAction: string;
155
+ }
156
+ /**
157
+ * Anomaly detection result
158
+ */
159
+ export interface AnomalyDetectionResult {
160
+ transactions: FinancialTransaction[];
161
+ anomalies: DetectedAnomaly[];
162
+ riskScore: number;
163
+ patterns: Array<{
164
+ type: string;
165
+ frequency: number;
166
+ description: string;
167
+ }>;
168
+ networkAnalysis?: {
169
+ clusters: number;
170
+ suspiciousNodes: string[];
171
+ graphDensity: number;
172
+ };
173
+ analysisTime: number;
174
+ }
175
+ /**
176
+ * Market regime types
177
+ */
178
+ export type MarketRegimeType = 'bull' | 'bear' | 'sideways' | 'high_vol' | 'crisis' | 'recovery';
179
+ /**
180
+ * Market data for regime classification
181
+ */
182
+ export interface MarketData {
183
+ prices: number[];
184
+ volumes?: number[];
185
+ volatility?: number[];
186
+ timestamps?: string[];
187
+ }
188
+ /**
189
+ * Regime classification
190
+ */
191
+ export interface RegimeClassification {
192
+ regime: MarketRegimeType;
193
+ confidence: number;
194
+ probability: number;
195
+ duration?: number;
196
+ characteristics: string[];
197
+ }
198
+ /**
199
+ * Market regime result
200
+ */
201
+ export interface MarketRegimeResult {
202
+ currentRegime: RegimeClassification;
203
+ historicalRegimes: RegimeClassification[];
204
+ transitionProbabilities: Record<MarketRegimeType, Record<MarketRegimeType, number>>;
205
+ similarHistoricalPeriods: Array<{
206
+ startDate: string;
207
+ endDate: string;
208
+ regime: MarketRegimeType;
209
+ similarity: number;
210
+ }>;
211
+ outlook: {
212
+ shortTerm: MarketRegimeType;
213
+ mediumTerm: MarketRegimeType;
214
+ confidence: number;
215
+ };
216
+ analysisTime: number;
217
+ }
218
+ /**
219
+ * Regulation types
220
+ */
221
+ export type RegulationType = 'basel3' | 'mifid2' | 'dodd_frank' | 'aml' | 'kyc' | 'fatca' | 'gdpr';
222
+ /**
223
+ * Compliance scope
224
+ */
225
+ export type ComplianceScope = 'positions' | 'transactions' | 'capital' | 'reporting' | 'all';
226
+ /**
227
+ * Compliance violation
228
+ */
229
+ export interface ComplianceViolation {
230
+ id: string;
231
+ regulation: RegulationType;
232
+ severity: 'critical' | 'major' | 'minor' | 'warning';
233
+ description: string;
234
+ affectedItems: string[];
235
+ remediation: string;
236
+ deadline?: string;
237
+ }
238
+ /**
239
+ * Capital adequacy metrics (Basel III)
240
+ */
241
+ export interface CapitalAdequacy {
242
+ cet1Ratio: number;
243
+ tier1Ratio: number;
244
+ totalCapitalRatio: number;
245
+ leverageRatio: number;
246
+ liquidity: {
247
+ lcr: number;
248
+ nsfr: number;
249
+ };
250
+ rwa: number;
251
+ }
252
+ /**
253
+ * Compliance check result
254
+ */
255
+ export interface ComplianceCheckResult {
256
+ entity: string;
257
+ regulations: RegulationType[];
258
+ scope: ComplianceScope;
259
+ compliant: boolean;
260
+ violations: ComplianceViolation[];
261
+ warnings: ComplianceViolation[];
262
+ capitalAdequacy?: CapitalAdequacy;
263
+ recommendations: string[];
264
+ asOfDate: string;
265
+ analysisTime: number;
266
+ }
267
+ /**
268
+ * Stress test scenario type
269
+ */
270
+ export type ScenarioType = 'historical' | 'hypothetical' | 'reverse';
271
+ /**
272
+ * Market shocks for stress testing
273
+ */
274
+ export interface MarketShocks {
275
+ equityShock?: number;
276
+ interestRateShock?: number;
277
+ creditSpreadShock?: number;
278
+ fxShock?: Record<string, number>;
279
+ commodityShock?: Record<string, number>;
280
+ volatilityShock?: number;
281
+ }
282
+ /**
283
+ * Stress test scenario
284
+ */
285
+ export interface StressScenario {
286
+ name: string;
287
+ type: ScenarioType;
288
+ description?: string;
289
+ shocks: MarketShocks;
290
+ historicalReference?: string;
291
+ }
292
+ /**
293
+ * Scenario impact result
294
+ */
295
+ export interface ScenarioImpact {
296
+ scenario: StressScenario;
297
+ portfolioImpact: {
298
+ pnl: number;
299
+ percentChange: number;
300
+ worstHolding: {
301
+ symbol: string;
302
+ loss: number;
303
+ };
304
+ bestHolding: {
305
+ symbol: string;
306
+ gain: number;
307
+ };
308
+ };
309
+ riskMetrics: {
310
+ varBreach: boolean;
311
+ capitalImpact: number;
312
+ liquidityImpact: number;
313
+ };
314
+ breaches: string[];
315
+ }
316
+ /**
317
+ * Stress test result
318
+ */
319
+ export interface StressTestResult {
320
+ portfolio: Portfolio;
321
+ scenarios: ScenarioImpact[];
322
+ aggregateImpact: {
323
+ worstCase: {
324
+ scenario: string;
325
+ pnl: number;
326
+ };
327
+ expectedLoss: number;
328
+ tailRisk: number;
329
+ };
330
+ capitalRecommendation: number;
331
+ recommendations: string[];
332
+ analysisTime: number;
333
+ }
334
+ /**
335
+ * Financial roles for RBAC
336
+ */
337
+ export type FinancialRole = 'TRADER' | 'RISK_MANAGER' | 'COMPLIANCE_OFFICER' | 'AUDITOR' | 'QUANT' | 'ADMIN';
338
+ /**
339
+ * Financial audit log entry (SOX/MiFID II compliant)
340
+ */
341
+ export interface FinancialAuditLogEntry {
342
+ timestamp: string;
343
+ userId: string;
344
+ toolName: string;
345
+ transactionIds: string[];
346
+ portfolioHash: string;
347
+ riskMetricsComputed: string[];
348
+ modelVersion: string;
349
+ inputHash: string;
350
+ outputHash: string;
351
+ executionTimeMs: number;
352
+ regulatoryFlags: string[];
353
+ }
354
+ /**
355
+ * Financial audit logger interface
356
+ */
357
+ export interface FinancialAuditLogger {
358
+ log: (entry: FinancialAuditLogEntry) => Promise<void>;
359
+ query: (filter: Partial<FinancialAuditLogEntry>) => Promise<FinancialAuditLogEntry[]>;
360
+ }
361
+ /**
362
+ * Role-based access control mapping
363
+ */
364
+ export declare const FinancialRolePermissions: Record<FinancialRole, string[]>;
365
+ /**
366
+ * Rate limits per tool
367
+ */
368
+ export declare const FinancialRateLimits: Record<string, {
369
+ requestsPerMinute: number;
370
+ maxConcurrent: number;
371
+ }>;
372
+ /**
373
+ * Economy Bridge interface for token economics
374
+ */
375
+ export interface EconomyBridge {
376
+ initialized: boolean;
377
+ calculateVar: (returns: Float32Array, confidence: number) => Promise<number>;
378
+ calculateCvar: (returns: Float32Array, confidence: number) => Promise<number>;
379
+ optimizePortfolio: (returns: Float32Array[], constraints: Record<string, number>) => Promise<Float32Array>;
380
+ simulateMonteCarlo: (portfolio: Float32Array, scenarios: number, horizon: number) => Promise<Float32Array>;
381
+ initialize: (config?: EconomyConfig) => Promise<void>;
382
+ }
383
+ /**
384
+ * Economy bridge configuration
385
+ */
386
+ export interface EconomyConfig {
387
+ precision?: number;
388
+ randomSeed?: number;
389
+ defaultScenarios?: number;
390
+ }
391
+ /**
392
+ * Sparse Bridge interface for efficient risk calculations
393
+ */
394
+ export interface SparseBridge {
395
+ initialized: boolean;
396
+ sparseInference: (features: Float32Array, indices: Uint32Array) => Promise<Float32Array>;
397
+ detectAnomalies: (transactions: Float32Array[], threshold: number) => Promise<Uint32Array>;
398
+ classifyRegime: (marketData: Float32Array) => Promise<{
399
+ regime: number;
400
+ confidence: number;
401
+ }>;
402
+ initialize: (config?: SparseConfig) => Promise<void>;
403
+ }
404
+ /**
405
+ * Sparse bridge configuration
406
+ */
407
+ export interface SparseConfig {
408
+ sparsityThreshold?: number;
409
+ maxFeatures?: number;
410
+ compressionLevel?: number;
411
+ }
412
+ /**
413
+ * Combined financial bridge interface
414
+ */
415
+ export interface FinancialBridge {
416
+ economy?: EconomyBridge;
417
+ sparse?: SparseBridge;
418
+ initialized: boolean;
419
+ }
420
+ /**
421
+ * Financial plugin configuration
422
+ */
423
+ export interface FinancialConfig {
424
+ compliance: {
425
+ auditEnabled: boolean;
426
+ retentionYears: number;
427
+ realTimeMonitoring: boolean;
428
+ };
429
+ risk: {
430
+ defaultConfidenceLevel: number;
431
+ defaultHorizon: TimeHorizon;
432
+ maxPositions: number;
433
+ varMethod: 'historical' | 'parametric' | 'monte_carlo';
434
+ };
435
+ anomaly: {
436
+ defaultThreshold: number;
437
+ maxTransactions: number;
438
+ windowSize: number;
439
+ };
440
+ stressTest: {
441
+ maxScenarios: number;
442
+ defaultSimulations: number;
443
+ };
444
+ cache: {
445
+ enabled: boolean;
446
+ ttl: number;
447
+ maxSize: number;
448
+ };
449
+ }
450
+ /**
451
+ * Default configuration
452
+ */
453
+ export declare const DEFAULT_FINANCIAL_CONFIG: FinancialConfig;
454
+ /**
455
+ * Portfolio risk input schema
456
+ */
457
+ export declare const PortfolioRiskInputSchema: z.ZodObject<{
458
+ holdings: z.ZodArray<z.ZodObject<{
459
+ symbol: z.ZodString;
460
+ quantity: z.ZodNumber;
461
+ assetClass: z.ZodOptional<z.ZodString>;
462
+ sector: z.ZodOptional<z.ZodString>;
463
+ currency: z.ZodOptional<z.ZodString>;
464
+ }, "strip", z.ZodTypeAny, {
465
+ symbol: string;
466
+ quantity: number;
467
+ assetClass?: string | undefined;
468
+ sector?: string | undefined;
469
+ currency?: string | undefined;
470
+ }, {
471
+ symbol: string;
472
+ quantity: number;
473
+ assetClass?: string | undefined;
474
+ sector?: string | undefined;
475
+ currency?: string | undefined;
476
+ }>, "many">;
477
+ riskMetrics: z.ZodOptional<z.ZodArray<z.ZodEnum<["var", "cvar", "sharpe", "sortino", "max_drawdown", "beta", "volatility"]>, "many">>;
478
+ confidenceLevel: z.ZodDefault<z.ZodNumber>;
479
+ horizon: z.ZodDefault<z.ZodEnum<["1d", "1w", "1m", "3m", "1y"]>>;
480
+ }, "strip", z.ZodTypeAny, {
481
+ holdings: {
482
+ symbol: string;
483
+ quantity: number;
484
+ assetClass?: string | undefined;
485
+ sector?: string | undefined;
486
+ currency?: string | undefined;
487
+ }[];
488
+ confidenceLevel: number;
489
+ horizon: "1d" | "1w" | "1m" | "3m" | "1y";
490
+ riskMetrics?: ("var" | "cvar" | "sharpe" | "sortino" | "max_drawdown" | "beta" | "volatility")[] | undefined;
491
+ }, {
492
+ holdings: {
493
+ symbol: string;
494
+ quantity: number;
495
+ assetClass?: string | undefined;
496
+ sector?: string | undefined;
497
+ currency?: string | undefined;
498
+ }[];
499
+ riskMetrics?: ("var" | "cvar" | "sharpe" | "sortino" | "max_drawdown" | "beta" | "volatility")[] | undefined;
500
+ confidenceLevel?: number | undefined;
501
+ horizon?: "1d" | "1w" | "1m" | "3m" | "1y" | undefined;
502
+ }>;
503
+ /**
504
+ * Anomaly detection input schema
505
+ */
506
+ export declare const AnomalyDetectInputSchema: z.ZodObject<{
507
+ transactions: z.ZodArray<z.ZodObject<{
508
+ id: z.ZodString;
509
+ amount: z.ZodNumber;
510
+ timestamp: z.ZodString;
511
+ parties: z.ZodArray<z.ZodString, "many">;
512
+ type: z.ZodOptional<z.ZodString>;
513
+ currency: z.ZodOptional<z.ZodString>;
514
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
515
+ }, "strip", z.ZodTypeAny, {
516
+ id: string;
517
+ amount: number;
518
+ timestamp: string;
519
+ parties: string[];
520
+ type?: string | undefined;
521
+ currency?: string | undefined;
522
+ metadata?: Record<string, unknown> | undefined;
523
+ }, {
524
+ id: string;
525
+ amount: number;
526
+ timestamp: string;
527
+ parties: string[];
528
+ type?: string | undefined;
529
+ currency?: string | undefined;
530
+ metadata?: Record<string, unknown> | undefined;
531
+ }>, "many">;
532
+ sensitivity: z.ZodDefault<z.ZodNumber>;
533
+ context: z.ZodDefault<z.ZodEnum<["fraud", "aml", "market_manipulation", "all"]>>;
534
+ }, "strip", z.ZodTypeAny, {
535
+ transactions: {
536
+ id: string;
537
+ amount: number;
538
+ timestamp: string;
539
+ parties: string[];
540
+ type?: string | undefined;
541
+ currency?: string | undefined;
542
+ metadata?: Record<string, unknown> | undefined;
543
+ }[];
544
+ sensitivity: number;
545
+ context: "fraud" | "aml" | "market_manipulation" | "all";
546
+ }, {
547
+ transactions: {
548
+ id: string;
549
+ amount: number;
550
+ timestamp: string;
551
+ parties: string[];
552
+ type?: string | undefined;
553
+ currency?: string | undefined;
554
+ metadata?: Record<string, unknown> | undefined;
555
+ }[];
556
+ sensitivity?: number | undefined;
557
+ context?: "fraud" | "aml" | "market_manipulation" | "all" | undefined;
558
+ }>;
559
+ /**
560
+ * Market regime input schema
561
+ */
562
+ export declare const MarketRegimeInputSchema: z.ZodObject<{
563
+ marketData: z.ZodObject<{
564
+ prices: z.ZodArray<z.ZodNumber, "many">;
565
+ volumes: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
566
+ volatility: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
567
+ timestamps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
568
+ }, "strip", z.ZodTypeAny, {
569
+ prices: number[];
570
+ volatility?: number[] | undefined;
571
+ volumes?: number[] | undefined;
572
+ timestamps?: string[] | undefined;
573
+ }, {
574
+ prices: number[];
575
+ volatility?: number[] | undefined;
576
+ volumes?: number[] | undefined;
577
+ timestamps?: string[] | undefined;
578
+ }>;
579
+ lookbackPeriod: z.ZodDefault<z.ZodNumber>;
580
+ regimeTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<["bull", "bear", "sideways", "high_vol", "crisis", "recovery"]>, "many">>;
581
+ }, "strip", z.ZodTypeAny, {
582
+ marketData: {
583
+ prices: number[];
584
+ volatility?: number[] | undefined;
585
+ volumes?: number[] | undefined;
586
+ timestamps?: string[] | undefined;
587
+ };
588
+ lookbackPeriod: number;
589
+ regimeTypes?: ("bull" | "bear" | "sideways" | "high_vol" | "crisis" | "recovery")[] | undefined;
590
+ }, {
591
+ marketData: {
592
+ prices: number[];
593
+ volatility?: number[] | undefined;
594
+ volumes?: number[] | undefined;
595
+ timestamps?: string[] | undefined;
596
+ };
597
+ lookbackPeriod?: number | undefined;
598
+ regimeTypes?: ("bull" | "bear" | "sideways" | "high_vol" | "crisis" | "recovery")[] | undefined;
599
+ }>;
600
+ /**
601
+ * Compliance check input schema
602
+ */
603
+ export declare const ComplianceCheckInputSchema: z.ZodObject<{
604
+ entity: z.ZodString;
605
+ regulations: z.ZodArray<z.ZodEnum<["basel3", "mifid2", "dodd_frank", "aml", "kyc", "fatca", "gdpr"]>, "many">;
606
+ scope: z.ZodDefault<z.ZodEnum<["positions", "transactions", "capital", "reporting", "all"]>>;
607
+ asOfDate: z.ZodOptional<z.ZodString>;
608
+ }, "strip", z.ZodTypeAny, {
609
+ entity: string;
610
+ regulations: ("aml" | "basel3" | "mifid2" | "dodd_frank" | "kyc" | "fatca" | "gdpr")[];
611
+ scope: "all" | "positions" | "transactions" | "capital" | "reporting";
612
+ asOfDate?: string | undefined;
613
+ }, {
614
+ entity: string;
615
+ regulations: ("aml" | "basel3" | "mifid2" | "dodd_frank" | "kyc" | "fatca" | "gdpr")[];
616
+ scope?: "all" | "positions" | "transactions" | "capital" | "reporting" | undefined;
617
+ asOfDate?: string | undefined;
618
+ }>;
619
+ /**
620
+ * Stress test input schema
621
+ */
622
+ export declare const StressTestInputSchema: z.ZodObject<{
623
+ portfolio: z.ZodObject<{
624
+ id: z.ZodOptional<z.ZodString>;
625
+ holdings: z.ZodArray<z.ZodObject<{
626
+ symbol: z.ZodString;
627
+ quantity: z.ZodNumber;
628
+ assetClass: z.ZodOptional<z.ZodString>;
629
+ }, "strip", z.ZodTypeAny, {
630
+ symbol: string;
631
+ quantity: number;
632
+ assetClass?: string | undefined;
633
+ }, {
634
+ symbol: string;
635
+ quantity: number;
636
+ assetClass?: string | undefined;
637
+ }>, "many">;
638
+ }, "strip", z.ZodTypeAny, {
639
+ holdings: {
640
+ symbol: string;
641
+ quantity: number;
642
+ assetClass?: string | undefined;
643
+ }[];
644
+ id?: string | undefined;
645
+ }, {
646
+ holdings: {
647
+ symbol: string;
648
+ quantity: number;
649
+ assetClass?: string | undefined;
650
+ }[];
651
+ id?: string | undefined;
652
+ }>;
653
+ scenarios: z.ZodArray<z.ZodObject<{
654
+ name: z.ZodString;
655
+ type: z.ZodEnum<["historical", "hypothetical", "reverse"]>;
656
+ description: z.ZodOptional<z.ZodString>;
657
+ shocks: z.ZodObject<{
658
+ equityShock: z.ZodOptional<z.ZodNumber>;
659
+ interestRateShock: z.ZodOptional<z.ZodNumber>;
660
+ creditSpreadShock: z.ZodOptional<z.ZodNumber>;
661
+ fxShock: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
662
+ commodityShock: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
663
+ volatilityShock: z.ZodOptional<z.ZodNumber>;
664
+ }, "strip", z.ZodTypeAny, {
665
+ equityShock?: number | undefined;
666
+ interestRateShock?: number | undefined;
667
+ creditSpreadShock?: number | undefined;
668
+ fxShock?: Record<string, number> | undefined;
669
+ commodityShock?: Record<string, number> | undefined;
670
+ volatilityShock?: number | undefined;
671
+ }, {
672
+ equityShock?: number | undefined;
673
+ interestRateShock?: number | undefined;
674
+ creditSpreadShock?: number | undefined;
675
+ fxShock?: Record<string, number> | undefined;
676
+ commodityShock?: Record<string, number> | undefined;
677
+ volatilityShock?: number | undefined;
678
+ }>;
679
+ historicalReference: z.ZodOptional<z.ZodString>;
680
+ }, "strip", z.ZodTypeAny, {
681
+ type: "historical" | "hypothetical" | "reverse";
682
+ name: string;
683
+ shocks: {
684
+ equityShock?: number | undefined;
685
+ interestRateShock?: number | undefined;
686
+ creditSpreadShock?: number | undefined;
687
+ fxShock?: Record<string, number> | undefined;
688
+ commodityShock?: Record<string, number> | undefined;
689
+ volatilityShock?: number | undefined;
690
+ };
691
+ description?: string | undefined;
692
+ historicalReference?: string | undefined;
693
+ }, {
694
+ type: "historical" | "hypothetical" | "reverse";
695
+ name: string;
696
+ shocks: {
697
+ equityShock?: number | undefined;
698
+ interestRateShock?: number | undefined;
699
+ creditSpreadShock?: number | undefined;
700
+ fxShock?: Record<string, number> | undefined;
701
+ commodityShock?: Record<string, number> | undefined;
702
+ volatilityShock?: number | undefined;
703
+ };
704
+ description?: string | undefined;
705
+ historicalReference?: string | undefined;
706
+ }>, "many">;
707
+ metrics: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
708
+ }, "strip", z.ZodTypeAny, {
709
+ portfolio: {
710
+ holdings: {
711
+ symbol: string;
712
+ quantity: number;
713
+ assetClass?: string | undefined;
714
+ }[];
715
+ id?: string | undefined;
716
+ };
717
+ scenarios: {
718
+ type: "historical" | "hypothetical" | "reverse";
719
+ name: string;
720
+ shocks: {
721
+ equityShock?: number | undefined;
722
+ interestRateShock?: number | undefined;
723
+ creditSpreadShock?: number | undefined;
724
+ fxShock?: Record<string, number> | undefined;
725
+ commodityShock?: Record<string, number> | undefined;
726
+ volatilityShock?: number | undefined;
727
+ };
728
+ description?: string | undefined;
729
+ historicalReference?: string | undefined;
730
+ }[];
731
+ metrics?: string[] | undefined;
732
+ }, {
733
+ portfolio: {
734
+ holdings: {
735
+ symbol: string;
736
+ quantity: number;
737
+ assetClass?: string | undefined;
738
+ }[];
739
+ id?: string | undefined;
740
+ };
741
+ scenarios: {
742
+ type: "historical" | "hypothetical" | "reverse";
743
+ name: string;
744
+ shocks: {
745
+ equityShock?: number | undefined;
746
+ interestRateShock?: number | undefined;
747
+ creditSpreadShock?: number | undefined;
748
+ fxShock?: Record<string, number> | undefined;
749
+ commodityShock?: Record<string, number> | undefined;
750
+ volatilityShock?: number | undefined;
751
+ };
752
+ description?: string | undefined;
753
+ historicalReference?: string | undefined;
754
+ }[];
755
+ metrics?: string[] | undefined;
756
+ }>;
757
+ /**
758
+ * Create a success result
759
+ */
760
+ export declare function successResult<T>(data: T, metadata?: MCPToolResult['metadata']): MCPToolResult;
761
+ /**
762
+ * Create an error result
763
+ */
764
+ export declare function errorResult(error: string | Error, metadata?: MCPToolResult['metadata']): MCPToolResult;
765
+ /**
766
+ * Financial plugin error codes
767
+ */
768
+ export declare const FinancialErrorCodes: {
769
+ readonly UNAUTHORIZED_ACCESS: "FIN_UNAUTHORIZED_ACCESS";
770
+ readonly INVALID_PORTFOLIO: "FIN_INVALID_PORTFOLIO";
771
+ readonly INVALID_TRANSACTION: "FIN_INVALID_TRANSACTION";
772
+ readonly COMPLIANCE_VIOLATION: "FIN_COMPLIANCE_VIOLATION";
773
+ readonly RATE_LIMIT_EXCEEDED: "FIN_RATE_LIMIT_EXCEEDED";
774
+ readonly WASM_NOT_INITIALIZED: "FIN_WASM_NOT_INITIALIZED";
775
+ readonly CALCULATION_FAILED: "FIN_CALCULATION_FAILED";
776
+ readonly MARKET_DATA_UNAVAILABLE: "FIN_MARKET_DATA_UNAVAILABLE";
777
+ readonly AUDIT_FAILED: "FIN_AUDIT_FAILED";
778
+ readonly SCENARIO_INVALID: "FIN_SCENARIO_INVALID";
779
+ };
780
+ export type FinancialErrorCode = (typeof FinancialErrorCodes)[keyof typeof FinancialErrorCodes];
781
+ /**
782
+ * Risk calculation proof for regulatory audits
783
+ */
784
+ export interface RiskCalculationProof {
785
+ inputHash: string;
786
+ modelChecksum: string;
787
+ randomSeed: string;
788
+ outputHash: string;
789
+ signature: string;
790
+ timestamp: string;
791
+ }
792
+ //# sourceMappingURL=types.d.ts.map