@anuma/sdk 10.7.0 → 10.8.0

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/index.d.mts CHANGED
@@ -7881,6 +7881,159 @@ declare function getCreditsUsed(r: ApiResponse): number | undefined;
7881
7881
  */
7882
7882
  declare function getImageModel(r: ApiResponse): string | undefined;
7883
7883
 
7884
+ type ChatRecordKind = "conversation" | "message" | "summary" | "project" | "memory_links" | "setting";
7885
+ type ChatJson = null | boolean | number | string | ChatJson[] | {
7886
+ [key: string]: ChatJson;
7887
+ };
7888
+ /** Whole-record JSON data is encrypted on the device, including all text, vectors and tool events. */
7889
+ interface ChatRecord {
7890
+ kind: ChatRecordKind;
7891
+ id: string;
7892
+ conversationId: string;
7893
+ sortKey: number;
7894
+ createdAt: number;
7895
+ updatedAt: number;
7896
+ isDeleted: boolean;
7897
+ data: {
7898
+ [key: string]: ChatJson;
7899
+ };
7900
+ }
7901
+ interface ChatSnapshot {
7902
+ record: ChatRecord;
7903
+ version: number;
7904
+ serverUpdatedAt: string;
7905
+ }
7906
+ interface ChatWrite {
7907
+ record: ChatRecord;
7908
+ expectedVersion: number;
7909
+ /** Sent and stored unencrypted so vault can run vector search. */
7910
+ embeddings?: number[][];
7911
+ embeddingModel?: string;
7912
+ }
7913
+ interface ChatRef {
7914
+ kind: ChatRecordKind;
7915
+ id: string;
7916
+ }
7917
+ type ChatAccountState = "none" | "migrating" | "active";
7918
+ interface ChatAccount {
7919
+ keyId: string;
7920
+ state: ChatAccountState;
7921
+ recordCount: number;
7922
+ storageBytes: number;
7923
+ vectorCount: number;
7924
+ /** The newest change; read it before loading history and poll `changes` from it. Absent before the first record. */
7925
+ changesCursor?: string;
7926
+ }
7927
+ interface ChatImport {
7928
+ record: ChatRecord;
7929
+ /** Sent and stored unencrypted so vault can run vector search. */
7930
+ embeddings?: number[][];
7931
+ embeddingModel?: string;
7932
+ }
7933
+ interface ChatRevision {
7934
+ kind: ChatRecordKind;
7935
+ id: string;
7936
+ updatedAt: number;
7937
+ isDeleted: boolean;
7938
+ }
7939
+ interface ChatChanges {
7940
+ items: ChatSnapshot[];
7941
+ nextCursor?: string;
7942
+ changesCursor: string;
7943
+ }
7944
+ interface ChatSearchOptions {
7945
+ limit?: number;
7946
+ kinds?: ("message" | "summary")[];
7947
+ conversationId?: string;
7948
+ excludeConversationId?: string;
7949
+ /** Ranks only vectors from this model; vectors stored without one always count. */
7950
+ embeddingModel?: string;
7951
+ signal?: AbortSignal;
7952
+ }
7953
+ interface ChatSearchHit extends ChatSnapshot {
7954
+ chunk: number;
7955
+ score: number;
7956
+ }
7957
+ interface ChatAttachment {
7958
+ id: string;
7959
+ sizeBytes: number;
7960
+ state: "pending" | "committed";
7961
+ ownerKind?: "message" | "summary";
7962
+ ownerId?: string;
7963
+ createdAt: string;
7964
+ committedAt?: string;
7965
+ }
7966
+ interface ChatPresignedUrl {
7967
+ url: string;
7968
+ method: string;
7969
+ headers: Record<string, string>;
7970
+ expiresAt: string;
7971
+ }
7972
+ interface ChatAttachments {
7973
+ create(sizeBytes: number, signal?: AbortSignal): Promise<{
7974
+ attachment: ChatAttachment;
7975
+ upload: ChatPresignedUrl;
7976
+ }>;
7977
+ commit(attachmentId: string, owner: {
7978
+ kind: "message" | "summary";
7979
+ id: string;
7980
+ }, signal?: AbortSignal): Promise<ChatAttachment>;
7981
+ get(attachmentId: string, signal?: AbortSignal): Promise<{
7982
+ attachment: ChatAttachment;
7983
+ download?: ChatPresignedUrl;
7984
+ } | null>;
7985
+ delete(attachmentId: string, signal?: AbortSignal): Promise<void>;
7986
+ }
7987
+ interface ChatListOptions {
7988
+ kind: ChatRecordKind;
7989
+ conversationId?: string;
7990
+ includeDeleted?: boolean;
7991
+ cursor?: string;
7992
+ limit?: number;
7993
+ signal?: AbortSignal;
7994
+ }
7995
+ interface ChatPage {
7996
+ items: ChatSnapshot[];
7997
+ nextCursor?: string;
7998
+ total?: number;
7999
+ }
8000
+ /** Explicit versions protect edits; ambiguous writes are never replayed automatically. */
8001
+ interface ChatStore {
8002
+ get(kind: ChatRecordKind, id: string, signal?: AbortSignal): Promise<ChatSnapshot | null>;
8003
+ list(options: ChatListOptions): Promise<ChatPage>;
8004
+ putMany(writes: readonly ChatWrite[], signal?: AbortSignal): Promise<ChatSnapshot[]>;
8005
+ getMany(refs: readonly ChatRef[], signal?: AbortSignal): Promise<ChatSnapshot[]>;
8006
+ account(signal?: AbortSignal): Promise<ChatAccount>;
8007
+ importRecords(records: readonly ChatImport[], signal?: AbortSignal): Promise<number>;
8008
+ verify(revisions: readonly ChatRevision[], signal?: AbortSignal): Promise<ChatRef[]>;
8009
+ activate(signal?: AbortSignal): Promise<boolean>;
8010
+ /** Without `kinds`, vault returns every kind except `setting`. */
8011
+ changes(cursor?: string, options?: {
8012
+ limit?: number;
8013
+ kinds?: readonly ChatRecordKind[];
8014
+ signal?: AbortSignal;
8015
+ }): Promise<ChatChanges>;
8016
+ search(embedding: readonly number[], options?: ChatSearchOptions): Promise<ChatSearchHit[]>;
8017
+ deleteAll(signal?: AbortSignal): Promise<number>;
8018
+ attachments: ChatAttachments;
8019
+ }
8020
+ interface RemoteChatStoreOptions {
8021
+ baseUrl: string;
8022
+ getToken: () => Promise<string | null>;
8023
+ keyId: string;
8024
+ encrypt: (plaintext: string) => Promise<string>;
8025
+ decrypt: (ciphertext: string) => Promise<string>;
8026
+ fetch?: typeof globalThis.fetch;
8027
+ timeoutMs?: number;
8028
+ signal?: AbortSignal;
8029
+ }
8030
+ declare class ChatStoreError extends Error {
8031
+ readonly status: number;
8032
+ readonly code?: string | undefined;
8033
+ readonly retryAfterMs?: number | undefined;
8034
+ constructor(message: string, status: number, code?: string | undefined, retryAfterMs?: number | undefined);
8035
+ }
8036
+
7884
8037
  /**
7885
8038
  * Class-B task types — the vocabulary of the `X-Anuma-Task-Type` header.
7886
8039
  *
@@ -8366,6 +8519,10 @@ interface StoredConversation {
8366
8519
  /** When the conversation was pinned to the top of the list; null/unset = not pinned.
8367
8520
  * `null` (not `undefined`) at runtime for unpinned rows — mirrors the model field. */
