sensemaking 0.25.1 → 0.27.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 (332) hide show
  1. package/README.md +48 -12
  2. package/dist/cjs/cli/index.d.cts +3 -3
  3. package/dist/cjs/cli/index.d.ts +3 -3
  4. package/dist/cjs/cli/index.js +3 -3
  5. package/dist/cjs/cli/index.js.map +1 -1
  6. package/dist/cjs/cli/path.js +5 -29
  7. package/dist/cjs/cli/path.js.map +1 -1
  8. package/dist/cjs/cli/peek.js +43 -2
  9. package/dist/cjs/cli/peek.js.map +1 -1
  10. package/dist/cjs/cli/related.js +4 -3
  11. package/dist/cjs/cli/related.js.map +1 -1
  12. package/dist/cjs/cli/search.js +38 -6
  13. package/dist/cjs/cli/search.js.map +1 -1
  14. package/dist/cjs/commands/index.d.cts +6 -3
  15. package/dist/cjs/commands/index.d.ts +6 -3
  16. package/dist/cjs/commands/index.js +4 -0
  17. package/dist/cjs/commands/index.js.map +1 -1
  18. package/dist/cjs/commands/map.d.cts +14 -5
  19. package/dist/cjs/commands/map.d.ts +14 -5
  20. package/dist/cjs/commands/map.js +42 -35
  21. package/dist/cjs/commands/map.js.map +1 -1
  22. package/dist/cjs/commands/path.d.cts +14 -0
  23. package/dist/cjs/commands/path.d.ts +14 -0
  24. package/dist/cjs/commands/path.js +209 -0
  25. package/dist/cjs/commands/path.js.map +1 -0
  26. package/dist/cjs/commands/peek.d.cts +25 -2
  27. package/dist/cjs/commands/peek.d.ts +25 -2
  28. package/dist/cjs/commands/peek.js +131 -50
  29. package/dist/cjs/commands/peek.js.map +1 -1
  30. package/dist/cjs/commands/related.d.cts +16 -3
  31. package/dist/cjs/commands/related.d.ts +16 -3
  32. package/dist/cjs/commands/related.js +131 -98
  33. package/dist/cjs/commands/related.js.map +1 -1
  34. package/dist/cjs/commands/scope.d.cts +1 -0
  35. package/dist/cjs/commands/scope.d.ts +1 -0
  36. package/dist/cjs/commands/scope.js +149 -0
  37. package/dist/cjs/commands/scope.js.map +1 -1
  38. package/dist/cjs/commands/search.d.cts +30 -3
  39. package/dist/cjs/commands/search.d.ts +30 -3
  40. package/dist/cjs/commands/search.js +240 -73
  41. package/dist/cjs/commands/search.js.map +1 -1
  42. package/dist/cjs/commands/signals.d.cts +22 -7
  43. package/dist/cjs/commands/signals.d.ts +22 -7
  44. package/dist/cjs/commands/signals.js +77 -15
  45. package/dist/cjs/commands/signals.js.map +1 -1
  46. package/dist/cjs/commands/snapshot.d.cts +3 -0
  47. package/dist/cjs/commands/snapshot.d.ts +3 -0
  48. package/dist/cjs/commands/snapshot.js +180 -0
  49. package/dist/cjs/commands/snapshot.js.map +1 -0
  50. package/dist/cjs/config/load.js +6 -0
  51. package/dist/cjs/config/load.js.map +1 -1
  52. package/dist/cjs/embed/cohere.js +41 -16
  53. package/dist/cjs/embed/cohere.js.map +1 -1
  54. package/dist/cjs/embed/endpoint.d.cts +2 -0
  55. package/dist/cjs/embed/endpoint.d.ts +2 -0
  56. package/dist/cjs/embed/endpoint.js +30 -0
  57. package/dist/cjs/embed/endpoint.js.map +1 -0
  58. package/dist/cjs/embed/handoff.d.cts +7 -2
  59. package/dist/cjs/embed/handoff.d.ts +7 -2
  60. package/dist/cjs/embed/handoff.js +10 -0
  61. package/dist/cjs/embed/handoff.js.map +1 -1
  62. package/dist/cjs/embed/http.d.cts +18 -1
  63. package/dist/cjs/embed/http.d.ts +18 -1
  64. package/dist/cjs/embed/http.js +239 -40
  65. package/dist/cjs/embed/http.js.map +1 -1
  66. package/dist/cjs/embed/openai.js +39 -17
  67. package/dist/cjs/embed/openai.js.map +1 -1
  68. package/dist/cjs/embed/query.d.cts +9 -3
  69. package/dist/cjs/embed/query.d.ts +9 -3
  70. package/dist/cjs/embed/query.js +257 -90
  71. package/dist/cjs/embed/query.js.map +1 -1
  72. package/dist/cjs/embed/registry.d.cts +2 -2
  73. package/dist/cjs/embed/registry.d.ts +2 -2
  74. package/dist/cjs/embed/registry.js +36 -4
  75. package/dist/cjs/embed/registry.js.map +1 -1
  76. package/dist/cjs/embed/static.js +6 -2
  77. package/dist/cjs/embed/static.js.map +1 -1
  78. package/dist/cjs/embed/store.js +42 -77
  79. package/dist/cjs/embed/store.js.map +1 -1
  80. package/dist/cjs/embed/types.d.cts +5 -2
  81. package/dist/cjs/embed/types.d.ts +5 -2
  82. package/dist/cjs/embed/types.js.map +1 -1
  83. package/dist/cjs/features/embed.js +290 -43
  84. package/dist/cjs/features/embed.js.map +1 -1
  85. package/dist/cjs/graph/traverse.d.cts +2 -2
  86. package/dist/cjs/graph/traverse.d.ts +2 -2
  87. package/dist/cjs/graph/traverse.js +15 -5
  88. package/dist/cjs/graph/traverse.js.map +1 -1
  89. package/dist/cjs/index.d.cts +2 -2
  90. package/dist/cjs/index.d.ts +2 -2
  91. package/dist/cjs/index.js +6 -0
  92. package/dist/cjs/index.js.map +1 -1
  93. package/dist/cjs/output/output.d.cts +4 -36
  94. package/dist/cjs/output/output.d.ts +4 -36
  95. package/dist/cjs/output/output.js +1 -2
  96. package/dist/cjs/output/output.js.map +1 -1
  97. package/dist/cjs/scan/pool.d.cts +2 -1
  98. package/dist/cjs/scan/pool.d.ts +2 -1
  99. package/dist/cjs/scan/pool.js +116 -27
  100. package/dist/cjs/scan/pool.js.map +1 -1
  101. package/dist/cjs/scan/reparse.d.cts +1 -0
  102. package/dist/cjs/scan/reparse.d.ts +1 -0
  103. package/dist/cjs/scan/reparse.js +75 -21
  104. package/dist/cjs/scan/reparse.js.map +1 -1
  105. package/dist/cjs/store/builder.d.cts +11 -21
  106. package/dist/cjs/store/builder.d.ts +11 -21
  107. package/dist/cjs/store/builder.js +1077 -438
  108. package/dist/cjs/store/builder.js.map +1 -1
  109. package/dist/cjs/store/duckdb/connection.js +16 -2
  110. package/dist/cjs/store/duckdb/connection.js.map +1 -1
  111. package/dist/cjs/store/duckdb/open.d.cts +1 -1
  112. package/dist/cjs/store/duckdb/open.d.ts +1 -1
  113. package/dist/cjs/store/duckdb/open.js +73 -65
  114. package/dist/cjs/store/duckdb/open.js.map +1 -1
  115. package/dist/cjs/store/duckdb/reconcile.js +533 -15
  116. package/dist/cjs/store/duckdb/reconcile.js.map +1 -1
  117. package/dist/cjs/store/embed-scope.js +19 -9
  118. package/dist/cjs/store/embed-scope.js.map +1 -1
  119. package/dist/cjs/store/index.d.cts +6 -0
  120. package/dist/cjs/store/index.d.ts +6 -0
  121. package/dist/cjs/store/index.js +8 -4
  122. package/dist/cjs/store/index.js.map +1 -1
  123. package/dist/cjs/store/open.d.cts +6 -1
  124. package/dist/cjs/store/open.d.ts +6 -1
  125. package/dist/cjs/store/open.js +230 -307
  126. package/dist/cjs/store/open.js.map +1 -1
  127. package/dist/cjs/store/readiness.d.cts +5 -0
  128. package/dist/cjs/store/readiness.d.ts +5 -0
  129. package/dist/cjs/store/readiness.js +39 -0
  130. package/dist/cjs/store/readiness.js.map +1 -0
  131. package/dist/cjs/store/reconcile.d.cts +26 -1
  132. package/dist/cjs/store/reconcile.d.ts +26 -1
  133. package/dist/cjs/store/reconcile.js +670 -576
  134. package/dist/cjs/store/reconcile.js.map +1 -1
  135. package/dist/cjs/store/signature.d.cts +1 -0
  136. package/dist/cjs/store/signature.d.ts +1 -0
  137. package/dist/cjs/store/signature.js +9 -0
  138. package/dist/cjs/store/signature.js.map +1 -1
  139. package/dist/cjs/store/sqlite/open.d.cts +1 -1
  140. package/dist/cjs/store/sqlite/open.d.ts +1 -1
  141. package/dist/cjs/store/sqlite/open.js +84 -90
  142. package/dist/cjs/store/sqlite/open.js.map +1 -1
  143. package/dist/cjs/store/sqlite/reconcile.js.map +1 -1
  144. package/dist/cjs/store/sqlite/store.js +63 -60
  145. package/dist/cjs/store/sqlite/store.js.map +1 -1
  146. package/dist/cjs/store/sqlite/vectors.d.cts +2 -2
  147. package/dist/cjs/store/sqlite/vectors.d.ts +2 -2
  148. package/dist/cjs/store/sqlite/vectors.js +8 -4
  149. package/dist/cjs/store/sqlite/vectors.js.map +1 -1
  150. package/dist/cjs/store/stages.js.map +1 -1
  151. package/dist/cjs/store/turso/connection.d.cts +1 -0
  152. package/dist/cjs/store/turso/connection.d.ts +1 -0
  153. package/dist/cjs/store/turso/connection.js +319 -94
  154. package/dist/cjs/store/turso/connection.js.map +1 -1
  155. package/dist/cjs/store/turso/open.d.cts +1 -1
  156. package/dist/cjs/store/turso/open.d.ts +1 -1
  157. package/dist/cjs/store/turso/open.js +70 -74
  158. package/dist/cjs/store/turso/open.js.map +1 -1
  159. package/dist/cjs/store/turso/store.js +25 -23
  160. package/dist/cjs/store/turso/store.js.map +1 -1
  161. package/dist/cjs/store/turso/vectors.d.cts +2 -2
  162. package/dist/cjs/store/turso/vectors.d.ts +2 -2
  163. package/dist/cjs/store/turso/vectors.js +26 -16
  164. package/dist/cjs/store/turso/vectors.js.map +1 -1
  165. package/dist/cjs/store/types.d.cts +4 -1
  166. package/dist/cjs/store/types.d.ts +4 -1
  167. package/dist/cjs/store/types.js.map +1 -1
  168. package/dist/cjs/store/vectors.d.cts +14 -1
  169. package/dist/cjs/store/vectors.d.ts +14 -1
  170. package/dist/cjs/store/vectors.js +61 -0
  171. package/dist/cjs/store/vectors.js.map +1 -1
  172. package/dist/cjs/watch.d.cts +6 -0
  173. package/dist/cjs/watch.d.ts +6 -0
  174. package/dist/cjs/watch.js +42 -10
  175. package/dist/cjs/watch.js.map +1 -1
  176. package/dist/cjs/workers/parse.d.cts +4 -3
  177. package/dist/cjs/workers/parse.d.ts +4 -3
  178. package/dist/cjs/workers/parse.js +19 -17
  179. package/dist/cjs/workers/parse.js.map +1 -1
  180. package/dist/esm/cli/index.d.ts +3 -3
  181. package/dist/esm/cli/index.js +3 -3
  182. package/dist/esm/cli/index.js.map +1 -1
  183. package/dist/esm/cli/path.js +4 -10
  184. package/dist/esm/cli/path.js.map +1 -1
  185. package/dist/esm/cli/peek.js +20 -2
  186. package/dist/esm/cli/peek.js.map +1 -1
  187. package/dist/esm/cli/related.js +5 -3
  188. package/dist/esm/cli/related.js.map +1 -1
  189. package/dist/esm/cli/search.js +12 -2
  190. package/dist/esm/cli/search.js.map +1 -1
  191. package/dist/esm/commands/index.d.ts +6 -3
  192. package/dist/esm/commands/index.js +1 -0
  193. package/dist/esm/commands/index.js.map +1 -1
  194. package/dist/esm/commands/map.d.ts +14 -5
  195. package/dist/esm/commands/map.js +2 -0
  196. package/dist/esm/commands/map.js.map +1 -1
  197. package/dist/esm/commands/path.d.ts +14 -0
  198. package/dist/esm/commands/path.js +33 -0
  199. package/dist/esm/commands/path.js.map +1 -0
  200. package/dist/esm/commands/peek.d.ts +25 -2
  201. package/dist/esm/commands/peek.js +59 -19
  202. package/dist/esm/commands/peek.js.map +1 -1
  203. package/dist/esm/commands/related.d.ts +16 -3
  204. package/dist/esm/commands/related.js +45 -28
  205. package/dist/esm/commands/related.js.map +1 -1
  206. package/dist/esm/commands/scope.d.ts +1 -0
  207. package/dist/esm/commands/scope.js +58 -0
  208. package/dist/esm/commands/scope.js.map +1 -1
  209. package/dist/esm/commands/search.d.ts +30 -3
  210. package/dist/esm/commands/search.js +95 -20
  211. package/dist/esm/commands/search.js.map +1 -1
  212. package/dist/esm/commands/signals.d.ts +22 -7
  213. package/dist/esm/commands/signals.js +74 -17
  214. package/dist/esm/commands/signals.js.map +1 -1
  215. package/dist/esm/commands/snapshot.d.ts +3 -0
  216. package/dist/esm/commands/snapshot.js +25 -0
  217. package/dist/esm/commands/snapshot.js.map +1 -0
  218. package/dist/esm/config/load.js +6 -0
  219. package/dist/esm/config/load.js.map +1 -1
  220. package/dist/esm/embed/cohere.js +35 -10
  221. package/dist/esm/embed/cohere.js.map +1 -1
  222. package/dist/esm/embed/endpoint.d.ts +2 -0
  223. package/dist/esm/embed/endpoint.js +11 -0
  224. package/dist/esm/embed/endpoint.js.map +1 -0
  225. package/dist/esm/embed/handoff.d.ts +7 -2
  226. package/dist/esm/embed/handoff.js +7 -0
  227. package/dist/esm/embed/handoff.js.map +1 -1
  228. package/dist/esm/embed/http.d.ts +18 -1
  229. package/dist/esm/embed/http.js +137 -17
  230. package/dist/esm/embed/http.js.map +1 -1
  231. package/dist/esm/embed/openai.js +34 -12
  232. package/dist/esm/embed/openai.js.map +1 -1
  233. package/dist/esm/embed/query.d.ts +9 -3
  234. package/dist/esm/embed/query.js +98 -26
  235. package/dist/esm/embed/query.js.map +1 -1
  236. package/dist/esm/embed/registry.d.ts +2 -2
  237. package/dist/esm/embed/registry.js +34 -5
  238. package/dist/esm/embed/registry.js.map +1 -1
  239. package/dist/esm/embed/static.js +10 -2
  240. package/dist/esm/embed/static.js.map +1 -1
  241. package/dist/esm/embed/store.js +30 -21
  242. package/dist/esm/embed/store.js.map +1 -1
  243. package/dist/esm/embed/types.d.ts +5 -2
  244. package/dist/esm/embed/types.js.map +1 -1
  245. package/dist/esm/features/embed.js +82 -21
  246. package/dist/esm/features/embed.js.map +1 -1
  247. package/dist/esm/graph/traverse.d.ts +2 -2
  248. package/dist/esm/graph/traverse.js +4 -2
  249. package/dist/esm/graph/traverse.js.map +1 -1
  250. package/dist/esm/index.d.ts +2 -2
  251. package/dist/esm/index.js +1 -1
  252. package/dist/esm/index.js.map +1 -1
  253. package/dist/esm/output/output.d.ts +4 -36
  254. package/dist/esm/output/output.js +1 -2
  255. package/dist/esm/output/output.js.map +1 -1
  256. package/dist/esm/scan/pool.d.ts +2 -1
  257. package/dist/esm/scan/pool.js +80 -23
  258. package/dist/esm/scan/pool.js.map +1 -1
  259. package/dist/esm/scan/reparse.d.ts +1 -0
  260. package/dist/esm/scan/reparse.js +40 -12
  261. package/dist/esm/scan/reparse.js.map +1 -1
  262. package/dist/esm/store/builder.d.ts +11 -21
  263. package/dist/esm/store/builder.js +337 -133
  264. package/dist/esm/store/builder.js.map +1 -1
  265. package/dist/esm/store/duckdb/connection.js +9 -1
  266. package/dist/esm/store/duckdb/connection.js.map +1 -1
  267. package/dist/esm/store/duckdb/open.d.ts +1 -1
  268. package/dist/esm/store/duckdb/open.js +13 -9
  269. package/dist/esm/store/duckdb/open.js.map +1 -1
  270. package/dist/esm/store/duckdb/reconcile.js +145 -10
  271. package/dist/esm/store/duckdb/reconcile.js.map +1 -1
  272. package/dist/esm/store/embed-scope.js +16 -6
  273. package/dist/esm/store/embed-scope.js.map +1 -1
  274. package/dist/esm/store/index.d.ts +6 -0
  275. package/dist/esm/store/index.js +10 -4
  276. package/dist/esm/store/index.js.map +1 -1
  277. package/dist/esm/store/open.d.ts +6 -1
  278. package/dist/esm/store/open.js +77 -87
  279. package/dist/esm/store/open.js.map +1 -1
  280. package/dist/esm/store/readiness.d.ts +5 -0
  281. package/dist/esm/store/readiness.js +11 -0
  282. package/dist/esm/store/readiness.js.map +1 -0
  283. package/dist/esm/store/reconcile.d.ts +26 -1
  284. package/dist/esm/store/reconcile.js +142 -120
  285. package/dist/esm/store/reconcile.js.map +1 -1
  286. package/dist/esm/store/signature.d.ts +1 -0
  287. package/dist/esm/store/signature.js +8 -0
  288. package/dist/esm/store/signature.js.map +1 -1
  289. package/dist/esm/store/sqlite/open.d.ts +1 -1
  290. package/dist/esm/store/sqlite/open.js +12 -12
  291. package/dist/esm/store/sqlite/open.js.map +1 -1
  292. package/dist/esm/store/sqlite/reconcile.js +2 -2
  293. package/dist/esm/store/sqlite/reconcile.js.map +1 -1
  294. package/dist/esm/store/sqlite/store.js +21 -18
  295. package/dist/esm/store/sqlite/store.js.map +1 -1
  296. package/dist/esm/store/sqlite/vectors.d.ts +2 -2
  297. package/dist/esm/store/sqlite/vectors.js +7 -5
  298. package/dist/esm/store/sqlite/vectors.js.map +1 -1
  299. package/dist/esm/store/stages.js.map +1 -1
  300. package/dist/esm/store/turso/connection.d.ts +1 -0
  301. package/dist/esm/store/turso/connection.js +97 -28
  302. package/dist/esm/store/turso/connection.js.map +1 -1
  303. package/dist/esm/store/turso/open.d.ts +1 -1
  304. package/dist/esm/store/turso/open.js +9 -8
  305. package/dist/esm/store/turso/open.js.map +1 -1
  306. package/dist/esm/store/turso/store.js +16 -14
  307. package/dist/esm/store/turso/store.js.map +1 -1
  308. package/dist/esm/store/turso/vectors.d.ts +2 -2
  309. package/dist/esm/store/turso/vectors.js +27 -17
  310. package/dist/esm/store/turso/vectors.js.map +1 -1
  311. package/dist/esm/store/types.d.ts +4 -1
  312. package/dist/esm/store/types.js.map +1 -1
  313. package/dist/esm/store/vectors.d.ts +14 -1
  314. package/dist/esm/store/vectors.js +55 -0
  315. package/dist/esm/store/vectors.js.map +1 -1
  316. package/dist/esm/watch.d.ts +6 -0
  317. package/dist/esm/watch.js +40 -14
  318. package/dist/esm/watch.js.map +1 -1
  319. package/dist/esm/workers/parse.d.ts +4 -3
  320. package/dist/esm/workers/parse.js +19 -17
  321. package/dist/esm/workers/parse.js.map +1 -1
  322. package/package.json +1 -1
  323. package/skills/sense/EXAMPLES.md +3 -3
  324. package/skills/sense/SKILL.md +11 -3
  325. package/skills/sense/references/search.md +17 -1
  326. package/skills/sense/references/sql.md +1 -1
  327. package/skills/sense/references/stores/duckdb.md +1 -1
  328. package/skills/sense/references/terminology.md +32 -0
  329. package/skills/sense-setup/SKILL.md +2 -2
  330. package/skills/sense-setup/references/embeddings.md +1 -1
  331. package/skills/sense-setup/references/store-benchmarks.md +5 -5
  332. package/skills/sense-setup/references/stores/duckdb.md +1 -1
