@linxiraos/pi-ai 1.1.7 → 1.1.9

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 (493) hide show
  1. package/CHANGELOG.md +3 -8
  2. package/README.md +66 -66
  3. package/package.json +131 -136
  4. package/src/auth-broker/client.ts +1 -1
  5. package/src/auth-broker/remote-store.ts +1 -1
  6. package/src/auth-broker/server.ts +4 -4
  7. package/src/auth-gateway/server.ts +15 -7
  8. package/src/auth-gateway/types.ts +2 -0
  9. package/src/auth-storage.ts +336 -102
  10. package/src/dialect/deepseek.ts +36 -2
  11. package/src/dialect/owned-stream.ts +3 -0
  12. package/src/dialect/thinking.ts +44 -7
  13. package/src/dialect/types.ts +8 -0
  14. package/src/error/auth-classify.ts +4 -1
  15. package/src/error/classes.ts +1 -2
  16. package/src/error/flags.ts +7 -40
  17. package/src/error/format.ts +4 -0
  18. package/src/error/rate-limit.ts +24 -2
  19. package/src/error/retryable.ts +3 -12
  20. package/src/index.ts +0 -1
  21. package/src/providers/amazon-bedrock.ts +131 -15
  22. package/src/providers/anthropic-client.ts +1 -1
  23. package/src/providers/anthropic-messages-server-schema.ts +29 -1
  24. package/src/providers/anthropic-messages-server.ts +56 -8
  25. package/src/providers/anthropic-wire.ts +63 -2
  26. package/src/providers/anthropic.ts +879 -178
  27. package/src/providers/aws-credentials.ts +2 -2
  28. package/src/providers/azure-openai-responses.ts +2 -1
  29. package/src/providers/claude-code-fingerprint.ts +9 -9
  30. package/src/providers/cowork-fetch.ts +2 -3
  31. package/src/providers/cursor-external-tool-handoff.md +1 -0
  32. package/src/providers/cursor.ts +71 -31
  33. package/src/providers/devin.ts +139 -68
  34. package/src/providers/github-copilot-headers.ts +7 -2
  35. package/src/providers/gitlab-duo.ts +18 -160
  36. package/src/providers/google-gemini-cli.ts +16 -18
  37. package/src/providers/google-shared.ts +16 -38
  38. package/src/providers/google-vertex.ts +2 -2
  39. package/src/providers/google.ts +8 -2
  40. package/src/providers/inference-headers.ts +80 -0
  41. package/src/providers/kimi.ts +6 -2
  42. package/src/providers/mock.ts +3 -0
  43. package/src/providers/ollama.ts +8 -22
  44. package/src/providers/openai-anthropic-shim.ts +1 -1
  45. package/src/providers/openai-codex/request-transformer.ts +14 -19
  46. package/src/providers/openai-codex-responses.ts +65 -29
  47. package/src/providers/openai-completions.ts +31 -34
  48. package/src/providers/openai-configuration-update.ts +170 -0
  49. package/src/providers/openai-responses-wire.ts +15 -0
  50. package/src/providers/openai-responses.ts +90 -85
  51. package/src/providers/openai-shared.ts +101 -55
  52. package/src/providers/pi-native-client.ts +1 -1
  53. package/src/providers/pi-native-server.ts +1 -0
  54. package/src/providers/transform-messages.ts +241 -63
  55. package/src/providers/vision-guard.ts +1 -68
  56. package/src/registry/amazon-bedrock.ts +5 -8
  57. package/src/registry/api-key-validation.ts +4 -2
  58. package/src/registry/bedrock-mantle.ts +5 -8
  59. package/src/registry/build.ts +73 -0
  60. package/src/registry/cloudflare-ai-gateway.ts +22 -63
  61. package/src/registry/engine/api-key.ts +109 -0
  62. package/src/registry/engine/common.ts +306 -0
  63. package/src/registry/engine/device-code.ts +131 -0
  64. package/src/registry/engine/oauth-code.ts +233 -0
  65. package/src/registry/engine/refresh.ts +105 -0
  66. package/src/registry/hooks/api-key.ts +19 -0
  67. package/src/registry/hooks/custom.ts +15 -0
  68. package/src/registry/hooks/device-code.ts +13 -0
  69. package/src/registry/hooks/env.ts +42 -0
  70. package/src/registry/hooks/index.ts +21 -0
  71. package/src/registry/hooks/oauth-code.ts +18 -0
  72. package/src/registry/hooks/types.ts +53 -0
  73. package/src/registry/{alibaba-coding-plan.ts → oauth/alibaba-coding-plan.ts} +3 -11
  74. package/src/registry/{alibaba-token-plan.ts → oauth/alibaba-token-plan.ts} +3 -10
  75. package/src/registry/oauth/anthropic.ts +39 -272
  76. package/src/registry/oauth/callback-server.ts +152 -24
  77. package/src/registry/oauth/cloudflare-ai-gateway.ts +39 -0
  78. package/src/registry/oauth/coreweave.ts +16 -0
  79. package/src/registry/oauth/cursor.ts +12 -1
  80. package/src/registry/oauth/device-code.ts +1 -2
  81. package/src/registry/oauth/github-copilot.ts +37 -21
  82. package/src/registry/oauth/gitlab-duo.ts +6 -219
  83. package/src/registry/oauth/google-antigravity.ts +32 -66
  84. package/src/registry/oauth/google-gemini-cli.ts +32 -65
  85. package/src/registry/oauth/google-oauth-shared.ts +0 -143
  86. package/src/registry/oauth/index.ts +28 -39
  87. package/src/registry/{kilo.ts → oauth/kilo.ts} +2 -9
  88. package/src/registry/oauth/kimi.ts +1 -246
  89. package/src/registry/oauth/native-scheme-callback.ts +62 -0
  90. package/src/registry/oauth/openai-codex.ts +28 -109
  91. package/src/registry/oauth/types.ts +2 -1
  92. package/src/registry/oauth/xai-oauth.ts +7 -327
  93. package/src/registry/oauth/xiaomi.ts +9 -60
  94. package/src/registry/oauth/zai.ts +6 -90
  95. package/src/registry/registry.ts +32 -171
  96. package/src/registry/types.ts +12 -9
  97. package/src/stream.ts +83 -50
  98. package/src/types.ts +55 -11
  99. package/src/usage/claude.ts +3 -2
  100. package/src/usage/cline-pass.ts +167 -0
  101. package/src/usage/devin.ts +310 -0
  102. package/src/usage/gemini.ts +2 -32
  103. package/src/usage/github-copilot.ts +2 -2
  104. package/src/usage/google-antigravity.ts +281 -56
  105. package/src/usage/openai-codex.ts +2 -1
  106. package/src/usage.ts +9 -0
  107. package/src/utils/aws-profile.ts +1 -1
  108. package/src/utils/empty-completion-retry.ts +0 -1
  109. package/src/utils/harmony-leak.ts +7 -7
  110. package/src/utils/http-inspector.ts +42 -7
  111. package/src/utils/leaked-thinking-stream.ts +37 -7
  112. package/src/utils/proxy.ts +38 -33
  113. package/src/utils/request-debug.ts +6 -29
  114. package/src/utils/schema/fields.ts +1 -1
  115. package/src/utils/schema/normalize.ts +173 -16
  116. package/src/utils/schema/strict-tool-validation.ts +4 -4
  117. package/src/utils/stream-markup-healing.ts +5 -26
  118. package/src/utils/thinking-loop.ts +12 -17
  119. package/src/utils/tool-call-loop-guard.ts +19 -9
  120. package/src/utils/transport-fetch.ts +50 -0
  121. package/src/utils.ts +34 -25
  122. package/THIRD-PARTY-NOTICES.txt +0 -22909
  123. package/dist/types/api-registry.d.ts +0 -30
  124. package/dist/types/auth/sqlite-credential-store.d.ts +0 -102
  125. package/dist/types/auth-broker/client.d.ts +0 -100
  126. package/dist/types/auth-broker/discover.d.ts +0 -39
  127. package/dist/types/auth-broker/index.d.ts +0 -7
  128. package/dist/types/auth-broker/refresher.d.ts +0 -25
  129. package/dist/types/auth-broker/remote-store.d.ts +0 -147
  130. package/dist/types/auth-broker/server.d.ts +0 -48
  131. package/dist/types/auth-broker/snapshot-cache.d.ts +0 -17
  132. package/dist/types/auth-broker/types.d.ts +0 -152
  133. package/dist/types/auth-broker/wire-schema-resource.d.ts +0 -53
  134. package/dist/types/auth-broker/wire-schemas.d.ts +0 -69
  135. package/dist/types/auth-gateway/http.d.ts +0 -70
  136. package/dist/types/auth-gateway/index.d.ts +0 -3
  137. package/dist/types/auth-gateway/server.d.ts +0 -36
  138. package/dist/types/auth-gateway/types.d.ts +0 -127
  139. package/dist/types/auth-retry.d.ts +0 -155
  140. package/dist/types/auth-storage.d.ts +0 -1286
  141. package/dist/types/dialect/anthropic.d.ts +0 -15
  142. package/dist/types/dialect/catalog.d.ts +0 -3
  143. package/dist/types/dialect/coercion.d.ts +0 -23
  144. package/dist/types/dialect/deepseek.d.ts +0 -14
  145. package/dist/types/dialect/demotion.d.ts +0 -30
  146. package/dist/types/dialect/examples.d.ts +0 -18
  147. package/dist/types/dialect/factory.d.ts +0 -3
  148. package/dist/types/dialect/fenced-thinking.d.ts +0 -53
  149. package/dist/types/dialect/gemini.d.ts +0 -17
  150. package/dist/types/dialect/gemma.d.ts +0 -15
  151. package/dist/types/dialect/glm.d.ts +0 -9
  152. package/dist/types/dialect/harmony.d.ts +0 -8
  153. package/dist/types/dialect/hermes.d.ts +0 -9
  154. package/dist/types/dialect/history.d.ts +0 -3
  155. package/dist/types/dialect/index.d.ts +0 -11
  156. package/dist/types/dialect/inventory.d.ts +0 -9
  157. package/dist/types/dialect/kimi.d.ts +0 -14
  158. package/dist/types/dialect/minimax.d.ts +0 -3
  159. package/dist/types/dialect/owned-stream.d.ts +0 -4
  160. package/dist/types/dialect/qwen-xml.d.ts +0 -6
  161. package/dist/types/dialect/qwen3.d.ts +0 -9
  162. package/dist/types/dialect/rendering.d.ts +0 -54
  163. package/dist/types/dialect/thinking-fence-strip.d.ts +0 -39
  164. package/dist/types/dialect/thinking.d.ts +0 -6
  165. package/dist/types/dialect/types.d.ts +0 -68
  166. package/dist/types/dialect/xml.d.ts +0 -9
  167. package/dist/types/error/abort.d.ts +0 -14
  168. package/dist/types/error/auth-classify.d.ts +0 -20
  169. package/dist/types/error/auth.d.ts +0 -27
  170. package/dist/types/error/aws.d.ts +0 -31
  171. package/dist/types/error/classes.d.ts +0 -106
  172. package/dist/types/error/finalize.d.ts +0 -41
  173. package/dist/types/error/flags.d.ts +0 -122
  174. package/dist/types/error/format.d.ts +0 -20
  175. package/dist/types/error/gateway.d.ts +0 -20
  176. package/dist/types/error/index.d.ts +0 -14
  177. package/dist/types/error/oauth.d.ts +0 -44
  178. package/dist/types/error/provider.d.ts +0 -44
  179. package/dist/types/error/rate-limit.d.ts +0 -85
  180. package/dist/types/error/retryable.d.ts +0 -27
  181. package/dist/types/error/validation.d.ts +0 -32
  182. package/dist/types/index.d.ts +0 -53
  183. package/dist/types/oneshot-retry.d.ts +0 -89
  184. package/dist/types/provider-details.d.ts +0 -24
  185. package/dist/types/providers/amazon-bedrock.d.ts +0 -51
  186. package/dist/types/providers/anthropic-client.d.ts +0 -106
  187. package/dist/types/providers/anthropic-messages-server-schema.d.ts +0 -937
  188. package/dist/types/providers/anthropic-messages-server.d.ts +0 -17
  189. package/dist/types/providers/anthropic-wire.d.ts +0 -358
  190. package/dist/types/providers/anthropic.d.ts +0 -255
  191. package/dist/types/providers/aws-credentials.d.ts +0 -49
  192. package/dist/types/providers/aws-eventstream.d.ts +0 -39
  193. package/dist/types/providers/aws-sigv4.d.ts +0 -55
  194. package/dist/types/providers/azure-openai-responses.d.ts +0 -20
  195. package/dist/types/providers/bedrock-mantle.d.ts +0 -13
  196. package/dist/types/providers/claude-code-fingerprint.d.ts +0 -21
  197. package/dist/types/providers/connect-error-detail.d.ts +0 -14
  198. package/dist/types/providers/cowork-fetch.d.ts +0 -14
  199. package/dist/types/providers/cursor/exec-modern.d.ts +0 -98
  200. package/dist/types/providers/cursor/interaction-query.d.ts +0 -15
  201. package/dist/types/providers/cursor-pi-args.d.ts +0 -140
  202. package/dist/types/providers/cursor.d.ts +0 -256
  203. package/dist/types/providers/devin.d.ts +0 -12
  204. package/dist/types/providers/error-message.d.ts +0 -25
  205. package/dist/types/providers/github-copilot-headers.d.ts +0 -40
  206. package/dist/types/providers/gitlab-duo-workflow.d.ts +0 -254
  207. package/dist/types/providers/gitlab-duo.d.ts +0 -27
  208. package/dist/types/providers/google-auth.d.ts +0 -24
  209. package/dist/types/providers/google-gemini-cli.d.ts +0 -119
  210. package/dist/types/providers/google-shared.d.ts +0 -203
  211. package/dist/types/providers/google-types.d.ts +0 -161
  212. package/dist/types/providers/google-vertex.d.ts +0 -7
  213. package/dist/types/providers/google.d.ts +0 -4
  214. package/dist/types/providers/grammar.d.ts +0 -1
  215. package/dist/types/providers/kimi.d.ts +0 -27
  216. package/dist/types/providers/mock.d.ts +0 -181
  217. package/dist/types/providers/ollama.d.ts +0 -8
  218. package/dist/types/providers/openai-anthropic-shim.d.ts +0 -35
  219. package/dist/types/providers/openai-chat-server-schema.d.ts +0 -1311
  220. package/dist/types/providers/openai-chat-server.d.ts +0 -16
  221. package/dist/types/providers/openai-chat-wire.d.ts +0 -669
  222. package/dist/types/providers/openai-codex/request-transformer.d.ts +0 -111
  223. package/dist/types/providers/openai-codex/response-handler.d.ts +0 -26
  224. package/dist/types/providers/openai-codex-responses.d.ts +0 -238
  225. package/dist/types/providers/openai-completions.d.ts +0 -46
  226. package/dist/types/providers/openai-data-uri.d.ts +0 -11
  227. package/dist/types/providers/openai-reasoning-fallback.d.ts +0 -33
  228. package/dist/types/providers/openai-responses-server-schema.d.ts +0 -1458
  229. package/dist/types/providers/openai-responses-server.d.ts +0 -17
  230. package/dist/types/providers/openai-responses-wire.d.ts +0 -6099
  231. package/dist/types/providers/openai-responses.d.ts +0 -131
  232. package/dist/types/providers/openai-shared.d.ts +0 -706
  233. package/dist/types/providers/pi-native-client.d.ts +0 -13
  234. package/dist/types/providers/pi-native-server.d.ts +0 -69
  235. package/dist/types/providers/register-builtins.d.ts +0 -37
  236. package/dist/types/providers/synthetic.d.ts +0 -26
  237. package/dist/types/providers/transform-messages.d.ts +0 -32
  238. package/dist/types/providers/vision-guard.d.ts +0 -41
  239. package/dist/types/registry/aiand.d.ts +0 -7
  240. package/dist/types/registry/aimlapi.d.ts +0 -4
  241. package/dist/types/registry/alibaba-coding-plan.d.ts +0 -8
  242. package/dist/types/registry/alibaba-token-plan.d.ts +0 -18
  243. package/dist/types/registry/amazon-bedrock.d.ts +0 -10
  244. package/dist/types/registry/anthropic.d.ts +0 -10
  245. package/dist/types/registry/api-key-login.d.ts +0 -46
  246. package/dist/types/registry/api-key-validation.d.ts +0 -44
  247. package/dist/types/registry/aws.d.ts +0 -15
  248. package/dist/types/registry/azure.d.ts +0 -4
  249. package/dist/types/registry/baseten.d.ts +0 -7
  250. package/dist/types/registry/bedrock-mantle.d.ts +0 -22
  251. package/dist/types/registry/cerebras.d.ts +0 -7
  252. package/dist/types/registry/cloudflare-ai-gateway.d.ts +0 -13
  253. package/dist/types/registry/coreweave.d.ts +0 -7
  254. package/dist/types/registry/cursor.d.ts +0 -7
  255. package/dist/types/registry/deepinfra.d.ts +0 -6
  256. package/dist/types/registry/deepseek.d.ts +0 -8
  257. package/dist/types/registry/derived.d.ts +0 -5
  258. package/dist/types/registry/devin.d.ts +0 -8
  259. package/dist/types/registry/exa.d.ts +0 -8
  260. package/dist/types/registry/firepass.d.ts +0 -16
  261. package/dist/types/registry/fireworks.d.ts +0 -7
  262. package/dist/types/registry/github-copilot.d.ts +0 -7
  263. package/dist/types/registry/gitlab-duo-workflow.d.ts +0 -10
  264. package/dist/types/registry/gitlab-duo.d.ts +0 -9
  265. package/dist/types/registry/gmi-cloud.d.ts +0 -7
  266. package/dist/types/registry/google-antigravity.d.ts +0 -9
  267. package/dist/types/registry/google-gemini-cli.d.ts +0 -9
  268. package/dist/types/registry/google-vertex.d.ts +0 -5
  269. package/dist/types/registry/google.d.ts +0 -4
  270. package/dist/types/registry/groq.d.ts +0 -4
  271. package/dist/types/registry/huggingface.d.ts +0 -7
  272. package/dist/types/registry/index.d.ts +0 -4
  273. package/dist/types/registry/kagi.d.ts +0 -14
  274. package/dist/types/registry/kilo.d.ts +0 -7
  275. package/dist/types/registry/kimi-code.d.ts +0 -7
  276. package/dist/types/registry/litellm.d.ts +0 -13
  277. package/dist/types/registry/llama-cpp.d.ts +0 -8
  278. package/dist/types/registry/lm-studio.d.ts +0 -8
  279. package/dist/types/registry/meta.d.ts +0 -7
  280. package/dist/types/registry/minimax-code-cn.d.ts +0 -6
  281. package/dist/types/registry/minimax-code.d.ts +0 -6
  282. package/dist/types/registry/minimax.d.ts +0 -4
  283. package/dist/types/registry/mistral.d.ts +0 -4
  284. package/dist/types/registry/moonshot.d.ts +0 -7
  285. package/dist/types/registry/nanogpt.d.ts +0 -7
  286. package/dist/types/registry/novita.d.ts +0 -6
  287. package/dist/types/registry/nvidia.d.ts +0 -7
  288. package/dist/types/registry/oauth/anthropic-constants.d.ts +0 -12
  289. package/dist/types/registry/oauth/anthropic.d.ts +0 -24
  290. package/dist/types/registry/oauth/callback-server.d.ts +0 -74
  291. package/dist/types/registry/oauth/cursor.d.ts +0 -16
  292. package/dist/types/registry/oauth/device-code.d.ts +0 -25
  293. package/dist/types/registry/oauth/devin.d.ts +0 -5
  294. package/dist/types/registry/oauth/github-copilot.d.ts +0 -30
  295. package/dist/types/registry/oauth/gitlab-duo-workflow.d.ts +0 -6
  296. package/dist/types/registry/oauth/gitlab-duo.d.ts +0 -3
  297. package/dist/types/registry/oauth/google-antigravity.d.ts +0 -15
  298. package/dist/types/registry/oauth/google-gemini-cli.d.ts +0 -22
  299. package/dist/types/registry/oauth/google-oauth-shared.d.ts +0 -56
  300. package/dist/types/registry/oauth/index.d.ts +0 -44
  301. package/dist/types/registry/oauth/kimi.d.ts +0 -21
  302. package/dist/types/registry/oauth/minimax-code.d.ts +0 -27
  303. package/dist/types/registry/oauth/openai-codex.d.ts +0 -33
  304. package/dist/types/registry/oauth/opencode.d.ts +0 -25
  305. package/dist/types/registry/oauth/openrouter.d.ts +0 -36
  306. package/dist/types/registry/oauth/perplexity.d.ts +0 -9
  307. package/dist/types/registry/oauth/pkce.d.ts +0 -8
  308. package/dist/types/registry/oauth/types.d.ts +0 -88
  309. package/dist/types/registry/oauth/wafer.d.ts +0 -1
  310. package/dist/types/registry/oauth/xai-oauth.d.ts +0 -46
  311. package/dist/types/registry/oauth/xiaomi.d.ts +0 -25
  312. package/dist/types/registry/oauth/zai.d.ts +0 -25
  313. package/dist/types/registry/ollama-cloud.d.ts +0 -7
  314. package/dist/types/registry/ollama.d.ts +0 -12
  315. package/dist/types/registry/openai-codex-device.d.ts +0 -8
  316. package/dist/types/registry/openai-codex.d.ts +0 -9
  317. package/dist/types/registry/openai.d.ts +0 -4
  318. package/dist/types/registry/opencode-go.d.ts +0 -6
  319. package/dist/types/registry/opencode-zen.d.ts +0 -6
  320. package/dist/types/registry/openrouter.d.ts +0 -14
  321. package/dist/types/registry/parallel.d.ts +0 -14
  322. package/dist/types/registry/perplexity.d.ts +0 -7
  323. package/dist/types/registry/qianfan.d.ts +0 -7
  324. package/dist/types/registry/qwen-portal.d.ts +0 -7
  325. package/dist/types/registry/registry.d.ts +0 -387
  326. package/dist/types/registry/sakana.d.ts +0 -7
  327. package/dist/types/registry/siliconflow-cn.d.ts +0 -7
  328. package/dist/types/registry/siliconflow.d.ts +0 -7
  329. package/dist/types/registry/synthetic.d.ts +0 -6
  330. package/dist/types/registry/tavily.d.ts +0 -14
  331. package/dist/types/registry/together.d.ts +0 -6
  332. package/dist/types/registry/types.d.ts +0 -79
  333. package/dist/types/registry/umans.d.ts +0 -7
  334. package/dist/types/registry/venice.d.ts +0 -13
  335. package/dist/types/registry/vercel-ai-gateway.d.ts +0 -7
  336. package/dist/types/registry/vllm.d.ts +0 -7
  337. package/dist/types/registry/wafer-serverless.d.ts +0 -6
  338. package/dist/types/registry/xai-oauth.d.ts +0 -7
  339. package/dist/types/registry/xai.d.ts +0 -7
  340. package/dist/types/registry/xiaomi-token-plan-ams.d.ts +0 -6
  341. package/dist/types/registry/xiaomi-token-plan-cn.d.ts +0 -6
  342. package/dist/types/registry/xiaomi-token-plan-sgp.d.ts +0 -6
  343. package/dist/types/registry/xiaomi.d.ts +0 -6
  344. package/dist/types/registry/yolo-auto.d.ts +0 -15
  345. package/dist/types/registry/zai.d.ts +0 -15
  346. package/dist/types/registry/zenmux.d.ts +0 -7
  347. package/dist/types/registry/zhipu-coding-plan.d.ts +0 -7
  348. package/dist/types/stream.d.ts +0 -53
  349. package/dist/types/types.d.ts +0 -1132
  350. package/dist/types/usage/alibaba-token-plan.d.ts +0 -3
  351. package/dist/types/usage/claude.d.ts +0 -4
  352. package/dist/types/usage/cursor.d.ts +0 -15
  353. package/dist/types/usage/gemini.d.ts +0 -2
  354. package/dist/types/usage/github-copilot.d.ts +0 -7
  355. package/dist/types/usage/google-antigravity.d.ts +0 -26
  356. package/dist/types/usage/kimi.d.ts +0 -4
  357. package/dist/types/usage/minimax-code.d.ts +0 -3
  358. package/dist/types/usage/ollama.d.ts +0 -5
  359. package/dist/types/usage/openai-codex-base-url.d.ts +0 -18
  360. package/dist/types/usage/openai-codex-reset.d.ts +0 -68
  361. package/dist/types/usage/openai-codex.d.ts +0 -10
  362. package/dist/types/usage/opencode-go.d.ts +0 -13
  363. package/dist/types/usage/shared.d.ts +0 -13
  364. package/dist/types/usage/synthetic.d.ts +0 -2
  365. package/dist/types/usage/umans.d.ts +0 -2
  366. package/dist/types/usage/xai-oauth.d.ts +0 -12
  367. package/dist/types/usage/zai.d.ts +0 -3
  368. package/dist/types/usage.d.ts +0 -537
  369. package/dist/types/utils/abort.d.ts +0 -25
  370. package/dist/types/utils/anthropic-auth.d.ts +0 -35
  371. package/dist/types/utils/aws-profile.d.ts +0 -17
  372. package/dist/types/utils/block-symbols.d.ts +0 -74
  373. package/dist/types/utils/deterministic-id.d.ts +0 -16
  374. package/dist/types/utils/empty-completion-retry.d.ts +0 -31
  375. package/dist/types/utils/event-stream.d.ts +0 -50
  376. package/dist/types/utils/foundry.d.ts +0 -1
  377. package/dist/types/utils/glyph-codec.d.ts +0 -22
  378. package/dist/types/utils/google-validation.d.ts +0 -2
  379. package/dist/types/utils/harmony-leak.d.ts +0 -135
  380. package/dist/types/utils/http-inspector.d.ts +0 -49
  381. package/dist/types/utils/idle-iterator.d.ts +0 -149
  382. package/dist/types/utils/leaked-thinking-stream.d.ts +0 -33
  383. package/dist/types/utils/openai-http.d.ts +0 -48
  384. package/dist/types/utils/openrouter-headers.d.ts +0 -1
  385. package/dist/types/utils/parse-bind.d.ts +0 -23
  386. package/dist/types/utils/provider-response.d.ts +0 -3
  387. package/dist/types/utils/proxy.d.ts +0 -58
  388. package/dist/types/utils/request-debug.d.ts +0 -29
  389. package/dist/types/utils/retry-after.d.ts +0 -4
  390. package/dist/types/utils/retry.d.ts +0 -14
  391. package/dist/types/utils/schema/adapt.d.ts +0 -24
  392. package/dist/types/utils/schema/compatibility.d.ts +0 -30
  393. package/dist/types/utils/schema/dereference.d.ts +0 -11
  394. package/dist/types/utils/schema/draft.d.ts +0 -10
  395. package/dist/types/utils/schema/equality.d.ts +0 -4
  396. package/dist/types/utils/schema/fields.d.ts +0 -54
  397. package/dist/types/utils/schema/index.d.ts +0 -14
  398. package/dist/types/utils/schema/json-schema-validator.d.ts +0 -20
  399. package/dist/types/utils/schema/meta-validator.d.ts +0 -2
  400. package/dist/types/utils/schema/normalize.d.ts +0 -153
  401. package/dist/types/utils/schema/spill.d.ts +0 -8
  402. package/dist/types/utils/schema/stamps.d.ts +0 -17
  403. package/dist/types/utils/schema/strict-tool-validation.d.ts +0 -25
  404. package/dist/types/utils/schema/types.d.ts +0 -4
  405. package/dist/types/utils/schema/typescript.d.ts +0 -24
  406. package/dist/types/utils/schema/wire.d.ts +0 -58
  407. package/dist/types/utils/sdk-stream-timeout.d.ts +0 -33
  408. package/dist/types/utils/sse-debug.d.ts +0 -5
  409. package/dist/types/utils/stream-markup-healing.d.ts +0 -87
  410. package/dist/types/utils/thinking-loop.d.ts +0 -94
  411. package/dist/types/utils/tool-call-loop-guard.d.ts +0 -26
  412. package/dist/types/utils/tool-choice.d.ts +0 -52
  413. package/dist/types/utils/validation.d.ts +0 -28
  414. package/dist/types/utils.d.ts +0 -57
  415. package/src/registry/aiand.ts +0 -22
  416. package/src/registry/aimlapi.ts +0 -6
  417. package/src/registry/anthropic.ts +0 -26
  418. package/src/registry/api-key-login.ts +0 -131
  419. package/src/registry/azure.ts +0 -6
  420. package/src/registry/baseten.ts +0 -22
  421. package/src/registry/cerebras.ts +0 -23
  422. package/src/registry/coreweave.ts +0 -40
  423. package/src/registry/cursor.ts +0 -20
  424. package/src/registry/deepinfra.ts +0 -24
  425. package/src/registry/deepseek.ts +0 -46
  426. package/src/registry/devin.ts +0 -15
  427. package/src/registry/exa.ts +0 -19
  428. package/src/registry/firepass.ts +0 -32
  429. package/src/registry/fireworks.ts +0 -28
  430. package/src/registry/github-copilot.ts +0 -22
  431. package/src/registry/gitlab-duo-workflow.ts +0 -20
  432. package/src/registry/gitlab-duo.ts +0 -19
  433. package/src/registry/gmi-cloud.ts +0 -22
  434. package/src/registry/google-antigravity.ts +0 -22
  435. package/src/registry/google-gemini-cli.ts +0 -22
  436. package/src/registry/google-vertex.ts +0 -38
  437. package/src/registry/google.ts +0 -6
  438. package/src/registry/groq.ts +0 -6
  439. package/src/registry/huggingface.ts +0 -29
  440. package/src/registry/kagi.ts +0 -28
  441. package/src/registry/kimi-code.ts +0 -17
  442. package/src/registry/litellm.ts +0 -27
  443. package/src/registry/llama-cpp.ts +0 -25
  444. package/src/registry/lm-studio.ts +0 -20
  445. package/src/registry/meta.ts +0 -22
  446. package/src/registry/minimax-code-cn.ts +0 -12
  447. package/src/registry/minimax-code.ts +0 -12
  448. package/src/registry/minimax.ts +0 -6
  449. package/src/registry/mistral.ts +0 -6
  450. package/src/registry/moonshot.ts +0 -28
  451. package/src/registry/nanogpt.ts +0 -22
  452. package/src/registry/novita.ts +0 -25
  453. package/src/registry/nvidia.ts +0 -61
  454. package/src/registry/oauth/devin.ts +0 -124
  455. package/src/registry/oauth/gitlab-duo-workflow.ts +0 -146
  456. package/src/registry/oauth/minimax-code.ts +0 -53
  457. package/src/registry/oauth/opencode.ts +0 -64
  458. package/src/registry/oauth/openrouter.ts +0 -120
  459. package/src/registry/oauth/wafer.ts +0 -24
  460. package/src/registry/ollama-cloud.ts +0 -36
  461. package/src/registry/ollama.ts +0 -43
  462. package/src/registry/openai-codex-device.ts +0 -18
  463. package/src/registry/openai-codex.ts +0 -19
  464. package/src/registry/openai.ts +0 -6
  465. package/src/registry/opencode-go.ts +0 -12
  466. package/src/registry/opencode-zen.ts +0 -12
  467. package/src/registry/openrouter.ts +0 -24
  468. package/src/registry/parallel.ts +0 -27
  469. package/src/registry/perplexity.ts +0 -13
  470. package/src/registry/qianfan.ts +0 -28
  471. package/src/registry/qwen-portal.ts +0 -50
  472. package/src/registry/sakana.ts +0 -22
  473. package/src/registry/siliconflow-cn.ts +0 -22
  474. package/src/registry/siliconflow.ts +0 -22
  475. package/src/registry/synthetic.ts +0 -21
  476. package/src/registry/tavily.ts +0 -27
  477. package/src/registry/together.ts +0 -26
  478. package/src/registry/umans.ts +0 -23
  479. package/src/registry/venice.ts +0 -33
  480. package/src/registry/vercel-ai-gateway.ts +0 -20
  481. package/src/registry/vllm.ts +0 -24
  482. package/src/registry/wafer-serverless.ts +0 -12
  483. package/src/registry/xai-oauth.ts +0 -17
  484. package/src/registry/xai.ts +0 -22
  485. package/src/registry/xiaomi-token-plan-ams.ts +0 -12
  486. package/src/registry/xiaomi-token-plan-cn.ts +0 -12
  487. package/src/registry/xiaomi-token-plan-sgp.ts +0 -12
  488. package/src/registry/xiaomi.ts +0 -12
  489. package/src/registry/yolo-auto.ts +0 -30
  490. package/src/registry/zai.ts +0 -41
  491. package/src/registry/zenmux.ts +0 -22
  492. package/src/registry/zhipu-coding-plan.ts +0 -27
  493. package/src/utils/retry.ts +0 -77
