@jsonstudio/llms 0.6.2979 → 0.6.3214

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 (242) hide show
  1. package/dist/conversion/args-mapping.js +8 -0
  2. package/dist/conversion/{shared/bridge-actions.js → bridge-actions.js} +2 -1
  3. package/dist/conversion/{shared/bridge-id-utils.js → bridge-id-utils.js} +1 -1
  4. package/dist/conversion/{shared/bridge-instructions.js → bridge-instructions.js} +1 -1
  5. package/dist/conversion/{shared/bridge-message-utils.d.ts → bridge-message-utils.d.ts} +1 -1
  6. package/dist/conversion/{shared/bridge-message-utils.js → bridge-message-utils.js} +5 -149
  7. package/dist/conversion/{shared/bridge-metadata.js → bridge-metadata.js} +1 -1
  8. package/dist/conversion/{shared/bridge-policies.js → bridge-policies.js} +1 -1
  9. package/dist/conversion/codecs/gemini-openai-codec.js +27 -8
  10. package/dist/conversion/codecs/responses-openai-codec.js +1 -1
  11. package/dist/conversion/{shared/compaction-detect.d.ts → compaction-detect.d.ts} +1 -1
  12. package/dist/conversion/compaction-detect.js +4 -0
  13. package/dist/conversion/compat/actions/apply-patch-fixer.js +2 -2
  14. package/dist/conversion/compat/actions/deepseek-web-response.d.ts +0 -1
  15. package/dist/conversion/compat/actions/deepseek-web-response.js +15 -405
  16. package/dist/conversion/compat/actions/harvest-tool-calls-from-text.js +1 -1
  17. package/dist/conversion/compat/actions/lmstudio-responses-fc-ids.js +1 -1
  18. package/dist/conversion/compat/actions/qwen-transform.js +74 -2
  19. package/dist/conversion/compat/actions/snapshot.js +1 -1
  20. package/dist/conversion/compat/antigravity-session-signature.js +36 -0
  21. package/dist/conversion/compat/profiles/chat-deepseek-web.json +0 -22
  22. package/dist/conversion/compat/profiles/chat-glm.json +251 -72
  23. package/dist/conversion/compat/profiles/chat-iflow.json +174 -39
  24. package/dist/conversion/compat/profiles/chat-lmstudio.json +43 -14
  25. package/dist/conversion/hub/operation-table/operation-table-runner.js +2 -2
  26. package/dist/conversion/hub/operation-table/semantic-mappers/anthropic-mapper.js +1 -1
  27. package/dist/conversion/hub/operation-table/semantic-mappers/chat-mapper.js +7 -4
  28. package/dist/conversion/hub/operation-table/semantic-mappers/gemini-mapper.js +2 -2
  29. package/dist/conversion/hub/operation-table/semantic-mappers/responses-mapper.js +2 -8
  30. package/dist/conversion/hub/pipeline/hub-pipeline.d.ts +1 -0
  31. package/dist/conversion/hub/pipeline/hub-pipeline.js +50 -3
  32. package/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage2_semantic_map/index.d.ts +1 -1
  33. package/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage2_semantic_map/index.js +62 -0
  34. package/dist/conversion/hub/pipeline/stages/req_process/req_process_stage2_route_select/index.js +3 -1
  35. package/dist/conversion/hub/pipeline/stages/resp_inbound/resp_inbound_stage1_sse_decode/index.js +1 -1
  36. package/dist/conversion/hub/pipeline/stages/resp_outbound/resp_outbound_stage1_client_remap/chat-process-semantics-bridge.d.ts +1 -1
  37. package/dist/conversion/hub/pipeline/stages/resp_process/resp_process_stage1_tool_governance/index.js +42 -29
  38. package/dist/conversion/hub/pipeline/stages/resp_process/resp_process_stage2_finalize/index.js +12 -0
  39. package/dist/conversion/hub/policy/protocol-spec.js +1 -1
  40. package/dist/conversion/hub/process/chat-process-clock-reminders.js +1 -1
  41. package/dist/conversion/hub/process/chat-process-clock-tools.js +1 -1
  42. package/dist/conversion/hub/process/chat-process-continue-execution.js +1 -1
  43. package/dist/conversion/hub/process/chat-process-servertool-orchestration.js +1 -1
  44. package/dist/conversion/hub/process/chat-process-web-search.js +1 -1
  45. package/dist/conversion/hub/response/provider-response.js +14 -5
  46. package/dist/conversion/hub/response/response-mappers.js +23 -1
  47. package/dist/conversion/hub/response/response-runtime.js +28 -5
  48. package/dist/conversion/hub/snapshot-recorder.js +1 -1
  49. package/dist/conversion/hub/tool-governance/engine.d.ts +8 -0
  50. package/dist/conversion/hub/tool-governance/engine.js +25 -68
  51. package/dist/conversion/hub/tool-governance/rules.js +73 -69
  52. package/dist/conversion/hub/tool-surface/tool-surface-engine.js +1 -1
  53. package/dist/conversion/index.d.ts +1 -2
  54. package/dist/conversion/index.js +1 -2
  55. package/dist/conversion/{shared/jsonish.js → jsonish.js} +1 -1
  56. package/dist/conversion/{shared/mcp-injection.js → mcp-injection.js} +1 -1
  57. package/dist/conversion/media.js +4 -0
  58. package/dist/conversion/{shared/metadata-passthrough.d.ts → metadata-passthrough.d.ts} +1 -1
  59. package/dist/conversion/{shared/metadata-passthrough.js → metadata-passthrough.js} +2 -2
  60. package/dist/conversion/payload-budget.js +47 -0
  61. package/dist/conversion/protocol-field-allowlists.d.ts +7 -0
  62. package/dist/conversion/protocol-field-allowlists.js +9 -0
  63. package/dist/conversion/{shared/protocol-state.d.ts → protocol-state.d.ts} +2 -2
  64. package/dist/conversion/{shared/protocol-state.js → protocol-state.js} +2 -2
  65. package/dist/conversion/{shared/errors.d.ts → provider-protocol-error.d.ts} +0 -3
  66. package/dist/conversion/provider-protocol-error.js +25 -0
  67. package/dist/conversion/responses/responses-openai-bridge/response-payload.js +8 -5
  68. package/dist/conversion/responses/responses-openai-bridge/types.d.ts +1 -1
  69. package/dist/conversion/responses/responses-openai-bridge.d.ts +1 -1
  70. package/dist/conversion/responses/responses-openai-bridge.js +43 -10
  71. package/dist/conversion/{shared/runtime-metadata.d.ts → runtime-metadata.d.ts} +1 -1
  72. package/dist/conversion/{shared/runtime-metadata.js → runtime-metadata.js} +2 -2
  73. package/dist/conversion/shared/anthropic-message-utils.js +19 -8
  74. package/dist/conversion/shared/chat-request-filters.d.ts +3 -4
  75. package/dist/conversion/shared/chat-request-filters.js +22 -78
  76. package/dist/conversion/shared/gemini-tool-utils.d.ts +1 -1
  77. package/dist/conversion/shared/openai-finalizer.js +1 -0
  78. package/dist/conversion/shared/openai-message-normalize.js +2 -2
  79. package/dist/conversion/shared/reasoning-normalizer.js +6 -0
  80. package/dist/conversion/shared/reasoning-utils.js +5 -2
  81. package/dist/conversion/shared/responses-conversation-store.js +1 -1
  82. package/dist/conversion/shared/responses-output-builder.js +55 -11
  83. package/dist/conversion/shared/responses-reasoning-registry.d.ts +14 -2
  84. package/dist/conversion/shared/responses-reasoning-registry.js +34 -6
  85. package/dist/conversion/shared/responses-response-utils.js +99 -9
  86. package/dist/conversion/shared/responses-tool-utils.js +1 -1
  87. package/dist/conversion/shared/text-markup-normalizer/normalize.d.ts +1 -1
  88. package/dist/conversion/shared/text-markup-normalizer.d.ts +2 -2
  89. package/dist/conversion/shared/text-markup-normalizer.js +1 -1
  90. package/dist/conversion/shared/tool-filter-pipeline.js +1 -1
  91. package/dist/conversion/shared/tool-governor.js +3 -3
  92. package/dist/conversion/shared/tool-mapping.d.ts +1 -1
  93. package/dist/conversion/{shared/snapshot-utils.d.ts → snapshot-utils.d.ts} +11 -0
  94. package/dist/conversion/{shared/snapshot-utils.js → snapshot-utils.js} +14 -23
  95. package/dist/conversion/types/text-markup-normalizer.d.ts +13 -0
  96. package/dist/conversion/types/text-markup-normalizer.js +1 -0
  97. package/dist/filters/special/request-tools-normalize.js +1 -1
  98. package/dist/filters/special/response-tool-text-canonicalize.js +2 -2
  99. package/dist/native/router_hotpath_napi.node +0 -0
  100. package/dist/quota/quota-manager.js +31 -59
  101. package/dist/quota/quota-state.js +14 -7
  102. package/dist/router/virtual-router/bootstrap/profile-builder.d.ts +1 -0
  103. package/dist/router/virtual-router/bootstrap/profile-builder.js +13 -0
  104. package/dist/router/virtual-router/bootstrap/provider-normalization.d.ts +2 -0
  105. package/dist/router/virtual-router/bootstrap/provider-normalization.js +4 -1
  106. package/dist/router/virtual-router/bootstrap/streaming-helpers.d.ts +7 -0
  107. package/dist/router/virtual-router/bootstrap/streaming-helpers.js +44 -0
  108. package/dist/router/virtual-router/bootstrap.js +2 -0
  109. package/dist/router/virtual-router/engine/routing-state/store.d.ts +1 -2
  110. package/dist/router/virtual-router/engine/routing-state/store.js +2 -2
  111. package/dist/router/virtual-router/engine-legacy/config.d.ts +11 -0
  112. package/dist/router/virtual-router/engine-legacy/config.js +108 -0
  113. package/dist/router/virtual-router/engine-legacy/direct-model.d.ts +10 -0
  114. package/dist/router/virtual-router/engine-legacy/direct-model.js +38 -0
  115. package/dist/router/virtual-router/engine-legacy/health.d.ts +13 -0
  116. package/dist/router/virtual-router/engine-legacy/health.js +104 -0
  117. package/dist/router/virtual-router/engine-legacy/helpers.d.ts +16 -0
  118. package/dist/router/virtual-router/engine-legacy/helpers.js +226 -0
  119. package/dist/router/virtual-router/engine-legacy/route-finalize.d.ts +9 -0
  120. package/dist/router/virtual-router/engine-legacy/route-finalize.js +84 -0
  121. package/dist/router/virtual-router/engine-legacy/route-selection.d.ts +17 -0
  122. package/dist/router/virtual-router/engine-legacy/route-selection.js +205 -0
  123. package/dist/router/virtual-router/engine-legacy/route-state-allowlist.d.ts +3 -0
  124. package/dist/router/virtual-router/engine-legacy/route-state-allowlist.js +36 -0
  125. package/dist/router/virtual-router/engine-legacy/route-state.d.ts +12 -0
  126. package/dist/router/virtual-router/engine-legacy/route-state.js +386 -0
  127. package/dist/router/virtual-router/engine-legacy/route-utils.d.ts +19 -0
  128. package/dist/router/virtual-router/engine-legacy/route-utils.js +212 -0
  129. package/dist/router/virtual-router/engine-legacy/routing.d.ts +8 -0
  130. package/dist/router/virtual-router/engine-legacy/routing.js +8 -0
  131. package/dist/router/virtual-router/engine-legacy/selection-core.d.ts +28 -0
  132. package/dist/router/virtual-router/engine-legacy/selection-core.js +112 -0
  133. package/dist/router/virtual-router/engine-legacy/selection-state.d.ts +16 -0
  134. package/dist/router/virtual-router/engine-legacy/selection-state.js +187 -0
  135. package/dist/router/virtual-router/engine-legacy/state-accessors.d.ts +21 -0
  136. package/dist/router/virtual-router/engine-legacy/state-accessors.js +118 -0
  137. package/dist/router/virtual-router/engine-legacy.d.ts +123 -0
  138. package/dist/router/virtual-router/engine-legacy.js +194 -0
  139. package/dist/router/virtual-router/engine-logging.d.ts +2 -0
  140. package/dist/router/virtual-router/engine-logging.js +7 -2
  141. package/dist/router/virtual-router/engine-selection/key-parsing.js +0 -3
  142. package/dist/router/virtual-router/engine-selection/native-chat-request-filter-semantics.d.ts +1 -0
  143. package/dist/router/virtual-router/engine-selection/native-chat-request-filter-semantics.js +54 -0
  144. package/dist/router/virtual-router/engine-selection/native-hub-bridge-policy-semantics.d.ts +10 -0
  145. package/dist/router/virtual-router/engine-selection/native-hub-bridge-policy-semantics.js +67 -0
  146. package/dist/router/virtual-router/engine-selection/native-hub-pipeline-governance-semantics.d.ts +22 -0
  147. package/dist/router/virtual-router/engine-selection/native-hub-pipeline-governance-semantics.js +154 -0
  148. package/dist/router/virtual-router/engine-selection/native-router-hotpath-loader.js +38 -2
  149. package/dist/router/virtual-router/engine-selection/native-shared-conversion-semantics.d.ts +75 -0
  150. package/dist/router/virtual-router/engine-selection/native-shared-conversion-semantics.js +205 -0
  151. package/dist/router/virtual-router/engine-selection/native-snapshot-hooks.d.ts +2 -0
  152. package/dist/router/virtual-router/engine-selection/native-snapshot-hooks.js +69 -0
  153. package/dist/router/virtual-router/engine-selection/native-virtual-router-engine-proxy.d.ts +16 -0
  154. package/dist/router/virtual-router/engine-selection/native-virtual-router-engine-proxy.js +14 -0
  155. package/dist/router/virtual-router/engine-selection/native-virtual-router-routing-instructions-semantics.d.ts +2 -0
  156. package/dist/router/virtual-router/engine-selection/native-virtual-router-routing-instructions-semantics.js +86 -0
  157. package/dist/router/virtual-router/engine-selection/tier-selection-quota-integration.js +100 -0
  158. package/dist/router/virtual-router/engine-selection/tier-selection-select.js +99 -0
  159. package/dist/router/virtual-router/engine.d.ts +22 -105
  160. package/dist/router/virtual-router/engine.js +274 -1641
  161. package/dist/router/virtual-router/load-balancer.d.ts +8 -0
  162. package/dist/router/virtual-router/load-balancer.js +65 -2
  163. package/dist/router/virtual-router/provider-registry.js +2 -0
  164. package/dist/router/virtual-router/routing-instructions/clean.d.ts +3 -0
  165. package/dist/router/virtual-router/routing-instructions/clean.js +34 -0
  166. package/dist/router/virtual-router/routing-instructions/parse.d.ts +18 -0
  167. package/dist/router/virtual-router/routing-instructions/parse.js +377 -0
  168. package/dist/router/virtual-router/routing-instructions/state.d.ts +4 -0
  169. package/dist/router/virtual-router/routing-instructions/state.js +245 -0
  170. package/dist/router/virtual-router/routing-instructions/types.d.ts +70 -0
  171. package/dist/router/virtual-router/routing-instructions/types.js +2 -0
  172. package/dist/router/virtual-router/routing-instructions.d.ts +5 -89
  173. package/dist/router/virtual-router/routing-instructions.js +4 -655
  174. package/dist/router/virtual-router/sticky-session-store.d.ts +4 -0
  175. package/dist/router/virtual-router/sticky-session-store.js +19 -81
  176. package/dist/router/virtual-router/tool-signals.js +21 -3
  177. package/dist/router/virtual-router/types.d.ts +4 -0
  178. package/dist/servertool/clock/session-scope.js +32 -1
  179. package/dist/servertool/engine.js +79 -8
  180. package/dist/servertool/handlers/antigravity-thought-signature-bootstrap.js +1 -1
  181. package/dist/servertool/handlers/clock-auto.js +1 -1
  182. package/dist/servertool/handlers/clock.js +1 -1
  183. package/dist/servertool/handlers/compaction-detect.d.ts +1 -1
  184. package/dist/servertool/handlers/compaction-detect.js +1 -1
  185. package/dist/servertool/handlers/gemini-empty-reply-continue.js +1 -1
  186. package/dist/servertool/handlers/iflow-model-error-retry.js +1 -1
  187. package/dist/servertool/handlers/recursive-detection-guard.js +1 -1
  188. package/dist/servertool/handlers/review.js +1 -1
  189. package/dist/servertool/handlers/stop-message-auto/iflow-followup.js +1 -1
  190. package/dist/servertool/handlers/stop-message-auto/runtime-utils.js +1 -1
  191. package/dist/servertool/handlers/stop-message-auto.js +1 -1
  192. package/dist/servertool/handlers/vision.js +1 -1
  193. package/dist/servertool/handlers/web-search.js +1 -1
  194. package/dist/servertool/reenter-backend.js +1 -1
  195. package/dist/servertool/server-side-tools.js +2 -2
  196. package/dist/servertool/stop-gateway-context.js +1 -1
  197. package/dist/servertool/stop-message-compare-context.js +1 -1
  198. package/dist/sse/json-to-sse/event-generators/responses.d.ts +4 -0
  199. package/dist/sse/json-to-sse/event-generators/responses.js +95 -1
  200. package/dist/sse/json-to-sse/sequencers/responses-sequencer.js +6 -4
  201. package/dist/sse/sse-to-json/builders/response-builder.d.ts +8 -0
  202. package/dist/sse/sse-to-json/builders/response-builder.js +162 -4
  203. package/dist/sse/sse-to-json/responses-sse-to-json-converter.js +2 -0
  204. package/dist/sse/types/responses-types.d.ts +6 -2
  205. package/dist/tools/apply-patch/structured/coercion.js +5 -0
  206. package/dist/tools/args-json.js +29 -0
  207. package/package.json +8 -5
  208. package/dist/conversion/shared/args-mapping.js +0 -77
  209. package/dist/conversion/shared/compaction-detect.js +0 -4
  210. package/dist/conversion/shared/errors.js +0 -31
  211. package/dist/conversion/shared/media.js +0 -4
  212. package/dist/conversion/shared/payload-budget.js +0 -165
  213. package/dist/conversion/shared/protocol-field-allowlists.d.ts +0 -7
  214. package/dist/conversion/shared/protocol-field-allowlists.js +0 -149
  215. package/dist/conversion/shared/snapshot-hooks.d.ts +0 -11
  216. package/dist/conversion/shared/snapshot-hooks.js +0 -503
  217. package/dist/conversion/shared/text-markup-normalizer/extractors-apply-patch.d.ts +0 -2
  218. package/dist/conversion/shared/text-markup-normalizer/extractors-apply-patch.js +0 -129
  219. package/dist/conversion/shared/text-markup-normalizer/extractors-json.d.ts +0 -4
  220. package/dist/conversion/shared/text-markup-normalizer/extractors-json.js +0 -637
  221. package/dist/conversion/shared/text-markup-normalizer/extractors-shared.d.ts +0 -21
  222. package/dist/conversion/shared/text-markup-normalizer/extractors-shared.js +0 -177
  223. package/dist/conversion/shared/text-markup-normalizer/extractors-transcript.d.ts +0 -5
  224. package/dist/conversion/shared/text-markup-normalizer/extractors-transcript.js +0 -385
  225. package/dist/conversion/shared/text-markup-normalizer/extractors-xml.d.ts +0 -10
  226. package/dist/conversion/shared/text-markup-normalizer/extractors-xml.js +0 -602
  227. package/dist/conversion/shared/text-markup-normalizer/extractors.d.ts +0 -5
  228. package/dist/conversion/shared/text-markup-normalizer/extractors.js +0 -4
  229. package/dist/conversion/shared/tool-canonicalizer.d.ts +0 -2
  230. package/dist/conversion/shared/tool-canonicalizer.js +0 -38
  231. /package/dist/conversion/{shared/args-mapping.d.ts → args-mapping.d.ts} +0 -0
  232. /package/dist/conversion/{shared/bridge-actions.d.ts → bridge-actions.d.ts} +0 -0
  233. /package/dist/conversion/{shared/bridge-id-utils.d.ts → bridge-id-utils.d.ts} +0 -0
  234. /package/dist/conversion/{shared/bridge-instructions.d.ts → bridge-instructions.d.ts} +0 -0
  235. /package/dist/conversion/{shared/bridge-metadata.d.ts → bridge-metadata.d.ts} +0 -0
  236. /package/dist/conversion/{shared/bridge-policies.d.ts → bridge-policies.d.ts} +0 -0
  237. /package/dist/conversion/{shared/jsonish.d.ts → jsonish.d.ts} +0 -0
  238. /package/dist/conversion/{shared/mcp-injection.d.ts → mcp-injection.d.ts} +0 -0
  239. /package/dist/conversion/{shared/media.d.ts → media.d.ts} +0 -0
  240. /package/dist/conversion/{shared/payload-budget.d.ts → payload-budget.d.ts} +0 -0
  241. /package/dist/conversion/{shared → types}/bridge-message-types.d.ts +0 -0
  242. /package/dist/conversion/{shared → types}/bridge-message-types.js +0 -0
