@theokit/sdk 4.61.0 → 4.63.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.
Files changed (114) hide show
  1. package/CHANGELOG.md +139 -0
  2. package/dist/{agent-P42GA6RM.js → agent-536OOESZ.js} +8 -6
  3. package/dist/{agent-P42GA6RM.js.map → agent-536OOESZ.js.map} +1 -1
  4. package/dist/{agent-M53C3PAA.cjs → agent-5KYMG63I.cjs} +9 -7
  5. package/dist/{agent-M53C3PAA.cjs.map → agent-5KYMG63I.cjs.map} +1 -1
  6. package/dist/{agent-DIu6FooJ.d.ts → agent-BFno7Sfn.d.ts} +36 -21
  7. package/dist/{agent-D3Xr_-6Z.d.cts → agent-X0DKA943.d.cts} +36 -21
  8. package/dist/chunk-A4RAL2ER.cjs +51 -0
  9. package/dist/chunk-A4RAL2ER.cjs.map +1 -0
  10. package/dist/chunk-A4VHSE56.cjs +21 -0
  11. package/dist/chunk-A4VHSE56.cjs.map +1 -0
  12. package/dist/{chunk-CQ2TQ32Y.js → chunk-AMFXSENK.js} +3 -48
  13. package/dist/chunk-AMFXSENK.js.map +1 -0
  14. package/dist/chunk-C7QPML3L.js +831 -0
  15. package/dist/chunk-C7QPML3L.js.map +1 -0
  16. package/dist/{chunk-5IT6DUOO.cjs → chunk-CASUEY42.cjs} +4 -4
  17. package/dist/{chunk-5IT6DUOO.cjs.map → chunk-CASUEY42.cjs.map} +1 -1
  18. package/dist/{chunk-GQZKDGZM.js → chunk-CHKH5452.js} +90 -70
  19. package/dist/chunk-CHKH5452.js.map +1 -0
  20. package/dist/chunk-EHJEZAOO.cjs +864 -0
  21. package/dist/chunk-EHJEZAOO.cjs.map +1 -0
  22. package/dist/chunk-IRCJ7EHV.cjs +201 -0
  23. package/dist/chunk-IRCJ7EHV.cjs.map +1 -0
  24. package/dist/chunk-LW7G5DYW.js +19 -0
  25. package/dist/chunk-LW7G5DYW.js.map +1 -0
  26. package/dist/{chunk-532CSLYU.js → chunk-MG3SOM3M.js} +3 -3
  27. package/dist/{chunk-532CSLYU.js.map → chunk-MG3SOM3M.js.map} +1 -1
  28. package/dist/{chunk-R7YIVL3K.cjs → chunk-NLXOGBRJ.cjs} +98 -78
  29. package/dist/chunk-NLXOGBRJ.cjs.map +1 -0
  30. package/dist/{chunk-SKXBJ2NU.cjs → chunk-NXH4GPAQ.cjs} +2 -49
  31. package/dist/chunk-NXH4GPAQ.cjs.map +1 -0
  32. package/dist/chunk-R6TA2DRJ.js +194 -0
  33. package/dist/chunk-R6TA2DRJ.js.map +1 -0
  34. package/dist/{chunk-6OBIWHDR.cjs → chunk-UUP3MUZ6.cjs} +20 -361
  35. package/dist/chunk-UUP3MUZ6.cjs.map +1 -0
  36. package/dist/chunk-WE22OXQA.js +48 -0
  37. package/dist/chunk-WE22OXQA.js.map +1 -0
  38. package/dist/{chunk-QEKI3YKI.js → chunk-YTR3RBUZ.js} +13 -348
  39. package/dist/chunk-YTR3RBUZ.js.map +1 -0
  40. package/dist/{cron-BcWmzWzT.d.cts → cron-BuiRPrvt.d.cts} +1 -1
  41. package/dist/{cron-De6hzWCF.d.ts → cron-C2SIi31n.d.ts} +1 -1
  42. package/dist/cron.cjs +8 -6
  43. package/dist/cron.d.cts +2 -2
  44. package/dist/cron.d.ts +2 -2
  45. package/dist/cron.js +7 -5
  46. package/dist/eval.cjs +7 -5
  47. package/dist/eval.cjs.map +1 -1
  48. package/dist/eval.js +6 -4
  49. package/dist/eval.js.map +1 -1
  50. package/dist/{index-manager-RHPFVFSC.cjs → index-manager-6TEEIWM7.cjs} +7 -6
  51. package/dist/{index-manager-RHPFVFSC.cjs.map → index-manager-6TEEIWM7.cjs.map} +1 -1
  52. package/dist/{index-manager-AHAYJ33H.js → index-manager-ACEQG3IJ.js} +6 -5
  53. package/dist/{index-manager-AHAYJ33H.js.map → index-manager-ACEQG3IJ.js.map} +1 -1
  54. package/dist/index.cjs +35 -208
  55. package/dist/index.cjs.map +1 -1
  56. package/dist/index.d.cts +8 -3
  57. package/dist/index.d.ts +8 -3
  58. package/dist/index.js +22 -195
  59. package/dist/index.js.map +1 -1
  60. package/dist/internal/memory/active-memory.d.ts +8 -1
  61. package/dist/internal/memory/dreaming/diary.d.ts +39 -2
  62. package/dist/internal/memory/index-db.d.ts +44 -1
  63. package/dist/internal/memory/index-manager-contract.d.ts +10 -0
  64. package/dist/internal/memory/index-manager-helpers.d.ts +20 -1
  65. package/dist/internal/memory/index-manager.d.ts +1 -1
  66. package/dist/internal/memory/lance-index.d.ts +15 -1
  67. package/dist/internal/memory/migrate-sqlite-to-lance.d.ts +43 -0
  68. package/dist/internal/memory/storage/index.cjs +95 -12
  69. package/dist/internal/memory/storage/index.d.cts +11 -1
  70. package/dist/internal/memory/storage/index.d.ts +11 -1
  71. package/dist/internal/memory/storage/index.js +4 -1
  72. package/dist/internal/memory/storage/markdown-store.d.cts +13 -42
  73. package/dist/internal/memory/storage/markdown-store.d.ts +13 -42
  74. package/dist/internal/memory/storage/memory-root.d.cts +93 -0
  75. package/dist/internal/memory/storage/memory-root.d.ts +93 -0
  76. package/dist/internal/memory/storage/session-loader.d.cts +35 -1
  77. package/dist/internal/memory/storage/session-loader.d.ts +35 -1
  78. package/dist/internal/memory/storage/session-summary-writer.d.cts +50 -2
  79. package/dist/internal/memory/storage/session-summary-writer.d.ts +50 -2
  80. package/dist/internal/memory/storage/transcript-store.d.cts +38 -1
  81. package/dist/internal/memory/storage/transcript-store.d.ts +38 -1
  82. package/dist/internal/memory/storage/wiki-loader.d.cts +27 -2
  83. package/dist/internal/memory/storage/wiki-loader.d.ts +27 -2
  84. package/dist/internal/memory/tools.d.ts +8 -1
  85. package/dist/internal/memory/types.d.ts +5 -0
  86. package/dist/internal/persistence/index.cjs +12 -11
  87. package/dist/internal/persistence/index.cjs.map +1 -1
  88. package/dist/internal/persistence/index.js +2 -1
  89. package/dist/internal/persistence/index.js.map +1 -1
  90. package/dist/internal/persistence/session-dir.d.cts +0 -15
  91. package/dist/internal/persistence/session-dir.d.ts +0 -15
  92. package/dist/internal/runtime/memory/memory-store.d.ts +2 -2
  93. package/dist/persistence.cjs +9 -8
  94. package/dist/persistence.cjs.map +1 -1
  95. package/dist/persistence.js +2 -1
  96. package/dist/persistence.js.map +1 -1
  97. package/dist/subagents-loader.d.cts +1 -1
  98. package/dist/subagents-loader.d.ts +1 -1
  99. package/dist/types/agent.d.ts +11 -0
  100. package/dist/types/memory-provider.d.ts +8 -0
  101. package/docs/error-codes.md +10 -9
  102. package/docs/harness-capability-map.md +57 -17
  103. package/docs/memory-decisions.md +44 -7
  104. package/package.json +1 -1
  105. package/dist/chunk-2UCFUSPW.cjs +0 -468
  106. package/dist/chunk-2UCFUSPW.cjs.map +0 -1
  107. package/dist/chunk-6OBIWHDR.cjs.map +0 -1
  108. package/dist/chunk-CQ2TQ32Y.js.map +0 -1
  109. package/dist/chunk-GQZKDGZM.js.map +0 -1
  110. package/dist/chunk-QEKI3YKI.js.map +0 -1
  111. package/dist/chunk-R7YIVL3K.cjs.map +0 -1
  112. package/dist/chunk-SKXBJ2NU.cjs.map +0 -1
  113. package/dist/chunk-WCLDJSMY.js +0 -456
  114. package/dist/chunk-WCLDJSMY.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -3,22 +3,24 @@
