@zenmux/rosetta-ai 1.0.40 → 1.0.41

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/README.md CHANGED
@@ -546,7 +546,7 @@ This implementation is not yet published as a Responses-capable npm release.
546
546
 
547
547
  ## Messages → Google Interactions (development)
548
548
 
549
- `MessagesToInteractionsConverter` directly translates Messages requests and Interactions V1 JSON/SSE responses. It supports text, image/document inputs, function calls/results (including `is_error`), system text, stop sequences, JSON Schema, and adaptive thinking with low/medium/high effort. Model support is separate from protocol support. Unsupported sampling, thinking budgets/disable, strict guarantees, cache controls, built-in Anthropic tools and stored-history parameters are rejected explicitly.
549
+ `MessagesToInteractionsConverter` directly translates Messages requests and Interactions V1 JSON/SSE responses. It supports text, image/document inputs, function calls/results (including `is_error`), system text, stop sequences, JSON Schema, and adaptive thinking with low/medium/high effort. Model support is separate from protocol support. Messages `cache_control` hints on the request, system/content blocks, and tool definitions are ignored, matching Messages → Gemini; cache breakpoints and TTLs are not forwarded or enforced. Unsupported sampling, thinking budgets/disable, strict guarantees, built-in Anthropic tools and stored-history parameters are rejected explicitly.
550
550
 
551
551
  Messages `input_tokens` excludes reported cache reads: `total_input_tokens - (total_cached_tokens ?? 0)`. `cache_read_input_tokens` is emitted only when reported, `output_tokens` includes output plus thought once, and `getUsage()` retains the complete original usage internally. Client usage contains only standard counters. Missing counters are not filled with zero; cache creation is not inferred. Stream usage is cumulative and completed only after the native terminal event and EOF, including late metadata.
552
552
 
@@ -16,6 +16,7 @@ function validateMessagesInteractionsParameters(params) {
16
16
  "stop_sequences",
17
17
  "thinking",
18
18
  "output_config",
19
+ "cache_control",
19
20
  ]);
20
21
  for (const [key, value] of Object.entries(p))
21
22
  if (value != null && !known.has(key))
@@ -62,7 +63,6 @@ function validateMessagesInteractionsParameters(params) {
62
63
  if (tool.strict === true)
63
64
  fail("Interactions V1 cannot guarantee tool strict=true");
64
65
  for (const key of [
65
- "cache_control",
66
66
  "defer_loading",
67
67
  "allowed_callers",
68
68
  "input_examples",
@@ -81,6 +81,7 @@ function validateMessagesInteractionsParameters(params) {
81
81
  }
82
82
  function convertMessagesInteractionRequest(params) {
83
83
  validateMessagesInteractionsParameters(params);
84
+ // Ignore Messages cache hints, matching the Gemini converter; only map supported content.
84
85
  const p = params;
85
86
  const model = nonempty(p.model, "model");
86
87
  if (!Array.isArray(p.messages) || !p.messages.length)
@@ -107,8 +108,6 @@ function convertMessagesInteractionRequest(params) {
107
108
  const block = object(rawBlock, "content block");
108
109
  if (block.interactions != null)
109
110
  fail("Native history is not supported by Messages conversion");
110
- if (block.cache_control != null)
111
- fail("cache_control has no equivalent in Interactions V1");
112
111
  if (block.type === "tool_use") {
113
112
  flush();
114
113
  if (message.role !== "assistant")
@@ -210,7 +209,7 @@ function convertMessagesInteractionRequest(params) {
210
209
  ? p.system
211
210
  : array(p.system, "system")
212
211
  .map(block => {
213
- if (block.type !== "text" || block.cache_control != null)
212
+ if (block.type !== "text")
214
213
  fail("system supports plain text only");
215
214
  return string(block.text, "system.text");
216
215
  })
@@ -229,8 +228,6 @@ function convertMessagesInteractionRequest(params) {
229
228
  }
230
229
  function convertContent(raw) {
231
230
  const block = object(raw, "content block");
232
- if (block.cache_control != null)
233
- fail("cache_control has no equivalent in Interactions V1");
234
231
  if (block.type === "text") {
235
232
  if (block.citations != null && (!Array.isArray(block.citations) || block.citations.length))
236
233
  fail("Citation history has no equivalent in Interactions conversion");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenmux/rosetta-ai",
3
- "version": "1.0.40",
3
+ "version": "1.0.41",
4
4
  "description": "Universal translator between AI provider protocols",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",