@jsonstudio/rcc 0.89.555 → 0.89.611

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 (70) hide show
  1. package/dist/build-info.js +2 -2
  2. package/dist/modules/llmswitch/bridge.d.ts +43 -0
  3. package/dist/modules/llmswitch/bridge.js +103 -0
  4. package/dist/modules/llmswitch/bridge.js.map +1 -1
  5. package/dist/monitoring/semantic-config-loader.js +3 -1
  6. package/dist/monitoring/semantic-config-loader.js.map +1 -1
  7. package/dist/providers/core/runtime/http-transport-provider.d.ts +3 -0
  8. package/dist/providers/core/runtime/http-transport-provider.js +70 -4
  9. package/dist/providers/core/runtime/http-transport-provider.js.map +1 -1
  10. package/dist/providers/core/runtime/responses-provider.d.ts +2 -2
  11. package/dist/providers/core/runtime/responses-provider.js +33 -28
  12. package/dist/providers/core/runtime/responses-provider.js.map +1 -1
  13. package/dist/providers/core/utils/provider-error-reporter.js +7 -7
  14. package/dist/providers/core/utils/provider-error-reporter.js.map +1 -1
  15. package/dist/providers/core/utils/snapshot-writer.js +6 -2
  16. package/dist/providers/core/utils/snapshot-writer.js.map +1 -1
  17. package/dist/server/runtime/http-server/index.js +59 -47
  18. package/dist/server/runtime/http-server/index.js.map +1 -1
  19. package/dist/server/runtime/http-server/llmswitch-loader.d.ts +0 -1
  20. package/dist/server/runtime/http-server/llmswitch-loader.js +17 -21
  21. package/dist/server/runtime/http-server/llmswitch-loader.js.map +1 -1
  22. package/dist/server/runtime/http-server/request-executor.d.ts +6 -0
  23. package/dist/server/runtime/http-server/request-executor.js +113 -37
  24. package/dist/server/runtime/http-server/request-executor.js.map +1 -1
  25. package/node_modules/@jsonstudio/llms/dist/conversion/codecs/gemini-openai-codec.js +15 -1
  26. package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/iflow-web-search.d.ts +18 -0
  27. package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/iflow-web-search.js +87 -0
  28. package/node_modules/@jsonstudio/llms/dist/conversion/compat/profiles/chat-gemini.json +14 -15
  29. package/node_modules/@jsonstudio/llms/dist/conversion/compat/profiles/chat-glm.json +194 -190
  30. package/node_modules/@jsonstudio/llms/dist/conversion/compat/profiles/chat-iflow.json +199 -195
  31. package/node_modules/@jsonstudio/llms/dist/conversion/compat/profiles/chat-lmstudio.json +43 -43
  32. package/node_modules/@jsonstudio/llms/dist/conversion/compat/profiles/chat-qwen.json +20 -20
  33. package/node_modules/@jsonstudio/llms/dist/conversion/compat/profiles/responses-c4m.json +42 -42
  34. package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/compat/compat-pipeline-executor.js +6 -0
  35. package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/compat/compat-types.d.ts +2 -0
  36. package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/hub-pipeline.js +5 -1
  37. package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/session-identifiers.d.ts +9 -0
  38. package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/session-identifiers.js +76 -0
  39. package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/stages/resp_inbound/resp_inbound_stage1_sse_decode/index.js +31 -2
  40. package/node_modules/@jsonstudio/llms/dist/conversion/hub/process/chat-process.js +89 -25
  41. package/node_modules/@jsonstudio/llms/dist/conversion/responses/responses-openai-bridge.js +75 -4
  42. package/node_modules/@jsonstudio/llms/dist/conversion/shared/anthropic-message-utils.js +41 -6
  43. package/node_modules/@jsonstudio/llms/dist/conversion/shared/errors.d.ts +20 -0
  44. package/node_modules/@jsonstudio/llms/dist/conversion/shared/errors.js +28 -0
  45. package/node_modules/@jsonstudio/llms/dist/conversion/shared/responses-conversation-store.js +30 -3
  46. package/node_modules/@jsonstudio/llms/dist/conversion/shared/responses-output-builder.js +68 -6
  47. package/node_modules/@jsonstudio/llms/dist/filters/special/request-toolcalls-stringify.d.ts +13 -0
  48. package/node_modules/@jsonstudio/llms/dist/filters/special/request-toolcalls-stringify.js +103 -3
  49. package/node_modules/@jsonstudio/llms/dist/filters/special/response-tool-text-canonicalize.d.ts +16 -0
  50. package/node_modules/@jsonstudio/llms/dist/filters/special/response-tool-text-canonicalize.js +27 -3
  51. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/classifier.js +4 -2
  52. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine.d.ts +30 -0
  53. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine.js +618 -42
  54. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/health-manager.d.ts +23 -0
  55. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/health-manager.js +14 -0
  56. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/provider-registry.d.ts +15 -0
  57. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/provider-registry.js +40 -0
  58. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/routing-instructions.d.ts +34 -0
  59. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/routing-instructions.js +393 -0
  60. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/sticky-session-store.d.ts +3 -0
  61. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/sticky-session-store.js +110 -0
  62. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/tool-signals.js +0 -22
  63. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/types.d.ts +41 -0
  64. package/node_modules/@jsonstudio/llms/dist/servertool/engine.js +42 -1
  65. package/node_modules/@jsonstudio/llms/dist/servertool/handlers/web-search.js +157 -4
  66. package/node_modules/@jsonstudio/llms/dist/servertool/types.d.ts +6 -0
  67. package/node_modules/@jsonstudio/llms/package.json +1 -1
  68. package/package.json +8 -5
  69. package/scripts/mock-provider/run-regressions.mjs +38 -2
  70. package/scripts/verify-apply-patch.mjs +132 -0