3
3
  var chunkROYPRJH4_cjs = require('./chunk-ROYPRJH4.cjs');
4
4
  var chunkOBA6YK2R_cjs = require('./chunk-OBA6YK2R.cjs');
5
5
  var chunkGWC3HADL_cjs = require('./chunk-GWC3HADL.cjs');
6
+ var chunkIRCJ7EHV_cjs = require('./chunk-IRCJ7EHV.cjs');
6
7
  var chunkP6A3M6VD_cjs = require('./chunk-P6A3M6VD.cjs');
7
8
  require('./chunk-QDED6YO6.cjs');
8
9
  var chunk6SBW4QR2_cjs = require('./chunk-6SBW4QR2.cjs');
9
10
  require('./chunk-XWL6O3SW.cjs');
10
11
  require('./chunk-VTYY7XL5.cjs');
11
- var chunk5IT6DUOO_cjs = require('./chunk-5IT6DUOO.cjs');
12
- var chunkR7YIVL3K_cjs = require('./chunk-R7YIVL3K.cjs');
12
+ var chunkCASUEY42_cjs = require('./chunk-CASUEY42.cjs');
13
+ var chunkNLXOGBRJ_cjs = require('./chunk-NLXOGBRJ.cjs');
13
14
  var chunkNGESVVJN_cjs = require('./chunk-NGESVVJN.cjs');