@@ -41,28 +41,6 @@
41
41
  }
42
42
  }
43
43
  },
44
- {
45
- "action": "harvest_tool_calls_from_text",
46
- "config": {
47
- "normalizer": {
48
- "jsonToolRepair": {
49
- "toolNameAliases": {
50
- "shell_command": "exec_command",
51
- "shell": "exec_command",
52
- "bash": "exec_command",
53
- "terminal": "exec_command"
54
- },
55
- "argumentAliases": {
56
- "exec_command": {
57
- "cmd": ["cmd", "command", "input.command", "script"],
58
- "command": ["cmd", "command", "input.command", "script"],
59
- "workdir": ["workdir", "cwd", "input.cwd"]
60
- }
61
- }
62
- }
63
- }
64
- }
65
- },
66
44
  { "action": "snapshot", "phase": "compat-post" }
67
45
  ]
68
46
  }
@@ -3,8 +3,13 @@
3
3
  "protocol": "openai-chat",
4
4
  "request": {
5
5
  "mappings": [
6
- { "action": "snapshot", "phase": "compat-pre" },
7
- { "action": "dto_unwrap" },
6
+ {
7
+ "action": "snapshot",
8
+ "phase": "compat-pre"
9
+ },
10
+ {
11
+ "action": "dto_unwrap"
12
+ },
8
13
  {
9
14
  "action": "remove",
10
15
  "path": "parallel_tool_calls"
@@ -30,11 +35,27 @@
30
35
  "config": {
31
36
  "request": {
32
37
  "allowTopLevel": [
33
- "model", "messages", "stream", "thinking", "do_sample", "temperature", "top_p",
34
- "max_tokens", "tools", "tool_choice", "stop", "response_format", "web_search"
38
+ "model",
39
+ "messages",
40
+ "stream",
41
+ "thinking",
42
+ "do_sample",
43
+ "temperature",
44
+ "top_p",
45
+ "max_tokens",
46
+ "tools",
47
+ "tool_choice",
48
+ "stop",
49
+ "response_format",
50
+ "web_search"
35
51
  ],
36
52
  "messages": {
37
- "allowedRoles": ["system", "user", "assistant", "tool"],
53
+ "allowedRoles": [
54
+ "system",
55
+ "user",
56
+ "assistant",
57
+ "tool"
58
+ ],
38
59
  "assistantWithToolCallsContentNull": true,
39
60
  "toolContentStringify": false
40
61
  },
@@ -43,25 +64,61 @@
43
64
  "normalize": false,
44
65
  "forceToolChoiceAuto": true
45
66
  },
46
- "assistantToolCalls": { "functionArgumentsType": "string" }
67
+ "assistantToolCalls": {
68
+ "functionArgumentsType": "string"
69
+ }
47
70
  },
48
71
  "response": {
49
72
  "allowTopLevel": [
50
- "id", "request_id", "created", "model",
51
- "choices", "usage", "video_result", "web_search", "content_filter",
52
- "required_action", "output", "output_text", "status"
73
+ "id",
74
+ "request_id",
75
+ "created",
76
+ "model",
77
+ "choices",
78
+ "usage",
79
+ "video_result",
80
+ "web_search",
81
+ "content_filter",
82
+ "required_action",
83
+ "output",
84
+ "output_text",
85
+ "status"
53
86
  ],
54
87
  "choices": {
55
88
  "required": true,
56
89
  "message": {
57
- "allow": ["role", "content", "reasoning_content", "audio", "tool_calls"],
90
+ "allow": [
91
+ "role",
92
+ "content",
93
+ "reasoning_content",
94
+ "audio",
95
+ "tool_calls"
96
+ ],
58
97
  "roleDefault": "assistant",
59
98
  "contentNullWhenToolCalls": true,
60
- "tool_calls": { "function": { "nameRequired": true, "argumentsType": "string" } }
99
+ "tool_calls": {
100
+ "function": {
101
+ "nameRequired": true,
102
+ "argumentsType": "string"
103
+ }
104
+ }
61
105
  },
62
- "finish_reason": ["stop", "tool_calls", "length", "sensitive", "network_error"]
106
+ "finish_reason": [
107
+ "stop",
108
+ "tool_calls",
109
+ "length",
110
+ "sensitive",
111
+ "network_error"
112
+ ]
63
113
  },
64
- "usage": { "allow": ["prompt_tokens", "completion_tokens", "prompt_tokens_details", "total_tokens"] }
114
+ "usage": {
115
+ "allow": [
116
+ "prompt_tokens",
117
+ "completion_tokens",
118
+ "prompt_tokens_details",
119
+ "total_tokens"
120
+ ]
121
+ }
65
122
  }
66
123
  }
67
124
  },
@@ -70,19 +127,31 @@
70
127
  "config": {
71
128
  "tools": {
72
129
  "function": {
73
- "removeKeys": ["strict", "json_schema"]
130
+ "removeKeys": [
131
+ "strict",
132
+ "json_schema"
133
+ ]
74
134
  }
75
135
  },
76
136
  "messages": {
77
137
  "assistantToolCalls": {
78
138
  "function": {
79
- "removeKeys": ["strict"]
139
+ "removeKeys": [
140
+ "strict"
141
+ ]
80
142
  }
81
143
  }
82
144
  },
83
145
  "topLevel": {
84
146
  "conditional": [
85
- { "when": { "tools": "empty" }, "remove": ["tool_choice"] }
147
+ {
148
+ "when": {
149
+ "tools": "empty"
150
+ },
151
+ "remove": [
152
+ "tool_choice"
153
+ ]
154
+ }
86
155
  ]
87
156
  }
88
157
  }
@@ -91,11 +160,32 @@
91
160
  "action": "field_map",
92
161
  "direction": "incoming",
93
162
  "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" },
