@remnic/core 9.3.603 → 9.3.605

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.
Files changed (64) hide show
  1. package/dist/access-cli.js +9 -9
  2. package/dist/access-schema.d.ts +34 -34
  3. package/dist/{chunk-JTDRJQ3K.js → chunk-6JGNHWCI.js} +2 -2
  4. package/dist/{chunk-M6I5Z4SR.js → chunk-6ZZP4EJF.js} +2 -2
  5. package/dist/{chunk-75O6YQ63.js → chunk-G6R5UD3Q.js} +10 -3
  6. package/dist/chunk-G6R5UD3Q.js.map +1 -0
  7. package/dist/{chunk-I4UNL747.js → chunk-GMAG2HS4.js} +7 -3
  8. package/dist/chunk-GMAG2HS4.js.map +1 -0
  9. package/dist/{chunk-5SQ5CQJP.js → chunk-HSVJGWYS.js} +2 -2
  10. package/dist/{chunk-RUYYYLDT.js → chunk-IOTENEVL.js} +3 -3
  11. package/dist/{chunk-M46RYSMW.js → chunk-JHMFYY7L.js} +5 -2
  12. package/dist/chunk-JHMFYY7L.js.map +1 -0
  13. package/dist/{chunk-2ESBDLT5.js → chunk-VJXSUAO7.js} +2 -2
  14. package/dist/{chunk-Z5AAYHUC.js → chunk-VOUOLGIP.js} +13 -2
  15. package/dist/chunk-VOUOLGIP.js.map +1 -0
  16. package/dist/{chunk-OB6353F7.js → chunk-XPSVGJYA.js} +4 -4
  17. package/dist/{chunk-MTGOAU7A.js → chunk-YJ6QCQNE.js} +336 -300
  18. package/dist/chunk-YJ6QCQNE.js.map +1 -0
  19. package/dist/{chunk-6PTSXBPE.js → chunk-ZDTVJXIP.js} +5 -2
  20. package/dist/chunk-ZDTVJXIP.js.map +1 -0
  21. package/dist/cli.js +8 -8
  22. package/dist/{first-start-migration-CKTCTCQI.js → first-start-migration-GYJWIH36.js} +2 -2
  23. package/dist/index.js +12 -12
  24. package/dist/namespaces/migrate.js +6 -6
  25. package/dist/namespaces/search.js +5 -5
  26. package/dist/operator-toolkit.js +7 -7
  27. package/dist/orchestrator.js +9 -9
  28. package/dist/retrieval-agents.js +2 -2
  29. package/dist/schemas.d.ts +42 -42
  30. package/dist/search/factory.js +4 -4
  31. package/dist/search/index.js +4 -4
  32. package/dist/search/lancedb-backend.d.ts +1 -0
  33. package/dist/search/lancedb-backend.js +1 -1
  34. package/dist/search/meilisearch-backend.d.ts +1 -0
  35. package/dist/search/meilisearch-backend.js +1 -1
  36. package/dist/search/orama-backend.d.ts +1 -0
  37. package/dist/search/orama-backend.js +1 -1
  38. package/dist/search/port.d.ts +1 -0
  39. package/dist/shared-context/manager.d.ts +2 -2
  40. package/dist/temporal-index.js +1 -1
  41. package/dist/tier-migration.d.ts +1 -0
  42. package/dist/tier-migration.js +1 -1
  43. package/package.json +1 -1
  44. package/src/orchestrator.ts +51 -8
  45. package/src/search/lancedb-backend.ts +5 -1
  46. package/src/search/meilisearch-backend.ts +7 -2
  47. package/src/search/orama-backend.ts +5 -1
  48. package/src/search/port.ts +1 -0
  49. package/src/temporal-index.test.ts +30 -1
  50. package/src/temporal-index.ts +10 -3
  51. package/src/tier-migration.ts +13 -2
  52. package/dist/chunk-6PTSXBPE.js.map +0 -1
  53. package/dist/chunk-75O6YQ63.js.map +0 -1
  54. package/dist/chunk-I4UNL747.js.map +0 -1
  55. package/dist/chunk-M46RYSMW.js.map +0 -1
  56. package/dist/chunk-MTGOAU7A.js.map +0 -1
  57. package/dist/chunk-Z5AAYHUC.js.map +0 -1
  58. /package/dist/{chunk-JTDRJQ3K.js.map → chunk-6JGNHWCI.js.map} +0 -0
  59. /package/dist/{chunk-M6I5Z4SR.js.map → chunk-6ZZP4EJF.js.map} +0 -0
  60. /package/dist/{chunk-5SQ5CQJP.js.map → chunk-HSVJGWYS.js.map} +0 -0
  61. /package/dist/{chunk-RUYYYLDT.js.map → chunk-IOTENEVL.js.map} +0 -0
  62. /package/dist/{chunk-2ESBDLT5.js.map → chunk-VJXSUAO7.js.map} +0 -0
  63. /package/dist/{chunk-OB6353F7.js.map → chunk-XPSVGJYA.js.map} +0 -0
  64. /package/dist/{first-start-migration-CKTCTCQI.js.map → first-start-migration-GYJWIH36.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/tier-migration.ts"],"sourcesContent":["import { appendFile, mkdir } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport type { MemoryFile } from \"./types.js\";\nimport { StorageManager } from \"./storage.js\";\nimport type { MemoryTier } from \"./tier-routing.js\";\nimport type { SearchBackend } from \"./search/port.js\";\n\nexport type { MemoryTier } from \"./tier-routing.js\";\n\nexport interface TierMigrationRequest {\n memory: MemoryFile;\n fromTier: MemoryTier;\n toTier: MemoryTier;\n reason: string;\n}\n\nexport interface TierMigrationResult {\n memoryId: string;\n fromTier: MemoryTier;\n toTier: MemoryTier;\n changed: boolean;\n reason: string;\n targetPath: string;\n}\n\nexport interface TierMigrationExecutorOptions {\n storage: StorageManager;\n qmd: SearchBackend;\n hotCollection: string;\n coldCollection: string;\n autoEmbed?: boolean;\n journalPath?: string;\n}\n\ntype TierMigrationJournalEntry = {\n ts: string;\n memoryId: string;\n fromTier: MemoryTier;\n toTier: MemoryTier;\n changed: boolean;\n reason: string;\n targetPath: string;\n};\n\nexport class TierMigrationExecutor {\n private readonly storage: StorageManager;\n private readonly qmd: SearchBackend;\n private readonly hotCollection: string;\n private readonly coldCollection: string;\n private readonly autoEmbed: boolean;\n private readonly journalPath: string;\n\n constructor(options: TierMigrationExecutorOptions) {\n this.storage = options.storage;\n this.qmd = options.qmd;\n this.hotCollection = options.hotCollection;\n this.coldCollection = options.coldCollection;\n this.autoEmbed = options.autoEmbed === true;\n this.journalPath = options.journalPath ?? path.join(this.storage.dir, \"state\", \"tier-migration-journal.jsonl\");\n }\n\n async migrateMemory(request: TierMigrationRequest): Promise<TierMigrationResult> {\n const { memory, fromTier, toTier, reason } = request;\n const targetPath = this.storage.buildTierMemoryPath(memory, toTier);\n\n if (fromTier === toTier) {\n const noChange: TierMigrationResult = {\n memoryId: memory.frontmatter.id,\n fromTier,\n toTier,\n changed: false,\n reason,\n targetPath,\n };\n await this.appendJournal(noChange);\n return noChange;\n }\n\n const moved = await this.storage.migrateMemoryToTier(memory, toTier);\n const result: TierMigrationResult = {\n memoryId: memory.frontmatter.id,\n fromTier,\n toTier,\n changed: moved.changed,\n reason,\n targetPath: moved.targetPath,\n };\n\n await this.appendJournal(result);\n\n if (result.changed) {\n const destinationCollection = this.collectionForTier(toTier);\n const sourceCollection = this.collectionForTier(fromTier);\n // QMD update is effectively global in current CLI versions. One update call is enough.\n await this.qmd.updateCollection(destinationCollection);\n if (this.autoEmbed) {\n await this.qmd.embedCollection(destinationCollection);\n if (sourceCollection !== destinationCollection) {\n await this.qmd.embedCollection(sourceCollection);\n }\n }\n }\n\n return result;\n }\n\n private collectionForTier(tier: MemoryTier): string {\n return tier === \"cold\" ? this.coldCollection : this.hotCollection;\n }\n\n private async appendJournal(result: TierMigrationResult): Promise<void> {\n const entry: TierMigrationJournalEntry = {\n ts: new Date().toISOString(),\n memoryId: result.memoryId,\n fromTier: result.fromTier,\n toTier: result.toTier,\n changed: result.changed,\n reason: result.reason,\n targetPath: result.targetPath,\n };\n await mkdir(path.dirname(this.journalPath), { recursive: true });\n await appendFile(this.journalPath, `${JSON.stringify(entry)}\\n`, \"utf-8\");\n }\n}\n"],"mappings":";AAAA,SAAS,YAAY,aAAa;AAClC,OAAO,UAAU;AA2CV,IAAM,wBAAN,MAA4B;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEjB,YAAY,SAAuC;AACjD,SAAK,UAAU,QAAQ;AACvB,SAAK,MAAM,QAAQ;AACnB,SAAK,gBAAgB,QAAQ;AAC7B,SAAK,iBAAiB,QAAQ;AAC9B,SAAK,YAAY,QAAQ,cAAc;AACvC,SAAK,cAAc,QAAQ,eAAe,KAAK,KAAK,KAAK,QAAQ,KAAK,SAAS,8BAA8B;AAAA,EAC/G;AAAA,EAEA,MAAM,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