14
15
  require('./chunk-2DG7KW4L.cjs');
15
16
  require('./chunk-BUUUWQMB.cjs');
16
- var chunk6OBIWHDR_cjs = require('./chunk-6OBIWHDR.cjs');
17
+ require('./chunk-UUP3MUZ6.cjs');
17
18
  require('./chunk-P6H23T43.cjs');
18
19
  require('./chunk-BV2MWEMV.cjs');
19
20
  require('./chunk-EI2Q7SJ5.cjs');
20
21
  require('./chunk-GHX4P3V2.cjs');
21
- var chunk2UCFUSPW_cjs = require('./chunk-2UCFUSPW.cjs');
22
+ require('./chunk-A4VHSE56.cjs');
23
+ var chunkEHJEZAOO_cjs = require('./chunk-EHJEZAOO.cjs');
22
24
  require('./chunk-QI7WE46I.cjs');
23
25
  var chunkP5LCASTC_cjs = require('./chunk-P5LCASTC.cjs');
24
26
  require('./chunk-F3YZMOAU.cjs');
@@ -44,7 +46,8 @@ require('./chunk-ILCGLTSA.cjs');
44
46
  require('./chunk-CQGYNZ3K.cjs');
45
47
  require('./chunk-4I55V454.cjs');
46
48
  require('./chunk-BUIK7GUA.cjs');
47
- require('./chunk-SKXBJ2NU.cjs');
49
+ require('./chunk-A4RAL2ER.cjs');
50
+ require('./chunk-NXH4GPAQ.cjs');
48
51
  require('./chunk-2ADR2GSO.cjs');
49
52
  var chunkZF2LDKQQ_cjs = require('./chunk-ZF2LDKQQ.cjs');
