driftdetect-mcp 0.3.0 → 0.4.2

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.
Files changed (140) hide show
  1. package/dist/bin/server.d.ts +12 -2
  2. package/dist/bin/server.d.ts.map +1 -1
  3. package/dist/bin/server.js +25 -5
  4. package/dist/bin/server.js.map +1 -1
  5. package/dist/enterprise-server.d.ts +78 -0
  6. package/dist/enterprise-server.d.ts.map +1 -0
  7. package/dist/enterprise-server.js +201 -0
  8. package/dist/enterprise-server.js.map +1 -0
  9. package/dist/index.d.ts +15 -2
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +17 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/infrastructure/cache.d.ts +86 -0
  14. package/dist/infrastructure/cache.d.ts.map +1 -0
  15. package/dist/infrastructure/cache.js +271 -0
  16. package/dist/infrastructure/cache.js.map +1 -0
  17. package/dist/infrastructure/cursor-manager.d.ts +86 -0
  18. package/dist/infrastructure/cursor-manager.d.ts.map +1 -0
  19. package/dist/infrastructure/cursor-manager.js +175 -0
  20. package/dist/infrastructure/cursor-manager.js.map +1 -0
  21. package/dist/infrastructure/error-handler.d.ts +82 -0
  22. package/dist/infrastructure/error-handler.d.ts.map +1 -0
  23. package/dist/infrastructure/error-handler.js +226 -0
  24. package/dist/infrastructure/error-handler.js.map +1 -0
  25. package/dist/infrastructure/index.d.ts +19 -0
  26. package/dist/infrastructure/index.d.ts.map +1 -0
  27. package/dist/infrastructure/index.js +26 -0
  28. package/dist/infrastructure/index.js.map +1 -0
  29. package/dist/infrastructure/metrics.d.ts +104 -0
  30. package/dist/infrastructure/metrics.d.ts.map +1 -0
  31. package/dist/infrastructure/metrics.js +291 -0
  32. package/dist/infrastructure/metrics.js.map +1 -0
  33. package/dist/infrastructure/rate-limiter.d.ts +59 -0
  34. package/dist/infrastructure/rate-limiter.d.ts.map +1 -0
  35. package/dist/infrastructure/rate-limiter.js +132 -0
  36. package/dist/infrastructure/rate-limiter.js.map +1 -0
  37. package/dist/infrastructure/response-builder.d.ts +104 -0
  38. package/dist/infrastructure/response-builder.d.ts.map +1 -0
  39. package/dist/infrastructure/response-builder.js +207 -0
  40. package/dist/infrastructure/response-builder.js.map +1 -0
  41. package/dist/infrastructure/token-estimator.d.ts +48 -0
  42. package/dist/infrastructure/token-estimator.d.ts.map +1 -0
  43. package/dist/infrastructure/token-estimator.js +131 -0
  44. package/dist/infrastructure/token-estimator.js.map +1 -0
  45. package/dist/server.d.ts.map +1 -1
  46. package/dist/server.js +1136 -18
  47. package/dist/server.js.map +1 -1
  48. package/dist/tools/detail/code-examples.d.ts +33 -0
  49. package/dist/tools/detail/code-examples.d.ts.map +1 -0
  50. package/dist/tools/detail/code-examples.js +126 -0
  51. package/dist/tools/detail/code-examples.js.map +1 -0
  52. package/dist/tools/detail/dna-check.d.ts +32 -0
  53. package/dist/tools/detail/dna-check.d.ts.map +1 -0
  54. package/dist/tools/detail/dna-check.js +231 -0
  55. package/dist/tools/detail/dna-check.js.map +1 -0
  56. package/dist/tools/detail/dna-profile.d.ts +37 -0
  57. package/dist/tools/detail/dna-profile.d.ts.map +1 -0
  58. package/dist/tools/detail/dna-profile.js +101 -0
  59. package/dist/tools/detail/dna-profile.js.map +1 -0
  60. package/dist/tools/detail/file-patterns.d.ts +39 -0
  61. package/dist/tools/detail/file-patterns.d.ts.map +1 -0
  62. package/dist/tools/detail/file-patterns.js +103 -0
  63. package/dist/tools/detail/file-patterns.js.map +1 -0
  64. package/dist/tools/detail/files-list.d.ts +30 -0
  65. package/dist/tools/detail/files-list.d.ts.map +1 -0
  66. package/dist/tools/detail/files-list.js +99 -0
  67. package/dist/tools/detail/files-list.js.map +1 -0
  68. package/dist/tools/detail/impact-analysis.d.ts +53 -0
  69. package/dist/tools/detail/impact-analysis.d.ts.map +1 -0
  70. package/dist/tools/detail/impact-analysis.js +130 -0
  71. package/dist/tools/detail/impact-analysis.js.map +1 -0
  72. package/dist/tools/detail/index.d.ts +23 -0
  73. package/dist/tools/detail/index.d.ts.map +1 -0
  74. package/dist/tools/detail/index.js +200 -0
  75. package/dist/tools/detail/index.js.map +1 -0
  76. package/dist/tools/detail/pattern-get.d.ts +45 -0
  77. package/dist/tools/detail/pattern-get.d.ts.map +1 -0
  78. package/dist/tools/detail/pattern-get.js +87 -0
  79. package/dist/tools/detail/pattern-get.js.map +1 -0
  80. package/dist/tools/detail/reachability.d.ts +60 -0
  81. package/dist/tools/detail/reachability.d.ts.map +1 -0
  82. package/dist/tools/detail/reachability.js +168 -0
  83. package/dist/tools/detail/reachability.js.map +1 -0
  84. package/dist/tools/discovery/capabilities.d.ts +28 -0
  85. package/dist/tools/discovery/capabilities.d.ts.map +1 -0
  86. package/dist/tools/discovery/capabilities.js +112 -0
  87. package/dist/tools/discovery/capabilities.js.map +1 -0
  88. package/dist/tools/discovery/index.d.ts +13 -0
  89. package/dist/tools/discovery/index.d.ts.map +1 -0
  90. package/dist/tools/discovery/index.js +30 -0
  91. package/dist/tools/discovery/index.js.map +1 -0
  92. package/dist/tools/discovery/projects.d.ts +26 -0
  93. package/dist/tools/discovery/projects.d.ts.map +1 -0
  94. package/dist/tools/discovery/projects.js +210 -0
  95. package/dist/tools/discovery/projects.js.map +1 -0
  96. package/dist/tools/discovery/status.d.ts +42 -0
  97. package/dist/tools/discovery/status.d.ts.map +1 -0
  98. package/dist/tools/discovery/status.js +157 -0
  99. package/dist/tools/discovery/status.js.map +1 -0
  100. package/dist/tools/exploration/contracts-list.d.ts +35 -0
  101. package/dist/tools/exploration/contracts-list.d.ts.map +1 -0
  102. package/dist/tools/exploration/contracts-list.js +106 -0
  103. package/dist/tools/exploration/contracts-list.js.map +1 -0
  104. package/dist/tools/exploration/files-list.d.ts +29 -0
  105. package/dist/tools/exploration/files-list.d.ts.map +1 -0
  106. package/dist/tools/exploration/files-list.js +94 -0
  107. package/dist/tools/exploration/files-list.js.map +1 -0
  108. package/dist/tools/exploration/index.d.ts +17 -0
  109. package/dist/tools/exploration/index.d.ts.map +1 -0
  110. package/dist/tools/exploration/index.js +126 -0
  111. package/dist/tools/exploration/index.js.map +1 -0
  112. package/dist/tools/exploration/patterns-list.d.ts +40 -0
  113. package/dist/tools/exploration/patterns-list.d.ts.map +1 -0
  114. package/dist/tools/exploration/patterns-list.js +172 -0
  115. package/dist/tools/exploration/patterns-list.js.map +1 -0
  116. package/dist/tools/exploration/security-summary.d.ts +49 -0
  117. package/dist/tools/exploration/security-summary.d.ts.map +1 -0
  118. package/dist/tools/exploration/security-summary.js +111 -0
  119. package/dist/tools/exploration/security-summary.js.map +1 -0
  120. package/dist/tools/exploration/trends.d.ts +49 -0
  121. package/dist/tools/exploration/trends.d.ts.map +1 -0
  122. package/dist/tools/exploration/trends.js +147 -0
  123. package/dist/tools/exploration/trends.js.map +1 -0
  124. package/dist/tools/index.d.ts +13 -0
  125. package/dist/tools/index.d.ts.map +1 -0
  126. package/dist/tools/index.js +13 -0
  127. package/dist/tools/index.js.map +1 -0
  128. package/dist/tools/orchestration/context.d.ts +72 -0
  129. package/dist/tools/orchestration/context.d.ts.map +1 -0
  130. package/dist/tools/orchestration/context.js +499 -0
  131. package/dist/tools/orchestration/context.js.map +1 -0
  132. package/dist/tools/orchestration/index.d.ts +11 -0
  133. package/dist/tools/orchestration/index.d.ts.map +1 -0
  134. package/dist/tools/orchestration/index.js +56 -0
  135. package/dist/tools/orchestration/index.js.map +1 -0
  136. package/dist/tools/registry.d.ts +41 -0
  137. package/dist/tools/registry.d.ts.map +1 -0
  138. package/dist/tools/registry.js +64 -0
  139. package/dist/tools/registry.js.map +1 -0
  140. package/package.json +3 -3
