@agentvault/secure-channel 0.6.13 → 0.6.15
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 +34 -6
- package/dist/cli.js.map +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +35 -7
- package/dist/index.js.map +3 -3
- package/dist/openclaw-entry.d.ts.map +1 -1
- package/dist/openclaw-entry.js +12 -1
- package/dist/openclaw-entry.js.map +2 -2
- package/dist/types.d.ts +11 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { SecureChannel } from "./channel.js";
|
|
2
|
-
export type { SecureChannelConfig, ChannelState, MessageMetadata, PersistedState, LegacyPersistedState, DeviceSession, HistoryEntry, } from "./types.js";
|
|
2
|
+
export type { SecureChannelConfig, ChannelState, MessageMetadata, AttachmentData, PersistedState, LegacyPersistedState, DeviceSession, HistoryEntry, } from "./types.js";
|
|
3
3
|
export { agentVaultPlugin, setOcRuntime, getActiveChannel } from "./openclaw-plugin.js";
|
|
4
|
-
export declare const VERSION = "0.6.
|
|
4
|
+
export declare const VERSION = "0.6.13";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,YAAY,EACV,mBAAmB,EACnB,YAAY,EACZ,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,YAAY,GACb,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExF,eAAO,MAAM,OAAO,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,YAAY,EACV,mBAAmB,EACnB,YAAY,EACZ,eAAe,EACf,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,YAAY,GACb,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExF,eAAO,MAAM,OAAO,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -45652,26 +45652,54 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
|
|
|
45652
45652
|
}
|
|
45653
45653
|
if (messageType === "message") {
|
|
45654
45654
|
const topicId = msgData.topic_id;
|
|
45655
|
-
let
|
|
45655
|
+
let attachData;
|
|
45656
45656
|
if (attachmentInfo) {
|
|
45657
45657
|
try {
|
|
45658
|
-
|
|
45658
|
+
const { filePath, decrypted } = await this._downloadAndDecryptAttachment(attachmentInfo);
|
|
45659
|
+
attachData = {
|
|
45660
|
+
filename: attachmentInfo.filename,
|
|
45661
|
+
mime: attachmentInfo.mime,
|
|
45662
|
+
size: decrypted.length,
|
|
45663
|
+
filePath
|
|
45664
|
+
};
|
|
45665
|
+
if (attachmentInfo.mime.startsWith("image/")) {
|
|
45666
|
+
attachData.base64 = `data:${attachmentInfo.mime};base64,${bytesToBase64(decrypted)}`;
|
|
45667
|
+
}
|
|
45668
|
+
const textMimes = ["text/", "application/json", "application/xml", "application/csv"];
|
|
45669
|
+
if (textMimes.some((m2) => attachmentInfo.mime.startsWith(m2))) {
|
|
45670
|
+
attachData.textContent = new TextDecoder().decode(decrypted);
|
|
45671
|
+
}
|
|
45659
45672
|
} catch (err) {
|
|
45660
45673
|
console.error(`[SecureChannel] Failed to download attachment:`, err);
|
|
45661
45674
|
}
|
|
45662
45675
|
}
|
|
45663
45676
|
this._appendHistory("owner", messageText, topicId);
|
|
45664
45677
|
let emitText = messageText;
|
|
45665
|
-
if (
|
|
45666
|
-
|
|
45678
|
+
if (attachData) {
|
|
45679
|
+
if (attachData.textContent) {
|
|
45680
|
+
emitText = `[Attachment: ${attachData.filename} (${attachData.mime}) saved to ${attachData.filePath}]
|
|
45681
|
+
---
|
|
45682
|
+
${attachData.textContent}
|
|
45683
|
+
---
|
|
45684
|
+
|
|
45685
|
+
${messageText}`;
|
|
45686
|
+
} else if (attachData.base64) {
|
|
45687
|
+
emitText = `[Image attachment: ${attachData.filename} saved to ${attachData.filePath}]
|
|
45688
|
+
Use your Read tool to view this image file.
|
|
45667
45689
|
|
|
45668
45690
|
${messageText}`;
|
|
45691
|
+
} else {
|
|
45692
|
+
emitText = `[Attachment: ${attachData.filename} saved to ${attachData.filePath}]
|
|
45693
|
+
|
|
45694
|
+
${messageText}`;
|
|
45695
|
+
}
|
|
45669
45696
|
}
|
|
45670
45697
|
const metadata = {
|
|
45671
45698
|
messageId: msgData.message_id,
|
|
45672
45699
|
conversationId: convId,
|
|
45673
45700
|
timestamp: msgData.created_at,
|
|
45674
|
-
topicId
|
|
45701
|
+
topicId,
|
|
45702
|
+
attachment: attachData
|
|
45675
45703
|
};
|
|
45676
45704
|
this.emit("message", emitText, metadata);
|
|
45677
45705
|
this.config.onMessage?.(emitText, metadata);
|
|
@@ -45708,7 +45736,7 @@ ${messageText}`;
|
|
|
45708
45736
|
const filePath = join2(attachDir, info.filename);
|
|
45709
45737
|
await writeFile2(filePath, decrypted);
|
|
45710
45738
|
console.log(`[SecureChannel] Attachment saved: ${filePath} (${decrypted.length} bytes)`);
|
|
45711
|
-
return filePath;
|
|
45739
|
+
return { filePath, decrypted };
|
|
45712
45740
|
}
|
|
45713
45741
|
/**
|
|
45714
45742
|
* Upload an attachment file: encrypt, upload to server, return metadata
|
|
@@ -46247,7 +46275,7 @@ async function _handleInbound(params) {
|
|
|
46247
46275
|
}
|
|
46248
46276
|
|
|
46249
46277
|
// src/index.ts
|
|
46250
|
-
var VERSION = "0.6.
|
|
46278
|
+
var VERSION = "0.6.13";
|
|
46251
46279
|
export {
|
|
46252
46280
|
SecureChannel,
|
|
46253
46281
|
VERSION,
|