openmates 0.15.0-alpha.26 → 0.15.0-alpha.28

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.
@@ -6004,7 +6004,7 @@ var OpenMatesClient = class _OpenMatesClient {
6004
6004
  }
6005
6005
  }
6006
6006
  const explicitTasksAppSkill = messageExplicitlyRequestsTasksAppSkill(params.message);
6007
- const { ws, session, ownerId } = await this.openWsClient({
6007
+ const { ws, ownerId } = await this.openWsClient({
6008
6008
  taskUpdateJobs: !explicitTasksAppSkill
6009
6009
  });
6010
6010
  if (!params.incognito && !ownerId) {
@@ -6131,6 +6131,9 @@ var OpenMatesClient = class _OpenMatesClient {
6131
6131
  }
6132
6132
  const encryptedEmbeds = [...params.encryptedEmbeds ?? []];
6133
6133
  if (!params.incognito && params.preparedEmbeds && params.preparedEmbeds.length > 0) {
6134
+ if (!ownerId) {
6135
+ throw new Error("Authenticated user identity is required to encrypt embeds.");
6136
+ }
6134
6137
  const masterKey = this.getMasterKeyBytes();
6135
6138
  for (const embed of params.preparedEmbeds) {
6136
6139
  const encrypted = await encryptEmbed(
@@ -6139,7 +6142,7 @@ var OpenMatesClient = class _OpenMatesClient {
6139
6142
  chatKeyBytes,
6140
6143
  chatId,
6141
6144
  messageId,
6142
- session.hashedEmail
6145
+ ownerId
6143
6146
  );
6144
6147
  if (encrypted) encryptedEmbeds.push(encrypted);
6145
6148
  }
@@ -6648,7 +6651,8 @@ var OpenMatesClient = class _OpenMatesClient {
6648
6651
  embeds: resp.embeds,
6649
6652
  chatId,
6650
6653
  chatKeyBytes,
6651
- fallbackMessageId: assistantId
6654
+ fallbackMessageId: assistantId,
6655
+ ownerId
6652
6656
  });
6653
6657
  await this.persistPostProcessingMetadata({
6654
6658
  ws,
@@ -6931,7 +6935,6 @@ var OpenMatesClient = class _OpenMatesClient {
6931
6935
  }).map((embed) => [embed.embed_id, embed])
6932
6936
  );
6933
6937
  if (finalized.size === 0) return;
6934
- const session = this.requireSession();
6935
6938
  const masterKey = this.getMasterKeyBytes();
6936
6939
  const parentKeys = /* @__PURE__ */ new Map();
6937
6940
  const processed = /* @__PURE__ */ new Set();
@@ -6956,10 +6959,9 @@ var OpenMatesClient = class _OpenMatesClient {
6956
6959
  const createdAt = normalizeUnixSeconds(embed.createdAt, now);
6957
6960
  const updatedAt = normalizeUnixSeconds(embed.updatedAt, now);
6958
6961
  const messageId = embed.message_id || params.fallbackMessageId;
6959
- const userId = embed.user_id || session.hashedEmail;
6960
6962
  const hashedChatId = computeSHA256(params.chatId);
6961
6963
  const hashedMessageId = computeSHA256(messageId);
6962
- const hashedUserId = computeSHA256(userId);
6964
+ const hashedUserId = computeSHA256(params.ownerId);
6963
6965
  const hashedEmbedId = computeSHA256(embed.embed_id);
6964
6966
  const encryptedContent = await encryptWithAesGcmCombined(
6965
6967
  embed.content ?? "",
@@ -6991,7 +6993,17 @@ var OpenMatesClient = class _OpenMatesClient {
6991
6993
  created_at: now
6992
6994
  }
6993
6995
  ] : [];
6996
+ const storeRequestId = randomUUID5();
6997
+ const storeConfirmed = params.ws.waitForMessage(
6998
+ "store_embed_confirmed",
6999
+ (payload) => {
7000
+ const p = payload;
7001
+ return p.request_id === storeRequestId && p.embed_id === embed.embed_id;
7002
+ },
7003
+ 3e4
7004
+ );
6994
7005
  await params.ws.sendAsync("store_embed", {
7006
+ request_id: storeRequestId,
6995
7007
  embed_id: embed.embed_id,
6996
7008
  encrypted_type: encryptedType,
6997
7009
  encrypted_content: encryptedContent,
@@ -7012,8 +7024,19 @@ var OpenMatesClient = class _OpenMatesClient {
7012
7024
  created_at: createdAt,
7013
7025
  updated_at: updatedAt
7014
7026
  });
7027
+ await storeConfirmed;
7015
7028
  if (keys.length > 0) {
7016
- await params.ws.sendAsync("store_embed_keys", { keys });
7029
+ const keysRequestId = randomUUID5();
7030
+ const keysConfirmed = params.ws.waitForMessage(
7031
+ "store_embed_keys_confirmed",
7032
+ (payload) => {
7033
+ const p = payload;
7034
+ return p.request_id === keysRequestId;
7035
+ },
7036
+ 3e4
7037
+ );
7038
+ await params.ws.sendAsync("store_embed_keys", { request_id: keysRequestId, keys });
7039
+ await keysConfirmed;
7017
7040
  parentKeys.set(embed.embed_id, embedKey);
7018
7041
  }
7019
7042
  if (Array.isArray(embed.version_history_rows)) {
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  getExtForLang,
4
4
  serializeToYaml
5
- } from "./chunk-SK2NK7LX.js";
5
+ } from "./chunk-LJQTUMTN.js";
6
6
  import "./chunk-AXNRPVLE.js";
7
7
  export {
8
8
  getExtForLang,
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  reconcileAuthoritativeChats,
19
19
  renderSupportInfo,
20
20
  serializeToYaml
21
- } from "./chunk-SK2NK7LX.js";
21
+ } from "./chunk-LJQTUMTN.js";
22
22
  import "./chunk-AXNRPVLE.js";
23
23
  export {
24
24
  APP_SKILL_METADATA,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openmates",
3
- "version": "0.15.0-alpha.26",
3
+ "version": "0.15.0-alpha.28",
4
4
  "description": "OpenMates CLI and SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",