@elizaos/plugin-farcaster 1.0.5 → 1.7.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 (80) hide show
  1. package/README.md +42 -1
  2. package/dist/__tests__/e2e/scenarios.d.ts +4 -0
  3. package/dist/__tests__/e2e/scenarios.d.ts.map +1 -0
  4. package/dist/__tests__/suite.d.ts +130 -0
  5. package/dist/__tests__/suite.d.ts.map +1 -0
  6. package/dist/__tests__/test-utils.d.ts +29 -0
  7. package/dist/__tests__/test-utils.d.ts.map +1 -0
  8. package/dist/__tests__/types.d.ts +88 -0
  9. package/dist/__tests__/types.d.ts.map +1 -0
  10. package/dist/actions/index.d.ts +4 -0
  11. package/dist/actions/index.d.ts.map +1 -0
  12. package/dist/actions/replyCast.d.ts +3 -0
  13. package/dist/actions/replyCast.d.ts.map +1 -0
  14. package/dist/actions/sendCast.d.ts +3 -0
  15. package/dist/actions/sendCast.d.ts.map +1 -0
  16. package/dist/client.d.ts +26 -0
  17. package/dist/client.d.ts.map +1 -0
  18. package/dist/common/asyncqueue.d.ts +13 -0
  19. package/dist/common/asyncqueue.d.ts.map +1 -0
  20. package/dist/common/callbacks.d.ts +14 -0
  21. package/dist/common/callbacks.d.ts.map +1 -0
  22. package/dist/common/config.d.ts +24 -0
  23. package/dist/common/config.d.ts.map +1 -0
  24. package/dist/common/constants.d.ts +9 -0
  25. package/dist/common/constants.d.ts.map +1 -0
  26. package/dist/common/prompts.d.ts +5 -0
  27. package/dist/common/prompts.d.ts.map +1 -0
  28. package/dist/common/types.d.ts +106 -0
  29. package/dist/common/types.d.ts.map +1 -0
  30. package/dist/common/utils.d.ts +28 -0
  31. package/dist/common/utils.d.ts.map +1 -0
  32. package/dist/events/messageHandler.d.ts +29 -0
  33. package/dist/events/messageHandler.d.ts.map +1 -0
  34. package/dist/index.d.ts +9 -500
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +1538 -889
  37. package/dist/index.js.map +36 -1
  38. package/dist/managers/agent.d.ts +21 -0
  39. package/dist/managers/agent.d.ts.map +1 -0
  40. package/dist/managers/embedManager.d.ts +89 -0
  41. package/dist/managers/embedManager.d.ts.map +1 -0
  42. package/dist/managers/interaction-processor.d.ts +12 -0
  43. package/dist/managers/interaction-processor.d.ts.map +1 -0
  44. package/dist/managers/interaction-source.d.ts +50 -0
  45. package/dist/managers/interaction-source.d.ts.map +1 -0
  46. package/dist/managers/interactions.d.ts +50 -0
  47. package/dist/managers/interactions.d.ts.map +1 -0
  48. package/dist/managers/post.d.ts +24 -0
  49. package/dist/managers/post.d.ts.map +1 -0
  50. package/dist/providers/index.d.ts +5 -0
  51. package/dist/providers/index.d.ts.map +1 -0
  52. package/dist/providers/profileProvider.d.ts +3 -0
  53. package/dist/providers/profileProvider.d.ts.map +1 -0
  54. package/dist/providers/threadProvider.d.ts +3 -0
  55. package/dist/providers/threadProvider.d.ts.map +1 -0
  56. package/dist/providers/timelineProvider.d.ts +3 -0
  57. package/dist/providers/timelineProvider.d.ts.map +1 -0
  58. package/dist/routes/webhook.d.ts +3 -0
  59. package/dist/routes/webhook.d.ts.map +1 -0
  60. package/dist/service.d.ts +31 -0
  61. package/dist/service.d.ts.map +1 -0
  62. package/dist/services/CastService.d.ts +142 -0
  63. package/dist/services/CastService.d.ts.map +1 -0
  64. package/dist/services/MessageService.d.ts +50 -0
  65. package/dist/services/MessageService.d.ts.map +1 -0
  66. package/package.json +6 -6
  67. package/dist/chunk-FNDASAYG.js +0 -83
  68. package/dist/chunk-FNDASAYG.js.map +0 -1
  69. package/dist/chunk-IOTLJXKN.js +0 -72
  70. package/dist/chunk-IOTLJXKN.js.map +0 -1
  71. package/dist/chunk-OAXQ6Z2Q.js +0 -105
  72. package/dist/chunk-OAXQ6Z2Q.js.map +0 -1
  73. package/dist/chunk-Y2URJ4EZ.js +0 -21
  74. package/dist/chunk-Y2URJ4EZ.js.map +0 -1
  75. package/dist/profileProvider-TNRU42OO.js +0 -8
  76. package/dist/profileProvider-TNRU42OO.js.map +0 -1
  77. package/dist/sendCast-OW6DBKQB.js +0 -8
  78. package/dist/sendCast-OW6DBKQB.js.map +0 -1
  79. package/dist/timelineProvider-GPRPFEVJ.js +0 -8
  80. package/dist/timelineProvider-GPRPFEVJ.js.map +0 -1
