openmates 0.27.0-alpha.63 → 0.27.0-alpha.65

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.
@@ -17201,7 +17201,15 @@ var OpenMatesClient = class _OpenMatesClient {
17201
17201
  } catch (error) {
17202
17202
  if (error instanceof WebSocketProtocolError) {
17203
17203
  if (error.code === "version_conflict") {
17204
- const latestCache = await this.ensureSynced(true, [chatId], { teamId });
17204
+ const latestCache = await this.ensureSynced(
17205
+ true,
17206
+ [chatId],
17207
+ { teamId },
17208
+ false,
17209
+ void 0,
17210
+ void 0,
17211
+ { skipTypedRecoveryOutputReplay: true }
17212
+ );
17205
17213
  const latestChat = latestCache.chats.find(
17206
17214
  (chat) => String(chat.details.id ?? "") === chatId
17207
17215
  );
@@ -17710,10 +17718,47 @@ var OpenMatesClient = class _OpenMatesClient {
17710
17718
  if (Array.isArray(embed.version_history_rows)) {
17711
17719
  for (const row3 of embed.version_history_rows) {
17712
17720
  if (!row3.embed_id || typeof row3.version_number !== "number") continue;
17721
+ if (row3.embed_id !== embed.embed_id) {
17722
+ throw new Error(`Embed ${embed.embed_id} history row has a different embed identity.`);
17723
+ }
17724
+ if (row3.version_number === 1) {
17725
+ const query = new URLSearchParams({ capability: "bounded-v1", chat_id: params.chatId });
17726
+ if (params.teamId) query.set("team_id", params.teamId);
17727
+ const existing = await this.http.get(
17728
+ `/v1/embeds/${encodeURIComponent(embed.embed_id)}/versions/1?${query}`,
17729
+ this.getCliRequestHeaders()
17730
+ );
17731
+ if (existing.ok) {
17732
+ const rows2 = existing.data?.rows;
17733
+ if (existing.data?.embed_id !== embed.embed_id || existing.data.version_number !== 1 || !Array.isArray(rows2) || rows2.length !== 1 || rows2[0].version_number !== 1 || typeof rows2[0].encrypted_snapshot !== "string" || rows2[0].encrypted_patch != null || typeof row3.snapshot !== "string" || typeof row3.patch === "string") {
17734
+ throw new Error(`Canonical embed ${embed.embed_id} v1 history is invalid.`);
17735
+ }
17736
+ const canonicalSnapshot = await decryptWithAesGcmCombined(rows2[0].encrypted_snapshot, embedKey);
17737
+ if (canonicalSnapshot !== row3.snapshot) {
17738
+ throw new Error(`Existing canonical embed ${embed.embed_id} v1 does not match streamed source.`);
17739
+ }
17740
+ continue;
17741
+ }
17742
+ if (existing.status !== 404) {
17743
+ throw new Error(`Canonical embed ${embed.embed_id} v1 read failed (HTTP ${existing.status}).`);
17744
+ }
17745
+ }
17713
17746
  const encryptedSnapshot = typeof row3.snapshot === "string" ? await encryptWithAesGcmCombined(row3.snapshot, embedKey) : void 0;
17714
17747
  const encryptedPatch = typeof row3.patch === "string" ? await encryptWithAesGcmCombined(row3.patch, embedKey) : void 0;
17715
17748
  if (!encryptedSnapshot && !encryptedPatch) continue;
17749
+ const diffRequestId = randomUUID9();
17750
+ const diffConfirmed = params.ws.waitForMessage(
17751
+ "store_embed_diff_confirmed",
17752
+ (payload) => {
17753
+ const p = payload;
17754
+ return p.request_id === diffRequestId && p.embed_id === row3.embed_id && p.version_number === row3.version_number;
17755
+ },
17756
+ 3e4
17757
+ );
17758
+ void diffConfirmed.catch(() => {
17759
+ });
17716
17760
  await params.ws.sendAsync("store_embed_diff", {
17761
+ request_id: diffRequestId,
17717
17762
  embed_id: row3.embed_id,
17718
17763
  version_number: row3.version_number,
17719
17764
  encrypted_snapshot: encryptedSnapshot ?? null,
@@ -17721,6 +17766,11 @@ var OpenMatesClient = class _OpenMatesClient {
17721
17766
  hashed_user_id: hashedUserId,
17722
17767
  created_at: normalizeUnixSeconds(row3.created_at, now)
17723
17768
  });
17769
+ const diffReceipt = (await diffConfirmed).payload;
17770
+ const expectedDigest = computeSHA256(JSON.stringify([encryptedSnapshot ?? null, encryptedPatch ?? null]));
17771
+ if (diffReceipt.canonical_source !== "version_row" || diffReceipt.canonical_digest !== expectedDigest) {
17772
+ throw new Error(`Embed ${embed.embed_id} v${row3.version_number} durable receipt did not match the stored source.`);
17773
+ }
17724
17774
  }
17725
17775
  }
17726
17776
  };
@@ -21974,7 +22024,7 @@ Required: ${schema.required.join(", ")}`
21974
22024
  * The sync cache stores encrypted data — decryption is always on-demand.
21975
22025
  * SECURITY: decrypted user content is NEVER written to disk.
21976
22026
  */
21977
- async ensureSynced(forceRefresh = false, refreshChatIds = [], options = {}, includeMessageContentRefresh = false, onSyncedCache, signal) {
22027
+ async ensureSynced(forceRefresh = false, refreshChatIds = [], options = {}, includeMessageContentRefresh = false, onSyncedCache, signal, syncBehavior = {}) {
21978
22028
  signal?.throwIfAborted();
21979
22029
  const teamId = this.resolveTeamContext(options);
21980
22030
  const syncMasterKey = Buffer.from(this.getMasterKeyBytes());
@@ -22211,7 +22261,7 @@ Required: ${schema.required.join(", ")}`
22211
22261
  await ws.waitForRecoveryOutputDiscovery();
22212
22262
  signal?.throwIfAborted();
22213
22263
  const pages = ws.drainAvailableRecoveryOutputPages();
22214
- if (pages.length > 0) {
22264
+ if (pages.length > 0 && !syncBehavior.skipTypedRecoveryOutputReplay) {
22215
22265
  if (!ownerId2) throw new Error("Authenticated owner identity is required for recovery output replay.");
22216
22266
  const currentCache = {
22217
22267
  syncedAt: Date.now(),
@@ -22255,7 +22305,15 @@ Required: ${schema.required.join(", ")}`
22255
22305
  signal?.throwIfAborted();
22256
22306
  if (persistedTaskJobIds.size > 0 || persistedWorkflowDeliveryCount > 0 || recoveredOutputCount > 0) {
22257
22307
  this.invalidateSyncedHistory(teamId);
22258
- return this.ensureSynced(true, refreshChatIds, { teamId }, includeMessageContentRefresh, onSyncedCache, signal);
22308
+ return this.ensureSynced(
22309
+ true,
22310
+ refreshChatIds,
22311
+ { teamId },
22312
+ includeMessageContentRefresh,
22313
+ onSyncedCache,
22314
+ signal,
22315
+ syncBehavior
22316
+ );
22259
22317
  }
22260
22318
  const cache = {
22261
22319
  syncedAt: Date.now(),
@@ -3828,7 +3828,9 @@ declare class OpenMatesClient {
3828
3828
  * The sync cache stores encrypted data — decryption is always on-demand.
3829
3829
  * SECURITY: decrypted user content is NEVER written to disk.
3830
3830
  */
3831
- ensureSynced(forceRefresh?: boolean, refreshChatIds?: string[], options?: TeamContextOptions, includeMessageContentRefresh?: boolean, onSyncedCache?: (cache: SyncCache) => Promise<void>, signal?: AbortSignal): Promise<SyncCache>;
3831
+ ensureSynced(forceRefresh?: boolean, refreshChatIds?: string[], options?: TeamContextOptions, includeMessageContentRefresh?: boolean, onSyncedCache?: (cache: SyncCache) => Promise<void>, signal?: AbortSignal, syncBehavior?: {
3832
+ skipTypedRecoveryOutputReplay?: boolean;
3833
+ }): Promise<SyncCache>;
3832
3834
  /**
3833
3835
  * Claim and finish reconnect workflow deliveries using only normal client
3834
3836
  * ciphertext. A fenced server transaction persists chat/message/selected
package/dist/cli.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- export { ak as ImagesAiDetectionClassification, al as ImagesAiDetectionSummary, aK as assertTrustedAccountCommandAllowed, aL as assertTrustedAccountGuardEnvironment, aC as buildImagesAiDetectionSummary, aM as buildProjectDefaultFocus, aN as buildTravelConnectionsRequest, aD as classifyImagesAiDetection, aO as extractExplicitProjectMentions, aF as formatImagesAiDetectionLabel, aG as getExtForLang, aP as handleWiki, aQ as printWhoAmI, aR as readRootProjectInstructions, aS as renderProjectReadApprovalRequest, aT as renderProjectWriteApprovalRequest, aU as renderRemoteCommandEvent, aV as requireExactConfirmation, aW as resolveProjectContext, aJ as serializeToYaml, aX as shouldRequireTrustedAccountGuard, aY as waitForSafeE2ETotpWindow, aZ as waitForWorkflowRun } from './cli-bEgF9_RV.js';
2
+ export { ak as ImagesAiDetectionClassification, al as ImagesAiDetectionSummary, aK as assertTrustedAccountCommandAllowed, aL as assertTrustedAccountGuardEnvironment, aC as buildImagesAiDetectionSummary, aM as buildProjectDefaultFocus, aN as buildTravelConnectionsRequest, aD as classifyImagesAiDetection, aO as extractExplicitProjectMentions, aF as formatImagesAiDetectionLabel, aG as getExtForLang, aP as handleWiki, aQ as printWhoAmI, aR as readRootProjectInstructions, aS as renderProjectReadApprovalRequest, aT as renderProjectWriteApprovalRequest, aU as renderRemoteCommandEvent, aV as requireExactConfirmation, aW as resolveProjectContext, aJ as serializeToYaml, aX as shouldRequireTrustedAccountGuard, aY as waitForSafeE2ETotpWindow, aZ as waitForWorkflowRun } from './cli-B0wAUh-J.js';
3
3
  import '@repo/pairing-crypto/direct-chat';
package/dist/cli.js CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  shouldRequireTrustedAccountGuard,
22
22
  waitForSafeE2ETotpWindow,
23
23
  waitForWorkflowRun
24
- } from "./chunk-D6TL3ILK.js";
24
+ } from "./chunk-VRRTQJWZ.js";
25
25
  import "./chunk-Q6PGA2B3.js";
26
26
  import "./chunk-IWKP55ZB.js";
27
27
  import "./chunk-F2U6KIMR.js";
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { O as OpenMatesSession, U as UserPlanStatus, a as UserPlanRecord, b as UserPlanVerificationStatus, c as UserPlanLearningType, d as UserPlanLearningTargetKind, e as UserPlanLearningStatus, f as UserPlanLearningLevel, g as UserPlanLearningRecord, h as UserPlanCriterionRecord, i as UserPlanVerificationRecord, j as UserPlanCreateInput, k as UserPlanUpdateInput, B as BuyerAddress, P as ProjectItemRecord, T as TaskCreateOptions, l as TaskUpdateOptions, m as UserPlanLearningCreateTasksInput, n as UserPlanLearningCreateTasksResult, o as UserTaskStatus, E as ExternalChatContext, p as TaskPriorityLevel, D as DecryptedUserTask, q as DecryptedTaskActivityEntry, r as TaskActivityCreateOptions, s as UserTaskReorderInput, W as WorkflowSummary, t as WorkflowCapability, u as WorkflowDetail, v as WorkflowAuthoringWarning, w as WorkflowInputStartParams, x as WorkflowInputSessionResult, y as WorkflowInputSessionDetail, z as WorkflowInputEvent, A as WorkflowGraph, C as WorkflowRunContentRetention, F as WorkflowRunOnceOptions, G as WorkflowRunDetail, H as WorkflowRunOptions, I as WorkflowNode, J as WorkflowRunCancellationResult, K as WorkflowTemplateProjectionUpsertParams, L as WorkflowTemplateProjectionResult, M as PublicWorkflowTemplateProjection, N as WorkflowTemplateProjectionRevocationResult, Q as WorkflowTemplateBindingCompletionParams, R as WorkflowTemplateBindingCompletionResult, S as WorkflowTemplateShortUrlParams, V as WorkflowTemplateShortUrlResult, X as ShortUrlRevokeResult, Y as WorkflowTemplateImportPayload, Z as ImportedWorkflowTemplate, _ as WikipediaLearningBundle } from './cli-bEgF9_RV.js';
2
- export { $ as AuthMethodsStatus, a0 as AuthoritativeChatReconciliation, a1 as BackupCodesResult, a2 as BankTransferOrderDetails, a3 as BankTransferStatus, a4 as CachedChat, a5 as CachedNewChatSuggestion, a6 as ChatListPage, a7 as CliSignupResult, a8 as DecryptedDraft, a9 as DecryptedEmbed, aa as DecryptedMemoryEntry, ab as DecryptedMessage, ac as DecryptedNewChatSuggestion, ad as DocsFile, ae as DocsFolder, af as DocsSearchResult, ag as DocsTree, ah as EncryptedDraft, ai as GiftCardBankTransferStatus, aj as INTEREST_TAG_IDS, ak as ImagesAiDetectionClassification, al as ImagesAiDetectionSummary, am as InterestTagId, an as MATE_NAMES, ao as MEMORY_TYPE_REGISTRY, ap as MemoryFieldDef, aq as MemoryTypeDef, ar as OpenMatesClient, as as OpenMatesClientOptions, at as SyncCache, au as TopicPreferencesPayload, av as TotpSetupStartResult, aw as WorkflowEdge, ax as WorkflowNodeRun, ay as WorkflowNodeType, az as WorkflowReturnedOutputReference, aA as WorkflowRunContentStorage, aB as WorkflowRunRouting, aC as buildImagesAiDetectionSummary, aD as classifyImagesAiDetection, aE as deriveAppUrl, aF as formatImagesAiDetectionLabel, aG as getExtForLang, aH as normalizeInterestTagIds, aI as reconcileAuthoritativeChats, aJ as serializeToYaml } from './cli-bEgF9_RV.js';
1
+ import { O as OpenMatesSession, U as UserPlanStatus, a as UserPlanRecord, b as UserPlanVerificationStatus, c as UserPlanLearningType, d as UserPlanLearningTargetKind, e as UserPlanLearningStatus, f as UserPlanLearningLevel, g as UserPlanLearningRecord, h as UserPlanCriterionRecord, i as UserPlanVerificationRecord, j as UserPlanCreateInput, k as UserPlanUpdateInput, B as BuyerAddress, P as ProjectItemRecord, T as TaskCreateOptions, l as TaskUpdateOptions, m as UserPlanLearningCreateTasksInput, n as UserPlanLearningCreateTasksResult, o as UserTaskStatus, E as ExternalChatContext, p as TaskPriorityLevel, D as DecryptedUserTask, q as DecryptedTaskActivityEntry, r as TaskActivityCreateOptions, s as UserTaskReorderInput, W as WorkflowSummary, t as WorkflowCapability, u as WorkflowDetail, v as WorkflowAuthoringWarning, w as WorkflowInputStartParams, x as WorkflowInputSessionResult, y as WorkflowInputSessionDetail, z as WorkflowInputEvent, A as WorkflowGraph, C as WorkflowRunContentRetention, F as WorkflowRunOnceOptions, G as WorkflowRunDetail, H as WorkflowRunOptions, I as WorkflowNode, J as WorkflowRunCancellationResult, K as WorkflowTemplateProjectionUpsertParams, L as WorkflowTemplateProjectionResult, M as PublicWorkflowTemplateProjection, N as WorkflowTemplateProjectionRevocationResult, Q as WorkflowTemplateBindingCompletionParams, R as WorkflowTemplateBindingCompletionResult, S as WorkflowTemplateShortUrlParams, V as WorkflowTemplateShortUrlResult, X as ShortUrlRevokeResult, Y as WorkflowTemplateImportPayload, Z as ImportedWorkflowTemplate, _ as WikipediaLearningBundle } from './cli-B0wAUh-J.js';
2
+ export { $ as AuthMethodsStatus, a0 as AuthoritativeChatReconciliation, a1 as BackupCodesResult, a2 as BankTransferOrderDetails, a3 as BankTransferStatus, a4 as CachedChat, a5 as CachedNewChatSuggestion, a6 as ChatListPage, a7 as CliSignupResult, a8 as DecryptedDraft, a9 as DecryptedEmbed, aa as DecryptedMemoryEntry, ab as DecryptedMessage, ac as DecryptedNewChatSuggestion, ad as DocsFile, ae as DocsFolder, af as DocsSearchResult, ag as DocsTree, ah as EncryptedDraft, ai as GiftCardBankTransferStatus, aj as INTEREST_TAG_IDS, ak as ImagesAiDetectionClassification, al as ImagesAiDetectionSummary, am as InterestTagId, an as MATE_NAMES, ao as MEMORY_TYPE_REGISTRY, ap as MemoryFieldDef, aq as MemoryTypeDef, ar as OpenMatesClient, as as OpenMatesClientOptions, at as SyncCache, au as TopicPreferencesPayload, av as TotpSetupStartResult, aw as WorkflowEdge, ax as WorkflowNodeRun, ay as WorkflowNodeType, az as WorkflowReturnedOutputReference, aA as WorkflowRunContentStorage, aB as WorkflowRunRouting, aC as buildImagesAiDetectionSummary, aD as classifyImagesAiDetection, aE as deriveAppUrl, aF as formatImagesAiDetectionLabel, aG as getExtForLang, aH as normalizeInterestTagIds, aI as reconcileAuthoritativeChats, aJ as serializeToYaml } from './cli-B0wAUh-J.js';
3
3
  import { DirectChatKeyPair } from '@repo/pairing-crypto/direct-chat';
4
4
 
5
5
  type ChatModelSelection = "auto" | (string & {});
package/dist/index.js CHANGED
@@ -44,7 +44,7 @@ import {
44
44
  selectAssistantMessagesForSpeech,
45
45
  serializeToYaml,
46
46
  summarizeAssistantSpeech
47
- } from "./chunk-D6TL3ILK.js";
47
+ } from "./chunk-VRRTQJWZ.js";
48
48
  import "./chunk-Q6PGA2B3.js";
49
49
  import "./chunk-IWKP55ZB.js";
50
50
  import "./chunk-F2U6KIMR.js";
@@ -17,47 +17,47 @@
17
17
  {
18
18
  "name": "libggml-base.so",
19
19
  "bytes": 1110088,
20
- "sha256": "bdb1a65cc110d622ca0ca0a9274b9a9f0949d86e0f6136b8b5d159a685096c44"
20
+ "sha256": "104a3ba6bea2068f8c336daeb02b1034abaea3d4adff4efa65cecb4c82058553"
21
21
  },
22
22
  {
23
23
  "name": "libggml-base.so.0",
24
24
  "bytes": 1110088,
25
- "sha256": "bdb1a65cc110d622ca0ca0a9274b9a9f0949d86e0f6136b8b5d159a685096c44"
25
+ "sha256": "104a3ba6bea2068f8c336daeb02b1034abaea3d4adff4efa65cecb4c82058553"
26
26
  },
27
27
  {
28
28
  "name": "libggml-base.so.0.15.1",
29
29
  "bytes": 1110088,
30
- "sha256": "bdb1a65cc110d622ca0ca0a9274b9a9f0949d86e0f6136b8b5d159a685096c44"
30
+ "sha256": "104a3ba6bea2068f8c336daeb02b1034abaea3d4adff4efa65cecb4c82058553"
31
31
  },
32
32
  {
33
33
  "name": "libggml-cpu.so",
34
34
  "bytes": 869800,
35
- "sha256": "fc1ed2b090628912eee7d6618014efe0be9bec527adf108677873c796a22eb7d"
35
+ "sha256": "b85fde7ee4ae941a206b58c885827ed0b50a0ddf291e58afe2b84bfbbe21359a"
36
36
  },
37
37
  {
38
38
  "name": "libggml-cpu.so.0",
39
39
  "bytes": 869800,
40
- "sha256": "fc1ed2b090628912eee7d6618014efe0be9bec527adf108677873c796a22eb7d"
40
+ "sha256": "b85fde7ee4ae941a206b58c885827ed0b50a0ddf291e58afe2b84bfbbe21359a"
41
41
  },
42
42
  {
43
43
  "name": "libggml-cpu.so.0.15.1",
44
44
  "bytes": 869800,
45
- "sha256": "fc1ed2b090628912eee7d6618014efe0be9bec527adf108677873c796a22eb7d"
45
+ "sha256": "b85fde7ee4ae941a206b58c885827ed0b50a0ddf291e58afe2b84bfbbe21359a"
46
46
  },
47
47
  {
48
48
  "name": "libggml.so",
49
49
  "bytes": 1899104,
50
- "sha256": "53aac984ca4703e965c1cbc9cbb49aa21126558f566695c441d932c18a03a3fd"
50
+ "sha256": "4428f75f410d7b6b4dba98ee0f2502c428ef9b7b8159a1a6efa71f38b7fc8e77"
51
51
  },
52
52
  {
53
53
  "name": "libggml.so.0",
54
54
  "bytes": 1899104,
55
- "sha256": "53aac984ca4703e965c1cbc9cbb49aa21126558f566695c441d932c18a03a3fd"
55
+ "sha256": "4428f75f410d7b6b4dba98ee0f2502c428ef9b7b8159a1a6efa71f38b7fc8e77"
56
56
  },
57
57
  {
58
58
  "name": "libggml.so.0.15.1",
59
59
  "bytes": 1899104,
60
- "sha256": "53aac984ca4703e965c1cbc9cbb49aa21126558f566695c441d932c18a03a3fd"
60
+ "sha256": "4428f75f410d7b6b4dba98ee0f2502c428ef9b7b8159a1a6efa71f38b7fc8e77"
61
61
  },
62
62
  {
63
63
  "name": "openmates-pii-worker",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openmates",
3
- "version": "0.27.0-alpha.63",
3
+ "version": "0.27.0-alpha.65",
4
4
  "description": "OpenMates CLI and SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",