@psnext/slingcli 2.5.20260623-1 → 2.5.20260705-1
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/node_modules/@aws/lambda-invoke-store/README.md +25 -1
- package/node_modules/@aws/lambda-invoke-store/dist-cjs/invoke-store.js +12 -0
- package/node_modules/@aws/lambda-invoke-store/dist-es/invoke-store.js +12 -0
- package/node_modules/@aws/lambda-invoke-store/dist-types/invoke-store.d.ts +6 -0
- package/node_modules/@aws/lambda-invoke-store/package.json +1 -1
- package/node_modules/@aws-sdk/core/account-id-endpoint.d.ts +1 -3
- package/node_modules/@aws-sdk/core/client.d.ts +1 -3
- package/node_modules/@aws-sdk/core/httpAuthSchemes.d.ts +1 -3
- package/node_modules/@aws-sdk/core/package.json +10 -17
- package/node_modules/@aws-sdk/core/protocols.d.ts +1 -3
- package/node_modules/@aws-sdk/core/util.d.ts +1 -3
- package/node_modules/@aws-sdk/credential-provider-env/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/index.js +172 -1
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-cjs/index.js +3 -51
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/index.js +3 -3
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/index.d.ts +3 -3
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-http/package.json +8 -10
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +13 -13
- package/node_modules/@aws-sdk/credential-provider-login/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-node/package.json +11 -11
- package/node_modules/@aws-sdk/credential-provider-process/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/index.js +58 -3
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +7 -8
- package/node_modules/@aws-sdk/eventstream-handler-node/package.json +4 -4
- package/node_modules/@aws-sdk/middleware-eventstream/package.json +4 -4
- package/node_modules/@aws-sdk/middleware-websocket/package.json +7 -7
- package/node_modules/@aws-sdk/nested-clients/cognito-identity.d.ts +1 -3
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +13 -25
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +13 -17
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +12 -15
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +12 -15
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +13 -25
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/commandBuilder.js +6 -0
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/commands/GetCredentialsForIdentityCommand.js +2 -14
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/commands/GetIdCommand.js +2 -14
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/index.js +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/runtimeConfig.browser.js +0 -2
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/runtimeConfig.js +1 -2
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/runtimeConfig.native.js +0 -2
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/runtimeConfig.shared.js +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/commandBuilder.js +8 -0
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/commands/CreateOAuth2TokenCommand.js +2 -17
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/index.js +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/runtimeConfig.browser.js +0 -2
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/runtimeConfig.js +1 -2
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/runtimeConfig.native.js +0 -2
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/runtimeConfig.shared.js +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/commandBuilder.js +6 -0
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/commands/GetRoleCredentialsCommand.js +2 -14
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/index.js +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/runtimeConfig.browser.js +0 -2
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/runtimeConfig.js +1 -2
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/runtimeConfig.native.js +0 -2
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/runtimeConfig.shared.js +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/commandBuilder.js +6 -0
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/commands/CreateTokenCommand.js +2 -14
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/index.js +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/runtimeConfig.browser.js +0 -2
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/runtimeConfig.js +1 -2
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/runtimeConfig.native.js +0 -2
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/runtimeConfig.shared.js +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/commandBuilder.js +6 -0
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/commands/AssumeRoleCommand.js +2 -14
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/commands/AssumeRoleWithWebIdentityCommand.js +2 -14
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/index.js +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/runtimeConfig.browser.js +0 -2
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/runtimeConfig.js +1 -2
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/runtimeConfig.native.js +0 -2
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/runtimeConfig.shared.js +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/commandBuilder.d.ts +18 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/commands/GetCredentialsForIdentityCommand.d.ts +3 -8
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/commands/GetIdCommand.d.ts +3 -8
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/index.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/runtimeConfig.browser.d.ts +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/runtimeConfig.d.ts +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/runtimeConfig.native.d.ts +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/runtimeConfig.shared.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/commandBuilder.d.ts +18 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/commands/CreateOAuth2TokenCommand.d.ts +3 -8
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/index.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/runtimeConfig.browser.d.ts +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/runtimeConfig.d.ts +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/runtimeConfig.native.d.ts +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/runtimeConfig.shared.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/commandBuilder.d.ts +18 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/commands/GetRoleCredentialsCommand.d.ts +3 -8
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/index.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/runtimeConfig.browser.d.ts +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/runtimeConfig.d.ts +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/runtimeConfig.native.d.ts +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/runtimeConfig.shared.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/commandBuilder.d.ts +18 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/commands/CreateTokenCommand.d.ts +3 -8
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/index.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/runtimeConfig.browser.d.ts +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/runtimeConfig.d.ts +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/runtimeConfig.native.d.ts +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/runtimeConfig.shared.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/commandBuilder.d.ts +18 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/commands/AssumeRoleCommand.d.ts +3 -8
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/commands/AssumeRoleWithWebIdentityCommand.d.ts +3 -8
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/index.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/runtimeConfig.browser.d.ts +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/runtimeConfig.d.ts +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/runtimeConfig.native.d.ts +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/runtimeConfig.shared.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/commandBuilder.d.ts +46 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/commands/GetCredentialsForIdentityCommand.d.ts +7 -16
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/commands/GetIdCommand.d.ts +7 -16
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/index.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/runtimeConfig.browser.d.ts +8 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/runtimeConfig.d.ts +8 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/runtimeConfig.native.d.ts +8 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/runtimeConfig.shared.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/commandBuilder.d.ts +42 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/commands/CreateOAuth2TokenCommand.d.ts +3 -8
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/index.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/runtimeConfig.browser.d.ts +8 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/runtimeConfig.d.ts +8 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/runtimeConfig.native.d.ts +8 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/runtimeConfig.shared.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/commandBuilder.d.ts +42 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/commands/GetRoleCredentialsCommand.d.ts +3 -8
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/index.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/runtimeConfig.browser.d.ts +8 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/runtimeConfig.d.ts +8 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/runtimeConfig.native.d.ts +8 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/runtimeConfig.shared.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/commandBuilder.d.ts +42 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/commands/CreateTokenCommand.d.ts +3 -8
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/index.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/runtimeConfig.browser.d.ts +8 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/runtimeConfig.d.ts +8 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/runtimeConfig.native.d.ts +8 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/runtimeConfig.shared.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/commandBuilder.d.ts +46 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/commands/AssumeRoleCommand.d.ts +7 -16
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/commands/AssumeRoleWithWebIdentityCommand.d.ts +7 -16
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/index.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/runtimeConfig.browser.d.ts +8 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/runtimeConfig.d.ts +8 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/runtimeConfig.native.d.ts +8 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/runtimeConfig.shared.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-cjs/index.js +3 -51
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/index.js +3 -3
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/index.d.ts +3 -3
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/package.json +4 -4
- package/node_modules/@aws-sdk/nested-clients/package.json +8 -10
- package/node_modules/@aws-sdk/nested-clients/signin.d.ts +1 -3
- package/node_modules/@aws-sdk/nested-clients/sso-oidc.d.ts +1 -3
- package/node_modules/@aws-sdk/nested-clients/sso.d.ts +1 -3
- package/node_modules/@aws-sdk/nested-clients/sts.d.ts +1 -3
- package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +4 -4
- package/node_modules/@aws-sdk/types/package.json +2 -2
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/index.js +236 -3
- package/node_modules/@aws-sdk/xml-builder/package.json +3 -4
- package/node_modules/@earendil-works/pi-agent-core/dist/agent.js +10 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +9 -8
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js +20 -2
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +2 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js +1 -1
- package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +51 -47
- package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +11 -17
- package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +25 -11
- package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare.js +0 -18
- package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js +8 -4
- package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js +8 -4
- package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +68 -43
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +38 -29
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +189 -204
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +26 -35
- package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js +4 -6
- package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js +11 -2
- package/node_modules/@earendil-works/pi-ai/dist/auth/helpers.js +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js +19 -4
- package/node_modules/@earendil-works/pi-ai/dist/compat.js +81 -7
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +60 -45
- package/node_modules/@earendil-works/pi-ai/dist/images-models.js +7 -3
- package/node_modules/@earendil-works/pi-ai/dist/index.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/legacy-api-aliases.js +49 -0
- package/node_modules/@earendil-works/pi-ai/dist/models.js +7 -3
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.js +149 -12
- package/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.models.js +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.js +18 -34
- package/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.models.js +20 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.js +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.js +39 -9
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-auth.js +85 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.js +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.models.js +13 -13
- package/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.models.js +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +1 -20
- package/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.js +20 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.js +57 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/groq.models.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.models.js +72 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.models.js +4 -4
- package/node_modules/@earendil-works/pi-ai/dist/providers/minimax.models.js +4 -4
- package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.models.js +4 -4
- package/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.models.js +23 -4
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.js +16 -16
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.js +90 -17
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.js +390 -102
- package/node_modules/@earendil-works/pi-ai/dist/providers/together.models.js +39 -20
- package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.js +389 -80
- package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.js +7 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.models.js +12 -12
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.models.js +12 -12
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.models.js +12 -12
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.models.js +15 -15
- package/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.js +6 -6
- package/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.js +6 -6
- package/node_modules/@earendil-works/pi-ai/dist/utils/error-body.js +109 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/estimate.js +95 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/headers.js +10 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/device-code.js +15 -2
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js +3 -2
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.js +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +87 -0
- package/node_modules/@earendil-works/pi-ai/package.json +1 -33
- package/node_modules/@earendil-works/pi-coding-agent/dist/cli/file-processor.js +13 -25
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js +50 -34
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.js +13 -5
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/compaction.js +11 -11
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/loader.js +11 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.js +33 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/http-dispatcher.js +28 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-registry.js +2 -4
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-resolver.js +15 -18
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/project-trust.js +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/provider-attribution.js +0 -10
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.js +2 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/session-manager.js +96 -73
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.js +19 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/timings.js +24 -14
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js +20 -5
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.js +2 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js +12 -25
- package/node_modules/@earendil-works/pi-coding-agent/dist/index.js +2 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/main.js +20 -4
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/assistant-message.js +23 -15
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-entry.js +52 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/extension-editor.js +12 -3
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/session-selector.js +14 -3
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/settings-selector.js +13 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/status-indicator.js +60 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/user-message.js +19 -6
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js +180 -155
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-client.js +14 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.js +16 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.js +7 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/rpc-entry.js +10 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-convert.js +21 -15
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-process.js +83 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/mime.js +41 -0
- package/node_modules/@earendil-works/pi-coding-agent/npm-shrinkwrap.json +12 -12
- package/node_modules/@earendil-works/pi-coding-agent/package.json +8 -5
- package/node_modules/@earendil-works/pi-orchestrator/dist/cli.js +136 -0
- package/node_modules/@earendil-works/pi-orchestrator/dist/config.js +55 -0
- package/node_modules/@earendil-works/pi-orchestrator/dist/handler.js +105 -0
- package/node_modules/@earendil-works/pi-orchestrator/dist/index.js +11 -0
- package/node_modules/@earendil-works/pi-orchestrator/dist/ipc/client.js +56 -0
- package/node_modules/@earendil-works/pi-orchestrator/dist/ipc/protocol.js +12 -0
- package/node_modules/@earendil-works/pi-orchestrator/dist/ipc/server.js +145 -0
- package/node_modules/@earendil-works/pi-orchestrator/dist/radius.js +365 -0
- package/node_modules/@earendil-works/pi-orchestrator/dist/rpc-process.js +168 -0
- package/node_modules/@earendil-works/pi-orchestrator/dist/serve.js +70 -0
- package/node_modules/@earendil-works/pi-orchestrator/dist/storage.js +58 -0
- package/node_modules/@earendil-works/pi-orchestrator/dist/supervisor.js +290 -0
- package/node_modules/@earendil-works/pi-orchestrator/dist/types.js +2 -0
- package/node_modules/@earendil-works/pi-orchestrator/package.json +45 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +3 -0
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.browser.js +358 -145
- package/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.js +462 -142
- package/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.native.js +358 -145
- package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +18 -0
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.js +108 -63
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.browser.js +11 -8
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +11 -8
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +5 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.browser.js +30 -36
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +85 -137
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.native.js +30 -36
- package/node_modules/@smithy/core/dist-es/submodules/checksum/crc32/Crc32Js.js +30 -0
- package/node_modules/@smithy/core/dist-es/submodules/checksum/crc32/Crc32Node.js +24 -0
- package/node_modules/@smithy/core/dist-es/submodules/checksum/index.browser.js +7 -1
- package/node_modules/@smithy/core/dist-es/submodules/checksum/index.js +7 -1
- package/node_modules/@smithy/core/dist-es/submodules/checksum/index.native.js +7 -1
- package/node_modules/@smithy/core/dist-es/submodules/checksum/md5/Md5Js.js +92 -0
- package/node_modules/@smithy/core/dist-es/submodules/checksum/md5/Md5Node.js +29 -0
- package/node_modules/@smithy/core/dist-es/submodules/checksum/sha256/Sha256Js.js +179 -0
- package/node_modules/@smithy/core/dist-es/submodules/checksum/sha256/Sha256Node.js +59 -0
- package/node_modules/@smithy/core/dist-es/submodules/checksum/sha256/Sha256WebCrypto.js +71 -0
- package/node_modules/@smithy/core/dist-es/submodules/client/index.js +1 -0
- package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/client-command-builder.js +17 -0
- package/node_modules/@smithy/core/dist-es/submodules/config/config-resolver/regionConfig/config.js +6 -1
- package/node_modules/@smithy/core/dist-es/submodules/config/config-resolver/regionConfig/getInstanceMetadataRegion.js +92 -0
- package/node_modules/@smithy/core/dist-es/submodules/config/defaults-mode/constants.js +3 -0
- package/node_modules/@smithy/core/dist-es/submodules/config/defaults-mode/resolveDefaultsModeConfig.js +3 -56
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/EventStreamCodec.js +5 -3
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/splitMessage.js +7 -6
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +4 -1
- package/node_modules/@smithy/core/dist-es/submodules/serde/concatBytes.js +15 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/index.browser.js +2 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/index.js +2 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/index.native.js +2 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/util-stream/checksum/ChecksumStream.js +35 -27
- package/node_modules/@smithy/core/dist-es/submodules/serde/util-stream/headStream.js +2 -1
- package/node_modules/@smithy/core/dist-es/submodules/serde/util-stream/stream-collector.browser.js +12 -38
- package/node_modules/@smithy/core/dist-es/submodules/serde/util-stream/stream-collector.js +18 -33
- package/node_modules/@smithy/core/dist-es/submodules/serde/util-utf8/toUint8Array.browser.js +3 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/util-utf8/toUint8Array.js +3 -0
- package/node_modules/@smithy/core/dist-types/submodules/checksum/crc32/Crc32Js.d.ts +18 -0
- package/node_modules/@smithy/core/dist-types/submodules/checksum/crc32/Crc32Node.d.ts +18 -0
- package/node_modules/@smithy/core/dist-types/submodules/checksum/index.browser.d.ts +7 -1
- package/node_modules/@smithy/core/dist-types/submodules/checksum/index.d.ts +7 -1
- package/node_modules/@smithy/core/dist-types/submodules/checksum/index.native.d.ts +7 -1
- package/node_modules/@smithy/core/dist-types/submodules/checksum/md5/Md5Js.d.ts +19 -0
- package/node_modules/@smithy/core/dist-types/submodules/checksum/md5/Md5Node.d.ts +17 -0
- package/node_modules/@smithy/core/dist-types/submodules/checksum/sha256/Sha256Js.d.ts +28 -0
- package/node_modules/@smithy/core/dist-types/submodules/checksum/sha256/Sha256Node.d.ts +13 -0
- package/node_modules/@smithy/core/dist-types/submodules/checksum/sha256/Sha256WebCrypto.d.ts +22 -0
- package/node_modules/@smithy/core/dist-types/submodules/client/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/submodules/client/smithy-client/client-command-builder.d.ts +22 -0
- package/node_modules/@smithy/core/dist-types/submodules/client/smithy-client/command.d.ts +5 -6
- package/node_modules/@smithy/core/dist-types/submodules/config/config-resolver/regionConfig/getInstanceMetadataRegion.d.ts +7 -0
- package/node_modules/@smithy/core/dist-types/submodules/config/defaults-mode/constants.d.ts +12 -0
- package/node_modules/@smithy/core/dist-types/submodules/endpoints/index.browser.d.ts +4 -5
- package/node_modules/@smithy/core/dist-types/submodules/endpoints/index.d.ts +4 -5
- package/node_modules/@smithy/core/dist-types/submodules/endpoints/middleware-endpoint/adaptors/getEndpointFromInstructions.d.ts +3 -4
- package/node_modules/@smithy/core/dist-types/submodules/endpoints/middleware-endpoint/endpointMiddleware.d.ts +1 -2
- package/node_modules/@smithy/core/dist-types/submodules/endpoints/middleware-endpoint/getEndpointPlugin.d.ts +1 -2
- package/node_modules/@smithy/core/dist-types/submodules/serde/concatBytes.d.ts +6 -0
- package/node_modules/@smithy/core/dist-types/submodules/serde/index.browser.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/submodules/serde/index.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/submodules/serde/index.native.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/submodules/serde/util-stream/checksum/ChecksumStream.d.ts +29 -12
- package/node_modules/@smithy/core/dist-types/submodules/serde/util-stream/stream-collector.browser.d.ts +8 -2
- package/node_modules/@smithy/core/dist-types/submodules/serde/util-stream/stream-collector.d.ts +4 -1
- package/node_modules/@smithy/core/package.json +5 -5
- package/node_modules/@smithy/credential-provider-imds/package.json +3 -3
- package/node_modules/@smithy/fetch-http-handler/dist-cjs/index.js +2 -55
- package/node_modules/@smithy/fetch-http-handler/dist-es/index.js +2 -2
- package/node_modules/@smithy/fetch-http-handler/dist-types/index.d.ts +2 -2
- package/node_modules/@smithy/fetch-http-handler/package.json +4 -4
- package/node_modules/@smithy/signature-v4/package.json +3 -4
- package/node_modules/@smithy/types/dist-types/index.d.ts +1 -0
- package/node_modules/@smithy/types/package.json +1 -1
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/buffer.d.ts +64 -25
- package/node_modules/@types/node/crypto.d.ts +18 -5
- package/node_modules/@types/node/diagnostics_channel.d.ts +254 -23
- package/node_modules/@types/node/dns.d.ts +1 -1
- package/node_modules/@types/node/ffi.d.ts +486 -0
- package/node_modules/@types/node/fs/promises.d.ts +3 -0
- package/node_modules/@types/node/fs.d.ts +21 -6
- package/node_modules/@types/node/http.d.ts +25 -0
- package/node_modules/@types/node/index.d.ts +1 -0
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/process.d.ts +14 -1
- package/node_modules/@types/node/quic.d.ts +92 -11
- package/node_modules/@types/node/sqlite.d.ts +55 -0
- package/node_modules/@types/node/stream/iter.d.ts +150 -0
- package/node_modules/@types/node/stream.d.ts +32 -0
- package/node_modules/@types/node/test.d.ts +112 -2
- package/node_modules/@types/node/ts5.6/index.d.ts +1 -0
- package/node_modules/@types/node/ts5.7/index.d.ts +1 -0
- package/node_modules/@types/node/util.d.ts +19 -2
- package/node_modules/@types/node/v8.d.ts +84 -2
- package/node_modules/@types/node/worker_threads.d.ts +8 -7
- package/node_modules/brace-expansion/dist/commonjs/index.js +24 -14
- package/node_modules/brace-expansion/dist/commonjs/index.js.map +1 -1
- package/node_modules/brace-expansion/dist/esm/index.js +24 -14
- package/node_modules/brace-expansion/dist/esm/index.js.map +1 -1
- package/node_modules/brace-expansion/package.json +2 -2
- package/node_modules/google-auth-library/build/src/auth/googleauth.js +1 -1
- package/node_modules/google-auth-library/package.json +4 -4
- package/node_modules/protobufjs/dist/light/protobuf.js +2 -2
- package/node_modules/protobufjs/dist/light/protobuf.min.js +2 -2
- package/node_modules/protobufjs/dist/minimal/protobuf.js +2 -2
- package/node_modules/protobufjs/dist/minimal/protobuf.min.js +2 -2
- package/node_modules/protobufjs/dist/protobuf.js +5 -2
- package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
- package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
- package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
- package/node_modules/protobufjs/package.json +1 -1
- package/node_modules/protobufjs/src/parse.js +3 -0
- package/package.json +7 -6
- package/slingshot/index.js +293 -295
- package/node_modules/@aws-crypto/crc32/CHANGELOG.md +0 -100
- package/node_modules/@aws-crypto/crc32/LICENSE +0 -201
- package/node_modules/@aws-crypto/crc32/README.md +0 -16
- package/node_modules/@aws-crypto/crc32/build/main/aws_crc32.d.ts +0 -7
- package/node_modules/@aws-crypto/crc32/build/main/aws_crc32.js +0 -31
- package/node_modules/@aws-crypto/crc32/build/main/aws_crc32.js.map +0 -1
- package/node_modules/@aws-crypto/crc32/build/main/index.d.ts +0 -7
- package/node_modules/@aws-crypto/crc32/build/main/index.js +0 -108
- package/node_modules/@aws-crypto/crc32/build/main/index.js.map +0 -1
- package/node_modules/@aws-crypto/crc32/build/module/aws_crc32.d.ts +0 -7
- package/node_modules/@aws-crypto/crc32/build/module/aws_crc32.js +0 -28
- package/node_modules/@aws-crypto/crc32/build/module/aws_crc32.js.map +0 -1
- package/node_modules/@aws-crypto/crc32/build/module/index.d.ts +0 -7
- package/node_modules/@aws-crypto/crc32/build/module/index.js +0 -103
- package/node_modules/@aws-crypto/crc32/build/module/index.js.map +0 -1
- package/node_modules/@aws-crypto/crc32/package.json +0 -32
- package/node_modules/@aws-crypto/crc32/src/aws_crc32.ts +0 -24
- package/node_modules/@aws-crypto/crc32/src/index.ts +0 -92
- package/node_modules/@aws-crypto/crc32/tsconfig.json +0 -9
- package/node_modules/@aws-crypto/crc32/tsconfig.module.json +0 -7
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.browser.js +0 -869
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.native.js +0 -862
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/checkUrl.js +0 -42
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttp.browser.js +0 -27
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttp.js +0 -71
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/requestHelpers.js +0 -49
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/retry-wrapper.js +0 -13
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/index.browser.js +0 -2
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/stream-collector/collector.js +0 -8
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/stream-collector/index.js +0 -41
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/stream-collector/collector.d.ts +0 -5
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/stream-collector/index.d.ts +0 -7
- package/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromTokenFile.js +0 -29
- package/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromWebToken.js +0 -25
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/stream-collector/collector.js +0 -8
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/stream-collector/index.js +0 -41
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/stream-collector/collector.d.ts +0 -5
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/stream-collector/index.d.ts +0 -7
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-parser.browser.js +0 -57
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-parser.js +0 -234
- package/node_modules/@earendil-works/pi-ai/dist/api-registry.js +0 -44
- package/node_modules/@smithy/core/dist-es/submodules/checksum/md5-js/constants.js +0 -3
- package/node_modules/@smithy/core/dist-es/submodules/checksum/md5-js/md5.js +0 -168
- package/node_modules/@smithy/core/dist-types/submodules/checksum/md5-js/constants.d.ts +0 -12
- package/node_modules/@smithy/core/dist-types/submodules/checksum/md5-js/md5.d.ts +0 -16
- package/node_modules/@smithy/fetch-http-handler/dist-es/stream-collector.js +0 -53
- package/node_modules/@smithy/fetch-http-handler/dist-types/stream-collector.d.ts +0 -2
- /package/node_modules/@smithy/{core/dist-es/submodules/endpoints/middleware-endpoint/types.js → types/dist-es/endpoints/EndpointParameterInstructions.js} +0 -0
- /package/node_modules/@smithy/{core/dist-types/submodules/endpoints/middleware-endpoint/types.d.ts → types/dist-types/endpoints/EndpointParameterInstructions.d.ts} +0 -0
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
import OpenAI from "openai";
|
|
2
2
|
import { clampThinkingLevel } from "../models.js";
|
|
3
|
+
import { formatProviderError, normalizeProviderError } from "../utils/error-body.js";
|
|
3
4
|
import { AssistantMessageEventStream } from "../utils/event-stream.js";
|
|
4
5
|
import { headersToRecord } from "../utils/headers.js";
|
|
5
6
|
import { getProviderEnvValue } from "../utils/provider-env.js";
|
|
6
|
-
import { isCloudflareProvider, resolveCloudflareBaseUrl } from "./cloudflare.js";
|
|
7
7
|
import { buildCopilotDynamicHeaders, hasCopilotVisionInput } from "./github-copilot-headers.js";
|
|
8
8
|
import { clampOpenAIPromptCacheKey } from "./openai-prompt-cache.js";
|
|
9
9
|
import { convertResponsesMessages, convertResponsesTools, processResponsesStream } from "./openai-responses-shared.js";
|
|
10
10
|
import { buildBaseOptions } from "./simple-options.js";
|
|
11
11
|
const OPENAI_TOOL_CALL_PROVIDERS = new Set(["openai", "openai-codex", "opencode"]);
|
|
12
|
+
function hasHeader(headers, name) {
|
|
13
|
+
if (!headers)
|
|
14
|
+
return false;
|
|
15
|
+
const expected = name.toLowerCase();
|
|
16
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
17
|
+
if (key.toLowerCase() === expected && value !== null && value.trim().length > 0)
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
function getClientApiKey(provider, apiKey, headers) {
|
|
23
|
+
if (apiKey)
|
|
24
|
+
return apiKey;
|
|
25
|
+
if (hasHeader(headers, "authorization") || hasHeader(headers, "cf-aig-authorization"))
|
|
26
|
+
return "unused";
|
|
27
|
+
throw new Error(`No API key for provider: ${provider}`);
|
|
28
|
+
}
|
|
12
29
|
/**
|
|
13
30
|
* Resolve cache retention preference.
|
|
14
31
|
* Defaults to "short" and uses PI_CACHE_RETENTION for backward compatibility.
|
|
@@ -33,20 +50,7 @@ function getPromptCacheRetention(compat, cacheRetention) {
|
|
|
33
50
|
return cacheRetention === "long" && compat.supportsLongCacheRetention ? "24h" : undefined;
|
|
34
51
|
}
|
|
35
52
|
function formatOpenAIResponsesError(error) {
|
|
36
|
-
|
|
37
|
-
const status = error.status;
|
|
38
|
-
const statusCode = typeof status === "number" ? status : undefined;
|
|
39
|
-
if (statusCode !== undefined) {
|
|
40
|
-
return `OpenAI API error (${statusCode}): ${error.message}`;
|
|
41
|
-
}
|
|
42
|
-
return error.message;
|
|
43
|
-
}
|
|
44
|
-
try {
|
|
45
|
-
return JSON.stringify(error);
|
|
46
|
-
}
|
|
47
|
-
catch {
|
|
48
|
-
return String(error);
|
|
49
|
-
}
|
|
53
|
+
return formatProviderError(normalizeProviderError(error), "OpenAI API error");
|
|
50
54
|
}
|
|
51
55
|
/**
|
|
52
56
|
* Generate function for OpenAI Responses API
|
|
@@ -74,13 +78,10 @@ export const stream = (model, context, options) => {
|
|
|
74
78
|
};
|
|
75
79
|
try {
|
|
76
80
|
// Create OpenAI client
|
|
77
|
-
const apiKey = options?.apiKey;
|
|
78
|
-
if (!apiKey) {
|
|
79
|
-
throw new Error(`No API key for provider: ${model.provider}`);
|
|
80
|
-
}
|
|
81
|
+
const apiKey = getClientApiKey(model.provider, options?.apiKey, options?.headers);
|
|
81
82
|
const cacheRetention = resolveCacheRetention(options?.cacheRetention, options?.env);
|
|
82
83
|
const cacheSessionId = cacheRetention === "none" ? undefined : options?.sessionId;
|
|
83
|
-
const client = createClient(model, context, apiKey, options?.headers, cacheSessionId
|
|
84
|
+
const client = createClient(model, context, apiKey, options?.headers, cacheSessionId);
|
|
84
85
|
let params = buildParams(model, context, options);
|
|
85
86
|
const nextParams = await options?.onPayload?.(params, model);
|
|
86
87
|
if (nextParams !== undefined) {
|
|
@@ -122,11 +123,8 @@ export const stream = (model, context, options) => {
|
|
|
122
123
|
return stream;
|
|
123
124
|
};
|
|
124
125
|
export const streamSimple = (model, context, options) => {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
throw new Error(`No API key for provider: ${model.provider}`);
|
|
128
|
-
}
|
|
129
|
-
const base = buildBaseOptions(model, options, apiKey);
|
|
126
|
+
getClientApiKey(model.provider, options?.apiKey, options?.headers);
|
|
127
|
+
const base = buildBaseOptions(model, context, options, options?.apiKey);
|
|
130
128
|
const clampedReasoning = options?.reasoning ? clampThinkingLevel(model, options.reasoning) : undefined;
|
|
131
129
|
const reasoningEffort = clampedReasoning === "off" ? undefined : clampedReasoning;
|
|
132
130
|
return stream(model, context, {
|
|
@@ -134,7 +132,7 @@ export const streamSimple = (model, context, options) => {
|
|
|
134
132
|
reasoningEffort,
|
|
135
133
|
});
|
|
136
134
|
};
|
|
137
|
-
function createClient(model, context, apiKey, optionsHeaders, sessionId
|
|
135
|
+
function createClient(model, context, apiKey, optionsHeaders, sessionId) {
|
|
138
136
|
const compat = getCompat(model);
|
|
139
137
|
const headers = { ...model.headers };
|
|
140
138
|
if (model.provider === "github-copilot") {
|
|
@@ -155,18 +153,11 @@ function createClient(model, context, apiKey, optionsHeaders, sessionId, env) {
|
|
|
155
153
|
if (optionsHeaders) {
|
|
156
154
|
Object.assign(headers, optionsHeaders);
|
|
157
155
|
}
|
|
158
|
-
const defaultHeaders = model.provider === "cloudflare-ai-gateway"
|
|
159
|
-
? {
|
|
160
|
-
...headers,
|
|
161
|
-
Authorization: headers.Authorization ?? null,
|
|
162
|
-
"cf-aig-authorization": `Bearer ${apiKey}`,
|
|
163
|
-
}
|
|
164
|
-
: headers;
|
|
165
156
|
return new OpenAI({
|
|
166
157
|
apiKey,
|
|
167
|
-
baseURL:
|
|
158
|
+
baseURL: model.baseUrl,
|
|
168
159
|
dangerouslyAllowBrowser: true,
|
|
169
|
-
defaultHeaders,
|
|
160
|
+
defaultHeaders: headers,
|
|
170
161
|
});
|
|
171
162
|
}
|
|
172
163
|
function buildParams(model, context, options) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import OpenAI from "openai";
|
|
2
|
-
import {
|
|
2
|
+
import { formatProviderError, normalizeProviderError } from "../utils/error-body.js";
|
|
3
|
+
import { headersToRecord, providerHeadersToRecord } from "../utils/headers.js";
|
|
3
4
|
import { sanitizeSurrogates } from "../utils/sanitize-unicode.js";
|
|
4
5
|
export const generateImages = async (model, context, options) => {
|
|
5
6
|
const output = {
|
|
@@ -59,7 +60,7 @@ export const generateImages = async (model, context, options) => {
|
|
|
59
60
|
}
|
|
60
61
|
catch (error) {
|
|
61
62
|
output.stopReason = options?.signal?.aborted ? "aborted" : "error";
|
|
62
|
-
output.errorMessage =
|
|
63
|
+
output.errorMessage = formatProviderError(normalizeProviderError(error));
|
|
63
64
|
return output;
|
|
64
65
|
}
|
|
65
66
|
};
|
|
@@ -68,10 +69,7 @@ function createClient(model, apiKey, optionsHeaders) {
|
|
|
68
69
|
apiKey,
|
|
69
70
|
baseURL: model.baseUrl,
|
|
70
71
|
dangerouslyAllowBrowser: true,
|
|
71
|
-
defaultHeaders: {
|
|
72
|
-
...model.headers,
|
|
73
|
-
...optionsHeaders,
|
|
74
|
-
},
|
|
72
|
+
defaultHeaders: providerHeadersToRecord({ ...model.headers, ...optionsHeaders }),
|
|
75
73
|
});
|
|
76
74
|
}
|
|
77
75
|
function buildParams(model, context) {
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import { estimateContextTokens } from "../utils/estimate.js";
|
|
2
|
+
const CONTEXT_SAFETY_TOKENS = 4096;
|
|
3
|
+
const MIN_MAX_TOKENS = 1;
|
|
4
|
+
export function clampMaxTokensToContext(model, context, maxTokens) {
|
|
5
|
+
if (model.contextWindow <= 0)
|
|
6
|
+
return Math.max(MIN_MAX_TOKENS, maxTokens);
|
|
7
|
+
const available = model.contextWindow - estimateContextTokens(context).tokens - CONTEXT_SAFETY_TOKENS;
|
|
8
|
+
return Math.min(maxTokens, Math.max(MIN_MAX_TOKENS, available));
|
|
9
|
+
}
|
|
10
|
+
export function buildBaseOptions(model, context, options, apiKey) {
|
|
2
11
|
return {
|
|
3
12
|
temperature: options?.temperature,
|
|
4
|
-
maxTokens: options?.maxTokens,
|
|
13
|
+
maxTokens: clampMaxTokensToContext(model, context, options?.maxTokens ?? model.maxTokens),
|
|
5
14
|
signal: options?.signal,
|
|
6
15
|
apiKey: apiKey || options?.apiKey,
|
|
7
16
|
transport: options?.transport,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Standard api-key auth: a stored credential key wins, otherwise the first
|
|
3
3
|
* set env var resolves. Includes a `login` that prompts for the key.
|
|
4
|
-
* Providers with non-standard resolution (
|
|
4
|
+
* Providers with non-standard resolution (provider env, ambient files, IAM)
|
|
5
5
|
* write their own `ApiKeyAuth`.
|
|
6
6
|
*/
|
|
7
7
|
export function envApiKeyAuth(name, envVars) {
|
|
@@ -9,7 +9,7 @@ export function envApiKeyAuth(name, envVars) {
|
|
|
9
9
|
name,
|
|
10
10
|
login: async (callbacks) => {
|
|
11
11
|
const key = await callbacks.prompt({ type: "secret", message: `Enter ${name}` });
|
|
12
|
-
return { type: "
|
|
12
|
+
return { type: "api_key", key };
|
|
13
13
|
},
|
|
14
14
|
resolve: async ({ ctx, credential }) => {
|
|
15
15
|
if (credential?.key)
|
|
@@ -12,19 +12,34 @@ export class ModelsError extends Error {
|
|
|
12
12
|
* nothing is stored. No silent env fallback after a failed refresh or for a
|
|
13
13
|
* credential type without a matching handler.
|
|
14
14
|
*/
|
|
15
|
-
export async function resolveProviderAuth(provider, model, credentials, authContext) {
|
|
15
|
+
export async function resolveProviderAuth(provider, model, credentials, authContext, overrides) {
|
|
16
|
+
const requestAuthContext = overrides?.env ? overlayEnvAuthContext(authContext, overrides.env) : authContext;
|
|
17
|
+
if (overrides?.apiKey !== undefined && provider.auth.apiKey) {
|
|
18
|
+
return resolveApiKey(requestAuthContext, provider.auth.apiKey, model, {
|
|
19
|
+
type: "api_key",
|
|
20
|
+
key: overrides.apiKey,
|
|
21
|
+
env: overrides.env,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
16
24
|
const stored = await readCredential(credentials, provider.id);
|
|
17
25
|
if (stored) {
|
|
18
26
|
if (stored.type === "oauth" && provider.auth.oauth) {
|
|
19
27
|
return resolveStoredOAuth(credentials, provider.id, provider.auth.oauth, stored);
|
|
20
28
|
}
|
|
21
|
-
if (stored.type === "
|
|
22
|
-
|
|
29
|
+
if (stored.type === "api_key" && provider.auth.apiKey) {
|
|
30
|
+
const credential = overrides?.env ? { ...stored, env: { ...stored.env, ...overrides.env } } : stored;
|
|
31
|
+
return resolveApiKey(requestAuthContext, provider.auth.apiKey, model, credential);
|
|
23
32
|
}
|
|
24
33
|
return undefined;
|
|
25
34
|
}
|
|
26
35
|
// Ambient (env vars, AWS profiles, ADC files).
|
|
27
|
-
return provider.auth.apiKey ? resolveApiKey(
|
|
36
|
+
return provider.auth.apiKey ? resolveApiKey(requestAuthContext, provider.auth.apiKey, model, undefined) : undefined;
|
|
37
|
+
}
|
|
38
|
+
function overlayEnvAuthContext(base, env) {
|
|
39
|
+
return {
|
|
40
|
+
env: async (name) => env[name] || (await base.env(name)),
|
|
41
|
+
fileExists: (path) => base.fileExists(path),
|
|
42
|
+
};
|
|
28
43
|
}
|
|
29
44
|
/**
|
|
30
45
|
* OAuth resolution with double-checked locking (same pattern as today's
|
|
@@ -18,12 +18,12 @@ export * from "./api/mistral-conversations.lazy.js";
|
|
|
18
18
|
export * from "./api/openai-codex-responses.lazy.js";
|
|
19
19
|
export * from "./api/openai-completions.lazy.js";
|
|
20
20
|
export * from "./api/openai-responses.lazy.js";
|
|
21
|
-
export * from "./api-registry.js";
|
|
22
21
|
export * from "./env-api-keys.js";
|
|
23
22
|
export * from "./image-models.js";
|
|
24
23
|
export * from "./images.js";
|
|
25
24
|
export * from "./images-api-registry.js";
|
|
26
25
|
export * from "./index.js";
|
|
26
|
+
export * from "./legacy-api-aliases.js";
|
|
27
27
|
export * from "./providers/images/register-builtins.js";
|
|
28
28
|
import { anthropicMessagesApi } from "./api/anthropic-messages.lazy.js";
|
|
29
29
|
import { azureOpenAIResponsesApi } from "./api/azure-openai-responses.lazy.js";
|
|
@@ -34,15 +34,75 @@ import { mistralConversationsApi } from "./api/mistral-conversations.lazy.js";
|
|
|
34
34
|
import { openAICodexResponsesApi } from "./api/openai-codex-responses.lazy.js";
|
|
35
35
|
import { openAICompletionsApi } from "./api/openai-completions.lazy.js";
|
|
36
36
|
import { openAIResponsesApi } from "./api/openai-responses.lazy.js";
|
|
37
|
-
import { clearApiProviders, getApiProvider, registerApiProvider } from "./api-registry.js";
|
|
38
37
|
import { getEnvApiKey } from "./env-api-keys.js";
|
|
39
|
-
import { getBuiltinModel, getBuiltinModels, getBuiltinProviders } from "./providers/all.js";
|
|
38
|
+
import { builtinModels, getBuiltinModel, getBuiltinModels, getBuiltinProviders } from "./providers/all.js";
|
|
39
|
+
import { createFauxCore } from "./providers/faux.js";
|
|
40
40
|
/** @deprecated Static catalog read. Use `getBuiltinModel` from "@earendil-works/pi-ai/providers/all" or `Models.getModel()`. */
|
|
41
41
|
export const getModel = getBuiltinModel;
|
|
42
42
|
/** @deprecated Static catalog read. Use `getBuiltinModels` from "@earendil-works/pi-ai/providers/all" or `Models.getModels()`. */
|
|
43
43
|
export const getModels = getBuiltinModels;
|
|
44
44
|
/** @deprecated Static catalog read. Use `getBuiltinProviders` from "@earendil-works/pi-ai/providers/all" or `Models.getProviders()`. */
|
|
45
45
|
export const getProviders = getBuiltinProviders;
|
|
46
|
+
const apiProviderRegistry = new Map();
|
|
47
|
+
function wrapStream(api, stream) {
|
|
48
|
+
return (model, context, options) => {
|
|
49
|
+
if (model.api !== api) {
|
|
50
|
+
throw new Error(`Mismatched api: ${model.api} expected ${api}`);
|
|
51
|
+
}
|
|
52
|
+
return stream(model, context, options);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function wrapStreamSimple(api, streamSimple) {
|
|
56
|
+
return (model, context, options) => {
|
|
57
|
+
if (model.api !== api) {
|
|
58
|
+
throw new Error(`Mismatched api: ${model.api} expected ${api}`);
|
|
59
|
+
}
|
|
60
|
+
return streamSimple(model, context, options);
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export function registerApiProvider(provider, sourceId) {
|
|
64
|
+
apiProviderRegistry.set(provider.api, {
|
|
65
|
+
provider: {
|
|
66
|
+
api: provider.api,
|
|
67
|
+
stream: wrapStream(provider.api, provider.stream),
|
|
68
|
+
streamSimple: wrapStreamSimple(provider.api, provider.streamSimple),
|
|
69
|
+
},
|
|
70
|
+
sourceId,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
export function getApiProvider(api) {
|
|
74
|
+
return apiProviderRegistry.get(api)?.provider;
|
|
75
|
+
}
|
|
76
|
+
export function getApiProviders() {
|
|
77
|
+
return Array.from(apiProviderRegistry.values(), (entry) => entry.provider);
|
|
78
|
+
}
|
|
79
|
+
export function unregisterApiProviders(sourceId) {
|
|
80
|
+
for (const [api, entry] of apiProviderRegistry.entries()) {
|
|
81
|
+
if (entry.sourceId === sourceId) {
|
|
82
|
+
apiProviderRegistry.delete(api);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function clearApiProviders() {
|
|
87
|
+
apiProviderRegistry.clear();
|
|
88
|
+
}
|
|
89
|
+
export function registerFauxProvider(options = {}) {
|
|
90
|
+
const core = createFauxCore(options);
|
|
91
|
+
const sourceId = `faux-provider-${Math.random().toString(36).slice(2, 10)}`;
|
|
92
|
+
registerApiProvider({ api: core.api, stream: core.stream, streamSimple: core.streamSimple }, sourceId);
|
|
93
|
+
return {
|
|
94
|
+
api: core.api,
|
|
95
|
+
models: core.models,
|
|
96
|
+
getModel: core.getModel,
|
|
97
|
+
state: core.state,
|
|
98
|
+
setResponses: core.setResponses,
|
|
99
|
+
appendResponses: core.appendResponses,
|
|
100
|
+
getPendingResponseCount: core.getPendingResponseCount,
|
|
101
|
+
unregister() {
|
|
102
|
+
unregisterApiProviders(sourceId);
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
}
|
|
46
106
|
const BUILTIN_APIS = [
|
|
47
107
|
["anthropic-messages", anthropicMessagesApi()],
|
|
48
108
|
["openai-completions", openAICompletionsApi()],
|
|
@@ -54,6 +114,7 @@ const BUILTIN_APIS = [
|
|
|
54
114
|
["mistral-conversations", mistralConversationsApi()],
|
|
55
115
|
["bedrock-converse-stream", bedrockConverseStreamApi()],
|
|
56
116
|
];
|
|
117
|
+
const builtinApiProviderInstances = new Map();
|
|
57
118
|
/**
|
|
58
119
|
* Registers the builtin API implementations into the api-registry without
|
|
59
120
|
* clobbering existing entries: compat may load after a test or extension has
|
|
@@ -61,27 +122,34 @@ const BUILTIN_APIS = [
|
|
|
61
122
|
*/
|
|
62
123
|
export function registerBuiltInApiProviders() {
|
|
63
124
|
for (const [api, streams] of BUILTIN_APIS) {
|
|
64
|
-
if (getApiProvider(api))
|
|
65
|
-
|
|
66
|
-
|
|
125
|
+
if (!getApiProvider(api)) {
|
|
126
|
+
registerApiProvider({ api, stream: streams.stream, streamSimple: streams.streamSimple });
|
|
127
|
+
}
|
|
128
|
+
builtinApiProviderInstances.set(api, getApiProvider(api));
|
|
67
129
|
}
|
|
68
130
|
}
|
|
69
131
|
export function resetApiProviders() {
|
|
70
132
|
clearApiProviders();
|
|
133
|
+
builtinApiProviderInstances.clear();
|
|
71
134
|
registerBuiltInApiProviders();
|
|
72
135
|
}
|
|
73
136
|
registerBuiltInApiProviders();
|
|
137
|
+
const compatModels = builtinModels();
|
|
74
138
|
function hasExplicitApiKey(apiKey) {
|
|
75
139
|
return typeof apiKey === "string" && apiKey.trim().length > 0;
|
|
76
140
|
}
|
|
77
141
|
function withEnvApiKey(model, options) {
|
|
78
142
|
if (hasExplicitApiKey(options?.apiKey))
|
|
79
143
|
return options;
|
|
80
|
-
const apiKey = getEnvApiKey(model.provider);
|
|
144
|
+
const apiKey = getEnvApiKey(model.provider, options?.env);
|
|
81
145
|
if (!apiKey)
|
|
82
146
|
return options;
|
|
83
147
|
return { ...options, apiKey };
|
|
84
148
|
}
|
|
149
|
+
function shouldUseBuiltinModels(model) {
|
|
150
|
+
const builtin = compatModels.getModel(model.provider, model.id);
|
|
151
|
+
return builtin?.api === model.api && getApiProvider(model.api) === builtinApiProviderInstances.get(model.api);
|
|
152
|
+
}
|
|
85
153
|
function resolveApiProvider(api) {
|
|
86
154
|
const provider = getApiProvider(api);
|
|
87
155
|
if (!provider) {
|
|
@@ -90,6 +158,9 @@ function resolveApiProvider(api) {
|
|
|
90
158
|
return provider;
|
|
91
159
|
}
|
|
92
160
|
export function stream(model, context, options) {
|
|
161
|
+
if (shouldUseBuiltinModels(model)) {
|
|
162
|
+
return compatModels.stream(model, context, options);
|
|
163
|
+
}
|
|
93
164
|
const provider = resolveApiProvider(model.api);
|
|
94
165
|
return provider.stream(model, context, withEnvApiKey(model, options));
|
|
95
166
|
}
|
|
@@ -98,6 +169,9 @@ export async function complete(model, context, options) {
|
|
|
98
169
|
return s.result();
|
|
99
170
|
}
|
|
100
171
|
export function streamSimple(model, context, options) {
|
|
172
|
+
if (shouldUseBuiltinModels(model)) {
|
|
173
|
+
return compatModels.streamSimple(model, context, options);
|
|
174
|
+
}
|
|
101
175
|
const provider = resolveApiProvider(model.api);
|
|
102
176
|
return provider.streamSimple(model, context, withEnvApiKey(model, options));
|
|
103
177
|
}
|
|
@@ -152,6 +152,21 @@ export const IMAGE_MODELS = {
|
|
|
152
152
|
"cacheWrite": 0
|
|
153
153
|
}
|
|
154
154
|
},
|
|
155
|
+
"google/gemini-3.1-flash-lite-image": {
|
|
156
|
+
id: "google/gemini-3.1-flash-lite-image",
|
|
157
|
+
name: "Google: Nano Banana 2 Lite (Gemini 3.1 Flash Lite Image)",
|
|
158
|
+
api: "openrouter-images",
|
|
159
|
+
provider: "openrouter",
|
|
160
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
161
|
+
input: ["image", "text"],
|
|
162
|
+
output: ["image", "text"],
|
|
163
|
+
cost: {
|
|
164
|
+
"input": 0.25,
|
|
165
|
+
"output": 1.5,
|
|
166
|
+
"cacheRead": 0,
|
|
167
|
+
"cacheWrite": 0
|
|
168
|
+
}
|
|
169
|
+
},
|
|
155
170
|
"microsoft/mai-image-2.5": {
|
|
156
171
|
id: "microsoft/mai-image-2.5",
|
|
157
172
|
name: "Microsoft: MAI-Image-2.5",
|
|
@@ -212,6 +227,51 @@ export const IMAGE_MODELS = {
|
|
|
212
227
|
"cacheWrite": 0
|
|
213
228
|
}
|
|
214
229
|
},
|
|
230
|
+
"openai/gpt-image-1": {
|
|
231
|
+
id: "openai/gpt-image-1",
|
|
232
|
+
name: "OpenAI: GPT Image 1",
|
|
233
|
+
api: "openrouter-images",
|
|
234
|
+
provider: "openrouter",
|
|
235
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
236
|
+
input: ["text", "image"],
|
|
237
|
+
output: ["image"],
|
|
238
|
+
cost: {
|
|
239
|
+
"input": 10,
|
|
240
|
+
"output": 10,
|
|
241
|
+
"cacheRead": 1.25,
|
|
242
|
+
"cacheWrite": 0
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
"openai/gpt-image-1-mini": {
|
|
246
|
+
id: "openai/gpt-image-1-mini",
|
|
247
|
+
name: "OpenAI: GPT Image 1 Mini",
|
|
248
|
+
api: "openrouter-images",
|
|
249
|
+
provider: "openrouter",
|
|
250
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
251
|
+
input: ["text", "image"],
|
|
252
|
+
output: ["image"],
|
|
253
|
+
cost: {
|
|
254
|
+
"input": 2.5,
|
|
255
|
+
"output": 2.5,
|
|
256
|
+
"cacheRead": 0.25,
|
|
257
|
+
"cacheWrite": 0
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
"openai/gpt-image-2": {
|
|
261
|
+
id: "openai/gpt-image-2",
|
|
262
|
+
name: "OpenAI: GPT Image 2",
|
|
263
|
+
api: "openrouter-images",
|
|
264
|
+
provider: "openrouter",
|
|
265
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
266
|
+
input: ["text", "image"],
|
|
267
|
+
output: ["image"],
|
|
268
|
+
cost: {
|
|
269
|
+
"input": 8,
|
|
270
|
+
"output": 8,
|
|
271
|
+
"cacheRead": 2,
|
|
272
|
+
"cacheWrite": 0
|
|
273
|
+
}
|
|
274
|
+
},
|
|
215
275
|
"openrouter/auto": {
|
|
216
276
|
id: "openrouter/auto",
|
|
217
277
|
name: "Auto Router",
|
|
@@ -407,36 +467,6 @@ export const IMAGE_MODELS = {
|
|
|
407
467
|
"cacheWrite": 0
|
|
408
468
|
}
|
|
409
469
|
},
|
|
410
|
-
"sourceful/riverflow-v2-fast-preview": {
|
|
411
|
-
id: "sourceful/riverflow-v2-fast-preview",
|
|
412
|
-
name: "Sourceful: Riverflow V2 Fast Preview",
|
|
413
|
-
api: "openrouter-images",
|
|
414
|
-
provider: "openrouter",
|
|
415
|
-
baseUrl: "https://openrouter.ai/api/v1",
|
|
416
|
-
input: ["text", "image"],
|
|
417
|
-
output: ["image"],
|
|
418
|
-
cost: {
|
|
419
|
-
"input": 0,
|
|
420
|
-
"output": 0,
|
|
421
|
-
"cacheRead": 0,
|
|
422
|
-
"cacheWrite": 0
|
|
423
|
-
}
|
|
424
|
-
},
|
|
425
|
-
"sourceful/riverflow-v2-max-preview": {
|
|
426
|
-
id: "sourceful/riverflow-v2-max-preview",
|
|
427
|
-
name: "Sourceful: Riverflow V2 Max Preview",
|
|
428
|
-
api: "openrouter-images",
|
|
429
|
-
provider: "openrouter",
|
|
430
|
-
baseUrl: "https://openrouter.ai/api/v1",
|
|
431
|
-
input: ["text", "image"],
|
|
432
|
-
output: ["image"],
|
|
433
|
-
cost: {
|
|
434
|
-
"input": 0,
|
|
435
|
-
"output": 0,
|
|
436
|
-
"cacheRead": 0,
|
|
437
|
-
"cacheWrite": 0
|
|
438
|
-
}
|
|
439
|
-
},
|
|
440
470
|
"sourceful/riverflow-v2-pro": {
|
|
441
471
|
id: "sourceful/riverflow-v2-pro",
|
|
442
472
|
name: "Sourceful: Riverflow V2 Pro",
|
|
@@ -452,21 +482,6 @@ export const IMAGE_MODELS = {
|
|
|
452
482
|
"cacheWrite": 0
|
|
453
483
|
}
|
|
454
484
|
},
|
|
455
|
-
"sourceful/riverflow-v2-standard-preview": {
|
|
456
|
-
id: "sourceful/riverflow-v2-standard-preview",
|
|
457
|
-
name: "Sourceful: Riverflow V2 Standard Preview",
|
|
458
|
-
api: "openrouter-images",
|
|
459
|
-
provider: "openrouter",
|
|
460
|
-
baseUrl: "https://openrouter.ai/api/v1",
|
|
461
|
-
input: ["text", "image"],
|
|
462
|
-
output: ["image"],
|
|
463
|
-
cost: {
|
|
464
|
-
"input": 0,
|
|
465
|
-
"output": 0,
|
|
466
|
-
"cacheRead": 0,
|
|
467
|
-
"cacheWrite": 0
|
|
468
|
-
}
|
|
469
|
-
},
|
|
470
485
|
"sourceful/riverflow-v2.5-fast": {
|
|
471
486
|
id: "sourceful/riverflow-v2.5-fast",
|
|
472
487
|
name: "Sourceful: Riverflow V2.5 Fast",
|
|
@@ -81,16 +81,20 @@ class ImagesModelsImpl {
|
|
|
81
81
|
if (!provider) {
|
|
82
82
|
throw new ModelsError("provider", `Unknown provider: ${model.provider}`);
|
|
83
83
|
}
|
|
84
|
-
const resolution = await this.
|
|
84
|
+
const resolution = await resolveProviderAuth(provider, model, this.credentials, this.authContext, {
|
|
85
|
+
apiKey: options?.apiKey,
|
|
86
|
+
env: options?.env,
|
|
87
|
+
});
|
|
85
88
|
const auth = resolution?.auth;
|
|
86
89
|
if (!auth) {
|
|
87
90
|
return provider.generateImages(model, context, options);
|
|
88
91
|
}
|
|
89
92
|
const requestModel = auth.baseUrl ? { ...model, baseUrl: auth.baseUrl } : model;
|
|
90
|
-
// Explicit request options win per-field; headers merge per
|
|
93
|
+
// Explicit request options win per-field; headers/env merge per key.
|
|
91
94
|
const apiKey = options?.apiKey ?? auth.apiKey;
|
|
92
95
|
const headers = auth.headers || options?.headers ? { ...auth.headers, ...options?.headers } : undefined;
|
|
93
|
-
|
|
96
|
+
const env = resolution.env || options?.env ? { ...(resolution.env ?? {}), ...(options?.env ?? {}) } : undefined;
|
|
97
|
+
return await provider.generateImages(requestModel, context, { ...options, apiKey, headers, env });
|
|
94
98
|
}
|
|
95
99
|
catch (error) {
|
|
96
100
|
return {
|
|
@@ -13,6 +13,7 @@ export * from "./utils/diagnostics.js";
|
|
|
13
13
|
export * from "./utils/event-stream.js";
|
|
14
14
|
export * from "./utils/json-parse.js";
|
|
15
15
|
export * from "./utils/overflow.js";
|
|
16
|
+
export * from "./utils/retry.js";
|
|
16
17
|
export * from "./utils/typebox-helpers.js";
|
|
17
18
|
export * from "./utils/validation.js";
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { anthropicMessagesApi } from "./api/anthropic-messages.lazy.js";
|
|
2
|
+
import { azureOpenAIResponsesApi } from "./api/azure-openai-responses.lazy.js";
|
|
3
|
+
import { googleGenerativeAIApi } from "./api/google-generative-ai.lazy.js";
|
|
4
|
+
import { googleVertexApi } from "./api/google-vertex.lazy.js";
|
|
5
|
+
import { mistralConversationsApi } from "./api/mistral-conversations.lazy.js";
|
|
6
|
+
import { openAICodexResponsesApi } from "./api/openai-codex-responses.lazy.js";
|
|
7
|
+
import { openAICompletionsApi } from "./api/openai-completions.lazy.js";
|
|
8
|
+
import { openAIResponsesApi } from "./api/openai-responses.lazy.js";
|
|
9
|
+
const anthropicMessagesStreams = anthropicMessagesApi();
|
|
10
|
+
const azureOpenAIResponsesStreams = azureOpenAIResponsesApi();
|
|
11
|
+
const googleGenerativeAIStreams = googleGenerativeAIApi();
|
|
12
|
+
const googleVertexStreams = googleVertexApi();
|
|
13
|
+
const mistralConversationsStreams = mistralConversationsApi();
|
|
14
|
+
const openAICodexResponsesStreams = openAICodexResponsesApi();
|
|
15
|
+
const openAICompletionsStreams = openAICompletionsApi();
|
|
16
|
+
const openAIResponsesStreams = openAIResponsesApi();
|
|
17
|
+
/** @deprecated Use `stream` from `@earendil-works/pi-ai/api/anthropic-messages` or `anthropicMessagesApi().stream`. */
|
|
18
|
+
export const streamAnthropic = anthropicMessagesStreams.stream;
|
|
19
|
+
/** @deprecated Use `streamSimple` from `@earendil-works/pi-ai/api/anthropic-messages` or `anthropicMessagesApi().streamSimple`. */
|
|
20
|
+
export const streamSimpleAnthropic = anthropicMessagesStreams.streamSimple;
|
|
21
|
+
/** @deprecated Use `stream` from `@earendil-works/pi-ai/api/azure-openai-responses` or `azureOpenAIResponsesApi().stream`. */
|
|
22
|
+
export const streamAzureOpenAIResponses = azureOpenAIResponsesStreams.stream;
|
|
23
|
+
/** @deprecated Use `streamSimple` from `@earendil-works/pi-ai/api/azure-openai-responses` or `azureOpenAIResponsesApi().streamSimple`. */
|
|
24
|
+
export const streamSimpleAzureOpenAIResponses = azureOpenAIResponsesStreams.streamSimple;
|
|
25
|
+
/** @deprecated Use `stream` from `@earendil-works/pi-ai/api/google-generative-ai` or `googleGenerativeAIApi().stream`. */
|
|
26
|
+
export const streamGoogle = googleGenerativeAIStreams.stream;
|
|
27
|
+
/** @deprecated Use `streamSimple` from `@earendil-works/pi-ai/api/google-generative-ai` or `googleGenerativeAIApi().streamSimple`. */
|
|
28
|
+
export const streamSimpleGoogle = googleGenerativeAIStreams.streamSimple;
|
|
29
|
+
/** @deprecated Use `stream` from `@earendil-works/pi-ai/api/google-vertex` or `googleVertexApi().stream`. */
|
|
30
|
+
export const streamGoogleVertex = googleVertexStreams.stream;
|
|
31
|
+
/** @deprecated Use `streamSimple` from `@earendil-works/pi-ai/api/google-vertex` or `googleVertexApi().streamSimple`. */
|
|
32
|
+
export const streamSimpleGoogleVertex = googleVertexStreams.streamSimple;
|
|
33
|
+
/** @deprecated Use `stream` from `@earendil-works/pi-ai/api/mistral-conversations` or `mistralConversationsApi().stream`. */
|
|
34
|
+
export const streamMistral = mistralConversationsStreams.stream;
|
|
35
|
+
/** @deprecated Use `streamSimple` from `@earendil-works/pi-ai/api/mistral-conversations` or `mistralConversationsApi().streamSimple`. */
|
|
36
|
+
export const streamSimpleMistral = mistralConversationsStreams.streamSimple;
|
|
37
|
+
/** @deprecated Use `stream` from `@earendil-works/pi-ai/api/openai-codex-responses` or `openAICodexResponsesApi().stream`. */
|
|
38
|
+
export const streamOpenAICodexResponses = openAICodexResponsesStreams.stream;
|
|
39
|
+
/** @deprecated Use `streamSimple` from `@earendil-works/pi-ai/api/openai-codex-responses` or `openAICodexResponsesApi().streamSimple`. */
|
|
40
|
+
export const streamSimpleOpenAICodexResponses = openAICodexResponsesStreams.streamSimple;
|
|
41
|
+
/** @deprecated Use `stream` from `@earendil-works/pi-ai/api/openai-completions` or `openAICompletionsApi().stream`. */
|
|
42
|
+
export const streamOpenAICompletions = openAICompletionsStreams.stream;
|
|
43
|
+
/** @deprecated Use `streamSimple` from `@earendil-works/pi-ai/api/openai-completions` or `openAICompletionsApi().streamSimple`. */
|
|
44
|
+
export const streamSimpleOpenAICompletions = openAICompletionsStreams.streamSimple;
|
|
45
|
+
/** @deprecated Use `stream` from `@earendil-works/pi-ai/api/openai-responses` or `openAIResponsesApi().stream`. */
|
|
46
|
+
export const streamOpenAIResponses = openAIResponsesStreams.stream;
|
|
47
|
+
/** @deprecated Use `streamSimple` from `@earendil-works/pi-ai/api/openai-responses` or `openAIResponsesApi().streamSimple`. */
|
|
48
|
+
export const streamSimpleOpenAIResponses = openAIResponsesStreams.streamSimple;
|
|
49
|
+
//# sourceMappingURL=legacy-api-aliases.js.map
|
|
@@ -85,15 +85,19 @@ class ModelsImpl {
|
|
|
85
85
|
return provider;
|
|
86
86
|
}
|
|
87
87
|
async applyAuth(model, options) {
|
|
88
|
-
const resolution = await this.
|
|
88
|
+
const resolution = await resolveProviderAuth(this.requireProvider(model), model, this.credentials, this.authContext, {
|
|
89
|
+
apiKey: options?.apiKey,
|
|
90
|
+
env: options?.env,
|
|
91
|
+
});
|
|
89
92
|
const auth = resolution?.auth;
|
|
90
93
|
if (!auth)
|
|
91
94
|
return { requestModel: model, requestOptions: options };
|
|
92
95
|
const requestModel = auth.baseUrl ? { ...model, baseUrl: auth.baseUrl } : model;
|
|
93
|
-
// Explicit request options win per-field; headers merge per
|
|
96
|
+
// Explicit request options win per-field; headers/env merge per key.
|
|
94
97
|
const apiKey = options?.apiKey ?? auth.apiKey;
|
|
95
98
|
const headers = auth.headers || options?.headers ? { ...auth.headers, ...options?.headers } : undefined;
|
|
96
|
-
const
|
|
99
|
+
const env = resolution.env || options?.env ? { ...(resolution.env ?? {}), ...(options?.env ?? {}) } : undefined;
|
|
100
|
+
const requestOptions = { ...options, apiKey, headers, env };
|
|
97
101
|
return { requestModel, requestOptions };
|
|
98
102
|
}
|
|
99
103
|
stream(model, context, options) {
|