@agentvault/agentvault 0.19.22 → 0.19.23
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 +19 -57
- package/dist/cli.js.map +3 -3
- package/dist/index.js +19 -57
- package/dist/index.js.map +3 -3
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -47959,32 +47959,9 @@ var init_channel = __esm({
|
|
|
47959
47959
|
this._persisted.a2aChannels[match.channelId].conversationId = match.conversationId;
|
|
47960
47960
|
await this._persistState();
|
|
47961
47961
|
}
|
|
47962
|
-
|
|
47963
|
-
|
|
47964
|
-
|
|
47965
|
-
{
|
|
47966
|
-
method: "POST",
|
|
47967
|
-
headers: {
|
|
47968
|
-
"Content-Type": "application/json",
|
|
47969
|
-
Authorization: `Bearer ${this._deviceJwt}`
|
|
47970
|
-
},
|
|
47971
|
-
body: JSON.stringify({
|
|
47972
|
-
text: content.text || "",
|
|
47973
|
-
hub_address: myHub
|
|
47974
|
-
})
|
|
47975
|
-
}
|
|
47976
|
-
);
|
|
47977
|
-
if (httpRes.ok) {
|
|
47978
|
-
const result = await httpRes.json();
|
|
47979
|
-
console.log(`[deliver] A2A HTTP send OK \u2192 ${peerAddress} msg=${result.message_id?.slice(0, 8)}`);
|
|
47980
|
-
return { ok: true, destination: { kind: "a2a", id: peerAddress }, timestamp: ts };
|
|
47981
|
-
} else {
|
|
47982
|
-
const errText = await httpRes.text();
|
|
47983
|
-
console.warn(`[deliver] A2A HTTP send failed (${httpRes.status}): ${errText}`);
|
|
47984
|
-
}
|
|
47985
|
-
} catch (httpErr) {
|
|
47986
|
-
console.warn(`[deliver] A2A HTTP send error: ${httpErr}`);
|
|
47987
|
-
}
|
|
47962
|
+
channelEntry = Object.values(this._persisted?.a2aChannels ?? {}).find(
|
|
47963
|
+
(ch) => ch.hubAddress === peerAddress
|
|
47964
|
+
);
|
|
47988
47965
|
}
|
|
47989
47966
|
} catch (syncErr) {
|
|
47990
47967
|
console.warn("[deliver] A2A direct send failed:", syncErr);
|
|
@@ -48511,7 +48488,7 @@ var init_channel = __esm({
|
|
|
48511
48488
|
messageNumber: encrypted.header.messageNumber
|
|
48512
48489
|
};
|
|
48513
48490
|
const headerBlobHex = Buffer.from(JSON.stringify(headerObj)).toString("hex");
|
|
48514
|
-
const
|
|
48491
|
+
const payload = {
|
|
48515
48492
|
channel_id: channelEntry.channelId,
|
|
48516
48493
|
conversation_id: channelEntry.conversationId,
|
|
48517
48494
|
header_blob: headerBlobHex,
|
|
@@ -48521,7 +48498,7 @@ var init_channel = __esm({
|
|
|
48521
48498
|
parent_span_id: opts?.parentSpanId
|
|
48522
48499
|
};
|
|
48523
48500
|
if (this._persisted.hubAddress) {
|
|
48524
|
-
|
|
48501
|
+
payload.hub_address = this._persisted.hubAddress;
|
|
48525
48502
|
}
|
|
48526
48503
|
if (channelEntry.observerSession?.ratchetState) {
|
|
48527
48504
|
try {
|
|
@@ -48532,9 +48509,9 @@ var init_channel = __esm({
|
|
|
48532
48509
|
previousChainLength: obsEncrypted.header.previousChainLength,
|
|
48533
48510
|
messageNumber: obsEncrypted.header.messageNumber
|
|
48534
48511
|
};
|
|
48535
|
-
|
|
48536
|
-
|
|
48537
|
-
|
|
48512
|
+
payload.observer_header_blob = Buffer.from(JSON.stringify(obsHeaderObj)).toString("hex");
|
|
48513
|
+
payload.observer_ciphertext = bytesToHex(obsEncrypted.ciphertext);
|
|
48514
|
+
payload.observer_nonce = bytesToHex(obsEncrypted.nonce);
|
|
48538
48515
|
channelEntry.observerSession.ratchetState = obsRatchet.serialize();
|
|
48539
48516
|
} catch (obsErr) {
|
|
48540
48517
|
console.error("[SecureChannel] Observer encryption failed (sending without observer copy):", obsErr);
|
|
@@ -48545,34 +48522,14 @@ var init_channel = __esm({
|
|
|
48545
48522
|
this._ws.send(
|
|
48546
48523
|
JSON.stringify({
|
|
48547
48524
|
event: "a2a_message",
|
|
48548
|
-
data:
|
|
48525
|
+
data: payload
|
|
48549
48526
|
})
|
|
48550
48527
|
);
|
|
48551
48528
|
return;
|
|
48552
48529
|
}
|
|
48553
|
-
|
|
48554
|
-
|
|
48555
|
-
|
|
48556
|
-
text,
|
|
48557
|
-
message_type: "a2a",
|
|
48558
|
-
parent_span_id: opts?.parentSpanId
|
|
48559
|
-
};
|
|
48560
|
-
if (this._persisted.hubAddress) {
|
|
48561
|
-
payload.hub_address = this._persisted.hubAddress;
|
|
48562
|
-
}
|
|
48563
|
-
const a2aJson = JSON.stringify({ event: "a2a_message", data: payload });
|
|
48564
|
-
console.log(`[sendToAgent] Sending A2A plaintext: conv=${payload.conversation_id} wsReady=${this._ws.readyState} bytes=${a2aJson.length}`);
|
|
48565
|
-
await new Promise((resolve3, reject) => {
|
|
48566
|
-
this._ws.send(a2aJson, (err) => {
|
|
48567
|
-
if (err) {
|
|
48568
|
-
console.error(`[sendToAgent] WS send failed:`, err);
|
|
48569
|
-
reject(err);
|
|
48570
|
-
} else {
|
|
48571
|
-
console.log(`[sendToAgent] WS send confirmed`);
|
|
48572
|
-
resolve3();
|
|
48573
|
-
}
|
|
48574
|
-
});
|
|
48575
|
-
});
|
|
48530
|
+
throw new Error(
|
|
48531
|
+
`A2A channel ${channelEntry.channelId.slice(0, 8)}... has no encryption session. Key exchange must complete before messages can be sent. Role: ${channelEntry.role ?? "unknown"}.`
|
|
48532
|
+
);
|
|
48576
48533
|
}
|
|
48577
48534
|
/**
|
|
48578
48535
|
* List all A2A channels for this agent.
|
|
@@ -49139,8 +49096,8 @@ var init_channel = __esm({
|
|
|
49139
49096
|
if (this._persisted && convId) {
|
|
49140
49097
|
if (!this._persisted.a2aChannels) this._persisted.a2aChannels = {};
|
|
49141
49098
|
const existingNow = this._persisted.a2aChannels[channelId];
|
|
49142
|
-
if (existingNow?.
|
|
49143
|
-
console.log(`[SecureChannel] A2A channel ${channelId.slice(0, 8)}...
|
|
49099
|
+
if (existingNow?.session) {
|
|
49100
|
+
console.log(`[SecureChannel] A2A channel ${channelId.slice(0, 8)}... session already active, skipping key exchange`);
|
|
49144
49101
|
} else {
|
|
49145
49102
|
const a2aEphemeral = await generateEphemeralKeypair();
|
|
49146
49103
|
const ephPubHex = bytesToHex(a2aEphemeral.publicKey);
|
|
@@ -49342,6 +49299,11 @@ var init_channel = __esm({
|
|
|
49342
49299
|
}
|
|
49343
49300
|
this.emit("a2a_channel_revoked", channelData);
|
|
49344
49301
|
}
|
|
49302
|
+
if (data.event === "error") {
|
|
49303
|
+
const detail = data.data?.detail || data.detail || "Unknown server error";
|
|
49304
|
+
console.error(`[SecureChannel] Server error: ${detail}`);
|
|
49305
|
+
this.emit("error", new Error(`Server: ${detail}`));
|
|
49306
|
+
}
|
|
49345
49307
|
if (data.event === "a2a_message") {
|
|
49346
49308
|
const msgData = data.data || data;
|
|
49347
49309
|
const a2aMsgId = msgData.message_id;
|