163
+ {
164
+ "sourcePath": "usage.prompt_tokens",
165
+ "targetPath": "usage.input_tokens",
166
+ "type": "number"
167
+ },
168
+ {
169
+ "sourcePath": "usage.completion_tokens",
170
+ "targetPath": "usage.output_tokens",
171
+ "type": "number"
172
+ },
173
+ {
174
+ "sourcePath": "created",
175
+ "targetPath": "created_at",
176
+ "type": "number"
177
+ },
178
+ {
179
+ "sourcePath": "request_id",
180
+ "targetPath": "request_id",
181
+ "type": "string"
182
+ },
183
+ {
184
+ "sourcePath": "model",
185
+ "targetPath": "model",
186
+ "type": "string",
187
+ "transform": "normalizeModelName"
188
+ },
99
189
  {
100
190
  "sourcePath": "choices[*].message.tool_calls[*].function.arguments",
101
191
  "targetPath": "choices[*].message.tool_calls[*].function.arguments",
@@ -103,29 +193,51 @@
103
193
  }
104
194
  ]
105
195
  },
106
- { "action": "tool_schema_sanitize", "mode": "glm_shell" },
196
+ {
197
+ "action": "tool_schema_sanitize",
198
+ "mode": "glm_shell"
199
+ },
107
200
  {
108
201
  "action": "glm_web_search_request"
109
202
  },
