openmates 0.27.0-alpha.45 → 0.27.0-alpha.46

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.
@@ -5403,6 +5403,8 @@ var OpenMatesWsClient = class {
5403
5403
  let tokenUsage = null;
5404
5404
  let promptBudget = null;
5405
5405
  let recoveryJobId = null;
5406
+ let recoveryFinal = null;
5407
+ const recoveryCreatedAt = () => recoveryFinal && recoveryJobId === recoveryFinal.jobId && messageId === recoveryFinal.assistantId && options?.recoveryTurnId === recoveryFinal.turnId ? recoveryFinal.createdAt : null;
5406
5408
  const compressionCheckpoints = [];
5407
5409
  let followUpSuggestions = [];
5408
5410
  let newChatSuggestions = [];
@@ -5484,6 +5486,15 @@ var OpenMatesWsClient = class {
5484
5486
  if (typeof p.recovery_job_id === "string" && p.recovery_job_id && p.recovery_protocol_version === 1)
5485
5487
  recoveryJobId = p.recovery_job_id;
5486
5488
  };
5489
+ const captureRecoveryFinal = (p) => {
5490
+ if (p.chat_id !== chatId || p.user_message_id !== userMessageId || p.recovery_protocol_version !== 1 || typeof p.message_id !== "string" || !p.message_id || typeof p.recovery_job_id !== "string" || !p.recovery_job_id || typeof p.recovery_turn_id !== "string" || !p.recovery_turn_id || p.recovery_turn_id !== options?.recoveryTurnId || !Number.isSafeInteger(p.created_at) || Number(p.created_at) <= 0) return;
5491
+ recoveryFinal = {
5492
+ assistantId: p.message_id,
5493
+ jobId: p.recovery_job_id,
5494
+ turnId: p.recovery_turn_id,
5495
+ createdAt: Number(p.created_at)
5496
+ };
5497
+ };
5487
5498
  const extractMessageContent = (message) => {
5488
5499
  if (typeof message.content === "string") return message.content;
5489
5500
  const content = message.content;
@@ -5528,6 +5539,7 @@ var OpenMatesWsClient = class {
5528
5539
  embeds: [...embeds.values()],
5529
5540
  subChatEvents,
5530
5541
  recoveryJobId,
5542
+ recoveryCreatedAt: recoveryCreatedAt(),
5531
5543
  compressionCheckpoints,
5532
5544
  tokenUsage,
5533
5545
  promptBudget
@@ -5565,6 +5577,7 @@ var OpenMatesWsClient = class {
5565
5577
  embeds: [...embeds.values()],
5566
5578
  subChatEvents,
5567
5579
  recoveryJobId,
5580
+ recoveryCreatedAt: recoveryCreatedAt(),
5568
5581
  compressionCheckpoints,
5569
5582
  tokenUsage,
5570
5583
  promptBudget
@@ -5597,6 +5610,7 @@ var OpenMatesWsClient = class {
5597
5610
  embeds: [...embeds.values()],
5598
5611
  subChatEvents,
5599
5612
  recoveryJobId,
5613
+ recoveryCreatedAt: recoveryCreatedAt(),
5600
5614
  compressionCheckpoints,
5601
5615
  tokenUsage,
5602
5616
  promptBudget
@@ -5715,6 +5729,7 @@ var OpenMatesWsClient = class {
5715
5729
  aiResponseDone = false;
5716
5730
  postProcessingDone = false;
5717
5731
  recoveryJobId = null;
5732
+ recoveryFinal = null;
5718
5733
  latestContent = "";
5719
5734
  if (postProcessingTimer) {
5720
5735
  clearTimeout(postProcessingTimer);
@@ -5856,6 +5871,7 @@ var OpenMatesWsClient = class {
5856
5871
  latestContent = p.full_content_so_far;
5857
5872
  }
5858
5873
  if (p.is_final_chunk === true) {
5874
+ captureRecoveryFinal(p);
5859
5875
  if (p.awaiting_async_skill_continuation === true) {
5860
5876
  awaitingUnidentifiedAsyncContinuation = true;
5861
5877
  resetTimeout(Math.max(timeoutMs, 20 * 6e4 + 5e3));
@@ -5891,6 +5907,7 @@ var OpenMatesWsClient = class {
5891
5907
  if (p.is_focus_mode_continuation === true) beginFocusModeContinuation();
5892
5908
  beginSubChatContinuation(p);
5893
5909
  capture(p);
5910
+ captureRecoveryFinal(p);
5894
5911
  const content = typeof p.full_content === "string" ? p.full_content : latestContent;
5895
5912
  if (p.awaiting_focus_mode_continuation === true) {
5896
5913
  awaitingFocusModeContinuation = true;
@@ -6016,6 +6033,7 @@ var OpenMatesWsClient = class {
6016
6033
  embeds: [...embeds.values()],
6017
6034
  subChatEvents,
6018
6035
  recoveryJobId,
6036
+ recoveryCreatedAt: recoveryCreatedAt(),
6019
6037
  compressionCheckpoints,
6020
6038
  tokenUsage,
6021
6039
  promptBudget
@@ -10048,6 +10066,12 @@ function normalizeUnixSeconds(value, fallback2) {
10048
10066
  }
10049
10067
  return value > 1e10 ? Math.floor(value / 1e3) : Math.floor(value);
10050
10068
  }
10069
+ function nextPersonalUserCreatedAt(nowSeconds3, predecessorTimestamps) {
10070
+ if (!Number.isSafeInteger(nowSeconds3) || nowSeconds3 <= 0) throw new Error("Personal chat timestamp is invalid.");
10071
+ const latest = predecessorTimestamps.reduce((max, value) => Number.isSafeInteger(value) && value > 0 ? Math.max(max, value) : max, 0);
10072
+ if (latest >= Number.MAX_SAFE_INTEGER) throw new Error("Personal chat timestamp is exhausted.");
10073
+ return Math.max(nowSeconds3, latest + 1);
10074
+ }
10051
10075
  function defaultIdeaBucketProcessingWindowId(date = /* @__PURE__ */ new Date()) {
10052
10076
  return date.toISOString().slice(0, 10);
10053
10077
  }
@@ -15123,7 +15147,8 @@ var OpenMatesClient = class _OpenMatesClient {
15123
15147
  }
15124
15148
  }
15125
15149
  const messageId = randomUUID9();
15126
- const createdAt = Math.floor(Date.now() / 1e3);
15150
+ const wallCreatedAt = Math.floor(Date.now() / 1e3);
15151
+ const createdAt = !teamId && !params.incognito && params.chatId ? nextPersonalUserCreatedAt(wallCreatedAt, savedPrivacyHistory?.messages.map((row3) => row3.createdAt) ?? []) : wallCreatedAt;
15127
15152
  const isNewChat = !params.chatId;
15128
15153
  let messageHistoryForRequest = params.messageHistory;
15129
15154
  if (!params.incognito && !isNewChat && !messageHistoryForRequest) {
@@ -16111,7 +16136,7 @@ var OpenMatesClient = class _OpenMatesClient {
16111
16136
  assistant = recovered.content;
16112
16137
  category = recovered.category;
16113
16138
  modelName = recovered.model_name;
16114
- const completedAt = Math.floor(Date.now() / 1e3);
16139
+ const completedAt = resp.recoveryCreatedAt ?? Math.floor(Date.now() / 1e3);
16115
16140
  const encryptedAssistantContent = await encryptWithAesGcmCombined(
16116
16141
  assistant,
16117
16142
  chatKeyBytes
@@ -360,6 +360,7 @@ declare class OpenMatesWsClient {
360
360
  embeds: SendEmbedDataFrame[];
361
361
  subChatEvents: SubChatEvent[];
362
362
  recoveryJobId: string | null;
363
+ recoveryCreatedAt: number | null;
363
364
  compressionCheckpoints: ChatCompressionCheckpointEvent[];
364
365
  tokenUsage: AiResponseTokenUsage | null;
365
366
  promptBudget: AiResponsePromptBudget | null;
package/dist/cli.d.ts CHANGED
@@ -1,2 +1,2 @@
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-lcUy3XgS.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-D-jTGCjY.js';
package/dist/cli.js CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  shouldRequireTrustedAccountGuard,
22
22
  waitForSafeE2ETotpWindow,
23
23
  waitForWorkflowRun
24
- } from "./chunk-FZQ37KXS.js";
24
+ } from "./chunk-WCND4GFX.js";
25
25
  import "./chunk-B4UXKGH3.js";
26
26
  import "./chunk-IWKP55ZB.js";
27
27
  import "./chunk-FC27KZIW.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-lcUy3XgS.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-lcUy3XgS.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-D-jTGCjY.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-D-jTGCjY.js';
3
3
 
4
4
  type ChatModelSelection = "auto" | (string & {});
5
5
  interface ChatModelCatalogEntry {
package/dist/index.js CHANGED
@@ -44,7 +44,7 @@ import {
44
44
  selectAssistantMessagesForSpeech,
45
45
  serializeToYaml,
46
46
  summarizeAssistantSpeech
47
- } from "./chunk-FZQ37KXS.js";
47
+ } from "./chunk-WCND4GFX.js";
48
48
  import "./chunk-B4UXKGH3.js";
49
49
  import "./chunk-IWKP55ZB.js";
50
50
  import "./chunk-FC27KZIW.js";
@@ -17,47 +17,47 @@
17
17
  {
18
18
  "name": "libggml-base.so",
19
19
  "bytes": 1110088,
20
- "sha256": "038050223c47649a1b2456628d140e08e793ddec00bc5e530a157160ebd1a07f"
20
+ "sha256": "3d3b5f5729c23afbd1ddae2e4dca2a37c010ad8b2f67227dff147a070cc35313"
21
21
  },
22
22
  {
23
23
  "name": "libggml-base.so.0",
24
24
  "bytes": 1110088,
25
- "sha256": "038050223c47649a1b2456628d140e08e793ddec00bc5e530a157160ebd1a07f"
25
+ "sha256": "3d3b5f5729c23afbd1ddae2e4dca2a37c010ad8b2f67227dff147a070cc35313"
26
26
  },
27
27
  {
28
28
  "name": "libggml-base.so.0.15.1",
29
29
  "bytes": 1110088,
30
- "sha256": "038050223c47649a1b2456628d140e08e793ddec00bc5e530a157160ebd1a07f"
30
+ "sha256": "3d3b5f5729c23afbd1ddae2e4dca2a37c010ad8b2f67227dff147a070cc35313"
31
31
  },
32
32
  {
33
33
  "name": "libggml-cpu.so",
34
34
  "bytes": 869800,
35
- "sha256": "ebca462977e567e4f01a98c96385502c5da236776ed5e34b0024691f2f3a4226"
35
+ "sha256": "f823b482cb87acd8e9ba3ec0272c3092a9fcb68cf93eecd20c2ab4c4d27889cf"
36
36
  },
37
37
  {
38
38
  "name": "libggml-cpu.so.0",
39
39
  "bytes": 869800,
40
- "sha256": "ebca462977e567e4f01a98c96385502c5da236776ed5e34b0024691f2f3a4226"
40
+ "sha256": "f823b482cb87acd8e9ba3ec0272c3092a9fcb68cf93eecd20c2ab4c4d27889cf"
41
41
  },
42
42
  {
43
43
  "name": "libggml-cpu.so.0.15.1",
44
44
  "bytes": 869800,
45
- "sha256": "ebca462977e567e4f01a98c96385502c5da236776ed5e34b0024691f2f3a4226"
45
+ "sha256": "f823b482cb87acd8e9ba3ec0272c3092a9fcb68cf93eecd20c2ab4c4d27889cf"
46
46
  },
47
47
  {
48
48
  "name": "libggml.so",
49
49
  "bytes": 1899104,
50
- "sha256": "950459aba85eb2db368deb4b6ff215e3ce06b47a6047ab86e0fe3c60f31edcca"
50
+ "sha256": "b24c630710e35e68d38c99c8d3af584299269fd031807ee7efc5cebb1a51fa69"
51
51
  },
52
52
  {
53
53
  "name": "libggml.so.0",
54
54
  "bytes": 1899104,
55
- "sha256": "950459aba85eb2db368deb4b6ff215e3ce06b47a6047ab86e0fe3c60f31edcca"
55
+ "sha256": "b24c630710e35e68d38c99c8d3af584299269fd031807ee7efc5cebb1a51fa69"
56
56
  },
57
57
  {
58
58
  "name": "libggml.so.0.15.1",
59
59
  "bytes": 1899104,
60
- "sha256": "950459aba85eb2db368deb4b6ff215e3ce06b47a6047ab86e0fe3c60f31edcca"
60
+ "sha256": "b24c630710e35e68d38c99c8d3af584299269fd031807ee7efc5cebb1a51fa69"
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.45",
3
+ "version": "0.27.0-alpha.46",
4
4
  "description": "OpenMates CLI and SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",