@@ -11,6 +11,15 @@ Object.defineProperty(exports, "duckdbDialect", {
11
11
  var _errorsts = require("../../errors.js");
12
12
  var _sharedts = require("../shared.js");
13
13
  var _lexicalts = require("./lexical.js");
14
+ var _nativets = require("./native.js");
15
+ function _array_like_to_array(arr, len) {
16
+ if (len == null || len > arr.length) len = arr.length;
17
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
18
+ return arr2;
19
+ }
20
+ function _array_without_holes(arr) {
21
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
22
+ }
14
23
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
15
24
  try {
16
25
  var info = gen[key](arg);
@@ -37,6 +46,23 @@ function _async_to_generator(fn) {
37
46
  });
38
47
  };
39
48
  }
49
+ function _instanceof(left, right) {
50
+ "@swc/helpers - instanceof";
51
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
52
+ return !!right[Symbol.hasInstance](left);
53
+ } else return left instanceof right;
54
+ }
55
+ function _iterable_to_array(iter) {
56
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) {
57
+ return Array.from(iter);
58
+ }
59
+ }
60
+ function _non_iterable_spread() {
61
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
62
+ }
63
+ function _to_consumable_array(arr) {
64
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
65
+ }
40
66
  function _ts_generator(thisArg, body) {
41
67
  var f, y, t, _ = {
42
68
  label: 0,
@@ -136,9 +162,41 @@ function _ts_generator(thisArg, body) {
136
162
  };
137
163
  }
138
164
  }
