echoclaw-relay-agent 0.4.0 → 0.4.1
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/main.js +14 -2
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -2963,11 +2963,14 @@ var GatewayRpcProxy = class extends import_events2.EventEmitter {
|
|
|
2963
2963
|
}
|
|
2964
2964
|
handleEvent(frame, generation) {
|
|
2965
2965
|
const runId = frame.payload?.runId;
|
|
2966
|
+
const state = frame.payload?.state;
|
|
2966
2967
|
const streamId = frame.payload?.streamId || frame.payload?.id;
|
|
2968
|
+
console.log(`[rpc-proxy] Event received: event=${frame.event}, state=${state}, runId=${runId?.slice(0, 8) ?? "none"}, streams=${this.streams.size}, runIdMap=${this.runIdToRpc.size}`);
|
|
2967
2969
|
let rpcId = runId ? this.runIdToRpc.get(runId) : void 0;
|
|
2968
2970
|
if (!rpcId && streamId) rpcId = streamId;
|
|
2969
2971
|
const stream = rpcId ? this.streams.get(rpcId) : null;
|
|
2970
2972
|
if (!stream) {
|
|
2973
|
+
console.log(`[rpc-proxy] No matching stream for runId=${runId?.slice(0, 8) ?? "none"}, forwarding as unmatched event`);
|
|
2971
2974
|
this.emit("gateway_event", frame);
|
|
2972
2975
|
return;
|
|
2973
2976
|
}
|
|
@@ -2983,7 +2986,6 @@ var GatewayRpcProxy = class extends import_events2.EventEmitter {
|
|
|
2983
2986
|
this.cancelStream(stream.requestId);
|
|
2984
2987
|
return;
|
|
2985
2988
|
}
|
|
2986
|
-
const state = frame.payload?.state;
|
|
2987
2989
|
const isFinal = state === "final" || state === "aborted" || state === "error";
|
|
2988
2990
|
this.emitTunnelResponse(stream.requestId, frame, isFinal);
|
|
2989
2991
|
if (isFinal) {
|
|
@@ -3071,6 +3073,16 @@ function startGateway(gwConfig) {
|
|
|
3071
3073
|
rpcProxy.on("response", (response) => {
|
|
3072
3074
|
sendEncryptedPayload(response);
|
|
3073
3075
|
});
|
|
3076
|
+
rpcProxy.on("gateway_event", (frame) => {
|
|
3077
|
+
console.log(`[relay-agent] Forwarding unmatched gateway event: ${frame.event ?? frame.type}`);
|
|
3078
|
+
sendEncryptedPayload({
|
|
3079
|
+
request_id: `evt-${Date.now().toString(36)}`,
|
|
3080
|
+
direction: "response",
|
|
3081
|
+
type: "ws-rpc",
|
|
3082
|
+
frame,
|
|
3083
|
+
final: false
|
|
3084
|
+
});
|
|
3085
|
+
});
|
|
3074
3086
|
gatewayConn.on("state", (newState, oldState) => {
|
|
3075
3087
|
console.log(`[relay-agent] Gateway: ${oldState} \u2192 ${newState}`);
|
|
3076
3088
|
broadcastControlState();
|
|
@@ -3888,7 +3900,7 @@ async function discoverGatewayToken() {
|
|
|
3888
3900
|
}
|
|
3889
3901
|
|
|
3890
3902
|
// src/main.ts
|
|
3891
|
-
var VERSION = "0.4.
|
|
3903
|
+
var VERSION = "0.4.1";
|
|
3892
3904
|
function parseArgs() {
|
|
3893
3905
|
const args = process.argv.slice(2);
|
|
3894
3906
|
const opts = {
|