@anuma/sdk 3.12.2 → 3.13.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.
@@ -19,6 +19,7 @@ import {
19
19
  VAULT_SIZE_HOP_CAP,
20
20
  archiveVaultMemoryOp,
21
21
  assertVaultScopeForSweep,
22
+ backfillMemoryTopicsOp,
22
23
  capHopsForDensity,
23
24
  chunkAndEmbedAllMessages,
24
25
  chunkAndEmbedMessage,
@@ -94,6 +95,7 @@ import {
94
95
  prepareVaultCandidates,
95
96
  rankPreparedVaultCandidates,
96
97
  recall,
98
+ relinkMemoryTopicsOp,
97
99
  replaceMemoryEntitiesGuardedOp,
98
100
  requestEncryptionKey,
99
101
  requestKeyPair,
@@ -131,7 +133,7 @@ import {
131
133
  updateVaultMemoryOp,
132
134
  upsertMessageOp,
133
135
  vaultMemoryToStored
134
- } from "./chunk-FXGG7JA5.mjs";
136
+ } from "./chunk-ME6ZQN52.mjs";
135
137
  import {
136
138
  createStreamingDeAnonymizer,
137
139
  notifyConsolidationFallback,
@@ -1124,6 +1126,12 @@ __decorateClass([
1124
1126
  __decorateClass([
1125
1127
  (0, import_decorators6.field)("topics_user_managed")
1126
1128
  ], VaultMemory.prototype, "topicsUserManaged", 2);
1129
+ __decorateClass([
1130
+ (0, import_decorators6.field)("topics")
1131
+ ], VaultMemory.prototype, "topics", 2);
1132
+ __decorateClass([
1133
+ (0, import_decorators6.field)("topics_updated_at")
1134
+ ], VaultMemory.prototype, "topicsUpdatedAt", 2);
1127
1135
  __decorateClass([
1128
1136
  (0, import_decorators6.field)("topics_extracted_at")
1129
1137
  ], VaultMemory.prototype, "topicsExtractedAt", 2);
@@ -1307,7 +1315,7 @@ __decorateClass([
1307
1315
  ], VaultFolder.prototype, "context", 2);
1308
1316
 
1309
1317
  // src/lib/db/schema.ts
1310
- var SDK_SCHEMA_VERSION = 41;
1318
+ var SDK_SCHEMA_VERSION = 42;
1311
1319
  var sdkSchema = (0, import_watermelondb12.appSchema)({
1312
1320
  version: SDK_SCHEMA_VERSION,
1313
1321
  tables: [
@@ -1429,9 +1437,33 @@ var sdkSchema = (0, import_watermelondb12.appSchema)({
1429
1437
  // links). Auto-extraction then leaves its links alone — the user owns
1430
1438
  // them. Null/false = topics are auto-derived (default).
1431
1439
  { name: "topics_user_managed", type: "boolean", isOptional: true },
1440
+ // The memory's topics as a DURABLE, SYNCED record: a JSON array of
1441
+ // `{name, kind?, source}`, `name` in the caller's display casing (unlike
1442
+ // `entity.canonical_name`, which is lowercased and has no display
1443
+ // column). `entity` / `memory_entity` are a device-local INDEX over this
1444
+ // — their ids are locally generated, so they can never sync — and a
1445
+ // restored device rebuilds them from these names with no LLM call.
1446
+ // Null = predates v42 (backfilled from the row's current links by the
1447
+ // sweep's topicsBackfill bucket). See getMemoriesNeedingTopicExtractionOp.
1448
+ { name: "topics", type: "string", isOptional: true },
1449
+ // Unix ms of the last write to `topics`. A SECOND timestamp is required:
1450
+ // every topic writer deliberately pins `updated_at` so a topic change
1451
+ // doesn't inflate recall's recency multiplier, and both client sync
1452
+ // paths key on `updated_at` — so without this a topic-only change would
1453
+ // neither upload nor merge. Null = `topics` never written.
1454
+ { name: "topics_updated_at", type: "number", isOptional: true },
1432
1455
  // Unix ms of the last LLM topic-extraction pass over this memory's
1433
1456
  // content. Null = never extracted standalone (legacy rows with entity
1434
1457
  // links are grandfathered — see getMemoriesNeedingTopicExtractionOp).
1458
+ //
1459
+ // DEPRECATED (v42) — `topics_updated_at` subsumes this and
1460
+ // `topics_extracted_version` both: null there means never processed, and
1461
+ // non-null with an empty `topics` means processed and found nothing
1462
+ // (today's "answered empty" case), while a release-time
1463
+ // EXTRACTOR_CHANGED_AT constant compared against `topics_updated_at`
1464
+ // replaces the version check. Both columns are kept only to avoid a
1465
+ // column-drop migration in an otherwise additive list; removing them is
1466
+ // a follow-up once `topics` is proven in production.
1435
1467
  { name: "topics_extracted_at", type: "number", isOptional: true },
1436
1468
  // Write-time supersession (A2). When set, this fact was replaced by a
1437
1469
  // newer, incompatible-value fact (e.g. "Lives in Portland" superseded by
@@ -1445,6 +1477,9 @@ var sdkSchema = (0, import_watermelondb12.appSchema)({
1445
1477
  // The extraction-logic version this memory was last stamped under. Null
1446
1478
  // (pre-v38) is treated as version 0, so a bump of TOPICS_EXTRACTION_VERSION
1447
1479
  // re-extracts stale rows. See getMemoriesNeedingTopicExtractionOp.
1480
+ //
1481
+ // DEPRECATED (v42) alongside `topics_extracted_at` — same rationale and
1482
+ // same removal follow-up; see that column's note above.
1448
1483
  { name: "topics_extracted_version", type: "number", isOptional: true },
1449
1484
  // Re-observation watermark (C3). Unix ms of the last time retain() merged
1450
1485
  // a duplicate observation into this fact (proof_count++). Distinct from
@@ -2178,6 +2213,23 @@ var sdkMigrations = (0, import_migrations.schemaMigrations)({
2178
2213
  ]
2179
2214
  })
2180
2215
  ]
2216
+ },
2217
+ // v41 -> v42: topics + topics_updated_at on memory_vault — the durable,
2218
+ // synced record of a memory's topics. Existing rows keep both NULL: the
2219
+ // sweep's topicsBackfill bucket fills them from each row's current entity
2220
+ // links (no LLM), capped under the worker's `limit` so the one-time
2221
+ // re-upload it triggers drains across sweeps instead of spiking.
2222
+ {
2223
+ toVersion: 42,
2224
+ steps: [
2225
+ (0, import_migrations.addColumns)({
2226
+ table: "memory_vault",
2227
+ columns: [
2228
+ { name: "topics", type: "string", isOptional: true },
2229
+ { name: "topics_updated_at", type: "number", isOptional: true }
2230
+ ]
2231
+ })
2232
+ ]
2181
2233
  }
2182
2234
  ]
2183
2235
  });
@@ -12963,6 +13015,7 @@ export {
12963
13015
  activatedToolSetNames,
12964
13016
  analyzeStyle,
12965
13017
  archiveVaultMemoryOp,
13018
+ backfillMemoryTopicsOp,
12966
13019
  buildConnectorGuidance,
12967
13020
  buildDeniedToolsRider,
12968
13021
  buildSystemPrompt,
@@ -13120,6 +13173,7 @@ export {
13120
13173
  rankProfileCandidates,
13121
13174
  recall,
13122
13175
  reflect,
13176
+ relinkMemoryTopicsOp,
13123
13177
  relinkMisclassifiedVideosOp,
13124
13178
  renderTemplate,
13125
13179
  requestEncryptionKey,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  recall
3
- } from "./chunk-FXGG7JA5.mjs";
3
+ } from "./chunk-ME6ZQN52.mjs";
4
4
  import "./chunk-OBDRKQQI.mjs";
5
5
  import "./chunk-3RPGXXPZ.mjs";
6
6
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anuma/sdk",
3
- "version": "3.12.2",
3
+ "version": "3.13.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",