@arbidocs/sdk 0.4.32 → 0.4.33
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/README.md +18 -0
- package/dist/{browser-CsCYLnPh.d.cts → browser-CQ3lohen.d.cts} +198 -8
- package/dist/{browser-CsCYLnPh.d.ts → browser-CQ3lohen.d.ts} +198 -8
- package/dist/browser.cjs +158 -19
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +159 -21
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +188 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -3
- package/dist/index.d.ts +18 -3
- package/dist/index.js +186 -33
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -5,7 +5,7 @@ var path2 = require('path');
|
|
|
5
5
|
var os2 = require('os');
|
|
6
6
|
var client = require('@arbidocs/client');
|
|
7
7
|
var child_process = require('child_process');
|
|
8
|
-
var crypto = require('crypto');
|
|
8
|
+
var crypto$1 = require('crypto');
|
|
9
9
|
var url = require('url');
|
|
10
10
|
|
|
11
11
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
@@ -3583,8 +3583,8 @@ async function extractErrorMessage(res) {
|
|
|
3583
3583
|
const text = await res.text();
|
|
3584
3584
|
if (text) {
|
|
3585
3585
|
try {
|
|
3586
|
-
const
|
|
3587
|
-
bodyDetail = detailText(
|
|
3586
|
+
const json2 = JSON.parse(text);
|
|
3587
|
+
bodyDetail = detailText(json2.detail) || json2.message || json2.error || void 0;
|
|
3588
3588
|
} catch {
|
|
3589
3589
|
if (text.length < 200) bodyDetail = text;
|
|
3590
3590
|
}
|
|
@@ -3597,8 +3597,8 @@ async function extractErrorMessage(res) {
|
|
|
3597
3597
|
return `Request failed: ${res.status} ${res.statusText}`;
|
|
3598
3598
|
}
|
|
3599
3599
|
async function authenticatedFetch(options) {
|
|
3600
|
-
const { baseUrl, accessToken, path:
|
|
3601
|
-
const res = await fetch(`${baseUrl}${
|
|
3600
|
+
const { baseUrl, accessToken, path: path4, method, body, headers, signal } = options;
|
|
3601
|
+
const res = await fetch(`${baseUrl}${path4}`, {
|
|
3602
3602
|
method: method ?? (body ? "POST" : "GET"),
|
|
3603
3603
|
headers: {
|
|
3604
3604
|
Authorization: `Bearer ${accessToken}`,
|
|
@@ -3816,8 +3816,8 @@ var FileConfigStore = class {
|
|
|
3816
3816
|
readPublicConfigDomain(filePath) {
|
|
3817
3817
|
try {
|
|
3818
3818
|
const content = fs2__default.default.readFileSync(filePath, "utf-8");
|
|
3819
|
-
const
|
|
3820
|
-
const domain =
|
|
3819
|
+
const json2 = JSON.parse(content);
|
|
3820
|
+
const domain = json2?.deployment?.domain;
|
|
3821
3821
|
if (domain) {
|
|
3822
3822
|
return { baseUrl: `https://${domain}`, deploymentDomain: domain };
|
|
3823
3823
|
}
|
|
@@ -5038,8 +5038,8 @@ async function getThumbnails(auth, docIds) {
|
|
|
5038
5038
|
headers: { "Content-Type": "application/json" },
|
|
5039
5039
|
body: JSON.stringify({ document_ext_ids: docIds })
|
|
5040
5040
|
});
|
|
5041
|
-
const
|
|
5042
|
-
return
|
|
5041
|
+
const json2 = await res.json();
|
|
5042
|
+
return json2.thumbnails ?? {};
|
|
5043
5043
|
}
|
|
5044
5044
|
async function uploadFile(auth, fileData, fileName, options) {
|
|
5045
5045
|
const formData = new FormData();
|
|
@@ -5931,17 +5931,17 @@ async function encryptDmContent(arbi, plaintext, recipientEncryptionPubKeyBase64
|
|
|
5931
5931
|
senderEncryptionSecretKey
|
|
5932
5932
|
);
|
|
5933
5933
|
}
|
|
5934
|
-
async function decryptDmContent(arbi, notification,
|
|
5934
|
+
async function decryptDmContent(arbi, notification, crypto2) {
|
|
5935
5935
|
if (!notification.content) return null;
|
|
5936
|
-
const isSent = notification.sender.external_id ===
|
|
5936
|
+
const isSent = notification.sender.external_id === crypto2.userExtId;
|
|
5937
5937
|
const otherParty = isSent ? notification.recipient : notification.sender;
|
|
5938
5938
|
return arbi.crypto.decryptMessage(
|
|
5939
5939
|
notification.content,
|
|
5940
5940
|
otherParty.encryption_public_key,
|
|
5941
|
-
|
|
5941
|
+
crypto2.encryptionKeypair.secretKey
|
|
5942
5942
|
);
|
|
5943
5943
|
}
|
|
5944
|
-
async function decryptDmBatch(arbi, notifications,
|
|
5944
|
+
async function decryptDmBatch(arbi, notifications, crypto2) {
|
|
5945
5945
|
const results = [];
|
|
5946
5946
|
for (const n2 of notifications) {
|
|
5947
5947
|
if (n2.type !== "user_message" || !n2.content) {
|
|
@@ -5949,7 +5949,7 @@ async function decryptDmBatch(arbi, notifications, crypto) {
|
|
|
5949
5949
|
continue;
|
|
5950
5950
|
}
|
|
5951
5951
|
try {
|
|
5952
|
-
const plaintext = await decryptDmContent(arbi, n2,
|
|
5952
|
+
const plaintext = await decryptDmContent(arbi, n2, crypto2);
|
|
5953
5953
|
results.push({ ...n2, content: plaintext });
|
|
5954
5954
|
} catch {
|
|
5955
5955
|
results.push({ ...n2, content: "[Decryption failed]" });
|
|
@@ -5960,9 +5960,9 @@ async function decryptDmBatch(arbi, notifications, crypto) {
|
|
|
5960
5960
|
async function listDMs(arbi) {
|
|
5961
5961
|
return requireData(await arbi.fetch.GET("/v1/notifications/"), "Failed to fetch messages");
|
|
5962
5962
|
}
|
|
5963
|
-
async function listDecryptedDMs(arbi,
|
|
5963
|
+
async function listDecryptedDMs(arbi, crypto2) {
|
|
5964
5964
|
const raw = await listDMs(arbi);
|
|
5965
|
-
return decryptDmBatch(arbi, raw,
|
|
5965
|
+
return decryptDmBatch(arbi, raw, crypto2);
|
|
5966
5966
|
}
|
|
5967
5967
|
async function listActivity(arbi, options) {
|
|
5968
5968
|
return requireData(
|
|
@@ -6009,7 +6009,7 @@ async function resolveRecipient(arbi, ref) {
|
|
|
6009
6009
|
}
|
|
6010
6010
|
return null;
|
|
6011
6011
|
}
|
|
6012
|
-
async function sendEncryptedDM(arbi, messages,
|
|
6012
|
+
async function sendEncryptedDM(arbi, messages, crypto2) {
|
|
6013
6013
|
const plaintextFor = new Map(messages.map((m2) => [m2.recipient_ext_id, m2.content]));
|
|
6014
6014
|
const encrypted = await Promise.all(
|
|
6015
6015
|
messages.map(async (msg) => ({
|
|
@@ -6018,7 +6018,7 @@ async function sendEncryptedDM(arbi, messages, crypto) {
|
|
|
6018
6018
|
arbi,
|
|
6019
6019
|
msg.content,
|
|
6020
6020
|
msg.recipient_encryption_public_key,
|
|
6021
|
-
|
|
6021
|
+
crypto2.encryptionKeypair.secretKey
|
|
6022
6022
|
)
|
|
6023
6023
|
}))
|
|
6024
6024
|
);
|
|
@@ -6033,7 +6033,7 @@ async function sendEncryptedDM(arbi, messages, crypto) {
|
|
|
6033
6033
|
content: plaintextFor.get(n2.recipient.external_id) ?? n2.content
|
|
6034
6034
|
}));
|
|
6035
6035
|
}
|
|
6036
|
-
async function requestWorkspaceAccess(arbi, params,
|
|
6036
|
+
async function requestWorkspaceAccess(arbi, params, crypto2) {
|
|
6037
6037
|
const payload = JSON.stringify({
|
|
6038
6038
|
session_pubkey_b64: params.sessionPubkeyB64,
|
|
6039
6039
|
note: params.note?.trim() || void 0
|
|
@@ -6042,7 +6042,7 @@ async function requestWorkspaceAccess(arbi, params, crypto) {
|
|
|
6042
6042
|
arbi,
|
|
6043
6043
|
payload,
|
|
6044
6044
|
params.recipientEncryptionPublicKey,
|
|
6045
|
-
|
|
6045
|
+
crypto2.encryptionKeypair.secretKey
|
|
6046
6046
|
);
|
|
6047
6047
|
return requireData(
|
|
6048
6048
|
await arbi.fetch.POST("/v1/notifications/access-request", {
|
|
@@ -6443,6 +6443,7 @@ __export(workflows_exports, {
|
|
|
6443
6443
|
createWorkflow: () => createWorkflow,
|
|
6444
6444
|
deleteWorkflow: () => deleteWorkflow,
|
|
6445
6445
|
getWorkflow: () => getWorkflow,
|
|
6446
|
+
listWorkflowRuns: () => listWorkflowRuns,
|
|
6446
6447
|
listWorkflows: () => listWorkflows,
|
|
6447
6448
|
runWorkflow: () => runWorkflow,
|
|
6448
6449
|
updateWorkflow: () => updateWorkflow
|
|
@@ -6478,6 +6479,12 @@ async function runWorkflow(arbi, workflowId) {
|
|
|
6478
6479
|
"Failed to run workflow"
|
|
6479
6480
|
);
|
|
6480
6481
|
}
|
|
6482
|
+
async function listWorkflowRuns(arbi, workflowId) {
|
|
6483
|
+
return requireData(
|
|
6484
|
+
await arbi.fetch.GET("/v1/workflow/{workflow_id}/runs", byId2(workflowId)),
|
|
6485
|
+
"Failed to list automation executions"
|
|
6486
|
+
);
|
|
6487
|
+
}
|
|
6481
6488
|
|
|
6482
6489
|
// src/operations/facts.ts
|
|
6483
6490
|
var facts_exports = {};
|
|
@@ -6551,8 +6558,8 @@ function tokenExpiresWithin(token, seconds) {
|
|
|
6551
6558
|
const payload = token?.split(".")[1];
|
|
6552
6559
|
if (!payload) return false;
|
|
6553
6560
|
try {
|
|
6554
|
-
const
|
|
6555
|
-
const { exp } = JSON.parse(
|
|
6561
|
+
const json2 = atob(payload.replace(/-/g, "+").replace(/_/g, "/"));
|
|
6562
|
+
const { exp } = JSON.parse(json2);
|
|
6556
6563
|
return typeof exp === "number" && exp * 1e3 - Date.now() < seconds * 1e3;
|
|
6557
6564
|
} catch {
|
|
6558
6565
|
return false;
|
|
@@ -6943,9 +6950,9 @@ var Arbi = class {
|
|
|
6943
6950
|
const lr2 = this.requireLogin();
|
|
6944
6951
|
const userExtId = lr2.userExtId ?? client.session.getState().userExtId;
|
|
6945
6952
|
if (!userExtId) throw new ArbiError("No user id in session \u2014 cannot request access");
|
|
6946
|
-
const
|
|
6953
|
+
const crypto2 = createDmCryptoContext(client, lr2.signingPrivateKey, userExtId);
|
|
6947
6954
|
const sessionPubkeyB64 = client.crypto.bytesToBase64(lr2.serverSessionKey);
|
|
6948
|
-
return requestWorkspaceAccess(client, { ...params, sessionPubkeyB64 },
|
|
6955
|
+
return requestWorkspaceAccess(client, { ...params, sessionPubkeyB64 }, crypto2);
|
|
6949
6956
|
},
|
|
6950
6957
|
copyDocuments: (targetWorkspaceId, docIds, targetWorkspaceKey) => copyDocuments(
|
|
6951
6958
|
this.requireClient(),
|
|
@@ -7065,11 +7072,11 @@ var Arbi = class {
|
|
|
7065
7072
|
};
|
|
7066
7073
|
/** Authenticated native Word transport, with normal session recovery. */
|
|
7067
7074
|
editor = {
|
|
7068
|
-
request: (
|
|
7075
|
+
request: (path4, options = {}) => this.recovering(async () => {
|
|
7069
7076
|
const { baseUrl, accessToken } = this.getAuthHeaders();
|
|
7070
7077
|
const headers = new Headers(options.headers);
|
|
7071
7078
|
headers.set("Authorization", `Bearer ${accessToken}`);
|
|
7072
|
-
const response = await fetch(`${baseUrl}/v1/editor${
|
|
7079
|
+
const response = await fetch(`${baseUrl}/v1/editor${path4}`, { ...options, headers });
|
|
7073
7080
|
if (!response.ok) {
|
|
7074
7081
|
const body = await response.json().catch(() => null);
|
|
7075
7082
|
throw new ArbiApiError(body?.detail || `Document request failed (${response.status})`, {
|
|
@@ -8127,6 +8134,152 @@ async function uploadArchive(auth, archivePath, options) {
|
|
|
8127
8134
|
}
|
|
8128
8135
|
}
|
|
8129
8136
|
|
|
8137
|
+
// src/operations/mail.ts
|
|
8138
|
+
var mail_exports = {};
|
|
8139
|
+
__export(mail_exports, {
|
|
8140
|
+
NATIVE_ACCOUNT: () => NATIVE_ACCOUNT,
|
|
8141
|
+
attachmentFromBytes: () => attachmentFromBytes,
|
|
8142
|
+
claimNativeAlias: () => claimNativeAlias,
|
|
8143
|
+
createMailFetch: () => createMailFetch,
|
|
8144
|
+
downloadAttachment: () => downloadAttachment,
|
|
8145
|
+
getMailPolicy: () => getMailPolicy,
|
|
8146
|
+
getMessage: () => getMessage2,
|
|
8147
|
+
listFolders: () => listFolders,
|
|
8148
|
+
listMailAccounts: () => listMailAccounts,
|
|
8149
|
+
listMessages: () => listMessages,
|
|
8150
|
+
saveDraft: () => saveDraft,
|
|
8151
|
+
sendMessage: () => sendMessage,
|
|
8152
|
+
unlockNativeMail: () => unlockNativeMail,
|
|
8153
|
+
updateMessage: () => updateMessage
|
|
8154
|
+
});
|
|
8155
|
+
var NATIVE_ACCOUNT = "native";
|
|
8156
|
+
function createMailFetch(auth) {
|
|
8157
|
+
return (path4, init = {}) => authenticatedFetch({
|
|
8158
|
+
...auth,
|
|
8159
|
+
path: `/v1/mail${path4}`,
|
|
8160
|
+
method: init.method,
|
|
8161
|
+
body: init.body,
|
|
8162
|
+
headers: {
|
|
8163
|
+
...init.body ? { "Content-Type": "application/json" } : {},
|
|
8164
|
+
...init.headers
|
|
8165
|
+
}
|
|
8166
|
+
});
|
|
8167
|
+
}
|
|
8168
|
+
async function json(response) {
|
|
8169
|
+
return (await response).json();
|
|
8170
|
+
}
|
|
8171
|
+
var accountPath = (accountId) => `/accounts/${encodeURIComponent(accountId)}`;
|
|
8172
|
+
function getMailPolicy(mail) {
|
|
8173
|
+
return json(mail("/policy"));
|
|
8174
|
+
}
|
|
8175
|
+
function listMailAccounts(mail) {
|
|
8176
|
+
return json(mail("/accounts"));
|
|
8177
|
+
}
|
|
8178
|
+
async function claimNativeAlias(mail, alias) {
|
|
8179
|
+
const { email } = await json(
|
|
8180
|
+
mail("/native/alias", { method: "POST", body: JSON.stringify({ alias }) })
|
|
8181
|
+
);
|
|
8182
|
+
return email;
|
|
8183
|
+
}
|
|
8184
|
+
function listFolders(mail, accountId = NATIVE_ACCOUNT) {
|
|
8185
|
+
return json(mail(`${accountPath(accountId)}/folders`));
|
|
8186
|
+
}
|
|
8187
|
+
function listMessages(mail, options) {
|
|
8188
|
+
const params = new URLSearchParams({ folder_id: options.folderId });
|
|
8189
|
+
if (options.query) params.set("q", options.query);
|
|
8190
|
+
if (options.cursor) params.set("cursor", options.cursor);
|
|
8191
|
+
if (options.limit) params.set("limit", String(options.limit));
|
|
8192
|
+
return json(mail(`${accountPath(options.accountId ?? NATIVE_ACCOUNT)}/messages?${params}`));
|
|
8193
|
+
}
|
|
8194
|
+
function getMessage2(mail, messageId, accountId = NATIVE_ACCOUNT) {
|
|
8195
|
+
return json(mail(`${accountPath(accountId)}/messages/${encodeURIComponent(messageId)}`));
|
|
8196
|
+
}
|
|
8197
|
+
async function downloadAttachment(mail, messageId, attachmentId, accountId = NATIVE_ACCOUNT) {
|
|
8198
|
+
const path4 = `${accountPath(accountId)}/messages/${encodeURIComponent(messageId)}/attachments/${encodeURIComponent(attachmentId)}`;
|
|
8199
|
+
return new Uint8Array(await (await mail(path4)).arrayBuffer());
|
|
8200
|
+
}
|
|
8201
|
+
async function updateMessage(mail, messageId, update, accountId = NATIVE_ACCOUNT) {
|
|
8202
|
+
await mail(`${accountPath(accountId)}/messages/${encodeURIComponent(messageId)}`, {
|
|
8203
|
+
method: "PATCH",
|
|
8204
|
+
body: JSON.stringify(update)
|
|
8205
|
+
});
|
|
8206
|
+
}
|
|
8207
|
+
function saveDraft(mail, compose, accountId = NATIVE_ACCOUNT) {
|
|
8208
|
+
return json(
|
|
8209
|
+
mail(`${accountPath(accountId)}/drafts`, { method: "POST", body: JSON.stringify(compose) })
|
|
8210
|
+
);
|
|
8211
|
+
}
|
|
8212
|
+
function sendMessage(mail, message, accountId = NATIVE_ACCOUNT) {
|
|
8213
|
+
const body = { ...message, request_id: message.request_id ?? crypto.randomUUID() };
|
|
8214
|
+
return json(
|
|
8215
|
+
mail(`${accountPath(accountId)}/send`, { method: "POST", body: JSON.stringify(body) })
|
|
8216
|
+
);
|
|
8217
|
+
}
|
|
8218
|
+
async function unlockNativeMail(mail, keys) {
|
|
8219
|
+
await client.initSodium();
|
|
8220
|
+
const secretKey = client.deriveEncryptionKeypairFromSigning({
|
|
8221
|
+
publicKey: keys.signingPrivateKey.slice(32, 64),
|
|
8222
|
+
secretKey: keys.signingPrivateKey
|
|
8223
|
+
}).secretKey;
|
|
8224
|
+
try {
|
|
8225
|
+
let cursor = 0;
|
|
8226
|
+
while (cursor !== null) {
|
|
8227
|
+
const page = await json(
|
|
8228
|
+
mail(`/native/keys?cursor=${cursor}`)
|
|
8229
|
+
);
|
|
8230
|
+
const sealed = {};
|
|
8231
|
+
for (const [id, wrapped] of Object.entries(page.keys)) {
|
|
8232
|
+
const key = client.sealedBoxDecrypt(wrapped, secretKey);
|
|
8233
|
+
try {
|
|
8234
|
+
sealed[id] = await client.sealKeyForSession(key, keys.serverSessionKey);
|
|
8235
|
+
} finally {
|
|
8236
|
+
key.fill(0);
|
|
8237
|
+
}
|
|
8238
|
+
}
|
|
8239
|
+
if (Object.keys(sealed).length) {
|
|
8240
|
+
await mail("/native/session-keys", {
|
|
8241
|
+
method: "POST",
|
|
8242
|
+
body: JSON.stringify({ keys: sealed })
|
|
8243
|
+
});
|
|
8244
|
+
}
|
|
8245
|
+
cursor = page.next_cursor;
|
|
8246
|
+
}
|
|
8247
|
+
} finally {
|
|
8248
|
+
secretKey.fill(0);
|
|
8249
|
+
}
|
|
8250
|
+
}
|
|
8251
|
+
function attachmentFromBytes(name, contentType, bytes) {
|
|
8252
|
+
return {
|
|
8253
|
+
id: "",
|
|
8254
|
+
name,
|
|
8255
|
+
content_type: contentType,
|
|
8256
|
+
size: bytes.length,
|
|
8257
|
+
content_base64: bytesToBase64(bytes)
|
|
8258
|
+
};
|
|
8259
|
+
}
|
|
8260
|
+
function bytesToBase64(bytes) {
|
|
8261
|
+
let binary = "";
|
|
8262
|
+
for (let i2 = 0; i2 < bytes.length; i2 += 32768) {
|
|
8263
|
+
binary += String.fromCharCode(...bytes.subarray(i2, i2 + 32768));
|
|
8264
|
+
}
|
|
8265
|
+
return btoa(binary);
|
|
8266
|
+
}
|
|
8267
|
+
|
|
8268
|
+
// src/operations/mail-node.ts
|
|
8269
|
+
var mail_node_exports = {};
|
|
8270
|
+
__export(mail_node_exports, {
|
|
8271
|
+
attachmentFromFile: () => attachmentFromFile
|
|
8272
|
+
});
|
|
8273
|
+
function attachmentFromFile(filePath) {
|
|
8274
|
+
const resolved = path2__default.default.resolve(filePath);
|
|
8275
|
+
const name = path2__default.default.basename(resolved);
|
|
8276
|
+
return attachmentFromBytes(
|
|
8277
|
+
name,
|
|
8278
|
+
mimeFromName(name) || "application/octet-stream",
|
|
8279
|
+
fs2__default.default.readFileSync(resolved)
|
|
8280
|
+
);
|
|
8281
|
+
}
|
|
8282
|
+
|
|
8130
8283
|
// src/listen/index.ts
|
|
8131
8284
|
var listen_exports = {};
|
|
8132
8285
|
__export(listen_exports, {
|
|
@@ -8135,7 +8288,7 @@ __export(listen_exports, {
|
|
|
8135
8288
|
startDmListener: () => startDmListener
|
|
8136
8289
|
});
|
|
8137
8290
|
function toUuid(input) {
|
|
8138
|
-
const hash = crypto.createHash("sha256").update(input).digest("hex");
|
|
8291
|
+
const hash = crypto$1.createHash("sha256").update(input).digest("hex");
|
|
8139
8292
|
return [
|
|
8140
8293
|
hash.slice(0, 8),
|
|
8141
8294
|
hash.slice(8, 12),
|
|
@@ -8291,14 +8444,14 @@ var OpenClawOrchestrator = class {
|
|
|
8291
8444
|
return;
|
|
8292
8445
|
}
|
|
8293
8446
|
try {
|
|
8294
|
-
const
|
|
8295
|
-
const payloads =
|
|
8447
|
+
const json2 = JSON.parse(stdout);
|
|
8448
|
+
const payloads = json2?.payloads ?? json2?.result?.payloads ?? [];
|
|
8296
8449
|
const texts = payloads.map((p2) => p2.text ?? "").filter(Boolean);
|
|
8297
8450
|
if (texts.length > 0) {
|
|
8298
8451
|
resolve2(texts.join("\n"));
|
|
8299
8452
|
return;
|
|
8300
8453
|
}
|
|
8301
|
-
const finalText =
|
|
8454
|
+
const finalText = json2?.meta?.systemPromptReport?.finalAssistantVisibleText ?? json2?.meta?.systemPromptReport?.finalAssistantRawText;
|
|
8302
8455
|
if (typeof finalText === "string" && finalText.trim()) {
|
|
8303
8456
|
resolve2(finalText.trim());
|
|
8304
8457
|
return;
|
|
@@ -8318,7 +8471,7 @@ var OpenClawOrchestrator = class {
|
|
|
8318
8471
|
|
|
8319
8472
|
// src/listen/dm-listener.ts
|
|
8320
8473
|
async function startDmListener(options) {
|
|
8321
|
-
const { arbi, baseUrl, crypto, orchestrator, parentExtId, onLog, onError } = options;
|
|
8474
|
+
const { arbi, baseUrl, crypto: crypto2, orchestrator, parentExtId, onLog, onError } = options;
|
|
8322
8475
|
const log = onLog ?? (() => {
|
|
8323
8476
|
});
|
|
8324
8477
|
const logError = onError ?? ((msg) => console.error(msg));
|
|
@@ -8335,7 +8488,7 @@ async function startDmListener(options) {
|
|
|
8335
8488
|
}
|
|
8336
8489
|
let plaintext;
|
|
8337
8490
|
try {
|
|
8338
|
-
plaintext = await decryptDmContent(arbi, msg,
|
|
8491
|
+
plaintext = await decryptDmContent(arbi, msg, crypto2);
|
|
8339
8492
|
} catch (err) {
|
|
8340
8493
|
logError("Failed to decrypt incoming DM", err);
|
|
8341
8494
|
return;
|
|
@@ -8371,7 +8524,7 @@ async function startDmListener(options) {
|
|
|
8371
8524
|
recipient_encryption_public_key: senderPubKey
|
|
8372
8525
|
}
|
|
8373
8526
|
],
|
|
8374
|
-
|
|
8527
|
+
crypto2
|
|
8375
8528
|
);
|
|
8376
8529
|
log(`Reply sent to ${msg.sender?.email ?? senderExtId}`);
|
|
8377
8530
|
} catch (err) {
|
|
@@ -8477,6 +8630,8 @@ exports.getErrorMessage = getErrorMessage;
|
|
|
8477
8630
|
exports.getRawWorkspaceKey = getRawWorkspaceKey;
|
|
8478
8631
|
exports.health = health_exports;
|
|
8479
8632
|
exports.listen = listen_exports;
|
|
8633
|
+
exports.mail = mail_exports;
|
|
8634
|
+
exports.mailNode = mail_node_exports;
|
|
8480
8635
|
exports.parseSSEEvents = parseSSEEvents;
|
|
8481
8636
|
exports.parseSlashCommand = parseSlashCommand;
|
|
8482
8637
|
exports.parseSlashTokenInProgress = parseSlashTokenInProgress;
|