@jsonstudio/rcc 0.89.168 → 0.89.333

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 (323) hide show
  1. package/README.md +18 -15
  2. package/dist/build-info.js +2 -2
  3. package/dist/cli.js +32 -0
  4. package/dist/cli.js.map +1 -1
  5. package/dist/client/gemini-cli/gemini-cli-protocol-client.js +28 -5
  6. package/dist/client/gemini-cli/gemini-cli-protocol-client.js.map +1 -1
  7. package/dist/error-handling/quiet-error-handling-center.d.ts +9 -0
  8. package/dist/error-handling/quiet-error-handling-center.js +141 -0
  9. package/dist/error-handling/quiet-error-handling-center.js.map +1 -0
  10. package/dist/error-handling/route-error-hub.js +8 -2
  11. package/dist/error-handling/route-error-hub.js.map +1 -1
  12. package/dist/modules/pipeline/utils/colored-logger.d.ts +2 -0
  13. package/dist/modules/pipeline/utils/colored-logger.js +20 -3
  14. package/dist/modules/pipeline/utils/colored-logger.js.map +1 -1
  15. package/dist/providers/auth/antigravity-userinfo-helper.d.ts +10 -0
  16. package/dist/providers/auth/antigravity-userinfo-helper.js +140 -0
  17. package/dist/providers/auth/antigravity-userinfo-helper.js.map +1 -0
  18. package/dist/providers/auth/oauth-lifecycle.js +140 -8
  19. package/dist/providers/auth/oauth-lifecycle.js.map +1 -1
  20. package/dist/providers/auth/token-scanner/index.d.ts +32 -0
  21. package/dist/providers/auth/token-scanner/index.js +86 -0
  22. package/dist/providers/auth/token-scanner/index.js.map +1 -0
  23. package/dist/providers/auth/tokenfile-auth.d.ts +17 -0
  24. package/dist/providers/auth/tokenfile-auth.js +27 -5
  25. package/dist/providers/auth/tokenfile-auth.js.map +1 -1
  26. package/dist/providers/core/api/provider-types.d.ts +10 -0
  27. package/dist/providers/core/config/oauth-flows.d.ts +2 -0
  28. package/dist/providers/core/config/oauth-flows.js.map +1 -1
  29. package/dist/providers/core/config/provider-oauth-configs.js +85 -0
  30. package/dist/providers/core/config/provider-oauth-configs.js.map +1 -1
  31. package/dist/providers/core/runtime/base-provider.d.ts +2 -0
  32. package/dist/providers/core/runtime/base-provider.js +135 -15
  33. package/dist/providers/core/runtime/base-provider.js.map +1 -1
  34. package/dist/providers/core/runtime/gemini-cli-http-provider.d.ts +8 -3
  35. package/dist/providers/core/runtime/gemini-cli-http-provider.js +262 -64
  36. package/dist/providers/core/runtime/gemini-cli-http-provider.js.map +1 -1
  37. package/dist/providers/core/runtime/http-transport-provider.d.ts +25 -0
  38. package/dist/providers/core/runtime/http-transport-provider.js +305 -67
  39. package/dist/providers/core/runtime/http-transport-provider.js.map +1 -1
  40. package/dist/providers/core/runtime/provider-error-classifier.d.ts +2 -2
  41. package/dist/providers/core/runtime/provider-error-classifier.js +14 -4
  42. package/dist/providers/core/runtime/provider-error-classifier.js.map +1 -1
  43. package/dist/providers/core/runtime/provider-factory.d.ts +1 -0
  44. package/dist/providers/core/runtime/provider-factory.js +37 -8
  45. package/dist/providers/core/runtime/provider-factory.js.map +1 -1
  46. package/dist/providers/core/runtime/responses-provider.d.ts +3 -3
  47. package/dist/providers/core/runtime/responses-provider.js +48 -114
  48. package/dist/providers/core/runtime/responses-provider.js.map +1 -1
  49. package/dist/providers/core/strategies/oauth-auth-code-flow.js +11 -3
  50. package/dist/providers/core/strategies/oauth-auth-code-flow.js.map +1 -1
  51. package/dist/providers/core/utils/http-client.d.ts +5 -0
  52. package/dist/providers/core/utils/http-client.js +29 -3
  53. package/dist/providers/core/utils/http-client.js.map +1 -1
  54. package/dist/providers/core/utils/provider-error-reporter.js +8 -2
  55. package/dist/providers/core/utils/provider-error-reporter.js.map +1 -1
  56. package/dist/providers/core/utils/snapshot-writer.js +5 -1
  57. package/dist/providers/core/utils/snapshot-writer.js.map +1 -1
  58. package/dist/providers/profile/provider-profile-loader.js +8 -4
  59. package/dist/providers/profile/provider-profile-loader.js.map +1 -1
  60. package/dist/runtime/runtime-flags.d.ts +4 -0
  61. package/dist/runtime/runtime-flags.js +32 -0
  62. package/dist/runtime/runtime-flags.js.map +1 -0
  63. package/dist/server/handlers/handler-utils.js +29 -2
  64. package/dist/server/handlers/handler-utils.js.map +1 -1
  65. package/dist/server/handlers/messages-handler.js +27 -26
  66. package/dist/server/handlers/messages-handler.js.map +1 -1
  67. package/dist/server/handlers/responses-handler.js +35 -1
  68. package/dist/server/handlers/responses-handler.js.map +1 -1
  69. package/dist/server/runtime/http-server/index.d.ts +1 -0
  70. package/dist/server/runtime/http-server/index.js +39 -4
  71. package/dist/server/runtime/http-server/index.js.map +1 -1
  72. package/dist/server/runtime/http-server/request-executor.d.ts +4 -0
  73. package/dist/server/runtime/http-server/request-executor.js +99 -4
  74. package/dist/server/runtime/http-server/request-executor.js.map +1 -1
  75. package/dist/server/utils/sse-request-parser.d.ts +1 -0
  76. package/dist/server/utils/sse-request-parser.js +17 -6
  77. package/dist/server/utils/sse-request-parser.js.map +1 -1
  78. package/dist/server/utils/warmup-detector.d.ts +7 -0
  79. package/dist/server/utils/warmup-detector.js +125 -0
  80. package/dist/server/utils/warmup-detector.js.map +1 -0
  81. package/dist/server/utils/warmup-storm-tracker.d.ts +9 -0
  82. package/dist/server/utils/warmup-storm-tracker.js +61 -0
  83. package/dist/server/utils/warmup-storm-tracker.js.map +1 -0
  84. package/dist/utils/debug-utils.js +14 -0
  85. package/dist/utils/debug-utils.js.map +1 -1
  86. package/dist/utils/error-handler-registry.js +6 -5
  87. package/dist/utils/error-handler-registry.js.map +1 -1
  88. package/dist/utils/error-handling-utils.js +4 -3
  89. package/dist/utils/error-handling-utils.js.map +1 -1
  90. package/dist/utils/log-helpers.d.ts +6 -0
  91. package/dist/utils/log-helpers.js +90 -0
  92. package/dist/utils/log-helpers.js.map +1 -0
  93. package/dist/utils/logger.d.ts +8 -0
  94. package/dist/utils/logger.js +55 -2
  95. package/dist/utils/logger.js.map +1 -1
  96. package/dist/utils/snapshot-writer.js +2 -6
  97. package/dist/utils/snapshot-writer.js.map +1 -1
  98. package/node_modules/@jsonstudio/llms/dist/conversion/codecs/gemini-openai-codec.js +15 -1
  99. package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/auto-thinking.d.ts +6 -0
  100. package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/auto-thinking.js +25 -0
  101. package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/field-mapping.d.ts +14 -0
  102. package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/field-mapping.js +155 -0
  103. package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/glm-tool-extraction.d.ts +2 -0
  104. package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/glm-tool-extraction.js +264 -0
  105. package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/qwen-transform.d.ts +3 -0
  106. package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/qwen-transform.js +209 -0
  107. package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/request-rules.d.ts +24 -0
  108. package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/request-rules.js +63 -0
  109. package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/response-blacklist.d.ts +14 -0
  110. package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/response-blacklist.js +85 -0
  111. package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/response-normalize.d.ts +5 -0
  112. package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/response-normalize.js +121 -0
  113. package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/response-validate.d.ts +5 -0
  114. package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/response-validate.js +76 -0
  115. package/{dist/providers/compat/utils/snapshot-writer.d.ts → node_modules/@jsonstudio/llms/dist/conversion/compat/actions/snapshot.d.ts} +2 -2
  116. package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/snapshot.js +21 -0
  117. package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/tool-schema.d.ts +6 -0
  118. package/{dist/providers/compat/glm/utils/tool-schema-helpers.js → node_modules/@jsonstudio/llms/dist/conversion/compat/actions/tool-schema.js} +6 -1
  119. package/{dist/providers/compat/filters → node_modules/@jsonstudio/llms/dist/conversion/compat/actions}/universal-shape-filter.d.ts +17 -22
  120. package/{dist/providers/compat/filters → node_modules/@jsonstudio/llms/dist/conversion/compat/actions}/universal-shape-filter.js +35 -99
  121. package/node_modules/@jsonstudio/llms/dist/conversion/compat/profiles/chat-glm.json +187 -13
  122. package/node_modules/@jsonstudio/llms/dist/conversion/compat/profiles/chat-iflow.json +177 -9
  123. package/node_modules/@jsonstudio/llms/dist/conversion/compat/profiles/chat-lmstudio.json +10 -2
  124. package/node_modules/@jsonstudio/llms/dist/conversion/compat/profiles/chat-qwen.json +14 -10
  125. package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/compat/compat-engine.d.ts +7 -2
  126. package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/compat/compat-engine.js +5 -665
  127. package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/compat/compat-pipeline-executor.d.ts +9 -0
  128. package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/compat/compat-pipeline-executor.js +845 -0
  129. package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/compat/compat-types.d.ts +47 -0
  130. package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/hub-pipeline.d.ts +2 -0
  131. package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/hub-pipeline.js +35 -1
  132. package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/stages/req_outbound/req_outbound_stage3_compat/index.js +2 -2
  133. package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/target-utils.js +3 -0
  134. package/node_modules/@jsonstudio/llms/dist/conversion/hub/response/response-runtime.js +19 -2
  135. package/node_modules/@jsonstudio/llms/dist/conversion/responses/responses-host-policy.d.ts +6 -0
  136. package/node_modules/@jsonstudio/llms/dist/conversion/responses/responses-host-policy.js +14 -0
  137. package/node_modules/@jsonstudio/llms/dist/conversion/responses/responses-openai-bridge.js +51 -2
  138. package/node_modules/@jsonstudio/llms/dist/conversion/shared/anthropic-message-utils.js +6 -0
  139. package/node_modules/@jsonstudio/llms/dist/conversion/shared/responses-reasoning-registry.d.ts +4 -0
  140. package/node_modules/@jsonstudio/llms/dist/conversion/shared/responses-reasoning-registry.js +62 -1
  141. package/node_modules/@jsonstudio/llms/dist/conversion/shared/responses-response-utils.js +23 -1
  142. package/node_modules/@jsonstudio/llms/dist/conversion/shared/tool-canonicalizer.d.ts +2 -0
  143. package/node_modules/@jsonstudio/llms/dist/conversion/shared/tool-filter-pipeline.js +11 -0
  144. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/bootstrap.js +251 -12
  145. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/classifier.js +11 -4
  146. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/context-advisor.d.ts +21 -0
  147. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/context-advisor.js +76 -0
  148. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine.d.ts +11 -0
  149. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine.js +187 -28
  150. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/features.js +22 -457
  151. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/health-manager.js +2 -7
  152. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/message-utils.d.ts +7 -0
  153. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/message-utils.js +66 -0
  154. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/provider-registry.js +6 -2
  155. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/token-estimator.d.ts +2 -0
  156. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/token-estimator.js +16 -0
  157. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/token-file-scanner.d.ts +15 -0
  158. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/token-file-scanner.js +56 -0
  159. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/tool-signals.d.ts +13 -0
  160. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/tool-signals.js +403 -0
  161. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/types.d.ts +21 -1
  162. package/node_modules/@jsonstudio/llms/dist/router/virtual-router/types.js +1 -0
  163. package/node_modules/@jsonstudio/llms/package.json +2 -2
  164. package/package.json +11 -10
  165. package/scripts/README.md +26 -12
  166. package/scripts/auth-antigravity-token.mjs +64 -0
  167. package/scripts/auth-gemini-cli-token.mjs +96 -0
  168. package/scripts/auth-iflow-manual.mjs +81 -0
  169. package/scripts/auth-iflow-token-direct.mjs +87 -0
  170. package/scripts/auth-iflow-token.mjs +77 -0
  171. package/scripts/copy-compat-assets.mjs +3 -15
  172. package/scripts/install-verify.mjs +1 -0
  173. package/scripts/replay-codex-sample.mjs +13 -8
  174. package/scripts/tests/chat-pipeline-blackbox.mjs +1 -1
  175. package/scripts/tools/capture-provider-goldens.mjs +8 -7
  176. package/scripts/verify-client-headers.mjs +224 -0
  177. package/dist/providers/compat/base-compatibility.d.ts +0 -27
  178. package/dist/providers/compat/base-compatibility.js +0 -143
  179. package/dist/providers/compat/base-compatibility.js.map +0 -1
  180. package/dist/providers/compat/compat-directory-loader.d.ts +0 -4
  181. package/dist/providers/compat/compat-directory-loader.js +0 -85
  182. package/dist/providers/compat/compat-directory-loader.js.map +0 -1
  183. package/dist/providers/compat/compatibility-adapter.d.ts +0 -18
  184. package/dist/providers/compat/compatibility-adapter.js +0 -104
  185. package/dist/providers/compat/compatibility-adapter.js.map +0 -1
  186. package/dist/providers/compat/compatibility-factory.d.ts +0 -57
  187. package/dist/providers/compat/compatibility-factory.js +0 -155
  188. package/dist/providers/compat/compatibility-factory.js.map +0 -1
  189. package/dist/providers/compat/compatibility-interface.d.ts +0 -35
  190. package/dist/providers/compat/compatibility-interface.js +0 -2
  191. package/dist/providers/compat/compatibility-interface.js.map +0 -1
  192. package/dist/providers/compat/compatibility-manager.d.ts +0 -85
  193. package/dist/providers/compat/compatibility-manager.js +0 -368
  194. package/dist/providers/compat/compatibility-manager.js.map +0 -1
  195. package/dist/providers/compat/config/config-compatibility.d.ts +0 -28
  196. package/dist/providers/compat/config/config-compatibility.js +0 -95
  197. package/dist/providers/compat/config/config-compatibility.js.map +0 -1
  198. package/dist/providers/compat/field-mapping.d.ts +0 -102
  199. package/dist/providers/compat/field-mapping.js +0 -447
  200. package/dist/providers/compat/field-mapping.js.map +0 -1
  201. package/dist/providers/compat/filters/blacklist-sanitizer.d.ts +0 -45
  202. package/dist/providers/compat/filters/blacklist-sanitizer.js +0 -133
  203. package/dist/providers/compat/filters/blacklist-sanitizer.js.map +0 -1
  204. package/dist/providers/compat/filters/response-blacklist-sanitizer.d.ts +0 -28
  205. package/dist/providers/compat/filters/response-blacklist-sanitizer.js +0 -138
  206. package/dist/providers/compat/filters/response-blacklist-sanitizer.js.map +0 -1
  207. package/dist/providers/compat/filters/universal-shape-filter.js.map +0 -1
  208. package/dist/providers/compat/glm/config/blacklist-rules.json +0 -22
  209. package/dist/providers/compat/glm/config/field-mappings.json +0 -92
  210. package/dist/providers/compat/glm/config/response-blacklist.json +0 -7
  211. package/dist/providers/compat/glm/config/shape-filters.json +0 -37
  212. package/dist/providers/compat/glm/field-mapping/field-mapping-processor.d.ts +0 -28
  213. package/dist/providers/compat/glm/field-mapping/field-mapping-processor.js +0 -306
  214. package/dist/providers/compat/glm/field-mapping/field-mapping-processor.js.map +0 -1
  215. package/dist/providers/compat/glm/functions/glm-processor.d.ts +0 -50
  216. package/dist/providers/compat/glm/functions/glm-processor.js +0 -134
  217. package/dist/providers/compat/glm/functions/glm-processor.js.map +0 -1
  218. package/dist/providers/compat/glm/glm-compatibility.d.ts +0 -34
  219. package/dist/providers/compat/glm/glm-compatibility.js +0 -117
  220. package/dist/providers/compat/glm/glm-compatibility.js.map +0 -1
  221. package/dist/providers/compat/glm/hooks/base-hook.d.ts +0 -21
  222. package/dist/providers/compat/glm/hooks/base-hook.js +0 -53
  223. package/dist/providers/compat/glm/hooks/base-hook.js.map +0 -1
  224. package/dist/providers/compat/glm/hooks/glm-request-validation-hook.d.ts +0 -24
  225. package/dist/providers/compat/glm/hooks/glm-request-validation-hook.js +0 -268
  226. package/dist/providers/compat/glm/hooks/glm-request-validation-hook.js.map +0 -1
  227. package/dist/providers/compat/glm/hooks/glm-response-normalization-hook.d.ts +0 -21
  228. package/dist/providers/compat/glm/hooks/glm-response-normalization-hook.js +0 -171
  229. package/dist/providers/compat/glm/hooks/glm-response-normalization-hook.js.map +0 -1
  230. package/dist/providers/compat/glm/hooks/glm-response-validation-hook.d.ts +0 -25
  231. package/dist/providers/compat/glm/hooks/glm-response-validation-hook.js +0 -236
  232. package/dist/providers/compat/glm/hooks/glm-response-validation-hook.js.map +0 -1
  233. package/dist/providers/compat/glm/hooks/glm-tool-cleaning-hook.d.ts +0 -26
  234. package/dist/providers/compat/glm/hooks/glm-tool-cleaning-hook.js +0 -186
  235. package/dist/providers/compat/glm/hooks/glm-tool-cleaning-hook.js.map +0 -1
  236. package/dist/providers/compat/glm/index.d.ts +0 -24
  237. package/dist/providers/compat/glm/index.js +0 -29
  238. package/dist/providers/compat/glm/index.js.map +0 -1
  239. package/dist/providers/compat/glm/utils/tool-schema-helpers.d.ts +0 -3
  240. package/dist/providers/compat/glm/utils/tool-schema-helpers.js.map +0 -1
  241. package/dist/providers/compat/iflow/config/field-mappings.json +0 -92
  242. package/dist/providers/compat/iflow/config/shape-filters.json +0 -37
  243. package/dist/providers/compat/iflow/field-mapping/iflow-field-mapping-processor.d.ts +0 -34
  244. package/dist/providers/compat/iflow/field-mapping/iflow-field-mapping-processor.js +0 -386
  245. package/dist/providers/compat/iflow/field-mapping/iflow-field-mapping-processor.js.map +0 -1
  246. package/dist/providers/compat/iflow/functions/iflow-processor.d.ts +0 -53
  247. package/dist/providers/compat/iflow/functions/iflow-processor.js +0 -215
  248. package/dist/providers/compat/iflow/functions/iflow-processor.js.map +0 -1
  249. package/dist/providers/compat/iflow/hooks/base-hook.d.ts +0 -23
  250. package/dist/providers/compat/iflow/hooks/base-hook.js +0 -59
  251. package/dist/providers/compat/iflow/hooks/base-hook.js.map +0 -1
  252. package/dist/providers/compat/iflow/hooks/iflow-request-validation-hook.d.ts +0 -23
  253. package/dist/providers/compat/iflow/hooks/iflow-request-validation-hook.js +0 -279
  254. package/dist/providers/compat/iflow/hooks/iflow-request-validation-hook.js.map +0 -1
  255. package/dist/providers/compat/iflow/hooks/iflow-response-normalization-hook.d.ts +0 -20
  256. package/dist/providers/compat/iflow/hooks/iflow-response-normalization-hook.js +0 -180
  257. package/dist/providers/compat/iflow/hooks/iflow-response-normalization-hook.js.map +0 -1
  258. package/dist/providers/compat/iflow/hooks/iflow-response-validation-hook.d.ts +0 -23
  259. package/dist/providers/compat/iflow/hooks/iflow-response-validation-hook.js +0 -232
  260. package/dist/providers/compat/iflow/hooks/iflow-response-validation-hook.js.map +0 -1
  261. package/dist/providers/compat/iflow/hooks/iflow-tool-cleaning-hook.d.ts +0 -25
  262. package/dist/providers/compat/iflow/hooks/iflow-tool-cleaning-hook.js +0 -216
  263. package/dist/providers/compat/iflow/hooks/iflow-tool-cleaning-hook.js.map +0 -1
  264. package/dist/providers/compat/iflow/iflow-compatibility.d.ts +0 -24
  265. package/dist/providers/compat/iflow/iflow-compatibility.js +0 -94
  266. package/dist/providers/compat/iflow/iflow-compatibility.js.map +0 -1
  267. package/dist/providers/compat/index.d.ts +0 -59
  268. package/dist/providers/compat/index.js +0 -83
  269. package/dist/providers/compat/index.js.map +0 -1
  270. package/dist/providers/compat/lmstudio-compatibility.d.ts +0 -44
  271. package/dist/providers/compat/lmstudio-compatibility.js +0 -193
  272. package/dist/providers/compat/lmstudio-compatibility.js.map +0 -1
  273. package/dist/providers/compat/passthrough-compatibility.d.ts +0 -29
  274. package/dist/providers/compat/passthrough-compatibility.js +0 -83
  275. package/dist/providers/compat/passthrough-compatibility.js.map +0 -1
  276. package/dist/providers/compat/profiles/chat/glm/index.d.ts +0 -6
  277. package/dist/providers/compat/profiles/chat/glm/index.js +0 -6
  278. package/dist/providers/compat/profiles/chat/glm/index.js.map +0 -1
  279. package/dist/providers/compat/profiles/chat/iflow/index.d.ts +0 -6
  280. package/dist/providers/compat/profiles/chat/iflow/index.js +0 -6
  281. package/dist/providers/compat/profiles/chat/iflow/index.js.map +0 -1
  282. package/dist/providers/compat/profiles/chat/lmstudio/index.d.ts +0 -6
  283. package/dist/providers/compat/profiles/chat/lmstudio/index.js +0 -6
  284. package/dist/providers/compat/profiles/chat/lmstudio/index.js.map +0 -1
  285. package/dist/providers/compat/profiles/chat/qwen/index.d.ts +0 -6
  286. package/dist/providers/compat/profiles/chat/qwen/index.js +0 -6
  287. package/dist/providers/compat/profiles/chat/qwen/index.js.map +0 -1
  288. package/dist/providers/compat/profiles/compat/passthrough/index.d.ts +0 -6
  289. package/dist/providers/compat/profiles/compat/passthrough/index.js +0 -6
  290. package/dist/providers/compat/profiles/compat/passthrough/index.js.map +0 -1
  291. package/dist/providers/compat/profiles/responses/c4m/index.d.ts +0 -6
  292. package/dist/providers/compat/profiles/responses/c4m/index.js +0 -6
  293. package/dist/providers/compat/profiles/responses/c4m/index.js.map +0 -1
  294. package/dist/providers/compat/profiles/responses/default/index.d.ts +0 -6
  295. package/dist/providers/compat/profiles/responses/default/index.js +0 -6
  296. package/dist/providers/compat/profiles/responses/default/index.js.map +0 -1
  297. package/dist/providers/compat/profiles/responses/fai/index.d.ts +0 -6
  298. package/dist/providers/compat/profiles/responses/fai/index.js +0 -6
  299. package/dist/providers/compat/profiles/responses/fai/index.js.map +0 -1
  300. package/dist/providers/compat/profiles/responses/fc/index.d.ts +0 -6
  301. package/dist/providers/compat/profiles/responses/fc/index.js +0 -6
  302. package/dist/providers/compat/profiles/responses/fc/index.js.map +0 -1
  303. package/dist/providers/compat/qwen/index.d.ts +0 -4
  304. package/dist/providers/compat/qwen/index.js +0 -6
  305. package/dist/providers/compat/qwen/index.js.map +0 -1
  306. package/dist/providers/compat/qwen-compatibility.d.ts +0 -52
  307. package/dist/providers/compat/qwen-compatibility.js +0 -330
  308. package/dist/providers/compat/qwen-compatibility.js.map +0 -1
  309. package/dist/providers/compat/register-compat-module.d.ts +0 -8
  310. package/dist/providers/compat/register-compat-module.js +0 -53
  311. package/dist/providers/compat/register-compat-module.js.map +0 -1
  312. package/dist/providers/compat/responses/c4m-responses-compatibility.d.ts +0 -27
  313. package/dist/providers/compat/responses/c4m-responses-compatibility.js +0 -197
  314. package/dist/providers/compat/responses/c4m-responses-compatibility.js.map +0 -1
  315. package/dist/providers/compat/standard-compatibility-utils.d.ts +0 -1
  316. package/dist/providers/compat/standard-compatibility-utils.js +0 -77
  317. package/dist/providers/compat/standard-compatibility-utils.js.map +0 -1
  318. package/dist/providers/compat/standard-compatibility.d.ts +0 -31
  319. package/dist/providers/compat/standard-compatibility.js +0 -118
  320. package/dist/providers/compat/standard-compatibility.js.map +0 -1
  321. package/dist/providers/compat/utils/snapshot-writer.js +0 -62
  322. package/dist/providers/compat/utils/snapshot-writer.js.map +0 -1
  323. package/scripts/check-glm-compat.mjs +0 -47
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env node
2
+ // Antigravity OAuth authentication script
3
+ // Usage:
4
+ // # 默认使用 ~/.routecodex/auth/antigravity-oauth.json(自动创建/更新)
5
+ // node scripts/auth-antigravity-token.mjs
6
+ //
7
+ // # 或通过环境变量显式指定 token 文件(支持 ~ 展开):
8
+ // // ANTIGRAVITY_TOKEN_FILE="~/.routecodex/auth/antigravity-oauth-alt.json" node scripts/auth-antigravity-token.mjs
9
+
10
+ import os from 'os';
11
+ import path from 'path';
12
+ import fs from 'fs/promises';
13
+
14
+ async function resolveAntigravityTokenPath() {
15
+ const envFile =
16
+ (process.env.ANTIGRAVITY_TOKEN_FILE && process.env.ANTIGRAVITY_TOKEN_FILE.trim()) ||
17
+ (process.env.ROUTECODEX_ANTIGRAVITY_TOKEN_FILE && process.env.ROUTECODEX_ANTIGRAVITY_TOKEN_FILE.trim()) ||
18
+ '';
19
+
20
+ if (envFile) {
21
+ const normalized = envFile.startsWith('~')
22
+ ? envFile.replace(/^~(?=$|\/)/, os.homedir())
23
+ : envFile;
24
+ return path.resolve(normalized);
25
+ }
26
+
27
+ const home = os.homedir();
28
+ return path.join(home, '.routecodex', 'auth', 'antigravity-oauth.json');
29
+ }
30
+
31
+ async function run() {
32
+ const tokenPath = await resolveAntigravityTokenPath();
33
+ const dir = path.dirname(tokenPath);
34
+ await fs.mkdir(dir, { recursive: true });
35
+ try {
36
+ await fs.access(tokenPath);
37
+ } catch {
38
+ await fs.writeFile(tokenPath, '{}', 'utf-8');
39
+ }
40
+
41
+ const { ensureValidOAuthToken } = await import('../dist/providers/auth/oauth-lifecycle.js');
42
+
43
+ console.log(`[antigravity-auth] Authenticating token: ${tokenPath}`);
44
+
45
+ await ensureValidOAuthToken(
46
+ 'antigravity',
47
+ {
48
+ type: 'antigravity-oauth',
49
+ tokenFile: tokenPath
50
+ },
51
+ {
52
+ forceReauthorize: true,
53
+ openBrowser: true
54
+ }
55
+ );
56
+
57
+ console.log(`[antigravity-auth] Token saved to: ${tokenPath}`);
58
+ }
59
+
60
+ run().catch((err) => {
61
+ console.error('[antigravity-auth] Error:', err);
62
+ process.exit(1);
63
+ });
64
+
@@ -0,0 +1,96 @@
1
+ #!/usr/bin/env node
2
+ // Gemini CLI OAuth authentication script
3
+ // Usage:
4
+ // # 默认使用 ~/.routecodex/auth/gemini-oauth.json(自动创建/更新)
5
+ // node scripts/auth-gemini-cli-token.mjs
6
+ //
7
+ // # 或通过环境变量显式指定 token 文件(支持 ~ 展开):
8
+ // // GEMINI_CLI_TOKEN_FILE="~/.routecodex/auth/gemini-oauth-1-primary.json" node scripts/auth-gemini-cli-token.mjs
9
+
10
+ import os from 'os';
11
+ import path from 'path';
12
+ import fs from 'fs/promises';
13
+
14
+ async function resolveGeminiTokenPath() {
15
+ const envFile =
16
+ (process.env.GEMINI_CLI_TOKEN_FILE && process.env.GEMINI_CLI_TOKEN_FILE.trim()) ||
17
+ (process.env.ROUTECODEX_GEMINI_TOKEN_FILE && process.env.ROUTECODEX_GEMINI_TOKEN_FILE.trim()) ||
18
+ '';
19
+
20
+ if (envFile) {
21
+ const normalized = envFile.startsWith('~')
22
+ ? envFile.replace(/^~\//, `${os.homedir()}/`)
23
+ : envFile;
24
+ return { tokenPath: normalized, duplicates: [] };
25
+ }
26
+
27
+ const authDir = path.join(os.homedir(), '.routecodex', 'auth');
28
+ const primaryName = 'gemini-oauth.json';
29
+
30
+ let entries = [];
31
+ try {
32
+ entries = await fs.readdir(authDir);
33
+ } catch {
34
+ // directory may not exist yet
35
+ entries = [];
36
+ }
37
+
38
+ const matches = entries
39
+ .filter((entry) => entry.endsWith('.json'))
40
+ .filter((entry) => entry === primaryName || entry.startsWith('gemini-oauth-'));
41
+
42
+ matches.sort();
43
+ if (matches.length > 0) {
44
+ const canonical = path.join(authDir, matches[0]);
45
+ const duplicates = matches.slice(1).map((name) => path.join(authDir, name));
46
+ return { tokenPath: canonical, duplicates };
47
+ }
48
+
49
+ const canonical = path.join(authDir, primaryName);
50
+ return { tokenPath: canonical, duplicates: [] };
51
+ }
52
+
53
+ async function run() {
54
+ const { tokenPath, duplicates } = await resolveGeminiTokenPath();
55
+ console.log(`[gemini-cli-auth] Authenticating token: ${tokenPath}`);
56
+
57
+ // ensure token file exists so re-auth can recreate after delete
58
+ await fs.mkdir(path.dirname(tokenPath), { recursive: true });
59
+ try {
60
+ await fs.access(tokenPath);
61
+ } catch {
62
+ await fs.writeFile(tokenPath, '{}', 'utf-8');
63
+ }
64
+
65
+ const { ensureValidOAuthToken } = await import('../dist/providers/auth/oauth-lifecycle.js');
66
+
67
+ await ensureValidOAuthToken(
68
+ 'gemini-cli',
69
+ {
70
+ type: 'gemini-cli-oauth',
71
+ tokenFile: tokenPath
72
+ },
73
+ {
74
+ forceReauthorize: true,
75
+ openBrowser: true
76
+ }
77
+ );
78
+
79
+ // clean up duplicate token files for the same family
80
+ for (const dup of duplicates) {
81
+ if (dup === tokenPath) continue;
82
+ try {
83
+ await fs.unlink(dup);
84
+ console.log(`[gemini-cli-auth] Removed duplicate token file: ${dup}`);
85
+ } catch {
86
+ // ignore
87
+ }
88
+ }
89
+
90
+ console.log(`[gemini-cli-auth] Token saved to: ${tokenPath}`);
91
+ }
92
+
93
+ run().catch((err) => {
94
+ console.error('[gemini-cli-auth] Error:', err);
95
+ process.exit(1);
96
+ });
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env node
2
+ import os from 'os';
3
+ import path from 'path';
4
+ import fs from 'fs/promises';
5
+ import { createProviderOAuthStrategy } from '../dist/providers/core/config/provider-oauth-configs.js';
6
+
7
+ async function resolveIflowTokenPath() {
8
+ const envFile = process.env.IFLOW_TOKEN_FILE;
9
+ if (envFile && envFile.trim()) {
10
+ const normalized = envFile.startsWith('~') ? envFile.replace(/^~\//, `${os.homedir()}/`) : envFile;
11
+ return { tokenPath: normalized, duplicates: [] };
12
+ }
13
+
14
+ const authDir = path.join(os.homedir(), '.routecodex', 'auth');
15
+ const seq = 1;
16
+ const prefix = `iflow-oauth-${seq}`;
17
+ let entries = [];
18
+ try {
19
+ entries = await fs.readdir(authDir);
20
+ } catch {
21
+ // directory may not exist yet
22
+ }
23
+ const matches = entries
24
+ .filter((entry) => entry.endsWith('.json'))
25
+ .filter((entry) => entry === `${prefix}.json` || entry.startsWith(`${prefix}-`));
26
+ matches.sort();
27
+ if (matches.length > 0) {
28
+ const canonical = path.join(authDir, matches[0]);
29
+ const duplicates = matches.slice(1).map((name) => path.join(authDir, name));
30
+ return { tokenPath: canonical, duplicates };
31
+ }
32
+ const canonical = path.join(authDir, `${prefix}-primary.json`);
33
+ return { tokenPath: canonical, duplicates: [] };
34
+ }
35
+
36
+ async function run() {
37
+ const { tokenPath, duplicates } = await resolveIflowTokenPath();
38
+ console.log(`[iflow-manual] Manual auth for: ${tokenPath}`);
39
+
40
+ // ensure token file exists
41
+ await fs.mkdir(path.dirname(tokenPath), { recursive: true });
42
+ try { await fs.access(tokenPath); } catch { await fs.writeFile(tokenPath, '{}', 'utf-8'); }
43
+
44
+ // Use device code flow but let user open the URL manually
45
+ const strategy = createProviderOAuthStrategy('iflow', {
46
+ flowType: 'device_code',
47
+ endpoints: {
48
+ deviceCodeUrl: 'https://iflow.cn/oauth/device/code',
49
+ tokenUrl: 'https://iflow.cn/oauth/token',
50
+ userInfoUrl: 'https://iflow.cn/api/oauth/getUserInfo'
51
+ },
52
+ client: { clientId: '10009311001', scopes: ['openid','profile','email','api'] }
53
+ }, tokenPath);
54
+
55
+ // Manually trigger device code flow
56
+ const deviceCodeData = await strategy.initiateDeviceCodeFlow();
57
+ console.log('Please open this URL in your browser:');
58
+ console.log(deviceCodeData.verification_uri);
59
+ console.log('User code:', deviceCodeData.user_code);
60
+ console.log('Press Enter when you have authorized...');
61
+
62
+ await new Promise(resolve => process.stdin.once('data', resolve));
63
+
64
+ const token = await strategy.pollForToken(deviceCodeData);
65
+ await strategy.saveToken(token);
66
+
67
+ // clean up duplicate token files for the same sequence
68
+ for (const dup of duplicates) {
69
+ if (dup === tokenPath) continue;
70
+ try {
71
+ await fs.unlink(dup);
72
+ console.log(`[iflow-manual] Removed duplicate token file: ${dup}`);
73
+ } catch {
74
+ // ignore
75
+ }
76
+ }
77
+
78
+ console.log(`[iflow-manual] Token saved to: ${tokenPath}`);
79
+ }
80
+
81
+ run().catch(err => { console.error('[iflow-manual] Error:', err); process.exit(1); });
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env node
2
+ // iFlow token auth using direct device flow - no browser redirect
3
+ // Usage: ILOW_TOKEN_FILE="~/.routecodex/auth/iflow-oauth-1-xxx.json" node scripts/auth-iflow-token-direct.mjs
4
+
5
+ import os from 'os';
6
+ import path from 'path';
7
+ import fs from 'fs/promises';
8
+
9
+ async function resolveIflowTokenPath() {
10
+ const envFile = process.env.IFLOW_TOKEN_FILE;
11
+ if (envFile && envFile.trim()) {
12
+ const normalized = envFile.startsWith('~') ? envFile.replace(/^~\//, `${os.homedir()}/`) : envFile;
13
+ return { tokenPath: normalized, duplicates: [] };
14
+ }
15
+
16
+ const authDir = path.join(os.homedir(), '.routecodex', 'auth');
17
+ const seq = 1;
18
+ const prefix = `iflow-oauth-${seq}`;
19
+ let entries = [];
20
+ try {
21
+ entries = await fs.readdir(authDir);
22
+ } catch {
23
+ // directory may not exist yet
24
+ }
25
+ const matches = entries
26
+ .filter((entry) => entry.endsWith('.json'))
27
+ .filter((entry) => entry === `${prefix}.json` || entry.startsWith(`${prefix}-`));
28
+ matches.sort();
29
+ if (matches.length > 0) {
30
+ const canonical = path.join(authDir, matches[0]);
31
+ const duplicates = matches.slice(1).map((name) => path.join(authDir, name));
32
+ return { tokenPath: canonical, duplicates };
33
+ }
34
+ const canonical = path.join(authDir, `${prefix}-primary.json`);
35
+ return { tokenPath: canonical, duplicates: [] };
36
+ }
37
+
38
+ async function run() {
39
+ const { tokenPath, duplicates } = await resolveIflowTokenPath();
40
+ console.log(`[iflow-auth-direct] Starting device flow for: ${tokenPath}`);
41
+
42
+ // ensure token file exists so re-auth can recreate after delete
43
+ await fs.mkdir(path.dirname(tokenPath), { recursive: true });
44
+ try {
45
+ await fs.access(tokenPath);
46
+ } catch {
47
+ await fs.writeFile(tokenPath, '{}', 'utf-8');
48
+ }
49
+
50
+ const { createProviderOAuthStrategy } = await import('../dist/providers/core/config/provider-oauth-configs.js');
51
+
52
+ // Use device code flow instead of auth code flow
53
+ const strategy = createProviderOAuthStrategy('iflow', {
54
+ flowType: 'device_code',
55
+ endpoints: {
56
+ deviceCodeUrl: 'https://iflow.cn/oauth/device/code',
57
+ tokenUrl: 'https://iflow.cn/oauth/token',
58
+ userInfoUrl: 'https://iflow.cn/api/oauth/getUserInfo'
59
+ },
60
+ client: {
61
+ clientId: process.env.IFLOW_CLIENT_ID || 'iflow-desktop-client',
62
+ scopes: ['openid','profile','email','api']
63
+ }
64
+ }, tokenPath);
65
+
66
+ console.log('[iflow-auth-direct] Opening browser for device code flow...');
67
+ const token = await strategy.authenticate({ openBrowser: true });
68
+ await strategy.saveToken(token);
69
+
70
+ // clean up duplicate token files for the same sequence
71
+ for (const dup of duplicates) {
72
+ if (dup === tokenPath) continue;
73
+ try {
74
+ await fs.unlink(dup);
75
+ console.log(`[iflow-auth-direct] Removed duplicate token file: ${dup}`);
76
+ } catch {
77
+ // ignore
78
+ }
79
+ }
80
+
81
+ console.log(`[iflow-auth-direct] Token saved to: ${tokenPath}`);
82
+ }
83
+
84
+ run().catch(err => {
85
+ console.error('[iflow-auth-direct] Error:', err);
86
+ process.exit(1);
87
+ });
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env node
2
+ // iFlow token authentication script for specific token file
3
+ // Usage: ILOW_TOKEN_FILE="~/.routecodex/auth/iflow-oauth-1-xxx.json" node scripts/auth-iflow-token.mjs
4
+
5
+ import os from 'os';
6
+ import path from 'path';
7
+ import fs from 'fs/promises';
8
+
9
+ async function resolveIflowTokenPath() {
10
+ const envFile = process.env.IFLOW_TOKEN_FILE;
11
+ if (envFile && envFile.trim()) {
12
+ const normalized = envFile.startsWith('~') ? envFile.replace(/^~\//, `${os.homedir()}/`) : envFile;
13
+ return { tokenPath: normalized, duplicates: [] };
14
+ }
15
+
16
+ const authDir = path.join(os.homedir(), '.routecodex', 'auth');
17
+ const seq = 1;
18
+ const prefix = `iflow-oauth-${seq}`;
19
+ let entries = [];
20
+ try {
21
+ entries = await fs.readdir(authDir);
22
+ } catch {
23
+ // directory may not exist yet
24
+ }
25
+ const matches = entries
26
+ .filter((entry) => entry.endsWith('.json'))
27
+ .filter((entry) => entry === `${prefix}.json` || entry.startsWith(`${prefix}-`));
28
+ matches.sort();
29
+ if (matches.length > 0) {
30
+ const canonical = path.join(authDir, matches[0]);
31
+ const duplicates = matches.slice(1).map((name) => path.join(authDir, name));
32
+ return { tokenPath: canonical, duplicates };
33
+ }
34
+ const canonical = path.join(authDir, `${prefix}-primary.json`);
35
+ return { tokenPath: canonical, duplicates: [] };
36
+ }
37
+
38
+ async function run() {
39
+ const { tokenPath, duplicates } = await resolveIflowTokenPath();
40
+ console.log(`[iflow-auth] Authenticating token: ${tokenPath}`);
41
+
42
+ // ensure token file exists so re-auth can recreate after delete
43
+ await fs.mkdir(path.dirname(tokenPath), { recursive: true });
44
+ try {
45
+ await fs.access(tokenPath);
46
+ } catch {
47
+ await fs.writeFile(tokenPath, '{}', 'utf-8');
48
+ }
49
+
50
+ const { ensureValidOAuthToken } = await import('../dist/providers/auth/oauth-lifecycle.js');
51
+
52
+ await ensureValidOAuthToken('iflow', {
53
+ type: 'iflow-oauth',
54
+ tokenFile: tokenPath
55
+ }, {
56
+ forceReauthorize: true,
57
+ openBrowser: true
58
+ });
59
+
60
+ // clean up duplicate token files for the same sequence
61
+ for (const dup of duplicates) {
62
+ if (dup === tokenPath) continue;
63
+ try {
64
+ await fs.unlink(dup);
65
+ console.log(`[iflow-auth] Removed duplicate token file: ${dup}`);
66
+ } catch {
67
+ // ignore
68
+ }
69
+ }
70
+
71
+ console.log(`[iflow-auth] Token saved to: ${tokenPath}`);
72
+ }
73
+
74
+ run().catch(err => {
75
+ console.error('[iflow-auth] Error:', err);
76
+ process.exit(1);
77
+ });
@@ -15,23 +15,11 @@ async function ensureDir(p) {
15
15
  }
16
16
 
17
17
  async function main() {
18
- const SRC = path.resolve(process.cwd(), 'src/providers/compat');
19
- const DIST = path.resolve(process.cwd(), 'dist/providers/compat');
20
18
  const PROMPT_SRC = path.resolve(process.cwd(), 'src/config/system-prompts');
21
19
  const PROMPT_DIST = path.resolve(process.cwd(), 'dist/config/system-prompts');
22
- const copied = [];
23
20
  const promptCopied = [];
24
21
  try {
25
- for await (const file of walk(SRC)) {
26
- if (file.endsWith('.json') && file.includes(`${path.sep}config${path.sep}`)) {
27
- const rel = path.relative(SRC, file);
28
- const dest = path.join(DIST, rel);
29
- await ensureDir(path.dirname(dest));
30
- await fs.copyFile(file, dest);
31
- copied.push(rel);
32
- }
33
- }
34
- // copy system prompt artifacts
22
+ // copy system prompt artifacts only; provider compat assets are owned by llmswitch-core
35
23
  try {
36
24
  for await (const file of walk(PROMPT_SRC)) {
37
25
  const stats = await fs.stat(file);
@@ -46,8 +34,8 @@ async function main() {
46
34
  } catch (promptErr) {
47
35
  if (promptErr && promptErr.code !== 'ENOENT') throw promptErr;
48
36
  }
49
- // 不再复制 pipeline-config.generated.json dist;统一从 ~/.routecodex/config/generated 读取
50
- console.log(`[copy-compat-assets] copied ${copied.length} JSON assets; prompts: ${promptCopied.length}`);
37
+ // 不再复制 provider compat 资产;兼容层由 sharedmodule/llmswitch-core 提供
38
+ console.log(`[copy-compat-assets] prompts copied: ${promptCopied.length}`);
51
39
  } catch (err) {
52
40
  console.error('[copy-compat-assets] failed:', err?.message || String(err));
53
41
  process.exit(1);
@@ -1027,6 +1027,7 @@ async function main() {
1027
1027
  messages: [...chatMessages, assistantMsg, toolMsg],
1028
1028
  tools: chatTools,
1029
1029
  stream: false,
1030
+ tool_choice: 'auto'
1030
1031
  };
1031
1032
 
1032
1033
  console.log('📨 提交工具输出...');
@@ -39,21 +39,26 @@ function readJson(file) {
39
39
  }
40
40
 
41
41
  function extractEndpoint(doc) {
42
- return doc?.data?.url || doc?.endpoint || '/v1/responses';
42
+ return doc?.data?.url || doc?.url || doc?.endpoint || '/v1/responses';
43
43
  }
44
44
 
45
45
  function extractBody(doc) {
46
- const body = doc?.data?.body;
47
- if (!body) return undefined;
48
- if (typeof body.body === 'object') return body.body;
49
- if (typeof body === 'object') return body;
50
- if (typeof doc.data.data === 'object') return doc.data.data;
46
+ const bodyNode = doc?.data?.body || doc?.body;
47
+ if (!bodyNode) {
48
+ if (typeof doc?.data?.data === 'object') return doc.data.data;
49
+ if (typeof doc?.body?.data === 'object') return doc.body.data;
50
+ return undefined;
51
+ }
52
+ if (typeof bodyNode.body === 'object') return bodyNode.body;
53
+ if (typeof bodyNode === 'object') return bodyNode;
54
+ if (typeof doc?.data?.data === 'object') return doc.data.data;
55
+ if (typeof doc?.body?.data === 'object') return doc.body.data;
51
56
  return undefined;
52
57
  }
53
58
 
54
59
  function detectStream(doc, requestBody) {
55
- if (doc?.data?.meta?.stream === true) return true;
56
- if (doc?.data?.body?.metadata?.stream === true) return true;
60
+ if (doc?.data?.meta?.stream === true || doc?.meta?.stream === true) return true;
61
+ if (doc?.data?.body?.metadata?.stream === true || doc?.body?.metadata?.stream === true) return true;
57
62
  if (requestBody?.stream === true) return true;
58
63
  return false;
59
64
  }
@@ -191,7 +191,7 @@ function resolveGoldenExpectations(sample) {
191
191
  if (sample.meta?.endpoint && sample.meta?.requestId) {
192
192
  const reqId = sample.meta.requestId;
193
193
  const endpoint = sample.meta.endpoint;
194
- const baseDir = path.join(os.homedir(), '.routecodex', 'golden_samples');
194
+ const baseDir = path.join(os.homedir(), '.routecodex', 'codex-samples');
195
195
  const folder = endpoint.includes('/messages')
196
196
  ? 'anthropic-messages'
197
197
  : endpoint.includes('/responses')
@@ -13,18 +13,19 @@ const ROOT = path.resolve(__dirname, '../..');
13
13
 
14
14
  const HOME = os.homedir();
15
15
  const PROVIDER_ROOT = path.join(HOME, '.routecodex', 'provider');
16
- const SNAPSHOT_ROOT = path.join(HOME, '.routecodex', 'golden_samples');
17
- const PROVIDER_GOLDEN_ROOT = path.join(SNAPSHOT_ROOT, 'provider_golden_samples');
16
+ const RUNTIME_SNAPSHOT_ROOT = path.join(HOME, '.routecodex', 'codex-samples');
17
+ const GOLDEN_ROOT = path.join(HOME, '.routecodex', 'golden_samples');
18
+ const PROVIDER_GOLDEN_ROOT = path.join(GOLDEN_ROOT, 'provider_golden_samples');
18
19
  const CI_GOLDENS_ROOT = path.join(ROOT, 'samples', 'ci-goldens');
19
20
  const CUSTOM_SAMPLE_ROOTS = [
20
- path.join(SNAPSHOT_ROOT, 'new'),
21
+ path.join(GOLDEN_ROOT, 'new'),
21
22
  CI_GOLDENS_ROOT
22
23
  ];
23
24
  const TEMP_ROOT = path.join(process.cwd(), 'tmp', 'provider-captures');
24
25
  const STAGE_DIRS = {
25
- 'openai-chat': path.join(SNAPSHOT_ROOT, 'openai-chat'),
26
- 'openai-responses': path.join(SNAPSHOT_ROOT, 'openai-responses'),
27
- 'anthropic-messages': path.join(SNAPSHOT_ROOT, 'anthropic-messages')
26
+ 'openai-chat': path.join(RUNTIME_SNAPSHOT_ROOT, 'openai-chat'),
27
+ 'openai-responses': path.join(RUNTIME_SNAPSHOT_ROOT, 'openai-responses'),
28
+ 'anthropic-messages': path.join(RUNTIME_SNAPSHOT_ROOT, 'anthropic-messages')
28
29
  };
29
30
  const ENTRY_STAGE_MATRIX = {
30
31
  'openai-chat': {
@@ -437,7 +438,7 @@ function spawnServer(configPath, port) {
437
438
  }
438
439
 
439
440
  async function captureProvider(providerEntry, entryType, port, options, sanitizedProviderId) {
440
- const stageDir = path.join(SNAPSHOT_ROOT, ENTRY_DEFS[entryType].stageDir);
441
+ const stageDir = path.join(RUNTIME_SNAPSHOT_ROOT, ENTRY_DEFS[entryType].stageDir);
441
442
  const suffix = '_req_outbound_stage2_format_build.json';
442
443
  const before = snapshotStageFiles(stageDir, suffix);
443
444
  const baseUrl = `http://127.0.0.1:${port}`;