@bubblelab/bubble-core 0.1.9 → 0.1.10

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 (186) hide show
  1. package/dist/bubble-bundle.d.ts +252 -1686
  2. package/dist/bubble-factory.d.ts.map +1 -1
  3. package/dist/bubble-factory.js +51 -19
  4. package/dist/bubble-factory.js.map +1 -1
  5. package/dist/bubble-flow/bubble-flow-class.d.ts +17 -1
  6. package/dist/bubble-flow/bubble-flow-class.d.ts.map +1 -1
  7. package/dist/bubble-flow/bubble-flow-class.js +16 -0
  8. package/dist/bubble-flow/bubble-flow-class.js.map +1 -1
  9. package/dist/bubble-flow/sample/data-analyst-flow.d.ts +1 -1
  10. package/dist/bubble-flow/sample/data-analyst-flow.d.ts.map +1 -1
  11. package/dist/bubble-flow/sample/error-ts.d.ts +1 -1
  12. package/dist/bubble-flow/sample/error-ts.d.ts.map +1 -1
  13. package/dist/bubble-flow/sample/sanitytest.d.ts +1 -1
  14. package/dist/bubble-flow/sample/sanitytest.d.ts.map +1 -1
  15. package/dist/bubble-flow/sample/simple-webhook-2.d.ts +1 -1
  16. package/dist/bubble-flow/sample/simple-webhook-2.d.ts.map +1 -1
  17. package/dist/bubble-flow/sample/simple-webhook.d.ts +1 -1
  18. package/dist/bubble-flow/sample/simple-webhook.d.ts.map +1 -1
  19. package/dist/bubble-flow/sample/simplified-data-analysis.flow.d.ts +1 -1
  20. package/dist/bubble-flow/sample/simplified-data-analysis.flow.d.ts.map +1 -1
  21. package/dist/bubble-flow/sample/slack-v0.1.d.ts +1 -1
  22. package/dist/bubble-flow/sample/slack-v0.1.d.ts.map +1 -1
  23. package/dist/bubble-flow/sample/slackagenttest.d.ts +1 -1
  24. package/dist/bubble-flow/sample/slackagenttest.d.ts.map +1 -1
  25. package/dist/bubbles/service-bubble/ai-agent.d.ts +30 -30
  26. package/dist/bubbles/service-bubble/ai-agent.d.ts.map +1 -1
  27. package/dist/bubbles/service-bubble/ai-agent.js +3 -1
  28. package/dist/bubbles/service-bubble/ai-agent.js.map +1 -1
  29. package/dist/bubbles/service-bubble/apify/actors/instagram-hashtag-scraper.d.ts +34 -34
  30. package/dist/bubbles/service-bubble/apify/actors/instagram-scraper.d.ts +42 -42
  31. package/dist/bubbles/service-bubble/apify/actors/linkedin-posts-search.d.ts +21 -21
  32. package/dist/bubbles/service-bubble/apify/actors/linkedin-profile-posts.d.ts +6 -6
  33. package/dist/bubbles/service-bubble/apify/actors/youtube-scraper.d.ts +184 -0
  34. package/dist/bubbles/service-bubble/apify/actors/youtube-scraper.d.ts.map +1 -0
  35. package/dist/bubbles/service-bubble/apify/actors/youtube-scraper.js +145 -0
  36. package/dist/bubbles/service-bubble/apify/actors/youtube-scraper.js.map +1 -0
  37. package/dist/bubbles/service-bubble/apify/actors/youtube-transcript-scraper.d.ts +52 -0
  38. package/dist/bubbles/service-bubble/apify/actors/youtube-transcript-scraper.d.ts.map +1 -0
  39. package/dist/bubbles/service-bubble/apify/actors/youtube-transcript-scraper.js +29 -0
  40. package/dist/bubbles/service-bubble/apify/actors/youtube-transcript-scraper.js.map +1 -0
  41. package/dist/bubbles/service-bubble/apify/apify-scraper.schema.d.ts +338 -109
  42. package/dist/bubbles/service-bubble/apify/apify-scraper.schema.d.ts.map +1 -1
  43. package/dist/bubbles/service-bubble/apify/apify-scraper.schema.js +16 -0
  44. package/dist/bubbles/service-bubble/apify/apify-scraper.schema.js.map +1 -1
  45. package/dist/bubbles/service-bubble/apify/apify.d.ts +10 -10
  46. package/dist/bubbles/service-bubble/apify/index.d.ts +2 -0
  47. package/dist/bubbles/service-bubble/apify/index.d.ts.map +1 -1
  48. package/dist/bubbles/service-bubble/apify/index.js +3 -0
  49. package/dist/bubbles/service-bubble/apify/index.js.map +1 -1
  50. package/dist/bubbles/service-bubble/apify/types.js +1 -2
  51. package/dist/bubbles/service-bubble/apify/types.js.map +1 -1
  52. package/dist/bubbles/service-bubble/gmail.d.ts +678 -184
  53. package/dist/bubbles/service-bubble/gmail.d.ts.map +1 -1
  54. package/dist/bubbles/service-bubble/gmail.js +435 -7
  55. package/dist/bubbles/service-bubble/gmail.js.map +1 -1
  56. package/dist/bubbles/service-bubble/google-calendar.d.ts +60 -60
  57. package/dist/bubbles/service-bubble/google-drive.d.ts +301 -72
  58. package/dist/bubbles/service-bubble/google-drive.d.ts.map +1 -1
  59. package/dist/bubbles/service-bubble/google-drive.js +65 -75
  60. package/dist/bubbles/service-bubble/google-drive.js.map +1 -1
  61. package/dist/bubbles/service-bubble/google-sheets.d.ts +76 -76
  62. package/dist/bubbles/service-bubble/hello-world.d.ts +4 -4
  63. package/dist/bubbles/service-bubble/hello-world.js +2 -2
  64. package/dist/bubbles/service-bubble/hello-world.js.map +1 -1
  65. package/dist/bubbles/service-bubble/http.d.ts +10 -10
  66. package/dist/bubbles/service-bubble/postgresql.d.ts +12 -12
  67. package/dist/bubbles/service-bubble/resend.d.ts +16 -16
  68. package/dist/bubbles/service-bubble/slack.d.ts +469 -469
  69. package/dist/bubbles/service-bubble/storage.d.ts +36 -36
  70. package/dist/bubbles/service-bubble/storage.d.ts.map +1 -1
  71. package/dist/bubbles/service-bubble/storage.js +16 -5
  72. package/dist/bubbles/service-bubble/storage.js.map +1 -1
  73. package/dist/bubbles/service-bubble/x-twitter.d.ts +814 -0
  74. package/dist/bubbles/service-bubble/x-twitter.d.ts.map +1 -0
  75. package/dist/bubbles/service-bubble/x-twitter.js +445 -0
  76. package/dist/bubbles/service-bubble/x-twitter.js.map +1 -0
  77. package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts +20 -20
  78. package/dist/bubbles/tool-bubble/chart-js-tool.d.ts +10 -10
  79. package/dist/bubbles/tool-bubble/get-bubble-details-tool.d.ts.map +1 -1
  80. package/dist/bubbles/tool-bubble/get-bubble-details-tool.js +17 -9
  81. package/dist/bubbles/tool-bubble/get-bubble-details-tool.js.map +1 -1
  82. package/dist/bubbles/tool-bubble/instagram-tool.d.ts +86 -86
  83. package/dist/bubbles/tool-bubble/linkedin-tool.d.ts +134 -134
  84. package/dist/bubbles/tool-bubble/reddit-scrape-tool.d.ts +69 -64
  85. package/dist/bubbles/tool-bubble/reddit-scrape-tool.d.ts.map +1 -1
  86. package/dist/bubbles/tool-bubble/reddit-scrape-tool.js +97 -22
  87. package/dist/bubbles/tool-bubble/reddit-scrape-tool.js.map +1 -1
  88. package/dist/bubbles/tool-bubble/research-agent-tool.d.ts +6 -6
  89. package/dist/bubbles/tool-bubble/research-agent-tool.js +4 -4
  90. package/dist/bubbles/tool-bubble/research-agent-tool.js.map +1 -1
  91. package/dist/bubbles/tool-bubble/sql-query-tool.d.ts +8 -8
  92. package/dist/bubbles/tool-bubble/tool-template.d.ts +8 -8
  93. package/dist/bubbles/tool-bubble/web-crawl-tool.d.ts +10 -10
  94. package/dist/bubbles/tool-bubble/web-extract-tool.d.ts +4 -4
  95. package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts +12 -12
  96. package/dist/bubbles/tool-bubble/web-search-tool.d.ts +11 -10
  97. package/dist/bubbles/tool-bubble/web-search-tool.d.ts.map +1 -1
  98. package/dist/bubbles/tool-bubble/web-search-tool.js +5 -1
  99. package/dist/bubbles/tool-bubble/web-search-tool.js.map +1 -1
  100. package/dist/bubbles/tool-bubble/youtube-tool.d.ts +394 -0
  101. package/dist/bubbles/tool-bubble/youtube-tool.d.ts.map +1 -0
  102. package/dist/bubbles/tool-bubble/youtube-tool.js +352 -0
  103. package/dist/bubbles/tool-bubble/youtube-tool.js.map +1 -0
  104. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.d.ts +47 -36
  105. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.d.ts.map +1 -1
  106. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.js +91 -65
  107. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.js.map +1 -1
  108. package/dist/bubbles/workflow-bubble/database-analyzer.workflow.d.ts +4 -4
  109. package/dist/bubbles/workflow-bubble/generate-document.workflow.d.ts +70 -70
  110. package/dist/bubbles/workflow-bubble/parse-document.workflow.d.ts +66 -66
  111. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts +56 -56
  112. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts.map +1 -1
  113. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.js.map +1 -1
  114. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.d.ts +44 -44
  115. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.d.ts.map +1 -1
  116. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.js +1 -1
  117. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.js.map +1 -1
  118. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.d.ts +32 -32
  119. package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts +58 -58
  120. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.d.ts +18 -18
  121. package/dist/bubbles.json +69 -54
  122. package/dist/index.d.ts +4 -2
  123. package/dist/index.d.ts.map +1 -1
  124. package/dist/index.js +2 -1
  125. package/dist/index.js.map +1 -1
  126. package/dist/logging/BubbleLogger.d.ts.map +1 -1
  127. package/dist/logging/BubbleLogger.js +20 -13
  128. package/dist/logging/BubbleLogger.js.map +1 -1
  129. package/dist/logging/StreamingBubbleLogger.d.ts.map +1 -1
  130. package/dist/logging/StreamingBubbleLogger.js +5 -5
  131. package/dist/logging/StreamingBubbleLogger.js.map +1 -1
  132. package/dist/test-gm.d.ts +10 -0
  133. package/dist/test-gm.d.ts.map +1 -0
  134. package/dist/test-gm.js +95 -0
  135. package/dist/test-gm.js.map +1 -0
  136. package/dist/types/base-bubble-class.d.ts +1 -1
  137. package/dist/types/base-bubble-class.d.ts.map +1 -1
  138. package/dist/types/base-bubble-class.js +29 -21
  139. package/dist/types/base-bubble-class.js.map +1 -1
  140. package/dist/types/bubble.d.ts +1 -10
  141. package/dist/types/bubble.d.ts.map +1 -1
  142. package/dist/types/bubble.js +1 -1
  143. package/dist/types/bubble.js.map +1 -1
  144. package/dist/types/service-bubble-class.d.ts +1 -1
  145. package/dist/types/service-bubble-class.d.ts.map +1 -1
  146. package/dist/types/tool-bubble-class.d.ts +1 -1
  147. package/dist/types/tool-bubble-class.d.ts.map +1 -1
  148. package/dist/types/tool-bubble-class.js +0 -2
  149. package/dist/types/tool-bubble-class.js.map +1 -1
  150. package/dist/types/workflow-bubble-class.d.ts +1 -1
  151. package/dist/types/workflow-bubble-class.d.ts.map +1 -1
  152. package/dist/utils/agent-formatter.d.ts.map +1 -1
  153. package/dist/utils/agent-formatter.js +2 -2
  154. package/dist/utils/agent-formatter.js.map +1 -1
  155. package/dist/utils/bubbleflow-validation.d.ts.map +1 -1
  156. package/dist/utils/bubbleflow-validation.js +89 -32
  157. package/dist/utils/bubbleflow-validation.js.map +1 -1
  158. package/dist/utils/error-sanitizer.d.ts +12 -0
  159. package/dist/utils/error-sanitizer.d.ts.map +1 -0
  160. package/dist/utils/error-sanitizer.js +77 -0
  161. package/dist/utils/error-sanitizer.js.map +1 -0
  162. package/package.json +4 -4
  163. package/dist/bubble-trigger/index.d.ts +0 -2
  164. package/dist/bubble-trigger/index.d.ts.map +0 -1
  165. package/dist/bubble-trigger/index.js +0 -2
  166. package/dist/bubble-trigger/index.js.map +0 -1
  167. package/dist/bubble-trigger/types.d.ts +0 -87
  168. package/dist/bubble-trigger/types.d.ts.map +0 -1
  169. package/dist/bubble-trigger/types.js +0 -14
  170. package/dist/bubble-trigger/types.js.map +0 -1
  171. package/dist/bubbles/service-bubble/apify/api-scraper.schema.d.ts +0 -370
  172. package/dist/bubbles/service-bubble/apify/api-scraper.schema.d.ts.map +0 -1
  173. package/dist/bubbles/service-bubble/apify/api-scraper.schema.js +0 -14
  174. package/dist/bubbles/service-bubble/apify/api-scraper.schema.js.map +0 -1
  175. package/dist/bubbles/service-bubble/apify.d.ts +0 -136
  176. package/dist/bubbles/service-bubble/apify.d.ts.map +0 -1
  177. package/dist/bubbles/service-bubble/apify.js +0 -282
  178. package/dist/bubbles/service-bubble/apify.js.map +0 -1
  179. package/dist/types/ai-models.d.ts +0 -4
  180. package/dist/types/ai-models.d.ts.map +0 -1
  181. package/dist/types/ai-models.js +0 -20
  182. package/dist/types/ai-models.js.map +0 -1
  183. package/dist/types/api-scraper.schema.d.ts +0 -453
  184. package/dist/types/api-scraper.schema.d.ts.map +0 -1
  185. package/dist/types/api-scraper.schema.js +0 -160
  186. package/dist/types/api-scraper.schema.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"x-twitter.d.ts","sourceRoot":"","sources":["../../../src/bubbles/service-bubble/x-twitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AA6C3D,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2ExB,CAAC;AAGH,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAsCxB,CAAC;AAEH,KAAK,cAAc,GAAG,CAAC,CAAC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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAAwB;IACpD,MAAM,CAAC,QAAQ,CAAC,gBAAgB,8CAA8C;IAC9E,MAAM,CAAC,QAAQ,CAAC,eAAe,iVAY7B;IACF,MAAM,CAAC,QAAQ,CAAC,KAAK,aAAa;gBAEhC,MAAM,GAAE,CAEF,EACN,OAAO,CAAC,EAAE,aAAa;IAKZ,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;YAsBjC,qBAAqB;cAmCnB,aAAa,CAC3B,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,OAAO,CAAC,cAAc,EAAE;QAAE,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,CAAA;KAAE,CAAC,CAAC;YAgCpD,SAAS;YAqET,QAAQ;YA6CR,WAAW;YAwDX,aAAa;IAkE3B,SAAS,CAAC,gBAAgB,IAAI,MAAM,GAAG,SAAS;CAYjD"}
