apexbot 1.1.3 → 1.1.4
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/dist/cli/index.js +154 -0
- package/dist/tools/loader.js +54 -9
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -3525,6 +3525,160 @@ program
|
|
|
3525
3525
|
}
|
|
3526
3526
|
});
|
|
3527
3527
|
// ─────────────────────────────────────────────────────────────────
|
|
3528
|
+
// MEMORY Command - Vector memory management (OpenClaw-style)
|
|
3529
|
+
// ─────────────────────────────────────────────────────────────────
|
|
3530
|
+
program
|
|
3531
|
+
.command('memory [action]')
|
|
3532
|
+
.description('Manage vector memory store')
|
|
3533
|
+
.option('--json', 'Output as JSON')
|
|
3534
|
+
.option('--limit <n>', 'Limit results', '10')
|
|
3535
|
+
.option('--threshold <n>', 'Similarity threshold (0-1)', '0.3')
|
|
3536
|
+
.option('--source <source>', 'Filter by source (user|assistant|document|web)')
|
|
3537
|
+
.option('--session <id>', 'Filter by session ID')
|
|
3538
|
+
.action(async (action = 'status', options) => {
|
|
3539
|
+
const { initVectorStore } = await Promise.resolve().then(() => __importStar(require('../memory')));
|
|
3540
|
+
const store = await initVectorStore();
|
|
3541
|
+
switch (action) {
|
|
3542
|
+
case 'status': {
|
|
3543
|
+
const stats = await store.getStats();
|
|
3544
|
+
if (options.json) {
|
|
3545
|
+
console.log(JSON.stringify(stats, null, 2));
|
|
3546
|
+
return;
|
|
3547
|
+
}
|
|
3548
|
+
console.log('');
|
|
3549
|
+
console.log(chalk.cyan('Memory Store Status:'));
|
|
3550
|
+
console.log('');
|
|
3551
|
+
console.log(` Entries: ${stats.count}`);
|
|
3552
|
+
if (stats.count > 0) {
|
|
3553
|
+
console.log(` Oldest: ${new Date(stats.oldestTimestamp).toISOString()}`);
|
|
3554
|
+
console.log(` Newest: ${new Date(stats.newestTimestamp).toISOString()}`);
|
|
3555
|
+
}
|
|
3556
|
+
console.log(` Store path: ${chalk.gray(path.join(CONFIG_DIR, 'memory.db'))}`);
|
|
3557
|
+
console.log('');
|
|
3558
|
+
break;
|
|
3559
|
+
}
|
|
3560
|
+
case 'search': {
|
|
3561
|
+
// Get query from remaining args
|
|
3562
|
+
const query = process.argv.slice(process.argv.indexOf('search') + 1)
|
|
3563
|
+
.filter(arg => !arg.startsWith('-'))
|
|
3564
|
+
.join(' ');
|
|
3565
|
+
if (!query) {
|
|
3566
|
+
console.log(chalk.red('Please provide a search query:'));
|
|
3567
|
+
console.log(chalk.gray(' apexbot memory search "your query here"'));
|
|
3568
|
+
return;
|
|
3569
|
+
}
|
|
3570
|
+
const limit = parseInt(options.limit) || 10;
|
|
3571
|
+
const threshold = parseFloat(options.threshold) || 0.3;
|
|
3572
|
+
console.log(chalk.gray(`Searching for: "${query}"...`));
|
|
3573
|
+
const results = await store.search(query, limit, threshold);
|
|
3574
|
+
if (options.json) {
|
|
3575
|
+
console.log(JSON.stringify(results, null, 2));
|
|
3576
|
+
return;
|
|
3577
|
+
}
|
|
3578
|
+
console.log('');
|
|
3579
|
+
console.log(chalk.cyan(`Found ${results.length} results:`));
|
|
3580
|
+
console.log('');
|
|
3581
|
+
if (results.length === 0) {
|
|
3582
|
+
console.log(chalk.gray(' No matching memories found.'));
|
|
3583
|
+
}
|
|
3584
|
+
else {
|
|
3585
|
+
for (const result of results) {
|
|
3586
|
+
const score = (result.similarity * 100).toFixed(1);
|
|
3587
|
+
const date = new Date(result.entry.timestamp).toLocaleDateString();
|
|
3588
|
+
const source = result.entry.source || 'unknown';
|
|
3589
|
+
const content = result.entry.content.length > 100
|
|
3590
|
+
? result.entry.content.slice(0, 100) + '...'
|
|
3591
|
+
: result.entry.content;
|
|
3592
|
+
console.log(` ${chalk.green(score + '%')} ${chalk.gray(`[${source}] ${date}`)}`);
|
|
3593
|
+
console.log(` ${content.replace(/\n/g, ' ')}`);
|
|
3594
|
+
console.log('');
|
|
3595
|
+
}
|
|
3596
|
+
}
|
|
3597
|
+
break;
|
|
3598
|
+
}
|
|
3599
|
+
case 'add': {
|
|
3600
|
+
// Get content from remaining args
|
|
3601
|
+
const content = process.argv.slice(process.argv.indexOf('add') + 1)
|
|
3602
|
+
.filter(arg => !arg.startsWith('-'))
|
|
3603
|
+
.join(' ');
|
|
3604
|
+
if (!content) {
|
|
3605
|
+
console.log(chalk.red('Please provide content to store:'));
|
|
3606
|
+
console.log(chalk.gray(' apexbot memory add "your memory content here"'));
|
|
3607
|
+
return;
|
|
3608
|
+
}
|
|
3609
|
+
const source = (options.source || 'document');
|
|
3610
|
+
const sessionId = options.session;
|
|
3611
|
+
const id = await store.store({
|
|
3612
|
+
content,
|
|
3613
|
+
source,
|
|
3614
|
+
sessionId,
|
|
3615
|
+
timestamp: Date.now(),
|
|
3616
|
+
});
|
|
3617
|
+
if (options.json) {
|
|
3618
|
+
console.log(JSON.stringify({ id, content, source }, null, 2));
|
|
3619
|
+
return;
|
|
3620
|
+
}
|
|
3621
|
+
console.log(chalk.green(`✓ Stored memory with ID: ${id}`));
|
|
3622
|
+
break;
|
|
3623
|
+
}
|
|
3624
|
+
case 'clear': {
|
|
3625
|
+
console.log(chalk.yellow('Warning: This will delete all stored memories!'));
|
|
3626
|
+
const inquirer = require('inquirer');
|
|
3627
|
+
const { confirm } = await inquirer.prompt([{
|
|
3628
|
+
type: 'confirm',
|
|
3629
|
+
name: 'confirm',
|
|
3630
|
+
message: 'Are you sure?',
|
|
3631
|
+
default: false,
|
|
3632
|
+
}]);
|
|
3633
|
+
if (confirm) {
|
|
3634
|
+
// Clear the store
|
|
3635
|
+
const dbPath = path.join(CONFIG_DIR, 'memory.db');
|
|
3636
|
+
const jsonPath = path.join(CONFIG_DIR, 'memory.json');
|
|
3637
|
+
try {
|
|
3638
|
+
if (fs.existsSync(dbPath))
|
|
3639
|
+
fs.unlinkSync(dbPath);
|
|
3640
|
+
if (fs.existsSync(jsonPath))
|
|
3641
|
+
fs.unlinkSync(jsonPath);
|
|
3642
|
+
console.log(chalk.green('✓ Memory store cleared.'));
|
|
3643
|
+
}
|
|
3644
|
+
catch (e) {
|
|
3645
|
+
console.log(chalk.red(`Error: ${e.message}`));
|
|
3646
|
+
}
|
|
3647
|
+
}
|
|
3648
|
+
else {
|
|
3649
|
+
console.log(chalk.gray('Cancelled.'));
|
|
3650
|
+
}
|
|
3651
|
+
break;
|
|
3652
|
+
}
|
|
3653
|
+
case 'index': {
|
|
3654
|
+
console.log(chalk.cyan('Indexing memories...'));
|
|
3655
|
+
// Re-embed all memories (useful after changing embedding provider)
|
|
3656
|
+
const stats = await store.getStats();
|
|
3657
|
+
console.log(` Processing ${stats.count} entries...`);
|
|
3658
|
+
// TODO: Implement re-indexing if needed
|
|
3659
|
+
console.log(chalk.green('✓ Indexing complete.'));
|
|
3660
|
+
break;
|
|
3661
|
+
}
|
|
3662
|
+
default: {
|
|
3663
|
+
console.log('');
|
|
3664
|
+
console.log(chalk.cyan('Memory Commands:'));
|
|
3665
|
+
console.log('');
|
|
3666
|
+
console.log(' apexbot memory status Show memory store status');
|
|
3667
|
+
console.log(' apexbot memory search "query" Search memories semantically');
|
|
3668
|
+
console.log(' apexbot memory add "content" Add a memory entry');
|
|
3669
|
+
console.log(' apexbot memory clear Clear all memories');
|
|
3670
|
+
console.log(' apexbot memory index Re-index memories');
|
|
3671
|
+
console.log('');
|
|
3672
|
+
console.log('Options:');
|
|
3673
|
+
console.log(' --json Output as JSON');
|
|
3674
|
+
console.log(' --limit <n> Limit search results (default: 10)');
|
|
3675
|
+
console.log(' --threshold <n> Similarity threshold 0-1 (default: 0.3)');
|
|
3676
|
+
console.log(' --source <type> Filter by source (user|assistant|document|web)');
|
|
3677
|
+
console.log('');
|
|
3678
|
+
}
|
|
3679
|
+
}
|
|
3680
|
+
});
|
|
3681
|
+
// ─────────────────────────────────────────────────────────────────
|
|
3528
3682
|
// CHAT Command - Interactive CLI Chat (like Clawdbot)
|
|
3529
3683
|
// ─────────────────────────────────────────────────────────────────
|
|
3530
3684
|
program
|
package/dist/tools/loader.js
CHANGED
|
@@ -55,6 +55,7 @@ const web_1 = require("../tools/web");
|
|
|
55
55
|
const datetime_1 = require("../tools/datetime");
|
|
56
56
|
const math_1 = require("../tools/math");
|
|
57
57
|
const skills_1 = require("../skills");
|
|
58
|
+
// Core skills (always available)
|
|
58
59
|
const obsidian_1 = __importDefault(require("../skills/obsidian"));
|
|
59
60
|
const weather_1 = __importDefault(require("../skills/weather"));
|
|
60
61
|
const reminder_1 = __importDefault(require("../skills/reminder"));
|
|
@@ -63,6 +64,33 @@ const spotify_1 = __importDefault(require("../skills/spotify"));
|
|
|
63
64
|
const calendar_1 = __importDefault(require("../skills/calendar"));
|
|
64
65
|
const search_1 = __importDefault(require("../skills/search"));
|
|
65
66
|
const memory_1 = __importDefault(require("../skills/memory"));
|
|
67
|
+
// Additional skills
|
|
68
|
+
const notion_1 = __importDefault(require("../skills/notion"));
|
|
69
|
+
const trello_1 = __importDefault(require("../skills/trello"));
|
|
70
|
+
const gmail_1 = __importDefault(require("../skills/gmail"));
|
|
71
|
+
const slack_1 = __importDefault(require("../skills/slack"));
|
|
72
|
+
const discord_1 = __importDefault(require("../skills/discord"));
|
|
73
|
+
const whatsapp_1 = __importDefault(require("../skills/whatsapp"));
|
|
74
|
+
const signal_1 = __importDefault(require("../skills/signal"));
|
|
75
|
+
const imessage_1 = __importDefault(require("../skills/imessage"));
|
|
76
|
+
const matrix_1 = __importDefault(require("../skills/matrix"));
|
|
77
|
+
const twitter_1 = __importDefault(require("../skills/twitter"));
|
|
78
|
+
const sonos_1 = __importDefault(require("../skills/sonos"));
|
|
79
|
+
const voice_1 = __importDefault(require("../skills/voice"));
|
|
80
|
+
const imagegen_1 = __importDefault(require("../skills/imagegen"));
|
|
81
|
+
const gifsearch_1 = __importDefault(require("../skills/gifsearch"));
|
|
82
|
+
const homeassistant_1 = __importDefault(require("../skills/homeassistant"));
|
|
83
|
+
const hue_1 = __importDefault(require("../skills/hue"));
|
|
84
|
+
const git_1 = __importDefault(require("../skills/git"));
|
|
85
|
+
const browser_1 = __importDefault(require("../skills/browser"));
|
|
86
|
+
const cron_1 = __importDefault(require("../skills/cron"));
|
|
87
|
+
const webhooks_1 = __importDefault(require("../skills/webhooks"));
|
|
88
|
+
const onepassword_1 = __importDefault(require("../skills/onepassword"));
|
|
89
|
+
const canvas_1 = __importDefault(require("../skills/canvas"));
|
|
90
|
+
const applenotes_1 = __importDefault(require("../skills/applenotes"));
|
|
91
|
+
const bird_1 = __importDefault(require("../skills/bird"));
|
|
92
|
+
const himalaya_1 = __importDefault(require("../skills/himalaya"));
|
|
93
|
+
const songsee_1 = __importDefault(require("../skills/songsee"));
|
|
66
94
|
/**
|
|
67
95
|
* Register all built-in tools
|
|
68
96
|
*/
|
|
@@ -91,15 +119,32 @@ async function registerSkills(configDir) {
|
|
|
91
119
|
console.log('[Loader] Registering skills...');
|
|
92
120
|
const skillManager = (0, skills_1.initSkillManager)(configDir);
|
|
93
121
|
await skillManager.loadConfig();
|
|
94
|
-
// Register built-in skills
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
122
|
+
// Register ALL built-in skills
|
|
123
|
+
const allSkills = [
|
|
124
|
+
// Core skills
|
|
125
|
+
obsidian_1.default, weather_1.default, reminder_1.default, system_1.default,
|
|
126
|
+
spotify_1.default, calendar_1.default, search_1.default, memory_1.default,
|
|
127
|
+
// Productivity
|
|
128
|
+
notion_1.default, trello_1.default, gmail_1.default, canvas_1.default, applenotes_1.default,
|
|
129
|
+
// Communication
|
|
130
|
+
slack_1.default, discord_1.default, whatsapp_1.default, signal_1.default, imessage_1.default, matrix_1.default, twitter_1.default,
|
|
131
|
+
// Media
|
|
132
|
+
sonos_1.default, voice_1.default, imagegen_1.default, gifsearch_1.default, songsee_1.default,
|
|
133
|
+
// Smart Home
|
|
134
|
+
homeassistant_1.default, hue_1.default,
|
|
135
|
+
// Development
|
|
136
|
+
git_1.default, browser_1.default, cron_1.default, webhooks_1.default, onepassword_1.default,
|
|
137
|
+
// CLI tools
|
|
138
|
+
bird_1.default, himalaya_1.default,
|
|
139
|
+
];
|
|
140
|
+
for (const skill of allSkills) {
|
|
141
|
+
try {
|
|
142
|
+
skillManager.register(skill);
|
|
143
|
+
}
|
|
144
|
+
catch (e) {
|
|
145
|
+
console.warn(`[Loader] Failed to register skill: ${e.message}`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
103
148
|
// Check if this is first run (no config file exists)
|
|
104
149
|
const configPath = path.join(configDir, 'skills.json');
|
|
105
150
|
let isFirstRun = false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apexbot",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "ApexBot - Your free, private AI assistant. 100% free with Ollama (local AI). Multi-channel: Telegram, Discord, WebChat. Tools & Skills system with Spotify, Obsidian, and more!",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|