0xkobold 0.0.2 â 0.0.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/README.md +59 -5
- package/dist/package.json +7 -5
- package/dist/src/cli/commands/setup.js +144 -0
- package/dist/src/cli/commands/setup.js.map +1 -0
- package/dist/src/cli/program.js +3 -0
- package/dist/src/cli/program.js.map +1 -1
- package/dist/src/extensions/core/auto-compact-on-error-extension.js +244 -0
- package/dist/src/extensions/core/auto-compact-on-error-extension.js.map +1 -0
- package/dist/src/extensions/core/diagnostics-extension.js +215 -0
- package/dist/src/extensions/core/diagnostics-extension.js.map +1 -0
- package/dist/src/extensions/core/extension-scaffold-extension.js +449 -0
- package/dist/src/extensions/core/extension-scaffold-extension.js.map +1 -0
- package/dist/src/extensions/core/git-commit-extension.js +527 -0
- package/dist/src/extensions/core/git-commit-extension.js.map +1 -0
- package/dist/src/extensions/core/heartbeat-extension.js +43 -0
- package/dist/src/extensions/core/heartbeat-extension.js.map +1 -1
- package/dist/src/extensions/core/memory-extension.js +120 -0
- package/dist/src/extensions/core/memory-extension.js.map +1 -0
- package/dist/src/extensions/core/memory-synthesis-extension.js +137 -0
- package/dist/src/extensions/core/memory-synthesis-extension.js.map +1 -0
- package/dist/src/extensions/core/mode-manager-extension.js +19 -0
- package/dist/src/extensions/core/mode-manager-extension.js.map +1 -1
- package/dist/src/extensions/core/ollama-cloud-extension.js +132 -0
- package/dist/src/extensions/core/ollama-cloud-extension.js.map +1 -0
- package/dist/src/extensions/core/ollama-router-extension.js +100 -0
- package/dist/src/extensions/core/ollama-router-extension.js.map +1 -0
- package/dist/src/extensions/core/perennial-memory-extension.js +449 -0
- package/dist/src/extensions/core/perennial-memory-extension.js.map +1 -0
- package/dist/src/index.js +7 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/llm/ollama.js +80 -9
- package/dist/src/llm/ollama.js.map +1 -1
- package/package.json +7 -5
- package/scripts/postinstall.js +71 -0
package/README.md
CHANGED
|
@@ -52,15 +52,31 @@ Best of both worlds:
|
|
|
52
52
|
### Via NPM (Recommended)
|
|
53
53
|
|
|
54
54
|
```bash
|
|
55
|
-
# Install
|
|
55
|
+
# 1. Install Bun (if not already installed)
|
|
56
|
+
curl -fsSL https://bun.sh/install | bash
|
|
57
|
+
# Restart your terminal after installing Bun
|
|
58
|
+
|
|
59
|
+
# 2. Install 0xKobold globally
|
|
56
60
|
npm install -g 0xkobold
|
|
57
61
|
|
|
58
|
-
#
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
# 3. Run interactive setup
|
|
63
|
+
0xkobold setup
|
|
64
|
+
|
|
65
|
+
# 4. Start using it!
|
|
66
|
+
0xkobold # Start the TUI
|
|
67
|
+
0xkobold --mode plan # Or start in plan mode
|
|
68
|
+
0xkobold --mode build # Or start in build mode
|
|
61
69
|
```
|
|
62
70
|
|
|
63
|
-
###
|
|
71
|
+
### Quick Start with npx (No Install)
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# Just want to try it out? Use npx:
|
|
75
|
+
npx 0xkobold setup
|
|
76
|
+
npx 0xkobold
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### From Source (Development)
|
|
64
80
|
|
|
65
81
|
```bash
|
|
66
82
|
# Clone and install
|
|
@@ -150,6 +166,44 @@ const result = await agent.spawn('Research this topic');
|
|
|
150
166
|
|
|
151
167
|
The `spawn_subagent` skill is built-in and lets agents create child agents automatically.
|
|
152
168
|
|
|
169
|
+
## Ollama Cloud đŠī¸
|
|
170
|
+
|
|
171
|
+
0xKobold now supports Ollama Cloud for access to larger models without running Ollama locally.
|
|
172
|
+
|
|
173
|
+
### Setup Cloud Access
|
|
174
|
+
|
|
175
|
+
1. Get your API key from [ollama.com/settings/keys](https://ollama.com/settings/keys)
|
|
176
|
+
|
|
177
|
+
2. Login via the TUI:
|
|
178
|
+
```
|
|
179
|
+
/login
|
|
180
|
+
# Select "Ollama Cloud"
|
|
181
|
+
# Paste your API key
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
3. Switch between modes:
|
|
185
|
+
```
|
|
186
|
+
/ollama-mode cloud # Use cloud exclusively
|
|
187
|
+
/ollama-mode local # Use local Ollama
|
|
188
|
+
/ollama-mode auto # Auto-detect (default)
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Cloud Models Available
|
|
192
|
+
|
|
193
|
+
- **GPT-OSS 120B** - State-of-the-art open source
|
|
194
|
+
- **Qwen 2.5 72B/32B** - Alibaba's instruction-tuned model
|
|
195
|
+
- **DeepSeek R1 671B** - Reasoning-capable model
|
|
196
|
+
- **Llama 3.2** - Meta's latest open weights
|
|
197
|
+
|
|
198
|
+
### Quick Commands
|
|
199
|
+
|
|
200
|
+
- `/ollama-mode` - Show current mode and status
|
|
201
|
+
- `/ollama-status` - Check cloud connection
|
|
202
|
+
- `/ollama-local` - Switch to local mode
|
|
203
|
+
- `/ollama-cloud` - Switch to cloud mode
|
|
204
|
+
|
|
205
|
+
Your API key is securely stored in `~/.0xkobold/auth.json` with 0600 permissions.
|
|
206
|
+
|
|
153
207
|
## Commands
|
|
154
208
|
|
|
155
209
|
```bash
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "0xkobold",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Your digital familiar - a personal AI assistant that learns and evolves",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -28,15 +28,16 @@
|
|
|
28
28
|
"update:install": "bun run src/cli/index.ts update install",
|
|
29
29
|
"update:framework": "bun run src/cli/index.ts update framework",
|
|
30
30
|
"setup-hooks": "bash scripts/install-hooks.sh",
|
|
31
|
-
"prepublishOnly": "bun run build"
|
|
31
|
+
"prepublishOnly": "bun run build",
|
|
32
|
+
"postinstall": "node scripts/postinstall.js || echo 'Welcome to 0xKobold! Run: 0xkobold setup'"
|
|
32
33
|
},
|
|
33
34
|
"keywords": ["ai", "assistant", "cli", "agent", "kobold"],
|
|
34
35
|
"author": "0xKobold Team",
|
|
35
36
|
"license": "MIT",
|
|
36
37
|
"dependencies": {
|
|
37
|
-
"@mariozechner/pi-agent-core": "0.57.
|
|
38
|
-
"@mariozechner/pi-coding-agent": "0.57.
|
|
39
|
-
"@mariozechner/pi-tui": "0.57.
|
|
38
|
+
"@mariozechner/pi-agent-core": "0.57.1",
|
|
39
|
+
"@mariozechner/pi-coding-agent": "0.57.1",
|
|
40
|
+
"@mariozechner/pi-tui": "0.57.1",
|
|
40
41
|
"ajv": "^8.18.0",
|
|
41
42
|
"blessed": "^0.1.81",
|
|
42
43
|
"commander": "^11.1.0",
|
|
@@ -63,6 +64,7 @@
|
|
|
63
64
|
"private": false,
|
|
64
65
|
"files": [
|
|
65
66
|
"dist",
|
|
67
|
+
"scripts/postinstall.js",
|
|
66
68
|
"README.md",
|
|
67
69
|
"LICENSE",
|
|
68
70
|
"package.json",
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* 0xKobold Setup Command
|
|
4
|
+
*
|
|
5
|
+
* Interactive setup wizard for first-time users.
|
|
6
|
+
* Guides through configuration and first run.
|
|
7
|
+
*/
|
|
8
|
+
import { Command } from "commander";
|
|
9
|
+
import { existsSync } from "node:fs";
|
|
10
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
11
|
+
import { join } from "node:path";
|
|
12
|
+
import { homedir } from "node:os";
|
|
13
|
+
import { Database } from "bun:sqlite";
|
|
14
|
+
const KOBOLD_DIR = join(homedir(), ".0xkobold");
|
|
15
|
+
const CONFIG_PATH = join(KOBOLD_DIR, "config.json");
|
|
16
|
+
const DEFAULT_CONFIG = {
|
|
17
|
+
version: "0.0.4",
|
|
18
|
+
llm: {
|
|
19
|
+
provider: "ollama",
|
|
20
|
+
model: "qwen2.5-coder:14b",
|
|
21
|
+
maxTokens: 4000,
|
|
22
|
+
temperature: 0.7,
|
|
23
|
+
cloud: {
|
|
24
|
+
enabled: false,
|
|
25
|
+
endpoint: "",
|
|
26
|
+
apiKey: "",
|
|
27
|
+
model: "kimi-k2.5"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
gateway: {
|
|
31
|
+
port: 18789,
|
|
32
|
+
host: "127.0.0.1",
|
|
33
|
+
enabled: false
|
|
34
|
+
},
|
|
35
|
+
discord: {
|
|
36
|
+
enabled: false,
|
|
37
|
+
token: "",
|
|
38
|
+
channelId: ""
|
|
39
|
+
},
|
|
40
|
+
extensions: [
|
|
41
|
+
"core/mcp-extension",
|
|
42
|
+
"core/mode-manager-extension",
|
|
43
|
+
"core/websearch-extension",
|
|
44
|
+
"core/heartbeat-extension",
|
|
45
|
+
"core/ollama-router-extension",
|
|
46
|
+
"core/ollama-cloud-extension",
|
|
47
|
+
"core/discord-bridge-extension"
|
|
48
|
+
]
|
|
49
|
+
};
|
|
50
|
+
function checkBun() {
|
|
51
|
+
try {
|
|
52
|
+
const result = Bun.spawnSync(["bun", "--version"]);
|
|
53
|
+
return result.success;
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function getBunInstallCommand() {
|
|
60
|
+
const platform = process.platform;
|
|
61
|
+
if (platform === "darwin" || platform === "linux") {
|
|
62
|
+
return "curl -fsSL https://bun.sh/install | bash";
|
|
63
|
+
}
|
|
64
|
+
if (platform === "win32") {
|
|
65
|
+
return "powershell -c \"irm bun.sh/install.ps1 | iex\"";
|
|
66
|
+
}
|
|
67
|
+
return "# Install Bun: https://bun.sh/docs/installation";
|
|
68
|
+
}
|
|
69
|
+
export const setupCommand = new Command("setup")
|
|
70
|
+
.description("Interactive setup wizard for 0xKobold")
|
|
71
|
+
.option("-q, --quick", "Quick setup (accept defaults)")
|
|
72
|
+
.action(async (options) => {
|
|
73
|
+
console.log("đ˛ Welcome to 0xKobold Setup\n");
|
|
74
|
+
// Check for Bun
|
|
75
|
+
if (!checkBun()) {
|
|
76
|
+
console.log("â Bun is required but not installed.");
|
|
77
|
+
console.log("\nInstall Bun with:\n");
|
|
78
|
+
console.log(` ${getBunInstallCommand()}`);
|
|
79
|
+
console.log("\nThen restart your terminal and run: 0xkobold setup");
|
|
80
|
+
process.exit(1);
|
|
81
|
+
}
|
|
82
|
+
console.log("â Bun detected\n");
|
|
83
|
+
// Check if already initialized
|
|
84
|
+
if (existsSync(CONFIG_PATH) && !options.quick) {
|
|
85
|
+
console.log(`â ī¸ 0xKobold is already configured at ${CONFIG_PATH}`);
|
|
86
|
+
console.log("\nTo reconfigure, run: 0xkobold setup --force");
|
|
87
|
+
console.log("To check status: 0xkobold status");
|
|
88
|
+
console.log("To start TUI: 0xkobold\n");
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
// Create directory
|
|
92
|
+
await mkdir(KOBOLD_DIR, { recursive: true });
|
|
93
|
+
if (options.quick) {
|
|
94
|
+
console.log("⥠Quick setup mode (using defaults)...\n");
|
|
95
|
+
// Write default config
|
|
96
|
+
await writeFile(CONFIG_PATH, JSON.stringify(DEFAULT_CONFIG, null, 2));
|
|
97
|
+
// Create database
|
|
98
|
+
const db = new Database(join(KOBOLD_DIR, "kobold.db"));
|
|
99
|
+
db.exec(`
|
|
100
|
+
CREATE TABLE IF NOT EXISTS conversations (
|
|
101
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
102
|
+
session_id TEXT NOT NULL,
|
|
103
|
+
role TEXT NOT NULL,
|
|
104
|
+
content TEXT NOT NULL,
|
|
105
|
+
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
106
|
+
metadata TEXT
|
|
107
|
+
);
|
|
108
|
+
CREATE TABLE IF NOT EXISTS memory (
|
|
109
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
110
|
+
key TEXT UNIQUE NOT NULL,
|
|
111
|
+
value TEXT NOT NULL,
|
|
112
|
+
category TEXT,
|
|
113
|
+
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
114
|
+
);
|
|
115
|
+
`);
|
|
116
|
+
db.close();
|
|
117
|
+
console.log("â Configuration created");
|
|
118
|
+
console.log(`â Database initialized at ${join(KOBOLD_DIR, "kobold.db")}`);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
console.log("đ Configuration Options:\n");
|
|
122
|
+
console.log(" LLM Provider: Ollama (local)");
|
|
123
|
+
console.log(" Default Model: qwen2.5-coder:14b");
|
|
124
|
+
console.log(" Gateway: Disabled (run '0xkobold gateway start' to enable)");
|
|
125
|
+
console.log(" Discord: Disabled (configure in config.json to enable)\n");
|
|
126
|
+
// Write config
|
|
127
|
+
await writeFile(CONFIG_PATH, JSON.stringify(DEFAULT_CONFIG, null, 2));
|
|
128
|
+
console.log("â Configuration saved");
|
|
129
|
+
}
|
|
130
|
+
// Success message
|
|
131
|
+
console.log("\nđ 0xKobold is ready!\n");
|
|
132
|
+
console.log("Next steps:\n");
|
|
133
|
+
console.log(" 1. Start the TUI:");
|
|
134
|
+
console.log(" 0xkobold\n");
|
|
135
|
+
console.log(" 2. Or start with a specific mode:");
|
|
136
|
+
console.log(" 0xkobold --mode plan # For planning/research");
|
|
137
|
+
console.log(" 0xkobold --mode build # For implementation\n");
|
|
138
|
+
console.log(" 3. Edit config:");
|
|
139
|
+
console.log(` ${CONFIG_PATH}\n`);
|
|
140
|
+
console.log(" 4. Start WebSocket gateway:");
|
|
141
|
+
console.log(" 0xkobold gateway start\n");
|
|
142
|
+
console.log("Documentation: https://github.com/kobolds/0xKobolds#readme");
|
|
143
|
+
});
|
|
144
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../../src/cli/commands/setup.ts"],"names":[],"mappings":";AACA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW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,CAAC;IACzC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAC7B,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;IACpC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAChC,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;IACpD,OAAO,CAAC,GAAG,CAAC,sDAAsD,CAAC,CAAC;IACpE,OAAO,CAAC,GAAG,CAAC,qDAAqD,CAAC,CAAC;IACnE,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAClC,OAAO,CAAC,GAAG,CAAC,SAAS,WAAW,IAAI,CAAC,CAAC;IACtC,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,4DAA4D,CAAC,CAAC;AAC5E,CAAC,CAAC,CAAC"}
|
package/dist/src/cli/program.js
CHANGED
|
@@ -13,6 +13,7 @@ import { createStatusCommand } from "./commands/status.js";
|
|
|
13
13
|
import { createLogsCommand } from "./commands/logs.js";
|
|
14
14
|
// System commands
|
|
15
15
|
import { createSystemCommand } from "./commands/system.js";
|
|
16
|
+
import { setupCommand } from "./commands/setup.js";
|
|
16
17
|
// Extension CLI registrations
|
|
17
18
|
import { registerDiscordCli } from "./extensions/discord.js";
|
|
18
19
|
import { registerHeartbeatCli } from "./extensions/heartbeat.js";
|
|
@@ -34,6 +35,8 @@ export function createCli() {
|
|
|
34
35
|
// System management (install/uninstall)
|
|
35
36
|
const systemCmd = createSystemCommand();
|
|
36
37
|
program.addCommand(systemCmd);
|
|
38
|
+
// Setup wizard
|
|
39
|
+
program.addCommand(setupCommand);
|
|
37
40
|
// Extension CLIs
|
|
38
41
|
registerDiscordCli(program);
|
|
39
42
|
registerHeartbeatCli(program);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program.js","sourceRoot":"","sources":["../../../src/cli/program.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC,SAAS,IAAI,EAAE,MAAM,EAAE,CAAC;AAErE,gBAAgB;AAChB,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,kBAAkB;AAClB,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"program.js","sourceRoot":"","sources":["../../../src/cli/program.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC,SAAS,IAAI,EAAE,MAAM,EAAE,CAAC;AAErE,gBAAgB;AAChB,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,kBAAkB;AAClB,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,8BAA8B;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC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,oCAAoC;QACpC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,iBAAiB,GAAG,MAAM,CAAC;YACvC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC/B,CAAC;QACD,aAAa;QACb,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;QAC7C,MAAM,IAAI,EAAE,CAAC;IACf,CAAC,CAAC,CAAC;IAEL,gCAAgC;IAChC,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,yDAAyD,CAAC;SACtE,MAAM,CAAC,eAAe,EAAE,qCAAqC,CAAC;SAC9D,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACrB,OAAO,CAAC,GAAG,CAAC,iBAAiB,GAAG,MAAM,CAAC;QACvC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC7B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;QAC7C,MAAM,IAAI,EAAE,CAAC;IACf,CAAC,CAAC,CAAC;IAEL,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-Compact on Error Extension
|
|
3
|
+
*
|
|
4
|
+
* Automatically detects context overflow errors from LLM providers and
|
|
5
|
+
* triggers compaction to reduce context size, then retries the request.
|
|
6
|
+
*
|
|
7
|
+
* This prevents the "prompt too long; exceeded max context length" errors
|
|
8
|
+
* by proactively checking context size before requests and auto-compacting
|
|
9
|
+
* when errors occur.
|
|
10
|
+
*
|
|
11
|
+
* Adapted from OpenClaw error handling patterns.
|
|
12
|
+
*/
|
|
13
|
+
const sessionStates = new Map();
|
|
14
|
+
const MAX_RETRIES = 2;
|
|
15
|
+
const RETRY_RESET_DELAY_MS = 30000; // Reset retry count after 30 seconds of no errors
|
|
16
|
+
const COMPACTION_COOLDOWN_MS = 5000; // Don't compact more often than every 5 seconds
|
|
17
|
+
// Context overflow error patterns (adapted from OpenClaw)
|
|
18
|
+
const CONTEXT_OVERFLOW_PATTERNS = [
|
|
19
|
+
/request_too_large/i,
|
|
20
|
+
/request exceeds the maximum size/i,
|
|
21
|
+
/context length exceeded/i,
|
|
22
|
+
/maximum context length/i,
|
|
23
|
+
/prompt is too long/i,
|
|
24
|
+
/exceeds model context window/i,
|
|
25
|
+
/model token limit/i,
|
|
26
|
+
/context overflow/i,
|
|
27
|
+
/exceed context limit/i,
|
|
28
|
+
/exceeds the model's maximum context/i,
|
|
29
|
+
/context_window_exceeded/i,
|
|
30
|
+
/exceeded max context length/i,
|
|
31
|
+
/exceeded.*context.*limit/i,
|
|
32
|
+
/prompt too long/i,
|
|
33
|
+
/400 Bad Request.*prompt too long/i,
|
|
34
|
+
// Chinese proxy error messages
|
|
35
|
+
/ä¸ä¸æčŋ[éŋå¤]/i,
|
|
36
|
+
/ä¸ä¸æčļ
åē/i,
|
|
37
|
+
/ä¸ä¸æéŋåēĻčļ
/i,
|
|
38
|
+
/čļ
åēæå¤§ä¸ä¸æ/i,
|
|
39
|
+
/蝎åįŧŠä¸ä¸æ/i,
|
|
40
|
+
];
|
|
41
|
+
// TPM (tokens per minute) patterns - these are rate limits, NOT context overflow
|
|
42
|
+
const TPM_PATTERNS = [
|
|
43
|
+
/tpm/i,
|
|
44
|
+
/tokens per minute/i,
|
|
45
|
+
/rate limit.*token/i,
|
|
46
|
+
];
|
|
47
|
+
/**
|
|
48
|
+
* Check if error is a context overflow error
|
|
49
|
+
*/
|
|
50
|
+
function isContextOverflowError(errorMessage) {
|
|
51
|
+
if (!errorMessage)
|
|
52
|
+
return false;
|
|
53
|
+
// Exclude TPM/rate limit errors
|
|
54
|
+
if (TPM_PATTERNS.some(p => p.test(errorMessage))) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
// Check for context overflow patterns
|
|
58
|
+
return CONTEXT_OVERFLOW_PATTERNS.some(pattern => pattern.test(errorMessage));
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Check if error is a reasoning constraint error (not overflow)
|
|
62
|
+
*/
|
|
63
|
+
function isReasoningConstraintError(errorMessage) {
|
|
64
|
+
if (!errorMessage)
|
|
65
|
+
return false;
|
|
66
|
+
const lower = errorMessage.toLowerCase();
|
|
67
|
+
return (lower.includes("reasoning is mandatory") ||
|
|
68
|
+
lower.includes("reasoning is required") ||
|
|
69
|
+
lower.includes("requires reasoning") ||
|
|
70
|
+
(lower.includes("reasoning") && lower.includes("cannot be disabled")));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get or create session state
|
|
74
|
+
*/
|
|
75
|
+
function getSessionState(ctx) {
|
|
76
|
+
// @ts-ignore - sessionManager may have getSessionId
|
|
77
|
+
const sessionId = ctx.sessionManager?.getSessionId?.() ?? 'default';
|
|
78
|
+
if (!sessionStates.has(sessionId)) {
|
|
79
|
+
sessionStates.set(sessionId, {
|
|
80
|
+
retryAttempts: 0,
|
|
81
|
+
warnedAt90Percent: false,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return sessionStates.get(sessionId);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Auto-Compact on Error Extension
|
|
88
|
+
*/
|
|
89
|
+
export default function autoCompactOnErrorExtension(pi) {
|
|
90
|
+
console.log("[AutoCompactOnError] Extension loaded");
|
|
91
|
+
// Listen for turn_end to check for errors and detect context overflow
|
|
92
|
+
pi.on("turn_end", async (event, ctx) => {
|
|
93
|
+
const message = event.message;
|
|
94
|
+
const state = getSessionState(ctx);
|
|
95
|
+
// Check if this is an error message
|
|
96
|
+
if (message.role === 'assistant' && message.errorMessage) {
|
|
97
|
+
// Extract error text - use errorMessage first, then check content
|
|
98
|
+
let errorText = message.errorMessage;
|
|
99
|
+
if (typeof message.content === 'string') {
|
|
100
|
+
errorText = message.content + ' ' + errorText;
|
|
101
|
+
}
|
|
102
|
+
else if (Array.isArray(message.content)) {
|
|
103
|
+
const contentText = message.content
|
|
104
|
+
.filter(c => c.type === 'text')
|
|
105
|
+
.map(c => c.text)
|
|
106
|
+
.join(' ');
|
|
107
|
+
errorText = contentText + ' ' + errorText;
|
|
108
|
+
}
|
|
109
|
+
// Check if it's a context overflow error
|
|
110
|
+
if (!isContextOverflowError(errorText) || isReasoningConstraintError(errorText)) {
|
|
111
|
+
// Reset retry count on non-context-overflow errors
|
|
112
|
+
state.retryAttempts = 0;
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
// Context overflow error detected!
|
|
116
|
+
if (state.retryAttempts >= MAX_RETRIES) {
|
|
117
|
+
console.log(`[AutoCompactOnError] Max retries (${MAX_RETRIES}) reached`);
|
|
118
|
+
ctx.ui.notify(`â ī¸ Context overflow persisted after ${MAX_RETRIES} compaction attempts.\n` +
|
|
119
|
+
`You may need to start a new session with /new or manually compact with /compact.`, "error");
|
|
120
|
+
// Don't reset here - let the user see the error
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
// Check compaction cooldown
|
|
124
|
+
const now = Date.now();
|
|
125
|
+
if (state.lastCompactionTime && (now - state.lastCompactionTime) < COMPACTION_COOLDOWN_MS) {
|
|
126
|
+
ctx.ui.notify(`âŗ Compaction cooldown active. Please wait a moment before retrying.`, "warning");
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
state.retryAttempts++;
|
|
130
|
+
state.lastCompactionTime = now;
|
|
131
|
+
console.log(`[AutoCompactOnError] Context overflow detected! Auto-compacting (attempt ${state.retryAttempts}/${MAX_RETRIES})`);
|
|
132
|
+
ctx.ui.notify(`đī¸ Context overflow detected!\n` +
|
|
133
|
+
`Automatically compacting conversation... (attempt ${state.retryAttempts}/${MAX_RETRIES})`, "warning");
|
|
134
|
+
// Trigger compaction
|
|
135
|
+
if (ctx.compact) {
|
|
136
|
+
try {
|
|
137
|
+
let compactionCompleted = false;
|
|
138
|
+
ctx.compact({
|
|
139
|
+
onComplete: (result) => {
|
|
140
|
+
compactionCompleted = true;
|
|
141
|
+
console.log("[AutoCompactOnError] Compaction completed:", result);
|
|
142
|
+
ctx.ui.notify(`â
Compaction complete! Summarized ${result.tokensBefore.toLocaleString()} tokens.\n` +
|
|
143
|
+
`The conversation is ready to continue. Please retry your request.`, "info");
|
|
144
|
+
},
|
|
145
|
+
onError: (error) => {
|
|
146
|
+
console.error("[AutoCompactOnError] Compaction failed:", error);
|
|
147
|
+
ctx.ui.notify(`â Auto-compaction failed: ${error.message}\n` +
|
|
148
|
+
`Please try /compact manually or start a new session with /new.`, "error");
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
// Note: We can't automatically retry here because the turn has already ended with an error.
|
|
152
|
+
// The user will need to send their message again, but now with compacted context.
|
|
153
|
+
}
|
|
154
|
+
catch (err) {
|
|
155
|
+
console.error("[AutoCompactOnError] Error triggering compaction:", err);
|
|
156
|
+
ctx.ui.notify(`â Failed to trigger compaction: ${err}`, "error");
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
ctx.ui.notify(`â ī¸ Context is full and auto-compaction is not available.\n` +
|
|
161
|
+
`Please run /compact manually or start a new session with /new.`, "error");
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
// Successful turn - reset retry count after delay
|
|
166
|
+
if (state.retryAttempts > 0) {
|
|
167
|
+
const now = Date.now();
|
|
168
|
+
if (state.lastCompactionTime && (now - state.lastCompactionTime) > RETRY_RESET_DELAY_MS) {
|
|
169
|
+
state.retryAttempts = 0;
|
|
170
|
+
state.warnedAt90Percent = false;
|
|
171
|
+
console.log("[AutoCompactOnError] Reset retry count after successful period");
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
// Proactive warning when context is getting full
|
|
177
|
+
pi.on("before_provider_request", async (event, ctx) => {
|
|
178
|
+
const usage = ctx.getContextUsage?.();
|
|
179
|
+
const state = getSessionState(ctx);
|
|
180
|
+
if (!usage || usage.tokens === null) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
// Warning at 85% (before we hit the 90% danger zone)
|
|
184
|
+
const warningThreshold = usage.contextWindow * 0.85;
|
|
185
|
+
const dangerThreshold = usage.contextWindow * 0.95;
|
|
186
|
+
if (usage.tokens > dangerThreshold) {
|
|
187
|
+
// Very close to limit - suggest immediate compaction
|
|
188
|
+
ctx.ui.notify(`đ¨ Context is ${usage.percent?.toFixed(1)}% full (${usage.tokens?.toLocaleString()}/${usage.contextWindow.toLocaleString()} tokens).\n` +
|
|
189
|
+
`â ī¸ Dangerously close to overflow! Consider running /compact now.`, "error");
|
|
190
|
+
}
|
|
191
|
+
else if (usage.tokens > warningThreshold && !state.warnedAt90Percent) {
|
|
192
|
+
// First time crossing 85% - warn user
|
|
193
|
+
state.warnedAt90Percent = true;
|
|
194
|
+
ctx.ui.notify(`â ī¸ Context is ${usage.percent?.toFixed(1)}% full (${usage.tokens?.toLocaleString()}/${usage.contextWindow.toLocaleString()} tokens).\n` +
|
|
195
|
+
`Consider running /compact soon to prevent overflow errors.`, "warning");
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
// Register command for manual triggering and status
|
|
199
|
+
pi.registerCommand("auto-compact", {
|
|
200
|
+
description: "Configure auto-compaction on context overflow errors",
|
|
201
|
+
handler: async (args, ctx) => {
|
|
202
|
+
const parts = args.trim().split(" ");
|
|
203
|
+
const subcommand = parts[0];
|
|
204
|
+
const state = getSessionState(ctx);
|
|
205
|
+
if (subcommand === "status") {
|
|
206
|
+
const usage = ctx.getContextUsage?.();
|
|
207
|
+
ctx.ui.notify(`Auto-compact status:\n` +
|
|
208
|
+
` Max retries: ${MAX_RETRIES}\n` +
|
|
209
|
+
` Current retry attempts: ${state.retryAttempts}\n` +
|
|
210
|
+
` Last compaction: ${state.lastCompactionTime ? new Date(state.lastCompactionTime).toLocaleTimeString() : 'never'}\n` +
|
|
211
|
+
` Context usage: ${usage ? `${usage.percent?.toFixed(1)}% (${usage.tokens?.toLocaleString()}/${usage.contextWindow.toLocaleString()})` : 'unknown'}`, "info");
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
if (subcommand === "reset") {
|
|
215
|
+
state.retryAttempts = 0;
|
|
216
|
+
state.warnedAt90Percent = false;
|
|
217
|
+
ctx.ui.notify("Auto-compact state reset for current session.", "info");
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
if (subcommand === "compact") {
|
|
221
|
+
// Manual trigger for testing
|
|
222
|
+
ctx.ui.notify("Triggering compaction...", "info");
|
|
223
|
+
if (ctx.compact) {
|
|
224
|
+
ctx.compact({
|
|
225
|
+
onComplete: (result) => {
|
|
226
|
+
ctx.ui.notify(`â
Compaction complete! Summarized ${result.tokensBefore.toLocaleString()} tokens.`, "info");
|
|
227
|
+
},
|
|
228
|
+
onError: (error) => {
|
|
229
|
+
ctx.ui.notify(`â Compaction failed: ${error.message}`, "error");
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
ctx.ui.notify(`Usage: /auto-compact [status|reset|compact]\n\n` +
|
|
236
|
+
`Auto-compact automatically triggers when:\n` +
|
|
237
|
+
`âĸ "prompt too long" or "context overflow" errors occur\n` +
|
|
238
|
+
`âĸ Up to ${MAX_RETRIES} automatic retries before giving up\n\n` +
|
|
239
|
+
`Proactive warnings appear at 85% context usage.`, "info");
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
console.log("[AutoCompactOnError] Extension initialized");
|
|
243
|
+
}
|
|
244
|
+
//# sourceMappingURL=auto-compact-on-error-extension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-compact-on-error-extension.js","sourceRoot":"","sources":["../../../../src/extensions/core/auto-compact-on-error-extension.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;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