@elizaos/plugin-farcaster 1.0.5 → 1.7.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/README.md +42 -1
- package/dist/__tests__/e2e/scenarios.d.ts +4 -0
- package/dist/__tests__/e2e/scenarios.d.ts.map +1 -0
- package/dist/__tests__/suite.d.ts +117 -0
- package/dist/__tests__/suite.d.ts.map +1 -0
- package/dist/__tests__/test-utils.d.ts +29 -0
- package/dist/__tests__/test-utils.d.ts.map +1 -0
- package/dist/__tests__/types.d.ts +88 -0
- package/dist/__tests__/types.d.ts.map +1 -0
- package/dist/actions/index.d.ts +4 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/replyCast.d.ts +3 -0
- package/dist/actions/replyCast.d.ts.map +1 -0
- package/dist/actions/sendCast.d.ts +3 -0
- package/dist/actions/sendCast.d.ts.map +1 -0
- package/dist/client.d.ts +26 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/common/asyncqueue.d.ts +13 -0
- package/dist/common/asyncqueue.d.ts.map +1 -0
- package/dist/common/callbacks.d.ts +14 -0
- package/dist/common/callbacks.d.ts.map +1 -0
- package/dist/common/config.d.ts +15 -0
- package/dist/common/config.d.ts.map +1 -0
- package/dist/common/constants.d.ts +9 -0
- package/dist/common/constants.d.ts.map +1 -0
- package/dist/common/prompts.d.ts +5 -0
- package/dist/common/prompts.d.ts.map +1 -0
- package/dist/common/types.d.ts +80 -0
- package/dist/common/types.d.ts.map +1 -0
- package/dist/common/utils.d.ts +24 -0
- package/dist/common/utils.d.ts.map +1 -0
- package/dist/events/messageHandler.d.ts +29 -0
- package/dist/events/messageHandler.d.ts.map +1 -0
- package/dist/index.d.ts +7 -500
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1050 -739
- package/dist/index.js.map +35 -1
- package/dist/managers/agent.d.ts +21 -0
- package/dist/managers/agent.d.ts.map +1 -0
- package/dist/managers/interaction-processor.d.ts +12 -0
- package/dist/managers/interaction-processor.d.ts.map +1 -0
- package/dist/managers/interaction-source.d.ts +50 -0
- package/dist/managers/interaction-source.d.ts.map +1 -0
- package/dist/managers/interactions.d.ts +49 -0
- package/dist/managers/interactions.d.ts.map +1 -0
- package/dist/managers/post.d.ts +24 -0
- package/dist/managers/post.d.ts.map +1 -0
- package/dist/providers/index.d.ts +5 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/profileProvider.d.ts +3 -0
- package/dist/providers/profileProvider.d.ts.map +1 -0
- package/dist/providers/threadProvider.d.ts +3 -0
- package/dist/providers/threadProvider.d.ts.map +1 -0
- package/dist/providers/timelineProvider.d.ts +3 -0
- package/dist/providers/timelineProvider.d.ts.map +1 -0
- package/dist/routes/webhook.d.ts +3 -0
- package/dist/routes/webhook.d.ts.map +1 -0
- package/dist/service.d.ts +31 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/services/CastService.d.ts +142 -0
- package/dist/services/CastService.d.ts.map +1 -0
- package/dist/services/MessageService.d.ts +50 -0
- package/dist/services/MessageService.d.ts.map +1 -0
- package/package.json +5 -6
- package/dist/chunk-FNDASAYG.js +0 -83
- package/dist/chunk-FNDASAYG.js.map +0 -1
- package/dist/chunk-IOTLJXKN.js +0 -72
- package/dist/chunk-IOTLJXKN.js.map +0 -1
- package/dist/chunk-OAXQ6Z2Q.js +0 -105
- package/dist/chunk-OAXQ6Z2Q.js.map +0 -1
- package/dist/chunk-Y2URJ4EZ.js +0 -21
- package/dist/chunk-Y2URJ4EZ.js.map +0 -1
- package/dist/profileProvider-TNRU42OO.js +0 -8
- package/dist/profileProvider-TNRU42OO.js.map +0 -1
- package/dist/sendCast-OW6DBKQB.js +0 -8
- package/dist/sendCast-OW6DBKQB.js.map +0 -1
- package/dist/timelineProvider-GPRPFEVJ.js +0 -8
- package/dist/timelineProvider-GPRPFEVJ.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,506 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { NeynarAPIClient } from '@neynar/nodejs-sdk';
|
|
4
|
-
import { CastWithInteractions } from '@neynar/nodejs-sdk/build/api/index.js';
|
|
5
|
-
import { z } from 'zod';
|
|
6
|
-
|
|
7
|
-
type Profile = {
|
|
8
|
-
fid: number;
|
|
9
|
-
name: string;
|
|
10
|
-
username: string;
|
|
11
|
-
pfp?: string;
|
|
12
|
-
bio?: string;
|
|
13
|
-
url?: string;
|
|
14
|
-
};
|
|
15
|
-
type Cast = {
|
|
16
|
-
hash: string;
|
|
17
|
-
authorFid: number;
|
|
18
|
-
text: string;
|
|
19
|
-
profile: Profile;
|
|
20
|
-
threadId?: string;
|
|
21
|
-
inReplyTo?: {
|
|
22
|
-
hash: string;
|
|
23
|
-
fid: number;
|
|
24
|
-
};
|
|
25
|
-
timestamp: Date;
|
|
26
|
-
stats?: {
|
|
27
|
-
recasts: number;
|
|
28
|
-
replies: number;
|
|
29
|
-
likes: number;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
type CastId = {
|
|
33
|
-
hash: string;
|
|
34
|
-
fid: number;
|
|
35
|
-
};
|
|
36
|
-
type FidRequest = {
|
|
37
|
-
fid: number;
|
|
38
|
-
pageSize: number;
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* This schema defines all required/optional environment settings for Farcaster client
|
|
42
|
-
*/
|
|
43
|
-
declare const FarcasterConfigSchema: z.ZodObject<{
|
|
44
|
-
FARCASTER_DRY_RUN: z.ZodEffects<z.ZodUnion<[z.ZodBoolean, z.ZodString]>, boolean, string | boolean>;
|
|
45
|
-
FARCASTER_FID: z.ZodNumber;
|
|
46
|
-
MAX_CAST_LENGTH: z.ZodDefault<z.ZodNumber>;
|
|
47
|
-
FARCASTER_POLL_INTERVAL: z.ZodDefault<z.ZodNumber>;
|
|
48
|
-
ENABLE_CAST: z.ZodEffects<z.ZodUnion<[z.ZodBoolean, z.ZodString]>, boolean, string | boolean>;
|
|
49
|
-
CAST_INTERVAL_MIN: z.ZodNumber;
|
|
50
|
-
CAST_INTERVAL_MAX: z.ZodNumber;
|
|
51
|
-
ENABLE_ACTION_PROCESSING: z.ZodEffects<z.ZodUnion<[z.ZodBoolean, z.ZodString]>, boolean, string | boolean>;
|
|
52
|
-
ACTION_INTERVAL: z.ZodNumber;
|
|
53
|
-
CAST_IMMEDIATELY: z.ZodEffects<z.ZodUnion<[z.ZodBoolean, z.ZodString]>, boolean, string | boolean>;
|
|
54
|
-
MAX_ACTIONS_PROCESSING: z.ZodNumber;
|
|
55
|
-
FARCASTER_SIGNER_UUID: z.ZodString;
|
|
56
|
-
FARCASTER_NEYNAR_API_KEY: z.ZodString;
|
|
57
|
-
FARCASTER_HUB_URL: z.ZodString;
|
|
58
|
-
}, "strip", z.ZodTypeAny, {
|
|
59
|
-
FARCASTER_DRY_RUN: boolean;
|
|
60
|
-
FARCASTER_FID: number;
|
|
61
|
-
MAX_CAST_LENGTH: number;
|
|
62
|
-
FARCASTER_POLL_INTERVAL: number;
|
|
63
|
-
ENABLE_CAST: boolean;
|
|
64
|
-
CAST_INTERVAL_MIN: number;
|
|
65
|
-
CAST_INTERVAL_MAX: number;
|
|
66
|
-
ENABLE_ACTION_PROCESSING: boolean;
|
|
67
|
-
ACTION_INTERVAL: number;
|
|
68
|
-
CAST_IMMEDIATELY: boolean;
|
|
69
|
-
MAX_ACTIONS_PROCESSING: number;
|
|
70
|
-
FARCASTER_SIGNER_UUID: string;
|
|
71
|
-
FARCASTER_NEYNAR_API_KEY: string;
|
|
72
|
-
FARCASTER_HUB_URL: string;
|
|
73
|
-
}, {
|
|
74
|
-
FARCASTER_DRY_RUN: string | boolean;
|
|
75
|
-
FARCASTER_FID: number;
|
|
76
|
-
ENABLE_CAST: string | boolean;
|
|
77
|
-
CAST_INTERVAL_MIN: number;
|
|
78
|
-
CAST_INTERVAL_MAX: number;
|
|
79
|
-
ENABLE_ACTION_PROCESSING: string | boolean;
|
|
80
|
-
ACTION_INTERVAL: number;
|
|
81
|
-
CAST_IMMEDIATELY: string | boolean;
|
|
82
|
-
MAX_ACTIONS_PROCESSING: number;
|
|
83
|
-
FARCASTER_SIGNER_UUID: string;
|
|
84
|
-
FARCASTER_NEYNAR_API_KEY: string;
|
|
85
|
-
FARCASTER_HUB_URL: string;
|
|
86
|
-
MAX_CAST_LENGTH?: number | undefined;
|
|
87
|
-
FARCASTER_POLL_INTERVAL?: number | undefined;
|
|
88
|
-
}>;
|
|
89
|
-
type FarcasterConfig = z.infer<typeof FarcasterConfigSchema>;
|
|
90
|
-
declare enum FarcasterMessageType {
|
|
91
|
-
CAST = "CAST",
|
|
92
|
-
REPLY = "REPLY"
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
declare class FarcasterClient {
|
|
96
|
-
private neynar;
|
|
97
|
-
private signerUuid;
|
|
98
|
-
constructor(opts: {
|
|
99
|
-
neynar: NeynarAPIClient;
|
|
100
|
-
signerUuid: string;
|
|
101
|
-
});
|
|
102
|
-
sendCast({ content, inReplyTo, }: {
|
|
103
|
-
content: Content;
|
|
104
|
-
inReplyTo?: CastId;
|
|
105
|
-
}): Promise<CastWithInteractions[]>;
|
|
106
|
-
private publishCast;
|
|
107
|
-
getCast(castHash: string): Promise<CastWithInteractions>;
|
|
108
|
-
getMentions(request: FidRequest): Promise<CastWithInteractions[]>;
|
|
109
|
-
getProfile(fid: number): Promise<Profile>;
|
|
110
|
-
getTimeline(request: FidRequest): Promise<{
|
|
111
|
-
timeline: Cast[];
|
|
112
|
-
cursor?: string;
|
|
113
|
-
}>;
|
|
114
|
-
clearCache(): void;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
interface FarcasterInteractionParams {
|
|
118
|
-
client: FarcasterClient;
|
|
119
|
-
runtime: IAgentRuntime;
|
|
120
|
-
config: FarcasterConfig;
|
|
121
|
-
}
|
|
122
|
-
declare class FarcasterInteractionManager {
|
|
123
|
-
private timeout;
|
|
124
|
-
private isRunning;
|
|
125
|
-
private client;
|
|
126
|
-
private runtime;
|
|
127
|
-
private config;
|
|
128
|
-
private asyncQueue;
|
|
129
|
-
constructor(opts: FarcasterInteractionParams);
|
|
130
|
-
start(): Promise<void>;
|
|
131
|
-
stop(): Promise<void>;
|
|
132
|
-
private runPeriodically;
|
|
133
|
-
private ensureCastConnection;
|
|
134
|
-
private handleInteractions;
|
|
135
|
-
buildThreadForCast(cast: Cast, skipMemoryId: Set<UUID>): Promise<Cast[]>;
|
|
136
|
-
private handleMentionCast;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
interface FarcasterCastParams {
|
|
140
|
-
client: FarcasterClient;
|
|
141
|
-
runtime: IAgentRuntime;
|
|
142
|
-
config: FarcasterConfig;
|
|
143
|
-
}
|
|
144
|
-
declare class FarcasterCastManager {
|
|
145
|
-
client: FarcasterClient;
|
|
146
|
-
runtime: IAgentRuntime;
|
|
147
|
-
fid: number;
|
|
148
|
-
private timeout;
|
|
149
|
-
private config;
|
|
150
|
-
private isRunning;
|
|
151
|
-
constructor(opts: FarcasterCastParams);
|
|
152
|
-
start(): Promise<void>;
|
|
153
|
-
stop(): Promise<void>;
|
|
154
|
-
private calculateDelay;
|
|
155
|
-
private runPeriodically;
|
|
156
|
-
private generateNewCast;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* A manager that orchestrates all Farcaster operations:
|
|
161
|
-
* - client: base operations (Neynar client, hub connection, etc.)
|
|
162
|
-
* - posts: autonomous posting logic
|
|
163
|
-
* - interactions: handling mentions, replies, likes, etc.
|
|
164
|
-
*/
|
|
165
|
-
declare class FarcasterAgentManager {
|
|
166
|
-
readonly runtime: IAgentRuntime;
|
|
167
|
-
readonly client: FarcasterClient;
|
|
168
|
-
readonly casts: FarcasterCastManager;
|
|
169
|
-
readonly interactions: FarcasterInteractionManager;
|
|
170
|
-
constructor(runtime: IAgentRuntime, config: FarcasterConfig);
|
|
171
|
-
start(): Promise<void>;
|
|
172
|
-
stop(): Promise<void>;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
interface Message {
|
|
176
|
-
id: string;
|
|
177
|
-
agentId: UUID;
|
|
178
|
-
roomId: string;
|
|
179
|
-
userId: string;
|
|
180
|
-
username: string;
|
|
181
|
-
text: string;
|
|
182
|
-
type: FarcasterMessageType;
|
|
183
|
-
timestamp: number;
|
|
184
|
-
inReplyTo?: string;
|
|
185
|
-
metadata?: any;
|
|
186
|
-
}
|
|
187
|
-
interface GetMessagesOptions {
|
|
188
|
-
roomId?: string;
|
|
189
|
-
limit?: number;
|
|
190
|
-
}
|
|
191
|
-
interface SendMessageOptions {
|
|
192
|
-
agentId: UUID;
|
|
193
|
-
roomId: string;
|
|
194
|
-
text: string;
|
|
195
|
-
type: string;
|
|
196
|
-
replyToId?: string;
|
|
197
|
-
metadata?: any;
|
|
198
|
-
}
|
|
199
|
-
interface IMessageService {
|
|
200
|
-
getMessages(options: GetMessagesOptions): Promise<Message[]>;
|
|
201
|
-
sendMessage(options: SendMessageOptions): Promise<Message>;
|
|
202
|
-
getMessage(messageId: string, agentId: UUID): Promise<Message | null>;
|
|
203
|
-
}
|
|
204
|
-
declare class FarcasterMessageService implements IMessageService {
|
|
205
|
-
private client;
|
|
206
|
-
private runtime;
|
|
207
|
-
constructor(client: FarcasterClient, runtime: any);
|
|
208
|
-
getMessages(options: GetMessagesOptions): Promise<Message[]>;
|
|
209
|
-
sendMessage(options: SendMessageOptions): Promise<Message>;
|
|
210
|
-
deleteMessage(messageId: string, agentId: UUID): Promise<void>;
|
|
211
|
-
getMessage(messageId: string, agentId: UUID): Promise<Message | null>;
|
|
212
|
-
markAsRead(messageIds: string[], agentId: UUID): Promise<void>;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
interface FarcasterCast {
|
|
216
|
-
id: string;
|
|
217
|
-
agentId: UUID;
|
|
218
|
-
roomId: UUID;
|
|
219
|
-
userId: string;
|
|
220
|
-
username: string;
|
|
221
|
-
text: string;
|
|
222
|
-
timestamp: number;
|
|
223
|
-
inReplyTo?: string;
|
|
224
|
-
media?: any[];
|
|
225
|
-
metadata?: any;
|
|
226
|
-
}
|
|
227
|
-
interface CastServiceInterface {
|
|
228
|
-
getCasts(params: {
|
|
229
|
-
agentId: UUID;
|
|
230
|
-
limit?: number;
|
|
231
|
-
cursor?: string;
|
|
232
|
-
}): Promise<FarcasterCast[]>;
|
|
233
|
-
createCast(params: {
|
|
234
|
-
agentId: UUID;
|
|
235
|
-
roomId: UUID;
|
|
236
|
-
text: string;
|
|
237
|
-
media?: string[];
|
|
238
|
-
replyTo?: {
|
|
239
|
-
hash: string;
|
|
240
|
-
fid: number;
|
|
241
|
-
};
|
|
242
|
-
}): Promise<FarcasterCast>;
|
|
243
|
-
deleteCast(params: {
|
|
244
|
-
agentId: UUID;
|
|
245
|
-
castHash: string;
|
|
246
|
-
}): Promise<void>;
|
|
247
|
-
likeCast(params: {
|
|
248
|
-
agentId: UUID;
|
|
249
|
-
castHash: string;
|
|
250
|
-
}): Promise<void>;
|
|
251
|
-
unlikeCast(params: {
|
|
252
|
-
agentId: UUID;
|
|
253
|
-
castHash: string;
|
|
254
|
-
}): Promise<void>;
|
|
255
|
-
recast(params: {
|
|
256
|
-
agentId: UUID;
|
|
257
|
-
castHash: string;
|
|
258
|
-
}): Promise<void>;
|
|
259
|
-
unrecast(params: {
|
|
260
|
-
agentId: UUID;
|
|
261
|
-
castHash: string;
|
|
262
|
-
}): Promise<void>;
|
|
263
|
-
getMentions(params: {
|
|
264
|
-
agentId: UUID;
|
|
265
|
-
limit?: number;
|
|
266
|
-
}): Promise<FarcasterCast[]>;
|
|
267
|
-
}
|
|
268
|
-
declare class FarcasterCastService implements CastServiceInterface {
|
|
269
|
-
private client;
|
|
270
|
-
private runtime;
|
|
271
|
-
static serviceType: string;
|
|
272
|
-
constructor(client: FarcasterClient, runtime: IAgentRuntime);
|
|
273
|
-
/**
|
|
274
|
-
* Get recent casts from the timeline
|
|
275
|
-
*/
|
|
276
|
-
getCasts(params: {
|
|
277
|
-
agentId: UUID;
|
|
278
|
-
limit?: number;
|
|
279
|
-
cursor?: string;
|
|
280
|
-
}): Promise<FarcasterCast[]>;
|
|
281
|
-
/**
|
|
282
|
-
* Create a new cast
|
|
283
|
-
*/
|
|
284
|
-
createCast(params: {
|
|
285
|
-
agentId: UUID;
|
|
286
|
-
roomId: UUID;
|
|
287
|
-
text: string;
|
|
288
|
-
media?: string[];
|
|
289
|
-
replyTo?: {
|
|
290
|
-
hash: string;
|
|
291
|
-
fid: number;
|
|
292
|
-
};
|
|
293
|
-
}): Promise<FarcasterCast>;
|
|
294
|
-
/**
|
|
295
|
-
* Delete a cast
|
|
296
|
-
*/
|
|
297
|
-
deleteCast(params: {
|
|
298
|
-
agentId: UUID;
|
|
299
|
-
castHash: string;
|
|
300
|
-
}): Promise<void>;
|
|
301
|
-
/**
|
|
302
|
-
* Like a cast
|
|
303
|
-
*/
|
|
304
|
-
likeCast(params: {
|
|
305
|
-
agentId: UUID;
|
|
306
|
-
castHash: string;
|
|
307
|
-
}): Promise<void>;
|
|
308
|
-
/**
|
|
309
|
-
* Unlike a cast
|
|
310
|
-
*/
|
|
311
|
-
unlikeCast(params: {
|
|
312
|
-
agentId: UUID;
|
|
313
|
-
castHash: string;
|
|
314
|
-
}): Promise<void>;
|
|
315
|
-
/**
|
|
316
|
-
* Recast a cast
|
|
317
|
-
*/
|
|
318
|
-
recast(params: {
|
|
319
|
-
agentId: UUID;
|
|
320
|
-
castHash: string;
|
|
321
|
-
}): Promise<void>;
|
|
322
|
-
/**
|
|
323
|
-
* Remove a recast
|
|
324
|
-
*/
|
|
325
|
-
unrecast(params: {
|
|
326
|
-
agentId: UUID;
|
|
327
|
-
castHash: string;
|
|
328
|
-
}): Promise<void>;
|
|
329
|
-
/**
|
|
330
|
-
* Get mentions
|
|
331
|
-
*/
|
|
332
|
-
getMentions(params: {
|
|
333
|
-
agentId: UUID;
|
|
334
|
-
limit?: number;
|
|
335
|
-
}): Promise<FarcasterCast[]>;
|
|
336
|
-
/**
|
|
337
|
-
* Generate cast content using AI
|
|
338
|
-
*/
|
|
339
|
-
private generateCastContent;
|
|
340
|
-
/**
|
|
341
|
-
* Truncate cast to fit character limit
|
|
342
|
-
*/
|
|
343
|
-
private truncateCast;
|
|
344
|
-
/**
|
|
345
|
-
* Store cast in agent memory
|
|
346
|
-
*/
|
|
347
|
-
private storeCastInMemory;
|
|
348
|
-
/**
|
|
349
|
-
* Convert internal Cast type to FarcasterCast
|
|
350
|
-
*/
|
|
351
|
-
private castToFarcasterCast;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
declare class FarcasterService extends Service {
|
|
355
|
-
private static instance?;
|
|
356
|
-
private managers;
|
|
357
|
-
private messageServices;
|
|
358
|
-
private castServices;
|
|
359
|
-
static serviceType: string;
|
|
360
|
-
readonly description = "Farcaster integration service for sending and receiving casts";
|
|
361
|
-
readonly capabilityDescription = "The agent is able to send and receive messages on farcaster";
|
|
362
|
-
private static getInstance;
|
|
363
|
-
initialize(runtime: IAgentRuntime): Promise<void>;
|
|
364
|
-
static start(runtime: IAgentRuntime): Promise<Service>;
|
|
365
|
-
static stop(runtime: IAgentRuntime): Promise<void>;
|
|
366
|
-
stop(): Promise<void>;
|
|
367
|
-
getMessageService(agentId: UUID): FarcasterMessageService | undefined;
|
|
368
|
-
/**
|
|
369
|
-
* Get the PostService for a specific agent (for compatibility)
|
|
370
|
-
* @deprecated Use getCastService() instead. Will be removed in a future major release.
|
|
371
|
-
*/
|
|
372
|
-
getPostService(agentId: UUID): FarcasterCastService | undefined;
|
|
373
|
-
getCastService(agentId: UUID): FarcasterCastService | undefined;
|
|
374
|
-
healthCheck(): Promise<{
|
|
375
|
-
healthy: boolean;
|
|
376
|
-
details: Record<string, any>;
|
|
377
|
-
}>;
|
|
378
|
-
getActiveManagers(): Map<UUID, FarcasterAgentManager>;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* Represents a Test Suite for Farcaster functionality.
|
|
383
|
-
* This class implements the TestSuite interface.
|
|
384
|
-
* It contains various test cases related to Farcaster operations such as initializing the client,
|
|
385
|
-
* fetching profile, fetching casts, posting casts, and handling cast interactions.
|
|
386
|
-
*/
|
|
387
|
-
declare class FarcasterTestSuite implements TestSuite {
|
|
388
|
-
name: string;
|
|
389
|
-
description: string;
|
|
390
|
-
private manager;
|
|
391
|
-
tests: TestCase[];
|
|
392
|
-
/**
|
|
393
|
-
* Constructor for TestSuite class.
|
|
394
|
-
* Initializes an array of test functions to be executed.
|
|
395
|
-
*/
|
|
396
|
-
constructor();
|
|
397
|
-
/**
|
|
398
|
-
* Test that checks if Farcaster is properly configured
|
|
399
|
-
*/
|
|
400
|
-
testMockConfiguration(runtime: IAgentRuntime): Promise<void>;
|
|
401
|
-
/**
|
|
402
|
-
* Test service initialization without real credentials
|
|
403
|
-
*/
|
|
404
|
-
testMockServiceInit(runtime: IAgentRuntime): Promise<void>;
|
|
405
|
-
/**
|
|
406
|
-
* Asynchronously initializes the Farcaster client for the provided agent runtime.
|
|
407
|
-
*
|
|
408
|
-
* @param {IAgentRuntime} runtime - The agent runtime to use for initializing the Farcaster client.
|
|
409
|
-
* @throws {Error} If the Farcaster client manager is not found or if the Farcaster client fails to initialize.
|
|
410
|
-
*/
|
|
411
|
-
testInitializingClient(runtime: IAgentRuntime): Promise<void>;
|
|
412
|
-
/**
|
|
413
|
-
* Asynchronously fetches the profile of a user from Farcaster using the given runtime.
|
|
414
|
-
*
|
|
415
|
-
* @param {IAgentRuntime} runtime The runtime to use for fetching the profile.
|
|
416
|
-
* @returns {Promise<void>} A Promise that resolves when the profile is successfully fetched, or rejects with an error.
|
|
417
|
-
*/
|
|
418
|
-
testFetchProfile(runtime: IAgentRuntime): Promise<void>;
|
|
419
|
-
/**
|
|
420
|
-
* Asynchronously fetches the timeline from the Farcaster client.
|
|
421
|
-
*
|
|
422
|
-
* @param {IAgentRuntime} runtime - The agent runtime object.
|
|
423
|
-
* @throws {Error} If there are no casts in the timeline.
|
|
424
|
-
* @throws {Error} If an error occurs while fetching the timeline.
|
|
425
|
-
*/
|
|
426
|
-
testFetchTimeline(runtime: IAgentRuntime): Promise<void>;
|
|
427
|
-
/**
|
|
428
|
-
* Asynchronously posts a test cast using the Farcaster API.
|
|
429
|
-
*
|
|
430
|
-
* @param {IAgentRuntime} runtime - The agent runtime object.
|
|
431
|
-
* @returns {Promise<void>} A Promise that resolves when the cast is successfully posted.
|
|
432
|
-
* @throws {Error} If there is an error posting the cast.
|
|
433
|
-
*/
|
|
434
|
-
testPostCast(runtime: IAgentRuntime): Promise<void>;
|
|
435
|
-
/**
|
|
436
|
-
* Asynchronously posts an image cast on Farcaster using the provided runtime and cast content.
|
|
437
|
-
* Note: This might need updating based on how images are actually handled in sendCast
|
|
438
|
-
*
|
|
439
|
-
* @param {IAgentRuntime} runtime - The runtime environment for the action.
|
|
440
|
-
* @returns {Promise<void>} A Promise that resolves when the cast is successfully posted.
|
|
441
|
-
* @throws {Error} If there is an error posting the cast.
|
|
442
|
-
*/
|
|
443
|
-
testPostImageCast(runtime: IAgentRuntime): Promise<void>;
|
|
444
|
-
/**
|
|
445
|
-
* Asynchronously handles a fake cast response using the given runtime.
|
|
446
|
-
*
|
|
447
|
-
* @param {IAgentRuntime} runtime - The runtime object for the agent
|
|
448
|
-
* @returns {Promise<void>} - A promise that resolves when the cast response is handled
|
|
449
|
-
* @throws {Error} - If there is an error handling the cast response
|
|
450
|
-
*/
|
|
451
|
-
testHandleCastResponse(runtime: IAgentRuntime): Promise<void>;
|
|
452
|
-
/**
|
|
453
|
-
* Generates random content for a cast based on the given context.
|
|
454
|
-
*
|
|
455
|
-
* @param {IAgentRuntime} runtime - The runtime environment.
|
|
456
|
-
* @param {string} context - Optional context for the content generation.
|
|
457
|
-
* @returns {Promise<string>} A promise that resolves to the generated cast content.
|
|
458
|
-
*/
|
|
459
|
-
private generateRandomCastContent;
|
|
460
|
-
/**
|
|
461
|
-
* Tests the MessageService functionality
|
|
462
|
-
*
|
|
463
|
-
* @param {IAgentRuntime} runtime - The runtime environment.
|
|
464
|
-
* @returns {Promise<void>} A promise that resolves when the test is complete.
|
|
465
|
-
*/
|
|
466
|
-
testMessageService(runtime: IAgentRuntime): Promise<void>;
|
|
467
|
-
/**
|
|
468
|
-
* Tests the PostService functionality
|
|
469
|
-
*
|
|
470
|
-
* @param {IAgentRuntime} runtime - The runtime environment.
|
|
471
|
-
* @returns {Promise<void>} A promise that resolves when the test is complete.
|
|
472
|
-
*/
|
|
473
|
-
testPostService(runtime: IAgentRuntime): Promise<void>;
|
|
474
|
-
/**
|
|
475
|
-
* Tests real account posting functionality
|
|
476
|
-
*
|
|
477
|
-
* @param {IAgentRuntime} runtime - The runtime environment.
|
|
478
|
-
* @returns {Promise<void>} A promise that resolves when the test is complete.
|
|
479
|
-
*/
|
|
480
|
-
testRealAccountPosting(runtime: IAgentRuntime): Promise<void>;
|
|
481
|
-
/**
|
|
482
|
-
* Tests real account interactions (mentions, replies, etc)
|
|
483
|
-
*
|
|
484
|
-
* @param {IAgentRuntime} runtime - The runtime environment.
|
|
485
|
-
* @returns {Promise<void>} A promise that resolves when the test is complete.
|
|
486
|
-
*/
|
|
487
|
-
testRealAccountInteractions(runtime: IAgentRuntime): Promise<void>;
|
|
488
|
-
/**
|
|
489
|
-
* Tests message metadata tracking functionality
|
|
490
|
-
*
|
|
491
|
-
* @param {IAgentRuntime} runtime - The runtime environment.
|
|
492
|
-
* @returns {Promise<void>} A promise that resolves when the test is complete.
|
|
493
|
-
*/
|
|
494
|
-
testMessageMetadataTracking(runtime: IAgentRuntime): Promise<void>;
|
|
495
|
-
}
|
|
496
|
-
|
|
1
|
+
import { FarcasterService } from './service.js';
|
|
2
|
+
import { FarcasterTestSuite } from './__tests__/suite.js';
|
|
497
3
|
declare const farcasterPlugin: {
|
|
498
4
|
name: string;
|
|
499
5
|
description: string;
|
|
500
6
|
services: (typeof FarcasterService)[];
|
|
501
|
-
actions:
|
|
502
|
-
providers:
|
|
7
|
+
actions: any[];
|
|
8
|
+
providers: any[];
|
|
9
|
+
routes: Route[];
|
|
503
10
|
tests: FarcasterTestSuite[];
|
|
504
11
|
};
|
|
505
|
-
|
|
506
|
-
|
|
12
|
+
export default farcasterPlugin;
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAK1D,QAAA,MAAM,eAAe;;;;;;;;CAQpB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|