package/README.md CHANGED
@@ -71,8 +71,47 @@ Edit `.env` with your credentials:
71
71
  FARCASTER_FID=your-fid-here
72
72
  FARCASTER_NEYNAR_API_KEY=your-api-key-here
73
73
  FARCASTER_SIGNER_UUID=your-signer-uuid-here
74
+ FARCASTER_MODE=polling # or 'webhook' for real-time processing
74
75
  ```
75
76
 
77
+ ### 3. Webhook Setup (Recommended for Production)
78
+
79
+ For real-time interaction processing instead of polling, you can configure webhooks:
80
+
81
+ #### Step 1: Set Environment Variable
82
+ ```env
83
+ FARCASTER_MODE=webhook
84
+ ```
85
+
86
+ #### Step 2: Expose Your Server
87
+ If running locally, use ngrok to expose your server:
88
+ ```bash
89
+ # Install ngrok if you haven't already
90
+ npm install -g ngrok
91
+
92
+ # Expose your local server (default port 3000)
93
+ ngrok http 3000
94
+ ```
95
+
96
+ This will give you a URL like: `https://c7120f641530.ngrok-free.app`
97
+
98
+ #### Step 3: Configure Neynar Webhook
99
+ 1. Go to [Neynar Webhook Dashboard](https://dev.neynar.com/webhook)
100
+ 2. Click "New webhook"
101
+ 3. Set the **Target URL** to: `https://your-ngrok-url.ngrok-free.app/farcaster/webhook`
102
+ - Example: `https://c7120f641530.ngrok-free.app/farcaster/webhook`
103
+ 4. Configure **Event Types**:
104
+ - Select `cast.created`
105
+ 5. Set **Filters**:
106
+ - **Mentioned users**: Add your Farcaster username
107
+ - **Parent cast authors**: Add your Farcaster username
108
+
109
+
110
+ #### Step 4: Test Webhook
111
+ Once configured, your agent will receive real-time notifications when:
112
+ - Someone mentions your agent
113
+ - Someone replies to your agent's casts
114
+
76
115
  ## Configuration
77
116
 
78
117
  The plugin requires the following configurations, which can be set via environment variables or ElizaOS runtime settings:
@@ -84,6 +123,7 @@ The plugin requires the following configurations, which can be set via environme
84
123
  | `FARCASTER_NEYNAR_API_KEY` | Neynar API key for accessing Farcaster |
85
124
  | `FARCASTER_SIGNER_UUID` | Signer UUID for your Farcaster account |
86
125
  | `FARCASTER_FID` | Your Farcaster FID (identifier) |
126
+ | `FARCASTER_MODE` | Interaction mode: `polling` or `webhook` |
87
127
 
88
128
  ### Optional Settings
89
129
 
@@ -115,7 +155,8 @@ The plugin requires the following configurations, which can be set via environme
115
155
  "settings": {
116
156
  "FARCASTER_FID": "123456",
117
157
  "FARCASTER_NEYNAR_API_KEY": "your-api-key",
118
- "FARCASTER_SIGNER_UUID": "your-signer-uuid"
158
+ "FARCASTER_SIGNER_UUID": "your-signer-uuid",
159
+ "FARCASTER_MODE": "webhook"
119
160
  }
120
161
  }