50
53
  var chunk2C72DXQF_cjs = require('./chunk-2C72DXQF.cjs');
@@ -66,13 +69,12 @@ var crypto = require('crypto');
66
69
  var zod = require('zod');
67
70
  var promises = require('fs/promises');
68
71
  var path = require('path');
69
- var fs = require('fs');
70
72
 
71
73
  // src/agent-factory.ts
72
74
  function createAgentFactory(common) {
73
75
  return {
74
- forSession: (agentId, overrides) => chunkR7YIVL3K_cjs.Agent.create(mergeAgentOptions(common, overrides, agentId)),
75
- getOrCreate: (agentId, overrides) => chunkR7YIVL3K_cjs.Agent.getOrCreate(agentId, mergeAgentOptions(common, overrides, agentId))
76
+ forSession: (agentId, overrides) => chunkNLXOGBRJ_cjs.Agent.create(mergeAgentOptions(common, overrides, agentId)),
77
+ getOrCreate: (agentId, overrides) => chunkNLXOGBRJ_cjs.Agent.getOrCreate(agentId, mergeAgentOptions(common, overrides, agentId))
76
78
  };
77
79
  }
78
80
  function mergeAgentOptions(common, overrides, agentId) {
@@ -1019,47 +1021,6 @@ function foldLayers(entries, accumulatingKeys = []) {
1019
1021
  }
1020
1022
  return combined;
1021
1023
  }
1022
- function diaryPath(cwd) {
1023
- return path.join(chunk2UCFUSPW_cjs.memoryDir(cwd), "dream-diary.md");
1024
- }
1025
- function renderDiaryEntry(entry) {
1026
- const stamp = new Date(entry.timestampMs).toISOString();
1027
- const hash = entryHash(entry).slice(0, 8);
1028
- return [
1029
- `## ${stamp}`,
1030
- "",
1031
- `- entry-hash: ${hash}`,
1032
- `- facts before: ${entry.factsBefore}`,
1033
- `- facts after: ${entry.factsAfter}`,
1034
- `- duplicates removed: ${entry.duplicatesRemoved}`,
1035
- `- clusters created: ${entry.clustersCreated}`,
1036
- `- notes written: ${entry.notesWritten}`,
1037
- ""
1038
- ].join("\n");
1039
- }
1040
- async function appendDiaryEntry(cwd, entry) {
1041
- const path = diaryPath(cwd);
1042
- let raw = "";
1043
- try {
1044
- raw = await promises.readFile(path, "utf8");
1045
- } catch {
1046
- raw = "# Dream Diary\n\n";
1047
- }
1048
- const next = `${raw.endsWith("\n") ? raw : `${raw}
1049
- `}${renderDiaryEntry(entry)}`;
1050
- await chunkI6TGFUCO_cjs.replaceFileAtomic(path, next);
1051
- }
1052
- function entryHash(entry) {
1053
- return crypto.createHash("sha256").update(
1054
- [
1055
- entry.factsBefore,
1056
- entry.factsAfter,
1057
- entry.duplicatesRemoved,
1058
- entry.clustersCreated,
1059
- entry.notesWritten
1060
- ].join("|")
1061
- ).digest("hex");
1062
- }
1063
1024
 
1064
1025
  // src/internal/memory/dreaming/phases.ts
1065
1026
  var DEFAULT_DEDUP_THRESHOLD = 0.95;
