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.
Files changed (131) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +293 -0
  3. package/dist/cli.d.ts +10 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +261 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/health-check.d.ts +7 -0
  8. package/dist/health-check.d.ts.map +1 -0
  9. package/dist/health-check.js +57 -0
  10. package/dist/health-check.js.map +1 -0
  11. package/dist/index.d.ts +122 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +612 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/prompts/index.d.ts +77 -0
  16. package/dist/prompts/index.d.ts.map +1 -0
  17. package/dist/prompts/index.js +186 -0
  18. package/dist/prompts/index.js.map +1 -0
  19. package/dist/resources/index.d.ts +75 -0
  20. package/dist/resources/index.d.ts.map +1 -0
  21. package/dist/resources/index.js +218 -0
  22. package/dist/resources/index.js.map +1 -0
  23. package/dist/test/setup.d.ts +78 -0
  24. package/dist/test/setup.d.ts.map +1 -0
  25. package/dist/test/setup.js +138 -0
  26. package/dist/test/setup.js.map +1 -0
  27. package/dist/tools/implementations/advanced-social-tools.d.ts +250 -0
  28. package/dist/tools/implementations/advanced-social-tools.d.ts.map +1 -0
  29. package/dist/tools/implementations/advanced-social-tools.js +380 -0
  30. package/dist/tools/implementations/advanced-social-tools.js.map +1 -0
  31. package/dist/tools/implementations/base-tool.d.ts +73 -0
  32. package/dist/tools/implementations/base-tool.d.ts.map +1 -0
  33. package/dist/tools/implementations/base-tool.js +225 -0
  34. package/dist/tools/implementations/base-tool.js.map +1 -0
  35. package/dist/tools/implementations/content-management-tools.d.ts +81 -0
  36. package/dist/tools/implementations/content-management-tools.d.ts.map +1 -0
  37. package/dist/tools/implementations/content-management-tools.js +236 -0
  38. package/dist/tools/implementations/content-management-tools.js.map +1 -0
  39. package/dist/tools/implementations/create-post-tool.d.ts +131 -0
  40. package/dist/tools/implementations/create-post-tool.d.ts.map +1 -0
  41. package/dist/tools/implementations/create-post-tool.js +182 -0
  42. package/dist/tools/implementations/create-post-tool.js.map +1 -0
  43. package/dist/tools/implementations/follow-user-tool.d.ts +69 -0
  44. package/dist/tools/implementations/follow-user-tool.d.ts.map +1 -0
  45. package/dist/tools/implementations/follow-user-tool.js +200 -0
  46. package/dist/tools/implementations/follow-user-tool.js.map +1 -0
  47. package/dist/tools/implementations/get-user-profile-tool.d.ts +61 -0
  48. package/dist/tools/implementations/get-user-profile-tool.d.ts.map +1 -0
  49. package/dist/tools/implementations/get-user-profile-tool.js +139 -0
  50. package/dist/tools/implementations/get-user-profile-tool.js.map +1 -0
  51. package/dist/tools/implementations/index.d.ts +22 -0
  52. package/dist/tools/implementations/index.d.ts.map +1 -0
  53. package/dist/tools/implementations/index.js +32 -0
  54. package/dist/tools/implementations/index.js.map +1 -0
  55. package/dist/tools/implementations/like-post-tool.d.ts +68 -0
  56. package/dist/tools/implementations/like-post-tool.d.ts.map +1 -0
  57. package/dist/tools/implementations/like-post-tool.js +184 -0
  58. package/dist/tools/implementations/like-post-tool.js.map +1 -0
  59. package/dist/tools/implementations/media-tools.d.ts +360 -0
  60. package/dist/tools/implementations/media-tools.d.ts.map +1 -0
  61. package/dist/tools/implementations/media-tools.js +444 -0
  62. package/dist/tools/implementations/media-tools.js.map +1 -0
  63. package/dist/tools/implementations/moderation-tools.d.ts +189 -0
  64. package/dist/tools/implementations/moderation-tools.d.ts.map +1 -0
  65. package/dist/tools/implementations/moderation-tools.js +289 -0
  66. package/dist/tools/implementations/moderation-tools.js.map +1 -0
  67. package/dist/tools/implementations/oauth-tools.d.ts +108 -0
  68. package/dist/tools/implementations/oauth-tools.d.ts.map +1 -0
  69. package/dist/tools/implementations/oauth-tools.js +183 -0
  70. package/dist/tools/implementations/oauth-tools.js.map +1 -0
  71. package/dist/tools/implementations/reply-to-post-tool.d.ts +52 -0
  72. package/dist/tools/implementations/reply-to-post-tool.d.ts.map +1 -0
  73. package/dist/tools/implementations/reply-to-post-tool.js +167 -0
  74. package/dist/tools/implementations/reply-to-post-tool.js.map +1 -0
  75. package/dist/tools/implementations/repost-tool.d.ts +76 -0
  76. package/dist/tools/implementations/repost-tool.d.ts.map +1 -0
  77. package/dist/tools/implementations/repost-tool.js +181 -0
  78. package/dist/tools/implementations/repost-tool.js.map +1 -0
  79. package/dist/tools/implementations/search-posts-tool.d.ts +95 -0
  80. package/dist/tools/implementations/search-posts-tool.d.ts.map +1 -0
  81. package/dist/tools/implementations/search-posts-tool.js +208 -0
  82. package/dist/tools/implementations/search-posts-tool.js.map +1 -0
  83. package/dist/tools/implementations/social-graph-tools.d.ts +119 -0
  84. package/dist/tools/implementations/social-graph-tools.d.ts.map +1 -0
  85. package/dist/tools/implementations/social-graph-tools.js +262 -0
  86. package/dist/tools/implementations/social-graph-tools.js.map +1 -0
  87. package/dist/tools/implementations/streaming-tools.d.ts +130 -0
  88. package/dist/tools/implementations/streaming-tools.d.ts.map +1 -0
  89. package/dist/tools/implementations/streaming-tools.js +241 -0
  90. package/dist/tools/implementations/streaming-tools.js.map +1 -0
  91. package/dist/tools/implementations/timeline-tools.d.ts +69 -0
  92. package/dist/tools/implementations/timeline-tools.d.ts.map +1 -0
  93. package/dist/tools/implementations/timeline-tools.js +194 -0
  94. package/dist/tools/implementations/timeline-tools.js.map +1 -0
  95. package/dist/tools/index.d.ts +23 -0
  96. package/dist/tools/index.d.ts.map +1 -0
  97. package/dist/tools/index.js +73 -0
  98. package/dist/tools/index.js.map +1 -0
  99. package/dist/types/index.d.ts +242 -0
  100. package/dist/types/index.d.ts.map +1 -0
  101. package/dist/types/index.js +73 -0
  102. package/dist/types/index.js.map +1 -0
  103. package/dist/utils/atp-client.d.ts +109 -0
  104. package/dist/utils/atp-client.d.ts.map +1 -0
  105. package/dist/utils/atp-client.js +451 -0
  106. package/dist/utils/atp-client.js.map +1 -0
  107. package/dist/utils/config.d.ts +74 -0
  108. package/dist/utils/config.d.ts.map +1 -0
  109. package/dist/utils/config.js +311 -0
  110. package/dist/utils/config.js.map +1 -0
  111. package/dist/utils/firehose-client.d.ts +96 -0
  112. package/dist/utils/firehose-client.d.ts.map +1 -0
  113. package/dist/utils/firehose-client.js +252 -0
  114. package/dist/utils/firehose-client.js.map +1 -0
  115. package/dist/utils/logger.d.ts +74 -0
  116. package/dist/utils/logger.d.ts.map +1 -0
  117. package/dist/utils/logger.js +142 -0
  118. package/dist/utils/logger.js.map +1 -0
  119. package/dist/utils/oauth-client.d.ts +61 -0
  120. package/dist/utils/oauth-client.d.ts.map +1 -0
  121. package/dist/utils/oauth-client.js +224 -0
  122. package/dist/utils/oauth-client.js.map +1 -0
  123. package/dist/utils/performance.d.ts +102 -0
  124. package/dist/utils/performance.d.ts.map +1 -0
  125. package/dist/utils/performance.js +302 -0
  126. package/dist/utils/performance.js.map +1 -0
  127. package/dist/utils/security.d.ts +154 -0
  128. package/dist/utils/security.d.ts.map +1 -0
  129. package/dist/utils/security.js +358 -0
  130. package/dist/utils/security.js.map +1 -0
  131. package/package.json +93 -0
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Create Post Tool - Creates new posts on AT Protocol
3
+ */
4
+ import { z } from 'zod';
5
+ import { BaseTool } from './base-tool.js';
6
+ import type { AtpClient } from '../../utils/atp-client.js';
7
+ import type { ATURI, CID, ICreatePostParams } from '../../types/index.js';
8
+ /**
9
+ * Tool for creating new posts on AT Protocol
10
+ */
11
+ export declare class CreatePostTool extends BaseTool {
12
+ readonly schema: {
13
+ method: string;
14
+ description: string;
15
+ params: z.ZodObject<{
16
+ text: z.ZodString;
17
+ reply: z.ZodOptional<z.ZodObject<{
18
+ root: z.ZodString;
19
+ parent: z.ZodString;
20
+ }, "strip", z.ZodTypeAny, {
21
+ root: string;
22
+ parent: string;
23
+ }, {
24
+ root: string;
25
+ parent: string;
26
+ }>>;
27
+ embed: z.ZodOptional<z.ZodObject<{
28
+ images: z.ZodOptional<z.ZodArray<z.ZodObject<{
29
+ alt: z.ZodString;
30
+ image: z.ZodAny;
31
+ }, "strip", z.ZodTypeAny, {
32
+ alt: string;
33
+ image?: any;
34
+ }, {
35
+ alt: string;
36
+ image?: any;
37
+ }>, "many">>;
38
+ external: z.ZodOptional<z.ZodObject<{
39
+ uri: z.ZodString;
40
+ title: z.ZodString;
41
+ description: z.ZodString;
42
+ }, "strip", z.ZodTypeAny, {
43
+ description: string;
44
+ uri: string;
45
+ title: string;
46
+ }, {
47
+ description: string;
48
+ uri: string;
49
+ title: string;
50
+ }>>;
51
+ }, "strip", z.ZodTypeAny, {
52
+ images?: {
53
+ alt: string;
54
+ image?: any;
55
+ }[] | undefined;
56
+ external?: {
57
+ description: string;
58
+ uri: string;
59
+ title: string;
60
+ } | undefined;
61
+ }, {
62
+ images?: {
63
+ alt: string;
64
+ image?: any;
65
+ }[] | undefined;
66
+ external?: {
67
+ description: string;
68
+ uri: string;
69
+ title: string;
70
+ } | undefined;
71
+ }>>;
72
+ langs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
73
+ }, "strip", z.ZodTypeAny, {
74
+ text: string;
75
+ reply?: {
76
+ root: string;
77
+ parent: string;
78
+ } | undefined;
79
+ embed?: {
80
+ images?: {
81
+ alt: string;
82
+ image?: any;
83
+ }[] | undefined;
84
+ external?: {
85
+ description: string;
86
+ uri: string;
87
+ title: string;
88
+ } | undefined;
89
+ } | undefined;
90
+ langs?: string[] | undefined;
91
+ }, {
92
+ text: string;
93
+ reply?: {
94
+ root: string;
95
+ parent: string;
96
+ } | undefined;
97
+ embed?: {
98
+ images?: {
99
+ alt: string;
100
+ image?: any;
101
+ }[] | undefined;
102
+ external?: {
103
+ description: string;
104
+ uri: string;
105
+ title: string;
106
+ } | undefined;
107
+ } | undefined;
108
+ langs?: string[] | undefined;
109
+ }>;
110
+ };
111
+ constructor(atpClient: AtpClient);
112
+ protected execute(params: ICreatePostParams): Promise<{
113
+ uri: ATURI;
114
+ cid: CID;
115
+ success: boolean;
116
+ message: string;
117
+ }>;
118
+ /**
119
+ * Get CID from AT Protocol URI
120
+ */
121
+ private getCidFromUri;
122
+ /**
123
+ * Process embed data for the post
124
+ */
125
+ private processEmbed;
126
+ /**
127
+ * Upload a blob to AT Protocol
128
+ */
129
+ private uploadBlob;
130
+ }
131
+ //# sourceMappingURL=create-post-tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-post-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/implementations/create-post-tool.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAgB,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAuC1E;;GAEG;AACH,qBAAa,cAAe,SAAQ,QAAQ;IAC1C,SAAgB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAKpB;gBAEU,SAAS,EAAE,SAAS;cAIhB,OAAO,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC;QAC1D,GAAG,EAAE,KAAK,CAAC;QACX,GAAG,EAAE,GAAG,CAAC;QACT,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IAyEF;;OAEG;YACW,aAAa;IAgB3B;;OAEG;YACW,YAAY;IAyC1B;;OAEG;YACW,UAAU;CAazB"}
@@ -0,0 +1,182 @@
1
+ /**
2
+ * Create Post Tool - Creates new posts on AT Protocol
3
+ */
4
+ import { z } from 'zod';
5
+ import { BaseTool, ToolAuthMode } from './base-tool.js';
6
+ /**
7
+ * Zod schema for create post parameters
8
+ */
9
+ const CreatePostSchema = z.object({
10
+ text: z
11
+ .string()
12
+ .min(1, 'Post text cannot be empty')
13
+ .max(300, 'Post text cannot exceed 300 characters'),
14
+ reply: z
15
+ .object({
16
+ root: z.string().min(1, 'Root URI is required'),
17
+ parent: z.string().min(1, 'Parent URI is required'),
18
+ })
19
+ .optional(),
20
+ embed: z
21
+ .object({
22
+ images: z
23
+ .array(z.object({
24
+ alt: z.string().max(1000, 'Alt text cannot exceed 1000 characters'),
25
+ image: z.any(), // Blob type
26
+ }))
27
+ .max(4, 'Cannot attach more than 4 images')
28
+ .optional(),
29
+ external: z
30
+ .object({
31
+ uri: z.string().url('External URI must be a valid URL'),
32
+ title: z.string().max(300, 'Title cannot exceed 300 characters'),
33
+ description: z.string().max(1000, 'Description cannot exceed 1000 characters'),
34
+ })
35
+ .optional(),
36
+ })
37
+ .optional(),
38
+ langs: z.array(z.string().length(2, 'Language codes must be 2 characters')).optional(),
39
+ });
40
+ /**
41
+ * Tool for creating new posts on AT Protocol
42
+ */
43
+ export class CreatePostTool extends BaseTool {
44
+ schema = {
45
+ method: 'create_post',
46
+ description: 'Create a new post on AT Protocol. Supports text, replies, images, external links, and language tags.',
47
+ params: CreatePostSchema,
48
+ };
49
+ constructor(atpClient) {
50
+ super(atpClient, 'CreatePost', ToolAuthMode.PRIVATE);
51
+ }
52
+ async execute(params) {
53
+ try {
54
+ this.logger.info('Creating new post', {
55
+ textLength: params.text.length,
56
+ hasReply: !!params.reply,
57
+ hasEmbed: !!params.embed,
58
+ langs: params.langs,
59
+ });
60
+ // Validate reply parameters if provided
61
+ if (params.reply) {
62
+ this.validateAtUri(params.reply.root);
63
+ this.validateAtUri(params.reply.parent);
64
+ }
65
+ // Build the post record
66
+ const postRecord = {
67
+ $type: 'app.bsky.feed.post',
68
+ text: params.text,
69
+ createdAt: new Date().toISOString(),
70
+ };
71
+ // Add reply information if this is a reply
72
+ if (params.reply) {
73
+ postRecord.reply = {
74
+ root: {
75
+ uri: params.reply.root,
76
+ cid: await this.getCidFromUri(params.reply.root),
77
+ },
78
+ parent: {
79
+ uri: params.reply.parent,
80
+ cid: await this.getCidFromUri(params.reply.parent),
81
+ },
82
+ };
83
+ }
84
+ // Add language tags if provided
85
+ if (params.langs && params.langs.length > 0) {
86
+ postRecord.langs = params.langs;
87
+ }
88
+ // Handle embeds if provided
89
+ if (params.embed) {
90
+ postRecord.embed = await this.processEmbed(params.embed);
91
+ }
92
+ // Create the post using AT Protocol
93
+ const response = await this.executeAtpOperation(async () => {
94
+ const agent = this.atpClient.getAgent();
95
+ return await agent.post(postRecord);
96
+ }, 'createPost', { textLength: params.text.length });
97
+ this.logger.info('Post created successfully', {
98
+ uri: response.uri,
99
+ cid: response.cid,
100
+ });
101
+ return {
102
+ uri: response.uri,
103
+ cid: response.cid,
104
+ success: true,
105
+ message: 'Post created successfully',
106
+ };
107
+ }
108
+ catch (error) {
109
+ this.logger.error('Failed to create post', error);
110
+ this.formatError(error);
111
+ }
112
+ }
113
+ /**
114
+ * Get CID from AT Protocol URI
115
+ */
116
+ async getCidFromUri(uri) {
117
+ try {
118
+ // Extract the CID from the URI or fetch it from the network
119
+ // For now, we'll use a placeholder implementation
120
+ // In a real implementation, you would resolve the URI to get the CID
121
+ const parts = uri.split('/');
122
+ const rkey = parts[parts.length - 1];
123
+ // This is a simplified approach - in practice you'd need to resolve the record
124
+ return rkey || 'placeholder-cid';
125
+ }
126
+ catch (error) {
127
+ this.logger.warn('Could not resolve CID from URI, using placeholder', { uri });
128
+ return 'placeholder-cid';
129
+ }
130
+ }
131
+ /**
132
+ * Process embed data for the post
133
+ */
134
+ async processEmbed(embed) {
135
+ const processedEmbed = {};
136
+ // Handle image embeds
137
+ if (embed.images && embed.images.length > 0) {
138
+ this.logger.debug('Processing image embeds', { count: embed.images.length });
139
+ const images = [];
140
+ for (const img of embed.images) {
141
+ try {
142
+ // Upload the image blob
143
+ const uploadResult = await this.uploadBlob(img.image);
144
+ images.push({
145
+ alt: img.alt,
146
+ image: uploadResult.blob,
147
+ });
148
+ }
149
+ catch (error) {
150
+ this.logger.error('Failed to upload image', error);
151
+ throw error;
152
+ }
153
+ }
154
+ processedEmbed.$type = 'app.bsky.embed.images';
155
+ processedEmbed.images = images;
156
+ }
157
+ // Handle external link embeds
158
+ if (embed.external) {
159
+ this.logger.debug('Processing external link embed', { uri: embed.external.uri });
160
+ processedEmbed.$type = 'app.bsky.embed.external';
161
+ processedEmbed.external = {
162
+ uri: embed.external.uri,
163
+ title: embed.external.title,
164
+ description: embed.external.description,
165
+ };
166
+ }
167
+ return processedEmbed;
168
+ }
169
+ /**
170
+ * Upload a blob to AT Protocol
171
+ */
172
+ async uploadBlob(blob) {
173
+ return await this.executeAtpOperation(async () => {
174
+ const agent = this.atpClient.getAgent();
175
+ const response = await agent.uploadBlob(blob, {
176
+ encoding: blob.type,
177
+ });
178
+ return response.data;
179
+ }, 'uploadBlob', { blobSize: blob.size, blobType: blob.type });
180
+ }
181
+ }
182
+ //# sourceMappingURL=create-post-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-post-tool.js","sourceRoot":"","sources":["../../../src/tools/implementations/create-post-tool.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAIxD;;GAEG;AACH,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,EAAE,2BAA2B,CAAC;SACnC,GAAG,CAAC,GAAG,EAAE,wCAAwC,CAAC;IACrD,KAAK,EAAE,CAAC;SACL,MAAM,CAAC;QACN,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,sBAAsB,CAAC;QAC/C,MAAM,EAAE,CAAC,CAAC,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AAI,CAAC,MAAM,CAAC,KAAK,CAAC,gCAAgC,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC;YAEjF,cAAc,CAAC,KAAK,GAAG,yBAAyB,CAAC;YACjD,cAAc,CAAC,QAAQ,GAAG;gBACxB,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG;gBACvB,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK;gBAC3B,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC,WAAW;aACxC,CAAC;QACJ,CAAC;QAED,OAAO,cAAc,CAAC;IACxB,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,UAAU,CAAC,IAAU;QACjC,OAAO,MAAM,IAAI,CAAC,mBAAmB,CACnC,KAAK,IAAI,EAAE;YACT,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;YACxC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE;gBAC5C,QAAQ,EAAE,IAAI,CAAC,IAAI;aACpB,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC,EACD,YAAY,EACZ,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,CAC7C,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Follow User Tool - Follows users on AT Protocol
3
+ */
4
+ import { z } from 'zod';
5
+ import { BaseTool } from './base-tool.js';
6
+ import type { AtpClient } from '../../utils/atp-client.js';
7
+ import type { ATURI, CID, DID, IFollowUserParams } from '../../types/index.js';
8
+ /**
9
+ * Tool for following users on AT Protocol
10
+ */
11
+ export declare class FollowUserTool extends BaseTool {
12
+ readonly schema: {
13
+ method: string;
14
+ description: string;
15
+ params: z.ZodObject<{
16
+ actor: z.ZodString;
17
+ }, "strip", z.ZodTypeAny, {
18
+ actor: string;
19
+ }, {
20
+ actor: string;
21
+ }>;
22
+ };
23
+ constructor(atpClient: AtpClient);
24
+ protected execute(params: IFollowUserParams): Promise<{
25
+ uri: ATURI;
26
+ cid: CID;
27
+ success: boolean;
28
+ message: string;
29
+ followedUser: {
30
+ did: DID;
31
+ handle?: string;
32
+ };
33
+ }>;
34
+ /**
35
+ * Resolve actor identifier to DID and profile information
36
+ */
37
+ private resolveActor;
38
+ /**
39
+ * Check if the user is already being followed
40
+ */
41
+ private checkExistingFollow;
42
+ }
43
+ /**
44
+ * Unfollow User Tool - Unfollows users on AT Protocol
45
+ */
46
+ export declare class UnfollowUserTool extends BaseTool {
47
+ readonly schema: {
48
+ method: string;
49
+ description: string;
50
+ params: z.ZodObject<{
51
+ followUri: z.ZodString;
52
+ }, "strip", z.ZodTypeAny, {
53
+ followUri: string;
54
+ }, {
55
+ followUri: string;
56
+ }>;
57
+ };
58
+ constructor(atpClient: AtpClient);
59
+ protected execute(params: {
60
+ followUri: string;
61
+ }): Promise<{
62
+ success: boolean;
63
+ message: string;
64
+ deletedFollow: {
65
+ uri: ATURI;
66
+ };
67
+ }>;
68
+ }
69
+ //# sourceMappingURL=follow-user-tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"follow-user-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/implementations/follow-user-tool.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAS/E;;GAEG;AACH,qBAAa,cAAe,SAAQ,QAAQ;IAC1C,SAAgB,MAAM;;;;;;;;;;MAIpB;gBAEU,SAAS,EAAE,SAAS;cAIhB,OAAO,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC;QAC1D,GAAG,EAAE,KAAK,CAAC;QACX,GAAG,EAAE,GAAG,CAAC;QACT,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,YAAY,EAAE;YACZ,GAAG,EAAE,GAAG,CAAC;YACT,MAAM,CAAC,EAAE,MAAM,CAAC;SACjB,CAAC;KACH,CAAC;IA+EF;;OAEG;YACW,YAAY;IAqB1B;;OAEG;YACW,mBAAmB;CAyClC;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,QAAQ;IAC5C,SAAgB,MAAM;;;;;;;;;;MAMpB;gBAEU,SAAS,EAAE,SAAS;cAIhB,OAAO,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAC9D,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,aAAa,EAAE;YACb,GAAG,EAAE,KAAK,CAAC;SACZ,CAAC;KACH,CAAC;CAgDH"}
@@ -0,0 +1,200 @@
1
+ /**
2
+ * Follow User Tool - Follows users on AT Protocol
3
+ */
4
+ import { z } from 'zod';
5
+ import { BaseTool } from './base-tool.js';
6
+ /**
7
+ * Zod schema for follow user parameters
8
+ */
9
+ const FollowUserSchema = z.object({
10
+ actor: z.string().min(1, 'Actor (DID or handle) is required'),
11
+ });
12
+ /**
13
+ * Tool for following users on AT Protocol
14
+ */
15
+ export class FollowUserTool extends BaseTool {
16
+ schema = {
17
+ method: 'follow_user',
18
+ description: 'Follow a user on AT Protocol. Creates a follow record for the specified user.',
19
+ params: FollowUserSchema,
20
+ };
21
+ constructor(atpClient) {
22
+ super(atpClient, 'FollowUser');
23
+ }
24
+ async execute(params) {
25
+ try {
26
+ this.logger.info('Following user', {
27
+ actor: params.actor,
28
+ });
29
+ // Validate the actor identifier
30
+ this.validateActor(params.actor);
31
+ // Resolve the actor to get their DID and profile info
32
+ const userProfile = await this.resolveActor(params.actor);
33
+ // Check if already following this user
34
+ const existingFollow = await this.checkExistingFollow(userProfile.did);
35
+ if (existingFollow) {
36
+ this.logger.info('User is already being followed', {
37
+ actor: params.actor,
38
+ followUri: existingFollow.uri,
39
+ });
40
+ return {
41
+ uri: existingFollow.uri,
42
+ cid: existingFollow.cid,
43
+ success: true,
44
+ message: 'User was already being followed',
45
+ followedUser: {
46
+ did: userProfile.did,
47
+ handle: userProfile.handle,
48
+ },
49
+ };
50
+ }
51
+ // Create the follow record
52
+ const followRecord = {
53
+ $type: 'app.bsky.graph.follow',
54
+ subject: userProfile.did,
55
+ createdAt: new Date().toISOString(),
56
+ };
57
+ // Create the follow using AT Protocol
58
+ const response = await this.executeAtpOperation(async () => {
59
+ const agent = this.atpClient.getAgent();
60
+ return await agent.com.atproto.repo.createRecord({
61
+ repo: agent.session?.did || '',
62
+ collection: 'app.bsky.graph.follow',
63
+ record: followRecord,
64
+ });
65
+ }, 'createFollow', {
66
+ actor: params.actor,
67
+ targetDid: userProfile.did,
68
+ });
69
+ this.logger.info('User followed successfully', {
70
+ followUri: response.data.uri,
71
+ followCid: response.data.cid,
72
+ actor: params.actor,
73
+ targetDid: userProfile.did,
74
+ });
75
+ return {
76
+ uri: response.data.uri,
77
+ cid: response.data.cid,
78
+ success: true,
79
+ message: 'User followed successfully',
80
+ followedUser: {
81
+ did: userProfile.did,
82
+ handle: userProfile.handle,
83
+ },
84
+ };
85
+ }
86
+ catch (error) {
87
+ this.logger.error('Failed to follow user', error);
88
+ this.formatError(error);
89
+ }
90
+ }
91
+ /**
92
+ * Resolve actor identifier to DID and profile information
93
+ */
94
+ async resolveActor(actor) {
95
+ try {
96
+ const response = await this.executeAtpOperation(async () => {
97
+ const agent = this.atpClient.getAgent();
98
+ return await agent.getProfile({ actor });
99
+ }, 'getProfile', { actor });
100
+ return {
101
+ did: response.data.did,
102
+ ...(response.data.handle && { handle: response.data.handle }),
103
+ };
104
+ }
105
+ catch (error) {
106
+ this.logger.error('Failed to resolve actor', error, { actor });
107
+ throw error;
108
+ }
109
+ }
110
+ /**
111
+ * Check if the user is already being followed
112
+ */
113
+ async checkExistingFollow(targetDid) {
114
+ try {
115
+ const response = await this.executeAtpOperation(async () => {
116
+ const agent = this.atpClient.getAgent();
117
+ const userDid = agent.session?.did;
118
+ if (!userDid) {
119
+ throw new Error('User session not available');
120
+ }
121
+ // List existing follows to check for duplicates
122
+ return await agent.com.atproto.repo.listRecords({
123
+ repo: userDid,
124
+ collection: 'app.bsky.graph.follow',
125
+ limit: 100, // Should be enough to find recent follows
126
+ });
127
+ }, 'listFollows', { targetDid });
128
+ // Check if any of the follows match the target user
129
+ for (const record of response.data.records) {
130
+ const followRecord = record.value;
131
+ if (followRecord.subject === targetDid) {
132
+ return {
133
+ uri: record.uri,
134
+ cid: record.cid,
135
+ };
136
+ }
137
+ }
138
+ return null;
139
+ }
140
+ catch (error) {
141
+ this.logger.warn('Could not check for existing follow', error);
142
+ return null;
143
+ }
144
+ }
145
+ }
146
+ /**
147
+ * Unfollow User Tool - Unfollows users on AT Protocol
148
+ */
149
+ export class UnfollowUserTool extends BaseTool {
150
+ schema = {
151
+ method: 'unfollow_user',
152
+ description: 'Unfollow a user on AT Protocol. Deletes the follow record.',
153
+ params: z.object({
154
+ followUri: z.string().min(1, 'Follow URI is required'),
155
+ }),
156
+ };
157
+ constructor(atpClient) {
158
+ super(atpClient, 'UnfollowUser');
159
+ }
160
+ async execute(params) {
161
+ try {
162
+ this.logger.info('Unfollowing user', {
163
+ followUri: params.followUri,
164
+ });
165
+ // Validate the follow URI
166
+ this.validateAtUri(params.followUri);
167
+ // Delete the follow record
168
+ await this.executeAtpOperation(async () => {
169
+ const agent = this.atpClient.getAgent();
170
+ const uriParts = params.followUri.replace('at://', '').split('/');
171
+ const did = uriParts[0];
172
+ const collection = uriParts[1];
173
+ const rkey = uriParts[2];
174
+ if (!did || !collection || !rkey) {
175
+ throw new Error(`Invalid AT URI format: ${params.followUri}`);
176
+ }
177
+ return await agent.com.atproto.repo.deleteRecord({
178
+ repo: did,
179
+ collection,
180
+ rkey,
181
+ });
182
+ }, 'deleteFollow', { followUri: params.followUri });
183
+ this.logger.info('User unfollowed successfully', {
184
+ followUri: params.followUri,
185
+ });
186
+ return {
187
+ success: true,
188
+ message: 'User unfollowed successfully',
189
+ deletedFollow: {
190
+ uri: params.followUri,
191
+ },
192
+ };
193
+ }
194
+ catch (error) {
195
+ this.logger.error('Failed to unfollow user', error);
196
+ this.formatError(error);
197
+ }
198
+ }
199
+ }
200
+ //# sourceMappingURL=follow-user-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"follow-user-tool.js","sourceRoot":"","sources":["../../../src/tools/implementations/follow-user-tool.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI1C;;GAEG;AACH,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,mCAAmC,CAAC;CAC9D,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,QAAQ;IAC1B,MAAM,GAAG;QACvB,MAAM,EAAE,aAAa;QACrB,WAAW,EAAE,+EAA+E;QAC5F,MAAM,EAAE,gBAAgB;KACzB,CAAC;IAEF,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IACjC,CAAC;IAES,KAAK,CAAC,OAAO,CAAC,MAAyB;QAU/C,IAAI,CAAC;YACH,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE;gBACjC,KAAK,EAAE,MAAM,CAAC,KAAK;aACpB,CAAC,CAAC;YAEH,gCAAgC;YAChC,IAAI,CAAC,aAAa,CAAC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AAG,QAAQ,CAAC,CAAC,CAAC,CAAC;gBAEzB,IAAI,CAAC,GAAG,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,EAAE,CAAC;oBACjC,MAAM,IAAI,KAAK,CAAC,0BAA0B,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;gBAChE,CAAC;gBAED,OAAO,MAAM,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC;oBAC/C,IAAI,EAAE,GAAG;oBACT,UAAU;oBACV,IAAI;iBACL,CAAC,CAAC;YACL,CAAC,EACD,cAAc,EACd,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAChC,CAAC;YAEF,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,8BAA8B,EAAE;gBAC/C,SAAS,EAAE,MAAM,CAAC,SAAS;aAC5B,CAAC,CAAC;YAEH,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE,8BAA8B;gBACvC,aAAa,EAAE;oBACb,GAAG,EAAE,MAAM,CAAC,SAAkB;iBAC/B;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;YACpD,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Get User Profile Tool - Retrieves user profiles from AT Protocol
3
+ */
4
+ import { z } from 'zod';
5
+ import { BaseTool } from './base-tool.js';
6
+ import type { AtpClient } from '../../utils/atp-client.js';
7
+ import type { IAtpProfile, IGetUserProfileParams } from '../../types/index.js';
8
+ /**
9
+ * Tool for retrieving user profiles from AT Protocol
10
+ */
11
+ export declare class GetUserProfileTool extends BaseTool {
12
+ readonly schema: {
13
+ method: string;
14
+ description: string;
15
+ params: z.ZodObject<{
16
+ actor: z.ZodString;
17
+ }, "strip", z.ZodTypeAny, {
18
+ actor: string;
19
+ }, {
20
+ actor: string;
21
+ }>;
22
+ };
23
+ constructor(atpClient: AtpClient);
24
+ protected execute(params: IGetUserProfileParams): Promise<{
25
+ success: boolean;
26
+ profile: IAtpProfile & {
27
+ indexedAt?: string;
28
+ viewer?: {
29
+ muted?: boolean;
30
+ blockedBy?: boolean;
31
+ blocking?: string;
32
+ following?: string;
33
+ followedBy?: string;
34
+ };
35
+ labels?: Array<{
36
+ src: string;
37
+ uri: string;
38
+ cid: string;
39
+ val: string;
40
+ cts: string;
41
+ }>;
42
+ };
43
+ }>;
44
+ /**
45
+ * Get multiple user profiles in batch
46
+ */
47
+ getProfiles(actors: string[]): Promise<{
48
+ success: boolean;
49
+ profiles: Array<IAtpProfile & {
50
+ indexedAt?: string;
51
+ viewer?: {
52
+ muted?: boolean;
53
+ blockedBy?: boolean;
54
+ blocking?: string;
55
+ following?: string;
56
+ followedBy?: string;
57
+ };
58
+ }>;
59
+ }>;
60
+ }
61
+ //# sourceMappingURL=get-user-profile-tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-user-profile-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/implementations/get-user-profile-tool.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAgB,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAO,WAAW,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AASpF;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,QAAQ;IAC9C,SAAgB,MAAM;;;;;;;;;;MAKpB;gBAEU,SAAS,EAAE,SAAS;cAIhB,OAAO,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC;QAC9D,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,WA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