@mirra-messenger/sdk 0.2.0 → 0.4.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 +66 -0
- package/dist/client.d.ts +100 -5
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +151 -4
- package/dist/client.js.map +1 -1
- package/dist/generated/adapters.d.ts +1693 -0
- package/dist/generated/adapters.d.ts.map +1 -0
- package/dist/generated/adapters.js +1998 -0
- package/dist/generated/adapters.js.map +1 -0
- package/dist/generated/index.d.ts +8 -0
- package/dist/generated/index.d.ts.map +1 -0
- package/dist/generated/index.js +12 -0
- package/dist/generated/index.js.map +1 -0
- package/dist/types.d.ts +163 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,1998 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Auto-Generated SDK Adapter Methods
|
|
4
|
+
*
|
|
5
|
+
* DO NOT EDIT THIS FILE DIRECTLY
|
|
6
|
+
* Generated from adapter operation schemas
|
|
7
|
+
* Run: npm run generate:llm-api
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.generatedAdapters = void 0;
|
|
11
|
+
// ============================================================================
|
|
12
|
+
// Adapter Factory Functions
|
|
13
|
+
// ============================================================================
|
|
14
|
+
/**
|
|
15
|
+
* Flows Adapter
|
|
16
|
+
* Category: internal
|
|
17
|
+
*/
|
|
18
|
+
function createFlowsAdapter(sdk) {
|
|
19
|
+
return {
|
|
20
|
+
/**
|
|
21
|
+
* Create a new time-based flow with cron schedule
|
|
22
|
+
* @param args.title - Flow title
|
|
23
|
+
* @param args.description - Detailed description of what the flow does
|
|
24
|
+
* @param args.schedule - Cron expression for scheduling (e.g., "0 9 * * *" for daily at 9am)
|
|
25
|
+
* @param args.scriptId - ID of the script to execute when triggered
|
|
26
|
+
* @param args.scriptInput - Optional static input data for the script (optional)
|
|
27
|
+
*/
|
|
28
|
+
createTimeFlow: async (args) => {
|
|
29
|
+
return sdk.resources.call({
|
|
30
|
+
resourceId: 'flows',
|
|
31
|
+
method: 'createTimeFlow',
|
|
32
|
+
params: args || {}
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
/**
|
|
36
|
+
* Create an event-based flow with pre-filtering conditions.
|
|
37
|
+
|
|
38
|
+
EFFICIENCY RULE: Always filter in eventFilter, not the script.
|
|
39
|
+
- eventFilter conditions: FREE (evaluated in-memory before script runs)
|
|
40
|
+
- Script filtering: EXPENSIVE (invokes Lambda for every event)
|
|
41
|
+
|
|
42
|
+
BAD: Trigger on "telegram.message" with no filter → script checks sender
|
|
43
|
+
GOOD: Trigger on "telegram.message" with eventFilter for sender
|
|
44
|
+
|
|
45
|
+
TRIGGER STRUCTURE:
|
|
46
|
+
{
|
|
47
|
+
type: "event",
|
|
48
|
+
config: {
|
|
49
|
+
eventFilter: {
|
|
50
|
+
operator: "and" | "or",
|
|
51
|
+
conditions: [
|
|
52
|
+
{ operator: "equals", field: "eventType", value: "call.ended" },
|
|
53
|
+
{ operator: "contains", field: "content.text", value: "urgent" }
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
VALID OPERATORS: equals, notEquals, contains, startsWith, endsWith, greaterThan, lessThan, exists, notExists, matchesRegex, and, or, not
|
|
60
|
+
|
|
61
|
+
COMMON EVENT TYPES: call.started, call.ended, call.action, telegram.message, gmail.email_received
|
|
62
|
+
* @param args.title - Flow title
|
|
63
|
+
* @param args.description - Detailed description of what the flow does
|
|
64
|
+
* @param args.trigger - Event filter conditions that determine WHEN the script runs. Add ALL filtering logic here to minimize Lambda invocations. Must have type:"event" and config.eventFilter with operator and conditions array.
|
|
65
|
+
* @param args.scriptId - ID of the script to execute when triggered
|
|
66
|
+
* @param args.scriptInput - Optional static input data for the script (optional)
|
|
67
|
+
*/
|
|
68
|
+
createEventFlow: async (args) => {
|
|
69
|
+
return sdk.resources.call({
|
|
70
|
+
resourceId: 'flows',
|
|
71
|
+
method: 'createEventFlow',
|
|
72
|
+
params: args || {}
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
/**
|
|
76
|
+
* List all flows for the user
|
|
77
|
+
* @param args.status - Filter by status: active, paused, completed, failed (optional)
|
|
78
|
+
*/
|
|
79
|
+
listFlows: async (args) => {
|
|
80
|
+
return sdk.resources.call({
|
|
81
|
+
resourceId: 'flows',
|
|
82
|
+
method: 'listFlows',
|
|
83
|
+
params: args || {}
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
/**
|
|
87
|
+
* Get a specific flow by ID
|
|
88
|
+
* @param args.id - Flow ID
|
|
89
|
+
*/
|
|
90
|
+
getFlow: async (args) => {
|
|
91
|
+
return sdk.resources.call({
|
|
92
|
+
resourceId: 'flows',
|
|
93
|
+
method: 'getFlow',
|
|
94
|
+
params: args || {}
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
/**
|
|
98
|
+
* Update an existing flow
|
|
99
|
+
* @param args.id - Flow ID to update
|
|
100
|
+
* @param args.title - New title (optional)
|
|
101
|
+
* @param args.description - New description (optional)
|
|
102
|
+
* @param args.trigger - New trigger configuration (optional)
|
|
103
|
+
* @param args.scriptId - New script ID (optional)
|
|
104
|
+
* @param args.scriptInput - New script input data (optional)
|
|
105
|
+
* @param args.status - New status: active, paused, completed, failed (optional)
|
|
106
|
+
*/
|
|
107
|
+
updateFlow: async (args) => {
|
|
108
|
+
return sdk.resources.call({
|
|
109
|
+
resourceId: 'flows',
|
|
110
|
+
method: 'updateFlow',
|
|
111
|
+
params: args || {}
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
/**
|
|
115
|
+
* Delete a flow
|
|
116
|
+
* @param args.id - Flow ID to delete
|
|
117
|
+
*/
|
|
118
|
+
deleteFlow: async (args) => {
|
|
119
|
+
return sdk.resources.call({
|
|
120
|
+
resourceId: 'flows',
|
|
121
|
+
method: 'deleteFlow',
|
|
122
|
+
params: args || {}
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
/**
|
|
126
|
+
* Pause an active flow
|
|
127
|
+
* @param args.id - Flow ID to pause
|
|
128
|
+
*/
|
|
129
|
+
pauseFlow: async (args) => {
|
|
130
|
+
return sdk.resources.call({
|
|
131
|
+
resourceId: 'flows',
|
|
132
|
+
method: 'pauseFlow',
|
|
133
|
+
params: args || {}
|
|
134
|
+
});
|
|
135
|
+
},
|
|
136
|
+
/**
|
|
137
|
+
* Resume a paused flow
|
|
138
|
+
* @param args.id - Flow ID to resume
|
|
139
|
+
*/
|
|
140
|
+
resumeFlow: async (args) => {
|
|
141
|
+
return sdk.resources.call({
|
|
142
|
+
resourceId: 'flows',
|
|
143
|
+
method: 'resumeFlow',
|
|
144
|
+
params: args || {}
|
|
145
|
+
});
|
|
146
|
+
},
|
|
147
|
+
/**
|
|
148
|
+
* Search flows with filters
|
|
149
|
+
* @param args.status - Filter by status (or array of statuses) (optional)
|
|
150
|
+
* @param args.triggerType - Filter by trigger type: time or event (optional)
|
|
151
|
+
* @param args.limit - Maximum number of results (default: 100) (optional)
|
|
152
|
+
* @param args.offset - Pagination offset (default: 0) (optional)
|
|
153
|
+
*/
|
|
154
|
+
searchFlows: async (args) => {
|
|
155
|
+
return sdk.resources.call({
|
|
156
|
+
resourceId: 'flows',
|
|
157
|
+
method: 'searchFlows',
|
|
158
|
+
params: args || {}
|
|
159
|
+
});
|
|
160
|
+
},
|
|
161
|
+
/**
|
|
162
|
+
* Record execution result for a flow
|
|
163
|
+
* @param args.id - Flow ID
|
|
164
|
+
* @param args.success - Whether execution succeeded
|
|
165
|
+
* @param args.result - Execution result data (optional)
|
|
166
|
+
* @param args.error - Error message if execution failed (optional)
|
|
167
|
+
*/
|
|
168
|
+
recordExecution: async (args) => {
|
|
169
|
+
return sdk.resources.call({
|
|
170
|
+
resourceId: 'flows',
|
|
171
|
+
method: 'recordExecution',
|
|
172
|
+
params: args || {}
|
|
173
|
+
});
|
|
174
|
+
},
|
|
175
|
+
/**
|
|
176
|
+
* List all available event types that can trigger automations
|
|
177
|
+
* @param args.includeTemplates - Include condition templates for each event type (optional)
|
|
178
|
+
*/
|
|
179
|
+
listEventTypes: async (args) => {
|
|
180
|
+
return sdk.resources.call({
|
|
181
|
+
resourceId: 'flows',
|
|
182
|
+
method: 'listEventTypes',
|
|
183
|
+
params: args || {}
|
|
184
|
+
});
|
|
185
|
+
},
|
|
186
|
+
/**
|
|
187
|
+
* Test a flow by generating an event that matches the trigger conditions.
|
|
188
|
+
|
|
189
|
+
MODES:
|
|
190
|
+
- dryRun=true (DEFAULT): Validates trigger matching only. Safe, no side effects, no token consumption.
|
|
191
|
+
- dryRun=false: Executes the real script. WARNING: This causes real side effects (sends messages, makes API calls, consumes tokens).
|
|
192
|
+
|
|
193
|
+
Use dryRun=true first to verify trigger conditions work, then dryRun=false only when ready to test full execution.
|
|
194
|
+
|
|
195
|
+
WORKFLOW:
|
|
196
|
+
1. Generates a test event from the flow's trigger conditions
|
|
197
|
+
2. Validates the event matches the trigger (always)
|
|
198
|
+
3. If dryRun=false, executes the script with the test event
|
|
199
|
+
|
|
200
|
+
RESULT:
|
|
201
|
+
Returns detailed information about trigger matching, including which conditions passed/failed, and optionally full execution results.
|
|
202
|
+
* @param args.flowId - ID of the flow to test
|
|
203
|
+
* @param args.dryRun - If true (default), only validate trigger matching without executing script. If false, execute the script (causes side effects). (optional)
|
|
204
|
+
* @param args.eventOverrides - Custom field values to merge into the generated test event (e.g., {"content.text": "custom message"}) (optional)
|
|
205
|
+
*/
|
|
206
|
+
testFlow: async (args) => {
|
|
207
|
+
return sdk.resources.call({
|
|
208
|
+
resourceId: 'flows',
|
|
209
|
+
method: 'testFlow',
|
|
210
|
+
params: args || {}
|
|
211
|
+
});
|
|
212
|
+
},
|
|
213
|
+
/**
|
|
214
|
+
* Check if a custom event would match a flow trigger without any execution. Useful for debugging trigger conditions or testing with real event data.
|
|
215
|
+
* @param args.flowId - ID of the flow
|
|
216
|
+
* @param args.event - Event object to test against the trigger (must match IntegrationEvent structure)
|
|
217
|
+
*/
|
|
218
|
+
validateTrigger: async (args) => {
|
|
219
|
+
return sdk.resources.call({
|
|
220
|
+
resourceId: 'flows',
|
|
221
|
+
method: 'validateTrigger',
|
|
222
|
+
params: args || {}
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* User Adapter
|
|
229
|
+
* Category: internal
|
|
230
|
+
*/
|
|
231
|
+
function createUserAdapter(sdk) {
|
|
232
|
+
return {
|
|
233
|
+
/**
|
|
234
|
+
* Get user profile information including username, email, timezone, phone, and usage stats
|
|
235
|
+
*/
|
|
236
|
+
getProfile: async (args) => {
|
|
237
|
+
return sdk.resources.call({
|
|
238
|
+
resourceId: 'user',
|
|
239
|
+
method: 'getProfile',
|
|
240
|
+
params: args || {}
|
|
241
|
+
});
|
|
242
|
+
},
|
|
243
|
+
/**
|
|
244
|
+
* Update user profile fields (username, email, timezone, phone)
|
|
245
|
+
* @param args.username - New username (3-30 characters, alphanumeric with underscores/hyphens) (optional)
|
|
246
|
+
* @param args.email - New email address (optional)
|
|
247
|
+
* @param args.timezone - IANA timezone identifier (e.g., America/Los_Angeles) (optional)
|
|
248
|
+
* @param args.phoneNumber - Phone number (7-15 digits with optional formatting) (optional)
|
|
249
|
+
*/
|
|
250
|
+
updateProfile: async (args) => {
|
|
251
|
+
return sdk.resources.call({
|
|
252
|
+
resourceId: 'user',
|
|
253
|
+
method: 'updateProfile',
|
|
254
|
+
params: args || {}
|
|
255
|
+
});
|
|
256
|
+
},
|
|
257
|
+
/**
|
|
258
|
+
* Update user preferences (notification settings, etc)
|
|
259
|
+
* @param args.timezone - Preferred timezone for scheduling (optional)
|
|
260
|
+
* @param args.socials - Social media links (twitter, discord) (optional)
|
|
261
|
+
*/
|
|
262
|
+
updatePreferences: async (args) => {
|
|
263
|
+
return sdk.resources.call({
|
|
264
|
+
resourceId: 'user',
|
|
265
|
+
method: 'updatePreferences',
|
|
266
|
+
params: args || {}
|
|
267
|
+
});
|
|
268
|
+
},
|
|
269
|
+
/**
|
|
270
|
+
* Get token usage statistics, quota, and billing information
|
|
271
|
+
*/
|
|
272
|
+
getUsageStats: async (args) => {
|
|
273
|
+
return sdk.resources.call({
|
|
274
|
+
resourceId: 'user',
|
|
275
|
+
method: 'getUsageStats',
|
|
276
|
+
params: args || {}
|
|
277
|
+
});
|
|
278
|
+
},
|
|
279
|
+
/**
|
|
280
|
+
* Get active sessions/devices (based on push token registrations)
|
|
281
|
+
*/
|
|
282
|
+
getSessions: async (args) => {
|
|
283
|
+
return sdk.resources.call({
|
|
284
|
+
resourceId: 'user',
|
|
285
|
+
method: 'getSessions',
|
|
286
|
+
params: args || {}
|
|
287
|
+
});
|
|
288
|
+
},
|
|
289
|
+
/**
|
|
290
|
+
* Soft delete user account (set inactive flag) - CAUTION: This marks the account for deletion
|
|
291
|
+
* @param args.confirm - Must be true to confirm account deactivation
|
|
292
|
+
*/
|
|
293
|
+
deactivateAccount: async (args) => {
|
|
294
|
+
return sdk.resources.call({
|
|
295
|
+
resourceId: 'user',
|
|
296
|
+
method: 'deactivateAccount',
|
|
297
|
+
params: args || {}
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Contacts Adapter
|
|
304
|
+
* Category: internal
|
|
305
|
+
*/
|
|
306
|
+
function createContactsAdapter(sdk) {
|
|
307
|
+
return {
|
|
308
|
+
/**
|
|
309
|
+
* Get a list of all accepted contacts for the user with their profile information
|
|
310
|
+
* @param args.limit - Maximum number of contacts to return (default: 100) (optional)
|
|
311
|
+
* @param args.offset - Number of contacts to skip for pagination (default: 0) (optional)
|
|
312
|
+
*/
|
|
313
|
+
listContacts: async (args) => {
|
|
314
|
+
return sdk.resources.call({
|
|
315
|
+
resourceId: 'contacts',
|
|
316
|
+
method: 'listContacts',
|
|
317
|
+
params: args || {}
|
|
318
|
+
});
|
|
319
|
+
},
|
|
320
|
+
/**
|
|
321
|
+
* Get detailed information about a specific contact by their ID or username
|
|
322
|
+
* @param args.contactId - The contact user ID (MongoDB ObjectId) (optional)
|
|
323
|
+
* @param args.username - The contact username (optional)
|
|
324
|
+
*/
|
|
325
|
+
getContact: async (args) => {
|
|
326
|
+
return sdk.resources.call({
|
|
327
|
+
resourceId: 'contacts',
|
|
328
|
+
method: 'getContact',
|
|
329
|
+
params: args || {}
|
|
330
|
+
});
|
|
331
|
+
},
|
|
332
|
+
/**
|
|
333
|
+
* Send a contact request to another user by their username
|
|
334
|
+
* @param args.username - Username of the user to add as a contact
|
|
335
|
+
*/
|
|
336
|
+
addContact: async (args) => {
|
|
337
|
+
return sdk.resources.call({
|
|
338
|
+
resourceId: 'contacts',
|
|
339
|
+
method: 'addContact',
|
|
340
|
+
params: args || {}
|
|
341
|
+
});
|
|
342
|
+
},
|
|
343
|
+
/**
|
|
344
|
+
* Remove a user from your contacts list (unfriend)
|
|
345
|
+
* @param args.contactId - The contact user ID to remove (optional)
|
|
346
|
+
* @param args.username - The contact username to remove (optional)
|
|
347
|
+
*/
|
|
348
|
+
removeContact: async (args) => {
|
|
349
|
+
return sdk.resources.call({
|
|
350
|
+
resourceId: 'contacts',
|
|
351
|
+
method: 'removeContact',
|
|
352
|
+
params: args || {}
|
|
353
|
+
});
|
|
354
|
+
},
|
|
355
|
+
/**
|
|
356
|
+
* Search your contacts by username, email, phone, or wallet address
|
|
357
|
+
* @param args.query - Search query - can be username, email, phone, or wallet address
|
|
358
|
+
* @param args.searchType - Type of search to perform: all, username, email, phone, or wallet (default: all) (optional)
|
|
359
|
+
* @param args.limit - Maximum number of results (default: 20) (optional)
|
|
360
|
+
*/
|
|
361
|
+
searchContacts: async (args) => {
|
|
362
|
+
return sdk.resources.call({
|
|
363
|
+
resourceId: 'contacts',
|
|
364
|
+
method: 'searchContacts',
|
|
365
|
+
params: args || {}
|
|
366
|
+
});
|
|
367
|
+
},
|
|
368
|
+
/**
|
|
369
|
+
* Block a user (prevents them from contacting you)
|
|
370
|
+
* @param args.contactId - The user ID to block (optional)
|
|
371
|
+
* @param args.username - The username to block (optional)
|
|
372
|
+
*/
|
|
373
|
+
blockContact: async (args) => {
|
|
374
|
+
return sdk.resources.call({
|
|
375
|
+
resourceId: 'contacts',
|
|
376
|
+
method: 'blockContact',
|
|
377
|
+
params: args || {}
|
|
378
|
+
});
|
|
379
|
+
},
|
|
380
|
+
/**
|
|
381
|
+
* Unblock a previously blocked user
|
|
382
|
+
* @param args.contactId - The user ID to unblock (optional)
|
|
383
|
+
* @param args.username - The username to unblock (optional)
|
|
384
|
+
*/
|
|
385
|
+
unblockContact: async (args) => {
|
|
386
|
+
return sdk.resources.call({
|
|
387
|
+
resourceId: 'contacts',
|
|
388
|
+
method: 'unblockContact',
|
|
389
|
+
params: args || {}
|
|
390
|
+
});
|
|
391
|
+
},
|
|
392
|
+
/**
|
|
393
|
+
* Get a list of all users you have blocked
|
|
394
|
+
* @param args.limit - Maximum number of results (default: 100) (optional)
|
|
395
|
+
* @param args.offset - Number of items to skip for pagination (default: 0) (optional)
|
|
396
|
+
*/
|
|
397
|
+
getBlockedContacts: async (args) => {
|
|
398
|
+
return sdk.resources.call({
|
|
399
|
+
resourceId: 'contacts',
|
|
400
|
+
method: 'getBlockedContacts',
|
|
401
|
+
params: args || {}
|
|
402
|
+
});
|
|
403
|
+
},
|
|
404
|
+
/**
|
|
405
|
+
* Get pending contact requests (sent by you or received from others)
|
|
406
|
+
* @param args.type - Type of requests to retrieve: all, sent, or received (default: all) (optional)
|
|
407
|
+
* @param args.status - Filter by request status: pending, accepted, or rejected (default: pending) (optional)
|
|
408
|
+
*/
|
|
409
|
+
getContactRequests: async (args) => {
|
|
410
|
+
return sdk.resources.call({
|
|
411
|
+
resourceId: 'contacts',
|
|
412
|
+
method: 'getContactRequests',
|
|
413
|
+
params: args || {}
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Memory Adapter
|
|
420
|
+
* Category: internal
|
|
421
|
+
*/
|
|
422
|
+
function createMemoryAdapter(sdk) {
|
|
423
|
+
return {
|
|
424
|
+
/**
|
|
425
|
+
* Create a new memory entity in the knowledge graph. Use the type field to specify what kind of memory (task, note, idea, shopping_item, etc.)
|
|
426
|
+
* @param args.type - Memory subtype: "task" (reminders/todos), "note" (general notes), "idea" (concepts/ideas), "shopping_item" (shopping list), "topic" (general knowledge), "document" (documents), "contact" (people), or "event" (calendar items)
|
|
427
|
+
* @param args.content - Main content/description of the memory
|
|
428
|
+
* @param args.metadata - Additional metadata (e.g., priority, deadline, tags, etc.) (optional)
|
|
429
|
+
*/
|
|
430
|
+
create: async (args) => {
|
|
431
|
+
return sdk.resources.call({
|
|
432
|
+
resourceId: 'memory',
|
|
433
|
+
method: 'create',
|
|
434
|
+
params: args || {}
|
|
435
|
+
});
|
|
436
|
+
},
|
|
437
|
+
/**
|
|
438
|
+
* Semantic search across memory entities
|
|
439
|
+
* @param args.query - Search query text
|
|
440
|
+
* @param args.limit - Maximum number of results to return (default: 50, max: 100) (optional)
|
|
441
|
+
*/
|
|
442
|
+
search: async (args) => {
|
|
443
|
+
return sdk.resources.call({
|
|
444
|
+
resourceId: 'memory',
|
|
445
|
+
method: 'search',
|
|
446
|
+
params: args || {}
|
|
447
|
+
});
|
|
448
|
+
},
|
|
449
|
+
/**
|
|
450
|
+
* Query entities with filters and pagination
|
|
451
|
+
* @param args.type - Entity type filter (optional)
|
|
452
|
+
* @param args.filters - Additional filters (optional)
|
|
453
|
+
* @param args.limit - Maximum results (default: 50, max: 100) (optional)
|
|
454
|
+
* @param args.offset - Pagination offset (default: 0) (optional)
|
|
455
|
+
*/
|
|
456
|
+
query: async (args) => {
|
|
457
|
+
return sdk.resources.call({
|
|
458
|
+
resourceId: 'memory',
|
|
459
|
+
method: 'query',
|
|
460
|
+
params: args || {}
|
|
461
|
+
});
|
|
462
|
+
},
|
|
463
|
+
/**
|
|
464
|
+
* Find a single entity matching criteria
|
|
465
|
+
* @param args.filters - Filter criteria (e.g., { id: "..." })
|
|
466
|
+
*/
|
|
467
|
+
findOne: async (args) => {
|
|
468
|
+
return sdk.resources.call({
|
|
469
|
+
resourceId: 'memory',
|
|
470
|
+
method: 'findOne',
|
|
471
|
+
params: args || {}
|
|
472
|
+
});
|
|
473
|
+
},
|
|
474
|
+
/**
|
|
475
|
+
* Update an existing memory entity
|
|
476
|
+
* @param args.id - Entity ID to update
|
|
477
|
+
* @param args.type - Entity type (optional)
|
|
478
|
+
* @param args.content - Updated content (optional)
|
|
479
|
+
* @param args.metadata - Updated metadata (optional)
|
|
480
|
+
*/
|
|
481
|
+
update: async (args) => {
|
|
482
|
+
return sdk.resources.call({
|
|
483
|
+
resourceId: 'memory',
|
|
484
|
+
method: 'update',
|
|
485
|
+
params: args || {}
|
|
486
|
+
});
|
|
487
|
+
},
|
|
488
|
+
/**
|
|
489
|
+
* Delete a memory entity
|
|
490
|
+
* @param args.id - Entity ID to delete
|
|
491
|
+
*/
|
|
492
|
+
delete: async (args) => {
|
|
493
|
+
return sdk.resources.call({
|
|
494
|
+
resourceId: 'memory',
|
|
495
|
+
method: 'delete',
|
|
496
|
+
params: args || {}
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* AI Services Adapter
|
|
503
|
+
* Category: internal
|
|
504
|
+
*/
|
|
505
|
+
function createAiAdapter(sdk) {
|
|
506
|
+
return {
|
|
507
|
+
/**
|
|
508
|
+
* Have a conversation with an AI assistant. Supports multi-turn conversations with system prompts, user messages, and assistant responses.
|
|
509
|
+
|
|
510
|
+
PROVIDER: Uses Anthropic (Claude) as the AI provider.
|
|
511
|
+
|
|
512
|
+
BEST PRACTICES:
|
|
513
|
+
- Use system messages to set AI behavior and constraints
|
|
514
|
+
- Keep conversations focused - avoid unnecessary context
|
|
515
|
+
|
|
516
|
+
MESSAGE STRUCTURE:
|
|
517
|
+
Each message has:
|
|
518
|
+
- role: "system" | "user" | "assistant"
|
|
519
|
+
- content: string (the message text)
|
|
520
|
+
|
|
521
|
+
TYPICAL PATTERNS:
|
|
522
|
+
1. Simple query: [{ role: "user", content: "question" }]
|
|
523
|
+
2. With system prompt: [{ role: "system", content: "instructions" }, { role: "user", content: "question" }]
|
|
524
|
+
3. Multi-turn: [system, user, assistant, user, assistant, ...]
|
|
525
|
+
* @param args.messages - Array of message objects with role ("system" | "user" | "assistant") and content (string). System messages set AI behavior, user messages are queries, assistant messages are previous AI responses.
|
|
526
|
+
* @param args.model - Specific model to use. Default: "claude-3-haiku-20240307". Use Anthropic Claude model names. (optional)
|
|
527
|
+
* @param args.temperature - Creativity level 0.0-1.0. Lower=factual/consistent, Higher=creative/varied. Default: 0.7 (optional)
|
|
528
|
+
* @param args.maxTokens - Maximum tokens in response. Default: 1000. Increase for longer responses (costs more tokens). (optional)
|
|
529
|
+
*/
|
|
530
|
+
chat: async (args) => {
|
|
531
|
+
return sdk.resources.call({
|
|
532
|
+
resourceId: 'ai',
|
|
533
|
+
method: 'chat',
|
|
534
|
+
params: args || {}
|
|
535
|
+
});
|
|
536
|
+
},
|
|
537
|
+
/**
|
|
538
|
+
* Use AI to make a decision from a list of options. The AI analyzes your prompt, considers the context, and selects the most appropriate option with reasoning.
|
|
539
|
+
|
|
540
|
+
USE CASES:
|
|
541
|
+
- Route messages to correct handlers
|
|
542
|
+
- Classify user intents
|
|
543
|
+
- Select appropriate tools or actions
|
|
544
|
+
- Prioritize tasks
|
|
545
|
+
- Choose templates or responses
|
|
546
|
+
- Determine sentiment or category
|
|
547
|
+
|
|
548
|
+
HOW IT WORKS:
|
|
549
|
+
1. Provide a prompt (the decision context)
|
|
550
|
+
2. List available options (each with id and label)
|
|
551
|
+
3. Optionally add extra context
|
|
552
|
+
4. AI returns selected option ID and reasoning
|
|
553
|
+
|
|
554
|
+
BEST PRACTICES:
|
|
555
|
+
- Make option labels clear and descriptive
|
|
556
|
+
- Use unique IDs for options
|
|
557
|
+
- Add context when decision needs background info
|
|
558
|
+
- Keep prompt focused on the decision criteria
|
|
559
|
+
- Use metadata field for additional option data
|
|
560
|
+
* @param args.prompt - The decision prompt - what needs to be decided and why
|
|
561
|
+
* @param args.options - Array of options to choose from. Each option must have: id (unique identifier), label (descriptive name), and optional metadata (additional data)
|
|
562
|
+
* @param args.context - Additional context to help the AI make a better decision (optional)
|
|
563
|
+
* @param args.model - Specific model to use. Defaults to system default. (optional)
|
|
564
|
+
*/
|
|
565
|
+
decide: async (args) => {
|
|
566
|
+
return sdk.resources.call({
|
|
567
|
+
resourceId: 'ai',
|
|
568
|
+
method: 'decide',
|
|
569
|
+
params: args || {}
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Documents Adapter
|
|
576
|
+
* Category: storage
|
|
577
|
+
*/
|
|
578
|
+
function createDocumentAdapter(sdk) {
|
|
579
|
+
return {
|
|
580
|
+
/**
|
|
581
|
+
* Upload and process a document (PDF, DOCX, TXT, MD)
|
|
582
|
+
* @param args.file - Base64 encoded file content
|
|
583
|
+
* @param args.filename - Original filename with extension
|
|
584
|
+
* @param args.mimeType - MIME type (application/pdf, text/plain, etc.)
|
|
585
|
+
* @param args.graphId - Target graph ID (defaults to user's personal graph) (optional)
|
|
586
|
+
* @param args.title - Custom document title (optional)
|
|
587
|
+
* @param args.productTags - Array of product tags for categorization (optional)
|
|
588
|
+
*/
|
|
589
|
+
upload: async (args) => {
|
|
590
|
+
return sdk.resources.call({
|
|
591
|
+
resourceId: 'document',
|
|
592
|
+
method: 'upload',
|
|
593
|
+
params: args || {}
|
|
594
|
+
});
|
|
595
|
+
},
|
|
596
|
+
/**
|
|
597
|
+
* Get document metadata and content
|
|
598
|
+
* @param args.documentId - Document ID to retrieve
|
|
599
|
+
*/
|
|
600
|
+
get: async (args) => {
|
|
601
|
+
return sdk.resources.call({
|
|
602
|
+
resourceId: 'document',
|
|
603
|
+
method: 'get',
|
|
604
|
+
params: args || {}
|
|
605
|
+
});
|
|
606
|
+
},
|
|
607
|
+
/**
|
|
608
|
+
* Get document processing status
|
|
609
|
+
* @param args.documentId - Document ID to check
|
|
610
|
+
*/
|
|
611
|
+
getStatus: async (args) => {
|
|
612
|
+
return sdk.resources.call({
|
|
613
|
+
resourceId: 'document',
|
|
614
|
+
method: 'getStatus',
|
|
615
|
+
params: args || {}
|
|
616
|
+
});
|
|
617
|
+
},
|
|
618
|
+
/**
|
|
619
|
+
* Get all chunks for a document
|
|
620
|
+
* @param args.documentId - Document ID
|
|
621
|
+
*/
|
|
622
|
+
getChunks: async (args) => {
|
|
623
|
+
return sdk.resources.call({
|
|
624
|
+
resourceId: 'document',
|
|
625
|
+
method: 'getChunks',
|
|
626
|
+
params: args || {}
|
|
627
|
+
});
|
|
628
|
+
},
|
|
629
|
+
/**
|
|
630
|
+
* Delete a document and all its chunks
|
|
631
|
+
* @param args.documentId - Document ID to delete
|
|
632
|
+
*/
|
|
633
|
+
delete: async (args) => {
|
|
634
|
+
return sdk.resources.call({
|
|
635
|
+
resourceId: 'document',
|
|
636
|
+
method: 'delete',
|
|
637
|
+
params: args || {}
|
|
638
|
+
});
|
|
639
|
+
},
|
|
640
|
+
/**
|
|
641
|
+
* Share a document to another graph (group or user-contact)
|
|
642
|
+
* @param args.documentId - Document ID to share
|
|
643
|
+
* @param args.targetGraphId - Target graph ID to share to
|
|
644
|
+
* @param args.shareReason - Optional reason for sharing (optional)
|
|
645
|
+
*/
|
|
646
|
+
share: async (args) => {
|
|
647
|
+
return sdk.resources.call({
|
|
648
|
+
resourceId: 'document',
|
|
649
|
+
method: 'share',
|
|
650
|
+
params: args || {}
|
|
651
|
+
});
|
|
652
|
+
},
|
|
653
|
+
/**
|
|
654
|
+
* Remove document access from a graph
|
|
655
|
+
* @param args.documentId - Document ID
|
|
656
|
+
* @param args.graphId - Graph ID to remove access from
|
|
657
|
+
*/
|
|
658
|
+
unshare: async (args) => {
|
|
659
|
+
return sdk.resources.call({
|
|
660
|
+
resourceId: 'document',
|
|
661
|
+
method: 'unshare',
|
|
662
|
+
params: args || {}
|
|
663
|
+
});
|
|
664
|
+
},
|
|
665
|
+
/**
|
|
666
|
+
* List all graphs a document is shared in
|
|
667
|
+
* @param args.documentId - Document ID
|
|
668
|
+
*/
|
|
669
|
+
listGraphs: async (args) => {
|
|
670
|
+
return sdk.resources.call({
|
|
671
|
+
resourceId: 'document',
|
|
672
|
+
method: 'listGraphs',
|
|
673
|
+
params: args || {}
|
|
674
|
+
});
|
|
675
|
+
},
|
|
676
|
+
/**
|
|
677
|
+
* Semantic search across document chunks
|
|
678
|
+
* @param args.query - Search query
|
|
679
|
+
* @param args.graphId - Graph ID to search in (defaults to user's graph) (optional)
|
|
680
|
+
* @param args.limit - Maximum results (default: 10) (optional)
|
|
681
|
+
* @param args.threshold - Similarity threshold 0-1 (default: 0.7) (optional)
|
|
682
|
+
*/
|
|
683
|
+
search: async (args) => {
|
|
684
|
+
return sdk.resources.call({
|
|
685
|
+
resourceId: 'document',
|
|
686
|
+
method: 'search',
|
|
687
|
+
params: args || {}
|
|
688
|
+
});
|
|
689
|
+
},
|
|
690
|
+
/**
|
|
691
|
+
* List documents in a graph
|
|
692
|
+
* @param args.graphId - Graph ID to list documents from (defaults to user's graph) (optional)
|
|
693
|
+
* @param args.limit - Maximum results (default: 50) (optional)
|
|
694
|
+
* @param args.offset - Pagination offset (default: 0) (optional)
|
|
695
|
+
*/
|
|
696
|
+
list: async (args) => {
|
|
697
|
+
return sdk.resources.call({
|
|
698
|
+
resourceId: 'document',
|
|
699
|
+
method: 'list',
|
|
700
|
+
params: args || {}
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* Feed Items Adapter
|
|
707
|
+
* Category: internal
|
|
708
|
+
*/
|
|
709
|
+
function createFeedItemsAdapter(sdk) {
|
|
710
|
+
return {
|
|
711
|
+
/**
|
|
712
|
+
* Create a feed item with flexible content blocks. Use this to show action results, notifications, or updates to users.
|
|
713
|
+
* @param args.title - Main title of the feed item (shown prominently)
|
|
714
|
+
* @param args.subtitle - Optional subtitle (shown below title in muted color) (optional)
|
|
715
|
+
* @param args.blocks - Array of content blocks to display (text, key_value, list, timestamp, user_mention, divider, image, progress)
|
|
716
|
+
* @param args.itemType - Type: informative (FYI), actionable (needs response), or error
|
|
717
|
+
* @param args.actions - Optional action buttons for the feed item (optional)
|
|
718
|
+
* @param args.avatar - Optional avatar to show (user profile, icon, or custom image) (optional)
|
|
719
|
+
* @param args.metadata - Additional metadata (searchable, not displayed) (optional)
|
|
720
|
+
*/
|
|
721
|
+
createFeedItem: async (args) => {
|
|
722
|
+
return sdk.resources.call({
|
|
723
|
+
resourceId: 'feed-items',
|
|
724
|
+
method: 'create_feed_item',
|
|
725
|
+
params: args || {}
|
|
726
|
+
});
|
|
727
|
+
}
|
|
728
|
+
};
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* Telegram Adapter
|
|
732
|
+
* Category: social
|
|
733
|
+
*/
|
|
734
|
+
function createTelegramAdapter(sdk) {
|
|
735
|
+
return {
|
|
736
|
+
/**
|
|
737
|
+
* Send a text message to a Telegram chat or user. Supports both chat IDs and usernames.
|
|
738
|
+
* @param args.chatId - Chat ID (numeric) or username (e.g., @username) to send the message to. Chat IDs can be obtained from getChats operation.
|
|
739
|
+
* @param args.text - The text content of the message to send
|
|
740
|
+
*/
|
|
741
|
+
sendMessage: async (args) => {
|
|
742
|
+
return sdk.resources.call({
|
|
743
|
+
resourceId: 'telegram',
|
|
744
|
+
method: 'sendMessage',
|
|
745
|
+
params: args || {}
|
|
746
|
+
});
|
|
747
|
+
},
|
|
748
|
+
/**
|
|
749
|
+
* Retrieve Telegram chats with pagination support. Use limit and offset to paginate through large chat lists. Results are cached for 10 minutes.
|
|
750
|
+
* @param args.limit - Maximum number of chats to return (default: 50, max: 100). Use pagination for large chat lists to avoid token limits. (optional)
|
|
751
|
+
* @param args.offset - Number of chats to skip for pagination (default: 0). Combine with limit to fetch subsequent pages. (optional)
|
|
752
|
+
* @param args.forceRefresh - If true, bypasses the cache and fetches fresh chat data from Telegram. Default: false (optional)
|
|
753
|
+
*/
|
|
754
|
+
getChats: async (args) => {
|
|
755
|
+
return sdk.resources.call({
|
|
756
|
+
resourceId: 'telegram',
|
|
757
|
+
method: 'getChats',
|
|
758
|
+
params: args || {}
|
|
759
|
+
});
|
|
760
|
+
},
|
|
761
|
+
/**
|
|
762
|
+
* Find a Telegram chat by name or username. Searches through user's chats and returns the first match.
|
|
763
|
+
* @param args.name - Chat name, username (with or without @), or partial match to search for
|
|
764
|
+
*/
|
|
765
|
+
findChatByName: async (args) => {
|
|
766
|
+
return sdk.resources.call({
|
|
767
|
+
resourceId: 'telegram',
|
|
768
|
+
method: 'findChatByName',
|
|
769
|
+
params: args || {}
|
|
770
|
+
});
|
|
771
|
+
},
|
|
772
|
+
/**
|
|
773
|
+
* Search for messages across Telegram chats by content, date range, sender, or specific chats.
|
|
774
|
+
* @param args.chatIds - Array of chat IDs to search within. If not provided, searches globally. (optional)
|
|
775
|
+
* @param args.query - Text query to search for in messages (optional)
|
|
776
|
+
* @param args.fromDate - ISO date string for start of date range (optional)
|
|
777
|
+
* @param args.toDate - ISO date string for end of date range (optional)
|
|
778
|
+
* @param args.limit - Maximum number of messages to return (default: 100, max: 100) (optional)
|
|
779
|
+
* @param args.senderId - Filter messages by sender ID (optional)
|
|
780
|
+
*/
|
|
781
|
+
searchMessages: async (args) => {
|
|
782
|
+
return sdk.resources.call({
|
|
783
|
+
resourceId: 'telegram',
|
|
784
|
+
method: 'searchMessages',
|
|
785
|
+
params: args || {}
|
|
786
|
+
});
|
|
787
|
+
},
|
|
788
|
+
/**
|
|
789
|
+
* Get recent contacts from Telegram, optionally filtering for new contacts since a specific date.
|
|
790
|
+
* @param args.sinceDate - ISO date string - only return contacts with activity since this date (optional)
|
|
791
|
+
* @param args.onlyNewContacts - If true, only return contacts that are new (first message after sinceDate) (optional)
|
|
792
|
+
* @param args.limit - Maximum number of contacts to return (default: 100, max: 100) (optional)
|
|
793
|
+
*/
|
|
794
|
+
getRecentContacts: async (args) => {
|
|
795
|
+
return sdk.resources.call({
|
|
796
|
+
resourceId: 'telegram',
|
|
797
|
+
method: 'getRecentContacts',
|
|
798
|
+
params: args || {}
|
|
799
|
+
});
|
|
800
|
+
},
|
|
801
|
+
/**
|
|
802
|
+
* Get message history from a specific Telegram chat with pagination and date filtering.
|
|
803
|
+
* @param args.chatId - Chat ID to retrieve messages from
|
|
804
|
+
* @param args.limit - Maximum number of messages to return (default: 50, max: 100) (optional)
|
|
805
|
+
* @param args.offsetId - Message ID to use as pagination offset (optional)
|
|
806
|
+
* @param args.minDate - ISO date string for minimum message date (optional)
|
|
807
|
+
* @param args.maxDate - ISO date string for maximum message date (optional)
|
|
808
|
+
*/
|
|
809
|
+
getChatMessages: async (args) => {
|
|
810
|
+
return sdk.resources.call({
|
|
811
|
+
resourceId: 'telegram',
|
|
812
|
+
method: 'getChatMessages',
|
|
813
|
+
params: args || {}
|
|
814
|
+
});
|
|
815
|
+
},
|
|
816
|
+
/**
|
|
817
|
+
* Get summary of unread messages across Telegram chats, including mentions and last message info.
|
|
818
|
+
* @param args.chatIds - Array of chat IDs to filter by. If not provided, checks all chats. (optional)
|
|
819
|
+
* @param args.priorityOnly - If true, only return chats with unread messages (optional)
|
|
820
|
+
* @param args.groupBy - Group results by "chat" or "sender" (optional)
|
|
821
|
+
*/
|
|
822
|
+
getUnreadSummary: async (args) => {
|
|
823
|
+
return sdk.resources.call({
|
|
824
|
+
resourceId: 'telegram',
|
|
825
|
+
method: 'getUnreadSummary',
|
|
826
|
+
params: args || {}
|
|
827
|
+
});
|
|
828
|
+
},
|
|
829
|
+
/**
|
|
830
|
+
* Mark messages as read in a Telegram chat up to a specific message ID.
|
|
831
|
+
* @param args.chatId - Chat ID to mark messages as read in
|
|
832
|
+
* @param args.maxMessageId - Maximum message ID to mark as read. If not provided, marks all messages as read. (optional)
|
|
833
|
+
*/
|
|
834
|
+
markAsRead: async (args) => {
|
|
835
|
+
return sdk.resources.call({
|
|
836
|
+
resourceId: 'telegram',
|
|
837
|
+
method: 'markAsRead',
|
|
838
|
+
params: args || {}
|
|
839
|
+
});
|
|
840
|
+
},
|
|
841
|
+
/**
|
|
842
|
+
* Get messages where the user is mentioned in Telegram chats.
|
|
843
|
+
* @param args.chatIds - Array of chat IDs to filter mentions by (optional)
|
|
844
|
+
* @param args.sinceDate - ISO date string - only return mentions since this date (optional)
|
|
845
|
+
* @param args.onlyUnread - If true, only return unread mentions (optional)
|
|
846
|
+
*/
|
|
847
|
+
getMentions: async (args) => {
|
|
848
|
+
return sdk.resources.call({
|
|
849
|
+
resourceId: 'telegram',
|
|
850
|
+
method: 'getMentions',
|
|
851
|
+
params: args || {}
|
|
852
|
+
});
|
|
853
|
+
},
|
|
854
|
+
/**
|
|
855
|
+
* Perform a global search across all Telegram chats for messages matching a query.
|
|
856
|
+
* @param args.query - Search query text
|
|
857
|
+
* @param args.filter - Filter results by chat type: "groups", "private", or "channels" (optional)
|
|
858
|
+
* @param args.limit - Maximum number of results to return (default: 100, max: 100) (optional)
|
|
859
|
+
*/
|
|
860
|
+
globalSearch: async (args) => {
|
|
861
|
+
return sdk.resources.call({
|
|
862
|
+
resourceId: 'telegram',
|
|
863
|
+
method: 'globalSearch',
|
|
864
|
+
params: args || {}
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
};
|
|
868
|
+
}
|
|
869
|
+
/**
|
|
870
|
+
* Gmail Adapter
|
|
871
|
+
* Category: communication
|
|
872
|
+
*/
|
|
873
|
+
function createGoogleGmailAdapter(sdk) {
|
|
874
|
+
return {
|
|
875
|
+
/**
|
|
876
|
+
* Send an email via Gmail
|
|
877
|
+
* @param args.to - Valid email address
|
|
878
|
+
* @param args.subject - Email subject line
|
|
879
|
+
* @param args.body - Email body content
|
|
880
|
+
* @param args.cc - CC recipients (comma-separated email addresses) (optional)
|
|
881
|
+
* @param args.bcc - BCC recipients (comma-separated email addresses) (optional)
|
|
882
|
+
* @param args.isHtml - Whether body is HTML format (optional)
|
|
883
|
+
*/
|
|
884
|
+
sendEmail: async (args) => {
|
|
885
|
+
return sdk.resources.call({
|
|
886
|
+
resourceId: 'google-gmail',
|
|
887
|
+
method: 'sendEmail',
|
|
888
|
+
params: args || {}
|
|
889
|
+
});
|
|
890
|
+
},
|
|
891
|
+
/**
|
|
892
|
+
* Search emails with Gmail query syntax
|
|
893
|
+
* @param args.query - Gmail search query (e.g., "from:user@example.com is:unread")
|
|
894
|
+
* @param args.maxResults - Maximum number of results to return (default: 50, max: 100) (optional)
|
|
895
|
+
*/
|
|
896
|
+
searchEmails: async (args) => {
|
|
897
|
+
return sdk.resources.call({
|
|
898
|
+
resourceId: 'google-gmail',
|
|
899
|
+
method: 'searchEmails',
|
|
900
|
+
params: args || {}
|
|
901
|
+
});
|
|
902
|
+
},
|
|
903
|
+
/**
|
|
904
|
+
* List recent emails from inbox
|
|
905
|
+
* @param args.maxResults - Maximum number of results to return (default: 50, max: 100) (optional)
|
|
906
|
+
*/
|
|
907
|
+
listEmails: async (args) => {
|
|
908
|
+
return sdk.resources.call({
|
|
909
|
+
resourceId: 'google-gmail',
|
|
910
|
+
method: 'listEmails',
|
|
911
|
+
params: args || {}
|
|
912
|
+
});
|
|
913
|
+
},
|
|
914
|
+
/**
|
|
915
|
+
* Get details of a specific email by ID
|
|
916
|
+
* @param args.messageId - Gmail message ID
|
|
917
|
+
*/
|
|
918
|
+
getEmail: async (args) => {
|
|
919
|
+
return sdk.resources.call({
|
|
920
|
+
resourceId: 'google-gmail',
|
|
921
|
+
method: 'getEmail',
|
|
922
|
+
params: args || {}
|
|
923
|
+
});
|
|
924
|
+
},
|
|
925
|
+
/**
|
|
926
|
+
* Create a draft email in Gmail
|
|
927
|
+
* @param args.to - Valid email address
|
|
928
|
+
* @param args.subject - Email subject line
|
|
929
|
+
* @param args.body - Email body content
|
|
930
|
+
* @param args.cc - CC recipients (comma-separated email addresses) (optional)
|
|
931
|
+
* @param args.bcc - BCC recipients (comma-separated email addresses) (optional)
|
|
932
|
+
* @param args.isHtml - Whether body is HTML format (optional)
|
|
933
|
+
*/
|
|
934
|
+
createDraft: async (args) => {
|
|
935
|
+
return sdk.resources.call({
|
|
936
|
+
resourceId: 'google-gmail',
|
|
937
|
+
method: 'createDraft',
|
|
938
|
+
params: args || {}
|
|
939
|
+
});
|
|
940
|
+
},
|
|
941
|
+
/**
|
|
942
|
+
* Update an existing draft email
|
|
943
|
+
* @param args.draftId - Gmail draft ID to update
|
|
944
|
+
* @param args.to - Updated recipient email address(es) (optional)
|
|
945
|
+
* @param args.subject - Updated email subject line (optional)
|
|
946
|
+
* @param args.body - Updated email body content (optional)
|
|
947
|
+
* @param args.cc - Updated CC recipients (optional)
|
|
948
|
+
* @param args.bcc - Updated BCC recipients (optional)
|
|
949
|
+
* @param args.isHtml - Whether body is HTML format (optional)
|
|
950
|
+
*/
|
|
951
|
+
updateDraft: async (args) => {
|
|
952
|
+
return sdk.resources.call({
|
|
953
|
+
resourceId: 'google-gmail',
|
|
954
|
+
method: 'updateDraft',
|
|
955
|
+
params: args || {}
|
|
956
|
+
});
|
|
957
|
+
},
|
|
958
|
+
/**
|
|
959
|
+
* Delete a draft email
|
|
960
|
+
* @param args.draftId - Gmail draft ID to delete
|
|
961
|
+
*/
|
|
962
|
+
deleteDraft: async (args) => {
|
|
963
|
+
return sdk.resources.call({
|
|
964
|
+
resourceId: 'google-gmail',
|
|
965
|
+
method: 'deleteDraft',
|
|
966
|
+
params: args || {}
|
|
967
|
+
});
|
|
968
|
+
},
|
|
969
|
+
/**
|
|
970
|
+
* List all draft emails
|
|
971
|
+
* @param args.maxResults - Maximum number of drafts to return (default: 10) (optional)
|
|
972
|
+
*/
|
|
973
|
+
listDrafts: async (args) => {
|
|
974
|
+
return sdk.resources.call({
|
|
975
|
+
resourceId: 'google-gmail',
|
|
976
|
+
method: 'listDrafts',
|
|
977
|
+
params: args || {}
|
|
978
|
+
});
|
|
979
|
+
},
|
|
980
|
+
/**
|
|
981
|
+
* Mark an email as read
|
|
982
|
+
* @param args.messageId - Gmail message ID to mark as read
|
|
983
|
+
*/
|
|
984
|
+
markAsRead: async (args) => {
|
|
985
|
+
return sdk.resources.call({
|
|
986
|
+
resourceId: 'google-gmail',
|
|
987
|
+
method: 'markAsRead',
|
|
988
|
+
params: args || {}
|
|
989
|
+
});
|
|
990
|
+
},
|
|
991
|
+
/**
|
|
992
|
+
* Mark an email as unread
|
|
993
|
+
* @param args.messageId - Gmail message ID to mark as unread
|
|
994
|
+
*/
|
|
995
|
+
markAsUnread: async (args) => {
|
|
996
|
+
return sdk.resources.call({
|
|
997
|
+
resourceId: 'google-gmail',
|
|
998
|
+
method: 'markAsUnread',
|
|
999
|
+
params: args || {}
|
|
1000
|
+
});
|
|
1001
|
+
},
|
|
1002
|
+
/**
|
|
1003
|
+
* Delete an email
|
|
1004
|
+
* @param args.messageId - Gmail message ID to delete
|
|
1005
|
+
*/
|
|
1006
|
+
deleteEmail: async (args) => {
|
|
1007
|
+
return sdk.resources.call({
|
|
1008
|
+
resourceId: 'google-gmail',
|
|
1009
|
+
method: 'deleteEmail',
|
|
1010
|
+
params: args || {}
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
/**
|
|
1016
|
+
* Google Calendar Adapter
|
|
1017
|
+
* Category: productivity
|
|
1018
|
+
*/
|
|
1019
|
+
function createGoogleCalendarAdapter(sdk) {
|
|
1020
|
+
return {
|
|
1021
|
+
/**
|
|
1022
|
+
* Create a new calendar event
|
|
1023
|
+
* @param args.summary - Event title/summary
|
|
1024
|
+
* @param args.start - Start time object with dateTime and optional timeZone
|
|
1025
|
+
* @param args.end - End time object with dateTime and optional timeZone
|
|
1026
|
+
* @param args.description - Event description (optional)
|
|
1027
|
+
* @param args.location - Event location (optional)
|
|
1028
|
+
* @param args.attendees - Array of attendee email addresses (optional)
|
|
1029
|
+
*/
|
|
1030
|
+
createEvent: async (args) => {
|
|
1031
|
+
return sdk.resources.call({
|
|
1032
|
+
resourceId: 'google-calendar',
|
|
1033
|
+
method: 'createEvent',
|
|
1034
|
+
params: args || {}
|
|
1035
|
+
});
|
|
1036
|
+
},
|
|
1037
|
+
/**
|
|
1038
|
+
* List calendar events
|
|
1039
|
+
* @param args.timeMin - Start time for events to list (ISO 8601) (optional)
|
|
1040
|
+
* @param args.timeMax - End time for events to list (ISO 8601) (optional)
|
|
1041
|
+
* @param args.maxResults - Maximum number of events to return (default: 50, max: 100) (optional)
|
|
1042
|
+
* @param args.query - Search query to filter events (optional)
|
|
1043
|
+
*/
|
|
1044
|
+
listEvents: async (args) => {
|
|
1045
|
+
return sdk.resources.call({
|
|
1046
|
+
resourceId: 'google-calendar',
|
|
1047
|
+
method: 'listEvents',
|
|
1048
|
+
params: args || {}
|
|
1049
|
+
});
|
|
1050
|
+
},
|
|
1051
|
+
/**
|
|
1052
|
+
* Get calendar events (alias for listEvents)
|
|
1053
|
+
* @param args.timeMin - Start time for events to list (ISO 8601) (optional)
|
|
1054
|
+
* @param args.timeMax - End time for events to list (ISO 8601) (optional)
|
|
1055
|
+
* @param args.maxResults - Maximum number of events to return (default: 50, max: 100) (optional)
|
|
1056
|
+
* @param args.query - Search query to filter events (optional)
|
|
1057
|
+
*/
|
|
1058
|
+
getEvents: async (args) => {
|
|
1059
|
+
return sdk.resources.call({
|
|
1060
|
+
resourceId: 'google-calendar',
|
|
1061
|
+
method: 'getEvents',
|
|
1062
|
+
params: args || {}
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
};
|
|
1066
|
+
}
|
|
1067
|
+
/**
|
|
1068
|
+
* Google Drive Adapter
|
|
1069
|
+
* Category: storage
|
|
1070
|
+
*/
|
|
1071
|
+
function createGoogleDriveAdapter(sdk) {
|
|
1072
|
+
return {
|
|
1073
|
+
/**
|
|
1074
|
+
* List files in Google Drive
|
|
1075
|
+
* @param args.query - Search query (Google Drive query syntax) (optional)
|
|
1076
|
+
* @param args.pageSize - Maximum number of files to return (default: 20) (optional)
|
|
1077
|
+
*/
|
|
1078
|
+
listFiles: async (args) => {
|
|
1079
|
+
return sdk.resources.call({
|
|
1080
|
+
resourceId: 'google-drive',
|
|
1081
|
+
method: 'listFiles',
|
|
1082
|
+
params: args || {}
|
|
1083
|
+
});
|
|
1084
|
+
},
|
|
1085
|
+
/**
|
|
1086
|
+
* Create a new file in Google Drive
|
|
1087
|
+
* @param args.name - Name of the file
|
|
1088
|
+
* @param args.mimeType - MIME type of the file
|
|
1089
|
+
* @param args.folderId - Parent folder ID (optional) (optional)
|
|
1090
|
+
*/
|
|
1091
|
+
createFile: async (args) => {
|
|
1092
|
+
return sdk.resources.call({
|
|
1093
|
+
resourceId: 'google-drive',
|
|
1094
|
+
method: 'createFile',
|
|
1095
|
+
params: args || {}
|
|
1096
|
+
});
|
|
1097
|
+
},
|
|
1098
|
+
/**
|
|
1099
|
+
* Create a new folder in Google Drive
|
|
1100
|
+
* @param args.name - Name of the folder
|
|
1101
|
+
* @param args.parentFolderId - Parent folder ID (optional) (optional)
|
|
1102
|
+
*/
|
|
1103
|
+
createFolder: async (args) => {
|
|
1104
|
+
return sdk.resources.call({
|
|
1105
|
+
resourceId: 'google-drive',
|
|
1106
|
+
method: 'createFolder',
|
|
1107
|
+
params: args || {}
|
|
1108
|
+
});
|
|
1109
|
+
},
|
|
1110
|
+
/**
|
|
1111
|
+
* Get information about a file
|
|
1112
|
+
* @param args.fileId - ID of the file
|
|
1113
|
+
*/
|
|
1114
|
+
getFileInfo: async (args) => {
|
|
1115
|
+
return sdk.resources.call({
|
|
1116
|
+
resourceId: 'google-drive',
|
|
1117
|
+
method: 'getFileInfo',
|
|
1118
|
+
params: args || {}
|
|
1119
|
+
});
|
|
1120
|
+
},
|
|
1121
|
+
/**
|
|
1122
|
+
* Share a file with others
|
|
1123
|
+
* @param args.fileId - ID of the file to share
|
|
1124
|
+
* @param args.email - Email address to share with (optional) (optional)
|
|
1125
|
+
* @param args.role - Permission role: reader, writer, commenter (default: reader) (optional)
|
|
1126
|
+
*/
|
|
1127
|
+
shareFile: async (args) => {
|
|
1128
|
+
return sdk.resources.call({
|
|
1129
|
+
resourceId: 'google-drive',
|
|
1130
|
+
method: 'shareFile',
|
|
1131
|
+
params: args || {}
|
|
1132
|
+
});
|
|
1133
|
+
}
|
|
1134
|
+
};
|
|
1135
|
+
}
|
|
1136
|
+
/**
|
|
1137
|
+
* Google Sheets Adapter
|
|
1138
|
+
* Category: productivity
|
|
1139
|
+
*/
|
|
1140
|
+
function createGoogleSheetsAdapter(sdk) {
|
|
1141
|
+
return {
|
|
1142
|
+
/**
|
|
1143
|
+
* Create a new Google Sheets spreadsheet
|
|
1144
|
+
* @param args.title - Title of the spreadsheet
|
|
1145
|
+
*/
|
|
1146
|
+
createSpreadsheet: async (args) => {
|
|
1147
|
+
return sdk.resources.call({
|
|
1148
|
+
resourceId: 'google-sheets',
|
|
1149
|
+
method: 'createSpreadsheet',
|
|
1150
|
+
params: args || {}
|
|
1151
|
+
});
|
|
1152
|
+
},
|
|
1153
|
+
/**
|
|
1154
|
+
* Read data from a range in a spreadsheet
|
|
1155
|
+
* @param args.spreadsheetId - ID of the spreadsheet
|
|
1156
|
+
* @param args.range - Cell range (e.g., "Sheet1!A1:B10")
|
|
1157
|
+
*/
|
|
1158
|
+
readRange: async (args) => {
|
|
1159
|
+
return sdk.resources.call({
|
|
1160
|
+
resourceId: 'google-sheets',
|
|
1161
|
+
method: 'readRange',
|
|
1162
|
+
params: args || {}
|
|
1163
|
+
});
|
|
1164
|
+
},
|
|
1165
|
+
/**
|
|
1166
|
+
* Write data to a range in a spreadsheet
|
|
1167
|
+
* @param args.spreadsheetId - ID of the spreadsheet
|
|
1168
|
+
* @param args.range - Cell range (e.g., "Sheet1!A1:B10")
|
|
1169
|
+
* @param args.values - Data to write (2D array)
|
|
1170
|
+
*/
|
|
1171
|
+
writeRange: async (args) => {
|
|
1172
|
+
return sdk.resources.call({
|
|
1173
|
+
resourceId: 'google-sheets',
|
|
1174
|
+
method: 'writeRange',
|
|
1175
|
+
params: args || {}
|
|
1176
|
+
});
|
|
1177
|
+
},
|
|
1178
|
+
/**
|
|
1179
|
+
* Append a row to a spreadsheet
|
|
1180
|
+
* @param args.spreadsheetId - ID of the spreadsheet
|
|
1181
|
+
* @param args.sheetName - Name of the sheet
|
|
1182
|
+
* @param args.values - Row values to append
|
|
1183
|
+
*/
|
|
1184
|
+
appendRow: async (args) => {
|
|
1185
|
+
return sdk.resources.call({
|
|
1186
|
+
resourceId: 'google-sheets',
|
|
1187
|
+
method: 'appendRow',
|
|
1188
|
+
params: args || {}
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1191
|
+
};
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* Google Docs Adapter
|
|
1195
|
+
* Category: productivity
|
|
1196
|
+
*/
|
|
1197
|
+
function createGoogleDocsAdapter(sdk) {
|
|
1198
|
+
return {
|
|
1199
|
+
/**
|
|
1200
|
+
* Create a new Google Doc
|
|
1201
|
+
* @param args.title - Title of the document
|
|
1202
|
+
*/
|
|
1203
|
+
createDocument: async (args) => {
|
|
1204
|
+
return sdk.resources.call({
|
|
1205
|
+
resourceId: 'google-docs',
|
|
1206
|
+
method: 'createDocument',
|
|
1207
|
+
params: args || {}
|
|
1208
|
+
});
|
|
1209
|
+
},
|
|
1210
|
+
/**
|
|
1211
|
+
* Get a Google Doc by ID
|
|
1212
|
+
* @param args.documentId - ID of the document
|
|
1213
|
+
*/
|
|
1214
|
+
getDocument: async (args) => {
|
|
1215
|
+
return sdk.resources.call({
|
|
1216
|
+
resourceId: 'google-docs',
|
|
1217
|
+
method: 'getDocument',
|
|
1218
|
+
params: args || {}
|
|
1219
|
+
});
|
|
1220
|
+
},
|
|
1221
|
+
/**
|
|
1222
|
+
* Append text to the end of a document
|
|
1223
|
+
* @param args.documentId - ID of the document
|
|
1224
|
+
* @param args.text - Text to append
|
|
1225
|
+
*/
|
|
1226
|
+
appendText: async (args) => {
|
|
1227
|
+
return sdk.resources.call({
|
|
1228
|
+
resourceId: 'google-docs',
|
|
1229
|
+
method: 'appendText',
|
|
1230
|
+
params: args || {}
|
|
1231
|
+
});
|
|
1232
|
+
},
|
|
1233
|
+
/**
|
|
1234
|
+
* Replace text in a document
|
|
1235
|
+
* @param args.documentId - ID of the document
|
|
1236
|
+
* @param args.searchText - Text to search for
|
|
1237
|
+
* @param args.replaceText - Text to replace with
|
|
1238
|
+
*/
|
|
1239
|
+
replaceText: async (args) => {
|
|
1240
|
+
return sdk.resources.call({
|
|
1241
|
+
resourceId: 'google-docs',
|
|
1242
|
+
method: 'replaceText',
|
|
1243
|
+
params: args || {}
|
|
1244
|
+
});
|
|
1245
|
+
}
|
|
1246
|
+
};
|
|
1247
|
+
}
|
|
1248
|
+
/**
|
|
1249
|
+
* Jira Adapter
|
|
1250
|
+
* Category: project
|
|
1251
|
+
*/
|
|
1252
|
+
function createJiraAdapter(sdk) {
|
|
1253
|
+
return {
|
|
1254
|
+
/**
|
|
1255
|
+
* Create a new Jira issue
|
|
1256
|
+
* @param args.projectKey - Jira project key (e.g., "PROJ")
|
|
1257
|
+
* @param args.summary - Issue summary/title
|
|
1258
|
+
* @param args.description - Issue description (optional)
|
|
1259
|
+
* @param args.issueType - Issue type (Task, Bug, Story, etc.) (optional)
|
|
1260
|
+
*/
|
|
1261
|
+
createIssue: async (args) => {
|
|
1262
|
+
return sdk.resources.call({
|
|
1263
|
+
resourceId: 'jira',
|
|
1264
|
+
method: 'createIssue',
|
|
1265
|
+
params: args || {}
|
|
1266
|
+
});
|
|
1267
|
+
},
|
|
1268
|
+
/**
|
|
1269
|
+
* Search Jira issues using JQL
|
|
1270
|
+
* @param args.jql - JQL query string
|
|
1271
|
+
* @param args.maxResults - Maximum number of results (default: 50, max: 100) (optional)
|
|
1272
|
+
*/
|
|
1273
|
+
searchIssues: async (args) => {
|
|
1274
|
+
return sdk.resources.call({
|
|
1275
|
+
resourceId: 'jira',
|
|
1276
|
+
method: 'searchIssues',
|
|
1277
|
+
params: args || {}
|
|
1278
|
+
});
|
|
1279
|
+
},
|
|
1280
|
+
/**
|
|
1281
|
+
* Get a specific Jira issue by key or ID
|
|
1282
|
+
* @param args.issueKey - Issue key (e.g., "PROJ-123") or ID
|
|
1283
|
+
*/
|
|
1284
|
+
getIssue: async (args) => {
|
|
1285
|
+
return sdk.resources.call({
|
|
1286
|
+
resourceId: 'jira',
|
|
1287
|
+
method: 'getIssue',
|
|
1288
|
+
params: args || {}
|
|
1289
|
+
});
|
|
1290
|
+
},
|
|
1291
|
+
/**
|
|
1292
|
+
* Update an existing Jira issue
|
|
1293
|
+
* @param args.issueKey - Issue key (e.g., "PROJ-123")
|
|
1294
|
+
* @param args.summary - New issue summary/title (optional)
|
|
1295
|
+
* @param args.description - New issue description (optional)
|
|
1296
|
+
*/
|
|
1297
|
+
updateIssue: async (args) => {
|
|
1298
|
+
return sdk.resources.call({
|
|
1299
|
+
resourceId: 'jira',
|
|
1300
|
+
method: 'updateIssue',
|
|
1301
|
+
params: args || {}
|
|
1302
|
+
});
|
|
1303
|
+
},
|
|
1304
|
+
/**
|
|
1305
|
+
* Delete a Jira issue
|
|
1306
|
+
* @param args.issueKey - Issue key (e.g., "PROJ-123")
|
|
1307
|
+
*/
|
|
1308
|
+
deleteIssue: async (args) => {
|
|
1309
|
+
return sdk.resources.call({
|
|
1310
|
+
resourceId: 'jira',
|
|
1311
|
+
method: 'deleteIssue',
|
|
1312
|
+
params: args || {}
|
|
1313
|
+
});
|
|
1314
|
+
},
|
|
1315
|
+
/**
|
|
1316
|
+
* Add a comment to a Jira issue
|
|
1317
|
+
* @param args.issueKey - Issue key (e.g., "PROJ-123")
|
|
1318
|
+
* @param args.comment - Comment text
|
|
1319
|
+
*/
|
|
1320
|
+
addComment: async (args) => {
|
|
1321
|
+
return sdk.resources.call({
|
|
1322
|
+
resourceId: 'jira',
|
|
1323
|
+
method: 'addComment',
|
|
1324
|
+
params: args || {}
|
|
1325
|
+
});
|
|
1326
|
+
},
|
|
1327
|
+
/**
|
|
1328
|
+
* Transition a Jira issue to a different status
|
|
1329
|
+
* @param args.issueKey - Issue key (e.g., "PROJ-123")
|
|
1330
|
+
* @param args.transitionId - ID of the transition to perform
|
|
1331
|
+
*/
|
|
1332
|
+
transitionIssue: async (args) => {
|
|
1333
|
+
return sdk.resources.call({
|
|
1334
|
+
resourceId: 'jira',
|
|
1335
|
+
method: 'transitionIssue',
|
|
1336
|
+
params: args || {}
|
|
1337
|
+
});
|
|
1338
|
+
},
|
|
1339
|
+
/**
|
|
1340
|
+
* Assign a Jira issue to a user
|
|
1341
|
+
* @param args.issueKey - Issue key (e.g., "PROJ-123")
|
|
1342
|
+
* @param args.accountId - Atlassian account ID of the assignee
|
|
1343
|
+
*/
|
|
1344
|
+
assignIssue: async (args) => {
|
|
1345
|
+
return sdk.resources.call({
|
|
1346
|
+
resourceId: 'jira',
|
|
1347
|
+
method: 'assignIssue',
|
|
1348
|
+
params: args || {}
|
|
1349
|
+
});
|
|
1350
|
+
},
|
|
1351
|
+
/**
|
|
1352
|
+
* Get all accessible Jira projects
|
|
1353
|
+
*/
|
|
1354
|
+
getProjects: async (args) => {
|
|
1355
|
+
return sdk.resources.call({
|
|
1356
|
+
resourceId: 'jira',
|
|
1357
|
+
method: 'getProjects',
|
|
1358
|
+
params: args || {}
|
|
1359
|
+
});
|
|
1360
|
+
},
|
|
1361
|
+
/**
|
|
1362
|
+
* List all accessible Jira projects (alias for getProjects)
|
|
1363
|
+
*/
|
|
1364
|
+
listProjects: async (args) => {
|
|
1365
|
+
return sdk.resources.call({
|
|
1366
|
+
resourceId: 'jira',
|
|
1367
|
+
method: 'listProjects',
|
|
1368
|
+
params: args || {}
|
|
1369
|
+
});
|
|
1370
|
+
},
|
|
1371
|
+
/**
|
|
1372
|
+
* Get metadata for a specific Jira project
|
|
1373
|
+
* @param args.projectKey - Project key (e.g., "PROJ")
|
|
1374
|
+
*/
|
|
1375
|
+
getProjectMetadata: async (args) => {
|
|
1376
|
+
return sdk.resources.call({
|
|
1377
|
+
resourceId: 'jira',
|
|
1378
|
+
method: 'getProjectMetadata',
|
|
1379
|
+
params: args || {}
|
|
1380
|
+
});
|
|
1381
|
+
},
|
|
1382
|
+
/**
|
|
1383
|
+
* Get available transitions for a Jira issue
|
|
1384
|
+
* @param args.issueKey - Issue key (e.g., "PROJ-123")
|
|
1385
|
+
*/
|
|
1386
|
+
getTransitions: async (args) => {
|
|
1387
|
+
return sdk.resources.call({
|
|
1388
|
+
resourceId: 'jira',
|
|
1389
|
+
method: 'getTransitions',
|
|
1390
|
+
params: args || {}
|
|
1391
|
+
});
|
|
1392
|
+
},
|
|
1393
|
+
/**
|
|
1394
|
+
* List users that can be assigned to issues in a project
|
|
1395
|
+
* @param args.projectKey - Project key (e.g., "PROJ")
|
|
1396
|
+
*/
|
|
1397
|
+
listAssignableUsers: async (args) => {
|
|
1398
|
+
return sdk.resources.call({
|
|
1399
|
+
resourceId: 'jira',
|
|
1400
|
+
method: 'listAssignableUsers',
|
|
1401
|
+
params: args || {}
|
|
1402
|
+
});
|
|
1403
|
+
},
|
|
1404
|
+
/**
|
|
1405
|
+
* Get available issue types for a project
|
|
1406
|
+
* @param args.projectKey - Project key (e.g., "PROJ")
|
|
1407
|
+
*/
|
|
1408
|
+
getIssueTypes: async (args) => {
|
|
1409
|
+
return sdk.resources.call({
|
|
1410
|
+
resourceId: 'jira',
|
|
1411
|
+
method: 'getIssueTypes',
|
|
1412
|
+
params: args || {}
|
|
1413
|
+
});
|
|
1414
|
+
}
|
|
1415
|
+
};
|
|
1416
|
+
}
|
|
1417
|
+
/**
|
|
1418
|
+
* Twitter Adapter
|
|
1419
|
+
* Category: social
|
|
1420
|
+
*/
|
|
1421
|
+
function createTwitterAdapter(sdk) {
|
|
1422
|
+
return {
|
|
1423
|
+
/**
|
|
1424
|
+
* Post a tweet
|
|
1425
|
+
* @param args.text - Tweet text (max 280 characters)
|
|
1426
|
+
*/
|
|
1427
|
+
postTweet: async (args) => {
|
|
1428
|
+
return sdk.resources.call({
|
|
1429
|
+
resourceId: 'twitter',
|
|
1430
|
+
method: 'postTweet',
|
|
1431
|
+
params: args || {}
|
|
1432
|
+
});
|
|
1433
|
+
},
|
|
1434
|
+
/**
|
|
1435
|
+
* Retrieve tweets from a Twitter user
|
|
1436
|
+
* @param args.userId - Twitter user ID (recommended for stability and speed) (optional)
|
|
1437
|
+
* @param args.userName - Twitter username/screen name (alternative to userId) (optional)
|
|
1438
|
+
* @param args.cursor - Pagination cursor for next page of results (optional)
|
|
1439
|
+
* @param args.includeReplies - Whether to include replies in results (default: false) (optional)
|
|
1440
|
+
*/
|
|
1441
|
+
getUserTweets: async (args) => {
|
|
1442
|
+
return sdk.resources.call({
|
|
1443
|
+
resourceId: 'twitter',
|
|
1444
|
+
method: 'getUserTweets',
|
|
1445
|
+
params: args || {}
|
|
1446
|
+
});
|
|
1447
|
+
}
|
|
1448
|
+
};
|
|
1449
|
+
}
|
|
1450
|
+
/**
|
|
1451
|
+
* Trello Adapter
|
|
1452
|
+
* Category: productivity
|
|
1453
|
+
*/
|
|
1454
|
+
function createTrelloAdapter(sdk) {
|
|
1455
|
+
return {
|
|
1456
|
+
/**
|
|
1457
|
+
* Get all boards for the authenticated user
|
|
1458
|
+
*/
|
|
1459
|
+
getBoards: async (args) => {
|
|
1460
|
+
return sdk.resources.call({
|
|
1461
|
+
resourceId: 'trello',
|
|
1462
|
+
method: 'getBoards',
|
|
1463
|
+
params: args || {}
|
|
1464
|
+
});
|
|
1465
|
+
},
|
|
1466
|
+
/**
|
|
1467
|
+
* Get a specific board by ID including its lists
|
|
1468
|
+
* @param args.boardId - The ID of the board to retrieve
|
|
1469
|
+
*/
|
|
1470
|
+
getBoard: async (args) => {
|
|
1471
|
+
return sdk.resources.call({
|
|
1472
|
+
resourceId: 'trello',
|
|
1473
|
+
method: 'getBoard',
|
|
1474
|
+
params: args || {}
|
|
1475
|
+
});
|
|
1476
|
+
},
|
|
1477
|
+
/**
|
|
1478
|
+
* Create a new card in a Trello list
|
|
1479
|
+
* @param args.name - Card name/title
|
|
1480
|
+
* @param args.idList - ID of the list to add the card to
|
|
1481
|
+
* @param args.desc - Card description (supports markdown) (optional)
|
|
1482
|
+
*/
|
|
1483
|
+
createCard: async (args) => {
|
|
1484
|
+
return sdk.resources.call({
|
|
1485
|
+
resourceId: 'trello',
|
|
1486
|
+
method: 'createCard',
|
|
1487
|
+
params: args || {}
|
|
1488
|
+
});
|
|
1489
|
+
},
|
|
1490
|
+
/**
|
|
1491
|
+
* Get a specific card by ID
|
|
1492
|
+
* @param args.cardId - The ID of the card to retrieve
|
|
1493
|
+
*/
|
|
1494
|
+
getCard: async (args) => {
|
|
1495
|
+
return sdk.resources.call({
|
|
1496
|
+
resourceId: 'trello',
|
|
1497
|
+
method: 'getCard',
|
|
1498
|
+
params: args || {}
|
|
1499
|
+
});
|
|
1500
|
+
},
|
|
1501
|
+
/**
|
|
1502
|
+
* Update an existing card
|
|
1503
|
+
* @param args.cardId - The ID of the card to update
|
|
1504
|
+
* @param args.name - New card name (optional)
|
|
1505
|
+
* @param args.desc - New card description (optional)
|
|
1506
|
+
* @param args.idList - Move card to a different list (optional)
|
|
1507
|
+
* @param args.closed - Archive the card (optional)
|
|
1508
|
+
*/
|
|
1509
|
+
updateCard: async (args) => {
|
|
1510
|
+
return sdk.resources.call({
|
|
1511
|
+
resourceId: 'trello',
|
|
1512
|
+
method: 'updateCard',
|
|
1513
|
+
params: args || {}
|
|
1514
|
+
});
|
|
1515
|
+
},
|
|
1516
|
+
/**
|
|
1517
|
+
* Delete a card permanently
|
|
1518
|
+
* @param args.cardId - The ID of the card to delete
|
|
1519
|
+
*/
|
|
1520
|
+
deleteCard: async (args) => {
|
|
1521
|
+
return sdk.resources.call({
|
|
1522
|
+
resourceId: 'trello',
|
|
1523
|
+
method: 'deleteCard',
|
|
1524
|
+
params: args || {}
|
|
1525
|
+
});
|
|
1526
|
+
},
|
|
1527
|
+
/**
|
|
1528
|
+
* Create a new checklist on a card
|
|
1529
|
+
* @param args.cardId - The ID of the card to add the checklist to
|
|
1530
|
+
* @param args.name - Checklist name
|
|
1531
|
+
*/
|
|
1532
|
+
createChecklist: async (args) => {
|
|
1533
|
+
return sdk.resources.call({
|
|
1534
|
+
resourceId: 'trello',
|
|
1535
|
+
method: 'createChecklist',
|
|
1536
|
+
params: args || {}
|
|
1537
|
+
});
|
|
1538
|
+
},
|
|
1539
|
+
/**
|
|
1540
|
+
* Get a specific checklist by ID
|
|
1541
|
+
* @param args.checklistId - The ID of the checklist to retrieve
|
|
1542
|
+
*/
|
|
1543
|
+
getChecklist: async (args) => {
|
|
1544
|
+
return sdk.resources.call({
|
|
1545
|
+
resourceId: 'trello',
|
|
1546
|
+
method: 'getChecklist',
|
|
1547
|
+
params: args || {}
|
|
1548
|
+
});
|
|
1549
|
+
},
|
|
1550
|
+
/**
|
|
1551
|
+
* Update a checklist name
|
|
1552
|
+
* @param args.checklistId - The ID of the checklist to update
|
|
1553
|
+
* @param args.name - New checklist name
|
|
1554
|
+
*/
|
|
1555
|
+
updateChecklist: async (args) => {
|
|
1556
|
+
return sdk.resources.call({
|
|
1557
|
+
resourceId: 'trello',
|
|
1558
|
+
method: 'updateChecklist',
|
|
1559
|
+
params: args || {}
|
|
1560
|
+
});
|
|
1561
|
+
},
|
|
1562
|
+
/**
|
|
1563
|
+
* Delete a checklist from a card
|
|
1564
|
+
* @param args.checklistId - The ID of the checklist to delete
|
|
1565
|
+
*/
|
|
1566
|
+
deleteChecklist: async (args) => {
|
|
1567
|
+
return sdk.resources.call({
|
|
1568
|
+
resourceId: 'trello',
|
|
1569
|
+
method: 'deleteChecklist',
|
|
1570
|
+
params: args || {}
|
|
1571
|
+
});
|
|
1572
|
+
},
|
|
1573
|
+
/**
|
|
1574
|
+
* Add a check item to a checklist
|
|
1575
|
+
* @param args.checklistId - The ID of the checklist to add the item to
|
|
1576
|
+
* @param args.name - Check item text
|
|
1577
|
+
*/
|
|
1578
|
+
addCheckItem: async (args) => {
|
|
1579
|
+
return sdk.resources.call({
|
|
1580
|
+
resourceId: 'trello',
|
|
1581
|
+
method: 'addCheckItem',
|
|
1582
|
+
params: args || {}
|
|
1583
|
+
});
|
|
1584
|
+
},
|
|
1585
|
+
/**
|
|
1586
|
+
* Update a check item (name or completion state)
|
|
1587
|
+
* @param args.cardId - The ID of the card containing the check item
|
|
1588
|
+
* @param args.checkItemId - The ID of the check item to update
|
|
1589
|
+
* @param args.name - New check item text (optional)
|
|
1590
|
+
* @param args.state - Check state: "complete" or "incomplete" (optional)
|
|
1591
|
+
*/
|
|
1592
|
+
updateCheckItem: async (args) => {
|
|
1593
|
+
return sdk.resources.call({
|
|
1594
|
+
resourceId: 'trello',
|
|
1595
|
+
method: 'updateCheckItem',
|
|
1596
|
+
params: args || {}
|
|
1597
|
+
});
|
|
1598
|
+
},
|
|
1599
|
+
/**
|
|
1600
|
+
* Delete a check item from a checklist
|
|
1601
|
+
* @param args.checklistId - The ID of the checklist containing the item
|
|
1602
|
+
* @param args.checkItemId - The ID of the check item to delete
|
|
1603
|
+
*/
|
|
1604
|
+
deleteCheckItem: async (args) => {
|
|
1605
|
+
return sdk.resources.call({
|
|
1606
|
+
resourceId: 'trello',
|
|
1607
|
+
method: 'deleteCheckItem',
|
|
1608
|
+
params: args || {}
|
|
1609
|
+
});
|
|
1610
|
+
}
|
|
1611
|
+
};
|
|
1612
|
+
}
|
|
1613
|
+
/**
|
|
1614
|
+
* Jupiter Adapter
|
|
1615
|
+
* Category: crypto
|
|
1616
|
+
*/
|
|
1617
|
+
function createJupiterAdapter(sdk) {
|
|
1618
|
+
return {
|
|
1619
|
+
/**
|
|
1620
|
+
* Execute a token swap on Jupiter DEX
|
|
1621
|
+
* @param args.inputMint - Input token mint address
|
|
1622
|
+
* @param args.outputMint - Output token mint address
|
|
1623
|
+
* @param args.amount - Amount to swap (in smallest unit)
|
|
1624
|
+
* @param args.inputDecimals - Number of decimals for input token
|
|
1625
|
+
* @param args.slippageBps - Slippage tolerance in basis points (default: 50) (optional)
|
|
1626
|
+
*/
|
|
1627
|
+
swap: async (args) => {
|
|
1628
|
+
return sdk.resources.call({
|
|
1629
|
+
resourceId: 'jupiter',
|
|
1630
|
+
method: 'swap',
|
|
1631
|
+
params: args || {}
|
|
1632
|
+
});
|
|
1633
|
+
},
|
|
1634
|
+
/**
|
|
1635
|
+
* Get token holdings for a wallet
|
|
1636
|
+
* @param args.walletAddress - Wallet address to check (uses actor wallet if not provided) (optional)
|
|
1637
|
+
*/
|
|
1638
|
+
getHoldings: async (args) => {
|
|
1639
|
+
return sdk.resources.call({
|
|
1640
|
+
resourceId: 'jupiter',
|
|
1641
|
+
method: 'getHoldings',
|
|
1642
|
+
params: args || {}
|
|
1643
|
+
});
|
|
1644
|
+
},
|
|
1645
|
+
/**
|
|
1646
|
+
* Get token security information using Jupiter Shield
|
|
1647
|
+
* @param args.tokenMint - Token mint address to check security for
|
|
1648
|
+
*/
|
|
1649
|
+
getTokenSecurity: async (args) => {
|
|
1650
|
+
return sdk.resources.call({
|
|
1651
|
+
resourceId: 'jupiter',
|
|
1652
|
+
method: 'getTokenSecurity',
|
|
1653
|
+
params: args || {}
|
|
1654
|
+
});
|
|
1655
|
+
},
|
|
1656
|
+
/**
|
|
1657
|
+
* Search for tokens by symbol, name, or mint address
|
|
1658
|
+
* @param args.query - Search query (symbol, name, or mint address)
|
|
1659
|
+
*/
|
|
1660
|
+
searchTokens: async (args) => {
|
|
1661
|
+
return sdk.resources.call({
|
|
1662
|
+
resourceId: 'jupiter',
|
|
1663
|
+
method: 'searchTokens',
|
|
1664
|
+
params: args || {}
|
|
1665
|
+
});
|
|
1666
|
+
}
|
|
1667
|
+
};
|
|
1668
|
+
}
|
|
1669
|
+
/**
|
|
1670
|
+
* Crypto Adapter
|
|
1671
|
+
* Category: crypto
|
|
1672
|
+
*/
|
|
1673
|
+
function createCryptoAdapter(sdk) {
|
|
1674
|
+
return {
|
|
1675
|
+
/**
|
|
1676
|
+
* Get the current price of a crypto asset
|
|
1677
|
+
* @param args.tokenAddress - Token contract address (EVM: 0x..., SVM: base58)
|
|
1678
|
+
* @param args.chainName - Specific chain name (auto-detected if not provided) (optional)
|
|
1679
|
+
*/
|
|
1680
|
+
getPrice: async (args) => {
|
|
1681
|
+
return sdk.resources.call({
|
|
1682
|
+
resourceId: 'crypto',
|
|
1683
|
+
method: 'getPrice',
|
|
1684
|
+
params: args || {}
|
|
1685
|
+
});
|
|
1686
|
+
},
|
|
1687
|
+
/**
|
|
1688
|
+
* Send cryptocurrency or tokens (creates pending transaction for signing)
|
|
1689
|
+
* @param args.recipient - Contact username, user ID, or Solana wallet address
|
|
1690
|
+
* @param args.token - Token symbol (SOL, USDC), name, or mint address
|
|
1691
|
+
* @param args.amount - Amount to send (in UI units)
|
|
1692
|
+
*/
|
|
1693
|
+
sendToken: async (args) => {
|
|
1694
|
+
return sdk.resources.call({
|
|
1695
|
+
resourceId: 'crypto',
|
|
1696
|
+
method: 'sendToken',
|
|
1697
|
+
params: args || {}
|
|
1698
|
+
});
|
|
1699
|
+
},
|
|
1700
|
+
/**
|
|
1701
|
+
* Set up automated price monitoring with progressive alerts
|
|
1702
|
+
* @param args.tokenAddress - Token contract address to monitor
|
|
1703
|
+
* @param args.direction - Alert direction: "above" or "below"
|
|
1704
|
+
* @param args.targetPrice - Target price in USD to trigger alert
|
|
1705
|
+
* @param args.scriptId - ID of the script to execute when price target is reached
|
|
1706
|
+
* @param args.chainName - Chain name (auto-detected if not provided) (optional)
|
|
1707
|
+
* @param args.percentStep - Progressive alert step percentage (default: 0.1 = 10%) (optional)
|
|
1708
|
+
*/
|
|
1709
|
+
monitorPrice: async (args) => {
|
|
1710
|
+
return sdk.resources.call({
|
|
1711
|
+
resourceId: 'crypto',
|
|
1712
|
+
method: 'monitorPrice',
|
|
1713
|
+
params: args || {}
|
|
1714
|
+
});
|
|
1715
|
+
},
|
|
1716
|
+
/**
|
|
1717
|
+
* List all active crypto price monitoring assignments
|
|
1718
|
+
*/
|
|
1719
|
+
listSubscriptions: async (args) => {
|
|
1720
|
+
return sdk.resources.call({
|
|
1721
|
+
resourceId: 'crypto',
|
|
1722
|
+
method: 'listSubscriptions',
|
|
1723
|
+
params: args || {}
|
|
1724
|
+
});
|
|
1725
|
+
},
|
|
1726
|
+
/**
|
|
1727
|
+
* Stop monitoring a crypto asset
|
|
1728
|
+
* @param args.tokenAddress - Token address to stop monitoring
|
|
1729
|
+
*/
|
|
1730
|
+
unsubscribeAsset: async (args) => {
|
|
1731
|
+
return sdk.resources.call({
|
|
1732
|
+
resourceId: 'crypto',
|
|
1733
|
+
method: 'unsubscribeAsset',
|
|
1734
|
+
params: args || {}
|
|
1735
|
+
});
|
|
1736
|
+
}
|
|
1737
|
+
};
|
|
1738
|
+
}
|
|
1739
|
+
/**
|
|
1740
|
+
* Scripts Adapter
|
|
1741
|
+
* Category: productivity
|
|
1742
|
+
*/
|
|
1743
|
+
function createScriptsAdapter(sdk) {
|
|
1744
|
+
return {
|
|
1745
|
+
/**
|
|
1746
|
+
* Create a new script with initial version and API key. IMPORTANT: The script ID for subsequent operations (deployScript, executeScript, etc.) is returned at data._id in the response.
|
|
1747
|
+
* @param args.name - Name of the script
|
|
1748
|
+
* @param args.description - Description of what the script does (optional)
|
|
1749
|
+
* @param args.runtime - Lambda runtime (default: nodejs18) (optional)
|
|
1750
|
+
* @param args.config - Script configuration (timeout, memory, maxCostPerExecution, etc.) (optional)
|
|
1751
|
+
* @param args.code - Initial JavaScript/TypeScript code for the script
|
|
1752
|
+
*/
|
|
1753
|
+
createScript: async (args) => {
|
|
1754
|
+
return sdk.resources.call({
|
|
1755
|
+
resourceId: 'scripts',
|
|
1756
|
+
method: 'createScript',
|
|
1757
|
+
params: args || {}
|
|
1758
|
+
});
|
|
1759
|
+
},
|
|
1760
|
+
/**
|
|
1761
|
+
* Delete a script and all its versions
|
|
1762
|
+
* @param args.scriptId - ID of the script to delete
|
|
1763
|
+
*/
|
|
1764
|
+
deleteScript: async (args) => {
|
|
1765
|
+
return sdk.resources.call({
|
|
1766
|
+
resourceId: 'scripts',
|
|
1767
|
+
method: 'deleteScript',
|
|
1768
|
+
params: args || {}
|
|
1769
|
+
});
|
|
1770
|
+
},
|
|
1771
|
+
/**
|
|
1772
|
+
* Create a new version of an existing script.
|
|
1773
|
+
* @param args.scriptId - ID of the script
|
|
1774
|
+
* @param args.code - Updated code for the new version
|
|
1775
|
+
* @param args.commitMessage - Description of changes in this version (optional)
|
|
1776
|
+
*/
|
|
1777
|
+
createVersion: async (args) => {
|
|
1778
|
+
return sdk.resources.call({
|
|
1779
|
+
resourceId: 'scripts',
|
|
1780
|
+
method: 'createVersion',
|
|
1781
|
+
params: args || {}
|
|
1782
|
+
});
|
|
1783
|
+
},
|
|
1784
|
+
/**
|
|
1785
|
+
* List all versions of a script
|
|
1786
|
+
* @param args.scriptId - ID of the script
|
|
1787
|
+
*/
|
|
1788
|
+
listVersions: async (args) => {
|
|
1789
|
+
return sdk.resources.call({
|
|
1790
|
+
resourceId: 'scripts',
|
|
1791
|
+
method: 'listVersions',
|
|
1792
|
+
params: args || {}
|
|
1793
|
+
});
|
|
1794
|
+
},
|
|
1795
|
+
/**
|
|
1796
|
+
* Deploy a script version to AWS Lambda. Must be called after createScript to make the script executable.
|
|
1797
|
+
* @param args.scriptId - ID of the script to deploy (from createScript response at data._id)
|
|
1798
|
+
* @param args.version - Version number to deploy (default: latest) (optional)
|
|
1799
|
+
*/
|
|
1800
|
+
deployScript: async (args) => {
|
|
1801
|
+
return sdk.resources.call({
|
|
1802
|
+
resourceId: 'scripts',
|
|
1803
|
+
method: 'deployScript',
|
|
1804
|
+
params: args || {}
|
|
1805
|
+
});
|
|
1806
|
+
},
|
|
1807
|
+
/**
|
|
1808
|
+
* Execute a deployed script with custom data. Script must be deployed first via deployScript.
|
|
1809
|
+
* @param args.scriptId - ID of the script to execute (from createScript response at data._id)
|
|
1810
|
+
* @param args.data - Input data to pass to the script (optional)
|
|
1811
|
+
* @param args.trigger - Trigger information (type, source, event) (optional)
|
|
1812
|
+
*/
|
|
1813
|
+
executeScript: async (args) => {
|
|
1814
|
+
return sdk.resources.call({
|
|
1815
|
+
resourceId: 'scripts',
|
|
1816
|
+
method: 'executeScript',
|
|
1817
|
+
params: args || {}
|
|
1818
|
+
});
|
|
1819
|
+
},
|
|
1820
|
+
/**
|
|
1821
|
+
* Get details of a specific script
|
|
1822
|
+
* @param args.scriptId - ID of the script
|
|
1823
|
+
*/
|
|
1824
|
+
getScript: async (args) => {
|
|
1825
|
+
return sdk.resources.call({
|
|
1826
|
+
resourceId: 'scripts',
|
|
1827
|
+
method: 'getScript',
|
|
1828
|
+
params: args || {}
|
|
1829
|
+
});
|
|
1830
|
+
},
|
|
1831
|
+
/**
|
|
1832
|
+
* List all scripts owned by the user
|
|
1833
|
+
*/
|
|
1834
|
+
listScripts: async (args) => {
|
|
1835
|
+
return sdk.resources.call({
|
|
1836
|
+
resourceId: 'scripts',
|
|
1837
|
+
method: 'listScripts',
|
|
1838
|
+
params: args || {}
|
|
1839
|
+
});
|
|
1840
|
+
},
|
|
1841
|
+
/**
|
|
1842
|
+
* Get execution history for a script
|
|
1843
|
+
* @param args.scriptId - ID of the script
|
|
1844
|
+
* @param args.status - Filter by status (completed, failed, running) (optional)
|
|
1845
|
+
* @param args.limit - Maximum number of executions to return (default: 100) (optional)
|
|
1846
|
+
*/
|
|
1847
|
+
getExecutions: async (args) => {
|
|
1848
|
+
return sdk.resources.call({
|
|
1849
|
+
resourceId: 'scripts',
|
|
1850
|
+
method: 'getExecutions',
|
|
1851
|
+
params: args || {}
|
|
1852
|
+
});
|
|
1853
|
+
},
|
|
1854
|
+
/**
|
|
1855
|
+
* Get details of a specific execution
|
|
1856
|
+
* @param args.executionId - ID of the execution
|
|
1857
|
+
*/
|
|
1858
|
+
getExecution: async (args) => {
|
|
1859
|
+
return sdk.resources.call({
|
|
1860
|
+
resourceId: 'scripts',
|
|
1861
|
+
method: 'getExecution',
|
|
1862
|
+
params: args || {}
|
|
1863
|
+
});
|
|
1864
|
+
},
|
|
1865
|
+
/**
|
|
1866
|
+
* Publish a script to the marketplace
|
|
1867
|
+
* @param args.scriptId - ID of the script to publish
|
|
1868
|
+
* @param args.pricing - Pricing configuration for the marketplace (optional)
|
|
1869
|
+
*/
|
|
1870
|
+
publishScript: async (args) => {
|
|
1871
|
+
return sdk.resources.call({
|
|
1872
|
+
resourceId: 'scripts',
|
|
1873
|
+
method: 'publishScript',
|
|
1874
|
+
params: args || {}
|
|
1875
|
+
});
|
|
1876
|
+
},
|
|
1877
|
+
/**
|
|
1878
|
+
* Remove a script from the marketplace
|
|
1879
|
+
* @param args.scriptId - ID of the script to unpublish
|
|
1880
|
+
*/
|
|
1881
|
+
unpublishScript: async (args) => {
|
|
1882
|
+
return sdk.resources.call({
|
|
1883
|
+
resourceId: 'scripts',
|
|
1884
|
+
method: 'unpublishScript',
|
|
1885
|
+
params: args || {}
|
|
1886
|
+
});
|
|
1887
|
+
},
|
|
1888
|
+
/**
|
|
1889
|
+
* List all published scripts in the marketplace
|
|
1890
|
+
*/
|
|
1891
|
+
listMarketplaceScripts: async (args) => {
|
|
1892
|
+
return sdk.resources.call({
|
|
1893
|
+
resourceId: 'scripts',
|
|
1894
|
+
method: 'listMarketplaceScripts',
|
|
1895
|
+
params: args || {}
|
|
1896
|
+
});
|
|
1897
|
+
},
|
|
1898
|
+
/**
|
|
1899
|
+
* Get execution metrics for a script
|
|
1900
|
+
* @param args.scriptId - ID of the script
|
|
1901
|
+
*/
|
|
1902
|
+
getMetrics: async (args) => {
|
|
1903
|
+
return sdk.resources.call({
|
|
1904
|
+
resourceId: 'scripts',
|
|
1905
|
+
method: 'getMetrics',
|
|
1906
|
+
params: args || {}
|
|
1907
|
+
});
|
|
1908
|
+
},
|
|
1909
|
+
/**
|
|
1910
|
+
* Create a webhook endpoint for the script
|
|
1911
|
+
* @param args.scriptId - ID of the script
|
|
1912
|
+
* @param args.name - Name of the webhook
|
|
1913
|
+
* @param args.enabled - Whether webhook is enabled (default: true) (optional)
|
|
1914
|
+
*/
|
|
1915
|
+
createWebhook: async (args) => {
|
|
1916
|
+
return sdk.resources.call({
|
|
1917
|
+
resourceId: 'scripts',
|
|
1918
|
+
method: 'createWebhook',
|
|
1919
|
+
params: args || {}
|
|
1920
|
+
});
|
|
1921
|
+
},
|
|
1922
|
+
/**
|
|
1923
|
+
* Create a cron schedule for the script
|
|
1924
|
+
* @param args.scriptId - ID of the script
|
|
1925
|
+
* @param args.name - Name of the schedule
|
|
1926
|
+
* @param args.cronExpression - Cron expression (e.g., "0 9 * * *" for daily at 9am)
|
|
1927
|
+
* @param args.enabled - Whether schedule is enabled (default: true) (optional)
|
|
1928
|
+
* @param args.data - Data to pass to the script on scheduled execution (optional)
|
|
1929
|
+
*/
|
|
1930
|
+
createSchedule: async (args) => {
|
|
1931
|
+
return sdk.resources.call({
|
|
1932
|
+
resourceId: 'scripts',
|
|
1933
|
+
method: 'createSchedule',
|
|
1934
|
+
params: args || {}
|
|
1935
|
+
});
|
|
1936
|
+
},
|
|
1937
|
+
/**
|
|
1938
|
+
* Get the script code for a specific flow
|
|
1939
|
+
* @param args.flowId - ID of the flow to get script code for
|
|
1940
|
+
*/
|
|
1941
|
+
getFlowScript: async (args) => {
|
|
1942
|
+
return sdk.resources.call({
|
|
1943
|
+
resourceId: 'scripts',
|
|
1944
|
+
method: 'getFlowScript',
|
|
1945
|
+
params: args || {}
|
|
1946
|
+
});
|
|
1947
|
+
},
|
|
1948
|
+
/**
|
|
1949
|
+
* Modify the script code for a flow. Automatically creates a copy if user doesn't own the original, deploys to Lambda, and updates the flow.
|
|
1950
|
+
* @param args.flowId - ID of the flow to modify
|
|
1951
|
+
* @param args.newCode - New code to deploy
|
|
1952
|
+
* @param args.commitMessage - Description of changes (optional)
|
|
1953
|
+
*/
|
|
1954
|
+
modifyFlowScript: async (args) => {
|
|
1955
|
+
return sdk.resources.call({
|
|
1956
|
+
resourceId: 'scripts',
|
|
1957
|
+
method: 'modifyFlowScript',
|
|
1958
|
+
params: args || {}
|
|
1959
|
+
});
|
|
1960
|
+
},
|
|
1961
|
+
/**
|
|
1962
|
+
* Validate script code BEFORE creating or deploying. Checks for: 1) Missing async handler wrapper (top-level await errors), 2) Invalid adapter operations. Returns validation errors with suggestions for fixes. ALWAYS use this before createScript/modifyFlowScript.
|
|
1963
|
+
* @param args.code - The script code to validate
|
|
1964
|
+
*/
|
|
1965
|
+
lintScript: async (args) => {
|
|
1966
|
+
return sdk.resources.call({
|
|
1967
|
+
resourceId: 'scripts',
|
|
1968
|
+
method: 'lintScript',
|
|
1969
|
+
params: args || {}
|
|
1970
|
+
});
|
|
1971
|
+
}
|
|
1972
|
+
};
|
|
1973
|
+
}
|
|
1974
|
+
// ============================================================================
|
|
1975
|
+
// Exports
|
|
1976
|
+
// ============================================================================
|
|
1977
|
+
exports.generatedAdapters = {
|
|
1978
|
+
flows: createFlowsAdapter,
|
|
1979
|
+
user: createUserAdapter,
|
|
1980
|
+
contacts: createContactsAdapter,
|
|
1981
|
+
memory: createMemoryAdapter,
|
|
1982
|
+
ai: createAiAdapter,
|
|
1983
|
+
document: createDocumentAdapter,
|
|
1984
|
+
feedItems: createFeedItemsAdapter,
|
|
1985
|
+
telegram: createTelegramAdapter,
|
|
1986
|
+
googleGmail: createGoogleGmailAdapter,
|
|
1987
|
+
googleCalendar: createGoogleCalendarAdapter,
|
|
1988
|
+
googleDrive: createGoogleDriveAdapter,
|
|
1989
|
+
googleSheets: createGoogleSheetsAdapter,
|
|
1990
|
+
googleDocs: createGoogleDocsAdapter,
|
|
1991
|
+
jira: createJiraAdapter,
|
|
1992
|
+
twitter: createTwitterAdapter,
|
|
1993
|
+
trello: createTrelloAdapter,
|
|
1994
|
+
jupiter: createJupiterAdapter,
|
|
1995
|
+
crypto: createCryptoAdapter,
|
|
1996
|
+
scripts: createScriptsAdapter
|
|
1997
|
+
};
|
|
1998
|
+
//# sourceMappingURL=adapters.js.map
|