@jsonstudio/rcc 0.90.367 → 0.90.429

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 (1185) hide show
  1. package/config/providers/ali-coding-plan.json +5 -0
  2. package/dist/build-info.js +2 -2
  3. package/dist/cli/commands/codex.js +37 -35
  4. package/dist/cli/commands/codex.js.map +1 -1
  5. package/dist/cli/commands/heartbeat.d.ts +20 -0
  6. package/dist/cli/commands/heartbeat.js +184 -0
  7. package/dist/cli/commands/heartbeat.js.map +1 -0
  8. package/dist/cli/commands/launcher/types.d.ts +0 -1
  9. package/dist/cli/commands/launcher-kernel.js +165 -73
  10. package/dist/cli/commands/launcher-kernel.js.map +1 -1
  11. package/dist/cli/commands/start.js +5 -3
  12. package/dist/cli/commands/start.js.map +1 -1
  13. package/dist/cli/register/heartbeat-command.d.ts +3 -0
  14. package/dist/cli/register/heartbeat-command.js +5 -0
  15. package/dist/cli/register/heartbeat-command.js.map +1 -0
  16. package/dist/cli.js +11 -0
  17. package/dist/cli.js.map +1 -1
  18. package/dist/commands/validate.js +34 -13
  19. package/dist/commands/validate.js.map +1 -1
  20. package/dist/config/user-data-paths.js +14 -3
  21. package/dist/config/user-data-paths.js.map +1 -1
  22. package/dist/index.js +31 -12
  23. package/dist/index.js.map +1 -1
  24. package/dist/manager/modules/quota/antigravity-quota-manager.js +50 -37
  25. package/dist/manager/modules/quota/antigravity-quota-manager.js.map +1 -1
  26. package/dist/manager/modules/quota/antigravity-quota-persistence.js +23 -14
  27. package/dist/manager/modules/quota/antigravity-quota-persistence.js.map +1 -1
  28. package/dist/manager/modules/quota/antigravity-quota-runtime.js +20 -11
  29. package/dist/manager/modules/quota/antigravity-quota-runtime.js.map +1 -1
  30. package/dist/manager/modules/quota/quota-adapter.js +28 -12
  31. package/dist/manager/modules/quota/quota-adapter.js.map +1 -1
  32. package/dist/manager/quota/provider-quota-store.js +17 -11
  33. package/dist/manager/quota/provider-quota-store.js.map +1 -1
  34. package/dist/manager/storage/file-store.js +15 -9
  35. package/dist/manager/storage/file-store.js.map +1 -1
  36. package/dist/modules/llmswitch/bridge/index.d.ts +1 -1
  37. package/dist/modules/llmswitch/bridge/index.js +1 -1
  38. package/dist/modules/llmswitch/bridge/index.js.map +1 -1
  39. package/dist/modules/llmswitch/bridge/module-loader.js +2 -2
  40. package/dist/modules/llmswitch/bridge/module-loader.js.map +1 -1
  41. package/dist/modules/llmswitch/bridge/quota-manager.js +1 -1
  42. package/dist/modules/llmswitch/bridge/quota-manager.js.map +1 -1
  43. package/dist/modules/llmswitch/bridge/runtime-integrations.d.ts +1 -1
  44. package/dist/modules/llmswitch/bridge/runtime-integrations.js +1 -1
  45. package/dist/modules/llmswitch/bridge/runtime-integrations.js.map +1 -1
  46. package/dist/modules/llmswitch/bridge/snapshot-recorder.js +4 -1
  47. package/dist/modules/llmswitch/bridge/snapshot-recorder.js.map +1 -1
  48. package/dist/modules/llmswitch/bridge/state-integrations.d.ts +28 -0
  49. package/dist/modules/llmswitch/bridge/state-integrations.js +138 -0
  50. package/dist/modules/llmswitch/bridge/state-integrations.js.map +1 -1
  51. package/dist/modules/llmswitch/bridge.d.ts +6 -6
  52. package/dist/modules/llmswitch/bridge.js +1 -1
  53. package/dist/modules/llmswitch/bridge.js.map +1 -1
  54. package/dist/modules/llmswitch/core-loader.js +24 -35
  55. package/dist/modules/llmswitch/core-loader.js.map +1 -1
  56. package/dist/providers/auth/oauth-auth.js +5 -3
  57. package/dist/providers/auth/oauth-auth.js.map +1 -1
  58. package/dist/providers/auth/oauth-lifecycle.js +84 -34
  59. package/dist/providers/auth/oauth-lifecycle.js.map +1 -1
  60. package/dist/providers/auth/tokenfile-auth.js +22 -12
  61. package/dist/providers/auth/tokenfile-auth.js.map +1 -1
  62. package/dist/providers/core/api/provider-types.d.ts +16 -0
  63. package/dist/providers/core/strategies/oauth-auth-code-flow.js +3 -1
  64. package/dist/providers/core/strategies/oauth-auth-code-flow.js.map +1 -1
  65. package/dist/providers/core/utils/snapshot-writer.js +28 -18
  66. package/dist/providers/core/utils/snapshot-writer.js.map +1 -1
  67. package/dist/server/handlers/handler-response-utils.js +21 -7
  68. package/dist/server/handlers/handler-response-utils.js.map +1 -1
  69. package/dist/server/handlers/handler-utils.js +16 -8
  70. package/dist/server/handlers/handler-utils.js.map +1 -1
  71. package/dist/server/runtime/http-server/clock-runtime-hooks.js +7 -10
  72. package/dist/server/runtime/http-server/clock-runtime-hooks.js.map +1 -1
  73. package/dist/server/runtime/http-server/daemon-admin/providers-handler-routing-utils.js +0 -30
  74. package/dist/server/runtime/http-server/daemon-admin/providers-handler-routing-utils.js.map +1 -1
  75. package/dist/server/runtime/http-server/daemon-admin/providers-handler.js +1 -113
  76. package/dist/server/runtime/http-server/daemon-admin/providers-handler.js.map +1 -1
  77. package/dist/server/runtime/http-server/daemon-admin/status-handler.js +11 -2
  78. package/dist/server/runtime/http-server/daemon-admin/status-handler.js.map +1 -1
  79. package/dist/server/runtime/http-server/executor/client-injection-flow.js +9 -8
  80. package/dist/server/runtime/http-server/executor/client-injection-flow.js.map +1 -1
  81. package/dist/server/runtime/http-server/executor/provider-response-converter.js +2 -133
  82. package/dist/server/runtime/http-server/executor/provider-response-converter.js.map +1 -1
  83. package/dist/server/runtime/http-server/executor-metadata.js +29 -5
  84. package/dist/server/runtime/http-server/executor-metadata.js.map +1 -1
  85. package/dist/server/runtime/http-server/executor-response.js +1 -62
  86. package/dist/server/runtime/http-server/executor-response.js.map +1 -1
  87. package/dist/server/runtime/http-server/heartbeat-runtime-hooks.d.ts +23 -0
  88. package/dist/server/runtime/http-server/heartbeat-runtime-hooks.js +140 -0
  89. package/dist/server/runtime/http-server/heartbeat-runtime-hooks.js.map +1 -0
  90. package/dist/server/runtime/http-server/http-server-lifecycle.js +2 -0
  91. package/dist/server/runtime/http-server/http-server-lifecycle.js.map +1 -1
  92. package/dist/server/runtime/http-server/http-server-runtime-setup.js +2 -0
  93. package/dist/server/runtime/http-server/http-server-runtime-setup.js.map +1 -1
  94. package/dist/server/runtime/http-server/http-server-session-daemon.d.ts +1 -0
  95. package/dist/server/runtime/http-server/http-server-session-daemon.js +27 -8
  96. package/dist/server/runtime/http-server/http-server-session-daemon.js.map +1 -1
  97. package/dist/server/runtime/http-server/index.d.ts +1 -0
  98. package/dist/server/runtime/http-server/index.js +20 -1
  99. package/dist/server/runtime/http-server/index.js.map +1 -1
  100. package/dist/server/runtime/http-server/request-activity-tracker.d.ts +7 -0
  101. package/dist/server/runtime/http-server/request-activity-tracker.js +58 -0
  102. package/dist/server/runtime/http-server/request-activity-tracker.js.map +1 -0
  103. package/dist/server/runtime/http-server/request-executor.d.ts +7 -0
  104. package/dist/server/runtime/http-server/request-executor.js +529 -473
  105. package/dist/server/runtime/http-server/request-executor.js.map +1 -1
  106. package/dist/server/runtime/http-server/session-client-reaper.js +9 -2
  107. package/dist/server/runtime/http-server/session-client-reaper.js.map +1 -1
  108. package/dist/server/runtime/http-server/session-client-registry-utils.d.ts +1 -0
  109. package/dist/server/runtime/http-server/session-client-registry-utils.js +10 -2
  110. package/dist/server/runtime/http-server/session-client-registry-utils.js.map +1 -1
  111. package/dist/server/runtime/http-server/session-client-registry.d.ts +3 -0
  112. package/dist/server/runtime/http-server/session-client-registry.js +26 -0
  113. package/dist/server/runtime/http-server/session-client-registry.js.map +1 -1
  114. package/dist/server/runtime/http-server/session-client-route-utils.js +5 -38
  115. package/dist/server/runtime/http-server/session-client-route-utils.js.map +1 -1
  116. package/dist/server/runtime/http-server/session-client-routes.js +75 -2
  117. package/dist/server/runtime/http-server/session-client-routes.js.map +1 -1
  118. package/dist/server/runtime/http-server/session-storage-cleanup.d.ts +17 -0
  119. package/dist/server/runtime/http-server/session-storage-cleanup.js +251 -0
  120. package/dist/server/runtime/http-server/session-storage-cleanup.js.map +1 -0
  121. package/dist/server/runtime/http-server/tmux-scope-cleanup-policy.d.ts +21 -0
  122. package/dist/server/runtime/http-server/tmux-scope-cleanup-policy.js +59 -0
  123. package/dist/server/runtime/http-server/tmux-scope-cleanup-policy.js.map +1 -0
  124. package/dist/server/runtime/http-server/tmux-session-probe.d.ts +1 -0
  125. package/dist/server/runtime/http-server/tmux-session-probe.js +23 -0
  126. package/dist/server/runtime/http-server/tmux-session-probe.js.map +1 -1
  127. package/dist/server-lifecycle/port-utils.js +38 -7
  128. package/dist/server-lifecycle/port-utils.js.map +1 -1
  129. package/dist/tools/semantic-replay-snapshot-loader.js +2 -2
  130. package/dist/tools/semantic-replay-snapshot-loader.js.map +1 -1
  131. package/dist/utils/snapshot-writer.js +16 -6
  132. package/dist/utils/snapshot-writer.js.map +1 -1
  133. package/docs/CLOCK.md +51 -0
  134. package/docs/INSTRUCTION_MARKUP.md +28 -2
  135. package/docs/session-client-daemon-design.md +92 -0
  136. package/package.json +8 -7
  137. package/scripts/analyze-thinking-keywords.mjs +1 -1
  138. package/scripts/ci/repo-sanity.mjs +35 -31
  139. package/scripts/ensure-llmswitch-mode.mjs +63 -5
  140. package/scripts/install-global.sh +46 -0
  141. package/scripts/install-release.sh +39 -5
  142. package/scripts/install-verify.mjs +143 -18
  143. package/scripts/link-llmswitch.mjs +56 -0
  144. package/scripts/pack-mode.mjs +39 -16
  145. package/scripts/pack-rcc.mjs +63 -4
  146. package/scripts/publish-rcc.mjs +59 -4
  147. package/scripts/snapshot-inspect.mjs +5 -24
  148. package/scripts/tests/blackbox-rcc-vs-routecodex-antigravity.mjs +2 -2
  149. package/scripts/vendor-core.mjs +9 -30
  150. package/vendor/llmswitch-core/README.md +0 -271
  151. package/vendor/llmswitch-core/dist/bridge/routecodex-adapter.d.ts +0 -74
  152. package/vendor/llmswitch-core/dist/bridge/routecodex-adapter.js +0 -229
  153. package/vendor/llmswitch-core/dist/config-unified/enhanced-path-resolver.d.ts +0 -5
  154. package/vendor/llmswitch-core/dist/config-unified/enhanced-path-resolver.js +0 -46
  155. package/vendor/llmswitch-core/dist/config-unified/unified-config.d.ts +0 -26
  156. package/vendor/llmswitch-core/dist/config-unified/unified-config.js +0 -231
  157. package/vendor/llmswitch-core/dist/conversion/args-mapping.d.ts +0 -18
  158. package/vendor/llmswitch-core/dist/conversion/args-mapping.js +0 -8
  159. package/vendor/llmswitch-core/dist/conversion/bridge-actions.d.ts +0 -39
  160. package/vendor/llmswitch-core/dist/conversion/bridge-actions.js +0 -82
  161. package/vendor/llmswitch-core/dist/conversion/bridge-id-utils.d.ts +0 -9
  162. package/vendor/llmswitch-core/dist/conversion/bridge-id-utils.js +0 -13
  163. package/vendor/llmswitch-core/dist/conversion/bridge-instructions.d.ts +0 -1
  164. package/vendor/llmswitch-core/dist/conversion/bridge-instructions.js +0 -17
  165. package/vendor/llmswitch-core/dist/conversion/bridge-message-utils.d.ts +0 -23
  166. package/vendor/llmswitch-core/dist/conversion/bridge-message-utils.js +0 -45
  167. package/vendor/llmswitch-core/dist/conversion/bridge-metadata.d.ts +0 -2
  168. package/vendor/llmswitch-core/dist/conversion/bridge-metadata.js +0 -5
  169. package/vendor/llmswitch-core/dist/conversion/bridge-policies.d.ts +0 -18
  170. package/vendor/llmswitch-core/dist/conversion/bridge-policies.js +0 -11
  171. package/vendor/llmswitch-core/dist/conversion/codec-registry.d.ts +0 -10
  172. package/vendor/llmswitch-core/dist/conversion/codec-registry.js +0 -37
  173. package/vendor/llmswitch-core/dist/conversion/codecs/anthropic-openai-codec.d.ts +0 -22
  174. package/vendor/llmswitch-core/dist/conversion/codecs/anthropic-openai-codec.js +0 -52
  175. package/vendor/llmswitch-core/dist/conversion/codecs/gemini-openai-codec.d.ts +0 -17
  176. package/vendor/llmswitch-core/dist/conversion/codecs/gemini-openai-codec.js +0 -85
  177. package/vendor/llmswitch-core/dist/conversion/codecs/openai-openai-codec.d.ts +0 -12
  178. package/vendor/llmswitch-core/dist/conversion/codecs/openai-openai-codec.js +0 -54
  179. package/vendor/llmswitch-core/dist/conversion/codecs/responses-openai-codec.d.ts +0 -12
  180. package/vendor/llmswitch-core/dist/conversion/codecs/responses-openai-codec.js +0 -66
  181. package/vendor/llmswitch-core/dist/conversion/compaction-detect.d.ts +0 -2
  182. package/vendor/llmswitch-core/dist/conversion/compaction-detect.js +0 -4
  183. package/vendor/llmswitch-core/dist/conversion/compat/actions/anthropic-claude-code-system-prompt.d.ts +0 -4
  184. package/vendor/llmswitch-core/dist/conversion/compat/actions/anthropic-claude-code-system-prompt.js +0 -42
  185. package/vendor/llmswitch-core/dist/conversion/compat/actions/anthropic-claude-code-user-id.d.ts +0 -3
  186. package/vendor/llmswitch-core/dist/conversion/compat/actions/anthropic-claude-code-user-id.js +0 -30
  187. package/vendor/llmswitch-core/dist/conversion/compat/actions/antigravity-thought-signature-cache.d.ts +0 -3
  188. package/vendor/llmswitch-core/dist/conversion/compat/actions/antigravity-thought-signature-cache.js +0 -8
  189. package/vendor/llmswitch-core/dist/conversion/compat/actions/antigravity-thought-signature-prepare.d.ts +0 -3
  190. package/vendor/llmswitch-core/dist/conversion/compat/actions/antigravity-thought-signature-prepare.js +0 -26
  191. package/vendor/llmswitch-core/dist/conversion/compat/actions/apply-patch-fixer.d.ts +0 -1
  192. package/vendor/llmswitch-core/dist/conversion/compat/actions/apply-patch-fixer.js +0 -30
  193. package/vendor/llmswitch-core/dist/conversion/compat/actions/auto-thinking.d.ts +0 -6
  194. package/vendor/llmswitch-core/dist/conversion/compat/actions/auto-thinking.js +0 -26
  195. package/vendor/llmswitch-core/dist/conversion/compat/actions/claude-thinking-tools.d.ts +0 -2
  196. package/vendor/llmswitch-core/dist/conversion/compat/actions/claude-thinking-tools.js +0 -4
  197. package/vendor/llmswitch-core/dist/conversion/compat/actions/deepseek-web-request.d.ts +0 -3
  198. package/vendor/llmswitch-core/dist/conversion/compat/actions/deepseek-web-request.js +0 -62
  199. package/vendor/llmswitch-core/dist/conversion/compat/actions/deepseek-web-response.d.ts +0 -12
  200. package/vendor/llmswitch-core/dist/conversion/compat/actions/deepseek-web-response.js +0 -114
  201. package/vendor/llmswitch-core/dist/conversion/compat/actions/field-mapping.d.ts +0 -14
  202. package/vendor/llmswitch-core/dist/conversion/compat/actions/field-mapping.js +0 -155
  203. package/vendor/llmswitch-core/dist/conversion/compat/actions/gemini-cli-request.d.ts +0 -5
  204. package/vendor/llmswitch-core/dist/conversion/compat/actions/gemini-cli-request.js +0 -27
  205. package/vendor/llmswitch-core/dist/conversion/compat/actions/gemini-web-search.d.ts +0 -3
  206. package/vendor/llmswitch-core/dist/conversion/compat/actions/gemini-web-search.js +0 -24
  207. package/vendor/llmswitch-core/dist/conversion/compat/actions/glm-history-image-trim.d.ts +0 -2
  208. package/vendor/llmswitch-core/dist/conversion/compat/actions/glm-history-image-trim.js +0 -54
  209. package/vendor/llmswitch-core/dist/conversion/compat/actions/glm-image-content.d.ts +0 -2
  210. package/vendor/llmswitch-core/dist/conversion/compat/actions/glm-image-content.js +0 -54
  211. package/vendor/llmswitch-core/dist/conversion/compat/actions/glm-native-compat.d.ts +0 -6
  212. package/vendor/llmswitch-core/dist/conversion/compat/actions/glm-native-compat.js +0 -34
  213. package/vendor/llmswitch-core/dist/conversion/compat/actions/glm-tool-extraction.d.ts +0 -3
  214. package/vendor/llmswitch-core/dist/conversion/compat/actions/glm-tool-extraction.js +0 -35
  215. package/vendor/llmswitch-core/dist/conversion/compat/actions/glm-vision-prompt.d.ts +0 -11
  216. package/vendor/llmswitch-core/dist/conversion/compat/actions/glm-vision-prompt.js +0 -104
  217. package/vendor/llmswitch-core/dist/conversion/compat/actions/glm-web-search.d.ts +0 -2
  218. package/vendor/llmswitch-core/dist/conversion/compat/actions/glm-web-search.js +0 -30
  219. package/vendor/llmswitch-core/dist/conversion/compat/actions/harvest-tool-calls-from-text.d.ts +0 -15
  220. package/vendor/llmswitch-core/dist/conversion/compat/actions/harvest-tool-calls-from-text.js +0 -124
  221. package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-kimi-cli-defaults.d.ts +0 -10
  222. package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-kimi-cli-defaults.js +0 -31
  223. package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-kimi-history-media-placeholder.d.ts +0 -7
  224. package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-kimi-history-media-placeholder.js +0 -25
  225. package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-kimi-thinking-reasoning-fill.d.ts +0 -12
  226. package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-kimi-thinking-reasoning-fill.js +0 -46
  227. package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-native-compat.d.ts +0 -6
  228. package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-native-compat.js +0 -36
  229. package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-response-body-unwrap.d.ts +0 -9
  230. package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-response-body-unwrap.js +0 -25
  231. package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-tool-text-fallback.d.ts +0 -5
  232. package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-tool-text-fallback.js +0 -29
  233. package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-web-search.d.ts +0 -18
  234. package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-web-search.js +0 -49
  235. package/vendor/llmswitch-core/dist/conversion/compat/actions/index.d.ts +0 -2
  236. package/vendor/llmswitch-core/dist/conversion/compat/actions/index.js +0 -2
  237. package/vendor/llmswitch-core/dist/conversion/compat/actions/lmstudio-responses-fc-ids.d.ts +0 -2
  238. package/vendor/llmswitch-core/dist/conversion/compat/actions/lmstudio-responses-fc-ids.js +0 -4
  239. package/vendor/llmswitch-core/dist/conversion/compat/actions/lmstudio-responses-input-stringify.d.ts +0 -14
  240. package/vendor/llmswitch-core/dist/conversion/compat/actions/lmstudio-responses-input-stringify.js +0 -125
  241. package/vendor/llmswitch-core/dist/conversion/compat/actions/normalize-tool-call-ids.d.ts +0 -2
  242. package/vendor/llmswitch-core/dist/conversion/compat/actions/normalize-tool-call-ids.js +0 -10
  243. package/vendor/llmswitch-core/dist/conversion/compat/actions/qwen-transform.d.ts +0 -4
  244. package/vendor/llmswitch-core/dist/conversion/compat/actions/qwen-transform.js +0 -40
  245. package/vendor/llmswitch-core/dist/conversion/compat/actions/request-rules.d.ts +0 -24
  246. package/vendor/llmswitch-core/dist/conversion/compat/actions/request-rules.js +0 -4
  247. package/vendor/llmswitch-core/dist/conversion/compat/actions/response-blacklist.d.ts +0 -10
  248. package/vendor/llmswitch-core/dist/conversion/compat/actions/response-blacklist.js +0 -10
  249. package/vendor/llmswitch-core/dist/conversion/compat/actions/response-normalize.d.ts +0 -5
  250. package/vendor/llmswitch-core/dist/conversion/compat/actions/response-normalize.js +0 -4
  251. package/vendor/llmswitch-core/dist/conversion/compat/actions/response-validate.d.ts +0 -5
  252. package/vendor/llmswitch-core/dist/conversion/compat/actions/response-validate.js +0 -4
  253. package/vendor/llmswitch-core/dist/conversion/compat/actions/snapshot.d.ts +0 -8
  254. package/vendor/llmswitch-core/dist/conversion/compat/actions/snapshot.js +0 -21
  255. package/vendor/llmswitch-core/dist/conversion/compat/actions/strip-orphan-function-calls-tag.d.ts +0 -2
  256. package/vendor/llmswitch-core/dist/conversion/compat/actions/strip-orphan-function-calls-tag.js +0 -4
  257. package/vendor/llmswitch-core/dist/conversion/compat/actions/tool-schema.d.ts +0 -6
  258. package/vendor/llmswitch-core/dist/conversion/compat/actions/tool-schema.js +0 -91
  259. package/vendor/llmswitch-core/dist/conversion/compat/actions/tool-text-request-guidance.d.ts +0 -9
  260. package/vendor/llmswitch-core/dist/conversion/compat/actions/tool-text-request-guidance.js +0 -7
  261. package/vendor/llmswitch-core/dist/conversion/compat/actions/universal-shape-filter.d.ts +0 -57
  262. package/vendor/llmswitch-core/dist/conversion/compat/actions/universal-shape-filter.js +0 -14
  263. package/vendor/llmswitch-core/dist/conversion/compat/antigravity-session-signature.d.ts +0 -86
  264. package/vendor/llmswitch-core/dist/conversion/compat/antigravity-session-signature.js +0 -1143
  265. package/vendor/llmswitch-core/dist/conversion/compat/profiles/anthropic-claude-code.json +0 -17
  266. package/vendor/llmswitch-core/dist/conversion/compat/profiles/chat-claude-code.json +0 -18
  267. package/vendor/llmswitch-core/dist/conversion/compat/profiles/chat-deepseek-web.json +0 -47
  268. package/vendor/llmswitch-core/dist/conversion/compat/profiles/chat-gemini-cli.json +0 -23
  269. package/vendor/llmswitch-core/dist/conversion/compat/profiles/chat-gemini.json +0 -31
  270. package/vendor/llmswitch-core/dist/conversion/compat/profiles/chat-glm.json +0 -405
  271. package/vendor/llmswitch-core/dist/conversion/compat/profiles/chat-iflow.json +0 -353
  272. package/vendor/llmswitch-core/dist/conversion/compat/profiles/chat-lmstudio.json +0 -80
  273. package/vendor/llmswitch-core/dist/conversion/compat/profiles/chat-qwen.json +0 -22
  274. package/vendor/llmswitch-core/dist/conversion/compat/profiles/responses-c4m.json +0 -45
  275. package/vendor/llmswitch-core/dist/conversion/compat/profiles/responses-crs.json +0 -15
  276. package/vendor/llmswitch-core/dist/conversion/compat/profiles/responses-output2choices-test.json +0 -12
  277. package/vendor/llmswitch-core/dist/conversion/config/config-manager.d.ts +0 -212
  278. package/vendor/llmswitch-core/dist/conversion/config/config-manager.js +0 -310
  279. package/vendor/llmswitch-core/dist/conversion/config/sample-config.json +0 -314
  280. package/vendor/llmswitch-core/dist/conversion/config/version-switch.json +0 -150
  281. package/vendor/llmswitch-core/dist/conversion/hub/config/types.d.ts +0 -26
  282. package/vendor/llmswitch-core/dist/conversion/hub/config/types.js +0 -1
  283. package/vendor/llmswitch-core/dist/conversion/hub/core/detour-registry.d.ts +0 -11
  284. package/vendor/llmswitch-core/dist/conversion/hub/core/detour-registry.js +0 -23
  285. package/vendor/llmswitch-core/dist/conversion/hub/core/hub-context.d.ts +0 -23
  286. package/vendor/llmswitch-core/dist/conversion/hub/core/hub-context.js +0 -1
  287. package/vendor/llmswitch-core/dist/conversion/hub/core/index.d.ts +0 -4
  288. package/vendor/llmswitch-core/dist/conversion/hub/core/index.js +0 -3
  289. package/vendor/llmswitch-core/dist/conversion/hub/core/stage-driver.d.ts +0 -30
  290. package/vendor/llmswitch-core/dist/conversion/hub/core/stage-driver.js +0 -33
  291. package/vendor/llmswitch-core/dist/conversion/hub/format-adapters/anthropic-format-adapter.d.ts +0 -16
  292. package/vendor/llmswitch-core/dist/conversion/hub/format-adapters/anthropic-format-adapter.js +0 -42
  293. package/vendor/llmswitch-core/dist/conversion/hub/format-adapters/chat-format-adapter.d.ts +0 -17
  294. package/vendor/llmswitch-core/dist/conversion/hub/format-adapters/chat-format-adapter.js +0 -42
  295. package/vendor/llmswitch-core/dist/conversion/hub/format-adapters/gemini-format-adapter.d.ts +0 -16
  296. package/vendor/llmswitch-core/dist/conversion/hub/format-adapters/gemini-format-adapter.js +0 -42
  297. package/vendor/llmswitch-core/dist/conversion/hub/format-adapters/index.d.ts +0 -21
  298. package/vendor/llmswitch-core/dist/conversion/hub/format-adapters/index.js +0 -4
  299. package/vendor/llmswitch-core/dist/conversion/hub/format-adapters/responses-format-adapter.d.ts +0 -19
  300. package/vendor/llmswitch-core/dist/conversion/hub/format-adapters/responses-format-adapter.js +0 -42
  301. package/vendor/llmswitch-core/dist/conversion/hub/hub-feature.d.ts +0 -1
  302. package/vendor/llmswitch-core/dist/conversion/hub/hub-feature.js +0 -26
  303. package/vendor/llmswitch-core/dist/conversion/hub/node-support.d.ts +0 -19
  304. package/vendor/llmswitch-core/dist/conversion/hub/node-support.js +0 -136
  305. package/vendor/llmswitch-core/dist/conversion/hub/operation-table/operation-table-runner.d.ts +0 -18
  306. package/vendor/llmswitch-core/dist/conversion/hub/operation-table/operation-table-runner.js +0 -162
  307. package/vendor/llmswitch-core/dist/conversion/hub/operation-table/semantic-mappers/anthropic-mapper.d.ts +0 -8
  308. package/vendor/llmswitch-core/dist/conversion/hub/operation-table/semantic-mappers/anthropic-mapper.js +0 -503
  309. package/vendor/llmswitch-core/dist/conversion/hub/operation-table/semantic-mappers/archive/chat-mapper.archive.d.ts +0 -8
  310. package/vendor/llmswitch-core/dist/conversion/hub/operation-table/semantic-mappers/archive/chat-mapper.archive.js +0 -409
  311. package/vendor/llmswitch-core/dist/conversion/hub/operation-table/semantic-mappers/chat-mapper.d.ts +0 -8
  312. package/vendor/llmswitch-core/dist/conversion/hub/operation-table/semantic-mappers/chat-mapper.js +0 -350
  313. package/vendor/llmswitch-core/dist/conversion/hub/operation-table/semantic-mappers/gemini-mapper.d.ts +0 -7
  314. package/vendor/llmswitch-core/dist/conversion/hub/operation-table/semantic-mappers/gemini-mapper.js +0 -1540
  315. package/vendor/llmswitch-core/dist/conversion/hub/operation-table/semantic-mappers/responses-mapper.d.ts +0 -21
  316. package/vendor/llmswitch-core/dist/conversion/hub/operation-table/semantic-mappers/responses-mapper.js +0 -491
  317. package/vendor/llmswitch-core/dist/conversion/hub/ops/operations.d.ts +0 -19
  318. package/vendor/llmswitch-core/dist/conversion/hub/ops/operations.js +0 -7
  319. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/compat/compat-engine.d.ts +0 -9
  320. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/compat/compat-engine.js +0 -13
  321. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/compat/compat-pipeline-executor.d.ts +0 -9
  322. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/compat/compat-pipeline-executor.js +0 -46
  323. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/compat/compat-profile-resolver.d.ts +0 -2
  324. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/compat/compat-profile-resolver.js +0 -14
  325. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/compat/compat-profile-store.d.ts +0 -2
  326. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/compat/compat-profile-store.js +0 -94
  327. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/compat/compat-types.d.ts +0 -175
  328. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/compat/compat-types.js +0 -1
  329. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/compat/native-adapter-context.d.ts +0 -3
  330. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/compat/native-adapter-context.js +0 -40
  331. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/hub-pipeline.d.ts +0 -111
  332. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/hub-pipeline.js +0 -1927
  333. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/hub-stage-timing.d.ts +0 -8
  334. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/hub-stage-timing.js +0 -211
  335. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/session-identifiers.d.ts +0 -9
  336. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/session-identifiers.js +0 -16
  337. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage1_format_parse/index.d.ts +0 -10
  338. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage1_format_parse/index.js +0 -236
  339. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage2_semantic_map/index.d.ts +0 -24
  340. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage2_semantic_map/index.js +0 -132
  341. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage2_semantic_map/semantic-lift.d.ts +0 -14
  342. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage2_semantic_map/semantic-lift.js +0 -24
  343. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/archive/shell-like-tool-call-normalization-fallback.d.ts +0 -2
  344. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/archive/shell-like-tool-call-normalization-fallback.js +0 -157
  345. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/context-capture-orchestration.d.ts +0 -16
  346. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/context-capture-orchestration.js +0 -29
  347. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/context-factories.d.ts +0 -5
  348. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/context-factories.js +0 -19
  349. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/index.d.ts +0 -6
  350. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/index.js +0 -22
  351. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/responses-context-snapshot.d.ts +0 -8
  352. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/responses-context-snapshot.js +0 -28
  353. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/tool-output-diagnostics.d.ts +0 -2
  354. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/tool-output-diagnostics.js +0 -4
  355. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/tool-output-snapshot.d.ts +0 -10
  356. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/tool-output-snapshot.js +0 -12
  357. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_outbound/req_outbound_stage1_semantic_map/context-merge.d.ts +0 -3
  358. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_outbound/req_outbound_stage1_semantic_map/context-merge.js +0 -30
  359. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_outbound/req_outbound_stage1_semantic_map/index.d.ts +0 -18
  360. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_outbound/req_outbound_stage1_semantic_map/index.js +0 -84
  361. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_outbound/req_outbound_stage2_format_build/index.d.ts +0 -8
  362. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_outbound/req_outbound_stage2_format_build/index.js +0 -12
  363. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_outbound/req_outbound_stage3_compat/index.d.ts +0 -14
  364. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_outbound/req_outbound_stage3_compat/index.js +0 -45
  365. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_process/req_process_stage1_tool_governance/index.d.ts +0 -16
  366. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_process/req_process_stage1_tool_governance/index.js +0 -62
  367. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_process/req_process_stage2_route_select/index.d.ts +0 -17
  368. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_process/req_process_stage2_route_select/index.js +0 -35
  369. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_inbound/resp_inbound_stage1_sse_decode/index.d.ts +0 -17
  370. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_inbound/resp_inbound_stage1_sse_decode/index.js +0 -243
  371. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_inbound/resp_inbound_stage1_sse_decode/stream-json-sniffer.d.ts +0 -3
  372. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_inbound/resp_inbound_stage1_sse_decode/stream-json-sniffer.js +0 -81
  373. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_inbound/resp_inbound_stage2_format_parse/index.d.ts +0 -10
  374. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_inbound/resp_inbound_stage2_format_parse/index.js +0 -50
  375. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_inbound/resp_inbound_stage3_semantic_map/index.d.ts +0 -13
  376. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_inbound/resp_inbound_stage3_semantic_map/index.js +0 -25
  377. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_outbound/resp_outbound_stage1_client_remap/chat-process-semantics-bridge.d.ts +0 -6
  378. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_outbound/resp_outbound_stage1_client_remap/chat-process-semantics-bridge.js +0 -17
  379. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_outbound/resp_outbound_stage1_client_remap/client-remap-protocol-switch.d.ts +0 -9
  380. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_outbound/resp_outbound_stage1_client_remap/client-remap-protocol-switch.js +0 -103
  381. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_outbound/resp_outbound_stage1_client_remap/index.d.ts +0 -13
  382. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_outbound/resp_outbound_stage1_client_remap/index.js +0 -30
  383. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_outbound/resp_outbound_stage2_sse_stream/index.d.ts +0 -17
  384. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_outbound/resp_outbound_stage2_sse_stream/index.js +0 -35
  385. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_process/resp_process_stage1_tool_governance/index.d.ts +0 -16
  386. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_process/resp_process_stage1_tool_governance/index.js +0 -52
  387. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_process/resp_process_stage2_finalize/index.d.ts +0 -19
  388. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_process/resp_process_stage2_finalize/index.js +0 -40
  389. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_process/resp_process_stage3_servertool_orchestration/index.d.ts +0 -44
  390. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_process/resp_process_stage3_servertool_orchestration/index.js +0 -88
  391. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/utils.d.ts +0 -2
  392. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/utils.js +0 -27
  393. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/target-utils.d.ts +0 -5
  394. package/vendor/llmswitch-core/dist/conversion/hub/pipeline/target-utils.js +0 -26
  395. package/vendor/llmswitch-core/dist/conversion/hub/pipelines/inbound.d.ts +0 -22
  396. package/vendor/llmswitch-core/dist/conversion/hub/pipelines/inbound.js +0 -66
  397. package/vendor/llmswitch-core/dist/conversion/hub/pipelines/outbound.d.ts +0 -22
  398. package/vendor/llmswitch-core/dist/conversion/hub/pipelines/outbound.js +0 -59
  399. package/vendor/llmswitch-core/dist/conversion/hub/policy/policy-engine.d.ts +0 -48
  400. package/vendor/llmswitch-core/dist/conversion/hub/policy/policy-engine.js +0 -269
  401. package/vendor/llmswitch-core/dist/conversion/hub/policy/protocol-spec.d.ts +0 -75
  402. package/vendor/llmswitch-core/dist/conversion/hub/policy/protocol-spec.js +0 -27
  403. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-anthropic-alias.d.ts +0 -2
  404. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-anthropic-alias.js +0 -36
  405. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-directive-parser.d.ts +0 -5
  406. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-directive-parser.js +0 -56
  407. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-directives.d.ts +0 -24
  408. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-directives.js +0 -98
  409. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-reminder-directives.d.ts +0 -8
  410. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-reminder-directives.js +0 -42
  411. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-reminder-finalize.d.ts +0 -14
  412. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-reminder-finalize.js +0 -10
  413. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-reminder-messages.d.ts +0 -5
  414. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-reminder-messages.js +0 -10
  415. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-reminder-orchestration.d.ts +0 -30
  416. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-reminder-orchestration.js +0 -68
  417. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-reminder-time-tag.d.ts +0 -9
  418. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-reminder-time-tag.js +0 -18
  419. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-reminders.d.ts +0 -2
  420. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-reminders.js +0 -104
  421. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-tool-schemas.d.ts +0 -3
  422. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-tool-schemas.js +0 -280
  423. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-tools.d.ts +0 -6
  424. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-tools.js +0 -41
  425. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-continue-execution.d.ts +0 -11
  426. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-continue-execution.js +0 -83
  427. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-governance-context.d.ts +0 -15
  428. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-governance-context.js +0 -7
  429. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-governance-finalize.d.ts +0 -16
  430. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-governance-finalize.js +0 -11
  431. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-governance-orchestration.d.ts +0 -9
  432. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-governance-orchestration.js +0 -49
  433. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-governed-control-ops.d.ts +0 -8
  434. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-governed-control-ops.js +0 -5
  435. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-governed-filter-call.d.ts +0 -12
  436. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-governed-filter-call.js +0 -18
  437. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-governed-merge.d.ts +0 -8
  438. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-governed-merge.js +0 -11
  439. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-media.d.ts +0 -5
  440. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-media.js +0 -108
  441. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-node-result.d.ts +0 -23
  442. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-node-result.js +0 -24
  443. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-pending-tool-sync.d.ts +0 -14
  444. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-pending-tool-sync.js +0 -52
  445. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-post-governed-normalization.d.ts +0 -8
  446. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-post-governed-normalization.js +0 -16
  447. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-review.d.ts +0 -2
  448. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-review.js +0 -8
  449. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-servertool-orchestration.d.ts +0 -8
  450. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-servertool-orchestration.js +0 -22
  451. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-session-usage.d.ts +0 -7
  452. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-session-usage.js +0 -147
  453. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-tool-normalization.d.ts +0 -2
  454. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-tool-normalization.js +0 -4
  455. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-web-search-intent.d.ts +0 -12
  456. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-web-search-intent.js +0 -13
  457. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-web-search-tool-schema.d.ts +0 -3
  458. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-web-search-tool-schema.js +0 -4
  459. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-web-search.d.ts +0 -8
  460. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-web-search.js +0 -26
  461. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process.d.ts +0 -15
  462. package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process.js +0 -27
  463. package/vendor/llmswitch-core/dist/conversion/hub/process/client-inject-readiness.d.ts +0 -1
  464. package/vendor/llmswitch-core/dist/conversion/hub/process/client-inject-readiness.js +0 -4
  465. package/vendor/llmswitch-core/dist/conversion/hub/registry.d.ts +0 -28
  466. package/vendor/llmswitch-core/dist/conversion/hub/registry.js +0 -101
  467. package/vendor/llmswitch-core/dist/conversion/hub/response/chat-response-utils.d.ts +0 -6
  468. package/vendor/llmswitch-core/dist/conversion/hub/response/chat-response-utils.js +0 -8
  469. package/vendor/llmswitch-core/dist/conversion/hub/response/provider-response.d.ts +0 -51
  470. package/vendor/llmswitch-core/dist/conversion/hub/response/provider-response.js +0 -529
  471. package/vendor/llmswitch-core/dist/conversion/hub/response/response-mappers.d.ts +0 -24
  472. package/vendor/llmswitch-core/dist/conversion/hub/response/response-mappers.js +0 -73
  473. package/vendor/llmswitch-core/dist/conversion/hub/response/response-runtime.d.ts +0 -9
  474. package/vendor/llmswitch-core/dist/conversion/hub/response/response-runtime.js +0 -758
  475. package/vendor/llmswitch-core/dist/conversion/hub/semantic-mappers/anthropic-mapper.d.ts +0 -2
  476. package/vendor/llmswitch-core/dist/conversion/hub/semantic-mappers/anthropic-mapper.js +0 -2
  477. package/vendor/llmswitch-core/dist/conversion/hub/semantic-mappers/chat-mapper.d.ts +0 -2
  478. package/vendor/llmswitch-core/dist/conversion/hub/semantic-mappers/chat-mapper.js +0 -2
  479. package/vendor/llmswitch-core/dist/conversion/hub/semantic-mappers/gemini-mapper.d.ts +0 -2
  480. package/vendor/llmswitch-core/dist/conversion/hub/semantic-mappers/gemini-mapper.js +0 -2
  481. package/vendor/llmswitch-core/dist/conversion/hub/semantic-mappers/index.d.ts +0 -4
  482. package/vendor/llmswitch-core/dist/conversion/hub/semantic-mappers/index.js +0 -4
  483. package/vendor/llmswitch-core/dist/conversion/hub/semantic-mappers/responses-mapper.d.ts +0 -2
  484. package/vendor/llmswitch-core/dist/conversion/hub/semantic-mappers/responses-mapper.js +0 -2
  485. package/vendor/llmswitch-core/dist/conversion/hub/snapshot-recorder.d.ts +0 -13
  486. package/vendor/llmswitch-core/dist/conversion/hub/snapshot-recorder.js +0 -38
  487. package/vendor/llmswitch-core/dist/conversion/hub/standardized-bridge.d.ts +0 -12
  488. package/vendor/llmswitch-core/dist/conversion/hub/standardized-bridge.js +0 -16
  489. package/vendor/llmswitch-core/dist/conversion/hub/tool-governance/engine.d.ts +0 -24
  490. package/vendor/llmswitch-core/dist/conversion/hub/tool-governance/engine.js +0 -118
  491. package/vendor/llmswitch-core/dist/conversion/hub/tool-governance/index.d.ts +0 -3
  492. package/vendor/llmswitch-core/dist/conversion/hub/tool-governance/index.js +0 -2
  493. package/vendor/llmswitch-core/dist/conversion/hub/tool-governance/rules.d.ts +0 -2
  494. package/vendor/llmswitch-core/dist/conversion/hub/tool-governance/rules.js +0 -80
  495. package/vendor/llmswitch-core/dist/conversion/hub/tool-governance/types.d.ts +0 -38
  496. package/vendor/llmswitch-core/dist/conversion/hub/tool-governance/types.js +0 -1
  497. package/vendor/llmswitch-core/dist/conversion/hub/tool-session-compat.d.ts +0 -26
  498. package/vendor/llmswitch-core/dist/conversion/hub/tool-session-compat.js +0 -86
  499. package/vendor/llmswitch-core/dist/conversion/hub/tool-surface/tool-surface-engine.d.ts +0 -18
  500. package/vendor/llmswitch-core/dist/conversion/hub/tool-surface/tool-surface-engine.js +0 -574
  501. package/vendor/llmswitch-core/dist/conversion/hub/types/chat-envelope.d.ts +0 -79
  502. package/vendor/llmswitch-core/dist/conversion/hub/types/chat-envelope.js +0 -1
  503. package/vendor/llmswitch-core/dist/conversion/hub/types/chat-schema.d.ts +0 -112
  504. package/vendor/llmswitch-core/dist/conversion/hub/types/chat-schema.js +0 -1
  505. package/vendor/llmswitch-core/dist/conversion/hub/types/errors.d.ts +0 -5
  506. package/vendor/llmswitch-core/dist/conversion/hub/types/errors.js +0 -13
  507. package/vendor/llmswitch-core/dist/conversion/hub/types/format-envelope.d.ts +0 -7
  508. package/vendor/llmswitch-core/dist/conversion/hub/types/format-envelope.js +0 -1
  509. package/vendor/llmswitch-core/dist/conversion/hub/types/index.d.ts +0 -6
  510. package/vendor/llmswitch-core/dist/conversion/hub/types/index.js +0 -6
  511. package/vendor/llmswitch-core/dist/conversion/hub/types/json.d.ts +0 -9
  512. package/vendor/llmswitch-core/dist/conversion/hub/types/json.js +0 -9
  513. package/vendor/llmswitch-core/dist/conversion/hub/types/node.d.ts +0 -31
  514. package/vendor/llmswitch-core/dist/conversion/hub/types/node.js +0 -1
  515. package/vendor/llmswitch-core/dist/conversion/hub/types/standardized.d.ts +0 -99
  516. package/vendor/llmswitch-core/dist/conversion/hub/types/standardized.js +0 -1
  517. package/vendor/llmswitch-core/dist/conversion/index.d.ts +0 -33
  518. package/vendor/llmswitch-core/dist/conversion/index.js +0 -33
  519. package/vendor/llmswitch-core/dist/conversion/jsonish.d.ts +0 -3
  520. package/vendor/llmswitch-core/dist/conversion/jsonish.js +0 -20
  521. package/vendor/llmswitch-core/dist/conversion/mcp-injection.d.ts +0 -2
  522. package/vendor/llmswitch-core/dist/conversion/mcp-injection.js +0 -7
  523. package/vendor/llmswitch-core/dist/conversion/media.d.ts +0 -1
  524. package/vendor/llmswitch-core/dist/conversion/media.js +0 -4
  525. package/vendor/llmswitch-core/dist/conversion/metadata-passthrough.d.ts +0 -11
  526. package/vendor/llmswitch-core/dist/conversion/metadata-passthrough.js +0 -20
  527. package/vendor/llmswitch-core/dist/conversion/payload-budget.d.ts +0 -13
  528. package/vendor/llmswitch-core/dist/conversion/payload-budget.js +0 -47
  529. package/vendor/llmswitch-core/dist/conversion/pipeline/codecs/v2/anthropic-openai-pipeline.d.ts +0 -11
  530. package/vendor/llmswitch-core/dist/conversion/pipeline/codecs/v2/anthropic-openai-pipeline.js +0 -104
  531. package/vendor/llmswitch-core/dist/conversion/pipeline/codecs/v2/openai-openai-pipeline.d.ts +0 -15
  532. package/vendor/llmswitch-core/dist/conversion/pipeline/codecs/v2/openai-openai-pipeline.js +0 -176
  533. package/vendor/llmswitch-core/dist/conversion/pipeline/codecs/v2/responses-openai-pipeline.d.ts +0 -12
  534. package/vendor/llmswitch-core/dist/conversion/pipeline/codecs/v2/responses-openai-pipeline.js +0 -212
  535. package/vendor/llmswitch-core/dist/conversion/pipeline/codecs/v2/shared/openai-chat-helpers.d.ts +0 -13
  536. package/vendor/llmswitch-core/dist/conversion/pipeline/codecs/v2/shared/openai-chat-helpers.js +0 -34
  537. package/vendor/llmswitch-core/dist/conversion/pipeline/hooks/adapter-context.d.ts +0 -7
  538. package/vendor/llmswitch-core/dist/conversion/pipeline/hooks/adapter-context.js +0 -18
  539. package/vendor/llmswitch-core/dist/conversion/pipeline/hooks/protocol-hooks.d.ts +0 -67
  540. package/vendor/llmswitch-core/dist/conversion/pipeline/hooks/protocol-hooks.js +0 -1
  541. package/vendor/llmswitch-core/dist/conversion/pipeline/index.d.ts +0 -35
  542. package/vendor/llmswitch-core/dist/conversion/pipeline/index.js +0 -103
  543. package/vendor/llmswitch-core/dist/conversion/pipeline/meta/meta-bag.d.ts +0 -20
  544. package/vendor/llmswitch-core/dist/conversion/pipeline/meta/meta-bag.js +0 -81
  545. package/vendor/llmswitch-core/dist/conversion/pipeline/schema/canonical-chat.d.ts +0 -18
  546. package/vendor/llmswitch-core/dist/conversion/pipeline/schema/canonical-chat.js +0 -1
  547. package/vendor/llmswitch-core/dist/conversion/pipeline/schema/index.d.ts +0 -1
  548. package/vendor/llmswitch-core/dist/conversion/pipeline/schema/index.js +0 -1
  549. package/vendor/llmswitch-core/dist/conversion/protocol-field-allowlists.d.ts +0 -7
  550. package/vendor/llmswitch-core/dist/conversion/protocol-field-allowlists.js +0 -9
  551. package/vendor/llmswitch-core/dist/conversion/protocol-state.d.ts +0 -4
  552. package/vendor/llmswitch-core/dist/conversion/protocol-state.js +0 -27
  553. package/vendor/llmswitch-core/dist/conversion/provider-protocol-error.d.ts +0 -17
  554. package/vendor/llmswitch-core/dist/conversion/provider-protocol-error.js +0 -25
  555. package/vendor/llmswitch-core/dist/conversion/responses/responses-host-policy.d.ts +0 -6
  556. package/vendor/llmswitch-core/dist/conversion/responses/responses-host-policy.js +0 -4
  557. package/vendor/llmswitch-core/dist/conversion/responses/responses-openai-bridge/response-payload.d.ts +0 -3
  558. package/vendor/llmswitch-core/dist/conversion/responses/responses-openai-bridge/response-payload.js +0 -190
  559. package/vendor/llmswitch-core/dist/conversion/responses/responses-openai-bridge/types.d.ts +0 -35
  560. package/vendor/llmswitch-core/dist/conversion/responses/responses-openai-bridge/types.js +0 -1
  561. package/vendor/llmswitch-core/dist/conversion/responses/responses-openai-bridge.d.ts +0 -15
  562. package/vendor/llmswitch-core/dist/conversion/responses/responses-openai-bridge.js +0 -475
  563. package/vendor/llmswitch-core/dist/conversion/runtime-metadata.d.ts +0 -7
  564. package/vendor/llmswitch-core/dist/conversion/runtime-metadata.js +0 -31
  565. package/vendor/llmswitch-core/dist/conversion/schema-validator.d.ts +0 -7
  566. package/vendor/llmswitch-core/dist/conversion/schema-validator.js +0 -67
  567. package/vendor/llmswitch-core/dist/conversion/shared/anthropic-message-utils.d.ts +0 -22
  568. package/vendor/llmswitch-core/dist/conversion/shared/anthropic-message-utils.js +0 -1416
  569. package/vendor/llmswitch-core/dist/conversion/shared/chat-envelope-validator.d.ts +0 -8
  570. package/vendor/llmswitch-core/dist/conversion/shared/chat-envelope-validator.js +0 -4
  571. package/vendor/llmswitch-core/dist/conversion/shared/chat-output-normalizer.d.ts +0 -4
  572. package/vendor/llmswitch-core/dist/conversion/shared/chat-output-normalizer.js +0 -10
  573. package/vendor/llmswitch-core/dist/conversion/shared/chat-request-filters.d.ts +0 -8
  574. package/vendor/llmswitch-core/dist/conversion/shared/chat-request-filters.js +0 -63
  575. package/vendor/llmswitch-core/dist/conversion/shared/gemini-tool-utils.d.ts +0 -7
  576. package/vendor/llmswitch-core/dist/conversion/shared/gemini-tool-utils.js +0 -20
  577. package/vendor/llmswitch-core/dist/conversion/shared/openai-finalizer.d.ts +0 -8
  578. package/vendor/llmswitch-core/dist/conversion/shared/openai-finalizer.js +0 -22
  579. package/vendor/llmswitch-core/dist/conversion/shared/openai-message-normalize.d.ts +0 -1
  580. package/vendor/llmswitch-core/dist/conversion/shared/openai-message-normalize.js +0 -151
  581. package/vendor/llmswitch-core/dist/conversion/shared/output-content-normalizer.d.ts +0 -12
  582. package/vendor/llmswitch-core/dist/conversion/shared/output-content-normalizer.js +0 -26
  583. package/vendor/llmswitch-core/dist/conversion/shared/reasoning-mapping.d.ts +0 -5
  584. package/vendor/llmswitch-core/dist/conversion/shared/reasoning-mapping.js +0 -7
  585. package/vendor/llmswitch-core/dist/conversion/shared/reasoning-normalizer.d.ts +0 -25
  586. package/vendor/llmswitch-core/dist/conversion/shared/reasoning-normalizer.js +0 -114
  587. package/vendor/llmswitch-core/dist/conversion/shared/reasoning-tool-normalizer.d.ts +0 -12
  588. package/vendor/llmswitch-core/dist/conversion/shared/reasoning-tool-normalizer.js +0 -22
  589. package/vendor/llmswitch-core/dist/conversion/shared/reasoning-tool-parser.d.ts +0 -10
  590. package/vendor/llmswitch-core/dist/conversion/shared/reasoning-tool-parser.js +0 -11
  591. package/vendor/llmswitch-core/dist/conversion/shared/reasoning-utils.d.ts +0 -2
  592. package/vendor/llmswitch-core/dist/conversion/shared/reasoning-utils.js +0 -19
  593. package/vendor/llmswitch-core/dist/conversion/shared/responses-conversation-store.d.ts +0 -35
  594. package/vendor/llmswitch-core/dist/conversion/shared/responses-conversation-store.js +0 -195
  595. package/vendor/llmswitch-core/dist/conversion/shared/responses-output-builder.d.ts +0 -13
  596. package/vendor/llmswitch-core/dist/conversion/shared/responses-output-builder.js +0 -32
  597. package/vendor/llmswitch-core/dist/conversion/shared/responses-reasoning-registry.d.ts +0 -24
  598. package/vendor/llmswitch-core/dist/conversion/shared/responses-reasoning-registry.js +0 -185
  599. package/vendor/llmswitch-core/dist/conversion/shared/responses-request-adapter.d.ts +0 -7
  600. package/vendor/llmswitch-core/dist/conversion/shared/responses-request-adapter.js +0 -14
  601. package/vendor/llmswitch-core/dist/conversion/shared/responses-response-utils.d.ts +0 -3
  602. package/vendor/llmswitch-core/dist/conversion/shared/responses-response-utils.js +0 -254
  603. package/vendor/llmswitch-core/dist/conversion/shared/responses-tool-utils.d.ts +0 -14
  604. package/vendor/llmswitch-core/dist/conversion/shared/responses-tool-utils.js +0 -102
  605. package/vendor/llmswitch-core/dist/conversion/shared/streaming-text-extractor.d.ts +0 -19
  606. package/vendor/llmswitch-core/dist/conversion/shared/streaming-text-extractor.js +0 -39
  607. package/vendor/llmswitch-core/dist/conversion/shared/text-markup-normalizer/normalize.d.ts +0 -2
  608. package/vendor/llmswitch-core/dist/conversion/shared/text-markup-normalizer/normalize.js +0 -116
  609. package/vendor/llmswitch-core/dist/conversion/shared/text-markup-normalizer.d.ts +0 -4
  610. package/vendor/llmswitch-core/dist/conversion/shared/text-markup-normalizer.js +0 -3
  611. package/vendor/llmswitch-core/dist/conversion/shared/thought-signature-validator.d.ts +0 -52
  612. package/vendor/llmswitch-core/dist/conversion/shared/thought-signature-validator.js +0 -58
  613. package/vendor/llmswitch-core/dist/conversion/shared/tool-argument-repairer.d.ts +0 -39
  614. package/vendor/llmswitch-core/dist/conversion/shared/tool-argument-repairer.js +0 -53
  615. package/vendor/llmswitch-core/dist/conversion/shared/tool-call-id-manager.d.ts +0 -109
  616. package/vendor/llmswitch-core/dist/conversion/shared/tool-call-id-manager.js +0 -202
  617. package/vendor/llmswitch-core/dist/conversion/shared/tool-call-utils.d.ts +0 -11
  618. package/vendor/llmswitch-core/dist/conversion/shared/tool-call-utils.js +0 -14
  619. package/vendor/llmswitch-core/dist/conversion/shared/tool-filter-pipeline.d.ts +0 -21
  620. package/vendor/llmswitch-core/dist/conversion/shared/tool-filter-pipeline.js +0 -171
  621. package/vendor/llmswitch-core/dist/conversion/shared/tool-governor.d.ts +0 -29
  622. package/vendor/llmswitch-core/dist/conversion/shared/tool-governor.js +0 -694
  623. package/vendor/llmswitch-core/dist/conversion/shared/tool-harvester.d.ts +0 -31
  624. package/vendor/llmswitch-core/dist/conversion/shared/tool-harvester.js +0 -23
  625. package/vendor/llmswitch-core/dist/conversion/shared/tool-mapping.d.ts +0 -19
  626. package/vendor/llmswitch-core/dist/conversion/shared/tool-mapping.js +0 -65
  627. package/vendor/llmswitch-core/dist/conversion/shared/tooling.d.ts +0 -29
  628. package/vendor/llmswitch-core/dist/conversion/shared/tooling.js +0 -57
  629. package/vendor/llmswitch-core/dist/conversion/snapshot-utils.d.ts +0 -31
  630. package/vendor/llmswitch-core/dist/conversion/snapshot-utils.js +0 -49
  631. package/vendor/llmswitch-core/dist/conversion/types/bridge-message-types.d.ts +0 -41
  632. package/vendor/llmswitch-core/dist/conversion/types/bridge-message-types.js +0 -1
  633. package/vendor/llmswitch-core/dist/conversion/types/text-markup-normalizer.d.ts +0 -13
  634. package/vendor/llmswitch-core/dist/conversion/types/text-markup-normalizer.js +0 -1
  635. package/vendor/llmswitch-core/dist/conversion/types.d.ts +0 -33
  636. package/vendor/llmswitch-core/dist/conversion/types.js +0 -1
  637. package/vendor/llmswitch-core/dist/filters/builtin/add-fields-filter.d.ts +0 -8
  638. package/vendor/llmswitch-core/dist/filters/builtin/add-fields-filter.js +0 -16
  639. package/vendor/llmswitch-core/dist/filters/builtin/blacklist-filter.d.ts +0 -8
  640. package/vendor/llmswitch-core/dist/filters/builtin/blacklist-filter.js +0 -19
  641. package/vendor/llmswitch-core/dist/filters/builtin/whitelist-filter.d.ts +0 -8
  642. package/vendor/llmswitch-core/dist/filters/builtin/whitelist-filter.js +0 -19
  643. package/vendor/llmswitch-core/dist/filters/config/openai-openai.fieldmap.json +0 -18
  644. package/vendor/llmswitch-core/dist/filters/engine.d.ts +0 -16
  645. package/vendor/llmswitch-core/dist/filters/engine.js +0 -167
  646. package/vendor/llmswitch-core/dist/filters/index.d.ts +0 -18
  647. package/vendor/llmswitch-core/dist/filters/index.js +0 -22
  648. package/vendor/llmswitch-core/dist/filters/special/request-tool-choice-policy.d.ts +0 -11
  649. package/vendor/llmswitch-core/dist/filters/special/request-tool-choice-policy.js +0 -29
  650. package/vendor/llmswitch-core/dist/filters/special/request-tool-list-filter.d.ts +0 -11
  651. package/vendor/llmswitch-core/dist/filters/special/request-tool-list-filter.js +0 -322
  652. package/vendor/llmswitch-core/dist/filters/special/request-toolcalls-stringify.d.ts +0 -13
  653. package/vendor/llmswitch-core/dist/filters/special/request-toolcalls-stringify.js +0 -94
  654. package/vendor/llmswitch-core/dist/filters/special/request-tools-normalize.d.ts +0 -11
  655. package/vendor/llmswitch-core/dist/filters/special/request-tools-normalize.js +0 -114
  656. package/vendor/llmswitch-core/dist/filters/special/response-finish-invariants.d.ts +0 -11
  657. package/vendor/llmswitch-core/dist/filters/special/response-finish-invariants.js +0 -30
  658. package/vendor/llmswitch-core/dist/filters/special/response-openai-to-responses-bridge.d.ts +0 -13
  659. package/vendor/llmswitch-core/dist/filters/special/response-openai-to-responses-bridge.js +0 -24
  660. package/vendor/llmswitch-core/dist/filters/special/response-tool-arguments-blacklist.d.ts +0 -12
  661. package/vendor/llmswitch-core/dist/filters/special/response-tool-arguments-blacklist.js +0 -63
  662. package/vendor/llmswitch-core/dist/filters/special/response-tool-arguments-schema-converge.d.ts +0 -13
  663. package/vendor/llmswitch-core/dist/filters/special/response-tool-arguments-schema-converge.js +0 -63
  664. package/vendor/llmswitch-core/dist/filters/special/response-tool-arguments-stringify.d.ts +0 -9
  665. package/vendor/llmswitch-core/dist/filters/special/response-tool-arguments-stringify.js +0 -132
  666. package/vendor/llmswitch-core/dist/filters/special/response-tool-arguments-whitelist.d.ts +0 -11
  667. package/vendor/llmswitch-core/dist/filters/special/response-tool-arguments-whitelist.js +0 -56
  668. package/vendor/llmswitch-core/dist/filters/special/response-tool-text-canonicalize.d.ts +0 -13
  669. package/vendor/llmswitch-core/dist/filters/special/response-tool-text-canonicalize.js +0 -16
  670. package/vendor/llmswitch-core/dist/filters/special/tool-filter-hooks.d.ts +0 -19
  671. package/vendor/llmswitch-core/dist/filters/special/tool-filter-hooks.js +0 -394
  672. package/vendor/llmswitch-core/dist/filters/special/tool-post-constraints.d.ts +0 -31
  673. package/vendor/llmswitch-core/dist/filters/special/tool-post-constraints.js +0 -120
  674. package/vendor/llmswitch-core/dist/filters/types.d.ts +0 -68
  675. package/vendor/llmswitch-core/dist/filters/types.js +0 -3
  676. package/vendor/llmswitch-core/dist/filters/utils/fieldmap-loader.d.ts +0 -2
  677. package/vendor/llmswitch-core/dist/filters/utils/fieldmap-loader.js +0 -16
  678. package/vendor/llmswitch-core/dist/filters/utils/snapshot-writer.d.ts +0 -10
  679. package/vendor/llmswitch-core/dist/filters/utils/snapshot-writer.js +0 -85
  680. package/vendor/llmswitch-core/dist/guidance/index.d.ts +0 -3
  681. package/vendor/llmswitch-core/dist/guidance/index.js +0 -299
  682. package/vendor/llmswitch-core/dist/http/sse-response.d.ts +0 -22
  683. package/vendor/llmswitch-core/dist/http/sse-response.js +0 -103
  684. package/vendor/llmswitch-core/dist/index.d.ts +0 -11
  685. package/vendor/llmswitch-core/dist/index.js +0 -11
  686. package/vendor/llmswitch-core/dist/native/router_hotpath_napi.node +0 -0
  687. package/vendor/llmswitch-core/dist/quota/apikey-reset.d.ts +0 -17
  688. package/vendor/llmswitch-core/dist/quota/apikey-reset.js +0 -43
  689. package/vendor/llmswitch-core/dist/quota/index.d.ts +0 -2
  690. package/vendor/llmswitch-core/dist/quota/index.js +0 -1
  691. package/vendor/llmswitch-core/dist/quota/quota-manager.d.ts +0 -44
  692. package/vendor/llmswitch-core/dist/quota/quota-manager.js +0 -463
  693. package/vendor/llmswitch-core/dist/quota/quota-state.d.ts +0 -6
  694. package/vendor/llmswitch-core/dist/quota/quota-state.js +0 -191
  695. package/vendor/llmswitch-core/dist/quota/types.d.ts +0 -62
  696. package/vendor/llmswitch-core/dist/quota/types.js +0 -1
  697. package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/auth-utils.d.ts +0 -6
  698. package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/auth-utils.js +0 -288
  699. package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/claude-code-helpers.d.ts +0 -11
  700. package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/claude-code-helpers.js +0 -18
  701. package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/config-defaults.d.ts +0 -5
  702. package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/config-defaults.js +0 -13
  703. package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/config-normalizers.d.ts +0 -4
  704. package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/config-normalizers.js +0 -106
  705. package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/profile-builder.d.ts +0 -8
  706. package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/profile-builder.js +0 -87
  707. package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/provider-normalization.d.ts +0 -44
  708. package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/provider-normalization.js +0 -272
  709. package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/responses-helpers.d.ts +0 -15
  710. package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/responses-helpers.js +0 -65
  711. package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/routing-config.d.ts +0 -24
  712. package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/routing-config.js +0 -346
  713. package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/streaming-helpers.d.ts +0 -19
  714. package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/streaming-helpers.js +0 -172
  715. package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/utils.d.ts +0 -5
  716. package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/utils.js +0 -41
  717. package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/web-search-config.d.ts +0 -4
  718. package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/web-search-config.js +0 -156
  719. package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap.d.ts +0 -2
  720. package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap.js +0 -329
  721. package/vendor/llmswitch-core/dist/router/virtual-router/classifier.d.ts +0 -10
  722. package/vendor/llmswitch-core/dist/router/virtual-router/classifier.js +0 -187
  723. package/vendor/llmswitch-core/dist/router/virtual-router/context-advisor.d.ts +0 -23
  724. package/vendor/llmswitch-core/dist/router/virtual-router/context-advisor.js +0 -67
  725. package/vendor/llmswitch-core/dist/router/virtual-router/context-weighted.d.ts +0 -31
  726. package/vendor/llmswitch-core/dist/router/virtual-router/context-weighted.js +0 -54
  727. package/vendor/llmswitch-core/dist/router/virtual-router/default-thinking-keywords.d.ts +0 -1
  728. package/vendor/llmswitch-core/dist/router/virtual-router/default-thinking-keywords.js +0 -13
  729. package/vendor/llmswitch-core/dist/router/virtual-router/engine/antigravity/alias-lease.d.ts +0 -33
  730. package/vendor/llmswitch-core/dist/router/virtual-router/engine/antigravity/alias-lease.js +0 -257
  731. package/vendor/llmswitch-core/dist/router/virtual-router/engine/cooldown-manager.d.ts +0 -34
  732. package/vendor/llmswitch-core/dist/router/virtual-router/engine/cooldown-manager.js +0 -118
  733. package/vendor/llmswitch-core/dist/router/virtual-router/engine/health/index.d.ts +0 -23
  734. package/vendor/llmswitch-core/dist/router/virtual-router/engine/health/index.js +0 -724
  735. package/vendor/llmswitch-core/dist/router/virtual-router/engine/provider-key/parse.d.ts +0 -1
  736. package/vendor/llmswitch-core/dist/router/virtual-router/engine/provider-key/parse.js +0 -1
  737. package/vendor/llmswitch-core/dist/router/virtual-router/engine/route-analytics.d.ts +0 -28
  738. package/vendor/llmswitch-core/dist/router/virtual-router/engine/route-analytics.js +0 -44
  739. package/vendor/llmswitch-core/dist/router/virtual-router/engine/routing-pools/index.d.ts +0 -13
  740. package/vendor/llmswitch-core/dist/router/virtual-router/engine/routing-pools/index.js +0 -386
  741. package/vendor/llmswitch-core/dist/router/virtual-router/engine/routing-state/keys.d.ts +0 -3
  742. package/vendor/llmswitch-core/dist/router/virtual-router/engine/routing-state/keys.js +0 -30
  743. package/vendor/llmswitch-core/dist/router/virtual-router/engine/routing-state/metadata.d.ts +0 -6
  744. package/vendor/llmswitch-core/dist/router/virtual-router/engine/routing-state/metadata.js +0 -132
  745. package/vendor/llmswitch-core/dist/router/virtual-router/engine/routing-state/store.d.ts +0 -10
  746. package/vendor/llmswitch-core/dist/router/virtual-router/engine/routing-state/store.js +0 -156
  747. package/vendor/llmswitch-core/dist/router/virtual-router/engine/sticky-session-manager.d.ts +0 -29
  748. package/vendor/llmswitch-core/dist/router/virtual-router/engine/sticky-session-manager.js +0 -55
  749. package/vendor/llmswitch-core/dist/router/virtual-router/engine-health.d.ts +0 -1
  750. package/vendor/llmswitch-core/dist/router/virtual-router/engine-health.js +0 -1
  751. package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/config.d.ts +0 -11
  752. package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/config.js +0 -108
  753. package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/direct-model.d.ts +0 -10
  754. package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/direct-model.js +0 -38
  755. package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/health.d.ts +0 -13
  756. package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/health.js +0 -104
  757. package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/helpers.d.ts +0 -16
  758. package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/helpers.js +0 -226
  759. package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/route-utils.d.ts +0 -19
  760. package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/route-utils.js +0 -212
  761. package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/selection-core.d.ts +0 -28
  762. package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/selection-core.js +0 -112
  763. package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/selection-state.d.ts +0 -16
  764. package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/selection-state.js +0 -187
  765. package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/state-accessors.d.ts +0 -21
  766. package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/state-accessors.js +0 -118
  767. package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy.d.ts +0 -123
  768. package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy.js +0 -245
  769. package/vendor/llmswitch-core/dist/router/virtual-router/engine-logging.d.ts +0 -67
  770. package/vendor/llmswitch-core/dist/router/virtual-router/engine-logging.js +0 -356
  771. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/alias-selection.d.ts +0 -15
  772. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/alias-selection.js +0 -118
  773. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/context-weight-multipliers.d.ts +0 -11
  774. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/context-weight-multipliers.js +0 -23
  775. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/direct-provider-model.d.ts +0 -9
  776. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/direct-provider-model.js +0 -49
  777. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/instruction-target.d.ts +0 -6
  778. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/instruction-target.js +0 -54
  779. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/key-parsing.d.ts +0 -8
  780. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/key-parsing.js +0 -47
  781. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/multimodal-capability.d.ts +0 -3
  782. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/multimodal-capability.js +0 -26
  783. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-directive-parser.d.ts +0 -24
  784. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-directive-parser.js +0 -209
  785. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-reminder-directives.d.ts +0 -7
  786. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-reminder-directives.js +0 -121
  787. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-reminder-orchestration-semantics.d.ts +0 -10
  788. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-reminder-orchestration-semantics.js +0 -110
  789. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-reminder-semantics.d.ts +0 -8
  790. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-reminder-semantics.js +0 -281
  791. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-reminder-time-tag-semantics.d.ts +0 -1
  792. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-reminder-time-tag-semantics.js +0 -25
  793. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-reminders-semantics.d.ts +0 -4
  794. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-reminders-semantics.js +0 -44
  795. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-tool-schema-semantics.d.ts +0 -2
  796. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-tool-schema-semantics.js +0 -62
  797. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-governance-semantics.d.ts +0 -49
  798. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-governance-semantics.js +0 -552
  799. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-governed-filter-semantics.d.ts +0 -9
  800. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-governed-filter-semantics.js +0 -64
  801. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-node-result-semantics.d.ts +0 -5
  802. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-node-result-semantics.js +0 -163
  803. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-post-governed-normalization-semantics.d.ts +0 -1
  804. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-post-governed-normalization-semantics.js +0 -49
  805. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-servertool-orchestration-semantics.d.ts +0 -30
  806. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-servertool-orchestration-semantics.js +0 -446
  807. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-web-search-intent-semantics.d.ts +0 -1
  808. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-web-search-intent-semantics.js +0 -49
  809. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-request-filter-semantics.d.ts +0 -1
  810. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-request-filter-semantics.js +0 -54
  811. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-compat-action-semantics.d.ts +0 -22
  812. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-compat-action-semantics.js +0 -559
  813. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-deepseek-web-compat.d.ts +0 -17
  814. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-deepseek-web-compat.js +0 -26
  815. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-bridge-action-semantics.d.ts +0 -276
  816. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-bridge-action-semantics.js +0 -1291
  817. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-bridge-policy-semantics.d.ts +0 -72
  818. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-bridge-policy-semantics.js +0 -405
  819. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-edge-stage-semantics.d.ts +0 -18
  820. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-edge-stage-semantics.js +0 -333
  821. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-governance-semantics.d.ts +0 -30
  822. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-governance-semantics.js +0 -202
  823. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-inbound-outbound-semantics.d.ts +0 -22
  824. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-inbound-outbound-semantics.js +0 -426
  825. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-orchestration-semantics.d.ts +0 -57
  826. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-orchestration-semantics.js +0 -705
  827. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-req-inbound-semantics.d.ts +0 -53
  828. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-req-inbound-semantics.js +0 -598
  829. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-req-outbound-semantics.d.ts +0 -147
  830. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-req-outbound-semantics.js +0 -570
  831. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-req-process-semantics.d.ts +0 -26
  832. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-req-process-semantics.js +0 -148
  833. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-resp-semantics.d.ts +0 -46
  834. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-resp-semantics.js +0 -755
  835. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-semantic-mappers.d.ts +0 -2
  836. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-semantic-mappers.js +0 -83
  837. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-session-identifiers-semantics.d.ts +0 -11
  838. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-session-identifiers-semantics.js +0 -207
  839. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-target-semantics.d.ts +0 -3
  840. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-target-semantics.js +0 -128
  841. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-router-hotpath-analysis.d.ts +0 -57
  842. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-router-hotpath-analysis.js +0 -217
  843. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-router-hotpath-loader.d.ts +0 -5
  844. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-router-hotpath-loader.js +0 -464
  845. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-router-hotpath-policy.d.ts +0 -5
  846. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-router-hotpath-policy.js +0 -18
  847. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-router-hotpath-quota-buckets.d.ts +0 -25
  848. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-router-hotpath-quota-buckets.js +0 -85
  849. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-router-hotpath.d.ts +0 -59
  850. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-router-hotpath.js +0 -117
  851. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-shared-conversion-semantics.d.ts +0 -243
  852. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-shared-conversion-semantics.js +0 -2594
  853. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-snapshot-hooks.d.ts +0 -3
  854. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-snapshot-hooks.js +0 -109
  855. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-virtual-router-alias-selection-semantics.d.ts +0 -16
  856. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-virtual-router-alias-selection-semantics.js +0 -96
  857. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-virtual-router-engine-proxy.d.ts +0 -16
  858. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-virtual-router-engine-proxy.js +0 -14
  859. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-virtual-router-routing-instructions-semantics.d.ts +0 -3
  860. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-virtual-router-routing-instructions-semantics.js +0 -123
  861. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-virtual-router-stop-message-actions-semantics.d.ts +0 -6
  862. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-virtual-router-stop-message-actions-semantics.js +0 -85
  863. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-virtual-router-stop-message-semantics.d.ts +0 -9
  864. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-virtual-router-stop-message-semantics.js +0 -70
  865. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-virtual-router-stop-message-state-semantics.d.ts +0 -2
  866. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-virtual-router-stop-message-state-semantics.js +0 -76
  867. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/route-utils.d.ts +0 -15
  868. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/route-utils.js +0 -248
  869. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/routing-state-filter.d.ts +0 -4
  870. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/routing-state-filter.js +0 -50
  871. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/selection-deps.d.ts +0 -58
  872. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/selection-deps.js +0 -1
  873. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/sticky-pool.d.ts +0 -11
  874. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/sticky-pool.js +0 -109
  875. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-load-balancing.d.ts +0 -16
  876. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-load-balancing.js +0 -120
  877. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-priority.d.ts +0 -11
  878. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-priority.js +0 -55
  879. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-selection-antigravity-session-lease.d.ts +0 -10
  880. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-selection-antigravity-session-lease.js +0 -231
  881. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-selection-antigravity-target-split.d.ts +0 -4
  882. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-selection-antigravity-target-split.js +0 -43
  883. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-selection-quota-integration.d.ts +0 -29
  884. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-selection-quota-integration.js +0 -194
  885. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-selection-select.d.ts +0 -22
  886. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-selection-select.js +0 -352
  887. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-selection.d.ts +0 -3
  888. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-selection.js +0 -309
  889. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection.d.ts +0 -1
  890. package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection.js +0 -1
  891. package/vendor/llmswitch-core/dist/router/virtual-router/engine.d.ts +0 -43
  892. package/vendor/llmswitch-core/dist/router/virtual-router/engine.js +0 -360
  893. package/vendor/llmswitch-core/dist/router/virtual-router/error-center.d.ts +0 -10
  894. package/vendor/llmswitch-core/dist/router/virtual-router/error-center.js +0 -39
  895. package/vendor/llmswitch-core/dist/router/virtual-router/features.d.ts +0 -3
  896. package/vendor/llmswitch-core/dist/router/virtual-router/features.js +0 -124
  897. package/vendor/llmswitch-core/dist/router/virtual-router/health-manager.d.ts +0 -23
  898. package/vendor/llmswitch-core/dist/router/virtual-router/health-manager.js +0 -107
  899. package/vendor/llmswitch-core/dist/router/virtual-router/health-weighted.d.ts +0 -25
  900. package/vendor/llmswitch-core/dist/router/virtual-router/health-weighted.js +0 -63
  901. package/vendor/llmswitch-core/dist/router/virtual-router/load-balancer.d.ts +0 -28
  902. package/vendor/llmswitch-core/dist/router/virtual-router/load-balancer.js +0 -160
  903. package/vendor/llmswitch-core/dist/router/virtual-router/message-utils.d.ts +0 -15
  904. package/vendor/llmswitch-core/dist/router/virtual-router/message-utils.js +0 -235
  905. package/vendor/llmswitch-core/dist/router/virtual-router/pre-command-file-resolver.d.ts +0 -2
  906. package/vendor/llmswitch-core/dist/router/virtual-router/pre-command-file-resolver.js +0 -117
  907. package/vendor/llmswitch-core/dist/router/virtual-router/provider-registry.d.ts +0 -17
  908. package/vendor/llmswitch-core/dist/router/virtual-router/provider-registry.js +0 -145
  909. package/vendor/llmswitch-core/dist/router/virtual-router/routing-instructions/clean.d.ts +0 -3
  910. package/vendor/llmswitch-core/dist/router/virtual-router/routing-instructions/clean.js +0 -34
  911. package/vendor/llmswitch-core/dist/router/virtual-router/routing-instructions/parse.d.ts +0 -6
  912. package/vendor/llmswitch-core/dist/router/virtual-router/routing-instructions/parse.js +0 -24
  913. package/vendor/llmswitch-core/dist/router/virtual-router/routing-instructions/state.d.ts +0 -4
  914. package/vendor/llmswitch-core/dist/router/virtual-router/routing-instructions/state.js +0 -284
  915. package/vendor/llmswitch-core/dist/router/virtual-router/routing-instructions/types.d.ts +0 -74
  916. package/vendor/llmswitch-core/dist/router/virtual-router/routing-instructions/types.js +0 -2
  917. package/vendor/llmswitch-core/dist/router/virtual-router/routing-instructions.d.ts +0 -5
  918. package/vendor/llmswitch-core/dist/router/virtual-router/routing-instructions.js +0 -4
  919. package/vendor/llmswitch-core/dist/router/virtual-router/routing-pre-command-actions.d.ts +0 -3
  920. package/vendor/llmswitch-core/dist/router/virtual-router/routing-pre-command-actions.js +0 -26
  921. package/vendor/llmswitch-core/dist/router/virtual-router/routing-pre-command-parser.d.ts +0 -2
  922. package/vendor/llmswitch-core/dist/router/virtual-router/routing-pre-command-parser.js +0 -85
  923. package/vendor/llmswitch-core/dist/router/virtual-router/routing-pre-command-state-codec.d.ts +0 -3
  924. package/vendor/llmswitch-core/dist/router/virtual-router/routing-pre-command-state-codec.js +0 -24
  925. package/vendor/llmswitch-core/dist/router/virtual-router/routing-stop-message-actions.d.ts +0 -2
  926. package/vendor/llmswitch-core/dist/router/virtual-router/routing-stop-message-actions.js +0 -99
  927. package/vendor/llmswitch-core/dist/router/virtual-router/routing-stop-message-parser.d.ts +0 -3
  928. package/vendor/llmswitch-core/dist/router/virtual-router/routing-stop-message-parser.js +0 -19
  929. package/vendor/llmswitch-core/dist/router/virtual-router/routing-stop-message-state-codec.d.ts +0 -7
  930. package/vendor/llmswitch-core/dist/router/virtual-router/routing-stop-message-state-codec.js +0 -121
  931. package/vendor/llmswitch-core/dist/router/virtual-router/sticky-session-store.d.ts +0 -8
  932. package/vendor/llmswitch-core/dist/router/virtual-router/sticky-session-store.js +0 -296
  933. package/vendor/llmswitch-core/dist/router/virtual-router/stop-message-file-resolver.d.ts +0 -2
  934. package/vendor/llmswitch-core/dist/router/virtual-router/stop-message-file-resolver.js +0 -76
  935. package/vendor/llmswitch-core/dist/router/virtual-router/stop-message-stage-template-files.d.ts +0 -12
  936. package/vendor/llmswitch-core/dist/router/virtual-router/stop-message-stage-template-files.js +0 -67
  937. package/vendor/llmswitch-core/dist/router/virtual-router/stop-message-state-sync.d.ts +0 -17
  938. package/vendor/llmswitch-core/dist/router/virtual-router/stop-message-state-sync.js +0 -82
  939. package/vendor/llmswitch-core/dist/router/virtual-router/success-center.d.ts +0 -10
  940. package/vendor/llmswitch-core/dist/router/virtual-router/success-center.js +0 -32
  941. package/vendor/llmswitch-core/dist/router/virtual-router/token-counter.d.ts +0 -2
  942. package/vendor/llmswitch-core/dist/router/virtual-router/token-counter.js +0 -148
  943. package/vendor/llmswitch-core/dist/router/virtual-router/token-estimator.d.ts +0 -2
  944. package/vendor/llmswitch-core/dist/router/virtual-router/token-estimator.js +0 -16
  945. package/vendor/llmswitch-core/dist/router/virtual-router/token-file-scanner.d.ts +0 -24
  946. package/vendor/llmswitch-core/dist/router/virtual-router/token-file-scanner.js +0 -117
  947. package/vendor/llmswitch-core/dist/router/virtual-router/tool-signals.d.ts +0 -19
  948. package/vendor/llmswitch-core/dist/router/virtual-router/tool-signals.js +0 -647
  949. package/vendor/llmswitch-core/dist/router/virtual-router/types.d.ts +0 -681
  950. package/vendor/llmswitch-core/dist/router/virtual-router/types.js +0 -34
  951. package/vendor/llmswitch-core/dist/runtime/user-data-paths.d.ts +0 -5
  952. package/vendor/llmswitch-core/dist/runtime/user-data-paths.js +0 -43
  953. package/vendor/llmswitch-core/dist/servertool/clock/config.d.ts +0 -17
  954. package/vendor/llmswitch-core/dist/servertool/clock/config.js +0 -48
  955. package/vendor/llmswitch-core/dist/servertool/clock/daemon.d.ts +0 -24
  956. package/vendor/llmswitch-core/dist/servertool/clock/daemon.js +0 -207
  957. package/vendor/llmswitch-core/dist/servertool/clock/io.d.ts +0 -2
  958. package/vendor/llmswitch-core/dist/servertool/clock/io.js +0 -14
  959. package/vendor/llmswitch-core/dist/servertool/clock/log.d.ts +0 -3
  960. package/vendor/llmswitch-core/dist/servertool/clock/log.js +0 -13
  961. package/vendor/llmswitch-core/dist/servertool/clock/ntp.d.ts +0 -18
  962. package/vendor/llmswitch-core/dist/servertool/clock/ntp.js +0 -318
  963. package/vendor/llmswitch-core/dist/servertool/clock/paths.d.ts +0 -5
  964. package/vendor/llmswitch-core/dist/servertool/clock/paths.js +0 -28
  965. package/vendor/llmswitch-core/dist/servertool/clock/recurrence.d.ts +0 -7
  966. package/vendor/llmswitch-core/dist/servertool/clock/recurrence.js +0 -248
  967. package/vendor/llmswitch-core/dist/servertool/clock/session-scope.d.ts +0 -3
  968. package/vendor/llmswitch-core/dist/servertool/clock/session-scope.js +0 -41
  969. package/vendor/llmswitch-core/dist/servertool/clock/session-store.d.ts +0 -3
  970. package/vendor/llmswitch-core/dist/servertool/clock/session-store.js +0 -63
  971. package/vendor/llmswitch-core/dist/servertool/clock/state.d.ts +0 -9
  972. package/vendor/llmswitch-core/dist/servertool/clock/state.js +0 -135
  973. package/vendor/llmswitch-core/dist/servertool/clock/task-store.d.ts +0 -5
  974. package/vendor/llmswitch-core/dist/servertool/clock/task-store.js +0 -4
  975. package/vendor/llmswitch-core/dist/servertool/clock/tasks.d.ts +0 -24
  976. package/vendor/llmswitch-core/dist/servertool/clock/tasks.js +0 -595
  977. package/vendor/llmswitch-core/dist/servertool/clock/types.d.ts +0 -98
  978. package/vendor/llmswitch-core/dist/servertool/clock/types.js +0 -1
  979. package/vendor/llmswitch-core/dist/servertool/continue-execution/log.d.ts +0 -3
  980. package/vendor/llmswitch-core/dist/servertool/continue-execution/log.js +0 -13
  981. package/vendor/llmswitch-core/dist/servertool/engine.d.ts +0 -38
  982. package/vendor/llmswitch-core/dist/servertool/engine.js +0 -1660
  983. package/vendor/llmswitch-core/dist/servertool/followup-shadow.d.ts +0 -16
  984. package/vendor/llmswitch-core/dist/servertool/followup-shadow.js +0 -145
  985. package/vendor/llmswitch-core/dist/servertool/handlers/antigravity-thought-signature-bootstrap.d.ts +0 -1
  986. package/vendor/llmswitch-core/dist/servertool/handlers/antigravity-thought-signature-bootstrap.js +0 -225
  987. package/vendor/llmswitch-core/dist/servertool/handlers/apply-patch-guard.d.ts +0 -1
  988. package/vendor/llmswitch-core/dist/servertool/handlers/apply-patch-guard.js +0 -5
  989. package/vendor/llmswitch-core/dist/servertool/handlers/clock-auto.d.ts +0 -1
  990. package/vendor/llmswitch-core/dist/servertool/handlers/clock-auto.js +0 -177
  991. package/vendor/llmswitch-core/dist/servertool/handlers/clock.d.ts +0 -1
  992. package/vendor/llmswitch-core/dist/servertool/handlers/clock.js +0 -544
  993. package/vendor/llmswitch-core/dist/servertool/handlers/compaction-detect.d.ts +0 -1
  994. package/vendor/llmswitch-core/dist/servertool/handlers/compaction-detect.js +0 -1
  995. package/vendor/llmswitch-core/dist/servertool/handlers/continue-execution.d.ts +0 -1
  996. package/vendor/llmswitch-core/dist/servertool/handlers/continue-execution.js +0 -110
  997. package/vendor/llmswitch-core/dist/servertool/handlers/exec-command-guard.d.ts +0 -1
  998. package/vendor/llmswitch-core/dist/servertool/handlers/exec-command-guard.js +0 -10
  999. package/vendor/llmswitch-core/dist/servertool/handlers/followup-message-trimmer.d.ts +0 -16
  1000. package/vendor/llmswitch-core/dist/servertool/handlers/followup-message-trimmer.js +0 -198
  1001. package/vendor/llmswitch-core/dist/servertool/handlers/followup-request-builder.d.ts +0 -25
  1002. package/vendor/llmswitch-core/dist/servertool/handlers/followup-request-builder.js +0 -515
  1003. package/vendor/llmswitch-core/dist/servertool/handlers/followup-sanitize.d.ts +0 -2
  1004. package/vendor/llmswitch-core/dist/servertool/handlers/followup-sanitize.js +0 -7
  1005. package/vendor/llmswitch-core/dist/servertool/handlers/gemini-empty-reply-continue.d.ts +0 -1
  1006. package/vendor/llmswitch-core/dist/servertool/handlers/gemini-empty-reply-continue.js +0 -3
  1007. package/vendor/llmswitch-core/dist/servertool/handlers/iflow-model-error-retry.d.ts +0 -1
  1008. package/vendor/llmswitch-core/dist/servertool/handlers/iflow-model-error-retry.js +0 -92
  1009. package/vendor/llmswitch-core/dist/servertool/handlers/recursive-detection-guard.d.ts +0 -1
  1010. package/vendor/llmswitch-core/dist/servertool/handlers/recursive-detection-guard.js +0 -374
  1011. package/vendor/llmswitch-core/dist/servertool/handlers/review.d.ts +0 -1
  1012. package/vendor/llmswitch-core/dist/servertool/handlers/review.js +0 -181
  1013. package/vendor/llmswitch-core/dist/servertool/handlers/stop-message-auto/blocked-report.d.ts +0 -16
  1014. package/vendor/llmswitch-core/dist/servertool/handlers/stop-message-auto/blocked-report.js +0 -407
  1015. package/vendor/llmswitch-core/dist/servertool/handlers/stop-message-auto/iflow-followup.d.ts +0 -44
  1016. package/vendor/llmswitch-core/dist/servertool/handlers/stop-message-auto/iflow-followup.js +0 -816
  1017. package/vendor/llmswitch-core/dist/servertool/handlers/stop-message-auto/routing-state.d.ts +0 -28
  1018. package/vendor/llmswitch-core/dist/servertool/handlers/stop-message-auto/routing-state.js +0 -123
  1019. package/vendor/llmswitch-core/dist/servertool/handlers/stop-message-auto/runtime-utils.d.ts +0 -81
  1020. package/vendor/llmswitch-core/dist/servertool/handlers/stop-message-auto/runtime-utils.js +0 -355
  1021. package/vendor/llmswitch-core/dist/servertool/handlers/stop-message-auto.d.ts +0 -1
  1022. package/vendor/llmswitch-core/dist/servertool/handlers/stop-message-auto.js +0 -553
  1023. package/vendor/llmswitch-core/dist/servertool/handlers/vision.d.ts +0 -7
  1024. package/vendor/llmswitch-core/dist/servertool/handlers/vision.js +0 -240
  1025. package/vendor/llmswitch-core/dist/servertool/handlers/web-search.d.ts +0 -7
  1026. package/vendor/llmswitch-core/dist/servertool/handlers/web-search.js +0 -926
  1027. package/vendor/llmswitch-core/dist/servertool/log/progress-file.d.ts +0 -14
  1028. package/vendor/llmswitch-core/dist/servertool/log/progress-file.js +0 -88
  1029. package/vendor/llmswitch-core/dist/servertool/pending-session.d.ts +0 -19
  1030. package/vendor/llmswitch-core/dist/servertool/pending-session.js +0 -99
  1031. package/vendor/llmswitch-core/dist/servertool/pre-command-hooks.d.ts +0 -17
  1032. package/vendor/llmswitch-core/dist/servertool/pre-command-hooks.js +0 -491
  1033. package/vendor/llmswitch-core/dist/servertool/reenter-backend.d.ts +0 -23
  1034. package/vendor/llmswitch-core/dist/servertool/reenter-backend.js +0 -20
  1035. package/vendor/llmswitch-core/dist/servertool/registry.d.ts +0 -35
  1036. package/vendor/llmswitch-core/dist/servertool/registry.js +0 -92
  1037. package/vendor/llmswitch-core/dist/servertool/server-side-tools.d.ts +0 -15
  1038. package/vendor/llmswitch-core/dist/servertool/server-side-tools.js +0 -898
  1039. package/vendor/llmswitch-core/dist/servertool/stop-gateway-context.d.ts +0 -14
  1040. package/vendor/llmswitch-core/dist/servertool/stop-gateway-context.js +0 -167
  1041. package/vendor/llmswitch-core/dist/servertool/stop-message-compare-context.d.ts +0 -24
  1042. package/vendor/llmswitch-core/dist/servertool/stop-message-compare-context.js +0 -133
  1043. package/vendor/llmswitch-core/dist/servertool/strip-servertool-calls.d.ts +0 -2
  1044. package/vendor/llmswitch-core/dist/servertool/strip-servertool-calls.js +0 -75
  1045. package/vendor/llmswitch-core/dist/servertool/types.d.ts +0 -235
  1046. package/vendor/llmswitch-core/dist/servertool/types.js +0 -1
  1047. package/vendor/llmswitch-core/dist/sse/index.d.ts +0 -176
  1048. package/vendor/llmswitch-core/dist/sse/index.js +0 -142
  1049. package/vendor/llmswitch-core/dist/sse/json-to-sse/anthropic-json-to-sse-converter.d.ts +0 -15
  1050. package/vendor/llmswitch-core/dist/sse/json-to-sse/anthropic-json-to-sse-converter.js +0 -112
  1051. package/vendor/llmswitch-core/dist/sse/json-to-sse/chat-json-to-sse-converter.d.ts +0 -80
  1052. package/vendor/llmswitch-core/dist/sse/json-to-sse/chat-json-to-sse-converter.js +0 -300
  1053. package/vendor/llmswitch-core/dist/sse/json-to-sse/event-generators/chat.d.ts +0 -55
  1054. package/vendor/llmswitch-core/dist/sse/json-to-sse/event-generators/chat.js +0 -233
  1055. package/vendor/llmswitch-core/dist/sse/json-to-sse/event-generators/responses.d.ts +0 -103
  1056. package/vendor/llmswitch-core/dist/sse/json-to-sse/event-generators/responses.js +0 -703
  1057. package/vendor/llmswitch-core/dist/sse/json-to-sse/gemini-json-to-sse-converter.d.ts +0 -15
  1058. package/vendor/llmswitch-core/dist/sse/json-to-sse/gemini-json-to-sse-converter.js +0 -99
  1059. package/vendor/llmswitch-core/dist/sse/json-to-sse/index.d.ts +0 -7
  1060. package/vendor/llmswitch-core/dist/sse/json-to-sse/index.js +0 -9
  1061. package/vendor/llmswitch-core/dist/sse/json-to-sse/responses-json-to-sse-converter.d.ts +0 -80
  1062. package/vendor/llmswitch-core/dist/sse/json-to-sse/responses-json-to-sse-converter.js +0 -322
  1063. package/vendor/llmswitch-core/dist/sse/json-to-sse/sequencers/anthropic-sequencer.d.ts +0 -13
  1064. package/vendor/llmswitch-core/dist/sse/json-to-sse/sequencers/anthropic-sequencer.js +0 -162
  1065. package/vendor/llmswitch-core/dist/sse/json-to-sse/sequencers/chat-sequencer.d.ts +0 -39
  1066. package/vendor/llmswitch-core/dist/sse/json-to-sse/sequencers/chat-sequencer.js +0 -264
  1067. package/vendor/llmswitch-core/dist/sse/json-to-sse/sequencers/gemini-sequencer.d.ts +0 -10
  1068. package/vendor/llmswitch-core/dist/sse/json-to-sse/sequencers/gemini-sequencer.js +0 -95
  1069. package/vendor/llmswitch-core/dist/sse/json-to-sse/sequencers/responses-sequencer.d.ts +0 -40
  1070. package/vendor/llmswitch-core/dist/sse/json-to-sse/sequencers/responses-sequencer.js +0 -293
  1071. package/vendor/llmswitch-core/dist/sse/registry/sse-codec-registry.d.ts +0 -32
  1072. package/vendor/llmswitch-core/dist/sse/registry/sse-codec-registry.js +0 -135
  1073. package/vendor/llmswitch-core/dist/sse/shared/chat-serializer.d.ts +0 -4
  1074. package/vendor/llmswitch-core/dist/sse/shared/chat-serializer.js +0 -40
  1075. package/vendor/llmswitch-core/dist/sse/shared/constants.d.ts +0 -272
  1076. package/vendor/llmswitch-core/dist/sse/shared/constants.js +0 -321
  1077. package/vendor/llmswitch-core/dist/sse/shared/reasoning-dispatcher.d.ts +0 -10
  1078. package/vendor/llmswitch-core/dist/sse/shared/reasoning-dispatcher.js +0 -25
  1079. package/vendor/llmswitch-core/dist/sse/shared/responses-output-normalizer.d.ts +0 -13
  1080. package/vendor/llmswitch-core/dist/sse/shared/responses-output-normalizer.js +0 -47
  1081. package/vendor/llmswitch-core/dist/sse/shared/serializers/anthropic-event-serializer.d.ts +0 -2
  1082. package/vendor/llmswitch-core/dist/sse/shared/serializers/anthropic-event-serializer.js +0 -9
  1083. package/vendor/llmswitch-core/dist/sse/shared/serializers/base-serializer.d.ts +0 -158
  1084. package/vendor/llmswitch-core/dist/sse/shared/serializers/base-serializer.js +0 -210
  1085. package/vendor/llmswitch-core/dist/sse/shared/serializers/chat-event-serializer.d.ts +0 -82
  1086. package/vendor/llmswitch-core/dist/sse/shared/serializers/chat-event-serializer.js +0 -275
  1087. package/vendor/llmswitch-core/dist/sse/shared/serializers/gemini-event-serializer.d.ts +0 -2
  1088. package/vendor/llmswitch-core/dist/sse/shared/serializers/gemini-event-serializer.js +0 -5
  1089. package/vendor/llmswitch-core/dist/sse/shared/serializers/index.d.ts +0 -42
  1090. package/vendor/llmswitch-core/dist/sse/shared/serializers/index.js +0 -56
  1091. package/vendor/llmswitch-core/dist/sse/shared/serializers/responses-event-serializer.d.ts +0 -131
  1092. package/vendor/llmswitch-core/dist/sse/shared/serializers/responses-event-serializer.js +0 -375
  1093. package/vendor/llmswitch-core/dist/sse/shared/serializers/types.d.ts +0 -51
  1094. package/vendor/llmswitch-core/dist/sse/shared/serializers/types.js +0 -4
  1095. package/vendor/llmswitch-core/dist/sse/shared/utils.d.ts +0 -254
  1096. package/vendor/llmswitch-core/dist/sse/shared/utils.js +0 -543
  1097. package/vendor/llmswitch-core/dist/sse/shared/writer.d.ts +0 -127
  1098. package/vendor/llmswitch-core/dist/sse/shared/writer.js +0 -321
  1099. package/vendor/llmswitch-core/dist/sse/sse-to-json/anthropic-sse-to-json-converter.d.ts +0 -20
  1100. package/vendor/llmswitch-core/dist/sse/sse-to-json/anthropic-sse-to-json-converter.js +0 -204
  1101. package/vendor/llmswitch-core/dist/sse/sse-to-json/builders/anthropic-response-builder.d.ts +0 -16
  1102. package/vendor/llmswitch-core/dist/sse/sse-to-json/builders/anthropic-response-builder.js +0 -258
  1103. package/vendor/llmswitch-core/dist/sse/sse-to-json/builders/response-builder.d.ts +0 -177
  1104. package/vendor/llmswitch-core/dist/sse/sse-to-json/builders/response-builder.js +0 -1135
  1105. package/vendor/llmswitch-core/dist/sse/sse-to-json/chat-sse-to-json-converter.d.ts +0 -119
  1106. package/vendor/llmswitch-core/dist/sse/sse-to-json/chat-sse-to-json-converter.js +0 -850
  1107. package/vendor/llmswitch-core/dist/sse/sse-to-json/gemini-sse-to-json-converter.d.ts +0 -14
  1108. package/vendor/llmswitch-core/dist/sse/sse-to-json/gemini-sse-to-json-converter.js +0 -186
  1109. package/vendor/llmswitch-core/dist/sse/sse-to-json/index.d.ts +0 -7
  1110. package/vendor/llmswitch-core/dist/sse/sse-to-json/index.js +0 -9
  1111. package/vendor/llmswitch-core/dist/sse/sse-to-json/parsers/sse-parser.d.ts +0 -73
  1112. package/vendor/llmswitch-core/dist/sse/sse-to-json/parsers/sse-parser.js +0 -434
  1113. package/vendor/llmswitch-core/dist/sse/sse-to-json/responses-sse-to-json-converter.d.ts +0 -61
  1114. package/vendor/llmswitch-core/dist/sse/sse-to-json/responses-sse-to-json-converter.js +0 -306
  1115. package/vendor/llmswitch-core/dist/sse/types/anthropic-types.d.ts +0 -194
  1116. package/vendor/llmswitch-core/dist/sse/types/anthropic-types.js +0 -8
  1117. package/vendor/llmswitch-core/dist/sse/types/chat-types.d.ts +0 -321
  1118. package/vendor/llmswitch-core/dist/sse/types/chat-types.js +0 -33
  1119. package/vendor/llmswitch-core/dist/sse/types/conversion-context.d.ts +0 -214
  1120. package/vendor/llmswitch-core/dist/sse/types/conversion-context.js +0 -20
  1121. package/vendor/llmswitch-core/dist/sse/types/core-interfaces.d.ts +0 -94
  1122. package/vendor/llmswitch-core/dist/sse/types/core-interfaces.js +0 -5
  1123. package/vendor/llmswitch-core/dist/sse/types/gemini-types.d.ts +0 -135
  1124. package/vendor/llmswitch-core/dist/sse/types/gemini-types.js +0 -5
  1125. package/vendor/llmswitch-core/dist/sse/types/index.d.ts +0 -17
  1126. package/vendor/llmswitch-core/dist/sse/types/index.js +0 -9
  1127. package/vendor/llmswitch-core/dist/sse/types/responses-types.d.ts +0 -334
  1128. package/vendor/llmswitch-core/dist/sse/types/responses-types.js +0 -38
  1129. package/vendor/llmswitch-core/dist/sse/types/sse-events.d.ts +0 -181
  1130. package/vendor/llmswitch-core/dist/sse/types/sse-events.js +0 -150
  1131. package/vendor/llmswitch-core/dist/sse/types/stream-state.d.ts +0 -199
  1132. package/vendor/llmswitch-core/dist/sse/types/stream-state.js +0 -44
  1133. package/vendor/llmswitch-core/dist/sse/types/utility-types.d.ts +0 -234
  1134. package/vendor/llmswitch-core/dist/sse/types/utility-types.js +0 -46
  1135. package/vendor/llmswitch-core/dist/telemetry/stats-center.d.ts +0 -82
  1136. package/vendor/llmswitch-core/dist/telemetry/stats-center.js +0 -308
  1137. package/vendor/llmswitch-core/dist/tools/apply-patch/args-normalizer/default-actions.d.ts +0 -2
  1138. package/vendor/llmswitch-core/dist/tools/apply-patch/args-normalizer/default-actions.js +0 -12
  1139. package/vendor/llmswitch-core/dist/tools/apply-patch/args-normalizer/extract-patch.d.ts +0 -2
  1140. package/vendor/llmswitch-core/dist/tools/apply-patch/args-normalizer/extract-patch.js +0 -15
  1141. package/vendor/llmswitch-core/dist/tools/apply-patch/args-normalizer/index.d.ts +0 -2
  1142. package/vendor/llmswitch-core/dist/tools/apply-patch/args-normalizer/index.js +0 -164
  1143. package/vendor/llmswitch-core/dist/tools/apply-patch/args-normalizer/structured-builders.d.ts +0 -7
  1144. package/vendor/llmswitch-core/dist/tools/apply-patch/args-normalizer/structured-builders.js +0 -85
  1145. package/vendor/llmswitch-core/dist/tools/apply-patch/args-normalizer/types.d.ts +0 -54
  1146. package/vendor/llmswitch-core/dist/tools/apply-patch/args-normalizer/types.js +0 -1
  1147. package/vendor/llmswitch-core/dist/tools/apply-patch/execution-capturer.d.ts +0 -13
  1148. package/vendor/llmswitch-core/dist/tools/apply-patch/execution-capturer.js +0 -181
  1149. package/vendor/llmswitch-core/dist/tools/apply-patch/json/parse-loose.d.ts +0 -3
  1150. package/vendor/llmswitch-core/dist/tools/apply-patch/json/parse-loose.js +0 -139
  1151. package/vendor/llmswitch-core/dist/tools/apply-patch/patch-text/context-diff.d.ts +0 -1
  1152. package/vendor/llmswitch-core/dist/tools/apply-patch/patch-text/context-diff.js +0 -173
  1153. package/vendor/llmswitch-core/dist/tools/apply-patch/patch-text/git-diff.d.ts +0 -1
  1154. package/vendor/llmswitch-core/dist/tools/apply-patch/patch-text/git-diff.js +0 -138
  1155. package/vendor/llmswitch-core/dist/tools/apply-patch/patch-text/looks-like-patch.d.ts +0 -1
  1156. package/vendor/llmswitch-core/dist/tools/apply-patch/patch-text/looks-like-patch.js +0 -11
  1157. package/vendor/llmswitch-core/dist/tools/apply-patch/patch-text/normalize.d.ts +0 -3
  1158. package/vendor/llmswitch-core/dist/tools/apply-patch/patch-text/normalize.js +0 -383
  1159. package/vendor/llmswitch-core/dist/tools/apply-patch/regression-capturer.d.ts +0 -13
  1160. package/vendor/llmswitch-core/dist/tools/apply-patch/regression-capturer.js +0 -113
  1161. package/vendor/llmswitch-core/dist/tools/apply-patch/structured/coercion.d.ts +0 -3
  1162. package/vendor/llmswitch-core/dist/tools/apply-patch/structured/coercion.js +0 -103
  1163. package/vendor/llmswitch-core/dist/tools/apply-patch/structured.d.ts +0 -20
  1164. package/vendor/llmswitch-core/dist/tools/apply-patch/structured.js +0 -537
  1165. package/vendor/llmswitch-core/dist/tools/apply-patch/validation/shared.d.ts +0 -3
  1166. package/vendor/llmswitch-core/dist/tools/apply-patch/validation/shared.js +0 -6
  1167. package/vendor/llmswitch-core/dist/tools/apply-patch/validator.d.ts +0 -8
  1168. package/vendor/llmswitch-core/dist/tools/apply-patch/validator.js +0 -21
  1169. package/vendor/llmswitch-core/dist/tools/apply-patch-structured.d.ts +0 -1
  1170. package/vendor/llmswitch-core/dist/tools/apply-patch-structured.js +0 -1
  1171. package/vendor/llmswitch-core/dist/tools/args-json.d.ts +0 -1
  1172. package/vendor/llmswitch-core/dist/tools/args-json.js +0 -204
  1173. package/vendor/llmswitch-core/dist/tools/exec-command/normalize.d.ts +0 -17
  1174. package/vendor/llmswitch-core/dist/tools/exec-command/normalize.js +0 -116
  1175. package/vendor/llmswitch-core/dist/tools/exec-command/regression-capturer.d.ts +0 -11
  1176. package/vendor/llmswitch-core/dist/tools/exec-command/regression-capturer.js +0 -144
  1177. package/vendor/llmswitch-core/dist/tools/exec-command/validator.d.ts +0 -10
  1178. package/vendor/llmswitch-core/dist/tools/exec-command/validator.js +0 -238
  1179. package/vendor/llmswitch-core/dist/tools/patch-regression-capturer.d.ts +0 -1
  1180. package/vendor/llmswitch-core/dist/tools/patch-regression-capturer.js +0 -1
  1181. package/vendor/llmswitch-core/dist/tools/tool-description-utils.d.ts +0 -5
  1182. package/vendor/llmswitch-core/dist/tools/tool-description-utils.js +0 -50
  1183. package/vendor/llmswitch-core/dist/tools/tool-registry.d.ts +0 -15
  1184. package/vendor/llmswitch-core/dist/tools/tool-registry.js +0 -253
  1185. package/vendor/llmswitch-core/package.json +0 -189