@@ -0,0 +1,445 @@
1
+ import { z } from 'zod';
2
+ import { ServiceBubble } from '../../types/service-bubble-class.js';
3
+ import { CredentialType } from '@bubblelab/shared-schemas';
4
+ // Define tweet schema
5
+ const TweetSchema = z
6
+ .object({
7
+ id: z.string().describe('Unique tweet identifier'),
8
+ text: z.string().describe('Tweet content'),
9
+ author_id: z.string().optional().describe('Author user ID'),
10
+ created_at: z
11
+ .string()
12
+ .optional()
13
+ .describe('Creation time in ISO 8601 format'),
14
+ public_metrics: z
15
+ .object({
16
+ retweet_count: z.number().optional(),
17
+ like_count: z.number().optional(),
18
+ reply_count: z.number().optional(),
19
+ quote_count: z.number().optional(),
20
+ })
21
+ .optional()
22
+ .describe('Public engagement metrics'),
23
+ })
24
+ .describe('X (Twitter) tweet metadata');
25
+ // Define user schema
26
+ const UserSchema = z
27
+ .object({
28
+ id: z.string().describe('Unique user identifier'),
29
+ name: z.string().describe('User display name'),
30
+ username: z.string().describe('User handle (without @)'),
31
+ description: z.string().optional().describe('User bio'),
32
+ public_metrics: z
33
+ .object({
34
+ followers_count: z.number().optional(),
35
+ following_count: z.number().optional(),
36
+ tweet_count: z.number().optional(),
37
+ listed_count: z.number().optional(),
38
+ })
39
+ .optional()
40
+ .describe('Public user metrics'),
41
+ verified: z.boolean().optional().describe('Whether user is verified'),
42
+ })
43
+ .describe('X (Twitter) user metadata');
44
+ // Define the parameters schema for X Twitter operations
45
+ const XTwitterParamsSchema = z.discriminatedUnion('operation', [
46
+ // Post tweet operation
47
+ z.object({
48
+ operation: z.literal('post_tweet').describe('Post a new tweet'),
49
+ text: z
50
+ .string()
51
+ .min(1, 'Tweet text is required')
52
+ .max(280, 'Tweet text cannot exceed 280 characters')
53
+ .describe('Tweet content (max 280 characters)'),
54
+ reply_to_tweet_id: z
55
+ .string()
56
+ .optional()
57
+ .describe('ID of tweet to reply to (for replies)'),
58
+ credentials: z
59
+ .record(z.nativeEnum(CredentialType), z.string())
60
+ .optional()
61
+ .describe('Object mapping credential types to values (injected at runtime)'),
62
+ }),
63
+ // Get tweet operation
64
+ z.object({
65
+ operation: z.literal('get_tweet').describe('Get a tweet by ID'),
66
+ tweet_id: z
67
+ .string()
68
+ .min(1, 'Tweet ID is required')
69
+ .describe('X (Twitter) tweet ID'),
70
+ credentials: z
71
+ .record(z.nativeEnum(CredentialType), z.string())
72
+ .optional()
73
+ .describe('Object mapping credential types to values (injected at runtime)'),
74
+ }),
75
+ // Get user info operation
76
+ z.object({
77
+ operation: z
78
+ .literal('get_user_info')
79
+ .describe('Get user information by username or ID'),
80
+ username: z.string().optional().describe('Username (without @) to look up'),
81
+ user_id: z.string().optional().describe('User ID to look up'),
82
+ credentials: z
83
+ .record(z.nativeEnum(CredentialType), z.string())
84
+ .optional()
85
+ .describe('Object mapping credential types to values (injected at runtime)'),
86
+ }),
87
+ // Get user tweets operation
88
+ z.object({
89
+ operation: z
90
+ .literal('get_user_tweets')
91
+ .describe("Get a user's recent tweets"),
92
+ username: z
93
+ .string()
94
+ .optional()
95
+ .describe('Username (without @) to get tweets for'),
96
+ user_id: z.string().optional().describe('User ID to get tweets for'),
97
+ max_results: z
98
+ .number()
99
+ .min(1)
100
+ .max(100)
101
+ .optional()
102
+ .default(10)
103
+ .describe('Maximum number of tweets to return (1-100)'),
104
+ credentials: z
105
+ .record(z.nativeEnum(CredentialType), z.string())
106
+ .optional()
107
+ .describe('Object mapping credential types to values (injected at runtime)'),
108
+ }),
109
+ ]);
110
+ // Define result schemas for different operations
111
+ const XTwitterResultSchema = z.discriminatedUnion('operation', [
112
+ z.object({
113
+ operation: z.literal('post_tweet').describe('Post a new tweet'),
114
+ success: z.boolean().describe('Whether the tweet was posted successfully'),
115
+ tweet: TweetSchema.optional().describe('Posted tweet metadata'),
116
+ error: z.string().describe('Error message if operation failed'),
117
+ }),
118
+ z.object({
119
+ operation: z.literal('get_tweet').describe('Get a tweet by ID'),
120
+ success: z
121
+ .boolean()
122
+ .describe('Whether the tweet was retrieved successfully'),
123
+ tweet: TweetSchema.optional().describe('Tweet metadata'),
124
+ error: z.string().describe('Error message if operation failed'),
125
+ }),
126
+ z.object({
127
+ operation: z.literal('get_user_info').describe('Get user information'),
128
+ success: z
129
+ .boolean()
130
+ .describe('Whether the user info was retrieved successfully'),
131
+ user: UserSchema.optional().describe('User metadata'),
132
+ error: z.string().describe('Error message if operation failed'),
133
+ }),
134
+ z.object({
135
+ operation: z.literal('get_user_tweets').describe("Get a user's tweets"),
136
+ success: z
137
+ .boolean()
138
+ .describe('Whether the tweets were retrieved successfully'),
139
+ tweets: z.array(TweetSchema).optional().describe('List of tweets'),
140
+ total_count: z
141
+ .number()
142
+ .optional()
143
+ .describe('Total number of tweets returned'),
144
+ error: z.string().describe('Error message if operation failed'),
145
+ }),
146
+ ]);
147
+ export class XTwitterBubble extends ServiceBubble {
148
+ static type = 'service';
149
+ static service = 'x-twitter';
150
+ static authType = 'oauth';
151
+ static bubbleName = 'x-twitter';
152
+ static schema = XTwitterParamsSchema;
153
+ static resultSchema = XTwitterResultSchema;
154
+ static shortDescription = 'X (Twitter) integration for social media';
155
+ static longDescription = `
156
+ X (Twitter) service integration for social media operations.
157
+ Use cases:
158
+ - Post tweets
159
+ - Read tweets by ID
160
+ - Get user information
161
+ - Get user's recent tweets
162
+
163
+ Security Features:
164
+ - OAuth 2.0 authentication with X (Twitter)
165
+ - Scoped access permissions
166
+ - Secure token handling
167
+ `;
168
+ static alias = 'twitter';
169
+ constructor(params = {
170
+ operation: 'get_user_info',
171
+ }, context) {
172
+ super(params, context);
173
+ }
174
+ async testCredential() {
175
+ const credential = this.chooseCredential();
176
+ if (!credential) {
177
+ throw new Error('X (Twitter) credentials are required');
178
+ }
179
+ try {
180
+ // Test the credentials by making a simple API call
181
+ const response = await fetch('https://api.twitter.com/2/users/me?user.fields=id,name,username', {
182
+ headers: {
183
+ Authorization: `Bearer ${credential}`,
184
+ 'Content-Type': 'application/json',
185
+ },
186
+ });
187
+ return response.ok;
188
+ }
189
+ catch {
190
+ return false;
191
+ }
192
+ }
193
+ async makeTwitterApiRequest(endpoint, method = 'GET', body) {
194
+ const url = endpoint.startsWith('https://')
195
+ ? endpoint
196
+ : `https://api.twitter.com/2${endpoint}`;
197
+ const requestHeaders = {
198
+ Authorization: `Bearer ${this.chooseCredential()}`,
199
+ 'Content-Type': 'application/json',
200
+ };
201
+ const requestInit = {
202
+ method,
203
+ headers: requestHeaders,
204
+ };
205
+ if (body && method === 'POST') {
206
+ requestInit.body = JSON.stringify(body);
207
+ }
208
+ const response = await fetch(url, requestInit);
209
+ if (!response.ok) {
210
+ const errorText = await response.text();
211
+ throw new Error(`X (Twitter) API error: ${response.status} ${response.statusText} - ${errorText}`);
212
+ }
213
+ return await response.json();
214
+ }
215
+ async performAction(context) {
216
+ void context;
217
+ const { operation } = this.params;
218
+ try {
219
+ const result = await (async () => {
220
+ switch (operation) {
221
+ case 'post_tweet':
222
+ return await this.postTweet(this.params);
223
+ case 'get_tweet':
224
+ return await this.getTweet(this.params);
225
+ case 'get_user_info':
226
+ return await this.getUserInfo(this.params);
227
+ case 'get_user_tweets':
228
+ return await this.getUserTweets(this.params);
229
+ default:
230
+ throw new Error(`Unsupported operation: ${operation}`);
231
+ }
232
+ })();
233
+ return result;
234
+ }
235
+ catch (error) {
236
+ return {
237
+ operation,
238
+ success: false,
239
+ error: error instanceof Error ? error.message : 'Unknown error occurred',
240
+ };
241
+ }
242
+ }
243
+ async postTweet(params) {
244
+ try {
245
+ const { text, reply_to_tweet_id } = params;
246
+ const requestBody = {
247
+ text,
248
+ };
249
+ if (reply_to_tweet_id) {
250
+ requestBody.reply = {
251
+ in_reply_to_tweet_id: reply_to_tweet_id,
252
+ };
253
+ }
254
+ const response = await this.makeTwitterApiRequest('/tweets', 'POST', requestBody);
255
+ // Fetch the created tweet details with all fields
256
+ const tweetId = response.data.id;
257
+ const tweetResponse = await this.makeTwitterApiRequest(`/tweets/${tweetId}?tweet.fields=created_at,public_metrics,author_id&expansions=author_id&user.fields=id`);
258
+ const tweetData = tweetResponse.data;
259
+ return {
260
+ operation: 'post_tweet',
261
+ success: true,
262
+ tweet: {
263
+ id: tweetData.id,
264
+ text: tweetData.text,
265
+ author_id: tweetData.author_id,
266
+ created_at: tweetData.created_at,
267
+ public_metrics: tweetData.public_metrics,
268
+ },
269
+ error: '',
270
+ };
271
+ }
272
+ catch (error) {
273
+ let errorMessage = 'Unknown error occurred during tweet posting';
274
+ if (error instanceof Error) {
275
+ errorMessage = error.message;
276
+ if (errorMessage.includes('401')) {
277
+ errorMessage =
278
+ 'Authentication failed. Please check your X (Twitter) credentials.';
279
+ }
280
+ else if (errorMessage.includes('403')) {
281
+ errorMessage =
282
+ 'Permission denied. Please ensure you have write access.';
283
+ }
284
+ else if (errorMessage.includes('429')) {
285
+ errorMessage =
286
+ 'Rate limit exceeded. Please wait before posting again.';
287
+ }
288
+ }
289
+ return {
290
+ operation: 'post_tweet',
291
+ success: false,
292
+ tweet: undefined,
293
+ error: errorMessage,
294
+ };
295
+ }
296
+ }
297
+ async getTweet(params) {
298
+ try {
299
+ const { tweet_id } = params;
300
+ const response = await this.makeTwitterApiRequest(`/tweets/${tweet_id}?tweet.fields=created_at,public_metrics,author_id`);
301
+ return {
302
+ operation: 'get_tweet',
303
+ success: true,
304
+ tweet: {
305
+ id: response.data.id,
306
+ text: response.data.text,
307
+ author_id: response.data.author_id,
308
+ created_at: response.data.created_at,
309
+ public_metrics: response.data.public_metrics,
310
+ },
311
+ error: '',
312
+ };
313
+ }
314
+ catch (error) {
315
+ let errorMessage = 'Unknown error occurred while fetching tweet';
316
+ if (error instanceof Error) {
317
+ errorMessage = error.message;
318
+ if (errorMessage.includes('404')) {
319
+ errorMessage = 'Tweet not found. Please check the tweet ID.';
320
+ }
321
+ else if (errorMessage.includes('401')) {
322
+ errorMessage =
323
+ 'Authentication failed. Please check your X (Twitter) credentials.';
324
+ }
325
+ }
326
+ return {
327
+ operation: 'get_tweet',
328
+ success: false,
329
+ tweet: undefined,
330
+ error: errorMessage,
331
+ };
332
+ }
333
+ }
334
+ async getUserInfo(params) {
335
+ try {
336
+ const { username, user_id } = params;
337
+ if (!username && !user_id) {
338
+ throw new Error('Either username or user_id is required');
339
+ }
340
+ let endpoint;
341
+ if (username) {
342
+ endpoint = `/users/by/username/${username}?user.fields=description,public_metrics,verified`;
343
+ }
344
+ else {
345
+ endpoint = `/users/${user_id}?user.fields=description,public_metrics,verified`;
346
+ }
347
+ const response = await this.makeTwitterApiRequest(endpoint);
348
+ return {
349
+ operation: 'get_user_info',
350
+ success: true,
351
+ user: {
352
+ id: response.data.id,
353
+ name: response.data.name,
354
+ username: response.data.username,
355
+ description: response.data.description,
356
+ public_metrics: response.data.public_metrics,
357
+ verified: response.data.verified,
358
+ },
359
+ error: '',
360
+ };
361
+ }
362
+ catch (error) {
363
+ let errorMessage = 'Unknown error occurred while fetching user info';
364
+ if (error instanceof Error) {
365
+ errorMessage = error.message;
366
+ if (errorMessage.includes('404')) {
367
+ errorMessage =
368
+ 'User not found. Please check the username or user ID.';
369
+ }
370
+ else if (errorMessage.includes('401')) {
371
+ errorMessage =
372
+ 'Authentication failed. Please check your X (Twitter) credentials.';
373
+ }
374
+ }
375
+ return {
376
+ operation: 'get_user_info',
377
+ success: false,
378
+ user: undefined,
379
+ error: errorMessage,
380
+ };
381
+ }
382
+ }
383
+ async getUserTweets(params) {
384
+ try {
385
+ const { username, user_id, max_results } = params;
386
+ if (!username && !user_id) {
387
+ throw new Error('Either username or user_id is required');
388
+ }
389
+ // First get user ID if only username provided
390
+ let actualUserId;
391
+ if (username && !user_id) {
392
+ const userResponse = await this.makeTwitterApiRequest(`/users/by/username/${username}`);
393
+ actualUserId = userResponse.data.id;
394
+ }
395
+ else {
396
+ actualUserId = user_id;
397
+ }
398
+ const response = await this.makeTwitterApiRequest(`/users/${actualUserId}/tweets?max_results=${max_results}&tweet.fields=created_at,public_metrics,author_id`);
399
+ const tweets = response.data?.map((tweet) => ({
400
+ id: tweet.id,
401
+ text: tweet.text,
402
+ author_id: tweet.author_id,
403
+ created_at: tweet.created_at,
404
+ public_metrics: tweet.public_metrics,
405
+ })) || [];
406
+ return {
407
+ operation: 'get_user_tweets',
408
+ success: true,
409
+ tweets,
410
+ total_count: tweets.length,
411
+ error: '',
412
+ };
413
+ }
414
+ catch (error) {
415
+ let errorMessage = 'Unknown error occurred while fetching user tweets';
416
+ if (error instanceof Error) {
417
+ errorMessage = error.message;
418
+ if (errorMessage.includes('404')) {
419
+ errorMessage =
420
+ 'User not found. Please check the username or user ID.';
421
+ }
422
+ else if (errorMessage.includes('401')) {
423
+ errorMessage =
424
+ 'Authentication failed. Please check your X (Twitter) credentials.';
425
+ }
426
+ }
427
+ return {
428
+ operation: 'get_user_tweets',
429
+ success: false,
430
+ tweets: undefined,
431
+ total_count: 0,
432
+ error: errorMessage,
433
+ };
434
+ }
435
+ }
436
+ chooseCredential() {
437
+ const { credentials } = this.params;
438
+ if (!credentials || typeof credentials !== 'object') {
439
+ throw new Error('No X (Twitter) credentials provided');
440
+ }
441
+ // X Twitter bubble uses X_TWITTER_CRED credentials
442
+ return credentials[CredentialType.X_TWITTER_CRED];
443
+ }
444
+ }
445
+ //# sourceMappingURL=x-twitter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"x-twitter.js","sourceRoot":"","sources":["../../../src/bubbles/service-bubble/x-twitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEpE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,sBAAsB;AACtB,MAAM,WAAW,GAAG,CAAC;KAClB,MAAM,CAAC;IACN,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;IAClD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;IAC1C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IAC3D,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,kCAAkC,CAAC;IAC/C,cAAc,EAAE,CAAC;SACd,MAAM,CAAC;QACN,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QACpC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QACjC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAClC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KACnC,CAAC;SACD,QAAQ,EAAE;SACV,QAAQ,CAAC,2BAA2B,CAAC;CACzC,CAAC;KACD,QAAQ,CAAC,4BAA4B,CAAC,CAAC;AAE1C,qBAAqB;AACrB,MAAM,UAAU,GAAG,CAAC;KACjB,MAAM,CAAC;IACN,EAAE,EAAE,CAAC,CAAC,MAAM,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E5B,CAAC;QAEF,IAAI,CAAC,WAAW,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;YACpD,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC;QAED,mDAAmD;QACnD,OAAO,WAAW,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;IACpD,CAAC"}
@@ -91,25 +91,25 @@ declare const BubbleFlowValidationToolResultSchema: z.ZodObject<{
91
91
  codeLength: z.ZodNumber;
92
92
  strictMode: z.ZodBoolean;
93
93
  }, "strip", z.ZodTypeAny, {
94
+ codeLength: number;
94
95
  strictMode: boolean;
95
96
  validatedAt: string;
96
- codeLength: number;
97
97
  }, {
98
+ codeLength: number;
98
99
  strictMode: boolean;
99
100
  validatedAt: string;
100
- codeLength: number;
101
101
  }>;