@@ -0,0 +1,49 @@
1
+ /**
2
+ * drift_trends - Pattern Trend Analysis
3
+ *
4
+ * Exploration tool that shows how patterns have changed over time.
5
+ * Identifies regressions, improvements, and stability.
6
+ */
7
+ import type { HistoryStore } from 'driftdetect-core';
8
+ export interface TrendItem {
9
+ patternId: string;
10
+ patternName: string;
11
+ category: string;
12
+ type: 'regression' | 'improvement' | 'stable';
13
+ severity?: 'critical' | 'warning';
14
+ metric: string;
15
+ change: {
16
+ from: number;
17
+ to: number;
18
+ delta: number;
19
+ deltaPercent: number;
20
+ };
21
+ details?: string;
22
+ }
23
+ export interface TrendsData {
24
+ period: string;
25
+ summary: {
26
+ regressions: number;
27
+ improvements: number;
28
+ stable: number;
29
+ criticalRegressions: number;
30
+ };
31
+ trends: TrendItem[];
32
+ healthTrend: {
33
+ current: number;
34
+ previous: number;
35
+ direction: 'up' | 'down' | 'stable';
36
+ };
37
+ }
38
+ export declare function handleTrends(store: HistoryStore, args: {
39
+ period?: string;
40
+ category?: string;
41
+ severity?: string;
42
+ limit?: number;
43
+ }): Promise<{
44
+ content: Array<{
45
+ type: string;
46
+ text: string;
47
+ }>;
48
+ }>;
49
+ //# sourceMappingURL=trends.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trends.d.ts","sourceRoot":"","sources":["../../../src/tools/exploration/trends.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,kBAAkB,CAAC;AAGnE,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,YAAY,GAAG,aAAa,GAAG,QAAQ,CAAC;IAC9C,QAAQ,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,MAAM,EAAE,MAAM,CAAC;QACf,mBAAmB,EAAE,MAAM,CAAC;KAC7B,CAAC;IACF,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,WAAW,EAAE;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,IAAI,GAAG,MAAM,GAAG,QAAQ,CAAC;KACrC,CAAC;CACH;AAgBD,wBAAsB,YAAY,CAChC,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE;IACJ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GACA,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CA4I7D"}
@@ -0,0 +1,147 @@
1
+ /**
2
+ * drift_trends - Pattern Trend Analysis
3
+ *
4
+ * Exploration tool that shows how patterns have changed over time.
5
+ * Identifies regressions, improvements, and stability.
6
+ */
7
+ import { createResponseBuilder } from '../../infrastructure/index.js';
8
+ const DEFAULT_LIMIT = 20;
9
+ function getPeriodStartDate(period) {
10
+ const now = new Date();
11
+ let daysAgo = 7;
12
+ if (period === '30d')
13
+ daysAgo = 30;
14
+ else if (period === '90d')
15
+ daysAgo = 90;
16
+ const startDate = new Date(now);
17
+ startDate.setDate(startDate.getDate() - daysAgo);
18
+ return startDate.toISOString().split('T')[0];
19
+ }
20
+ export async function handleTrends(store, args) {
21
+ const builder = createResponseBuilder();
22
+ const period = args.period ?? '7d';
23
+ const limit = args.limit ?? DEFAULT_LIMIT;
24
+ await store.initialize();
25
+ // Get snapshots for the period
26
+ const startDate = getPeriodStartDate(period);
27
+ const snapshots = await store.getSnapshots(startDate);
28
+ if (snapshots.length < 2) {
29
+ return builder
30
+ .withSummary(`Not enough history for ${period} trend analysis. Need at least 2 snapshots.`)
31
+ .withData({
32
+ period,
33
+ summary: { regressions: 0, improvements: 0, stable: 0, criticalRegressions: 0 },
34
+ trends: [],
35
+ healthTrend: { current: 0, previous: 0, direction: 'stable' },
36
+ })
37
+ .withHints({
38
+ nextActions: [
39
+ "Run 'drift scan' periodically to build history",
40
+ 'Try a longer period like 30d or 90d',
41
+ ],
42
+ })
43
+ .buildContent();
44
+ }
45
+ const oldSnapshot = snapshots[0];
46
+ const newSnapshot = snapshots[snapshots.length - 1];
47
+ // Calculate trends using the store's method
48
+ const calculatedTrends = store.calculateTrends(newSnapshot, oldSnapshot);
49
+ // Map to our TrendItem format
50
+ let trends = calculatedTrends.map((t) => {
51
+ const item = {
52
+ patternId: t.patternId,
53
+ patternName: t.patternName,
54
+ category: t.category,
55
+ type: t.type,
56
+ metric: t.metric,
57
+ change: {
58
+ from: t.previousValue,
59
+ to: t.currentValue,
60
+ delta: t.change,
61
+ deltaPercent: Math.round(t.changePercent),
62
+ },
63
+ details: t.details,
64
+ };
65
+ if (t.severity === 'critical') {
66
+ item.severity = 'critical';
67
+ }
68
+ else if (t.severity === 'warning') {
69
+ item.severity = 'warning';
70
+ }
71
+ return item;
72
+ });
73
+ // Filter by category
74
+ if (args.category) {
75
+ trends = trends.filter(t => t.category === args.category);
76
+ }
77
+ // Filter by severity
78
+ if (args.severity && args.severity !== 'all') {
79
+ if (args.severity === 'critical') {
80
+ trends = trends.filter(t => t.severity === 'critical');
81
+ }
82
+ else if (args.severity === 'warning') {
83
+ trends = trends.filter(t => t.severity === 'critical' || t.severity === 'warning');
84
+ }
85
+ }
86
+ // Sort: regressions first, then by severity
87
+ trends.sort((a, b) => {
88
+ if (a.type === 'regression' && b.type !== 'regression')
89
+ return -1;
90
+ if (b.type === 'regression' && a.type !== 'regression')
91
+ return 1;
92
+ if (a.severity === 'critical' && b.severity !== 'critical')
93
+ return -1;
94
+ if (b.severity === 'critical' && a.severity !== 'critical')
95
+ return 1;
96
+ return Math.abs(b.change.deltaPercent) - Math.abs(a.change.deltaPercent);
97
+ });
98
+ // Calculate summary before limiting
99
+ const summary = {
100
+ regressions: trends.filter(t => t.type === 'regression').length,
101
+ improvements: trends.filter(t => t.type === 'improvement').length,
102
+ stable: newSnapshot.patterns.length - trends.length,
103
+ criticalRegressions: trends.filter(t => t.severity === 'critical').length,
104
+ };
105
+ // Apply limit
106
+ trends = trends.slice(0, limit);
107
+ // Calculate health trend from summaries
108
+ const currentHealth = Math.round((newSnapshot.summary?.avgConfidence ?? 0) * 100);
109
+ const previousHealth = Math.round((oldSnapshot.summary?.avgConfidence ?? 0) * 100);
110
+ const healthTrend = {
111
+ current: currentHealth,
112
+ previous: previousHealth,
113
+ direction: currentHealth > previousHealth + 5
114
+ ? 'up'
115
+ : currentHealth < previousHealth - 5
116
+ ? 'down'
117
+ : 'stable',
118
+ };
119
+ // Build summary text
120
+ let summaryText = `${period} trends: `;
121
+ if (summary.criticalRegressions > 0) {
122
+ summaryText += `⚠️ ${summary.criticalRegressions} critical regressions. `;
123
+ }
124
+ summaryText += `${summary.regressions} regressions, ${summary.improvements} improvements. `;
125
+ summaryText += `Health: ${currentHealth}/100 (${healthTrend.direction}).`;
126
+ const hints = {
127
+ nextActions: summary.regressions > 0
128
+ ? [
129
+ 'Use drift_pattern_get to investigate regression details',
130
+ 'Use drift_code_examples to see correct implementations',
131
+ ]
132
+ : [
133
+ 'Continue monitoring with periodic scans',
134
+ 'Use drift_patterns_list to explore stable patterns',
135
+ ],
136
+ relatedTools: ['drift_pattern_get', 'drift_code_examples', 'drift_patterns_list'],
137
+ };
138
+ if (summary.criticalRegressions > 0) {
139
+ hints.warnings = [`${summary.criticalRegressions} patterns have critical regressions`];
140
+ }
141
+ return builder
142
+ .withSummary(summaryText)
143
+ .withData({ period, summary, trends, healthTrend })
144
+ .withHints(hints)
145
+ .buildContent();
146
+ }
147
+ //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
+ * - Discovery: Lightweight status and capability tools
6
+ * - Exploration: Paginated listing tools
7
+ * - Detail: Focused single-item tools
8
+ */
9
+ export * from './discovery/index.js';
10
+ export * from './exploration/index.js';
11
+ export * from './detail/index.js';
12
+ export * from './registry.js';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Enterprise MCP Tools
3
+ *
4
+ * Tools organized into three layers:
5
+ * - Discovery: Lightweight status and capability tools
6
+ * - Exploration: Paginated listing tools
7
+ * - Detail: Focused single-item tools
8
+ */
9
+ export * from './discovery/index.js';
10
+ export * from './exploration/index.js';
11
+ export * from './detail/index.js';
12
+ export * from './registry.js';
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * drift_context - Intent-Aware Context Orchestration
3
+ *
4
+ * The "final boss" tool. Instead of making the AI figure out which tools to call
5
+ * and how to synthesize the results, this tool understands the AI's intent and
6
+ * returns a curated context package with everything needed for the task.
7
+ *
8
+ * This is the recommended starting point for any code generation task.
9
+ */
10
+ import { PatternStore, ManifestStore, BoundaryStore, CallGraphStore, DNAStore } from 'driftdetect-core';
11
+ export type TaskIntent = 'add_feature' | 'fix_bug' | 'refactor' | 'security_audit' | 'understand_code' | 'add_test';
12
+ export interface RelevantPattern {
13
+ id: string;
14
+ name: string;
15
+ category: string;
16
+ why: string;
17
+ example: string;
18
+ confidence: number;
19
+ locationCount: number;
20
+ }
21
+ export interface SuggestedFile {
22
+ file: string;
23
+ reason: string;
24
+ patterns: string[];
25
+ risk: 'low' | 'medium' | 'high';
26
+ }
27
+ export interface Guidance {
28
+ keyInsights: string[];
29
+ commonMistakes: string[];
30
+ decisionPoints: string[];
31
+ }
32
+ export interface Warning {
33
+ type: 'security' | 'breaking_change' | 'deprecated' | 'complexity' | 'data_access';
34
+ message: string;
35
+ severity: 'info' | 'warning' | 'critical';
36
+ }
37
+ export interface Confidence {
38
+ patternCoverage: number;
39
+ dataFreshness: string;
40
+ limitations: string[];
41
+ }
42
+ export interface DeeperDive {
43
+ tool: string;
44
+ args: Record<string, unknown>;
45
+ reason: string;
46
+ }
47
+ export interface ContextPackage {
48
+ summary: string;
49
+ relevantPatterns: RelevantPattern[];
50
+ suggestedFiles: SuggestedFile[];
51
+ guidance: Guidance;
52
+ warnings: Warning[];
53
+ confidence: Confidence;
54
+ deeperDive: DeeperDive[];
55
+ }
56
+ export declare function handleContext(stores: {
57
+ pattern: PatternStore;
58
+ manifest: ManifestStore;
59
+ boundary: BoundaryStore;
60
+ callGraph: CallGraphStore;
61
+ dna: DNAStore;
62
+ }, projectRoot: string, args: {
63
+ intent: TaskIntent;
64
+ focus: string;
65
+ question?: string;
66
+ }): Promise<{
67
+ content: Array<{
68
+ type: string;
69
+ text: string;
70
+ }>;
71
+ }>;
72
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/tools/orchestration/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,YAAY,EACZ,aAAa,EACb,aAAa,EACb,cAAc,EACd,QAAQ,EAGT,MAAM,kBAAkB,CAAC;AAS1B,MAAM,MAAM,UAAU,GAClB,aAAa,GACb,SAAS,GACT,UAAU,GACV,gBAAgB,GAChB,i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