@rainfall-devkit/sdk 0.1.8 → 0.2.1

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 (58) hide show
  1. package/README.md +51 -0
  2. package/dist/chunk-7MRE4ZVI.mjs +662 -0
  3. package/dist/chunk-AQFC7YAX.mjs +27 -0
  4. package/dist/chunk-EI7SJH5K.mjs +85 -0
  5. package/dist/chunk-NTTAVKRT.mjs +89 -0
  6. package/dist/chunk-RVKW5KBT.mjs +269 -0
  7. package/dist/chunk-V5QWJVLC.mjs +662 -0
  8. package/dist/chunk-VDPKDC3R.mjs +869 -0
  9. package/dist/chunk-WOITG5TG.mjs +84 -0
  10. package/dist/chunk-XAHJQRBJ.mjs +269 -0
  11. package/dist/chunk-XEQ6U3JQ.mjs +269 -0
  12. package/dist/cli/index.js +3797 -632
  13. package/dist/cli/index.mjs +453 -36
  14. package/dist/config-7UT7GYSN.mjs +16 -0
  15. package/dist/config-DDTQQBN7.mjs +14 -0
  16. package/dist/config-MD45VGWD.mjs +14 -0
  17. package/dist/config-ZKNHII2A.mjs +8 -0
  18. package/dist/daemon/index.d.mts +168 -0
  19. package/dist/daemon/index.d.ts +168 -0
  20. package/dist/daemon/index.js +3182 -0
  21. package/dist/daemon/index.mjs +1548 -0
  22. package/dist/errors-BMPseAnM.d.mts +47 -0
  23. package/dist/errors-BMPseAnM.d.ts +47 -0
  24. package/dist/errors-CZdRoYyw.d.ts +332 -0
  25. package/dist/errors-Chjq1Mev.d.mts +332 -0
  26. package/dist/index.d.mts +249 -2
  27. package/dist/index.d.ts +249 -2
  28. package/dist/index.js +1247 -3
  29. package/dist/index.mjs +227 -2
  30. package/dist/listeners-B5Vy9Ao5.d.ts +372 -0
  31. package/dist/listeners-BbYIaNCs.d.mts +372 -0
  32. package/dist/listeners-CP2A9J_2.d.ts +372 -0
  33. package/dist/listeners-CTRSofnm.d.mts +372 -0
  34. package/dist/listeners-CYI-YwIF.d.mts +372 -0
  35. package/dist/listeners-DRwITBW_.d.mts +372 -0
  36. package/dist/listeners-DrMrvFT5.d.ts +372 -0
  37. package/dist/listeners-MNAnpZj-.d.mts +372 -0
  38. package/dist/listeners-PZI7iT85.d.ts +372 -0
  39. package/dist/listeners-QJeEtLbV.d.ts +372 -0
  40. package/dist/listeners-hp0Ib2Ox.d.ts +372 -0
  41. package/dist/listeners-jLwetUnx.d.mts +372 -0
  42. package/dist/mcp.d.mts +7 -2
  43. package/dist/mcp.d.ts +7 -2
  44. package/dist/mcp.js +92 -1
  45. package/dist/mcp.mjs +1 -1
  46. package/dist/sdk-4OvXPr8E.d.mts +1054 -0
  47. package/dist/sdk-4OvXPr8E.d.ts +1054 -0
  48. package/dist/sdk-CJ9g5lFo.d.mts +772 -0
  49. package/dist/sdk-CJ9g5lFo.d.ts +772 -0
  50. package/dist/sdk-CN1ezZrI.d.mts +1054 -0
  51. package/dist/sdk-CN1ezZrI.d.ts +1054 -0
  52. package/dist/sdk-DD1OeGRJ.d.mts +871 -0
  53. package/dist/sdk-DD1OeGRJ.d.ts +871 -0
  54. package/dist/sdk-Xw0BjsLd.d.mts +1054 -0
  55. package/dist/sdk-Xw0BjsLd.d.ts +1054 -0
  56. package/dist/types-GnRAfH-h.d.mts +489 -0
  57. package/dist/types-GnRAfH-h.d.ts +489 -0
  58. package/package.json +17 -5