102
102
  success: z.ZodBoolean;
103
103
  error: z.ZodString;
104
104
  }, "strip", z.ZodTypeAny, {
105
105
  valid: boolean;
106
- success: boolean;
107
- error: string;
108
106
  metadata: {
107
+ codeLength: number;
109
108
  strictMode: boolean;
110
109
  validatedAt: string;
111
- codeLength: number;
112
110
  };
111
+ success: boolean;
112
+ error: string;
113
113
  bubbles?: {
114
114
  bubbleName: string;
115
115
  variableName: string;
@@ -118,17 +118,17 @@ declare const BubbleFlowValidationToolResultSchema: z.ZodObject<{
118
118
  hasActionCall: boolean;
119
119
  parameterCount: number;
120
120
  }[] | undefined;
121
- errors?: string[] | undefined;
122
121
  bubbleCount?: number | undefined;
122
+ errors?: string[] | undefined;
123
123
  }, {
124
124
  valid: boolean;
125
- success: boolean;
126
- error: string;
127
125
  metadata: {
126
+ codeLength: number;
128
127
  strictMode: boolean;
129
128
  validatedAt: string;
130
- codeLength: number;
131
129
  };
130
+ success: boolean;
131
+ error: string;
132
132
  bubbles?: {
133
133
  bubbleName: string;
134
134
  variableName: string;
@@ -137,8 +137,8 @@ declare const BubbleFlowValidationToolResultSchema: z.ZodObject<{
137
137
  hasActionCall: boolean;
138
138
  parameterCount: number;
139
139
  }[] | undefined;
140
- errors?: string[] | undefined;
141
140
  bubbleCount?: number | undefined;
141
+ errors?: string[] | undefined;
142
142
  }>;
143
143
  /**
144
144
  * BubbleFlow Validation Tool
@@ -212,25 +212,25 @@ export declare class BubbleFlowValidationTool extends ToolBubble<BubbleFlowValid
212
212
  codeLength: z.ZodNumber;
213
213
  strictMode: z.ZodBoolean;
214
214
  }, "strip", z.ZodTypeAny, {
215
+ codeLength: number;
215
216
  strictMode: boolean;
216
217
  validatedAt: string;
217
- codeLength: number;
218
218
  }, {
219
+ codeLength: number;
219
220
  strictMode: boolean;
220
221
  validatedAt: string;
221
- codeLength: number;
222
222
  }>;
223
223
  success: z.ZodBoolean;
224
224
  error: z.ZodString;
225
225
  }, "strip", z.ZodTypeAny, {
226
226
  valid: boolean;
227
- success: boolean;
228
- error: string;
229
227
  metadata: {
228
+ codeLength: number;
230
229
  strictMode: boolean;
231
230
  validatedAt: string;
232
- codeLength: number;
233
231
  };
232
+ success: boolean;
233
+ error: string;
234
234
  bubbles?: {
235
235
  bubbleName: string;
236
236
  variableName: string;
@@ -239,17 +239,17 @@ export declare class BubbleFlowValidationTool extends ToolBubble<BubbleFlowValid
239
239
  hasActionCall: boolean;
240
240
  parameterCount: number;
241
241
  }[] | undefined;
242
- errors?: string[] | undefined;
243
242
  bubbleCount?: number | undefined;
243
+ errors?: string[] | undefined;
244
244
  }, {
245
245
  valid: boolean;
246
- success: boolean;
247
- error: string;
248
246
  metadata: {
247
+ codeLength: number;
249
248
  strictMode: boolean;
250
249
  validatedAt: string;
251
- codeLength: number;
252
250
  };
251
+ success: boolean;
252
+ error: string;
253
253
  bubbles?: {
254
254
  bubbleName: string;
255
255
  variableName: string;
@@ -258,8 +258,8 @@ export declare class BubbleFlowValidationTool extends ToolBubble<BubbleFlowValid
258
258
  hasActionCall: boolean;
259
259
  parameterCount: number;
260
260
  }[] | undefined;
261
- errors?: string[] | undefined;
262
261
  bubbleCount?: number | undefined;
262
+ errors?: string[] | undefined;
263
263
  }>;
264
264
  static readonly shortDescription = "Validates BubbleFlow TypeScript code for syntax and structure";
265
265
  static readonly longDescription = "\n A comprehensive validation tool for BubbleFlow TypeScript code.\n \n What it does:\n - Validates TypeScript syntax and compilation\n - Checks BubbleFlow class structure and requirements\n - Parses and analyzes bubble instantiations\n - Provides detailed error reporting with line numbers\n - Returns metadata about detected bubbles\n \n How it works:\n - Uses TypeScript compiler API for syntax validation\n - Validates that code extends BubbleFlow and has handle method\n - Parses bubble instantiations using AST analysis\n - Maps bubble class names to registered bubble types\n \n Use cases:\n - When an AI agent needs to validate user-provided BubbleFlow code\n - When checking code before execution or deployment\n - When providing feedback on BubbleFlow implementation\n - When analyzing bubble usage patterns in code\n ";