121
162
  ```
@@ -0,0 +1,4 @@
1
+ import { type TestCase } from '@elizaos/core';
2
+ export declare const farcasterE2EScenarios: TestCase[];
3
+ export default farcasterE2EScenarios;
4
+ //# sourceMappingURL=scenarios.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scenarios.d.ts","sourceRoot":"","sources":["../../../src/__tests__/e2e/scenarios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAOpF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,EAsV3C,CAAC;AAGF,eAAe,qBAAqB,CAAC"}
@@ -0,0 +1,130 @@
1
+ import { type IAgentRuntime, type TestSuite, type TestCase } from '@elizaos/core';
2
+ /**
3
+ * Represents a Test Suite for Farcaster functionality.
4
+ * This class implements the TestSuite interface.
5
+ * It contains various test cases related to Farcaster operations such as initializing the client,
6
+ * fetching profile, fetching casts, posting casts, and handling cast interactions.
7
+ */
8
+ export declare class FarcasterTestSuite implements TestSuite {
9
+ name: string;
10
+ description: string;
11
+ private manager;
12
+ tests: TestCase[];
13
+ /**
14
+ * Constructor for TestSuite class.
15
+ * Initializes an array of test functions to be executed.
16
+ */
17
+ constructor();
18
+ /**
19
+ * A wrapper for test cases that dynamically runs either a real or mock test
20
+ * based on the presence of Farcaster credentials in the agent's runtime settings.
21
+ *
22
+ * @param realTest - The test case to run if credentials are provided.
23
+ * @param mockTest - An optional mock test case to run as a fallback.
24
+ * @returns A TestCase that handles the conditional logic.
25
+ */
26
+ private credentialedOrMockTest;
27
+ /**
28
+ * Test that checks and logs the Farcaster configuration for the current agent.
29
+ */
30
+ testConfiguration(runtime: IAgentRuntime): Promise<void>;
31
+ /**
32
+ * Test that checks if Farcaster is properly configured
33
+ */
34
+ testMockConfiguration(runtime: IAgentRuntime): Promise<void>;
35
+ /**
36
+ * Test service initialization without real credentials
37
+ */
38
+ testMockServiceInit(runtime: IAgentRuntime): Promise<void>;
39
+ /**
40
+ * Asynchronously initializes the Farcaster client for the provided agent runtime.
41
+ *
42
+ * @param {IAgentRuntime} runtime - The agent runtime to use for initializing the Farcaster client.
43
+ * @throws {Error} If the Farcaster client manager is not found or if the Farcaster client fails to initialize.
44
+ */
45
+ testInitializingClient(runtime: IAgentRuntime): Promise<void>;
46
+ /**
47
+ * Asynchronously fetches the profile of a user from Farcaster using the given runtime.
48
+ *
49
+ * @param {IAgentRuntime} runtime The runtime to use for fetching the profile.
50
+ * @returns {Promise<void>} A Promise that resolves when the profile is successfully fetched, or rejects with an error.
51
+ */
52
+ testFetchProfile(runtime: IAgentRuntime): Promise<void>;
53
+ /**
54
+ * Asynchronously fetches the timeline from the Farcaster client.
55
+ *
56
+ * @param {IAgentRuntime} runtime - The agent runtime object.
57
+ * @throws {Error} If there are no casts in the timeline.
58
+ * @throws {Error} If an error occurs while fetching the timeline.
59
+ */
60
+ testFetchTimeline(runtime: IAgentRuntime): Promise<void>;
61
+ /**
62
+ * Asynchronously posts a test cast using the Farcaster API.
63
+ *
64
+ * @param {IAgentRuntime} runtime - The agent runtime object.
65
+ * @returns {Promise<void>} A Promise that resolves when the cast is successfully posted.
66
+ * @throws {Error} If there is an error posting the cast.
67
+ */
68
+ testPostCast(runtime: IAgentRuntime): Promise<void>;
69
+ /**
70
+ * Asynchronously posts an image cast on Farcaster using the provided runtime and cast content.
71
+ * Note: This might need updating based on how images are actually handled in sendCast
72
+ *
73
+ * @param {IAgentRuntime} runtime - The runtime environment for the action.
74
+ * @returns {Promise<void>} A Promise that resolves when the cast is successfully posted.
75
+ * @throws {Error} If there is an error posting the cast.
76
+ */
77
+ testPostImageCast(runtime: IAgentRuntime): Promise<void>;
78
+ /**
79
+ * Asynchronously handles a fake cast response using the given runtime.
80
+ *
81
+ * @param {IAgentRuntime} runtime - The runtime object for the agent
82
+ * @returns {Promise<void>} - A promise that resolves when the cast response is handled
83
+ * @throws {Error} - If there is an error handling the cast response
84
+ */
85
+ testHandleCastResponse(runtime: IAgentRuntime): Promise<void>;
86
+ /**
87
+ * Generates random content for a cast based on the given context.
88
+ *
89
+ * @param {IAgentRuntime} runtime - The runtime environment.
90
+ * @param {string} context - Optional context for the content generation.
91
+ * @returns {Promise<string>} A promise that resolves to the generated cast content.
92
+ */
93
+ private generateRandomCastContent;
94
+ /**
95
+ * Tests the MessageService functionality
96
+ *
97
+ * @param {IAgentRuntime} runtime - The runtime environment.
98
+ * @returns {Promise<void>} A promise that resolves when the test is complete.
99
+ */
100
+ testMessageService(runtime: IAgentRuntime): Promise<void>;
101
+ /**
102
+ * Tests the PostService functionality
103
+ *
104
+ * @param {IAgentRuntime} runtime - The runtime environment.
105
+ * @returns {Promise<void>} A promise that resolves when the test is complete.
106
+ */
107
+ testPostService(runtime: IAgentRuntime): Promise<void>;
108
+ /**
109
+ * Tests real account posting functionality
110
+ *
111
+ * @param {IAgentRuntime} runtime - The runtime environment.
112
+ * @returns {Promise<void>} A promise that resolves when the test is complete.
113
+ */
114
+ testRealAccountPosting(runtime: IAgentRuntime): Promise<void>;
115
+ /**
116
+ * Tests real account interactions (mentions, replies, etc)
117
+ *
118
+ * @param {IAgentRuntime} runtime - The runtime environment.
119
+ * @returns {Promise<void>} A promise that resolves when the test is complete.
120
+ */
121
+ testRealAccountInteractions(runtime: IAgentRuntime): Promise<void>;
122
+ /**
123
+ * Tests message metadata tracking functionality
124
+ *
125
+ * @param {IAgentRuntime} runtime - The runtime environment.
126
+ * @returns {Promise<void>} A promise that resolves when the test is complete.
127
+ */
128
+ testMessageMetadataTracking(runtime: IAgentRuntime): Promise<void>;
129
+ }
130
+ //# sourceMappingURL=suite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suite.d.ts","sourceRoot":"","sources":["../../src/__tests__/suite.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,SAAS,EAEd,KAAK,QAAQ,EACd,MAAM,eAAe,CAAC;AAQvB;;;;;GAKG;AACH,qBAAa,kBAAmB,YAAW,SAAS;IAClD,IAAI,SAA4B;IAChC,WAAW,SAAmD;IAC9D,OAAO,CAAC,OAAO,CAAsC;IACrD,KAAK,EAAE,QAAQ,EAAE,CAAC;IAElB;;;OAGG;;IA6BH;;;;;;;OAOG;IACH,OAAO,CAAC,sBAAsB;IAyB9B;;OAEG;IACG,iBAAiB,CAAC,OAAO,EAAE,aAAa;IAsB9C;;OAEG;IACG,qBAAqB,CAAC,OAAO,EAAE,aAAa;IAqBlD;;OAEG;IACG,mBAAmB,CAAC,OAAO,EAAE,aAAa;IA+BhD;;;;;OAKG;IACG,sBAAsB,CAAC,OAAO,EAAE,aAAa;IAmBnD;;;;;OAKG;IACG,gBAAgB,CAAC,OAAO,EAAE,aAAa;IAqB7C;;;;;;OAMG;IACG,iBAAiB,CAAC,OAAO,EAAE,aAAa;IAuB9C;;;;;;OAMG;IACG,YAAY,CAAC,OAAO,EAAE,aAAa;IAoBzC;;;;;;;OAOG;IACG,iBAAiB,CAAC,OAAO,EAAE,aAAa;IAwB9C;;;;;;OAMG;IACG,sBAAsB,CAAC,OAAO,EAAE,aAAa;IA+CnD;;;;;;OAMG;YACW,yBAAyB;IAcvC;;;;;OAKG;IACG,kBAAkB,CAAC,OAAO,EAAE,aAAa;IAuC/C;;;;;OAKG;IACG,eAAe,CAAC,OAAO,EAAE,aAAa;IAsC5C;;;;;OAKG;IACG,sBAAsB,CAAC,OAAO,EAAE,aAAa;IA0CnD;;;;;OAKG;IACG,2BAA2B,CAAC,OAAO,EAAE,aAAa;IAoDxD;;;;;OAKG;IACG,2BAA2B,CAAC,OAAO,EAAE,aAAa;CA4CzD"}
@@ -0,0 +1,29 @@
1
+ import type { FarcasterClient } from '../client';
2
+ import type { Cast, Profile } from '../common/types';
3
+ import type { TestInteraction } from './types';
4
+ export declare function createTestInteraction(cast: Cast, profile: Profile): TestInteraction | null;
5
+ export declare function handleTestInteraction(client: FarcasterClient, interaction: TestInteraction): Promise<{
6
+ success: boolean;
7
+ cast: {
8
+ hash: string;
9
+ text: string;
10
+ parent_hash: string;
11
+ timestamp: string;
12
+ };
13
+ }>;
14
+ export declare function createTestCast(client: FarcasterClient, content: string): Promise<{
15
+ success: boolean;
16
+ cast: NeynarCast;
17
+ }>;
18
+ export declare const TEST_IMAGE_URL = "https://github.com/elizaOS/awesome-eliza/blob/main/assets/eliza-logo.jpg?raw=true";
19
+ export declare const TEST_IMAGE: {
20
+ id: string;
21
+ text: string;
22
+ description: string;
23
+ source: string;
24
+ url: string;
25
+ title: string;
26
+ contentType: string;
27
+ alt_text: string;
28
+ };
29
+ //# sourceMappingURL=test-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../src/__tests__/test-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CA+B1F;AAED,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,eAAe;;;;;;;;GAuBhG;AAED,wBAAsB,cAAc,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM;;;GAc5E;AAED,eAAO,MAAM,cAAc,sFAC0D,CAAC;AAEtF,eAAO,MAAM,UAAU;;;;;;;;;CAStB,CAAC"}
@@ -0,0 +1,88 @@
1
+ export interface TestInteraction {
2
+ type: 'RECAST' | 'REPLY' | 'LIKE';
3
+ castId?: string;
4
+ content?: string;
5
+ }
6
+ export interface TestCast {
7
+ hash: string;
8
+ text: string;
9
+ username: string;
10
+ fid: string;
11
+ timestamp: number;
12
+ threadHash: string;
13
+ permanentUrl: string;
14
+ photos: any[];
15
+ hashtags: string[];
16
+ mentions: string[];
17
+ thread: any[];
18
+ urls: string[];
19
+ videos: any[];
20
+ }
21
+ export interface TestImage {
22
+ id: string;
23
+ text: string;
24
+ description: string;
25
+ source: string;
26
+ url: string;
27
+ title: string;
28
+ contentType: string;
29
+ alt_text: string;
30
+ }
31
+ export declare enum ServiceType {
32
+ FARCASTER = "farcaster"
33
+ }
34
+ export interface CastId {
35
+ hash: string;
36
+ fid: string;
37
+ }
38
+ export interface CastStats {
39
+ recasts: number;
40
+ replies: number;
41
+ likes: number;
42
+ }
43
+ export interface Profile {
44
+ fid: string;
45
+ username: string;
46
+ name: string;
47
+ pfp: string;
48
+ }
49
+ export interface Cast {
50
+ hash: string;
51
+ authorFid: string;
52
+ text: string;
53
+ timestamp: Date;
54
+ profile: Profile;
55
+ stats: CastStats;
56
+ }
57
+ export interface FarcasterClient {
58
+ client: {
59
+ fetchProfile: (username: string) => Promise<Profile>;
60
+ fetchUserCasts: (fid: string, limit: number) => Promise<Cast[]>;
61
+ fetchFeed: (limit: number) => Promise<Cast[]>;
62
+ fetchOwnCasts: (limit: number) => Promise<Cast[]>;
63
+ };
64
+ post: {
65
+ postCast: (runtime: any, client: any, text: string, roomId: string, content: string, username: string, media?: any[]) => Promise<void>;
66
+ generateNewCast: () => Promise<void>;
67
+ };
68
+ interaction: {
69
+ handleCast: (params: {
70
+ cast: Cast;
71
+ message: any;
72
+ thread: any[];
73
+ }) => Promise<void>;
74
+ };
75
+ publishCast: (text: string, parent?: CastId) => Promise<{
76
+ success: boolean;
77
+ cast: {
78
+ hash: string;
79
+ author: {
80
+ fid: string;
81
+ };
82
+ text: string;
83
+ timestamp: string;
84
+ parent_hash?: string;
85
+ };
86
+ }>;
87
+ }
88
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/__tests__/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,MAAM,EAAE,GAAG,EAAE,CAAC;CACf;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,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EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,GAAG,EAAE,KACV,OAAO,CAAC,IAAI,CAAC,CAAC;QACnB,eAAe,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;KACtC,CAAC;IACF,WAAW,EAAE;QACX,UAAU,EAAE,CAAC,MAAM,EAAE;YAAE,IAAI,EAAE,IAAI,CAAC;YAAC,OAAO,EAAE,GAAG,CAAC;YAAC,MAAM,EAAE,GAAG,EAAE,CAAA;SAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;KACpF,CAAC;IACF,WAAW,EAAE,CACX,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,MAAM,KACZ,OAAO,CAAC;QACX,OAAO,EAAE,OAAO,CAAC;QACjB,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM,CAAC;YACb,MAAM,EAAE;gBAAE,GAAG,EAAE,MAAM,CAAA;aAAE,CAAC;YACxB,IAAI,EAAE,MAAM,CAAC;YACb,SAAS,EAAE,MAAM,CAAC;YAClB,WAAW,CAAC,EAAE,MAAM,CAAC;SACtB,CAAC;KACH,CAAC,CAAC;CACJ"}
@@ -0,0 +1,4 @@
1
+ export { sendCastAction } from './sendCast';
2
+ export { replyCastAction } from './replyCast';
3
+ export declare const farcasterActions: any[];
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAM9C,eAAO,MAAM,gBAAgB,OAAoC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Action } from '@elizaos/core';
2
+ export declare const replyCastAction: Action;
3
+ //# sourceMappingURL=replyCast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replyCast.d.ts","sourceRoot":"","sources":["../../src/actions/replyCast.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EAKZ,MAAM,eAAe,CAAC;AAKvB,eAAO,MAAM,eAAe,EAAE,MA0G7B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Action } from '@elizaos/core';
2
+ export declare const sendCastAction: Action;
3
+ //# sourceMappingURL=sendCast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendCast.d.ts","sourceRoot":"","sources":["../../src/actions/sendCast.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EAKZ,MAAM,eAAe,CAAC;AAIvB,eAAO,MAAM,cAAc,EAAE,MA4G5B,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { Content } from '@elizaos/core';
2
+ import { type NeynarAPIClient } from '@neynar/nodejs-sdk';
3
+ import { Cast as NeynarCast } from '@neynar/nodejs-sdk/build/api';
4
+ import type { Cast, CastId, FidRequest, Profile } from './common/types';
5
+ export declare class FarcasterClient {
6
+ private neynar;
7
+ private signerUuid;
8
+ constructor(opts: {
9
+ neynar: NeynarAPIClient;
10
+ signerUuid: string;
11
+ });
12
+ sendCast({ content, inReplyTo, }: {
13
+ content: Content;
14
+ inReplyTo?: CastId;
15
+ }): Promise<NeynarCast[]>;
16
+ private publishCast;
17
+ getCast(castHash: string): Promise<NeynarCast>;
18
+ getMentions(request: FidRequest): Promise<NeynarCast[]>;
19
+ getProfile(fid: number): Promise<Profile>;
20
+ getTimeline(request: FidRequest): Promise<{
21
+ timeline: Cast[];
22
+ cursor?: string;
23
+ }>;
24
+ clearCache(): void;
25
+ }
26
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAe,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAIlE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAexE,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,UAAU,CAAS;gBACf,IAAI,EAAE;QAAE,MAAM,EAAE,eAAe,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE;IAK3D,QAAQ,CAAC,EACb,OAAO,EACP,SAAS,GACV,EAAE;QACD,OAAO,EAAE,OAAO,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;YAgBX,WAAW;IAsBnB,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAY9C,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAkBvD,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAkCzC,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC;QAC9C,QAAQ,EAAE,IAAI,EAAE,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IAqBF,UAAU,IAAI,IAAI;CAInB"}
@@ -0,0 +1,13 @@
1
+ export declare class AsyncQueue {
2
+ private queue;
3
+ private running;
4
+ private emptyListeners;
5
+ private maxConcurrent;
6
+ constructor(maxConcurrent?: number);
7
+ submit<T>(work: () => Promise<T>): Promise<T>;
8
+ private doNextWork;
9
+ size(): Promise<number>;
10
+ waitUntilFinished(): Promise<void>;
11
+ private checkIfEmptyAndNotify;
12
+ }
13
+ //# sourceMappingURL=asyncqueue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asyncqueue.d.ts","sourceRoot":"","sources":["../../src/common/asyncqueue.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAU;IACrB,OAAO,CAAC,KAAK,CAA+B;IAC5C,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,cAAc,CAAsB;IAC5C,OAAO,CAAC,aAAa,CAAS;gBAElB,aAAa,GAAE,MAAU;IAI/B,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;YAarC,UAAU;IAsBlB,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;IAIvB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAUxC,OAAO,CAAC,qBAAqB;CAQ9B"}
@@ -0,0 +1,14 @@
1
+ import { HandlerCallback, IAgentRuntime, Memory, UUID } from '@elizaos/core';
2
+ import { Cast as NeynarCast } from '@neynar/nodejs-sdk/build/api';
3
+ import { FarcasterClient } from '../client';
4
+ import { CastId, FarcasterConfig } from './types';
5
+ export declare function standardCastHandlerCallback({ client, runtime, config, roomId, onCompletion, onError, inReplyTo, }: {
6
+ inReplyTo?: CastId;
7
+ client: FarcasterClient;
8
+ runtime: IAgentRuntime;
9
+ config: FarcasterConfig;
10
+ roomId: UUID;
11
+ onCompletion?: (casts: NeynarCast[], memories: Memory[]) => Promise<void>;
12
+ onError?: (error: unknown) => Promise<void>;
13
+ }): HandlerCallback;
14
+ //# sourceMappingURL=callbacks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callbacks.d.ts","sourceRoot":"","sources":["../../src/common/callbacks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,eAAe,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAGlD,wBAAgB,2BAA2B,CAAC,EAC1C,MAAM,EACN,OAAO,EACP,MAAM,EACN,MAAM,EACN,YAAY,EACZ,OAAO,EACP,SAAS,GACV,EAAE;IACD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,aAAa,CAAC;IACvB,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE,IAAI,CAAC;IACb,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1E,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C,GAAG,eAAe,CAqDlB"}
@@ -0,0 +1,24 @@
1
+ import { type IAgentRuntime } from '@elizaos/core';
2
+ import { FarcasterConfig } from './types';
3
+ /**
4
+ * Gets the Farcaster FID from runtime settings.
5
+ * Uses getSetting which already prioritizes: character.secrets -> character.settings -> env vars
6
+ */
7
+ export declare function getFarcasterFid(runtime: IAgentRuntime): number | null;
8
+ /**
9
+ * Checks if Farcaster is properly configured for this runtime.
10
+ * getSetting already handles priority: character.secrets -> character.settings -> env vars
11
+ */
12
+ export declare function hasFarcasterEnabled(runtime: IAgentRuntime): boolean;
13
+ /**
14
+ * Constructs and validates a Farcaster configuration object using runtime settings and environment variables.
15
+ *
16
+ * Retrieves configuration values for the Farcaster client, applying defaults where necessary, and validates them against the {@link FarcasterConfigSchema}. Throws a detailed error if validation fails.
17
+ *
18
+ * @param runtime - The runtime environment providing configuration settings.
19
+ * @returns The validated {@link FarcasterConfig} object.
20
+ *
21
+ * @throws {Error} If configuration validation fails, with details about each invalid field.
22
+ */
23
+ export declare function validateFarcasterConfig(runtime: IAgentRuntime): FarcasterConfig;
24
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/common/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAQzE,OAAO,EAAE,eAAe,EAAyB,MAAM,SAAS,CAAC;AAQjE;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,GAAG,IAAI,CAKrE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAUnE;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,aAAa,GAAG,eAAe,CAsG/E"}
@@ -0,0 +1,9 @@
1
+ export declare const FARCASTER_SERVICE_NAME = "farcaster";
2
+ export declare const FARCASTER_SOURCE = "farcaster";
3
+ export declare const DEFAULT_MAX_CAST_LENGTH = 320;
4
+ export declare const DEFAULT_POLL_INTERVAL = 120;
5
+ export declare const DEFAULT_CAST_INTERVAL_MIN = 90;
6
+ export declare const DEFAULT_CAST_INTERVAL_MAX = 180;
7
+ export declare const DEFAULT_CAST_CACHE_TTL: number;
8
+ export declare const DEFAULT_CAST_CACHE_SIZE = 9000;
9
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,cAAc,CAAC;AAClD,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAC5C,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAC3C,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAC5C,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAC7C,eAAO,MAAM,sBAAsB,QAAiB,CAAC;AACrD,eAAO,MAAM,uBAAuB,OAAO,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { type Character } from '@elizaos/core';
2
+ import type { Cast } from './types';
3
+ export declare const formatCast: (cast: Cast) => string;
4
+ export declare const formatTimeline: (character: Character, timeline: Cast[]) => string;
5
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/common/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,eAAO,MAAM,UAAU,GAAI,MAAM,IAAI,WAIpC,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,WAAW,SAAS,EACpB,UAAU,IAAI,EAAE,WAGjB,CAAC"}
@@ -0,0 +1,106 @@
1
+ import { type Media, Memory, MessagePayload } from '@elizaos/core';
2
+ import { Cast as NeynarCast, Embed as NeynarEmbed } from '@neynar/nodejs-sdk/build/api';
3
+ import { z } from 'zod';
4
+ export type Profile = {
5
+ fid: number;
6
+ name: string;
7
+ username: string;
8
+ pfp?: string;
9
+ bio?: string;
10
+ url?: string;
11
+ };
12
+ /**
13
+ * Embed types that can be attached to a cast
14
+ */
15
+ export type CastEmbed = {
16
+ /** Type of embed: image, video, url, cast (quote), frame */
17
+ type: 'image' | 'video' | 'audio' | 'url' | 'cast' | 'frame' | 'unknown';
18
+ /** URL of the embedded content */
19
+ url: string;
20
+ /** For embedded casts, the cast hash */
21
+ castHash?: string;
22
+ /** Metadata about the embed from Neynar */
23
+ metadata?: {
24
+ contentType?: string;
25
+ width?: number;
26
+ height?: number;
27
+ duration?: number;
28
+ title?: string;
29
+ description?: string;
30
+ authorFid?: number;
31
+ authorUsername?: string;
32
+ };
33
+ };
34
+ export type Cast = {
35
+ hash: string;
36
+ authorFid: number;
37
+ text: string;
38
+ profile: Profile;
39
+ threadId?: string;
40
+ inReplyTo?: {
41
+ hash: string;
42
+ fid: number;
43
+ };
44
+ timestamp: Date;
45
+ stats?: {
46
+ recasts: number;
47
+ replies: number;
48
+ likes: number;
49
+ };
50
+ /** Raw embeds from Neynar API */
51
+ embeds?: NeynarEmbed[];
52
+ /** Processed media attachments ready for elizaos Memory */
53
+ media?: Media[];
54
+ };
55
+ export type CastId = {
56
+ hash: string;
57
+ fid: number;
58
+ };
59
+ export type FidRequest = {
60
+ fid: number;
61
+ pageSize: number;
62
+ };
63
+ export interface LastCast {
64
+ hash: string;
65
+ timestamp: number;
66
+ }
67
+ /**
68
+ * This schema defines all required/optional environment settings for Farcaster client
69
+ */
70
+ export declare const FarcasterConfigSchema: any;
71
+ export type FarcasterConfig = z.infer<typeof FarcasterConfigSchema>;
72
+ export declare enum FarcasterEventTypes {
73
+ CAST_GENERATED = "FARCASTER_CAST_GENERATED",
74
+ MENTION_RECEIVED = "FARCASTER_MENTION_RECEIVED",
75
+ THREAD_CAST_CREATED = "FARCASTER_THREAD_CAST_CREATED"
76
+ }
77
+ export declare enum FarcasterMessageType {
78
+ CAST = "CAST",
79
+ REPLY = "REPLY"
80
+ }
81
+ export interface FarcasterGenericCastPayload extends Omit<MessagePayload, 'message'> {
82
+ memory: Memory;
83
+ cast: NeynarCast;
84
+ }
85
+ /**
86
+ * Neynar webhook data structure for cast events
87
+ */
88
+ export interface NeynarWebhookData {
89
+ type: string;
90
+ data?: {
91
+ hash: string;
92
+ text?: string;
93
+ author: {
94
+ fid: number;
95
+ username?: string;
96
+ };
97
+ mentioned_profiles?: Array<{
98
+ fid: number;
99
+ }>;
100
+ parent_hash?: string;
101
+ parent_author?: {
102
+ fid: number;
103
+ };
104
+ };
105
+ }
106
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGnE,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,K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,kBAAkB,CAAC,EAAE,KAAK,CAAC;YAAE,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,aAAa,CAAC,EAAE;YAAE,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC;KACjC,CAAC;CACH"}
@@ -0,0 +1,28 @@
1
+ import { IAgentRuntime, Memory, UUID } from '@elizaos/core';
2
+ import { Cast as NeynarCast } from '@neynar/nodejs-sdk/build/api';
3
+ import { Cast } from './types';
4
+ export declare const MAX_CAST_LENGTH = 1024;
5
+ export declare function castId({ hash, agentId }: {
6
+ hash: string;
7
+ agentId: string;
8
+ }): string;
9
+ export declare function castUuid(props: {
10
+ hash: string;
11
+ agentId: string;
12
+ }): any;
13
+ export declare function splitPostContent(content: string, maxLength?: number): string[];
14
+ export declare function splitParagraph(paragraph: string, maxLength: number): string[];
15
+ export declare function lastCastCacheKey(fid: number): string;
16
+ /**
17
+ * Convert a Neynar Cast to our internal Cast type
18
+ * Now includes embeds from the original cast for media processing
19
+ */
20
+ export declare function neynarCastToCast(neynarCast: NeynarCast): Cast;
21
+ export declare function createCastMemory({ roomId, senderId, runtime, cast, }: {
22
+ roomId: UUID;
23
+ senderId: UUID;
24
+ runtime: IAgentRuntime;
25
+ cast: Cast;
26
+ }): Memory;
27
+ export declare function formatCastTimestamp(timestamp: Date): string;
28
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/common/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAgB,IAAI,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAElE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,eAAO,MAAM,eAAe,OAAO,CAAC;AAEpC,wBAAgB,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,UAE1E;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,OAEhE;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,GAAE,MAAwB,GAAG,MAAM,EAAE,CAkC/F;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CA6C7E;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,UAE3C;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAyB7D;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,QAAQ,EACR,OAAO,EACP,IAAI,GACL,EAAE;IACD,MAAM,EAAE,IAAI,CAAC;IACb,QAAQ,EAAE,IAAI,CAAC;IACf,OAAO,EAAE,aAAa,CAAC;IACvB,IAAI,EAAE,IAAI,CAAC;CACZ,GAAG,MAAM,CA2BT;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,IAAI,GAAG,MAAM,CAO3D"}