@stevederico/dotbot 0.16.0 → 0.16.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.
- package/CHANGELOG.md +6 -0
- package/README.md +2 -2
- package/bin/dotbot.js +6 -6
- package/dotbot.db +0 -0
- package/package.json +1 -1
- package/storage/SQLiteCronAdapter.js +15 -14
- package/storage/SQLiteEventStore.js +2 -3
- package/storage/SQLiteMemoryAdapter.js +2 -3
- package/storage/SQLiteTaskAdapter.js +2 -3
- package/storage/SQLiteTriggerAdapter.js +2 -3
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<img src="https://img.shields.io/github/stars/stevederico/dotbot?style=social" alt="GitHub stars">
|
|
13
13
|
</a>
|
|
14
14
|
<a href="https://github.com/stevederico/dotbot">
|
|
15
|
-
<img src="https://img.shields.io/badge/version-0.16.
|
|
15
|
+
<img src="https://img.shields.io/badge/version-0.16.1-green" alt="version">
|
|
16
16
|
</a>
|
|
17
17
|
<img src="https://img.shields.io/badge/LOC-11k-orange" alt="Lines of Code">
|
|
18
18
|
</p>
|
|
@@ -147,7 +147,7 @@ for await (const event of agent.chat({
|
|
|
147
147
|
## CLI Reference
|
|
148
148
|
|
|
149
149
|
```
|
|
150
|
-
dotbot v0.16.
|
|
150
|
+
dotbot v0.16.1 — AI agent CLI
|
|
151
151
|
|
|
152
152
|
Usage:
|
|
153
153
|
dotbot chat "message" Send a one-shot message
|
package/bin/dotbot.js
CHANGED
|
@@ -41,7 +41,7 @@ async function loadModules() {
|
|
|
41
41
|
agentLoop = mod.agentLoop;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
const VERSION = '0.16.
|
|
44
|
+
const VERSION = '0.16.1';
|
|
45
45
|
const DEFAULT_PORT = 3000;
|
|
46
46
|
const DEFAULT_DB = './dotbot.db';
|
|
47
47
|
|
|
@@ -150,19 +150,19 @@ async function initStores(dbPath) {
|
|
|
150
150
|
});
|
|
151
151
|
|
|
152
152
|
const cronStore = new stores.SQLiteCronStore();
|
|
153
|
-
await cronStore.init(
|
|
153
|
+
await cronStore.init(dbPath);
|
|
154
154
|
|
|
155
155
|
const taskStore = new stores.SQLiteTaskStore();
|
|
156
|
-
await taskStore.init(
|
|
156
|
+
await taskStore.init(dbPath);
|
|
157
157
|
|
|
158
158
|
const triggerStore = new stores.SQLiteTriggerStore();
|
|
159
|
-
await triggerStore.init(
|
|
159
|
+
await triggerStore.init(dbPath);
|
|
160
160
|
|
|
161
161
|
const memoryStore = new stores.SQLiteMemoryStore();
|
|
162
|
-
await memoryStore.init(
|
|
162
|
+
await memoryStore.init(dbPath);
|
|
163
163
|
|
|
164
164
|
const eventStore = new stores.SQLiteEventStore();
|
|
165
|
-
await eventStore.init(
|
|
165
|
+
await eventStore.init(dbPath);
|
|
166
166
|
|
|
167
167
|
return { sessionStore, cronStore, taskStore, triggerStore, memoryStore, eventStore };
|
|
168
168
|
}
|
package/dotbot.db
ADDED
|
Binary file
|
package/package.json
CHANGED
|
@@ -34,20 +34,7 @@ export class SQLiteCronStore extends CronStore {
|
|
|
34
34
|
this.db = new DatabaseSync(dbPath);
|
|
35
35
|
this.onTaskFire = options.onTaskFire || null;
|
|
36
36
|
|
|
37
|
-
//
|
|
38
|
-
const cols = this.db.prepare("PRAGMA table_info(cron_tasks)").all();
|
|
39
|
-
if (cols.some(c => c.name === 'goal_id') && !cols.some(c => c.name === 'task_id')) {
|
|
40
|
-
console.log('[cron] migrating goal_id column to task_id...');
|
|
41
|
-
this.db.exec('ALTER TABLE cron_tasks RENAME COLUMN goal_id TO task_id');
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Migration: goal_step → task_step task type
|
|
45
|
-
const goalStepCount = this.db.prepare("SELECT COUNT(*) as cnt FROM cron_tasks WHERE name = 'goal_step'").get();
|
|
46
|
-
if (goalStepCount && goalStepCount.cnt > 0) {
|
|
47
|
-
console.log('[cron] migrating goal_step tasks to task_step...');
|
|
48
|
-
this.db.prepare("UPDATE cron_tasks SET name = 'task_step' WHERE name = 'goal_step'").run();
|
|
49
|
-
}
|
|
50
|
-
|
|
37
|
+
// Create table first
|
|
51
38
|
this.db.exec(`
|
|
52
39
|
CREATE TABLE IF NOT EXISTS cron_tasks (
|
|
53
40
|
id TEXT PRIMARY KEY,
|
|
@@ -71,6 +58,20 @@ export class SQLiteCronStore extends CronStore {
|
|
|
71
58
|
CREATE INDEX IF NOT EXISTS idx_cron_session ON cron_tasks(session_id);
|
|
72
59
|
`);
|
|
73
60
|
|
|
61
|
+
// Migration: goal_id → task_id column
|
|
62
|
+
const cols = this.db.prepare("PRAGMA table_info(cron_tasks)").all();
|
|
63
|
+
if (cols.some(c => c.name === 'goal_id') && !cols.some(c => c.name === 'task_id')) {
|
|
64
|
+
console.log('[cron] migrating goal_id column to task_id...');
|
|
65
|
+
this.db.exec('ALTER TABLE cron_tasks RENAME COLUMN goal_id TO task_id');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Migration: goal_step → task_step task type
|
|
69
|
+
const goalStepCount = this.db.prepare("SELECT COUNT(*) as cnt FROM cron_tasks WHERE name = 'goal_step'").get();
|
|
70
|
+
if (goalStepCount && goalStepCount.cnt > 0) {
|
|
71
|
+
console.log('[cron] migrating goal_step tasks to task_step...');
|
|
72
|
+
this.db.prepare("UPDATE cron_tasks SET name = 'task_step' WHERE name = 'goal_step'").run();
|
|
73
|
+
}
|
|
74
|
+
|
|
74
75
|
// Deduplicate existing heartbeats before relying on the unique index
|
|
75
76
|
const dupes = this.db.prepare(`
|
|
76
77
|
SELECT user_id, GROUP_CONCAT(id) as ids, COUNT(*) as cnt
|
|
@@ -17,10 +17,9 @@ export class SQLiteEventStore extends EventStore {
|
|
|
17
17
|
/**
|
|
18
18
|
* Initialize SQLite event store
|
|
19
19
|
*
|
|
20
|
-
* @param {
|
|
21
|
-
* @param {string} config.dbPath - Path to SQLite database file
|
|
20
|
+
* @param {string} dbPath - Path to SQLite database file
|
|
22
21
|
*/
|
|
23
|
-
async init(
|
|
22
|
+
async init(dbPath) {
|
|
24
23
|
this.db = new DatabaseSync(dbPath);
|
|
25
24
|
|
|
26
25
|
this.db.exec(`
|
|
@@ -14,10 +14,9 @@ export class SQLiteMemoryStore {
|
|
|
14
14
|
/**
|
|
15
15
|
* Initialize SQLite memory store
|
|
16
16
|
*
|
|
17
|
-
* @param {
|
|
18
|
-
* @param {string} config.dbPath - Path to SQLite database file
|
|
17
|
+
* @param {string} dbPath - Path to SQLite database file
|
|
19
18
|
*/
|
|
20
|
-
async init(
|
|
19
|
+
async init(dbPath) {
|
|
21
20
|
this.db = new DatabaseSync(dbPath);
|
|
22
21
|
|
|
23
22
|
this.db.exec(`
|
|
@@ -17,10 +17,9 @@ export class SQLiteTaskStore extends TaskStore {
|
|
|
17
17
|
/**
|
|
18
18
|
* Initialize SQLite task store
|
|
19
19
|
*
|
|
20
|
-
* @param {
|
|
21
|
-
* @param {string} config.dbPath - Path to SQLite database file
|
|
20
|
+
* @param {string} dbPath - Path to SQLite database file
|
|
22
21
|
*/
|
|
23
|
-
async init(
|
|
22
|
+
async init(dbPath) {
|
|
24
23
|
this.db = new DatabaseSync(dbPath);
|
|
25
24
|
|
|
26
25
|
// Migration: goals → tasks table
|
|
@@ -17,11 +17,10 @@ export class SQLiteTriggerStore extends TriggerStore {
|
|
|
17
17
|
/**
|
|
18
18
|
* Initialize SQLite trigger store
|
|
19
19
|
*
|
|
20
|
-
* @param {
|
|
21
|
-
* @param {string} config.dbPath - Path to SQLite database file
|
|
20
|
+
* @param {string} dbPath - Path to SQLite database file
|
|
22
21
|
* @param {Object} [options={}] - Reserved for future use
|
|
23
22
|
*/
|
|
24
|
-
async init(
|
|
23
|
+
async init(dbPath, options = {}) {
|
|
25
24
|
this.db = new DatabaseSync(dbPath);
|
|
26
25
|
|
|
27
26
|
this.db.exec(`
|