@agentvault/agentvault 0.10.1 → 0.11.0
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/account-config.d.ts +20 -0
- package/dist/account-config.d.ts.map +1 -0
- package/dist/channel.d.ts.map +1 -1
- package/dist/cli.js +122 -46
- package/dist/cli.js.map +3 -3
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +105 -54
- package/dist/index.js.map +3 -3
- package/dist/openclaw-entry.d.ts.map +1 -1
- package/dist/openclaw-entry.js +57 -15
- package/dist/openclaw-entry.js.map +3 -3
- package/dist/openclaw-plugin.d.ts +3 -11
- package/dist/openclaw-plugin.d.ts.map +1 -1
- package/dist/setup.d.ts +1 -0
- package/dist/setup.d.ts.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { SecureChannel } from "./channel.js";
|
|
2
2
|
export type { SecureChannelConfig, ChannelState, MessageMetadata, AttachmentData, PersistedState, LegacyPersistedState, DeviceSession, HistoryEntry, SendOptions, DecisionOption, DecisionRequest, DecisionResponse, ContextRef, HeartbeatStatus, StatusAlert, RoomInfo, RoomMemberInfo, RoomConversationInfo, RoomState, A2AChannel, A2AMessage, RoomParticipantEvent, } from "./types.js";
|
|
3
|
+
export { listAccountIds, resolveAccount } from "./account-config.js";
|
|
4
|
+
export type { ResolvedAccount } from "./account-config.js";
|
|
3
5
|
export { agentVaultPlugin, setOcRuntime, getActiveChannel } from "./openclaw-plugin.js";
|
|
4
6
|
export { sendToOwner, checkGateway } from "./gateway-send.js";
|
|
5
7
|
export type { GatewaySendOptions, GatewaySendResult, GatewayStatusResult, } from "./gateway-send.js";
|
|
6
|
-
export declare const VERSION = "0.
|
|
8
|
+
export declare const VERSION = "0.11.0";
|
|
7
9
|
//# 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,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,WAAW,EACX,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,WAAW,EACX,QAAQ,EACR,cAAc,EACd,oBAAoB,EACpB,SAAS,EACT,UAAU,EACV,UAAU,EACV,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGxF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC9D,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAE3B,eAAO,MAAM,OAAO,
|
|
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,EACZ,WAAW,EACX,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,WAAW,EACX,QAAQ,EACR,cAAc,EACd,oBAAoB,EACpB,SAAS,EACT,UAAU,EACV,UAAU,EACV,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrE,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAG3D,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGxF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC9D,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAE3B,eAAO,MAAM,OAAO,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -45631,6 +45631,7 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
|
|
|
45631
45631
|
if (this._sessions.size === 0) {
|
|
45632
45632
|
throw new Error("No active sessions");
|
|
45633
45633
|
}
|
|
45634
|
+
const targetConvId = options?.conversationId;
|
|
45634
45635
|
const topicId = options?.topicId ?? this._lastIncomingTopicId ?? this._persisted?.defaultTopicId;
|
|
45635
45636
|
const messageType = options?.messageType ?? "text";
|
|
45636
45637
|
const priority = options?.priority ?? "normal";
|
|
@@ -45655,51 +45656,61 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
|
|
|
45655
45656
|
}
|
|
45656
45657
|
}
|
|
45657
45658
|
const messageGroupId = randomUUID();
|
|
45659
|
+
let sentCount = 0;
|
|
45658
45660
|
for (const [convId, session] of this._sessions) {
|
|
45659
45661
|
if (!session.activated) continue;
|
|
45660
45662
|
if (roomConvIds.has(convId)) continue;
|
|
45661
|
-
|
|
45662
|
-
|
|
45663
|
-
|
|
45664
|
-
|
|
45665
|
-
|
|
45666
|
-
|
|
45667
|
-
|
|
45668
|
-
|
|
45669
|
-
|
|
45670
|
-
|
|
45671
|
-
const payload = {
|
|
45672
|
-
conversation_id: msg.convId,
|
|
45673
|
-
header_blob: msg.headerBlob,
|
|
45674
|
-
ciphertext: msg.ciphertext,
|
|
45675
|
-
message_group_id: msg.messageGroupId,
|
|
45676
|
-
topic_id: msg.topicId,
|
|
45677
|
-
message_type: messageType,
|
|
45678
|
-
priority,
|
|
45679
|
-
parent_span_id: parentSpanId,
|
|
45680
|
-
metadata: scanStatus ? { ...envelopeMetadata ?? {}, scan_status: scanStatus } : envelopeMetadata
|
|
45663
|
+
if (targetConvId && convId !== targetConvId) continue;
|
|
45664
|
+
try {
|
|
45665
|
+
const encrypted = session.ratchet.encrypt(plaintext);
|
|
45666
|
+
const transport = encryptedMessageToTransport(encrypted);
|
|
45667
|
+
const msg = {
|
|
45668
|
+
convId,
|
|
45669
|
+
headerBlob: transport.header_blob,
|
|
45670
|
+
ciphertext: transport.ciphertext,
|
|
45671
|
+
messageGroupId,
|
|
45672
|
+
topicId
|
|
45681
45673
|
};
|
|
45682
|
-
if (this.
|
|
45683
|
-
payload
|
|
45684
|
-
|
|
45685
|
-
|
|
45686
|
-
|
|
45687
|
-
|
|
45688
|
-
|
|
45689
|
-
|
|
45690
|
-
|
|
45691
|
-
|
|
45692
|
-
|
|
45693
|
-
|
|
45694
|
-
|
|
45695
|
-
|
|
45696
|
-
|
|
45697
|
-
|
|
45674
|
+
if (this._state === "ready" && this._ws) {
|
|
45675
|
+
const payload = {
|
|
45676
|
+
conversation_id: msg.convId,
|
|
45677
|
+
header_blob: msg.headerBlob,
|
|
45678
|
+
ciphertext: msg.ciphertext,
|
|
45679
|
+
message_group_id: msg.messageGroupId,
|
|
45680
|
+
topic_id: msg.topicId,
|
|
45681
|
+
message_type: messageType,
|
|
45682
|
+
priority,
|
|
45683
|
+
parent_span_id: parentSpanId,
|
|
45684
|
+
metadata: scanStatus ? { ...envelopeMetadata ?? {}, scan_status: scanStatus } : envelopeMetadata
|
|
45685
|
+
};
|
|
45686
|
+
if (this._persisted?.hubAddress) {
|
|
45687
|
+
payload.hub_address = this._persisted.hubAddress;
|
|
45688
|
+
}
|
|
45689
|
+
this._ws.send(
|
|
45690
|
+
JSON.stringify({
|
|
45691
|
+
event: "message",
|
|
45692
|
+
data: payload
|
|
45693
|
+
})
|
|
45694
|
+
);
|
|
45695
|
+
} else {
|
|
45696
|
+
if (!this._persisted.outboundQueue) {
|
|
45697
|
+
this._persisted.outboundQueue = [];
|
|
45698
|
+
}
|
|
45699
|
+
if (this._persisted.outboundQueue.length >= 50) {
|
|
45700
|
+
this._persisted.outboundQueue.shift();
|
|
45701
|
+
console.warn("[SecureChannel] Outbound queue full, dropping oldest message");
|
|
45702
|
+
}
|
|
45703
|
+
this._persisted.outboundQueue.push(msg);
|
|
45704
|
+
console.log(`[SecureChannel] Message queued (state=${this._state}, queue=${this._persisted.outboundQueue.length})`);
|
|
45698
45705
|
}
|
|
45699
|
-
|
|
45700
|
-
|
|
45706
|
+
sentCount++;
|
|
45707
|
+
} catch (err) {
|
|
45708
|
+
console.error(`[SecureChannel] send() failed for conv ${convId.slice(0, 8)}...:`, err);
|
|
45701
45709
|
}
|
|
45702
45710
|
}
|
|
45711
|
+
if (sentCount === 0 && this._sessions.size > 0) {
|
|
45712
|
+
console.warn("[SecureChannel] send() delivered to 0 sessions (all skipped or failed)");
|
|
45713
|
+
}
|
|
45703
45714
|
await this._persistState();
|
|
45704
45715
|
}
|
|
45705
45716
|
/**
|
|
@@ -47889,6 +47900,57 @@ ${messageText}`;
|
|
|
47889
47900
|
}
|
|
47890
47901
|
};
|
|
47891
47902
|
|
|
47903
|
+
// src/account-config.ts
|
|
47904
|
+
var DEFAULT_API_URL = "https://api.agentvault.chat";
|
|
47905
|
+
var DEFAULT_HTTP_PORT = 18790;
|
|
47906
|
+
function listAccountIds(cfg) {
|
|
47907
|
+
const av = cfg?.channels?.agentvault;
|
|
47908
|
+
if (!av) return [];
|
|
47909
|
+
if (av.accounts && typeof av.accounts === "object") {
|
|
47910
|
+
return Object.keys(av.accounts);
|
|
47911
|
+
}
|
|
47912
|
+
return av.dataDir ? ["default"] : [];
|
|
47913
|
+
}
|
|
47914
|
+
function resolveAccount(cfg, accountId) {
|
|
47915
|
+
const av = cfg?.channels?.agentvault ?? {};
|
|
47916
|
+
const id = accountId ?? "default";
|
|
47917
|
+
if (av.accounts && typeof av.accounts === "object") {
|
|
47918
|
+
const acct = av.accounts[id];
|
|
47919
|
+
if (!acct) {
|
|
47920
|
+
return {
|
|
47921
|
+
accountId: id,
|
|
47922
|
+
dataDir: "",
|
|
47923
|
+
apiUrl: av.apiUrl ?? DEFAULT_API_URL,
|
|
47924
|
+
agentName: id,
|
|
47925
|
+
httpPort: DEFAULT_HTTP_PORT,
|
|
47926
|
+
configured: false
|
|
47927
|
+
};
|
|
47928
|
+
}
|
|
47929
|
+
let httpPort = acct.httpPort;
|
|
47930
|
+
if (httpPort == null) {
|
|
47931
|
+
const keys = Object.keys(av.accounts);
|
|
47932
|
+
const index = keys.indexOf(id);
|
|
47933
|
+
httpPort = DEFAULT_HTTP_PORT + (index >= 0 ? index : 0);
|
|
47934
|
+
}
|
|
47935
|
+
return {
|
|
47936
|
+
accountId: id,
|
|
47937
|
+
dataDir: acct.dataDir ?? "",
|
|
47938
|
+
apiUrl: acct.apiUrl ?? av.apiUrl ?? DEFAULT_API_URL,
|
|
47939
|
+
agentName: acct.agentName ?? id,
|
|
47940
|
+
httpPort,
|
|
47941
|
+
configured: Boolean(acct.dataDir)
|
|
47942
|
+
};
|
|
47943
|
+
}
|
|
47944
|
+
return {
|
|
47945
|
+
accountId: id,
|
|
47946
|
+
dataDir: av.dataDir ?? "~/.openclaw/agentvault",
|
|
47947
|
+
apiUrl: av.apiUrl ?? DEFAULT_API_URL,
|
|
47948
|
+
agentName: av.agentName ?? "OpenClaw Agent",
|
|
47949
|
+
httpPort: av.httpPort ?? DEFAULT_HTTP_PORT,
|
|
47950
|
+
configured: Boolean(av.dataDir)
|
|
47951
|
+
};
|
|
47952
|
+
}
|
|
47953
|
+
|
|
47892
47954
|
// src/openclaw-plugin.ts
|
|
47893
47955
|
import { resolve } from "node:path";
|
|
47894
47956
|
var _ocRuntime = null;
|
|
@@ -47913,21 +47975,8 @@ var agentVaultPlugin = {
|
|
|
47913
47975
|
chatTypes: ["direct"]
|
|
47914
47976
|
},
|
|
47915
47977
|
config: {
|
|
47916
|
-
listAccountIds
|
|
47917
|
-
|
|
47918
|
-
return av?.dataDir ? ["default"] : [];
|
|
47919
|
-
},
|
|
47920
|
-
resolveAccount: (cfg, accountId) => {
|
|
47921
|
-
const av = cfg?.channels?.agentvault ?? {};
|
|
47922
|
-
return {
|
|
47923
|
-
accountId: accountId ?? "default",
|
|
47924
|
-
dataDir: av.dataDir ?? "~/.openclaw/agentvault",
|
|
47925
|
-
apiUrl: av.apiUrl ?? "https://api.agentvault.chat",
|
|
47926
|
-
agentName: av.agentName ?? "OpenClaw Agent",
|
|
47927
|
-
httpPort: av.httpPort ?? 18790,
|
|
47928
|
-
configured: Boolean(av.dataDir)
|
|
47929
|
-
};
|
|
47930
|
-
}
|
|
47978
|
+
listAccountIds,
|
|
47979
|
+
resolveAccount
|
|
47931
47980
|
},
|
|
47932
47981
|
gateway: {
|
|
47933
47982
|
startAccount: async (ctx) => {
|
|
@@ -48140,13 +48189,15 @@ async function checkGateway(options) {
|
|
|
48140
48189
|
}
|
|
48141
48190
|
|
|
48142
48191
|
// src/index.ts
|
|
48143
|
-
var VERSION = "0.
|
|
48192
|
+
var VERSION = "0.11.0";
|
|
48144
48193
|
export {
|
|
48145
48194
|
SecureChannel,
|
|
48146
48195
|
VERSION,
|
|
48147
48196
|
agentVaultPlugin,
|
|
48148
48197
|
checkGateway,
|
|
48149
48198
|
getActiveChannel,
|
|
48199
|
+
listAccountIds,
|
|
48200
|
+
resolveAccount,
|
|
48150
48201
|
sendToOwner,
|
|
48151
48202
|
setOcRuntime
|
|
48152
48203
|
};
|