@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
|
@@ -323,9 +323,9 @@ function getAccountId(accessToken) {
|
|
|
323
323
|
return typeof accountId === "string" && accountId.length > 0 ? accountId : null;
|
|
324
324
|
}
|
|
325
325
|
function credentialsFromToken(token) {
|
|
326
|
-
const accountId = getAccountId(token.access)
|
|
326
|
+
const accountId = getAccountId(token.access);
|
|
327
327
|
if (!accountId) {
|
|
328
|
-
|
|
328
|
+
throw new Error("Failed to extract accountId from token");
|
|
329
329
|
}
|
|
330
330
|
return {
|
|
331
331
|
access: token.access,
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
* - GitHub Copilot: "prompt token count of X exceeds the limit of Y"
|
|
23
23
|
* - MiniMax: "invalid params, context window exceeds limit"
|
|
24
24
|
* - Kimi For Coding: "Your request exceeded model token limit: X (requested: Y)"
|
|
25
|
+
* - DS4: "Prompt has X tokens, but the configured context size is Y tokens"
|
|
25
26
|
* - Cerebras: "400/413 status code (no body)"
|
|
26
27
|
* - Mistral: "Prompt contains X tokens ... too large for model with Y maximum context length"
|
|
27
28
|
* - z.ai: Does NOT error, accepts overflow silently - handled via usage.input > contextWindow
|
|
@@ -48,6 +49,7 @@ const OVERFLOW_PATTERNS = [
|
|
|
48
49
|
/context window exceeds limit/i, // MiniMax
|
|
49
50
|
/exceeded model token limit/i, // Kimi For Coding
|
|
50
51
|
/too large for model with \d+ maximum context length/i, // Mistral
|
|
52
|
+
/prompt has [\d,]+ tokens?, but the configured context size is [\d,]+ tokens?/i, // DS4 server
|
|
51
53
|
/model_context_window_exceeded/i, // z.ai non-standard finish_reason surfaced as error text
|
|
52
54
|
/prompt too long; exceeded (?:max )?context length/i, // Ollama explicit overflow error
|
|
53
55
|
/context[_ ]length[_ ]exceeded/i, // Generic fallback
|
|
@@ -94,6 +96,7 @@ const NON_OVERFLOW_PATTERNS = [
|
|
|
94
96
|
* - llama.cpp: "exceeds the available context size"
|
|
95
97
|
* - LM Studio: "greater than the context length"
|
|
96
98
|
* - Kimi For Coding: "exceeded model token limit: X (requested: Y)"
|
|
99
|
+
* - DS4: "Prompt has X tokens, but the configured context size is Y tokens"
|
|
97
100
|
*
|
|
98
101
|
* **Unreliable detection:**
|
|
99
102
|
* - z.ai: Sometimes accepts overflow silently (detectable via usage.input > contextWindow),
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
function buildProviderErrorPattern(patterns) {
|
|
2
|
+
return new RegExp(patterns.join("|"), "i");
|
|
3
|
+
}
|
|
4
|
+
const NON_RETRYABLE_PROVIDER_LIMIT_ERROR_PATTERN = buildProviderErrorPattern([
|
|
5
|
+
// OpenCode Go/free-tier limits returned as 429 JSON error types by OpenCode's
|
|
6
|
+
// Zen API. These are subscription/account limits, not transient throttles.
|
|
7
|
+
"GoUsageLimitError",
|
|
8
|
+
"FreeUsageLimitError",
|
|
9
|
+
// OpenCode Go subscription-limit text asks users to enable available-balance
|
|
10
|
+
// usage after rolling/weekly/monthly limits are reached.
|
|
11
|
+
"Monthly usage limit reached",
|
|
12
|
+
"available balance",
|
|
13
|
+
// Generic quota/budget/billing exhaustion. `insufficient_quota` is OpenAI's
|
|
14
|
+
// quota/billing error code; the other strings cover common gateway wording.
|
|
15
|
+
"insufficient_quota",
|
|
16
|
+
"out of budget",
|
|
17
|
+
"quota exceeded",
|
|
18
|
+
"billing",
|
|
19
|
+
]);
|
|
20
|
+
const RETRYABLE_PROVIDER_ERROR_PATTERN = buildProviderErrorPattern([
|
|
21
|
+
// Generic provider load, HTTP status, and server-side transient failures.
|
|
22
|
+
"overloaded",
|
|
23
|
+
"rate.?limit",
|
|
24
|
+
"too many requests",
|
|
25
|
+
"429",
|
|
26
|
+
"500",
|
|
27
|
+
"502",
|
|
28
|
+
"503",
|
|
29
|
+
"504",
|
|
30
|
+
"524",
|
|
31
|
+
"service.?unavailable",
|
|
32
|
+
"server.?error",
|
|
33
|
+
"internal.?error",
|
|
34
|
+
// Wrapper/provider text for transient upstream failures, including OpenRouter
|
|
35
|
+
// "Provider returned error" responses (#2264).
|
|
36
|
+
"provider.?returned.?error",
|
|
37
|
+
// Network, proxy, and fetch transport failures. This includes OpenAI Codex
|
|
38
|
+
// raw-fetch failures such as "upstream connect", "connection refused", and
|
|
39
|
+
// "reset before headers" (#733), plus OpenRouter connection drops (#3317).
|
|
40
|
+
"network.?error",
|
|
41
|
+
"connection.?error",
|
|
42
|
+
"connection.?refused",
|
|
43
|
+
"connection.?lost",
|
|
44
|
+
"other side closed",
|
|
45
|
+
"fetch failed",
|
|
46
|
+
"upstream.?connect",
|
|
47
|
+
"reset before headers",
|
|
48
|
+
"socket hang up",
|
|
49
|
+
"timed? out",
|
|
50
|
+
"timeout",
|
|
51
|
+
"terminated",
|
|
52
|
+
// WebSocket transports can report close/error text instead of HTTP/fetch text.
|
|
53
|
+
"websocket.?closed",
|
|
54
|
+
"websocket.?error",
|
|
55
|
+
// Premature stream endings from SDKs and transports. Anthropic can throw
|
|
56
|
+
// "stream ended without ..." and "Anthropic stream ended before message_stop"
|
|
57
|
+
// (#4433); Bedrock/Smithy can throw an HTTP/2 no-response error (#3594).
|
|
58
|
+
"ended without",
|
|
59
|
+
"stream ended before message_stop",
|
|
60
|
+
"http2 request did not get a response",
|
|
61
|
+
// Provider-requested retry delay cap failures should flow through the outer
|
|
62
|
+
// retry policy so callers can surface/abort the backoff (#1123).
|
|
63
|
+
"retry delay",
|
|
64
|
+
// Explicit retry guidance emitted mid-stream by OpenAI Responses and Bedrock
|
|
65
|
+
// stream exceptions (#6019).
|
|
66
|
+
"you can retry your request",
|
|
67
|
+
"try your request again",
|
|
68
|
+
"please retry your request",
|
|
69
|
+
]);
|
|
70
|
+
/**
|
|
71
|
+
* Classifies whether a failed assistant message looks like a transient provider
|
|
72
|
+
* or transport error, so callers can decide if the last assistant turn should be
|
|
73
|
+
* restarted.
|
|
74
|
+
*
|
|
75
|
+
* This does not implement retry policy. Callers should first handle context
|
|
76
|
+
* overflow separately, then apply their own retry budget, backoff, and reporting
|
|
77
|
+
* before restarting the assistant turn.
|
|
78
|
+
*/
|
|
79
|
+
export function isRetryableAssistantError(message) {
|
|
80
|
+
if (message.stopReason !== "error" || !message.errorMessage)
|
|
81
|
+
return false;
|
|
82
|
+
const errorMessage = message.errorMessage;
|
|
83
|
+
if (NON_RETRYABLE_PROVIDER_LIMIT_ERROR_PATTERN.test(errorMessage))
|
|
84
|
+
return false;
|
|
85
|
+
return RETRYABLE_PROVIDER_ERROR_PATTERN.test(errorMessage);
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=retry.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@earendil-works/pi-ai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.80.3",
|
|
4
4
|
"description": "Unified LLM API with automatic model discovery and provider configuration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -27,38 +27,6 @@
|
|
|
27
27
|
"types": "./dist/api/*.d.ts",
|
|
28
28
|
"import": "./dist/api/*.js"
|
|
29
29
|
},
|
|
30
|
-
"./anthropic": {
|
|
31
|
-
"types": "./dist/api/anthropic-messages.d.ts",
|
|
32
|
-
"import": "./dist/api/anthropic-messages.js"
|
|
33
|
-
},
|
|
34
|
-
"./azure-openai-responses": {
|
|
35
|
-
"types": "./dist/api/azure-openai-responses.d.ts",
|
|
36
|
-
"import": "./dist/api/azure-openai-responses.js"
|
|
37
|
-
},
|
|
38
|
-
"./google": {
|
|
39
|
-
"types": "./dist/api/google-generative-ai.d.ts",
|
|
40
|
-
"import": "./dist/api/google-generative-ai.js"
|
|
41
|
-
},
|
|
42
|
-
"./google-vertex": {
|
|
43
|
-
"types": "./dist/api/google-vertex.d.ts",
|
|
44
|
-
"import": "./dist/api/google-vertex.js"
|
|
45
|
-
},
|
|
46
|
-
"./mistral": {
|
|
47
|
-
"types": "./dist/api/mistral-conversations.d.ts",
|
|
48
|
-
"import": "./dist/api/mistral-conversations.js"
|
|
49
|
-
},
|
|
50
|
-
"./openai-codex-responses": {
|
|
51
|
-
"types": "./dist/api/openai-codex-responses.d.ts",
|
|
52
|
-
"import": "./dist/api/openai-codex-responses.js"
|
|
53
|
-
},
|
|
54
|
-
"./openai-completions": {
|
|
55
|
-
"types": "./dist/api/openai-completions.d.ts",
|
|
56
|
-
"import": "./dist/api/openai-completions.js"
|
|
57
|
-
},
|
|
58
|
-
"./openai-responses": {
|
|
59
|
-
"types": "./dist/api/openai-responses.d.ts",
|
|
60
|
-
"import": "./dist/api/openai-responses.js"
|
|
61
|
-
},
|
|
62
30
|
"./oauth": {
|
|
63
31
|
"types": "./dist/oauth.d.ts",
|
|
64
32
|
"import": "./dist/oauth.js"
|
|
@@ -5,7 +5,7 @@ import { access, readFile, stat } from "node:fs/promises";
|
|
|
5
5
|
import chalk from "chalk";
|
|
6
6
|
import { resolve } from "path";
|
|
7
7
|
import { resolveReadPath } from "../core/tools/path-utils.js";
|
|
8
|
-
import {
|
|
8
|
+
import { processImage } from "../utils/image-process.js";
|
|
9
9
|
import { detectSupportedImageMimeTypeFromFile } from "../utils/mime.js";
|
|
10
10
|
/** Process @file arguments into text content and image attachments */
|
|
11
11
|
export async function processFileArguments(fileArgs, options) {
|
|
@@ -33,32 +33,20 @@ export async function processFileArguments(fileArgs, options) {
|
|
|
33
33
|
if (mimeType) {
|
|
34
34
|
// Handle image file
|
|
35
35
|
const content = await readFile(absolutePath);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (!resized) {
|
|
41
|
-
text += `<file name="${absolutePath}">[Image omitted: could not be resized below the inline image size limit.]</file>\n`;
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
dimensionNote = formatDimensionNote(resized);
|
|
45
|
-
attachment = {
|
|
46
|
-
type: "image",
|
|
47
|
-
mimeType: resized.mimeType,
|
|
48
|
-
data: resized.data,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
attachment = {
|
|
53
|
-
type: "image",
|
|
54
|
-
mimeType,
|
|
55
|
-
data: content.toString("base64"),
|
|
56
|
-
};
|
|
36
|
+
const processed = await processImage(content, mimeType, { autoResizeImages });
|
|
37
|
+
if (!processed.ok) {
|
|
38
|
+
text += `<file name="${absolutePath}">${processed.message}</file>\n`;
|
|
39
|
+
continue;
|
|
57
40
|
}
|
|
41
|
+
const attachment = {
|
|
42
|
+
type: "image",
|
|
43
|
+
mimeType: processed.mimeType,
|
|
44
|
+
data: processed.data,
|
|
45
|
+
};
|
|
58
46
|
images.push(attachment);
|
|
59
|
-
// Add text reference to image with optional
|
|
60
|
-
if (
|
|
61
|
-
text += `<file name="${absolutePath}">${
|
|
47
|
+
// Add text reference to image with optional processing hints
|
|
48
|
+
if (processed.hints.length > 0) {
|
|
49
|
+
text += `<file name="${absolutePath}">${processed.hints.join("\n")}</file>\n`;
|
|
62
50
|
}
|
|
63
51
|
else {
|
|
64
52
|
text += `<file name="${absolutePath}"></file>\n`;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
16
16
|
import { basename, dirname } from "node:path";
|
|
17
|
-
import { clampThinkingLevel, cleanupSessionResources, getSupportedThinkingLevels, isContextOverflow, modelsAreEqual, resetApiProviders, streamSimple, } from "@earendil-works/pi-ai/compat";
|
|
17
|
+
import { clampThinkingLevel, cleanupSessionResources, getSupportedThinkingLevels, isContextOverflow, isRetryableAssistantError, modelsAreEqual, resetApiProviders, streamSimple, } from "@earendil-works/pi-ai/compat";
|
|
18
18
|
import { getThemeByName, theme } from "../modes/interactive/theme/theme.js";
|
|
19
19
|
import { stripFrontmatter } from "../utils/frontmatter.js";
|
|
20
20
|
import { resolvePath } from "../utils/paths.js";
|
|
@@ -120,6 +120,7 @@ export class AgentSession {
|
|
|
120
120
|
// Base system prompt (without extension appends) - used to apply fresh appends each turn
|
|
121
121
|
_baseSystemPrompt = "";
|
|
122
122
|
_baseSystemPromptOptions;
|
|
123
|
+
_systemPromptOverride;
|
|
123
124
|
constructor(config) {
|
|
124
125
|
this.agent = config.agent;
|
|
125
126
|
this.sessionManager = config.sessionManager;
|
|
@@ -139,6 +140,7 @@ export class AgentSession {
|
|
|
139
140
|
// (session persistence, extensions, auto-compaction, retry logic)
|
|
140
141
|
this._unsubscribeAgent = this.agent.subscribe(this._handleAgentEvent);
|
|
141
142
|
this._installAgentToolHooks();
|
|
143
|
+
this._installAgentNextTurnRefresh();
|
|
142
144
|
this._buildRuntime({
|
|
143
145
|
activeToolNames: this._initialActiveToolNames,
|
|
144
146
|
includeAllExtensionTools: true,
|
|
@@ -227,6 +229,26 @@ export class AgentSession {
|
|
|
227
229
|
};
|
|
228
230
|
};
|
|
229
231
|
}
|
|
232
|
+
_installAgentNextTurnRefresh() {
|
|
233
|
+
const previousPrepareNextTurnWithContext = this.agent.prepareNextTurnWithContext ??
|
|
234
|
+
(this.agent.prepareNextTurn
|
|
235
|
+
? async (_turn, signal) => await this.agent.prepareNextTurn?.(signal)
|
|
236
|
+
: undefined);
|
|
237
|
+
this.agent.prepareNextTurnWithContext = async (turn, signal) => {
|
|
238
|
+
const previousSnapshot = await previousPrepareNextTurnWithContext?.(turn, signal);
|
|
239
|
+
const previousContext = previousSnapshot?.context ?? turn.context;
|
|
240
|
+
return {
|
|
241
|
+
...previousSnapshot,
|
|
242
|
+
context: {
|
|
243
|
+
...previousContext,
|
|
244
|
+
systemPrompt: this._systemPromptOverride ?? this._baseSystemPrompt,
|
|
245
|
+
tools: this.agent.state.tools.slice(),
|
|
246
|
+
},
|
|
247
|
+
model: this.agent.state.model,
|
|
248
|
+
thinkingLevel: this.agent.state.thinkingLevel,
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
}
|
|
230
252
|
// =========================================================================
|
|
231
253
|
// Event Subscription
|
|
232
254
|
// =========================================================================
|
|
@@ -560,7 +582,7 @@ export class AgentSession {
|
|
|
560
582
|
this.agent.state.tools = tools;
|
|
561
583
|
// Rebuild base system prompt with new tool set
|
|
562
584
|
this._baseSystemPrompt = this._rebuildSystemPrompt(validToolNames);
|
|
563
|
-
this.agent.state.systemPrompt = this._baseSystemPrompt;
|
|
585
|
+
this.agent.state.systemPrompt = this._systemPromptOverride ?? this._baseSystemPrompt;
|
|
564
586
|
}
|
|
565
587
|
/** Whether compaction or branch summarization is currently running */
|
|
566
588
|
get isCompacting() {
|
|
@@ -668,6 +690,7 @@ export class AgentSession {
|
|
|
668
690
|
}
|
|
669
691
|
}
|
|
670
692
|
finally {
|
|
693
|
+
this._systemPromptOverride = undefined;
|
|
671
694
|
this._flushPendingBashMessages();
|
|
672
695
|
}
|
|
673
696
|
}
|
|
@@ -769,18 +792,11 @@ export class AgentSession {
|
|
|
769
792
|
}
|
|
770
793
|
throw new Error(formatNoApiKeyFoundMessage(this.model.provider));
|
|
771
794
|
}
|
|
772
|
-
// Check if we need to compact before sending (catches aborted responses)
|
|
795
|
+
// Check if we need to compact before sending (catches aborted responses).
|
|
796
|
+
// The user's new prompt is sent below, so do not call agent.continue() here.
|
|
773
797
|
const lastAssistant = this._findLastAssistantMessage();
|
|
774
|
-
if (lastAssistant
|
|
775
|
-
|
|
776
|
-
await this.agent.continue();
|
|
777
|
-
while (await this._handlePostAgentRun()) {
|
|
778
|
-
await this.agent.continue();
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
finally {
|
|
782
|
-
this._flushPendingBashMessages();
|
|
783
|
-
}
|
|
798
|
+
if (lastAssistant) {
|
|
799
|
+
await this._checkCompaction(lastAssistant, false);
|
|
784
800
|
}
|
|
785
801
|
// Build messages array (custom message if any, then user message)
|
|
786
802
|
messages = [];
|
|
@@ -815,11 +831,13 @@ export class AgentSession {
|
|
|
815
831
|
}
|
|
816
832
|
}
|
|
817
833
|
// Apply extension-modified system prompt, or reset to base
|
|
818
|
-
if (result?.systemPrompt) {
|
|
834
|
+
if (result?.systemPrompt !== undefined) {
|
|
835
|
+
this._systemPromptOverride = result.systemPrompt;
|
|
819
836
|
this.agent.state.systemPrompt = result.systemPrompt;
|
|
820
837
|
}
|
|
821
838
|
else {
|
|
822
839
|
// Ensure we're using the base prompt (in case previous turn had modifications)
|
|
840
|
+
this._systemPromptOverride = undefined;
|
|
823
841
|
this.agent.state.systemPrompt = this._baseSystemPrompt;
|
|
824
842
|
}
|
|
825
843
|
}
|
|
@@ -1459,10 +1477,12 @@ export class AgentSession {
|
|
|
1459
1477
|
return await this._runAutoCompaction("overflow", willRetry);
|
|
1460
1478
|
}
|
|
1461
1479
|
// Case 2: Threshold - context is getting large
|
|
1462
|
-
// For error messages
|
|
1463
|
-
// This ensures sessions that hit persistent API errors (e.g. 529)
|
|
1480
|
+
// For error messages or all-zero usage messages, estimate from the last valid response.
|
|
1481
|
+
// This ensures sessions that hit persistent API errors (e.g. 529) or malformed zero-usage
|
|
1482
|
+
// responses can still compact and do not reset context accounting.
|
|
1464
1483
|
let contextTokens;
|
|
1465
|
-
|
|
1484
|
+
const directContextTokens = assistantMessage.usage ? calculateContextTokens(assistantMessage.usage) : 0;
|
|
1485
|
+
if (assistantMessage.stopReason === "error" || directContextTokens === 0) {
|
|
1466
1486
|
const messages = this.agent.state.messages;
|
|
1467
1487
|
const estimate = estimateContextTokens(messages);
|
|
1468
1488
|
if (estimate.lastUsageIndex === null)
|
|
@@ -1479,7 +1499,7 @@ export class AgentSession {
|
|
|
1479
1499
|
contextTokens = estimate.tokens;
|
|
1480
1500
|
}
|
|
1481
1501
|
else {
|
|
1482
|
-
contextTokens =
|
|
1502
|
+
contextTokens = directContextTokens;
|
|
1483
1503
|
}
|
|
1484
1504
|
if (shouldCompact(contextTokens, contextWindow, settings)) {
|
|
1485
1505
|
return await this._runAutoCompaction("threshold", false);
|
|
@@ -1765,7 +1785,11 @@ export class AgentSession {
|
|
|
1765
1785
|
});
|
|
1766
1786
|
},
|
|
1767
1787
|
appendEntry: (customType, data) => {
|
|
1768
|
-
this.sessionManager.appendCustomEntry(customType, data);
|
|
1788
|
+
const entryId = this.sessionManager.appendCustomEntry(customType, data);
|
|
1789
|
+
const entry = this.sessionManager.getEntry(entryId);
|
|
1790
|
+
if (entry) {
|
|
1791
|
+
this._emit({ type: "entry_appended", entry });
|
|
1792
|
+
}
|
|
1769
1793
|
},
|
|
1770
1794
|
setSessionName: (name) => {
|
|
1771
1795
|
this.setSessionName(name);
|
|
@@ -1968,25 +1992,15 @@ export class AgentSession {
|
|
|
1968
1992
|
// =========================================================================
|
|
1969
1993
|
// Auto-Retry
|
|
1970
1994
|
// =========================================================================
|
|
1971
|
-
_isNonRetryableProviderLimitError(errorMessage) {
|
|
1972
|
-
return /GoUsageLimitError|FreeUsageLimitError|Monthly usage limit reached|available balance|insufficient_quota|out of budget|quota exceeded|billing/i.test(errorMessage);
|
|
1973
|
-
}
|
|
1974
1995
|
/**
|
|
1975
1996
|
* Check if an error is retryable (overloaded, rate limit, server errors).
|
|
1976
1997
|
* Context overflow errors are NOT retryable (handled by compaction instead).
|
|
1977
1998
|
*/
|
|
1978
1999
|
_isRetryableError(message) {
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
// Context overflow is handled by compaction, not retry
|
|
1982
|
-
const contextWindow = this.model?.contextWindow ?? 0;
|
|
1983
|
-
if (isContextOverflow(message, contextWindow))
|
|
1984
|
-
return false;
|
|
1985
|
-
const err = message.errorMessage;
|
|
1986
|
-
if (this._isNonRetryableProviderLimitError(err))
|
|
2000
|
+
// Context overflow is handled by compaction, not retry.
|
|
2001
|
+
if (isContextOverflow(message, this.model?.contextWindow ?? 0))
|
|
1987
2002
|
return false;
|
|
1988
|
-
|
|
1989
|
-
return /overloaded|provider.?returned.?error|rate.?limit|too many requests|429|500|502|503|504|service.?unavailable|server.?error|internal.?error|network.?error|connection.?error|connection.?refused|connection.?lost|websocket.?closed|websocket.?error|other side closed|fetch failed|upstream.?connect|reset before headers|socket hang up|ended without|stream ended before message_stop|http2 request did not get a response|timed? out|timeout|terminated|retry delay/i.test(err);
|
|
2003
|
+
return isRetryableAssistantError(message);
|
|
1990
2004
|
}
|
|
1991
2005
|
/**
|
|
1992
2006
|
* Prepare a retryable error for continuation with exponential backoff.
|
|
@@ -2152,7 +2166,9 @@ export class AgentSession {
|
|
|
2152
2166
|
*/
|
|
2153
2167
|
setSessionName(name) {
|
|
2154
2168
|
this.sessionManager.appendSessionInfo(name);
|
|
2155
|
-
|
|
2169
|
+
const event = { type: "session_info_changed", name: this.sessionManager.getSessionName() };
|
|
2170
|
+
this._emit(event);
|
|
2171
|
+
void this._extensionRunner.emit(event);
|
|
2156
2172
|
}
|
|
2157
2173
|
// =========================================================================
|
|
2158
2174
|
// Tree Navigation
|
|
@@ -2424,8 +2440,8 @@ export class AgentSession {
|
|
|
2424
2440
|
const contextTokens = calculateContextTokens(assistant.usage);
|
|
2425
2441
|
if (contextTokens > 0) {
|
|
2426
2442
|
hasPostCompactionUsage = true;
|
|
2443
|
+
break;
|
|
2427
2444
|
}
|
|
2428
|
-
break;
|
|
2429
2445
|
}
|
|
2430
2446
|
}
|
|
2431
2447
|
}
|
|
@@ -208,9 +208,15 @@ export class AuthStorage {
|
|
|
208
208
|
}
|
|
209
209
|
persistProviderChange(provider, credential) {
|
|
210
210
|
if (this.loadError) {
|
|
211
|
-
|
|
211
|
+
this.reload();
|
|
212
|
+
}
|
|
213
|
+
if (this.loadError) {
|
|
214
|
+
const error = new Error(`Cannot update auth storage because it could not be loaded: ${this.loadError.message}`);
|
|
215
|
+
this.recordError(error);
|
|
216
|
+
throw error;
|
|
212
217
|
}
|
|
213
218
|
try {
|
|
219
|
+
let persistedData = {};
|
|
214
220
|
this.storage.withLock((current) => {
|
|
215
221
|
const currentData = this.parseStorageData(current);
|
|
216
222
|
const merged = { ...currentData };
|
|
@@ -220,11 +226,15 @@ export class AuthStorage {
|
|
|
220
226
|
else {
|
|
221
227
|
delete merged[provider];
|
|
222
228
|
}
|
|
229
|
+
persistedData = merged;
|
|
223
230
|
return { result: undefined, next: JSON.stringify(merged, null, 2) };
|
|
224
231
|
});
|
|
232
|
+
this.loadError = null;
|
|
233
|
+
return persistedData;
|
|
225
234
|
}
|
|
226
235
|
catch (error) {
|
|
227
236
|
this.recordError(error);
|
|
237
|
+
throw error;
|
|
228
238
|
}
|
|
229
239
|
}
|
|
230
240
|
/**
|
|
@@ -244,15 +254,13 @@ export class AuthStorage {
|
|
|
244
254
|
* Set credential for a provider.
|
|
245
255
|
*/
|
|
246
256
|
set(provider, credential) {
|
|
247
|
-
this.data
|
|
248
|
-
this.persistProviderChange(provider, credential);
|
|
257
|
+
this.data = this.persistProviderChange(provider, credential);
|
|
249
258
|
}
|
|
250
259
|
/**
|
|
251
260
|
* Remove credential for a provider.
|
|
252
261
|
*/
|
|
253
262
|
remove(provider) {
|
|
254
|
-
|
|
255
|
-
this.persistProviderChange(provider, undefined);
|
|
263
|
+
this.data = this.persistProviderChange(provider, undefined);
|
|
256
264
|
}
|
|
257
265
|
/**
|
|
258
266
|
* List all providers with credentials.
|
|
@@ -80,19 +80,22 @@ export function calculateContextTokens(usage) {
|
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
82
|
* Get usage from an assistant message if available.
|
|
83
|
-
* Skips aborted and
|
|
83
|
+
* Skips aborted, error, and all-zero usage messages as they don't have valid usage data.
|
|
84
84
|
*/
|
|
85
85
|
function getAssistantUsage(msg) {
|
|
86
86
|
if (msg.role === "assistant" && "usage" in msg) {
|
|
87
87
|
const assistantMsg = msg;
|
|
88
|
-
if (assistantMsg.stopReason !== "aborted" &&
|
|
88
|
+
if (assistantMsg.stopReason !== "aborted" &&
|
|
89
|
+
assistantMsg.stopReason !== "error" &&
|
|
90
|
+
assistantMsg.usage &&
|
|
91
|
+
calculateContextTokens(assistantMsg.usage) > 0) {
|
|
89
92
|
return assistantMsg.usage;
|
|
90
93
|
}
|
|
91
94
|
}
|
|
92
95
|
return undefined;
|
|
93
96
|
}
|
|
94
97
|
/**
|
|
95
|
-
* Find the last
|
|
98
|
+
* Find the last valid assistant message usage from session entries.
|
|
96
99
|
*/
|
|
97
100
|
export function getLastAssistantUsage(entries) {
|
|
98
101
|
for (let i = entries.length - 1; i >= 0; i--) {
|
|
@@ -565,16 +568,13 @@ Be concise. Focus on what's needed to understand the kept suffix.`;
|
|
|
565
568
|
*/
|
|
566
569
|
export async function compact(preparation, model, apiKey, headers, customInstructions, signal, thinkingLevel, streamFn, env) {
|
|
567
570
|
const { firstKeptEntryId, messagesToSummarize, turnPrefixMessages, isSplitTurn, tokensBefore, previousSummary, fileOps, settings, } = preparation;
|
|
568
|
-
// Generate summaries
|
|
571
|
+
// Generate summaries and merge into one
|
|
569
572
|
let summary;
|
|
570
573
|
if (isSplitTurn && turnPrefixMessages.length > 0) {
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
: Promise.resolve("No prior history."),
|
|
576
|
-
generateTurnPrefixSummary(turnPrefixMessages, model, settings.reserveTokens, apiKey, headers, env, signal, thinkingLevel, streamFn),
|
|
577
|
-
]);
|
|
574
|
+
const historyResult = messagesToSummarize.length > 0
|
|
575
|
+
? await generateSummary(messagesToSummarize, model, settings.reserveTokens, apiKey, headers, signal, customInstructions, previousSummary, thinkingLevel, streamFn, env)
|
|
576
|
+
: "No prior history.";
|
|
577
|
+
const turnPrefixResult = await generateTurnPrefixSummary(turnPrefixMessages, model, settings.reserveTokens, apiKey, headers, env, signal, thinkingLevel, streamFn);
|
|
578
578
|
// Merge into single summary
|
|
579
579
|
summary = `${historyResult}\n\n---\n\n**Turn Context (split turn):**\n\n${turnPrefixResult}`;
|
|
580
580
|
}
|
|
@@ -25,6 +25,7 @@ import { resolvePath } from "../../utils/paths.js";
|
|
|
25
25
|
import { createEventBus } from "../event-bus.js";
|
|
26
26
|
import { execCommand } from "../exec.js";
|
|
27
27
|
import { createSyntheticSourceInfo } from "../source-info.js";
|
|
28
|
+
import { time } from "../timings.js";
|
|
28
29
|
/** Modules available to extensions via virtualModules (for compiled Bun binary) */
|
|
29
30
|
const VIRTUAL_MODULES = {
|
|
30
31
|
typebox: _bundledTypebox,
|
|
@@ -153,7 +154,7 @@ export function createExtensionRuntime() {
|
|
|
153
154
|
invalidate: (message) => {
|
|
154
155
|
state.staleMessage ??=
|
|
155
156
|
message ??
|
|
156
|
-
"This extension ctx is stale after session replacement or reload. Do not use a captured
|
|
157
|
+
"This extension ctx is stale after session replacement or reload. Do not use a captured pi or command ctx after ctx.newSession(), ctx.fork(), ctx.switchSession(), or ctx.reload(). For newSession, fork, and switchSession, move post-replacement work into withSession and use the ctx passed to withSession. For reload, do not use the old ctx after await ctx.reload().";
|
|
157
158
|
},
|
|
158
159
|
// Pre-bind: queue registrations so bindCore() can flush them once the
|
|
159
160
|
// model registry is available. bindCore() replaces both with direct calls.
|
|
@@ -211,6 +212,11 @@ function createExtensionAPI(extension, runtime, cwd, eventBus) {
|
|
|
211
212
|
runtime.assertActive();
|
|
212
213
|
extension.messageRenderers.set(customType, renderer);
|
|
213
214
|
},
|
|
215
|
+
registerEntryRenderer(customType, renderer) {
|
|
216
|
+
runtime.assertActive();
|
|
217
|
+
extension.entryRenderers ??= new Map();
|
|
218
|
+
extension.entryRenderers.set(customType, renderer);
|
|
219
|
+
},
|
|
214
220
|
// Flag access - checks extension registered it, reads from runtime
|
|
215
221
|
getFlag(name) {
|
|
216
222
|
runtime.assertActive();
|
|
@@ -331,6 +337,7 @@ function createExtension(extensionPath, resolvedPath) {
|
|
|
331
337
|
handlers: new Map(),
|
|
332
338
|
tools: new Map(),
|
|
333
339
|
messageRenderers: new Map(),
|
|
340
|
+
entryRenderers: new Map(),
|
|
334
341
|
commands: new Map(),
|
|
335
342
|
flags: new Map(),
|
|
336
343
|
shortcuts: new Map(),
|
|
@@ -340,12 +347,14 @@ async function loadExtension(extensionPath, cwd, eventBus, runtime, cacheToken)
|
|
|
340
347
|
const resolvedPath = resolvePath(extensionPath, cwd, { normalizeUnicodeSpaces: true });
|
|
341
348
|
try {
|
|
342
349
|
const factory = await loadExtensionModule(resolvedPath, cacheToken);
|
|
350
|
+
time(`${extensionPath} module import`, "extensions");
|
|
343
351
|
if (!factory) {
|
|
344
352
|
return { extension: null, error: `Extension does not export a valid factory function: ${extensionPath}` };
|
|
345
353
|
}
|
|
346
354
|
const extension = createExtension(extensionPath, resolvedPath);
|
|
347
355
|
const api = createExtensionAPI(extension, runtime, cwd, eventBus);
|
|
348
356
|
await factory(api);
|
|
357
|
+
time(`${extensionPath} factory`, "extensions");
|
|
349
358
|
return { extension, error: null };
|
|
350
359
|
}
|
|
351
360
|
catch (err) {
|
|
@@ -361,6 +370,7 @@ export async function loadExtensionFromFactory(factory, cwd, eventBus, runtime,
|
|
|
361
370
|
const resolvedCwd = resolvePath(cwd);
|
|
362
371
|
const api = createExtensionAPI(extension, runtime, resolvedCwd, eventBus);
|
|
363
372
|
await factory(api);
|
|
373
|
+
time(`${extensionPath} factory`, "extensions");
|
|
364
374
|
return extension;
|
|
365
375
|
}
|
|
366
376
|
/**
|
|
@@ -45,6 +45,23 @@ const buildBuiltinKeybindings = (resolvedKeybindings) => {
|
|
|
45
45
|
}
|
|
46
46
|
return builtinKeybindings;
|
|
47
47
|
};
|
|
48
|
+
async function callContextHandlerAbortable(fn, signal) {
|
|
49
|
+
if (signal.aborted) {
|
|
50
|
+
throw new Error("Agent run aborted");
|
|
51
|
+
}
|
|
52
|
+
let cleanup = () => { };
|
|
53
|
+
const abortPromise = new Promise((_resolve, reject) => {
|
|
54
|
+
const onAbort = () => reject(new Error("Agent run aborted"));
|
|
55
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
56
|
+
cleanup = () => signal.removeEventListener("abort", onAbort);
|
|
57
|
+
});
|
|
58
|
+
try {
|
|
59
|
+
return await Promise.race([Promise.resolve().then(fn), abortPromise]);
|
|
60
|
+
}
|
|
61
|
+
finally {
|
|
62
|
+
cleanup();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
48
65
|
/**
|
|
49
66
|
* Helper function to emit session_shutdown event to extensions.
|
|
50
67
|
* Returns true if the event was emitted, false if there were no handlers.
|
|
@@ -358,6 +375,15 @@ export class ExtensionRunner {
|
|
|
358
375
|
}
|
|
359
376
|
return undefined;
|
|
360
377
|
}
|
|
378
|
+
getEntryRenderer(customType) {
|
|
379
|
+
for (const ext of this.extensions) {
|
|
380
|
+
const renderer = ext.entryRenderers?.get(customType);
|
|
381
|
+
if (renderer) {
|
|
382
|
+
return renderer;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
return undefined;
|
|
386
|
+
}
|
|
361
387
|
resolveRegisteredCommands() {
|
|
362
388
|
const commands = [];
|
|
363
389
|
const counts = new Map();
|
|
@@ -684,6 +710,7 @@ export class ExtensionRunner {
|
|
|
684
710
|
}
|
|
685
711
|
async emitContext(messages) {
|
|
686
712
|
const ctx = this.createContext();
|
|
713
|
+
const signal = ctx.signal;
|
|
687
714
|
let currentMessages = structuredClone(messages);
|
|
688
715
|
for (const ext of this.extensions) {
|
|
689
716
|
const handlers = ext.handlers.get("context");
|
|
@@ -692,12 +719,17 @@ export class ExtensionRunner {
|
|
|
692
719
|
for (const handler of handlers) {
|
|
693
720
|
try {
|
|
694
721
|
const event = { type: "context", messages: currentMessages };
|
|
695
|
-
const handlerResult =
|
|
722
|
+
const handlerResult = signal
|
|
723
|
+
? await callContextHandlerAbortable(() => handler(event, ctx), signal)
|
|
724
|
+
: await handler(event, ctx);
|
|
696
725
|
if (handlerResult && handlerResult.messages) {
|
|
697
726
|
currentMessages = handlerResult.messages;
|
|
698
727
|
}
|
|
699
728
|
}
|
|
700
729
|
catch (err) {
|
|
730
|
+
if (signal?.aborted) {
|
|
731
|
+
throw err;
|
|
732
|
+
}
|
|
701
733
|
const message = err instanceof Error ? err.message : String(err);
|
|
702
734
|
const stack = err instanceof Error ? err.stack : undefined;
|
|
703
735
|
this.emitError({
|