110
203
  {
111
204
  "action": "auto_thinking",
112
205
  "config": {
113
- "modelPrefixes": ["glm-4.7", "glm-4.6", "glm-4.5", "glm-z1"],
114
- "excludePrefixes": ["glm-4.6v"]
206
+ "modelPrefixes": [
207
+ "glm-4.7",
208
+ "glm-4.6",
209
+ "glm-4.5",
210
+ "glm-z1"
211
+ ],
212
+ "excludePrefixes": [
213
+ "glm-4.6v"
214
+ ]
115
215
  }
116
216
  },
117
- { "action": "snapshot", "phase": "compat-post" },
118
- { "action": "dto_rewrap" }
217
+ {
218
+ "action": "snapshot",
219
+ "phase": "compat-post"
220
+ },
221
+ {
222
+ "action": "dto_rewrap"
223
+ }
119
224
  ]
120
225
  },
121
226
  "response": {
122
227
  "mappings": [
123
- { "action": "snapshot", "phase": "compat-pre" },
124
- { "action": "dto_unwrap" },
228
+ {
229
+ "action": "snapshot",
230
+ "phase": "compat-pre"
231
+ },
232
+ {
233
+ "action": "dto_unwrap"
234
+ },
125
235
  {
126
236
  "action": "resp_blacklist",
127
237
  "config": {
128
- "paths": ["usage.prompt_tokens_details.cached_tokens"],
238
+ "paths": [
239
+ "usage.prompt_tokens_details.cached_tokens"
240
+ ],
129
241
  "keepCritical": true
130
242
  }
131
243
  },
@@ -135,11 +247,26 @@
135
247
  "config": {
136
248
  "request": {
137
249
  "allowTopLevel": [
138
- "model", "messages", "stream", "thinking", "do_sample", "temperature", "top_p",
139
- "max_tokens", "tools", "tool_choice", "stop", "response_format"
250
+ "model",
251
+ "messages",
252
+ "stream",
253
+ "thinking",
254
+ "do_sample",
255
+ "temperature",
256
+ "top_p",
257
+ "max_tokens",
258
+ "tools",
259
+ "tool_choice",
260
+ "stop",
261
+ "response_format"
140
262
  ],
141
263
  "messages": {
142
- "allowedRoles": ["system", "user", "assistant", "tool"],
264
+ "allowedRoles": [
265
+ "system",
266
+ "user",
267
+ "assistant",
268
+ "tool"
269
+ ],
143
270
  "assistantWithToolCallsContentNull": true,
144
271
  "toolContentStringify": false
145
272
  },
@@ -148,25 +275,61 @@
148
275
  "normalize": false,
149
276
  "forceToolChoiceAuto": true
150
277
  },
151
- "assistantToolCalls": { "functionArgumentsType": "string" }
278
+ "assistantToolCalls": {
279
+ "functionArgumentsType": "string"
280
+ }
152
281
  },
153
282
  "response": {
154
283
  "allowTopLevel": [
155
- "id", "request_id", "created", "model",
156
- "choices", "usage", "video_result", "web_search", "content_filter",
157
- "required_action", "output", "output_text", "status"
284
+ "id",
285
+ "request_id",
286
+ "created",
287
+ "model",
288
+ "choices",
289
+ "usage",
290
+ "video_result",
291
+ "web_search",
292
+ "content_filter",
293
+ "required_action",
294
+ "output",
295
+ "output_text",
296
+ "status"
158
297
  ],
159
298
  "choices": {
160
299
  "required": true,
161
300
  "message": {
162
- "allow": ["role", "content", "reasoning_content", "audio", "tool_calls"],
301
+ "allow": [
302
+ "role",
303
+ "content",
304
+ "reasoning_content",
305
+ "audio",
306
+ "tool_calls"
307
+ ],
163
308
  "roleDefault": "assistant",
164
309
  "contentNullWhenToolCalls": true,
165
- "tool_calls": { "function": { "nameRequired": true, "argumentsType": "string" } }
310
+ "tool_calls": {
311
+ "function": {
312
+ "nameRequired": true,
313
+ "argumentsType": "string"
314
+ }
315
+ }
166
316
  },
167
- "finish_reason": ["stop", "tool_calls", "length", "sensitive", "network_error"]
317
+ "finish_reason": [
318
+ "stop",
319
+ "tool_calls",
320
+ "length",
321
+ "sensitive",
322
+ "network_error"
323
+ ]
168
324
  },
169
- "usage": { "allow": ["prompt_tokens", "completion_tokens", "prompt_tokens_details", "total_tokens"] }
325
+ "usage": {
326
+ "allow": [
327
+ "prompt_tokens",
328
+ "completion_tokens",
329
+ "prompt_tokens_details",
330
+ "total_tokens"
331
+ ]
332
+ }
170
333
  }
171
334
  }
172
335
  },
