@agentvault/secure-channel 0.6.22 → 0.6.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 +12 -0
- package/dist/channel.d.ts.map +1 -1
- package/dist/cli.js +61 -6
- package/dist/cli.js.map +2 -2
- package/dist/index.js +61 -6
- package/dist/index.js.map +2 -2
- package/dist/types.d.ts +3 -0
- package/dist/types.d.ts.map +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -45540,13 +45540,17 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
|
|
|
45540
45540
|
}
|
|
45541
45541
|
async sendStatusAlert(alert) {
|
|
45542
45542
|
const priority = alert.severity === "error" || alert.severity === "critical" ? "high" : "normal";
|
|
45543
|
+
const envelope = {
|
|
45544
|
+
title: alert.title,
|
|
45545
|
+
message: alert.message,
|
|
45546
|
+
severity: alert.severity,
|
|
45547
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
45548
|
+
};
|
|
45549
|
+
if (alert.detail !== void 0) envelope.detail = alert.detail;
|
|
45550
|
+
if (alert.detailFormat !== void 0) envelope.detail_format = alert.detailFormat;
|
|
45551
|
+
if (alert.category !== void 0) envelope.category = alert.category;
|
|
45543
45552
|
await this.send(
|
|
45544
|
-
JSON.stringify(
|
|
45545
|
-
title: alert.title,
|
|
45546
|
-
message: alert.message,
|
|
45547
|
-
severity: alert.severity,
|
|
45548
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
45549
|
-
}),
|
|
45553
|
+
JSON.stringify(envelope),
|
|
45550
45554
|
{
|
|
45551
45555
|
messageType: "status_alert",
|
|
45552
45556
|
priority,
|
|
@@ -45554,6 +45558,57 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
|
|
|
45554
45558
|
}
|
|
45555
45559
|
);
|
|
45556
45560
|
}
|
|
45561
|
+
async sendArtifact(artifact) {
|
|
45562
|
+
if (this._state !== "ready" || this._sessions.size === 0 || !this._ws) {
|
|
45563
|
+
throw new Error("Channel is not ready");
|
|
45564
|
+
}
|
|
45565
|
+
const attachMeta = await this._uploadAttachment(artifact.filePath, this._primaryConversationId);
|
|
45566
|
+
const envelope = JSON.stringify({
|
|
45567
|
+
type: "artifact",
|
|
45568
|
+
blob_id: attachMeta.blobId,
|
|
45569
|
+
blob_url: attachMeta.blobUrl,
|
|
45570
|
+
filename: artifact.filename,
|
|
45571
|
+
mime_type: artifact.mimeType,
|
|
45572
|
+
size_bytes: attachMeta.size,
|
|
45573
|
+
description: artifact.description,
|
|
45574
|
+
attachment: attachMeta
|
|
45575
|
+
});
|
|
45576
|
+
const messageGroupId = randomUUID();
|
|
45577
|
+
for (const [convId, session] of this._sessions) {
|
|
45578
|
+
if (!session.activated) continue;
|
|
45579
|
+
const encrypted = session.ratchet.encrypt(envelope);
|
|
45580
|
+
const transport = encryptedMessageToTransport(encrypted);
|
|
45581
|
+
this._ws.send(
|
|
45582
|
+
JSON.stringify({
|
|
45583
|
+
event: "message",
|
|
45584
|
+
data: {
|
|
45585
|
+
conversation_id: convId,
|
|
45586
|
+
header_blob: transport.header_blob,
|
|
45587
|
+
ciphertext: transport.ciphertext,
|
|
45588
|
+
message_group_id: messageGroupId,
|
|
45589
|
+
message_type: "artifact_share"
|
|
45590
|
+
}
|
|
45591
|
+
})
|
|
45592
|
+
);
|
|
45593
|
+
}
|
|
45594
|
+
await this._persistState();
|
|
45595
|
+
}
|
|
45596
|
+
async sendActionConfirmation(confirmation) {
|
|
45597
|
+
const envelope = {
|
|
45598
|
+
type: "action_confirmation",
|
|
45599
|
+
action: confirmation.action,
|
|
45600
|
+
status: confirmation.status
|
|
45601
|
+
};
|
|
45602
|
+
if (confirmation.decisionId !== void 0) envelope.decision_id = confirmation.decisionId;
|
|
45603
|
+
if (confirmation.detail !== void 0) envelope.detail = confirmation.detail;
|
|
45604
|
+
await this.send(
|
|
45605
|
+
JSON.stringify(envelope),
|
|
45606
|
+
{
|
|
45607
|
+
messageType: "action_confirmation",
|
|
45608
|
+
metadata: { status: confirmation.status }
|
|
45609
|
+
}
|
|
45610
|
+
);
|
|
45611
|
+
}
|
|
45557
45612
|
_sendHeartbeat() {
|
|
45558
45613
|
if (this._state !== "ready" || !this._heartbeatCallback) return;
|
|
45559
45614
|
const status = this._heartbeatCallback();
|