@@ -1200,13 +1161,17 @@ async function runInner(options) {
1200
1161
  const now = options.now ?? Date.now;
1201
1162
  const timestampMs = now();
1202
1163
  try {
1203
- const facts = await chunk2UCFUSPW_cjs.readFactsFromMarkdown(options.cwd);
1164
+ const root = options.memoryRoot ?? chunkEHJEZAOO_cjs.resolveMemoryRoot(options.cwd);
1165
+ const facts = await chunkEHJEZAOO_cjs.readFactsFromMarkdown(
1166
+ options.cwd,
1167
+ options.memoryRoot ? { directory: options.memoryRoot } : void 0
1168
+ );
1204
1169
  if (facts.length === 0) {
1205
1170
  return emptyResult("skipped");
1206
1171
  }
1207
1172
  const dedup = await lightPhase(facts, options.embedding, options.dedupThreshold);
1208
1173
  const rem = await remPhase(dedup.kept, options.embedding, options.clusterThreshold);
1209
- const notesWritten = await writeConsolidatedNotes(options.cwd, rem.clusters, timestampMs);
1174
+ const notesWritten = await writeConsolidatedNotes(root, rem.clusters, timestampMs);
1210
1175
  const result = {
1211
1176
  status: "ok",
1212
1177
  factsBefore: facts.length,
@@ -1216,7 +1181,7 @@ async function runInner(options) {
1216
1181
  notesWritten,
1217
1182
  diaryEntryHash: void 0
1218
1183
  };
1219
- await appendDiaryEntry(options.cwd, {
1184
+ await chunkIRCJ7EHV_cjs.appendDiaryEntry(root, {
1220
1185
  timestampMs,
1221
1186
  factsBefore: result.factsBefore,
1222
1187
  factsAfter: result.factsAfter,
@@ -1232,9 +1197,9 @@ async function runInner(options) {
1232
1197
  return emptyResult("error");
1233
1198
  }
1234
1199
  }
1235
- async function writeConsolidatedNotes(cwd, clusters, timestampMs) {
1200
+ async function writeConsolidatedNotes(root, clusters, timestampMs) {
1236
1201
  if (clusters.length === 0) return 0;
1237
- const notesDir = path.join(chunk2UCFUSPW_cjs.memoryDir(cwd), "notes");
1202
+ const notesDir = path.join(root, "notes");
1238
1203
  await promises.mkdir(notesDir, { recursive: true });
1239
1204
  const isoSlug = new Date(timestampMs).toISOString().replace(/[^\dT]/g, "-");
1240
1205
  const file = path.join(notesDir, `dreamed-${isoSlug}.md`);
@@ -1300,8 +1265,8 @@ var Memory = {
1300
1265
  openArgs.embedding = await resolveEmbedding(opts.embedding, peer.MEMORY_EMBEDDING_ADAPTERS);
1301
1266
  return await peer.IndexManager.open(openArgs);
1302
1267
  }
1303
- const { IndexManager } = await import('./index-manager-RHPFVFSC.cjs');
1304
- openArgs.embedding = await resolveEmbedding(opts.embedding, chunkR7YIVL3K_cjs.MEMORY_EMBEDDING_ADAPTERS);
1268
+ const { IndexManager } = await import('./index-manager-6TEEIWM7.cjs');
1269
+ openArgs.embedding = await resolveEmbedding(opts.embedding, chunkNLXOGBRJ_cjs.MEMORY_EMBEDDING_ADAPTERS);
1305
1270
  return await IndexManager.open(openArgs);
1306
1271
  },
1307
1272
  /**
@@ -1312,7 +1277,7 @@ var Memory = {
1312
1277
  */
1313
1278
  async runDreamingSweep(opts) {
1314
1279
  const peer = await tryLoadSdkMemoryPeer();
1315
- const catalog = peer !== null ? peer.MEMORY_EMBEDDING_ADAPTERS : chunkR7YIVL3K_cjs.MEMORY_EMBEDDING_ADAPTERS;
1280
+ const catalog = peer !== null ? peer.MEMORY_EMBEDDING_ADAPTERS : chunkNLXOGBRJ_cjs.MEMORY_EMBEDDING_ADAPTERS;
1316
1281
  const sweepArgs = await buildDreamingSweepArgs(opts, catalog);
1317
1282
  const result = peer !== null ? (
1318
1283
  // biome-ignore lint/suspicious/noExplicitAny: peer is dynamically loaded — structural compat ensured by sdk-memory
@@ -1346,6 +1311,7 @@ async function buildDreamingSweepArgs(opts, catalog) {
1346
1311
  const runtime = await resolveEmbedding(opts.embedding, catalog);
1347
1312
  return {
1348
1313
  cwd: opts.cwd,
1314
+ memoryRoot: chunkEHJEZAOO_cjs.resolveMemoryRoot(opts.cwd, { directory: opts.directory }),
1349
1315
  embedding: runtime,
1350
1316
  ...opts.dedupThreshold !== void 0 ? { dedupThreshold: opts.dedupThreshold } : {},
1351
1317
  ...opts.clusterThreshold !== void 0 ? { clusterThreshold: opts.clusterThreshold } : {}
@@ -1377,145 +1343,6 @@ function extractRawId(id, expectedAdapterId) {
1377
1343
  }
1378
1344
  return id.slice(prefix.length);
1379
1345
  }
1380
- async function readAllSqliteFacts(cwd) {
1381
- const dbPath = chunk6OBIWHDR_cjs.defaultIndexPath(cwd);
1382
- if (!fs.existsSync(dbPath)) return [];
1383
- const db = await chunk6OBIWHDR_cjs.openMemoryDb({ filePath: dbPath });
1384
- try {
1385
- const stmt = db.prepare("SELECT id, path, source, start_line, end_line, text FROM chunks");
1386
- const rows = stmt.all();
1387
- return rows.map((r) => ({
1388
- ...r,
1389
- namespace: "default",
1390
- scope: "agent",
1391
- user_id: "default"
1392
- }));
1393
- } finally {
1394
- db.close();
1395
- }
1396
- }
1397
- function nfcEqual(a, b) {
1398
- return a.normalize("NFC") === b.normalize("NFC");
1399
- }
1400
- async function migrateSqliteToLance(opts) {
1401
- const cwd = opts.cwd;
1402
- const finalPath = chunk6OBIWHDR_cjs.lanceStoragePath(cwd);
1403
- const newPath = path.join(cwd, ".theokit", "memory", "lance-new");
1404
- const rawLog = opts.logger ?? ((m) => console.log(m));
1405
- const log = (m) => rawLog(chunkJTB5Q42C_cjs.redactSecrets(m));
1406
- if (fs.existsSync(finalPath)) {
1407
- throw new chunkK3FW2XZD_cjs.ConfigurationError(
1408
- `Destination already exists: ${finalPath}. Remove it manually (\`rm -rf ${finalPath}\`) and re-run.`,
1409
- { code: "migration_destination_exists" }
1410
- );
1411
- }
1412
- if (fs.existsSync(newPath)) {
1413
- log(`Removing stale ${newPath} from a previous run...`);
1414
- fs.rmSync(newPath, { recursive: true, force: true });
1415
- }
1416
- log(`Reading SQLite facts from ${cwd}/.theokit/memory/index.sqlite ...`);
1417
- const sqliteFacts = await readAllSqliteFacts(cwd);
1418
- log(`SQLite has ${sqliteFacts.length} facts.`);
1419
- if (sqliteFacts.length === 0) {
1420
- return {
1421
- countSqlite: 0,
1422
- countLance: 0,
1423
- validated: true,
1424
- sampleComparisons: [],
1425
- lancePath: finalPath,
1426
- committed: false
1427
- };
1428
- }
1429
- const placeholderEmbedding = {
1430
- id: "migration-placeholder",
1431
- model: "deterministic-hash",
1432
- dimension: 8,
1433
- embed: async (texts) => {
1434
- return texts.map((t) => {
1435
- const arr = new Array(8).fill(0);
1436
- for (let i = 0; i < t.length; i += 1) {
1437
- arr[i % 8] += t.charCodeAt(i);
1438
- }
1439
- return arr.map((x) => x / 1e3);
1440
- });
1441
- },
1442
- stats: () => ({ cacheHits: 0, cacheMisses: 0, httpCalls: 0, retries: 0 })
1443
- };
1444
- fs.mkdirSync(newPath, { recursive: true });
1445
- log(`Writing Lance index to ${newPath} ...`);
1446
- const lance = await chunk6OBIWHDR_cjs.LanceIndex.open({
1447
- cwd,
1448
- embedding: placeholderEmbedding,
1449
- storagePath: newPath
1450
- });
1451
- const batchSize = opts.batchSize ?? 100;
1452
- for (let i = 0; i < sqliteFacts.length; i += batchSize) {
1453
- const batch = sqliteFacts.slice(i, i + batchSize).map((f) => ({
1454
- id: f.id,
1455
- text: f.text,
1456
- source: f.source,
1457
- namespace: f.namespace ?? "default",
1458
- scope: f.scope ?? "agent",
1459
- user_id: f.user_id ?? "default",
1460
- timestamp: 0
1461
- }));
1462
- await lance.addFacts(batch);
1463
- log(` Migrated ${Math.min(i + batchSize, sqliteFacts.length)}/${sqliteFacts.length}`);
1464
- }
1465
- const lanceCount = await lance.countFacts("default");
1466
- log(`Lance has ${lanceCount} facts (expected ${sqliteFacts.length}).`);
1467
- const sampleSize = Math.min(10, sqliteFacts.length);
1468
- const sampleComparisons = [];
1469
- for (let i = 0; i < sampleSize; i += 1) {
1470
- const sqliteFact = sqliteFacts[Math.floor(i * sqliteFacts.length / sampleSize)];
1471
- if (sqliteFact === void 0) continue;
1472
- const hits = await lance.search(sqliteFact.text, {
1473
- namespace: sqliteFact.namespace ?? "default",
1474
- limit: 1
1475
- });
1476
- const hit = hits[0];
1477
- const match = hit !== void 0 && nfcEqual(hit.text, sqliteFact.text);
1478
- sampleComparisons.push({ id: sqliteFact.id, match });
1479
- }
1480
- const allMatch = sampleComparisons.every((c) => c.match);
1481
- const countMatch = lanceCount === sqliteFacts.length;
1482
- const validated = allMatch && countMatch;
1483
- await lance.close();
1484
- if (opts.dryRun === true) {
1485
- log("Dry-run mode \u2014 discarding Lance staging dir.");
1486
- fs.rmSync(newPath, { recursive: true, force: true });
1487
- return {
1488
- countSqlite: sqliteFacts.length,
1489
- countLance: lanceCount,
1490
- validated,
1491
- sampleComparisons,
1492
- lancePath: finalPath,
1493
- committed: false
1494
- };
1495
- }
1496
- if (!validated) {
1497
- log("Validation FAILED \u2014 leaving SQLite intact, removing Lance staging dir.");
1498
- fs.rmSync(newPath, { recursive: true, force: true });
1499
- return {
1500
- countSqlite: sqliteFacts.length,
1501
- countLance: lanceCount,
1502
- validated: false,
1503
- sampleComparisons,
1504
- lancePath: finalPath,
1505
- committed: false
1506
- };
1507
- }
1508
- fs.renameSync(newPath, finalPath);
1509
- log(`Migration committed to ${finalPath}.`);
1510
- return {
1511
- countSqlite: sqliteFacts.length,
1512
- countLance: lanceCount,
1513
- validated: true,
1514
- sampleComparisons,
1515
- lancePath: finalPath,
1516
- committed: true
1517
- };
1518
- }
1519
1346
 
1520
1347
  // src/migrate.ts
1521
1348
  async function migrateSqliteToLance2(options) {
@@ -1523,7 +1350,7 @@ async function migrateSqliteToLance2(options) {
1523
1350
  if (peer !== null) {
1524
1351
  return peer.migrateSqliteToLance(options);
1525
1352
  }
1526
- return migrateSqliteToLance(options);
1353
+ return chunkIRCJ7EHV_cjs.migrateSqliteToLance(options);
1527
1354
  }
1528
1355
 
1529
1356
  // src/permission-engine.ts
@@ -1874,7 +1701,7 @@ function isBuiltAgent(m) {
1874
1701
  return typeof m.send === "function";
1875
1702
  }
1876
1703
  async function materialize(def, index) {
1877
- const { Agent: Agent2 } = await import('./agent-M53C3PAA.cjs');
1704
+ const { Agent: Agent2 } = await import('./agent-5KYMG63I.cjs');
1878
1705
  return Agent2.create({
1879
1706
  // `AgentDefinition.model` admits the sentinel `'inherit'`, which is not a model id. Inheriting
1880
1707
  // here means "declare nothing and let the default apply" — forwarding the literal would create
@@ -2016,7 +1843,7 @@ var FIXTURE_USER = {
2016
1843
  };
2017
1844
  var FIXTURE_MODELS = [
2018
1845
  {
2019
- id: chunkR7YIVL3K_cjs.DEFAULT_AGENTIC_MODEL_ID,
1846
+ id: chunkNLXOGBRJ_cjs.DEFAULT_AGENTIC_MODEL_ID,
2020
1847
  name: "Gemini 2.0 Flash",
2021
1848
  displayName: "Gemini 2.0 Flash",
2022
1849
  parameters: [
@@ -2219,7 +2046,7 @@ var Theokit = class {
2219
2046
  envVars: p.envVars
2220
2047
  }));
2221
2048
  },
2222
- embeddingAdapters: () => Object.entries(chunkR7YIVL3K_cjs.MEMORY_EMBEDDING_ADAPTERS).map(([id, adapter]) => ({
2049
+ embeddingAdapters: () => Object.entries(chunkNLXOGBRJ_cjs.MEMORY_EMBEDDING_ADAPTERS).map(([id, adapter]) => ({
2223
2050
  id,
2224
2051
  transport: adapter.transport,
2225
2052
  defaultModel: adapter.defaultModel
@@ -2438,35 +2265,35 @@ Object.defineProperty(exports, "fn", {
2438
2265
  });
2439
2266
  Object.defineProperty(exports, "Cron", {
2440
2267
  enumerable: true,
2441
- get: function () { return chunk5IT6DUOO_cjs.Cron; }
2268
+ get: function () { return chunkCASUEY42_cjs.Cron; }
2442
2269
  });
2443
2270
  Object.defineProperty(exports, "Agent", {
2444
2271
  enumerable: true,
2445
- get: function () { return chunkR7YIVL3K_cjs.Agent; }
2272
+ get: function () { return chunkNLXOGBRJ_cjs.Agent; }
2446
2273
  });
2447
2274
  Object.defineProperty(exports, "AgentBuilder", {
2448
2275
  enumerable: true,
2449
- get: function () { return chunkR7YIVL3K_cjs.AgentBuilder; }
2276
+ get: function () { return chunkNLXOGBRJ_cjs.AgentBuilder; }
2450
2277
  });
2451
2278
  Object.defineProperty(exports, "Tool", {
2452
2279
  enumerable: true,
2453
- get: function () { return chunkR7YIVL3K_cjs.Tool; }
2280
+ get: function () { return chunkNLXOGBRJ_cjs.Tool; }
2454
2281
  });
2455
2282
  Object.defineProperty(exports, "ToolError", {
2456
2283
  enumerable: true,
2457
- get: function () { return chunkR7YIVL3K_cjs.ToolError; }
2284
+ get: function () { return chunkNLXOGBRJ_cjs.ToolError; }
2458
2285
  });
2459
2286
  Object.defineProperty(exports, "UsageAccumulator", {
2460
2287
  enumerable: true,
2461
- get: function () { return chunkR7YIVL3K_cjs.UsageAccumulator; }
2288
+ get: function () { return chunkNLXOGBRJ_cjs.UsageAccumulator; }
2462
2289
  });
2463
2290
  Object.defineProperty(exports, "computeCost", {
2464
2291
  enumerable: true,
2465
- get: function () { return chunkR7YIVL3K_cjs.computeCost; }
2292
+ get: function () { return chunkNLXOGBRJ_cjs.computeCost; }
2466
2293
  });
2467
2294
  Object.defineProperty(exports, "getPricingEntry", {
2468
2295
  enumerable: true,
2469
- get: function () { return chunkR7YIVL3K_cjs.getPricingEntry; }
2296
+ get: function () { return chunkNLXOGBRJ_cjs.getPricingEntry; }
2470
2297
  });
2471
2298
  Object.defineProperty(exports, "emitRunEvent", {
2472
2299
  enumerable: true,