@openadapter/koda 1.0.0-beta.3
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 +4448 -0
- package/README.md +665 -0
- package/dist/bun/cli.d.ts +2 -0
- package/dist/bun/cli.js +2 -0
- package/dist/bun/register-bedrock.d.ts +1 -0
- package/dist/bun/register-bedrock.js +1 -0
- package/dist/bun/restore-sandbox-env.d.ts +12 -0
- package/dist/bun/restore-sandbox-env.js +1 -0
- package/dist/cli/args.d.ts +55 -0
- package/dist/cli/args.js +167 -0
- package/dist/cli/config-selector.d.ts +13 -0
- package/dist/cli/config-selector.js +1 -0
- package/dist/cli/file-processor.d.ts +14 -0
- package/dist/cli/file-processor.js +7 -0
- package/dist/cli/import-sessions.d.ts +34 -0
- package/dist/cli/import-sessions.js +6 -0
- package/dist/cli/initial-message.d.ts +17 -0
- package/dist/cli/initial-message.js +1 -0
- package/dist/cli/list-models.d.ts +8 -0
- package/dist/cli/list-models.js +2 -0
- package/dist/cli/openadapter-setup.d.ts +29 -0
- package/dist/cli/openadapter-setup.js +3 -0
- package/dist/cli/session-picker.d.ts +8 -0
- package/dist/cli/session-picker.js +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +2 -0
- package/dist/config.d.ts +92 -0
- package/dist/config.js +1 -0
- package/dist/core/agent-session-runtime.d.ts +116 -0
- package/dist/core/agent-session-runtime.js +1 -0
- package/dist/core/agent-session-services.d.ts +86 -0
- package/dist/core/agent-session-services.js +1 -0
- package/dist/core/agent-session.d.ts +747 -0
- package/dist/core/agent-session.js +32 -0
- package/dist/core/auth-guidance.d.ts +4 -0
- package/dist/core/auth-guidance.js +8 -0
- package/dist/core/auth-storage.d.ts +140 -0
- package/dist/core/auth-storage.js +1 -0
- package/dist/core/bash-executor.d.ts +31 -0
- package/dist/core/bash-executor.js +1 -0
- package/dist/core/compaction/branch-summarization.d.ts +89 -0
- package/dist/core/compaction/branch-summarization.js +38 -0
- package/dist/core/compaction/compaction.d.ts +120 -0
- package/dist/core/compaction/compaction.js +104 -0
- package/dist/core/compaction/index.d.ts +6 -0
- package/dist/core/compaction/index.js +1 -0
- package/dist/core/compaction/utils.d.ts +37 -0
- package/dist/core/compaction/utils.js +19 -0
- package/dist/core/defaults.d.ts +2 -0
- package/dist/core/defaults.js +1 -0
- package/dist/core/diagnostics.d.ts +14 -0
- package/dist/core/diagnostics.js +0 -0
- package/dist/core/event-bus.d.ts +8 -0
- package/dist/core/event-bus.js +1 -0
- package/dist/core/exec.d.ts +28 -0
- package/dist/core/exec.js +1 -0
- package/dist/core/export-html/ansi-to-html.d.ts +21 -0
- package/dist/core/export-html/ansi-to-html.js +1 -0
- package/dist/core/export-html/index.d.ts +36 -0
- package/dist/core/export-html/index.js +2 -0
- package/dist/core/export-html/template.css +1066 -0
- package/dist/core/export-html/template.html +55 -0
- package/dist/core/export-html/template.js +72 -0
- package/dist/core/export-html/tool-renderer.d.ts +33 -0
- package/dist/core/export-html/tool-renderer.js +1 -0
- package/dist/core/export-html/vendor/highlight.min.js +8 -0
- package/dist/core/export-html/vendor/marked.min.js +56 -0
- package/dist/core/extensions/index.d.ts +11 -0
- package/dist/core/extensions/index.js +1 -0
- package/dist/core/extensions/loader.d.ts +23 -0
- package/dist/core/extensions/loader.js +1 -0
- package/dist/core/extensions/runner.d.ts +160 -0
- package/dist/core/extensions/runner.js +1 -0
- package/dist/core/extensions/types.d.ts +1180 -0
- package/dist/core/extensions/types.js +1 -0
- package/dist/core/extensions/wrapper.d.ts +19 -0
- package/dist/core/extensions/wrapper.js +1 -0
- package/dist/core/footer-data-provider.d.ts +53 -0
- package/dist/core/footer-data-provider.js +1 -0
- package/dist/core/http-dispatcher.d.ts +20 -0
- package/dist/core/http-dispatcher.js +1 -0
- package/dist/core/index.d.ts +11 -0
- package/dist/core/index.js +1 -0
- package/dist/core/keybindings.d.ts +352 -0
- package/dist/core/keybindings.js +1 -0
- package/dist/core/messages.d.ts +76 -0
- package/dist/core/messages.js +17 -0
- package/dist/core/model-registry.d.ts +149 -0
- package/dist/core/model-registry.js +9 -0
- package/dist/core/model-resolver.d.ts +109 -0
- package/dist/core/model-resolver.js +1 -0
- package/dist/core/output-guard.d.ts +6 -0
- package/dist/core/output-guard.js +1 -0
- package/dist/core/package-manager.d.ts +203 -0
- package/dist/core/package-manager.js +3 -0
- package/dist/core/prompt-templates.d.ts +51 -0
- package/dist/core/prompt-templates.js +2 -0
- package/dist/core/provider-attribution.d.ts +3 -0
- package/dist/core/provider-attribution.js +1 -0
- package/dist/core/provider-display-names.d.ts +1 -0
- package/dist/core/provider-display-names.js +1 -0
- package/dist/core/resolve-config-value.d.ts +30 -0
- package/dist/core/resolve-config-value.js +1 -0
- package/dist/core/resource-loader.d.ts +193 -0
- package/dist/core/resource-loader.js +1 -0
- package/dist/core/sdk.d.ts +108 -0
- package/dist/core/sdk.js +1 -0
- package/dist/core/session-cwd.d.ts +18 -0
- package/dist/core/session-cwd.js +7 -0
- package/dist/core/session-manager.d.ts +331 -0
- package/dist/core/session-manager.js +11 -0
- package/dist/core/settings-manager.d.ts +265 -0
- package/dist/core/settings-manager.js +1 -0
- package/dist/core/skills.d.ts +59 -0
- package/dist/core/skills.js +4 -0
- package/dist/core/slash-commands.d.ts +13 -0
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/source-info.d.ts +17 -0
- package/dist/core/source-info.js +1 -0
- package/dist/core/system-prompt.d.ts +27 -0
- package/dist/core/system-prompt.js +52 -0
- package/dist/core/telemetry.d.ts +2 -0
- package/dist/core/telemetry.js +1 -0
- package/dist/core/timings.d.ts +7 -0
- package/dist/core/timings.js +3 -0
- package/dist/core/tools/bash.d.ts +67 -0
- package/dist/core/tools/bash.js +18 -0
- package/dist/core/tools/edit-diff.d.ts +86 -0
- package/dist/core/tools/edit-diff.js +16 -0
- package/dist/core/tools/edit.d.ts +50 -0
- package/dist/core/tools/edit.js +2 -0
- package/dist/core/tools/file-mutation-queue.d.ts +5 -0
- package/dist/core/tools/file-mutation-queue.js +1 -0
- package/dist/core/tools/find.d.ts +34 -0
- package/dist/core/tools/find.js +13 -0
- package/dist/core/tools/grep.d.ts +36 -0
- package/dist/core/tools/grep.js +13 -0
- package/dist/core/tools/index.d.ts +39 -0
- package/dist/core/tools/index.js +1 -0
- package/dist/core/tools/ls.d.ts +36 -0
- package/dist/core/tools/ls.js +9 -0
- package/dist/core/tools/output-accumulator.d.ts +51 -0
- package/dist/core/tools/output-accumulator.js +4 -0
- package/dist/core/tools/path-utils.d.ts +9 -0
- package/dist/core/tools/path-utils.js +1 -0
- package/dist/core/tools/read.d.ts +34 -0
- package/dist/core/tools/read.js +22 -0
- package/dist/core/tools/render-utils.d.ts +23 -0
- package/dist/core/tools/render-utils.js +4 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts +13 -0
- package/dist/core/tools/tool-definition-wrapper.js +1 -0
- package/dist/core/tools/truncate.d.ts +69 -0
- package/dist/core/tools/truncate.js +5 -0
- package/dist/core/tools/write.d.ts +25 -0
- package/dist/core/tools/write.js +13 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +1 -0
- package/dist/main.d.ts +11 -0
- package/dist/main.js +1 -0
- package/dist/migrations.d.ts +32 -0
- package/dist/migrations.js +8 -0
- package/dist/modes/index.d.ts +8 -0
- package/dist/modes/index.js +1 -0
- package/dist/modes/interactive/assets/clankolas.png +0 -0
- package/dist/modes/interactive/components/armin.d.ts +33 -0
- package/dist/modes/interactive/components/armin.js +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +19 -0
- package/dist/modes/interactive/components/assistant-message.js +1 -0
- package/dist/modes/interactive/components/bash-execution.d.ts +33 -0
- package/dist/modes/interactive/components/bash-execution.js +13 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts +15 -0
- package/dist/modes/interactive/components/bordered-loader.js +1 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts +15 -0
- package/dist/modes/interactive/components/branch-summary-message.js +3 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +15 -0
- package/dist/modes/interactive/components/compaction-summary-message.js +3 -0
- package/dist/modes/interactive/components/config-selector.d.ts +70 -0
- package/dist/modes/interactive/components/config-selector.js +1 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts +13 -0
- package/dist/modes/interactive/components/countdown-timer.js +1 -0
- package/dist/modes/interactive/components/custom-editor.d.ts +20 -0
- package/dist/modes/interactive/components/custom-editor.js +1 -0
- package/dist/modes/interactive/components/custom-message.d.ts +19 -0
- package/dist/modes/interactive/components/custom-message.js +2 -0
- package/dist/modes/interactive/components/daxnuts.d.ts +22 -0
- package/dist/modes/interactive/components/daxnuts.js +1 -0
- package/dist/modes/interactive/components/diff.d.ts +11 -0
- package/dist/modes/interactive/components/diff.js +3 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts +14 -0
- package/dist/modes/interactive/components/dynamic-border.js +1 -0
- package/dist/modes/interactive/components/earendil-announcement.d.ts +4 -0
- package/dist/modes/interactive/components/earendil-announcement.js +1 -0
- package/dist/modes/interactive/components/extension-editor.d.ts +19 -0
- package/dist/modes/interactive/components/extension-editor.js +3 -0
- package/dist/modes/interactive/components/extension-input.d.ts +22 -0
- package/dist/modes/interactive/components/extension-input.js +2 -0
- package/dist/modes/interactive/components/extension-selector.d.ts +25 -0
- package/dist/modes/interactive/components/extension-selector.js +2 -0
- package/dist/modes/interactive/components/footer.d.ts +27 -0
- package/dist/modes/interactive/components/footer.js +1 -0
- package/dist/modes/interactive/components/index.d.ts +31 -0
- package/dist/modes/interactive/components/index.js +1 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts +12 -0
- package/dist/modes/interactive/components/keybinding-hints.js +1 -0
- package/dist/modes/interactive/components/login-dialog.d.ts +51 -0
- package/dist/modes/interactive/components/login-dialog.js +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts +46 -0
- package/dist/modes/interactive/components/model-selector.js +2 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts +30 -0
- package/dist/modes/interactive/components/oauth-selector.js +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +41 -0
- package/dist/modes/interactive/components/scoped-models-selector.js +1 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts +22 -0
- package/dist/modes/interactive/components/session-selector-search.js +1 -0
- package/dist/modes/interactive/components/session-selector.d.ts +95 -0
- package/dist/modes/interactive/components/session-selector.js +2 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +68 -0
- package/dist/modes/interactive/components/settings-selector.js +1 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts +9 -0
- package/dist/modes/interactive/components/show-images-selector.js +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +16 -0
- package/dist/modes/interactive/components/skill-invocation-message.js +3 -0
- package/dist/modes/interactive/components/theme-selector.d.ts +10 -0
- package/dist/modes/interactive/components/theme-selector.js +1 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +10 -0
- package/dist/modes/interactive/components/thinking-selector.js +1 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +62 -0
- package/dist/modes/interactive/components/tool-execution.js +4 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +88 -0
- package/dist/modes/interactive/components/tree-selector.js +1 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts +29 -0
- package/dist/modes/interactive/components/user-message-selector.js +1 -0
- package/dist/modes/interactive/components/user-message.d.ts +9 -0
- package/dist/modes/interactive/components/user-message.js +1 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts +23 -0
- package/dist/modes/interactive/components/visual-truncate.js +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +417 -0
- package/dist/modes/interactive/interactive-mode.js +116 -0
- package/dist/modes/interactive/theme/dark.json +86 -0
- package/dist/modes/interactive/theme/light.json +85 -0
- package/dist/modes/interactive/theme/theme-schema.json +335 -0
- package/dist/modes/interactive/theme/theme.d.ts +101 -0
- package/dist/modes/interactive/theme/theme.js +18 -0
- package/dist/modes/print-mode.d.ts +27 -0
- package/dist/modes/print-mode.js +4 -0
- package/dist/modes/rpc/jsonl.d.ts +16 -0
- package/dist/modes/rpc/jsonl.js +3 -0
- package/dist/modes/rpc/rpc-client.d.ts +226 -0
- package/dist/modes/rpc/rpc-client.js +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts +19 -0
- package/dist/modes/rpc/rpc-mode.js +1 -0
- package/dist/modes/rpc/rpc-types.d.ts +419 -0
- package/dist/modes/rpc/rpc-types.js +0 -0
- package/dist/package-manager-cli.d.ts +3 -0
- package/dist/package-manager-cli.js +49 -0
- package/dist/utils/ansi.d.ts +1 -0
- package/dist/utils/ansi.js +1 -0
- package/dist/utils/auto-update.d.ts +13 -0
- package/dist/utils/auto-update.js +1 -0
- package/dist/utils/changelog.d.ts +20 -0
- package/dist/utils/changelog.js +4 -0
- package/dist/utils/child-process.d.ts +14 -0
- package/dist/utils/child-process.js +1 -0
- package/dist/utils/clipboard-image.d.ts +10 -0
- package/dist/utils/clipboard-image.js +1 -0
- package/dist/utils/clipboard-native.d.ts +9 -0
- package/dist/utils/clipboard-native.js +1 -0
- package/dist/utils/clipboard.d.ts +1 -0
- package/dist/utils/clipboard.js +1 -0
- package/dist/utils/deprecation.d.ts +3 -0
- package/dist/utils/deprecation.js +1 -0
- package/dist/utils/exif-orientation.d.ts +4 -0
- package/dist/utils/exif-orientation.js +1 -0
- package/dist/utils/frontmatter.d.ts +7 -0
- package/dist/utils/frontmatter.js +4 -0
- package/dist/utils/fs-watch.d.ts +4 -0
- package/dist/utils/fs-watch.js +1 -0
- package/dist/utils/git.d.ts +25 -0
- package/dist/utils/git.js +1 -0
- package/dist/utils/html.d.ts +6 -0
- package/dist/utils/html.js +1 -0
- package/dist/utils/image-convert.d.ts +8 -0
- package/dist/utils/image-convert.js +1 -0
- package/dist/utils/image-resize-core.d.ts +29 -0
- package/dist/utils/image-resize-core.js +1 -0
- package/dist/utils/image-resize-worker.d.ts +1 -0
- package/dist/utils/image-resize-worker.js +1 -0
- package/dist/utils/image-resize.d.ts +15 -0
- package/dist/utils/image-resize.js +1 -0
- package/dist/utils/json.d.ts +2 -0
- package/dist/utils/json.js +1 -0
- package/dist/utils/koda-user-agent.d.ts +1 -0
- package/dist/utils/koda-user-agent.js +1 -0
- package/dist/utils/mime.d.ts +2 -0
- package/dist/utils/mime.js +1 -0
- package/dist/utils/paths.d.ts +30 -0
- package/dist/utils/paths.js +1 -0
- package/dist/utils/photon.d.ts +20 -0
- package/dist/utils/photon.js +1 -0
- package/dist/utils/shell.d.ts +29 -0
- package/dist/utils/shell.js +8 -0
- package/dist/utils/sleep.d.ts +4 -0
- package/dist/utils/sleep.js +1 -0
- package/dist/utils/syntax-highlight.d.ts +11 -0
- package/dist/utils/syntax-highlight.js +2 -0
- package/dist/utils/tools-manager.d.ts +2 -0
- package/dist/utils/tools-manager.js +1 -0
- package/dist/utils/version-check.d.ts +14 -0
- package/dist/utils/version-check.js +1 -0
- package/dist/utils/windows-self-update.d.ts +2 -0
- package/dist/utils/windows-self-update.js +1 -0
- package/docs/compaction.md +394 -0
- package/docs/custom-provider.md +736 -0
- package/docs/development.md +71 -0
- package/docs/docs.json +148 -0
- package/docs/extensions.md +2626 -0
- package/docs/images/doom-extension.png +0 -0
- package/docs/images/exy.png +0 -0
- package/docs/images/interactive-mode.png +0 -0
- package/docs/images/tree-view.png +0 -0
- package/docs/index.md +80 -0
- package/docs/json.md +82 -0
- package/docs/keybindings.md +197 -0
- package/docs/models.md +493 -0
- package/docs/packages.md +226 -0
- package/docs/prompt-templates.md +88 -0
- package/docs/providers.md +253 -0
- package/docs/quickstart.md +165 -0
- package/docs/rpc.md +1408 -0
- package/docs/sdk.md +1137 -0
- package/docs/session-format.md +412 -0
- package/docs/sessions.md +145 -0
- package/docs/settings.md +281 -0
- package/docs/shell-aliases.md +13 -0
- package/docs/skills.md +231 -0
- package/docs/terminal-setup.md +114 -0
- package/docs/termux.md +127 -0
- package/docs/themes.md +295 -0
- package/docs/tmux.md +61 -0
- package/docs/tui.md +927 -0
- package/docs/usage.md +288 -0
- package/docs/windows.md +17 -0
- package/npm-shrinkwrap.json +1792 -0
- package/openadapter/extensions/koda-ask.js +12 -0
- package/openadapter/extensions/koda-bg.js +14 -0
- package/openadapter/extensions/koda-commands.mjs +15 -0
- package/openadapter/extensions/koda-help.js +8 -0
- package/openadapter/extensions/koda-memory.js +16 -0
- package/openadapter/extensions/koda-status.js +1 -0
- package/openadapter/extensions/koda-todo.js +4 -0
- package/openadapter/extensions/koda-vision.js +4 -0
- package/openadapter/extensions/koda-web.js +7 -0
- package/openadapter/setup.mjs +173 -0
- package/openadapter/skills/code-review/SKILL.md +22 -0
- package/openadapter/skills/debugging/SKILL.md +28 -0
- package/openadapter/skills/frontend/SKILL.md +38 -0
- package/package.json +108 -0
package/docs/packages.md
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
> pi can help you create pi packages. Ask it to bundle your extensions, skills, prompt templates, or themes.
|
|
2
|
+
|
|
3
|
+
# Pi Packages
|
|
4
|
+
|
|
5
|
+
Pi packages bundle extensions, skills, prompt templates, and themes so you can share them through npm or git. A package can declare resources in `package.json` under the `pi` key, or use conventional directories.
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
- [Install and Manage](#install-and-manage)
|
|
10
|
+
- [Package Sources](#package-sources)
|
|
11
|
+
- [Creating a Pi Package](#creating-a-pi-package)
|
|
12
|
+
- [Package Structure](#package-structure)
|
|
13
|
+
- [Dependencies](#dependencies)
|
|
14
|
+
- [Package Filtering](#package-filtering)
|
|
15
|
+
- [Enable and Disable Resources](#enable-and-disable-resources)
|
|
16
|
+
- [Scope and Deduplication](#scope-and-deduplication)
|
|
17
|
+
|
|
18
|
+
## Install and Manage
|
|
19
|
+
|
|
20
|
+
> **Security:** Pi packages run with full system access. Extensions execute arbitrary code, and skills can instruct the model to perform any action including running executables. Review source code before installing third-party packages.
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pi install npm:@foo/bar@1.0.0
|
|
24
|
+
pi install git:github.com/user/repo@v1
|
|
25
|
+
pi install https://github.com/user/repo # raw URLs work too
|
|
26
|
+
pi install /absolute/path/to/package
|
|
27
|
+
pi install ./relative/path/to/package
|
|
28
|
+
|
|
29
|
+
pi remove npm:@foo/bar
|
|
30
|
+
pi list # show installed packages from settings
|
|
31
|
+
pi update # update pi, update packages, and reconcile pinned git refs
|
|
32
|
+
pi update --extensions # update packages and reconcile pinned git refs only
|
|
33
|
+
pi update --self # update pi only
|
|
34
|
+
pi update --self --force # reinstall pi even if current
|
|
35
|
+
pi update npm:@foo/bar # update one package
|
|
36
|
+
pi update --extension npm:@foo/bar
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
These commands manage pi packages, not the pi CLI installation. To uninstall pi itself, see [Quickstart](quickstart.md#uninstall).
|
|
40
|
+
|
|
41
|
+
By default, `install` and `remove` write to user settings (`~/.pi/agent/settings.json`). Use `-l` to write to project settings (`.pi/settings.json`) instead. Project settings can be shared with your team, and pi installs any missing packages automatically on startup.
|
|
42
|
+
|
|
43
|
+
To try a package without installing it, use `--extension` or `-e`. This installs to a temporary directory for the current run only:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pi -e npm:@foo/bar
|
|
47
|
+
pi -e git:github.com/user/repo
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Package Sources
|
|
51
|
+
|
|
52
|
+
Pi accepts three source types in settings and `pi install`.
|
|
53
|
+
|
|
54
|
+
### npm
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
npm:@scope/pkg@1.2.3
|
|
58
|
+
npm:pkg
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
- Versioned specs are pinned and skipped by package updates (`pi update`, `pi update --extensions`).
|
|
62
|
+
- User installs go under `~/.pi/agent/npm/`.
|
|
63
|
+
- Project installs go under `.pi/npm/`.
|
|
64
|
+
- Set `npmCommand` in `settings.json` to pin npm package lookup and install operations to a specific wrapper command such as `mise` or `asdf`.
|
|
65
|
+
|
|
66
|
+
Example:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"npmCommand": ["mise", "exec", "node@20", "--", "npm"]
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### git
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
git:github.com/user/repo@v1
|
|
78
|
+
git:git@github.com:user/repo@v1
|
|
79
|
+
https://github.com/user/repo@v1
|
|
80
|
+
ssh://git@github.com/user/repo@v1
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
- Without `git:` prefix, only protocol URLs are accepted (`https://`, `http://`, `ssh://`, `git://`).
|
|
84
|
+
- With `git:` prefix, shorthand formats are accepted, including `github.com/user/repo` and `git@github.com:user/repo`.
|
|
85
|
+
- HTTPS and SSH URLs are both supported.
|
|
86
|
+
- SSH URLs use your configured SSH keys automatically (respects `~/.ssh/config`).
|
|
87
|
+
- For non-interactive runs (for example CI), you can set `GIT_TERMINAL_PROMPT=0` to disable credential prompts and set `GIT_SSH_COMMAND` (for example `ssh -o BatchMode=yes -o ConnectTimeout=5`) to fail fast.
|
|
88
|
+
- Refs are pinned tags or commits. `pi update` and `pi update --extensions` do not move them to newer refs, but they do reconcile an existing clone to the configured ref.
|
|
89
|
+
- Use `pi install git:host/user/repo@new-ref` to update settings and move an existing package to a new pinned ref.
|
|
90
|
+
- Cloned to `~/.pi/agent/git/<host>/<path>` (global) or `.pi/git/<host>/<path>` (project).
|
|
91
|
+
- When reconciliation changes the checkout, pi resets and cleans the clone, then runs `npm install` if `package.json` exists.
|
|
92
|
+
|
|
93
|
+
**SSH examples:**
|
|
94
|
+
```bash
|
|
95
|
+
# git@host:path shorthand (requires git: prefix)
|
|
96
|
+
pi install git:git@github.com:user/repo
|
|
97
|
+
|
|
98
|
+
# ssh:// protocol format
|
|
99
|
+
pi install ssh://git@github.com/user/repo
|
|
100
|
+
|
|
101
|
+
# With version ref
|
|
102
|
+
pi install git:git@github.com:user/repo@v1.0.0
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Local Paths
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
/absolute/path/to/package
|
|
109
|
+
./relative/path/to/package
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Local paths point to files or directories on disk and are added to settings without copying. Relative paths are resolved against the settings file they appear in. If the path is a file, it loads as a single extension. If it is a directory, pi loads resources using package rules.
|
|
113
|
+
|
|
114
|
+
## Creating a Pi Package
|
|
115
|
+
|
|
116
|
+
Add a `pi` manifest to `package.json` or use conventional directories. Include the `pi-package` keyword for discoverability.
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"name": "my-package",
|
|
121
|
+
"keywords": ["pi-package"],
|
|
122
|
+
"pi": {
|
|
123
|
+
"extensions": ["./extensions"],
|
|
124
|
+
"skills": ["./skills"],
|
|
125
|
+
"prompts": ["./prompts"],
|
|
126
|
+
"themes": ["./themes"]
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Paths are relative to the package root. Arrays support glob patterns and `!exclusions`.
|
|
132
|
+
|
|
133
|
+
### Gallery Metadata
|
|
134
|
+
|
|
135
|
+
The [package gallery](https://pi.dev/packages) displays packages tagged with `pi-package`. Add `video` or `image` fields to show a preview:
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"name": "my-package",
|
|
140
|
+
"keywords": ["pi-package"],
|
|
141
|
+
"pi": {
|
|
142
|
+
"extensions": ["./extensions"],
|
|
143
|
+
"video": "https://example.com/demo.mp4",
|
|
144
|
+
"image": "https://example.com/screenshot.png"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
- **video**: MP4 only. On desktop, autoplays on hover. Clicking opens a fullscreen player.
|
|
150
|
+
- **image**: PNG, JPEG, GIF, or WebP. Displayed as a static preview.
|
|
151
|
+
|
|
152
|
+
If both are set, video takes precedence.
|
|
153
|
+
|
|
154
|
+
## Package Structure
|
|
155
|
+
|
|
156
|
+
### Convention Directories
|
|
157
|
+
|
|
158
|
+
If no `pi` manifest is present, pi auto-discovers resources from these directories:
|
|
159
|
+
|
|
160
|
+
- `extensions/` loads `.ts` and `.js` files
|
|
161
|
+
- `skills/` recursively finds `SKILL.md` folders and loads top-level `.md` files as skills
|
|
162
|
+
- `prompts/` loads `.md` files
|
|
163
|
+
- `themes/` loads `.json` files
|
|
164
|
+
|
|
165
|
+
## Dependencies
|
|
166
|
+
|
|
167
|
+
Third party runtime dependencies belong in `dependencies` in `package.json`. Dependencies that do not register extensions, skills, prompt templates, or themes also belong in `dependencies`. When pi installs a package from npm or git, it runs `npm install`, so those dependencies are installed automatically.
|
|
168
|
+
|
|
169
|
+
Pi bundles core packages for extensions and skills. If you import any of these, list them in `peerDependencies` with a `"*"` range and do not bundle them: `@openadapter/koda-ai`, `@openadapter/koda-agent-core`, `@openadapter/koda`, `@openadapter/koda-tui`, `typebox`.
|
|
170
|
+
|
|
171
|
+
Other pi packages must be bundled in your tarball. Add them to `dependencies` and `bundledDependencies`, then reference their resources through `node_modules/` paths. Pi loads packages with separate module roots, so separate installs do not collide or share modules.
|
|
172
|
+
|
|
173
|
+
Example:
|
|
174
|
+
|
|
175
|
+
```json
|
|
176
|
+
{
|
|
177
|
+
"dependencies": {
|
|
178
|
+
"shitty-extensions": "^1.0.1"
|
|
179
|
+
},
|
|
180
|
+
"bundledDependencies": ["shitty-extensions"],
|
|
181
|
+
"pi": {
|
|
182
|
+
"extensions": ["extensions", "node_modules/shitty-extensions/extensions"],
|
|
183
|
+
"skills": ["skills", "node_modules/shitty-extensions/skills"]
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Package Filtering
|
|
189
|
+
|
|
190
|
+
Filter what a package loads using the object form in settings:
|
|
191
|
+
|
|
192
|
+
```json
|
|
193
|
+
{
|
|
194
|
+
"packages": [
|
|
195
|
+
"npm:simple-pkg",
|
|
196
|
+
{
|
|
197
|
+
"source": "npm:my-package",
|
|
198
|
+
"extensions": ["extensions/*.ts", "!extensions/legacy.ts"],
|
|
199
|
+
"skills": [],
|
|
200
|
+
"prompts": ["prompts/review.md"],
|
|
201
|
+
"themes": ["+themes/legacy.json"]
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
`+path` and `-path` are exact paths relative to the package root.
|
|
208
|
+
|
|
209
|
+
- Omit a key to load all of that type.
|
|
210
|
+
- Use `[]` to load none of that type.
|
|
211
|
+
- `!pattern` excludes matches.
|
|
212
|
+
- `+path` force-includes an exact path.
|
|
213
|
+
- `-path` force-excludes an exact path.
|
|
214
|
+
- Filters layer on top of the manifest. They narrow down what is already allowed.
|
|
215
|
+
|
|
216
|
+
## Enable and Disable Resources
|
|
217
|
+
|
|
218
|
+
Use `pi config` to enable or disable extensions, skills, prompt templates, and themes from installed packages and local directories. Works for both global (`~/.pi/agent`) and project (`.pi/`) scopes.
|
|
219
|
+
|
|
220
|
+
## Scope and Deduplication
|
|
221
|
+
|
|
222
|
+
Packages can appear in both global and project settings. If the same package appears in both, the project entry wins. Identity is determined by:
|
|
223
|
+
|
|
224
|
+
- npm: package name
|
|
225
|
+
- git: repository URL without ref
|
|
226
|
+
- local: resolved absolute path
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
> pi can create prompt templates. Ask it to build one for your workflow.
|
|
2
|
+
|
|
3
|
+
# Prompt Templates
|
|
4
|
+
|
|
5
|
+
Prompt templates are Markdown snippets that expand into full prompts. Type `/name` in the editor to invoke a template, where `name` is the filename without `.md`.
|
|
6
|
+
|
|
7
|
+
## Locations
|
|
8
|
+
|
|
9
|
+
Pi loads prompt templates from:
|
|
10
|
+
|
|
11
|
+
- Global: `~/.pi/agent/prompts/*.md`
|
|
12
|
+
- Project: `.pi/prompts/*.md`
|
|
13
|
+
- Packages: `prompts/` directories or `pi.prompts` entries in `package.json`
|
|
14
|
+
- Settings: `prompts` array with files or directories
|
|
15
|
+
- CLI: `--prompt-template <path>` (repeatable)
|
|
16
|
+
|
|
17
|
+
Disable discovery with `--no-prompt-templates`.
|
|
18
|
+
|
|
19
|
+
## Format
|
|
20
|
+
|
|
21
|
+
```markdown
|
|
22
|
+
---
|
|
23
|
+
description: Review staged git changes
|
|
24
|
+
---
|
|
25
|
+
Review the staged changes (`git diff --cached`). Focus on:
|
|
26
|
+
- Bugs and logic errors
|
|
27
|
+
- Security issues
|
|
28
|
+
- Error handling gaps
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
- The filename becomes the command name. `review.md` becomes `/review`.
|
|
32
|
+
- `description` is optional. If missing, the first non-empty line is used.
|
|
33
|
+
- `argument-hint` is optional. When set, the hint is displayed before the description in the autocomplete dropdown.
|
|
34
|
+
|
|
35
|
+
### Argument Hints
|
|
36
|
+
|
|
37
|
+
Use `argument-hint` in frontmatter to show expected arguments in autocomplete. Use `<angle brackets>` for required arguments and `[square brackets]` for optional ones:
|
|
38
|
+
|
|
39
|
+
```markdown
|
|
40
|
+
---
|
|
41
|
+
description: Review PRs from URLs with structured issue and code analysis
|
|
42
|
+
argument-hint: "<PR-URL>"
|
|
43
|
+
---
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
This renders in the autocomplete dropdown as:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
→ pr <PR-URL> — Review PRs from URLs with structured issue and code analysis
|
|
50
|
+
is <issue> — Analyze GitHub issues (bugs or feature requests)
|
|
51
|
+
wr [instructions] — Finish the current task end-to-end
|
|
52
|
+
cl — Audit changelog entries before release
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Usage
|
|
56
|
+
|
|
57
|
+
Type `/` followed by the template name in the editor. Autocomplete shows available templates with descriptions.
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
/review # Expands review.md
|
|
61
|
+
/component Button # Expands with argument
|
|
62
|
+
/component Button "click handler" # Multiple arguments
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Arguments
|
|
66
|
+
|
|
67
|
+
Templates support positional arguments and simple slicing:
|
|
68
|
+
|
|
69
|
+
- `$1`, `$2`, ... positional args
|
|
70
|
+
- `$@` or `$ARGUMENTS` for all args joined
|
|
71
|
+
- `${@:N}` for args from the Nth position (1-indexed)
|
|
72
|
+
- `${@:N:L}` for `L` args starting at N
|
|
73
|
+
|
|
74
|
+
Example:
|
|
75
|
+
|
|
76
|
+
```markdown
|
|
77
|
+
---
|
|
78
|
+
description: Create a component
|
|
79
|
+
---
|
|
80
|
+
Create a React component named $1 with features: $@
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Usage: `/component Button "onClick handler" "disabled support"`
|
|
84
|
+
|
|
85
|
+
## Loading Rules
|
|
86
|
+
|
|
87
|
+
- Template discovery in `prompts/` is non-recursive.
|
|
88
|
+
- If you want templates in subdirectories, add them explicitly via `prompts` settings or a package manifest.
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
# Providers
|
|
2
|
+
|
|
3
|
+
Pi supports subscription-based providers via OAuth and API key providers via environment variables or auth file. For each provider, pi knows all available models. The list is updated with every pi release.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Subscriptions](#subscriptions)
|
|
8
|
+
- [API Keys](#api-keys)
|
|
9
|
+
- [Auth File](#auth-file)
|
|
10
|
+
- [Cloud Providers](#cloud-providers)
|
|
11
|
+
- [Custom Providers](#custom-providers)
|
|
12
|
+
- [Resolution Order](#resolution-order)
|
|
13
|
+
|
|
14
|
+
## Subscriptions
|
|
15
|
+
|
|
16
|
+
Use `/login` in interactive mode, then select a provider:
|
|
17
|
+
|
|
18
|
+
- ChatGPT Plus/Pro (Codex)
|
|
19
|
+
- Claude Pro/Max
|
|
20
|
+
- GitHub Copilot
|
|
21
|
+
|
|
22
|
+
Use `/logout` to clear credentials. Tokens are stored in `~/.pi/agent/auth.json` and auto-refresh when expired.
|
|
23
|
+
|
|
24
|
+
### OpenAI Codex
|
|
25
|
+
|
|
26
|
+
- Requires ChatGPT Plus or Pro subscription
|
|
27
|
+
- Officially endorsed by OpenAI: [Codex for OSS](https://developers.openai.com/community/codex-for-oss)
|
|
28
|
+
|
|
29
|
+
### Claude Pro/Max
|
|
30
|
+
|
|
31
|
+
Anthropic subscription auth is active for Claude Pro/Max accounts. Third-party harness usage draws from [extra usage](https://claude.ai/settings/usage) and is billed per token, not against Claude plan limits.
|
|
32
|
+
|
|
33
|
+
### GitHub Copilot
|
|
34
|
+
|
|
35
|
+
- Press Enter for github.com, or enter your GitHub Enterprise Server domain
|
|
36
|
+
- If you get "model not supported", enable it in VS Code: Copilot Chat → model selector → select model → "Enable"
|
|
37
|
+
|
|
38
|
+
## API Keys
|
|
39
|
+
|
|
40
|
+
### Environment Variables or Auth File
|
|
41
|
+
|
|
42
|
+
Use `/login` in interactive mode and select a provider to store an API key in `auth.json`, or set credentials via environment variable:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
46
|
+
pi
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
| Provider | Environment Variable | `auth.json` key |
|
|
50
|
+
|----------|----------------------|------------------|
|
|
51
|
+
| Anthropic | `ANTHROPIC_API_KEY` | `anthropic` |
|
|
52
|
+
| Azure OpenAI Responses | `AZURE_OPENAI_API_KEY` | `azure-openai-responses` |
|
|
53
|
+
| OpenAI | `OPENAI_API_KEY` | `openai` |
|
|
54
|
+
| DeepSeek | `DEEPSEEK_API_KEY` | `deepseek` |
|
|
55
|
+
| NVIDIA NIM | `NVIDIA_API_KEY` | `nvidia` |
|
|
56
|
+
| Google Gemini | `GEMINI_API_KEY` | `google` |
|
|
57
|
+
| Mistral | `MISTRAL_API_KEY` | `mistral` |
|
|
58
|
+
| Groq | `GROQ_API_KEY` | `groq` |
|
|
59
|
+
| Cerebras | `CEREBRAS_API_KEY` | `cerebras` |
|
|
60
|
+
| Cloudflare AI Gateway | `CLOUDFLARE_API_KEY` (+ `CLOUDFLARE_ACCOUNT_ID`, `CLOUDFLARE_GATEWAY_ID`) | `cloudflare-ai-gateway` |
|
|
61
|
+
| Cloudflare Workers AI | `CLOUDFLARE_API_KEY` (+ `CLOUDFLARE_ACCOUNT_ID`) | `cloudflare-workers-ai` |
|
|
62
|
+
| xAI | `XAI_API_KEY` | `xai` |
|
|
63
|
+
| OpenRouter | `OPENROUTER_API_KEY` | `openrouter` |
|
|
64
|
+
| Vercel AI Gateway | `AI_GATEWAY_API_KEY` | `vercel-ai-gateway` |
|
|
65
|
+
| ZAI | `ZAI_API_KEY` | `zai` |
|
|
66
|
+
| OpenCode Zen | `OPENCODE_API_KEY` | `opencode` |
|
|
67
|
+
| OpenCode Go | `OPENCODE_API_KEY` | `opencode-go` |
|
|
68
|
+
| Hugging Face | `HF_TOKEN` | `huggingface` |
|
|
69
|
+
| Fireworks | `FIREWORKS_API_KEY` | `fireworks` |
|
|
70
|
+
| Together AI | `TOGETHER_API_KEY` | `together` |
|
|
71
|
+
| Kimi For Coding | `KIMI_API_KEY` | `kimi-coding` |
|
|
72
|
+
| MiniMax | `MINIMAX_API_KEY` | `minimax` |
|
|
73
|
+
| MiniMax (China) | `MINIMAX_CN_API_KEY` | `minimax-cn` |
|
|
74
|
+
| Xiaomi MiMo | `XIAOMI_API_KEY` | `xiaomi` |
|
|
75
|
+
| Xiaomi MiMo Token Plan (China) | `XIAOMI_TOKEN_PLAN_CN_API_KEY` | `xiaomi-token-plan-cn` |
|
|
76
|
+
| Xiaomi MiMo Token Plan (Amsterdam) | `XIAOMI_TOKEN_PLAN_AMS_API_KEY` | `xiaomi-token-plan-ams` |
|
|
77
|
+
| Xiaomi MiMo Token Plan (Singapore) | `XIAOMI_TOKEN_PLAN_SGP_API_KEY` | `xiaomi-token-plan-sgp` |
|
|
78
|
+
|
|
79
|
+
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).
|
|
80
|
+
|
|
81
|
+
#### Auth File
|
|
82
|
+
|
|
83
|
+
Store credentials in `~/.pi/agent/auth.json`:
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"anthropic": { "type": "api_key", "key": "sk-ant-..." },
|
|
88
|
+
"openai": { "type": "api_key", "key": "sk-..." },
|
|
89
|
+
"deepseek": { "type": "api_key", "key": "sk-..." },
|
|
90
|
+
"nvidia": { "type": "api_key", "key": "nvapi-..." },
|
|
91
|
+
"google": { "type": "api_key", "key": "..." },
|
|
92
|
+
"opencode": { "type": "api_key", "key": "..." },
|
|
93
|
+
"opencode-go": { "type": "api_key", "key": "..." },
|
|
94
|
+
"together": { "type": "api_key", "key": "..." },
|
|
95
|
+
"xiaomi": { "type": "api_key", "key": "..." },
|
|
96
|
+
"xiaomi-token-plan-cn": { "type": "api_key", "key": "..." },
|
|
97
|
+
"xiaomi-token-plan-ams": { "type": "api_key", "key": "..." },
|
|
98
|
+
"xiaomi-token-plan-sgp": { "type": "api_key", "key": "..." }
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
The file is created with `0600` permissions (user read/write only). Auth file credentials take priority over environment variables.
|
|
103
|
+
|
|
104
|
+
### Key Resolution
|
|
105
|
+
|
|
106
|
+
The `key` field supports command execution, environment interpolation, and literals:
|
|
107
|
+
|
|
108
|
+
- **Shell command:** `"!command"` at the start executes the whole value as a command and uses stdout (cached for process lifetime)
|
|
109
|
+
```json
|
|
110
|
+
{ "type": "api_key", "key": "!security find-generic-password -ws 'anthropic'" }
|
|
111
|
+
{ "type": "api_key", "key": "!op read 'op://vault/item/credential'" }
|
|
112
|
+
```
|
|
113
|
+
- **Environment interpolation:** `"$ENV_VAR"` or `"${ENV_VAR}"` uses the value of the named variable. Interpolation works inside larger literals.
|
|
114
|
+
```json
|
|
115
|
+
{ "type": "api_key", "key": "$MY_ANTHROPIC_KEY" }
|
|
116
|
+
{ "type": "api_key", "key": "${KEY_PREFIX}_${KEY_SUFFIX}" }
|
|
117
|
+
```
|
|
118
|
+
`$FOO_BAR` is the variable `FOO_BAR`; use `${FOO}_BAR` when `BAR` is literal text. Missing environment variables make the value unresolved.
|
|
119
|
+
- **Escapes:** `"$$"` emits a literal `"$"`; `"$!"` emits a literal `"!"` without triggering command execution.
|
|
120
|
+
```json
|
|
121
|
+
{ "type": "api_key", "key": "$$literal-dollar-prefix" }
|
|
122
|
+
{ "type": "api_key", "key": "$!literal-bang-prefix" }
|
|
123
|
+
```
|
|
124
|
+
- **Literal value:** Used directly
|
|
125
|
+
```json
|
|
126
|
+
{ "type": "api_key", "key": "sk-ant-..." }
|
|
127
|
+
{ "type": "api_key", "key": "public" }
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Legacy uppercase env-var-like values such as `MY_API_KEY` are migrated to `$MY_API_KEY` on startup. OAuth credentials are also stored here after `/login` and managed automatically.
|
|
131
|
+
|
|
132
|
+
## Cloud Providers
|
|
133
|
+
|
|
134
|
+
### Azure OpenAI
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
export AZURE_OPENAI_API_KEY=...
|
|
138
|
+
export AZURE_OPENAI_BASE_URL=https://your-resource.openai.azure.com
|
|
139
|
+
# also supported: https://your-resource.cognitiveservices.azure.com
|
|
140
|
+
# root endpoints are auto-normalized to /openai/v1
|
|
141
|
+
# or use resource name instead of base URL
|
|
142
|
+
export AZURE_OPENAI_RESOURCE_NAME=your-resource
|
|
143
|
+
|
|
144
|
+
# Optional
|
|
145
|
+
export AZURE_OPENAI_API_VERSION=2024-02-01
|
|
146
|
+
export AZURE_OPENAI_DEPLOYMENT_NAME_MAP=gpt-4=my-gpt4,gpt-4o=my-gpt4o
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Amazon Bedrock
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Option 1: AWS Profile
|
|
153
|
+
export AWS_PROFILE=your-profile
|
|
154
|
+
|
|
155
|
+
# Option 2: IAM Keys
|
|
156
|
+
export AWS_ACCESS_KEY_ID=AKIA...
|
|
157
|
+
export AWS_SECRET_ACCESS_KEY=...
|
|
158
|
+
|
|
159
|
+
# Option 3: Bearer Token
|
|
160
|
+
export AWS_BEARER_TOKEN_BEDROCK=...
|
|
161
|
+
|
|
162
|
+
# Optional region (defaults to us-east-1)
|
|
163
|
+
export AWS_REGION=us-west-2
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Also supports ECS task roles (`AWS_CONTAINER_CREDENTIALS_*`) and IRSA (`AWS_WEB_IDENTITY_TOKEN_FILE`).
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
pi --provider amazon-bedrock --model us.anthropic.claude-sonnet-4-20250514-v1:0
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
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:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
export AWS_BEDROCK_FORCE_CACHE=1
|
|
176
|
+
pi --provider amazon-bedrock --model arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/abc123
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
If you are connecting to a Bedrock API proxy, the following environment variables can be used:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# Set the URL for the Bedrock proxy (standard AWS SDK env var)
|
|
183
|
+
export AWS_ENDPOINT_URL_BEDROCK_RUNTIME=https://my.corp.proxy/bedrock
|
|
184
|
+
|
|
185
|
+
# Set if your proxy does not require authentication
|
|
186
|
+
export AWS_BEDROCK_SKIP_AUTH=1
|
|
187
|
+
|
|
188
|
+
# Set if your proxy only supports HTTP/1.1
|
|
189
|
+
export AWS_BEDROCK_FORCE_HTTP1=1
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Cloudflare AI Gateway
|
|
193
|
+
|
|
194
|
+
`CLOUDFLARE_API_KEY` can be set via `/login`. The account ID and gateway slug must be set as environment variables.
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
export CLOUDFLARE_API_KEY=... # or use /login
|
|
198
|
+
export CLOUDFLARE_ACCOUNT_ID=...
|
|
199
|
+
export CLOUDFLARE_GATEWAY_ID=... # create at dash.cloudflare.com → AI → AI Gateway
|
|
200
|
+
pi --provider cloudflare-ai-gateway --model "claude-sonnet-4-5"
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
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`.
|
|
204
|
+
|
|
205
|
+
AI Gateway authentication uses `CLOUDFLARE_API_KEY` as `cf-aig-authorization`. Upstream authentication can be one of:
|
|
206
|
+
|
|
207
|
+
| Mode | Request auth | Upstream auth |
|
|
208
|
+
|------|--------------|---------------|
|
|
209
|
+
| Workers AI | Cloudflare token only | Cloudflare-native |
|
|
210
|
+
| Unified billing | Cloudflare token only | Cloudflare handles upstream auth and deducts credits |
|
|
211
|
+
| Stored BYOK | Cloudflare token only | Cloudflare injects provider keys stored in the AI Gateway dashboard |
|
|
212
|
+
| Inline BYOK | Cloudflare token plus upstream `Authorization` header | The request supplies the upstream provider key |
|
|
213
|
+
|
|
214
|
+
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.
|
|
215
|
+
|
|
216
|
+
### Cloudflare Workers AI
|
|
217
|
+
|
|
218
|
+
`CLOUDFLARE_API_KEY` can be set via `/login`. `CLOUDFLARE_ACCOUNT_ID` must be set as an environment variable.
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
export CLOUDFLARE_API_KEY=... # or use /login
|
|
222
|
+
export CLOUDFLARE_ACCOUNT_ID=...
|
|
223
|
+
pi --provider cloudflare-workers-ai --model "@cf/moonshotai/kimi-k2.6"
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Pi automatically sets `x-session-affinity` for [prefix caching](https://developers.cloudflare.com/workers-ai/features/prompt-caching/) discounts.
|
|
227
|
+
|
|
228
|
+
### Google Vertex AI
|
|
229
|
+
|
|
230
|
+
Uses Application Default Credentials:
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
gcloud auth application-default login
|
|
234
|
+
export GOOGLE_CLOUD_PROJECT=your-project
|
|
235
|
+
export GOOGLE_CLOUD_LOCATION=us-central1
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Or set `GOOGLE_APPLICATION_CREDENTIALS` to a service account key file.
|
|
239
|
+
|
|
240
|
+
## Custom Providers
|
|
241
|
+
|
|
242
|
+
**Via models.json:** Add Ollama, LM Studio, vLLM, or any provider that speaks a supported API (OpenAI Completions, OpenAI Responses, Anthropic Messages, Google Generative AI). See [models.md](models.md).
|
|
243
|
+
|
|
244
|
+
**Via extensions:** For providers that need custom API implementations or OAuth flows, create an extension. See [custom-provider.md](custom-provider.md) and [examples/extensions/custom-provider-gitlab-duo](../examples/extensions/custom-provider-gitlab-duo/).
|
|
245
|
+
|
|
246
|
+
## Resolution Order
|
|
247
|
+
|
|
248
|
+
When resolving credentials for a provider:
|
|
249
|
+
|
|
250
|
+
1. CLI `--api-key` flag
|
|
251
|
+
2. `auth.json` entry (API key or OAuth token)
|
|
252
|
+
3. Environment variable
|
|
253
|
+
4. Custom provider keys from `models.json`
|