@@ -174,12 +337,36 @@
174
337
  "action": "field_map",
175
338
  "direction": "outgoing",
176
339
  "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" },
340
+ {
341
+ "sourcePath": "usage.input_tokens",
342
+ "targetPath": "usage.prompt_tokens",
343
+ "type": "number"
344
+ },
345
+ {
346
+ "sourcePath": "usage.output_tokens",
347
+ "targetPath": "usage.completion_tokens",
348
+ "type": "number"
349
+ },
350
+ {
351
+ "sourcePath": "usage.total_input_tokens",
352
+ "targetPath": "usage.prompt_tokens",
353
+ "type": "number"
354
+ },
355
+ {
356
+ "sourcePath": "usage.total_output_tokens",
357
+ "targetPath": "usage.completion_tokens",
358
+ "type": "number"
359
+ },
360
+ {
361
+ "sourcePath": "created_at",
362
+ "targetPath": "created",
363
+ "type": "number"
364
+ },
365
+ {
366
+ "sourcePath": "request_id",
367
+ "targetPath": "request_id",
368
+ "type": "string"
369
+ },
183
370
  {
184
371
  "sourcePath": "choices[*].finish_reason",
185
372
  "targetPath": "choices[*].finish_reason",
@@ -193,34 +380,26 @@
193
380
  }
