llm-switcher 1.6.13 → 1.6.14

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog — LLM Switcher
2
2
 
3
+ ## Release 1.6.14 — 2026-10-12
4
+
5
+ - **System turn with an odd content shape.** On the translated route, a `system` turn whose `content` is not text and not a list is dropped. Before, the request failed with a `TypeError`.
6
+
3
7
  ## Release 1.6.13 — 2026-10-12
4
8
 
5
9
  - **`switch on` with no profile.** `switch on` gives each tool the profile that it had before `switch off`. A tool that was off stays off. A tool that is on keeps its profile.
package/formats.mjs CHANGED
@@ -462,7 +462,7 @@ function anthropicToIR(payload) {
462
462
  const text =
463
463
  typeof msg.content === 'string'
464
464
  ? msg.content
465
- : (msg.content || []).filter(p => p && p.type === 'text').map(p => p.text).join('\n');
465
+ : Array.isArray(msg.content) ? msg.content.filter(p => p && p.type === 'text').map(p => p.text).join('\n') : '';
466
466
  if (text.trim()) ir.system = ir.system ? `${ir.system}\n\n${text}` : text;
467
467
  return true;
468
468
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "llm-switcher",
3
- "version": "1.6.13",
3
+ "version": "1.6.14",
4
4
  "description": "Zero-dependency multi-protocol edge gateway & provider switcher for Claude Code and Codex, with OpenAI-compatible, Anthropic and Vertex upstreams",
5
5
  "keywords": [
6
6
  "llm",
@@ -112,6 +112,17 @@ test('healAnthropicPayload: native Anthropic passthrough keeps the billing heade
112
112
  assert.equal(payload.system[0].text, header);
113
113
  });
114
114
 
115
+ test('anthropicToIR: a system turn whose content is neither text nor a list is dropped, not thrown', () => {
116
+ for (const content of [{ type: 'text', text: 'odd' }, 42, null]) {
117
+ const ir = anthropicToIR({
118
+ model: 'claude-opus-4-6', max_tokens: 10,
119
+ messages: [{ role: 'system', content }, { role: 'user', content: 'hi' }]
120
+ });
121
+ assert.equal(ir.system, '', JSON.stringify(content));
122
+ assert.deepEqual(ir.messages.map(m => m.role), ['user']);
123
+ }
124
+ });
125
+
115
126
  test('anthropicToIR: a system turn folds into the IR system prompt', () => {
116
127
  const ir = anthropicToIR({
117
128
  model: 'claude-opus-4-6', max_tokens: 10,