lynkr 8.0.0 → 8.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 (102) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/src/api/openai-router.js +34 -2
  4. package/src/clients/standard-tools.js +23 -0
  5. package/src/config/index.js +20 -0
  6. package/src/orchestrator/index.js +2 -2
  7. package/src/server.js +2 -12
  8. package/src/tools/index.js +4 -0
  9. package/src/tools/lazy-loader.js +7 -0
  10. package/src/tools/tinyfish.js +358 -0
  11. package/src/tools/truncate.js +1 -0
  12. package/.github/FUNDING.yml +0 -15
  13. package/.github/workflows/README.md +0 -215
  14. package/.github/workflows/ci.yml +0 -69
  15. package/.github/workflows/index.yml +0 -62
  16. package/.github/workflows/web-tools-tests.yml +0 -56
  17. package/CITATIONS.bib +0 -6
  18. package/DEPLOYMENT.md +0 -1001
  19. package/LYNKR-TUI-PLAN.md +0 -984
  20. package/PERFORMANCE-REPORT.md +0 -866
  21. package/PLAN-per-client-model-routing.md +0 -252
  22. package/docs/42642f749da6234f41b6b425c3bb07c9.txt +0 -1
  23. package/docs/BingSiteAuth.xml +0 -4
  24. package/docs/docs-style.css +0 -478
  25. package/docs/docs.html +0 -198
  26. package/docs/google5be250e608e6da39.html +0 -1
  27. package/docs/index.html +0 -577
  28. package/docs/index.md +0 -584
  29. package/docs/robots.txt +0 -4
  30. package/docs/sitemap.xml +0 -44
  31. package/docs/style.css +0 -1223
  32. package/docs/toon-integration-spec.md +0 -130
  33. package/documentation/README.md +0 -101
  34. package/documentation/api.md +0 -806
  35. package/documentation/claude-code-cli.md +0 -679
  36. package/documentation/codex-cli.md +0 -397
  37. package/documentation/contributing.md +0 -571
  38. package/documentation/cursor-integration.md +0 -734
  39. package/documentation/docker.md +0 -874
  40. package/documentation/embeddings.md +0 -762
  41. package/documentation/faq.md +0 -713
  42. package/documentation/features.md +0 -403
  43. package/documentation/headroom.md +0 -519
  44. package/documentation/installation.md +0 -758
  45. package/documentation/memory-system.md +0 -476
  46. package/documentation/production.md +0 -636
  47. package/documentation/providers.md +0 -1009
  48. package/documentation/routing.md +0 -476
  49. package/documentation/testing.md +0 -629
  50. package/documentation/token-optimization.md +0 -325
  51. package/documentation/tools.md +0 -697
  52. package/documentation/troubleshooting.md +0 -969
  53. package/final-test.js +0 -33
  54. package/headroom-sidecar/config.py +0 -93
  55. package/headroom-sidecar/requirements.txt +0 -14
  56. package/headroom-sidecar/server.py +0 -451
  57. package/monitor-agents.sh +0 -31
  58. package/scripts/audit-log-reader.js +0 -399
  59. package/scripts/compact-dictionary.js +0 -204
  60. package/scripts/test-deduplication.js +0 -448
  61. package/src/db/database.sqlite +0 -0
  62. package/te +0 -11622
  63. package/test/README.md +0 -212
  64. package/test/azure-openai-config.test.js +0 -213
  65. package/test/azure-openai-error-resilience.test.js +0 -238
  66. package/test/azure-openai-format-conversion.test.js +0 -354
  67. package/test/azure-openai-integration.test.js +0 -287
  68. package/test/azure-openai-routing.test.js +0 -175
  69. package/test/azure-openai-streaming.test.js +0 -171
  70. package/test/bedrock-integration.test.js +0 -457
  71. package/test/comprehensive-test-suite.js +0 -928
  72. package/test/config-validation.test.js +0 -207
  73. package/test/cursor-integration.test.js +0 -484
  74. package/test/format-conversion.test.js +0 -578
  75. package/test/hybrid-routing-integration.test.js +0 -269
  76. package/test/hybrid-routing-performance.test.js +0 -428
  77. package/test/llamacpp-integration.test.js +0 -882
  78. package/test/lmstudio-integration.test.js +0 -347
  79. package/test/memory/extractor.test.js +0 -398
  80. package/test/memory/retriever.test.js +0 -613
  81. package/test/memory/retriever.test.js.bak +0 -585
  82. package/test/memory/search.test.js +0 -537
  83. package/test/memory/search.test.js.bak +0 -389
  84. package/test/memory/store.test.js +0 -344
  85. package/test/memory/store.test.js.bak +0 -312
  86. package/test/memory/surprise.test.js +0 -300
  87. package/test/memory-performance.test.js +0 -472
  88. package/test/openai-integration.test.js +0 -683
  89. package/test/openrouter-error-resilience.test.js +0 -418
  90. package/test/passthrough-mode.test.js +0 -385
  91. package/test/performance-benchmark.js +0 -351
  92. package/test/performance-tests.js +0 -528
  93. package/test/routing.test.js +0 -225
  94. package/test/toon-compression.test.js +0 -131
  95. package/test/web-tools.test.js +0 -329
  96. package/test-agents-simple.js +0 -43
  97. package/test-cli-connection.sh +0 -33
  98. package/test-learning-unit.js +0 -126
  99. package/test-learning.js +0 -112
  100. package/test-parallel-agents.sh +0 -124
  101. package/test-parallel-direct.js +0 -155
  102. package/test-subagents.sh +0 -117