194
381
  ]
195
382
  },
196
- { "action": "tool_schema_sanitize", "mode": "glm_shell" },
197
- { "action": "response_normalize" },
198
- { "action": "extract_glm_tool_markup" },
199
383
  {
200
- "action": "harvest_tool_calls_from_text",
201
- "config": {
202
- "normalizer": {
203
- "jsonToolRepair": {
204
- "toolNameAliases": {
205
- "shell_command": "exec_command",
206
- "shell": "exec_command",
207
- "bash": "exec_command",
208
- "terminal": "exec_command"
209
- },
210
- "argumentAliases": {
211
- "exec_command": {
212
- "cmd": ["cmd", "command", "input.command", "script"],
213
- "command": ["cmd", "command", "input.command", "script"],
214
- "workdir": ["workdir", "cwd", "input.cwd"]
215
- }
216
- }
217
- }
218
- }
219
- }
384
+ "action": "tool_schema_sanitize",
385
+ "mode": "glm_shell"
386
+ },
387
+ {
388
+ "action": "response_normalize"
220
389
  },
221
- { "action": "response_validate" },
222
- { "action": "snapshot", "phase": "compat-post" },
223
- { "action": "dto_rewrap" }
390
+ {
391
+ "action": "extract_glm_tool_markup"
392
+ },
393
+ {
394
+ "action": "response_validate"
395
+ },
396
+ {
397
+ "action": "snapshot",
398
+ "phase": "compat-post"
399
+ },
400
+ {
401
+ "action": "dto_rewrap"
402
+ }
224
403
  ]
225
404
  }
226
405
  }