@emqo/claudebridge 0.7.0 → 0.9.0
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/config.yaml.example +12 -3
- package/dist/adapters/base.d.ts +1 -0
- package/dist/adapters/discord.d.ts +4 -0
- package/dist/adapters/discord.js +99 -23
- package/dist/adapters/telegram.d.ts +4 -0
- package/dist/adapters/telegram.js +138 -60
- package/dist/core/agent.d.ts +37 -0
- package/dist/core/agent.js +251 -232
- package/dist/core/config.d.ts +2 -70
- package/dist/core/config.js +9 -38
- package/dist/core/i18n.js +12 -4
- package/dist/core/keys.d.ts +2 -10
- package/dist/core/keys.js +7 -22
- package/dist/core/lock.d.ts +8 -4
- package/dist/core/lock.js +28 -17
- package/dist/core/logger.d.ts +11 -0
- package/dist/core/logger.js +24 -0
- package/dist/core/router.d.ts +25 -0
- package/dist/core/router.js +125 -0
- package/dist/core/schema.d.ts +166 -0
- package/dist/core/schema.js +85 -0
- package/dist/core/session.d.ts +50 -0
- package/dist/core/session.js +100 -0
- package/dist/core/store.d.ts +52 -15
- package/dist/core/store.js +105 -19
- package/dist/ctl.js +32 -30
- package/dist/index.js +42 -13
- package/dist/providers/base.d.ts +26 -0
- package/dist/providers/base.js +1 -0
- package/dist/providers/claude.d.ts +9 -0
- package/dist/providers/claude.js +53 -0
- package/dist/providers/codex.d.ts +9 -0
- package/dist/providers/codex.js +35 -0
- package/dist/providers/registry.d.ts +2 -0
- package/dist/providers/registry.js +12 -0
- package/dist/skills/bridge.d.ts +2 -0
- package/dist/skills/bridge.js +2 -0
- package/dist/webhook.js +7 -5
- package/package.json +8 -4
package/dist/core/agent.d.ts
CHANGED
|
@@ -2,11 +2,15 @@ import { Config } from "./config.js";
|
|
|
2
2
|
import { Store } from "./store.js";
|
|
3
3
|
import { AccessControl } from "./permissions.js";
|
|
4
4
|
import { EndpointRotator } from "./keys.js";
|
|
5
|
+
import { SessionManager } from "./session.js";
|
|
6
|
+
import { SessionRouter } from "./router.js";
|
|
5
7
|
export interface AgentResponse {
|
|
6
8
|
text: string;
|
|
7
9
|
sessionId: string;
|
|
8
10
|
cost?: number;
|
|
9
11
|
timedOut?: boolean;
|
|
12
|
+
subSessionId?: string;
|
|
13
|
+
label?: string;
|
|
10
14
|
}
|
|
11
15
|
export type StreamCallback = (chunk: string, full: string) => void | Promise<void>;
|
|
12
16
|
export declare class AgentEngine {
|
|
@@ -14,6 +18,9 @@ export declare class AgentEngine {
|
|
|
14
18
|
private store;
|
|
15
19
|
private lock;
|
|
16
20
|
private rotator;
|
|
21
|
+
private sessionMgr;
|
|
22
|
+
private router;
|
|
23
|
+
private sessionExpiryTimer?;
|
|
17
24
|
access: AccessControl;
|
|
18
25
|
constructor(config: Config, store: Store);
|
|
19
26
|
reloadConfig(config: Config): void;
|
|
@@ -24,12 +31,42 @@ export declare class AgentEngine {
|
|
|
24
31
|
getRotator(): EndpointRotator;
|
|
25
32
|
getEndpointCount(): number;
|
|
26
33
|
getMaxParallel(): number;
|
|
34
|
+
getSessionManager(): SessionManager;
|
|
35
|
+
getRouter(): SessionRouter;
|
|
27
36
|
getWorkDir(userId: string): string;
|
|
37
|
+
/** @deprecated Use isSessionLocked() for multi-session mode */
|
|
28
38
|
isLocked(userId: string): boolean;
|
|
39
|
+
isSessionLocked(subSessionId: string): boolean;
|
|
40
|
+
isMultiSessionEnabled(): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Main entry point for user messages in multi-session mode.
|
|
43
|
+
* Routes to the correct sub-session and executes concurrently.
|
|
44
|
+
*/
|
|
45
|
+
handleUserMessage(userId: string, prompt: string, platform: string, chatId: string, replyToMsgId?: string, onChunk?: StreamCallback, overrideTimeoutMs?: number): Promise<AgentResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* Execute a prompt within a specific sub-session.
|
|
48
|
+
* Acquires per-session lock, resumes claude session via -r flag.
|
|
49
|
+
*/
|
|
50
|
+
private _executeSubSession;
|
|
51
|
+
/**
|
|
52
|
+
* Core execution: spawn claude CLI with session resume for a sub-session.
|
|
53
|
+
* Thin wrapper around _spawnAgent with sub-session persistence.
|
|
54
|
+
*/
|
|
55
|
+
private _executeWithSession;
|
|
56
|
+
/** Build the append system prompt (memories + skill doc) */
|
|
57
|
+
private _buildAppendPrompt;
|
|
58
|
+
/**
|
|
59
|
+
* Unified core: spawn provider CLI, parse stream, handle timeout.
|
|
60
|
+
* All execute methods delegate here.
|
|
61
|
+
*/
|
|
62
|
+
private _spawnAgent;
|
|
63
|
+
/** @deprecated Use handleUserMessage() for multi-session mode */
|
|
29
64
|
runStream(userId: string, prompt: string, platform: string, chatId: string, onChunk?: StreamCallback, overrideTimeoutMs?: number): Promise<AgentResponse>;
|
|
30
65
|
runParallel(userId: string, prompt: string, platform: string, chatId: string, onChunk?: StreamCallback, overrideTimeoutMs?: number): Promise<AgentResponse>;
|
|
31
66
|
private _executeWithRetry;
|
|
67
|
+
/** Legacy single-session execution. Thin wrapper around _spawnAgent with store persistence. */
|
|
32
68
|
private _execute;
|
|
69
|
+
/** Parallel execution without session resume. Thin wrapper around _spawnAgent. */
|
|
33
70
|
private _executeNoSession;
|
|
34
71
|
private _autoSummarize;
|
|
35
72
|
}
|