@@ -1,389 +0,0 @@
1
- const assert = require("assert");
2
- const { describe, it, beforeEach, afterEach } = require("node:test");
3
- const fs = require("fs");
4
- const path = require("path");
5
-
6
- describe("Memory Search", () => {
7
- let store;
8
- let search;
9
- let testDbPath;
10
-
11
- beforeEach(() => {
12
- // Create a temporary test database
13
- testDbPath = path.join(__dirname, `../../data/test-memory-${Date.now()}.db`);
14
-
15
- // Clear module cache
16
- delete require.cache[require.resolve("../../src/db")];
17
- delete require.cache[require.resolve("../../src/memory/store")];
18
- delete require.cache[require.resolve("../../src/memory/search")];
19
-
20
- // Set test environment
21
- process.env.DB_PATH = testDbPath;
22
-
23
- // Initialize database with schema
24
- require("../../src/db");
25
-
26
- // Load modules
27
- store = require("../../src/memory/store");
28
- search = require("../../src/memory/search");
29
-
30
- // Create test memories
31
- store.createMemory({
32
- content: "User prefers Python for data processing and machine learning tasks",
33
- type: "preference",
34
- category: "user",
35
- importance: 0.8
36
- });
37
-
38
- store.createMemory({
39
- content: "This project uses Express.js framework with TypeScript",
40
- type: "fact",
41
- category: "project",
42
- importance: 0.7
43
- });
44
-
45
- store.createMemory({
46
- content: "Decided to implement authentication using JWT tokens",
47
- type: "decision",
48
- category: "code",
49
- importance: 0.9
50
- });
51
-
52
- store.createMemory({
53
- content: "Database uses SQLite with better-sqlite3 driver",
54
- type: "fact",
55
- category: "project",
56
- importance: 0.6
57
- });
58
-
59
- store.createMemory({
60
- content: "UserController class handles user authentication and profile management",
61
- type: "entity",
62
- category: "code",
63
- importance: 0.5
64
- });
65
- });
66
-
67
- afterEach(() => {
68
- // Clean up test database
69
- try {
70
- if (fs.existsSync(testDbPath)) {
71
- fs.unlinkSync(testDbPath);
72
- }
73
- } catch (err) {
74
- // Ignore cleanup errors
75
- }
76
- });
77
-
78
- describe("searchMemories()", () => {
79
- it("should find memories by keyword", () => {
80
- const results = search.searchMemories({ query: "Python" });
81
- assert.ok(results.length > 0, "Should find Python memory");
82
- assert.ok(results[0].content.toLowerCase().includes("python"));
83
- });
84
-
85
- it("should find memories with partial matches", () => {
86
- const results = search.searchMemories({ query: "express" });
87
- assert.ok(results.length > 0, "Should find Express memory");
88
- assert.ok(results.some(m => m.content.toLowerCase().includes("express")));
89
- });
90
-
91
- it("should support FTS5 phrase search", () => {
92
- const results = search.searchMemories({ query: "machine learning" });
93
- assert.ok(results.length > 0, "Should find 'machine learning' phrase");
94
- });
95
-
96
- it("should filter by memory type", () => {
97
- const results = search.searchMemories({
98
- query: "project",
99
- types: ["fact"]
100
- });
101
- assert.ok(results.length > 0);
102
- assert.ok(results.every(m => m.type === "fact"), "All results should be facts");
103
- });
104
-
105
- it("should filter by category", () => {
106
- const results = search.searchMemories({
107
- query: "project",
108
- categories: ["project"]
109
- });
110
- assert.ok(results.length > 0);
111
- assert.ok(results.every(m => m.category === "project"));
112
- });
113
-
114
- it("should filter by session id", () => {
115
- // Create session-specific memory
116
- store.createMemory({
117
- content: "Session-specific memory about testing",
118
- type: "fact",
119
- sessionId: "test-session-123"
120
- });
121
-
122
- const results = search.searchMemories({
123
- query: "testing",
124
- sessionId: "test-session-123"
125
- });
126
-
127
- assert.ok(results.length > 0);
128
- assert.ok(results.every(m => m.sessionId === "test-session-123" || m.sessionId === null));
129
- });
130
-
131
- it("should filter by minimum importance", () => {
132
- const results = search.searchMemories({
133
- query: "project",
134
- minImportance: 0.7
135
- });
136
-
137
- assert.ok(results.length > 0);
138
- assert.ok(results.every(m => m.importance >= 0.7));
139
- });
140
-
141
- it("should respect limit parameter", () => {
142
- const results = search.searchMemories({ query: "project", limit: 2 });
143
- assert.ok(results.length <= 2);
144
- });
145
-
146
- it("should return empty array for no matches", () => {
147
- const results = search.searchMemories({ query: "nonexistent-keyword-xyz" });
148
- assert.strictEqual(results.length, 0);
149
- });
150
-
151
- it("should handle special characters in query", () => {
152
- store.createMemory({
153
- content: "Uses @nestjs/core package version ^9.0.0",
154
- type: "fact",
155
- category: "project"
156
- });
157
-
158
- const results = search.searchMemories({ query: "nestjs" });
159
- assert.ok(results.length > 0);
160
- });
161
-
162
- it("should be case-insensitive", () => {
163
- const lower = search.searchMemories({ query: "python" });
164
- const upper = search.searchMemories({ query: "PYTHON" });
165
- const mixed = search.searchMemories({ query: "PyThOn" });
166
-
167
- assert.ok(lower.length > 0);
168
- assert.strictEqual(lower.length, upper.length);
169
- assert.strictEqual(lower.length, mixed.length);
170
- });
171
- });
172
-
173
- describe("searchWithExpansion()", () => {
174
- it("should expand query and find more results", () => {
175
- const basicResults = search.searchMemories({ query: "database" });
176
- const expandedResults = search.searchWithExpansion({ query: "database" });
177
-
178
- // Expanded search should find at least as many as basic
179
- assert.ok(expandedResults.length >= basicResults.length);
180
- });
181
-
182
- it("should find results with related terms", () => {
183
- // Should find both "Express.js" and "authentication" memories
184
- const results = search.searchWithExpansion({ query: "authentication" });
185
- assert.ok(results.length > 0);
186
- });
187
-
188
- it("should handle multi-word queries", () => {
189
- const results = search.searchWithExpansion({ query: "user authentication system" });
190
- assert.ok(results.length >= 0); // Should not error
191
- });
192
- });
193
-
194
- describe("extractKeywords()", () => {
195
- it("should extract meaningful keywords", () => {
196
- const keywords = search.extractKeywords("User prefers Python for data processing");
197
- assert.ok(keywords.length > 0);
198
- assert.ok(keywords.includes("python") || keywords.includes("data"));
199
- });
200
-
201
- it("should filter out stop words", () => {
202
- const keywords = search.extractKeywords("The user is using the database");
203
- // Should not include common stop words like "the", "is", "using"
204
- assert.ok(!keywords.includes("the"));
205
- assert.ok(!keywords.includes("is"));
206
- });
207
-
208
- it("should handle empty text", () => {
209
- const keywords = search.extractKeywords("");
210
- assert.ok(Array.isArray(keywords));
211
- assert.strictEqual(keywords.length, 0);
212
- });
213
-
214
- it("should extract from technical content", () => {
215
- const keywords = search.extractKeywords("Using Express.js with TypeScript and JWT authentication");
216
- assert.ok(keywords.length > 0);
217
- assert.ok(keywords.some(k => k.includes("express") || k.includes("typescript") || k.includes("jwt")));
218
- });
219
- });
220
-
221
- describe("findSimilar()", () => {
222
- it("should find memories similar to reference", () => {
223
- const reference = store.createMemory({
224
- content: "User likes JavaScript frameworks like React and Vue",
225
- type: "preference"
226
- });
227
-
228
- const similar = search.findSimilar(reference.id, { limit: 3 });
229
- assert.ok(similar.length >= 0);
230
- // Should not include the reference memory itself
231
- assert.ok(!similar.some(m => m.id === reference.id));
232
- });
233
-
234
- it("should return empty for no similar memories", () => {
235
- const unique = store.createMemory({
236
- content: "Quantum computing with superconducting qubits",
237
- type: "fact"
238
- });
239
-
240
- const similar = search.findSimilar(unique.id, { limit: 5 });
241
- assert.ok(similar.length >= 0);
242
- });
243
-
244
- it("should throw error for non-existent memory id", () => {
245
- assert.throws(() => {
246
- search.findSimilar(99999);
247
- });
248
- });
249
- });
250
-
251
- describe("searchByContent()", () => {
252
- it("should search by content similarity", () => {
253
- const results = search.searchByContent("Python programming language");
254
- assert.ok(results.length > 0);
255
- assert.ok(results.some(m => m.content.toLowerCase().includes("python")));
256
- });
257
-
258
- it("should handle empty content", () => {
259
- const results = search.searchByContent("");
260
- assert.strictEqual(results.length, 0);
261
- });
262
-
263
- it("should filter by type and category", () => {
264
- const results = search.searchByContent("project", {
265
- types: ["fact"],
266
- categories: ["project"]
267
- });
268
-
269
- assert.ok(results.every(m => m.type === "fact" && m.category === "project"));
270
- });
271
- });
272
-
273
- describe("countSearchResults()", () => {
274
- it("should count matching memories", () => {
275
- const count = search.countSearchResults({ query: "project" });
276
- assert.ok(count > 0);
277
- assert.strictEqual(typeof count, "number");
278
- });
279
-
280
- it("should return 0 for no matches", () => {
281
- const count = search.countSearchResults({ query: "nonexistent-xyz" });
282
- assert.strictEqual(count, 0);
283
- });
284
-
285
- it("should respect filters", () => {
286
- const totalCount = search.countSearchResults({ query: "project" });
287
- const factCount = search.countSearchResults({ query: "project", types: ["fact"] });
288
-
289
- assert.ok(factCount <= totalCount);
290
- });
291
- });
292
-
293
- describe("FTS5 Query Preparation", () => {
294
- it("should handle AND operator", () => {
295
- const results = search.searchMemories({ query: "Python AND machine" });
296
- if (results.length > 0) {
297
- assert.ok(results[0].content.toLowerCase().includes("python"));
298
- assert.ok(results[0].content.toLowerCase().includes("machine"));
299
- }
300
- });
301
-
302
- it("should handle OR operator", () => {
303
- const results = search.searchMemories({ query: "Python OR JavaScript" });
304
- assert.ok(results.length > 0);
305
- });
306
-
307
- it("should handle complex queries", () => {
308
- // Should not throw error with complex FTS5 syntax
309
- assert.doesNotThrow(() => {
310
- search.searchMemories({ query: "(Python OR JavaScript) AND framework" });
311
- });
312
- });
313
-
314
- it("should escape special FTS5 characters", () => {
315
- // Characters like quotes, parens can break FTS5
316
- assert.doesNotThrow(() => {
317
- search.searchMemories({ query: 'test "quoted" (parens)' });
318
- });
319
- });
320
- });
321
-
322
- describe("Performance", () => {
323
- it("should handle searches with many results efficiently", () => {
324
- // Create many memories
325
- for (let i = 0; i < 100; i++) {
326
- store.createMemory({
327
- content: `Test memory number ${i} about Python and JavaScript`,
328
- type: "fact",
329
- importance: Math.random()
330
- });
331
- }
332
-
333
- const start = Date.now();
334
- const results = search.searchMemories({ query: "Python", limit: 10 });
335
- const duration = Date.now() - start;
336
-
337
- assert.ok(results.length > 0);
338
- assert.ok(duration < 100, `Search took ${duration}ms, expected < 100ms`);
339
- });
340
-
341
- it("should handle multiple concurrent searches", () => {
342
- const searches = [
343
- search.searchMemories({ query: "Python" }),
344
- search.searchMemories({ query: "Express" }),
345
- search.searchMemories({ query: "database" }),
346
- search.searchMemories({ query: "authentication" })
347
- ];
348
-
349
- // All should complete without errors
350
- searches.forEach(results => {
351
- assert.ok(Array.isArray(results));
352
- });
353
- });
354
- });
355
-
356
- describe("Edge Cases", () => {
357
- it("should handle very long queries", () => {
358
- const longQuery = "Python ".repeat(100);
359
- assert.doesNotThrow(() => {
360
- search.searchMemories({ query: longQuery });
361
- });
362
- });
363
-
364
- it("should handle queries with only stop words", () => {
365
- const results = search.searchMemories({ query: "the a an is are" });
366
- assert.ok(Array.isArray(results));
367
- });
368
-
369
- it("should handle numeric queries", () => {
370
- store.createMemory({
371
- content: "Server runs on port 3000",
372
- type: "fact"
373
- });
374
-
375
- const results = search.searchMemories({ query: "3000" });
376
- assert.ok(results.length > 0);
377
- });
378
-
379
- it("should handle emoji and unicode", () => {
380
- store.createMemory({
381
- content: "User's favorite emoji is 🚀 for deployment",
382
- type: "preference"
383
- });
384
-
385
- const results = search.searchMemories({ query: "emoji" });
386
- assert.ok(results.length > 0);
387
- });
388
- });
389
- });