create-bubblelab-app 0.1.5 → 0.1.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-bubblelab-app",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Create BubbleLab AI agent applications with one command",
@@ -1,103 +0,0 @@
1
- /**
2
- * Reddit News Scraper Flow
3
- *
4
- * This is a simple BubbleFlow that scrapes Reddit and summarizes news posts.
5
- */
6
- import {
7
- BubbleFlow,
8
- RedditScrapeTool,
9
- AIAgentBubble,
10
- type WebhookEvent,
11
- } from '@bubblelab/bubble-core';
12
- import { CredentialType } from '@bubblelab/shared-schemas';
13
- import { config } from 'dotenv';
14
-
15
- // Load environment variables from .env file
16
- config();
17
-
18
- /**
19
- * Payload interface for the Reddit news flow
20
- */
21
- interface RedditNewsPayload extends WebhookEvent {
22
- subreddit: string;
23
- limit: number;
24
- }
25
-
26
- /**
27
- * RedditNewsFlow - Scrapes Reddit and summarizes news
28
- *
29
- * This flow demonstrates:
30
- * - Using RedditScrapeTool to scrape subreddit posts
31
- * - Using AIAgentBubble to analyze and summarize content
32
- * - Simple 2-step workflow
33
- */
34
- export class RedditNewsFlow extends BubbleFlow<'webhook/http'> {
35
- async handle(payload: RedditNewsPayload) {
36
- const subreddit = payload.subreddit || 'worldnews';
37
- this.logger?.logLine(36, 'Statement: VariableDeclaration');
38
- const limit = payload.limit || 10;
39
- this.logger?.logLine(37, 'Statement: VariableDeclaration');
40
-
41
- // Step 1: Scrape Reddit for posts
42
- const scrapeResult = await new RedditScrapeTool({
43
- subreddit: subreddit,
44
- sort: 'hot',
45
- limit: limit
46
- }, {logger: this.logger, variableId: 417, dependencyGraph: {"name":"reddit-scrape-tool","uniqueId":"417","variableId":417,"variableName":"scrapeResult","nodeType":"tool","dependencies":[]}, currentUniqueId: "417"}).action();
47
- this.logger?.logLine(44, 'Statement: VariableDeclaration');
48
-
49
- if (!scrapeResult.success || !scrapeResult.data?.posts) {
50
- throw new Error('Failed to scrape Reddit or no posts found.');
51
- this.logger?.logLine(47, 'Statement: ThrowStatement');
52
- }
53
- this.logger?.logLine(48, 'Statement: IfStatement');
54
-
55
- const posts = scrapeResult.data.posts;
56
- this.logger?.logLine(50, 'Statement: VariableDeclaration');
57
-
58
- // Format posts for AI
59
- const postsText = posts
60
- .map(
61
- (
62
- post: {
63
- title: string;
64
- score: number;
65
- selftext: string;
66
- postUrl: string;
67
- },
68
- i: number
69
- ) =>
70
- `${i + 1}. "${post.title}" (${post.score} upvotes)\n ${post.selftext || 'No description'}\n URL: ${post.postUrl}`
71
- )
72
- .join('\n\n');
73
- this.logger?.logLine(66, 'Statement: VariableDeclaration');
74
-
75
- // Step 2: Summarize the news using AI
76
- const summaryResult = await new AIAgentBubble({
77
- message: `Here are the top ${posts.length} posts from r/${subreddit}:
78
-
79
- ${postsText}
80
-
81
- Please provide:
82
- 1. A summary of the top 5 most important/popular news items
83
- 2. Key themes or trends you notice
84
- 3. A one-paragraph executive summary
85
-
86
- Format the response in a clear, readable way.`,
87
- model: {
88
- model: 'google/gemini-2.5-flash',
89
- },
90
- tools: []
91
- }, {logger: this.logger, variableId: 422, dependencyGraph: {"name":"ai-agent","uniqueId":"422","variableId":422,"variableName":"summaryResult","nodeType":"service","dependencies":[]}, currentUniqueId: "422"}).action();
92
- this.logger?.logLine(84, 'Statement: VariableDeclaration');
93
-
94
- return {
95
- subreddit,
96
- postsScraped: posts.length,
97
- summary: summaryResult.data?.response,
98
- timestamp: new Date().toISOString(),
99
- status: 'success',
100
- };
101
- this.logger?.logLine(92, 'Statement: ReturnStatement');
102
- }
103
- }