@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,168 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { isBunBinary } from "./config.js";
|
|
6
|
+
const require = createRequire(import.meta.url);
|
|
7
|
+
function toError(error) {
|
|
8
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
9
|
+
}
|
|
10
|
+
export class RpcProcessInstance {
|
|
11
|
+
process;
|
|
12
|
+
exited = false;
|
|
13
|
+
nextRequestId = 0;
|
|
14
|
+
stdoutBuffer = "";
|
|
15
|
+
stderrBuffer = "";
|
|
16
|
+
pendingRequests = new Map();
|
|
17
|
+
eventListeners = new Set();
|
|
18
|
+
exitListeners = new Set();
|
|
19
|
+
uiRequestHandler;
|
|
20
|
+
constructor(options) {
|
|
21
|
+
const rpcCommand = this.getSpawnCommand();
|
|
22
|
+
this.process = spawn(rpcCommand.command, rpcCommand.args, {
|
|
23
|
+
cwd: options.cwd,
|
|
24
|
+
env: process.env,
|
|
25
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
26
|
+
});
|
|
27
|
+
if (!this.process.stdin || !this.process.stdout) {
|
|
28
|
+
throw new Error("Failed to create RPC process stdio");
|
|
29
|
+
}
|
|
30
|
+
this.attachListeners();
|
|
31
|
+
}
|
|
32
|
+
getSpawnCommand() {
|
|
33
|
+
if (isBunBinary) {
|
|
34
|
+
return {
|
|
35
|
+
command: join(dirname(process.execPath), process.platform === "win32" ? "pi.exe" : "pi"),
|
|
36
|
+
args: ["--mode", "rpc"],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
command: process.execPath,
|
|
41
|
+
args: [require.resolve("@earendil-works/pi-coding-agent/rpc-entry")],
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
attachListeners() {
|
|
45
|
+
this.process.stdout?.setEncoding("utf8");
|
|
46
|
+
this.process.stdout?.on("data", (chunk) => {
|
|
47
|
+
this.stdoutBuffer += chunk;
|
|
48
|
+
while (true) {
|
|
49
|
+
const newlineIndex = this.stdoutBuffer.indexOf("\n");
|
|
50
|
+
if (newlineIndex === -1) {
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
const line = this.stdoutBuffer.slice(0, newlineIndex).trim();
|
|
54
|
+
this.stdoutBuffer = this.stdoutBuffer.slice(newlineIndex + 1);
|
|
55
|
+
if (!line) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
this.handleLine(line);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
this.process.stderr?.setEncoding("utf8");
|
|
62
|
+
this.process.stderr?.on("data", (chunk) => {
|
|
63
|
+
this.stderrBuffer += chunk;
|
|
64
|
+
});
|
|
65
|
+
this.process.once("error", (error) => {
|
|
66
|
+
this.exited = true;
|
|
67
|
+
const wrapped = new Error(`RPC process error: ${error.message}. Stderr: ${this.stderrBuffer}`);
|
|
68
|
+
this.rejectAllPending(wrapped);
|
|
69
|
+
this.notifyExit(wrapped);
|
|
70
|
+
});
|
|
71
|
+
this.process.once("exit", (code, signal) => {
|
|
72
|
+
this.exited = true;
|
|
73
|
+
const error = new Error(`RPC process exited (code=${code} signal=${signal}). Stderr: ${this.stderrBuffer}`);
|
|
74
|
+
this.rejectAllPending(error);
|
|
75
|
+
this.notifyExit(error);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
handleLine(line) {
|
|
79
|
+
const parsed = JSON.parse(line);
|
|
80
|
+
switch (parsed.type) {
|
|
81
|
+
case "response": {
|
|
82
|
+
if (!parsed.id) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const pending = this.pendingRequests.get(parsed.id);
|
|
86
|
+
if (!pending) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
this.pendingRequests.delete(parsed.id);
|
|
90
|
+
pending.resolve(parsed);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
case "extension_ui_request": {
|
|
94
|
+
this.uiRequestHandler?.(parsed);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
default: {
|
|
98
|
+
for (const listener of this.eventListeners) {
|
|
99
|
+
listener(parsed);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
rejectAllPending(error) {
|
|
105
|
+
for (const [id, pending] of this.pendingRequests) {
|
|
106
|
+
this.pendingRequests.delete(id);
|
|
107
|
+
pending.reject(error);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
notifyExit(error) {
|
|
111
|
+
for (const listener of this.exitListeners) {
|
|
112
|
+
listener(error);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
send(command) {
|
|
116
|
+
if (this.exited) {
|
|
117
|
+
throw new Error(`RPC process is not running. Stderr: ${this.stderrBuffer}`);
|
|
118
|
+
}
|
|
119
|
+
const id = command.id ?? `orchestrator_${++this.nextRequestId}_${randomUUID()}`;
|
|
120
|
+
const fullCommand = { ...command, id };
|
|
121
|
+
return new Promise((resolve, reject) => {
|
|
122
|
+
this.pendingRequests.set(id, { resolve, reject });
|
|
123
|
+
this.process.stdin?.write(`${JSON.stringify(fullCommand)}\n`, (error) => {
|
|
124
|
+
if (!error) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
this.pendingRequests.delete(id);
|
|
128
|
+
reject(toError(error));
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
handleUiResponse(response) {
|
|
133
|
+
if (this.exited) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
this.process.stdin?.write(`${JSON.stringify(response)}\n`);
|
|
137
|
+
}
|
|
138
|
+
setUiRequestHandler(handler) {
|
|
139
|
+
this.uiRequestHandler = handler;
|
|
140
|
+
}
|
|
141
|
+
onEvent(listener) {
|
|
142
|
+
this.eventListeners.add(listener);
|
|
143
|
+
return () => {
|
|
144
|
+
this.eventListeners.delete(listener);
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
onExit(listener) {
|
|
148
|
+
this.exitListeners.add(listener);
|
|
149
|
+
return () => {
|
|
150
|
+
this.exitListeners.delete(listener);
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
async dispose() {
|
|
154
|
+
this.uiRequestHandler = undefined;
|
|
155
|
+
this.rejectAllPending(new Error("RPC process disposed"));
|
|
156
|
+
if (this.exited) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
this.process.kill("SIGTERM");
|
|
160
|
+
await new Promise((resolve) => {
|
|
161
|
+
this.process.once("exit", () => resolve());
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
export function createRpcProcessInstance(options) {
|
|
166
|
+
return new RpcProcessInstance(options);
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=rpc-process.js.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, unlinkSync } from "node:fs";
|
|
2
|
+
import { dirname } from "node:path";
|
|
3
|
+
import { getSocketPath } from "./config.js";
|
|
4
|
+
import { handleIpcRequest, openRpcStream } from "./handler.js";
|
|
5
|
+
import { startIpcServer } from "./ipc/server.js";
|
|
6
|
+
import { getRadiusOrchestratorBaseUrl, isRadiusEnabled, radiusPresence } from "./radius.js";
|
|
7
|
+
import { supervisor } from "./supervisor.js";
|
|
8
|
+
export async function serve() {
|
|
9
|
+
const socketPath = getSocketPath();
|
|
10
|
+
mkdirSync(dirname(socketPath), { recursive: true });
|
|
11
|
+
const server = await startIpcServer(Object.assign(handleIpcRequest, {
|
|
12
|
+
openRpcStream,
|
|
13
|
+
}));
|
|
14
|
+
try {
|
|
15
|
+
await supervisor.recoverAfterRestart();
|
|
16
|
+
if (isRadiusEnabled()) {
|
|
17
|
+
const machine = await radiusPresence.start();
|
|
18
|
+
console.log(`radius integration enabled: ${socketPath} -> ${getRadiusOrchestratorBaseUrl()}`);
|
|
19
|
+
if (machine) {
|
|
20
|
+
console.log(`radius machine id: ${machine.id}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
console.log("radius integration disabled: login radius in ~/.pi/agent/auth.json or set PI_RADIUS_API_KEY");
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
server.close();
|
|
29
|
+
if (existsSync(socketPath)) {
|
|
30
|
+
unlinkSync(socketPath);
|
|
31
|
+
}
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
console.log(`orchestrator listening on ${socketPath}`);
|
|
35
|
+
let shutdownPromise;
|
|
36
|
+
const shutdown = async (exitCode) => {
|
|
37
|
+
if (shutdownPromise) {
|
|
38
|
+
await shutdownPromise;
|
|
39
|
+
process.exit(exitCode);
|
|
40
|
+
}
|
|
41
|
+
shutdownPromise = (async () => {
|
|
42
|
+
server.close();
|
|
43
|
+
await supervisor.shutdown();
|
|
44
|
+
await radiusPresence.stop();
|
|
45
|
+
if (existsSync(socketPath)) {
|
|
46
|
+
unlinkSync(socketPath);
|
|
47
|
+
}
|
|
48
|
+
})();
|
|
49
|
+
await shutdownPromise;
|
|
50
|
+
process.exit(exitCode);
|
|
51
|
+
};
|
|
52
|
+
process.on("SIGINT", () => {
|
|
53
|
+
void shutdown(0);
|
|
54
|
+
});
|
|
55
|
+
process.on("SIGTERM", () => {
|
|
56
|
+
void shutdown(0);
|
|
57
|
+
});
|
|
58
|
+
process.on("uncaughtException", (error) => {
|
|
59
|
+
console.error(error);
|
|
60
|
+
void shutdown(1);
|
|
61
|
+
});
|
|
62
|
+
process.on("unhandledRejection", (reason) => {
|
|
63
|
+
console.error(reason);
|
|
64
|
+
void shutdown(1);
|
|
65
|
+
});
|
|
66
|
+
await new Promise(() => {
|
|
67
|
+
// Keep the process alive until a signal or fatal error triggers shutdown.
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=serve.js.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { getInstancesPath, getMachinePath, getOrchestratorDir } from "./config.js";
|
|
3
|
+
function ensureOrchestratorDir() {
|
|
4
|
+
const orchestratorDir = getOrchestratorDir();
|
|
5
|
+
if (!existsSync(orchestratorDir)) {
|
|
6
|
+
mkdirSync(orchestratorDir, { recursive: true });
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export function loadMachine() {
|
|
10
|
+
const machinePath = getMachinePath();
|
|
11
|
+
if (!existsSync(machinePath)) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
const data = readFileSync(machinePath, "utf-8");
|
|
15
|
+
return JSON.parse(data);
|
|
16
|
+
}
|
|
17
|
+
export function saveMachine(machine) {
|
|
18
|
+
ensureOrchestratorDir();
|
|
19
|
+
writeFileSync(getMachinePath(), JSON.stringify(machine, null, 2));
|
|
20
|
+
}
|
|
21
|
+
export function deleteMachine() {
|
|
22
|
+
const machinePath = getMachinePath();
|
|
23
|
+
if (!existsSync(machinePath)) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
rmSync(machinePath);
|
|
27
|
+
}
|
|
28
|
+
export function loadInstances() {
|
|
29
|
+
const instancesPath = getInstancesPath();
|
|
30
|
+
if (!existsSync(instancesPath)) {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
const data = readFileSync(instancesPath, "utf-8");
|
|
34
|
+
return JSON.parse(data);
|
|
35
|
+
}
|
|
36
|
+
export function saveInstances(instances) {
|
|
37
|
+
ensureOrchestratorDir();
|
|
38
|
+
writeFileSync(getInstancesPath(), JSON.stringify(instances, null, 2));
|
|
39
|
+
}
|
|
40
|
+
export function getInstance(instanceId) {
|
|
41
|
+
return loadInstances().find((instance) => instance.id === instanceId);
|
|
42
|
+
}
|
|
43
|
+
export function upsertInstance(instance) {
|
|
44
|
+
const instances = loadInstances();
|
|
45
|
+
const index = instances.findIndex((existing) => existing.id === instance.id);
|
|
46
|
+
if (index === -1) {
|
|
47
|
+
instances.push(instance);
|
|
48
|
+
saveInstances(instances);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
instances[index] = instance;
|
|
52
|
+
saveInstances(instances);
|
|
53
|
+
}
|
|
54
|
+
export function removeInstance(instanceId) {
|
|
55
|
+
const instances = loadInstances().filter((instance) => instance.id !== instanceId);
|
|
56
|
+
saveInstances(instances);
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { radiusPresence } from "./radius.js";
|
|
3
|
+
import { createRpcProcessInstance } from "./rpc-process.js";
|
|
4
|
+
import { getInstance, loadInstances, removeInstance, saveInstances, upsertInstance } from "./storage.js";
|
|
5
|
+
function cloneInstance(record) {
|
|
6
|
+
return { ...record };
|
|
7
|
+
}
|
|
8
|
+
// Only refresh persisted session metadata after commands that can plausibly change
|
|
9
|
+
// the instance identity/details we store in instances.json. Most RPCs mutate transient
|
|
10
|
+
// runtime state only, so forcing a follow-up get_state after every command is wasted IO.
|
|
11
|
+
//
|
|
12
|
+
// - new_session / switch_session / fork / clone can change sessionId/sessionFile
|
|
13
|
+
// - set_session_name changes a persisted session detail we may want reflected externally
|
|
14
|
+
// - prompt can materialize or advance persisted session state after the child processes it
|
|
15
|
+
const SESSION_METADATA_COMMANDS = new Set([
|
|
16
|
+
"new_session",
|
|
17
|
+
"switch_session",
|
|
18
|
+
"fork",
|
|
19
|
+
"clone",
|
|
20
|
+
"set_session_name",
|
|
21
|
+
"prompt",
|
|
22
|
+
]);
|
|
23
|
+
function shouldRefreshSessionMetadata(command) {
|
|
24
|
+
return SESSION_METADATA_COMMANDS.has(command.type);
|
|
25
|
+
}
|
|
26
|
+
function isGetStateSuccess(response) {
|
|
27
|
+
return response.success === true && response.command === "get_state" && "data" in response;
|
|
28
|
+
}
|
|
29
|
+
export class OrchestratorSupervisor {
|
|
30
|
+
liveInstances = new Map();
|
|
31
|
+
setStatus(live, status) {
|
|
32
|
+
live.record = {
|
|
33
|
+
...live.record,
|
|
34
|
+
status,
|
|
35
|
+
lastSeenAt: new Date().toISOString(),
|
|
36
|
+
};
|
|
37
|
+
upsertInstance(live.record);
|
|
38
|
+
}
|
|
39
|
+
updateRecord(live, updates) {
|
|
40
|
+
live.record = {
|
|
41
|
+
...live.record,
|
|
42
|
+
...updates,
|
|
43
|
+
lastSeenAt: new Date().toISOString(),
|
|
44
|
+
};
|
|
45
|
+
if (updates.radiusPiId !== undefined) {
|
|
46
|
+
live.resources.radiusPiId = updates.radiusPiId;
|
|
47
|
+
}
|
|
48
|
+
if (updates.sessionId !== undefined) {
|
|
49
|
+
live.resources.sessionId = updates.sessionId;
|
|
50
|
+
}
|
|
51
|
+
upsertInstance(live.record);
|
|
52
|
+
}
|
|
53
|
+
clearBindings(live) {
|
|
54
|
+
live.unsubscribeEvents?.();
|
|
55
|
+
live.unsubscribeExit?.();
|
|
56
|
+
live.unsubscribeEvents = undefined;
|
|
57
|
+
live.unsubscribeExit = undefined;
|
|
58
|
+
live.onUiRequest = undefined;
|
|
59
|
+
live.resources.rpcProcess?.setUiRequestHandler(undefined);
|
|
60
|
+
}
|
|
61
|
+
bindRpcProcess(live, rpcProcess) {
|
|
62
|
+
this.clearBindings(live);
|
|
63
|
+
live.resources.rpcProcess = rpcProcess;
|
|
64
|
+
live.unsubscribeEvents = rpcProcess.onEvent((event) => {
|
|
65
|
+
for (const subscriber of live.subscribers) {
|
|
66
|
+
subscriber(event);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
live.unsubscribeExit = rpcProcess.onExit((error) => {
|
|
70
|
+
void this.handleUnexpectedRpcExit(live, error);
|
|
71
|
+
});
|
|
72
|
+
rpcProcess.setUiRequestHandler((request) => {
|
|
73
|
+
live.onUiRequest?.(request);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
async handleUnexpectedRpcExit(live, _error) {
|
|
77
|
+
if (this.liveInstances.get(live.record.id) !== live) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (live.record.status === "stopping" || live.record.status === "stopped") {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
this.setStatus(live, "error");
|
|
84
|
+
this.clearBindings(live);
|
|
85
|
+
live.resources.rpcProcess = undefined;
|
|
86
|
+
if (live.resources.radiusPiId) {
|
|
87
|
+
try {
|
|
88
|
+
await radiusPresence.disconnectPi(live.record);
|
|
89
|
+
this.updateRecord(live, { radiusPiId: undefined });
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
console.error(`Failed to disconnect Radius Pi ${live.record.id}: ${String(error)}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
this.liveInstances.delete(live.record.id);
|
|
96
|
+
}
|
|
97
|
+
getRpcProcess(live) {
|
|
98
|
+
return live.resources.rpcProcess;
|
|
99
|
+
}
|
|
100
|
+
async syncInstanceRecord(live) {
|
|
101
|
+
const rpcProcess = this.getRpcProcess(live);
|
|
102
|
+
if (!rpcProcess) {
|
|
103
|
+
this.updateRecord(live, {});
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const response = await rpcProcess.send({ type: "get_state" });
|
|
107
|
+
if (!isGetStateSuccess(response)) {
|
|
108
|
+
this.updateRecord(live, {});
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
this.updateRecord(live, {
|
|
112
|
+
sessionId: response.data.sessionId,
|
|
113
|
+
sessionFile: response.data.sessionFile,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
async cleanupAcquiredResources(live) {
|
|
117
|
+
const rpcProcess = live.resources.rpcProcess;
|
|
118
|
+
this.clearBindings(live);
|
|
119
|
+
if (live.resources.radiusPiId) {
|
|
120
|
+
await radiusPresence.disconnectPi(live.record);
|
|
121
|
+
live.resources.radiusPiId = undefined;
|
|
122
|
+
live.record = {
|
|
123
|
+
...live.record,
|
|
124
|
+
radiusPiId: undefined,
|
|
125
|
+
lastSeenAt: new Date().toISOString(),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
live.resources.sessionId = undefined;
|
|
129
|
+
if (rpcProcess) {
|
|
130
|
+
live.resources.rpcProcess = undefined;
|
|
131
|
+
await rpcProcess.dispose();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
async failSpawn(live, error) {
|
|
135
|
+
this.setStatus(live, "error");
|
|
136
|
+
try {
|
|
137
|
+
await this.cleanupAcquiredResources(live);
|
|
138
|
+
}
|
|
139
|
+
finally {
|
|
140
|
+
this.setStatus(live, "stopped");
|
|
141
|
+
this.liveInstances.delete(live.record.id);
|
|
142
|
+
}
|
|
143
|
+
throw error;
|
|
144
|
+
}
|
|
145
|
+
updateInstance(instance) {
|
|
146
|
+
const live = this.liveInstances.get(instance.id);
|
|
147
|
+
if (live) {
|
|
148
|
+
live.record = instance;
|
|
149
|
+
live.resources.radiusPiId = instance.radiusPiId;
|
|
150
|
+
live.resources.sessionId = instance.sessionId;
|
|
151
|
+
}
|
|
152
|
+
upsertInstance(instance);
|
|
153
|
+
}
|
|
154
|
+
openRpcStream(instanceId, onEvent, onUiRequest) {
|
|
155
|
+
const live = this.liveInstances.get(instanceId);
|
|
156
|
+
const rpcProcess = live ? this.getRpcProcess(live) : undefined;
|
|
157
|
+
if (!live || !rpcProcess) {
|
|
158
|
+
return undefined;
|
|
159
|
+
}
|
|
160
|
+
live.subscribers.add(onEvent);
|
|
161
|
+
live.onUiRequest = onUiRequest;
|
|
162
|
+
return {
|
|
163
|
+
handleRpc: async (command) => {
|
|
164
|
+
const response = await rpcProcess.send(command);
|
|
165
|
+
if (shouldRefreshSessionMetadata(command)) {
|
|
166
|
+
await this.syncInstanceRecord(live);
|
|
167
|
+
}
|
|
168
|
+
return response;
|
|
169
|
+
},
|
|
170
|
+
handleUiResponse: (response) => {
|
|
171
|
+
rpcProcess.handleUiResponse(response);
|
|
172
|
+
},
|
|
173
|
+
close: () => {
|
|
174
|
+
if (live.onUiRequest === onUiRequest) {
|
|
175
|
+
live.onUiRequest = undefined;
|
|
176
|
+
}
|
|
177
|
+
live.subscribers.delete(onEvent);
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
getLiveInstance(instanceId) {
|
|
182
|
+
const live = this.liveInstances.get(instanceId);
|
|
183
|
+
return live ? cloneInstance(live.record) : undefined;
|
|
184
|
+
}
|
|
185
|
+
listLiveInstances() {
|
|
186
|
+
return [...this.liveInstances.values()].map((live) => cloneInstance(live.record));
|
|
187
|
+
}
|
|
188
|
+
async recoverAfterRestart() {
|
|
189
|
+
const recoveredAt = new Date().toISOString();
|
|
190
|
+
const instances = loadInstances().map((instance) => ({
|
|
191
|
+
...instance,
|
|
192
|
+
status: instance.status === "online" || instance.status === "starting" ? "stopped" : instance.status,
|
|
193
|
+
lastSeenAt: recoveredAt,
|
|
194
|
+
}));
|
|
195
|
+
for (const instance of instances) {
|
|
196
|
+
await radiusPresence.disconnectPi(instance);
|
|
197
|
+
}
|
|
198
|
+
saveInstances(instances);
|
|
199
|
+
}
|
|
200
|
+
listInstances() {
|
|
201
|
+
return loadInstances().map(cloneInstance);
|
|
202
|
+
}
|
|
203
|
+
getInstance(instanceId) {
|
|
204
|
+
const live = this.liveInstances.get(instanceId);
|
|
205
|
+
if (live) {
|
|
206
|
+
return cloneInstance(live.record);
|
|
207
|
+
}
|
|
208
|
+
const stored = getInstance(instanceId);
|
|
209
|
+
return stored ? cloneInstance(stored) : undefined;
|
|
210
|
+
}
|
|
211
|
+
async spawnInstance(options) {
|
|
212
|
+
const now = new Date().toISOString();
|
|
213
|
+
const live = {
|
|
214
|
+
record: {
|
|
215
|
+
id: randomUUID(),
|
|
216
|
+
status: "starting",
|
|
217
|
+
cwd: options.cwd,
|
|
218
|
+
createdAt: now,
|
|
219
|
+
lastSeenAt: now,
|
|
220
|
+
label: options.label,
|
|
221
|
+
},
|
|
222
|
+
resources: {},
|
|
223
|
+
subscribers: new Set(),
|
|
224
|
+
};
|
|
225
|
+
this.liveInstances.set(live.record.id, live);
|
|
226
|
+
upsertInstance(live.record);
|
|
227
|
+
try {
|
|
228
|
+
const rpcProcess = createRpcProcessInstance({ cwd: options.cwd });
|
|
229
|
+
this.bindRpcProcess(live, rpcProcess);
|
|
230
|
+
await this.syncInstanceRecord(live);
|
|
231
|
+
const registeredRecord = await radiusPresence.registerPi(live.record);
|
|
232
|
+
this.updateRecord(live, { radiusPiId: registeredRecord.radiusPiId });
|
|
233
|
+
this.setStatus(live, "online");
|
|
234
|
+
return cloneInstance(live.record);
|
|
235
|
+
}
|
|
236
|
+
catch (error) {
|
|
237
|
+
return await this.failSpawn(live, error);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
async stopInstance(instanceId) {
|
|
241
|
+
const live = this.liveInstances.get(instanceId);
|
|
242
|
+
if (!live) {
|
|
243
|
+
return undefined;
|
|
244
|
+
}
|
|
245
|
+
this.setStatus(live, "stopping");
|
|
246
|
+
try {
|
|
247
|
+
await this.cleanupAcquiredResources(live);
|
|
248
|
+
}
|
|
249
|
+
finally {
|
|
250
|
+
live.record = {
|
|
251
|
+
...live.record,
|
|
252
|
+
status: "stopped",
|
|
253
|
+
lastSeenAt: new Date().toISOString(),
|
|
254
|
+
};
|
|
255
|
+
this.liveInstances.delete(instanceId);
|
|
256
|
+
removeInstance(instanceId);
|
|
257
|
+
}
|
|
258
|
+
return cloneInstance(live.record);
|
|
259
|
+
}
|
|
260
|
+
async handleRpc(instanceId, command) {
|
|
261
|
+
const live = this.liveInstances.get(instanceId);
|
|
262
|
+
const rpcProcess = live ? this.getRpcProcess(live) : undefined;
|
|
263
|
+
if (!live || !rpcProcess) {
|
|
264
|
+
return undefined;
|
|
265
|
+
}
|
|
266
|
+
const response = await rpcProcess.send(command);
|
|
267
|
+
if (shouldRefreshSessionMetadata(command)) {
|
|
268
|
+
await this.syncInstanceRecord(live);
|
|
269
|
+
}
|
|
270
|
+
return response;
|
|
271
|
+
}
|
|
272
|
+
async shutdown() {
|
|
273
|
+
for (const instanceId of [...this.liveInstances.keys()]) {
|
|
274
|
+
await this.stopInstance(instanceId);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
export const supervisor = new OrchestratorSupervisor();
|
|
279
|
+
radiusPresence.setCoordinator({
|
|
280
|
+
getLiveInstance(instanceId) {
|
|
281
|
+
return supervisor.getLiveInstance(instanceId);
|
|
282
|
+
},
|
|
283
|
+
listLiveInstances() {
|
|
284
|
+
return supervisor.listLiveInstances();
|
|
285
|
+
},
|
|
286
|
+
updateInstance(instance) {
|
|
287
|
+
supervisor.updateInstance(instance);
|
|
288
|
+
},
|
|
289
|
+
});
|
|
290
|
+
//# sourceMappingURL=supervisor.js.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@earendil-works/pi-orchestrator",
|
|
3
|
+
"version": "0.80.3",
|
|
4
|
+
"description": "experimental orchestrator package for pi",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md",
|
|
17
|
+
"CHANGELOG.md"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"clean": "shx rm -rf dist",
|
|
21
|
+
"dev": "tsgo -p tsconfig.build.json --watch --preserveWatchOutput",
|
|
22
|
+
"build": "tsgo -p tsconfig.build.json && shx chmod +x dist/cli.js",
|
|
23
|
+
"prepublishOnly": "npm run clean && npm run build"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"pi",
|
|
27
|
+
"orchestrator"
|
|
28
|
+
],
|
|
29
|
+
"author": "Earendil Works",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "git+https://github.com/earendil-works/pi.git",
|
|
34
|
+
"directory": "packages/orchestrator"
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=22.19.0"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@earendil-works/pi-coding-agent": "^0.80.3"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"shx": "0.4.0"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -371,6 +371,9 @@ export class Markdown {
|
|
|
371
371
|
};
|
|
372
372
|
for (const token of tokens) {
|
|
373
373
|
switch (token.type) {
|
|
374
|
+
case "escape":
|
|
375
|
+
result += applyTextWithNewlines(this.options.preserveBackslashEscapes ? token.raw : token.text);
|
|
376
|
+
break;
|
|
374
377
|
case "text":
|
|
375
378
|
// Text tokens in list items can have nested tokens for inline formatting
|
|
376
379
|
if (token.tokens && token.tokens.length > 0) {
|