@@ -0,0 +1,871 @@
1
+ /**
2
+ * Core types for the Rainfall SDK
3
+ */
4
+ interface RainfallConfig {
5
+ apiKey: string;
6
+ baseUrl?: string;
7
+ timeout?: number;
8
+ retries?: number;
9
+ retryDelay?: number;
10
+ }
11
+ interface RequestOptions {
12
+ timeout?: number;
13
+ retries?: number;
14
+ retryDelay?: number;
15
+ }
16
+ interface ApiResponse<T = unknown> {
17
+ success: boolean;
18
+ data?: T;
19
+ error?: ApiError;
20
+ }
21
+ interface ApiError {
22
+ code: string;
23
+ message: string;
24
+ details?: Record<string, unknown>;
25
+ }
26
+ interface RateLimitInfo {
27
+ limit: number;
28
+ remaining: number;
29
+ resetAt: Date;
30
+ }
31
+ interface ToolSchema {
32
+ name: string;
33
+ description: string;
34
+ category: string;
35
+ parameters: unknown;
36
+ output: unknown;
37
+ metadata: Record<string, unknown>;
38
+ }
39
+ declare namespace Integrations {
40
+ interface GitHub {
41
+ issues: {
42
+ create(params: {
43
+ owner: string;
44
+ repo: string;
45
+ title: string;
46
+ body?: string;
47
+ }): Promise<unknown>;
48
+ list(params: {
49
+ owner: string;
50
+ repo: string;
51
+ state?: 'open' | 'closed' | 'all';
52
+ }): Promise<unknown>;
53
+ get(params: {
54
+ owner: string;
55
+ repo: string;
56
+ issue_number: number;
57
+ }): Promise<unknown>;
58
+ update(params: {
59
+ owner: string;
60
+ repo: string;
61
+ issue_number: number;
62
+ title?: string;
63
+ body?: string;
64
+ state?: 'open' | 'closed';
65
+ }): Promise<unknown>;
66
+ addComment(params: {
67
+ owner: string;
68
+ repo: string;
69
+ issue_number: number;
70
+ body: string;
71
+ }): Promise<unknown>;
72
+ };
73
+ repos: {
74
+ get(params: {
75
+ owner: string;
76
+ repo: string;
77
+ }): Promise<unknown>;
78
+ listBranches(params: {
79
+ owner: string;
80
+ repo: string;
81
+ }): Promise<unknown>;
82
+ };
83
+ pullRequests: {
84
+ list(params: {
85
+ owner: string;
86
+ repo: string;
87
+ state?: 'open' | 'closed' | 'all';
88
+ }): Promise<unknown>;
89
+ get(params: {
90
+ owner: string;
91
+ repo: string;
92
+ pullNumber: number;
93
+ }): Promise<unknown>;
94
+ };
95
+ }
96
+ interface Notion {
97
+ pages: {
98
+ create(params: {
99
+ parent: unknown;
100
+ properties: unknown;
101
+ children?: unknown[];
102
+ }): Promise<unknown>;
103
+ retrieve(params: {
104
+ pageId: string;
105
+ }): Promise<unknown>;
106
+ update(params: {
107
+ pageId: string;
108
+ properties: unknown;
109
+ }): Promise<unknown>;
110
+ };
111
+ databases: {
112
+ query(params: {
113
+ databaseId: string;
114
+ filter?: unknown;
115
+ sorts?: unknown[];
116
+ }): Promise<unknown>;
117
+ retrieve(params: {
118
+ databaseId: string;
119
+ }): Promise<unknown>;
120
+ };
121
+ blocks: {
122
+ appendChildren(params: {
123
+ blockId: string;
124
+ children: unknown[];
125
+ }): Promise<unknown>;
126
+ retrieveChildren(params: {
127
+ blockId: string;
128
+ }): Promise<unknown>;
129
+ };
130
+ }
131
+ interface Linear {
132
+ issues: {
133
+ create(params: {
134
+ title: string;
135
+ description?: string;
136
+ teamId?: string;
137
+ assigneeId?: string;
138
+ priority?: number;
139
+ labels?: string[];
140
+ }): Promise<unknown>;
141
+ list(params?: {
142
+ filter?: unknown;
143
+ orderBy?: string;
144
+ }): Promise<unknown>;
145
+ get(params: {
146
+ issueId: string;
147
+ }): Promise<unknown>;
148
+ update(params: {
149
+ issueId: string;
150
+ title?: string;
151
+ description?: string;
152
+ state?: string;
153
+ }): Promise<unknown>;
154
+ archive(params: {
155
+ issueId: string;
156
+ }): Promise<unknown>;
157
+ };
158
+ teams: {
159
+ list(): Promise<unknown>;
160
+ };
161
+ }
162
+ interface Slack {
163
+ messages: {
164
+ send(params: {
165
+ channelId: string;
166
+ text: string;
167
+ blocks?: unknown[];
168
+ }): Promise<unknown>;
169
+ list(params: {
170
+ channelId: string;
171
+ limit?: number;
172
+ }): Promise<unknown>;
173
+ };
174
+ channels: {
175
+ list(): Promise<unknown>;
176
+ };
177
+ users: {
178
+ list(): Promise<unknown>;
179
+ };
180
+ reactions: {
181
+ add(params: {
182
+ channelId: string;
183
+ timestamp: string;
184
+ reaction: string;
185
+ }): Promise<unknown>;
186
+ };
187
+ }
188
+ interface Figma {
189
+ files: {
190
+ get(params: {
191
+ fileKey: string;
192
+ }): Promise<unknown>;
193
+ getNodes(params: {
194
+ fileKey: string;
195
+ nodeIds: string[];
196
+ }): Promise<unknown>;
197
+ getImages(params: {
198
+ fileKey: string;
199
+ nodeIds: string[];
200
+ format?: 'png' | 'svg' | 'pdf';
201
+ }): Promise<unknown>;
202
+ getComments(params: {
203
+ fileKey: string;
204
+ }): Promise<unknown>;
205
+ postComment(params: {
206
+ fileKey: string;
207
+ message: string;
208
+ nodeId?: string;
209
+ }): Promise<unknown>;
210
+ };
211
+ projects: {
212
+ list(params: {
213
+ teamId: string;
214
+ }): Promise<unknown>;
215
+ getFiles(params: {
216
+ projectId: string;
217
+ }): Promise<unknown>;
218
+ };
219
+ }
220
+ interface Stripe {
221
+ customers: {
222
+ create(params: {
223
+ email: string;
224
+ name?: string;
225
+ metadata?: Record<string, string>;
226
+ }): Promise<unknown>;
227
+ retrieve(params: {
228
+ customerId: string;
229
+ }): Promise<unknown>;
230
+ update(params: {
231
+ customerId: string;
232
+ metadata?: Record<string, string>;
233
+ }): Promise<unknown>;
234
+ listPaymentMethods(params: {
235
+ customerId: string;
236
+ }): Promise<unknown>;
237
+ };
238
+ paymentIntents: {
239
+ create(params: {
240
+ amount: number;
241
+ currency: string;
242
+ customer?: string;
243
+ }): Promise<unknown>;
244
+ retrieve(params: {
245
+ paymentIntentId: string;
246
+ }): Promise<unknown>;
247
+ confirm(params: {
248
+ paymentIntentId: string;
249
+ }): Promise<unknown>;
250
+ };
251
+ subscriptions: {
252
+ create(params: {
253
+ customer: string;
254
+ items: unknown[];
255
+ }): Promise<unknown>;
256
+ retrieve(params: {
257
+ subscriptionId: string;
258
+ }): Promise<unknown>;
259
+ cancel(params: {
260
+ subscriptionId: string;
261
+ }): Promise<unknown>;
262
+ };
263
+ }
264
+ }
265
+ declare namespace Memory {
266
+ interface MemoryClient {
267
+ create(params: {
268
+ content: string;
269
+ keywords?: string[];
270
+ metadata?: Record<string, unknown>;
271
+ }): Promise<unknown>;
272
+ get(params: {
273
+ memoryId: string;
274
+ }): Promise<unknown>;
275
+ recall(params: {
276
+ query: string;
277
+ topK?: number;
278
+ threshold?: number;
279
+ }): Promise<unknown>;
280
+ list(params?: {
281
+ limit?: number;
282
+ offset?: number;
283
+ }): Promise<unknown>;
284
+ update(params: {
285
+ memoryId: string;
286
+ content?: string;
287
+ metadata?: Record<string, unknown>;
288
+ }): Promise<unknown>;
289
+ delete(params: {
290
+ memoryId: string;
291
+ }): Promise<unknown>;
292
+ }
293
+ }
294
+ declare namespace Articles {
295
+ interface ArticlesClient {
296
+ search(params: {
297
+ query: string;
298
+ limit?: number;
299
+ }): Promise<unknown>;
300
+ create(params: {
301
+ title: string;
302
+ content: string;
303
+ topics?: string[];
304
+ metadata?: Record<string, unknown>;
305
+ }): Promise<unknown>;
306
+ createFromUrl(params: {
307
+ url: string;
308
+ }): Promise<unknown>;
309
+ fetch(params: {
310
+ articleId: string;
311
+ }): Promise<unknown>;
312
+ recent(params?: {
313
+ limit?: number;
314
+ }): Promise<unknown>;
315
+ relevant(params: {
316
+ query: string;
317
+ limit?: number;
318
+ }): Promise<unknown>;
319
+ summarize(params: {
320
+ articleId?: string;
321
+ text?: string;
322
+ length?: 'short' | 'medium' | 'long';
323
+ }): Promise<unknown>;
324
+ extractTopics(params: {
325
+ text: string;
326
+ }): Promise<unknown>;
327
+ }
328
+ }
329
+ declare namespace Web {
330
+ interface WebClient {
331
+ search: {
332
+ exa(params: {
333
+ query: string;
334
+ numResults?: number;
335
+ includeDomains?: string[];
336
+ excludeDomains?: string[];
337
+ }): Promise<unknown>;
338
+ perplexity(params: {
339
+ query: string;
340
+ }): Promise<unknown>;
341
+ };
342
+ fetch(params: {
343
+ url: string;
344
+ headers?: Record<string, string>;
345
+ }): Promise<unknown>;
346
+ htmlToMarkdown(params: {
347
+ html: string;
348
+ baseUrl?: string;
349
+ }): Promise<unknown>;
350
+ extractHtml(params: {
351
+ html: string;
352
+ selector: string;
353
+ }): Promise<unknown>;
354
+ }
355
+ }
356
+ declare namespace AI {
357
+ interface AIClient {
358
+ embeddings: {
359
+ document(params: {
360
+ text: string;
361
+ }): Promise<unknown>;
362
+ query(params: {
363
+ text: string;
364
+ }): Promise<unknown>;
365
+ image(params: {
366
+ imageBase64: string;
367
+ }): Promise<unknown>;
368
+ };
369
+ image: {
370
+ generate(params: {
371
+ prompt: string;
372
+ size?: '256x256' | '512x512' | '1024x1024';
373
+ }): Promise<unknown>;
374
+ };
375
+ ocr(params: {
376
+ imageBase64: string;
377
+ }): Promise<unknown>;
378
+ vision(params: {
379
+ imageBase64: string;
380
+ prompt?: string;
381
+ }): Promise<unknown>;
382
+ chat(params: {
383
+ messages: Array<{
384
+ role: 'user' | 'assistant' | 'system';
385
+ content: string;
386
+ }>;
387
+ model?: string;
388
+ }): Promise<unknown>;
389
+ complete(params: {
390
+ prompt: string;
391
+ suffix?: string;
392
+ }): Promise<unknown>;
393
+ classify(params: {
394
+ text: string;
395
+ labels: string[];
396
+ }): Promise<unknown>;
397
+ segment(params: {
398
+ text: string;
399
+ maxLength?: number;
400
+ }): Promise<unknown[]>;
401
+ }
402
+ }
403
+ declare namespace Data {
404
+ interface DataClient {
405
+ csv: {
406
+ query(params: {
407
+ sql: string;
408
+ csvData?: string;
409
+ fileId?: string;
410
+ }): Promise<unknown>;
411
+ convert(params: {
412
+ data: string;
413
+ fromFormat: string;
414
+ toFormat: string;
415
+ }): Promise<unknown>;
416
+ };
417
+ scripts: {
418
+ create(params: {
419
+ name: string;
420
+ code: string;
421
+ language?: string;
422
+ }): Promise<unknown>;
423
+ execute(params: {
424
+ name: string;
425
+ params?: Record<string, unknown>;
426
+ }): Promise<unknown>;
427
+ list(): Promise<unknown>;
428
+ update(params: {
429
+ name: string;
430
+ code: string;
431
+ }): Promise<unknown>;
432
+ delete(params: {
433
+ name: string;
434
+ }): Promise<unknown>;
435
+ };
436
+ similarity: {
437
+ search(params: {
438
+ query: number[];
439
+ embeddings: number[][];
440
+ topK?: number;
441
+ }): Promise<unknown>;
442
+ duckDbSearch(params: {
443
+ query: number[];
444
+ tableName: string;
445
+ }): Promise<unknown>;
446
+ };
447
+ }
448
+ }
449
+ declare namespace Utils {
450
+ interface UtilsClient {
451
+ mermaid(params: {
452
+ diagram: string;
453
+ }): Promise<unknown>;
454
+ documentConvert(params: {
455
+ document: string;
456
+ mimeType: string;
457
+ format: string;
458
+ }): Promise<unknown>;
459
+ regex: {
460
+ match(params: {
461
+ text: string;
462
+ pattern: string;
463
+ flags?: string;
464
+ }): Promise<unknown>;
465
+ replace(params: {
466
+ text: string;
467
+ pattern: string;
468
+ replacement: string;
469
+ flags?: string;
470
+ }): Promise<unknown>;
471
+ };
472
+ jsonExtract(params: {
473
+ text: string;
474
+ }): Promise<unknown>;
475
+ digest(params: {
476
+ data: string;
477
+ }): Promise<string>;
478
+ monteCarlo(params: {
479
+ iterations?: number;
480
+ formula: string;
481
+ variables?: Record<string, {
482
+ mean: number;
483
+ stdDev: number;
484
+ }>;
485
+ }): Promise<unknown>;
486
+ }
487
+ }
488
+
489
+ /**
490
+ * Core HTTP client for Rainfall SDK
491
+ */
492
+
493
+ declare class RainfallClient {
494
+ private readonly apiKey;
495
+ private readonly baseUrl;
496
+ private readonly defaultTimeout;
497
+ private readonly defaultRetries;
498
+ private readonly defaultRetryDelay;
499
+ private lastRateLimitInfo?;
500
+ private subscriberId?;
501
+ constructor(config: RainfallConfig);
502
+ /**
503
+ * Get the last rate limit info from the API
504
+ */
505
+ getRateLimitInfo(): RateLimitInfo | undefined;
506
+ /**
507
+ * Make an authenticated request to the Rainfall API
508
+ */
509
+ request<T = unknown>(path: string, options?: {
510
+ method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
511
+ body?: unknown;
512
+ headers?: Record<string, string>;
513
+ }, requestOptions?: RequestOptions): Promise<T>;
514
+ /**
515
+ * Execute a tool/node by ID
516
+ */
517
+ executeTool<T = unknown>(toolId: string, params?: Record<string, unknown>, options?: RequestOptions): Promise<T>;
518
+ /**
519
+ * List all available tools
520
+ */
521
+ listTools(): Promise<Array<{
522
+ id: string;
523
+ name: string;
524
+ description: string;
525
+ category: string;
526
+ }>>;
527
+ /**
528
+ * Get tool schema/parameters
529
+ */
530
+ getToolSchema(toolId: string): Promise<ToolSchema>;
531
+ /**
532
+ * Get subscriber info
533
+ */
534
+ getMe(): Promise<{
535
+ id: string;
536
+ name: string;
537
+ email?: string;
538
+ plan?: string;
539
+ billingStatus?: string;
540
+ usage: {
541
+ callsThisMonth: number;
542
+ callsLimit: number;
543
+ };
544
+ }>;
545
+ /**
546
+ * Ensure we have a subscriber ID, fetching it if necessary
547
+ */
548
+ private ensureSubscriberId;
549
+ private sleep;
550
+ /**
551
+ * OpenAI-compatible chat completions with tool support
552
+ */
553
+ chatCompletions(params: {
554
+ subscriber_id: string;
555
+ messages: Array<{
556
+ role: string;
557
+ content: string;
558
+ name?: string;
559
+ }>;
560
+ model?: string;
561
+ stream?: boolean;
562
+ temperature?: number;
563
+ max_tokens?: number;
564
+ tools?: unknown[];
565
+ tool_choice?: string | {
566
+ type: string;
567
+ function?: {
568
+ name: string;
569
+ };
570
+ };
571
+ conversation_id?: string;
572
+ agent_name?: string;
573
+ incognito?: boolean;
574
+ tool_priority?: 'local' | 'rainfall' | 'serverside' | 'stacked';
575
+ enable_stacked?: boolean;
576
+ }): Promise<unknown>;
577
+ /**
578
+ * List available models (OpenAI-compatible format)
579
+ */
580
+ listModels(subscriberId?: string): Promise<Array<{
581
+ id: string;
582
+ [key: string]: unknown;
583
+ }>>;
584
+ }
585
+
586
+ /**
587
+ * Integrations namespace for Rainfall SDK
588
+ * GitHub, Notion, Linear, Slack, Figma, Stripe
589
+ */
590
+
591
+ declare class IntegrationsNamespace {
592
+ private client;
593
+ constructor(client: RainfallClient);
594
+ get github(): Integrations.GitHub;
595
+ get notion(): Integrations.Notion;
596
+ get linear(): Integrations.Linear;
597
+ get slack(): Integrations.Slack;
598
+ get figma(): Integrations.Figma;
599
+ get stripe(): Integrations.Stripe;
600
+ }
601
+
602
+ declare class Rainfall {
603
+ private readonly client;
604
+ private _integrations?;
605
+ private _memory?;
606
+ private _articles?;
607
+ private _web?;
608
+ private _ai?;
609
+ private _data?;
610
+ private _utils?;
611
+ constructor(config: RainfallConfig);
612
+ /**
613
+ * Integrations namespace - GitHub, Notion, Linear, Slack, Figma, Stripe
614
+ *
615
+ * @example
616
+ * ```typescript
617
+ * // GitHub
618
+ * await rainfall.integrations.github.issues.create({
619
+ * owner: 'facebook',
620
+ * repo: 'react',
621
+ * title: 'Bug report'
622
+ * });
623
+ *
624
+ * // Slack
625
+ * await rainfall.integrations.slack.messages.send({
626
+ * channelId: 'C123456',
627
+ * text: 'Hello team!'
628
+ * });
629
+ *
630
+ * // Linear
631
+ * const issues = await rainfall.integrations.linear.issues.list();
632
+ * ```
633
+ */
634
+ get integrations(): IntegrationsNamespace;
635
+ /**
636
+ * Memory namespace - Semantic memory storage and retrieval
637
+ *
638
+ * @example
639
+ * ```typescript
640
+ * // Store a memory
641
+ * await rainfall.memory.create({
642
+ * content: 'User prefers dark mode',
643
+ * keywords: ['preference', 'ui']
644
+ * });
645
+ *
646
+ * // Recall similar memories
647
+ * const memories = await rainfall.memory.recall({
648
+ * query: 'user preferences',
649
+ * topK: 5
650
+ * });
651
+ * ```
652
+ */
653
+ get memory(): Memory.MemoryClient;
654
+ /**
655
+ * Articles namespace - News aggregation and article management
656
+ *
657
+ * @example
658
+ * ```typescript
659
+ * // Search news
660
+ * const articles = await rainfall.articles.search({
661
+ * query: 'artificial intelligence'
662
+ * });
663
+ *
664
+ * // Create from URL
665
+ * const article = await rainfall.articles.createFromUrl({
666
+ * url: 'https://example.com/article'
667
+ * });
668
+ *
669
+ * // Summarize
670
+ * const summary = await rainfall.articles.summarize({
671
+ * text: article.content
672
+ * });
673
+ * ```
674
+ */
675
+ get articles(): Articles.ArticlesClient;
676
+ /**
677
+ * Web namespace - Web search, scraping, and content extraction
678
+ *
679
+ * @example
680
+ * ```typescript
681
+ * // Search with Exa
682
+ * const results = await rainfall.web.search.exa({
683
+ * query: 'latest AI research'
684
+ * });
685
+ *
686
+ * // Fetch and convert
687
+ * const html = await rainfall.web.fetch({ url: 'https://example.com' });
688
+ * const markdown = await rainfall.web.htmlToMarkdown({ html });
689
+ *
690
+ * // Extract specific elements
691
+ * const links = await rainfall.web.extractHtml({
692
+ * html,
693
+ * selector: 'a[href]'
694
+ * });
695
+ * ```
696
+ */
697
+ get web(): Web.WebClient;
698
+ /**
699
+ * AI namespace - Embeddings, image generation, OCR, vision, chat
700
+ *
701
+ * @example
702
+ * ```typescript
703
+ * // Generate embeddings
704
+ * const embedding = await rainfall.ai.embeddings.document({
705
+ * text: 'Hello world'
706
+ * });
707
+ *
708
+ * // Generate image
709
+ * const image = await rainfall.ai.image.generate({
710
+ * prompt: 'A serene mountain landscape'
711
+ * });
712
+ *
713
+ * // OCR
714
+ * const text = await rainfall.ai.ocr({ imageBase64: '...' });
715
+ *
716
+ * // Chat
717
+ * const response = await rainfall.ai.chat({
718
+ * messages: [{ role: 'user', content: 'Hello!' }]
719
+ * });
720
+ * ```
721
+ */
722
+ get ai(): AI.AIClient;
723
+ /**
724
+ * Data namespace - CSV processing, scripts, similarity search
725
+ *
726
+ * @example
727
+ * ```typescript
728
+ * // Query CSV with SQL
729
+ * const results = await rainfall.data.csv.query({
730
+ * sql: 'SELECT * FROM data WHERE value > 100'
731
+ * });
732
+ *
733
+ * // Execute saved script
734
+ * const result = await rainfall.data.scripts.execute({
735
+ * name: 'my-script',
736
+ * params: { input: 'data' }
737
+ * });
738
+ * ```
739
+ */
740
+ get data(): Data.DataClient;
741
+ /**
742
+ * Utils namespace - Mermaid diagrams, document conversion, regex, JSON extraction
743
+ *
744
+ * @example
745
+ * ```typescript
746
+ * // Generate diagram
747
+ * const diagram = await rainfall.utils.mermaid({
748
+ * diagram: 'graph TD; A-->B;'
749
+ * });
750
+ *
751
+ * // Convert document
752
+ * const pdf = await rainfall.utils.documentConvert({
753
+ * document: markdownContent,
754
+ * mimeType: 'text/markdown',
755
+ * format: 'pdf'
756
+ * });
757
+ *
758
+ * // Extract JSON from text
759
+ * const json = await rainfall.utils.jsonExtract({
760
+ * text: 'Here is some data: {"key": "value"}'
761
+ * });
762
+ * ```
763
+ */
764
+ get utils(): Utils.UtilsClient;
765
+ /**
766
+ * Get the underlying HTTP client for advanced usage
767
+ */
768
+ getClient(): RainfallClient;
769
+ /**
770
+ * List all available tools
771
+ */
772
+ listTools(): Promise<{
773
+ id: string;
774
+ name: string;
775
+ description: string;
776
+ category: string;
777
+ }[]>;
778
+ /**
779
+ * Get schema for a specific tool
780
+ */
781
+ getToolSchema(toolId: string): Promise<ToolSchema>;
782
+ /**
783
+ * Execute any tool by ID (low-level access)
784
+ */
785
+ executeTool<T = unknown>(toolId: string, params?: Record<string, unknown>): Promise<T>;
786
+ /**
787
+ * Get current subscriber info and usage
788
+ */
789
+ getMe(): Promise<{
790
+ id: string;
791
+ name: string;
792
+ email?: string;
793
+ plan?: string;
794
+ billingStatus?: string;
795
+ usage: {
796
+ callsThisMonth: number;
797
+ callsLimit: number;
798
+ };
799
+ }>;
800
+ /**
801
+ * Get current rate limit info
802
+ */
803
+ getRateLimitInfo(): RateLimitInfo | undefined;
804
+ /**
805
+ * OpenAI-compatible chat completions with tool support
806
+ *
807
+ * @example
808
+ * ```typescript
809
+ * // Simple chat
810
+ * const response = await rainfall.chatCompletions({
811
+ * subscriber_id: 'my-subscriber',
812
+ * messages: [{ role: 'user', content: 'Hello!' }],
813
+ * model: 'llama-3.3-70b-versatile'
814
+ * });
815
+ *
816
+ * // With tools
817
+ * const response = await rainfall.chatCompletions({
818
+ * subscriber_id: 'my-subscriber',
819
+ * messages: [{ role: 'user', content: 'Search for AI news' }],
820
+ * tools: [{ type: 'function', function: { name: 'web-search' } }],
821
+ * enable_stacked: true
822
+ * });
823
+ *
824
+ * // Streaming
825
+ * const stream = await rainfall.chatCompletions({
826
+ * subscriber_id: 'my-subscriber',
827
+ * messages: [{ role: 'user', content: 'Tell me a story' }],
828
+ * stream: true
829
+ * });
830
+ * ```
831
+ */
832
+ chatCompletions(params: {
833
+ subscriber_id: string;
834
+ messages: Array<{
835
+ role: string;
836
+ content: string;
837
+ name?: string;
838
+ }>;
839
+ model?: string;
840
+ stream?: boolean;
841
+ temperature?: number;
842
+ max_tokens?: number;
843
+ tools?: unknown[];
844
+ tool_choice?: string | {
845
+ type: string;
846
+ function?: {
847
+ name: string;
848
+ };
849
+ };
850
+ conversation_id?: string;
851
+ agent_name?: string;
852
+ incognito?: boolean;
853
+ tool_priority?: 'local' | 'rainfall' | 'serverside' | 'stacked';
854
+ enable_stacked?: boolean;
855
+ }): Promise<unknown>;
856
+ /**
857
+ * List available models (OpenAI-compatible format)
858
+ *
859
+ * @example
860
+ * ```typescript
861
+ * const models = await rainfall.listModels();
862
+ * console.log(models); // [{ id: 'llama-3.3-70b-versatile', ... }]
863
+ * ```
864
+ */
865
+ listModels(subscriberId?: string): Promise<Array<{
866
+ id: string;
867
+ [key: string]: unknown;
868
+ }>>;
869
+ }
870
+
871
+ export { AI as A, Data as D, Integrations as I, Memory as M, Rainfall as R, type ToolSchema as T, Utils as U, Web as W, type ApiError as a, type ApiResponse as b, Articles as c, RainfallClient as d, type RainfallConfig as e, type RateLimitInfo as f, type RequestOptions as g };