openmates 0.18.0-alpha.47 → 0.18.0-alpha.49

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.
@@ -11039,7 +11039,7 @@ var OpenMatesClient = class _OpenMatesClient {
11039
11039
  let memoryMetadataKeys = [];
11040
11040
  if (!params.incognito) {
11041
11041
  try {
11042
- availableMemories = await this.listMemories({ teamId });
11042
+ availableMemories = params.memorySnapshot ?? await this.listMemories({ teamId });
11043
11043
  memoryCountsLoaded = true;
11044
11044
  memoryMetadataKeys = [
11045
11045
  ...new Set(
@@ -14772,9 +14772,9 @@ var OpenMatesClient = class _OpenMatesClient {
14772
14772
  // -------------------------------------------------------------------------
14773
14773
  /**
14774
14774
  * List all memories for the current user, decrypted.
14775
- * Fetches from the GDPR export endpoint and decrypts each entry with the master key.
14775
+ * Fetches from the owner-scoped memory surface and decrypts each entry with the master key.
14776
14776
  */
14777
- async sdkGetMemories(teamId) {
14777
+ async sdkGetTeamMemories(teamId) {
14778
14778
  const response = await this.http.get(
14779
14779
  `/v1/teams/${encodeURIComponent(teamId)}/memories`,
14780
14780
  this.getCliRequestHeaders()
@@ -14782,13 +14782,27 @@ var OpenMatesClient = class _OpenMatesClient {
14782
14782
  if (!response.ok) throw new Error(`Team memory list failed with HTTP ${response.status}`);
14783
14783
  return response.data.memories ?? [];
14784
14784
  }
14785
+ async sdkGetPersonalMemories() {
14786
+ const response = await this.http.get(
14787
+ "/v1/sdk/memories",
14788
+ this.getCliRequestHeaders()
14789
+ );
14790
+ if (response.ok) return response.data.memories ?? [];
14791
+ if (response.status !== 404 && response.status !== 501) {
14792
+ throw Object.assign(
14793
+ new Error(`Personal memory list failed with HTTP ${response.status}`),
14794
+ { status: response.status, retryAfterMs: response.retryAfterMs }
14795
+ );
14796
+ }
14797
+ const legacy = await this.settingsGet(
14798
+ "/v1/settings/export-account-data?include_usage=false&include_invoices=false"
14799
+ );
14800
+ return legacy.data?.app_settings_memories ?? [];
14801
+ }
14785
14802
  async listMemories(options = {}) {
14786
14803
  const masterKey = this.getMasterKeyBytes();
14787
14804
  const teamId = this.resolveTeamContext(options);
14788
- const data = teamId ? { data: { app_settings_memories: await this.sdkGetMemories(teamId) } } : await this.settingsGet(
14789
- "/v1/settings/export-account-data?include_usage=false&include_invoices=false"
14790
- );
14791
- const rawEntries = data.data?.app_settings_memories ?? [];
14805
+ const rawEntries = teamId ? await this.sdkGetTeamMemories(teamId) : await this.sdkGetPersonalMemories();
14792
14806
  const results = [];
14793
14807
  for (const raw of rawEntries) {
14794
14808
  const encryptedJson = typeof raw.encrypted_item_json === "string" ? raw.encrypted_item_json : null;
@@ -15378,7 +15392,7 @@ Required: ${schema.required.join(", ")}`
15378
15392
  *
15379
15393
  * Mirrors: mentionSearchService.ts data sources
15380
15394
  */
15381
- async buildMentionContext() {
15395
+ async buildMentionContext(options = {}) {
15382
15396
  let apps = [];
15383
15397
  try {
15384
15398
  const data = await this.listApps();
@@ -15387,7 +15401,7 @@ Required: ${schema.required.join(", ")}`
15387
15401
  }
15388
15402
  let memoryEntries = [];
15389
15403
  try {
15390
- const memories = await this.listMemories();
15404
+ const memories = options.memorySnapshot ?? await this.listMemories();
15391
15405
  memoryEntries = memories.map((m) => ({
15392
15406
  id: m.id,
15393
15407
  app_id: m.app_id,
@@ -52040,6 +52054,9 @@ Only output the final Markdown table. Do NOT include explanations, notes, or any
52040
52054
  transcribing_via: {
52041
52055
  text: "Transcribing via {model}\u2026"
52042
52056
  },
52057
+ auto_correcting: {
52058
+ text: "Auto correction\u2026"
52059
+ },
52043
52060
  transcribed_by: {
52044
52061
  text: "Transcribed by {model}:"
52045
52062
  },
@@ -77241,15 +77258,6 @@ async function main() {
77241
77258
  await enforceTrustedAccount(client);
77242
77259
  }
77243
77260
  const redactor = new OutputRedactor();
77244
- const piiDetectionEnabled = parsed.flags["no-pii-detection"] !== true;
77245
- if (piiDetectionEnabled && shouldInitializeRedactor(command, subcommand)) {
77246
- try {
77247
- const memories = client.hasSession() ? await client.listMemories() : [];
77248
- redactor.initializeFromMemories(memories);
77249
- } catch {
77250
- redactor.initializeFromMemories([]);
77251
- }
77252
- }
77253
77261
  if (!command) {
77254
77262
  if (parsed.flags.version !== void 0) {
77255
77263
  handleCliVersion(parsed.flags);
@@ -80951,9 +80959,6 @@ async function createEncryptedRemoteAccessProject(client, masterKey, name, conte
80951
80959
  encrypted: payload
80952
80960
  };
80953
80961
  }
80954
- function shouldInitializeRedactor(command, subcommand) {
80955
- return command === "chats" && ["new", "send", "answer-interactive", "incognito"].includes(subcommand ?? "");
80956
- }
80957
80962
  function parseJsonFlag(value, flagName) {
80958
80963
  try {
80959
80964
  return JSON.parse(value);
@@ -86368,6 +86373,25 @@ ${String(response.assistant ?? "")}
86368
86373
  }
86369
86374
  }
86370
86375
  async function sendMessageStreaming(client, params, redactor) {
86376
+ let memorySnapshot = [];
86377
+ const needsMemorySnapshot = client.hasSession() && (params.incognito !== true || params.piiDetection !== false || params.message.includes("@"));
86378
+ if (needsMemorySnapshot) {
86379
+ try {
86380
+ memorySnapshot = await client.listMemories({
86381
+ teamId: params.teamId,
86382
+ personal: params.personal
86383
+ });
86384
+ } catch (error) {
86385
+ if (params.autoApproveMemories && params.incognito !== true) {
86386
+ const message = error instanceof Error ? error.message : String(error);
86387
+ throw new Error(`Failed to load memories for auto-approval: ${message}`);
86388
+ }
86389
+ memorySnapshot = [];
86390
+ }
86391
+ }
86392
+ if (params.piiDetection !== false && redactor) {
86393
+ redactor.initializeFromMemories(memorySnapshot);
86394
+ }
86371
86395
  let headerPrinted = false;
86372
86396
  let typingShown = false;
86373
86397
  const renderedEmbedIds = /* @__PURE__ */ new Set();
@@ -86488,7 +86512,7 @@ async function sendMessageStreaming(client, params, redactor) {
86488
86512
  (query, language, limit) => client.searchWikipediaTitles(query, language, limit)
86489
86513
  );
86490
86514
  resolvedWikipediaMentions = wikipediaResult.resolved;
86491
- const mentionCtx = await client.buildMentionContext();
86515
+ const mentionCtx = await client.buildMentionContext({ memorySnapshot });
86492
86516
  const parsed = parseMentions(wikipediaResult.processedMessage, mentionCtx);
86493
86517
  finalMessage = parsed.processedMessage;
86494
86518
  const unresolvedMentions = parsed.unresolved.filter(
@@ -86725,6 +86749,7 @@ async function sendMessageStreaming(client, params, redactor) {
86725
86749
  autoApproveMemories: params.autoApproveMemories,
86726
86750
  taskUpdateJobs: params.taskUpdateJobs,
86727
86751
  responseTimeoutMs: params.responseTimeoutMs,
86752
+ memorySnapshot,
86728
86753
  preparedEmbeds: preparedEmbeds.length > 0 ? preparedEmbeds : void 0,
86729
86754
  piiMappings: piiResult.mappings.map((mapping) => ({
86730
86755
  placeholder: mapping.placeholder,
@@ -2287,6 +2287,12 @@ declare class OpenMatesClient {
2287
2287
  benchmarkMetadata?: BenchmarkMetadata;
2288
2288
  /** Full plaintext history for incognito benchmark turns. */
2289
2289
  messageHistory?: BenchmarkHistoryMessage[];
2290
+ /**
2291
+ * Decrypted memories already loaded by the command preparing this turn.
2292
+ * Reusing this snapshot keeps PII redaction, mention resolution, memory
2293
+ * metadata, and approval on one consistent owner-scoped read.
2294
+ */
2295
+ memorySnapshot?: DecryptedMemoryEntry[];
2290
2296
  /** Account-wide Learning Mode context when already known by the caller. */
2291
2297
  learningMode?: LearningModeContext;
2292
2298
  /** Start collecting before send for latency-sensitive benchmark turns. */
@@ -2760,9 +2766,10 @@ declare class OpenMatesClient {
2760
2766
  private _getPublicInspirations;
2761
2767
  /**
2762
2768
  * List all memories for the current user, decrypted.
2763
- * Fetches from the GDPR export endpoint and decrypts each entry with the master key.
2769
+ * Fetches from the owner-scoped memory surface and decrypts each entry with the master key.
2764
2770
  */
2765
- private sdkGetMemories;
2771
+ private sdkGetTeamMemories;
2772
+ private sdkGetPersonalMemories;
2766
2773
  listMemories(options?: TeamContextOptions): Promise<DecryptedMemoryEntry[]>;
2767
2774
  /**
2768
2775
  * Create a new memory entry with schema validation.
@@ -2881,7 +2888,9 @@ declare class OpenMatesClient {
2881
2888
  *
2882
2889
  * Mirrors: mentionSearchService.ts data sources
2883
2890
  */
2884
- buildMentionContext(): Promise<MentionContext>;
2891
+ buildMentionContext(options?: {
2892
+ memorySnapshot?: DecryptedMemoryEntry[];
2893
+ }): Promise<MentionContext>;
2885
2894
  private normalizePath;
2886
2895
  private downloadPaymentPdf;
2887
2896
  private ensureEmailEncryptionKey;
package/dist/cli.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- export { ae as ImagesAiDetectionClassification, af as ImagesAiDetectionSummary, aD as assertTrustedAccountCommandAllowed, aE as assertTrustedAccountGuardEnvironment, av as buildImagesAiDetectionSummary, aF as buildTravelConnectionsRequest, aw as classifyImagesAiDetection, ay as formatImagesAiDetectionLabel, az as getExtForLang, aG as printWhoAmI, aH as requireExactConfirmation, aI as resolveProjectContext, aC as serializeToYaml, aJ as shouldRequireTrustedAccountGuard, aK as waitForWorkflowRun } from './cli-BP60bZtx.js';
2
+ export { ae as ImagesAiDetectionClassification, af as ImagesAiDetectionSummary, aD as assertTrustedAccountCommandAllowed, aE as assertTrustedAccountGuardEnvironment, av as buildImagesAiDetectionSummary, aF as buildTravelConnectionsRequest, aw as classifyImagesAiDetection, ay as formatImagesAiDetectionLabel, az as getExtForLang, aG as printWhoAmI, aH as requireExactConfirmation, aI as resolveProjectContext, aC as serializeToYaml, aJ as shouldRequireTrustedAccountGuard, aK as waitForWorkflowRun } from './cli-IZIs_CNO.js';
package/dist/cli.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  serializeToYaml,
14
14
  shouldRequireTrustedAccountGuard,
15
15
  waitForWorkflowRun
16
- } from "./chunk-WS4JQQON.js";
16
+ } from "./chunk-B3CTTIEY.js";
17
17
  import "./chunk-IWKP55ZB.js";
18
18
  import "./chunk-BBKJZ23O.js";
19
19
  export {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { 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, 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 WorkflowInputStartParams, w as WorkflowInputSessionResult, x as WorkflowInputSessionDetail, y as WorkflowInputEvent, z as WorkflowGraph, A as WorkflowRunContentRetention, B as WorkflowRunDetail, C as WorkflowNode, F as WorkflowRunCancellationResult, G as WorkflowTemplateProjectionUpsertParams, H as WorkflowTemplateProjectionResult, I as PublicWorkflowTemplateProjection, J as WorkflowTemplateProjectionRevocationResult, K as WorkflowTemplateBindingCompletionParams, L as WorkflowTemplateBindingCompletionResult, M as WorkflowTemplateShortUrlParams, N as WorkflowTemplateShortUrlResult, S as ShortUrlRevokeResult, O as WorkflowTemplateImportPayload, Q as ImportedWorkflowTemplate } from './cli-BP60bZtx.js';
2
- export { R as AuthMethodsStatus, V as AuthoritativeChatReconciliation, X as BackupCodesResult, Y as BankTransferOrderDetails, Z as BankTransferStatus, _ as CachedChat, $ as CachedNewChatSuggestion, a0 as ChatListPage, a1 as CliSignupResult, a2 as DecryptedDraft, a3 as DecryptedEmbed, a4 as DecryptedMemoryEntry, a5 as DecryptedMessage, a6 as DecryptedNewChatSuggestion, a7 as DocsFile, a8 as DocsFolder, a9 as DocsSearchResult, aa as DocsTree, ab as EncryptedDraft, ac as GiftCardBankTransferStatus, ad as INTEREST_TAG_IDS, ae as ImagesAiDetectionClassification, af as ImagesAiDetectionSummary, ag as InterestTagId, ah as MATE_NAMES, ai as MEMORY_TYPE_REGISTRY, aj as MemoryFieldDef, ak as MemoryTypeDef, al as OpenMatesClient, am as OpenMatesClientOptions, an as OpenMatesSession, ao as SyncCache, ap as TopicPreferencesPayload, aq as TotpSetupStartResult, ar as WorkflowEdge, as as WorkflowNodeRun, at as WorkflowNodeType, au as WorkflowRunContentStorage, av as buildImagesAiDetectionSummary, aw as classifyImagesAiDetection, ax as deriveAppUrl, ay as formatImagesAiDetectionLabel, az as getExtForLang, aA as normalizeInterestTagIds, aB as reconcileAuthoritativeChats, aC as serializeToYaml } from './cli-BP60bZtx.js';
1
+ import { 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, 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 WorkflowInputStartParams, w as WorkflowInputSessionResult, x as WorkflowInputSessionDetail, y as WorkflowInputEvent, z as WorkflowGraph, A as WorkflowRunContentRetention, B as WorkflowRunDetail, C as WorkflowNode, F as WorkflowRunCancellationResult, G as WorkflowTemplateProjectionUpsertParams, H as WorkflowTemplateProjectionResult, I as PublicWorkflowTemplateProjection, J as WorkflowTemplateProjectionRevocationResult, K as WorkflowTemplateBindingCompletionParams, L as WorkflowTemplateBindingCompletionResult, M as WorkflowTemplateShortUrlParams, N as WorkflowTemplateShortUrlResult, S as ShortUrlRevokeResult, O as WorkflowTemplateImportPayload, Q as ImportedWorkflowTemplate } from './cli-IZIs_CNO.js';
2
+ export { R as AuthMethodsStatus, V as AuthoritativeChatReconciliation, X as BackupCodesResult, Y as BankTransferOrderDetails, Z as BankTransferStatus, _ as CachedChat, $ as CachedNewChatSuggestion, a0 as ChatListPage, a1 as CliSignupResult, a2 as DecryptedDraft, a3 as DecryptedEmbed, a4 as DecryptedMemoryEntry, a5 as DecryptedMessage, a6 as DecryptedNewChatSuggestion, a7 as DocsFile, a8 as DocsFolder, a9 as DocsSearchResult, aa as DocsTree, ab as EncryptedDraft, ac as GiftCardBankTransferStatus, ad as INTEREST_TAG_IDS, ae as ImagesAiDetectionClassification, af as ImagesAiDetectionSummary, ag as InterestTagId, ah as MATE_NAMES, ai as MEMORY_TYPE_REGISTRY, aj as MemoryFieldDef, ak as MemoryTypeDef, al as OpenMatesClient, am as OpenMatesClientOptions, an as OpenMatesSession, ao as SyncCache, ap as TopicPreferencesPayload, aq as TotpSetupStartResult, ar as WorkflowEdge, as as WorkflowNodeRun, at as WorkflowNodeType, au as WorkflowRunContentStorage, av as buildImagesAiDetectionSummary, aw as classifyImagesAiDetection, ax as deriveAppUrl, ay as formatImagesAiDetectionLabel, az as getExtForLang, aA as normalizeInterestTagIds, aB as reconcileAuthoritativeChats, aC as serializeToYaml } from './cli-IZIs_CNO.js';
3
3
 
4
4
  interface ProjectedAssistantSpeechSegment {
5
5
  sequence: number;
package/dist/index.js CHANGED
@@ -42,7 +42,7 @@ import {
42
42
  selectAssistantMessagesForSpeech,
43
43
  serializeToYaml,
44
44
  summarizeAssistantSpeech
45
- } from "./chunk-WS4JQQON.js";
45
+ } from "./chunk-B3CTTIEY.js";
46
46
  import "./chunk-IWKP55ZB.js";
47
47
  import "./chunk-BBKJZ23O.js";
48
48
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openmates",
3
- "version": "0.18.0-alpha.47",
3
+ "version": "0.18.0-alpha.49",
4
4
  "description": "OpenMates CLI and SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",