package/CHANGELOG.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
- ## [1.1.7] - 2026-09-01
5
+ ## [1.1.9] - 2026-09-05
6
6
 
7
- - 同步上游 OMP v18.0.11(`b8ce33a58911c26bed1d84f0db9a5e2e727c49a2`)。
7
+ - Z.ai OAuth key name sends zeta (merge restored the upstream oh-my-pi literal in tests); xAI/OpenAI-compatible requests send the zeta User-Agent again.
8
8
 
9
9
  ## [1.1.6] - 2026-08-30
10
10
 
@@ -14,12 +14,6 @@
14
14
 
15
15
  - 同步上游 OMP v18.0.5 / v18.0.6:新增 Yolo-Auto / OpenRouter 浏览器登录与 DeepInfra 支持,空补全重试重构(withReplaySafeStreamRetry)。
16
16
 
17
- ## [1.1.3] - 2026-08-25
18
-
19
- ### Fixed
20
-
21
- - Republished as 1.1.3 to reset the latest tag after the broken 1.1.2 (no functional change over 1.1.1).
22
-
23
17
  ## [1.1.2] - 2026-08-25
24
18
 
25
19
  ### Fixed
@@ -47,3 +41,4 @@
47
41
  ### Changed
48
42
 
49
43
  - Reset the version to 1.0.0 and republished under the `@linxiraos/*` scope, breaking from the `@linxiraos` version lineage.