165
+ function _ts_values(o) {
166
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
167
+ if (m) {
168
+ return m.call(o);
169
+ }
170
+ if (o && typeof o.length === "number") {
171
+ return {
172
+ next: function() {
173
+ if (o && i >= o.length) {
174
+ o = void 0;
175
+ }
176
+ return {
177
+ value: o && o[i++],
178
+ done: !o
179
+ };
180
+ }
181
+ };
182
+ }
183
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
184
+ }
185
+ function _type_of(obj) {
186
+ "@swc/helpers - typeof";
187
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
188
+ }
189
+ function _unsupported_iterable_to_array(o, minLen) {
190
+ if (!o) return;
191
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
192
+ var n = Object.prototype.toString.call(o).slice(8, -1);
193
+ if (n === "Object" && o.constructor) n = o.constructor.name;
194
+ if (n === "Map" || n === "Set") return Array.from(n);
195
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
196
+ }
139
197
  // This store's dialect (types.ts's ReconcileDialect) for the shared orchestration in
140
- // store/reconcile.ts. `content` is a plain table, not FTS-virtual, so rows are maintained here
141
- // unconditionally; DuckDB's ALTER TABLE needs a declared type, so every dynamic frontmatter
198
+ // store/reconcile.ts. `content` is a plain table, not FTS-virtual, so changed rows are maintained
199
+ // here; DuckDB's ALTER TABLE needs a declared type, so every dynamic frontmatter
142
200
  // column is VARIANT (holds mapValue()'s mixed JS types for one key across files).
