wave-code 0.19.3 → 0.19.5
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/stdio/agentBridge.d.ts +13 -7
- package/dist/stdio/agentBridge.d.ts.map +1 -1
- package/dist/stdio/agentBridge.js +261 -184
- package/dist/stdio/protocol.d.ts +4 -0
- package/dist/stdio/protocol.d.ts.map +1 -1
- package/dist/stdio/stdioServer.d.ts +1 -1
- package/dist/stdio/stdioServer.d.ts.map +1 -1
- package/dist/stdio/stdioServer.js +5 -3
- package/package.json +2 -2
- package/src/stdio/agentBridge.ts +384 -173
- package/src/stdio/protocol.ts +4 -0
- package/src/stdio/stdioServer.ts +9 -3
|
@@ -2,27 +2,32 @@
|
|
|
2
2
|
* AgentBridge — wraps the SDK Agent and translates between the JSON-RPC-like
|
|
3
3
|
* stdio protocol and Agent method calls / callbacks.
|
|
4
4
|
*
|
|
5
|
+
* Multi-tenant: maintains a Map<sessionId, {agent, storedConfig}> so a single
|
|
6
|
+
* `wave --stdio` process can host multiple sessions. Session-scoped requests
|
|
7
|
+
* carry `sessionId` on the JSON-RPC envelope for routing; global requests
|
|
8
|
+
* (listSessions/searchFiles/auth/plugins) don't require it but may use it
|
|
9
|
+
* for workdir fallback.
|
|
10
|
+
*
|
|
5
11
|
* Responsibilities:
|
|
6
|
-
* - Route incoming requests to the appropriate Agent method
|
|
7
|
-
* - Translate AgentCallbacks into outgoing notifications
|
|
12
|
+
* - Route incoming requests to the appropriate Agent method (by sessionId)
|
|
13
|
+
* - Translate AgentCallbacks into outgoing notifications (with sessionId)
|
|
8
14
|
* - Implement the canUseTool permission flow over the stdio protocol
|
|
9
15
|
* - Handle config updates by destroying and recreating the Agent
|
|
10
16
|
*/
|
|
11
17
|
import { type JsonRpcError } from "./protocol.js";
|
|
12
|
-
export type NotificationEmitter = (method: string, params: unknown) => void;
|
|
18
|
+
export type NotificationEmitter = (method: string, params: unknown, sessionId?: string) => void;
|
|
13
19
|
export interface AgentBridgeOptions {
|
|
14
20
|
emit: NotificationEmitter;
|
|
15
21
|
}
|
|
16
22
|
export declare class AgentBridge {
|
|
17
|
-
private
|
|
23
|
+
private sessions;
|
|
18
24
|
private pendingPermissions;
|
|
19
25
|
private permissionCounter;
|
|
20
|
-
private storedConfig;
|
|
21
26
|
private emit;
|
|
22
27
|
private pluginCore;
|
|
23
28
|
private pluginCoreWorkdir;
|
|
24
29
|
constructor(options: AgentBridgeOptions);
|
|
25
|
-
handleRequest(method: string, params: unknown): Promise<unknown>;
|
|
30
|
+
handleRequest(method: string, params: unknown, sessionId?: string): Promise<unknown>;
|
|
26
31
|
handleNotification(method: string, params: unknown): void;
|
|
27
32
|
private initialize;
|
|
28
33
|
private destroy;
|
|
@@ -64,7 +69,8 @@ export declare class AgentBridge {
|
|
|
64
69
|
private updateMarketplace;
|
|
65
70
|
private createCallbacks;
|
|
66
71
|
private findLastUserMessage;
|
|
67
|
-
private
|
|
72
|
+
private requireSession;
|
|
73
|
+
private getSessionWorkdir;
|
|
68
74
|
}
|
|
69
75
|
export declare class RpcError extends Error {
|
|
70
76
|
code: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentBridge.d.ts","sourceRoot":"","sources":["../../src/stdio/agentBridge.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"agentBridge.d.ts","sourceRoot":"","sources":["../../src/stdio/agentBridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAuBH,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,eAAe,CAAC;AAiBvB,MAAM,MAAM,mBAAmB,GAAG,CAChC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,EACf,SAAS,CAAC,EAAE,MAAM,KACf,IAAI,CAAC;AAEV,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,mBAAmB,CAAC;CAC3B;AAsDD,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAm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