atproto-mcp 0.1.0
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/LICENSE +22 -0
- package/README.md +293 -0
- package/dist/cli.d.ts +10 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +261 -0
- package/dist/cli.js.map +1 -0
- package/dist/health-check.d.ts +7 -0
- package/dist/health-check.d.ts.map +1 -0
- package/dist/health-check.js +57 -0
- package/dist/health-check.js.map +1 -0
- package/dist/index.d.ts +122 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +612 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/index.d.ts +77 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +186 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/resources/index.d.ts +75 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +218 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/test/setup.d.ts +78 -0
- package/dist/test/setup.d.ts.map +1 -0
- package/dist/test/setup.js +138 -0
- package/dist/test/setup.js.map +1 -0
- package/dist/tools/implementations/advanced-social-tools.d.ts +250 -0
- package/dist/tools/implementations/advanced-social-tools.d.ts.map +1 -0
- package/dist/tools/implementations/advanced-social-tools.js +380 -0
- package/dist/tools/implementations/advanced-social-tools.js.map +1 -0
- package/dist/tools/implementations/base-tool.d.ts +73 -0
- package/dist/tools/implementations/base-tool.d.ts.map +1 -0
- package/dist/tools/implementations/base-tool.js +225 -0
- package/dist/tools/implementations/base-tool.js.map +1 -0
- package/dist/tools/implementations/content-management-tools.d.ts +81 -0
- package/dist/tools/implementations/content-management-tools.d.ts.map +1 -0
- package/dist/tools/implementations/content-management-tools.js +236 -0
- package/dist/tools/implementations/content-management-tools.js.map +1 -0
- package/dist/tools/implementations/create-post-tool.d.ts +131 -0
- package/dist/tools/implementations/create-post-tool.d.ts.map +1 -0
- package/dist/tools/implementations/create-post-tool.js +182 -0
- package/dist/tools/implementations/create-post-tool.js.map +1 -0
- package/dist/tools/implementations/follow-user-tool.d.ts +69 -0
- package/dist/tools/implementations/follow-user-tool.d.ts.map +1 -0
- package/dist/tools/implementations/follow-user-tool.js +200 -0
- package/dist/tools/implementations/follow-user-tool.js.map +1 -0
- package/dist/tools/implementations/get-user-profile-tool.d.ts +61 -0
- package/dist/tools/implementations/get-user-profile-tool.d.ts.map +1 -0
- package/dist/tools/implementations/get-user-profile-tool.js +139 -0
- package/dist/tools/implementations/get-user-profile-tool.js.map +1 -0
- package/dist/tools/implementations/index.d.ts +22 -0
- package/dist/tools/implementations/index.d.ts.map +1 -0
- package/dist/tools/implementations/index.js +32 -0
- package/dist/tools/implementations/index.js.map +1 -0
- package/dist/tools/implementations/like-post-tool.d.ts +68 -0
- package/dist/tools/implementations/like-post-tool.d.ts.map +1 -0
- package/dist/tools/implementations/like-post-tool.js +184 -0
- package/dist/tools/implementations/like-post-tool.js.map +1 -0
- package/dist/tools/implementations/media-tools.d.ts +360 -0
- package/dist/tools/implementations/media-tools.d.ts.map +1 -0
- package/dist/tools/implementations/media-tools.js +444 -0
- package/dist/tools/implementations/media-tools.js.map +1 -0
- package/dist/tools/implementations/moderation-tools.d.ts +189 -0
- package/dist/tools/implementations/moderation-tools.d.ts.map +1 -0
- package/dist/tools/implementations/moderation-tools.js +289 -0
- package/dist/tools/implementations/moderation-tools.js.map +1 -0
- package/dist/tools/implementations/oauth-tools.d.ts +108 -0
- package/dist/tools/implementations/oauth-tools.d.ts.map +1 -0
- package/dist/tools/implementations/oauth-tools.js +183 -0
- package/dist/tools/implementations/oauth-tools.js.map +1 -0
- package/dist/tools/implementations/reply-to-post-tool.d.ts +52 -0
- package/dist/tools/implementations/reply-to-post-tool.d.ts.map +1 -0
- package/dist/tools/implementations/reply-to-post-tool.js +167 -0
- package/dist/tools/implementations/reply-to-post-tool.js.map +1 -0
- package/dist/tools/implementations/repost-tool.d.ts +76 -0
- package/dist/tools/implementations/repost-tool.d.ts.map +1 -0
- package/dist/tools/implementations/repost-tool.js +181 -0
- package/dist/tools/implementations/repost-tool.js.map +1 -0
- package/dist/tools/implementations/search-posts-tool.d.ts +95 -0
- package/dist/tools/implementations/search-posts-tool.d.ts.map +1 -0
- package/dist/tools/implementations/search-posts-tool.js +208 -0
- package/dist/tools/implementations/search-posts-tool.js.map +1 -0
- package/dist/tools/implementations/social-graph-tools.d.ts +119 -0
- package/dist/tools/implementations/social-graph-tools.d.ts.map +1 -0
- package/dist/tools/implementations/social-graph-tools.js +262 -0
- package/dist/tools/implementations/social-graph-tools.js.map +1 -0
- package/dist/tools/implementations/streaming-tools.d.ts +130 -0
- package/dist/tools/implementations/streaming-tools.d.ts.map +1 -0
- package/dist/tools/implementations/streaming-tools.js +241 -0
- package/dist/tools/implementations/streaming-tools.js.map +1 -0
- package/dist/tools/implementations/timeline-tools.d.ts +69 -0
- package/dist/tools/implementations/timeline-tools.d.ts.map +1 -0
- package/dist/tools/implementations/timeline-tools.js +194 -0
- package/dist/tools/implementations/timeline-tools.js.map +1 -0
- package/dist/tools/index.d.ts +23 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +73 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/types/index.d.ts +242 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +73 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/atp-client.d.ts +109 -0
- package/dist/utils/atp-client.d.ts.map +1 -0
- package/dist/utils/atp-client.js +451 -0
- package/dist/utils/atp-client.js.map +1 -0
- package/dist/utils/config.d.ts +74 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +311 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/firehose-client.d.ts +96 -0
- package/dist/utils/firehose-client.d.ts.map +1 -0
- package/dist/utils/firehose-client.js +252 -0
- package/dist/utils/firehose-client.js.map +1 -0
- package/dist/utils/logger.d.ts +74 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +142 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/oauth-client.d.ts +61 -0
- package/dist/utils/oauth-client.d.ts.map +1 -0
- package/dist/utils/oauth-client.js +224 -0
- package/dist/utils/oauth-client.js.map +1 -0
- package/dist/utils/performance.d.ts +102 -0
- package/dist/utils/performance.d.ts.map +1 -0
- package/dist/utils/performance.js +302 -0
- package/dist/utils/performance.js.map +1 -0
- package/dist/utils/security.d.ts +154 -0
- package/dist/utils/security.d.ts.map +1 -0
- package/dist/utils/security.js +358 -0
- package/dist/utils/security.js.map +1 -0
- package/package.json +93 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Prompts for AT Protocol content creation assistance
|
|
3
|
+
*/
|
|
4
|
+
import type { AtpClient } from '../utils/atp-client.js';
|
|
5
|
+
import { Logger } from '../utils/logger.js';
|
|
6
|
+
export interface IMcpPrompt {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
arguments?: Array<{
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
required?: boolean;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
export interface IPromptContent {
|
|
16
|
+
role: 'user' | 'assistant';
|
|
17
|
+
content: {
|
|
18
|
+
type: 'text';
|
|
19
|
+
text: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Base class for MCP prompts
|
|
24
|
+
*/
|
|
25
|
+
export declare abstract class BasePrompt implements IMcpPrompt {
|
|
26
|
+
protected atpClient: AtpClient;
|
|
27
|
+
abstract readonly name: string;
|
|
28
|
+
abstract readonly description: string;
|
|
29
|
+
abstract readonly arguments?: Array<{
|
|
30
|
+
name: string;
|
|
31
|
+
description: string;
|
|
32
|
+
required?: boolean;
|
|
33
|
+
}>;
|
|
34
|
+
protected logger: Logger;
|
|
35
|
+
constructor(atpClient: AtpClient, loggerName: string);
|
|
36
|
+
/**
|
|
37
|
+
* Check if the prompt is available
|
|
38
|
+
*/
|
|
39
|
+
isAvailable(): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Generate the prompt content
|
|
42
|
+
*/
|
|
43
|
+
abstract get(args?: Record<string, unknown>): Promise<IPromptContent[]>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Content composition prompt for creating engaging posts
|
|
47
|
+
*/
|
|
48
|
+
export declare class ContentCompositionPrompt extends BasePrompt {
|
|
49
|
+
readonly name = "content_composition";
|
|
50
|
+
readonly description = "Generate engaging social media post content with proper formatting and hashtags";
|
|
51
|
+
readonly arguments: {
|
|
52
|
+
name: string;
|
|
53
|
+
description: string;
|
|
54
|
+
required: boolean;
|
|
55
|
+
}[];
|
|
56
|
+
constructor(atpClient: AtpClient);
|
|
57
|
+
get(args?: Record<string, unknown>): Promise<IPromptContent[]>;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Reply template prompt for generating thoughtful responses
|
|
61
|
+
*/
|
|
62
|
+
export declare class ReplyTemplatePrompt extends BasePrompt {
|
|
63
|
+
readonly name = "reply_template";
|
|
64
|
+
readonly description = "Generate thoughtful reply templates for different types of posts";
|
|
65
|
+
readonly arguments: {
|
|
66
|
+
name: string;
|
|
67
|
+
description: string;
|
|
68
|
+
required: boolean;
|
|
69
|
+
}[];
|
|
70
|
+
constructor(atpClient: AtpClient);
|
|
71
|
+
get(args?: Record<string, unknown>): Promise<IPromptContent[]>;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Create all MCP prompts for AT Protocol content assistance
|
|
75
|
+
*/
|
|
76
|
+
export declare function createPrompts(atpClient: AtpClient): BasePrompt[];
|
|
77
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MA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C,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;CA8CrE;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,UAAU;IACjD,SAAgB,IAAI,oBAAoB;IACxC,SAAgB,WAAW,sEAAsE;IACjG,SAAgB,SAAS;;;;QAgBvB;gBAEU,SAAS,EAAE,SAAS;IAI1B,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;CA6CrE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,SAAS,GAAG,UAAU,EAAE,CAYhE"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Prompts for AT Protocol content creation assistance
|
|
3
|
+
*/
|
|
4
|
+
import { Logger } from '../utils/logger.js';
|
|
5
|
+
/**
|
|
6
|
+
* Base class for MCP prompts
|
|
7
|
+
*/
|
|
8
|
+
export class BasePrompt {
|
|
9
|
+
atpClient;
|
|
10
|
+
logger;
|
|
11
|
+
constructor(atpClient, loggerName) {
|
|
12
|
+
this.atpClient = atpClient;
|
|
13
|
+
this.logger = new Logger(loggerName);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Check if the prompt is available
|
|
17
|
+
*/
|
|
18
|
+
isAvailable() {
|
|
19
|
+
try {
|
|
20
|
+
return this.atpClient.isAuthenticated();
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Content composition prompt for creating engaging posts
|
|
29
|
+
*/
|
|
30
|
+
export class ContentCompositionPrompt extends BasePrompt {
|
|
31
|
+
name = 'content_composition';
|
|
32
|
+
description = 'Generate engaging social media post content with proper formatting and hashtags';
|
|
33
|
+
arguments = [
|
|
34
|
+
{
|
|
35
|
+
name: 'topic',
|
|
36
|
+
description: 'The main topic or subject for the post',
|
|
37
|
+
required: true,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'tone',
|
|
41
|
+
description: 'The desired tone (casual, professional, humorous, informative)',
|
|
42
|
+
required: false,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'length',
|
|
46
|
+
description: 'Desired length (short, medium, long)',
|
|
47
|
+
required: false,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'include_hashtags',
|
|
51
|
+
description: 'Whether to include relevant hashtags',
|
|
52
|
+
required: false,
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
constructor(atpClient) {
|
|
56
|
+
super(atpClient, 'ContentCompositionPrompt');
|
|
57
|
+
}
|
|
58
|
+
async get(args) {
|
|
59
|
+
const topic = args?.['topic'] ?? 'general topic';
|
|
60
|
+
const tone = args?.['tone'] ?? 'casual';
|
|
61
|
+
const length = args?.['length'] ?? 'medium';
|
|
62
|
+
const includeHashtags = args?.['include_hashtags'] !== false;
|
|
63
|
+
const lengthGuidance = {
|
|
64
|
+
short: 'Keep it under 100 characters, punchy and direct.',
|
|
65
|
+
medium: 'Aim for 150-250 characters, engaging but concise.',
|
|
66
|
+
long: 'Use up to 300 characters, provide more detail and context.',
|
|
67
|
+
};
|
|
68
|
+
const toneGuidance = {
|
|
69
|
+
casual: 'Use a friendly, conversational tone that feels natural and approachable.',
|
|
70
|
+
professional: 'Maintain a polished, business-appropriate tone while staying engaging.',
|
|
71
|
+
humorous: 'Add wit and humor where appropriate, but keep it tasteful.',
|
|
72
|
+
informative: 'Focus on providing valuable information in an accessible way.',
|
|
73
|
+
};
|
|
74
|
+
return [
|
|
75
|
+
{
|
|
76
|
+
role: 'user',
|
|
77
|
+
content: {
|
|
78
|
+
type: 'text',
|
|
79
|
+
text: `Create an engaging social media post about "${topic}" for AT Protocol/Bluesky.
|
|
80
|
+
|
|
81
|
+
Requirements:
|
|
82
|
+
- Topic: ${topic}
|
|
83
|
+
- Tone: ${tone} (${toneGuidance[tone] || toneGuidance.casual})
|
|
84
|
+
- Length: ${length} (${lengthGuidance[length] || lengthGuidance.medium})
|
|
85
|
+
- Include hashtags: ${includeHashtags ? 'Yes' : 'No'}
|
|
86
|
+
- Platform: AT Protocol/Bluesky (consider the community culture)
|
|
87
|
+
|
|
88
|
+
Guidelines:
|
|
89
|
+
1. Make it authentic and engaging
|
|
90
|
+
2. Use clear, accessible language
|
|
91
|
+
3. Consider adding a call-to-action or question to encourage engagement
|
|
92
|
+
4. If including hashtags, use 2-4 relevant ones
|
|
93
|
+
5. Ensure it fits within AT Protocol's 300-character limit
|
|
94
|
+
6. Consider the decentralized, open-source nature of the platform
|
|
95
|
+
|
|
96
|
+
Please provide the post text ready to publish.`,
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
];
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Reply template prompt for generating thoughtful responses
|
|
104
|
+
*/
|
|
105
|
+
export class ReplyTemplatePrompt extends BasePrompt {
|
|
106
|
+
name = 'reply_template';
|
|
107
|
+
description = 'Generate thoughtful reply templates for different types of posts';
|
|
108
|
+
arguments = [
|
|
109
|
+
{
|
|
110
|
+
name: 'original_post',
|
|
111
|
+
description: 'The original post content to reply to',
|
|
112
|
+
required: true,
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: 'reply_type',
|
|
116
|
+
description: 'Type of reply (supportive, questioning, informative, humorous)',
|
|
117
|
+
required: false,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: 'relationship',
|
|
121
|
+
description: 'Relationship to the original poster (friend, colleague, stranger)',
|
|
122
|
+
required: false,
|
|
123
|
+
},
|
|
124
|
+
];
|
|
125
|
+
constructor(atpClient) {
|
|
126
|
+
super(atpClient, 'ReplyTemplatePrompt');
|
|
127
|
+
}
|
|
128
|
+
async get(args) {
|
|
129
|
+
const originalPost = args?.['original_post'] ?? 'the original post';
|
|
130
|
+
const replyType = args?.['reply_type'] ?? 'supportive';
|
|
131
|
+
const relationship = args?.['relationship'] ?? 'stranger';
|
|
132
|
+
const replyTypeGuidance = {
|
|
133
|
+
supportive: 'Show encouragement, agreement, or positive reinforcement.',
|
|
134
|
+
questioning: 'Ask thoughtful questions to deepen the conversation.',
|
|
135
|
+
informative: 'Add helpful information or resources related to the topic.',
|
|
136
|
+
humorous: 'Add appropriate humor while being respectful.',
|
|
137
|
+
};
|
|
138
|
+
const relationshipGuidance = {
|
|
139
|
+
friend: 'Use a familiar, warm tone as you would with a close friend.',
|
|
140
|
+
colleague: 'Maintain professional courtesy while being personable.',
|
|
141
|
+
stranger: 'Be polite, respectful, and considerate in your approach.',
|
|
142
|
+
};
|
|
143
|
+
return [
|
|
144
|
+
{
|
|
145
|
+
role: 'user',
|
|
146
|
+
content: {
|
|
147
|
+
type: 'text',
|
|
148
|
+
text: `Generate a thoughtful reply to this AT Protocol/Bluesky post:
|
|
149
|
+
|
|
150
|
+
Original Post: "${originalPost}"
|
|
151
|
+
|
|
152
|
+
Reply Parameters:
|
|
153
|
+
- Type: ${replyType} (${replyTypeGuidance[replyType] || replyTypeGuidance.supportive})
|
|
154
|
+
- Relationship: ${relationship} (${relationshipGuidance[relationship] || relationshipGuidance.stranger})
|
|
155
|
+
|
|
156
|
+
Guidelines:
|
|
157
|
+
1. Keep it under 300 characters (AT Protocol limit)
|
|
158
|
+
2. Be authentic and add value to the conversation
|
|
159
|
+
3. Match the tone and energy of the original post
|
|
160
|
+
4. Avoid controversial topics unless directly relevant
|
|
161
|
+
5. Consider the decentralized, community-focused nature of AT Protocol
|
|
162
|
+
6. Be respectful and constructive
|
|
163
|
+
7. If appropriate, ask a follow-up question to continue the conversation
|
|
164
|
+
|
|
165
|
+
Please provide a ready-to-post reply that feels natural and engaging.`,
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
];
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Create all MCP prompts for AT Protocol content assistance
|
|
173
|
+
*/
|
|
174
|
+
export function createPrompts(atpClient) {
|
|
175
|
+
const logger = new Logger('PromptsFactory');
|
|
176
|
+
try {
|
|
177
|
+
const prompts = [new ContentCompositionPrompt(atpClient), new ReplyTemplatePrompt(atpClient)];
|
|
178
|
+
logger.info(`Created ${prompts.length} AT Protocol MCP prompts`);
|
|
179
|
+
return prompts;
|
|
180
|
+
}
|
|
181
|
+
catch (error) {
|
|
182
|
+
logger.error('Failed to create MCP prompts', error);
|
|
183
|
+
return [];
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAoB5C;;GAEG;AACH,MAAM,OAAgB,UAAU;IAYlB;IAHF,MAAM,CAAS;IAEzB,YACY,SAAoB,EAC9B,UAAkB;QADR,cAAS,GAAT,SAAS,CAAW;QAG9B,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,WAAW;QACT,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,CAAC;QAC1C,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CAMF;AAED;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,UAAU;IACtC,IAAI,GAAG,qBAAqB,CAAC;IAC7B,WAAW,GACzB,iFAAiF,CAAC;IACpE,SAAS,GAAG;QAC1B;YACE,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,wCAAwC;YACrD,QAAQ,EAAE,IAAI;SACf;QACD;YACE,IAAI,EAAE,MAAM;YACZ,WAA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AiB,CAAC,SAA2C,CAAC,IAAI,iBAAiB,CAAC,UAAU;kBACpG,YAAY,KAAK,oBAAoB,CAAC,YAAiD,CAAC,IAAI,oBAAoB,CAAC,QAAQ;;;;;;;;;;;sEAWrE;iBAC7D;aACF;SACF,CAAC;IACJ,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,SAAoB;IAChD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,gBAAgB,CAAC,CAAC;IAE5C,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,CAAC,IAAI,wBAAwB,CAAC,SAAS,CAAC,EAAE,IAAI,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC;QAE9F,MAAM,CAAC,IAAI,CAAC,WAAW,OAAO,CAAC,MAAM,0BAA0B,CAAC,CAAC;QACjE,OAAO,OAAO,CAAC;IACjB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAC;QACpD,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Resources for AT Protocol data exposure
|
|
3
|
+
*/
|
|
4
|
+
import type { AtpClient } from '../utils/atp-client.js';
|
|
5
|
+
import { Logger } from '../utils/logger.js';
|
|
6
|
+
export interface IMcpResource {
|
|
7
|
+
uri: string;
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
mimeType: string;
|
|
11
|
+
}
|
|
12
|
+
export interface IResourceContent {
|
|
13
|
+
uri: string;
|
|
14
|
+
mimeType: string;
|
|
15
|
+
text?: string;
|
|
16
|
+
blob?: Uint8Array;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Base class for MCP resources
|
|
20
|
+
*/
|
|
21
|
+
export declare abstract class BaseResource implements IMcpResource {
|
|
22
|
+
protected atpClient: AtpClient;
|
|
23
|
+
abstract readonly uri: string;
|
|
24
|
+
abstract readonly name: string;
|
|
25
|
+
abstract readonly description: string;
|
|
26
|
+
abstract readonly mimeType: string;
|
|
27
|
+
protected logger: Logger;
|
|
28
|
+
constructor(atpClient: AtpClient, loggerName: string);
|
|
29
|
+
/**
|
|
30
|
+
* Read the resource content
|
|
31
|
+
*/
|
|
32
|
+
abstract read(): Promise<IResourceContent>;
|
|
33
|
+
/**
|
|
34
|
+
* Check if the resource is available
|
|
35
|
+
*/
|
|
36
|
+
isAvailable(): Promise<boolean>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Timeline resource - exposes user's timeline as JSON
|
|
40
|
+
*/
|
|
41
|
+
export declare class TimelineResource extends BaseResource {
|
|
42
|
+
readonly uri = "atproto://timeline";
|
|
43
|
+
readonly name = "User Timeline";
|
|
44
|
+
readonly description = "Current user's timeline feed with recent posts";
|
|
45
|
+
readonly mimeType = "application/json";
|
|
46
|
+
constructor(atpClient: AtpClient);
|
|
47
|
+
read(): Promise<IResourceContent>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Profile resource - exposes user's profile information as JSON
|
|
51
|
+
*/
|
|
52
|
+
export declare class ProfileResource extends BaseResource {
|
|
53
|
+
readonly uri = "atproto://profile";
|
|
54
|
+
readonly name = "User Profile";
|
|
55
|
+
readonly description = "Current user's profile information and statistics";
|
|
56
|
+
readonly mimeType = "application/json";
|
|
57
|
+
constructor(atpClient: AtpClient);
|
|
58
|
+
read(): Promise<IResourceContent>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Notifications resource - exposes user's notifications as JSON
|
|
62
|
+
*/
|
|
63
|
+
export declare class NotificationsResource extends BaseResource {
|
|
64
|
+
readonly uri = "atproto://notifications";
|
|
65
|
+
readonly name = "User Notifications";
|
|
66
|
+
readonly description = "Current user's recent notifications and mentions";
|
|
67
|
+
readonly mimeType = "application/json";
|
|
68
|
+
constructor(atpClient: AtpClient);
|
|
69
|
+
read(): Promise<IResourceContent>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Create all MCP resources for AT Protocol data
|
|
73
|
+
*/
|
|
74
|
+
export declare function createResources(atpClient: AtpClient): BaseResource[];
|
|
75
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED;;GAEG;AACH,8BAAsB,YAAa,YAAW,YAAY;IAStD,SAAS,CAAC,SAAS,EAAE,SAAS;IARhC,kBAAyB,GAAG,EAAE,MAAM,CAAC;IACrC,kBAAyB,IAAI,EAAE,MAAM,CAAC;IACtC,kBAAyB,WAAW,EAAE,MAAM,CAAC;IAC7C,kBAAyB,QAAQ,EAAE,MAAM,CAAC;IAE1C,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;gBAGb,SAAS,EAAE,SAAS,EAC9B,UAAU,EAAE,MAAM;IAKpB;;OAEG;IACH,QAAQ,CAAC,IAAI,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAE1C;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;CAOtC;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,YAAY;IAChD,SAAgB,GAAG,wBAAwB;IAC3C,SAAgB,IAAI,mBAAmB;IACvC,SAAgB,WAAW,oDAAoD;IAC/E,SAAgB,QAAQ,sBAAsB;gBAElC,SAAS,EAAE,SAAS;IAI1B,IAAI,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAgDxC;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,SAAgB,GAAG,uBAAuB;IAC1C,SAAgB,IAAI,kBAAkB;IACtC,SAAgB,WAAW,uDAAuD;IAClF,SAAgB,QAAQ,sBAAsB;gBAElC,SAAS,EAAE,SAAS;IAI1B,IAAI,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAqDxC;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,YAAY;IACrD,SAAgB,GAAG,6BAA6B;IAChD,SAAgB,IAAI,wBAAwB;IAC5C,SAAgB,WAAW,sDAAsD;IACjF,SAAgB,QAAQ,sBAAsB;gBAElC,SAAS,EAAE,SAAS;IAI1B,IAAI,IAAI,OAAO,CAAC,gBAAgB,CAAC;CA8CxC;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,SAAS,GAAG,YAAY,EAAE,CAgBpE"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Resources for AT Protocol data exposure
|
|
3
|
+
*/
|
|
4
|
+
import { Logger } from '../utils/logger.js';
|
|
5
|
+
/**
|
|
6
|
+
* Base class for MCP resources
|
|
7
|
+
*/
|
|
8
|
+
export class BaseResource {
|
|
9
|
+
atpClient;
|
|
10
|
+
logger;
|
|
11
|
+
constructor(atpClient, loggerName) {
|
|
12
|
+
this.atpClient = atpClient;
|
|
13
|
+
this.logger = new Logger(loggerName);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Check if the resource is available
|
|
17
|
+
*/
|
|
18
|
+
async isAvailable() {
|
|
19
|
+
try {
|
|
20
|
+
return this.atpClient.isAuthenticated();
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Timeline resource - exposes user's timeline as JSON
|
|
29
|
+
*/
|
|
30
|
+
export class TimelineResource extends BaseResource {
|
|
31
|
+
uri = 'atproto://timeline';
|
|
32
|
+
name = 'User Timeline';
|
|
33
|
+
description = "Current user's timeline feed with recent posts";
|
|
34
|
+
mimeType = 'application/json';
|
|
35
|
+
constructor(atpClient) {
|
|
36
|
+
super(atpClient, 'TimelineResource');
|
|
37
|
+
}
|
|
38
|
+
async read() {
|
|
39
|
+
try {
|
|
40
|
+
this.logger.info('Reading timeline resource');
|
|
41
|
+
if (!this.atpClient.isAuthenticated()) {
|
|
42
|
+
throw new Error('Authentication required to access timeline');
|
|
43
|
+
}
|
|
44
|
+
const agent = this.atpClient.getAgent();
|
|
45
|
+
const response = await agent.getTimeline({
|
|
46
|
+
limit: 50,
|
|
47
|
+
});
|
|
48
|
+
const timelineData = {
|
|
49
|
+
uri: this.uri,
|
|
50
|
+
timestamp: new Date().toISOString(),
|
|
51
|
+
posts: response.data.feed.map((item) => ({
|
|
52
|
+
uri: item.post.uri,
|
|
53
|
+
cid: item.post.cid,
|
|
54
|
+
author: {
|
|
55
|
+
did: item.post.author.did,
|
|
56
|
+
handle: item.post.author.handle,
|
|
57
|
+
displayName: item.post.author.displayName,
|
|
58
|
+
avatar: item.post.author.avatar,
|
|
59
|
+
},
|
|
60
|
+
text: item.post.record.text,
|
|
61
|
+
createdAt: item.post.record.createdAt,
|
|
62
|
+
replyCount: item.post.replyCount || 0,
|
|
63
|
+
repostCount: item.post.repostCount || 0,
|
|
64
|
+
likeCount: item.post.likeCount || 0,
|
|
65
|
+
isLiked: !!item.post.viewer?.like,
|
|
66
|
+
isReposted: !!item.post.viewer?.repost,
|
|
67
|
+
embed: item.post.embed,
|
|
68
|
+
reply: item.post.record.reply,
|
|
69
|
+
})),
|
|
70
|
+
cursor: response.data.cursor,
|
|
71
|
+
};
|
|
72
|
+
return {
|
|
73
|
+
uri: this.uri,
|
|
74
|
+
mimeType: this.mimeType,
|
|
75
|
+
text: JSON.stringify(timelineData, null, 2),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
this.logger.error('Failed to read timeline resource', error);
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Profile resource - exposes user's profile information as JSON
|
|
86
|
+
*/
|
|
87
|
+
export class ProfileResource extends BaseResource {
|
|
88
|
+
uri = 'atproto://profile';
|
|
89
|
+
name = 'User Profile';
|
|
90
|
+
description = "Current user's profile information and statistics";
|
|
91
|
+
mimeType = 'application/json';
|
|
92
|
+
constructor(atpClient) {
|
|
93
|
+
super(atpClient, 'ProfileResource');
|
|
94
|
+
}
|
|
95
|
+
async read() {
|
|
96
|
+
try {
|
|
97
|
+
this.logger.info('Reading profile resource');
|
|
98
|
+
if (!this.atpClient.isAuthenticated()) {
|
|
99
|
+
throw new Error('Authentication required to access profile');
|
|
100
|
+
}
|
|
101
|
+
const agent = this.atpClient.getAgent();
|
|
102
|
+
const session = agent.session;
|
|
103
|
+
if (!session?.did) {
|
|
104
|
+
throw new Error('No active session found');
|
|
105
|
+
}
|
|
106
|
+
const response = await agent.getProfile({
|
|
107
|
+
actor: session.did,
|
|
108
|
+
});
|
|
109
|
+
const profileData = {
|
|
110
|
+
uri: this.uri,
|
|
111
|
+
timestamp: new Date().toISOString(),
|
|
112
|
+
profile: {
|
|
113
|
+
did: response.data.did,
|
|
114
|
+
handle: response.data.handle,
|
|
115
|
+
displayName: response.data.displayName,
|
|
116
|
+
description: response.data.description,
|
|
117
|
+
avatar: response.data.avatar,
|
|
118
|
+
banner: response.data.banner,
|
|
119
|
+
followersCount: response.data.followersCount || 0,
|
|
120
|
+
followsCount: response.data.followsCount || 0,
|
|
121
|
+
postsCount: response.data.postsCount || 0,
|
|
122
|
+
indexedAt: response.data.indexedAt,
|
|
123
|
+
createdAt: response.data.createdAt,
|
|
124
|
+
labels: response.data.labels || [],
|
|
125
|
+
},
|
|
126
|
+
session: {
|
|
127
|
+
did: session.did,
|
|
128
|
+
handle: session.handle,
|
|
129
|
+
active: session.active,
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
return {
|
|
133
|
+
uri: this.uri,
|
|
134
|
+
mimeType: this.mimeType,
|
|
135
|
+
text: JSON.stringify(profileData, null, 2),
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
this.logger.error('Failed to read profile resource', error);
|
|
140
|
+
throw error;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Notifications resource - exposes user's notifications as JSON
|
|
146
|
+
*/
|
|
147
|
+
export class NotificationsResource extends BaseResource {
|
|
148
|
+
uri = 'atproto://notifications';
|
|
149
|
+
name = 'User Notifications';
|
|
150
|
+
description = "Current user's recent notifications and mentions";
|
|
151
|
+
mimeType = 'application/json';
|
|
152
|
+
constructor(atpClient) {
|
|
153
|
+
super(atpClient, 'NotificationsResource');
|
|
154
|
+
}
|
|
155
|
+
async read() {
|
|
156
|
+
try {
|
|
157
|
+
this.logger.info('Reading notifications resource');
|
|
158
|
+
if (!this.atpClient.isAuthenticated()) {
|
|
159
|
+
throw new Error('Authentication required to access notifications');
|
|
160
|
+
}
|
|
161
|
+
const agent = this.atpClient.getAgent();
|
|
162
|
+
const response = await agent.listNotifications({
|
|
163
|
+
limit: 50,
|
|
164
|
+
});
|
|
165
|
+
const notificationsData = {
|
|
166
|
+
uri: this.uri,
|
|
167
|
+
timestamp: new Date().toISOString(),
|
|
168
|
+
notifications: response.data.notifications.map((notification) => ({
|
|
169
|
+
uri: notification.uri,
|
|
170
|
+
cid: notification.cid,
|
|
171
|
+
author: {
|
|
172
|
+
did: notification.author.did,
|
|
173
|
+
handle: notification.author.handle,
|
|
174
|
+
displayName: notification.author.displayName,
|
|
175
|
+
avatar: notification.author.avatar,
|
|
176
|
+
},
|
|
177
|
+
reason: notification.reason,
|
|
178
|
+
reasonSubject: notification.reasonSubject,
|
|
179
|
+
record: notification.record,
|
|
180
|
+
isRead: notification.isRead,
|
|
181
|
+
indexedAt: notification.indexedAt,
|
|
182
|
+
labels: notification.labels || [],
|
|
183
|
+
})),
|
|
184
|
+
cursor: response.data.cursor,
|
|
185
|
+
seenAt: response.data.seenAt,
|
|
186
|
+
};
|
|
187
|
+
return {
|
|
188
|
+
uri: this.uri,
|
|
189
|
+
mimeType: this.mimeType,
|
|
190
|
+
text: JSON.stringify(notificationsData, null, 2),
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
this.logger.error('Failed to read notifications resource', error);
|
|
195
|
+
throw error;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Create all MCP resources for AT Protocol data
|
|
201
|
+
*/
|
|
202
|
+
export function createResources(atpClient) {
|
|
203
|
+
const logger = new Logger('ResourcesFactory');
|
|
204
|
+
try {
|
|
205
|
+
const resources = [
|
|
206
|
+
new TimelineResource(atpClient),
|
|
207
|
+
new ProfileResource(atpClient),
|
|
208
|
+
new NotificationsResource(atpClient),
|
|
209
|
+
];
|
|
210
|
+
logger.info(`Created ${resources.length} AT Protocol MCP resources`);
|
|
211
|
+
return resources;
|
|
212
|
+
}
|
|
213
|
+
catch (error) {
|
|
214
|
+
logger.error('Failed to create MCP resources', error);
|
|
215
|
+
return [];
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAgB5C;;GAEG;AAC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
|
9
|
+
*/
|
|
10
|
+
export declare function createMockSession(): {
|
|
11
|
+
did: 'did:plc:test123';
|
|
12
|
+
handle: string;
|
|
13
|
+
accessJwt: string;
|
|
14
|
+
refreshJwt: string;
|
|
15
|
+
active: boolean;
|
|
16
|
+
status: string;
|
|
17
|
+
email?: string;
|
|
18
|
+
emailConfirmed?: boolean;
|
|
19
|
+
emailAuthFactor?: boolean;
|
|
20
|
+
didDoc?: unknown;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Create a mock AT Protocol configuration
|
|
24
|
+
*/
|
|
25
|
+
export declare function createMockAtpConfig(): {
|
|
26
|
+
service: string;
|
|
27
|
+
identifier: string;
|
|
28
|
+
password: string;
|
|
29
|
+
authMethod: 'app-password';
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Create a mock MCP server configuration
|
|
33
|
+
*/
|
|
34
|
+
export declare function createMockServerConfig(): {
|
|
35
|
+
port: number;
|
|
36
|
+
host: string;
|
|
37
|
+
name: string;
|
|
38
|
+
version: string;
|
|
39
|
+
description: string;
|
|
40
|
+
atproto: {
|
|
41
|
+
service: string;
|
|
42
|
+
identifier: string;
|
|
43
|
+
password: string;
|
|
44
|
+
authMethod: 'app-password';
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Mock console methods to reduce test noise
|
|
49
|
+
*/
|
|
50
|
+
export declare function mockConsole(): Record<string, unknown>;
|
|
51
|
+
/**
|
|
52
|
+
* Create a promise that resolves after a specified delay
|
|
53
|
+
*/
|
|
54
|
+
export declare function delay(ms: number): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Create a promise that rejects after a specified delay
|
|
57
|
+
*/
|
|
58
|
+
export declare function rejectAfter(ms: number, error: Error): Promise<never>;
|
|
59
|
+
/**
|
|
60
|
+
* Assert that a function throws an error with specific properties
|
|
61
|
+
*/
|
|
62
|
+
export declare function expectToThrow<T extends Error>(fn: () => Promise<unknown> | unknown, errorClass: new (...args: any[]) => T, message?: string | RegExp): Promise<T>;
|
|
63
|
+
/**
|
|
64
|
+
* Mock AT Protocol API responses
|
|
65
|
+
*/
|
|
66
|
+
export declare class MockAtpAgent {
|
|
67
|
+
loginResponse: any;
|
|
68
|
+
refreshResponse: any;
|
|
69
|
+
login(): Promise<any>;
|
|
70
|
+
refreshSession(): Promise<any>;
|
|
71
|
+
setLoginResponse(response: any): void;
|
|
72
|
+
setRefreshResponse(response: any): void;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Create a mock AT Protocol agent
|
|
76
|
+
*/
|
|
77
|
+
export declare function createMockAtpAgent(): MockAtpAgent;
|
|
78
|
+
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/test/setup.ts"],"names":[],"mappings":"AAAA;;GAEG;AA2BH;;GAEG;AAEH;;GAEG;AACH,wBAAgB,iBAAiB,IAAI;IACnC,GAAG,EAAE,iBAAiB,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CASA;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,cAAc,CAAC;CAC5B,CAOA;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IA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