@emqo/claudebridge 0.5.1 → 0.5.2
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/core/agent.js +3 -3
- package/dist/core/store.d.ts +2 -1
- package/dist/core/store.js +7 -5
- package/dist/index.js +5 -1
- package/package.json +1 -1
package/dist/core/agent.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { spawn } from "child_process";
|
|
2
2
|
import { mkdirSync } from "fs";
|
|
3
|
-
import { join
|
|
3
|
+
import { join } from "path";
|
|
4
4
|
import { UserLock } from "./lock.js";
|
|
5
5
|
import { AccessControl } from "./permissions.js";
|
|
6
6
|
import { EndpointRotator } from "./keys.js";
|
|
@@ -146,7 +146,7 @@ export class AgentEngine {
|
|
|
146
146
|
env.ANTHROPIC_API_KEY = ep.api_key;
|
|
147
147
|
if (ep.base_url)
|
|
148
148
|
env.ANTHROPIC_BASE_URL = ep.base_url;
|
|
149
|
-
env.CLAUDEBRIDGE_DB =
|
|
149
|
+
env.CLAUDEBRIDGE_DB = this.store.dbPath;
|
|
150
150
|
const child = spawn("claude", args, { cwd, env, stdio: ["pipe", "pipe", "pipe"] });
|
|
151
151
|
child.stdin.end();
|
|
152
152
|
console.log(`[agent] spawned claude pid=${child.pid} cwd=${cwd} args=${args.join(" ")}`);
|
|
@@ -252,7 +252,7 @@ export class AgentEngine {
|
|
|
252
252
|
env.ANTHROPIC_API_KEY = ep.api_key;
|
|
253
253
|
if (ep.base_url)
|
|
254
254
|
env.ANTHROPIC_BASE_URL = ep.base_url;
|
|
255
|
-
env.CLAUDEBRIDGE_DB =
|
|
255
|
+
env.CLAUDEBRIDGE_DB = this.store.dbPath;
|
|
256
256
|
const child = spawn("claude", args, { cwd, env, stdio: ["pipe", "pipe", "pipe"] });
|
|
257
257
|
child.stdin.end();
|
|
258
258
|
console.log(`[agent] spawned claude (parallel) pid=${child.pid} cwd=${cwd}`);
|
package/dist/core/store.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare class Store {
|
|
2
2
|
private db;
|
|
3
|
-
|
|
3
|
+
readonly dbPath: string;
|
|
4
|
+
constructor(dbPath?: string);
|
|
4
5
|
getSession(userId: string): string | null;
|
|
5
6
|
setSession(userId: string, sessionId: string, platform: string): void;
|
|
6
7
|
clearSession(userId: string): void;
|
package/dist/core/store.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import Database from "better-sqlite3";
|
|
2
2
|
import { mkdirSync } from "fs";
|
|
3
|
-
import { dirname } from "path";
|
|
4
|
-
const
|
|
3
|
+
import { dirname, resolve } from "path";
|
|
4
|
+
const DEFAULT_DB_PATH = "./data/claudebridge.db";
|
|
5
5
|
export class Store {
|
|
6
6
|
db;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
this.
|
|
7
|
+
dbPath;
|
|
8
|
+
constructor(dbPath) {
|
|
9
|
+
this.dbPath = resolve(dbPath || DEFAULT_DB_PATH);
|
|
10
|
+
mkdirSync(dirname(this.dbPath), { recursive: true });
|
|
11
|
+
this.db = new Database(this.dbPath);
|
|
10
12
|
this.db.pragma("journal_mode = WAL");
|
|
11
13
|
this.db.exec(`
|
|
12
14
|
CREATE TABLE IF NOT EXISTS sessions (
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { setDefaultAutoSelectFamily } from "net";
|
|
2
2
|
setDefaultAutoSelectFamily(false);
|
|
3
3
|
import { watch } from "fs";
|
|
4
|
+
import { join, dirname, resolve } from "path";
|
|
4
5
|
import { loadConfig, reloadConfig } from "./core/config.js";
|
|
5
6
|
import { Store } from "./core/store.js";
|
|
6
7
|
import { AgentEngine } from "./core/agent.js";
|
|
@@ -11,7 +12,10 @@ async function main() {
|
|
|
11
12
|
const _cfgIdx = process.argv.indexOf("--config");
|
|
12
13
|
const _cfgPath = _cfgIdx !== -1 ? process.argv[_cfgIdx + 1] : undefined;
|
|
13
14
|
let config = loadConfig(_cfgPath);
|
|
14
|
-
|
|
15
|
+
// Derive DB path from config file directory (not CWD)
|
|
16
|
+
const configDir = _cfgPath ? dirname(resolve(_cfgPath)) : process.cwd();
|
|
17
|
+
const dbPath = join(configDir, "data", "claudebridge.db");
|
|
18
|
+
const store = new Store(dbPath);
|
|
15
19
|
const engine = new AgentEngine(config, store);
|
|
16
20
|
const adapters = [];
|
|
17
21
|
let webhookServer = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emqo/claudebridge",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Bridge claude CLI to chat platforms (Telegram, Discord) with HITL approval, conditional branching, webhook triggers, parallel execution, and observability",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|