mixgram 1.3.7 → 2.0.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 (39) hide show
  1. package/README.md +68 -345
  2. package/bin/mixgram.js +51 -160
  3. package/examples/embedding-demo.js +22 -142
  4. package/package.json +2 -3
  5. package/pnpm-workspace.yaml +2 -2
  6. package/spec/bench-indexing.js +23 -211
  7. package/spec/bench-search.js +26 -212
  8. package/spec/run-tests.js +1 -214
  9. package/spec/scenarios/scenarios.js +277 -607
  10. package/spec/sdd.md +14 -988
  11. package/spec/tdd.md +15 -1232
  12. package/spec/test-large-document.js +20 -91
  13. package/src/config.js +57 -48
  14. package/src/core/documents/documents.js +62 -224
  15. package/src/core/embeddings/embedder.js +14 -54
  16. package/src/core/embeddings/queue.js +33 -106
  17. package/src/core/embeddings/vectorStore.js +30 -111
  18. package/src/core/embeddings/worker-process.js +23 -74
  19. package/src/core/indexing/indexer.js +51 -237
  20. package/src/core/indexing/parser.js +13 -114
  21. package/src/core/indexing/reindex.js +28 -137
  22. package/src/core/search/search.js +64 -158
  23. package/src/db/migrations/001_initial.sql +14 -63
  24. package/src/db/sqlite.js +19 -29
  25. package/src/fs/paths.js +11 -101
  26. package/src/fs/watcher.js +15 -48
  27. package/src/mcp/cli-adapter.js +32 -110
  28. package/src/mcp/server.js +64 -141
  29. package/src/mcp/tool-registry.js +21 -132
  30. package/src/mcp/tools.js +27 -199
  31. package/src/utils/markdown.js +15 -82
  32. package/patches/sharp@0.34.5.patch +0 -13
  33. package/spec/fixtures/realistic-content.js +0 -106
  34. package/spec/reporter.js +0 -127
  35. package/spec/run-tests-runner.js +0 -40
  36. package/src/core/embeddings/worker.js +0 -27
  37. package/src/core/prompts/prompts.js +0 -15
  38. package/src/core/sessions/sessions.js +0 -27
  39. package/src/utils/ids.js +0 -27
@@ -1,27 +0,0 @@
1
- import { getDb } from '../../db/sqlite.js';
2
- import { sessionId } from '../../utils/ids.js';
3
-
4
- function startSession(config, options = {}) {
5
- const id = options.id || sessionId();
6
- const { project, directory } = options;
7
- const db = getDb(config);
8
- const now = new Date().toISOString();
9
- db.prepare(
10
- 'INSERT INTO sessions (id, project, directory, started_at) VALUES (?, ?, ?, ?)'
11
- ).run(id, project || '', directory ?? null, now);
12
- return { id, started_at: now };
13
- }
14
-
15
- function endSession(config, sessionIdParam) {
16
- const db = getDb(config);
17
- const now = new Date().toISOString();
18
- const r = db.prepare('UPDATE sessions SET ended_at = ? WHERE id = ?').run(now, sessionIdParam);
19
- return { success: r.changes > 0, ended_at: now };
20
- }
21
-
22
- function getSession(config, sessionIdParam) {
23
- const db = getDb(config);
24
- return db.prepare('SELECT * FROM sessions WHERE id = ?').get(sessionIdParam) ?? null;
25
- }
26
-
27
- export { startSession, endSession, getSession };
package/src/utils/ids.js DELETED
@@ -1,27 +0,0 @@
1
- import crypto from 'crypto';
2
-
3
- const ALPHANUM = '0123456789abcdefghijklmnopqrstuvwxyz';
4
-
5
- export function generateId() {
6
- const bytes = crypto.randomBytes(10);
7
- let s = '';
8
- for (let i = 0; i < 10; i++) s += ALPHANUM[bytes[i] % 36];
9
- return s;
10
- }
11
-
12
- export function observationId() {
13
- return generateId();
14
- }
15
-
16
- export function sessionId() {
17
- return generateId();
18
- }
19
-
20
- export function chunkId(documentId, index) {
21
- return `${documentId}_${index}`;
22
- }
23
-
24
- export function promptId() {
25
- return generateId();
26
- }
27
-