@agentvault/secure-channel 0.6.13 → 0.6.14
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 +33 -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 +34 -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,53 @@ 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})]
|
|
45681
|
+
---
|
|
45682
|
+
${attachData.textContent}
|
|
45683
|
+
---
|
|
45684
|
+
|
|
45685
|
+
${messageText}`;
|
|
45686
|
+
} else if (attachData.base64) {
|
|
45687
|
+
emitText = `[Image attachment: ${attachData.filename}]
|
|
45667
45688
|
|
|
45668
45689
|
${messageText}`;
|
|
45690
|
+
} else {
|
|
45691
|
+
emitText = `[Attachment: ${attachData.filename} saved to ${attachData.filePath}]
|
|
45692
|
+
|
|
45693
|
+
${messageText}`;
|
|
45694
|
+
}
|
|
45669
45695
|
}
|
|
45670
45696
|
const metadata = {
|
|
45671
45697
|
messageId: msgData.message_id,
|
|
45672
45698
|
conversationId: convId,
|
|
45673
45699
|
timestamp: msgData.created_at,
|
|
45674
|
-
topicId
|
|
45700
|
+
topicId,
|
|
45701
|
+
attachment: attachData
|
|
45675
45702
|
};
|
|
45676
45703
|
this.emit("message", emitText, metadata);
|
|
45677
45704
|
this.config.onMessage?.(emitText, metadata);
|
|
@@ -45708,7 +45735,7 @@ ${messageText}`;
|
|
|
45708
45735
|
const filePath = join2(attachDir, info.filename);
|
|
45709
45736
|
await writeFile2(filePath, decrypted);
|
|
45710
45737
|
console.log(`[SecureChannel] Attachment saved: ${filePath} (${decrypted.length} bytes)`);
|
|
45711
|
-
return filePath;
|
|
45738
|
+
return { filePath, decrypted };
|
|
45712
45739
|
}
|
|
45713
45740
|
/**
|
|
45714
45741
|
* Upload an attachment file: encrypt, upload to server, return metadata
|
|
@@ -46247,7 +46274,7 @@ async function _handleInbound(params) {
|
|
|
46247
46274
|
}
|
|
46248
46275
|
|
|
46249
46276
|
// src/index.ts
|
|
46250
|
-
var VERSION = "0.6.
|
|
46277
|
+
var VERSION = "0.6.13";
|
|
46251
46278
|
export {
|
|
46252
46279
|
SecureChannel,
|
|
46253
46280
|
VERSION,
|