8368
8521
  pinnedAt?: Date | null;
8522
+ /** Per-conversation app state kept with the conversation in vault, keyed by the app; absent on local storage. */
8523
+ context?: {
8524
+ [key: string]: ChatJson;
8525
+ };
8369
8526
  }
8370
8527
  /**
8371
8528
  * Lazy variant of {@link StoredConversation}.
@@ -8391,159 +8548,6 @@ interface LazyStoredConversation extends Omit<StoredConversation, "title"> {
8391
8548
  encryptedTitle: string;
8392
8549
  }
8393
8550
 
8394
- type ChatRecordKind = "conversation" | "message" | "summary" | "project" | "memory_links" | "setting";
8395
- type ChatJson = null | boolean | number | string | ChatJson[] | {
8396
- [key: string]: ChatJson;
8397
- };
8398
- /** Whole-record JSON data is encrypted on the device, including all text, vectors and tool events. */
8399
- interface ChatRecord {
8400
- kind: ChatRecordKind;
8401
- id: string;
8402
- conversationId: string;
8403
- sortKey: number;
8404
- createdAt: number;
8405
- updatedAt: number;
8406
- isDeleted: boolean;
8407
- data: {
8408
- [key: string]: ChatJson;
8409
- };
8410
- }
8411
- interface ChatSnapshot {
8412
- record: ChatRecord;
8413
- version: number;
8414
- serverUpdatedAt: string;
8415
- }
8416
- interface ChatWrite {
8417
- record: ChatRecord;
8418
- expectedVersion: number;
8419
- /** Sent and stored unencrypted so vault can run vector search. */
8420
- embeddings?: number[][];
8421
- embeddingModel?: string;
8422
- }
8423
- interface ChatRef {
8424
- kind: ChatRecordKind;
8425
- id: string;
8426
- }
8427
- type ChatAccountState = "none" | "migrating" | "active";
8428
- interface ChatAccount {
8429
- keyId: string;
8430
- state: ChatAccountState;
8431
- recordCount: number;
8432
- storageBytes: number;
8433
- vectorCount: number;
8434
- /** The newest change; read it before loading history and poll `changes` from it. Absent before the first record. */
8435
- changesCursor?: string;
8436
- }
8437
- interface ChatImport {
8438
- record: ChatRecord;
8439
- /** Sent and stored unencrypted so vault can run vector search. */
8440
- embeddings?: number[][];
8441
- embeddingModel?: string;
8442
- }
8443
- interface ChatRevision {
8444
- kind: ChatRecordKind;
8445
- id: string;
8446
- updatedAt: number;
8447
- isDeleted: boolean;
8448
- }
8449
- interface ChatChanges {
8450
- items: ChatSnapshot[];
8451
- nextCursor?: string;
8452
- changesCursor: string;
8453
- }
8454
- interface ChatSearchOptions {
8455
- limit?: number;
8456
- kinds?: ("message" | "summary")[];
8457
- conversationId?: string;
8458
- excludeConversationId?: string;
8459
- /** Ranks only vectors from this model; vectors stored without one always count. */
8460
- embeddingModel?: string;
8461
- signal?: AbortSignal;
8462
- }
8463
- interface ChatSearchHit extends ChatSnapshot {
8464
- chunk: number;
8465
- score: number;
8466
- }
8467
- interface ChatAttachment {
8468
- id: string;
8469
- sizeBytes: number;
8470
- state: "pending" | "committed";
8471
- ownerKind?: "message" | "summary";
8472
- ownerId?: string;
8473
- createdAt: string;
8474
- committedAt?: string;
8475
- }
8476
- interface ChatPresignedUrl {
8477
- url: string;
8478
- method: string;
8479
- headers: Record<string, string>;
8480
- expiresAt: string;
8481
- }
8482
- interface ChatAttachments {
8483
- create(sizeBytes: number, signal?: AbortSignal): Promise<{
8484
- attachment: ChatAttachment;
8485
- upload: ChatPresignedUrl;
8486
- }>;
8487
- commit(attachmentId: string, owner: {
8488
- kind: "message" | "summary";
8489
- id: string;
8490
- }, signal?: AbortSignal): Promise<ChatAttachment>;
8491
- get(attachmentId: string, signal?: AbortSignal): Promise<{
8492
- attachment: ChatAttachment;
8493
- download?: ChatPresignedUrl;
8494
- } | null>;
8495
- delete(attachmentId: string, signal?: AbortSignal): Promise<void>;
8496
- }
8497
- interface ChatListOptions {
8498
- kind: ChatRecordKind;
8499
- conversationId?: string;
8500
- includeDeleted?: boolean;
8501
- cursor?: string;
8502
- limit?: number;
8503
- signal?: AbortSignal;
8504
- }
8505
- interface ChatPage {
8506
- items: ChatSnapshot[];
8507
- nextCursor?: string;
8508
- total?: number;
8509
- }
8510
- /** Explicit versions protect edits; ambiguous writes are never replayed automatically. */
8511
- interface ChatStore {
8512
- get(kind: ChatRecordKind, id: string, signal?: AbortSignal): Promise<ChatSnapshot | null>;
8513
- list(options: ChatListOptions): Promise<ChatPage>;
8514
- putMany(writes: readonly ChatWrite[], signal?: AbortSignal): Promise<ChatSnapshot[]>;
8515
- getMany(refs: readonly ChatRef[], signal?: AbortSignal): Promise<ChatSnapshot[]>;
8516
- account(signal?: AbortSignal): Promise<ChatAccount>;
8517
- importRecords(records: readonly ChatImport[], signal?: AbortSignal): Promise<number>;
8518
- verify(revisions: readonly ChatRevision[], signal?: AbortSignal): Promise<ChatRef[]>;
8519
- activate(signal?: AbortSignal): Promise<boolean>;
8520
- /** Without `kinds`, vault returns every kind except `setting`. */
8521
- changes(cursor?: string, options?: {
8522
- limit?: number;
8523
- kinds?: readonly ChatRecordKind[];
8524
- signal?: AbortSignal;
8525
- }): Promise<ChatChanges>;
8526
- search(embedding: readonly number[], options?: ChatSearchOptions): Promise<ChatSearchHit[]>;
8527
- deleteAll(signal?: AbortSignal): Promise<number>;
8528
- attachments: ChatAttachments;
8529
- }
8530
- interface RemoteChatStoreOptions {
8531
- baseUrl: string;
8532
- getToken: () => Promise<string | null>;
8533
- keyId: string;
8534
- encrypt: (plaintext: string) => Promise<string>;
8535
- decrypt: (ciphertext: string) => Promise<string>;
8536
- fetch?: typeof globalThis.fetch;
8537
- timeoutMs?: number;
8538
- signal?: AbortSignal;
8539
- }
8540
- declare class ChatStoreError extends Error {
8541
- readonly status: number;
8542
- readonly code?: string | undefined;
8543
- readonly retryAfterMs?: number | undefined;
8544
- constructor(message: string, status: number, code?: string | undefined, retryAfterMs?: number | undefined);
8545
- }
8546
-
8547
8551
  /** Connect to owner-scoped server storage using the account's canonical device-held cipher. */
8548
8552
  declare function createRemoteChatStore(options: RemoteChatStoreOptions): Promise<ChatStore>;
8549
8553
 
package/dist/index.d.ts CHANGED
@@ -7881,6 +7881,159 @@ declare function getCreditsUsed(r: ApiResponse): number | undefined;
7881
7881
  */
7882
7882
  declare function getImageModel(r: ApiResponse): string | undefined;
7883
7883
 
7884
+ type ChatRecordKind = "conversation" | "message" | "summary" | "project" | "memory_links" | "setting";
7885
+ type ChatJson = null | boolean | number | string | ChatJson[] | {
7886
+ [key: string]: ChatJson;
7887
+ };
7888
+ /** Whole-record JSON data is encrypted on the device, including all text, vectors and tool events. */
7889
+ interface ChatRecord {
7890
+ kind: ChatRecordKind;
7891
+ id: string;
7892
+ conversationId: string;
7893
+ sortKey: number;
7894
+ createdAt: number;
7895
+ updatedAt: number;
7896
+ isDeleted: boolean;
7897
+ data: {
7898
+ [key: string]: ChatJson;
7899
+ };
7900
+ }
7901
+ interface ChatSnapshot {
7902
+ record: ChatRecord;
7903
+ version: number;
7904
+ serverUpdatedAt: string;
7905
+ }
7906
+ interface ChatWrite {
7907
+ record: ChatRecord;
7908
+ expectedVersion: number;
7909
+ /** Sent and stored unencrypted so vault can run vector search. */
7910
+ embeddings?: number[][];
7911
+ embeddingModel?: string;
7912
+ }
7913
+ interface ChatRef {
7914
+ kind: ChatRecordKind;
7915
+ id: string;
7916
+ }
7917
+ type ChatAccountState = "none" | "migrating" | "active";
7918
+ interface ChatAccount {
7919
+ keyId: string;
7920
+ state: ChatAccountState;
7921
+ recordCount: number;
7922
+ storageBytes: number;
7923
+ vectorCount: number;
7924
+ /** The newest change; read it before loading history and poll `changes` from it. Absent before the first record. */
7925
+ changesCursor?: string;
7926
+ }
7927
+ interface ChatImport {
7928
+ record: ChatRecord;
7929
+ /** Sent and stored unencrypted so vault can run vector search. */
7930
+ embeddings?: number[][];
7931
+ embeddingModel?: string;
7932
+ }
7933
+ interface ChatRevision {
7934
+ kind: ChatRecordKind;
7935
+ id: string;
7936
+ updatedAt: number;
7937
+ isDeleted: boolean;
7938
+ }
7939
+ interface ChatChanges {
7940
+ items: ChatSnapshot[];
7941
+ nextCursor?: string;
7942
+ changesCursor: string;
7943
+ }
7944
+ interface ChatSearchOptions {
7945
+ limit?: number;
7946
+ kinds?: ("message" | "summary")[];
7947
+ conversationId?: string;
7948
+ excludeConversationId?: string;
7949
+ /** Ranks only vectors from this model; vectors stored without one always count. */
7950
+ embeddingModel?: string;
7951
+ signal?: AbortSignal;
7952
+ }
7953
+ interface ChatSearchHit extends ChatSnapshot {
7954
+ chunk: number;
7955
+ score: number;
7956
+ }
7957
+ interface ChatAttachment {
7958
+ id: string;
7959
+ sizeBytes: number;
7960
+ state: "pending" | "committed";
7961
+ ownerKind?: "message" | "summary";
7962
+ ownerId?: string;
7963
+ createdAt: string;
7964
+ committedAt?: string;
7965
+ }
7966
+ interface ChatPresignedUrl {
7967
+ url: string;
7968
+ method: string;
7969
+ headers: Record<string, string>;
7970
+ expiresAt: string;
7971
+ }
7972
+ interface ChatAttachments {
7973
+ create(sizeBytes: number, signal?: AbortSignal): Promise<{
7974
+ attachment: ChatAttachment;
7975
+ upload: ChatPresignedUrl;
7976
+ }>;
7977
+ commit(attachmentId: string, owner: {
7978
+ kind: "message" | "summary";
7979
+ id: string;
7980
+ }, signal?: AbortSignal): Promise<ChatAttachment>;
7981
+ get(attachmentId: string, signal?: AbortSignal): Promise<{
7982
+ attachment: ChatAttachment;
7983
+ download?: ChatPresignedUrl;
7984
+ } | null>;
7985
+ delete(attachmentId: string, signal?: AbortSignal): Promise<void>;
7986
+ }
7987
+ interface ChatListOptions {
7988
+ kind: ChatRecordKind;
7989
+ conversationId?: string;
7990
+ includeDeleted?: boolean;
7991
+ cursor?: string;
7992
+ limit?: number;
7993
+ signal?: AbortSignal;
7994
+ }
7995
+ interface ChatPage {
7996
+ items: ChatSnapshot[];
7997
+ nextCursor?: string;
7998
+ total?: number;
7999
+ }
8000
+ /** Explicit versions protect edits; ambiguous writes are never replayed automatically. */
8001
+ interface ChatStore {
8002
+ get(kind: ChatRecordKind, id: string, signal?: AbortSignal): Promise<ChatSnapshot | null>;
8003
+ list(options: ChatListOptions): Promise<ChatPage>;
8004
+ putMany(writes: readonly ChatWrite[], signal?: AbortSignal): Promise<ChatSnapshot[]>;
8005
+ getMany(refs: readonly ChatRef[], signal?: AbortSignal): Promise<ChatSnapshot[]>;
8006
+ account(signal?: AbortSignal): Promise<ChatAccount>;
8007
+ importRecords(records: readonly ChatImport[], signal?: AbortSignal): Promise<number>;
8008
+ verify(revisions: readonly ChatRevision[], signal?: AbortSignal): Promise<ChatRef[]>;
8009
+ activate(signal?: AbortSignal): Promise<boolean>;
8010
+ /** Without `kinds`, vault returns every kind except `setting`. */
8011
+ changes(cursor?: string, options?: {
8012
+ limit?: number;
8013
+ kinds?: readonly ChatRecordKind[];
8014
+ signal?: AbortSignal;
8015
+ }): Promise<ChatChanges>;
8016
+ search(embedding: readonly number[], options?: ChatSearchOptions): Promise<ChatSearchHit[]>;
8017
+ deleteAll(signal?: AbortSignal): Promise<number>;
8018
+ attachments: ChatAttachments;
8019
+ }
8020
+ interface RemoteChatStoreOptions {
8021
+ baseUrl: string;
8022
+ getToken: () => Promise<string | null>;
8023
+ keyId: string;
8024
+ encrypt: (plaintext: string) => Promise<string>;
8025
+ decrypt: (ciphertext: string) => Promise<string>;
8026
+ fetch?: typeof globalThis.fetch;
8027
+ timeoutMs?: number;
8028
+ signal?: AbortSignal;
8029
+ }
8030
+ declare class ChatStoreError extends Error {
8031
+ readonly status: number;
8032
+ readonly code?: string | undefined;
8033
+ readonly retryAfterMs?: number | undefined;
8034
+ constructor(message: string, status: number, code?: string | undefined, retryAfterMs?: number | undefined);
8035
+ }
8036
+
7884
8037
  /**
7885
8038
  * Class-B task types — the vocabulary of the `X-Anuma-Task-Type` header.
7886
8039
  *
@@ -8366,6 +8519,10 @@ interface StoredConversation {
8366
8519
  /** When the conversation was pinned to the top of the list; null/unset = not pinned.
8367
8520
  * `null` (not `undefined`) at runtime for unpinned rows — mirrors the model field. */
8368
8521
  pinnedAt?: Date | null;
8522
+ /** Per-conversation app state kept with the conversation in vault, keyed by the app; absent on local storage. */
8523
+ context?: {
8524
+ [key: string]: ChatJson;
8525
+ };
8369
8526
  }
8370
8527
  /**
8371
8528
  * Lazy variant of {@link StoredConversation}.
@@ -8391,159 +8548,6 @@ interface LazyStoredConversation extends Omit<StoredConversation, "title"> {
8391
8548
  encryptedTitle: string;
8392
8549
  }
8393
8550
 
8394
- type ChatRecordKind = "conversation" | "message" | "summary" | "project" | "memory_links" | "setting";
8395
- type ChatJson = null | boolean | number | string | ChatJson[] | {
8396
- [key: string]: ChatJson;
8397
- };
8398
- /** Whole-record JSON data is encrypted on the device, including all text, vectors and tool events. */
8399
- interface ChatRecord {
8400
- kind: ChatRecordKind;
8401
- id: string;
8402
- conversationId: string;
8403
- sortKey: number;
8404
- createdAt: number;
8405
- updatedAt: number;
8406
- isDeleted: boolean;
8407
- data: {
8408
- [key: string]: ChatJson;
8409
- };
8410
- }
8411
- interface ChatSnapshot {
8412
- record: ChatRecord;
8413
- version: number;
8414
- serverUpdatedAt: string;
8415
- }
8416
- interface ChatWrite {
8417
- record: ChatRecord;
8418
- expectedVersion: number;
8419
- /** Sent and stored unencrypted so vault can run vector search. */
8420
- embeddings?: number[][];
8421
- embeddingModel?: string;
8422
- }
8423
- interface ChatRef {
8424
- kind: ChatRecordKind;
8425
- id: string;
8426
- }
8427
- type ChatAccountState = "none" | "migrating" | "active";
8428
- interface ChatAccount {
8429
- keyId: string;
8430
- state: ChatAccountState;
8431
- recordCount: number;
8432
- storageBytes: number;
8433
- vectorCount: number;
8434
- /** The newest change; read it before loading history and poll `changes` from it. Absent before the first record. */
8435
- changesCursor?: string;
8436
- }
8437
- interface ChatImport {
8438
- record: ChatRecord;
8439
- /** Sent and stored unencrypted so vault can run vector search. */
8440
- embeddings?: number[][];
8441
- embeddingModel?: string;
8442
- }
8443
- interface ChatRevision {
8444
- kind: ChatRecordKind;
8445
- id: string;
8446
- updatedAt: number;
8447
- isDeleted: boolean;
8448
- }
8449
- interface ChatChanges {
8450
- items: ChatSnapshot[];
8451
- nextCursor?: string;
8452
- changesCursor: string;
8453
- }
8454
- interface ChatSearchOptions {
8455
- limit?: number;
8456
- kinds?: ("message" | "summary")[];
8457
- conversationId?: string;
8458
- excludeConversationId?: string;
8459
- /** Ranks only vectors from this model; vectors stored without one always count. */
8460
- embeddingModel?: string;
8461
- signal?: AbortSignal;
8462
- }
8463
- interface ChatSearchHit extends ChatSnapshot {
8464
- chunk: number;
8465
- score: number;
8466
- }
8467
- interface ChatAttachment {
8468
- id: string;
8469
- sizeBytes: number;
8470
- state: "pending" | "committed";
8471
- ownerKind?: "message" | "summary";
8472
- ownerId?: string;
8473
- createdAt: string;
8474
- committedAt?: string;
8475
- }
8476
- interface ChatPresignedUrl {
8477
- url: string;
8478
- method: string;
8479
- headers: Record<string, string>;
8480
- expiresAt: string;
8481
- }
8482
- interface ChatAttachments {
8483
- create(sizeBytes: number, signal?: AbortSignal): Promise<{
8484
- attachment: ChatAttachment;
8485
- upload: ChatPresignedUrl;
8486
- }>;
8487
- commit(attachmentId: string, owner: {
8488
- kind: "message" | "summary";
8489
- id: string;
8490
- }, signal?: AbortSignal): Promise<ChatAttachment>;
8491
- get(attachmentId: string, signal?: AbortSignal): Promise<{
8492
- attachment: ChatAttachment;
8493
- download?: ChatPresignedUrl;
8494
- } | null>;
8495
- delete(attachmentId: string, signal?: AbortSignal): Promise<void>;
8496
- }
8497
- interface ChatListOptions {
8498
- kind: ChatRecordKind;
8499
- conversationId?: string;
8500
- includeDeleted?: boolean;
8501
- cursor?: string;
8502
- limit?: number;
8503
- signal?: AbortSignal;
8504
- }
8505
- interface ChatPage {
8506
- items: ChatSnapshot[];
8507
- nextCursor?: string;
8508
- total?: number;
8509
- }
8510
- /** Explicit versions protect edits; ambiguous writes are never replayed automatically. */
8511
- interface ChatStore {
8512
- get(kind: ChatRecordKind, id: string, signal?: AbortSignal): Promise<ChatSnapshot | null>;
8513
- list(options: ChatListOptions): Promise<ChatPage>;
8514
- putMany(writes: readonly ChatWrite[], signal?: AbortSignal): Promise<ChatSnapshot[]>;
8515
- getMany(refs: readonly ChatRef[], signal?: AbortSignal): Promise<ChatSnapshot[]>;
8516
- account(signal?: AbortSignal): Promise<ChatAccount>;
8517
- importRecords(records: readonly ChatImport[], signal?: AbortSignal): Promise<number>;
8518
- verify(revisions: readonly ChatRevision[], signal?: AbortSignal): Promise<ChatRef[]>;
8519
- activate(signal?: AbortSignal): Promise<boolean>;
8520
- /** Without `kinds`, vault returns every kind except `setting`. */
8521
- changes(cursor?: string, options?: {
8522
- limit?: number;
8523
- kinds?: readonly ChatRecordKind[];
8524
- signal?: AbortSignal;
8525
- }): Promise<ChatChanges>;
8526
- search(embedding: readonly number[], options?: ChatSearchOptions): Promise<ChatSearchHit[]>;
8527
- deleteAll(signal?: AbortSignal): Promise<number>;
8528
- attachments: ChatAttachments;
8529
- }
8530
- interface RemoteChatStoreOptions {
8531
- baseUrl: string;
8532
- getToken: () => Promise<string | null>;
8533
- keyId: string;
8534
- encrypt: (plaintext: string) => Promise<string>;
8535
- decrypt: (ciphertext: string) => Promise<string>;
8536
- fetch?: typeof globalThis.fetch;
8537
- timeoutMs?: number;
8538
- signal?: AbortSignal;
8539
- }
8540
- declare class ChatStoreError extends Error {
8541
- readonly status: number;
8542
- readonly code?: string | undefined;
8543
- readonly retryAfterMs?: number | undefined;
8544
- constructor(message: string, status: number, code?: string | undefined, retryAfterMs?: number | undefined);
8545
- }
8546
-
8547
8551
  /** Connect to owner-scoped server storage using the account's canonical device-held cipher. */
8548
8552
  declare function createRemoteChatStore(options: RemoteChatStoreOptions): Promise<ChatStore>;
8549
8553