@gmickel/gno 0.7.0 → 0.8.1

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 (209) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +90 -50
  3. package/THIRD_PARTY_NOTICES.md +22 -0
  4. package/assets/screenshots/webui-ask-answer.png +0 -0
  5. package/assets/screenshots/webui-collections.png +0 -0
  6. package/assets/screenshots/webui-editor.png +0 -0
  7. package/assets/screenshots/webui-home.png +0 -0
  8. package/assets/skill/SKILL.md +12 -12
  9. package/assets/skill/cli-reference.md +59 -57
  10. package/assets/skill/examples.md +8 -7
  11. package/assets/skill/mcp-reference.md +8 -4
  12. package/package.json +31 -24
  13. package/src/app/constants.ts +43 -42
  14. package/src/cli/colors.ts +1 -1
  15. package/src/cli/commands/ask.ts +44 -43
  16. package/src/cli/commands/cleanup.ts +9 -8
  17. package/src/cli/commands/collection/add.ts +12 -12
  18. package/src/cli/commands/collection/index.ts +4 -4
  19. package/src/cli/commands/collection/list.ts +26 -25
  20. package/src/cli/commands/collection/remove.ts +10 -10
  21. package/src/cli/commands/collection/rename.ts +10 -10
  22. package/src/cli/commands/context/add.ts +1 -1
  23. package/src/cli/commands/context/check.ts +17 -17
  24. package/src/cli/commands/context/index.ts +4 -4
  25. package/src/cli/commands/context/list.ts +11 -11
  26. package/src/cli/commands/context/rm.ts +1 -1
  27. package/src/cli/commands/doctor.ts +86 -84
  28. package/src/cli/commands/embed.ts +30 -28
  29. package/src/cli/commands/get.ts +27 -26
  30. package/src/cli/commands/index-cmd.ts +9 -9
  31. package/src/cli/commands/index.ts +16 -16
  32. package/src/cli/commands/init.ts +13 -12
  33. package/src/cli/commands/ls.ts +20 -19
  34. package/src/cli/commands/mcp/config.ts +30 -28
  35. package/src/cli/commands/mcp/index.ts +4 -4
  36. package/src/cli/commands/mcp/install.ts +17 -17
  37. package/src/cli/commands/mcp/paths.ts +133 -133
  38. package/src/cli/commands/mcp/status.ts +21 -21
  39. package/src/cli/commands/mcp/uninstall.ts +13 -13
  40. package/src/cli/commands/mcp.ts +2 -2
  41. package/src/cli/commands/models/clear.ts +12 -11
  42. package/src/cli/commands/models/index.ts +5 -5
  43. package/src/cli/commands/models/list.ts +31 -30
  44. package/src/cli/commands/models/path.ts +1 -1
  45. package/src/cli/commands/models/pull.ts +19 -18
  46. package/src/cli/commands/models/use.ts +4 -4
  47. package/src/cli/commands/multi-get.ts +38 -36
  48. package/src/cli/commands/query.ts +21 -20
  49. package/src/cli/commands/ref-parser.ts +10 -10
  50. package/src/cli/commands/reset.ts +40 -39
  51. package/src/cli/commands/search.ts +14 -13
  52. package/src/cli/commands/serve.ts +4 -4
  53. package/src/cli/commands/shared.ts +11 -10
  54. package/src/cli/commands/skill/index.ts +5 -5
  55. package/src/cli/commands/skill/install.ts +18 -17
  56. package/src/cli/commands/skill/paths-cmd.ts +11 -10
  57. package/src/cli/commands/skill/paths.ts +23 -23
  58. package/src/cli/commands/skill/show.ts +13 -12
  59. package/src/cli/commands/skill/uninstall.ts +16 -15
  60. package/src/cli/commands/status.ts +25 -24
  61. package/src/cli/commands/update.ts +3 -3
  62. package/src/cli/commands/vsearch.ts +17 -16
  63. package/src/cli/context.ts +5 -5
  64. package/src/cli/errors.ts +3 -3
  65. package/src/cli/format/search-results.ts +37 -37
  66. package/src/cli/options.ts +43 -43
  67. package/src/cli/program.ts +455 -459
  68. package/src/cli/progress.ts +1 -1
  69. package/src/cli/run.ts +24 -23
  70. package/src/collection/add.ts +9 -8
  71. package/src/collection/index.ts +3 -3
  72. package/src/collection/remove.ts +7 -6
  73. package/src/collection/types.ts +6 -6
  74. package/src/config/defaults.ts +1 -1
  75. package/src/config/index.ts +5 -5
  76. package/src/config/loader.ts +19 -18
  77. package/src/config/paths.ts +9 -8
  78. package/src/config/saver.ts +14 -13
  79. package/src/config/types.ts +53 -52
  80. package/src/converters/adapters/markitdownTs/adapter.ts +21 -19
  81. package/src/converters/adapters/officeparser/adapter.ts +18 -16
  82. package/src/converters/canonicalize.ts +12 -12
  83. package/src/converters/errors.ts +26 -22
  84. package/src/converters/index.ts +8 -8
  85. package/src/converters/mime.ts +25 -25
  86. package/src/converters/native/markdown.ts +10 -9
  87. package/src/converters/native/plaintext.ts +8 -7
  88. package/src/converters/path.ts +2 -2
  89. package/src/converters/pipeline.ts +11 -10
  90. package/src/converters/registry.ts +8 -8
  91. package/src/converters/types.ts +14 -14
  92. package/src/converters/versions.ts +4 -4
  93. package/src/index.ts +4 -4
  94. package/src/ingestion/chunker.ts +10 -9
  95. package/src/ingestion/index.ts +6 -6
  96. package/src/ingestion/language.ts +62 -62
  97. package/src/ingestion/sync.ts +50 -49
  98. package/src/ingestion/types.ts +10 -10
  99. package/src/ingestion/walker.ts +14 -13
  100. package/src/llm/cache.ts +51 -49
  101. package/src/llm/errors.ts +40 -36
  102. package/src/llm/index.ts +9 -9
  103. package/src/llm/lockfile.ts +6 -6
  104. package/src/llm/nodeLlamaCpp/adapter.ts +13 -12
  105. package/src/llm/nodeLlamaCpp/embedding.ts +9 -8
  106. package/src/llm/nodeLlamaCpp/generation.ts +7 -6
  107. package/src/llm/nodeLlamaCpp/lifecycle.ts +11 -10
  108. package/src/llm/nodeLlamaCpp/rerank.ts +6 -5
  109. package/src/llm/policy.ts +5 -5
  110. package/src/llm/registry.ts +6 -5
  111. package/src/llm/types.ts +2 -2
  112. package/src/mcp/resources/index.ts +15 -13
  113. package/src/mcp/server.ts +25 -23
  114. package/src/mcp/tools/get.ts +25 -23
  115. package/src/mcp/tools/index.ts +32 -29
  116. package/src/mcp/tools/multi-get.ts +34 -32
  117. package/src/mcp/tools/query.ts +29 -27
  118. package/src/mcp/tools/search.ts +14 -12
  119. package/src/mcp/tools/status.ts +12 -11
  120. package/src/mcp/tools/vsearch.ts +26 -24
  121. package/src/pipeline/answer.ts +9 -9
  122. package/src/pipeline/chunk-lookup.ts +1 -1
  123. package/src/pipeline/contextual.ts +4 -4
  124. package/src/pipeline/expansion.ts +23 -21
  125. package/src/pipeline/explain.ts +21 -21
  126. package/src/pipeline/fusion.ts +9 -9
  127. package/src/pipeline/hybrid.ts +41 -42
  128. package/src/pipeline/index.ts +10 -10
  129. package/src/pipeline/query-language.ts +39 -39
  130. package/src/pipeline/rerank.ts +8 -7
  131. package/src/pipeline/search.ts +22 -22
  132. package/src/pipeline/types.ts +8 -8
  133. package/src/pipeline/vsearch.ts +21 -24
  134. package/src/serve/CLAUDE.md +21 -15
  135. package/src/serve/config-sync.ts +9 -8
  136. package/src/serve/context.ts +19 -18
  137. package/src/serve/index.ts +1 -1
  138. package/src/serve/jobs.ts +7 -7
  139. package/src/serve/public/app.tsx +79 -25
  140. package/src/serve/public/components/AddCollectionDialog.tsx +382 -0
  141. package/src/serve/public/components/CaptureButton.tsx +60 -0
  142. package/src/serve/public/components/CaptureModal.tsx +365 -0
  143. package/src/serve/public/components/IndexingProgress.tsx +333 -0
  144. package/src/serve/public/components/ShortcutHelpModal.tsx +106 -0
  145. package/src/serve/public/components/ai-elements/code-block.tsx +42 -32
  146. package/src/serve/public/components/ai-elements/conversation.tsx +16 -14
  147. package/src/serve/public/components/ai-elements/inline-citation.tsx +33 -32
  148. package/src/serve/public/components/ai-elements/loader.tsx +5 -4
  149. package/src/serve/public/components/ai-elements/message.tsx +39 -37
  150. package/src/serve/public/components/ai-elements/prompt-input.tsx +97 -95
  151. package/src/serve/public/components/ai-elements/sources.tsx +12 -10
  152. package/src/serve/public/components/ai-elements/suggestion.tsx +10 -9
  153. package/src/serve/public/components/editor/CodeMirrorEditor.tsx +142 -0
  154. package/src/serve/public/components/editor/MarkdownPreview.tsx +311 -0
  155. package/src/serve/public/components/editor/index.ts +6 -0
  156. package/src/serve/public/components/preset-selector.tsx +29 -28
  157. package/src/serve/public/components/ui/badge.tsx +13 -12
  158. package/src/serve/public/components/ui/button-group.tsx +13 -12
  159. package/src/serve/public/components/ui/button.tsx +23 -22
  160. package/src/serve/public/components/ui/card.tsx +16 -16
  161. package/src/serve/public/components/ui/carousel.tsx +36 -35
  162. package/src/serve/public/components/ui/collapsible.tsx +1 -1
  163. package/src/serve/public/components/ui/command.tsx +17 -15
  164. package/src/serve/public/components/ui/dialog.tsx +13 -12
  165. package/src/serve/public/components/ui/dropdown-menu.tsx +13 -12
  166. package/src/serve/public/components/ui/hover-card.tsx +6 -5
  167. package/src/serve/public/components/ui/input-group.tsx +45 -43
  168. package/src/serve/public/components/ui/input.tsx +6 -6
  169. package/src/serve/public/components/ui/progress.tsx +5 -4
  170. package/src/serve/public/components/ui/scroll-area.tsx +11 -10
  171. package/src/serve/public/components/ui/select.tsx +19 -18
  172. package/src/serve/public/components/ui/separator.tsx +6 -5
  173. package/src/serve/public/components/ui/table.tsx +18 -18
  174. package/src/serve/public/components/ui/textarea.tsx +4 -4
  175. package/src/serve/public/components/ui/tooltip.tsx +5 -4
  176. package/src/serve/public/globals.css +27 -4
  177. package/src/serve/public/hooks/use-api.ts +8 -8
  178. package/src/serve/public/hooks/useCaptureModal.tsx +83 -0
  179. package/src/serve/public/hooks/useKeyboardShortcuts.ts +85 -0
  180. package/src/serve/public/index.html +4 -4
  181. package/src/serve/public/lib/utils.ts +6 -0
  182. package/src/serve/public/pages/Ask.tsx +27 -26
  183. package/src/serve/public/pages/Browse.tsx +28 -27
  184. package/src/serve/public/pages/Collections.tsx +439 -0
  185. package/src/serve/public/pages/Dashboard.tsx +166 -40
  186. package/src/serve/public/pages/DocView.tsx +258 -73
  187. package/src/serve/public/pages/DocumentEditor.tsx +510 -0
  188. package/src/serve/public/pages/Search.tsx +80 -58
  189. package/src/serve/routes/api.ts +272 -155
  190. package/src/serve/security.ts +4 -4
  191. package/src/serve/server.ts +66 -48
  192. package/src/store/index.ts +5 -5
  193. package/src/store/migrations/001-initial.ts +24 -23
  194. package/src/store/migrations/002-documents-fts.ts +7 -6
  195. package/src/store/migrations/index.ts +4 -4
  196. package/src/store/migrations/runner.ts +17 -15
  197. package/src/store/sqlite/adapter.ts +123 -121
  198. package/src/store/sqlite/fts5-snowball.ts +24 -23
  199. package/src/store/sqlite/index.ts +1 -1
  200. package/src/store/sqlite/setup.ts +12 -12
  201. package/src/store/sqlite/types.ts +4 -4
  202. package/src/store/types.ts +19 -19
  203. package/src/store/vector/index.ts +3 -3
  204. package/src/store/vector/sqlite-vec.ts +23 -20
  205. package/src/store/vector/stats.ts +10 -8
  206. package/src/store/vector/types.ts +2 -2
  207. package/vendor/fts5-snowball/README.md +6 -6
  208. package/assets/screenshots/webui-ask-answer.jpg +0 -0
  209. package/assets/screenshots/webui-home.jpg +0 -0