@@ -1,200 +1,204 @@
1
1
  {
2
- "id": "chat:glm",
3
- "protocol": "openai-chat",
4
- "request": {
5
- "mappings": [
6
- { "action": "snapshot", "phase": "compat-pre" },
7
- { "action": "dto_unwrap" },
8
- {
9
- "action": "glm_image_content"
10
- },
11
- {
12
- "action": "glm_vision_prompt"
13
- },
14
- {
15
- "action": "rename",
16
- "from": "response_format",
17
- "to": "metadata.generation.response_format"
18
- },
19
- {
20
- "action": "remove",
21
- "path": "metadata.clientModelId"
22
- },
23
- {
24
- "action": "shape_filter",
25
- "target": "request",
26
- "config": {
27
- "request": {
28
- "allowTopLevel": [
29
- "model", "messages", "stream", "thinking", "do_sample", "temperature", "top_p",
30
- "max_tokens", "tools", "tool_choice", "stop", "response_format", "web_search"
31
- ],
32
- "messages": {
33
- "allowedRoles": ["system", "user", "assistant", "tool"],
34
- "assistantWithToolCallsContentNull": true,
35
- "toolContentStringify": false
2
+ "id": "chat:glm",
3
+ "protocol": "openai-chat",
4
+ "request": {
5
+ "mappings": [
6
+ { "action": "snapshot", "phase": "compat-pre" },
7
+ { "action": "dto_unwrap" },
8
+ {
9
+ "action": "remove",
10
+ "path": "parallel_tool_calls"
36
11
  },
37
- "messagesRules": [],
38
- "tools": {
39
- "normalize": false,
40
- "forceToolChoiceAuto": true
12
+ {
13
+ "action": "glm_image_content"
41
14
  },
42
- "assistantToolCalls": { "functionArgumentsType": "string" }
43
- },
44
- "response": {
45
- "allowTopLevel": [
46
- "id", "request_id", "created", "model",
47
- "choices", "usage", "video_result", "web_search", "content_filter",
48
- "required_action", "output", "output_text", "status"
49
- ],
50
- "choices": {
51
- "required": true,
52
- "message": {
53
- "allow": ["role", "content", "reasoning_content", "audio", "tool_calls"],
54
- "roleDefault": "assistant",
55
- "contentNullWhenToolCalls": true,
56
- "tool_calls": { "function": { "nameRequired": true, "argumentsType": "string" } }
57
- },
58
- "finish_reason": ["stop", "tool_calls", "length", "sensitive", "network_error"]
15
+ {
16
+ "action": "glm_vision_prompt"
59
17
  },
60
- "usage": { "allow": ["prompt_tokens", "completion_tokens", "prompt_tokens_details", "total_tokens"] }
61
- }
62
- }
63
- },
64
- {
65
- "action": "apply_rules",
66
- "config": {
67
- "tools": {
68
- "function": {
69
- "removeKeys": ["strict", "json_schema"]
70
- }
71
- },
72
- "messages": {
73
- "assistantToolCalls": {
74
- "function": {
75
- "removeKeys": ["strict"]
76
- }
77
- }
78
- },
79
- "topLevel": {
80
- "conditional": [
81
- { "when": { "tools": "empty" }, "remove": ["tool_choice"] }
82
- ]
83
- }
84
- }
85
- },
86
- {
87
- "action": "field_map",
88
- "direction": "incoming",
89
- "config": [
90
- { "sourcePath": "usage.prompt_tokens", "targetPath": "usage.input_tokens", "type": "number" },
91
- { "sourcePath": "usage.completion_tokens", "targetPath": "usage.output_tokens", "type": "number" },
92
- { "sourcePath": "created", "targetPath": "created_at", "type": "number" },
93
- { "sourcePath": "request_id", "targetPath": "request_id", "type": "string" },
94
- { "sourcePath": "model", "targetPath": "model", "type": "string", "transform": "normalizeModelName" },
95
- {
96
- "sourcePath": "choices[*].message.tool_calls[*].function.arguments",
97
- "targetPath": "choices[*].message.tool_calls[*].function.arguments",
98
- "type": "string"
99
- }
18
+ {
19
+ "action": "rename",
20
+ "from": "response_format",
21
+ "to": "metadata.generation.response_format"
22
+ },
23
+ {
24
+ "action": "remove",
25
+ "path": "metadata.clientModelId"
26
+ },
27
+ {
28
+ "action": "shape_filter",
29
+ "target": "request",
30
+ "config": {
31
+ "request": {
32
+ "allowTopLevel": [
33
+ "model", "messages", "stream", "thinking", "do_sample", "temperature", "top_p",
34
+ "max_tokens", "tools", "tool_choice", "stop", "response_format", "web_search"
35
+ ],
36
+ "messages": {
37
+ "allowedRoles": ["system", "user", "assistant", "tool"],
38
+ "assistantWithToolCallsContentNull": true,
39
+ "toolContentStringify": false
40
+ },
41
+ "messagesRules": [],
42
+ "tools": {
43
+ "normalize": false,
44
+ "forceToolChoiceAuto": true
45
+ },
46
+ "assistantToolCalls": { "functionArgumentsType": "string" }
47
+ },
48
+ "response": {
49
+ "allowTopLevel": [
50
+ "id", "request_id", "created", "model",
51
+ "choices", "usage", "video_result", "web_search", "content_filter",
52
+ "required_action", "output", "output_text", "status"
53
+ ],
54
+ "choices": {
55
+ "required": true,
56
+ "message": {
57
+ "allow": ["role", "content", "reasoning_content", "audio", "tool_calls"],
58
+ "roleDefault": "assistant",
59
+ "contentNullWhenToolCalls": true,
60
+ "tool_calls": { "function": { "nameRequired": true, "argumentsType": "string" } }
61
+ },
62
+ "finish_reason": ["stop", "tool_calls", "length", "sensitive", "network_error"]
63
+ },
64
+ "usage": { "allow": ["prompt_tokens", "completion_tokens", "prompt_tokens_details", "total_tokens"] }
65
+ }
66
+ }
67
+ },
68
+ {
69
+ "action": "apply_rules",
70
+ "config": {
71
+ "tools": {
72
+ "function": {
73
+ "removeKeys": ["strict", "json_schema"]
74
+ }
75
+ },
76
+ "messages": {
77
+ "assistantToolCalls": {
78
+ "function": {
79
+ "removeKeys": ["strict"]
80
+ }
81
+ }
82
+ },
83
+ "topLevel": {
84
+ "conditional": [
85
+ { "when": { "tools": "empty" }, "remove": ["tool_choice"] }
86
+ ]
87
+ }
88
+ }
89
+ },
90
+ {
91
+ "action": "field_map",
92
+ "direction": "incoming",
93
+ "config": [
94
+ { "sourcePath": "usage.prompt_tokens", "targetPath": "usage.input_tokens", "type": "number" },
95
+ { "sourcePath": "usage.completion_tokens", "targetPath": "usage.output_tokens", "type": "number" },
96
+ { "sourcePath": "created", "targetPath": "created_at", "type": "number" },
97
+ { "sourcePath": "request_id", "targetPath": "request_id", "type": "string" },
98
+ { "sourcePath": "model", "targetPath": "model", "type": "string", "transform": "normalizeModelName" },
99
+ {
100
+ "sourcePath": "choices[*].message.tool_calls[*].function.arguments",
101
+ "targetPath": "choices[*].message.tool_calls[*].function.arguments",
102
+ "type": "string"
103
+ }
104
+ ]
105
+ },
106
+ { "action": "tool_schema_sanitize", "mode": "glm_shell" },
107
+ {
108
+ "action": "glm_web_search_request"
109
+ },
110
+ {
111
+ "action": "auto_thinking",
112
+ "config": {
113
+ "modelPrefixes": ["glm-4.7", "glm-4.6", "glm-4.5", "glm-z1"],
114
+ "excludePrefixes": ["glm-4.6v"]
115
+ }
116
+ },
117
+ { "action": "snapshot", "phase": "compat-post" },
118
+ { "action": "dto_rewrap" }
100
119
  ]
101
- },
102
- { "action": "tool_schema_sanitize", "mode": "glm_shell" },
103
- {
104
- "action": "glm_web_search_request"
105
- },
106
- {
107
- "action": "auto_thinking",
108
- "config": {
109
- "modelPrefixes": ["glm-4.7", "glm-4.6", "glm-4.5", "glm-z1"],
110
- "excludePrefixes": ["glm-4.6v"]
111
- }
112
- },
113
- { "action": "snapshot", "phase": "compat-post" },
114
- { "action": "dto_rewrap" }
115
- ]
116
- },
117
- "response": {
118
- "mappings": [
119
- { "action": "snapshot", "phase": "compat-pre" },
120
- { "action": "dto_unwrap" },
121
- {
122
- "action": "resp_blacklist",
123
- "config": {
124
- "paths": ["usage.prompt_tokens_details.cached_tokens"],
125
- "keepCritical": true
126
- }
127
- },
128
- {
129
- "action": "shape_filter",
130
- "target": "response",
131
- "config": {
132
- "request": {
133
- "allowTopLevel": [
134
- "model", "messages", "stream", "thinking", "do_sample", "temperature", "top_p",
135
- "max_tokens", "tools", "tool_choice", "stop", "response_format"
136
- ],
137
- "messages": {
138
- "allowedRoles": ["system", "user", "assistant", "tool"],
139
- "assistantWithToolCallsContentNull": true,
140
- "toolContentStringify": false
120
+ },
121
+ "response": {
122
+ "mappings": [
123
+ { "action": "snapshot", "phase": "compat-pre" },
124
+ { "action": "dto_unwrap" },
125
+ {
126
+ "action": "resp_blacklist",
127
+ "config": {
128
+ "paths": ["usage.prompt_tokens_details.cached_tokens"],
129
+ "keepCritical": true
130
+ }
141
131
  },
142
- "messagesRules": [],
143
- "tools": {
144
- "normalize": false,
145
- "forceToolChoiceAuto": true
132
+ {
133
+ "action": "shape_filter",
134
+ "target": "response",
135
+ "config": {
136
+ "request": {
137
+ "allowTopLevel": [
138
+ "model", "messages", "stream", "thinking", "do_sample", "temperature", "top_p",
139
+ "max_tokens", "tools", "tool_choice", "stop", "response_format"
140
+ ],
141
+ "messages": {
142
+ "allowedRoles": ["system", "user", "assistant", "tool"],
143
+ "assistantWithToolCallsContentNull": true,
144
+ "toolContentStringify": false
145
+ },
146
+ "messagesRules": [],
147
+ "tools": {
148
+ "normalize": false,
149
+ "forceToolChoiceAuto": true
150
+ },
151
+ "assistantToolCalls": { "functionArgumentsType": "string" }
152
+ },
153
+ "response": {
154
+ "allowTopLevel": [
155
+ "id", "request_id", "created", "model",
156
+ "choices", "usage", "video_result", "web_search", "content_filter",
157
+ "required_action", "output", "output_text", "status"
158
+ ],
159
+ "choices": {
160
+ "required": true,
161
+ "message": {
162
+ "allow": ["role", "content", "reasoning_content", "audio", "tool_calls"],
163
+ "roleDefault": "assistant",
164
+ "contentNullWhenToolCalls": true,
165
+ "tool_calls": { "function": { "nameRequired": true, "argumentsType": "string" } }
166
+ },
167
+ "finish_reason": ["stop", "tool_calls", "length", "sensitive", "network_error"]
168
+ },
169
+ "usage": { "allow": ["prompt_tokens", "completion_tokens", "prompt_tokens_details", "total_tokens"] }
170
+ }
171
+ }
146
172
  },
147
- "assistantToolCalls": { "functionArgumentsType": "string" }
148
- },
149
- "response": {
150
- "allowTopLevel": [
151
- "id", "request_id", "created", "model",
152
- "choices", "usage", "video_result", "web_search", "content_filter",
153
- "required_action", "output", "output_text", "status"
154
- ],
155
- "choices": {
156
- "required": true,
157
- "message": {
158
- "allow": ["role", "content", "reasoning_content", "audio", "tool_calls"],
159
- "roleDefault": "assistant",
160
- "contentNullWhenToolCalls": true,
161
- "tool_calls": { "function": { "nameRequired": true, "argumentsType": "string" } }
162
- },
163
- "finish_reason": ["stop", "tool_calls", "length", "sensitive", "network_error"]
173
+ {
174
+ "action": "field_map",
175
+ "direction": "outgoing",
176
+ "config": [
177
+ { "sourcePath": "usage.input_tokens", "targetPath": "usage.prompt_tokens", "type": "number" },
178
+ { "sourcePath": "usage.output_tokens", "targetPath": "usage.completion_tokens", "type": "number" },
179
+ { "sourcePath": "usage.total_input_tokens", "targetPath": "usage.prompt_tokens", "type": "number" },
180
+ { "sourcePath": "usage.total_output_tokens", "targetPath": "usage.completion_tokens", "type": "number" },
181
+ { "sourcePath": "created_at", "targetPath": "created", "type": "number" },
182
+ { "sourcePath": "request_id", "targetPath": "request_id", "type": "string" },
183
+ {
184
+ "sourcePath": "choices[*].finish_reason",
185
+ "targetPath": "choices[*].finish_reason",
186
+ "type": "string",
187
+ "transform": "normalizeFinishReason"
188
+ },
189
+ {
190
+ "sourcePath": "choices[*].message.tool_calls[*].function.arguments",
191
+ "targetPath": "choices[*].message.tool_calls[*].function.arguments",
192
+ "type": "string"
193
+ }
194
+ ]
164
195
  },
165
- "usage": { "allow": ["prompt_tokens", "completion_tokens", "prompt_tokens_details", "total_tokens"] }
166
- }
167
- }
168
- },
169
- {
170
- "action": "field_map",
171
- "direction": "outgoing",
172
- "config": [
173
- { "sourcePath": "usage.input_tokens", "targetPath": "usage.prompt_tokens", "type": "number" },
174
- { "sourcePath": "usage.output_tokens", "targetPath": "usage.completion_tokens", "type": "number" },
175
- { "sourcePath": "usage.total_input_tokens", "targetPath": "usage.prompt_tokens", "type": "number" },
176
- { "sourcePath": "usage.total_output_tokens", "targetPath": "usage.completion_tokens", "type": "number" },
177
- { "sourcePath": "created_at", "targetPath": "created", "type": "number" },
178
- { "sourcePath": "request_id", "targetPath": "request_id", "type": "string" },
179
- {
180
- "sourcePath": "choices[*].finish_reason",
181
- "targetPath": "choices[*].finish_reason",
182
- "type": "string",
183
- "transform": "normalizeFinishReason"
184
- },
185
- {
186
- "sourcePath": "choices[*].message.tool_calls[*].function.arguments",
187
- "targetPath": "choices[*].message.tool_calls[*].function.arguments",
188
- "type": "string"
189
- }
196
+ { "action": "tool_schema_sanitize", "mode": "glm_shell" },
197
+ { "action": "response_normalize" },
198
+ { "action": "extract_glm_tool_markup" },
199
+ { "action": "response_validate" },
200
+ { "action": "snapshot", "phase": "compat-post" },
201
+ { "action": "dto_rewrap" }
190
202
  ]
191
- },
192
- { "action": "tool_schema_sanitize", "mode": "glm_shell" },
193
- { "action": "response_normalize" },
194
- { "action": "extract_glm_tool_markup" },
195
- { "action": "response_validate" },
196
- { "action": "snapshot", "phase": "compat-post" },
197
- { "action": "dto_rewrap" }
198
- ]
199
- }
203
+ }
200
204
  }