@anuma/sdk 2.5.0 → 2.6.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/{chunk-A26RBLTJ.mjs → chunk-TCRDSUC6.mjs} +11 -3
- package/dist/expo/index.cjs +34 -5
- package/dist/expo/index.d.mts +35 -12
- package/dist/expo/index.d.ts +35 -12
- package/dist/expo/index.mjs +25 -3
- package/dist/expo/{recall-JC5GF5CX.mjs → recall-FQU3NUTL.mjs} +1 -1
- package/dist/react/{chunk-V5GC3ES7.mjs → chunk-ZXS3KOY4.mjs} +15 -4
- package/dist/react/index.cjs +38 -6
- package/dist/react/index.d.mts +43 -15
- package/dist/react/index.d.ts +43 -15
- package/dist/react/index.mjs +25 -3
- package/dist/react/{recall-IRTSMKYI.mjs → recall-PV7L3SN3.mjs} +1 -1
- package/dist/server/{chunk-TWWLE6P3.mjs → chunk-Z6II54I7.mjs} +11 -3
- package/dist/server/index.cjs +34 -5
- package/dist/server/index.d.mts +35 -12
- package/dist/server/index.d.ts +35 -12
- package/dist/server/index.mjs +25 -3
- package/dist/server/{recall-44FIK2MJ.mjs → recall-CQT24XLH.mjs} +1 -1
- package/package.json +1 -1
|
@@ -1912,6 +1912,7 @@ function vaultMemoryToStoredRaw(memory) {
|
|
|
1912
1912
|
eventTimeKind: memory.eventTimeKind ?? null,
|
|
1913
1913
|
topicsUserManaged: memory.topicsUserManaged ?? false,
|
|
1914
1914
|
topicsExtractedAt: memory.topicsExtractedAt ?? null,
|
|
1915
|
+
topicsExtractedVersion: memory.topicsExtractedVersion ?? null,
|
|
1915
1916
|
supersededBy: memory.supersededBy ?? null,
|
|
1916
1917
|
supersededAt: memory.supersededAt ?? null,
|
|
1917
1918
|
createdAt: memory.createdAt,
|
|
@@ -2151,6 +2152,7 @@ function vaultMemoryRawToStoredRaw(raw) {
|
|
|
2151
2152
|
// SQLite stores booleans as 0/1, LokiJS as true/false — coerce both.
|
|
2152
2153
|
topicsUserManaged: raw.topics_user_managed === true || raw.topics_user_managed === 1,
|
|
2153
2154
|
topicsExtractedAt: raw.topics_extracted_at ?? null,
|
|
2155
|
+
topicsExtractedVersion: raw.topics_extracted_version ?? null,
|
|
2154
2156
|
supersededBy: raw.superseded_by ?? null,
|
|
2155
2157
|
supersededAt: raw.superseded_at ?? null,
|
|
2156
2158
|
createdAt: new Date(raw.created_at),
|
|
@@ -2329,6 +2331,7 @@ async function getUnfiledVaultMemoriesOp(ctx) {
|
|
|
2329
2331
|
(record) => vaultMemoryToStored(record, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner)
|
|
2330
2332
|
);
|
|
2331
2333
|
}
|
|
2334
|
+
var TOPICS_EXTRACTION_VERSION = 1;
|
|
2332
2335
|
async function getMemoriesNeedingTopicExtractionOp(ctx, options) {
|
|
2333
2336
|
const entityCtx = ctx.entityCtx;
|
|
2334
2337
|
if (!entityCtx) {
|
|
@@ -2347,7 +2350,10 @@ async function getMemoriesNeedingTopicExtractionOp(ctx, options) {
|
|
|
2347
2350
|
for (const raw of rows) {
|
|
2348
2351
|
const stamp = raw.topics_extracted_at ?? null;
|
|
2349
2352
|
if (stamp !== null) {
|
|
2350
|
-
|
|
2353
|
+
const version = raw.topics_extracted_version ?? 0;
|
|
2354
|
+
if (raw.updated_at > stamp || version < TOPICS_EXTRACTION_VERSION) {
|
|
2355
|
+
stampedPending.push(raw);
|
|
2356
|
+
}
|
|
2351
2357
|
} else {
|
|
2352
2358
|
unstamped.push(raw);
|
|
2353
2359
|
}
|
|
@@ -2377,7 +2383,7 @@ async function getMemoriesNeedingTopicExtractionOp(ctx, options) {
|
|
|
2377
2383
|
);
|
|
2378
2384
|
return { pending, linkedUnstamped };
|
|
2379
2385
|
}
|
|
2380
|
-
async function stampTopicsExtractedAtOp(ctx, memoryIds, extractedAt) {
|
|
2386
|
+
async function stampTopicsExtractedAtOp(ctx, memoryIds, extractedAt, version = TOPICS_EXTRACTION_VERSION) {
|
|
2381
2387
|
if (memoryIds.length === 0) return [];
|
|
2382
2388
|
const uniqueIds = Array.from(new Set(memoryIds));
|
|
2383
2389
|
const CHUNK = 500;
|
|
@@ -2400,6 +2406,7 @@ async function stampTopicsExtractedAtOp(ctx, memoryIds, extractedAt) {
|
|
|
2400
2406
|
prepared.push(
|
|
2401
2407
|
record.prepareUpdate((r) => {
|
|
2402
2408
|
r._setRaw("topics_extracted_at", extractedAt);
|
|
2409
|
+
r._setRaw("topics_extracted_version", version);
|
|
2403
2410
|
r._setRaw("updated_at", originalUpdatedAt);
|
|
2404
2411
|
})
|
|
2405
2412
|
);
|
|
@@ -5042,7 +5049,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
|
|
|
5042
5049
|
legacy.map((r) => ({ id: r.uniqueId, content: r.content, score: r.similarity }))
|
|
5043
5050
|
);
|
|
5044
5051
|
}
|
|
5045
|
-
const { recall: recall2 } = await import("./recall-
|
|
5052
|
+
const { recall: recall2 } = await import("./recall-FQU3NUTL.mjs");
|
|
5046
5053
|
const result = await recall2(
|
|
5047
5054
|
query,
|
|
5048
5055
|
{ vaultCtx, embeddingOptions, vaultCache: cache },
|
|
@@ -5737,6 +5744,7 @@ export {
|
|
|
5737
5744
|
deleteVaultMemoryOp,
|
|
5738
5745
|
supersedeVaultMemoryOp,
|
|
5739
5746
|
getUnfiledVaultMemoriesOp,
|
|
5747
|
+
TOPICS_EXTRACTION_VERSION,
|
|
5740
5748
|
getMemoriesNeedingTopicExtractionOp,
|
|
5741
5749
|
stampTopicsExtractedAtOp,
|
|
5742
5750
|
deleteAllVaultMemoriesForUserOp,
|
package/dist/expo/index.cjs
CHANGED
|
@@ -4166,6 +4166,7 @@ function vaultMemoryToStoredRaw(memory) {
|
|
|
4166
4166
|
eventTimeKind: memory.eventTimeKind ?? null,
|
|
4167
4167
|
topicsUserManaged: memory.topicsUserManaged ?? false,
|
|
4168
4168
|
topicsExtractedAt: memory.topicsExtractedAt ?? null,
|
|
4169
|
+
topicsExtractedVersion: memory.topicsExtractedVersion ?? null,
|
|
4169
4170
|
supersededBy: memory.supersededBy ?? null,
|
|
4170
4171
|
supersededAt: memory.supersededAt ?? null,
|
|
4171
4172
|
createdAt: memory.createdAt,
|
|
@@ -4405,6 +4406,7 @@ function vaultMemoryRawToStoredRaw(raw) {
|
|
|
4405
4406
|
// SQLite stores booleans as 0/1, LokiJS as true/false — coerce both.
|
|
4406
4407
|
topicsUserManaged: raw.topics_user_managed === true || raw.topics_user_managed === 1,
|
|
4407
4408
|
topicsExtractedAt: raw.topics_extracted_at ?? null,
|
|
4409
|
+
topicsExtractedVersion: raw.topics_extracted_version ?? null,
|
|
4408
4410
|
supersededBy: raw.superseded_by ?? null,
|
|
4409
4411
|
supersededAt: raw.superseded_at ?? null,
|
|
4410
4412
|
createdAt: new Date(raw.created_at),
|
|
@@ -4601,7 +4603,10 @@ async function getMemoriesNeedingTopicExtractionOp(ctx, options) {
|
|
|
4601
4603
|
for (const raw of rows) {
|
|
4602
4604
|
const stamp = raw.topics_extracted_at ?? null;
|
|
4603
4605
|
if (stamp !== null) {
|
|
4604
|
-
|
|
4606
|
+
const version = raw.topics_extracted_version ?? 0;
|
|
4607
|
+
if (raw.updated_at > stamp || version < TOPICS_EXTRACTION_VERSION) {
|
|
4608
|
+
stampedPending.push(raw);
|
|
4609
|
+
}
|
|
4605
4610
|
} else {
|
|
4606
4611
|
unstamped.push(raw);
|
|
4607
4612
|
}
|
|
@@ -4631,7 +4636,7 @@ async function getMemoriesNeedingTopicExtractionOp(ctx, options) {
|
|
|
4631
4636
|
);
|
|
4632
4637
|
return { pending, linkedUnstamped };
|
|
4633
4638
|
}
|
|
4634
|
-
async function stampTopicsExtractedAtOp(ctx, memoryIds, extractedAt) {
|
|
4639
|
+
async function stampTopicsExtractedAtOp(ctx, memoryIds, extractedAt, version = TOPICS_EXTRACTION_VERSION) {
|
|
4635
4640
|
if (memoryIds.length === 0) return [];
|
|
4636
4641
|
const uniqueIds = Array.from(new Set(memoryIds));
|
|
4637
4642
|
const CHUNK = 500;
|
|
@@ -4654,6 +4659,7 @@ async function stampTopicsExtractedAtOp(ctx, memoryIds, extractedAt) {
|
|
|
4654
4659
|
prepared.push(
|
|
4655
4660
|
record.prepareUpdate((r) => {
|
|
4656
4661
|
r._setRaw("topics_extracted_at", extractedAt);
|
|
4662
|
+
r._setRaw("topics_extracted_version", version);
|
|
4657
4663
|
r._setRaw("updated_at", originalUpdatedAt);
|
|
4658
4664
|
})
|
|
4659
4665
|
);
|
|
@@ -4706,13 +4712,14 @@ async function updateVaultMemoryEmbeddingOp(ctx, id, embedding, embeddingModel)
|
|
|
4706
4712
|
return false;
|
|
4707
4713
|
}
|
|
4708
4714
|
}
|
|
4709
|
-
var import_watermelondb9;
|
|
4715
|
+
var import_watermelondb9, TOPICS_EXTRACTION_VERSION;
|
|
4710
4716
|
var init_operations3 = __esm({
|
|
4711
4717
|
"src/lib/db/memoryVault/operations.ts"() {
|
|
4712
4718
|
"use strict";
|
|
4713
4719
|
import_watermelondb9 = require("@nozbe/watermelondb");
|
|
4714
4720
|
init_operations2();
|
|
4715
4721
|
init_encryption2();
|
|
4722
|
+
TOPICS_EXTRACTION_VERSION = 1;
|
|
4716
4723
|
}
|
|
4717
4724
|
});
|
|
4718
4725
|
|
|
@@ -7076,6 +7083,7 @@ __export(index_exports, {
|
|
|
7076
7083
|
StoredVaultFolderModel: () => VaultFolder,
|
|
7077
7084
|
StoredVaultMemoryModel: () => VaultMemory,
|
|
7078
7085
|
StreamExpiredError: () => StreamExpiredError,
|
|
7086
|
+
TOPICS_EXTRACTION_VERSION: () => TOPICS_EXTRACTION_VERSION,
|
|
7079
7087
|
TOPIC_EXTRACTION_BATCH_SIZE: () => TOPIC_EXTRACTION_BATCH_SIZE,
|
|
7080
7088
|
WalletPoller: () => WalletPoller,
|
|
7081
7089
|
addConversationMemoriesOp: () => addConversationMemoriesOp,
|
|
@@ -12648,6 +12656,9 @@ __decorateClass([
|
|
|
12648
12656
|
__decorateClass([
|
|
12649
12657
|
(0, import_decorators3.field)("superseded_at")
|
|
12650
12658
|
], VaultMemory.prototype, "supersededAt", 2);
|
|
12659
|
+
__decorateClass([
|
|
12660
|
+
(0, import_decorators3.field)("topics_extracted_version")
|
|
12661
|
+
], VaultMemory.prototype, "topicsExtractedVersion", 2);
|
|
12651
12662
|
__decorateClass([
|
|
12652
12663
|
import_decorators3.readonly,
|
|
12653
12664
|
(0, import_decorators3.date)("created_at")
|
|
@@ -16764,7 +16775,7 @@ __decorateClass([
|
|
|
16764
16775
|
], VaultFolder.prototype, "context", 2);
|
|
16765
16776
|
|
|
16766
16777
|
// src/lib/db/schema.ts
|
|
16767
|
-
var SDK_SCHEMA_VERSION =
|
|
16778
|
+
var SDK_SCHEMA_VERSION = 38;
|
|
16768
16779
|
var sdkSchema = (0, import_watermelondb19.appSchema)({
|
|
16769
16780
|
version: SDK_SCHEMA_VERSION,
|
|
16770
16781
|
tables: [
|
|
@@ -16898,7 +16909,11 @@ var sdkSchema = (0, import_watermelondb19.appSchema)({
|
|
|
16898
16909
|
// and dedup by default. Null = live (not superseded). Indexed so the
|
|
16899
16910
|
// recall filter stays cheap.
|
|
16900
16911
|
{ name: "superseded_by", type: "string", isOptional: true, isIndexed: true },
|
|
16901
|
-
{ name: "superseded_at", type: "number", isOptional: true }
|
|
16912
|
+
{ name: "superseded_at", type: "number", isOptional: true },
|
|
16913
|
+
// The extraction-logic version this memory was last stamped under. Null
|
|
16914
|
+
// (pre-v38) is treated as version 0, so a bump of TOPICS_EXTRACTION_VERSION
|
|
16915
|
+
// re-extracts stale rows. See getMemoriesNeedingTopicExtractionOp.
|
|
16916
|
+
{ name: "topics_extracted_version", type: "number", isOptional: true }
|
|
16902
16917
|
]
|
|
16903
16918
|
}),
|
|
16904
16919
|
// Entity table — canonical names extracted from auto-extraction (W5).
|
|
@@ -17524,6 +17539,19 @@ var sdkMigrations = (0, import_migrations2.schemaMigrations)({
|
|
|
17524
17539
|
]
|
|
17525
17540
|
})
|
|
17526
17541
|
]
|
|
17542
|
+
},
|
|
17543
|
+
// v37 -> v38: topics_extracted_version on memory_vault. Existing rows keep it
|
|
17544
|
+
// NULL, read as version 0 by getMemoriesNeedingTopicExtractionOp — so the
|
|
17545
|
+
// first sweep after a TOPICS_EXTRACTION_VERSION bump re-extracts them (drained
|
|
17546
|
+
// across sweeps by the worker's limit). See topicExtract.ts.
|
|
17547
|
+
{
|
|
17548
|
+
toVersion: 38,
|
|
17549
|
+
steps: [
|
|
17550
|
+
(0, import_migrations2.addColumns)({
|
|
17551
|
+
table: "memory_vault",
|
|
17552
|
+
columns: [{ name: "topics_extracted_version", type: "number", isOptional: true }]
|
|
17553
|
+
})
|
|
17554
|
+
]
|
|
17527
17555
|
}
|
|
17528
17556
|
]
|
|
17529
17557
|
});
|
|
@@ -18888,6 +18916,7 @@ function createNotionTools(getAccessToken, requestNotionAccess) {
|
|
|
18888
18916
|
StoredVaultFolderModel,
|
|
18889
18917
|
StoredVaultMemoryModel,
|
|
18890
18918
|
StreamExpiredError,
|
|
18919
|
+
TOPICS_EXTRACTION_VERSION,
|
|
18891
18920
|
TOPIC_EXTRACTION_BATCH_SIZE,
|
|
18892
18921
|
WalletPoller,
|
|
18893
18922
|
addConversationMemoriesOp,
|
package/dist/expo/index.d.mts
CHANGED
|
@@ -4319,6 +4319,9 @@ declare class VaultMemory extends Model {
|
|
|
4319
4319
|
/** A2 supersession: newer memory id that replaced this one, or null if live. */
|
|
4320
4320
|
supersededBy: string | null;
|
|
4321
4321
|
supersededAt: number | null;
|
|
4322
|
+
/** Extraction-logic version this memory was last stamped under. Null (pre-v38)
|
|
4323
|
+
* reads as 0, so a TOPICS_EXTRACTION_VERSION bump re-extracts stale rows. */
|
|
4324
|
+
topicsExtractedVersion: number | null;
|
|
4322
4325
|
createdAt: Date;
|
|
4323
4326
|
updatedAt: Date;
|
|
4324
4327
|
isDeleted: boolean;
|
|
@@ -4433,6 +4436,9 @@ interface StoredVaultMemory {
|
|
|
4433
4436
|
supersededBy: string | null;
|
|
4434
4437
|
/** Unix ms when this memory was superseded. Null when live. */
|
|
4435
4438
|
supersededAt: number | null;
|
|
4439
|
+
/** Extraction-logic version this memory was last stamped under. Null (pre-v38)
|
|
4440
|
+
* reads as 0, so a TOPICS_EXTRACTION_VERSION bump re-extracts stale rows. */
|
|
4441
|
+
topicsExtractedVersion: number | null;
|
|
4436
4442
|
createdAt: Date;
|
|
4437
4443
|
updatedAt: Date;
|
|
4438
4444
|
isDeleted: boolean;
|
|
@@ -4569,6 +4575,14 @@ declare function supersedeVaultMemoryOp(ctx: VaultMemoryOperationsContext, id: s
|
|
|
4569
4575
|
* Get all non-deleted, unfiled vault memories (folder_id is null).
|
|
4570
4576
|
*/
|
|
4571
4577
|
declare function getUnfiledVaultMemoriesOp(ctx: VaultMemoryOperationsContext): Promise<StoredVaultMemory[]>;
|
|
4578
|
+
/**
|
|
4579
|
+
* The current topic-extraction logic version. Bump this whenever the extraction
|
|
4580
|
+
* prompt or model in `topicExtract.ts` changes: every memory stamped under an
|
|
4581
|
+
* older version (including pre-v37 rows, read as version 0) is then re-extracted
|
|
4582
|
+
* by the next sweep, so topic-quality improvements propagate across the existing
|
|
4583
|
+
* vault. The worker's `limit` drains that re-extraction across sweeps.
|
|
4584
|
+
*/
|
|
4585
|
+
declare const TOPICS_EXTRACTION_VERSION = 1;
|
|
4572
4586
|
/**
|
|
4573
4587
|
* Result of {@link getMemoriesNeedingTopicExtractionOp}: which memories the
|
|
4574
4588
|
* background topic worker should run LLM entity extraction on, and which it
|
|
@@ -4578,8 +4592,10 @@ interface MemoriesNeedingTopicExtraction {
|
|
|
4578
4592
|
/**
|
|
4579
4593
|
* Memories to run LLM topic extraction on (decrypted): never-extracted rows
|
|
4580
4594
|
* with no entity links, plus stamped rows edited since their last pass
|
|
4581
|
-
* (`updated_at` > `topics_extracted_at`)
|
|
4582
|
-
*
|
|
4595
|
+
* (`updated_at` > `topics_extracted_at`) or extracted under an older
|
|
4596
|
+
* `topics_extracted_version` than {@link TOPICS_EXTRACTION_VERSION}. Edited /
|
|
4597
|
+
* stale-version rows come first (they get priority under `limit`), each group
|
|
4598
|
+
* newest-created first.
|
|
4583
4599
|
*/
|
|
4584
4600
|
pending: StoredVaultMemory[];
|
|
4585
4601
|
/**
|
|
@@ -4603,13 +4619,16 @@ declare function getMemoriesNeedingTopicExtractionOp(ctx: VaultMemoryOperationsC
|
|
|
4603
4619
|
limit?: number;
|
|
4604
4620
|
}): Promise<MemoriesNeedingTopicExtraction>;
|
|
4605
4621
|
/**
|
|
4606
|
-
* Stamp `topics_extracted_at` on the given
|
|
4607
|
-
* this after a successful extraction pass
|
|
4608
|
-
* quiet memories aren't re-asked every sweep)
|
|
4609
|
-
* `linkedUnstamped` rows without an LLM call.
|
|
4610
|
-
*
|
|
4611
|
-
*
|
|
4612
|
-
*
|
|
4622
|
+
* Stamp `topics_extracted_at` (and `topics_extracted_version`) on the given
|
|
4623
|
+
* memories — the topic worker calls this after a successful extraction pass
|
|
4624
|
+
* (including zero-entity results, so quiet memories aren't re-asked every sweep)
|
|
4625
|
+
* and to grandfather `linkedUnstamped` rows without an LLM call. `version`
|
|
4626
|
+
* defaults to {@link TOPICS_EXTRACTION_VERSION}: stamping at the current version
|
|
4627
|
+
* (for both fresh extractions and grandfathered legacy rows) means they aren't
|
|
4628
|
+
* re-extracted until a future version bump. Preserves `updated_at` so a stamp
|
|
4629
|
+
* never inflates the recency multiplier — and never masks a concurrent content
|
|
4630
|
+
* edit from the next sweep. Skips deleted, foreign-user, and user-managed rows.
|
|
4631
|
+
* Returns the IDs actually stamped.
|
|
4613
4632
|
*
|
|
4614
4633
|
* ALL eligibility AND `updated_at` are read from the LIVE Model inside the
|
|
4615
4634
|
* serialized writer — never a pre-writer snapshot. Writers are serialized, so
|
|
@@ -4624,7 +4643,7 @@ declare function getMemoriesNeedingTopicExtractionOp(ctx: VaultMemoryOperationsC
|
|
|
4624
4643
|
* (both `pending` and `linkedUnstamped` are capped), so the per-row Model load
|
|
4625
4644
|
* needed to `prepareUpdate` stays bounded and never spikes the RecordCache.
|
|
4626
4645
|
*/
|
|
4627
|
-
declare function stampTopicsExtractedAtOp(ctx: VaultMemoryOperationsContext, memoryIds: readonly string[], extractedAt: number): Promise<string[]>;
|
|
4646
|
+
declare function stampTopicsExtractedAtOp(ctx: VaultMemoryOperationsContext, memoryIds: readonly string[], extractedAt: number, version?: number): Promise<string[]>;
|
|
4628
4647
|
declare function deleteAllVaultMemoriesForUserOp(ctx: VaultMemoryOperationsContext, userId: string): Promise<number>;
|
|
4629
4648
|
declare function updateVaultMemoryEmbeddingOp(ctx: VaultMemoryOperationsContext, id: string, embedding: string, embeddingModel: string): Promise<boolean>;
|
|
4630
4649
|
|
|
@@ -6769,8 +6788,12 @@ declare function useChatStorage(options: UseChatStorageOptions): UseChatStorageR
|
|
|
6769
6788
|
* write-time supersession — a changed fact retires the stale one (points at
|
|
6770
6789
|
* the newer memory) instead of both surviving; superseded rows are excluded
|
|
6771
6790
|
* from recall/dedup by default
|
|
6791
|
+
* - v38: Added topics_extracted_version column to memory_vault — the extraction
|
|
6792
|
+
* logic version a memory was last stamped under. Bumping TOPICS_EXTRACTION_VERSION
|
|
6793
|
+
* (new prompt/model) makes the worker re-extract every row whose stored version
|
|
6794
|
+
* is behind, so topic-quality improvements propagate across the existing vault
|
|
6772
6795
|
*/
|
|
6773
|
-
declare const SDK_SCHEMA_VERSION =
|
|
6796
|
+
declare const SDK_SCHEMA_VERSION = 38;
|
|
6774
6797
|
/**
|
|
6775
6798
|
* Combined WatermelonDB schema for all SDK storage modules.
|
|
6776
6799
|
*
|
|
@@ -7372,4 +7395,4 @@ declare function refreshNotionAccessToken(params: NotionRefreshTokenParams): Pro
|
|
|
7372
7395
|
*/
|
|
7373
7396
|
declare function createNotionTools(getAccessToken: () => string | null, requestNotionAccess: () => Promise<string>): ToolConfig[];
|
|
7374
7397
|
|
|
7375
|
-
export { type AutoExtractMessage, type AutoExtractor, type Budget, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkVectorCache, type ChunkingOptions, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type EmbeddedWalletSignerFn, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FlushResult, type GetMessagesPageOptions, INFERENCE_ID_HEADER, type LazyStoredConversation, type Logger, LoggerProvider, type LoggerProviderProps, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MessageRedactionResult, type MessageSkeleton, NOTION_OAUTH_CONFIG, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, PII_PATTERNS, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PromptPreProcessor, type PromptPreProcessorContext, type QuantizedEmbedding, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageDetachedResult, type SendMessageWithStorageResult, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type StockPriceClassification, type StockPricePreProcessorOptions, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredMessage, type StoredMessageWithSimilarity, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, TOPIC_EXTRACTION_BATCH_SIZE, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, buildNotionAuthUrl, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createNotionTools, createPlatformCursorStore, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, hasEncryptionKey, isPiiRedactor, isRerankerAvailable, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, preEmbedVaultMemories, quantizeEmbedding, queueManager, recall, reflect, refreshNotionAccessToken, registerNotionClient, requestEncryptionKey, resolvePiiRedactor, resumeStream, retain, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, setLogger, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, supersedeVaultMemoryOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, xhrTransport };
|
|
7398
|
+
export { type AutoExtractMessage, type AutoExtractor, type Budget, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkVectorCache, type ChunkingOptions, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type EmbeddedWalletSignerFn, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FlushResult, type GetMessagesPageOptions, INFERENCE_ID_HEADER, type LazyStoredConversation, type Logger, LoggerProvider, type LoggerProviderProps, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MessageRedactionResult, type MessageSkeleton, NOTION_OAUTH_CONFIG, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, PII_PATTERNS, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PromptPreProcessor, type PromptPreProcessorContext, type QuantizedEmbedding, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageDetachedResult, type SendMessageWithStorageResult, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type StockPriceClassification, type StockPricePreProcessorOptions, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredMessage, type StoredMessageWithSimilarity, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, buildNotionAuthUrl, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createNotionTools, createPlatformCursorStore, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, hasEncryptionKey, isPiiRedactor, isRerankerAvailable, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, preEmbedVaultMemories, quantizeEmbedding, queueManager, recall, reflect, refreshNotionAccessToken, registerNotionClient, requestEncryptionKey, resolvePiiRedactor, resumeStream, retain, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, setLogger, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, supersedeVaultMemoryOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, xhrTransport };
|
package/dist/expo/index.d.ts
CHANGED
|
@@ -4319,6 +4319,9 @@ declare class VaultMemory extends Model {
|
|
|
4319
4319
|
/** A2 supersession: newer memory id that replaced this one, or null if live. */
|
|
4320
4320
|
supersededBy: string | null;
|
|
4321
4321
|
supersededAt: number | null;
|
|
4322
|
+
/** Extraction-logic version this memory was last stamped under. Null (pre-v38)
|
|
4323
|
+
* reads as 0, so a TOPICS_EXTRACTION_VERSION bump re-extracts stale rows. */
|
|
4324
|
+
topicsExtractedVersion: number | null;
|
|
4322
4325
|
createdAt: Date;
|
|
4323
4326
|
updatedAt: Date;
|
|
4324
4327
|
isDeleted: boolean;
|
|
@@ -4433,6 +4436,9 @@ interface StoredVaultMemory {
|
|
|
4433
4436
|
supersededBy: string | null;
|
|
4434
4437
|
/** Unix ms when this memory was superseded. Null when live. */
|
|
4435
4438
|
supersededAt: number | null;
|
|
4439
|
+
/** Extraction-logic version this memory was last stamped under. Null (pre-v38)
|
|
4440
|
+
* reads as 0, so a TOPICS_EXTRACTION_VERSION bump re-extracts stale rows. */
|
|
4441
|
+
topicsExtractedVersion: number | null;
|
|
4436
4442
|
createdAt: Date;
|
|
4437
4443
|
updatedAt: Date;
|
|
4438
4444
|
isDeleted: boolean;
|
|
@@ -4569,6 +4575,14 @@ declare function supersedeVaultMemoryOp(ctx: VaultMemoryOperationsContext, id: s
|
|
|
4569
4575
|
* Get all non-deleted, unfiled vault memories (folder_id is null).
|
|
4570
4576
|
*/
|
|
4571
4577
|
declare function getUnfiledVaultMemoriesOp(ctx: VaultMemoryOperationsContext): Promise<StoredVaultMemory[]>;
|
|
4578
|
+
/**
|
|
4579
|
+
* The current topic-extraction logic version. Bump this whenever the extraction
|
|
4580
|
+
* prompt or model in `topicExtract.ts` changes: every memory stamped under an
|
|
4581
|
+
* older version (including pre-v37 rows, read as version 0) is then re-extracted
|
|
4582
|
+
* by the next sweep, so topic-quality improvements propagate across the existing
|
|
4583
|
+
* vault. The worker's `limit` drains that re-extraction across sweeps.
|
|
4584
|
+
*/
|
|
4585
|
+
declare const TOPICS_EXTRACTION_VERSION = 1;
|
|
4572
4586
|
/**
|
|
4573
4587
|
* Result of {@link getMemoriesNeedingTopicExtractionOp}: which memories the
|
|
4574
4588
|
* background topic worker should run LLM entity extraction on, and which it
|
|
@@ -4578,8 +4592,10 @@ interface MemoriesNeedingTopicExtraction {
|
|
|
4578
4592
|
/**
|
|
4579
4593
|
* Memories to run LLM topic extraction on (decrypted): never-extracted rows
|
|
4580
4594
|
* with no entity links, plus stamped rows edited since their last pass
|
|
4581
|
-
* (`updated_at` > `topics_extracted_at`)
|
|
4582
|
-
*
|
|
4595
|
+
* (`updated_at` > `topics_extracted_at`) or extracted under an older
|
|
4596
|
+
* `topics_extracted_version` than {@link TOPICS_EXTRACTION_VERSION}. Edited /
|
|
4597
|
+
* stale-version rows come first (they get priority under `limit`), each group
|
|
4598
|
+
* newest-created first.
|
|
4583
4599
|
*/
|
|
4584
4600
|
pending: StoredVaultMemory[];
|
|
4585
4601
|
/**
|
|
@@ -4603,13 +4619,16 @@ declare function getMemoriesNeedingTopicExtractionOp(ctx: VaultMemoryOperationsC
|
|
|
4603
4619
|
limit?: number;
|
|
4604
4620
|
}): Promise<MemoriesNeedingTopicExtraction>;
|
|
4605
4621
|
/**
|
|
4606
|
-
* Stamp `topics_extracted_at` on the given
|
|
4607
|
-
* this after a successful extraction pass
|
|
4608
|
-
* quiet memories aren't re-asked every sweep)
|
|
4609
|
-
* `linkedUnstamped` rows without an LLM call.
|
|
4610
|
-
*
|
|
4611
|
-
*
|
|
4612
|
-
*
|
|
4622
|
+
* Stamp `topics_extracted_at` (and `topics_extracted_version`) on the given
|
|
4623
|
+
* memories — the topic worker calls this after a successful extraction pass
|
|
4624
|
+
* (including zero-entity results, so quiet memories aren't re-asked every sweep)
|
|
4625
|
+
* and to grandfather `linkedUnstamped` rows without an LLM call. `version`
|
|
4626
|
+
* defaults to {@link TOPICS_EXTRACTION_VERSION}: stamping at the current version
|
|
4627
|
+
* (for both fresh extractions and grandfathered legacy rows) means they aren't
|
|
4628
|
+
* re-extracted until a future version bump. Preserves `updated_at` so a stamp
|
|
4629
|
+
* never inflates the recency multiplier — and never masks a concurrent content
|
|
4630
|
+
* edit from the next sweep. Skips deleted, foreign-user, and user-managed rows.
|
|
4631
|
+
* Returns the IDs actually stamped.
|
|
4613
4632
|
*
|
|
4614
4633
|
* ALL eligibility AND `updated_at` are read from the LIVE Model inside the
|
|
4615
4634
|
* serialized writer — never a pre-writer snapshot. Writers are serialized, so
|
|
@@ -4624,7 +4643,7 @@ declare function getMemoriesNeedingTopicExtractionOp(ctx: VaultMemoryOperationsC
|
|
|
4624
4643
|
* (both `pending` and `linkedUnstamped` are capped), so the per-row Model load
|
|
4625
4644
|
* needed to `prepareUpdate` stays bounded and never spikes the RecordCache.
|
|
4626
4645
|
*/
|
|
4627
|
-
declare function stampTopicsExtractedAtOp(ctx: VaultMemoryOperationsContext, memoryIds: readonly string[], extractedAt: number): Promise<string[]>;
|
|
4646
|
+
declare function stampTopicsExtractedAtOp(ctx: VaultMemoryOperationsContext, memoryIds: readonly string[], extractedAt: number, version?: number): Promise<string[]>;
|
|
4628
4647
|
declare function deleteAllVaultMemoriesForUserOp(ctx: VaultMemoryOperationsContext, userId: string): Promise<number>;
|
|
4629
4648
|
declare function updateVaultMemoryEmbeddingOp(ctx: VaultMemoryOperationsContext, id: string, embedding: string, embeddingModel: string): Promise<boolean>;
|
|
4630
4649
|
|
|
@@ -6769,8 +6788,12 @@ declare function useChatStorage(options: UseChatStorageOptions): UseChatStorageR
|
|
|
6769
6788
|
* write-time supersession — a changed fact retires the stale one (points at
|
|
6770
6789
|
* the newer memory) instead of both surviving; superseded rows are excluded
|
|
6771
6790
|
* from recall/dedup by default
|
|
6791
|
+
* - v38: Added topics_extracted_version column to memory_vault — the extraction
|
|
6792
|
+
* logic version a memory was last stamped under. Bumping TOPICS_EXTRACTION_VERSION
|
|
6793
|
+
* (new prompt/model) makes the worker re-extract every row whose stored version
|
|
6794
|
+
* is behind, so topic-quality improvements propagate across the existing vault
|
|
6772
6795
|
*/
|
|
6773
|
-
declare const SDK_SCHEMA_VERSION =
|
|
6796
|
+
declare const SDK_SCHEMA_VERSION = 38;
|
|
6774
6797
|
/**
|
|
6775
6798
|
* Combined WatermelonDB schema for all SDK storage modules.
|
|
6776
6799
|
*
|
|
@@ -7372,4 +7395,4 @@ declare function refreshNotionAccessToken(params: NotionRefreshTokenParams): Pro
|
|
|
7372
7395
|
*/
|
|
7373
7396
|
declare function createNotionTools(getAccessToken: () => string | null, requestNotionAccess: () => Promise<string>): ToolConfig[];
|
|
7374
7397
|
|
|
7375
|
-
export { type AutoExtractMessage, type AutoExtractor, type Budget, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkVectorCache, type ChunkingOptions, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type EmbeddedWalletSignerFn, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FlushResult, type GetMessagesPageOptions, INFERENCE_ID_HEADER, type LazyStoredConversation, type Logger, LoggerProvider, type LoggerProviderProps, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MessageRedactionResult, type MessageSkeleton, NOTION_OAUTH_CONFIG, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, PII_PATTERNS, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PromptPreProcessor, type PromptPreProcessorContext, type QuantizedEmbedding, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageDetachedResult, type SendMessageWithStorageResult, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type StockPriceClassification, type StockPricePreProcessorOptions, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredMessage, type StoredMessageWithSimilarity, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, TOPIC_EXTRACTION_BATCH_SIZE, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, buildNotionAuthUrl, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createNotionTools, createPlatformCursorStore, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, hasEncryptionKey, isPiiRedactor, isRerankerAvailable, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, preEmbedVaultMemories, quantizeEmbedding, queueManager, recall, reflect, refreshNotionAccessToken, registerNotionClient, requestEncryptionKey, resolvePiiRedactor, resumeStream, retain, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, setLogger, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, supersedeVaultMemoryOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, xhrTransport };
|
|
7398
|
+
export { type AutoExtractMessage, type AutoExtractor, type Budget, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkVectorCache, type ChunkingOptions, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type EmbeddedWalletSignerFn, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FlushResult, type GetMessagesPageOptions, INFERENCE_ID_HEADER, type LazyStoredConversation, type Logger, LoggerProvider, type LoggerProviderProps, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MessageRedactionResult, type MessageSkeleton, NOTION_OAUTH_CONFIG, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, PII_PATTERNS, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PromptPreProcessor, type PromptPreProcessorContext, type QuantizedEmbedding, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageDetachedResult, type SendMessageWithStorageResult, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type StockPriceClassification, type StockPricePreProcessorOptions, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredMessage, type StoredMessageWithSimilarity, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, buildNotionAuthUrl, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createNotionTools, createPlatformCursorStore, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, hasEncryptionKey, isPiiRedactor, isRerankerAvailable, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, preEmbedVaultMemories, quantizeEmbedding, queueManager, recall, reflect, refreshNotionAccessToken, registerNotionClient, requestEncryptionKey, resolvePiiRedactor, resumeStream, retain, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, setLogger, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, supersedeVaultMemoryOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, xhrTransport };
|
package/dist/expo/index.mjs
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
ENTITY_KINDS,
|
|
9
9
|
LRUCache,
|
|
10
10
|
RerankerUnavailableError,
|
|
11
|
+
TOPICS_EXTRACTION_VERSION,
|
|
11
12
|
chunkAndEmbedAllMessages,
|
|
12
13
|
chunkAndEmbedMessage,
|
|
13
14
|
chunkText,
|
|
@@ -88,7 +89,7 @@ import {
|
|
|
88
89
|
upsertMessageOp,
|
|
89
90
|
useEncryption,
|
|
90
91
|
vaultMemoryToStored
|
|
91
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-TCRDSUC6.mjs";
|
|
92
93
|
import {
|
|
93
94
|
PII_PATTERNS,
|
|
94
95
|
PiiRedactor,
|
|
@@ -5516,6 +5517,9 @@ __decorateClass([
|
|
|
5516
5517
|
__decorateClass([
|
|
5517
5518
|
field3("superseded_at")
|
|
5518
5519
|
], VaultMemory.prototype, "supersededAt", 2);
|
|
5520
|
+
__decorateClass([
|
|
5521
|
+
field3("topics_extracted_version")
|
|
5522
|
+
], VaultMemory.prototype, "topicsExtractedVersion", 2);
|
|
5519
5523
|
__decorateClass([
|
|
5520
5524
|
readonly2,
|
|
5521
5525
|
date3("created_at")
|
|
@@ -9573,7 +9577,7 @@ __decorateClass([
|
|
|
9573
9577
|
], VaultFolder.prototype, "context", 2);
|
|
9574
9578
|
|
|
9575
9579
|
// src/lib/db/schema.ts
|
|
9576
|
-
var SDK_SCHEMA_VERSION =
|
|
9580
|
+
var SDK_SCHEMA_VERSION = 38;
|
|
9577
9581
|
var sdkSchema = appSchema2({
|
|
9578
9582
|
version: SDK_SCHEMA_VERSION,
|
|
9579
9583
|
tables: [
|
|
@@ -9707,7 +9711,11 @@ var sdkSchema = appSchema2({
|
|
|
9707
9711
|
// and dedup by default. Null = live (not superseded). Indexed so the
|
|
9708
9712
|
// recall filter stays cheap.
|
|
9709
9713
|
{ name: "superseded_by", type: "string", isOptional: true, isIndexed: true },
|
|
9710
|
-
{ name: "superseded_at", type: "number", isOptional: true }
|
|
9714
|
+
{ name: "superseded_at", type: "number", isOptional: true },
|
|
9715
|
+
// The extraction-logic version this memory was last stamped under. Null
|
|
9716
|
+
// (pre-v38) is treated as version 0, so a bump of TOPICS_EXTRACTION_VERSION
|
|
9717
|
+
// re-extracts stale rows. See getMemoriesNeedingTopicExtractionOp.
|
|
9718
|
+
{ name: "topics_extracted_version", type: "number", isOptional: true }
|
|
9711
9719
|
]
|
|
9712
9720
|
}),
|
|
9713
9721
|
// Entity table — canonical names extracted from auto-extraction (W5).
|
|
@@ -10333,6 +10341,19 @@ var sdkMigrations = schemaMigrations2({
|
|
|
10333
10341
|
]
|
|
10334
10342
|
})
|
|
10335
10343
|
]
|
|
10344
|
+
},
|
|
10345
|
+
// v37 -> v38: topics_extracted_version on memory_vault. Existing rows keep it
|
|
10346
|
+
// NULL, read as version 0 by getMemoriesNeedingTopicExtractionOp — so the
|
|
10347
|
+
// first sweep after a TOPICS_EXTRACTION_VERSION bump re-extracts them (drained
|
|
10348
|
+
// across sweeps by the worker's limit). See topicExtract.ts.
|
|
10349
|
+
{
|
|
10350
|
+
toVersion: 38,
|
|
10351
|
+
steps: [
|
|
10352
|
+
addColumns2({
|
|
10353
|
+
table: "memory_vault",
|
|
10354
|
+
columns: [{ name: "topics_extracted_version", type: "number", isOptional: true }]
|
|
10355
|
+
})
|
|
10356
|
+
]
|
|
10336
10357
|
}
|
|
10337
10358
|
]
|
|
10338
10359
|
});
|
|
@@ -11692,6 +11713,7 @@ export {
|
|
|
11692
11713
|
VaultFolder as StoredVaultFolderModel,
|
|
11693
11714
|
VaultMemory as StoredVaultMemoryModel,
|
|
11694
11715
|
StreamExpiredError,
|
|
11716
|
+
TOPICS_EXTRACTION_VERSION,
|
|
11695
11717
|
TOPIC_EXTRACTION_BATCH_SIZE,
|
|
11696
11718
|
WalletPoller,
|
|
11697
11719
|
addConversationMemoriesOp,
|
|
@@ -2068,6 +2068,7 @@ function vaultMemoryToStoredRaw(memory) {
|
|
|
2068
2068
|
eventTimeKind: memory.eventTimeKind ?? null,
|
|
2069
2069
|
topicsUserManaged: memory.topicsUserManaged ?? false,
|
|
2070
2070
|
topicsExtractedAt: memory.topicsExtractedAt ?? null,
|
|
2071
|
+
topicsExtractedVersion: memory.topicsExtractedVersion ?? null,
|
|
2071
2072
|
supersededBy: memory.supersededBy ?? null,
|
|
2072
2073
|
supersededAt: memory.supersededAt ?? null,
|
|
2073
2074
|
createdAt: memory.createdAt,
|
|
@@ -2307,6 +2308,7 @@ function vaultMemoryRawToStoredRaw(raw) {
|
|
|
2307
2308
|
// SQLite stores booleans as 0/1, LokiJS as true/false — coerce both.
|
|
2308
2309
|
topicsUserManaged: raw.topics_user_managed === true || raw.topics_user_managed === 1,
|
|
2309
2310
|
topicsExtractedAt: raw.topics_extracted_at ?? null,
|
|
2311
|
+
topicsExtractedVersion: raw.topics_extracted_version ?? null,
|
|
2310
2312
|
supersededBy: raw.superseded_by ?? null,
|
|
2311
2313
|
supersededAt: raw.superseded_at ?? null,
|
|
2312
2314
|
createdAt: new Date(raw.created_at),
|
|
@@ -2461,7 +2463,10 @@ async function clearMemoryTopicsOverrideOp(ctx, memoryId) {
|
|
|
2461
2463
|
await ctx.database.write(async () => {
|
|
2462
2464
|
await record.update((r) => {
|
|
2463
2465
|
r._setRaw("topics_user_managed", false);
|
|
2464
|
-
r._setRaw("
|
|
2466
|
+
r._setRaw("topics_extracted_version", null);
|
|
2467
|
+
if (record.topicsExtractedAt === null) {
|
|
2468
|
+
r._setRaw("topics_extracted_at", originalUpdatedAt);
|
|
2469
|
+
}
|
|
2465
2470
|
r._setRaw("updated_at", originalUpdatedAt);
|
|
2466
2471
|
});
|
|
2467
2472
|
});
|
|
@@ -2539,6 +2544,7 @@ async function getUnfiledVaultMemoriesOp(ctx) {
|
|
|
2539
2544
|
(record) => vaultMemoryToStored(record, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner)
|
|
2540
2545
|
);
|
|
2541
2546
|
}
|
|
2547
|
+
var TOPICS_EXTRACTION_VERSION = 1;
|
|
2542
2548
|
async function getMemoriesNeedingTopicExtractionOp(ctx, options) {
|
|
2543
2549
|
const entityCtx = ctx.entityCtx;
|
|
2544
2550
|
if (!entityCtx) {
|
|
@@ -2557,7 +2563,10 @@ async function getMemoriesNeedingTopicExtractionOp(ctx, options) {
|
|
|
2557
2563
|
for (const raw of rows) {
|
|
2558
2564
|
const stamp = raw.topics_extracted_at ?? null;
|
|
2559
2565
|
if (stamp !== null) {
|
|
2560
|
-
|
|
2566
|
+
const version = raw.topics_extracted_version ?? 0;
|
|
2567
|
+
if (raw.updated_at > stamp || version < TOPICS_EXTRACTION_VERSION) {
|
|
2568
|
+
stampedPending.push(raw);
|
|
2569
|
+
}
|
|
2561
2570
|
} else {
|
|
2562
2571
|
unstamped.push(raw);
|
|
2563
2572
|
}
|
|
@@ -2587,7 +2596,7 @@ async function getMemoriesNeedingTopicExtractionOp(ctx, options) {
|
|
|
2587
2596
|
);
|
|
2588
2597
|
return { pending, linkedUnstamped };
|
|
2589
2598
|
}
|
|
2590
|
-
async function stampTopicsExtractedAtOp(ctx, memoryIds, extractedAt) {
|
|
2599
|
+
async function stampTopicsExtractedAtOp(ctx, memoryIds, extractedAt, version = TOPICS_EXTRACTION_VERSION) {
|
|
2591
2600
|
if (memoryIds.length === 0) return [];
|
|
2592
2601
|
const uniqueIds = Array.from(new Set(memoryIds));
|
|
2593
2602
|
const CHUNK = 500;
|
|
@@ -2610,6 +2619,7 @@ async function stampTopicsExtractedAtOp(ctx, memoryIds, extractedAt) {
|
|
|
2610
2619
|
prepared.push(
|
|
2611
2620
|
record.prepareUpdate((r) => {
|
|
2612
2621
|
r._setRaw("topics_extracted_at", extractedAt);
|
|
2622
|
+
r._setRaw("topics_extracted_version", version);
|
|
2613
2623
|
r._setRaw("updated_at", originalUpdatedAt);
|
|
2614
2624
|
})
|
|
2615
2625
|
);
|
|
@@ -5374,7 +5384,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
|
|
|
5374
5384
|
legacy.map((r) => ({ id: r.uniqueId, content: r.content, score: r.similarity }))
|
|
5375
5385
|
);
|
|
5376
5386
|
}
|
|
5377
|
-
const { recall: recall2 } = await import("./recall-
|
|
5387
|
+
const { recall: recall2 } = await import("./recall-PV7L3SN3.mjs");
|
|
5378
5388
|
const result = await recall2(
|
|
5379
5389
|
query,
|
|
5380
5390
|
{ vaultCtx, embeddingOptions, vaultCache: cache },
|
|
@@ -6111,6 +6121,7 @@ export {
|
|
|
6111
6121
|
deleteVaultMemoryOp,
|
|
6112
6122
|
supersedeVaultMemoryOp,
|
|
6113
6123
|
getUnfiledVaultMemoriesOp,
|
|
6124
|
+
TOPICS_EXTRACTION_VERSION,
|
|
6114
6125
|
getMemoriesNeedingTopicExtractionOp,
|
|
6115
6126
|
stampTopicsExtractedAtOp,
|
|
6116
6127
|
deleteAllVaultMemoriesForUserOp,
|