44
+ - Fixed Gemini thought summaries occasionally leaking a raw `` ```thinking `` / `` ``````thinking `` fence delimiter into the reasoning block, so it no longer shows up as fence spam in the thinking display or persisted transcripts ([#8719](https://github.com/can1357/oh-my-pi/issues/8719)).
package/README.md CHANGED
@@ -10,38 +10,38 @@ Unified LLM API with automatic model discovery, provider configuration, token an
10
10
  - [Installation](#installation)
11
11
  - [Quick Start](#quick-start)
12
12
  - [Tools](#tools)
13
- - [Defining Tools](#defining-tools)
14
- - [Handling Tool Calls](#handling-tool-calls)
15
- - [Streaming Tool Calls with Partial JSON](#streaming-tool-calls-with-partial-json)
16
- - [Validating Tool Arguments](#validating-tool-arguments)
17
- - [Complete Event Reference](#complete-event-reference)
13
+ - [Defining Tools](#defining-tools)
14
+ - [Handling Tool Calls](#handling-tool-calls)
15
+ - [Streaming Tool Calls with Partial JSON](#streaming-tool-calls-with-partial-json)
16
+ - [Validating Tool Arguments](#validating-tool-arguments)
17
+ - [Complete Event Reference](#complete-event-reference)
18
18
  - [Image Input](#image-input)
19
19
  - [Thinking/Reasoning](#thinkingreasoning)
20
- - [Unified Interface](#unified-interface-streamsimplecompletesimple)
21
- - [Provider-Specific Options](#provider-specific-options-streamcomplete)
22
- - [Streaming Thinking Content](#streaming-thinking-content)
20
+ - [Unified Interface](#unified-interface-streamsimplecompletesimple)
21
+ - [Provider-Specific Options](#provider-specific-options-streamcomplete)
22
+ - [Streaming Thinking Content](#streaming-thinking-content)
23
23
  - [Stop Reasons](#stop-reasons)
24
24
  - [Error Handling](#error-handling)
25
- - [Aborting Requests](#aborting-requests)
26
- - [Continuing After Abort](#continuing-after-abort)
25
+ - [Aborting Requests](#aborting-requests)
26
+ - [Continuing After Abort](#continuing-after-abort)
27
27
  - [APIs, Models, and Providers](#apis-models-and-providers)
28
- - [Providers and Models](#providers-and-models)
29
- - [Querying Providers and Models](#querying-providers-and-models)
30
- - [Custom Models](#custom-models)
31
- - [OpenAI Compatibility Settings](#openai-compatibility-settings)
32
- - [Type Safety](#type-safety)
28
+ - [Providers and Models](#providers-and-models)
29
+ - [Querying Providers and Models](#querying-providers-and-models)
30
+ - [Custom Models](#custom-models)
31
+ - [OpenAI Compatibility Settings](#openai-compatibility-settings)
32
+ - [Type Safety](#type-safety)
33
33
  - [Cross-Provider Handoffs](#cross-provider-handoffs)
34
34
  - [Context Serialization](#context-serialization)
35
35
  - [Browser Usage](#browser-usage)
36
- - [Environment Variables](#environment-variables-nodejs-only)
37
- - [Checking Environment Variables](#checking-environment-variables)
36
+ - [Environment Variables](#environment-variables-nodejs-only)
37
+ - [Checking Environment Variables](#checking-environment-variables)
38
38
  - [OAuth Providers](#oauth-providers)
39
- - [Vertex AI (ADC)](#vertex-ai-adc)
40
- - [CLI Login](#cli-login)
41
- - [Programmatic OAuth](#programmatic-oauth)
42
- - [Login Flow Example](#login-flow-example)
43
- - [Using OAuth Tokens](#using-oauth-tokens)
44
- - [Provider Notes](#provider-notes)
39
+ - [Vertex AI (ADC)](#vertex-ai-adc)
40
+ - [CLI Login](#cli-login)
41
+ - [Programmatic OAuth](#programmatic-oauth)
42
+ - [Login Flow Example](#login-flow-example)
43
+ - [Using OAuth Tokens](#using-oauth-tokens)
44
+ - [Provider Notes](#provider-notes)
45
45
  - [License](#license)
46
46
 
47
47
  ## Supported Providers
@@ -172,7 +172,7 @@ const finalMessage = await s.result();
172
172
  context.messages.push(finalMessage);
173
173
 
174
174
  // Handle tool calls if any
175
- const toolCalls = finalMessage.content.filter((b) => b.type === "toolCall");
175
+ const toolCalls = finalMessage.content.filter(b => b.type === "toolCall");
176
176
  for (const call of toolCalls) {
177
177
  // Execute the tool
178
178
  const result =
@@ -464,7 +464,7 @@ const response = await completeSimple(
464
464
  },
465
465
  {
466
466
  reasoning: "medium", // 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' (xhigh maps to high on non-OpenAI providers)
467
- }
467
+ },
468
468
  );
469
469
 
470
470
  // Access thinking and text blocks
@@ -583,7 +583,7 @@ const s = stream(
583
583
  },
584
584
  {
585
585
  signal,
586
- }
586
+ },
587
587
  );
588
588
 
589
589
  for await (const event of s) {
@@ -643,7 +643,7 @@ Example:
643
643
  const response = await complete(model, context, {
644
644
  apiKey: "sk-live",
645
645
  headers: { "X-Debug-Trace": "true" },
646
- onPayload: (payload) => {
646
+ onPayload: payload => {
647
647
  console.log("request payload", payload);
648
648
  },
649
649
  });
@@ -918,7 +918,7 @@ const response = await complete(
918
918
  },
919
919
  {
920
920
  apiKey: "your-api-key",
921
- }
921
+ },
922
922
  );
923
923
  ```
