@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.
- package/CHANGELOG.md +3 -8
- package/README.md +66 -66
- package/package.json +131 -136
- package/src/auth-broker/client.ts +1 -1
- package/src/auth-broker/remote-store.ts +1 -1
- package/src/auth-broker/server.ts +4 -4
- package/src/auth-gateway/server.ts +15 -7
- package/src/auth-gateway/types.ts +2 -0
- package/src/auth-storage.ts +336 -102
- package/src/dialect/deepseek.ts +36 -2
- package/src/dialect/owned-stream.ts +3 -0
- package/src/dialect/thinking.ts +44 -7
- package/src/dialect/types.ts +8 -0
- package/src/error/auth-classify.ts +4 -1
- package/src/error/classes.ts +1 -2
- package/src/error/flags.ts +7 -40
- package/src/error/format.ts +4 -0
- package/src/error/rate-limit.ts +24 -2
- package/src/error/retryable.ts +3 -12
- package/src/index.ts +0 -1
- package/src/providers/amazon-bedrock.ts +131 -15
- package/src/providers/anthropic-client.ts +1 -1
- package/src/providers/anthropic-messages-server-schema.ts +29 -1
- package/src/providers/anthropic-messages-server.ts +56 -8
- package/src/providers/anthropic-wire.ts +63 -2
- package/src/providers/anthropic.ts +879 -178
- package/src/providers/aws-credentials.ts +2 -2
- package/src/providers/azure-openai-responses.ts +2 -1
- package/src/providers/claude-code-fingerprint.ts +9 -9
- package/src/providers/cowork-fetch.ts +2 -3
- package/src/providers/cursor-external-tool-handoff.md +1 -0
- package/src/providers/cursor.ts +71 -31
- package/src/providers/devin.ts +139 -68
- package/src/providers/github-copilot-headers.ts +7 -2
- package/src/providers/gitlab-duo.ts +18 -160
- package/src/providers/google-gemini-cli.ts +16 -18
- package/src/providers/google-shared.ts +16 -38
- package/src/providers/google-vertex.ts +2 -2
- package/src/providers/google.ts +8 -2
- package/src/providers/inference-headers.ts +80 -0
- package/src/providers/kimi.ts +6 -2
- package/src/providers/mock.ts +3 -0
- package/src/providers/ollama.ts +8 -22
- package/src/providers/openai-anthropic-shim.ts +1 -1
- package/src/providers/openai-codex/request-transformer.ts +14 -19
- package/src/providers/openai-codex-responses.ts +65 -29
- package/src/providers/openai-completions.ts +31 -34
- package/src/providers/openai-configuration-update.ts +170 -0
- package/src/providers/openai-responses-wire.ts +15 -0
- package/src/providers/openai-responses.ts +90 -85
- package/src/providers/openai-shared.ts +101 -55
- package/src/providers/pi-native-client.ts +1 -1
- package/src/providers/pi-native-server.ts +1 -0
- package/src/providers/transform-messages.ts +241 -63
- package/src/providers/vision-guard.ts +1 -68
- package/src/registry/amazon-bedrock.ts +5 -8
- package/src/registry/api-key-validation.ts +4 -2
- package/src/registry/bedrock-mantle.ts +5 -8
- package/src/registry/build.ts +73 -0
- package/src/registry/cloudflare-ai-gateway.ts +22 -63
- package/src/registry/engine/api-key.ts +109 -0
- package/src/registry/engine/common.ts +306 -0
- package/src/registry/engine/device-code.ts +131 -0
- package/src/registry/engine/oauth-code.ts +233 -0
- package/src/registry/engine/refresh.ts +105 -0
- package/src/registry/hooks/api-key.ts +19 -0
- package/src/registry/hooks/custom.ts +15 -0
- package/src/registry/hooks/device-code.ts +13 -0
- package/src/registry/hooks/env.ts +42 -0
- package/src/registry/hooks/index.ts +21 -0
- package/src/registry/hooks/oauth-code.ts +18 -0
- package/src/registry/hooks/types.ts +53 -0
- package/src/registry/{alibaba-coding-plan.ts → oauth/alibaba-coding-plan.ts} +3 -11
- package/src/registry/{alibaba-token-plan.ts → oauth/alibaba-token-plan.ts} +3 -10
- package/src/registry/oauth/anthropic.ts +39 -272
- package/src/registry/oauth/callback-server.ts +152 -24
- package/src/registry/oauth/cloudflare-ai-gateway.ts +39 -0
- package/src/registry/oauth/coreweave.ts +16 -0
- package/src/registry/oauth/cursor.ts +12 -1
- package/src/registry/oauth/device-code.ts +1 -2
- package/src/registry/oauth/github-copilot.ts +37 -21
- package/src/registry/oauth/gitlab-duo.ts +6 -219
- package/src/registry/oauth/google-antigravity.ts +32 -66
- package/src/registry/oauth/google-gemini-cli.ts +32 -65
- package/src/registry/oauth/google-oauth-shared.ts +0 -143
- package/src/registry/oauth/index.ts +28 -39
- package/src/registry/{kilo.ts → oauth/kilo.ts} +2 -9
- package/src/registry/oauth/kimi.ts +1 -246
- package/src/registry/oauth/native-scheme-callback.ts +62 -0
- package/src/registry/oauth/openai-codex.ts +28 -109
- package/src/registry/oauth/types.ts +2 -1
- package/src/registry/oauth/xai-oauth.ts +7 -327
- package/src/registry/oauth/xiaomi.ts +9 -60
- package/src/registry/oauth/zai.ts +6 -90
- package/src/registry/registry.ts +32 -171
- package/src/registry/types.ts +12 -9
- package/src/stream.ts +83 -50
- package/src/types.ts +55 -11
- package/src/usage/claude.ts +3 -2
- package/src/usage/cline-pass.ts +167 -0
- package/src/usage/devin.ts +310 -0
- package/src/usage/gemini.ts +2 -32
- package/src/usage/github-copilot.ts +2 -2
- package/src/usage/google-antigravity.ts +281 -56
- package/src/usage/openai-codex.ts +2 -1
- package/src/usage.ts +9 -0
- package/src/utils/aws-profile.ts +1 -1
- package/src/utils/empty-completion-retry.ts +0 -1
- package/src/utils/harmony-leak.ts +7 -7
- package/src/utils/http-inspector.ts +42 -7
- package/src/utils/leaked-thinking-stream.ts +37 -7
- package/src/utils/proxy.ts +38 -33
- package/src/utils/request-debug.ts +6 -29
- package/src/utils/schema/fields.ts +1 -1
- package/src/utils/schema/normalize.ts +173 -16
- package/src/utils/schema/strict-tool-validation.ts +4 -4
- package/src/utils/stream-markup-healing.ts +5 -26
- package/src/utils/thinking-loop.ts +12 -17
- package/src/utils/tool-call-loop-guard.ts +19 -9
- package/src/utils/transport-fetch.ts +50 -0
- package/src/utils.ts +34 -25
- package/THIRD-PARTY-NOTICES.txt +0 -22909
- package/dist/types/api-registry.d.ts +0 -30
- package/dist/types/auth/sqlite-credential-store.d.ts +0 -102
- package/dist/types/auth-broker/client.d.ts +0 -100
- package/dist/types/auth-broker/discover.d.ts +0 -39
- package/dist/types/auth-broker/index.d.ts +0 -7
- package/dist/types/auth-broker/refresher.d.ts +0 -25
- package/dist/types/auth-broker/remote-store.d.ts +0 -147
- package/dist/types/auth-broker/server.d.ts +0 -48
- package/dist/types/auth-broker/snapshot-cache.d.ts +0 -17
- package/dist/types/auth-broker/types.d.ts +0 -152
- package/dist/types/auth-broker/wire-schema-resource.d.ts +0 -53
- package/dist/types/auth-broker/wire-schemas.d.ts +0 -69
- package/dist/types/auth-gateway/http.d.ts +0 -70
- package/dist/types/auth-gateway/index.d.ts +0 -3
- package/dist/types/auth-gateway/server.d.ts +0 -36
- package/dist/types/auth-gateway/types.d.ts +0 -127
- package/dist/types/auth-retry.d.ts +0 -155
- package/dist/types/auth-storage.d.ts +0 -1286
- package/dist/types/dialect/anthropic.d.ts +0 -15
- package/dist/types/dialect/catalog.d.ts +0 -3
- package/dist/types/dialect/coercion.d.ts +0 -23
- package/dist/types/dialect/deepseek.d.ts +0 -14
- package/dist/types/dialect/demotion.d.ts +0 -30
- package/dist/types/dialect/examples.d.ts +0 -18
- package/dist/types/dialect/factory.d.ts +0 -3
- package/dist/types/dialect/fenced-thinking.d.ts +0 -53
- package/dist/types/dialect/gemini.d.ts +0 -17
- package/dist/types/dialect/gemma.d.ts +0 -15
- package/dist/types/dialect/glm.d.ts +0 -9
- package/dist/types/dialect/harmony.d.ts +0 -8
- package/dist/types/dialect/hermes.d.ts +0 -9
- package/dist/types/dialect/history.d.ts +0 -3
- package/dist/types/dialect/index.d.ts +0 -11
- package/dist/types/dialect/inventory.d.ts +0 -9
- package/dist/types/dialect/kimi.d.ts +0 -14
- package/dist/types/dialect/minimax.d.ts +0 -3
- package/dist/types/dialect/owned-stream.d.ts +0 -4
- package/dist/types/dialect/qwen-xml.d.ts +0 -6
- package/dist/types/dialect/qwen3.d.ts +0 -9
- package/dist/types/dialect/rendering.d.ts +0 -54
- package/dist/types/dialect/thinking-fence-strip.d.ts +0 -39
- package/dist/types/dialect/thinking.d.ts +0 -6
- package/dist/types/dialect/types.d.ts +0 -68
- package/dist/types/dialect/xml.d.ts +0 -9
- package/dist/types/error/abort.d.ts +0 -14
- package/dist/types/error/auth-classify.d.ts +0 -20
- package/dist/types/error/auth.d.ts +0 -27
- package/dist/types/error/aws.d.ts +0 -31
- package/dist/types/error/classes.d.ts +0 -106
- package/dist/types/error/finalize.d.ts +0 -41
- package/dist/types/error/flags.d.ts +0 -122
- package/dist/types/error/format.d.ts +0 -20
- package/dist/types/error/gateway.d.ts +0 -20
- package/dist/types/error/index.d.ts +0 -14
- package/dist/types/error/oauth.d.ts +0 -44
- package/dist/types/error/provider.d.ts +0 -44
- package/dist/types/error/rate-limit.d.ts +0 -85
- package/dist/types/error/retryable.d.ts +0 -27
- package/dist/types/error/validation.d.ts +0 -32
- package/dist/types/index.d.ts +0 -53
- package/dist/types/oneshot-retry.d.ts +0 -89
- package/dist/types/provider-details.d.ts +0 -24
- package/dist/types/providers/amazon-bedrock.d.ts +0 -51
- package/dist/types/providers/anthropic-client.d.ts +0 -106
- package/dist/types/providers/anthropic-messages-server-schema.d.ts +0 -937
- package/dist/types/providers/anthropic-messages-server.d.ts +0 -17
- package/dist/types/providers/anthropic-wire.d.ts +0 -358
- package/dist/types/providers/anthropic.d.ts +0 -255
- package/dist/types/providers/aws-credentials.d.ts +0 -49
- package/dist/types/providers/aws-eventstream.d.ts +0 -39
- package/dist/types/providers/aws-sigv4.d.ts +0 -55
- package/dist/types/providers/azure-openai-responses.d.ts +0 -20
- package/dist/types/providers/bedrock-mantle.d.ts +0 -13
- package/dist/types/providers/claude-code-fingerprint.d.ts +0 -21
- package/dist/types/providers/connect-error-detail.d.ts +0 -14
- package/dist/types/providers/cowork-fetch.d.ts +0 -14
- package/dist/types/providers/cursor/exec-modern.d.ts +0 -98
- package/dist/types/providers/cursor/interaction-query.d.ts +0 -15
- package/dist/types/providers/cursor-pi-args.d.ts +0 -140
- package/dist/types/providers/cursor.d.ts +0 -256
- package/dist/types/providers/devin.d.ts +0 -12
- package/dist/types/providers/error-message.d.ts +0 -25
- package/dist/types/providers/github-copilot-headers.d.ts +0 -40
- package/dist/types/providers/gitlab-duo-workflow.d.ts +0 -254
- package/dist/types/providers/gitlab-duo.d.ts +0 -27
- package/dist/types/providers/google-auth.d.ts +0 -24
- package/dist/types/providers/google-gemini-cli.d.ts +0 -119
- package/dist/types/providers/google-shared.d.ts +0 -203
- package/dist/types/providers/google-types.d.ts +0 -161
- package/dist/types/providers/google-vertex.d.ts +0 -7
- package/dist/types/providers/google.d.ts +0 -4
- package/dist/types/providers/grammar.d.ts +0 -1
- package/dist/types/providers/kimi.d.ts +0 -27
- package/dist/types/providers/mock.d.ts +0 -181
- package/dist/types/providers/ollama.d.ts +0 -8
- package/dist/types/providers/openai-anthropic-shim.d.ts +0 -35
- package/dist/types/providers/openai-chat-server-schema.d.ts +0 -1311
- package/dist/types/providers/openai-chat-server.d.ts +0 -16
- package/dist/types/providers/openai-chat-wire.d.ts +0 -669
- package/dist/types/providers/openai-codex/request-transformer.d.ts +0 -111
- package/dist/types/providers/openai-codex/response-handler.d.ts +0 -26
- package/dist/types/providers/openai-codex-responses.d.ts +0 -238
- package/dist/types/providers/openai-completions.d.ts +0 -46
- package/dist/types/providers/openai-data-uri.d.ts +0 -11
- package/dist/types/providers/openai-reasoning-fallback.d.ts +0 -33
- package/dist/types/providers/openai-responses-server-schema.d.ts +0 -1458
- package/dist/types/providers/openai-responses-server.d.ts +0 -17
- package/dist/types/providers/openai-responses-wire.d.ts +0 -6099
- package/dist/types/providers/openai-responses.d.ts +0 -131
- package/dist/types/providers/openai-shared.d.ts +0 -706
- package/dist/types/providers/pi-native-client.d.ts +0 -13
- package/dist/types/providers/pi-native-server.d.ts +0 -69
- package/dist/types/providers/register-builtins.d.ts +0 -37
- package/dist/types/providers/synthetic.d.ts +0 -26
- package/dist/types/providers/transform-messages.d.ts +0 -32
- package/dist/types/providers/vision-guard.d.ts +0 -41
- package/dist/types/registry/aiand.d.ts +0 -7
- package/dist/types/registry/aimlapi.d.ts +0 -4
- package/dist/types/registry/alibaba-coding-plan.d.ts +0 -8
- package/dist/types/registry/alibaba-token-plan.d.ts +0 -18
- package/dist/types/registry/amazon-bedrock.d.ts +0 -10
- package/dist/types/registry/anthropic.d.ts +0 -10
- package/dist/types/registry/api-key-login.d.ts +0 -46
- package/dist/types/registry/api-key-validation.d.ts +0 -44
- package/dist/types/registry/aws.d.ts +0 -15
- package/dist/types/registry/azure.d.ts +0 -4
- package/dist/types/registry/baseten.d.ts +0 -7
- package/dist/types/registry/bedrock-mantle.d.ts +0 -22
- package/dist/types/registry/cerebras.d.ts +0 -7
- package/dist/types/registry/cloudflare-ai-gateway.d.ts +0 -13
- package/dist/types/registry/coreweave.d.ts +0 -7
- package/dist/types/registry/cursor.d.ts +0 -7
- package/dist/types/registry/deepinfra.d.ts +0 -6
- package/dist/types/registry/deepseek.d.ts +0 -8
- package/dist/types/registry/derived.d.ts +0 -5
- package/dist/types/registry/devin.d.ts +0 -8
- package/dist/types/registry/exa.d.ts +0 -8
- package/dist/types/registry/firepass.d.ts +0 -16
- package/dist/types/registry/fireworks.d.ts +0 -7
- package/dist/types/registry/github-copilot.d.ts +0 -7
- package/dist/types/registry/gitlab-duo-workflow.d.ts +0 -10
- package/dist/types/registry/gitlab-duo.d.ts +0 -9
- package/dist/types/registry/gmi-cloud.d.ts +0 -7
- package/dist/types/registry/google-antigravity.d.ts +0 -9
- package/dist/types/registry/google-gemini-cli.d.ts +0 -9
- package/dist/types/registry/google-vertex.d.ts +0 -5
- package/dist/types/registry/google.d.ts +0 -4
- package/dist/types/registry/groq.d.ts +0 -4
- package/dist/types/registry/huggingface.d.ts +0 -7
- package/dist/types/registry/index.d.ts +0 -4
- package/dist/types/registry/kagi.d.ts +0 -14
- package/dist/types/registry/kilo.d.ts +0 -7
- package/dist/types/registry/kimi-code.d.ts +0 -7
- package/dist/types/registry/litellm.d.ts +0 -13
- package/dist/types/registry/llama-cpp.d.ts +0 -8
- package/dist/types/registry/lm-studio.d.ts +0 -8
- package/dist/types/registry/meta.d.ts +0 -7
- package/dist/types/registry/minimax-code-cn.d.ts +0 -6
- package/dist/types/registry/minimax-code.d.ts +0 -6
- package/dist/types/registry/minimax.d.ts +0 -4
- package/dist/types/registry/mistral.d.ts +0 -4
- package/dist/types/registry/moonshot.d.ts +0 -7
- package/dist/types/registry/nanogpt.d.ts +0 -7
- package/dist/types/registry/novita.d.ts +0 -6
- package/dist/types/registry/nvidia.d.ts +0 -7
- package/dist/types/registry/oauth/anthropic-constants.d.ts +0 -12
- package/dist/types/registry/oauth/anthropic.d.ts +0 -24
- package/dist/types/registry/oauth/callback-server.d.ts +0 -74
- package/dist/types/registry/oauth/cursor.d.ts +0 -16
- package/dist/types/registry/oauth/device-code.d.ts +0 -25
- package/dist/types/registry/oauth/devin.d.ts +0 -5
- package/dist/types/registry/oauth/github-copilot.d.ts +0 -30
- package/dist/types/registry/oauth/gitlab-duo-workflow.d.ts +0 -6
- package/dist/types/registry/oauth/gitlab-duo.d.ts +0 -3
- package/dist/types/registry/oauth/google-antigravity.d.ts +0 -15
- package/dist/types/registry/oauth/google-gemini-cli.d.ts +0 -22
- package/dist/types/registry/oauth/google-oauth-shared.d.ts +0 -56
- package/dist/types/registry/oauth/index.d.ts +0 -44
- package/dist/types/registry/oauth/kimi.d.ts +0 -21
- package/dist/types/registry/oauth/minimax-code.d.ts +0 -27
- package/dist/types/registry/oauth/openai-codex.d.ts +0 -33
- package/dist/types/registry/oauth/opencode.d.ts +0 -25
- package/dist/types/registry/oauth/openrouter.d.ts +0 -36
- package/dist/types/registry/oauth/perplexity.d.ts +0 -9
- package/dist/types/registry/oauth/pkce.d.ts +0 -8
- package/dist/types/registry/oauth/types.d.ts +0 -88
- package/dist/types/registry/oauth/wafer.d.ts +0 -1
- package/dist/types/registry/oauth/xai-oauth.d.ts +0 -46
- package/dist/types/registry/oauth/xiaomi.d.ts +0 -25
- package/dist/types/registry/oauth/zai.d.ts +0 -25
- package/dist/types/registry/ollama-cloud.d.ts +0 -7
- package/dist/types/registry/ollama.d.ts +0 -12
- package/dist/types/registry/openai-codex-device.d.ts +0 -8
- package/dist/types/registry/openai-codex.d.ts +0 -9
- package/dist/types/registry/openai.d.ts +0 -4
- package/dist/types/registry/opencode-go.d.ts +0 -6
- package/dist/types/registry/opencode-zen.d.ts +0 -6
- package/dist/types/registry/openrouter.d.ts +0 -14
- package/dist/types/registry/parallel.d.ts +0 -14
- package/dist/types/registry/perplexity.d.ts +0 -7
- package/dist/types/registry/qianfan.d.ts +0 -7
- package/dist/types/registry/qwen-portal.d.ts +0 -7
- package/dist/types/registry/registry.d.ts +0 -387
- package/dist/types/registry/sakana.d.ts +0 -7
- package/dist/types/registry/siliconflow-cn.d.ts +0 -7
- package/dist/types/registry/siliconflow.d.ts +0 -7
- package/dist/types/registry/synthetic.d.ts +0 -6
- package/dist/types/registry/tavily.d.ts +0 -14
- package/dist/types/registry/together.d.ts +0 -6
- package/dist/types/registry/types.d.ts +0 -79
- package/dist/types/registry/umans.d.ts +0 -7
- package/dist/types/registry/venice.d.ts +0 -13
- package/dist/types/registry/vercel-ai-gateway.d.ts +0 -7
- package/dist/types/registry/vllm.d.ts +0 -7
- package/dist/types/registry/wafer-serverless.d.ts +0 -6
- package/dist/types/registry/xai-oauth.d.ts +0 -7
- package/dist/types/registry/xai.d.ts +0 -7
- package/dist/types/registry/xiaomi-token-plan-ams.d.ts +0 -6
- package/dist/types/registry/xiaomi-token-plan-cn.d.ts +0 -6
- package/dist/types/registry/xiaomi-token-plan-sgp.d.ts +0 -6
- package/dist/types/registry/xiaomi.d.ts +0 -6
- package/dist/types/registry/yolo-auto.d.ts +0 -15
- package/dist/types/registry/zai.d.ts +0 -15
- package/dist/types/registry/zenmux.d.ts +0 -7
- package/dist/types/registry/zhipu-coding-plan.d.ts +0 -7
- package/dist/types/stream.d.ts +0 -53
- package/dist/types/types.d.ts +0 -1132
- package/dist/types/usage/alibaba-token-plan.d.ts +0 -3
- package/dist/types/usage/claude.d.ts +0 -4
- package/dist/types/usage/cursor.d.ts +0 -15
- package/dist/types/usage/gemini.d.ts +0 -2
- package/dist/types/usage/github-copilot.d.ts +0 -7
- package/dist/types/usage/google-antigravity.d.ts +0 -26
- package/dist/types/usage/kimi.d.ts +0 -4
- package/dist/types/usage/minimax-code.d.ts +0 -3
- package/dist/types/usage/ollama.d.ts +0 -5
- package/dist/types/usage/openai-codex-base-url.d.ts +0 -18
- package/dist/types/usage/openai-codex-reset.d.ts +0 -68
- package/dist/types/usage/openai-codex.d.ts +0 -10
- package/dist/types/usage/opencode-go.d.ts +0 -13
- package/dist/types/usage/shared.d.ts +0 -13
- package/dist/types/usage/synthetic.d.ts +0 -2
- package/dist/types/usage/umans.d.ts +0 -2
- package/dist/types/usage/xai-oauth.d.ts +0 -12
- package/dist/types/usage/zai.d.ts +0 -3
- package/dist/types/usage.d.ts +0 -537
- package/dist/types/utils/abort.d.ts +0 -25
- package/dist/types/utils/anthropic-auth.d.ts +0 -35
- package/dist/types/utils/aws-profile.d.ts +0 -17
- package/dist/types/utils/block-symbols.d.ts +0 -74
- package/dist/types/utils/deterministic-id.d.ts +0 -16
- package/dist/types/utils/empty-completion-retry.d.ts +0 -31
- package/dist/types/utils/event-stream.d.ts +0 -50
- package/dist/types/utils/foundry.d.ts +0 -1
- package/dist/types/utils/glyph-codec.d.ts +0 -22
- package/dist/types/utils/google-validation.d.ts +0 -2
- package/dist/types/utils/harmony-leak.d.ts +0 -135
- package/dist/types/utils/http-inspector.d.ts +0 -49
- package/dist/types/utils/idle-iterator.d.ts +0 -149
- package/dist/types/utils/leaked-thinking-stream.d.ts +0 -33
- package/dist/types/utils/openai-http.d.ts +0 -48
- package/dist/types/utils/openrouter-headers.d.ts +0 -1
- package/dist/types/utils/parse-bind.d.ts +0 -23
- package/dist/types/utils/provider-response.d.ts +0 -3
- package/dist/types/utils/proxy.d.ts +0 -58
- package/dist/types/utils/request-debug.d.ts +0 -29
- package/dist/types/utils/retry-after.d.ts +0 -4
- package/dist/types/utils/retry.d.ts +0 -14
- package/dist/types/utils/schema/adapt.d.ts +0 -24
- package/dist/types/utils/schema/compatibility.d.ts +0 -30
- package/dist/types/utils/schema/dereference.d.ts +0 -11
- package/dist/types/utils/schema/draft.d.ts +0 -10
- package/dist/types/utils/schema/equality.d.ts +0 -4
- package/dist/types/utils/schema/fields.d.ts +0 -54
- package/dist/types/utils/schema/index.d.ts +0 -14
- package/dist/types/utils/schema/json-schema-validator.d.ts +0 -20
- package/dist/types/utils/schema/meta-validator.d.ts +0 -2
- package/dist/types/utils/schema/normalize.d.ts +0 -153
- package/dist/types/utils/schema/spill.d.ts +0 -8
- package/dist/types/utils/schema/stamps.d.ts +0 -17
- package/dist/types/utils/schema/strict-tool-validation.d.ts +0 -25
- package/dist/types/utils/schema/types.d.ts +0 -4
- package/dist/types/utils/schema/typescript.d.ts +0 -24
- package/dist/types/utils/schema/wire.d.ts +0 -58
- package/dist/types/utils/sdk-stream-timeout.d.ts +0 -33
- package/dist/types/utils/sse-debug.d.ts +0 -5
- package/dist/types/utils/stream-markup-healing.d.ts +0 -87
- package/dist/types/utils/thinking-loop.d.ts +0 -94
- package/dist/types/utils/tool-call-loop-guard.d.ts +0 -26
- package/dist/types/utils/tool-choice.d.ts +0 -52
- package/dist/types/utils/validation.d.ts +0 -28
- package/dist/types/utils.d.ts +0 -57
- package/src/registry/aiand.ts +0 -22
- package/src/registry/aimlapi.ts +0 -6
- package/src/registry/anthropic.ts +0 -26
- package/src/registry/api-key-login.ts +0 -131
- package/src/registry/azure.ts +0 -6
- package/src/registry/baseten.ts +0 -22
- package/src/registry/cerebras.ts +0 -23
- package/src/registry/coreweave.ts +0 -40
- package/src/registry/cursor.ts +0 -20
- package/src/registry/deepinfra.ts +0 -24
- package/src/registry/deepseek.ts +0 -46
- package/src/registry/devin.ts +0 -15
- package/src/registry/exa.ts +0 -19
- package/src/registry/firepass.ts +0 -32
- package/src/registry/fireworks.ts +0 -28
- package/src/registry/github-copilot.ts +0 -22
- package/src/registry/gitlab-duo-workflow.ts +0 -20
- package/src/registry/gitlab-duo.ts +0 -19
- package/src/registry/gmi-cloud.ts +0 -22
- package/src/registry/google-antigravity.ts +0 -22
- package/src/registry/google-gemini-cli.ts +0 -22
- package/src/registry/google-vertex.ts +0 -38
- package/src/registry/google.ts +0 -6
- package/src/registry/groq.ts +0 -6
- package/src/registry/huggingface.ts +0 -29
- package/src/registry/kagi.ts +0 -28
- package/src/registry/kimi-code.ts +0 -17
- package/src/registry/litellm.ts +0 -27
- package/src/registry/llama-cpp.ts +0 -25
- package/src/registry/lm-studio.ts +0 -20
- package/src/registry/meta.ts +0 -22
- package/src/registry/minimax-code-cn.ts +0 -12
- package/src/registry/minimax-code.ts +0 -12
- package/src/registry/minimax.ts +0 -6
- package/src/registry/mistral.ts +0 -6
- package/src/registry/moonshot.ts +0 -28
- package/src/registry/nanogpt.ts +0 -22
- package/src/registry/novita.ts +0 -25
- package/src/registry/nvidia.ts +0 -61
- package/src/registry/oauth/devin.ts +0 -124
- package/src/registry/oauth/gitlab-duo-workflow.ts +0 -146
- package/src/registry/oauth/minimax-code.ts +0 -53
- package/src/registry/oauth/opencode.ts +0 -64
- package/src/registry/oauth/openrouter.ts +0 -120
- package/src/registry/oauth/wafer.ts +0 -24
- package/src/registry/ollama-cloud.ts +0 -36
- package/src/registry/ollama.ts +0 -43
- package/src/registry/openai-codex-device.ts +0 -18
- package/src/registry/openai-codex.ts +0 -19
- package/src/registry/openai.ts +0 -6
- package/src/registry/opencode-go.ts +0 -12
- package/src/registry/opencode-zen.ts +0 -12
- package/src/registry/openrouter.ts +0 -24
- package/src/registry/parallel.ts +0 -27
- package/src/registry/perplexity.ts +0 -13
- package/src/registry/qianfan.ts +0 -28
- package/src/registry/qwen-portal.ts +0 -50
- package/src/registry/sakana.ts +0 -22
- package/src/registry/siliconflow-cn.ts +0 -22
- package/src/registry/siliconflow.ts +0 -22
- package/src/registry/synthetic.ts +0 -21
- package/src/registry/tavily.ts +0 -27
- package/src/registry/together.ts +0 -26
- package/src/registry/umans.ts +0 -23
- package/src/registry/venice.ts +0 -33
- package/src/registry/vercel-ai-gateway.ts +0 -20
- package/src/registry/vllm.ts +0 -24
- package/src/registry/wafer-serverless.ts +0 -12
- package/src/registry/xai-oauth.ts +0 -17
- package/src/registry/xai.ts +0 -22
- package/src/registry/xiaomi-token-plan-ams.ts +0 -12
- package/src/registry/xiaomi-token-plan-cn.ts +0 -12
- package/src/registry/xiaomi-token-plan-sgp.ts +0 -12
- package/src/registry/xiaomi.ts +0 -12
- package/src/registry/yolo-auto.ts +0 -30
- package/src/registry/zai.ts +0 -41
- package/src/registry/zenmux.ts +0 -22
- package/src/registry/zhipu-coding-plan.ts +0 -27
- 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.
|
|
5
|
+
## [1.1.9] - 2026-09-05
|
|
6
6
|
|
|
7
|
-
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
26
|
-
|
|
25
|
+
- [Aborting Requests](#aborting-requests)
|
|
26
|
+
- [Continuing After Abort](#continuing-after-abort)
|
|
27
27
|
- [APIs, Models, and Providers](#apis-models-and-providers)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
37
|
-
|
|
36
|
+
- [Environment Variables](#environment-variables-nodejs-only)
|
|
37
|
+
- [Checking Environment Variables](#checking-environment-variables)
|
|
38
38
|
- [OAuth Providers](#oauth-providers)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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(
|
|
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:
|
|
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
|
|
932
|
-
|
|
|
933
|
-
| OpenAI
|
|
934
|
-
| Anthropic
|
|
935
|
-
| Google
|
|
936
|
-
| Vertex AI
|
|
937
|
-
| Mistral
|
|
938
|
-
| Groq
|
|
939
|
-
| Cerebras
|
|
940
|
-
| Together
|
|
941
|
-
| Qianfan
|
|
942
|
-
| Hugging Face
|
|
943
|
-
| Synthetic
|
|
944
|
-
| NVIDIA
|
|
945
|
-
| NanoGPT
|
|
946
|
-
| Novita
|
|
947
|
-
| DeepInfra
|
|
948
|
-
| Venice
|
|
949
|
-
| Moonshot
|
|
950
|
-
| xAI
|
|
951
|
-
| OpenRouter
|
|
952
|
-
| LiteLLM
|
|
953
|
-
| Ollama
|
|
954
|
-
| Ollama Cloud
|
|
955
|
-
| Qwen Portal
|
|
956
|
-
| QwenCloud Token Plan
|
|
957
|
-
| zAI
|
|
958
|
-
| Umans AI Coding Plan
|
|
959
|
-
| MiniMax Code
|
|
960
|
-
| Xiaomi MiMo
|
|
961
|
-
| ZenMux
|
|
962
|
-
| vLLM
|
|
963
|
-
| Cloudflare AI Gateway | `CLOUDFLARE_AI_GATEWAY_API_KEY` + `CLOUDFLARE_ACCOUNT_ID` + `CLOUDFLARE_GATEWAY_ID`
|
|
964
|
-
| GitHub Copilot
|
|
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
|
|
1146
|
+
onPrompt: async prompt => {
|
|
1147
1147
|
return await getUserInput(prompt.message);
|
|
1148
1148
|
},
|
|
1149
|
-
onProgress:
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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", ...
|
|
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
|
-
...
|
|
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", ...
|
|
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
|
|
263
|
+
for (const [waitingFor, waiters] of Array.from(this.#waiters)) {
|
|
264
264
|
if (generation <= waitingFor) continue;
|
|
265
|
-
for (const resolve of
|
|
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
|
|
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 = {
|