@jsonstudio/rcc 0.89.1960 → 0.89.2195

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 (559) hide show
  1. package/README.md +66 -6
  2. package/config/file-line-limit-policy.json +21 -0
  3. package/configsamples/config.json +1 -1
  4. package/configsamples/config.v1.quickstart.sanitized.json +6 -6
  5. package/configsamples/provider/iflow/config.v1.json +1 -1
  6. package/dist/app/config-readers.d.ts +18 -0
  7. package/dist/app/config-readers.js +95 -0
  8. package/dist/app/config-readers.js.map +1 -0
  9. package/dist/app/index.d.ts +9 -0
  10. package/dist/app/index.js +8 -0
  11. package/dist/app/index.js.map +1 -0
  12. package/dist/app/shutdown.d.ts +32 -0
  13. package/dist/app/shutdown.js +41 -0
  14. package/dist/app/shutdown.js.map +1 -0
  15. package/dist/bootstrap/index.d.ts +7 -0
  16. package/dist/bootstrap/index.js +7 -0
  17. package/dist/bootstrap/index.js.map +1 -0
  18. package/dist/bootstrap/log-filter.d.ts +15 -0
  19. package/dist/bootstrap/log-filter.js +81 -0
  20. package/dist/bootstrap/log-filter.js.map +1 -0
  21. package/dist/build-info.js +2 -2
  22. package/dist/cli/commands/claude.js +6 -5
  23. package/dist/cli/commands/claude.js.map +1 -1
  24. package/dist/cli/commands/init/basic.d.ts +1 -7
  25. package/dist/cli/commands/init/basic.js +0 -79
  26. package/dist/cli/commands/init/basic.js.map +1 -1
  27. package/dist/cli/commands/init/prompt-utils.d.ts +7 -0
  28. package/dist/cli/commands/init/prompt-utils.js +80 -0
  29. package/dist/cli/commands/init/prompt-utils.js.map +1 -0
  30. package/dist/cli/commands/init/workflows.js +2 -1
  31. package/dist/cli/commands/init/workflows.js.map +1 -1
  32. package/dist/cli/commands/init.js +103 -2
  33. package/dist/cli/commands/init.js.map +1 -1
  34. package/dist/cli/commands/launcher/index.d.ts +7 -0
  35. package/dist/cli/commands/launcher/index.js +7 -0
  36. package/dist/cli/commands/launcher/index.js.map +1 -0
  37. package/dist/cli/commands/launcher/types.d.ts +112 -0
  38. package/dist/cli/commands/launcher/types.js +7 -0
  39. package/dist/cli/commands/launcher/types.js.map +1 -0
  40. package/dist/cli/commands/launcher/utils.d.ts +114 -0
  41. package/dist/cli/commands/launcher/utils.js +378 -0
  42. package/dist/cli/commands/launcher/utils.js.map +1 -0
  43. package/dist/cli/commands/launcher-kernel.d.ts +2 -74
  44. package/dist/cli/commands/launcher-kernel.js +141 -143
  45. package/dist/cli/commands/launcher-kernel.js.map +1 -1
  46. package/dist/cli/commands/start-types.d.ts +67 -0
  47. package/dist/cli/commands/start-types.js +3 -0
  48. package/dist/cli/commands/start-types.js.map +1 -0
  49. package/dist/cli/commands/start-utils.d.ts +19 -0
  50. package/dist/cli/commands/start-utils.js +78 -0
  51. package/dist/cli/commands/start-utils.js.map +1 -0
  52. package/dist/cli/commands/start.d.ts +2 -67
  53. package/dist/cli/commands/start.js +131 -47
  54. package/dist/cli/commands/start.js.map +1 -1
  55. package/dist/cli/commands/stop.js +13 -0
  56. package/dist/cli/commands/stop.js.map +1 -1
  57. package/dist/cli/commands/tmux-inject.js +1 -1
  58. package/dist/cli/commands/tmux-inject.js.map +1 -1
  59. package/dist/cli/config/bundled-default-config.d.ts +18 -0
  60. package/dist/cli/config/bundled-default-config.js +62 -0
  61. package/dist/cli/config/bundled-default-config.js.map +1 -0
  62. package/dist/cli/config/init-config.js +60 -2
  63. package/dist/cli/config/init-config.js.map +1 -1
  64. package/dist/cli/config/init-provider-catalog.js +3 -1
  65. package/dist/cli/config/init-provider-catalog.js.map +1 -1
  66. package/dist/cli/config/precommand-default-script.d.ts +17 -0
  67. package/dist/cli/config/precommand-default-script.js +47 -0
  68. package/dist/cli/config/precommand-default-script.js.map +1 -0
  69. package/dist/cli.js +2 -0
  70. package/dist/cli.js.map +1 -1
  71. package/dist/client/gemini-cli/gemini-cli-protocol-client.js +55 -5
  72. package/dist/client/gemini-cli/gemini-cli-protocol-client.js.map +1 -1
  73. package/dist/commands/oauth.js +28 -4
  74. package/dist/commands/oauth.js.map +1 -1
  75. package/dist/commands/quota-daemon.js +12 -0
  76. package/dist/commands/quota-daemon.js.map +1 -1
  77. package/dist/configsamples/config.v1.quickstart.sanitized.json +1147 -0
  78. package/dist/constants/index.d.ts +34 -0
  79. package/dist/constants/index.js +57 -0
  80. package/dist/constants/index.js.map +1 -1
  81. package/dist/docs/daemon-admin-ui.html +268 -11
  82. package/dist/error-handling/quiet-error-handling-center.js +19 -1
  83. package/dist/error-handling/quiet-error-handling-center.js.map +1 -1
  84. package/dist/index.js +233 -30
  85. package/dist/index.js.map +1 -1
  86. package/dist/manager/index.js +4 -4
  87. package/dist/manager/index.js.map +1 -1
  88. package/dist/manager/modules/quota/antigravity-quota-core.d.ts +26 -0
  89. package/dist/manager/modules/quota/antigravity-quota-core.js +23 -0
  90. package/dist/manager/modules/quota/antigravity-quota-core.js.map +1 -0
  91. package/dist/manager/modules/quota/antigravity-quota-helpers.d.ts +16 -0
  92. package/dist/manager/modules/quota/antigravity-quota-helpers.js +167 -0
  93. package/dist/manager/modules/quota/antigravity-quota-helpers.js.map +1 -0
  94. package/dist/manager/modules/quota/antigravity-quota-manager.d.ts +10 -39
  95. package/dist/manager/modules/quota/antigravity-quota-manager.js +167 -464
  96. package/dist/manager/modules/quota/antigravity-quota-manager.js.map +1 -1
  97. package/dist/manager/modules/quota/antigravity-quota-persistence.d.ts +20 -0
  98. package/dist/manager/modules/quota/antigravity-quota-persistence.js +139 -0
  99. package/dist/manager/modules/quota/antigravity-quota-persistence.js.map +1 -0
  100. package/dist/manager/modules/quota/antigravity-quota-runtime.d.ts +55 -0
  101. package/dist/manager/modules/quota/antigravity-quota-runtime.js +174 -0
  102. package/dist/manager/modules/quota/antigravity-quota-runtime.js.map +1 -0
  103. package/dist/manager/modules/quota/antigravity-quota-sync.d.ts +46 -0
  104. package/dist/manager/modules/quota/antigravity-quota-sync.js +162 -0
  105. package/dist/manager/modules/quota/antigravity-quota-sync.js.map +1 -0
  106. package/dist/manager/modules/quota/index.d.ts +1 -0
  107. package/dist/manager/modules/quota/provider-quota-daemon.error-helpers.d.ts +13 -0
  108. package/dist/manager/modules/quota/provider-quota-daemon.error-helpers.js +149 -0
  109. package/dist/manager/modules/quota/provider-quota-daemon.error-helpers.js.map +1 -0
  110. package/dist/manager/modules/quota/provider-quota-daemon.events.js +1 -148
  111. package/dist/manager/modules/quota/provider-quota-daemon.events.js.map +1 -1
  112. package/dist/manager/modules/quota/provider-quota-daemon.js.map +1 -1
  113. package/dist/manager/modules/quota/quota-adapter.d.ts +111 -0
  114. package/dist/manager/modules/quota/quota-adapter.js +325 -0
  115. package/dist/manager/modules/quota/quota-adapter.js.map +1 -0
  116. package/dist/manager/quota/provider-quota-center.d.ts +10 -0
  117. package/dist/manager/quota/provider-quota-center.js +15 -2
  118. package/dist/manager/quota/provider-quota-center.js.map +1 -1
  119. package/dist/modules/llmswitch/bridge/antigravity-signature.d.ts +28 -0
  120. package/dist/modules/llmswitch/bridge/antigravity-signature.js +180 -0
  121. package/dist/modules/llmswitch/bridge/antigravity-signature.js.map +1 -0
  122. package/dist/modules/llmswitch/bridge/index.d.ts +13 -0
  123. package/dist/modules/llmswitch/bridge/index.js +14 -0
  124. package/dist/modules/llmswitch/bridge/index.js.map +1 -0
  125. package/dist/modules/llmswitch/bridge/module-loader.d.ts +16 -0
  126. package/dist/modules/llmswitch/bridge/module-loader.js +59 -0
  127. package/dist/modules/llmswitch/bridge/module-loader.js.map +1 -0
  128. package/dist/modules/llmswitch/bridge/quota-manager.d.ts +8 -0
  129. package/dist/modules/llmswitch/bridge/quota-manager.js +37 -0
  130. package/dist/modules/llmswitch/bridge/quota-manager.js.map +1 -0
  131. package/dist/modules/llmswitch/bridge/response-converter.d.ts +11 -0
  132. package/dist/modules/llmswitch/bridge/response-converter.js +68 -0
  133. package/dist/modules/llmswitch/bridge/response-converter.js.map +1 -0
  134. package/dist/modules/llmswitch/bridge/routing-integrations.d.ts +12 -0
  135. package/dist/modules/llmswitch/bridge/routing-integrations.js +56 -0
  136. package/dist/modules/llmswitch/bridge/routing-integrations.js.map +1 -0
  137. package/dist/modules/llmswitch/bridge/runtime-integrations.d.ts +34 -0
  138. package/dist/modules/llmswitch/bridge/runtime-integrations.js +87 -0
  139. package/dist/modules/llmswitch/bridge/runtime-integrations.js.map +1 -0
  140. package/dist/modules/llmswitch/bridge/snapshot-recorder.d.ts +13 -0
  141. package/dist/modules/llmswitch/bridge/snapshot-recorder.js +484 -0
  142. package/dist/modules/llmswitch/bridge/snapshot-recorder.js.map +1 -0
  143. package/dist/modules/llmswitch/bridge/state-integrations.d.ts +59 -0
  144. package/dist/modules/llmswitch/bridge/state-integrations.js +264 -0
  145. package/dist/modules/llmswitch/bridge/state-integrations.js.map +1 -0
  146. package/dist/modules/llmswitch/bridge.d.ts +14 -131
  147. package/dist/modules/llmswitch/bridge.js +14 -834
  148. package/dist/modules/llmswitch/bridge.js.map +1 -1
  149. package/dist/modules/pipeline/types/provider-config-types.d.ts +240 -0
  150. package/dist/modules/pipeline/types/provider-config-types.js +2 -0
  151. package/dist/modules/pipeline/types/provider-config-types.js.map +1 -0
  152. package/dist/modules/pipeline/types/provider-types.d.ts +2 -239
  153. package/dist/modules/pipeline/types/provider-types.js +1 -1
  154. package/dist/modules/pipeline/types/provider-types.js.map +1 -1
  155. package/dist/modules/pipeline/utils/debug-logger.js +3 -5
  156. package/dist/modules/pipeline/utils/debug-logger.js.map +1 -1
  157. package/dist/providers/auth/apikey-auth.d.ts +57 -1
  158. package/dist/providers/auth/apikey-auth.js +131 -1
  159. package/dist/providers/auth/apikey-auth.js.map +1 -1
  160. package/dist/providers/auth/oauth-lifecycle/error-detection.d.ts +8 -0
  161. package/dist/providers/auth/oauth-lifecycle/error-detection.js +71 -0
  162. package/dist/providers/auth/oauth-lifecycle/error-detection.js.map +1 -0
  163. package/dist/providers/auth/oauth-lifecycle/index.d.ts +10 -0
  164. package/dist/providers/auth/oauth-lifecycle/index.js +11 -0
  165. package/dist/providers/auth/oauth-lifecycle/index.js.map +1 -0
  166. package/dist/providers/auth/oauth-lifecycle/path-resolver.d.ts +18 -0
  167. package/dist/providers/auth/oauth-lifecycle/path-resolver.js +121 -0
  168. package/dist/providers/auth/oauth-lifecycle/path-resolver.js.map +1 -0
  169. package/dist/providers/auth/oauth-lifecycle/throttle.d.ts +22 -0
  170. package/dist/providers/auth/oauth-lifecycle/throttle.js +37 -0
  171. package/dist/providers/auth/oauth-lifecycle/throttle.js.map +1 -0
  172. package/dist/providers/auth/oauth-lifecycle/token-helpers.d.ts +36 -0
  173. package/dist/providers/auth/oauth-lifecycle/token-helpers.js +127 -0
  174. package/dist/providers/auth/oauth-lifecycle/token-helpers.js.map +1 -0
  175. package/dist/providers/auth/oauth-lifecycle/token-io.d.ts +14 -0
  176. package/dist/providers/auth/oauth-lifecycle/token-io.js +151 -0
  177. package/dist/providers/auth/oauth-lifecycle/token-io.js.map +1 -0
  178. package/dist/providers/auth/oauth-lifecycle.js +70 -446
  179. package/dist/providers/auth/oauth-lifecycle.js.map +1 -1
  180. package/dist/providers/auth/oauth-repair-cooldown.js +8 -3
  181. package/dist/providers/auth/oauth-repair-cooldown.js.map +1 -1
  182. package/dist/providers/auth/oauth-repair-env.js +5 -3
  183. package/dist/providers/auth/oauth-repair-env.js.map +1 -1
  184. package/dist/providers/auth/oauth-token-utils.d.ts +61 -0
  185. package/dist/providers/auth/oauth-token-utils.js +187 -0
  186. package/dist/providers/auth/oauth-token-utils.js.map +1 -0
  187. package/dist/providers/auth/oauth-utils/camoufox-helper.d.ts +21 -0
  188. package/dist/providers/auth/oauth-utils/camoufox-helper.js +82 -0
  189. package/dist/providers/auth/oauth-utils/camoufox-helper.js.map +1 -0
  190. package/dist/providers/auth/oauth-utils/error-extraction.d.ts +17 -0
  191. package/dist/providers/auth/oauth-utils/error-extraction.js +80 -0
  192. package/dist/providers/auth/oauth-utils/error-extraction.js.map +1 -0
  193. package/dist/providers/auth/oauth-utils/index.d.ts +7 -0
  194. package/dist/providers/auth/oauth-utils/index.js +8 -0
  195. package/dist/providers/auth/oauth-utils/index.js.map +1 -0
  196. package/dist/providers/auth/token-refresh/index.d.ts +6 -0
  197. package/dist/providers/auth/token-refresh/index.js +7 -0
  198. package/dist/providers/auth/token-refresh/index.js.map +1 -0
  199. package/dist/providers/auth/token-refresh/token-state.d.ts +17 -0
  200. package/dist/providers/auth/token-refresh/token-state.js +30 -0
  201. package/dist/providers/auth/token-refresh/token-state.js.map +1 -0
  202. package/dist/providers/auth/token-storage/index.d.ts +7 -0
  203. package/dist/providers/auth/token-storage/index.js +8 -0
  204. package/dist/providers/auth/token-storage/index.js.map +1 -0
  205. package/dist/providers/auth/token-storage/token-file-resolver.d.ts +12 -0
  206. package/dist/providers/auth/token-storage/token-file-resolver.js +117 -0
  207. package/dist/providers/auth/token-storage/token-file-resolver.js.map +1 -0
  208. package/dist/providers/auth/token-storage/token-persistence.d.ts +22 -0
  209. package/dist/providers/auth/token-storage/token-persistence.js +86 -0
  210. package/dist/providers/auth/token-storage/token-persistence.js.map +1 -0
  211. package/dist/providers/auth/tokenfile-auth.js +12 -9
  212. package/dist/providers/auth/tokenfile-auth.js.map +1 -1
  213. package/dist/providers/core/api/provider-config.d.ts +8 -0
  214. package/dist/providers/core/config/camoufox-launcher.d.ts +1 -0
  215. package/dist/providers/core/config/camoufox-launcher.js +40 -9
  216. package/dist/providers/core/config/camoufox-launcher.js.map +1 -1
  217. package/dist/providers/core/config/oauth-flows.js +7 -2
  218. package/dist/providers/core/config/oauth-flows.js.map +1 -1
  219. package/dist/providers/core/config/provider-debug-hooks.d.ts +0 -12
  220. package/dist/providers/core/config/provider-debug-hooks.js +16 -56
  221. package/dist/providers/core/config/provider-debug-hooks.js.map +1 -1
  222. package/dist/providers/core/config/provider-debug-output-utils.d.ts +38 -0
  223. package/dist/providers/core/config/provider-debug-output-utils.js +46 -0
  224. package/dist/providers/core/config/provider-debug-output-utils.js.map +1 -0
  225. package/dist/providers/core/config/provider-oauth-configs.js +13 -9
  226. package/dist/providers/core/config/provider-oauth-configs.js.map +1 -1
  227. package/dist/providers/core/runtime/antigravity-request-type.d.ts +2 -0
  228. package/dist/providers/core/runtime/antigravity-request-type.js +126 -0
  229. package/dist/providers/core/runtime/antigravity-request-type.js.map +1 -0
  230. package/dist/providers/core/runtime/base-provider-runtime-helpers.d.ts +27 -0
  231. package/dist/providers/core/runtime/base-provider-runtime-helpers.js +105 -0
  232. package/dist/providers/core/runtime/base-provider-runtime-helpers.js.map +1 -0
  233. package/dist/providers/core/runtime/base-provider-series-cooldown.d.ts +19 -0
  234. package/dist/providers/core/runtime/base-provider-series-cooldown.js +363 -0
  235. package/dist/providers/core/runtime/base-provider-series-cooldown.js.map +1 -0
  236. package/dist/providers/core/runtime/base-provider.d.ts +4 -35
  237. package/dist/providers/core/runtime/base-provider.js +20 -501
  238. package/dist/providers/core/runtime/base-provider.js.map +1 -1
  239. package/dist/providers/core/runtime/deepseek-http-provider-helpers.d.ts +32 -0
  240. package/dist/providers/core/runtime/deepseek-http-provider-helpers.js +301 -0
  241. package/dist/providers/core/runtime/deepseek-http-provider-helpers.js.map +1 -0
  242. package/dist/providers/core/runtime/deepseek-http-provider.d.ts +0 -3
  243. package/dist/providers/core/runtime/deepseek-http-provider.js +5 -127
  244. package/dist/providers/core/runtime/deepseek-http-provider.js.map +1 -1
  245. package/dist/providers/core/runtime/deepseek-session-pow-helpers.d.ts +21 -0
  246. package/dist/providers/core/runtime/deepseek-session-pow-helpers.js +99 -0
  247. package/dist/providers/core/runtime/deepseek-session-pow-helpers.js.map +1 -0
  248. package/dist/providers/core/runtime/deepseek-session-pow.js +17 -100
  249. package/dist/providers/core/runtime/deepseek-session-pow.js.map +1 -1
  250. package/dist/providers/core/runtime/gemini-cli-http-provider.d.ts +0 -15
  251. package/dist/providers/core/runtime/gemini-cli-http-provider.js +13 -303
  252. package/dist/providers/core/runtime/gemini-cli-http-provider.js.map +1 -1
  253. package/dist/providers/core/runtime/gemini-cli-response-postprocessor.d.ts +9 -0
  254. package/dist/providers/core/runtime/gemini-cli-response-postprocessor.js +85 -0
  255. package/dist/providers/core/runtime/gemini-cli-response-postprocessor.js.map +1 -0
  256. package/dist/providers/core/runtime/gemini-http-provider.js +2 -2
  257. package/dist/providers/core/runtime/gemini-http-provider.js.map +1 -1
  258. package/dist/providers/core/runtime/gemini-sse-normalizer.d.ts +25 -0
  259. package/dist/providers/core/runtime/gemini-sse-normalizer.js +159 -0
  260. package/dist/providers/core/runtime/gemini-sse-normalizer.js.map +1 -0
  261. package/dist/providers/core/runtime/http-request-executor.js +1 -48
  262. package/dist/providers/core/runtime/http-request-executor.js.map +1 -1
  263. package/dist/providers/core/runtime/http-transport-provider.d.ts +2 -48
  264. package/dist/providers/core/runtime/http-transport-provider.js +158 -1273
  265. package/dist/providers/core/runtime/http-transport-provider.js.map +1 -1
  266. package/dist/providers/core/runtime/provider-bootstrap-utils.d.ts +20 -0
  267. package/dist/providers/core/runtime/provider-bootstrap-utils.js +78 -0
  268. package/dist/providers/core/runtime/provider-bootstrap-utils.js.map +1 -0
  269. package/dist/providers/core/runtime/provider-factory-helpers.d.ts +19 -0
  270. package/dist/providers/core/runtime/provider-factory-helpers.js +203 -0
  271. package/dist/providers/core/runtime/provider-factory-helpers.js.map +1 -0
  272. package/dist/providers/core/runtime/provider-factory.d.ts +9 -7
  273. package/dist/providers/core/runtime/provider-factory.js +57 -214
  274. package/dist/providers/core/runtime/provider-factory.js.map +1 -1
  275. package/dist/providers/core/runtime/provider-family-profile-utils.d.ts +23 -0
  276. package/dist/providers/core/runtime/provider-family-profile-utils.js +57 -0
  277. package/dist/providers/core/runtime/provider-family-profile-utils.js.map +1 -0
  278. package/dist/providers/core/runtime/provider-http-executor-utils.d.ts +32 -0
  279. package/dist/providers/core/runtime/provider-http-executor-utils.js +92 -0
  280. package/dist/providers/core/runtime/provider-http-executor-utils.js.map +1 -0
  281. package/dist/providers/core/runtime/provider-iflow-business-error-utils.d.ts +15 -0
  282. package/dist/providers/core/runtime/provider-iflow-business-error-utils.js +49 -0
  283. package/dist/providers/core/runtime/provider-iflow-business-error-utils.js.map +1 -0
  284. package/dist/providers/core/runtime/provider-request-executor-deps-factory.d.ts +29 -0
  285. package/dist/providers/core/runtime/provider-request-executor-deps-factory.js +41 -0
  286. package/dist/providers/core/runtime/provider-request-executor-deps-factory.js.map +1 -0
  287. package/dist/providers/core/runtime/provider-request-header-orchestrator.d.ts +30 -0
  288. package/dist/providers/core/runtime/provider-request-header-orchestrator.js +91 -0
  289. package/dist/providers/core/runtime/provider-request-header-orchestrator.js.map +1 -0
  290. package/dist/providers/core/runtime/provider-request-preprocessor.d.ts +5 -0
  291. package/dist/providers/core/runtime/provider-request-preprocessor.js +39 -0
  292. package/dist/providers/core/runtime/provider-request-preprocessor.js.map +1 -0
  293. package/dist/providers/core/runtime/provider-request-shaping-utils.d.ts +37 -0
  294. package/dist/providers/core/runtime/provider-request-shaping-utils.js +65 -0
  295. package/dist/providers/core/runtime/provider-request-shaping-utils.js.map +1 -0
  296. package/dist/providers/core/runtime/provider-response-postprocessor.d.ts +7 -0
  297. package/dist/providers/core/runtime/provider-response-postprocessor.js +28 -0
  298. package/dist/providers/core/runtime/provider-response-postprocessor.js.map +1 -0
  299. package/dist/providers/core/runtime/provider-runtime-utils.d.ts +16 -0
  300. package/dist/providers/core/runtime/provider-runtime-utils.js +51 -0
  301. package/dist/providers/core/runtime/provider-runtime-utils.js.map +1 -0
  302. package/dist/providers/core/runtime/responses-provider-helpers.d.ts +37 -0
  303. package/dist/providers/core/runtime/responses-provider-helpers.js +212 -0
  304. package/dist/providers/core/runtime/responses-provider-helpers.js.map +1 -0
  305. package/dist/providers/core/runtime/responses-provider.d.ts +0 -10
  306. package/dist/providers/core/runtime/responses-provider.js +14 -224
  307. package/dist/providers/core/runtime/responses-provider.js.map +1 -1
  308. package/dist/providers/core/runtime/runtime-endpoint-resolver.d.ts +21 -0
  309. package/dist/providers/core/runtime/runtime-endpoint-resolver.js +64 -0
  310. package/dist/providers/core/runtime/runtime-endpoint-resolver.js.map +1 -0
  311. package/dist/providers/core/runtime/service-profile-resolver.d.ts +29 -0
  312. package/dist/providers/core/runtime/service-profile-resolver.js +88 -0
  313. package/dist/providers/core/runtime/service-profile-resolver.js.map +1 -0
  314. package/dist/providers/core/runtime/transport/auth-mode-utils.d.ts +13 -0
  315. package/dist/providers/core/runtime/transport/auth-mode-utils.js +43 -0
  316. package/dist/providers/core/runtime/transport/auth-mode-utils.js.map +1 -0
  317. package/dist/providers/core/runtime/transport/auth-provider-factory.d.ts +37 -0
  318. package/dist/providers/core/runtime/transport/auth-provider-factory.js +131 -0
  319. package/dist/providers/core/runtime/transport/auth-provider-factory.js.map +1 -0
  320. package/dist/providers/core/runtime/transport/header-utils.d.ts +15 -0
  321. package/dist/providers/core/runtime/transport/header-utils.js +85 -0
  322. package/dist/providers/core/runtime/transport/header-utils.js.map +1 -0
  323. package/dist/providers/core/runtime/transport/iflow-signer.d.ts +12 -0
  324. package/dist/providers/core/runtime/transport/iflow-signer.js +63 -0
  325. package/dist/providers/core/runtime/transport/iflow-signer.js.map +1 -0
  326. package/dist/providers/core/runtime/transport/index.d.ts +15 -0
  327. package/dist/providers/core/runtime/transport/index.js +16 -0
  328. package/dist/providers/core/runtime/transport/index.js.map +1 -0
  329. package/dist/providers/core/runtime/transport/oauth-header-preflight.d.ts +12 -0
  330. package/dist/providers/core/runtime/transport/oauth-header-preflight.js +56 -0
  331. package/dist/providers/core/runtime/transport/oauth-header-preflight.js.map +1 -0
  332. package/dist/providers/core/runtime/transport/oauth-recovery-handler.d.ts +34 -0
  333. package/dist/providers/core/runtime/transport/oauth-recovery-handler.js +126 -0
  334. package/dist/providers/core/runtime/transport/oauth-recovery-handler.js.map +1 -0
  335. package/dist/providers/core/runtime/transport/provider-payload-utils.d.ts +21 -0
  336. package/dist/providers/core/runtime/transport/provider-payload-utils.js +88 -0
  337. package/dist/providers/core/runtime/transport/provider-payload-utils.js.map +1 -0
  338. package/dist/providers/core/runtime/transport/request-header-builder.d.ts +24 -0
  339. package/dist/providers/core/runtime/transport/request-header-builder.js +90 -0
  340. package/dist/providers/core/runtime/transport/request-header-builder.js.map +1 -0
  341. package/dist/providers/core/runtime/transport/runtime-detector.d.ts +22 -0
  342. package/dist/providers/core/runtime/transport/runtime-detector.js +63 -0
  343. package/dist/providers/core/runtime/transport/runtime-detector.js.map +1 -0
  344. package/dist/providers/core/runtime/transport/session-header-utils.d.ts +8 -0
  345. package/dist/providers/core/runtime/transport/session-header-utils.js +72 -0
  346. package/dist/providers/core/runtime/transport/session-header-utils.js.map +1 -0
  347. package/dist/providers/core/runtime/vision-debug-utils.d.ts +2 -0
  348. package/dist/providers/core/runtime/vision-debug-utils.js +31 -0
  349. package/dist/providers/core/runtime/vision-debug-utils.js.map +1 -1
  350. package/dist/providers/core/strategies/oauth-auth-code-flow.d.ts +13 -0
  351. package/dist/providers/core/strategies/oauth-auth-code-flow.js +272 -55
  352. package/dist/providers/core/strategies/oauth-auth-code-flow.js.map +1 -1
  353. package/dist/providers/core/utils/snapshot-writer-buffer.d.ts +13 -0
  354. package/dist/providers/core/utils/snapshot-writer-buffer.js +39 -0
  355. package/dist/providers/core/utils/snapshot-writer-buffer.js.map +1 -0
  356. package/dist/providers/core/utils/snapshot-writer.js +75 -54
  357. package/dist/providers/core/utils/snapshot-writer.js.map +1 -1
  358. package/dist/providers/profile/families/antigravity-profile.js +2 -10
  359. package/dist/providers/profile/families/antigravity-profile.js.map +1 -1
  360. package/dist/providers/profile/families/deepseek-profile.d.ts +2 -0
  361. package/dist/providers/profile/families/deepseek-profile.js +110 -0
  362. package/dist/providers/profile/families/deepseek-profile.js.map +1 -0
  363. package/dist/providers/profile/families/iflow-profile.js +89 -10
  364. package/dist/providers/profile/families/iflow-profile.js.map +1 -1
  365. package/dist/providers/profile/provider-profile-loader.d.ts +5 -0
  366. package/dist/providers/profile/provider-profile-loader.js +35 -0
  367. package/dist/providers/profile/provider-profile-loader.js.map +1 -1
  368. package/dist/providers/profile/provider-profile.d.ts +16 -1
  369. package/dist/runtime/runtime-flags.js +1 -1
  370. package/dist/runtime/runtime-flags.js.map +1 -1
  371. package/dist/runtime/wasm-runtime/index.d.ts +56 -0
  372. package/dist/runtime/wasm-runtime/index.js +69 -0
  373. package/dist/runtime/wasm-runtime/index.js.map +1 -0
  374. package/dist/scripts/camoufox/launch-auth.mjs +158 -10
  375. package/dist/server/handlers/handler-response-utils.d.ts +13 -0
  376. package/dist/server/handlers/handler-response-utils.js +427 -0
  377. package/dist/server/handlers/handler-response-utils.js.map +1 -0
  378. package/dist/server/handlers/handler-utils.d.ts +2 -11
  379. package/dist/server/handlers/handler-utils.js +21 -421
  380. package/dist/server/handlers/handler-utils.js.map +1 -1
  381. package/dist/server/runtime/http-server/clock-client-reaper.d.ts +23 -0
  382. package/dist/server/runtime/http-server/clock-client-reaper.js +159 -0
  383. package/dist/server/runtime/http-server/clock-client-reaper.js.map +1 -0
  384. package/dist/server/runtime/http-server/clock-client-registry-utils.d.ts +87 -0
  385. package/dist/server/runtime/http-server/clock-client-registry-utils.js +276 -0
  386. package/dist/server/runtime/http-server/clock-client-registry-utils.js.map +1 -0
  387. package/dist/server/runtime/http-server/clock-client-registry.d.ts +5 -50
  388. package/dist/server/runtime/http-server/clock-client-registry.js +74 -320
  389. package/dist/server/runtime/http-server/clock-client-registry.js.map +1 -1
  390. package/dist/server/runtime/http-server/clock-client-route-utils.d.ts +12 -0
  391. package/dist/server/runtime/http-server/clock-client-route-utils.js +210 -0
  392. package/dist/server/runtime/http-server/clock-client-route-utils.js.map +1 -0
  393. package/dist/server/runtime/http-server/clock-client-routes.js +27 -201
  394. package/dist/server/runtime/http-server/clock-client-routes.js.map +1 -1
  395. package/dist/server/runtime/http-server/clock-daemon-log-throttle.d.ts +12 -0
  396. package/dist/server/runtime/http-server/clock-daemon-log-throttle.js +56 -0
  397. package/dist/server/runtime/http-server/clock-daemon-log-throttle.js.map +1 -0
  398. package/dist/server/runtime/http-server/daemon-admin/control-handler.js +143 -14
  399. package/dist/server/runtime/http-server/daemon-admin/control-handler.js.map +1 -1
  400. package/dist/server/runtime/http-server/daemon-admin/credentials-handler-utils.d.ts +19 -0
  401. package/dist/server/runtime/http-server/daemon-admin/credentials-handler-utils.js +107 -0
  402. package/dist/server/runtime/http-server/daemon-admin/credentials-handler-utils.js.map +1 -0
  403. package/dist/server/runtime/http-server/daemon-admin/credentials-handler.js +2 -104
  404. package/dist/server/runtime/http-server/daemon-admin/credentials-handler.js.map +1 -1
  405. package/dist/server/runtime/http-server/daemon-admin/providers-handler-routing-utils.d.ts +28 -0
  406. package/dist/server/runtime/http-server/daemon-admin/providers-handler-routing-utils.js +298 -0
  407. package/dist/server/runtime/http-server/daemon-admin/providers-handler-routing-utils.js.map +1 -0
  408. package/dist/server/runtime/http-server/daemon-admin/providers-handler-utils.d.ts +22 -0
  409. package/dist/server/runtime/http-server/daemon-admin/providers-handler-utils.js +211 -0
  410. package/dist/server/runtime/http-server/daemon-admin/providers-handler-utils.js.map +1 -0
  411. package/dist/server/runtime/http-server/daemon-admin/providers-handler.js +25 -454
  412. package/dist/server/runtime/http-server/daemon-admin/providers-handler.js.map +1 -1
  413. package/dist/server/runtime/http-server/daemon-admin/quota-handler.js +81 -32
  414. package/dist/server/runtime/http-server/daemon-admin/quota-handler.js.map +1 -1
  415. package/dist/server/runtime/http-server/daemon-admin/routecodex-x7e-gate.d.ts +22 -0
  416. package/dist/server/runtime/http-server/daemon-admin/routecodex-x7e-gate.js +70 -0
  417. package/dist/server/runtime/http-server/daemon-admin/routecodex-x7e-gate.js.map +1 -0
  418. package/dist/server/runtime/http-server/executor/antigravity-detector.d.ts +34 -0
  419. package/dist/server/runtime/http-server/executor/antigravity-detector.js +118 -0
  420. package/dist/server/runtime/http-server/executor/antigravity-detector.js.map +1 -0
  421. package/dist/server/runtime/http-server/executor/env-config.d.ts +13 -0
  422. package/dist/server/runtime/http-server/executor/env-config.js +20 -0
  423. package/dist/server/runtime/http-server/executor/env-config.js.map +1 -0
  424. package/dist/server/runtime/http-server/executor/index.d.ts +11 -0
  425. package/dist/server/runtime/http-server/executor/index.js +18 -0
  426. package/dist/server/runtime/http-server/executor/index.js.map +1 -0
  427. package/dist/server/runtime/http-server/executor/provider-request-context.d.ts +20 -0
  428. package/dist/server/runtime/http-server/executor/provider-request-context.js +38 -0
  429. package/dist/server/runtime/http-server/executor/provider-request-context.js.map +1 -0
  430. package/dist/server/runtime/http-server/executor/provider-response-converter.d.ts +23 -0
  431. package/dist/server/runtime/http-server/executor/provider-response-converter.js +337 -0
  432. package/dist/server/runtime/http-server/executor/provider-response-converter.js.map +1 -0
  433. package/dist/server/runtime/http-server/executor/provider-response-utils.d.ts +8 -0
  434. package/dist/server/runtime/http-server/executor/provider-response-utils.js +93 -0
  435. package/dist/server/runtime/http-server/executor/provider-response-utils.js.map +1 -0
  436. package/dist/server/runtime/http-server/executor/provider-runtime-resolver.d.ts +23 -0
  437. package/dist/server/runtime/http-server/executor/provider-runtime-resolver.js +85 -0
  438. package/dist/server/runtime/http-server/executor/provider-runtime-resolver.js.map +1 -0
  439. package/dist/server/runtime/http-server/executor/request-executor-core-utils.d.ts +7 -0
  440. package/dist/server/runtime/http-server/executor/request-executor-core-utils.js +39 -0
  441. package/dist/server/runtime/http-server/executor/request-executor-core-utils.js.map +1 -0
  442. package/dist/server/runtime/http-server/executor/request-retry-helpers.d.ts +16 -0
  443. package/dist/server/runtime/http-server/executor/request-retry-helpers.js +218 -0
  444. package/dist/server/runtime/http-server/executor/request-retry-helpers.js.map +1 -0
  445. package/dist/server/runtime/http-server/executor/retry-engine.d.ts +21 -0
  446. package/dist/server/runtime/http-server/executor/retry-engine.js +73 -0
  447. package/dist/server/runtime/http-server/executor/retry-engine.js.map +1 -0
  448. package/dist/server/runtime/http-server/executor/sse-error-handler.d.ts +14 -0
  449. package/dist/server/runtime/http-server/executor/sse-error-handler.js +127 -0
  450. package/dist/server/runtime/http-server/executor/sse-error-handler.js.map +1 -0
  451. package/dist/server/runtime/http-server/executor/usage-aggregator.d.ts +39 -0
  452. package/dist/server/runtime/http-server/executor/usage-aggregator.js +177 -0
  453. package/dist/server/runtime/http-server/executor/usage-aggregator.js.map +1 -0
  454. package/dist/server/runtime/http-server/executor/usage-logger.d.ts +7 -0
  455. package/dist/server/runtime/http-server/executor/usage-logger.js +13 -0
  456. package/dist/server/runtime/http-server/executor/usage-logger.js.map +1 -0
  457. package/dist/server/runtime/http-server/executor/utils.d.ts +21 -0
  458. package/dist/server/runtime/http-server/executor/utils.js +62 -0
  459. package/dist/server/runtime/http-server/executor/utils.js.map +1 -0
  460. package/dist/server/runtime/http-server/executor-metadata.js +83 -2
  461. package/dist/server/runtime/http-server/executor-metadata.js.map +1 -1
  462. package/dist/server/runtime/http-server/executor-response.js +17 -9
  463. package/dist/server/runtime/http-server/executor-response.js.map +1 -1
  464. package/dist/server/runtime/http-server/http-server-bootstrap.d.ts +31 -0
  465. package/dist/server/runtime/http-server/http-server-bootstrap.js +367 -0
  466. package/dist/server/runtime/http-server/http-server-bootstrap.js.map +1 -0
  467. package/dist/server/runtime/http-server/http-server-clock-daemon.d.ts +5 -0
  468. package/dist/server/runtime/http-server/http-server-clock-daemon.js +242 -0
  469. package/dist/server/runtime/http-server/http-server-clock-daemon.js.map +1 -0
  470. package/dist/server/runtime/http-server/http-server-legacy-pipeline.d.ts +2 -0
  471. package/dist/server/runtime/http-server/http-server-legacy-pipeline.js +65 -0
  472. package/dist/server/runtime/http-server/http-server-legacy-pipeline.js.map +1 -0
  473. package/dist/server/runtime/http-server/http-server-lifecycle.d.ts +27 -0
  474. package/dist/server/runtime/http-server/http-server-lifecycle.js +285 -0
  475. package/dist/server/runtime/http-server/http-server-lifecycle.js.map +1 -0
  476. package/dist/server/runtime/http-server/http-server-runtime-providers.d.ts +10 -0
  477. package/dist/server/runtime/http-server/http-server-runtime-providers.js +415 -0
  478. package/dist/server/runtime/http-server/http-server-runtime-providers.js.map +1 -0
  479. package/dist/server/runtime/http-server/http-server-runtime-setup.d.ts +2 -0
  480. package/dist/server/runtime/http-server/http-server-runtime-setup.js +93 -0
  481. package/dist/server/runtime/http-server/http-server-runtime-setup.js.map +1 -0
  482. package/dist/server/runtime/http-server/index.d.ts +4 -46
  483. package/dist/server/runtime/http-server/index.js +98 -2577
  484. package/dist/server/runtime/http-server/index.js.map +1 -1
  485. package/dist/server/runtime/http-server/request-executor.d.ts +8 -21
  486. package/dist/server/runtime/http-server/request-executor.js +94 -956
  487. package/dist/server/runtime/http-server/request-executor.js.map +1 -1
  488. package/dist/server/runtime/http-server/routes.js +2 -2
  489. package/dist/server/runtime/http-server/routes.js.map +1 -1
  490. package/dist/server/runtime/http-server/servertool-admin-state.d.ts +42 -0
  491. package/dist/server/runtime/http-server/servertool-admin-state.js +210 -0
  492. package/dist/server/runtime/http-server/servertool-admin-state.js.map +1 -0
  493. package/dist/server/runtime/http-server/stats-manager-internals.d.ts +96 -0
  494. package/dist/server/runtime/http-server/stats-manager-internals.js +311 -0
  495. package/dist/server/runtime/http-server/stats-manager-internals.js.map +1 -0
  496. package/dist/server/runtime/http-server/stats-manager-table.d.ts +6 -0
  497. package/dist/server/runtime/http-server/stats-manager-table.js +135 -0
  498. package/dist/server/runtime/http-server/stats-manager-table.js.map +1 -0
  499. package/dist/server/runtime/http-server/stats-manager.d.ts +0 -23
  500. package/dist/server/runtime/http-server/stats-manager.js +95 -483
  501. package/dist/server/runtime/http-server/stats-manager.js.map +1 -1
  502. package/dist/server/utils/client-connection-state.js +61 -0
  503. package/dist/server/utils/client-connection-state.js.map +1 -1
  504. package/dist/server/utils/request-id-manager.d.ts +6 -0
  505. package/dist/server/utils/request-id-manager.js +105 -15
  506. package/dist/server/utils/request-id-manager.js.map +1 -1
  507. package/dist/server/utils/stage-logger.js +14 -4
  508. package/dist/server/utils/stage-logger.js.map +1 -1
  509. package/dist/server-lifecycle/index.d.ts +6 -0
  510. package/dist/server-lifecycle/index.js +7 -0
  511. package/dist/server-lifecycle/index.js.map +1 -0
  512. package/dist/server-lifecycle/port-utils.d.ts +18 -0
  513. package/dist/server-lifecycle/port-utils.js +204 -0
  514. package/dist/server-lifecycle/port-utils.js.map +1 -0
  515. package/dist/sharedmodule/process-snapshot.d.ts +26 -0
  516. package/dist/sharedmodule/process-snapshot.js +141 -0
  517. package/dist/sharedmodule/process-snapshot.js.map +1 -0
  518. package/dist/token-daemon/index.js +10 -3
  519. package/dist/token-daemon/index.js.map +1 -1
  520. package/dist/token-daemon/token-daemon.js +9 -11
  521. package/dist/token-daemon/token-daemon.js.map +1 -1
  522. package/dist/token-daemon/token-utils.d.ts +1 -1
  523. package/dist/token-daemon/token-utils.js +19 -3
  524. package/dist/token-daemon/token-utils.js.map +1 -1
  525. package/dist/tools/semantic-replay-snapshot-loader.d.ts +4 -0
  526. package/dist/tools/semantic-replay-snapshot-loader.js +396 -0
  527. package/dist/tools/semantic-replay-snapshot-loader.js.map +1 -0
  528. package/dist/tools/semantic-replay.js +2 -393
  529. package/dist/tools/semantic-replay.js.map +1 -1
  530. package/dist/utils/daemon-stop-intent.d.ts +17 -0
  531. package/dist/utils/daemon-stop-intent.js +104 -0
  532. package/dist/utils/daemon-stop-intent.js.map +1 -0
  533. package/dist/utils/key-429-tracker.js +6 -5
  534. package/dist/utils/key-429-tracker.js.map +1 -1
  535. package/dist/utils/pipeline-health-manager.js +7 -6
  536. package/dist/utils/pipeline-health-manager.js.map +1 -1
  537. package/dist/utils/process-lifecycle-logger.js +45 -1
  538. package/dist/utils/process-lifecycle-logger.js.map +1 -1
  539. package/dist/utils/runtime-exit-forensics.d.ts +2 -2
  540. package/dist/utils/runtime-exit-forensics.js +10 -5
  541. package/dist/utils/runtime-exit-forensics.js.map +1 -1
  542. package/dist/utils/snapshot-writer.js +3 -3
  543. package/dist/utils/snapshot-writer.js.map +1 -1
  544. package/docs/QUOTA_MANAGER_V3.md +3 -0
  545. package/docs/VIRTUAL_ROUTER_PRIORITY_AND_HEALTH.md +114 -0
  546. package/docs/daemon-admin-ui.html +268 -11
  547. package/docs/file-line-limit-gate.md +30 -0
  548. package/docs/refactoring/host-164.3-responsibility-migration.md +62 -0
  549. package/docs/release-iflow-400-gate.md +58 -0
  550. package/docs/replay-evidence-iflow-400.txt +33 -0
  551. package/docs/stop-message-auto.md +4 -3
  552. package/package.json +4 -3
  553. package/scripts/auth-iflow-manual.mjs +13 -23
  554. package/scripts/camoufox/launch-auth.mjs +158 -10
  555. package/scripts/ci/check-file-line-limit.mjs +149 -0
  556. package/scripts/copy-compat-assets.mjs +26 -0
  557. package/scripts/copy-modules-config.mjs +18 -0
  558. package/scripts/tests/ci-jest.mjs +4 -0
  559. package/scripts/verify-codex-error-samples.mjs +27 -6
@@ -1,837 +1,17 @@
1
- import path from 'path';
2
- import { fileURLToPath } from 'url';
3
- import { createRequire } from 'module';
4
- import { importCoreModule, resolveCoreModulePath } from './core-loader.js';
5
- import { writeErrorsampleJson } from '../../utils/errorsamples.js';
6
- import { isLlmsEngineShadowEnabledForSubpath, recordLlmsEngineShadowDiff, resolveLlmsEngineShadowConfig, shouldRunLlmsEngineShadowForSubpath } from '../../utils/llms-engine-shadow.js';
7
- import { buildInfo } from '../../build-info.js';
8
- import { resolveLlmswitchCoreVersion } from '../../utils/runtime-versions.js';
9
- const require = createRequire(import.meta.url);
10
- function parsePrefixList(raw) {
11
- return String(raw || '')
12
- .split(',')
13
- .map((s) => s.trim())
14
- .filter(Boolean)
15
- .map((s) => s.replace(/^\/*/, '').replace(/\/+$/, ''));
16
- }
17
- function matchesPrefix(subpath, prefixes) {
18
- if (!prefixes.length) {
19
- return false;
20
- }
21
- const normalized = subpath.replace(/^\/*/, '').replace(/\.js$/i, '');
22
- return prefixes.some((prefix) => normalized === prefix || normalized.startsWith(`${prefix}/`));
23
- }
24
- function isEngineEnabled() {
25
- const raw = String(process.env.ROUTECODEX_LLMS_ENGINE_ENABLE || '').trim().toLowerCase();
26
- return raw === '1' || raw === 'true' || raw === 'yes';
27
- }
28
- function getEnginePrefixes() {
29
- return parsePrefixList(process.env.ROUTECODEX_LLMS_ENGINE_PREFIXES);
30
- }
31
- function resolveImplForSubpath(subpath) {
32
- if (!isEngineEnabled()) {
33
- return 'ts';
34
- }
35
- const enginePrefixes = getEnginePrefixes();
36
- if (matchesPrefix(subpath, enginePrefixes)) {
37
- return 'engine';
38
- }
39
- return 'ts';
40
- }
41
- async function importCoreDist(subpath, impl = resolveImplForSubpath(subpath)) {
42
- try {
43
- return await importCoreModule(subpath, impl);
44
- }
45
- catch (error) {
46
- const detail = error instanceof Error ? error.message : String(error);
47
- const pkg = impl === 'engine' ? '@jsonstudio/llms-engine' : '@jsonstudio/llms';
48
- throw new Error(`[llmswitch-bridge] Unable to load core module "${subpath}" (${impl}). 请确认 ${pkg} 依赖已安装(npm install)。${detail ? ` (${detail})` : ''}`);
49
- }
50
- }
51
- function requireCoreDist(subpath, impl = resolveImplForSubpath(subpath)) {
52
- if (impl === 'engine' && !isEngineEnabled()) {
53
- throw new Error('[llmswitch-bridge] ROUTECODEX_LLMS_ENGINE_ENABLE must be enabled to load engine core');
54
- }
55
- const modulePath = resolveCoreModulePath(subpath, impl);
56
- // eslint-disable-next-line @typescript-eslint/no-var-requires
57
- return require(modulePath);
58
- }
59
- let cachedAntigravitySignatureModule = null;
60
- let antigravitySignatureModuleWarmupPromise = null;
61
- function loadAntigravitySignatureModule() {
62
- if (cachedAntigravitySignatureModule) {
63
- return cachedAntigravitySignatureModule;
64
- }
65
- try {
66
- cachedAntigravitySignatureModule = requireCoreDist('conversion/compat/antigravity-session-signature');
67
- }
68
- catch {
69
- cachedAntigravitySignatureModule = null;
70
- }
71
- return cachedAntigravitySignatureModule;
72
- }
73
- export async function warmupAntigravitySessionSignatureModule() {
74
- if (cachedAntigravitySignatureModule) {
75
- return;
76
- }
77
- if (!antigravitySignatureModuleWarmupPromise) {
78
- antigravitySignatureModuleWarmupPromise = (async () => {
79
- try {
80
- return await importCoreDist('conversion/compat/antigravity-session-signature');
81
- }
82
- catch {
83
- return null;
84
- }
85
- })();
86
- }
87
- try {
88
- cachedAntigravitySignatureModule = await antigravitySignatureModuleWarmupPromise;
89
- }
90
- finally {
91
- antigravitySignatureModuleWarmupPromise = null;
92
- }
93
- }
94
- export function extractAntigravityGeminiSessionId(payload) {
95
- const mod = loadAntigravitySignatureModule();
96
- const fn = mod?.extractAntigravityGeminiSessionId;
97
- if (typeof fn !== 'function') {
98
- return undefined;
99
- }
100
- try {
101
- return fn(payload);
102
- }
103
- catch {
104
- return undefined;
105
- }
106
- }
107
- export function cacheAntigravitySessionSignature(a, b, c, d = 1) {
108
- const mod = loadAntigravitySignatureModule();
109
- const fn = mod?.cacheAntigravitySessionSignature;
110
- if (typeof fn !== 'function') {
111
- return;
112
- }
113
- const supportsAliasKey = typeof mod?.getAntigravitySessionSignature === 'function' &&
114
- mod.getAntigravitySessionSignature.length >= 2;
115
- const isNewSignature = typeof c === 'string';
116
- const aliasKey = isNewSignature ? a : 'antigravity.unknown';
117
- const sessionId = isNewSignature ? b : a;
118
- const signature = isNewSignature ? c : b;
119
- const messageCount = typeof c === 'number' ? c : typeof d === 'number' ? d : 1;
120
- try {
121
- if (isNewSignature && supportsAliasKey) {
122
- fn(aliasKey, sessionId, signature, messageCount);
123
- }
124
- else {
125
- fn(sessionId, signature, messageCount);
126
- }
127
- }
128
- catch {
129
- // best-effort only
130
- }
131
- }
132
- export function getAntigravityLatestSignatureSessionIdForAlias(aliasKey, options) {
133
- const mod = loadAntigravitySignatureModule();
134
- const fn = mod?.getAntigravityLatestSignatureSessionIdForAlias;
135
- if (typeof fn !== 'function') {
136
- return undefined;
137
- }
138
- try {
139
- const out = fn(aliasKey, options);
140
- return typeof out === 'string' && out.trim().length ? out.trim() : undefined;
141
- }
142
- catch {
143
- return undefined;
144
- }
145
- }
146
- export function lookupAntigravitySessionSignatureEntry(aliasKey, sessionId, options) {
147
- const mod = loadAntigravitySignatureModule();
148
- const fn = mod?.lookupAntigravitySessionSignatureEntry;
149
- if (typeof fn !== 'function') {
150
- return undefined;
151
- }
152
- try {
153
- const out = fn(aliasKey, sessionId, options);
154
- return out && typeof out === 'object' ? out : undefined;
155
- }
156
- catch {
157
- return undefined;
158
- }
159
- }
160
- export function invalidateAntigravitySessionSignature(aliasKey, sessionId) {
161
- const mod = loadAntigravitySignatureModule();
162
- const fn = mod?.invalidateAntigravitySessionSignature;
163
- if (typeof fn !== 'function') {
164
- return;
165
- }
166
- try {
167
- fn(aliasKey, sessionId);
168
- }
169
- catch {
170
- // best-effort only
171
- }
172
- }
173
- export function resetAntigravitySessionSignatureCachesForTests() {
174
- const mod = loadAntigravitySignatureModule();
175
- const fn = mod?.resetAntigravitySessionSignatureCachesForTests;
176
- if (typeof fn !== 'function') {
177
- return;
178
- }
179
- try {
180
- fn();
181
- }
182
- catch {
183
- // best-effort only
184
- }
185
- }
186
- let quotaModulePromise = null;
187
- let cachedQuotaModuleError = null;
188
- async function importQuotaModule() {
189
- if (!quotaModulePromise) {
190
- quotaModulePromise = (async () => {
191
- try {
192
- const mod = await importCoreDist('quota/index');
193
- cachedQuotaModuleError = null;
194
- return mod;
195
- }
196
- catch {
197
- cachedQuotaModuleError = 'failed to import core module quota/index (resolveCoreModulePath or import failed)';
198
- return null;
199
- }
200
- })();
201
- }
202
- return await quotaModulePromise;
203
- }
204
- export async function createCoreQuotaManager(options) {
205
- const mod = await importQuotaModule();
206
- const Ctor = mod?.QuotaManager;
207
- if (typeof Ctor !== 'function') {
208
- throw new Error(`[llmswitch-bridge] core QuotaManager not available; please update @jsonstudio/llms${cachedQuotaModuleError ? ` (${cachedQuotaModuleError})` : ''}`);
209
- }
210
- return new Ctor({ ...(options ?? {}) });
211
- }
212
- export function configureAntigravitySessionSignaturePersistence(input) {
213
- const mod = loadAntigravitySignatureModule();
214
- const fn = mod?.configureAntigravitySessionSignaturePersistence;
215
- if (typeof fn !== 'function') {
216
- return;
217
- }
218
- try {
219
- fn(input);
220
- }
221
- catch {
222
- // best-effort only
223
- }
224
- }
225
- export function flushAntigravitySessionSignaturePersistenceSync() {
226
- const mod = loadAntigravitySignatureModule();
227
- const fn = mod?.flushAntigravitySessionSignaturePersistenceSync;
228
- if (typeof fn !== 'function') {
229
- return;
230
- }
231
- try {
232
- fn();
233
- }
234
- catch {
235
- // best-effort only
236
- }
237
- }
238
- export async function writeSnapshotViaHooks(channelOrOptions, payload) {
239
- let hooksModule = null;
240
- try {
241
- hooksModule = await importCoreDist('conversion/shared/snapshot-hooks');
242
- }
243
- catch {
244
- hooksModule = null;
245
- }
246
- const writer = hooksModule?.writeSnapshotViaHooks;
247
- if (typeof writer !== 'function') {
248
- return;
249
- }
250
- let options;
251
- if (payload && typeof channelOrOptions === 'string') {
252
- const channelValue = typeof payload.channel === 'string' && payload.channel ? payload.channel : channelOrOptions;
253
- options = {
254
- ...payload,
255
- channel: channelValue
256
- };
257
- }
258
- else if (channelOrOptions && typeof channelOrOptions === 'object') {
259
- options = channelOrOptions;
260
- }
261
- if (!options) {
262
- return;
263
- }
264
- await writer(options);
265
- }
266
- export async function resumeResponsesConversation(responseId, submitPayload, options) {
267
- const mod = await importCoreDist('conversion/shared/responses-conversation-store');
268
- const fn = mod.resumeResponsesConversation;
269
- if (typeof fn !== 'function') {
270
- throw new Error('[llmswitch-bridge] resumeResponsesConversation not available');
271
- }
272
- return await fn(responseId, submitPayload, options);
273
- }
274
- export async function rebindResponsesConversationRequestId(oldId, newId) {
275
- if (!oldId || !newId || oldId === newId) {
276
- return;
277
- }
278
- const mod = await importCoreDist('conversion/shared/responses-conversation-store');
279
- const fn = mod.rebindResponsesConversationRequestId;
280
- if (typeof fn === 'function') {
281
- fn(oldId, newId);
282
- }
283
- }
284
- const cachedConvertProviderResponseByImpl = {
285
- ts: null,
286
- engine: null
287
- };
288
- const llmsEngineShadowConfig = resolveLlmsEngineShadowConfig();
289
1
  /**
290
- * Host/HTTP 侧统一使用的 provider 响应转换入口。
291
- * 封装 llmswitch-core 的 convertProviderResponse,避免在 Host 内部直接 import core 模块。
2
+ * RouteCodex LLM Switch Bridge
3
+ *
4
+ * Single boundary module for llmswitch-core integration.
292
5
  */
293
- export async function convertProviderResponse(options) {
294
- const subpath = 'conversion/hub/response/provider-response';
295
- const ensureFn = async (impl) => {
296
- if (!cachedConvertProviderResponseByImpl[impl]) {
297
- const mod = await importCoreDist(subpath, impl);
298
- const fn = mod.convertProviderResponse;
299
- if (typeof fn !== 'function') {
300
- throw new Error('[llmswitch-bridge] convertProviderResponse not available');
301
- }
302
- cachedConvertProviderResponseByImpl[impl] = async (opts) => {
303
- const result = fn(opts);
304
- return result instanceof Promise ? await result : result;
305
- };
306
- }
307
- return cachedConvertProviderResponseByImpl[impl];
308
- };
309
- const shadowEnabled = isLlmsEngineShadowEnabledForSubpath(llmsEngineShadowConfig, 'conversion/hub/response');
310
- if (shadowEnabled) {
311
- // Fail fast: if shadow is enabled for this module, engine core must be available.
312
- await ensureFn('engine');
313
- }
314
- const wantsShadow = shadowEnabled && shouldRunLlmsEngineShadowForSubpath(llmsEngineShadowConfig, 'conversion/hub/response');
315
- if (wantsShadow) {
316
- const baseline = await (await ensureFn('ts'))(options);
317
- const requestId = typeof options.requestId === 'string'
318
- ? String(options.requestId)
319
- : (typeof options.id === 'string' ? String(options.id) : `shadow_${Date.now()}`);
320
- void (async () => {
321
- try {
322
- const candidate = await (await ensureFn('engine'))(options);
323
- await recordLlmsEngineShadowDiff({
324
- group: 'provider-response',
325
- requestId,
326
- subpath: 'conversion/hub/response',
327
- baselineImpl: 'ts',
328
- candidateImpl: 'engine',
329
- baselineOut: baseline,
330
- candidateOut: candidate,
331
- excludedComparePaths: []
332
- });
333
- }
334
- catch (error) {
335
- // eslint-disable-next-line no-console
336
- console.error('[llms-engine-shadow] provider response shadow failed:', error);
337
- }
338
- })();
339
- return baseline;
340
- }
341
- const impl = resolveImplForSubpath(subpath);
342
- return await (await ensureFn(impl))(options);
343
- }
344
- let cachedSnapshotRecorderFactory = null;
345
- /**
346
- * 为 HubPipeline / provider 响应路径创建阶段快照记录器。
347
- * 内部通过 llmswitch-core 的 snapshot-recorder 模块实现。
348
- */
349
- export async function createSnapshotRecorder(context, endpoint) {
350
- if (!cachedSnapshotRecorderFactory) {
351
- const mod = await importCoreDist('conversion/hub/snapshot-recorder');
352
- const factory = mod.createSnapshotRecorder;
353
- if (typeof factory !== 'function') {
354
- throw new Error('[llmswitch-bridge] createSnapshotRecorder not available');
355
- }
356
- cachedSnapshotRecorderFactory = factory;
357
- }
358
- const recorder = cachedSnapshotRecorderFactory(context, endpoint);
359
- const baseRecord = typeof recorder?.record === 'function' ? recorder.record.bind(recorder) : null;
360
- if (!baseRecord) {
361
- return recorder;
362
- }
363
- return {
364
- ...recorder,
365
- record(stage, payload) {
366
- baseRecord(stage, payload);
367
- try {
368
- if (!stage || typeof stage !== 'string')
369
- return;
370
- const p = payload;
371
- if (!p || typeof p !== 'object')
372
- return;
373
- if (stage.startsWith('hub_policy.')) {
374
- const violations = p.violations;
375
- if (!Array.isArray(violations) || violations.length <= 0)
376
- return;
377
- void writeErrorsampleJson({
378
- group: 'policy',
379
- kind: stage,
380
- payload: {
381
- kind: 'hub_policy_violation',
382
- timestamp: new Date().toISOString(),
383
- endpoint,
384
- stage,
385
- versions: {
386
- routecodex: buildInfo.version,
387
- llms: resolveLlmswitchCoreVersion(),
388
- node: process.version
389
- },
390
- ...(context && typeof context === 'object'
391
- ? {
392
- requestId: context.requestId,
393
- providerProtocol: context.providerProtocol,
394
- runtime: context.runtime
395
- }
396
- : {}),
397
- observation: payload
398
- }
399
- }).catch(() => { });
400
- return;
401
- }
402
- if (stage.startsWith('hub_toolsurface.')) {
403
- const diffCount = typeof p.diffCount === 'number' ? p.diffCount : 0;
404
- if (!(diffCount > 0))
405
- return;
406
- void writeErrorsampleJson({
407
- group: 'tool-surface',
408
- kind: stage,
409
- payload: {
410
- kind: 'hub_toolsurface_diff',
411
- timestamp: new Date().toISOString(),
412
- endpoint,
413
- stage,
414
- versions: {
415
- routecodex: buildInfo.version,
416
- llms: resolveLlmswitchCoreVersion(),
417
- node: process.version
418
- },
419
- ...(context && typeof context === 'object'
420
- ? {
421
- requestId: context.requestId,
422
- providerProtocol: context.providerProtocol,
423
- runtime: context.runtime
424
- }
425
- : {}),
426
- observation: payload
427
- }
428
- }).catch(() => { });
429
- return;
430
- }
431
- if (stage.startsWith('hub_followup.')) {
432
- const diffCount = typeof p.diffCount === 'number' ? p.diffCount : 0;
433
- if (!(diffCount > 0))
434
- return;
435
- void writeErrorsampleJson({
436
- group: 'followup',
437
- kind: stage,
438
- payload: {
439
- kind: 'hub_followup_diff',
440
- timestamp: new Date().toISOString(),
441
- endpoint,
442
- stage,
443
- versions: {
444
- routecodex: buildInfo.version,
445
- llms: resolveLlmswitchCoreVersion(),
446
- node: process.version
447
- },
448
- ...(context && typeof context === 'object'
449
- ? {
450
- requestId: context.requestId,
451
- providerProtocol: context.providerProtocol,
452
- runtime: context.runtime
453
- }
454
- : {}),
455
- observation: payload
456
- }
457
- }).catch(() => { });
458
- return;
459
- }
460
- }
461
- catch {
462
- // best-effort only; must never break request path
463
- }
464
- }
465
- };
466
- }
467
- let cachedResponsesSseConverterFactory = null;
468
- /**
469
- * 创建 Responses SSE→JSON 转换器实例,供 ResponsesProvider 使用。
470
- */
471
- export async function createResponsesSseToJsonConverter() {
472
- if (!cachedResponsesSseConverterFactory) {
473
- const mod = await importCoreDist('sse/sse-to-json/index');
474
- const Ctor = mod.ResponsesSseToJsonConverter;
475
- if (typeof Ctor !== 'function') {
476
- throw new Error('[llmswitch-bridge] ResponsesSseToJsonConverter not available');
477
- }
478
- cachedResponsesSseConverterFactory = () => new Ctor();
479
- }
480
- return cachedResponsesSseConverterFactory();
481
- }
482
- let cachedProviderErrorCenter = null;
483
- /**
484
- * ProviderErrorCenter 统一桥接入口。
485
- * Provider/Host 通过本函数获取 error center,避免直接 import core 模块。
486
- */
487
- export async function getProviderErrorCenter() {
488
- if (!cachedProviderErrorCenter) {
489
- const mod = await importCoreDist('router/virtual-router/error-center');
490
- const center = mod.providerErrorCenter;
491
- if (!center) {
492
- throw new Error('[llmswitch-bridge] providerErrorCenter not available');
493
- }
494
- cachedProviderErrorCenter = center;
495
- }
496
- return cachedProviderErrorCenter;
497
- }
498
- let cachedProviderSuccessCenter = null;
499
- /**
500
- * ProviderSuccessCenter 统一桥接入口。
501
- * Host 通过本函数获取 success center,避免直接 import core 模块。
502
- */
503
- export async function getProviderSuccessCenter() {
504
- if (!cachedProviderSuccessCenter) {
505
- const mod = await importCoreDist('router/virtual-router/success-center');
506
- const center = mod.providerSuccessCenter;
507
- if (!center) {
508
- throw new Error('[llmswitch-bridge] providerSuccessCenter not available');
509
- }
510
- cachedProviderSuccessCenter = center;
511
- }
512
- return cachedProviderSuccessCenter;
513
- }
514
- let cachedStickySessionStore = undefined;
515
- function getStickySessionStoreExports() {
516
- if (cachedStickySessionStore !== undefined) {
517
- return cachedStickySessionStore;
518
- }
519
- try {
520
- // NOTE: must be sync because VirtualRouter routingStateStore expects loadSync.
521
- // Centralized here to keep a single core import surface.
522
- cachedStickySessionStore = requireCoreDist('router/virtual-router/sticky-session-store');
523
- }
524
- catch {
525
- cachedStickySessionStore = null;
526
- }
527
- return cachedStickySessionStore;
528
- }
529
- export function loadRoutingInstructionStateSync(key) {
530
- const mod = getStickySessionStoreExports();
531
- const fn = mod?.loadRoutingInstructionStateSync;
532
- if (typeof fn !== 'function') {
533
- return null;
534
- }
535
- return fn(key);
536
- }
537
- export function saveRoutingInstructionStateAsync(key, state) {
538
- const mod = getStickySessionStoreExports();
539
- const fn = mod?.saveRoutingInstructionStateAsync;
540
- if (typeof fn !== 'function') {
541
- return;
542
- }
543
- fn(key, state);
544
- }
545
- export function saveRoutingInstructionStateSync(key, state) {
546
- const mod = getStickySessionStoreExports();
547
- const fn = mod?.saveRoutingInstructionStateSync;
548
- if (typeof fn !== 'function') {
549
- return;
550
- }
551
- fn(key, state);
552
- }
553
- let cachedSessionIdentifiersModule = undefined;
554
- function getSessionIdentifiersModule() {
555
- if (cachedSessionIdentifiersModule !== undefined) {
556
- return cachedSessionIdentifiersModule;
557
- }
558
- try {
559
- cachedSessionIdentifiersModule = requireCoreDist('conversion/hub/pipeline/session-identifiers');
560
- }
561
- catch {
562
- cachedSessionIdentifiersModule = null;
563
- }
564
- return cachedSessionIdentifiersModule;
565
- }
566
- export function extractSessionIdentifiersFromMetadata(meta) {
567
- const mod = getSessionIdentifiersModule();
568
- const fn = mod?.extractSessionIdentifiersFromMetadata;
569
- if (typeof fn !== 'function') {
570
- return {};
571
- }
572
- try {
573
- return fn(meta);
574
- }
575
- catch {
576
- return {};
577
- }
578
- }
579
- let cachedStatsCenter = undefined;
580
- export function getStatsCenterSafe() {
581
- if (cachedStatsCenter) {
582
- return cachedStatsCenter;
583
- }
584
- if (cachedStatsCenter === null) {
585
- return { recordProviderUsage: () => { } };
586
- }
587
- try {
588
- const mod = requireCoreDist('telemetry/stats-center');
589
- const fn = mod?.getStatsCenter;
590
- const center = typeof fn === 'function' ? fn() : null;
591
- if (center && typeof center.recordProviderUsage === 'function') {
592
- cachedStatsCenter = center;
593
- return center;
594
- }
595
- }
596
- catch {
597
- // fall through
598
- }
599
- cachedStatsCenter = null;
600
- return { recordProviderUsage: () => { } };
601
- }
602
- export function getLlmsStatsSnapshot() {
603
- try {
604
- const mod = requireCoreDist('telemetry/stats-center');
605
- const get = mod?.getStatsCenter;
606
- const center = typeof get === 'function' ? get() : null;
607
- const snap = center && typeof center === 'object' ? center.getSnapshot : null;
608
- return typeof snap === 'function' ? snap.call(center) : null;
609
- }
610
- catch {
611
- return null;
612
- }
613
- }
614
- /**
615
- * 通过 llmswitch-core 的 bootstrapVirtualRouterConfig 预处理 Virtual Router 配置。
616
- */
617
- export async function bootstrapVirtualRouterConfig(input) {
618
- const mod = await importCoreDist('router/virtual-router/bootstrap');
619
- const fn = mod.bootstrapVirtualRouterConfig;
620
- if (typeof fn !== 'function') {
621
- throw new Error('[llmswitch-bridge] bootstrapVirtualRouterConfig not available');
622
- }
623
- return fn(input);
624
- }
625
- let cachedClockTaskStoreModule = undefined;
626
- let clockTaskStoreLastLoadAttemptAtMs = 0;
627
- let hasLoggedClockTaskStoreLoadFailure = false;
628
- const CLOCK_TASK_STORE_RETRY_INTERVAL_MS = 30_000;
629
- async function tryLoadClockTaskStoreModule() {
630
- try {
631
- return await importCoreDist('servertool/clock/task-store');
632
- }
633
- catch {
634
- // fallback to legacy split exports
635
- }
636
- try {
637
- const [tasksModule, configModule] = await Promise.all([
638
- importCoreDist('servertool/clock/tasks'),
639
- importCoreDist('servertool/clock/config')
640
- ]);
641
- return {
642
- ...tasksModule,
643
- resolveClockConfig: configModule.resolveClockConfig
644
- };
645
- }
646
- catch {
647
- return null;
648
- }
649
- }
650
- async function getClockTaskStoreModuleSafe() {
651
- if (cachedClockTaskStoreModule) {
652
- return cachedClockTaskStoreModule;
653
- }
654
- const now = Date.now();
655
- if (cachedClockTaskStoreModule === null &&
656
- now - clockTaskStoreLastLoadAttemptAtMs < CLOCK_TASK_STORE_RETRY_INTERVAL_MS) {
657
- return null;
658
- }
659
- clockTaskStoreLastLoadAttemptAtMs = now;
660
- const loaded = await tryLoadClockTaskStoreModule();
661
- if (loaded) {
662
- cachedClockTaskStoreModule = loaded;
663
- hasLoggedClockTaskStoreLoadFailure = false;
664
- return loaded;
665
- }
666
- cachedClockTaskStoreModule = null;
667
- if (!hasLoggedClockTaskStoreLoadFailure) {
668
- hasLoggedClockTaskStoreLoadFailure = true;
669
- console.warn('[llmswitch-bridge] clock task-store module unavailable; clock daemon inject/tasks are temporarily disabled. Please ensure @jsonstudio/llms dist is built and installed.');
670
- }
671
- return null;
672
- }
673
- export async function resolveClockConfigSnapshot(input) {
674
- const mod = await getClockTaskStoreModuleSafe();
675
- const fn = mod?.resolveClockConfig;
676
- if (typeof fn !== 'function') {
677
- return null;
678
- }
679
- try {
680
- return fn(input) ?? null;
681
- }
682
- catch {
683
- return null;
684
- }
685
- }
686
- export async function reserveClockDueTasks(args) {
687
- const mod = await getClockTaskStoreModuleSafe();
688
- const fn = mod?.reserveDueTasksForRequest;
689
- if (typeof fn !== 'function') {
690
- return { reservation: null };
691
- }
692
- try {
693
- return await fn(args);
694
- }
695
- catch {
696
- return { reservation: null };
697
- }
698
- }
699
- export async function commitClockDueReservation(args) {
700
- const mod = await getClockTaskStoreModuleSafe();
701
- const fn = mod?.commitClockReservation;
702
- if (typeof fn !== 'function') {
703
- return;
704
- }
705
- try {
706
- await fn(args.reservation, args.config);
707
- }
708
- catch {
709
- // best-effort only
710
- }
711
- }
712
- export async function listClockSessionIdsSnapshot() {
713
- const mod = await getClockTaskStoreModuleSafe();
714
- const fn = mod?.listClockSessionIds;
715
- if (typeof fn !== 'function') {
716
- return [];
717
- }
718
- try {
719
- const out = await fn();
720
- return Array.isArray(out) ? out.filter((item) => typeof item === 'string' && item.trim()).map((item) => item.trim()) : [];
721
- }
722
- catch {
723
- return [];
724
- }
725
- }
726
- export async function listClockTasksSnapshot(args) {
727
- const mod = await getClockTaskStoreModuleSafe();
728
- const fn = mod?.listClockTasks;
729
- if (typeof fn !== 'function') {
730
- return [];
731
- }
732
- try {
733
- const out = await fn(args.sessionId, args.config);
734
- return Array.isArray(out) ? out : [];
735
- }
736
- catch {
737
- return [];
738
- }
739
- }
740
- export async function scheduleClockTasksSnapshot(args) {
741
- const mod = await getClockTaskStoreModuleSafe();
742
- const fn = mod?.scheduleClockTasks;
743
- if (typeof fn !== 'function') {
744
- return [];
745
- }
746
- try {
747
- const out = await fn(args.sessionId, Array.isArray(args.items) ? args.items : [], args.config);
748
- return Array.isArray(out) ? out : [];
749
- }
750
- catch {
751
- return [];
752
- }
753
- }
754
- export async function updateClockTaskSnapshot(args) {
755
- const mod = await getClockTaskStoreModuleSafe();
756
- const fn = mod?.updateClockTask;
757
- if (typeof fn !== 'function') {
758
- return null;
759
- }
760
- try {
761
- return await fn(args.sessionId, args.taskId, args.patch, args.config);
762
- }
763
- catch {
764
- return null;
765
- }
766
- }
767
- export async function cancelClockTaskSnapshot(args) {
768
- const mod = await getClockTaskStoreModuleSafe();
769
- const fn = mod?.cancelClockTask;
770
- if (typeof fn !== 'function') {
771
- return false;
772
- }
773
- try {
774
- return Boolean(await fn(args.sessionId, args.taskId, args.config));
775
- }
776
- catch {
777
- return false;
778
- }
779
- }
780
- export async function clearClockTasksSnapshot(args) {
781
- const mod = await getClockTaskStoreModuleSafe();
782
- const fn = mod?.clearClockTasks;
783
- if (typeof fn !== 'function') {
784
- return 0;
785
- }
786
- try {
787
- const removed = await fn(args.sessionId, args.config);
788
- return Number.isFinite(Number(removed)) ? Math.max(0, Math.floor(Number(removed))) : 0;
789
- }
790
- catch {
791
- return 0;
792
- }
793
- }
794
- const cachedHubPipelineCtorByImpl = {
795
- ts: null,
796
- engine: null
797
- };
798
- /**
799
- * 获取 HubPipeline 构造函数,供 Host 创建 HubPipeline 实例。
800
- */
801
- export async function getHubPipelineCtor() {
802
- const impl = resolveImplForSubpath('conversion/hub/pipeline/hub-pipeline');
803
- if (!cachedHubPipelineCtorByImpl[impl]) {
804
- const mod = await importCoreDist('conversion/hub/pipeline/hub-pipeline', impl);
805
- const Ctor = mod.HubPipeline;
806
- if (typeof Ctor !== 'function') {
807
- throw new Error('[llmswitch-bridge] HubPipeline constructor not available');
808
- }
809
- cachedHubPipelineCtorByImpl[impl] = Ctor;
810
- }
811
- return cachedHubPipelineCtorByImpl[impl];
812
- }
813
- export async function getHubPipelineCtorForImpl(impl) {
814
- if (!cachedHubPipelineCtorByImpl[impl]) {
815
- const mod = await importCoreDist('conversion/hub/pipeline/hub-pipeline', impl);
816
- const Ctor = mod.HubPipeline;
817
- if (typeof Ctor !== 'function') {
818
- throw new Error('[llmswitch-bridge] HubPipeline constructor not available');
819
- }
820
- cachedHubPipelineCtorByImpl[impl] = Ctor;
821
- }
822
- return cachedHubPipelineCtorByImpl[impl];
823
- }
824
- function resolveBaseDir() {
825
- const env = String(process.env.ROUTECODEX_BASEDIR || process.env.RCC_BASEDIR || '').trim();
826
- if (env) {
827
- return env;
828
- }
829
- try {
830
- const __filename = fileURLToPath(import.meta.url);
831
- return path.resolve(path.dirname(__filename), '../../..');
832
- }
833
- catch {
834
- return process.cwd();
835
- }
836
- }
6
+ // Core module loading utilities.
7
+ export { importCoreDist, requireCoreDist, resolveImplForSubpath } from './bridge/module-loader.js';
8
+ // Existing bridge exports.
9
+ export { createSnapshotRecorder } from './bridge/snapshot-recorder.js';
10
+ export { convertProviderResponse } from './bridge/response-converter.js';
11
+ export { warmupAntigravitySessionSignatureModule, extractAntigravityGeminiSessionId, cacheAntigravitySessionSignature, getAntigravityLatestSignatureSessionIdForAlias, lookupAntigravitySessionSignatureEntry, invalidateAntigravitySessionSignature, clearAntigravitySessionAliasPins, resetAntigravitySessionSignatureCachesForTests, configureAntigravitySessionSignaturePersistence, flushAntigravitySessionSignaturePersistenceSync } from './bridge/antigravity-signature.js';
12
+ // Newly factored bridge modules.
13
+ export { createCoreQuotaManager } from './bridge/quota-manager.js';
14
+ export { writeSnapshotViaHooks, resumeResponsesConversation, rebindResponsesConversationRequestId, createResponsesSseToJsonConverter, getProviderErrorCenter, getProviderSuccessCenter } from './bridge/runtime-integrations.js';
15
+ export { loadRoutingInstructionStateSync, saveRoutingInstructionStateAsync, saveRoutingInstructionStateSync, extractSessionIdentifiersFromMetadata, getStatsCenterSafe, getLlmsStatsSnapshot, resolveClockConfigSnapshot, reserveClockDueTasks, commitClockDueReservation, listClockSessionIdsSnapshot, listClockTasksSnapshot, scheduleClockTasksSnapshot, updateClockTaskSnapshot, cancelClockTaskSnapshot, clearClockTasksSnapshot } from './bridge/state-integrations.js';
16
+ export { bootstrapVirtualRouterConfig, getHubPipelineCtor, getHubPipelineCtorForImpl, resolveBaseDir } from './bridge/routing-integrations.js';
837
17
  //# sourceMappingURL=bridge.js.map