@bagalobsta/heartbeat-library 1.0.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.
Files changed (3) hide show
  1. package/README.md +43 -0
  2. package/lib/index.js +140 -0
  3. package/package.json +28 -0
package/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Heartbeat Library
2
+
3
+ Pre-built heartbeat tasks for OpenClaw agents. Copy-paste ready.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @bagalobsta/heartbeat-library
9
+ ```
10
+
11
+ ## Tasks Included
12
+
13
+ - ☀️ **Weather Check** — Daily weather forecast
14
+ - 📧 **Email Digest** — Unread email summary
15
+ - 📅 **Calendar Alerts** — Events in next 2 hours
16
+ - 💰 **Price Tracker** — Crypto price monitor
17
+ - 📰 **News Digest** — Top HN stories
18
+ - 📊 **Project Status** — Downloads/sales/stars
19
+ - 🔥 **Moltbook Digest** — Trending posts + DMs
20
+ - 💾 **Backup Reminder** — Weekly backup check
21
+ - ⏰ **Standup Prompt** — Daily standup reminder
22
+
23
+ ## Usage
24
+
25
+ ```javascript
26
+ const tasks = require('@bagalobsta/heartbeat-library');
27
+
28
+ // Get weather check task
29
+ console.log(tasks.weatherCheck.task);
30
+
31
+ // List all tasks
32
+ Object.keys(tasks).forEach(name => {
33
+ console.log(`${name}: ${tasks[name].description}`);
34
+ });
35
+ ```
36
+
37
+ ## Add to Your Heartbeat
38
+
39
+ Copy the task code into your HEARTBEAT.md or cron job. Each task is self-contained and ready to use.
40
+
41
+ ## License
42
+
43
+ MIT
package/lib/index.js ADDED
@@ -0,0 +1,140 @@
1
+ // Heartbeat Library - Pre-built tasks for OpenClaw agents
2
+
3
+ module.exports = {
4
+ // Weather check
5
+ weatherCheck: {
6
+ name: "Check Weather",
7
+ description: "Daily weather forecast for your location",
8
+ frequency: "daily",
9
+ time: "8:00 AM",
10
+ task: `
11
+ import { exec } from 'child_process';
12
+ const result = exec('weather', (err, stdout) => {
13
+ if (err) console.log('Weather unavailable');
14
+ else console.log('🌤️ Today: ' + stdout);
15
+ });
16
+ `
17
+ },
18
+
19
+ // Email digest
20
+ emailDigest: {
21
+ name: "Email Digest",
22
+ description: "Check unread emails and summary",
23
+ frequency: "daily",
24
+ time: "9:00 AM",
25
+ task: `
26
+ const { exec } = require('child_process');
27
+ exec('himalaya list inbox --limit 5', (err, stdout) => {
28
+ if (err) return;
29
+ const unread = stdout.split('\\n').filter(l => l.includes('unread'));
30
+ console.log('📧 Unread: ' + unread.length);
31
+ });
32
+ `
33
+ },
34
+
35
+ // Calendar check
36
+ calendarCheck: {
37
+ name: "Calendar Alerts",
38
+ description: "Show events in next 2 hours",
39
+ frequency: "hourly",
40
+ time: "every hour",
41
+ task: `
42
+ const now = new Date();
43
+ const in2h = new Date(now.getTime() + 2 * 60 * 60 * 1000);
44
+ // Check your calendar API here
45
+ console.log('📅 Next 2 hours: (integrate with your calendar)');
46
+ `
47
+ },
48
+
49
+ // Price tracker
50
+ priceTracker: {
51
+ name: "Price Tracker",
52
+ description: "Monitor crypto prices",
53
+ frequency: "4-hourly",
54
+ time: "every 4 hours",
55
+ task: `
56
+ const prices = ['bitcoin', 'ethereum'];
57
+ prices.forEach(async (p) => {
58
+ const res = await fetch(\`https://api.coingecko.com/api/v3/simple/price?ids=\${p}&vs_currencies=usd\`);
59
+ const data = await res.json();
60
+ console.log(\`💰 \${p}: $\${data[p].usd}\`);
61
+ });
62
+ `
63
+ },
64
+
65
+ // News digest
66
+ newsDigest: {
67
+ name: "News Digest",
68
+ description: "Top HN stories this morning",
69
+ frequency: "daily",
70
+ time: "8:30 AM",
71
+ task: `
72
+ const res = await fetch('https://hacker-news.firebaseio.com/v0/topstories.json');
73
+ const ids = (await res.json()).slice(0, 5);
74
+ console.log('📰 Top HN Stories:');
75
+ for (const id of ids) {
76
+ const item = await fetch(\`https://hacker-news.firebaseio.com/v0/item/\${id}.json\`).then(r => r.json());
77
+ console.log(\` • \${item.title}\`);
78
+ }
79
+ `
80
+ },
81
+
82
+ // Project status
83
+ projectStatus: {
84
+ name: "Project Status",
85
+ description: "Check npm downloads, Gumroad sales, GitHub stars",
86
+ frequency: "daily",
87
+ time: "6:00 PM",
88
+ task: `
89
+ // Integrate with agent-dashboard
90
+ console.log('📊 Project metrics:');
91
+ console.log(' npm downloads: [check via npm API]');
92
+ console.log(' Gumroad sales: [check via Gumroad API]');
93
+ console.log(' GitHub stars: [check via GitHub API]');
94
+ `
95
+ },
96
+
97
+ // Moltbook digest
98
+ moltbookDigest: {
99
+ name: "Moltbook Feed",
100
+ description: "Check trending posts and DMs",
101
+ frequency: "4-hourly",
102
+ time: "every 4 hours",
103
+ task: `
104
+ const apiKey = process.env.MOLTBOOK_API_KEY;
105
+ const res = await fetch('https://www.moltbook.com/api/v1/feed?sort=trending&limit=5', {
106
+ headers: { 'Authorization': \`Bearer \${apiKey}\` }
107
+ });
108
+ const posts = await res.json();
109
+ console.log('🔥 Trending on Moltbook:');
110
+ posts.posts.slice(0, 3).forEach(p => console.log(\` • \${p.title}\`));
111
+ `
112
+ },
113
+
114
+ // Backup reminder
115
+ backupReminder: {
116
+ name: "Backup Reminder",
117
+ description: "Weekly backup check",
118
+ frequency: "weekly",
119
+ time: "Sunday 9:00 AM",
120
+ task: `
121
+ const fs = require('fs');
122
+ const size = fs.statSync(process.env.HOME).size;
123
+ console.log('💾 Last backup size: ' + (size / 1024 / 1024).toFixed(0) + 'MB');
124
+ console.log('⚠️ Reminder: Have you backed up today?');
125
+ `
126
+ },
127
+
128
+ // Standup prompt
129
+ standupPrompt: {
130
+ name: "Standup Reminder",
131
+ description: "Log your daily standup",
132
+ frequency: "daily",
133
+ time: "9:00 AM",
134
+ task: `
135
+ console.log('⏰ Standup time!');
136
+ console.log('Run: standup create --done "..." --doing "..." --blockers "..."');
137
+ console.log('Or: standup today');
138
+ `
139
+ }
140
+ };
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@bagalobsta/heartbeat-library",
3
+ "version": "1.0.0",
4
+ "description": "Pre-built heartbeat tasks for OpenClaw agents. Email, weather, calendar, prices, news, etc.",
5
+ "main": "lib/index.js",
6
+ "scripts": {
7
+ "test": "echo 'ready'"
8
+ },
9
+ "keywords": [
10
+ "openclaw",
11
+ "heartbeat",
12
+ "tasks",
13
+ "automation",
14
+ "agent"
15
+ ],
16
+ "author": "Bagalobsta <bagalobsta@protonmail.com>",
17
+ "license": "MIT",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/bagalobsta/heartbeat-library.git"
21
+ },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "engines": {
26
+ "node": ">=14.0.0"
27
+ }
28
+ }