0xkobold 0.2.0 → 0.3.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/HEARTBEAT.md +40 -58
- package/README.md +387 -337
- package/dist/package.json +11 -3
- package/dist/src/auth/device-auth.js +202 -0
- package/dist/src/auth/device-auth.js.map +1 -0
- package/dist/src/auth/index.js +3 -0
- package/dist/src/auth/index.js.map +1 -0
- package/dist/src/channels/index.js +8 -0
- package/dist/src/channels/index.js.map +1 -0
- package/dist/src/channels/slack/webhook.js +128 -0
- package/dist/src/channels/slack/webhook.js.map +1 -0
- package/dist/src/channels/telegram/bot.js +223 -0
- package/dist/src/channels/telegram/bot.js.map +1 -0
- package/dist/src/channels/whatsapp/integration.js +325 -0
- package/dist/src/channels/whatsapp/integration.js.map +1 -0
- package/dist/src/cli/commands/check.js +69 -0
- package/dist/src/cli/commands/check.js.map +1 -0
- package/dist/src/cli/commands/init.js +134 -79
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/commands/migrate.js +24 -0
- package/dist/src/cli/commands/migrate.js.map +1 -0
- package/dist/src/cli/commands/tailscale.js +81 -0
- package/dist/src/cli/commands/tailscale.js.map +1 -0
- package/dist/src/cli/commands/telegram.js +111 -0
- package/dist/src/cli/commands/telegram.js.map +1 -0
- package/dist/src/cli/commands/tui.js +40 -22
- package/dist/src/cli/commands/tui.js.map +1 -1
- package/dist/src/cli/commands/whatsapp.js +116 -0
- package/dist/src/cli/commands/whatsapp.js.map +1 -0
- package/dist/src/cli/program.js +22 -0
- package/dist/src/cli/program.js.map +1 -1
- package/dist/src/config/index.js +2 -9
- package/dist/src/config/index.js.map +1 -1
- package/dist/src/config/manager.js +222 -0
- package/dist/src/config/manager.js.map +1 -0
- package/dist/src/documents/index.js +3 -0
- package/dist/src/documents/index.js.map +1 -0
- package/dist/src/documents/pdf.js +168 -0
- package/dist/src/documents/pdf.js.map +1 -0
- package/dist/src/gateway/client.js +318 -0
- package/dist/src/gateway/client.js.map +1 -0
- package/dist/src/infra/index.js +3 -0
- package/dist/src/infra/index.js.map +1 -0
- package/dist/src/infra/tailscale.js +163 -0
- package/dist/src/infra/tailscale.js.map +1 -0
- package/dist/src/media/audio.js +130 -0
- package/dist/src/media/audio.js.map +1 -0
- package/dist/src/media/index.js +4 -0
- package/dist/src/media/index.js.map +1 -0
- package/dist/src/media/vision.js +131 -0
- package/dist/src/media/vision.js.map +1 -0
- package/dist/src/migration/openclaw.js +498 -0
- package/dist/src/migration/openclaw.js.map +1 -0
- package/dist/src/sandbox/docker-runner.js +228 -0
- package/dist/src/sandbox/docker-runner.js.map +1 -0
- package/dist/src/sandbox/index.js +3 -0
- package/dist/src/sandbox/index.js.map +1 -0
- package/dist/src/skills/builtin/duplicate-detector.js +469 -0
- package/dist/src/skills/builtin/duplicate-detector.js.map +1 -0
- package/dist/src/skills/index.js +2 -0
- package/dist/src/skills/index.js.map +1 -1
- package/package.json +11 -3
|
@@ -1,18 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 0xKobold Init Command
|
|
3
|
+
*
|
|
4
|
+
* Sets up the workspace with Kobold identity and Ollama Cloud defaults.
|
|
5
|
+
* No immediate API key required - works out of the box.
|
|
6
|
+
*/
|
|
1
7
|
import { Command } from "commander";
|
|
2
8
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
3
9
|
import { existsSync } from "node:fs";
|
|
4
10
|
import { join } from "node:path";
|
|
5
11
|
import { homedir } from "node:os";
|
|
6
12
|
import { Database } from "bun:sqlite";
|
|
7
|
-
// Global config in home directory
|
|
8
13
|
const GLOBAL_KOBOLD_DIR = join(homedir(), ".0xkobold");
|
|
9
14
|
const GLOBAL_DB_PATH = join(GLOBAL_KOBOLD_DIR, "kobold.db");
|
|
10
15
|
const GLOBAL_CONFIG_PATH = join(GLOBAL_KOBOLD_DIR, "config.json");
|
|
11
16
|
const GLOBAL_MEMORY_PATH = join(GLOBAL_KOBOLD_DIR, "MEMORY.md");
|
|
12
|
-
// Local workspace in project directory
|
|
13
17
|
const LOCAL_KOBOLD_DIR = ".0xkobold";
|
|
14
18
|
const LOCAL_DB_PATH = join(LOCAL_KOBOLD_DIR, "workspace.db");
|
|
15
19
|
const LOCAL_MEMORY_PATH = join(LOCAL_KOBOLD_DIR, "MEMORY.md");
|
|
20
|
+
// 0xKobold Persona - Loaded into system prompt
|
|
21
|
+
const KOBOLD_PERSONA = `# 0xKobold Identity
|
|
22
|
+
|
|
23
|
+
## Name
|
|
24
|
+
0xKobold ("Kobold")
|
|
25
|
+
|
|
26
|
+
## Role
|
|
27
|
+
AI coding assistant with a focus on modern TypeScript/Bun development.
|
|
28
|
+
|
|
29
|
+
## Personality
|
|
30
|
+
- Helpful and direct
|
|
31
|
+
- Slightly mischievous (it's in the name)
|
|
32
|
+
- Values clean code and efficiency
|
|
33
|
+
- Prefers working solutions over perfect ones
|
|
34
|
+
|
|
35
|
+
## Capabilities
|
|
36
|
+
- File operations with safety checks
|
|
37
|
+
- Shell command execution (with blocks)
|
|
38
|
+
- Multi-channel communication (Telegram, Slack, WhatsApp)
|
|
39
|
+
- Docker sandboxing for safe execution
|
|
40
|
+
- Semantic memory with SQLite
|
|
41
|
+
- Agent spawning for parallel tasks
|
|
42
|
+
- Gateway server for remote access
|
|
43
|
+
|
|
44
|
+
## Default Behavior
|
|
45
|
+
- LLM: Ollama Cloud (Kimi K2.5)
|
|
46
|
+
- Mode: build (unless investigating)
|
|
47
|
+
- Auto-compact on context overflow
|
|
48
|
+
- Proactive duplicate detection
|
|
49
|
+
|
|
50
|
+
## Style
|
|
51
|
+
- Concise responses for simple tasks
|
|
52
|
+
- Detailed breakdowns for complex ones
|
|
53
|
+
- Code blocks with language tags
|
|
54
|
+
- Error handling with actionable fixes
|
|
55
|
+
`;
|
|
56
|
+
// User memory template
|
|
16
57
|
const MEMORY_TEMPLATE = `# 0xKobold Memory
|
|
17
58
|
|
|
18
59
|
## User Profile
|
|
@@ -32,40 +73,71 @@ const MEMORY_TEMPLATE = `# 0xKobold Memory
|
|
|
32
73
|
|
|
33
74
|
## Notes
|
|
34
75
|
`;
|
|
35
|
-
//
|
|
36
|
-
const packageJson = await Bun.file(new URL("../../../package.json", import.meta.url)).json();
|
|
76
|
+
// Default config - Ollama Cloud ready
|
|
37
77
|
const DEFAULT_CONFIG = {
|
|
38
|
-
version:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
78
|
+
version: "0.3.0",
|
|
79
|
+
llm: {
|
|
80
|
+
// Ollama Cloud - default, no API key needed for public models
|
|
81
|
+
defaultProvider: "ollama-cloud",
|
|
82
|
+
providers: {
|
|
83
|
+
"ollama-cloud": {
|
|
84
|
+
enabled: true,
|
|
85
|
+
// Kimi K2.5 via Ollama Cloud - great for coding
|
|
86
|
+
model: "kimi-k2.5:cloud",
|
|
87
|
+
baseUrl: "https://api.ollama.com",
|
|
88
|
+
// Set CLOUD_API_KEY env var for paid models
|
|
89
|
+
// Free tier works without key
|
|
90
|
+
},
|
|
91
|
+
// Optional - add your own
|
|
92
|
+
claude: {
|
|
93
|
+
enabled: false,
|
|
94
|
+
model: "claude-3-sonnet-20240229",
|
|
95
|
+
// Set ANTHROPIC_API_KEY env var
|
|
96
|
+
},
|
|
97
|
+
openai: {
|
|
98
|
+
enabled: false,
|
|
99
|
+
model: "gpt-4",
|
|
100
|
+
// Set OPENAI_API_KEY env var
|
|
101
|
+
}
|
|
102
|
+
}
|
|
47
103
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
104
|
+
features: {
|
|
105
|
+
gateway: {
|
|
106
|
+
enabled: true,
|
|
107
|
+
port: 18789,
|
|
108
|
+
host: "0.0.0.0"
|
|
109
|
+
},
|
|
110
|
+
sandbox: {
|
|
111
|
+
enabled: true,
|
|
112
|
+
docker: true
|
|
113
|
+
},
|
|
114
|
+
channels: {
|
|
115
|
+
telegram: false,
|
|
116
|
+
slack: false,
|
|
117
|
+
whatsapp: false
|
|
118
|
+
},
|
|
119
|
+
memory: {
|
|
120
|
+
enabled: true,
|
|
121
|
+
semanticSearch: true
|
|
122
|
+
}
|
|
51
123
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
temperature: 0.7
|
|
124
|
+
agent: {
|
|
125
|
+
defaultMode: "build",
|
|
126
|
+
maxConcurrency: 5,
|
|
127
|
+
autoCompact: true
|
|
57
128
|
}
|
|
58
129
|
};
|
|
59
130
|
export const initCommand = new Command("init")
|
|
60
|
-
.description("Initialize 0xKobold workspace")
|
|
131
|
+
.description("Initialize 0xKobold workspace with Kobold identity")
|
|
61
132
|
.option("-f, --force", "Overwrite existing files")
|
|
62
133
|
.action(async (options) => {
|
|
63
134
|
try {
|
|
64
|
-
console.log("🐲 Initializing
|
|
65
|
-
//
|
|
135
|
+
console.log("🐲 0xKobold Initializing...\n");
|
|
136
|
+
// Create global directory
|
|
66
137
|
if (!existsSync(GLOBAL_KOBOLD_DIR) || options.force) {
|
|
67
138
|
await mkdir(GLOBAL_KOBOLD_DIR, { recursive: true });
|
|
68
|
-
console.log(`✓ Created
|
|
139
|
+
console.log(`✓ Created: ${GLOBAL_KOBOLD_DIR}`);
|
|
140
|
+
// Initialize SQLite database
|
|
69
141
|
const db = new Database(GLOBAL_DB_PATH);
|
|
70
142
|
db.exec(`
|
|
71
143
|
CREATE TABLE IF NOT EXISTS conversations (
|
|
@@ -76,25 +148,8 @@ export const initCommand = new Command("init")
|
|
|
76
148
|
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
77
149
|
metadata TEXT
|
|
78
150
|
);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
id TEXT PRIMARY KEY,
|
|
82
|
-
name TEXT NOT NULL,
|
|
83
|
-
type TEXT NOT NULL,
|
|
84
|
-
config TEXT NOT NULL,
|
|
85
|
-
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
86
|
-
last_active DATETIME
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
CREATE TABLE IF NOT EXISTS sessions (
|
|
90
|
-
id TEXT PRIMARY KEY,
|
|
91
|
-
agent_id TEXT,
|
|
92
|
-
started_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
93
|
-
ended_at DATETIME,
|
|
94
|
-
context TEXT,
|
|
95
|
-
FOREIGN KEY (agent_id) REFERENCES agents(id)
|
|
96
|
-
);
|
|
97
|
-
|
|
151
|
+
CREATE INDEX IF NOT EXISTS idx_conversations_session ON conversations(session_id);
|
|
152
|
+
|
|
98
153
|
CREATE TABLE IF NOT EXISTS memory (
|
|
99
154
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
100
155
|
key TEXT UNIQUE NOT NULL,
|
|
@@ -102,26 +157,37 @@ export const initCommand = new Command("init")
|
|
|
102
157
|
category TEXT,
|
|
103
158
|
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
104
159
|
);
|
|
105
|
-
|
|
106
|
-
CREATE INDEX IF NOT EXISTS idx_conversations_session ON conversations(session_id);
|
|
107
160
|
CREATE INDEX IF NOT EXISTS idx_memory_key ON memory(key);
|
|
108
|
-
|
|
161
|
+
|
|
162
|
+
CREATE TABLE IF NOT EXISTS agents (
|
|
163
|
+
id TEXT PRIMARY KEY,
|
|
164
|
+
name TEXT NOT NULL,
|
|
165
|
+
type TEXT NOT NULL,
|
|
166
|
+
config TEXT NOT NULL,
|
|
167
|
+
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
168
|
+
last_active DATETIME
|
|
169
|
+
);
|
|
109
170
|
`);
|
|
110
171
|
db.close();
|
|
111
|
-
console.log("✓
|
|
172
|
+
console.log("✓ Database initialized");
|
|
173
|
+
// Create Kobold persona
|
|
174
|
+
await writeFile(join(GLOBAL_KOBOLD_DIR, "persona.md"), KOBOLD_PERSONA, "utf-8");
|
|
175
|
+
console.log("✓ Kobold persona created");
|
|
176
|
+
// Create user memory template
|
|
112
177
|
const memoryContent = MEMORY_TEMPLATE.replace("{{timestamp}}", new Date().toISOString());
|
|
113
178
|
await writeFile(GLOBAL_MEMORY_PATH, memoryContent, "utf-8");
|
|
114
|
-
console.log("✓
|
|
179
|
+
console.log("✓ Memory template created");
|
|
180
|
+
// Write config
|
|
115
181
|
await writeFile(GLOBAL_CONFIG_PATH, JSON.stringify(DEFAULT_CONFIG, null, 2), "utf-8");
|
|
116
|
-
console.log("✓
|
|
182
|
+
console.log("✓ Config created (Ollama Cloud default)");
|
|
117
183
|
}
|
|
118
184
|
else {
|
|
119
|
-
console.log(`ℹ️
|
|
185
|
+
console.log(`ℹ️ Config exists: ${GLOBAL_KOBOLD_DIR}`);
|
|
120
186
|
}
|
|
121
|
-
//
|
|
187
|
+
// Local workspace
|
|
122
188
|
if (!existsSync(LOCAL_KOBOLD_DIR) || options.force) {
|
|
123
189
|
await mkdir(LOCAL_KOBOLD_DIR, { recursive: true });
|
|
124
|
-
console.log(`✓
|
|
190
|
+
console.log(`✓ Workspace: ${LOCAL_KOBOLD_DIR}`);
|
|
125
191
|
const localDb = new Database(LOCAL_DB_PATH);
|
|
126
192
|
localDb.exec(`
|
|
127
193
|
CREATE TABLE IF NOT EXISTS project_context (
|
|
@@ -131,13 +197,6 @@ export const initCommand = new Command("init")
|
|
|
131
197
|
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
132
198
|
);
|
|
133
199
|
|
|
134
|
-
CREATE TABLE IF NOT EXISTS file_index (
|
|
135
|
-
id INTEGER PRIMARY KEY,
|
|
136
|
-
path TEXT UNIQUE NOT NULL,
|
|
137
|
-
content_hash TEXT NOT NULL,
|
|
138
|
-
last_indexed DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
139
|
-
);
|
|
140
|
-
|
|
141
200
|
CREATE TABLE IF NOT EXISTS allowed_projects (
|
|
142
201
|
id INTEGER PRIMARY KEY,
|
|
143
202
|
path TEXT UNIQUE NOT NULL,
|
|
@@ -146,29 +205,25 @@ export const initCommand = new Command("init")
|
|
|
146
205
|
);
|
|
147
206
|
`);
|
|
148
207
|
localDb.close();
|
|
149
|
-
console.log("✓
|
|
208
|
+
console.log("✓ Workspace DB initialized");
|
|
150
209
|
await writeFile(LOCAL_MEMORY_PATH, MEMORY_TEMPLATE, "utf-8");
|
|
151
|
-
console.log("✓ Created local MEMORY.md");
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
console.log(`ℹ️ Local workspace exists at: ${LOCAL_KOBOLD_DIR}`);
|
|
155
210
|
}
|
|
156
|
-
console.log("\n🎉 0xKobold
|
|
157
|
-
console.log(
|
|
158
|
-
console.log(`
|
|
159
|
-
console.log(`
|
|
160
|
-
console.log(
|
|
161
|
-
console.log(
|
|
162
|
-
console.log("
|
|
163
|
-
console.log("
|
|
164
|
-
console.log("
|
|
165
|
-
console.log("
|
|
166
|
-
console.log("
|
|
167
|
-
console.log("
|
|
168
|
-
console.log("
|
|
211
|
+
console.log("\n🎉 0xKobold is ready!");
|
|
212
|
+
console.log("\n📁 Locations:");
|
|
213
|
+
console.log(` Config: ${GLOBAL_CONFIG_PATH}`);
|
|
214
|
+
console.log(` Data: ${GLOBAL_DB_PATH}`);
|
|
215
|
+
console.log(` Persona: ${GLOBAL_KOBOLD_DIR}/persona.md`);
|
|
216
|
+
console.log(`\n\n🚀 Quick Start:`);
|
|
217
|
+
console.log(" 0xkobold chat # Start chatting");
|
|
218
|
+
console.log(" 0xkobold gateway start # Start web gateway");
|
|
219
|
+
console.log(" 0xkobold daemon # Start background daemon");
|
|
220
|
+
console.log("\n🔧 To add API keys for paid models:");
|
|
221
|
+
console.log(" export CLOUD_API_KEY=your_key");
|
|
222
|
+
console.log(" # Or edit ~/.0xkobold/config.json");
|
|
223
|
+
console.log("\nℹ️ Default: Ollama Cloud (free models work without key)");
|
|
169
224
|
}
|
|
170
225
|
catch (error) {
|
|
171
|
-
console.error("❌
|
|
226
|
+
console.error("❌ Init failed:", error);
|
|
172
227
|
process.exit(1);
|
|
173
228
|
}
|
|
174
229
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,iBAAiB,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC,CAAC;AACvD,MAAM,cAAc,GAAG,IAAI,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC;AAC5D,MAAM,kBAAkB,GAAG,IAAI,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC;AAClE,MAAM,kBAAkB,GAAG,IAAI,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC;AAChE,MAAM,gBAAgB,GAAG,WAAW,CAAC;AACrC,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,EAAE,cAAc,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C,CAAC;QACrD,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;QAChD,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;QACpD,OAAO,CAAC,GAAG,CAAC,4DAA4D,CAAC,CAAC;IAE5E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;QACvC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migrate Command - v0.3.0
|
|
3
|
+
*
|
|
4
|
+
* Migrate from OpenClaw to 0xKobold
|
|
5
|
+
*/
|
|
6
|
+
import { Command } from "commander";
|
|
7
|
+
import { runMigration } from "../../migration/openclaw.js";
|
|
8
|
+
export const migrateCommand = new Command("migrate")
|
|
9
|
+
.description("Migrate from OpenClaw (koclaw) to 0xKobold")
|
|
10
|
+
.option("-s, --source <path>", "OpenClaw source directory", "~/.openclaw")
|
|
11
|
+
.option("-t, --target <path>", "0xKobold target directory", "~/.0xkobold")
|
|
12
|
+
.option("--dry-run", "Preview changes without applying", true)
|
|
13
|
+
.option("--live", "Apply changes (default is dry-run)", false)
|
|
14
|
+
.option("-f, --force", "Force migration (skip dry-run)", false)
|
|
15
|
+
.action(async (options) => {
|
|
16
|
+
const dryRun = !options.live && !options.force;
|
|
17
|
+
await runMigration({
|
|
18
|
+
source: options.source,
|
|
19
|
+
target: options.target,
|
|
20
|
+
dryRun,
|
|
21
|
+
force: options.force,
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=migrate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../../../src/cli/commands/migrate.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC;KACjD,WAAW,CAAC,4CAA4C,CAAC;KACzD,MAAM,CAAC,qBAAqB,EAAE,2BAA2B,EAAE,aAAa,CAAC;KACzE,MAAM,CAAC,qBAAqB,EAAE,2BAA2B,EAAE,aAAa,CAAC;KACzE,MAAM,CAAC,WAAW,EAAE,kCAAkC,EAAE,IAAI,CAAC;KAC7D,MAAM,CAAC,QAAQ,EAAE,oCAAoC,EAAE,KAAK,CAAC;KAC7D,MAAM,CAAC,aAAa,EAAE,gCAAgC,EAAE,KAAK,CAAC;KAC9D,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IACxB,MAAM,MAAM,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;IAE/C,MAAM,YAAY,CAAC;QACjB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,MAAM;QACN,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tailscale CLI Command - v0.3.0
|
|
3
|
+
*
|
|
4
|
+
* Manage Tailscale VPN connection for secure remote access.
|
|
5
|
+
*/
|
|
6
|
+
import { Command } from "commander";
|
|
7
|
+
import { getTailscaleIntegration } from "../../infra/index.js";
|
|
8
|
+
export function createTailscaleCommand() {
|
|
9
|
+
const cmd = new Command("tailscale")
|
|
10
|
+
.description("Manage Tailscale VPN connection");
|
|
11
|
+
// Status
|
|
12
|
+
cmd
|
|
13
|
+
.command("status")
|
|
14
|
+
.description("Check Tailscale status")
|
|
15
|
+
.action(async () => {
|
|
16
|
+
const ts = getTailscaleIntegration();
|
|
17
|
+
const status = await ts.getStatus();
|
|
18
|
+
console.log("🔍 Tailscale Status\n");
|
|
19
|
+
if (!status.installed) {
|
|
20
|
+
console.log("❌ Tailscale not installed");
|
|
21
|
+
console.log(" Install: https://tailscale.com/download");
|
|
22
|
+
console.log(" macOS: brew install tailscale");
|
|
23
|
+
console.log(" Linux: curl -fsSL https://tailscale.com/install.sh | sh");
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
console.log(`✅ Tailscale installed`);
|
|
27
|
+
console.log(` Running: ${status.running ? "✅" : "❌"}`);
|
|
28
|
+
console.log(` Connected: ${status.connected ? "✅" : "❌"}`);
|
|
29
|
+
if (status.myIP) {
|
|
30
|
+
console.log(` IP: ${status.myIP}`);
|
|
31
|
+
// Show gateway URL
|
|
32
|
+
const url = await ts.getGatewayURL();
|
|
33
|
+
if (url) {
|
|
34
|
+
console.log(`\n🌐 Gateway URL: ${url}`);
|
|
35
|
+
console.log(` Use: 0xkobold tui --local --remote ${url}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
// Start
|
|
40
|
+
cmd
|
|
41
|
+
.command("start")
|
|
42
|
+
.description("Start Tailscale daemon")
|
|
43
|
+
.action(async () => {
|
|
44
|
+
const ts = getTailscaleIntegration();
|
|
45
|
+
ts.on("ready", ({ ip }) => {
|
|
46
|
+
console.log(`✅ Tailscale ready! IP: ${ip}`);
|
|
47
|
+
});
|
|
48
|
+
const success = await ts.start();
|
|
49
|
+
if (!success) {
|
|
50
|
+
console.log("\n⚠️ Manual start required:");
|
|
51
|
+
console.log(" sudo tailscale up");
|
|
52
|
+
console.log("\n Or use Tailscale GUI app");
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
// Stop
|
|
56
|
+
cmd
|
|
57
|
+
.command("stop")
|
|
58
|
+
.description("Stop Tailscale")
|
|
59
|
+
.action(async () => {
|
|
60
|
+
console.log("🛑 Stopping Tailscale...");
|
|
61
|
+
console.log(" Run: sudo tailscale down");
|
|
62
|
+
});
|
|
63
|
+
// Get URL
|
|
64
|
+
cmd
|
|
65
|
+
.command("url")
|
|
66
|
+
.description("Get Tailscale gateway URL")
|
|
67
|
+
.option("-p, --port <port>", "Gateway port", "7777")
|
|
68
|
+
.action(async (options) => {
|
|
69
|
+
const ts = getTailscaleIntegration();
|
|
70
|
+
const url = await ts.getGatewayURL(parseInt(options.port));
|
|
71
|
+
if (url) {
|
|
72
|
+
console.log(url);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
console.error("❌ Tailscale not running or not installed");
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
return cmd;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=tailscale.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tailscale.js","sourceRoot":"","sources":["../../../../src/cli/commands/tailscale.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,MAAM,UAAU,sBAAsB;IACpC,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,WAAW,CAAC;SACjC,WAAW,CAAC,iCAAiC,CAAC,CAAC;IAElD,SAAS;IACT,GAAG;SACA,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,wBAAwB,CAAC;SACrC,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,MAAM,EAAE,GAAG,uBAAuB,EAAE,CAAC;QACrC,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,SAAS,EAAE,CAAC;QAEpC,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;QAErC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;YACtB,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;YACzC,OAAO,CAAC,GAAG,CAAC,4CAA4C,CAA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
import { getTelegramIntegration, resetTelegramIntegration, } from "../../channels/index.js";
|
|
8
|
+
export function createTelegramCommand() {
|
|
9
|
+
const cmd = new Command("telegram")
|
|
10
|
+
.description("Manage Telegram integration");
|
|
11
|
+
// Start Telegram
|
|
12
|
+
cmd
|
|
13
|
+
.command("start")
|
|
14
|
+
.description("Start Telegram bot")
|
|
15
|
+
.option("--token <token>", "Bot token (or set TELEGRAM_BOT_TOKEN)")
|
|
16
|
+
.option("--mode <mode>", "Connection mode (polling|webhook)", "polling")
|
|
17
|
+
.action(async (options) => {
|
|
18
|
+
const token = options.token || process.env.TELEGRAM_BOT_TOKEN;
|
|
19
|
+
if (!token) {
|
|
20
|
+
console.error("❌ Telegram bot token required");
|
|
21
|
+
console.error("Set TELEGRAM_BOT_TOKEN or use --token");
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
console.log("📱 Starting Telegram bot...");
|
|
25
|
+
try {
|
|
26
|
+
const telegram = getTelegramIntegration({
|
|
27
|
+
token,
|
|
28
|
+
mode: options.mode,
|
|
29
|
+
});
|
|
30
|
+
telegram.on("connected", () => {
|
|
31
|
+
console.log("✅ Telegram bot connected!");
|
|
32
|
+
console.log("Mode:", options.mode);
|
|
33
|
+
});
|
|
34
|
+
telegram.on("message", (msg) => {
|
|
35
|
+
console.log(`📩 ${msg.isGroup ? "Group" : "DM"}: ${msg.text?.slice(0, 50)}...`);
|
|
36
|
+
});
|
|
37
|
+
telegram.on("error", (err) => {
|
|
38
|
+
console.error("❌ Telegram error:", err.message);
|
|
39
|
+
});
|
|
40
|
+
await telegram.start();
|
|
41
|
+
console.log("\n🔄 Telegram bot running...");
|
|
42
|
+
console.log("Press Ctrl+C to stop\n");
|
|
43
|
+
process.on("SIGINT", async () => {
|
|
44
|
+
console.log("\n🛑 Stopping Telegram...");
|
|
45
|
+
await resetTelegramIntegration();
|
|
46
|
+
console.log("✅ Telegram stopped");
|
|
47
|
+
process.exit(0);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
console.error("❌ Failed to start Telegram:", error);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
// Stop
|
|
56
|
+
cmd
|
|
57
|
+
.command("stop")
|
|
58
|
+
.description("Stop Telegram bot")
|
|
59
|
+
.action(async () => {
|
|
60
|
+
console.log("🛑 Stopping Telegram...");
|
|
61
|
+
await resetTelegramIntegration();
|
|
62
|
+
console.log("✅ Telegram stopped");
|
|
63
|
+
});
|
|
64
|
+
// Status
|
|
65
|
+
cmd
|
|
66
|
+
.command("status")
|
|
67
|
+
.description("Check Telegram status")
|
|
68
|
+
.action(() => {
|
|
69
|
+
try {
|
|
70
|
+
const telegram = getTelegramIntegration();
|
|
71
|
+
const status = telegram.getStatus();
|
|
72
|
+
if (status.connected) {
|
|
73
|
+
console.log("🟢 Telegram: Connected");
|
|
74
|
+
console.log(` Mode: ${status.mode}`);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
console.log("🔴 Telegram: Not running");
|
|
78
|
+
console.log(" Run: 0xkobold telegram start");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
console.log("🔴 Telegram: Not initialized");
|
|
83
|
+
console.log(" Run: 0xkobold telegram start --token <token>");
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
// Send message
|
|
87
|
+
cmd
|
|
88
|
+
.command("send")
|
|
89
|
+
.description("Send test message")
|
|
90
|
+
.argument("<chatId>", "Chat ID (e.g., 123456789)")
|
|
91
|
+
.argument("<message>", "Message text")
|
|
92
|
+
.option("--token <token>", "Bot token")
|
|
93
|
+
.action(async (chatId, message, options) => {
|
|
94
|
+
try {
|
|
95
|
+
const token = options.token || process.env.TELEGRAM_BOT_TOKEN;
|
|
96
|
+
const telegram = getTelegramIntegration(token ? { token, mode: "polling" } : undefined);
|
|
97
|
+
if (!telegram.getStatus().connected) {
|
|
98
|
+
console.error("❌ Telegram not connected");
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
await telegram.sendMessage(chatId, message);
|
|
102
|
+
console.log("✅ Message sent");
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
console.error("❌ Failed to send:", error);
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
return cmd;
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=telegram.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telegram.js","sourceRoot":"","sources":["../../../../src/cli/commands/telegram.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,UAAU,qBAAqB;IACnC,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC;SAChC,WAAW,CAAC,6BAA6B,CAAC,CAAC;IAE9C,iBAAiB;IACjB,GAAG;SACA,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,oBAAoB,CAAC;SACjC,MAAM,CAAC,iBAAiB,EAAE,uCAAuC,CAAC;SAClE,MAAM,CAAC,eAAe,EAAE,mCAAmC,EAAE,SAAS,CAAC;SACvE,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACxB,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;QAE9D,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;YAC/C,OAAO,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;YACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;QAE3C,IAA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U,EAAE,2BAA2B,CAAC;SACjD,QAAQ,CAAC,WAAW,EAAE,cAAc,CAAC;SACrC,MAAM,CAAC,iBAAiB,EAAE,WAAW,CAAC;SACtC,MAAM,CAAC,KAAK,EAAE,MAAc,EAAE,OAAe,EAAE,OAAO,EAAE,EAAE;QACzD,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;YAC9D,MAAM,QAAQ,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YAExF,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC,SAAS,EAAE,CAAC;gBACpC,OAAO,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;gBAC1C,OAAO;YACT,CAAC;YAED,MAAM,QAAQ,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAC5C,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAChC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;YAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -10,6 +10,8 @@ export const tuiCommand = new Command()
|
|
|
10
10
|
.description("Start the 0xKobold Terminal UI (interactive mode)")
|
|
11
11
|
.option("-e, --extensions <paths...>", "Additional extension paths to load")
|
|
12
12
|
.option("-l, --local", "Use current directory as workspace (default: global ~/.0xkobold)")
|
|
13
|
+
.option("-r, --remote <url>", "Connect to remote gateway instead of local (e.g., wss://vps.example.com:7777)")
|
|
14
|
+
.option("--token <token>", "Authentication token for remote gateway")
|
|
13
15
|
.action(async (options) => {
|
|
14
16
|
// The main TUI entry point is src/index.ts (relative to package root)
|
|
15
17
|
const packageRoot = resolve(__dirname, "../../..");
|
|
@@ -17,9 +19,23 @@ export const tuiCommand = new Command()
|
|
|
17
19
|
// Determine working directory: global workspace by default, or current dir with --local
|
|
18
20
|
const globalWorkspace = resolve(homedir(), ".0xkobold");
|
|
19
21
|
const cwd = options.local ? process.cwd() : globalWorkspace;
|
|
20
|
-
//
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
// Remote gateway mode
|
|
23
|
+
if (options.remote) {
|
|
24
|
+
console.log(`🌐 Remote Gateway Mode: ${options.remote}`);
|
|
25
|
+
console.log(`📁 Local Working Directory: ${cwd}`);
|
|
26
|
+
console.log(`🧠 AI Processing: Remote (VPS)\n`);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
console.log(`🐉 Starting 0xKobold TUI (${options.local ? "local" : "global"} workspace)...`);
|
|
30
|
+
if (options.local) {
|
|
31
|
+
console.log(`📁 Working in: ${cwd}\n`);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
console.log(`📁 Global workspace: ${cwd}\n`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// Write context file for local mode tracking
|
|
38
|
+
if (options.local || options.remote) {
|
|
23
39
|
const contextFile = resolve(globalWorkspace, ".active-context");
|
|
24
40
|
try {
|
|
25
41
|
if (!existsSync(globalWorkspace)) {
|
|
@@ -27,23 +43,26 @@ export const tuiCommand = new Command()
|
|
|
27
43
|
}
|
|
28
44
|
writeFileSync(contextFile, JSON.stringify({
|
|
29
45
|
workingDir: cwd,
|
|
30
|
-
isLocal:
|
|
46
|
+
isLocal: options.local || !!options.remote,
|
|
47
|
+
remoteGateway: options.remote || null,
|
|
31
48
|
timestamp: Date.now(),
|
|
32
49
|
}, null, 2));
|
|
33
|
-
// Broadcast to gateway if available
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
50
|
+
// Broadcast to local gateway if available (only in non-remote mode)
|
|
51
|
+
if (!options.remote) {
|
|
52
|
+
try {
|
|
53
|
+
await fetch("http://127.0.0.1:18789/event", {
|
|
54
|
+
method: "POST",
|
|
55
|
+
headers: { "Content-Type": "application/json" },
|
|
56
|
+
body: JSON.stringify({
|
|
57
|
+
type: "tui.context_changed",
|
|
58
|
+
workingDir: cwd,
|
|
59
|
+
isLocal: true,
|
|
60
|
+
}),
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
// Gateway not running, ignore
|
|
65
|
+
}
|
|
47
66
|
}
|
|
48
67
|
}
|
|
49
68
|
catch {
|
|
@@ -63,7 +82,6 @@ export const tuiCommand = new Command()
|
|
|
63
82
|
}
|
|
64
83
|
}
|
|
65
84
|
try {
|
|
66
|
-
console.log(`🐉 Starting 0xKobold TUI (${options.local ? "local" : "global"} workspace)...\n`);
|
|
67
85
|
const args = [tuiEntryPoint];
|
|
68
86
|
// Add any custom extensions if provided
|
|
69
87
|
if (options.extensions) {
|
|
@@ -79,12 +97,12 @@ export const tuiCommand = new Command()
|
|
|
79
97
|
env: {
|
|
80
98
|
...process.env,
|
|
81
99
|
// Set working directory for file operations (tools, etc.)
|
|
82
|
-
// Config stays in default pi location (~/.pi/agent/)
|
|
83
100
|
KOBOLD_WORKING_DIR: cwd,
|
|
84
101
|
// Session identification
|
|
85
102
|
KOBOLD_SESSION_TYPE: "tui",
|
|
86
|
-
//
|
|
87
|
-
|
|
103
|
+
// Remote gateway configuration
|
|
104
|
+
KOBOLD_REMOTE_GATEWAY: options.remote || "",
|
|
105
|
+
KOBOLD_REMOTE_TOKEN: options.token || "",
|
|
88
106
|
},
|
|
89
107
|
});
|
|
90
108
|
child.on("exit", (code) => {
|