@code-yeongyu/senpi 2026.7.14 → 2026.7.16-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +143 -0
- package/README.md +6 -6
- package/dist/bun/cli.js +2 -0
- package/dist/bun/cli.js.map +1 -1
- package/dist/cli/args.js +1 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/list-models.d.ts +2 -2
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +3 -3
- package/dist/cli/list-models.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +3 -0
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +4 -3
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +14 -5
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +8 -4
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +81 -30
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-providers.js +1 -1
- package/dist/core/auth-providers.js.map +1 -1
- package/dist/core/auth-storage.d.ts +32 -87
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +158 -221
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/cache-stats.d.ts +2 -2
- package/dist/core/cache-stats.d.ts.map +1 -1
- package/dist/core/cache-stats.js +1 -1
- package/dist/core/cache-stats.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/dynamic-prompt/build.d.ts.map +1 -1
- package/dist/core/dynamic-prompt/build.js +6 -1
- package/dist/core/dynamic-prompt/build.js.map +1 -1
- package/dist/core/extensions/builtin/bash-timeout/timeout.js +2 -2
- package/dist/core/extensions/builtin/bash-timeout/timeout.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js +22 -13
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/runtime-session.d.ts +1 -1
- package/dist/core/extensions/builtin/terminal/runtime-session.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/runtime-session.js +3 -2
- package/dist/core/extensions/builtin/terminal/runtime-session.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +8 -2
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +1 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +3 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +15 -2
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/model-config.d.ts +589 -0
- package/dist/core/model-config.d.ts.map +1 -0
- package/dist/core/model-config.js +288 -0
- package/dist/core/model-config.js.map +1 -0
- package/dist/core/model-registry.d.ts +17 -146
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +69 -943
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts +8 -5
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +19 -18
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +81 -0
- package/dist/core/model-runtime.d.ts.map +1 -0
- package/dist/core/model-runtime.js +442 -0
- package/dist/core/model-runtime.js.map +1 -0
- package/dist/core/models-store.d.ts +17 -0
- package/dist/core/models-store.d.ts.map +1 -0
- package/dist/core/models-store.js +46 -0
- package/dist/core/models-store.js.map +1 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +7 -2
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/provider-composer.d.ts +64 -0
- package/dist/core/provider-composer.d.ts.map +1 -0
- package/dist/core/provider-composer.js +406 -0
- package/dist/core/provider-composer.js.map +1 -0
- package/dist/core/provider-display-names.d.ts.map +1 -1
- package/dist/core/provider-display-names.js +2 -1
- package/dist/core/provider-display-names.js.map +1 -1
- package/dist/core/radius.d.ts +2 -0
- package/dist/core/radius.d.ts.map +1 -0
- package/dist/core/radius.js +2 -0
- package/dist/core/radius.js.map +1 -0
- package/dist/core/remote-catalog-provider.d.ts +5 -0
- package/dist/core/remote-catalog-provider.d.ts.map +1 -0
- package/dist/core/remote-catalog-provider.js +83 -0
- package/dist/core/remote-catalog-provider.js.map +1 -0
- package/dist/core/runtime-credentials.d.ts +15 -0
- package/dist/core/runtime-credentials.d.ts.map +1 -0
- package/dist/core/runtime-credentials.js +35 -0
- package/dist/core/runtime-credentials.js.map +1 -0
- package/dist/core/sdk.d.ts +11 -20
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +61 -89
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/skills.js +1 -1
- package/dist/core/skills.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +1 -11
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +10 -13
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +22 -10
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/footer.js +1 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +4 -8
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +14 -12
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +13 -4
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +84 -41
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +4 -4
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +14 -25
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +5 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +155 -129
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +70 -8
- package/dist/package-manager-cli.js.map +1 -1
- package/docs/custom-provider.md +8 -11
- package/docs/extensions.md +78 -555
- package/docs/models.md +4 -0
- package/docs/packages.md +1 -0
- package/docs/providers.md +23 -11
- package/docs/sdk.md +79 -105
- package/docs/usage.md +1 -0
- package/examples/AGENTS.md +34 -0
- package/examples/extensions/README.md +1 -0
- package/examples/extensions/custom-provider-anthropic/index.ts +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/kimi-deferred-tools.ts +61 -0
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/sdk/02-custom-model.ts +5 -8
- package/examples/sdk/09-api-keys-and-oauth.ts +13 -31
- package/examples/sdk/12-full-control.ts +8 -13
- package/examples/sdk/README.md +14 -18
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +32 -0
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +3 -3
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/local-module-loader.ts +2 -2
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/rewrite-imports.ts +4 -4
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/render.ts +32 -32
- package/node_modules/@earendil-works/pi-agent-core/package.json +4 -4
- package/node_modules/@earendil-works/pi-ai/README.md +80 -25
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +23 -42
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +10 -6
- package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/lazy.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/lazy.js +9 -10
- package/node_modules/@earendil-works/pi-ai/dist/api/lazy.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +4 -3
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +54 -5
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +23 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +24 -6
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.d.ts +97 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js +307 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.lazy.d.ts +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.lazy.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.lazy.js +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.lazy.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/credential-store.d.ts +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/credential-store.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/credential-store.js +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/credential-store.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/helpers.d.ts +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/helpers.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/helpers.js +4 -3
- package/node_modules/@earendil-works/pi-ai/dist/auth/helpers.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic.d.ts +9 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/{utils → auth}/oauth/anthropic.js +51 -116
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/device-code.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/device-code.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/github-copilot.d.ts +6 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/github-copilot.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/{utils → auth}/oauth/github-copilot.js +18 -77
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/github-copilot.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.d.ts +23 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.js +49 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/oauth-page.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/oauth-page.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.d.ts +9 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/{utils → auth}/oauth/openai-codex.js +61 -155
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/pkce.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/pkce.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/radius.d.ts +16 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/radius.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/radius.js +316 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/radius.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/xai.d.ts +6 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/xai.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/xai.js +189 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/xai.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts +2 -4
- package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js +9 -7
- package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts +49 -10
- package/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/bun-oauth.d.ts +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/bun-oauth.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/bun-oauth.js +17 -0
- package/node_modules/@earendil-works/pi-ai/dist/bun-oauth.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/cli.js +58 -76
- package/node_modules/@earendil-works/pi-ai/dist/cli.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/compat/extension-oauth-types.d.ts +42 -0
- package/node_modules/@earendil-works/pi-ai/dist/compat/extension-oauth-types.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/compat/extension-oauth-types.js +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/compat/extension-oauth-types.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/compat.d.ts +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/compat.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/compat.js +49 -22
- package/node_modules/@earendil-works/pi-ai/dist/compat.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/images-models.d.ts +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/images-models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/images-models.js +5 -4
- package/node_modules/@earendil-works/pi-ai/dist/images-models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +3 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models-store.d.ts +25 -0
- package/node_modules/@earendil-works/pi-ai/dist/models-store.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/models-store.js +16 -0
- package/node_modules/@earendil-works/pi-ai/dist/models-store.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/models.d.ts +69 -30
- package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +328 -120
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.js +217 -31
- package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/oauth.d.ts +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/oauth.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/oauth.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/oauth.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/all.d.ts +11 -6
- package/node_modules/@earendil-works/pi-ai/dist/providers/all.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/all.js +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/all.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js +51 -10
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.js +4 -3
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-auth.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-auth.js +13 -20
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-auth.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-stream.d.ts +8 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-stream.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-stream.js +21 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-stream.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.js +11 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.d.ts +1 -6
- package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.js +1 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.js +56 -5
- package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.d.ts +66 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.js +42 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.d.ts +36 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.js +19 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.d.ts +36 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.js +19 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.d.ts +57 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.js +19 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.d.ts +42 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.js +175 -139
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/radius-config.d.ts +26 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/radius-config.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/radius-config.js +59 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/radius-config.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/radius.d.ts +9 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/radius.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/radius.js +54 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/radius.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.d.ts +84 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.js +74 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/xai.d.ts +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/xai.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/xai.js +15 -3
- package/node_modules/@earendil-works/pi-ai/dist/providers/xai.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.d.ts +6 -114
- package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.js +3 -92
- package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.js +9 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.d.ts +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.js +6 -2
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/coerce-parameters.d.ts +8 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/coerce-parameters.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/coerce-parameters.js +92 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/coerce-parameters.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/format.d.ts +6 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/format.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/format.js +54 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/format.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/index.d.ts +4 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/index.js +4 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/index.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/invoke-match.d.ts +7 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/invoke-match.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/invoke-match.js +16 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/invoke-match.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/invoke-tag-scanner.d.ts +19 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/invoke-tag-scanner.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/invoke-tag-scanner.js +217 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/invoke-tag-scanner.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/parse.d.ts +4 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/parse.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/parse.js +46 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/parse.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/stream-boundary.d.ts +13 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/stream-boundary.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/stream-boundary.js +144 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/stream-boundary.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/stream.d.ts +5 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/stream.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/stream.js +208 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/stream.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/tool-resolver.d.ts +4 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/tool-resolver.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/tool-resolver.js +17 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/tool-resolver.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/xml-entities.d.ts +5 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/xml-entities.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/xml-entities.js +34 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/xml-entities.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.d.ts +3 -1
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +12 -5
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +6 -1
- package/node_modules/@earendil-works/pi-pty/native/prebuilds/darwin-arm64/senpi_pty.darwin-arm64.node +0 -0
- package/node_modules/@earendil-works/pi-pty/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.js +22 -4
- package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/package.json +6 -6
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.d.ts +0 -27
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/anthropic.js.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/device-code.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/device-code.js.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.d.ts +0 -32
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.d.ts +0 -58
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.js +0 -122
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.js.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/load.d.ts +0 -5
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/load.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/load.js +0 -22
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/load.js.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/oauth-page.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/oauth-page.js.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.d.ts +0 -45
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.js.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/pkce.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/pkce.js.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.d.ts +0 -64
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.js +0 -2
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/types.js.map +0 -1
- /package/node_modules/@earendil-works/pi-ai/dist/{utils → auth}/oauth/device-code.d.ts +0 -0
- /package/node_modules/@earendil-works/pi-ai/dist/{utils → auth}/oauth/device-code.js +0 -0
- /package/node_modules/@earendil-works/pi-ai/dist/{utils → auth}/oauth/oauth-page.d.ts +0 -0
- /package/node_modules/@earendil-works/pi-ai/dist/{utils → auth}/oauth/oauth-page.js +0 -0
- /package/node_modules/@earendil-works/pi-ai/dist/{utils → auth}/oauth/pkce.d.ts +0 -0
- /package/node_modules/@earendil-works/pi-ai/dist/{utils → auth}/oauth/pkce.js +0 -0
package/docs/models.md
CHANGED
|
@@ -136,6 +136,7 @@ Set `api` at provider level (default for all models) or model level (override pe
|
|
|
136
136
|
| `baseUrl` | API endpoint URL |
|
|
137
137
|
| `api` | API type (see above) |
|
|
138
138
|
| `apiKey` | Optional API key config (see value resolution below). Omit it when auth is provided by `/login`/`auth.json` or CLI `--api-key`. |
|
|
139
|
+
| `oauth` | Dynamic OAuth provider type. Currently supports `"radius"`; requires the gateway `baseUrl`. |
|
|
139
140
|
| `headers` | Custom headers (see value resolution below) |
|
|
140
141
|
| `authHeader` | Set `true` to add `Authorization: Bearer <apiKey>` automatically |
|
|
141
142
|
| `models` | Array of model configurations |
|
|
@@ -447,7 +448,10 @@ For providers with partial OpenAI compatibility, use the `compat` field.
|
|
|
447
448
|
| `thinkingFormat` | Use `reasoning_effort`, `openrouter`, `deepseek`, `together`, `zai`, `qwen`, `chat-template`, or `qwen-chat-template` thinking parameters |
|
|
448
449
|
| `chatTemplateKwargs` | `chat_template_kwargs` values for `thinkingFormat: "chat-template"`; use `{ "$var": "thinking.enabled" }` or `{ "$var": "thinking.effort" }` for pi-controlled thinking values |
|
|
449
450
|
| `cacheControlFormat` | Use Anthropic-style `cache_control` markers on the system prompt, last tool definition, and last user/assistant text content. Currently only `anthropic` is supported. |
|
|
451
|
+
| `sendSessionAffinityHeaders` | For `openai-completions`, send session-affinity headers from the session id when caching is enabled. Default: `false`. |
|
|
452
|
+
| `sessionAffinityFormat` | For `openai-completions` and `openai-responses`, the session-affinity header format: `openai` sends `session_id`/`x-client-request-id` (completions also `x-session-affinity`), `openai-nosession` omits the underscore-containing `session_id` header, `openrouter` sends `x-session-id`. Does not affect the `prompt_cache_key` body param. Default: auto-detected. |
|
|
450
453
|
| `supportsStrictMode` | Include the `strict` field in tool definitions |
|
|
454
|
+
| `deferredToolsMode` | Use provider-specific deferred tool serialization. Currently only `"kimi"` is supported for Kimi's OpenAI-compatible Chat Completions format. |
|
|
451
455
|
| `supportsLongCacheRetention` | Whether the provider accepts long cache retention when cache retention is `long`: `prompt_cache_retention: "24h"` for OpenAI prompt caching, or `cache_control.ttl: "1h"` when `cacheControlFormat` is `anthropic`. Default: `true`. |
|
|
452
456
|
| `openRouterRouting` | OpenRouter provider routing preferences. This object is sent as-is in the `provider` field of the [OpenRouter API request](https://openrouter.ai/docs/guides/routing/provider-selection). |
|
|
453
457
|
| `vercelGatewayRouting` | Vercel AI Gateway routing config for provider selection (`only`, `order`) |
|
package/docs/packages.md
CHANGED
|
@@ -31,6 +31,7 @@ pi list # show installed packages from settings
|
|
|
31
31
|
pi update # update pi only
|
|
32
32
|
pi update --all # update pi, update packages, and reconcile pinned git refs
|
|
33
33
|
pi update --extensions # update packages and reconcile pinned git refs only
|
|
34
|
+
pi update --models # refresh model catalogs only
|
|
34
35
|
pi update --self # update pi only
|
|
35
36
|
pi update --self --force # reinstall pi even if current
|
|
36
37
|
pi update npm:@foo/bar # update one package
|
package/docs/providers.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Providers
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Pi supports subscription-based providers via OAuth and API key providers via environment variables or auth file. Built-in catalogs ship with pi; configured providers may refresh newer catalogs and cache them in `~/.pi/agent/models-store.json` for offline use.
|
|
4
4
|
|
|
5
5
|
## Table of Contents
|
|
6
6
|
|
|
@@ -18,8 +18,10 @@ Use `/login` in interactive mode, then select a provider:
|
|
|
18
18
|
- ChatGPT Plus/Pro (Codex)
|
|
19
19
|
- Claude Pro/Max
|
|
20
20
|
- GitHub Copilot
|
|
21
|
+
- xAI (Grok/X subscription)
|
|
22
|
+
- Radius
|
|
21
23
|
|
|
22
|
-
Use `/logout` to clear credentials. Tokens are stored in `~/.
|
|
24
|
+
Use `/logout` to clear credentials. Tokens are stored in `~/.pi/agent/auth.json` and auto-refresh when expired.
|
|
23
25
|
|
|
24
26
|
### OpenAI Codex
|
|
25
27
|
|
|
@@ -35,6 +37,15 @@ Anthropic subscription auth is active for Claude Pro/Max accounts. Third-party h
|
|
|
35
37
|
- Press Enter for github.com, or enter your GitHub Enterprise Server domain
|
|
36
38
|
- If you get "model not supported", enable it in VS Code: Copilot Chat → model selector → select model → "Enable"
|
|
37
39
|
|
|
40
|
+
### xAI (Grok/X subscription)
|
|
41
|
+
|
|
42
|
+
- Run `/login xai`, then select **Use a subscription**
|
|
43
|
+
- `XAI_API_KEY` remains available through **Use an API key**
|
|
44
|
+
|
|
45
|
+
### Radius
|
|
46
|
+
|
|
47
|
+
Radius is a dynamic `pi-messages` gateway. `/login radius` stores OAuth tokens in `auth.json`; the gateway catalog is refreshed independently and cached in `models-store.json`. Custom Radius gateways can be declared in `models.json` with `"oauth": "radius"` and a gateway `baseUrl`.
|
|
48
|
+
|
|
38
49
|
## API Keys
|
|
39
50
|
|
|
40
51
|
### Environment Variables or Auth File
|
|
@@ -43,7 +54,7 @@ Use `/login` in interactive mode and select a provider to store an API key in `a
|
|
|
43
54
|
|
|
44
55
|
```bash
|
|
45
56
|
export ANTHROPIC_API_KEY=sk-ant-...
|
|
46
|
-
|
|
57
|
+
pi
|
|
47
58
|
```
|
|
48
59
|
|
|
49
60
|
| Provider | Environment Variable | `auth.json` key |
|
|
@@ -68,6 +79,7 @@ senpi
|
|
|
68
79
|
| ZAI Coding Plan (China) | `ZAI_CODING_CN_API_KEY` | `zai-coding-cn` |
|
|
69
80
|
| OpenCode Zen | `OPENCODE_API_KEY` | `opencode` |
|
|
70
81
|
| OpenCode Go | `OPENCODE_API_KEY` | `opencode-go` |
|
|
82
|
+
| Radius | `RADIUS_API_KEY` | `radius` |
|
|
71
83
|
| Hugging Face | `HF_TOKEN` | `huggingface` |
|
|
72
84
|
| Fireworks | `FIREWORKS_API_KEY` | `fireworks` |
|
|
73
85
|
| Together AI | `TOGETHER_API_KEY` | `together` |
|
|
@@ -79,11 +91,11 @@ senpi
|
|
|
79
91
|
| Xiaomi MiMo Token Plan (Amsterdam) | `XIAOMI_TOKEN_PLAN_AMS_API_KEY` | `xiaomi-token-plan-ams` |
|
|
80
92
|
| Xiaomi MiMo Token Plan (Singapore) | `XIAOMI_TOKEN_PLAN_SGP_API_KEY` | `xiaomi-token-plan-sgp` |
|
|
81
93
|
|
|
82
|
-
Reference for environment variables and `auth.json` keys: [`const envMap`](https://github.com/
|
|
94
|
+
Reference for environment variables and `auth.json` keys: [`const envMap`](https://github.com/earendil-works/pi-mono/blob/main/packages/ai/src/env-api-keys.ts) in [`packages/ai/src/env-api-keys.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/ai/src/env-api-keys.ts).
|
|
83
95
|
|
|
84
96
|
#### Auth File
|
|
85
97
|
|
|
86
|
-
Store credentials in `~/.
|
|
98
|
+
Store credentials in `~/.pi/agent/auth.json`:
|
|
87
99
|
|
|
88
100
|
```json
|
|
89
101
|
{
|
|
@@ -191,14 +203,14 @@ export AWS_REGION=us-west-2
|
|
|
191
203
|
Also supports ECS task roles (`AWS_CONTAINER_CREDENTIALS_*`) and IRSA (`AWS_WEB_IDENTITY_TOKEN_FILE`).
|
|
192
204
|
|
|
193
205
|
```bash
|
|
194
|
-
|
|
206
|
+
pi --provider amazon-bedrock --model us.anthropic.claude-sonnet-4-20250514-v1:0
|
|
195
207
|
```
|
|
196
208
|
|
|
197
209
|
Prompt caching is enabled automatically for Claude models whose ID contains a recognizable model name (base models and system-defined inference profiles). For application inference profiles (whose ARNs don't contain the model name), set `AWS_BEDROCK_FORCE_CACHE=1` to enable cache points:
|
|
198
210
|
|
|
199
211
|
```bash
|
|
200
212
|
export AWS_BEDROCK_FORCE_CACHE=1
|
|
201
|
-
|
|
213
|
+
pi --provider amazon-bedrock --model arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/abc123
|
|
202
214
|
```
|
|
203
215
|
|
|
204
216
|
If you are connecting to a Bedrock API proxy, the following environment variables can be used:
|
|
@@ -222,7 +234,7 @@ export AWS_BEDROCK_FORCE_HTTP1=1
|
|
|
222
234
|
export CLOUDFLARE_API_KEY=... # or use /login
|
|
223
235
|
export CLOUDFLARE_ACCOUNT_ID=...
|
|
224
236
|
export CLOUDFLARE_GATEWAY_ID=... # create at dash.cloudflare.com → AI → AI Gateway
|
|
225
|
-
|
|
237
|
+
pi --provider cloudflare-ai-gateway --model "claude-sonnet-4-5"
|
|
226
238
|
```
|
|
227
239
|
|
|
228
240
|
Routes to OpenAI, Anthropic, and Workers AI through Cloudflare AI Gateway. Workers AI uses the Unified API (`/compat`) and prefixed model IDs (`workers-ai/@cf/...`). OpenAI uses the OpenAI passthrough route (`/openai`) with native OpenAI model IDs such as `gpt-5.1`. Anthropic uses the Anthropic passthrough route (`/anthropic`) with native Anthropic model IDs such as `claude-sonnet-4-5`.
|
|
@@ -236,7 +248,7 @@ AI Gateway authentication uses `CLOUDFLARE_API_KEY` as `cf-aig-authorization`. U
|
|
|
236
248
|
| Stored BYOK | Cloudflare token only | Cloudflare injects provider keys stored in the AI Gateway dashboard |
|
|
237
249
|
| Inline BYOK | Cloudflare token plus upstream `Authorization` header | The request supplies the upstream provider key |
|
|
238
250
|
|
|
239
|
-
For normal
|
|
251
|
+
For normal pi usage, prefer unified billing or stored BYOK. Inline BYOK requires configuring an additional upstream `Authorization` header for the Cloudflare AI Gateway provider, for example via a `models.json` provider/model override.
|
|
240
252
|
|
|
241
253
|
### Cloudflare Workers AI
|
|
242
254
|
|
|
@@ -245,10 +257,10 @@ For normal senpi usage, prefer unified billing or stored BYOK. Inline BYOK requi
|
|
|
245
257
|
```bash
|
|
246
258
|
export CLOUDFLARE_API_KEY=... # or use /login
|
|
247
259
|
export CLOUDFLARE_ACCOUNT_ID=...
|
|
248
|
-
|
|
260
|
+
pi --provider cloudflare-workers-ai --model "@cf/moonshotai/kimi-k2.6"
|
|
249
261
|
```
|
|
250
262
|
|
|
251
|
-
|
|
263
|
+
Pi automatically sets `x-session-affinity` for [prefix caching](https://developers.cloudflare.com/workers-ai/features/prompt-caching/) discounts.
|
|
252
264
|
|
|
253
265
|
### Google Vertex AI
|
|
254
266
|
|
package/docs/sdk.md
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
>
|
|
1
|
+
> pi can help you use the SDK. Ask it to build an integration for your use case.
|
|
2
2
|
|
|
3
3
|
# SDK
|
|
4
4
|
|
|
5
|
-
The SDK provides programmatic access to
|
|
5
|
+
The SDK provides programmatic access to pi's agent capabilities. Use it to embed pi in other applications, build custom interfaces, or integrate with automated workflows.
|
|
6
6
|
|
|
7
7
|
**Example use cases:**
|
|
8
8
|
- Build a custom UI (web, desktop, mobile)
|
|
9
9
|
- Integrate agent capabilities into existing applications
|
|
10
10
|
- Create automated pipelines with agent reasoning
|
|
11
|
+
- Build custom tools that spawn sub-agents
|
|
11
12
|
- Test agent behavior programmatically
|
|
12
13
|
|
|
13
14
|
See [examples/sdk/](../examples/sdk/) for working examples from minimal to full control.
|
|
@@ -15,16 +16,12 @@ See [examples/sdk/](../examples/sdk/) for working examples from minimal to full
|
|
|
15
16
|
## Quick Start
|
|
16
17
|
|
|
17
18
|
```typescript
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
// Set up credential storage and model registry
|
|
21
|
-
const authStorage = AuthStorage.create();
|
|
22
|
-
const modelRegistry = ModelRegistry.create(authStorage);
|
|
19
|
+
import { createAgentSession, ModelRuntime, SessionManager } from "@earendil-works/pi-coding-agent";
|
|
23
20
|
|
|
21
|
+
const modelRuntime = await ModelRuntime.create();
|
|
24
22
|
const { session } = await createAgentSession({
|
|
25
23
|
sessionManager: SessionManager.inMemory(),
|
|
26
|
-
|
|
27
|
-
modelRegistry,
|
|
24
|
+
modelRuntime,
|
|
28
25
|
});
|
|
29
26
|
|
|
30
27
|
session.subscribe((event) => {
|
|
@@ -39,7 +36,7 @@ await session.prompt("What files are in the current directory?");
|
|
|
39
36
|
## Installation
|
|
40
37
|
|
|
41
38
|
```bash
|
|
42
|
-
npm install @
|
|
39
|
+
npm install @earendil-works/pi-coding-agent
|
|
43
40
|
```
|
|
44
41
|
|
|
45
42
|
The SDK is included in the main package. No separate installation needed.
|
|
@@ -53,7 +50,7 @@ The main factory function for a single `AgentSession`.
|
|
|
53
50
|
`createAgentSession()` uses a `ResourceLoader` to supply extensions, skills, prompt templates, themes, and context files. If you do not provide one, it uses `DefaultResourceLoader` with standard discovery.
|
|
54
51
|
|
|
55
52
|
```typescript
|
|
56
|
-
import { createAgentSession, SessionManager } from "@
|
|
53
|
+
import { createAgentSession, SessionManager } from "@earendil-works/pi-coding-agent";
|
|
57
54
|
|
|
58
55
|
// Minimal: defaults with DefaultResourceLoader
|
|
59
56
|
const { session } = await createAgentSession();
|
|
@@ -131,7 +128,7 @@ import {
|
|
|
131
128
|
createAgentSessionServices,
|
|
132
129
|
getAgentDir,
|
|
133
130
|
SessionManager,
|
|
134
|
-
} from "@
|
|
131
|
+
} from "@earendil-works/pi-coding-agent";
|
|
135
132
|
|
|
136
133
|
const createRuntime: CreateAgentSessionRuntimeFactory = async ({ cwd, sessionManager, sessionStartEvent }) => {
|
|
137
134
|
const services = await createAgentSessionServices({ cwd });
|
|
@@ -209,7 +206,7 @@ await session.prompt("What files are here?");
|
|
|
209
206
|
|
|
210
207
|
// With images
|
|
211
208
|
await session.prompt("What's in this image?", {
|
|
212
|
-
images: [{ type: "image",
|
|
209
|
+
images: [{ type: "image", source: { type: "base64", mediaType: "image/png", data: "..." } }]
|
|
213
210
|
});
|
|
214
211
|
|
|
215
212
|
// During streaming: must specify how to queue the message
|
|
@@ -337,23 +334,23 @@ const { session } = await createAgentSession({
|
|
|
337
334
|
cwd: process.cwd(), // default
|
|
338
335
|
|
|
339
336
|
// Global config directory
|
|
340
|
-
agentDir: "~/.
|
|
337
|
+
agentDir: "~/.pi/agent", // default (expands ~)
|
|
341
338
|
});
|
|
342
339
|
```
|
|
343
340
|
|
|
344
341
|
`cwd` is used by `DefaultResourceLoader` for:
|
|
345
|
-
- Project extensions (`.
|
|
342
|
+
- Project extensions (`.pi/extensions/`)
|
|
346
343
|
- Project skills:
|
|
347
|
-
- `.
|
|
344
|
+
- `.pi/skills/`
|
|
348
345
|
- `.agents/skills/` in `cwd` and ancestor directories (up to git repo root, or filesystem root when not in a repo)
|
|
349
|
-
- Project prompts (`.
|
|
346
|
+
- Project prompts (`.pi/prompts/`)
|
|
350
347
|
- Context files (`AGENTS.md` walking up from cwd)
|
|
351
348
|
- Session directory naming
|
|
352
349
|
|
|
353
350
|
`agentDir` is used by `DefaultResourceLoader` for:
|
|
354
351
|
- Global extensions (`extensions/`)
|
|
355
352
|
- Global skills:
|
|
356
|
-
- `skills/` under `agentDir` (for example `~/.
|
|
353
|
+
- `skills/` under `agentDir` (for example `~/.pi/agent/skills/`)
|
|
357
354
|
- `~/.agents/skills/`
|
|
358
355
|
- Global prompts (`prompts/`)
|
|
359
356
|
- Global context file (`AGENTS.md`)
|
|
@@ -368,10 +365,9 @@ When you pass a custom `ResourceLoader`, `cwd` and `agentDir` no longer control
|
|
|
368
365
|
|
|
369
366
|
```typescript
|
|
370
367
|
import { getModel } from "@earendil-works/pi-ai";
|
|
371
|
-
import {
|
|
368
|
+
import { ModelRuntime } from "@earendil-works/pi-coding-agent";
|
|
372
369
|
|
|
373
|
-
const
|
|
374
|
-
const modelRegistry = ModelRegistry.create(authStorage);
|
|
370
|
+
const modelRuntime = await ModelRuntime.create();
|
|
375
371
|
|
|
376
372
|
// Find specific built-in model (doesn't check if API key exists)
|
|
377
373
|
const opus = getModel("anthropic", "claude-opus-4-5");
|
|
@@ -379,10 +375,10 @@ if (!opus) throw new Error("Model not found");
|
|
|
379
375
|
|
|
380
376
|
// Find any model by provider/id, including custom models from models.json
|
|
381
377
|
// (doesn't check if API key exists)
|
|
382
|
-
const customModel =
|
|
378
|
+
const customModel = modelRuntime.getModel("my-provider", "my-model");
|
|
383
379
|
|
|
384
|
-
// Get only models that have valid
|
|
385
|
-
const available = await
|
|
380
|
+
// Get only models that have valid authentication configured
|
|
381
|
+
const available = await modelRuntime.getAvailable();
|
|
386
382
|
|
|
387
383
|
const { session } = await createAgentSession({
|
|
388
384
|
model: opus,
|
|
@@ -394,8 +390,7 @@ const { session } = await createAgentSession({
|
|
|
394
390
|
{ model: haiku, thinkingLevel: "off" },
|
|
395
391
|
],
|
|
396
392
|
|
|
397
|
-
|
|
398
|
-
modelRegistry,
|
|
393
|
+
modelRuntime,
|
|
399
394
|
});
|
|
400
395
|
```
|
|
401
396
|
|
|
@@ -414,14 +409,14 @@ import {
|
|
|
414
409
|
|
|
415
410
|
const cliModel = resolveCliModel({
|
|
416
411
|
cliModel: "anthropic/claude-opus-4-5:high",
|
|
417
|
-
|
|
412
|
+
modelRuntime,
|
|
418
413
|
});
|
|
419
414
|
if (cliModel.error) throw new Error(cliModel.error);
|
|
420
415
|
if (cliModel.warning) console.warn(cliModel.warning);
|
|
421
416
|
|
|
422
417
|
const { scopedModels, diagnostics } = await resolveModelScopeWithDiagnostics(
|
|
423
418
|
["anthropic/*:high", "gpt-5"],
|
|
424
|
-
|
|
419
|
+
modelRuntime,
|
|
425
420
|
);
|
|
426
421
|
for (const diagnostic of diagnostics) {
|
|
427
422
|
console.warn(diagnostic.message);
|
|
@@ -434,40 +429,41 @@ for (const diagnostic of diagnostics) {
|
|
|
434
429
|
|
|
435
430
|
### API Keys and OAuth
|
|
436
431
|
|
|
437
|
-
|
|
432
|
+
Authentication resolution priority (handled by `ModelRuntime`):
|
|
438
433
|
1. Runtime overrides (via `setRuntimeApiKey`, not persisted)
|
|
439
434
|
2. Stored credentials in `auth.json` (API keys or OAuth tokens)
|
|
440
435
|
3. Environment variables (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, etc.)
|
|
441
436
|
4. Fallback resolver (for custom provider keys from `models.json`)
|
|
442
437
|
|
|
443
438
|
```typescript
|
|
444
|
-
import {
|
|
439
|
+
import { InMemoryCredentialStore } from "@earendil-works/pi-ai";
|
|
440
|
+
import { createAgentSession, ModelRuntime } from "@earendil-works/pi-coding-agent";
|
|
445
441
|
|
|
446
|
-
// Default: uses ~/.
|
|
447
|
-
const
|
|
448
|
-
const modelRegistry = ModelRegistry.create(authStorage);
|
|
442
|
+
// Default: uses ~/.pi/agent/auth.json and ~/.pi/agent/models.json
|
|
443
|
+
const modelRuntime = await ModelRuntime.create();
|
|
449
444
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
}
|
|
445
|
+
// Provider-owned auth methods and current status
|
|
446
|
+
for (const provider of modelRuntime.getProviders()) {
|
|
447
|
+
const status = await modelRuntime.checkAuth(provider.id);
|
|
448
|
+
console.log(provider.name, provider.auth, status);
|
|
449
|
+
}
|
|
455
450
|
|
|
456
451
|
// Runtime API key override (not persisted to disk)
|
|
457
|
-
|
|
452
|
+
modelRuntime.setRuntimeApiKey("anthropic", "sk-my-temp-key");
|
|
453
|
+
|
|
454
|
+
// Custom credential and model locations
|
|
455
|
+
const customRuntime = await ModelRuntime.create({
|
|
456
|
+
authPath: "/my/app/auth.json",
|
|
457
|
+
modelsPath: "/my/app/models.json",
|
|
458
|
+
});
|
|
458
459
|
|
|
459
|
-
//
|
|
460
|
-
const
|
|
461
|
-
const
|
|
460
|
+
// Or inject any pi-ai CredentialStore
|
|
461
|
+
const credentials = new InMemoryCredentialStore();
|
|
462
|
+
const inMemoryRuntime = await ModelRuntime.create({ credentials });
|
|
462
463
|
|
|
463
464
|
const { session } = await createAgentSession({
|
|
464
|
-
|
|
465
|
-
authStorage: customAuth,
|
|
466
|
-
modelRegistry: customRegistry,
|
|
465
|
+
modelRuntime: customRuntime,
|
|
467
466
|
});
|
|
468
|
-
|
|
469
|
-
// No custom models.json (built-in models only)
|
|
470
|
-
const simpleRegistry = ModelRegistry.inMemory(authStorage);
|
|
471
467
|
```
|
|
472
468
|
|
|
473
469
|
> See [examples/sdk/09-api-keys-and-oauth.ts](../examples/sdk/09-api-keys-and-oauth.ts)
|
|
@@ -477,7 +473,7 @@ const simpleRegistry = ModelRegistry.inMemory(authStorage);
|
|
|
477
473
|
Use a `ResourceLoader` to override the system prompt:
|
|
478
474
|
|
|
479
475
|
```typescript
|
|
480
|
-
import { createAgentSession, DefaultResourceLoader } from "@
|
|
476
|
+
import { createAgentSession, DefaultResourceLoader } from "@earendil-works/pi-coding-agent";
|
|
481
477
|
|
|
482
478
|
const loader = new DefaultResourceLoader({
|
|
483
479
|
systemPromptOverride: () => "You are a helpful assistant.",
|
|
@@ -499,10 +495,10 @@ Specify which built-in tools to enable:
|
|
|
499
495
|
- `noTools: "builtin"` disables default built-ins while keeping extension and custom tools enabled
|
|
500
496
|
- `excludeTools` disables specific built-in, extension, or custom tool names after any `tools` allowlist is applied
|
|
501
497
|
|
|
502
|
-
The `edit` tool returns `details.diff` for
|
|
498
|
+
The `edit` tool returns `details.diff` for Pi's TUI display and `details.patch` as a standard unified patch for SDK consumers.
|
|
503
499
|
|
|
504
500
|
```typescript
|
|
505
|
-
import { createAgentSession } from "@
|
|
501
|
+
import { createAgentSession } from "@earendil-works/pi-coding-agent";
|
|
506
502
|
|
|
507
503
|
// Read-only mode
|
|
508
504
|
const { session } = await createAgentSession({
|
|
@@ -525,7 +521,7 @@ const { session } = await createAgentSession({
|
|
|
525
521
|
When you pass a custom `cwd`, `createAgentSession()` builds selected built-in tools for that cwd.
|
|
526
522
|
|
|
527
523
|
```typescript
|
|
528
|
-
import { createAgentSession, SessionManager } from "@
|
|
524
|
+
import { createAgentSession, SessionManager } from "@earendil-works/pi-coding-agent";
|
|
529
525
|
|
|
530
526
|
const cwd = "/path/to/project";
|
|
531
527
|
|
|
@@ -543,15 +539,13 @@ const { session } = await createAgentSession({
|
|
|
543
539
|
});
|
|
544
540
|
```
|
|
545
541
|
|
|
546
|
-
`createAgentSession()` automatically builds selected built-in tools for the provided `cwd`. Factory helpers such as `createReadTool()` and `createCodingTools()` remain exported for lower-level composition, but most SDK users should pass tool names.
|
|
547
|
-
|
|
548
542
|
> See [examples/sdk/05-tools.ts](../examples/sdk/05-tools.ts)
|
|
549
543
|
|
|
550
544
|
### Custom Tools
|
|
551
545
|
|
|
552
546
|
```typescript
|
|
553
547
|
import { Type } from "typebox";
|
|
554
|
-
import { createAgentSession, defineTool } from "@
|
|
548
|
+
import { createAgentSession, defineTool } from "@earendil-works/pi-coding-agent";
|
|
555
549
|
|
|
556
550
|
// Inline custom tool
|
|
557
551
|
const myTool = defineTool({
|
|
@@ -583,10 +577,10 @@ If you pass `tools`, include each custom or extension tool name you want enabled
|
|
|
583
577
|
|
|
584
578
|
### Extensions
|
|
585
579
|
|
|
586
|
-
Extensions are loaded by the `ResourceLoader`. `DefaultResourceLoader` discovers extensions from `~/.
|
|
580
|
+
Extensions are loaded by the `ResourceLoader`. `DefaultResourceLoader` discovers extensions from `~/.pi/agent/extensions/`, `.pi/extensions/`, and settings.json extension sources.
|
|
587
581
|
|
|
588
582
|
```typescript
|
|
589
|
-
import { createAgentSession, DefaultResourceLoader } from "@
|
|
583
|
+
import { createAgentSession, DefaultResourceLoader } from "@earendil-works/pi-coding-agent";
|
|
590
584
|
|
|
591
585
|
const loader = new DefaultResourceLoader({
|
|
592
586
|
additionalExtensionPaths: ["/path/to/my-extension.ts"],
|
|
@@ -629,7 +623,7 @@ This displays as `<inline:my-provider>` instead of `<inline:1>`. Bare factory fu
|
|
|
629
623
|
**Event Bus:** Extensions can communicate via `pi.events`. Pass a shared `eventBus` to `DefaultResourceLoader` if you need to emit or listen from outside:
|
|
630
624
|
|
|
631
625
|
```typescript
|
|
632
|
-
import { createEventBus, DefaultResourceLoader } from "@
|
|
626
|
+
import { createEventBus, DefaultResourceLoader } from "@earendil-works/pi-coding-agent";
|
|
633
627
|
|
|
634
628
|
const eventBus = createEventBus();
|
|
635
629
|
const loader = new DefaultResourceLoader({
|
|
@@ -647,18 +641,16 @@ eventBus.on("my-extension:status", (data) => console.log(data));
|
|
|
647
641
|
```typescript
|
|
648
642
|
import {
|
|
649
643
|
createAgentSession,
|
|
650
|
-
createSyntheticSourceInfo,
|
|
651
644
|
DefaultResourceLoader,
|
|
652
645
|
type Skill,
|
|
653
|
-
} from "@
|
|
646
|
+
} from "@earendil-works/pi-coding-agent";
|
|
654
647
|
|
|
655
648
|
const customSkill: Skill = {
|
|
656
649
|
name: "my-skill",
|
|
657
650
|
description: "Custom instructions",
|
|
658
651
|
filePath: "/path/to/SKILL.md",
|
|
659
652
|
baseDir: "/path/to",
|
|
660
|
-
|
|
661
|
-
disableModelInvocation: false,
|
|
653
|
+
source: "custom",
|
|
662
654
|
};
|
|
663
655
|
|
|
664
656
|
const loader = new DefaultResourceLoader({
|
|
@@ -677,7 +669,7 @@ const { session } = await createAgentSession({ resourceLoader: loader });
|
|
|
677
669
|
### Context Files
|
|
678
670
|
|
|
679
671
|
```typescript
|
|
680
|
-
import { createAgentSession, DefaultResourceLoader } from "@
|
|
672
|
+
import { createAgentSession, DefaultResourceLoader } from "@earendil-works/pi-coding-agent";
|
|
681
673
|
|
|
682
674
|
const loader = new DefaultResourceLoader({
|
|
683
675
|
agentsFilesOverride: (current) => ({
|
|
@@ -699,16 +691,14 @@ const { session } = await createAgentSession({ resourceLoader: loader });
|
|
|
699
691
|
```typescript
|
|
700
692
|
import {
|
|
701
693
|
createAgentSession,
|
|
702
|
-
createSyntheticSourceInfo,
|
|
703
694
|
DefaultResourceLoader,
|
|
704
695
|
type PromptTemplate,
|
|
705
|
-
} from "@
|
|
696
|
+
} from "@earendil-works/pi-coding-agent";
|
|
706
697
|
|
|
707
698
|
const customCommand: PromptTemplate = {
|
|
708
699
|
name: "deploy",
|
|
709
700
|
description: "Deploy the application",
|
|
710
|
-
|
|
711
|
-
sourceInfo: createSyntheticSourceInfo("/virtual/prompts/deploy.md", { source: "sdk" }),
|
|
701
|
+
source: "(custom)",
|
|
712
702
|
content: "# Deploy\n\n1. Build\n2. Test\n3. Deploy",
|
|
713
703
|
};
|
|
714
704
|
|
|
@@ -738,7 +728,7 @@ import {
|
|
|
738
728
|
createAgentSessionServices,
|
|
739
729
|
getAgentDir,
|
|
740
730
|
SessionManager,
|
|
741
|
-
} from "@
|
|
731
|
+
} from "@earendil-works/pi-coding-agent";
|
|
742
732
|
|
|
743
733
|
// In-memory (no persistence)
|
|
744
734
|
const { session } = await createAgentSession({
|
|
@@ -765,7 +755,7 @@ const { session: opened } = await createAgentSession({
|
|
|
765
755
|
|
|
766
756
|
// List sessions
|
|
767
757
|
const currentProjectSessions = await SessionManager.list(process.cwd());
|
|
768
|
-
const allSessions = await SessionManager.listAll();
|
|
758
|
+
const allSessions = await SessionManager.listAll(process.cwd());
|
|
769
759
|
|
|
770
760
|
// Session replacement API for /new, /resume, /fork, /clone, and import flows.
|
|
771
761
|
const createRuntime: CreateAgentSessionRuntimeFactory = async ({ cwd, sessionManager, sessionStartEvent }) => {
|
|
@@ -807,12 +797,12 @@ const sm = SessionManager.open("/path/to/session.jsonl");
|
|
|
807
797
|
|
|
808
798
|
// Session listing
|
|
809
799
|
const currentProjectSessions = await SessionManager.list(process.cwd());
|
|
810
|
-
const allSessions = await SessionManager.listAll();
|
|
800
|
+
const allSessions = await SessionManager.listAll(process.cwd());
|
|
811
801
|
|
|
812
802
|
// Tree traversal
|
|
813
803
|
const entries = sm.getEntries(); // All entries (excludes header)
|
|
814
804
|
const tree = sm.getTree(); // Full tree structure
|
|
815
|
-
const
|
|
805
|
+
const path = sm.getPath(); // Path from root to current leaf
|
|
816
806
|
const leaf = sm.getLeafEntry(); // Current leaf entry
|
|
817
807
|
const entry = sm.getEntry(id); // Get entry by ID
|
|
818
808
|
const children = sm.getChildren(id); // Direct children of entry
|
|
@@ -832,7 +822,7 @@ sm.createBranchedSession(leafId); // Extract path to new file
|
|
|
832
822
|
### Settings Management
|
|
833
823
|
|
|
834
824
|
```typescript
|
|
835
|
-
import { createAgentSession, SettingsManager, SessionManager } from "@
|
|
825
|
+
import { createAgentSession, SettingsManager, SessionManager } from "@earendil-works/pi-coding-agent";
|
|
836
826
|
|
|
837
827
|
// Default: loads from files (global + project merged)
|
|
838
828
|
const { session } = await createAgentSession({
|
|
@@ -866,8 +856,8 @@ const { session } = await createAgentSession({
|
|
|
866
856
|
**Project-specific settings:**
|
|
867
857
|
|
|
868
858
|
Settings load from two locations and merge:
|
|
869
|
-
1. Global: `~/.
|
|
870
|
-
2. Project: `<cwd>/.
|
|
859
|
+
1. Global: `~/.pi/agent/settings.json`
|
|
860
|
+
2. Project: `<cwd>/.pi/settings.json`
|
|
871
861
|
|
|
872
862
|
Project overrides global. Nested objects merge keys. Setters modify global settings by default.
|
|
873
863
|
|
|
@@ -888,7 +878,7 @@ Use `DefaultResourceLoader` to discover extensions, skills, prompts, themes, and
|
|
|
888
878
|
import {
|
|
889
879
|
DefaultResourceLoader,
|
|
890
880
|
getAgentDir,
|
|
891
|
-
} from "@
|
|
881
|
+
} from "@earendil-works/pi-coding-agent";
|
|
892
882
|
|
|
893
883
|
const loader = new DefaultResourceLoader({
|
|
894
884
|
cwd,
|
|
@@ -932,26 +922,22 @@ interface LoadExtensionsResult {
|
|
|
932
922
|
import { getModel } from "@earendil-works/pi-ai";
|
|
933
923
|
import { Type } from "typebox";
|
|
934
924
|
import {
|
|
935
|
-
AuthStorage,
|
|
936
925
|
createAgentSession,
|
|
937
926
|
DefaultResourceLoader,
|
|
938
927
|
defineTool,
|
|
939
|
-
|
|
928
|
+
ModelRuntime,
|
|
940
929
|
SessionManager,
|
|
941
930
|
SettingsManager,
|
|
942
|
-
} from "@
|
|
943
|
-
|
|
944
|
-
// Set up auth storage (custom location)
|
|
945
|
-
const authStorage = AuthStorage.create("/custom/agent/auth.json");
|
|
931
|
+
} from "@earendil-works/pi-coding-agent";
|
|
946
932
|
|
|
947
|
-
|
|
933
|
+
const modelRuntime = await ModelRuntime.create({
|
|
934
|
+
authPath: "/custom/agent/auth.json",
|
|
935
|
+
modelsPath: "/custom/agent/models.json",
|
|
936
|
+
});
|
|
948
937
|
if (process.env.MY_KEY) {
|
|
949
|
-
|
|
938
|
+
modelRuntime.setRuntimeApiKey("anthropic", process.env.MY_KEY);
|
|
950
939
|
}
|
|
951
940
|
|
|
952
|
-
// Model registry (no custom models.json)
|
|
953
|
-
const modelRegistry = ModelRegistry.create(authStorage);
|
|
954
|
-
|
|
955
941
|
// Inline tool
|
|
956
942
|
const statusTool = defineTool({
|
|
957
943
|
name: "status",
|
|
@@ -987,8 +973,7 @@ const { session } = await createAgentSession({
|
|
|
987
973
|
|
|
988
974
|
model,
|
|
989
975
|
thinkingLevel: "off",
|
|
990
|
-
|
|
991
|
-
modelRegistry,
|
|
976
|
+
modelRuntime,
|
|
992
977
|
|
|
993
978
|
tools: ["read", "bash", "status"],
|
|
994
979
|
customTools: [statusTool],
|
|
@@ -1024,7 +1009,7 @@ import {
|
|
|
1024
1009
|
getAgentDir,
|
|
1025
1010
|
InteractiveMode,
|
|
1026
1011
|
SessionManager,
|
|
1027
|
-
} from "@
|
|
1012
|
+
} from "@earendil-works/pi-coding-agent";
|
|
1028
1013
|
|
|
1029
1014
|
const createRuntime: CreateAgentSessionRuntimeFactory = async ({ cwd, sessionManager, sessionStartEvent }) => {
|
|
1030
1015
|
const services = await createAgentSessionServices({ cwd });
|
|
@@ -1064,7 +1049,7 @@ import {
|
|
|
1064
1049
|
getAgentDir,
|
|
1065
1050
|
runPrintMode,
|
|
1066
1051
|
SessionManager,
|
|
1067
|
-
} from "@
|
|
1052
|
+
} from "@earendil-works/pi-coding-agent";
|
|
1068
1053
|
|
|
1069
1054
|
const createRuntime: CreateAgentSessionRuntimeFactory = async ({ cwd, sessionManager, sessionStartEvent }) => {
|
|
1070
1055
|
const services = await createAgentSessionServices({ cwd });
|
|
@@ -1101,7 +1086,7 @@ import {
|
|
|
1101
1086
|
getAgentDir,
|
|
1102
1087
|
runRpcMode,
|
|
1103
1088
|
SessionManager,
|
|
1104
|
-
} from "@
|
|
1089
|
+
} from "@earendil-works/pi-coding-agent";
|
|
1105
1090
|
|
|
1106
1091
|
const createRuntime: CreateAgentSessionRuntimeFactory = async ({ cwd, sessionManager, sessionStartEvent }) => {
|
|
1107
1092
|
const services = await createAgentSessionServices({ cwd });
|
|
@@ -1122,23 +1107,12 @@ await runRpcMode(runtime);
|
|
|
1122
1107
|
|
|
1123
1108
|
See [RPC documentation](rpc.md) for the JSON protocol.
|
|
1124
1109
|
|
|
1125
|
-
### App Server Mode
|
|
1126
|
-
|
|
1127
|
-
App Server mode is a CLI run mode for Codex-compatible app and editor integrations. Use it when a client expects the Codex app-server JSON-RPC method names, notification stream, and thread lifecycle instead of senpi's SDK object model.
|
|
1128
|
-
|
|
1129
|
-
```bash
|
|
1130
|
-
senpi app-server --listen ws://127.0.0.1:18990
|
|
1131
|
-
senpi app-server --listen stdio://
|
|
1132
|
-
```
|
|
1133
|
-
|
|
1134
|
-
See [App Server documentation](app-server.md) for activation, framing, method coverage, and compatibility notes.
|
|
1135
|
-
|
|
1136
1110
|
## RPC Mode Alternative
|
|
1137
1111
|
|
|
1138
1112
|
For subprocess-based integration without building with the SDK, use the CLI directly:
|
|
1139
1113
|
|
|
1140
1114
|
```bash
|
|
1141
|
-
|
|
1115
|
+
pi --mode rpc --no-session
|
|
1142
1116
|
```
|
|
1143
1117
|
|
|
1144
1118
|
See [RPC documentation](rpc.md) for the JSON protocol.
|
|
@@ -1165,8 +1139,8 @@ createAgentSessionRuntime
|
|
|
1165
1139
|
AgentSessionRuntime
|
|
1166
1140
|
|
|
1167
1141
|
// Auth and Models
|
|
1168
|
-
|
|
1169
|
-
ModelRegistry
|
|
1142
|
+
ModelRuntime // implements pi-ai Models and owns credential storage
|
|
1143
|
+
ModelRegistry // synchronous extension compatibility facade
|
|
1170
1144
|
resolveCliModel
|
|
1171
1145
|
resolveModelScopeWithDiagnostics
|
|
1172
1146
|
|
package/docs/usage.md
CHANGED
|
@@ -151,6 +151,7 @@ pi uninstall <source> [-l] # Alias for remove
|
|
|
151
151
|
pi update [source|self|pi] # Update pi only, or one package source
|
|
152
152
|
pi update --all # Update pi and packages; reconcile pinned git refs
|
|
153
153
|
pi update --extensions # Update packages only; reconcile pinned git refs
|
|
154
|
+
pi update --models # Refresh model catalogs only
|
|
154
155
|
pi update --self # Update pi only
|
|
155
156
|
pi update --extension <src> # Update one package
|
|
156
157
|
pi list # List installed packages
|