openmates 0.18.0-alpha.30 → 0.18.0-alpha.31
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/{chunk-QLI5D3XI.js → chunk-R4YXGJWV.js} +29 -0
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -10602,6 +10602,7 @@ var OpenMatesClient = class _OpenMatesClient {
|
|
|
10602
10602
|
assertNoConnectedAccountSecretLeak(connectedAccountTokenRefs);
|
|
10603
10603
|
const piiMappings = params.piiMappings ?? [];
|
|
10604
10604
|
let chatKeyBytes = null;
|
|
10605
|
+
let activeFocusId = null;
|
|
10605
10606
|
let encryptedChatKey = null;
|
|
10606
10607
|
let chatSlugLookupKey = null;
|
|
10607
10608
|
let baselineMessagesV = 0;
|
|
@@ -10632,6 +10633,14 @@ var OpenMatesClient = class _OpenMatesClient {
|
|
|
10632
10633
|
if (encKey) {
|
|
10633
10634
|
chatKeyBytes = await decryptBytesWithAesGcm(encKey, wrappingKey);
|
|
10634
10635
|
encryptedChatKey = encKey;
|
|
10636
|
+
if (!chatKeyBytes) throw new Error("Could not decrypt the saved chat key.");
|
|
10637
|
+
const encryptedFocusId = chat.details.encrypted_active_focus_id;
|
|
10638
|
+
if (typeof encryptedFocusId === "string" && encryptedFocusId) {
|
|
10639
|
+
activeFocusId = await decryptWithAesGcmCombined(encryptedFocusId, chatKeyBytes);
|
|
10640
|
+
if (!activeFocusId) {
|
|
10641
|
+
throw new Error("Could not decrypt the chat's active focus. Sync before sending again.");
|
|
10642
|
+
}
|
|
10643
|
+
}
|
|
10635
10644
|
}
|
|
10636
10645
|
}
|
|
10637
10646
|
if (!chatKeyBytes || !encryptedChatKey) {
|
|
@@ -10639,11 +10648,29 @@ var OpenMatesClient = class _OpenMatesClient {
|
|
|
10639
10648
|
}
|
|
10640
10649
|
}
|
|
10641
10650
|
}
|
|
10651
|
+
let focusPersistence = Promise.resolve();
|
|
10652
|
+
let focusPersistenceError = null;
|
|
10653
|
+
ws.onMessageType("focus_mode_activated", (event) => {
|
|
10654
|
+
if (event.chat_id !== chatId || !event.focus_id || !chatKeyBytes || params.incognito) return;
|
|
10655
|
+
const focusId = event.focus_id;
|
|
10656
|
+
const key = chatKeyBytes;
|
|
10657
|
+
focusPersistence = focusPersistence.then(async () => {
|
|
10658
|
+
const encryptedFocusId = await encryptWithAesGcmCombined(focusId, key);
|
|
10659
|
+
await ws.sendAsync("update_encrypted_active_focus_id", {
|
|
10660
|
+
chat_id: chatId,
|
|
10661
|
+
encrypted_active_focus_id: encryptedFocusId
|
|
10662
|
+
});
|
|
10663
|
+
}).catch((error) => {
|
|
10664
|
+
focusPersistenceError = error;
|
|
10665
|
+
});
|
|
10666
|
+
});
|
|
10642
10667
|
const clientCapabilities = taskUpdateJobsEnabled ? ["task_update_jobs"] : [];
|
|
10643
10668
|
const messagePayload = {
|
|
10644
10669
|
chat_id: chatId,
|
|
10645
10670
|
...teamId ? { team_id: teamId } : {},
|
|
10646
10671
|
client_capabilities: clientCapabilities,
|
|
10672
|
+
// Only decrypted current metadata restores focus; history is never authority.
|
|
10673
|
+
active_focus_id: activeFocusId,
|
|
10647
10674
|
is_incognito: Boolean(params.incognito),
|
|
10648
10675
|
message: {
|
|
10649
10676
|
message_id: messageId,
|
|
@@ -11393,8 +11420,10 @@ var OpenMatesClient = class _OpenMatesClient {
|
|
|
11393
11420
|
clearSyncCache(teamId);
|
|
11394
11421
|
}
|
|
11395
11422
|
} finally {
|
|
11423
|
+
await focusPersistence;
|
|
11396
11424
|
ws.close();
|
|
11397
11425
|
}
|
|
11426
|
+
if (focusPersistenceError) throw focusPersistenceError;
|
|
11398
11427
|
}
|
|
11399
11428
|
const mateName = category ? MATE_NAMES[category] ?? null : null;
|
|
11400
11429
|
return {
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED