@anuma/sdk 10.3.0 → 10.4.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/expo/index.cjs +418 -22
- package/dist/expo/index.d.mts +610 -527
- package/dist/expo/index.d.ts +610 -527
- package/dist/expo/index.mjs +414 -22
- package/dist/index.d.mts +154 -154
- package/dist/index.d.ts +154 -154
- package/dist/react/index.cjs +418 -22
- package/dist/react/index.d.mts +1055 -972
- package/dist/react/index.d.ts +1055 -972
- package/dist/react/index.mjs +414 -22
- package/dist/server/index.d.mts +10 -0
- package/dist/server/index.d.ts +10 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -7881,160 +7881,6 @@ 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";
|
|
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
|
-
changes(cursor?: string, options?: {
|
|
8011
|
-
limit?: number;
|
|
8012
|
-
signal?: AbortSignal;
|
|
8013
|
-
}): Promise<ChatChanges>;
|
|
8014
|
-
search(embedding: readonly number[], options?: ChatSearchOptions): Promise<ChatSearchHit[]>;
|
|
8015
|
-
deleteAll(signal?: AbortSignal): Promise<number>;
|
|
8016
|
-
attachments: ChatAttachments;
|
|
8017
|
-
}
|
|
8018
|
-
interface RemoteChatStoreOptions {
|
|
8019
|
-
baseUrl: string;
|
|
8020
|
-
getToken: () => Promise<string | null>;
|
|
8021
|
-
keyId: string;
|
|
8022
|
-
encrypt: (plaintext: string) => Promise<string>;
|
|
8023
|
-
decrypt: (ciphertext: string) => Promise<string>;
|
|
8024
|
-
fetch?: typeof globalThis.fetch;
|
|
8025
|
-
timeoutMs?: number;
|
|
8026
|
-
signal?: AbortSignal;
|
|
8027
|
-
}
|
|
8028
|
-
declare class ChatStoreError extends Error {
|
|
8029
|
-
readonly status: number;
|
|
8030
|
-
readonly code?: string | undefined;
|
|
8031
|
-
readonly retryAfterMs?: number | undefined;
|
|
8032
|
-
constructor(message: string, status: number, code?: string | undefined, retryAfterMs?: number | undefined);
|
|
8033
|
-
}
|
|
8034
|
-
|
|
8035
|
-
/** Connect to owner-scoped server storage using the account's canonical device-held cipher. */
|
|
8036
|
-
declare function createRemoteChatStore(options: RemoteChatStoreOptions): Promise<ChatStore>;
|
|
8037
|
-
|
|
8038
7884
|
/**
|
|
8039
7885
|
* Class-B task types — the vocabulary of the `X-Anuma-Task-Type` header.
|
|
8040
7886
|
*
|
|
@@ -8545,6 +8391,160 @@ interface LazyStoredConversation extends Omit<StoredConversation, "title"> {
|
|
|
8545
8391
|
encryptedTitle: string;
|
|
8546
8392
|
}
|
|
8547
8393
|
|
|
8394
|
+
type ChatRecordKind = "conversation" | "message" | "summary" | "project" | "memory_links";
|
|
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
|
+
changes(cursor?: string, options?: {
|
|
8521
|
+
limit?: number;
|
|
8522
|
+
signal?: AbortSignal;
|
|
8523
|
+
}): Promise<ChatChanges>;
|
|
8524
|
+
search(embedding: readonly number[], options?: ChatSearchOptions): Promise<ChatSearchHit[]>;
|
|
8525
|
+
deleteAll(signal?: AbortSignal): Promise<number>;
|
|
8526
|
+
attachments: ChatAttachments;
|
|
8527
|
+
}
|
|
8528
|
+
interface RemoteChatStoreOptions {
|
|
8529
|
+
baseUrl: string;
|
|
8530
|
+
getToken: () => Promise<string | null>;
|
|
8531
|
+
keyId: string;
|
|
8532
|
+
encrypt: (plaintext: string) => Promise<string>;
|
|
8533
|
+
decrypt: (ciphertext: string) => Promise<string>;
|
|
8534
|
+
fetch?: typeof globalThis.fetch;
|
|
8535
|
+
timeoutMs?: number;
|
|
8536
|
+
signal?: AbortSignal;
|
|
8537
|
+
}
|
|
8538
|
+
declare class ChatStoreError extends Error {
|
|
8539
|
+
readonly status: number;
|
|
8540
|
+
readonly code?: string | undefined;
|
|
8541
|
+
readonly retryAfterMs?: number | undefined;
|
|
8542
|
+
constructor(message: string, status: number, code?: string | undefined, retryAfterMs?: number | undefined);
|
|
8543
|
+
}
|
|
8544
|
+
|
|
8545
|
+
/** Connect to owner-scoped server storage using the account's canonical device-held cipher. */
|
|
8546
|
+
declare function createRemoteChatStore(options: RemoteChatStoreOptions): Promise<ChatStore>;
|
|
8547
|
+
|
|
8548
8548
|
/**
|
|
8549
8549
|
* Drop every cached plaintext title and pending decrypt promise.
|
|
8550
8550
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -7881,160 +7881,6 @@ 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";
|
|
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
|
-
changes(cursor?: string, options?: {
|
|
8011
|
-
limit?: number;
|
|
8012
|
-
signal?: AbortSignal;
|
|
8013
|
-
}): Promise<ChatChanges>;
|
|
8014
|
-
search(embedding: readonly number[], options?: ChatSearchOptions): Promise<ChatSearchHit[]>;
|
|
8015
|
-
deleteAll(signal?: AbortSignal): Promise<number>;
|
|
8016
|
-
attachments: ChatAttachments;
|
|
8017
|
-
}
|
|
8018
|
-
interface RemoteChatStoreOptions {
|
|
8019
|
-
baseUrl: string;
|
|
8020
|
-
getToken: () => Promise<string | null>;
|
|
8021
|
-
keyId: string;
|
|
8022
|
-
encrypt: (plaintext: string) => Promise<string>;
|
|
8023
|
-
decrypt: (ciphertext: string) => Promise<string>;
|
|
8024
|
-
fetch?: typeof globalThis.fetch;
|
|
8025
|
-
timeoutMs?: number;
|
|
8026
|
-
signal?: AbortSignal;
|
|
8027
|
-
}
|
|
8028
|
-
declare class ChatStoreError extends Error {
|
|
8029
|
-
readonly status: number;
|
|
8030
|
-
readonly code?: string | undefined;
|
|
8031
|
-
readonly retryAfterMs?: number | undefined;
|
|
8032
|
-
constructor(message: string, status: number, code?: string | undefined, retryAfterMs?: number | undefined);
|
|
8033
|
-
}
|
|
8034
|
-
|
|
8035
|
-
/** Connect to owner-scoped server storage using the account's canonical device-held cipher. */
|
|
8036
|
-
declare function createRemoteChatStore(options: RemoteChatStoreOptions): Promise<ChatStore>;
|
|
8037
|
-
|
|
8038
7884
|
/**
|
|
8039
7885
|
* Class-B task types — the vocabulary of the `X-Anuma-Task-Type` header.
|
|
8040
7886
|
*
|
|
@@ -8545,6 +8391,160 @@ interface LazyStoredConversation extends Omit<StoredConversation, "title"> {
|
|
|
8545
8391
|
encryptedTitle: string;
|
|
8546
8392
|
}
|
|
8547
8393
|
|
|
8394
|
+
type ChatRecordKind = "conversation" | "message" | "summary" | "project" | "memory_links";
|
|
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
|
+
changes(cursor?: string, options?: {
|
|
8521
|
+
limit?: number;
|
|
8522
|
+
signal?: AbortSignal;
|
|
8523
|
+
}): Promise<ChatChanges>;
|
|
8524
|
+
search(embedding: readonly number[], options?: ChatSearchOptions): Promise<ChatSearchHit[]>;
|
|
8525
|
+
deleteAll(signal?: AbortSignal): Promise<number>;
|
|
8526
|
+
attachments: ChatAttachments;
|
|
8527
|
+
}
|
|
8528
|
+
interface RemoteChatStoreOptions {
|
|
8529
|
+
baseUrl: string;
|
|
8530
|
+
getToken: () => Promise<string | null>;
|
|
8531
|
+
keyId: string;
|
|
8532
|
+
encrypt: (plaintext: string) => Promise<string>;
|
|
8533
|
+
decrypt: (ciphertext: string) => Promise<string>;
|
|
8534
|
+
fetch?: typeof globalThis.fetch;
|
|
8535
|
+
timeoutMs?: number;
|
|
8536
|
+
signal?: AbortSignal;
|
|
8537
|
+
}
|
|
8538
|
+
declare class ChatStoreError extends Error {
|
|
8539
|
+
readonly status: number;
|
|
8540
|
+
readonly code?: string | undefined;
|
|
8541
|
+
readonly retryAfterMs?: number | undefined;
|
|
8542
|
+
constructor(message: string, status: number, code?: string | undefined, retryAfterMs?: number | undefined);
|
|
8543
|
+
}
|
|
8544
|
+
|
|
8545
|
+
/** Connect to owner-scoped server storage using the account's canonical device-held cipher. */
|
|
8546
|
+
declare function createRemoteChatStore(options: RemoteChatStoreOptions): Promise<ChatStore>;
|
|
8547
|
+
|
|
8548
8548
|
/**
|
|
8549
8549
|
* Drop every cached plaintext title and pending decrypt promise.
|
|
8550
8550
|
*
|