143
201
  // No rowid coupling needed (unlike sqlite's content, which links to frontmatter's rowid):
144
202
  // `path` is content's own primary key, so this is a plain per-doc row.
@@ -149,6 +207,8 @@ var CONTENT_COLUMNS = [
149
207
  'text'
150
208
  ];
151
209
  var INSERT_CONTENT_SQL = "INSERT INTO content (".concat(CONTENT_COLUMNS.map(_sharedts.quoteIdent).join(', '), ") VALUES (?, ?, ?, ?)");
210
+ // Bound the extra persisted text held for exact comparison, even during a full reparse.
211
+ var CONTENT_LOOKUP_CHUNK = 128;
152
212
  function contentRow(doc) {
153
213
  return [
154
214
  doc.relPath,
@@ -160,43 +220,500 @@ function contentRow(doc) {
160
220
  // No compile-time column cap in DuckDB (unlike SQLite's SQLITE_MAX_COLUMN); kept as a sanity fence anyway
161
221
  // so a runaway frontmatter generator fails with a clear message instead of an unbounded ALTER TABLE loop.
162
222
  var MAX_FRONTMATTER_COLUMNS = 10000;
163
- function reconcileContent(conn, touched, docs, _delta) {
223
+ var FRONTMATTER_UPDATE_CHUNK = 128;
224
+ function withNativeStatement(native, sql, fn) {
164
225
  return _async_to_generator(function() {
226
+ var stmt, errors, result, err;
165
227
  return _ts_generator(this, function(_state) {
166
228
  switch(_state.label){
167
229
  case 0:
168
- if (!(touched.length > 0)) return [
230
+ return [
231
+ 4,
232
+ native.prepare(sql)
233
+ ];
234
+ case 1:
235
+ stmt = _state.sent();
236
+ errors = [];
237
+ _state.label = 2;
238
+ case 2:
239
+ _state.trys.push([
240
+ 2,
241
+ 4,
242
+ ,
243
+ 5
244
+ ]);
245
+ return [
246
+ 4,
247
+ fn(stmt)
248
+ ];
249
+ case 3:
250
+ result = _state.sent();
251
+ return [
252
+ 3,
253
+ 5
254
+ ];
255
+ case 4:
256
+ err = _state.sent();
257
+ errors.push(err);
258
+ return [
259
+ 3,
260
+ 5
261
+ ];
262
+ case 5:
263
+ try {
264
+ stmt.destroySync();
265
+ } catch (err) {
266
+ errors.push(err);
267
+ }
268
+ if (errors.length === 1) throw errors[0];
269
+ if (errors.length > 1) throw new AggregateError(errors, 'frontmatter statement and cleanup failed');
270
+ return [
271
+ 2,
272
+ result
273
+ ];
274
+ }
275
+ });
276
+ })();
277
+ }
278
+ // Wide writes amplify native commit allocations even for one changed stamp.
279
+ // Skip only known, exactly equal values; uncertain representations still write.
280
+ function updateFrontmatter(conn, writableColumns, rows) {
281
+ return _async_to_generator(function() {
282
+ var _loop, native, _ref, DuckDBVariantValue, DuckDBTypeId, physical, writable, pathIndex, columnTypes, insertSql, sameValue, i;
283
+ return _ts_generator(this, function(_state) {
284
+ switch(_state.label){
285
+ case 0:
286
+ _loop = function(i) {
287
+ var _loop, chunk, paths, placeholders, selected, existing, plans, position;
288
+ return _ts_generator(this, function(_state) {
289
+ switch(_state.label){
290
+ case 0:
291
+ _loop = function(position1) {
292
+ var plan, end, assignments;
293
+ return _ts_generator(this, function(_state) {
294
+ switch(_state.label){
295
+ case 0:
296
+ plan = plans[position1];
297
+ if (!plan.missing && plan.changed.length === 0) {
298
+ ++position1;
299
+ return [
300
+ 2,
301
+ (position = position1, "continue")
302
+ ];
303
+ }
304
+ end = position1 + 1;
305
+ while(end < plans.length && plans[end].missing === plan.missing && plans[end].signature === plan.signature)++end;
306
+ if (!plan.missing) return [
307
+ 3,
308
+ 2
309
+ ];
310
+ return [
311
+ 4,
312
+ (0, _sharedts.appendRows)(conn, 'frontmatter', writableColumns, insertSql, plans.slice(position1, end).map(function(repair) {
313
+ return repair.row;
314
+ }))
315
+ ];
316
+ case 1:
317
+ _state.sent();
318
+ return [
319
+ 3,
320
+ 4
321
+ ];
322
+ case 2:
323
+ assignments = plan.changed.map(function(index) {
324
+ return "".concat((0, _sharedts.quoteIdent)(writableColumns[index]), " = ?");
325
+ }).join(', ');
326
+ return [
327
+ 4,
328
+ withNativeStatement(native, "UPDATE frontmatter SET ".concat(assignments, ' WHERE "path" = ?'), function(stmt) {
329
+ return _async_to_generator(function() {
330
+ var _loop, rowIndex;
331
+ return _ts_generator(this, function(_state) {
332
+ switch(_state.label){
333
+ case 0:
334
+ _loop = function(rowIndex) {
335
+ var row;
336
+ return _ts_generator(this, function(_state) {
337
+ switch(_state.label){
338
+ case 0:
339
+ row = plans[rowIndex].row;
340
+ stmt.bind(_to_consumable_array(plan.changed.map(function(index) {
341
+ var _row_index;
342
+ return (_row_index = row[index]) !== null && _row_index !== void 0 ? _row_index : null;
343
+ })).concat([
344
+ row[pathIndex]
345
+ ]));
346
+ return [
347
+ 4,
348
+ stmt.run()
349
+ ];
350
+ case 1:
351
+ _state.sent();
352
+ return [
353
+ 2
354
+ ];
355
+ }
356
+ });
357
+ };
358
+ rowIndex = position1;
359
+ _state.label = 1;
360
+ case 1:
361
+ if (!(rowIndex < end)) return [
362
+ 3,
363
+ 4
364
+ ];
365
+ return [
366
+ 5,
367
+ _ts_values(_loop(rowIndex))
368
+ ];
369
+ case 2:
370
+ _state.sent();
371
+ _state.label = 3;
372
+ case 3:
373
+ ++rowIndex;
374
+ return [
375
+ 3,
376
+ 1
377
+ ];
378
+ case 4:
379
+ return [
380
+ 2
381
+ ];
382
+ }
383
+ });
384
+ })();
385
+ })
386
+ ];
387
+ case 3:
388
+ _state.sent();
389
+ _state.label = 4;
390
+ case 4:
391
+ position1 = end;
392
+ position = position1, void 0;
393
+ return [
394
+ 2
395
+ ];
396
+ }
397
+ });
398
+ };
399
+ chunk = rows.slice(i, i + FRONTMATTER_UPDATE_CHUNK);
400
+ paths = chunk.map(function(row) {
401
+ return row[pathIndex];
402
+ });
403
+ placeholders = paths.map(function() {
404
+ return '?';
405
+ }).join(', ');
406
+ selected = writableColumns.map(_sharedts.quoteIdent).join(', ');
407
+ return [
408
+ 4,
409
+ withNativeStatement(native, "SELECT ".concat(selected, ' FROM frontmatter WHERE "path" IN (').concat(placeholders, ")"), function(stmt) {
410
+ return _async_to_generator(function() {
411
+ var reader;
412
+ return _ts_generator(this, function(_state) {
413
+ switch(_state.label){
414
+ case 0:
415
+ stmt.bind(paths);
416
+ return [
417
+ 4,
418
+ stmt.runAndReadAll()
419
+ ];
420
+ case 1:
421
+ reader = _state.sent();
422
+ // Native wrappers distinguish numeric tags and SQL NULL from VARIANT null.
423
+ return [
424
+ 2,
425
+ new Map(reader.getRowObjects().map(function(row) {
426
+ return [
427
+ row.path,
428
+ row
429
+ ];
430
+ }))
431
+ ];
432
+ }
433
+ });
434
+ })();
435
+ })
436
+ ];
437
+ case 1:
438
+ existing = _state.sent();
439
+ plans = chunk.map(function(row) {
440
+ var old = existing.get(row[pathIndex]);
441
+ var changed = old ? writableColumns.flatMap(function(column, index) {
442
+ return sameValue(old[column], row[index], column) ? [] : [
443
+ index
444
+ ];
445
+ }) : [];
446
+ return {
447
+ row: row,
448
+ missing: old === undefined,
449
+ changed: changed,
450
+ signature: changed.join(',')
451
+ };
452
+ });
453
+ position = 0;
454
+ _state.label = 2;
455
+ case 2:
456
+ if (!(position < plans.length)) return [
457
+ 3,
458
+ 5
459
+ ];
460
+ return [
461
+ 5,
462
+ _ts_values(_loop(position))
463
+ ];
464
+ case 3:
465
+ _state.sent();
466
+ _state.label = 4;
467
+ case 4:
468
+ return [
469
+ 3,
470
+ 2
471
+ ];
472
+ case 5:
473
+ return [
474
+ 2
475
+ ];
476
+ }
477
+ });
478
+ };
479
+ if (rows.length === 0) return [
480
+ 2
481
+ ];
482
+ native = conn.duckdb;
483
+ return [
484
+ 4,
485
+ (0, _nativets.duckdbApi)()
486
+ ];
487
+ case 1:
488
+ _ref = _state.sent(), DuckDBVariantValue = _ref.DuckDBVariantValue, DuckDBTypeId = _ref.DuckDBTypeId;
489
+ return [
490
+ 4,
491
+ withNativeStatement(native, 'PRAGMA table_info(frontmatter)', function(stmt) {
492
+ return _async_to_generator(function() {
493
+ var reader;
494
+ return _ts_generator(this, function(_state) {
495
+ switch(_state.label){
496
+ case 0:
497
+ return [
498
+ 4,
499
+ stmt.runAndReadAll()
500
+ ];
501
+ case 1:
502
+ reader = _state.sent();
503
+ return [
504
+ 2,
505
+ reader.getRowObjectsJS()
506
+ ];
507
+ }
508
+ });
509
+ })();
510
+ })
511
+ ];
512
+ case 2:
513
+ physical = _state.sent();
514
+ writable = new Map(writableColumns.map(function(name, i) {
515
+ return [
516
+ name,
517
+ i
518
+ ];
519
+ }));
520
+ pathIndex = writable.get('path');
521
+ if (pathIndex === undefined) throw new Error('frontmatter update requires a writable path column');
522
+ columnTypes = new Map(physical.map(function(column) {
523
+ return [
524
+ column.name,
525
+ column.type
526
+ ];
527
+ }));
528
+ insertSql = "INSERT INTO frontmatter (".concat(writableColumns.map(_sharedts.quoteIdent).join(', '), ") VALUES (").concat(writableColumns.map(function() {
529
+ return '?';
530
+ }).join(', '), ")");
531
+ sameValue = function sameValue(old, value, column) {
532
+ var _old_type;
533
+ if (value === null || value === undefined) return old === null;
534
+ if (columnTypes.get(column) !== 'VARIANT') return Object.is(old, value);
535
+ if (!_instanceof(old, DuckDBVariantValue)) return false;
536
+ var typeId = typeof value === 'string' ? DuckDBTypeId.VARCHAR : (typeof value === "undefined" ? "undefined" : _type_of(value)) === 'bigint' ? DuckDBTypeId.HUGEINT : typeof value === 'number' && !Number.isInteger(value) ? DuckDBTypeId.DOUBLE : undefined;
537
+ return typeId !== undefined && ((_old_type = old.type) === null || _old_type === void 0 ? void 0 : _old_type.typeId) === typeId && Object.is(old.value, value);
538
+ };
539
+ i = 0;
540
+ _state.label = 3;
541
+ case 3:
542
+ if (!(i < rows.length)) return [
169
543
  3,
544
+ 6
545
+ ];
546
+ return [
547
+ 5,
548
+ _ts_values(_loop(i))
549
+ ];
550
+ case 4:
551
+ _state.sent();
552
+ _state.label = 5;
553
+ case 5:
554
+ i += FRONTMATTER_UPDATE_CHUNK;
555
+ return [
556
+ 3,
557
+ 3
558
+ ];
559
+ case 6:
560
+ return [
170
561
  2
171
562
  ];
563
+ }
564
+ });
565
+ })();
566
+ }
567
+ function reconcileContent(conn, touched, docs, delta) {
568
+ return _async_to_generator(function() {
569
+ var added, reparsed, changed, removed, i, _stmt, chunk, stmt, rows, existing, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, doc, row, docPaths, vanished, i1, _stmt1, _removed, chunk1, stmt1, rows1, changedDocs;
570
+ return _ts_generator(this, function(_state) {
571
+ switch(_state.label){
572
+ case 0:
573
+ added = new Set(delta.added);
574
+ reparsed = docs.filter(function(doc) {
575
+ return !added.has(doc.relPath);
576
+ });
577
+ changed = new Set(delta.added);
578
+ removed = [];
579
+ i = 0;
580
+ _state.label = 1;
581
+ case 1:
582
+ if (!(i < reparsed.length)) return [
583
+ 3,
584
+ 5
585
+ ];
586
+ chunk = reparsed.slice(i, i + CONTENT_LOOKUP_CHUNK);
172
587
  return [
173
588
  4,
174
- conn.runBatch('DELETE FROM content WHERE "path" = ?', touched.map(function(p) {
589
+ conn.prepare('SELECT "path", title, summary, text FROM content WHERE "path" IN ('.concat(chunk.map(function() {
590
+ return '?';
591
+ }).join(', '), ")"))
592
+ ];
593
+ case 2:
594
+ stmt = _state.sent();
595
+ return [
596
+ 4,
597
+ (_stmt = stmt).all.apply(_stmt, _to_consumable_array(chunk.map(function(doc) {
598
+ return doc.relPath;
599
+ })))
600
+ ];
601
+ case 3:
602
+ rows = _state.sent();
603
+ existing = new Map(rows.map(function(row) {
604
+ return [
605
+ row.path,
606
+ row
607
+ ];
608
+ }));
609
+ _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
610
+ try {
611
+ for(_iterator = chunk[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
612
+ doc = _step.value;
613
+ row = existing.get(doc.relPath);
614
+ if (row && row.title === doc.search.title && row.summary === doc.search.summary && row.text === doc.search.text) continue;
615
+ changed.add(doc.relPath);
616
+ if (row) removed.push(doc.relPath);
617
+ }
618
+ } catch (err) {
619
+ _didIteratorError = true;
620
+ _iteratorError = err;
621
+ } finally{
622
+ try {
623
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
624
+ _iterator.return();
625
+ }
626
+ } finally{
627
+ if (_didIteratorError) {
628
+ throw _iteratorError;
629
+ }
630
+ }
631
+ }
632
+ _state.label = 4;
633
+ case 4:
634
+ i += CONTENT_LOOKUP_CHUNK;
635
+ return [
636
+ 3,
637
+ 1
638
+ ];
639
+ case 5:
640
+ docPaths = new Set(docs.map(function(doc) {
641
+ return doc.relPath;
642
+ }));
643
+ vanished = touched.filter(function(path) {
644
+ return !docPaths.has(path);
645
+ });
646
+ i1 = 0;
647
+ _state.label = 6;
648
+ case 6:
649
+ if (!(i1 < vanished.length)) return [
650
+ 3,
651
+ 10
652
+ ];
653
+ chunk1 = vanished.slice(i1, i1 + CONTENT_LOOKUP_CHUNK);
654
+ return [
655
+ 4,
656
+ conn.prepare('SELECT "path" FROM content WHERE "path" IN ('.concat(chunk1.map(function() {
657
+ return '?';
658
+ }).join(', '), ")"))
659
+ ];
660
+ case 7:
661
+ stmt1 = _state.sent();
662
+ return [
663
+ 4,
664
+ (_stmt1 = stmt1).all.apply(_stmt1, _to_consumable_array(chunk1))
665
+ ];
666
+ case 8:
667
+ rows1 = _state.sent();
668
+ (_removed = removed).push.apply(_removed, _to_consumable_array(rows1.map(function(row) {
669
+ return row.path;
670
+ })));
671
+ _state.label = 9;
672
+ case 9:
673
+ i1 += CONTENT_LOOKUP_CHUNK;
674
+ return [
675
+ 3,
676
+ 6
677
+ ];
678
+ case 10:
679
+ if (!(removed.length > 0)) return [
680
+ 3,
681
+ 12
682
+ ];
683
+ return [
684
+ 4,
685
+ conn.runBatch('DELETE FROM content WHERE "path" = ?', removed.map(function(p) {
175
686
  return [
176
687
  p
177
688
  ];
178
689
  }))
179
690
  ];
180
- case 1:
691
+ case 11:
181
692
  _state.sent();
182
- _state.label = 2;
183
- case 2:
184
- // The delete above cleared every touched path, and duckdb holds the cache file for its whole
185
- // connection, so no second writer can have landed one of these rows: nothing can conflict.
693
+ _state.label = 12;
694
+ case 12:
695
+ // Keep document order and the existing insert/error semantics for added paths.
696
+ changedDocs = docs.filter(function(doc) {
697
+ return changed.has(doc.relPath);
698
+ });
186
699
  return [
187
700
  4,
188
- (0, _sharedts.appendRows)(conn, 'content', CONTENT_COLUMNS, INSERT_CONTENT_SQL, docs.map(contentRow))
701
+ (0, _sharedts.appendRows)(conn, 'content', CONTENT_COLUMNS, INSERT_CONTENT_SQL, changedDocs.map(contentRow))
189
702
  ];
190
- case 3:
703
+ case 13:
191
704
  _state.sent();
192
- // Build prepares the FTS index after reconcile. This persisted mark commits with the content
193
- // change, so an interrupted build cannot expose stale lexical results.
705
+ if (!(removed.length > 0 || changedDocs.length > 0)) return [
706
+ 3,
707
+ 15
708
+ ];
194
709
  return [
195
710
  4,
196
711
  (0, _lexicalts.markContentStale)(conn)
197
712
  ];
198
- case 4:
713
+ case 14:
199
714
  _state.sent();
715
+ _state.label = 15;
716
+ case 15:
200
717
  return [
201
718
  2
202
719
  ];
@@ -242,6 +759,7 @@ var duckdbDialect = {
242
759
  }
243
760
  },
244
761
  addColumns: addColumns,
762
+ updateFrontmatter: updateFrontmatter,
245
763
  reconcileContent: reconcileContent
246
764
  };
247
765
  /* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }