wave-code 0.19.3 → 0.19.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/dist/stdio/agentBridge.d.ts +13 -7
- package/dist/stdio/agentBridge.d.ts.map +1 -1
- package/dist/stdio/agentBridge.js +260 -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 +382 -173
- package/src/stdio/protocol.ts +4 -0
- package/src/stdio/stdioServer.ts +9 -3
package/src/stdio/protocol.ts
CHANGED
|
@@ -13,6 +13,8 @@ export interface JsonRpcRequest {
|
|
|
13
13
|
id: number | string;
|
|
14
14
|
method: string;
|
|
15
15
|
params?: unknown;
|
|
16
|
+
/** Session-scoped requests carry sessionId for routing to the right Agent. */
|
|
17
|
+
sessionId?: string;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
export interface JsonRpcResponse {
|
|
@@ -30,6 +32,8 @@ export interface JsonRpcError {
|
|
|
30
32
|
export interface JsonRpcNotification {
|
|
31
33
|
method: string;
|
|
32
34
|
params?: unknown;
|
|
35
|
+
/** Session-scoped notifications carry sessionId for demultiplexing on the client. */
|
|
36
|
+
sessionId?: string;
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
// ── Error codes (JSON-RPC 2.0 standard) ────────────────────────
|
package/src/stdio/stdioServer.ts
CHANGED
|
@@ -37,7 +37,8 @@ export class StdioServer {
|
|
|
37
37
|
this.output = options.output ?? process.stdout;
|
|
38
38
|
this.bridge = new AgentBridge({
|
|
39
39
|
...options.bridgeOptions,
|
|
40
|
-
emit: (method, params) =>
|
|
40
|
+
emit: (method, params, sessionId) =>
|
|
41
|
+
this.sendNotification(method, params, sessionId),
|
|
41
42
|
});
|
|
42
43
|
}
|
|
43
44
|
|
|
@@ -113,7 +114,11 @@ export class StdioServer {
|
|
|
113
114
|
|
|
114
115
|
private async handleRequest(msg: JsonRpcRequest): Promise<void> {
|
|
115
116
|
try {
|
|
116
|
-
const result = await this.bridge.handleRequest(
|
|
117
|
+
const result = await this.bridge.handleRequest(
|
|
118
|
+
msg.method,
|
|
119
|
+
msg.params,
|
|
120
|
+
msg.sessionId,
|
|
121
|
+
);
|
|
117
122
|
this.sendResponse(msg.id, result);
|
|
118
123
|
} catch (err) {
|
|
119
124
|
const code =
|
|
@@ -152,8 +157,9 @@ export class StdioServer {
|
|
|
152
157
|
this.write(response);
|
|
153
158
|
}
|
|
154
159
|
|
|
155
|
-
sendNotification(method: string, params?: unknown): void {
|
|
160
|
+
sendNotification(method: string, params?: unknown, sessionId?: string): void {
|
|
156
161
|
const notification: JsonRpcNotification = { method, params };
|
|
162
|
+
if (sessionId) notification.sessionId = sessionId;
|
|
157
163
|
this.write(notification);
|
|
158
164
|
}
|
|
159
165
|
|