924
924
 
@@ -928,40 +928,40 @@ const response = await complete(
928
928
 
929
929
  In Node.js environments, you can set environment variables to avoid passing API keys:
930
930
 
931
- | Provider | Environment Variable(s) |
932
- | -------------- | ---------------------------------------------------------------------------- |
933
- | OpenAI | `OPENAI_API_KEY` |
934
- | Anthropic | `ANTHROPIC_API_KEY` or `ANTHROPIC_OAUTH_TOKEN` (or `ANTHROPIC_FOUNDRY_API_KEY` when `CLAUDE_CODE_USE_FOUNDRY=true`) |
935
- | Google | `GEMINI_API_KEY` |
936
- | Vertex AI | `GOOGLE_CLOUD_PROJECT` (or `GCLOUD_PROJECT`) + `GOOGLE_CLOUD_LOCATION` + ADC |
937
- | Mistral | `MISTRAL_API_KEY` |
938
- | Groq | `GROQ_API_KEY` |
939
- | Cerebras | `CEREBRAS_API_KEY` |
940
- | Together | `TOGETHER_API_KEY` |
941
- | Qianfan | `QIANFAN_API_KEY` |
942
- | Hugging Face | `HUGGINGFACE_HUB_TOKEN` or `HF_TOKEN` |
943
- | Synthetic | `SYNTHETIC_API_KEY` |
944
- | NVIDIA | `NVIDIA_API_KEY` |
945
- | NanoGPT | `NANO_GPT_API_KEY` |
946
- | Novita | `NOVITA_API_KEY` |
947
- | DeepInfra | `DEEPINFRA_API_KEY` |
948
- | Venice | `VENICE_API_KEY` |
949
- | Moonshot | `MOONSHOT_API_KEY` |
950
- | xAI | `XAI_API_KEY` |
951
- | OpenRouter | `OPENROUTER_API_KEY` |
952
- | LiteLLM | `LITELLM_API_KEY` |
953
- | Ollama | `OLLAMA_API_KEY` (optional for local deployments) |
954
- | Ollama Cloud | `OLLAMA_CLOUD_API_KEY` |
955
- | Qwen Portal | `QWEN_OAUTH_TOKEN` or `QWEN_PORTAL_API_KEY` |
956
- | QwenCloud Token Plan | `ALIBABA_TOKEN_PLAN_API_KEY` or `BAILIAN_TOKEN_PLAN_API_KEY` |
957
- | zAI | `ZAI_API_KEY` |
958
- | Umans AI Coding Plan | `UMANS_AI_CODING_PLAN_API_KEY` |
959
- | MiniMax Code | `MINIMAX_CODE_API_KEY` (international) or `MINIMAX_CODE_CN_API_KEY` (China) |
960
- | Xiaomi MiMo | `XIAOMI_API_KEY` |
961
- | ZenMux | `ZENMUX_API_KEY` |
962
- | vLLM | `VLLM_API_KEY` |
963
- | Cloudflare AI Gateway | `CLOUDFLARE_AI_GATEWAY_API_KEY` + `CLOUDFLARE_ACCOUNT_ID` + `CLOUDFLARE_GATEWAY_ID` |
964
- | GitHub Copilot | `COPILOT_GITHUB_TOKEN` or `GH_TOKEN` or `GITHUB_TOKEN` |
931
+ | Provider | Environment Variable(s) |
932
+ | --------------------- | ------------------------------------------------------------------------------------------------------------------- |
933
+ | OpenAI | `OPENAI_API_KEY` |
934
+ | Anthropic | `ANTHROPIC_API_KEY` or `ANTHROPIC_OAUTH_TOKEN` (or `ANTHROPIC_FOUNDRY_API_KEY` when `CLAUDE_CODE_USE_FOUNDRY=true`) |
935
+ | Google | `GEMINI_API_KEY` |
936
+ | Vertex AI | `GOOGLE_CLOUD_PROJECT` (or `GCLOUD_PROJECT`) + `GOOGLE_CLOUD_LOCATION` + ADC |
937
+ | Mistral | `MISTRAL_API_KEY` |
938
+ | Groq | `GROQ_API_KEY` |
939
+ | Cerebras | `CEREBRAS_API_KEY` |
940
+ | Together | `TOGETHER_API_KEY` |
941
+ | Qianfan | `QIANFAN_API_KEY` |
942
+ | Hugging Face | `HUGGINGFACE_HUB_TOKEN` or `HF_TOKEN` |
943
+ | Synthetic | `SYNTHETIC_API_KEY` |
944
+ | NVIDIA | `NVIDIA_API_KEY` |
945
+ | NanoGPT | `NANO_GPT_API_KEY` |
946
+ | Novita | `NOVITA_API_KEY` |
947
+ | DeepInfra | `DEEPINFRA_API_KEY` |
948
+ | Venice | `VENICE_API_KEY` |
949
+ | Moonshot | `MOONSHOT_API_KEY` |
950
+ | xAI | `XAI_API_KEY` |
951
+ | OpenRouter | `OPENROUTER_API_KEY` |
952
+ | LiteLLM | `LITELLM_API_KEY` |
953
+ | Ollama | `OLLAMA_API_KEY` (optional for local deployments) |
954
+ | Ollama Cloud | `OLLAMA_CLOUD_API_KEY` |
955
+ | Qwen Portal | `QWEN_OAUTH_TOKEN` or `QWEN_PORTAL_API_KEY` |
956
+ | QwenCloud Token Plan | `ALIBABA_TOKEN_PLAN_API_KEY` or `BAILIAN_TOKEN_PLAN_API_KEY` |
957
+ | zAI | `ZAI_API_KEY` |
958
+ | Umans AI Coding Plan | `UMANS_AI_CODING_PLAN_API_KEY` |
959
+ | MiniMax Code | `MINIMAX_CODE_API_KEY` (international) or `MINIMAX_CODE_CN_API_KEY` (China) |
960
+ | Xiaomi MiMo | `XIAOMI_API_KEY` |
961
+ | ZenMux | `ZENMUX_API_KEY` |
962
+ | vLLM | `VLLM_API_KEY` |
963
+ | Cloudflare AI Gateway | `CLOUDFLARE_AI_GATEWAY_API_KEY` + `CLOUDFLARE_ACCOUNT_ID` + `CLOUDFLARE_GATEWAY_ID` |
964
+ | GitHub Copilot | `COPILOT_GITHUB_TOKEN` or `GH_TOKEN` or `GITHUB_TOKEN` |
965
965
 
966
966
  `/login cloudflare-ai-gateway` collects and stores the gateway token, account ID, and gateway ID. For environment configuration, set all three Cloudflare values above. OMP derives provider endpoints from the account and gateway IDs.
967
967
 
@@ -997,7 +997,7 @@ Provider endpoint defaults for the current OpenAI-compatible integrations:
997
997
  - LiteLLM: `http://localhost:4000/v1`
998
998
  - Cloudflare AI Gateway: native Anthropic, OpenAI, and Workers AI routes under `https://gateway.ai.cloudflare.com/v1/<account>/<gateway>`
999
999
  - Qwen Portal: `https://portal.qwen.ai/v1`
1000
- When set, the library automatically uses these keys:
1000
+ When set, the library automatically uses these keys:
1001
1001
 
1002
1002
  ```typescript
1003
1003
  // Uses OPENAI_API_KEY from environment
@@ -1143,10 +1143,10 @@ const credentials = await loginGitHubCopilot({
1143
1143
  console.log(`Open: ${url}`);
1144
1144
  if (instructions) console.log(instructions);
1145
1145
  },
1146
- onPrompt: async (prompt) => {
1146
+ onPrompt: async prompt => {
1147
1147
  return await getUserInput(prompt.message);
1148
1148
  },
1149
- onProgress: (message) => console.log(message),
1149
+ onProgress: message => console.log(message),
1150
1150
  });
1151
1151
 
1152
1152
  // Store credentials yourself
@@ -1180,7 +1180,7 @@ const response = await complete(
1180
1180
  {
1181
1181
  messages: [{ role: "user", content: "Hello!" }],
1182
1182
  },
1183
- { apiKey: result.apiKey }
1183
+ { apiKey: result.apiKey },
1184
1184
  );
1185
1185
  ```
1186
1186
 
package/package.json CHANGED
@@ -1,138 +1,133 @@
1
1
  {
2
- "type": "module",
3
- "name": "@linxiraos/pi-ai",
4
- "version": "1.1.7",
5
- "description": "Unified LLM API with automatic model discovery and provider configuration",
6
- "homepage": "https://linxira-os.github.io/zeta/",
7
- "author": "Can Boluk",
8
- "contributors": [
9
- "Mario Zechner"
10
- ],
11
- "license": "MIT",
12
- "repository": {
13
- "type": "git",
14
- "url": "git+https://github.com/Linxira-OS/linxira-zeta.git",
15
- "directory": "packages/ai"
16
- },
17
- "bugs": {
18
- "url": "https://github.com/Linxira-OS/linxira-zeta/issues"
19
- },
20
- "keywords": [
21
- "ai",
22
- "llm",
23
- "openai",
24
- "anthropic",
25
- "gemini",
26
- "unified",
27
- "api"
28
- ],
29
- "main": "./src/index.ts",
30
- "types": "./dist/types/index.d.ts",
31
- "scripts": {
32
- "check": "biome check . && bun run check:types",
33
- "check:types": "tsgo -p tsconfig.json --noEmit",
34
- "lint": "biome lint .",
35
- "test": "bun test --parallel",
36
- "fix": "biome check --write --unsafe .",
37
- "fmt": "biome format --write ."
38
- },
39
- "dependencies": {
40
- "@linxiraos/pi-omptype": "1.1.7",
41
- "@linxiraos/pi-catalog": "1.1.7",
42
- "@linxiraos/pi-utils": "1.1.7",
43
- "@linxiraos/pi-wire": "1.1.7"
44
- },
45
- "devDependencies": {
46
- "@types/bun": "^1.3.14"
47
- },
48
- "engines": {
49
- "bun": ">=1.3.14"
50
- },
51
- "files": [
52
- "src",
53
- "README.md",
54
- "CHANGELOG.md",
55
- "LICENSE",
56
- "THIRD-PARTY-NOTICES.txt",
57
- "dist/types"
58
- ],
59
- "exports": {
60
- ".": {
61
- "types": "./dist/types/index.d.ts",
62
- "import": "./src/index.ts"
63
- },
64
- "./error": {
65
- "types": "./dist/types/error/index.d.ts",
66
- "import": "./src/error/index.ts"
67
- },
68
- "./*": {
69
- "types": "./dist/types/*.d.ts",
70
- "import": "./src/*.ts"
71
- },
72
- "./auth-broker": {
73
- "types": "./dist/types/auth-broker/index.d.ts",
74
- "import": "./src/auth-broker/index.ts"
75
- },
76
- "./auth-broker/*": {
77
- "types": "./dist/types/auth-broker/*.d.ts",
78
- "import": "./src/auth-broker/*.ts"
79
- },
80
- "./auth-gateway": {
81
- "types": "./dist/types/auth-gateway/index.d.ts",
82
- "import": "./src/auth-gateway/index.ts"
83
- },
84
- "./auth-gateway/*": {
85
- "types": "./dist/types/auth-gateway/*.d.ts",
86
- "import": "./src/auth-gateway/*.ts"
87
- },
88
- "./providers/*": {
89
- "types": "./dist/types/providers/*.d.ts",
90
- "import": "./src/providers/*.ts"
91
- },
92
- "./providers/openai-codex/*": {
93
- "types": "./dist/types/providers/openai-codex/*.d.ts",
94
- "import": "./src/providers/openai-codex/*.ts"
95
- },
96
- "./usage/*": {
97
- "types": "./dist/types/usage/*.d.ts",
98
- "import": "./src/usage/*.ts"
99
- },
100
- "./utils/harmony-leak": {
101
- "types": "./dist/types/utils/harmony-leak.d.ts",
102
- "import": "./src/utils/harmony-leak.ts"
103
- },
104
- "./dialect": {
105
- "types": "./dist/types/dialect/index.d.ts",
106
- "import": "./src/dialect/index.ts"
107
- },
108
- "./utils/*": {
109
- "types": "./dist/types/utils/*.d.ts",
110
- "import": "./src/utils/*.ts"
111
- },
112
- "./oauth": {
113
- "types": "./dist/types/registry/oauth/index.d.ts",
114
- "import": "./src/registry/oauth/index.ts"
115
- },
116
- "./oauth/*": {
117
- "types": "./dist/types/registry/oauth/*.d.ts",
118
- "import": "./src/registry/oauth/*.ts"
119
- },
120
- "./registry": {
121
- "types": "./dist/types/registry/index.d.ts",
122
- "import": "./src/registry/index.ts"
123
- },
124
- "./registry/oauth": {
125
- "types": "./dist/types/registry/oauth/index.d.ts",
126
- "import": "./src/registry/oauth/index.ts"
127
- },
128
- "./utils/schema": {
129
- "types": "./dist/types/utils/schema/index.d.ts",
130
- "import": "./src/utils/schema/index.ts"
131
- },
132
- "./utils/schema/*": {
133
- "types": "./dist/types/utils/schema/*.d.ts",
134
- "import": "./src/utils/schema/*.ts"
135
- },
136
- "./*.js": "./src/*.ts"
137
- }
2
+ "engines": {
3
+ "bun": ">=1.3.14"
4
+ },
5
+ "devDependencies": {
6
+ "@types/bun": "^1.3.14"
7
+ },
8
+ "dependencies": {
9
+ "@linxiraos/pi-wire": "1.1.9",
10
+ "@linxiraos/pi-utils": "1.1.9",
11
+ "@linxiraos/pi-catalog": "1.1.9",
12
+ "@linxiraos/pi-omptype": "1.1.9",
13
+ "@linxiraos/pi-natives": "1.1.9"
14
+ },
15
+ "scripts": {
16
+ "test": "bun test --parallel",
17
+ "check:types": "tsgo -p tsconfig.json --noEmit",
18
+ "check": "tsgo -p tsconfig.json --noEmit"
19
+ },
20
+ "exports": {
21
+ "./*.js": "./src/*.ts",
22
+ "./utils/schema/*": {
23
+ "import": "./src/utils/schema/*.ts",
24
+ "types": "./src/utils/schema/*.ts"
25
+ },
26
+ "./utils/schema": {
27
+ "import": "./src/utils/schema/index.ts",
28
+ "types": "./src/utils/schema/index.ts"
29
+ },
30
+ "./registry/oauth": {
31
+ "import": "./src/registry/oauth/index.ts",
32
+ "types": "./src/registry/oauth/index.ts"
33
+ },
34
+ "./registry": {
35
+ "import": "./src/registry/index.ts",
36
+ "types": "./src/registry/index.ts"
37
+ },
38
+ "./oauth/*": {
39
+ "import": "./src/registry/oauth/*.ts",
40
+ "types": "./src/registry/oauth/*.ts"
41
+ },
42
+ "./oauth": {
43
+ "import": "./src/registry/oauth/index.ts",
44
+ "types": "./src/registry/oauth/index.ts"
45
+ },
46
+ "./utils/*": {
47
+ "import": "./src/utils/*.ts",
48
+ "types": "./src/utils/*.ts"
49
+ },
50
+ "./dialect": {
51
+ "import": "./src/dialect/index.ts",
52
+ "types": "./src/dialect/index.ts"
53
+ },
54
+ "./utils/harmony-leak": {
55
+ "import": "./src/utils/harmony-leak.ts",
56
+ "types": "./src/utils/harmony-leak.ts"
57
+ },
58
+ "./usage/*": {
59
+ "import": "./src/usage/*.ts",
60
+ "types": "./src/usage/*.ts"
61
+ },
62
+ "./providers/openai-codex/*": {
63
+ "import": "./src/providers/openai-codex/*.ts",
64
+ "types": "./src/providers/openai-codex/*.ts"
65
+ },
66
+ "./providers/*": {
67
+ "import": "./src/providers/*.ts",
68
+ "types": "./src/providers/*.ts"
69
+ },
70
+ "./auth-gateway/*": {
71
+ "import": "./src/auth-gateway/*.ts",
72
+ "types": "./src/auth-gateway/*.ts"
73
+ },
74
+ "./auth-gateway": {
75
+ "import": "./src/auth-gateway/index.ts",
76
+ "types": "./src/auth-gateway/index.ts"
77
+ },
78
+ "./auth-broker/*": {
79
+ "import": "./src/auth-broker/*.ts",
80
+ "types": "./src/auth-broker/*.ts"
81
+ },
82
+ "./auth-broker": {
83
+ "import": "./src/auth-broker/index.ts",
84
+ "types": "./src/auth-broker/index.ts"
85
+ },
86
+ "./*": {
87
+ "import": "./src/*.ts",
88
+ "types": "./src/*.ts"
89
+ },
90
+ "./error": {
91
+ "import": "./src/error/index.ts",
92
+ "types": "./src/error/index.ts"
93
+ },
94
+ ".": {
95
+ "import": "./src/index.ts",
96
+ "types": "./src/index.ts"
97
+ }
98
+ },
99
+ "types": "./src/index.ts",
100
+ "main": "./src/index.ts",
101
+ "type": "module",
102
+ "files": [
103
+ "src",
104
+ "README.md",
105
+ "CHANGELOG.md"
106
+ ],
107
+ "repository": {
108
+ "directory": "packages/ai",
109
+ "url": "git+https://github.com/Linxira-OS/linxira-zeta.git",
110
+ "type": "git"
111
+ },
112
+ "contributors": [
113
+ "Mario Zechner"
114
+ ],
115
+ "author": "Can Boluk",
116
+ "license": "MIT",
117
+ "bugs": {
118
+ "url": "https://github.com/Linxira-OS/linxira-zeta/issues"
119
+ },
120
+ "homepage": "https://linxira-os.github.io/zeta/",
121
+ "keywords": [
122
+ "ai",
123
+ "llm",
124
+ "openai",
125
+ "anthropic",
126
+ "gemini",
127
+ "unified",
128
+ "api"
129
+ ],
130
+ "description": "Unified LLM API with automatic model discovery and provider configuration",
131
+ "version": "1.1.9",
132
+ "name": "@linxiraos/pi-ai"
138
133
  }
@@ -445,7 +445,7 @@ export class AuthBrokerClient {
445
445
  ): Promise<Response> {
446
446
  const auth = opts.auth ?? true;
447
447
  const url = `${this.#baseUrl}${path}`;
448
- const headers: Record<string, string> = { Accept: "application/json", ...(opts.headers ?? {}) };
448
+ const headers: Record<string, string> = { Accept: "application/json", ...opts.headers };
449
449
  if (auth) headers.Authorization = `Bearer ${this.#token}`;
450
450
  let payload: string | undefined;
451
451
  if (opts.body !== undefined) {
@@ -204,7 +204,7 @@ function mergeUsageReports(base: UsageReport, overlay: UsageReport): UsageReport
204
204
  limits,
205
205
  metadata: {
206
206
  ...overlayMetadata,
207
- ...(base.metadata ?? {}),
207
+ ...base.metadata,
208
208
  ...(overlayMetadata.headersUpdatedAt !== undefined
209
209
  ? { headersUpdatedAt: overlayMetadata.headersUpdatedAt }
210
210
  : {}),
@@ -89,7 +89,7 @@ export interface AuthBrokerServerHandle {
89
89
  function json(status: number, body: unknown, headers?: Record<string, string>): Response {
90
90
  return new Response(JSON.stringify(body), {
91
91
  status,
92
- headers: { "Content-Type": "application/json", ...(headers ?? {}) },
92
+ headers: { "Content-Type": "application/json", ...headers },
93
93
  });
94
94
  }
95
95
 
@@ -260,9 +260,9 @@ class GenerationGate {
260
260
  }
261
261
 
262
262
  #wake(generation: number): void {
263
- for (const [waitingFor, waiters] of [...this.#waiters]) {
263
+ for (const [waitingFor, waiters] of Array.from(this.#waiters)) {
264
264
  if (generation <= waitingFor) continue;
265
- for (const resolve of [...waiters]) resolve();
265
+ for (const resolve of Array.from(waiters)) resolve();
266
266
  }
267
267
  }
268
268
  }
@@ -588,7 +588,7 @@ function serveSnapshotStream(
588
588
  generation: snapshot.generation,
589
589
  });
590
590
  }
591
- for (const id of [...lastByCredId.keys()]) {
591
+ for (const id of Array.from(lastByCredId.keys())) {
592
592
  if (seenIds.has(id)) continue;
593
593
  lastByCredId.delete(id);
594
594
  const payload: SnapshotStreamRemovedEvent = {