@agentvault/agentvault 0.13.5 → 0.13.6
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/__tests__/install-plugin.test.d.ts +2 -0
- package/dist/__tests__/install-plugin.test.d.ts.map +1 -0
- package/dist/account-config.d.ts +1 -0
- package/dist/account-config.d.ts.map +1 -1
- package/dist/channel.d.ts +0 -9
- package/dist/channel.d.ts.map +1 -1
- package/dist/cli.js +39 -207
- package/dist/cli.js.map +2 -2
- package/dist/gateway-send.d.ts +0 -14
- package/dist/gateway-send.d.ts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +45 -210
- package/dist/index.js.map +2 -2
- package/dist/openclaw-entry.d.ts.map +1 -1
- package/dist/openclaw-entry.js +37 -228
- package/dist/openclaw-entry.js.map +3 -3
- package/package.json +1 -1
- package/dist/channel.js +0 -2257
- package/dist/channel.js.map +0 -1
- package/dist/crypto-helpers.js +0 -4
- package/dist/crypto-helpers.js.map +0 -1
- package/dist/fetch-interceptor.d.ts +0 -32
- package/dist/fetch-interceptor.d.ts.map +0 -1
- package/dist/openclaw-plugin.js +0 -222
- package/dist/openclaw-plugin.js.map +0 -1
- package/dist/setup.js +0 -329
- package/dist/setup.js.map +0 -1
- package/dist/state.js +0 -61
- package/dist/state.js.map +0 -1
- package/dist/transport.js +0 -43
- package/dist/transport.js.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
package/dist/gateway-send.d.ts
CHANGED
|
@@ -29,20 +29,6 @@ export interface GatewayStatusResult {
|
|
|
29
29
|
* Never throws — returns `{ ok: false, error }` on failure.
|
|
30
30
|
*/
|
|
31
31
|
export declare function sendToOwner(text: string, options?: GatewaySendOptions): Promise<GatewaySendResult>;
|
|
32
|
-
export interface ActionReport {
|
|
33
|
-
action: string;
|
|
34
|
-
status: "completed" | "failed" | "partial";
|
|
35
|
-
room_id?: string;
|
|
36
|
-
detail?: string;
|
|
37
|
-
estimated_cost?: number;
|
|
38
|
-
decision_id?: string;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Report an action (deploy, execute, etc.) via the gateway HTTP server.
|
|
42
|
-
* Routes to sendActionConfirmationToRoom() (if room_id) or sendActionConfirmation().
|
|
43
|
-
* Never throws — returns `{ ok: false, error }` on failure.
|
|
44
|
-
*/
|
|
45
|
-
export declare function sendAction(report: ActionReport, options?: GatewaySendOptions): Promise<GatewaySendResult>;
|
|
46
32
|
/**
|
|
47
33
|
* Check gateway health / status.
|
|
48
34
|
* Never throws — returns `{ ok: false, error }` on failure.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway-send.d.ts","sourceRoot":"","sources":["../src/gateway-send.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,kBAAkB;IACjC,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAsBD;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,iBAAiB,CAAC,CAuB5B;AAED
|
|
1
|
+
{"version":3,"file":"gateway-send.d.ts","sourceRoot":"","sources":["../src/gateway-send.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,kBAAkB;IACjC,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAsBD;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,iBAAiB,CAAC,CAuB5B;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAChC,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,mBAAmB,CAAC,CAmB9B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export type { SecureChannelConfig, ChannelState, MessageMetadata, AttachmentData
|
|
|
3
3
|
export { listAccountIds, resolveAccount } from "./account-config.js";
|
|
4
4
|
export type { ResolvedAccount } from "./account-config.js";
|
|
5
5
|
export { agentVaultPlugin, setOcRuntime, getActiveChannel } from "./openclaw-plugin.js";
|
|
6
|
-
export { sendToOwner,
|
|
7
|
-
export type { GatewaySendOptions, GatewaySendResult, GatewayStatusResult,
|
|
8
|
-
export declare const VERSION = "0.
|
|
6
|
+
export { sendToOwner, checkGateway } from "./gateway-send.js";
|
|
7
|
+
export type { GatewaySendOptions, GatewaySendResult, GatewayStatusResult, } from "./gateway-send.js";
|
|
8
|
+
export declare const VERSION = "0.11.0";
|
|
9
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,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,
|
|
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
|
@@ -44880,7 +44880,6 @@ var DoubleRatchet = class _DoubleRatchet {
|
|
|
44880
44880
|
serialize() {
|
|
44881
44881
|
const s2 = this.state;
|
|
44882
44882
|
return JSON.stringify({
|
|
44883
|
-
version: 1,
|
|
44884
44883
|
rootKey: libsodium_wrappers_default.to_hex(s2.rootKey),
|
|
44885
44884
|
sendingChain: s2.sendingChain ? {
|
|
44886
44885
|
chainKey: libsodium_wrappers_default.to_hex(s2.sendingChain.chainKey),
|
|
@@ -44908,59 +44907,33 @@ var DoubleRatchet = class _DoubleRatchet {
|
|
|
44908
44907
|
});
|
|
44909
44908
|
}
|
|
44910
44909
|
static deserialize(json) {
|
|
44911
|
-
|
|
44912
|
-
|
|
44913
|
-
|
|
44914
|
-
|
|
44915
|
-
|
|
44916
|
-
|
|
44917
|
-
|
|
44918
|
-
|
|
44919
|
-
|
|
44920
|
-
|
|
44921
|
-
|
|
44922
|
-
|
|
44923
|
-
|
|
44924
|
-
|
|
44925
|
-
|
|
44926
|
-
|
|
44927
|
-
|
|
44928
|
-
|
|
44929
|
-
|
|
44930
|
-
|
|
44931
|
-
|
|
44932
|
-
|
|
44933
|
-
|
|
44934
|
-
|
|
44935
|
-
|
|
44936
|
-
|
|
44937
|
-
|
|
44938
|
-
receivingChain: d2.receivingChain ? {
|
|
44939
|
-
chainKey: libsodium_wrappers_default.from_hex(d2.receivingChain.chainKey),
|
|
44940
|
-
messageNumber: d2.receivingChain.messageNumber
|
|
44941
|
-
} : null,
|
|
44942
|
-
dhSendingKeypair: {
|
|
44943
|
-
publicKey: libsodium_wrappers_default.from_hex(dhSend.publicKey),
|
|
44944
|
-
privateKey: libsodium_wrappers_default.from_hex(dhSend.privateKey)
|
|
44945
|
-
},
|
|
44946
|
-
dhReceivingPublicKey: d2.dhReceivingPublicKey ? libsodium_wrappers_default.from_hex(d2.dhReceivingPublicKey) : null,
|
|
44947
|
-
identityKeypair: {
|
|
44948
|
-
publicKey: libsodium_wrappers_default.from_hex(idKp.publicKey),
|
|
44949
|
-
privateKey: libsodium_wrappers_default.from_hex(idKp.privateKey)
|
|
44950
|
-
},
|
|
44951
|
-
previousSendingChainLength: d2.previousSendingChainLength,
|
|
44952
|
-
skippedKeys: d2.skippedKeys.map((sk) => ({
|
|
44953
|
-
dhPub: sk.dhPub,
|
|
44954
|
-
n: sk.n,
|
|
44955
|
-
messageKey: libsodium_wrappers_default.from_hex(sk.messageKey)
|
|
44956
|
-
}))
|
|
44957
|
-
});
|
|
44958
|
-
} catch (err) {
|
|
44959
|
-
if (err instanceof Error && err.message.startsWith("Ratchet state")) {
|
|
44960
|
-
throw err;
|
|
44961
|
-
}
|
|
44962
|
-
throw new Error(`Ratchet state: corrupt hex data \u2014 ${err instanceof Error ? err.message : String(err)}`);
|
|
44963
|
-
}
|
|
44910
|
+
const d2 = JSON.parse(json);
|
|
44911
|
+
return new _DoubleRatchet({
|
|
44912
|
+
rootKey: libsodium_wrappers_default.from_hex(d2.rootKey),
|
|
44913
|
+
sendingChain: d2.sendingChain ? {
|
|
44914
|
+
chainKey: libsodium_wrappers_default.from_hex(d2.sendingChain.chainKey),
|
|
44915
|
+
messageNumber: d2.sendingChain.messageNumber
|
|
44916
|
+
} : null,
|
|
44917
|
+
receivingChain: d2.receivingChain ? {
|
|
44918
|
+
chainKey: libsodium_wrappers_default.from_hex(d2.receivingChain.chainKey),
|
|
44919
|
+
messageNumber: d2.receivingChain.messageNumber
|
|
44920
|
+
} : null,
|
|
44921
|
+
dhSendingKeypair: {
|
|
44922
|
+
publicKey: libsodium_wrappers_default.from_hex(d2.dhSendingKeypair.publicKey),
|
|
44923
|
+
privateKey: libsodium_wrappers_default.from_hex(d2.dhSendingKeypair.privateKey)
|
|
44924
|
+
},
|
|
44925
|
+
dhReceivingPublicKey: d2.dhReceivingPublicKey ? libsodium_wrappers_default.from_hex(d2.dhReceivingPublicKey) : null,
|
|
44926
|
+
identityKeypair: {
|
|
44927
|
+
publicKey: libsodium_wrappers_default.from_hex(d2.identityKeypair.publicKey),
|
|
44928
|
+
privateKey: libsodium_wrappers_default.from_hex(d2.identityKeypair.privateKey)
|
|
44929
|
+
},
|
|
44930
|
+
previousSendingChainLength: d2.previousSendingChainLength,
|
|
44931
|
+
skippedKeys: d2.skippedKeys.map((sk) => ({
|
|
44932
|
+
dhPub: sk.dhPub,
|
|
44933
|
+
n: sk.n,
|
|
44934
|
+
messageKey: libsodium_wrappers_default.from_hex(sk.messageKey)
|
|
44935
|
+
}))
|
|
44936
|
+
});
|
|
44964
44937
|
}
|
|
44965
44938
|
};
|
|
44966
44939
|
|
|
@@ -46025,9 +45998,7 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
|
|
|
46025
45998
|
data: {
|
|
46026
45999
|
room_id: roomId,
|
|
46027
46000
|
recipients,
|
|
46028
|
-
message_type: messageType
|
|
46029
|
-
priority: opts?.priority ?? "normal",
|
|
46030
|
-
metadata: opts?.metadata
|
|
46001
|
+
message_type: messageType
|
|
46031
46002
|
}
|
|
46032
46003
|
})
|
|
46033
46004
|
);
|
|
@@ -46041,12 +46012,7 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
|
|
|
46041
46012
|
"Content-Type": "application/json",
|
|
46042
46013
|
Authorization: `Bearer ${this._deviceJwt}`
|
|
46043
46014
|
},
|
|
46044
|
-
body: JSON.stringify({
|
|
46045
|
-
recipients,
|
|
46046
|
-
message_type: messageType,
|
|
46047
|
-
priority: opts?.priority ?? "normal",
|
|
46048
|
-
metadata: opts?.metadata
|
|
46049
|
-
})
|
|
46015
|
+
body: JSON.stringify({ recipients, message_type: messageType })
|
|
46050
46016
|
}
|
|
46051
46017
|
);
|
|
46052
46018
|
if (!res.ok) {
|
|
@@ -46191,27 +46157,6 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
|
|
|
46191
46157
|
}
|
|
46192
46158
|
);
|
|
46193
46159
|
}
|
|
46194
|
-
async sendActionConfirmationToRoom(roomId, confirmation) {
|
|
46195
|
-
const envelope = {
|
|
46196
|
-
type: "action_confirmation",
|
|
46197
|
-
action: confirmation.action,
|
|
46198
|
-
status: confirmation.status
|
|
46199
|
-
};
|
|
46200
|
-
if (confirmation.decisionId !== void 0) envelope.decision_id = confirmation.decisionId;
|
|
46201
|
-
if (confirmation.detail !== void 0) envelope.detail = confirmation.detail;
|
|
46202
|
-
const metadata = {
|
|
46203
|
-
action: confirmation.action,
|
|
46204
|
-
status: confirmation.status
|
|
46205
|
-
};
|
|
46206
|
-
if (confirmation.estimated_cost !== void 0) {
|
|
46207
|
-
metadata.estimated_cost = confirmation.estimated_cost;
|
|
46208
|
-
}
|
|
46209
|
-
await this.sendToRoom(roomId, JSON.stringify(envelope), {
|
|
46210
|
-
messageType: "action_confirmation",
|
|
46211
|
-
priority: "high",
|
|
46212
|
-
metadata
|
|
46213
|
-
});
|
|
46214
|
-
}
|
|
46215
46160
|
_sendHeartbeat() {
|
|
46216
46161
|
if (this._state !== "ready" || !this._heartbeatCallback) return;
|
|
46217
46162
|
const status = this._heartbeatCallback();
|
|
@@ -46286,52 +46231,10 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
|
|
|
46286
46231
|
res.end(JSON.stringify({ ok: false, error: "Missing 'text' field" }));
|
|
46287
46232
|
return;
|
|
46288
46233
|
}
|
|
46289
|
-
if (parsed.
|
|
46290
|
-
await this.sendToRoom(parsed.room_id, text, {
|
|
46291
|
-
messageType: parsed.message_type,
|
|
46292
|
-
priority: parsed.priority,
|
|
46293
|
-
metadata: parsed.metadata
|
|
46294
|
-
});
|
|
46295
|
-
} else if (parsed.file_path && typeof parsed.file_path === "string") {
|
|
46234
|
+
if (parsed.file_path && typeof parsed.file_path === "string") {
|
|
46296
46235
|
await this.sendWithAttachment(text, parsed.file_path, { topicId: parsed.topicId });
|
|
46297
46236
|
} else {
|
|
46298
|
-
await this.send(text, {
|
|
46299
|
-
topicId: parsed.topicId,
|
|
46300
|
-
messageType: parsed.message_type,
|
|
46301
|
-
metadata: parsed.metadata
|
|
46302
|
-
});
|
|
46303
|
-
}
|
|
46304
|
-
res.writeHead(200, { "Content-Type": "application/json" });
|
|
46305
|
-
res.end(JSON.stringify({ ok: true }));
|
|
46306
|
-
} catch (err) {
|
|
46307
|
-
res.writeHead(500, { "Content-Type": "application/json" });
|
|
46308
|
-
res.end(JSON.stringify({ ok: false, error: String(err) }));
|
|
46309
|
-
}
|
|
46310
|
-
});
|
|
46311
|
-
} else if (req.method === "POST" && req.url === "/action") {
|
|
46312
|
-
let body = "";
|
|
46313
|
-
req.on("data", (chunk) => {
|
|
46314
|
-
body += chunk.toString();
|
|
46315
|
-
});
|
|
46316
|
-
req.on("end", async () => {
|
|
46317
|
-
try {
|
|
46318
|
-
const parsed = JSON.parse(body);
|
|
46319
|
-
if (!parsed.action || typeof parsed.action !== "string") {
|
|
46320
|
-
res.writeHead(400, { "Content-Type": "application/json" });
|
|
46321
|
-
res.end(JSON.stringify({ ok: false, error: "Missing 'action' field" }));
|
|
46322
|
-
return;
|
|
46323
|
-
}
|
|
46324
|
-
const confirmation = {
|
|
46325
|
-
action: parsed.action,
|
|
46326
|
-
status: parsed.status ?? "completed",
|
|
46327
|
-
decisionId: parsed.decision_id,
|
|
46328
|
-
detail: parsed.detail,
|
|
46329
|
-
estimated_cost: parsed.estimated_cost
|
|
46330
|
-
};
|
|
46331
|
-
if (parsed.room_id && typeof parsed.room_id === "string") {
|
|
46332
|
-
await this.sendActionConfirmationToRoom(parsed.room_id, confirmation);
|
|
46333
|
-
} else {
|
|
46334
|
-
await this.sendActionConfirmation(confirmation);
|
|
46237
|
+
await this.send(text, { topicId: parsed.topicId });
|
|
46335
46238
|
}
|
|
46336
46239
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
46337
46240
|
res.end(JSON.stringify({ ok: true }));
|
|
@@ -46350,7 +46253,7 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
|
|
|
46350
46253
|
}));
|
|
46351
46254
|
} else {
|
|
46352
46255
|
res.writeHead(404, { "Content-Type": "application/json" });
|
|
46353
|
-
res.end(JSON.stringify({ ok: false, error: "Not found. Use POST /send
|
|
46256
|
+
res.end(JSON.stringify({ ok: false, error: "Not found. Use POST /send or GET /status" }));
|
|
46354
46257
|
}
|
|
46355
46258
|
});
|
|
46356
46259
|
this._httpServer.listen(port, "127.0.0.1", () => {
|
|
@@ -47144,15 +47047,7 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
|
|
|
47144
47047
|
nonce: hexToBytes(msgData.nonce)
|
|
47145
47048
|
};
|
|
47146
47049
|
const ratchet = DoubleRatchet.deserialize(channelEntry.session.ratchetState);
|
|
47147
|
-
const
|
|
47148
|
-
let a2aPlaintext;
|
|
47149
|
-
try {
|
|
47150
|
-
a2aPlaintext = ratchet.decrypt(encryptedMessage);
|
|
47151
|
-
} catch (decryptErr) {
|
|
47152
|
-
console.error(`[SecureChannel] A2A decrypt failed \u2014 restoring ratchet state:`, decryptErr);
|
|
47153
|
-
channelEntry.session.ratchetState = ratchetSnapshot;
|
|
47154
|
-
return;
|
|
47155
|
-
}
|
|
47050
|
+
const plaintext = ratchet.decrypt(encryptedMessage);
|
|
47156
47051
|
channelEntry.session.ratchetState = ratchet.serialize();
|
|
47157
47052
|
if (channelEntry.role === "responder" && !channelEntry.session.activated) {
|
|
47158
47053
|
channelEntry.session.activated = true;
|
|
@@ -47175,7 +47070,7 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
|
|
|
47175
47070
|
}
|
|
47176
47071
|
await this._persistState();
|
|
47177
47072
|
const a2aMsg = {
|
|
47178
|
-
text:
|
|
47073
|
+
text: plaintext,
|
|
47179
47074
|
fromHubAddress: msgData.from_hub_address || msgData.hub_address || "",
|
|
47180
47075
|
channelId,
|
|
47181
47076
|
conversationId: msgData.conversation_id || "",
|
|
@@ -47246,19 +47141,7 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
|
|
|
47246
47141
|
header_blob: msgData.header_blob,
|
|
47247
47142
|
ciphertext: msgData.ciphertext
|
|
47248
47143
|
});
|
|
47249
|
-
const
|
|
47250
|
-
let plaintext;
|
|
47251
|
-
try {
|
|
47252
|
-
plaintext = session.ratchet.decrypt(encrypted);
|
|
47253
|
-
} catch (decryptErr) {
|
|
47254
|
-
console.error(`[SecureChannel] Decrypt failed for conv ${convId.slice(0, 8)}... \u2014 restoring ratchet:`, decryptErr);
|
|
47255
|
-
try {
|
|
47256
|
-
session.ratchet = DoubleRatchet.deserialize(ratchetSnapshot);
|
|
47257
|
-
} catch (restoreErr) {
|
|
47258
|
-
console.error("[SecureChannel] Ratchet restore failed:", restoreErr);
|
|
47259
|
-
}
|
|
47260
|
-
return;
|
|
47261
|
-
}
|
|
47144
|
+
const plaintext = session.ratchet.decrypt(encrypted);
|
|
47262
47145
|
this._sendAck(msgData.message_id);
|
|
47263
47146
|
if (!session.activated) {
|
|
47264
47147
|
session.activated = true;
|
|
@@ -47646,14 +47529,9 @@ ${messageText}`;
|
|
|
47646
47529
|
ciphertext: msgData.ciphertext
|
|
47647
47530
|
});
|
|
47648
47531
|
let plaintext;
|
|
47649
|
-
const ratchetSnapshot = session.ratchet.serialize();
|
|
47650
47532
|
try {
|
|
47651
47533
|
plaintext = session.ratchet.decrypt(encrypted);
|
|
47652
47534
|
} catch (decryptErr) {
|
|
47653
|
-
try {
|
|
47654
|
-
session.ratchet = DoubleRatchet.deserialize(ratchetSnapshot);
|
|
47655
|
-
} catch {
|
|
47656
|
-
}
|
|
47657
47535
|
console.warn(
|
|
47658
47536
|
`[SecureChannel] Room decrypt failed for conv ${convId.slice(0, 8)}...: ${String(decryptErr)}, re-initializing ratchet`
|
|
47659
47537
|
);
|
|
@@ -47799,20 +47677,7 @@ ${messageText}`;
|
|
|
47799
47677
|
header_blob: msg.header_blob,
|
|
47800
47678
|
ciphertext: msg.ciphertext
|
|
47801
47679
|
});
|
|
47802
|
-
const
|
|
47803
|
-
let plaintext;
|
|
47804
|
-
try {
|
|
47805
|
-
plaintext = session.ratchet.decrypt(encrypted);
|
|
47806
|
-
} catch (decryptErr) {
|
|
47807
|
-
console.error(`[SecureChannel] Sync decrypt failed for ${msg.conversation_id.slice(0, 8)}... \u2014 restoring ratchet:`, decryptErr);
|
|
47808
|
-
try {
|
|
47809
|
-
session.ratchet = DoubleRatchet.deserialize(ratchetSnapshot);
|
|
47810
|
-
} catch {
|
|
47811
|
-
}
|
|
47812
|
-
this._persisted.lastMessageTimestamp = msg.created_at;
|
|
47813
|
-
since = msg.created_at;
|
|
47814
|
-
continue;
|
|
47815
|
-
}
|
|
47680
|
+
const plaintext = session.ratchet.decrypt(encrypted);
|
|
47816
47681
|
this._sendAck(msg.id);
|
|
47817
47682
|
if (!session.activated) {
|
|
47818
47683
|
session.activated = true;
|
|
@@ -47847,7 +47712,7 @@ ${messageText}`;
|
|
|
47847
47712
|
totalProcessed++;
|
|
47848
47713
|
} catch (err) {
|
|
47849
47714
|
console.warn(
|
|
47850
|
-
`[SecureChannel] Sync failed for msg ${msg.id.slice(0, 8)}... in conv ${msg.conversation_id.slice(0, 8)}...: ${String(err)}`
|
|
47715
|
+
`[SecureChannel] Sync decrypt failed for msg ${msg.id.slice(0, 8)}... in conv ${msg.conversation_id.slice(0, 8)}...: ${String(err)}`
|
|
47851
47716
|
);
|
|
47852
47717
|
this._persisted.lastMessageTimestamp = msg.created_at;
|
|
47853
47718
|
since = msg.created_at;
|
|
@@ -48043,18 +47908,7 @@ ${messageText}`;
|
|
|
48043
47908
|
header_blob: msg.header_blob,
|
|
48044
47909
|
ciphertext: msg.ciphertext
|
|
48045
47910
|
});
|
|
48046
|
-
const
|
|
48047
|
-
let plaintext;
|
|
48048
|
-
try {
|
|
48049
|
-
plaintext = session.ratchet.decrypt(encrypted);
|
|
48050
|
-
} catch (decryptErr) {
|
|
48051
|
-
console.error(`[SecureChannel] Room sync decrypt failed for ${msg.conversation_id.slice(0, 8)}... \u2014 restoring ratchet:`, decryptErr);
|
|
48052
|
-
try {
|
|
48053
|
-
session.ratchet = DoubleRatchet.deserialize(ratchetSnapshot);
|
|
48054
|
-
} catch {
|
|
48055
|
-
}
|
|
48056
|
-
continue;
|
|
48057
|
-
}
|
|
47911
|
+
const plaintext = session.ratchet.decrypt(encrypted);
|
|
48058
47912
|
if (!session.activated) {
|
|
48059
47913
|
session.activated = true;
|
|
48060
47914
|
}
|
|
@@ -48160,7 +48014,8 @@ function resolveAccount(cfg, accountId) {
|
|
|
48160
48014
|
apiUrl: av.apiUrl ?? DEFAULT_API_URL,
|
|
48161
48015
|
agentName: id,
|
|
48162
48016
|
httpPort: DEFAULT_HTTP_PORT,
|
|
48163
|
-
configured: false
|
|
48017
|
+
configured: false,
|
|
48018
|
+
inviteToken: ""
|
|
48164
48019
|
};
|
|
48165
48020
|
}
|
|
48166
48021
|
let httpPort = acct.httpPort;
|
|
@@ -48175,7 +48030,8 @@ function resolveAccount(cfg, accountId) {
|
|
|
48175
48030
|
apiUrl: acct.apiUrl ?? av.apiUrl ?? DEFAULT_API_URL,
|
|
48176
48031
|
agentName: acct.agentName ?? id,
|
|
48177
48032
|
httpPort,
|
|
48178
|
-
configured: Boolean(acct.dataDir)
|
|
48033
|
+
configured: Boolean(acct.dataDir),
|
|
48034
|
+
inviteToken: acct.inviteToken ?? ""
|
|
48179
48035
|
};
|
|
48180
48036
|
}
|
|
48181
48037
|
return {
|
|
@@ -48184,7 +48040,8 @@ function resolveAccount(cfg, accountId) {
|
|
|
48184
48040
|
apiUrl: av.apiUrl ?? DEFAULT_API_URL,
|
|
48185
48041
|
agentName: av.agentName ?? "OpenClaw Agent",
|
|
48186
48042
|
httpPort: av.httpPort ?? DEFAULT_HTTP_PORT,
|
|
48187
|
-
configured: Boolean(av.dataDir)
|
|
48043
|
+
configured: Boolean(av.dataDir),
|
|
48044
|
+
inviteToken: av.inviteToken ?? ""
|
|
48188
48045
|
};
|
|
48189
48046
|
}
|
|
48190
48047
|
|
|
@@ -48406,27 +48263,6 @@ async function sendToOwner(text, options) {
|
|
|
48406
48263
|
return { ok: false, error: friendlyError(err) };
|
|
48407
48264
|
}
|
|
48408
48265
|
}
|
|
48409
|
-
async function sendAction(report, options) {
|
|
48410
|
-
if (typeof report.action !== "string" || report.action.trim().length === 0) {
|
|
48411
|
-
return { ok: false, error: "Action must be a non-empty string" };
|
|
48412
|
-
}
|
|
48413
|
-
try {
|
|
48414
|
-
const base = resolveBaseUrl(options);
|
|
48415
|
-
const res = await fetch(`${base}/action`, {
|
|
48416
|
-
method: "POST",
|
|
48417
|
-
headers: { "Content-Type": "application/json" },
|
|
48418
|
-
body: JSON.stringify(report),
|
|
48419
|
-
signal: options?.signal
|
|
48420
|
-
});
|
|
48421
|
-
if (!res.ok) {
|
|
48422
|
-
const body = await res.text().catch(() => "");
|
|
48423
|
-
return { ok: false, error: `HTTP ${res.status}${body ? `: ${body}` : ""}` };
|
|
48424
|
-
}
|
|
48425
|
-
return { ok: true };
|
|
48426
|
-
} catch (err) {
|
|
48427
|
-
return { ok: false, error: friendlyError(err) };
|
|
48428
|
-
}
|
|
48429
|
-
}
|
|
48430
48266
|
async function checkGateway(options) {
|
|
48431
48267
|
try {
|
|
48432
48268
|
const base = resolveBaseUrl(options);
|
|
@@ -48447,7 +48283,7 @@ async function checkGateway(options) {
|
|
|
48447
48283
|
}
|
|
48448
48284
|
|
|
48449
48285
|
// src/index.ts
|
|
48450
|
-
var VERSION = "0.
|
|
48286
|
+
var VERSION = "0.11.0";
|
|
48451
48287
|
export {
|
|
48452
48288
|
SecureChannel,
|
|
48453
48289
|
VERSION,
|
|
@@ -48456,7 +48292,6 @@ export {
|
|
|
48456
48292
|
getActiveChannel,
|
|
48457
48293
|
listAccountIds,
|
|
48458
48294
|
resolveAccount,
|
|
48459
|
-
sendAction,
|
|
48460
48295
|
sendToOwner,
|
|
48461
48296
|
setOcRuntime
|
|
48462
48297
|
};
|