@agentvault/agentvault 0.19.8 → 0.19.10
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 +63 -40
- package/dist/cli.js.map +2 -2
- package/dist/index.js +63 -40
- package/dist/index.js.map +2 -2
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -47942,9 +47942,11 @@ var init_channel = __esm({
|
|
|
47942
47942
|
}
|
|
47943
47943
|
resolved = { kind: "room", id: target.roomId };
|
|
47944
47944
|
} else if (target.kind === "a2a") {
|
|
47945
|
-
const
|
|
47945
|
+
const a2aEntries = this._persisted?.a2aChannels ? Object.values(this._persisted.a2aChannels) : [];
|
|
47946
|
+
const channelEntry = a2aEntries.find((ch) => ch.hubAddress === target.hubAddress);
|
|
47946
47947
|
if (!channelEntry) {
|
|
47947
|
-
const
|
|
47948
|
+
const storedAddresses = a2aEntries.map((ch) => ch.hubAddress).join(", ") || "(none)";
|
|
47949
|
+
const err = `No A2A channel found for hub address: ${target.hubAddress} (stored: ${storedAddresses})`;
|
|
47948
47950
|
console.log(`[deliver] target=a2a:${target.hubAddress} content=${content.type} result=FAIL: ${err}`);
|
|
47949
47951
|
return { ok: false, destination: { kind: "a2a", id: target.hubAddress }, error: err, timestamp: ts };
|
|
47950
47952
|
}
|
|
@@ -49051,46 +49053,67 @@ var init_channel = __esm({
|
|
|
49051
49053
|
const channelData = data.data || data;
|
|
49052
49054
|
const channelId = channelData.channel_id;
|
|
49053
49055
|
const convId = channelData.conversation_id;
|
|
49054
|
-
const
|
|
49055
|
-
|
|
49056
|
-
|
|
49057
|
-
|
|
49058
|
-
|
|
49059
|
-
|
|
49060
|
-
|
|
49061
|
-
|
|
49062
|
-
|
|
49063
|
-
|
|
49064
|
-
|
|
49065
|
-
|
|
49066
|
-
|
|
49067
|
-
|
|
49068
|
-
|
|
49069
|
-
|
|
49070
|
-
|
|
49071
|
-
|
|
49072
|
-
|
|
49073
|
-
|
|
49074
|
-
|
|
49075
|
-
ephemeral_key: ephPubHex
|
|
49076
|
-
}
|
|
49077
|
-
})
|
|
49078
|
-
);
|
|
49079
|
-
console.log(
|
|
49080
|
-
`[SecureChannel] A2A key exchange sent for channel ${channelId.slice(0, 8)}... (role=${role})`
|
|
49056
|
+
const existingEntry = this._persisted?.a2aChannels?.[channelId];
|
|
49057
|
+
if (existingEntry?.conversationId && existingEntry?.hubAddress && (existingEntry.session || existingEntry.pendingEphemeralPrivateKey)) {
|
|
49058
|
+
console.log(
|
|
49059
|
+
`[SecureChannel] A2A channel ${channelId.slice(0, 8)}... already synced (peer=${existingEntry.hubAddress}), skipping approved event`
|
|
49060
|
+
);
|
|
49061
|
+
this.emit("a2a_channel_approved", channelData);
|
|
49062
|
+
if (this.config.onA2AChannelReady && convId) {
|
|
49063
|
+
this.config.onA2AChannelReady({
|
|
49064
|
+
channelId,
|
|
49065
|
+
peerHubAddress: existingEntry.hubAddress,
|
|
49066
|
+
role: existingEntry.role || "responder",
|
|
49067
|
+
conversationId: existingEntry.conversationId
|
|
49068
|
+
});
|
|
49069
|
+
}
|
|
49070
|
+
} else {
|
|
49071
|
+
const myHub = this._persisted?.hubAddress || "";
|
|
49072
|
+
const role = channelData.role || (myHub && channelData.initiator_hub_address === myHub ? "initiator" : "responder");
|
|
49073
|
+
const peerHub = role === "initiator" ? channelData.responder_hub_address || "" : channelData.initiator_hub_address || "";
|
|
49074
|
+
if (!myHub) {
|
|
49075
|
+
console.warn(
|
|
49076
|
+
`[SecureChannel] WARNING: hubAddress not set during a2a_channel_approved \u2014 peer address may be wrong (role=${role} peer=${peerHub})`
|
|
49081
49077
|
);
|
|
49082
49078
|
}
|
|
49083
|
-
|
|
49084
|
-
|
|
49085
|
-
|
|
49086
|
-
|
|
49087
|
-
|
|
49088
|
-
channelId
|
|
49089
|
-
|
|
49090
|
-
|
|
49091
|
-
|
|
49092
|
-
|
|
49093
|
-
|
|
49079
|
+
if (this._persisted && convId) {
|
|
49080
|
+
if (!this._persisted.a2aChannels) this._persisted.a2aChannels = {};
|
|
49081
|
+
const a2aEphemeral = await generateEphemeralKeypair();
|
|
49082
|
+
const ephPubHex = bytesToHex(a2aEphemeral.publicKey);
|
|
49083
|
+
const ephPrivHex = bytesToHex(a2aEphemeral.privateKey);
|
|
49084
|
+
this._persisted.a2aChannels[channelId] = {
|
|
49085
|
+
channelId,
|
|
49086
|
+
hubAddress: peerHub,
|
|
49087
|
+
conversationId: convId,
|
|
49088
|
+
role,
|
|
49089
|
+
pendingEphemeralPrivateKey: ephPrivHex
|
|
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
|
+
}
|
|
49094
49117
|
}
|
|
49095
49118
|
}
|
|
49096
49119
|
if (data.event === "a2a_channel_activated") {
|