@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
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./config.js";
|
|
2
|
+
export * from "./handler.js";
|
|
3
|
+
export * from "./ipc/client.js";
|
|
4
|
+
export * from "./ipc/protocol.js";
|
|
5
|
+
export * from "./ipc/server.js";
|
|
6
|
+
export * from "./rpc-process.js";
|
|
7
|
+
export * from "./serve.js";
|
|
8
|
+
export * from "./storage.js";
|
|
9
|
+
export * from "./supervisor.js";
|
|
10
|
+
export * from "./types.js";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { createConnection } from "node:net";
|
|
2
|
+
import { getSocketPath } from "../config.js";
|
|
3
|
+
import { encodeMessage, parseResponseLine } from "./protocol.js";
|
|
4
|
+
export async function sendIpcRequest(request) {
|
|
5
|
+
const socketPath = getSocketPath();
|
|
6
|
+
return new Promise((resolve, reject) => {
|
|
7
|
+
const socket = createConnection(socketPath);
|
|
8
|
+
let buffer = "";
|
|
9
|
+
let settled = false;
|
|
10
|
+
const cleanup = () => {
|
|
11
|
+
socket.removeAllListeners();
|
|
12
|
+
socket.end();
|
|
13
|
+
};
|
|
14
|
+
socket.on("connect", () => {
|
|
15
|
+
socket.write(encodeMessage(request));
|
|
16
|
+
});
|
|
17
|
+
socket.on("data", (chunk) => {
|
|
18
|
+
buffer += chunk.toString();
|
|
19
|
+
const newlineIndex = buffer.indexOf("\n");
|
|
20
|
+
if (newlineIndex === -1) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const line = buffer.slice(0, newlineIndex).trim();
|
|
24
|
+
if (!line) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
settled = true;
|
|
29
|
+
resolve(parseResponseLine(line));
|
|
30
|
+
cleanup();
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
settled = true;
|
|
34
|
+
reject(error);
|
|
35
|
+
cleanup();
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
socket.on("error", (error) => {
|
|
39
|
+
if (settled) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
settled = true;
|
|
43
|
+
reject(error);
|
|
44
|
+
cleanup();
|
|
45
|
+
});
|
|
46
|
+
socket.on("end", () => {
|
|
47
|
+
if (settled) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
settled = true;
|
|
51
|
+
reject(new Error(`Orchestrator socket closed before a response was received: ${socketPath}`));
|
|
52
|
+
cleanup();
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function encodeMessage(message) {
|
|
2
|
+
return `${JSON.stringify(message)}\n`;
|
|
3
|
+
}
|
|
4
|
+
export function parseRequestLine(line) {
|
|
5
|
+
const value = JSON.parse(line);
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
export function parseResponseLine(line) {
|
|
9
|
+
const value = JSON.parse(line);
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=protocol.js.map
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { existsSync, unlinkSync } from "node:fs";
|
|
2
|
+
import { createConnection, createServer } from "node:net";
|
|
3
|
+
import { getSocketPath } from "../config.js";
|
|
4
|
+
import { encodeMessage, parseRequestLine, } from "./protocol.js";
|
|
5
|
+
export async function startIpcServer(handler) {
|
|
6
|
+
const socketPath = getSocketPath();
|
|
7
|
+
await removeStaleSocketIfNeeded(socketPath);
|
|
8
|
+
const server = createServer((socket) => {
|
|
9
|
+
let buffer = "";
|
|
10
|
+
socket.on("data", async (chunk) => {
|
|
11
|
+
buffer += chunk.toString();
|
|
12
|
+
const newlineIndex = buffer.indexOf("\n");
|
|
13
|
+
if (newlineIndex === -1) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const line = buffer.slice(0, newlineIndex).trim();
|
|
17
|
+
buffer = buffer.slice(newlineIndex + 1);
|
|
18
|
+
if (!line) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
const request = parseRequestLine(line);
|
|
23
|
+
if (request.type === "rpc_stream") {
|
|
24
|
+
const response = await handler(request);
|
|
25
|
+
if (!response.ok || response.type !== "rpc_ready" || !response.instance) {
|
|
26
|
+
socket.end(encodeMessage(response));
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
socket.removeAllListeners("data");
|
|
30
|
+
const rpcStream = handler.openRpcStream(request.instanceId, (response) => {
|
|
31
|
+
socket.write(encodeMessage(response));
|
|
32
|
+
}, (event) => {
|
|
33
|
+
socket.write(encodeMessage(event));
|
|
34
|
+
}, (request) => {
|
|
35
|
+
socket.write(encodeMessage(request));
|
|
36
|
+
});
|
|
37
|
+
if (!rpcStream) {
|
|
38
|
+
socket.end(encodeMessage({ type: "error", ok: false, error: `Unknown instance: ${request.instanceId}` }));
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
socket.write(encodeMessage(response));
|
|
42
|
+
let rpcRequestQueue = Promise.resolve();
|
|
43
|
+
socket.on("data", (rpcChunk) => {
|
|
44
|
+
buffer += rpcChunk.toString();
|
|
45
|
+
for (;;) {
|
|
46
|
+
const rpcNewlineIndex = buffer.indexOf("\n");
|
|
47
|
+
if (rpcNewlineIndex === -1) {
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
const rpcLine = buffer.slice(0, rpcNewlineIndex).trim();
|
|
51
|
+
buffer = buffer.slice(rpcNewlineIndex + 1);
|
|
52
|
+
if (!rpcLine) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
rpcRequestQueue = rpcRequestQueue
|
|
56
|
+
.then(async () => {
|
|
57
|
+
try {
|
|
58
|
+
await rpcStream.handleRequest(JSON.parse(rpcLine));
|
|
59
|
+
}
|
|
60
|
+
catch (rpcError) {
|
|
61
|
+
socket.write(encodeMessage({
|
|
62
|
+
type: "error",
|
|
63
|
+
ok: false,
|
|
64
|
+
error: rpcError instanceof Error ? rpcError.message : String(rpcError),
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
.catch((rpcError) => {
|
|
69
|
+
socket.write(encodeMessage({
|
|
70
|
+
type: "error",
|
|
71
|
+
ok: false,
|
|
72
|
+
error: rpcError.message,
|
|
73
|
+
}));
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
socket.once("close", () => rpcStream.close());
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const response = await handler(request);
|
|
81
|
+
socket.end(encodeMessage(response));
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
const response = {
|
|
85
|
+
type: "error",
|
|
86
|
+
ok: false,
|
|
87
|
+
error: error instanceof Error ? error.message : String(error),
|
|
88
|
+
};
|
|
89
|
+
socket.end(encodeMessage(response));
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
await new Promise((resolve, reject) => {
|
|
94
|
+
server.once("error", reject);
|
|
95
|
+
server.listen(socketPath, () => {
|
|
96
|
+
server.off("error", reject);
|
|
97
|
+
resolve();
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
return server;
|
|
101
|
+
}
|
|
102
|
+
async function removeStaleSocketIfNeeded(socketPath) {
|
|
103
|
+
if (!existsSync(socketPath)) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const isLive = await isSocketLive(socketPath);
|
|
107
|
+
if (isLive) {
|
|
108
|
+
throw new Error(`orchestrator is already running: ${socketPath}`);
|
|
109
|
+
}
|
|
110
|
+
unlinkSync(socketPath);
|
|
111
|
+
}
|
|
112
|
+
async function isSocketLive(socketPath) {
|
|
113
|
+
return new Promise((resolve, reject) => {
|
|
114
|
+
const socket = createConnection(socketPath);
|
|
115
|
+
let settled = false;
|
|
116
|
+
const finish = (result) => {
|
|
117
|
+
if (settled) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
settled = true;
|
|
121
|
+
socket.removeAllListeners();
|
|
122
|
+
socket.destroy();
|
|
123
|
+
resolve(result);
|
|
124
|
+
};
|
|
125
|
+
socket.on("connect", () => finish(true));
|
|
126
|
+
socket.on("error", (error) => {
|
|
127
|
+
if (error.code === "ECONNREFUSED" || error.code === "ENOENT") {
|
|
128
|
+
finish(false);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (error.code === "EPIPE" || error.code === "ECONNRESET") {
|
|
132
|
+
finish(false);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (settled) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
settled = true;
|
|
139
|
+
socket.removeAllListeners();
|
|
140
|
+
socket.destroy();
|
|
141
|
+
reject(error);
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import { hostname, platform } from "node:os";
|
|
2
|
+
import { AuthStorage } from "@earendil-works/pi-coding-agent";
|
|
3
|
+
import { getOrchestratorDir, getSocketPath, VERSION } from "./config.js";
|
|
4
|
+
import { loadMachine, saveMachine } from "./storage.js";
|
|
5
|
+
const DEFAULT_RADIUS_URL = "https://radius.pi.dev/";
|
|
6
|
+
const DEFAULT_ORCHESTRATOR_BASE_PATH = "/v1/";
|
|
7
|
+
const NOT_FOUND_RETRY_THRESHOLD = 3;
|
|
8
|
+
const HEARTBEAT_BACKOFF_BASE_MS = 1_000;
|
|
9
|
+
const HEARTBEAT_BACKOFF_MAX_MS = 30_000;
|
|
10
|
+
const RADIUS_PROVIDER = "radius";
|
|
11
|
+
class RadiusHttpError extends Error {
|
|
12
|
+
status;
|
|
13
|
+
constructor(status, message) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.name = "RadiusHttpError";
|
|
16
|
+
this.status = status;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
async function post(path, body) {
|
|
20
|
+
const response = await fetch(new URL(path, getRadiusOrchestratorBaseUrl()), {
|
|
21
|
+
method: "POST",
|
|
22
|
+
headers: {
|
|
23
|
+
Authorization: `Bearer ${getRadiusAccessToken()}`,
|
|
24
|
+
"Content-Type": "application/json",
|
|
25
|
+
},
|
|
26
|
+
body: JSON.stringify(body),
|
|
27
|
+
});
|
|
28
|
+
if (!response.ok) {
|
|
29
|
+
throw new RadiusHttpError(response.status, `Radius request failed: ${response.status} ${await response.text()}`);
|
|
30
|
+
}
|
|
31
|
+
return (await response.json());
|
|
32
|
+
}
|
|
33
|
+
async function maybePost(path, body) {
|
|
34
|
+
const response = await fetch(new URL(path, getRadiusOrchestratorBaseUrl()), {
|
|
35
|
+
method: "POST",
|
|
36
|
+
headers: {
|
|
37
|
+
Authorization: `Bearer ${getRadiusAccessToken()}`,
|
|
38
|
+
"Content-Type": "application/json",
|
|
39
|
+
},
|
|
40
|
+
body: JSON.stringify(body),
|
|
41
|
+
});
|
|
42
|
+
if (!response.ok) {
|
|
43
|
+
throw new RadiusHttpError(response.status, `Radius request failed: ${response.status} ${await response.text()}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function isNotFoundError(error) {
|
|
47
|
+
return error instanceof RadiusHttpError && error.status === 404;
|
|
48
|
+
}
|
|
49
|
+
function computeBackoffDelayMs(failureCount) {
|
|
50
|
+
const exponentialDelay = Math.min(HEARTBEAT_BACKOFF_MAX_MS, HEARTBEAT_BACKOFF_BASE_MS * 2 ** Math.max(0, failureCount - 1));
|
|
51
|
+
const jitterMs = Math.floor(Math.random() * Math.max(250, exponentialDelay / 4));
|
|
52
|
+
return Math.min(HEARTBEAT_BACKOFF_MAX_MS, exponentialDelay + jitterMs);
|
|
53
|
+
}
|
|
54
|
+
function formatRadiusError(error) {
|
|
55
|
+
if (error instanceof RadiusHttpError) {
|
|
56
|
+
return `HTTP ${error.status}: ${error.message}`;
|
|
57
|
+
}
|
|
58
|
+
if (error instanceof Error) {
|
|
59
|
+
return error.message;
|
|
60
|
+
}
|
|
61
|
+
return String(error);
|
|
62
|
+
}
|
|
63
|
+
function logRadiusRetry(scope, action, delayMs, failureCount, error) {
|
|
64
|
+
console.error(`${scope} ${action} failed (attempt ${failureCount}); retrying in ${delayMs}ms: ${formatRadiusError(error)}`);
|
|
65
|
+
}
|
|
66
|
+
export function getRadiusUrl() {
|
|
67
|
+
return process.env.PI_RADIUS_URL || DEFAULT_RADIUS_URL;
|
|
68
|
+
}
|
|
69
|
+
export function getRadiusOrchestratorBaseUrl() {
|
|
70
|
+
const explicitUrl = process.env.PI_RADIUS_ORCHESTRATOR_URL;
|
|
71
|
+
if (explicitUrl) {
|
|
72
|
+
return explicitUrl;
|
|
73
|
+
}
|
|
74
|
+
return new URL(DEFAULT_ORCHESTRATOR_BASE_PATH, getRadiusUrl()).toString();
|
|
75
|
+
}
|
|
76
|
+
const radiusAuthStorage = AuthStorage.create();
|
|
77
|
+
function getStoredRadiusCredential() {
|
|
78
|
+
radiusAuthStorage.reload();
|
|
79
|
+
const credential = radiusAuthStorage.get(RADIUS_PROVIDER);
|
|
80
|
+
if (!credential || credential.type !== "oauth") {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
return credential;
|
|
84
|
+
}
|
|
85
|
+
export function getRadiusAccessToken() {
|
|
86
|
+
const storedCredential = getStoredRadiusCredential();
|
|
87
|
+
if (typeof storedCredential?.access === "string" && storedCredential.access) {
|
|
88
|
+
return storedCredential.access;
|
|
89
|
+
}
|
|
90
|
+
const apiKey = process.env.PI_RADIUS_API_KEY;
|
|
91
|
+
if (apiKey) {
|
|
92
|
+
return apiKey;
|
|
93
|
+
}
|
|
94
|
+
throw new Error("Radius credentials are required in ~/.pi/agent/auth.json or PI_RADIUS_API_KEY");
|
|
95
|
+
}
|
|
96
|
+
export function isRadiusEnabled() {
|
|
97
|
+
return !!getStoredRadiusCredential()?.access || !!process.env.PI_RADIUS_API_KEY;
|
|
98
|
+
}
|
|
99
|
+
export class RadiusPresence {
|
|
100
|
+
machineHeartbeatTimer;
|
|
101
|
+
machineHeartbeatIntervalMs = 0;
|
|
102
|
+
machineConsecutiveNotFoundCount = 0;
|
|
103
|
+
machineTransientFailureCount = 0;
|
|
104
|
+
piHeartbeatStates = new Map();
|
|
105
|
+
machine;
|
|
106
|
+
coordinator;
|
|
107
|
+
setCoordinator(coordinator) {
|
|
108
|
+
this.coordinator = coordinator;
|
|
109
|
+
}
|
|
110
|
+
async start(label) {
|
|
111
|
+
if (!isRadiusEnabled()) {
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
const registered = await this.registerMachine(label);
|
|
115
|
+
this.startMachineHeartbeat(registered.heartbeatIntervalMs);
|
|
116
|
+
return this.machine;
|
|
117
|
+
}
|
|
118
|
+
async stop() {
|
|
119
|
+
if (this.machineHeartbeatTimer) {
|
|
120
|
+
clearTimeout(this.machineHeartbeatTimer);
|
|
121
|
+
this.machineHeartbeatTimer = undefined;
|
|
122
|
+
}
|
|
123
|
+
for (const [instanceId, state] of this.piHeartbeatStates) {
|
|
124
|
+
if (state.timer) {
|
|
125
|
+
clearTimeout(state.timer);
|
|
126
|
+
}
|
|
127
|
+
this.piHeartbeatStates.delete(instanceId);
|
|
128
|
+
}
|
|
129
|
+
if (!this.machine || !isRadiusEnabled()) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
try {
|
|
133
|
+
await maybePost(`machines/${this.machine.id}/disconnect`, {});
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
if (!isNotFoundError(error)) {
|
|
137
|
+
throw error;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
async registerPi(instance) {
|
|
142
|
+
if (!isRadiusEnabled()) {
|
|
143
|
+
return instance;
|
|
144
|
+
}
|
|
145
|
+
const machine = this.machine ?? loadMachine();
|
|
146
|
+
if (!machine) {
|
|
147
|
+
throw new Error("No registered machine available for Pi registration");
|
|
148
|
+
}
|
|
149
|
+
const registered = await post("pis/register", {
|
|
150
|
+
machineId: machine.id,
|
|
151
|
+
label: instance.label,
|
|
152
|
+
cwd: instance.cwd,
|
|
153
|
+
hostname: hostname(),
|
|
154
|
+
pid: process.pid,
|
|
155
|
+
transport: "local-rpc",
|
|
156
|
+
capabilities: { rpc: true, relay: false, iroh: false },
|
|
157
|
+
sessionId: instance.sessionId,
|
|
158
|
+
});
|
|
159
|
+
const registeredInstance = { ...instance, radiusPiId: registered.id };
|
|
160
|
+
this.startPiHeartbeat(instance.id, registered.heartbeatIntervalMs, registered.id);
|
|
161
|
+
return registeredInstance;
|
|
162
|
+
}
|
|
163
|
+
async disconnectPi(instance) {
|
|
164
|
+
const state = this.piHeartbeatStates.get(instance.id);
|
|
165
|
+
if (state) {
|
|
166
|
+
if (state.timer) {
|
|
167
|
+
clearTimeout(state.timer);
|
|
168
|
+
}
|
|
169
|
+
this.piHeartbeatStates.delete(instance.id);
|
|
170
|
+
}
|
|
171
|
+
if (!isRadiusEnabled() || !instance.radiusPiId) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
try {
|
|
175
|
+
await maybePost(`pis/${instance.radiusPiId}/disconnect`, {});
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
if (!isNotFoundError(error)) {
|
|
179
|
+
throw error;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
async registerMachine(label) {
|
|
184
|
+
const existingMachine = this.machine ?? loadMachine();
|
|
185
|
+
const registered = await post("machines/register", {
|
|
186
|
+
machineId: existingMachine?.id,
|
|
187
|
+
label,
|
|
188
|
+
hostname: hostname(),
|
|
189
|
+
platform: platform(),
|
|
190
|
+
arch: process.arch,
|
|
191
|
+
version: VERSION,
|
|
192
|
+
capabilities: { spawn: true, relay: false, iroh: false },
|
|
193
|
+
});
|
|
194
|
+
const timestamp = new Date().toISOString();
|
|
195
|
+
this.machine = {
|
|
196
|
+
id: registered.id,
|
|
197
|
+
createdAt: existingMachine?.createdAt ?? timestamp,
|
|
198
|
+
lastSeenAt: timestamp,
|
|
199
|
+
label,
|
|
200
|
+
};
|
|
201
|
+
saveMachine(this.machine);
|
|
202
|
+
this.machineConsecutiveNotFoundCount = 0;
|
|
203
|
+
this.machineTransientFailureCount = 0;
|
|
204
|
+
return registered;
|
|
205
|
+
}
|
|
206
|
+
startMachineHeartbeat(intervalMs) {
|
|
207
|
+
this.machineHeartbeatIntervalMs = intervalMs;
|
|
208
|
+
this.scheduleMachineHeartbeat(intervalMs);
|
|
209
|
+
}
|
|
210
|
+
scheduleMachineHeartbeat(delayMs) {
|
|
211
|
+
if (this.machineHeartbeatTimer) {
|
|
212
|
+
clearTimeout(this.machineHeartbeatTimer);
|
|
213
|
+
}
|
|
214
|
+
this.machineHeartbeatTimer = setTimeout(() => {
|
|
215
|
+
void this.heartbeatMachine();
|
|
216
|
+
}, delayMs);
|
|
217
|
+
}
|
|
218
|
+
startPiHeartbeat(instanceId, intervalMs, radiusPiId) {
|
|
219
|
+
const existingState = this.piHeartbeatStates.get(instanceId);
|
|
220
|
+
if (existingState?.timer) {
|
|
221
|
+
clearTimeout(existingState.timer);
|
|
222
|
+
}
|
|
223
|
+
const state = existingState ?? {
|
|
224
|
+
intervalMs,
|
|
225
|
+
radiusPiId,
|
|
226
|
+
consecutiveNotFoundCount: 0,
|
|
227
|
+
transientFailureCount: 0,
|
|
228
|
+
};
|
|
229
|
+
state.intervalMs = intervalMs;
|
|
230
|
+
state.radiusPiId = radiusPiId;
|
|
231
|
+
state.consecutiveNotFoundCount = 0;
|
|
232
|
+
state.transientFailureCount = 0;
|
|
233
|
+
this.piHeartbeatStates.set(instanceId, state);
|
|
234
|
+
this.schedulePiHeartbeat(instanceId, intervalMs);
|
|
235
|
+
}
|
|
236
|
+
schedulePiHeartbeat(instanceId, delayMs) {
|
|
237
|
+
const state = this.piHeartbeatStates.get(instanceId);
|
|
238
|
+
if (!state) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
if (state.timer) {
|
|
242
|
+
clearTimeout(state.timer);
|
|
243
|
+
}
|
|
244
|
+
state.timer = setTimeout(() => {
|
|
245
|
+
void this.heartbeatPi(instanceId);
|
|
246
|
+
}, delayMs);
|
|
247
|
+
}
|
|
248
|
+
async heartbeatMachine() {
|
|
249
|
+
if (!this.machine || !isRadiusEnabled()) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
try {
|
|
253
|
+
await maybePost(`machines/${this.machine.id}/heartbeat`, {
|
|
254
|
+
cwd: getOrchestratorDir(),
|
|
255
|
+
socketPath: getSocketPath(),
|
|
256
|
+
});
|
|
257
|
+
this.machineConsecutiveNotFoundCount = 0;
|
|
258
|
+
this.machineTransientFailureCount = 0;
|
|
259
|
+
this.scheduleMachineHeartbeat(this.machineHeartbeatIntervalMs);
|
|
260
|
+
}
|
|
261
|
+
catch (error) {
|
|
262
|
+
if (!isNotFoundError(error)) {
|
|
263
|
+
this.machineTransientFailureCount += 1;
|
|
264
|
+
const delayMs = computeBackoffDelayMs(this.machineTransientFailureCount);
|
|
265
|
+
logRadiusRetry("Radius machine", "heartbeat", delayMs, this.machineTransientFailureCount, error);
|
|
266
|
+
this.scheduleMachineHeartbeat(delayMs);
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
this.machineTransientFailureCount = 0;
|
|
270
|
+
this.machineConsecutiveNotFoundCount += 1;
|
|
271
|
+
if (this.machineConsecutiveNotFoundCount < NOT_FOUND_RETRY_THRESHOLD) {
|
|
272
|
+
this.scheduleMachineHeartbeat(this.machineHeartbeatIntervalMs);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
try {
|
|
276
|
+
await this.reRegisterMachineAndPis();
|
|
277
|
+
}
|
|
278
|
+
catch (recoveryError) {
|
|
279
|
+
this.machineTransientFailureCount += 1;
|
|
280
|
+
const delayMs = computeBackoffDelayMs(this.machineTransientFailureCount);
|
|
281
|
+
logRadiusRetry("Radius machine", "re-registration", delayMs, this.machineTransientFailureCount, recoveryError);
|
|
282
|
+
this.scheduleMachineHeartbeat(delayMs);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
async heartbeatPi(instanceId) {
|
|
287
|
+
if (!isRadiusEnabled()) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
const state = this.piHeartbeatStates.get(instanceId);
|
|
291
|
+
if (!state) {
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
try {
|
|
295
|
+
await maybePost(`pis/${state.radiusPiId}/heartbeat`, {});
|
|
296
|
+
state.consecutiveNotFoundCount = 0;
|
|
297
|
+
state.transientFailureCount = 0;
|
|
298
|
+
this.schedulePiHeartbeat(instanceId, state.intervalMs);
|
|
299
|
+
}
|
|
300
|
+
catch (error) {
|
|
301
|
+
if (!isNotFoundError(error)) {
|
|
302
|
+
state.transientFailureCount += 1;
|
|
303
|
+
const delayMs = computeBackoffDelayMs(state.transientFailureCount);
|
|
304
|
+
logRadiusRetry(`Radius Pi ${instanceId}`, "heartbeat", delayMs, state.transientFailureCount, error);
|
|
305
|
+
this.schedulePiHeartbeat(instanceId, delayMs);
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
state.transientFailureCount = 0;
|
|
309
|
+
state.consecutiveNotFoundCount += 1;
|
|
310
|
+
if (state.consecutiveNotFoundCount < NOT_FOUND_RETRY_THRESHOLD) {
|
|
311
|
+
this.schedulePiHeartbeat(instanceId, state.intervalMs);
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
try {
|
|
315
|
+
const recovered = await this.reRegisterPi(instanceId);
|
|
316
|
+
if (!recovered) {
|
|
317
|
+
const delayMs = computeBackoffDelayMs(1);
|
|
318
|
+
console.error(`Radius Pi ${instanceId} re-registration skipped; retrying in ${delayMs}ms`);
|
|
319
|
+
this.schedulePiHeartbeat(instanceId, delayMs);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
catch (recoveryError) {
|
|
323
|
+
state.transientFailureCount += 1;
|
|
324
|
+
const delayMs = computeBackoffDelayMs(state.transientFailureCount);
|
|
325
|
+
logRadiusRetry(`Radius Pi ${instanceId}`, "re-registration", delayMs, state.transientFailureCount, recoveryError);
|
|
326
|
+
this.schedulePiHeartbeat(instanceId, delayMs);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
async reRegisterMachineAndPis() {
|
|
331
|
+
const registered = await this.registerMachine(this.machine?.label);
|
|
332
|
+
this.startMachineHeartbeat(registered.heartbeatIntervalMs);
|
|
333
|
+
const instances = this.coordinator?.listLiveInstances() ?? [];
|
|
334
|
+
for (const instance of instances) {
|
|
335
|
+
try {
|
|
336
|
+
await this.reRegisterPi(instance.id);
|
|
337
|
+
}
|
|
338
|
+
catch (error) {
|
|
339
|
+
console.error(`Radius Pi ${instance.id} re-registration failed: ${formatRadiusError(error)}`);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
async reRegisterPi(instanceId) {
|
|
344
|
+
const instance = this.coordinator?.getLiveInstance(instanceId);
|
|
345
|
+
if (!instance) {
|
|
346
|
+
const state = this.piHeartbeatStates.get(instanceId);
|
|
347
|
+
if (state) {
|
|
348
|
+
if (state.timer) {
|
|
349
|
+
clearTimeout(state.timer);
|
|
350
|
+
}
|
|
351
|
+
this.piHeartbeatStates.delete(instanceId);
|
|
352
|
+
}
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
if (!this.machine) {
|
|
356
|
+
await this.reRegisterMachineAndPis();
|
|
357
|
+
return true;
|
|
358
|
+
}
|
|
359
|
+
const registeredInstance = await this.registerPi(instance);
|
|
360
|
+
this.coordinator?.updateInstance(registeredInstance);
|
|
361
|
+
return true;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
export const radiusPresence = new RadiusPresence();
|
|
365
|
+
//# sourceMappingURL=radius.js.map
|