@agentvault/agentvault 0.19.10 → 0.19.11
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/channel.d.ts.map +1 -1
- package/dist/cli.js +42 -57
- package/dist/cli.js.map +2 -2
- package/dist/index.js +42 -57
- package/dist/index.js.map +2 -2
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -49054,66 +49054,51 @@ var init_channel = __esm({
|
|
|
49054
49054
|
const channelId = channelData.channel_id;
|
|
49055
49055
|
const convId = channelData.conversation_id;
|
|
49056
49056
|
const existingEntry = this._persisted?.a2aChannels?.[channelId];
|
|
49057
|
-
|
|
49058
|
-
|
|
49059
|
-
|
|
49057
|
+
const myHub = this._persisted?.hubAddress || "";
|
|
49058
|
+
const role = existingEntry?.role || channelData.role || (myHub && channelData.initiator_hub_address === myHub ? "initiator" : "responder");
|
|
49059
|
+
const peerHub = existingEntry?.hubAddress || (role === "initiator" ? channelData.responder_hub_address || "" : channelData.initiator_hub_address || "");
|
|
49060
|
+
if (!myHub && !existingEntry?.hubAddress) {
|
|
49061
|
+
console.warn(
|
|
49062
|
+
`[SecureChannel] WARNING: hubAddress not set during a2a_channel_approved \u2014 peer address may be wrong (role=${role} peer=${peerHub})`
|
|
49060
49063
|
);
|
|
49061
|
-
|
|
49062
|
-
|
|
49063
|
-
|
|
49064
|
-
|
|
49065
|
-
|
|
49066
|
-
|
|
49067
|
-
|
|
49068
|
-
|
|
49069
|
-
|
|
49070
|
-
|
|
49071
|
-
|
|
49072
|
-
|
|
49073
|
-
|
|
49074
|
-
if (
|
|
49075
|
-
|
|
49076
|
-
|
|
49064
|
+
}
|
|
49065
|
+
if (this._persisted && convId) {
|
|
49066
|
+
if (!this._persisted.a2aChannels) this._persisted.a2aChannels = {};
|
|
49067
|
+
const a2aEphemeral = await generateEphemeralKeypair();
|
|
49068
|
+
const ephPubHex = bytesToHex(a2aEphemeral.publicKey);
|
|
49069
|
+
const ephPrivHex = bytesToHex(a2aEphemeral.privateKey);
|
|
49070
|
+
this._persisted.a2aChannels[channelId] = {
|
|
49071
|
+
channelId,
|
|
49072
|
+
hubAddress: peerHub,
|
|
49073
|
+
conversationId: convId,
|
|
49074
|
+
role,
|
|
49075
|
+
pendingEphemeralPrivateKey: ephPrivHex
|
|
49076
|
+
};
|
|
49077
|
+
if (this._ws) {
|
|
49078
|
+
this._ws.send(
|
|
49079
|
+
JSON.stringify({
|
|
49080
|
+
event: "a2a_key_exchange",
|
|
49081
|
+
data: {
|
|
49082
|
+
channel_id: channelId,
|
|
49083
|
+
ephemeral_key: ephPubHex
|
|
49084
|
+
}
|
|
49085
|
+
})
|
|
49086
|
+
);
|
|
49087
|
+
console.log(
|
|
49088
|
+
`[SecureChannel] A2A key exchange sent for channel ${channelId.slice(0, 8)}... (role=${role})`
|
|
49077
49089
|
);
|
|
49078
49090
|
}
|
|
49079
|
-
|
|
49080
|
-
|
|
49081
|
-
|
|
49082
|
-
|
|
49083
|
-
|
|
49084
|
-
|
|
49085
|
-
|
|
49086
|
-
|
|
49087
|
-
|
|
49088
|
-
|
|
49089
|
-
|
|
49090
|
-
};
|
|
49091
|
-
if (this._ws) {
|
|
49092
|
-
this._ws.send(
|
|
49093
|
-
JSON.stringify({
|
|
49094
|
-
event: "a2a_key_exchange",
|
|
49095
|
-
data: {
|
|
49096
|
-
channel_id: channelId,
|
|
49097
|
-
ephemeral_key: ephPubHex
|
|
49098
|
-
}
|
|
49099
|
-
})
|
|
49100
|
-
);
|
|
49101
|
-
console.log(
|
|
49102
|
-
`[SecureChannel] A2A key exchange sent for channel ${channelId.slice(0, 8)}... (role=${role})`
|
|
49103
|
-
);
|
|
49104
|
-
}
|
|
49105
|
-
await this._persistState();
|
|
49106
|
-
}
|
|
49107
|
-
this.emit("a2a_channel_approved", channelData);
|
|
49108
|
-
if (this.config.onA2AChannelReady && convId) {
|
|
49109
|
-
this.config.onA2AChannelReady({
|
|
49110
|
-
channelId,
|
|
49111
|
-
peerHubAddress: peerHub,
|
|
49112
|
-
role,
|
|
49113
|
-
conversationId: convId,
|
|
49114
|
-
topic: channelData.topic || void 0
|
|
49115
|
-
});
|
|
49116
|
-
}
|
|
49091
|
+
await this._persistState();
|
|
49092
|
+
}
|
|
49093
|
+
this.emit("a2a_channel_approved", channelData);
|
|
49094
|
+
if (this.config.onA2AChannelReady && convId) {
|
|
49095
|
+
this.config.onA2AChannelReady({
|
|
49096
|
+
channelId,
|
|
49097
|
+
peerHubAddress: peerHub,
|
|
49098
|
+
role,
|
|
49099
|
+
conversationId: convId,
|
|
49100
|
+
topic: channelData.topic || void 0
|
|
49101
|
+
});
|
|
49117
49102
|
}
|
|
49118
49103
|
}
|
|
49119
49104
|
if (data.event === "a2a_channel_activated") {
|