lynkr 8.0.0 → 9.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 (128) hide show
  1. package/.lynkr/telemetry.db +0 -0
  2. package/.lynkr/telemetry.db-shm +0 -0
  3. package/.lynkr/telemetry.db-wal +0 -0
  4. package/README.md +196 -322
  5. package/lynkr-skill.tar.gz +0 -0
  6. package/package.json +4 -3
  7. package/src/api/openai-router.js +64 -13
  8. package/src/api/providers-handler.js +171 -3
  9. package/src/api/router.js +9 -2
  10. package/src/clients/circuit-breaker.js +10 -247
  11. package/src/clients/codex-process.js +342 -0
  12. package/src/clients/codex-utils.js +143 -0
  13. package/src/clients/databricks.js +210 -63
  14. package/src/clients/resilience.js +540 -0
  15. package/src/clients/retry.js +22 -167
  16. package/src/clients/standard-tools.js +23 -0
  17. package/src/config/index.js +77 -0
  18. package/src/context/compression.js +42 -9
  19. package/src/context/distill.js +492 -0
  20. package/src/orchestrator/index.js +48 -8
  21. package/src/routing/complexity-analyzer.js +258 -5
  22. package/src/routing/index.js +12 -2
  23. package/src/routing/latency-tracker.js +148 -0
  24. package/src/routing/model-tiers.js +2 -0
  25. package/src/routing/quality-scorer.js +113 -0
  26. package/src/routing/telemetry.js +464 -0
  27. package/src/server.js +13 -12
  28. package/src/tools/code-graph.js +538 -0
  29. package/src/tools/code-mode.js +304 -0
  30. package/src/tools/index.js +4 -0
  31. package/src/tools/lazy-loader.js +18 -0
  32. package/src/tools/mcp-remote.js +7 -0
  33. package/src/tools/smart-selection.js +11 -0
  34. package/src/tools/tinyfish.js +358 -0
  35. package/src/tools/truncate.js +1 -0
  36. package/src/utils/payload.js +206 -0
  37. package/src/utils/perf-timer.js +80 -0
  38. package/.github/FUNDING.yml +0 -15
  39. package/.github/workflows/README.md +0 -215
  40. package/.github/workflows/ci.yml +0 -69
  41. package/.github/workflows/index.yml +0 -62
  42. package/.github/workflows/web-tools-tests.yml +0 -56
  43. package/CITATIONS.bib +0 -6
  44. package/DEPLOYMENT.md +0 -1001
  45. package/LYNKR-TUI-PLAN.md +0 -984
  46. package/PERFORMANCE-REPORT.md +0 -866
  47. package/PLAN-per-client-model-routing.md +0 -252
  48. package/docs/42642f749da6234f41b6b425c3bb07c9.txt +0 -1
  49. package/docs/BingSiteAuth.xml +0 -4
  50. package/docs/docs-style.css +0 -478
  51. package/docs/docs.html +0 -198
  52. package/docs/google5be250e608e6da39.html +0 -1
  53. package/docs/index.html +0 -577
  54. package/docs/index.md +0 -584
  55. package/docs/robots.txt +0 -4
  56. package/docs/sitemap.xml +0 -44
  57. package/docs/style.css +0 -1223
  58. package/docs/toon-integration-spec.md +0 -130
  59. package/documentation/README.md +0 -101
  60. package/documentation/api.md +0 -806
  61. package/documentation/claude-code-cli.md +0 -679
  62. package/documentation/codex-cli.md +0 -397
  63. package/documentation/contributing.md +0 -571
  64. package/documentation/cursor-integration.md +0 -734
  65. package/documentation/docker.md +0 -874
  66. package/documentation/embeddings.md +0 -762
  67. package/documentation/faq.md +0 -713
  68. package/documentation/features.md +0 -403
  69. package/documentation/headroom.md +0 -519
  70. package/documentation/installation.md +0 -758
  71. package/documentation/memory-system.md +0 -476
  72. package/documentation/production.md +0 -636
  73. package/documentation/providers.md +0 -1009
  74. package/documentation/routing.md +0 -476
  75. package/documentation/testing.md +0 -629
  76. package/documentation/token-optimization.md +0 -325
  77. package/documentation/tools.md +0 -697
  78. package/documentation/troubleshooting.md +0 -969
  79. package/final-test.js +0 -33
  80. package/headroom-sidecar/config.py +0 -93
  81. package/headroom-sidecar/requirements.txt +0 -14
  82. package/headroom-sidecar/server.py +0 -451
  83. package/monitor-agents.sh +0 -31
  84. package/scripts/audit-log-reader.js +0 -399
  85. package/scripts/compact-dictionary.js +0 -204
  86. package/scripts/test-deduplication.js +0 -448
  87. package/src/db/database.sqlite +0 -0
  88. package/te +0 -11622
  89. package/test/README.md +0 -212
  90. package/test/azure-openai-config.test.js +0 -213
  91. package/test/azure-openai-error-resilience.test.js +0 -238
  92. package/test/azure-openai-format-conversion.test.js +0 -354
  93. package/test/azure-openai-integration.test.js +0 -287
  94. package/test/azure-openai-routing.test.js +0 -175
  95. package/test/azure-openai-streaming.test.js +0 -171
  96. package/test/bedrock-integration.test.js +0 -457
  97. package/test/comprehensive-test-suite.js +0 -928
  98. package/test/config-validation.test.js +0 -207
  99. package/test/cursor-integration.test.js +0 -484
  100. package/test/format-conversion.test.js +0 -578
  101. package/test/hybrid-routing-integration.test.js +0 -269
  102. package/test/hybrid-routing-performance.test.js +0 -428
  103. package/test/llamacpp-integration.test.js +0 -882
  104. package/test/lmstudio-integration.test.js +0 -347
  105. package/test/memory/extractor.test.js +0 -398
  106. package/test/memory/retriever.test.js +0 -613
  107. package/test/memory/retriever.test.js.bak +0 -585
  108. package/test/memory/search.test.js +0 -537
  109. package/test/memory/search.test.js.bak +0 -389
  110. package/test/memory/store.test.js +0 -344
  111. package/test/memory/store.test.js.bak +0 -312
  112. package/test/memory/surprise.test.js +0 -300
  113. package/test/memory-performance.test.js +0 -472
  114. package/test/openai-integration.test.js +0 -683
  115. package/test/openrouter-error-resilience.test.js +0 -418
  116. package/test/passthrough-mode.test.js +0 -385
  117. package/test/performance-benchmark.js +0 -351
  118. package/test/performance-tests.js +0 -528
  119. package/test/routing.test.js +0 -225
  120. package/test/toon-compression.test.js +0 -131
  121. package/test/web-tools.test.js +0 -329
  122. package/test-agents-simple.js +0 -43
  123. package/test-cli-connection.sh +0 -33
  124. package/test-learning-unit.js +0 -126
  125. package/test-learning.js +0 -112
  126. package/test-parallel-agents.sh +0 -124
  127. package/test-parallel-direct.js +0 -155
  128. package/test-subagents.sh +0 -117