@@ -7,14 +7,15 @@
7
7
  * @module src/store/sqlite/fts5-snowball
8
8
  */
9
9
 
10
- import type { Database } from 'bun:sqlite';
10
+ import type { Database } from "bun:sqlite";
11
+
11
12
  // node:fs: existsSync for sync file checks at load time
12
- import { existsSync } from 'node:fs';
13
+ import { existsSync } from "node:fs";
13
14
  // node:path: join for cross-platform paths
14
- import { join } from 'node:path';
15
+ import { join } from "node:path";
15
16
  // node:process: arch/platform detection (no Bun equivalent)
16
- import { arch, platform } from 'node:process';
17
- import { fileURLToPath } from 'node:url';
17
+ import { arch, platform } from "node:process";
18
+ import { fileURLToPath } from "node:url";
18
19
 
19
20
  // ─────────────────────────────────────────────────────────────────────────────
20
21
  // Types
@@ -34,30 +35,30 @@ export interface Fts5SnowballLoadResult {
34
35
  // ─────────────────────────────────────────────────────────────────────────────
35
36
 
36
37
  function getPlatformDir(): string | null {
37
- const os = platform === 'win32' ? 'windows' : platform;
38
- const archName = arch === 'arm64' ? 'arm64' : 'x64';
38
+ const os = platform === "win32" ? "windows" : platform;
39
+ const archName = arch === "arm64" ? "arm64" : "x64";
39
40
 
40
- if (os === 'darwin') {
41
+ if (os === "darwin") {
41
42
  return `darwin-${archName}`;
42
43
  }
43
- if (os === 'linux' && archName === 'x64') {
44
- return 'linux-x64';
44
+ if (os === "linux" && archName === "x64") {
45
+ return "linux-x64";
45
46
  }
46
- if (os === 'windows' && archName === 'x64') {
47
- return 'windows-x64';
47
+ if (os === "windows" && archName === "x64") {
48
+ return "windows-x64";
48
49
  }
49
50
 
50
51
  return null;
51
52
  }
52
53
 
53
54
  function getExtensionSuffix(): string {
54
- if (platform === 'win32') {
55
- return 'dll';
55
+ if (platform === "win32") {
56
+ return "dll";
56
57
  }
57
- if (platform === 'darwin') {
58
- return 'dylib';
58
+ if (platform === "darwin") {
59
+ return "dylib";
59
60
  }
60
- return 'so';
61
+ return "so";
61
62
  }
62
63
 
63
64
  // ─────────────────────────────────────────────────────────────────────────────
@@ -78,14 +79,14 @@ export function getExtensionPath(): string | null {
78
79
  const filename = `fts5stemmer.${suffix}`;
79
80
 
80
81
  // Resolve relative to this module (ESM-safe)
81
- const thisDir = fileURLToPath(new URL('.', import.meta.url));
82
+ const thisDir = fileURLToPath(new URL(".", import.meta.url));
82
83
  const vendorPath = join(
83
84
  thisDir,
84
- '..',
85
- '..',
86
- '..',
87
- 'vendor',
88
- 'fts5-snowball',
85
+ "..",
86
+ "..",
87
+ "..",
88
+ "vendor",
89
+ "fts5-snowball",
89
90
  platformDir,
90
91
  filename
91
92
  );
@@ -4,4 +4,4 @@
4
4
  * @module src/store/sqlite
5
5
  */
6
6
 
7
- export { SqliteAdapter } from './adapter';
7
+ export { SqliteAdapter } from "./adapter";
@@ -10,11 +10,11 @@
10
10
  * @module src/store/sqlite/setup
11
11
  */
12
12
 
13
- import { Database } from 'bun:sqlite';
13
+ import { Database } from "bun:sqlite";
14
14
  // node:fs: existsSync for checking file existence (no async needed at module load)
15
- import { existsSync } from 'node:fs';
15
+ import { existsSync } from "node:fs";
16
16
  // node:os: platform detection (no Bun equivalent)
17
- import { platform } from 'node:os';
17
+ import { platform } from "node:os";
18
18
 
19
19
  // ─────────────────────────────────────────────────────────────────────────────
20
20
  // Types
@@ -26,7 +26,7 @@ import { platform } from 'node:os';
26
26
  * - 'custom': Custom SQLite library loaded successfully (macOS with Homebrew)
27
27
  * - 'unavailable': Extension loading not possible
28
28
  */
29
- export type ExtensionLoadingMode = 'native' | 'custom' | 'unavailable';
29
+ export type ExtensionLoadingMode = "native" | "custom" | "unavailable";
30
30
 
31
31
  /**
32
32
  * Record of a SQLite load attempt for diagnostics.
@@ -42,8 +42,8 @@ export interface LoadAttempt {
42
42
 
43
43
  // Possible paths to Homebrew SQLite with extension support
44
44
  const SQLITE_PATHS = [
45
- '/opt/homebrew/opt/sqlite3/lib/libsqlite3.dylib', // macOS Apple Silicon
46
- '/usr/local/opt/sqlite3/lib/libsqlite3.dylib', // macOS Intel
45
+ "/opt/homebrew/opt/sqlite3/lib/libsqlite3.dylib", // macOS Apple Silicon
46
+ "/usr/local/opt/sqlite3/lib/libsqlite3.dylib", // macOS Intel
47
47
  ];
48
48
 
49
49
  let setupCompleted = false;
@@ -64,7 +64,7 @@ function setupCustomSqlite(): void {
64
64
  }
65
65
 
66
66
  // Linux/Windows: bundled SQLite supports extensions natively
67
- if (platform() !== 'darwin') {
67
+ if (platform() !== "darwin") {
68
68
  setupCompleted = true;
69
69
  return;
70
70
  }
@@ -72,7 +72,7 @@ function setupCustomSqlite(): void {
72
72
  // macOS: try Homebrew paths
73
73
  for (const path of SQLITE_PATHS) {
74
74
  if (!existsSync(path)) {
75
- loadAttempts.push({ path, error: 'file not found' });
75
+ loadAttempts.push({ path, error: "file not found" });
76
76
  continue;
77
77
  }
78
78
  try {
@@ -100,10 +100,10 @@ setupCustomSqlite();
100
100
  * Get the extension loading mode for this platform.
101
101
  */
102
102
  export function getExtensionLoadingMode(): ExtensionLoadingMode {
103
- if (platform() !== 'darwin') {
104
- return 'native'; // Linux/Windows: bundled SQLite supports extensions
103
+ if (platform() !== "darwin") {
104
+ return "native"; // Linux/Windows: bundled SQLite supports extensions
105
105
  }
106
- return customSqlitePath ? 'custom' : 'unavailable';
106
+ return customSqlitePath ? "custom" : "unavailable";
107
107
  }
108
108
 
109
109
  /**
@@ -125,5 +125,5 @@ export function getLoadAttempts(): LoadAttempt[] {
125
125
  * @deprecated Use getExtensionLoadingMode() !== 'unavailable' instead
126
126
  */
127
127
  export function hasExtensionSupport(): boolean {
128
- return getExtensionLoadingMode() !== 'unavailable';
128
+ return getExtensionLoadingMode() !== "unavailable";
129
129
  }
@@ -5,7 +5,7 @@
5
5
  * @module src/store/sqlite/types
6
6
  */
7
7
 
8
- import type { Database } from 'bun:sqlite';
8
+ import type { Database } from "bun:sqlite";
9
9
 
10
10
  /**
11
11
  * Type guard interface for accessing raw SQLite DB.
@@ -21,8 +21,8 @@ export interface SqliteDbProvider {
21
21
  export function isSqliteDbProvider(store: unknown): store is SqliteDbProvider {
22
22
  return (
23
23
  store !== null &&
24
- typeof store === 'object' &&
25
- 'getRawDb' in store &&
26
- typeof (store as SqliteDbProvider).getRawDb === 'function'
24
+ typeof store === "object" &&
25
+ "getRawDb" in store &&
26
+ typeof (store as SqliteDbProvider).getRawDb === "function"
27
27
  );
28
28
  }
@@ -5,7 +5,7 @@
5
5
  * @module src/store/types
6
6
  */
7
7
 
8
- import type { Collection, Context, FtsTokenizer } from '../config/types';
8
+ import type { Collection, Context, FtsTokenizer } from "../config/types";
9
9
 
10
10
  // ─────────────────────────────────────────────────────────────────────────────
11
11
  // Error Types
@@ -13,24 +13,24 @@ import type { Collection, Context, FtsTokenizer } from '../config/types';
13
13
 
14
14
  /** Store error codes */
15
15
  export type StoreErrorCode =
16
- | 'NOT_FOUND'
17
- | 'ALREADY_EXISTS'
18
- | 'CONSTRAINT_VIOLATION'
19
- | 'MIGRATION_FAILED'
20
- | 'CONNECTION_FAILED'
21
- | 'EXTENSION_LOAD_FAILED'
22
- | 'QUERY_FAILED'
23
- | 'TRANSACTION_FAILED'
24
- | 'INVALID_INPUT'
25
- | 'IO_ERROR'
26
- | 'INTERNAL'
16
+ | "NOT_FOUND"
17
+ | "ALREADY_EXISTS"
18
+ | "CONSTRAINT_VIOLATION"
19
+ | "MIGRATION_FAILED"
20
+ | "CONNECTION_FAILED"
21
+ | "EXTENSION_LOAD_FAILED"
22
+ | "QUERY_FAILED"
23
+ | "TRANSACTION_FAILED"
24
+ | "INVALID_INPUT"
25
+ | "IO_ERROR"
26
+ | "INTERNAL"
27
27
  // Vector-specific error codes (EPIC 7)
28
- | 'VECTOR_WRITE_FAILED'
29
- | 'VECTOR_DELETE_FAILED'
30
- | 'VEC_SEARCH_UNAVAILABLE'
31
- | 'VEC_SEARCH_FAILED'
32
- | 'VEC_REBUILD_FAILED'
33
- | 'VEC_SYNC_FAILED';
28
+ | "VECTOR_WRITE_FAILED"
29
+ | "VECTOR_DELETE_FAILED"
30
+ | "VEC_SEARCH_UNAVAILABLE"
31
+ | "VEC_SEARCH_FAILED"
32
+ | "VEC_REBUILD_FAILED"
33
+ | "VEC_SYNC_FAILED";
34
34
 
35
35
  /** Store error with structured details */
36
36
  export interface StoreError {
@@ -77,7 +77,7 @@ export interface CollectionRow {
77
77
 
78
78
  /** Context row from DB (mirrors config) */
79
79
  export interface ContextRow {
80
- scopeType: 'global' | 'collection' | 'prefix';
80
+ scopeType: "global" | "collection" | "prefix";
81
81
  scopeKey: string;
82
82
  text: string;
83
83
  syncedAt: string;
@@ -8,6 +8,6 @@ export {
8
8
  createVectorIndexPort,
9
9
  decodeEmbedding,
10
10
  encodeEmbedding,
11
- } from './sqlite-vec';
12
- export { createVectorStatsPort } from './stats';
13
- export * from './types';
11
+ } from "./sqlite-vec";
12
+ export { createVectorStatsPort } from "./stats";
13
+ export * from "./types";
@@ -5,11 +5,14 @@
5
5
  * @module src/store/vector/sqliteVec
6
6
  */
7
7
 
8
- import type { Database } from 'bun:sqlite';
9
- import { createHash } from 'node:crypto';
10
- import type { StoreResult } from '../types';
11
- import { err, ok } from '../types';
12
- import type { VectorIndexPort, VectorRow, VectorSearchResult } from './types';
8
+ import type { Database } from "bun:sqlite";
9
+
10
+ import { createHash } from "node:crypto";
11
+
12
+ import type { StoreResult } from "../types";
13
+ import type { VectorIndexPort, VectorRow, VectorSearchResult } from "./types";
14
+
15
+ import { err, ok } from "../types";
13
16
 
14
17
  // ─────────────────────────────────────────────────────────────────────────────
15
18
  // BLOB Encoding Helpers (avoid Buffer.buffer footgun)
@@ -49,7 +52,7 @@ export function decodeEmbedding(blob: Uint8Array): Float32Array {
49
52
  * First 8 chars of SHA256 hash.
50
53
  */
51
54
  function modelTableName(modelUri: string): string {
52
- const hash = createHash('sha256').update(modelUri).digest('hex').slice(0, 8);
55
+ const hash = createHash("sha256").update(modelUri).digest("hex").slice(0, 8);
53
56
  return `vec_${hash}`;
54
57
  }
55
58
 
@@ -60,7 +63,7 @@ function modelTableName(modelUri: string): string {
60
63
  export interface VectorIndexOptions {
61
64
  model: string;
62
65
  dimensions: number;
63
- distanceMetric?: 'cosine' | 'l2';
66
+ distanceMetric?: "cosine" | "l2";
64
67
  }
65
68
 
66
69
  /**
@@ -71,14 +74,14 @@ export async function createVectorIndexPort(
71
74
  db: Database,
72
75
  options: VectorIndexOptions
73
76
  ): Promise<StoreResult<VectorIndexPort>> {
74
- const { model, dimensions, distanceMetric = 'cosine' } = options;
77
+ const { model, dimensions, distanceMetric = "cosine" } = options;
75
78
  const tableName = modelTableName(model);
76
79
 
77
80
  // Try loading sqlite-vec extension (ESM dynamic import)
78
81
  let searchAvailable = false;
79
82
  let loadError: string | undefined;
80
83
  try {
81
- const sqliteVec = await import('sqlite-vec');
84
+ const sqliteVec = await import("sqlite-vec");
82
85
  sqliteVec.load(db);
83
86
  searchAvailable = true;
84
87
  } catch (e) {
@@ -155,7 +158,7 @@ export async function createVectorIndexPort(
155
158
  } catch (e) {
156
159
  return Promise.resolve(
157
160
  err(
158
- 'VECTOR_WRITE_FAILED',
161
+ "VECTOR_WRITE_FAILED",
159
162
  `Vector write failed: ${e instanceof Error ? e.message : String(e)}`
160
163
  )
161
164
  );
@@ -186,7 +189,7 @@ export async function createVectorIndexPort(
186
189
  } catch (e) {
187
190
  return Promise.resolve(
188
191
  err(
189
- 'VECTOR_DELETE_FAILED',
192
+ "VECTOR_DELETE_FAILED",
190
193
  `Vector delete failed: ${e instanceof Error ? e.message : String(e)}`
191
194
  )
192
195
  );
@@ -212,8 +215,8 @@ export async function createVectorIndexPort(
212
215
  if (!(searchAvailable && searchStmt)) {
213
216
  return Promise.resolve(
214
217
  err(
215
- 'VEC_SEARCH_UNAVAILABLE',
216
- 'Vector search requires sqlite-vec. Embeddings stored but KNN search disabled.'
218
+ "VEC_SEARCH_UNAVAILABLE",
219
+ "Vector search requires sqlite-vec. Embeddings stored but KNN search disabled."
217
220
  )
218
221
  );
219
222
  }
@@ -235,9 +238,9 @@ export async function createVectorIndexPort(
235
238
  return Promise.resolve(
236
239
  ok(
237
240
  filtered.map((r) => {
238
- const parts = r.chunk_id.split(':');
239
- const mirrorHash = parts[0] ?? '';
240
- const seqStr = parts[1] ?? '0';
241
+ const parts = r.chunk_id.split(":");
242
+ const mirrorHash = parts[0] ?? "";
243
+ const seqStr = parts[1] ?? "0";
241
244
  return {
242
245
  mirrorHash,
243
246
  seq: Number.parseInt(seqStr, 10),
@@ -249,7 +252,7 @@ export async function createVectorIndexPort(
249
252
  } catch (e) {
250
253
  return Promise.resolve(
251
254
  err(
252
- 'VEC_SEARCH_FAILED',
255
+ "VEC_SEARCH_FAILED",
253
256
  `Vector search failed: ${e instanceof Error ? e.message : String(e)}`
254
257
  )
255
258
  );
@@ -274,7 +277,7 @@ export async function createVectorIndexPort(
274
277
  // Repopulate from content_vectors
275
278
  const rows = db
276
279
  .prepare(
277
- 'SELECT mirror_hash, seq, embedding FROM content_vectors WHERE model = ?'
280
+ "SELECT mirror_hash, seq, embedding FROM content_vectors WHERE model = ?"
278
281
  )
279
282
  .all(model) as {
280
283
  mirror_hash: string;
@@ -297,7 +300,7 @@ export async function createVectorIndexPort(
297
300
  } catch (e) {
298
301
  return Promise.resolve(
299
302
  err(
300
- 'VEC_REBUILD_FAILED',
303
+ "VEC_REBUILD_FAILED",
301
304
  `Vec rebuild failed: ${e instanceof Error ? e.message : String(e)}`
302
305
  )
303
306
  );
@@ -363,7 +366,7 @@ export async function createVectorIndexPort(
363
366
  } catch (e) {
364
367
  return Promise.resolve(
365
368
  err(
366
- 'VEC_SYNC_FAILED',
369
+ "VEC_SYNC_FAILED",
367
370
  `Vec sync failed: ${e instanceof Error ? e.message : String(e)}`
368
371
  )
369
372
  );
@@ -5,10 +5,12 @@
5
5
  * @module src/store/vector/stats
6
6
  */
7
7
 
8
- import type { Database } from 'bun:sqlite';
9
- import type { StoreResult } from '../types';
10
- import { err, ok } from '../types';
11
- import type { BacklogItem, VectorStatsPort } from './types';
8
+ import type { Database } from "bun:sqlite";
9
+
10
+ import type { StoreResult } from "../types";
11
+ import type { BacklogItem, VectorStatsPort } from "./types";
12
+
13
+ import { err, ok } from "../types";
12
14
 
13
15
  /**
14
16
  * Create a VectorStatsPort for backlog detection and vector stats.
@@ -20,14 +22,14 @@ export function createVectorStatsPort(db: Database): VectorStatsPort {
20
22
  try {
21
23
  const result = db
22
24
  .prepare(
23
- 'SELECT COUNT(*) as count FROM content_vectors WHERE model = ?'
25
+ "SELECT COUNT(*) as count FROM content_vectors WHERE model = ?"
24
26
  )
25
27
  .get(model) as { count: number };
26
28
  return Promise.resolve(ok(result.count));
27
29
  } catch (e) {
28
30
  return Promise.resolve(
29
31
  err(
30
- 'QUERY_FAILED',
32
+ "QUERY_FAILED",
31
33
  `Failed to count vectors: ${e instanceof Error ? e.message : String(e)}`
32
34
  )
33
35
  );
@@ -61,7 +63,7 @@ export function createVectorStatsPort(db: Database): VectorStatsPort {
61
63
  } catch (e) {
62
64
  return Promise.resolve(
63
65
  err(
64
- 'QUERY_FAILED',
66
+ "QUERY_FAILED",
65
67
  `Failed to count backlog: ${e instanceof Error ? e.message : String(e)}`
66
68
  )
67
69
  );
@@ -145,7 +147,7 @@ export function createVectorStatsPort(db: Database): VectorStatsPort {
145
147
  } catch (e) {
146
148
  return Promise.resolve(
147
149
  err(
148
- 'QUERY_FAILED',
150
+ "QUERY_FAILED",
149
151
  `Failed to get backlog: ${e instanceof Error ? e.message : String(e)}`
150
152
  )
151
153
  );
@@ -5,7 +5,7 @@
5
5
  * @module src/store/vector/types
6
6
  */
7
7
 
8
- import type { StoreResult } from '../types';
8
+ import type { StoreResult } from "../types";
9
9
 
10
10
  // ─────────────────────────────────────────────────────────────────────────────
11
11
  // Row Types
@@ -39,7 +39,7 @@ export interface BacklogItem {
39
39
  seq: number;
40
40
  text: string;
41
41
  title: string | null;
42
- reason: 'new' | 'changed' | 'force';
42
+ reason: "new" | "changed" | "force";
43
43
  }
44
44
 
45
45
  // ─────────────────────────────────────────────────────────────────────────────
@@ -4,12 +4,12 @@ Prebuilt [fts5-snowball](https://github.com/abiliojr/fts5-snowball) SQLite exten
4
4
 
5
5
  ## Supported Platforms
6
6
 
7
- | Platform | File | Architecture |
8
- |----------|------|--------------|
9
- | Linux | `linux-x64/fts5stemmer.so` | x86_64 |
10
- | macOS | `darwin-arm64/fts5stemmer.dylib` | ARM64 (Apple Silicon) |
11
- | macOS | `darwin-x64/fts5stemmer.dylib` | x86_64 (Intel) |
12
- | Windows | `windows-x64/fts5stemmer.dll` | x86_64 |
7
+ | Platform | File | Architecture |
8
+ | -------- | -------------------------------- | --------------------- |
9
+ | Linux | `linux-x64/fts5stemmer.so` | x86_64 |
10
+ | macOS | `darwin-arm64/fts5stemmer.dylib` | ARM64 (Apple Silicon) |
11
+ | macOS | `darwin-x64/fts5stemmer.dylib` | x86_64 (Intel) |
12
+ | Windows | `windows-x64/fts5stemmer.dll` | x86_64 |
13
13
 
14
14
  ## Build Provenance
15
15
 
Binary file