@@ -1,1660 +0,0 @@
1
- import { runServerSideToolEngine } from './server-side-tools.js';
2
- import { ProviderProtocolError } from '../conversion/provider-protocol-error.js';
3
- import { ensureRuntimeMetadata, readRuntimeMetadata } from '../conversion/runtime-metadata.js';
4
- import { createHash } from 'node:crypto';
5
- import { loadRoutingInstructionStateSync, saveRoutingInstructionStateSync } from '../router/virtual-router/sticky-session-store.js';
6
- import { deserializeRoutingInstructionState, serializeRoutingInstructionState } from '../router/virtual-router/routing-instructions.js';
7
- import { applyHubFollowupPolicyShadow } from './followup-shadow.js';
8
- import { buildServerToolFollowupChatPayloadFromInjection, extractCapturedChatSeed } from './handlers/followup-request-builder.js';
9
- import { findNextUndeliveredDueAtMs, listClockTasks, resolveClockConfig } from './clock/task-store.js';
10
- import { resolveClockSessionScope } from './clock/session-scope.js';
11
- import { savePendingServerToolInjection } from './pending-session.js';
12
- import { appendServerToolProgressFileEvent } from './log/progress-file.js';
13
- import { attachStopGatewayContext, inspectStopGatewaySignal } from './stop-gateway-context.js';
14
- import { formatStopMessageCompareContext, readStopMessageCompareContext } from './stop-message-compare-context.js';
15
- const STOP_MESSAGE_STAGE_TIMEOUT_MS = 900_000;
16
- const STOP_MESSAGE_LOOP_WARN_THRESHOLD = 5;
17
- const STOP_MESSAGE_LOOP_FAIL_THRESHOLD = 10;
18
- function parseTimeoutMs(raw, fallback) {
19
- const n = typeof raw === 'string' ? Number(raw.trim()) : typeof raw === 'number' ? raw : NaN;
20
- if (!Number.isFinite(n) || n <= 0) {
21
- return fallback;
22
- }
23
- return Math.floor(n);
24
- }
25
- function resolveServerToolTimeoutMs() {
26
- return parseTimeoutMs(process.env.ROUTECODEX_SERVERTOOL_TIMEOUT_MS ||
27
- process.env.RCC_SERVERTOOL_TIMEOUT_MS ||
28
- process.env.LLMSWITCH_SERVERTOOL_TIMEOUT_MS, 500_000);
29
- }
30
- function resolveServerToolFollowupTimeoutMs(fallback) {
31
- return parseTimeoutMs(process.env.ROUTECODEX_SERVERTOOL_FOLLOWUP_TIMEOUT_MS ||
32
- process.env.RCC_SERVERTOOL_FOLLOWUP_TIMEOUT_MS ||
33
- process.env.LLMSWITCH_SERVERTOOL_FOLLOWUP_TIMEOUT_MS, fallback);
34
- }
35
- function withTimeout(promise, timeoutMs, buildError) {
36
- if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
37
- return promise;
38
- }
39
- let timer;
40
- return new Promise((resolve, reject) => {
41
- timer = setTimeout(() => reject(buildError()), timeoutMs);
42
- promise.then(resolve, reject).finally(() => {
43
- if (timer) {
44
- clearTimeout(timer);
45
- timer = undefined;
46
- }
47
- });
48
- });
49
- }
50
- class ServerToolClientDisconnectedError extends Error {
51
- code = 'SERVERTOOL_CLIENT_DISCONNECTED';
52
- }
53
- function createServerToolClientDisconnectedError(options) {
54
- const error = new ServerToolClientDisconnectedError(`[servertool] client disconnected during followup` + (options.flowId ? ` flow=${options.flowId}` : ''));
55
- error.details = {
56
- requestId: options.requestId,
57
- flowId: options.flowId
58
- };
59
- return error;
60
- }
61
- function isServerToolClientDisconnectedError(error) {
62
- return Boolean(error &&
63
- typeof error === 'object' &&
64
- typeof error.code === 'string' &&
65
- error.code === 'SERVERTOOL_CLIENT_DISCONNECTED');
66
- }
67
- function createClientDisconnectWatcher(options) {
68
- const interval = typeof options.pollIntervalMs === 'number' && Number.isFinite(options.pollIntervalMs) && options.pollIntervalMs > 0
69
- ? Math.max(20, Math.floor(options.pollIntervalMs))
70
- : 80;
71
- let timer;
72
- let active = true;
73
- const cancel = () => {
74
- active = false;
75
- if (timer) {
76
- clearTimeout(timer);
77
- timer = undefined;
78
- }
79
- };
80
- const promise = new Promise((_resolve, reject) => {
81
- const check = () => {
82
- if (!active) {
83
- return;
84
- }
85
- if (isAdapterClientDisconnected(options.adapterContext)) {
86
- cancel();
87
- reject(createServerToolClientDisconnectedError({
88
- requestId: options.requestId,
89
- flowId: options.flowId
90
- }));
91
- return;
92
- }
93
- timer = setTimeout(check, interval);
94
- timer.unref?.();
95
- };
96
- timer = setTimeout(check, interval);
97
- timer.unref?.();
98
- });
99
- return { promise, cancel };
100
- }
101
- function isServerToolTimeoutError(error) {
102
- return Boolean(error &&
103
- typeof error === 'object' &&
104
- typeof error.code === 'string' &&
105
- error.code === 'SERVERTOOL_TIMEOUT');
106
- }
107
- function createServerToolTimeoutError(options) {
108
- const err = new ProviderProtocolError(`[servertool] ${options.phase} timeout after ${options.timeoutMs}ms` +
109
- (options.flowId ? ` flow=${options.flowId}` : ''), {
110
- code: 'SERVERTOOL_TIMEOUT',
111
- category: 'INTERNAL_ERROR',
112
- details: {
113
- requestId: options.requestId,
114
- phase: options.phase,
115
- flowId: options.flowId,
116
- timeoutMs: options.timeoutMs,
117
- attempt: options.attempt,
118
- maxAttempts: options.maxAttempts
119
- }
120
- });
121
- err.status = 504;
122
- return err;
123
- }
124
- function createStopMessageFetchFailedError(options) {
125
- const baseMessage = options.reason === 'loop_limit'
126
- ? 'fetch failed: network error (stopMessage loop detected)'
127
- : 'fetch failed: network error (stopMessage exceeded stage timeout)';
128
- const err = new ProviderProtocolError(baseMessage, {
129
- code: 'SERVERTOOL_TIMEOUT',
130
- category: 'EXTERNAL_ERROR',
131
- details: {
132
- requestId: options.requestId,
133
- reason: options.reason,
134
- ...(typeof options.elapsedMs === 'number' && Number.isFinite(options.elapsedMs)
135
- ? { elapsedMs: Math.max(0, Math.floor(options.elapsedMs)) }
136
- : {}),
137
- ...(typeof options.repeatCount === 'number' && Number.isFinite(options.repeatCount)
138
- ? { repeatCount: Math.max(0, Math.floor(options.repeatCount)) }
139
- : {}),
140
- ...(typeof options.timeoutMs === 'number' && Number.isFinite(options.timeoutMs)
141
- ? { timeoutMs: Math.max(0, Math.floor(options.timeoutMs)) }
142
- : {}),
143
- ...(typeof options.attempt === 'number' && Number.isFinite(options.attempt)
144
- ? { attempt: Math.max(1, Math.floor(options.attempt)) }
145
- : {}),
146
- ...(typeof options.maxAttempts === 'number' && Number.isFinite(options.maxAttempts)
147
- ? { maxAttempts: Math.max(1, Math.floor(options.maxAttempts)) }
148
- : {})
149
- }
150
- });
151
- err.status = 502;
152
- return err;
153
- }
154
- function coerceFollowupPayloadStream(payload, stream) {
155
- if (!payload || typeof payload !== 'object') {
156
- return payload;
157
- }
158
- // ServerTool followup requests must be non-streaming to keep parsing deterministic and avoid
159
- // provider-side SSE wrappers leaking into internal reenter calls.
160
- if (stream === false) {
161
- payload.stream = false;
162
- }
163
- return payload;
164
- }
165
- function hasNonEmptyText(value) {
166
- if (typeof value === 'string') {
167
- return value.trim().length > 0;
168
- }
169
- if (Array.isArray(value)) {
170
- return value.some((entry) => hasNonEmptyText(entry));
171
- }
172
- if (value && typeof value === 'object' && !Array.isArray(value)) {
173
- const record = value;
174
- if (hasNonEmptyText(record.text))
175
- return true;
176
- if (hasNonEmptyText(record.output_text))
177
- return true;
178
- if (hasNonEmptyText(record.content))
179
- return true;
180
- }
181
- return false;
182
- }
183
- function isEmptyClientResponsePayload(payload) {
184
- if (!payload || typeof payload !== 'object') {
185
- return true;
186
- }
187
- // If upstream returned an explicit error shape, treat as non-empty (caller should surface it).
188
- if (Object.prototype.hasOwnProperty.call(payload, 'error')) {
189
- return false;
190
- }
191
- // OpenAI Responses: requires_action (function_call output) is a meaningful response and must not be
192
- // treated as "empty". Some auto-followup servertools (for example stop_message_flow)
193
- // previously misclassified this as empty because there is no output_text/content yet.
194
- const requiredAction = payload.required_action;
195
- if (requiredAction && typeof requiredAction === 'object') {
196
- return false;
197
- }
198
- const outputForResponses = Array.isArray(payload.output) ? payload.output : [];
199
- if (outputForResponses.length > 0) {
200
- for (const item of outputForResponses) {
201
- if (!item || typeof item !== 'object' || Array.isArray(item))
202
- continue;
203
- const type = typeof item.type === 'string' ? String(item.type).trim().toLowerCase() : '';
204
- if (type === 'function_call' || type === 'tool_call' || type === 'tool_use' || type.includes('tool')) {
205
- return false;
206
- }
207
- }
208
- }
209
- const choices = Array.isArray(payload.choices) ? payload.choices : [];
210
- if (choices.length > 0) {
211
- const first = choices[0] && typeof choices[0] === 'object' && !Array.isArray(choices[0]) ? choices[0] : null;
212
- const message = first && typeof first.message === 'object' && first.message !== null && !Array.isArray(first.message)
213
- ? first.message
214
- : null;
215
- if (!message) {
216
- return true;
217
- }
218
- const toolCalls = Array.isArray(message.tool_calls) ? message.tool_calls : [];
219
- if (toolCalls.length > 0) {
220
- return false;
221
- }
222
- // Support common chat shapes: content string/array, reasoning_content, etc.
223
- if (hasNonEmptyText(message.content))
224
- return false;
225
- if (hasNonEmptyText(message.reasoning_content))
226
- return false;
227
- if (hasNonEmptyText(message.reasoning))
228
- return false;
229
- return true;
230
- }
231
- const output = Array.isArray(payload.output) ? payload.output : [];
232
- if (output.length > 0) {
233
- for (const item of output) {
234
- if (!item || typeof item !== 'object' || Array.isArray(item))
235
- continue;
236
- const content = item.content;
237
- if (hasNonEmptyText(content)) {
238
- return false;
239
- }
240
- if (hasNonEmptyText(item.text))
241
- return false;
242
- if (hasNonEmptyText(item.output_text))
243
- return false;
244
- }
245
- return true;
246
- }
247
- return true;
248
- }
249
- function createEmptyFollowupError(args) {
250
- const wrapped = new ProviderProtocolError(`[servertool] Followup returned empty response for flow ${args.flowId ?? 'unknown'}`, {
251
- code: 'SERVERTOOL_EMPTY_FOLLOWUP',
252
- category: 'EXTERNAL_ERROR',
253
- details: {
254
- flowId: args.flowId,
255
- requestId: args.requestId,
256
- error: args.lastError instanceof Error ? args.lastError.message : undefined,
257
- ...(args.originalResponseWasEmpty ? { originalResponseWasEmpty: true } : {})
258
- }
259
- });
260
- wrapped.status = 502;
261
- wrapped.cause = args.lastError;
262
- return wrapped;
263
- }
264
- function createFollowupContractError(args) {
265
- const wrapped = new ProviderProtocolError(`[servertool] Followup contract failed for flow ${args.flowId ?? 'unknown'}: ${args.reason}`, {
266
- code: 'SERVERTOOL_FOLLOWUP_FAILED',
267
- category: 'INTERNAL_ERROR',
268
- details: {
269
- flowId: args.flowId,
270
- requestId: args.requestId,
271
- reason: args.reason,
272
- ...(args.details ?? {})
273
- }
274
- });
275
- wrapped.status = 502;
276
- wrapped.cause = args.cause;
277
- return wrapped;
278
- }
279
- function isStopFinishReasonWithoutToolCalls(base) {
280
- return inspectStopGatewaySignal(base).eligible;
281
- }
282
- async function shouldDisableServerToolTimeoutForClockHold(args) {
283
- // Only relevant for stop/length responses: clock_auto may hold indefinitely.
284
- if (!isStopFinishReasonWithoutToolCalls(args.chat)) {
285
- return false;
286
- }
287
- const record = args.adapterContext;
288
- const rt = readRuntimeMetadata(record);
289
- const sessionId = resolveClockSessionScope(record, rt);
290
- if (!sessionId) {
291
- return false;
292
- }
293
- const clockConfig = resolveClockConfig(rt?.clock);
294
- if (!clockConfig) {
295
- return false;
296
- }
297
- // If already within due window, clock_auto won't need long hold.
298
- try {
299
- const tasks = await listClockTasks(sessionId, clockConfig);
300
- const at = Date.now();
301
- const nextDueAtMs = findNextUndeliveredDueAtMs(tasks, at);
302
- if (!nextDueAtMs) {
303
- return false;
304
- }
305
- const thresholdMs = nextDueAtMs - clockConfig.dueWindowMs;
306
- if (thresholdMs <= at) {
307
- return false;
308
- }
309
- // Only disable when the wait exceeds current timeout.
310
- if (args.serverToolTimeoutMs > 0 && thresholdMs - at <= args.serverToolTimeoutMs) {
311
- return false;
312
- }
313
- return true;
314
- }
315
- catch {
316
- return false;
317
- }
318
- }
319
- export async function runServerToolOrchestration(options) {
320
- const BLUE = '\x1b[38;5;39m';
321
- const YELLOW = '\x1b[38;5;214m';
322
- const GOLD = '\x1b[38;5;220m';
323
- const RESET = '\x1b[0m';
324
- const resolveToolName = (flowId) => {
325
- const normalized = flowId.trim();
326
- if (!normalized)
327
- return 'unknown';
328
- const mapping = {
329
- continue_execution_flow: 'continue_execution',
330
- review_flow: 'review',
331
- stop_message_flow: 'stop_message_auto',
332
- apply_patch_guard: 'apply_patch_guard',
333
- exec_command_guard: 'exec_command_guard',
334
- iflow_model_error_retry: 'iflow_model_error_retry',
335
- antigravity_thought_signature_bootstrap: 'antigravity_thought_signature_bootstrap',
336
- web_search_flow: 'web_search',
337
- vision_flow: 'vision_auto',
338
- clock_flow: 'clock',
339
- clock_hold_flow: 'clock_auto',
340
- recursive_detection_guard: 'recursive_detection_guard'
341
- };
342
- return mapping[normalized] ?? normalized;
343
- };
344
- const resolveStage = (step, message) => {
345
- const normalized = message.trim().toLowerCase();
346
- if (normalized === 'matched' || step <= 1)
347
- return 'match';
348
- if (normalized.startsWith('completed') || step >= 5)
349
- return 'final';
350
- return 'followup';
351
- };
352
- const normalizeResult = (message) => {
353
- const normalized = message.trim().toLowerCase();
354
- if (!normalized)
355
- return 'unknown';
356
- const group = /^completed\s*\(([^)]+)\)/.exec(normalized);
357
- if (group && group[1]) {
358
- return 'completed_' + group[1].trim().replace(/[^a-z0-9]+/g, '_');
359
- }
360
- return normalized.replace(/[^a-z0-9]+/g, '_').replace(/^_+|_+$/g, '') || 'unknown';
361
- };
362
- const logStopEntry = (stage, result, extra) => {
363
- const color = BLUE;
364
- const viewStage = stage === 'trigger' ? 'match' : 'entry';
365
- const source = typeof extra?.source === 'string' ? extra.source : 'unknown';
366
- const reason = typeof extra?.reason === 'string' ? extra.reason : 'unknown';
367
- const eligible = typeof extra?.eligible === 'boolean' ? String(extra.eligible) : 'unknown';
368
- const flowId = typeof extra?.flowId === 'string' ? extra.flowId : '';
369
- const brief = stage === 'entry'
370
- ? `source=${source} reason=${reason} eligible=${eligible}`
371
- : `result=${result} flow=${flowId || 'none'}`;
372
- try {
373
- // eslint-disable-next-line no-console
374
- console.log(`${color}[servertool][stop_watch] requestId=${options.requestId} stage=${viewStage} ${brief}${RESET}`);
375
- }
376
- catch {
377
- /* best-effort logging */
378
- }
379
- appendServerToolProgressFileEvent({
380
- requestId: options.requestId,
381
- flowId: 'stop_message_flow',
382
- tool: 'stop_message_auto',
383
- stage,
384
- result,
385
- message: result,
386
- step: stage === 'entry' ? 0 : 2,
387
- entryEndpoint: options.entryEndpoint,
388
- providerProtocol: options.providerProtocol
389
- });
390
- };
391
- const logProgress = (step, _total, message, extra) => {
392
- const flowId = typeof extra?.flowId === 'string' ? extra.flowId.trim() : '';
393
- const tool = resolveToolName(flowId);
394
- const stage = resolveStage(step, message);
395
- const result = normalizeResult(message);
396
- const color = flowId === 'continue_execution_flow' ? GOLD : YELLOW;
397
- try {
398
- // eslint-disable-next-line no-console
399
- console.log(`${color}[servertool] requestId=${options.requestId} tool=${tool} stage=${stage} result=${result}${RESET}`);
400
- }
401
- catch {
402
- /* best-effort logging */
403
- }
404
- appendServerToolProgressFileEvent({
405
- requestId: options.requestId,
406
- flowId: flowId || 'none',
407
- tool,
408
- stage,
409
- result,
410
- message,
411
- step,
412
- entryEndpoint: options.entryEndpoint,
413
- providerProtocol: options.providerProtocol
414
- });
415
- };
416
- const logAutoHookTrace = (event) => {
417
- const reasonToken = typeof event.reason === 'string' && event.reason.trim()
418
- ? event.reason.trim().toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/^_+|_+$/g, '')
419
- : 'unknown';
420
- appendServerToolProgressFileEvent({
421
- requestId: options.requestId,
422
- flowId: event.flowId || `hook:${event.hookId}`,
423
- tool: event.hookId,
424
- stage: 'hook',
425
- result: `${event.result}_${reasonToken || 'unknown'}`,
426
- message: `${event.result} (${event.reason}) queue=${event.queue}[${event.queueIndex}/${event.queueTotal}] phase=${event.phase} priority=${event.priority}`,
427
- step: 2,
428
- entryEndpoint: options.entryEndpoint,
429
- providerProtocol: options.providerProtocol
430
- });
431
- try {
432
- options.stageRecorder?.record('servertool.hook', {
433
- hookId: event.hookId,
434
- phase: event.phase,
435
- priority: event.priority,
436
- result: event.result,
437
- reason: event.reason,
438
- queue: event.queue,
439
- queueIndex: event.queueIndex,
440
- queueTotal: event.queueTotal,
441
- ...(event.flowId ? { flowId: event.flowId } : {})
442
- });
443
- }
444
- catch {
445
- // best-effort only
446
- }
447
- if (event.hookId === 'stop_message_auto' && event.result === 'miss') {
448
- const compareContext = readStopMessageCompareContext(options.adapterContext);
449
- const summary = formatStopMessageCompareContext(compareContext);
450
- try {
451
- // eslint-disable-next-line no-console
452
- console.log(`${BLUE}[servertool][stop_compare] requestId=${options.requestId} stage=miss flow=none ${summary}${RESET}`);
453
- }
454
- catch {
455
- // best-effort logging
456
- }
457
- const compareResult = compareContext
458
- ? `${compareContext.decision}_${compareContext.reason.toLowerCase().replace(/[^a-z0-9]+/g, '_') || 'unknown'}`
459
- : 'unknown_no_context';
460
- appendServerToolProgressFileEvent({
461
- requestId: options.requestId,
462
- flowId: 'none',
463
- tool: 'stop_message_auto',
464
- stage: 'compare',
465
- result: compareResult,
466
- message: summary,
467
- step: 2,
468
- entryEndpoint: options.entryEndpoint,
469
- providerProtocol: options.providerProtocol
470
- });
471
- }
472
- };
473
- const logStopCompare = (stage, flowId) => {
474
- const compareContext = readStopMessageCompareContext(options.adapterContext);
475
- const summary = formatStopMessageCompareContext(compareContext);
476
- const viewStage = stage === 'trigger' ? 'match' : 'entry';
477
- const flowToken = flowId && flowId.trim() ? flowId.trim() : 'none';
478
- try {
479
- // eslint-disable-next-line no-console
480
- console.log(`${BLUE}[servertool][stop_compare] requestId=${options.requestId} stage=${viewStage} flow=${flowToken} ${summary}${RESET}`);
481
- }
482
- catch {
483
- // best-effort logging
484
- }
485
- const compareResult = compareContext
486
- ? `${compareContext.decision}_${compareContext.reason.toLowerCase().replace(/[^a-z0-9]+/g, '_') || 'unknown'}`
487
- : 'unknown_no_context';
488
- appendServerToolProgressFileEvent({
489
- requestId: options.requestId,
490
- flowId: flowToken,
491
- tool: 'stop_message_auto',
492
- stage: 'compare',
493
- result: compareResult,
494
- message: summary,
495
- step: stage === 'entry' ? 1 : 3,
496
- entryEndpoint: options.entryEndpoint,
497
- providerProtocol: options.providerProtocol
498
- });
499
- try {
500
- options.stageRecorder?.record('servertool.stop_compare', {
501
- stage: viewStage,
502
- flowId: flowToken,
503
- summary,
504
- ...(compareContext ? { compare: compareContext } : {})
505
- });
506
- }
507
- catch {
508
- // best-effort only
509
- }
510
- };
511
- const stopSignal = inspectStopGatewaySignal(options.chat);
512
- attachStopGatewayContext(options.adapterContext, stopSignal);
513
- if (stopSignal.observed) {
514
- logStopEntry('entry', 'observed', {
515
- reason: stopSignal.reason,
516
- source: stopSignal.source,
517
- eligible: stopSignal.eligible,
518
- ...(typeof stopSignal.choiceIndex === 'number' ? { choiceIndex: stopSignal.choiceIndex } : {}),
519
- ...(typeof stopSignal.hasToolCalls === 'boolean' ? { hasToolCalls: stopSignal.hasToolCalls } : {})
520
- });
521
- }
522
- const serverToolTimeoutMs = resolveServerToolTimeoutMs();
523
- const shouldDisableTimeout = await shouldDisableServerToolTimeoutForClockHold({
524
- chat: options.chat,
525
- adapterContext: options.adapterContext,
526
- serverToolTimeoutMs
527
- });
528
- const effectiveServerToolTimeoutMs = shouldDisableTimeout ? 0 : serverToolTimeoutMs;
529
- const followupTimeoutMs = resolveServerToolFollowupTimeoutMs(serverToolTimeoutMs);
530
- const engineOptions = {
531
- chatResponse: options.chat,
532
- adapterContext: options.adapterContext,
533
- entryEndpoint: options.entryEndpoint,
534
- requestId: options.requestId,
535
- providerProtocol: options.providerProtocol,
536
- providerInvoker: options.providerInvoker,
537
- reenterPipeline: options.reenterPipeline,
538
- clientInjectDispatch: options.clientInjectDispatch,
539
- onAutoHookTrace: logAutoHookTrace
540
- };
541
- const runEngine = async (overrides) => withTimeout(runServerSideToolEngine({
542
- ...engineOptions,
543
- ...overrides
544
- }), effectiveServerToolTimeoutMs, () => createServerToolTimeoutError({
545
- requestId: options.requestId,
546
- phase: 'engine',
547
- timeoutMs: effectiveServerToolTimeoutMs || serverToolTimeoutMs
548
- }));
549
- // StopMessage owns a dedicated orchestration skeleton:
550
- // same trigger/processing semantics as before, but isolated from the generic servertool queue.
551
- let engineResult = await runEngine({
552
- disableToolCallHandlers: true,
553
- includeAutoHookIds: ['stop_message_auto']
554
- });
555
- if (engineResult.mode === 'passthrough' || !engineResult.execution) {
556
- engineResult = await runEngine({
557
- excludeAutoHookIds: ['stop_message_auto']
558
- });
559
- }
560
- if (engineResult.mode === 'passthrough' || !engineResult.execution) {
561
- const skipReason = engineResult.mode === 'passthrough' ? 'passthrough' : 'no_execution';
562
- if (stopSignal.observed) {
563
- logStopEntry('trigger', `skipped_${skipReason}`, {
564
- reason: stopSignal.reason,
565
- source: stopSignal.source,
566
- eligible: stopSignal.eligible
567
- });
568
- logStopCompare('trigger');
569
- }
570
- try {
571
- options.stageRecorder?.record('servertool.match', {
572
- matched: false,
573
- mode: engineResult.mode,
574
- reason: skipReason
575
- });
576
- }
577
- catch {
578
- // best-effort only
579
- }
580
- appendServerToolProgressFileEvent({
581
- requestId: options.requestId,
582
- flowId: 'none',
583
- tool: 'none',
584
- stage: 'match',
585
- result: 'skipped_' + skipReason,
586
- message: 'skipped (' + skipReason + ')',
587
- step: 0,
588
- entryEndpoint: options.entryEndpoint,
589
- providerProtocol: options.providerProtocol
590
- });
591
- return {
592
- chat: engineResult.finalChatResponse,
593
- executed: false
594
- };
595
- }
596
- const flowId = engineResult.execution.flowId ?? 'unknown';
597
- if (stopSignal.observed) {
598
- logStopEntry('trigger', flowId === 'stop_message_flow' ? 'activated' : 'non_stop_flow', {
599
- flowId,
600
- reason: stopSignal.reason,
601
- source: stopSignal.source,
602
- eligible: stopSignal.eligible
603
- });
604
- logStopCompare('trigger', flowId);
605
- }
606
- try {
607
- options.stageRecorder?.record('servertool.match', {
608
- matched: true,
609
- flowId,
610
- hasFollowup: Boolean(engineResult.execution.followup)
611
- });
612
- }
613
- catch {
614
- // best-effort only
615
- }
616
- const totalSteps = 5;
617
- logProgress(1, totalSteps, 'matched', { flowId });
618
- // Mixed tools: persist servertool outputs for next request, but return remaining tool_calls to client.
619
- if (engineResult.pendingInjection) {
620
- const sessionId = engineResult.pendingInjection.sessionId;
621
- if (sessionId && sessionId.trim()) {
622
- try {
623
- await savePendingServerToolInjection(sessionId.trim(), {
624
- createdAtMs: Date.now(),
625
- afterToolCallIds: engineResult.pendingInjection.afterToolCallIds,
626
- messages: engineResult.pendingInjection.messages,
627
- sourceRequestId: options.requestId
628
- });
629
- }
630
- catch (error) {
631
- throw createFollowupContractError({
632
- flowId: engineResult.execution.flowId,
633
- requestId: options.requestId,
634
- reason: 'pending_injection_persist_failed',
635
- cause: error,
636
- details: {
637
- sessionId: sessionId.trim(),
638
- error: error instanceof Error ? error.message : String(error ?? 'unknown')
639
- }
640
- });
641
- }
642
- }
643
- else {
644
- throw createFollowupContractError({
645
- flowId: engineResult.execution.flowId,
646
- requestId: options.requestId,
647
- reason: 'pending_injection_missing_session_id'
648
- });
649
- }
650
- logProgress(5, totalSteps, 'completed (mixed tools; no reenter)', { flowId });
651
- return {
652
- chat: engineResult.finalChatResponse,
653
- executed: true,
654
- flowId: engineResult.execution.flowId
655
- };
656
- }
657
- if (!engineResult.execution.followup) {
658
- logProgress(5, totalSteps, 'completed (no followup)', { flowId });
659
- return {
660
- chat: engineResult.finalChatResponse,
661
- executed: true,
662
- flowId: engineResult.execution.flowId
663
- };
664
- }
665
- const isStopMessageFlow = engineResult.execution.flowId === 'stop_message_flow';
666
- const isClockHoldFlow = engineResult.execution.flowId === 'clock_hold_flow';
667
- const isContinueExecutionFlow = engineResult.execution.flowId === 'continue_execution_flow';
668
- const isReviewFlow = engineResult.execution.flowId === 'review_flow';
669
- const isApplyPatchGuard = engineResult.execution.flowId === 'apply_patch_guard';
670
- const isExecCommandGuard = engineResult.execution.flowId === 'exec_command_guard';
671
- const isErrorAutoFlow = engineResult.execution.flowId === 'iflow_model_error_retry';
672
- const applyAutoLimit = isErrorAutoFlow || isApplyPatchGuard || isExecCommandGuard;
673
- // ServerTool followups must not inherit or inject any routeHint; always route fresh.
674
- const preserveRouteHint = false;
675
- const followupPlan = engineResult.execution.followup;
676
- const followupEntryEndpoint = ('entryEndpoint' in engineResult.execution.followup
677
- ? engineResult.execution.followup.entryEndpoint
678
- : undefined) ||
679
- options.entryEndpoint ||
680
- '/v1/chat/completions';
681
- const hasPayloadField = Boolean(followupPlan && typeof followupPlan === 'object' && !Array.isArray(followupPlan)) &&
682
- Object.prototype.hasOwnProperty.call(followupPlan, 'payload');
683
- const hasInjectionField = Boolean(followupPlan && typeof followupPlan === 'object' && !Array.isArray(followupPlan)) &&
684
- Object.prototype.hasOwnProperty.call(followupPlan, 'injection');
685
- const hasMetadataField = Boolean(followupPlan && typeof followupPlan === 'object' && !Array.isArray(followupPlan)) &&
686
- Object.prototype.hasOwnProperty.call(followupPlan, 'metadata');
687
- const followupPayloadExpected = hasPayloadField || hasInjectionField;
688
- const followupPayloadRaw = (() => {
689
- if (followupPlan &&
690
- typeof followupPlan === 'object' &&
691
- !Array.isArray(followupPlan) &&
692
- hasPayloadField) {
693
- const candidate = followupPlan.payload;
694
- return candidate && typeof candidate === 'object' && !Array.isArray(candidate) ? candidate : null;
695
- }
696
- if (followupPlan &&
697
- typeof followupPlan === 'object' &&
698
- !Array.isArray(followupPlan) &&
699
- hasInjectionField) {
700
- const injection = followupPlan.injection;
701
- if (!injection || typeof injection !== 'object' || Array.isArray(injection)) {
702
- return null;
703
- }
704
- return buildServerToolFollowupChatPayloadFromInjection({
705
- adapterContext: options.adapterContext,
706
- chatResponse: engineResult.finalChatResponse,
707
- injection: injection
708
- });
709
- }
710
- return null;
711
- })();
712
- const metadataOnlyFollowup = !followupPayloadRaw &&
713
- hasMetadataField;
714
- if (followupPayloadExpected && !followupPayloadRaw) {
715
- throw createFollowupContractError({
716
- flowId: engineResult.execution.flowId,
717
- requestId: options.requestId,
718
- reason: 'missing_followup_payload',
719
- details: {
720
- entryEndpoint: followupEntryEndpoint,
721
- hasPayloadField,
722
- hasInjectionField,
723
- hasMetadataField
724
- }
725
- });
726
- }
727
- if (!followupPayloadRaw && !metadataOnlyFollowup) {
728
- throw createFollowupContractError({
729
- flowId: engineResult.execution.flowId,
730
- requestId: options.requestId,
731
- reason: 'missing_followup_contract',
732
- details: {
733
- entryEndpoint: followupEntryEndpoint
734
- }
735
- });
736
- }
737
- const loopPayload = followupPayloadRaw ||
738
- (engineResult.execution.flowId === 'stop_message_flow'
739
- ? buildStopMessageLoopPayload(options.adapterContext)
740
- : null);
741
- const loopState = loopPayload
742
- ? buildServerToolLoopState(options.adapterContext, engineResult.execution.flowId, loopPayload, engineResult.finalChatResponse)
743
- : null;
744
- const stopMessageReservation = null;
745
- if (applyAutoLimit && loopState && typeof loopState.repeatCount === 'number' && loopState.repeatCount >= 3) {
746
- logProgress(5, totalSteps, 'completed (auto limit hit)', { flowId });
747
- return {
748
- chat: engineResult.finalChatResponse,
749
- executed: true,
750
- flowId: engineResult.execution.flowId
751
- };
752
- }
753
- let shouldInjectStopLoopWarning = false;
754
- if (isStopMessageFlow && loopState) {
755
- const elapsedMs = typeof loopState.startedAtMs === 'number' && Number.isFinite(loopState.startedAtMs)
756
- ? Math.max(0, Date.now() - loopState.startedAtMs)
757
- : 0;
758
- if (elapsedMs >= STOP_MESSAGE_STAGE_TIMEOUT_MS) {
759
- throw createStopMessageFetchFailedError({
760
- requestId: options.requestId,
761
- reason: 'stage_timeout',
762
- elapsedMs,
763
- timeoutMs: STOP_MESSAGE_STAGE_TIMEOUT_MS
764
- });
765
- }
766
- const pairRepeatCount = typeof loopState.stopPairRepeatCount === 'number' && Number.isFinite(loopState.stopPairRepeatCount)
767
- ? Math.max(0, Math.floor(loopState.stopPairRepeatCount))
768
- : 0;
769
- if (pairRepeatCount >= STOP_MESSAGE_LOOP_FAIL_THRESHOLD) {
770
- throw createStopMessageFetchFailedError({
771
- requestId: options.requestId,
772
- reason: 'loop_limit',
773
- elapsedMs,
774
- repeatCount: pairRepeatCount
775
- });
776
- }
777
- if (pairRepeatCount >= STOP_MESSAGE_LOOP_WARN_THRESHOLD && !loopState.stopPairWarned) {
778
- loopState.stopPairWarned = true;
779
- shouldInjectStopLoopWarning = true;
780
- logProgress(2, totalSteps, 'loop warning armed', { flowId });
781
- }
782
- }
783
- if (isAdapterClientDisconnected(options.adapterContext)) {
784
- logProgress(5, totalSteps, 'completed (client disconnected)', { flowId });
785
- return {
786
- chat: engineResult.finalChatResponse,
787
- executed: true,
788
- flowId: engineResult.execution.flowId
789
- };
790
- }
791
- const metadata = {
792
- stream: false,
793
- ...(engineResult.execution.followup.metadata ?? {})
794
- };
795
- const rt = ensureRuntimeMetadata(metadata);
796
- rt.serverToolFollowup = true;
797
- if (loopState) {
798
- rt.serverToolLoopState = loopState;
799
- }
800
- // Followup re-enters HubPipeline at chat-process entry with a canonical "chat-like" body.
801
- // This avoids re-running per-protocol inbound parse/semantic-map for each client protocol.
802
- metadata.__hubEntry = 'chat_process';
803
- // Enforce unified followup contract:
804
- // - clear any inherited routeHint
805
- // - do not inherit sticky target
806
- // - record original entry endpoint for downstream formatting/debug
807
- rt.preserveRouteHint = preserveRouteHint;
808
- rt.disableStickyRoutes = true;
809
- rt.serverToolOriginalEntryEndpoint =
810
- (typeof options.entryEndpoint === 'string' && options.entryEndpoint.trim().length
811
- ? options.entryEndpoint
812
- : followupEntryEndpoint);
813
- // For stateful auto-followups (e.g. stop_message_flow / clock_hold_flow / continue_execution_flow),
814
- // keep the same providerKey/alias.
815
- // Otherwise the followup requestId suffix would cause round-robin alias switching and compatibility drift.
816
- if (isStopMessageFlow || isClockHoldFlow || isContinueExecutionFlow || isReviewFlow) {
817
- const providerKeyRaw = options.adapterContext.providerKey;
818
- const providerKey = typeof providerKeyRaw === 'string' && providerKeyRaw.trim().length ? providerKeyRaw.trim() : '';
819
- if (providerKey) {
820
- metadata.__shadowCompareForcedProviderKey = providerKey;
821
- }
822
- }
823
- const retryEmptyFollowupOnce = true;
824
- const maxAttempts = retryEmptyFollowupOnce ? 2 : 1;
825
- const followupRequestId = buildFollowupRequestId(options.requestId, engineResult.execution.followup.requestIdSuffix);
826
- const clientInjectOnlyRaw = metadata.clientInjectOnly;
827
- const clientInjectOnly = clientInjectOnlyRaw === true ||
828
- (typeof clientInjectOnlyRaw === 'string' && clientInjectOnlyRaw.trim().toLowerCase() === 'true');
829
- if (clientInjectOnly) {
830
- if (!options.clientInjectDispatch) {
831
- const wrapped = new ProviderProtocolError('[servertool] client inject dispatcher unavailable', {
832
- code: 'SERVERTOOL_FOLLOWUP_FAILED',
833
- category: 'INTERNAL_ERROR',
834
- details: {
835
- flowId: engineResult.execution.flowId,
836
- requestId: options.requestId,
837
- upstreamCode: 'client_inject_failed',
838
- reason: 'client_inject_dispatcher_unavailable'
839
- }
840
- });
841
- wrapped.status = 502;
842
- throw wrapped;
843
- }
844
- const disconnectWatcher = createClientDisconnectWatcher({
845
- adapterContext: options.adapterContext,
846
- requestId: options.requestId,
847
- flowId: engineResult.execution.flowId
848
- });
849
- try {
850
- const injectFollowupBody = isStopMessageFlow
851
- ? {}
852
- : (followupPayloadRaw && typeof followupPayloadRaw === 'object' && !Array.isArray(followupPayloadRaw)
853
- ? coerceFollowupPayloadStream(followupPayloadRaw, metadata.stream === true)
854
- : {});
855
- if (isStopMessageFlow && shouldInjectStopLoopWarning && loopState) {
856
- injectFollowupBody.messages = [];
857
- appendStopMessageLoopWarning(injectFollowupBody, loopState.stopPairRepeatCount ?? STOP_MESSAGE_LOOP_WARN_THRESHOLD);
858
- }
859
- const dispatchResult = await withTimeout(Promise.race([
860
- options.clientInjectDispatch({
861
- entryEndpoint: followupEntryEndpoint,
862
- requestId: followupRequestId,
863
- body: injectFollowupBody,
864
- metadata
865
- }),
866
- disconnectWatcher.promise
867
- ]), followupTimeoutMs, () => createServerToolTimeoutError({
868
- requestId: options.requestId,
869
- phase: 'followup',
870
- timeoutMs: followupTimeoutMs,
871
- flowId: engineResult.execution.flowId
872
- }));
873
- if (!dispatchResult || dispatchResult.ok !== true) {
874
- const wrapped = new ProviderProtocolError('[servertool.inject] client injection failed', {
875
- code: 'SERVERTOOL_FOLLOWUP_FAILED',
876
- details: {
877
- flowId: engineResult.execution.flowId,
878
- requestId: options.requestId,
879
- upstreamCode: 'client_inject_failed',
880
- reason: dispatchResult && typeof dispatchResult.reason === 'string' && dispatchResult.reason.trim()
881
- ? dispatchResult.reason.trim()
882
- : 'client_inject_not_handled'
883
- }
884
- });
885
- wrapped.status = 502;
886
- throw wrapped;
887
- }
888
- disconnectWatcher.cancel();
889
- const decorated = decorateFinalChatWithServerToolContext(engineResult.finalChatResponse, engineResult.execution);
890
- logProgress(5, totalSteps, 'completed (client inject only)', { flowId });
891
- return {
892
- chat: decorated,
893
- executed: true,
894
- flowId: engineResult.execution.flowId
895
- };
896
- }
897
- catch (error) {
898
- disconnectWatcher.cancel();
899
- if (isServerToolClientDisconnectedError(error) || isAdapterClientDisconnected(options.adapterContext)) {
900
- logProgress(5, totalSteps, 'completed (client disconnected)', { flowId });
901
- return {
902
- chat: engineResult.finalChatResponse,
903
- executed: true,
904
- flowId: engineResult.execution.flowId
905
- };
906
- }
907
- if (isStopMessageFlow) {
908
- disableStopMessageAfterFailedFollowup(options.adapterContext, stopMessageReservation);
909
- logProgress(5, totalSteps, 'failed (stopMessage client inject failed; state cleared)', { flowId });
910
- throw error;
911
- }
912
- throw error;
913
- }
914
- }
915
- if (!options.reenterPipeline) {
916
- const wrapped = new ProviderProtocolError('[servertool] followup requires reenter pipeline', {
917
- code: 'SERVERTOOL_FOLLOWUP_FAILED',
918
- category: 'INTERNAL_ERROR',
919
- details: {
920
- flowId: engineResult.execution.flowId,
921
- requestId: options.requestId,
922
- reason: 'reenter_pipeline_unavailable'
923
- }
924
- });
925
- wrapped.status = 502;
926
- throw wrapped;
927
- }
928
- if (!followupPayloadRaw) {
929
- throw createFollowupContractError({
930
- flowId: engineResult.execution.flowId,
931
- requestId: options.requestId,
932
- reason: 'metadata_only_followup_without_payload'
933
- });
934
- }
935
- // Build followup payload for non-client-inject flows
936
- let followupPayload = coerceFollowupPayloadStream(followupPayloadRaw, metadata.stream === true);
937
- if (shouldInjectStopLoopWarning && loopState) {
938
- appendStopMessageLoopWarning(followupPayload, loopState.stopPairRepeatCount ?? STOP_MESSAGE_LOOP_WARN_THRESHOLD);
939
- }
940
- followupPayload = applyHubFollowupPolicyShadow({
941
- requestId: followupRequestId,
942
- entryEndpoint: followupEntryEndpoint,
943
- flowId: engineResult.execution.flowId,
944
- payload: followupPayload,
945
- stageRecorder: options.stageRecorder
946
- });
947
- let followup;
948
- let lastError;
949
- // stopMessage 是一种“状态型” servertool:一旦触发,我们需要尽量避免因 followup 失败而把状态留在可继续触发的位置,
950
- // 否则会出现下一轮仍然自动触发 → 再次失败 → 客户端永远 502 的死循环。
951
- //
952
- // stop_message_flow 的计数器递增由 handler 在决定触发时处理,engine 不再提前递增。
953
- for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
954
- const elapsedBeforeAttempt = isStopMessageFlow && loopState && typeof loopState.startedAtMs === 'number' && Number.isFinite(loopState.startedAtMs)
955
- ? Math.max(0, Date.now() - loopState.startedAtMs)
956
- : 0;
957
- if (isStopMessageFlow && elapsedBeforeAttempt >= STOP_MESSAGE_STAGE_TIMEOUT_MS) {
958
- throw createStopMessageFetchFailedError({
959
- requestId: options.requestId,
960
- reason: 'stage_timeout',
961
- elapsedMs: elapsedBeforeAttempt,
962
- timeoutMs: STOP_MESSAGE_STAGE_TIMEOUT_MS,
963
- attempt,
964
- maxAttempts
965
- });
966
- }
967
- const attemptTimeoutMs = isStopMessageFlow && STOP_MESSAGE_STAGE_TIMEOUT_MS > elapsedBeforeAttempt
968
- ? Math.max(1, Math.min(followupTimeoutMs, STOP_MESSAGE_STAGE_TIMEOUT_MS - elapsedBeforeAttempt))
969
- : followupTimeoutMs;
970
- const disconnectWatcher = createClientDisconnectWatcher({
971
- adapterContext: options.adapterContext,
972
- requestId: options.requestId,
973
- flowId: engineResult.execution.flowId
974
- });
975
- try {
976
- const followupPromise = options.reenterPipeline({
977
- entryEndpoint: followupEntryEndpoint,
978
- requestId: followupRequestId,
979
- body: followupPayload,
980
- metadata
981
- });
982
- followup = await withTimeout(Promise.race([followupPromise, disconnectWatcher.promise]), attemptTimeoutMs, () => isStopMessageFlow
983
- ? createStopMessageFetchFailedError({
984
- requestId: options.requestId,
985
- reason: 'stage_timeout',
986
- elapsedMs: elapsedBeforeAttempt,
987
- timeoutMs: STOP_MESSAGE_STAGE_TIMEOUT_MS,
988
- attempt,
989
- maxAttempts
990
- })
991
- : createServerToolTimeoutError({
992
- requestId: options.requestId,
993
- phase: 'followup',
994
- timeoutMs: attemptTimeoutMs,
995
- flowId: engineResult.execution.flowId,
996
- attempt,
997
- maxAttempts
998
- }));
999
- disconnectWatcher.cancel();
1000
- if (retryEmptyFollowupOnce) {
1001
- const body = followup && followup.body && typeof followup.body === 'object'
1002
- ? followup.body
1003
- : undefined;
1004
- if (!body || isEmptyClientResponsePayload(body)) {
1005
- followup = undefined;
1006
- lastError = new Error('SERVERTOOL_EMPTY_FOLLOWUP');
1007
- if (attempt < maxAttempts) {
1008
- continue;
1009
- }
1010
- }
1011
- }
1012
- lastError = undefined;
1013
- break;
1014
- }
1015
- catch (error) {
1016
- disconnectWatcher.cancel();
1017
- if (isServerToolClientDisconnectedError(error) || isAdapterClientDisconnected(options.adapterContext)) {
1018
- logProgress(5, totalSteps, 'completed (client disconnected)', { flowId, attempt });
1019
- return {
1020
- chat: engineResult.finalChatResponse,
1021
- executed: true,
1022
- flowId: engineResult.execution.flowId
1023
- };
1024
- }
1025
- if (isServerToolTimeoutError(error)) {
1026
- throw error;
1027
- }
1028
- lastError = error;
1029
- if (attempt >= maxAttempts) {
1030
- if (isStopMessageFlow) {
1031
- disableStopMessageAfterFailedFollowup(options.adapterContext, stopMessageReservation);
1032
- logProgress(5, totalSteps, 'failed (stopMessage followup failed; state cleared)', { flowId, attempt });
1033
- throw error;
1034
- }
1035
- const wrapped = new ProviderProtocolError(`[servertool] Followup failed for flow ${engineResult.execution.flowId ?? 'unknown'} ` +
1036
- `(attempt ${attempt}/${maxAttempts})`, {
1037
- code: 'SERVERTOOL_FOLLOWUP_FAILED',
1038
- details: {
1039
- flowId: engineResult.execution.flowId,
1040
- requestId: options.requestId,
1041
- attempt,
1042
- maxAttempts,
1043
- error: error instanceof Error ? error.message : String(error ?? 'unknown')
1044
- }
1045
- });
1046
- wrapped.cause = error;
1047
- throw wrapped;
1048
- }
1049
- }
1050
- }
1051
- const followupBody = followup && followup.body && typeof followup.body === 'object'
1052
- ? followup.body
1053
- : undefined;
1054
- if (retryEmptyFollowupOnce && (!followupBody || isEmptyClientResponsePayload(followupBody))) {
1055
- if (isStopMessageFlow) {
1056
- disableStopMessageAfterFailedFollowup(options.adapterContext, stopMessageReservation);
1057
- logProgress(5, totalSteps, 'failed (stopMessage followup empty; state cleared)', { flowId });
1058
- throw createEmptyFollowupError({
1059
- flowId: engineResult.execution.flowId,
1060
- requestId: options.requestId,
1061
- lastError,
1062
- originalResponseWasEmpty: true
1063
- });
1064
- }
1065
- throw createEmptyFollowupError({
1066
- flowId: engineResult.execution.flowId,
1067
- requestId: options.requestId,
1068
- lastError
1069
- });
1070
- }
1071
- // Special case: Antigravity thoughtSignature bootstrap flow.
1072
- // - First followup performs a minimal preflight (forces clock.get) to obtain a fresh signature.
1073
- // - If preflight succeeds, immediately replay the original captured request as a second internal hop,
1074
- // so the client sees a single recovered response (transparent).
1075
- if (engineResult.execution.flowId === 'antigravity_thought_signature_bootstrap' && options.reenterPipeline) {
1076
- const preflight = followupBody;
1077
- const preflightError = preflight && typeof preflight.error === 'object' ? preflight.error : null;
1078
- const preflightStatus = (() => {
1079
- if (!preflightError || typeof preflightError !== 'object' || Array.isArray(preflightError))
1080
- return undefined;
1081
- const statusRaw = preflightError.status ?? preflightError.statusCode;
1082
- if (typeof statusRaw === 'number' && Number.isFinite(statusRaw))
1083
- return Math.floor(statusRaw);
1084
- const codeRaw = preflightError.code;
1085
- const code = typeof codeRaw === 'string' ? codeRaw.trim() : typeof codeRaw === 'number' ? String(codeRaw) : '';
1086
- if (code && /^HTTP_\d{3}$/i.test(code))
1087
- return Number(code.split('_')[1]);
1088
- if (code && /^\d{3}$/.test(code))
1089
- return Number(code);
1090
- return undefined;
1091
- })();
1092
- // One-shot guard: bootstrap preflight must surface as a real failure, otherwise the client only sees
1093
- // the synthetic servertool wrapper response and loses the upstream error.
1094
- if (preflightError && (preflightStatus === 429 || preflightStatus === 400)) {
1095
- throw createFollowupContractError({
1096
- flowId: engineResult.execution.flowId,
1097
- requestId: options.requestId,
1098
- reason: 'bootstrap_preflight_failed',
1099
- details: {
1100
- preflightStatus,
1101
- error: typeof preflightError.message === 'string'
1102
- ? String(preflightError.message)
1103
- : undefined
1104
- }
1105
- });
1106
- }
1107
- const replaySeed = extractCapturedChatSeed(options.adapterContext?.capturedChatRequest);
1108
- if (replaySeed) {
1109
- const replayPayload = {
1110
- ...(replaySeed.model ? { model: replaySeed.model } : {}),
1111
- messages: Array.isArray(replaySeed.messages) ? replaySeed.messages : [],
1112
- ...(Array.isArray(replaySeed.tools) ? { tools: replaySeed.tools } : {}),
1113
- ...(replaySeed.parameters && typeof replaySeed.parameters === 'object' && !Array.isArray(replaySeed.parameters)
1114
- ? { parameters: replaySeed.parameters }
1115
- : {})
1116
- };
1117
- const replayLoopState = buildServerToolLoopState(options.adapterContext, engineResult.execution.flowId, replayPayload);
1118
- const replayMetadata = { stream: false };
1119
- const replayRt = ensureRuntimeMetadata(replayMetadata);
1120
- replayRt.serverToolFollowup = true;
1121
- if (replayLoopState) {
1122
- replayRt.serverToolLoopState = replayLoopState;
1123
- }
1124
- replayMetadata.__hubEntry = 'chat_process';
1125
- replayRt.preserveRouteHint = false;
1126
- replayRt.disableStickyRoutes = true;
1127
- replayRt.serverToolOriginalEntryEndpoint =
1128
- (typeof options.entryEndpoint === 'string' && options.entryEndpoint.trim().length
1129
- ? options.entryEndpoint
1130
- : followupEntryEndpoint);
1131
- const forcedProviderKeyRaw = options.adapterContext?.providerKey;
1132
- const forcedProviderKey = typeof forcedProviderKeyRaw === 'string' && forcedProviderKeyRaw.trim().length ? forcedProviderKeyRaw.trim() : '';
1133
- if (forcedProviderKey) {
1134
- replayMetadata.__shadowCompareForcedProviderKey = forcedProviderKey;
1135
- }
1136
- const replayRequestId = buildFollowupRequestId(options.requestId, ':antigravity_ts_replay');
1137
- const replayPayloadFinal = applyHubFollowupPolicyShadow({
1138
- requestId: replayRequestId,
1139
- entryEndpoint: followupEntryEndpoint,
1140
- flowId: engineResult.execution.flowId,
1141
- payload: coerceFollowupPayloadStream(replayPayload, false),
1142
- stageRecorder: options.stageRecorder
1143
- });
1144
- const replayResult = await withTimeout(options.reenterPipeline({
1145
- entryEndpoint: followupEntryEndpoint,
1146
- requestId: replayRequestId,
1147
- body: replayPayloadFinal,
1148
- metadata: replayMetadata
1149
- }), followupTimeoutMs, () => createServerToolTimeoutError({
1150
- requestId: options.requestId,
1151
- phase: 'followup',
1152
- timeoutMs: followupTimeoutMs,
1153
- flowId: engineResult.execution.flowId
1154
- }));
1155
- const replayBody = replayResult && replayResult.body && typeof replayResult.body === 'object'
1156
- ? replayResult.body
1157
- : undefined;
1158
- const decorated = decorateFinalChatWithServerToolContext(replayBody ?? preflight ?? engineResult.finalChatResponse, engineResult.execution);
1159
- logProgress(5, totalSteps, 'completed (bootstrap replay)', { flowId });
1160
- return { chat: decorated, executed: true, flowId: engineResult.execution.flowId };
1161
- }
1162
- }
1163
- const decorated = decorateFinalChatWithServerToolContext(followupBody ?? engineResult.finalChatResponse, engineResult.execution);
1164
- logProgress(5, totalSteps, 'completed', { flowId });
1165
- return {
1166
- chat: decorated,
1167
- executed: true,
1168
- flowId: engineResult.execution.flowId
1169
- };
1170
- }
1171
- function disableStopMessageAfterFailedFollowup(adapterContext, reservation) {
1172
- try {
1173
- const key = reservation && typeof reservation.stickyKey === 'string' && reservation.stickyKey.trim()
1174
- ? reservation.stickyKey.trim()
1175
- : resolveStickyKeyFromAdapterContext(adapterContext);
1176
- if (!key) {
1177
- return;
1178
- }
1179
- const state = loadRoutingInstructionStateSync(key);
1180
- if (!state) {
1181
- return;
1182
- }
1183
- const now = Date.now();
1184
- state.stopMessageText = undefined;
1185
- state.stopMessageMaxRepeats = undefined;
1186
- state.stopMessageUsed = undefined;
1187
- state.stopMessageSource = undefined;
1188
- state.stopMessageUpdatedAt = now;
1189
- state.stopMessageLastUsedAt = now;
1190
- state.stopMessageAiSeedPrompt = undefined;
1191
- state.stopMessageAiHistory = undefined;
1192
- saveRoutingInstructionStateSync(key, state);
1193
- }
1194
- catch {
1195
- // best-effort: do not crash the request due to state cleanup failures
1196
- }
1197
- }
1198
- function resolveStickyKeyFromAdapterContext(adapterContext) {
1199
- if (!adapterContext || typeof adapterContext !== 'object') {
1200
- return undefined;
1201
- }
1202
- const record = adapterContext;
1203
- const runtime = readRuntimeMetadata(record);
1204
- const explicitScope = readTextFromAny(runtime?.stopMessageClientInjectSessionScope) ||
1205
- readTextFromAny(runtime?.stopMessageClientInjectScope) ||
1206
- readTextFromAny(record.stopMessageClientInjectSessionScope) ||
1207
- readTextFromAny(record.stopMessageClientInjectScope);
1208
- if (explicitScope &&
1209
- (explicitScope.startsWith('tmux:') || explicitScope.startsWith('session:') || explicitScope.startsWith('conversation:'))) {
1210
- return explicitScope;
1211
- }
1212
- const metadata = asRecord(record.metadata);
1213
- const tmuxSessionId = readTextFromAny(record.clientTmuxSessionId) ||
1214
- readTextFromAny(record.client_tmux_session_id) ||
1215
- readTextFromAny(record.tmuxSessionId) ||
1216
- readTextFromAny(record.tmux_session_id) ||
1217
- readTextFromAny(runtime?.clientTmuxSessionId) ||
1218
- readTextFromAny(runtime?.client_tmux_session_id) ||
1219
- readTextFromAny(runtime?.tmuxSessionId) ||
1220
- readTextFromAny(runtime?.tmux_session_id) ||
1221
- readTextFromAny(metadata?.clientTmuxSessionId) ||
1222
- readTextFromAny(metadata?.client_tmux_session_id) ||
1223
- readTextFromAny(metadata?.tmuxSessionId) ||
1224
- readTextFromAny(metadata?.tmux_session_id);
1225
- if (!tmuxSessionId) {
1226
- const sessionId = readTextFromAny(record.sessionId) ||
1227
- readTextFromAny(record.session_id) ||
1228
- readTextFromAny(runtime?.sessionId) ||
1229
- readTextFromAny(runtime?.session_id) ||
1230
- readTextFromAny(metadata?.sessionId) ||
1231
- readTextFromAny(metadata?.session_id);
1232
- if (sessionId) {
1233
- return `session:${sessionId}`;
1234
- }
1235
- const conversationId = readTextFromAny(record.conversationId) ||
1236
- readTextFromAny(record.conversation_id) ||
1237
- readTextFromAny(runtime?.conversationId) ||
1238
- readTextFromAny(runtime?.conversation_id) ||
1239
- readTextFromAny(metadata?.conversationId) ||
1240
- readTextFromAny(metadata?.conversation_id);
1241
- if (conversationId) {
1242
- return `conversation:${conversationId}`;
1243
- }
1244
- return undefined;
1245
- }
1246
- return `tmux:${tmuxSessionId}`;
1247
- }
1248
- function asRecord(value) {
1249
- if (!value || typeof value !== 'object' || Array.isArray(value)) {
1250
- return null;
1251
- }
1252
- return value;
1253
- }
1254
- function readTextFromAny(value) {
1255
- return typeof value === 'string' && value.trim().length ? value.trim() : '';
1256
- }
1257
- function cloneRoutingInstructionState(state) {
1258
- if (!state) {
1259
- return null;
1260
- }
1261
- try {
1262
- const serialized = serializeRoutingInstructionState(state);
1263
- return deserializeRoutingInstructionState(serialized);
1264
- }
1265
- catch {
1266
- return null;
1267
- }
1268
- }
1269
- function resolveStopMessageSnapshot(raw) {
1270
- if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
1271
- return null;
1272
- }
1273
- const record = raw;
1274
- const text = typeof record.stopMessageText === 'string' ? record.stopMessageText.trim() : '';
1275
- const maxRepeats = typeof record.stopMessageMaxRepeats === 'number' && Number.isFinite(record.stopMessageMaxRepeats)
1276
- ? Math.max(1, Math.floor(record.stopMessageMaxRepeats))
1277
- : 0;
1278
- if (!text || maxRepeats <= 0) {
1279
- return null;
1280
- }
1281
- const used = typeof record.stopMessageUsed === 'number' && Number.isFinite(record.stopMessageUsed)
1282
- ? Math.max(0, Math.floor(record.stopMessageUsed))
1283
- : 0;
1284
- const updatedAt = typeof record.stopMessageUpdatedAt === 'number' && Number.isFinite(record.stopMessageUpdatedAt)
1285
- ? record.stopMessageUpdatedAt
1286
- : undefined;
1287
- const lastUsedAt = typeof record.stopMessageLastUsedAt === 'number' && Number.isFinite(record.stopMessageLastUsedAt)
1288
- ? record.stopMessageLastUsedAt
1289
- : undefined;
1290
- const source = typeof record.stopMessageSource === 'string' &&
1291
- record.stopMessageSource.trim()
1292
- ? record.stopMessageSource.trim()
1293
- : undefined;
1294
- return {
1295
- text,
1296
- maxRepeats,
1297
- used,
1298
- ...(source ? { source } : {}),
1299
- ...(updatedAt ? { updatedAt } : {}),
1300
- ...(lastUsedAt ? { lastUsedAt } : {})
1301
- };
1302
- }
1303
- function createStopMessageState(snapshot) {
1304
- return {
1305
- forcedTarget: undefined,
1306
- stickyTarget: undefined,
1307
- allowedProviders: new Set(),
1308
- disabledProviders: new Set(),
1309
- disabledKeys: new Map(),
1310
- disabledModels: new Map(),
1311
- stopMessageSource: snapshot.source && snapshot.source.trim() ? snapshot.source.trim() : 'explicit',
1312
- stopMessageText: snapshot.text,
1313
- stopMessageMaxRepeats: snapshot.maxRepeats,
1314
- stopMessageUsed: snapshot.used,
1315
- stopMessageUpdatedAt: snapshot.updatedAt,
1316
- stopMessageLastUsedAt: snapshot.lastUsedAt
1317
- };
1318
- }
1319
- function decorateFinalChatWithServerToolContext(chat, execution) {
1320
- if (!execution || !execution.context) {
1321
- return chat;
1322
- }
1323
- // Handle continue_execution_flow: append visible summary to client response
1324
- if (execution.flowId === 'continue_execution_flow') {
1325
- const ctx = execution.context;
1326
- const ce = ctx.continue_execution;
1327
- const visibleSummary = ce && typeof ce.visibleSummary === 'string' && ce.visibleSummary.trim().length
1328
- ? ce.visibleSummary.trim()
1329
- : '';
1330
- if (!visibleSummary) {
1331
- return chat;
1332
- }
1333
- const cloned = JSON.parse(JSON.stringify(chat));
1334
- const choices = Array.isArray(cloned.choices) ? cloned.choices : [];
1335
- if (!choices.length) {
1336
- return cloned;
1337
- }
1338
- const first = choices[0] && typeof choices[0] === 'object' ? choices[0] : null;
1339
- if (!first || !first.message || typeof first.message !== 'object') {
1340
- return cloned;
1341
- }
1342
- const message = first.message;
1343
- const baseContent = typeof message.content === 'string' ? message.content : '';
1344
- // Prepend visible summary to the content
1345
- message.content =
1346
- baseContent && baseContent.trim().length
1347
- ? `${visibleSummary}\n\n${baseContent}`
1348
- : visibleSummary;
1349
- // Force finish_reason to 'stop' for continue_execution flow
1350
- first.finish_reason = 'stop';
1351
- return cloned;
1352
- }
1353
- // Handle web_search_flow: append original text summary
1354
- if (execution.flowId !== 'web_search_flow') {
1355
- return chat;
1356
- }
1357
- const ctx = execution.context;
1358
- const web = ctx.web_search;
1359
- const summary = web && typeof web.summary === 'string' && web.summary.trim().length
1360
- ? web.summary.trim()
1361
- : '';
1362
- if (!summary) {
1363
- return chat;
1364
- }
1365
- const engineId = web && typeof web.engineId === 'string' && web.engineId.trim().length
1366
- ? web.engineId.trim()
1367
- : undefined;
1368
- const label = engineId
1369
- ? `【web_search 原文 | engine: ${engineId}】`
1370
- : '【web_search 原文】';
1371
- const cloned = JSON.parse(JSON.stringify(chat));
1372
- const choices = Array.isArray(cloned.choices) ? cloned.choices : [];
1373
- if (!choices.length) {
1374
- return cloned;
1375
- }
1376
- const first = choices[0] && typeof choices[0] === 'object' ? choices[0] : null;
1377
- if (!first || !first.message || typeof first.message !== 'object') {
1378
- return cloned;
1379
- }
1380
- const message = first.message;
1381
- const baseContent = typeof message.content === 'string' ? message.content : '';
1382
- const suffix = `${label}\n${summary}`;
1383
- message.content =
1384
- baseContent && baseContent.trim().length
1385
- ? `${baseContent}\n\n${suffix}`
1386
- : suffix;
1387
- return cloned;
1388
- }
1389
- function resolveRouteHint(adapterContext, flowId) {
1390
- const rawRoute = adapterContext.routeId;
1391
- const routeId = typeof rawRoute === 'string' && rawRoute.trim() ? rawRoute.trim() : '';
1392
- if (!routeId) {
1393
- return undefined;
1394
- }
1395
- if (routeId.toLowerCase() === 'default') {
1396
- return undefined;
1397
- }
1398
- if (flowId && routeId.toLowerCase() === flowId.toLowerCase()) {
1399
- return undefined;
1400
- }
1401
- return routeId;
1402
- }
1403
- function buildServerToolLoopState(adapterContext, flowId, payload, response) {
1404
- if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {
1405
- return null;
1406
- }
1407
- const trackPayload = typeof flowId === 'string' && flowId.trim() && flowId !== 'stop_message_flow';
1408
- const payloadHash = trackPayload ? hashPayload(payload) : '__servertool_auto__';
1409
- if (!payloadHash) {
1410
- return null;
1411
- }
1412
- const previous = readServerToolLoopState(adapterContext);
1413
- const sameFlow = previous && previous.flowId === flowId;
1414
- const samePayload = !trackPayload || (previous && previous.payloadHash === payloadHash);
1415
- const prevCount = previous && typeof previous.repeatCount === 'number' && Number.isFinite(previous.repeatCount)
1416
- ? Math.max(0, Math.floor(previous.repeatCount))
1417
- : 0;
1418
- const repeatCount = sameFlow && samePayload ? prevCount + 1 : 1;
1419
- const previousStartedAtMs = sameFlow && previous && typeof previous.startedAtMs === 'number' && Number.isFinite(previous.startedAtMs)
1420
- ? Math.max(0, Math.floor(previous.startedAtMs))
1421
- : undefined;
1422
- const startedAtMs = previousStartedAtMs ?? Date.now();
1423
- const base = {
1424
- ...(flowId ? { flowId } : {}),
1425
- payloadHash,
1426
- repeatCount,
1427
- startedAtMs
1428
- };
1429
- if (flowId === 'stop_message_flow') {
1430
- const pairHash = hashStopMessageRequestResponsePair(payload, response);
1431
- if (pairHash) {
1432
- const previousPairHash = sameFlow && previous && typeof previous.stopPairHash === 'string' ? previous.stopPairHash : undefined;
1433
- const previousPairCount = sameFlow && previous && typeof previous.stopPairRepeatCount === 'number' && Number.isFinite(previous.stopPairRepeatCount)
1434
- ? Math.max(0, Math.floor(previous.stopPairRepeatCount))
1435
- : 0;
1436
- const stopPairRepeatCount = previousPairHash === pairHash ? previousPairCount + 1 : 1;
1437
- const stopPairWarned = previousPairHash === pairHash && previous && typeof previous.stopPairWarned === 'boolean'
1438
- ? previous.stopPairWarned
1439
- : false;
1440
- base.stopPairHash = pairHash;
1441
- base.stopPairRepeatCount = stopPairRepeatCount;
1442
- base.stopPairWarned = stopPairWarned;
1443
- }
1444
- }
1445
- return base;
1446
- }
1447
- function resolveCapturedChatRequest(adapterContext) {
1448
- if (!adapterContext || typeof adapterContext !== 'object') {
1449
- return null;
1450
- }
1451
- const record = adapterContext;
1452
- const direct = record.capturedChatRequest;
1453
- if (direct && typeof direct === 'object' && !Array.isArray(direct)) {
1454
- return direct;
1455
- }
1456
- return null;
1457
- }
1458
- function buildStopMessageLoopPayload(adapterContext) {
1459
- const captured = resolveCapturedChatRequest(adapterContext);
1460
- const seed = extractCapturedChatSeed(captured);
1461
- if (!seed || !Array.isArray(seed.messages) || seed.messages.length === 0) {
1462
- return null;
1463
- }
1464
- const payload = {
1465
- messages: seed.messages
1466
- };
1467
- if (seed.model) {
1468
- payload.model = seed.model;
1469
- }
1470
- if (Array.isArray(seed.tools) && seed.tools.length > 0) {
1471
- payload.tools = seed.tools;
1472
- }
1473
- if (seed.parameters && typeof seed.parameters === 'object' && !Array.isArray(seed.parameters)) {
1474
- payload.parameters = seed.parameters;
1475
- }
1476
- return payload;
1477
- }
1478
- function readServerToolLoopState(adapterContext) {
1479
- if (!adapterContext || typeof adapterContext !== 'object') {
1480
- return null;
1481
- }
1482
- const rt = readRuntimeMetadata(adapterContext);
1483
- const raw = rt?.serverToolLoopState;
1484
- if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
1485
- return null;
1486
- }
1487
- const record = raw;
1488
- const flowId = typeof record.flowId === 'string' ? record.flowId.trim() : undefined;
1489
- const payloadHash = typeof record.payloadHash === 'string' ? record.payloadHash.trim() : undefined;
1490
- const repeatCount = typeof record.repeatCount === 'number' && Number.isFinite(record.repeatCount)
1491
- ? Math.max(0, Math.floor(record.repeatCount))
1492
- : undefined;
1493
- const startedAtMs = typeof record.startedAtMs === 'number' && Number.isFinite(record.startedAtMs)
1494
- ? Math.max(0, Math.floor(record.startedAtMs))
1495
- : undefined;
1496
- const stopPairHash = typeof record.stopPairHash === 'string' && record.stopPairHash.trim().length
1497
- ? record.stopPairHash.trim()
1498
- : undefined;
1499
- const stopPairRepeatCount = typeof record.stopPairRepeatCount === 'number' && Number.isFinite(record.stopPairRepeatCount)
1500
- ? Math.max(0, Math.floor(record.stopPairRepeatCount))
1501
- : undefined;
1502
- const stopPairWarned = typeof record.stopPairWarned === 'boolean' ? record.stopPairWarned : undefined;
1503
- if (!payloadHash) {
1504
- return null;
1505
- }
1506
- return {
1507
- ...(flowId ? { flowId } : {}),
1508
- payloadHash,
1509
- ...(repeatCount !== undefined ? { repeatCount } : {}),
1510
- ...(startedAtMs !== undefined ? { startedAtMs } : {}),
1511
- ...(stopPairHash ? { stopPairHash } : {}),
1512
- ...(stopPairRepeatCount !== undefined ? { stopPairRepeatCount } : {}),
1513
- ...(stopPairWarned !== undefined ? { stopPairWarned } : {})
1514
- };
1515
- }
1516
- function hashPayload(payload) {
1517
- try {
1518
- const stable = stableStringify(payload);
1519
- return createHash('sha1').update(stable).digest('hex');
1520
- }
1521
- catch {
1522
- return null;
1523
- }
1524
- }
1525
- function hashStopMessageRequestResponsePair(payload, response) {
1526
- try {
1527
- const normalizedPayload = sanitizeLoopHashValue(payload);
1528
- const normalizedResponse = sanitizeLoopHashValue(response ?? {});
1529
- const stable = stableStringify({ request: normalizedPayload, response: normalizedResponse });
1530
- return createHash('sha1').update(stable).digest('hex');
1531
- }
1532
- catch {
1533
- return null;
1534
- }
1535
- }
1536
- function sanitizeLoopHashValue(value) {
1537
- if (value === null || value === undefined) {
1538
- return value;
1539
- }
1540
- if (Array.isArray(value)) {
1541
- return value.map((entry) => sanitizeLoopHashValue(entry));
1542
- }
1543
- if (typeof value !== 'object') {
1544
- return value;
1545
- }
1546
- const record = value;
1547
- const normalized = {};
1548
- const volatileKeys = new Set([
1549
- 'id',
1550
- 'created',
1551
- 'created_at',
1552
- 'timestamp',
1553
- 'request_id',
1554
- 'requestId',
1555
- 'trace_id',
1556
- 'response_id',
1557
- 'system_fingerprint'
1558
- ]);
1559
- for (const key of Object.keys(record)) {
1560
- if (volatileKeys.has(key)) {
1561
- continue;
1562
- }
1563
- normalized[key] = sanitizeLoopHashValue(record[key]);
1564
- }
1565
- return normalized;
1566
- }
1567
- function appendStopMessageLoopWarning(payload, repeatCountRaw) {
1568
- if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {
1569
- return;
1570
- }
1571
- const messages = Array.isArray(payload.messages)
1572
- ? payload.messages
1573
- : null;
1574
- if (!messages) {
1575
- return;
1576
- }
1577
- const repeatCount = Number.isFinite(repeatCountRaw)
1578
- ? Math.max(STOP_MESSAGE_LOOP_WARN_THRESHOLD, Math.floor(repeatCountRaw))
1579
- : STOP_MESSAGE_LOOP_WARN_THRESHOLD;
1580
- const warningText = [
1581
- `检测到 stopMessage 请求/响应参数已连续 ${repeatCount} 轮一致。`,
1582
- '请立即尝试跳出循环(换路径、换验证方法、或直接给结论)。',
1583
- `若继续达到 ${STOP_MESSAGE_LOOP_FAIL_THRESHOLD} 轮一致,将返回 fetch failed 网络错误并停止自动续跑。`
1584
- ].join('\n');
1585
- messages.push({
1586
- role: 'system',
1587
- content: warningText
1588
- });
1589
- }
1590
- function stableStringify(value) {
1591
- if (value === null || typeof value !== 'object') {
1592
- return JSON.stringify(value);
1593
- }
1594
- if (Array.isArray(value)) {
1595
- return `[${value.map((entry) => stableStringify(entry)).join(',')}]`;
1596
- }
1597
- const record = value;
1598
- const keys = Object.keys(record).sort();
1599
- const entries = keys.map((key) => `${JSON.stringify(key)}:${stableStringify(record[key])}`);
1600
- return `{${entries.join(',')}}`;
1601
- }
1602
- function buildFollowupRequestId(baseRequestId, suffix) {
1603
- const requestId = typeof baseRequestId === 'string' ? baseRequestId : '';
1604
- const suffixText = typeof suffix === 'string' ? suffix : '';
1605
- if (!suffixText) {
1606
- return requestId;
1607
- }
1608
- if (!requestId) {
1609
- return suffixText;
1610
- }
1611
- const normalized = normalizeFollowupRequestId(requestId, suffixText);
1612
- if (!normalized) {
1613
- return suffixText;
1614
- }
1615
- return normalized.endsWith(suffixText) ? normalized : `${normalized}${suffixText}`;
1616
- }
1617
- function isAdapterClientDisconnected(adapterContext) {
1618
- if (!adapterContext || typeof adapterContext !== 'object') {
1619
- return false;
1620
- }
1621
- const state = adapterContext.clientConnectionState;
1622
- if (state && typeof state === 'object' && !Array.isArray(state)) {
1623
- const disconnected = state.disconnected;
1624
- if (disconnected === true) {
1625
- return true;
1626
- }
1627
- if (typeof disconnected === 'string' && disconnected.trim().toLowerCase() === 'true') {
1628
- return true;
1629
- }
1630
- }
1631
- const raw = adapterContext.clientDisconnected;
1632
- if (raw === true) {
1633
- return true;
1634
- }
1635
- if (typeof raw === 'string' && raw.trim().toLowerCase() === 'true') {
1636
- return true;
1637
- }
1638
- return false;
1639
- }
1640
- function normalizeFollowupRequestId(requestId, suffixText) {
1641
- if (!requestId) {
1642
- return '';
1643
- }
1644
- const token = suffixText.startsWith(':') ? suffixText.slice(1) : suffixText;
1645
- if (!token) {
1646
- return requestId;
1647
- }
1648
- const delimiterIndex = requestId.indexOf(':');
1649
- if (delimiterIndex === -1) {
1650
- return requestId;
1651
- }
1652
- const base = requestId.slice(0, delimiterIndex);
1653
- const rawSuffix = requestId.slice(delimiterIndex + 1);
1654
- if (!rawSuffix) {
1655
- return requestId;
1656
- }
1657
- const tokens = rawSuffix.split(':').filter((entry) => entry.length > 0 && entry !== token);
1658
- const rebuilt = tokens.length > 0 ? `${base}:${tokens.join(':')}` : base;
1659
- return rebuilt;
1660
- }