@@ -1,578 +0,0 @@
1
- const assert = require("assert");
2
- const { describe, it, beforeEach, afterEach } = require("node:test");
3
-
4
- describe("Enhanced Format Conversion", () => {
5
- let openrouterUtils;
6
-
7
- beforeEach(() => {
8
- // Set MODEL_PROVIDER to avoid validation errors
9
- process.env.MODEL_PROVIDER = "databricks";
10
- process.env.DATABRICKS_API_KEY = "test-key";
11
- process.env.DATABRICKS_API_BASE = "http://test.com";
12
-
13
- // Clear module cache
14
- delete require.cache[require.resolve("../src/clients/openrouter-utils")];
15
- delete require.cache[require.resolve("../src/config")];
16
- openrouterUtils = require("../src/clients/openrouter-utils");
17
- });
18
-
19
- describe("Anthropic to OpenRouter Conversion", () => {
20
- describe("Message Conversion", () => {
21
- it("should convert simple text messages", () => {
22
- const anthropicMessages = [
23
- {
24
- role: "user",
25
- content: "Hello, how are you?"
26
- }
27
- ];
28
-
29
- const result = openrouterUtils.convertAnthropicMessagesToOpenRouter(anthropicMessages);
30
-
31
- assert.strictEqual(result.length, 1);
32
- assert.strictEqual(result[0].role, "user");
33
- assert.strictEqual(result[0].content, "Hello, how are you?");
34
- });
35
-
36
- it("should convert messages with content blocks", () => {
37
- const anthropicMessages = [
38
- {
39
- role: "user",
40
- content: [
41
- { type: "text", text: "Please read this file" }
42
- ]
43
- }
44
- ];
45
-
46
- const result = openrouterUtils.convertAnthropicMessagesToOpenRouter(anthropicMessages);
47
-
48
- assert.strictEqual(result.length, 1);
49
- assert.strictEqual(result[0].role, "user");
50
- assert.strictEqual(result[0].content, "Please read this file");
51
- });
52
-
53
- it("should handle multiple text blocks", () => {
54
- const anthropicMessages = [
55
- {
56
- role: "user",
57
- content: [
58
- { type: "text", text: "First part" },
59
- { type: "text", text: "Second part" }
60
- ]
61
- }
62
- ];
63
-
64
- const result = openrouterUtils.convertAnthropicMessagesToOpenRouter(anthropicMessages);
65
-
66
- assert.strictEqual(result.length, 1);
67
- assert.strictEqual(result[0].content, "First part\nSecond part");
68
- });
69
-
70
- it("should convert assistant messages with tool_use blocks", () => {
71
- const anthropicMessages = [
72
- {
73
- role: "assistant",
74
- content: [
75
- { type: "text", text: "I'll read that file" },
76
- {
77
- type: "tool_use",
78
- id: "toolu_123",
79
- name: "Read",
80
- input: { file_path: "/tmp/test.txt" }
81
- }
82
- ]
83
- }
84
- ];
85
-
86
- const result = openrouterUtils.convertAnthropicMessagesToOpenRouter(anthropicMessages);
87
-
88
- assert.strictEqual(result.length, 1);
89
- assert.strictEqual(result[0].role, "assistant");
90
- assert.strictEqual(result[0].content, "I'll read that file");
91
- assert.strictEqual(Array.isArray(result[0].tool_calls), true);
92
- assert.strictEqual(result[0].tool_calls.length, 1);
93
- assert.strictEqual(result[0].tool_calls[0].id, "toolu_123");
94
- assert.strictEqual(result[0].tool_calls[0].function.name, "Read");
95
- });
96
-
97
- it("should convert tool_result blocks to tool messages", () => {
98
- // Must include the assistant message with tool_use first
99
- // otherwise tool_result is orphaned and gets removed
100
- const anthropicMessages = [
101
- {
102
- role: "assistant",
103
- content: [
104
- {
105
- type: "tool_use",
106
- id: "toolu_123",
107
- name: "Read",
108
- input: { file_path: "/tmp/test.txt" }
109
- }
110
- ]
111
- },
112
- {
113
- role: "user",
114
- content: [
115
- {
116
- type: "tool_result",
117
- tool_use_id: "toolu_123",
118
- content: "File content here"
119
- }
120
- ]
121
- }
122
- ];
123
-
124
- const result = openrouterUtils.convertAnthropicMessagesToOpenRouter(anthropicMessages);
125
-
126
- // Tool results should be converted to tool role messages
127
- const toolMessage = result.find(m => m.role === "tool");
128
- assert.ok(toolMessage, "Tool message should be present");
129
- assert.strictEqual(toolMessage.tool_call_id, "toolu_123");
130
- assert.strictEqual(toolMessage.content, "File content here");
131
- });
132
-
133
- it("should handle text content separate from tool_result", () => {
134
- // Note: OpenRouter validation requires tool messages to immediately follow
135
- // the assistant message with tool_calls. A user message in between will
136
- // cause the tool message to be filtered as orphaned.
137
- const anthropicMessages = [
138
- {
139
- role: "assistant",
140
- content: [
141
- {
142
- type: "tool_use",
143
- id: "toolu_123",
144
- name: "Write",
145
- input: { file_path: "/tmp/test.txt", content: "data" }
146
- }
147
- ]
148
- },
149
- {
150
- role: "user",
151
- content: [
152
- {
153
- type: "tool_result",
154
- tool_use_id: "toolu_123",
155
- content: "Success"
156
- }
157
- ]
158
- },
159
- {
160
- role: "user",
161
- content: "Here's additional feedback"
162
- }
163
- ];
164
-
165
- const result = openrouterUtils.convertAnthropicMessagesToOpenRouter(anthropicMessages);
166
-
167
- // Should have assistant with tool_calls, tool message, and user message
168
- const assistantMsg = result.find(m => m.role === "assistant");
169
- const toolMsg = result.find(m => m.role === "tool");
170
- const userMsg = result.find(m => m.role === "user" && m.content === "Here's additional feedback");
171
-
172
- assert.ok(assistantMsg, "Assistant message should be present");
173
- assert.ok(toolMsg, "Tool message should be present");
174
- assert.ok(userMsg, "User message should be present");
175
- assert.strictEqual(toolMsg.content, "Success");
176
- });
177
- });
178
-
179
- describe("Tool Conversion", () => {
180
- it("should convert Anthropic tools to OpenRouter format", () => {
181
- const anthropicTools = [
182
- {
183
- name: "Write",
184
- description: "Write a file to the filesystem",
185
- input_schema: {
186
- type: "object",
187
- properties: {
188
- file_path: { type: "string", description: "Path to file" },
189
- content: { type: "string", description: "File content" }
190
- },
191
- required: ["file_path", "content"]
192
- }
193
- }
194
- ];
195
-
196
- const result = openrouterUtils.convertAnthropicToolsToOpenRouter(anthropicTools);
197
-
198
- assert.strictEqual(result.length, 1);
199
- assert.strictEqual(result[0].type, "function");
200
- assert.strictEqual(result[0].function.name, "Write");
201
- assert.strictEqual(result[0].function.description, "Write a file to the filesystem");
202
- assert.deepStrictEqual(result[0].function.parameters, anthropicTools[0].input_schema);
203
- });
204
-
205
- it("should handle tools without descriptions", () => {
206
- const anthropicTools = [
207
- {
208
- name: "TestTool",
209
- input_schema: {
210
- type: "object",
211
- properties: {}
212
- }
213
- }
214
- ];
215
-
216
- const result = openrouterUtils.convertAnthropicToolsToOpenRouter(anthropicTools);
217
-
218
- assert.strictEqual(result.length, 1);
219
- assert.strictEqual(result[0].function.name, "TestTool");
220
- assert.strictEqual(result[0].function.description, "");
221
- });
222
-
223
- it("should handle empty tools array", () => {
224
- const result = openrouterUtils.convertAnthropicToolsToOpenRouter([]);
225
- assert.strictEqual(result.length, 0);
226
- });
227
-
228
- it("should convert multiple tools", () => {
229
- const anthropicTools = [
230
- {
231
- name: "Read",
232
- description: "Read a file",
233
- input_schema: { type: "object", properties: {} }
234
- },
235
- {
236
- name: "Write",
237
- description: "Write a file",
238
- input_schema: { type: "object", properties: {} }
239
- },
240
- {
241
- name: "Execute",
242
- description: "Execute a command",
243
- input_schema: { type: "object", properties: {} }
244
- }
245
- ];
246
-
247
- const result = openrouterUtils.convertAnthropicToolsToOpenRouter(anthropicTools);
248
-
249
- assert.strictEqual(result.length, 3);
250
- assert.strictEqual(result[0].function.name, "Read");
251
- assert.strictEqual(result[1].function.name, "Write");
252
- assert.strictEqual(result[2].function.name, "Execute");
253
- });
254
- });
255
- });
256
-
257
- describe("OpenRouter to Anthropic Conversion", () => {
258
- describe("Response Conversion", () => {
259
- it("should convert text-only response", () => {
260
- const openRouterResponse = {
261
- choices: [
262
- {
263
- message: {
264
- role: "assistant",
265
- content: "Hello! I'm here to help."
266
- },
267
- finish_reason: "stop"
268
- }
269
- ],
270
- model: "openai/gpt-4o-mini",
271
- usage: { prompt_tokens: 10, completion_tokens: 8, total_tokens: 18 }
272
- };
273
-
274
- const result = openrouterUtils.convertOpenRouterResponseToAnthropic(
275
- openRouterResponse,
276
- "test-model"
277
- );
278
-
279
- assert.strictEqual(result.type, "message");
280
- assert.strictEqual(result.role, "assistant");
281
- assert.strictEqual(result.content.length, 1);
282
- assert.strictEqual(result.content[0].type, "text");
283
- assert.strictEqual(result.content[0].text, "Hello! I'm here to help.");
284
- assert.strictEqual(result.stop_reason, "end_turn");
285
- });
286
-
287
- it("should convert response with tool calls", () => {
288
- const openRouterResponse = {
289
- choices: [
290
- {
291
- message: {
292
- role: "assistant",
293
- content: "I'll read that file",
294
- tool_calls: [
295
- {
296
- id: "call_abc123",
297
- type: "function",
298
- function: {
299
- name: "Read",
300
- arguments: JSON.stringify({ file_path: "/tmp/test.txt" })
301
- }
302
- }
303
- ]
304
- },
305
- finish_reason: "tool_calls"
306
- }
307
- ],
308
- model: "openai/gpt-4o-mini",
309
- usage: { prompt_tokens: 15, completion_tokens: 25, total_tokens: 40 }
310
- };
311
-
312
- const result = openrouterUtils.convertOpenRouterResponseToAnthropic(
313
- openRouterResponse,
314
- "test-model"
315
- );
316
-
317
- assert.strictEqual(result.content.length, 2);
318
- assert.strictEqual(result.content[0].type, "text");
319
- assert.strictEqual(result.content[1].type, "tool_use");
320
- assert.strictEqual(result.content[1].id, "call_abc123");
321
- assert.strictEqual(result.content[1].name, "Read");
322
- assert.deepStrictEqual(result.content[1].input, { file_path: "/tmp/test.txt" });
323
- assert.strictEqual(result.stop_reason, "tool_use");
324
- });
325
-
326
- it("should convert response with multiple tool calls", () => {
327
- const openRouterResponse = {
328
- choices: [
329
- {
330
- message: {
331
- role: "assistant",
332
- content: "Processing multiple operations",
333
- tool_calls: [
334
- {
335
- id: "call_1",
336
- type: "function",
337
- function: {
338
- name: "Read",
339
- arguments: JSON.stringify({ file_path: "/input.txt" })
340
- }
341
- },
342
- {
343
- id: "call_2",
344
- type: "function",
345
- function: {
346
- name: "Write",
347
- arguments: JSON.stringify({
348
- file_path: "/output.txt",
349
- content: "result"
350
- })
351
- }
352
- }
353
- ]
354
- },
355
- finish_reason: "tool_calls"
356
- }
357
- ],
358
- model: "openai/gpt-4o-mini",
359
- usage: { prompt_tokens: 20, completion_tokens: 40, total_tokens: 60 }
360
- };
361
-
362
- const result = openrouterUtils.convertOpenRouterResponseToAnthropic(
363
- openRouterResponse,
364
- "test-model"
365
- );
366
-
367
- assert.strictEqual(result.content.length, 3); // 1 text + 2 tool_use
368
- assert.strictEqual(result.content[0].type, "text");
369
- assert.strictEqual(result.content[1].type, "tool_use");
370
- assert.strictEqual(result.content[1].name, "Read");
371
- assert.strictEqual(result.content[2].type, "tool_use");
372
- assert.strictEqual(result.content[2].name, "Write");
373
- });
374
-
375
- it("should generate unique IDs for tools", () => {
376
- const openRouterResponse = {
377
- choices: [
378
- {
379
- message: {
380
- role: "assistant",
381
- content: "Using tools",
382
- tool_calls: [
383
- {
384
- id: "call_1",
385
- type: "function",
386
- function: { name: "Tool1", arguments: "{}" }
387
- },
388
- {
389
- id: "call_2",
390
- type: "function",
391
- function: { name: "Tool2", arguments: "{}" }
392
- }
393
- ]
394
- },
395
- finish_reason: "tool_calls"
396
- }
397
- ],
398
- model: "test-model",
399
- usage: { prompt_tokens: 10, completion_tokens: 20, total_tokens: 30 }
400
- };
401
-
402
- const result = openrouterUtils.convertOpenRouterResponseToAnthropic(
403
- openRouterResponse,
404
- "test-model"
405
- );
406
-
407
- const tool1Id = result.content[1].id;
408
- const tool2Id = result.content[2].id;
409
-
410
- assert.strictEqual(tool1Id !== tool2Id, true);
411
- assert.strictEqual(typeof tool1Id, "string");
412
- assert.strictEqual(typeof tool2Id, "string");
413
- });
414
-
415
- it("should map finish_reason correctly", () => {
416
- const testCases = [
417
- { finish_reason: "stop", expected: "end_turn" },
418
- { finish_reason: "tool_calls", expected: "tool_use" },
419
- { finish_reason: "length", expected: "max_tokens" }
420
- ];
421
-
422
- testCases.forEach(({ finish_reason, expected }) => {
423
- const response = {
424
- choices: [
425
- {
426
- message: {
427
- role: "assistant",
428
- content: "Test",
429
- ...(finish_reason === "tool_calls" && {
430
- tool_calls: [
431
- {
432
- id: "test",
433
- function: { name: "test", arguments: "{}" }
434
- }
435
- ]
436
- })
437
- },
438
- finish_reason
439
- }
440
- ],
441
- model: "test-model",
442
- usage: { prompt_tokens: 10, completion_tokens: 10, total_tokens: 20 }
443
- };
444
-
445
- const result = openrouterUtils.convertOpenRouterResponseToAnthropic(
446
- response,
447
- "test-model"
448
- );
449
-
450
- assert.strictEqual(result.stop_reason, expected);
451
- });
452
- });
453
-
454
- it("should include proper message ID format", () => {
455
- const response = {
456
- choices: [
457
- {
458
- message: {
459
- role: "assistant",
460
- content: "Response"
461
- },
462
- finish_reason: "stop"
463
- }
464
- ],
465
- id: "chatcmpl-123",
466
- model: "openai/gpt-4o-mini",
467
- usage: { prompt_tokens: 10, completion_tokens: 10, total_tokens: 20 }
468
- };
469
-
470
- const result = openrouterUtils.convertOpenRouterResponseToAnthropic(
471
- response,
472
- "test-model"
473
- );
474
-
475
- assert.strictEqual(typeof result.id, "string");
476
- assert.strictEqual(result.id.length > 0, true);
477
- });
478
-
479
- it("should preserve usage metadata", () => {
480
- const response = {
481
- choices: [
482
- {
483
- message: {
484
- role: "assistant",
485
- content: "Test"
486
- },
487
- finish_reason: "stop"
488
- }
489
- ],
490
- model: "openai/gpt-4o-mini",
491
- usage: {
492
- prompt_tokens: 100,
493
- completion_tokens: 50,
494
- total_tokens: 150
495
- }
496
- };
497
-
498
- const result = openrouterUtils.convertOpenRouterResponseToAnthropic(
499
- response,
500
- "test-model"
501
- );
502
-
503
- assert.strictEqual(result.usage.input_tokens, 100);
504
- assert.strictEqual(result.usage.output_tokens, 50);
505
- });
506
- });
507
- });
508
-
509
- describe("Round-Trip Conversion", () => {
510
- it("should maintain data integrity through round-trip conversion", () => {
511
- const originalMessage = {
512
- role: "user",
513
- content: "Please write to /tmp/test.txt"
514
- };
515
-
516
- // Convert to OpenRouter
517
- const openRouterFormat = openrouterUtils.convertAnthropicMessagesToOpenRouter([
518
- originalMessage
519
- ]);
520
-
521
- // Verify conversion
522
- assert.strictEqual(openRouterFormat[0].role, "user");
523
- assert.strictEqual(openRouterFormat[0].content, "Please write to /tmp/test.txt");
524
- });
525
-
526
- it("should handle complex conversation with tools", () => {
527
- const conversation = [
528
- {
529
- role: "user",
530
- content: "Read /tmp/input.txt and write to /tmp/output.txt"
531
- },
532
- {
533
- role: "assistant",
534
- content: [
535
- { type: "text", text: "I'll do that for you" },
536
- {
537
- type: "tool_use",
538
- id: "toolu_1",
539
- name: "Read",
540
- input: { file_path: "/tmp/input.txt" }
541
- }
542
- ]
543
- },
544
- {
545
- role: "user",
546
- content: [
547
- {
548
- type: "tool_result",
549
- tool_use_id: "toolu_1",
550
- content: "File contents"
551
- }
552
- ]
553
- }
554
- ];
555
-
556
- // Convert to OpenRouter
557
- const openRouterFormat = openrouterUtils.convertAnthropicMessagesToOpenRouter(
558
- conversation
559
- );
560
-
561
- // Verify structure is maintained
562
- assert.strictEqual(openRouterFormat.length >= 3, true);
563
-
564
- // Check user message
565
- const userMsgs = openRouterFormat.filter(m => m.role === "user");
566
- assert.strictEqual(userMsgs.length >= 1, true);
567
-
568
- // Check assistant message with tool calls
569
- const assistantMsgs = openRouterFormat.filter(m => m.role === "assistant");
570
- assert.strictEqual(assistantMsgs.length >= 1, true);
571
- assert.strictEqual(Array.isArray(assistantMsgs[0].tool_calls), true);
572
-
573
- // Check tool message
574
- const toolMsgs = openRouterFormat.filter(m => m.role === "tool");
575
- assert.strictEqual(toolMsgs.length >= 1, true);
576
- });
577
- });
578
- });