@kingingwang/pi-linux-arm64 0.83.0
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/LICENSE +21 -0
- package/bin/CHANGELOG.md +5402 -0
- package/bin/README.md +712 -0
- package/bin/assets/clankolas.png +0 -0
- package/bin/docs/compaction.md +401 -0
- package/bin/docs/containerization.md +111 -0
- package/bin/docs/custom-provider.md +774 -0
- package/bin/docs/development.md +71 -0
- package/bin/docs/docs.json +156 -0
- package/bin/docs/environment-variables.md +88 -0
- package/bin/docs/extensions.md +2987 -0
- package/bin/docs/images/doom-extension.png +0 -0
- package/bin/docs/images/exy.png +0 -0
- package/bin/docs/images/interactive-mode.png +0 -0
- package/bin/docs/images/tree-view.png +0 -0
- package/bin/docs/index.md +84 -0
- package/bin/docs/json.md +91 -0
- package/bin/docs/keybindings.md +226 -0
- package/bin/docs/llama-cpp.md +99 -0
- package/bin/docs/models.md +565 -0
- package/bin/docs/packages.md +228 -0
- package/bin/docs/prompt-templates.md +96 -0
- package/bin/docs/providers.md +310 -0
- package/bin/docs/quickstart.md +167 -0
- package/bin/docs/rpc.md +1578 -0
- package/bin/docs/sdk.md +1205 -0
- package/bin/docs/security.md +59 -0
- package/bin/docs/session-format.md +438 -0
- package/bin/docs/sessions.md +145 -0
- package/bin/docs/settings.md +328 -0
- package/bin/docs/shell-aliases.md +13 -0
- package/bin/docs/skills.md +231 -0
- package/bin/docs/terminal-setup.md +142 -0
- package/bin/docs/termux.md +127 -0
- package/bin/docs/themes.md +299 -0
- package/bin/docs/tmux.md +63 -0
- package/bin/docs/tui.md +942 -0
- package/bin/docs/usage.md +305 -0
- package/bin/docs/windows.md +17 -0
- package/bin/examples/README.md +25 -0
- package/bin/examples/extensions/README.md +213 -0
- package/bin/examples/extensions/auto-commit-on-exit.ts +49 -0
- package/bin/examples/extensions/bash-spawn-hook.ts +30 -0
- package/bin/examples/extensions/bookmark.ts +50 -0
- package/bin/examples/extensions/border-status-editor.ts +150 -0
- package/bin/examples/extensions/built-in-tool-renderer.ts +249 -0
- package/bin/examples/extensions/claude-rules.ts +86 -0
- package/bin/examples/extensions/commands.ts +72 -0
- package/bin/examples/extensions/confirm-destructive.ts +59 -0
- package/bin/examples/extensions/custom-compaction.ts +117 -0
- package/bin/examples/extensions/custom-footer.ts +64 -0
- package/bin/examples/extensions/custom-header.ts +73 -0
- package/bin/examples/extensions/custom-provider-anthropic/index.ts +611 -0
- package/bin/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
- package/bin/examples/extensions/custom-provider-anthropic/package.json +19 -0
- package/bin/examples/extensions/custom-provider-gitlab-duo/index.ts +405 -0
- package/bin/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
- package/bin/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
- package/bin/examples/extensions/dirty-repo-guard.ts +56 -0
- package/bin/examples/extensions/doom-overlay/README.md +46 -0
- package/bin/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
- package/bin/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
- package/bin/examples/extensions/doom-overlay/doom/build.sh +152 -0
- package/bin/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
- package/bin/examples/extensions/doom-overlay/doom-component.ts +132 -0
- package/bin/examples/extensions/doom-overlay/doom-engine.ts +173 -0
- package/bin/examples/extensions/doom-overlay/doom-keys.ts +104 -0
- package/bin/examples/extensions/doom-overlay/index.ts +74 -0
- package/bin/examples/extensions/doom-overlay/wad-finder.ts +55 -0
- package/bin/examples/extensions/dynamic-resources/SKILL.md +8 -0
- package/bin/examples/extensions/dynamic-resources/dynamic.json +79 -0
- package/bin/examples/extensions/dynamic-resources/dynamic.md +5 -0
- package/bin/examples/extensions/dynamic-resources/index.ts +15 -0
- package/bin/examples/extensions/dynamic-tools.ts +74 -0
- package/bin/examples/extensions/entry-renderer.ts +41 -0
- package/bin/examples/extensions/event-bus.ts +43 -0
- package/bin/examples/extensions/file-trigger.ts +41 -0
- package/bin/examples/extensions/git-checkpoint.ts +53 -0
- package/bin/examples/extensions/git-merge-and-resolve.ts +115 -0
- package/bin/examples/extensions/github-issue-autocomplete.ts +185 -0
- package/bin/examples/extensions/gondolin/index.ts +531 -0
- package/bin/examples/extensions/gondolin/package-lock.json +185 -0
- package/bin/examples/extensions/gondolin/package.json +19 -0
- package/bin/examples/extensions/handoff.ts +190 -0
- package/bin/examples/extensions/hello.ts +26 -0
- package/bin/examples/extensions/hidden-thinking-label.ts +53 -0
- package/bin/examples/extensions/inline-bash.ts +94 -0
- package/bin/examples/extensions/input-transform-streaming.ts +39 -0
- package/bin/examples/extensions/input-transform.ts +43 -0
- package/bin/examples/extensions/interactive-shell.ts +196 -0
- package/bin/examples/extensions/kimi-deferred-tools.ts +61 -0
- package/bin/examples/extensions/mac-system-theme.ts +47 -0
- package/bin/examples/extensions/message-renderer.ts +59 -0
- package/bin/examples/extensions/minimal-mode.ts +426 -0
- package/bin/examples/extensions/modal-editor.ts +85 -0
- package/bin/examples/extensions/model-status.ts +31 -0
- package/bin/examples/extensions/notify.ts +55 -0
- package/bin/examples/extensions/overlay-qa-tests.ts +1450 -0
- package/bin/examples/extensions/overlay-test.ts +153 -0
- package/bin/examples/extensions/permission-gate.ts +34 -0
- package/bin/examples/extensions/pirate.ts +47 -0
- package/bin/examples/extensions/plan-mode/README.md +66 -0
- package/bin/examples/extensions/plan-mode/index.ts +390 -0
- package/bin/examples/extensions/plan-mode/utils.ts +168 -0
- package/bin/examples/extensions/preset.ts +436 -0
- package/bin/examples/extensions/project-trust.ts +64 -0
- package/bin/examples/extensions/prompt-customizer.ts +97 -0
- package/bin/examples/extensions/protected-paths.ts +30 -0
- package/bin/examples/extensions/provider-payload.ts +18 -0
- package/bin/examples/extensions/qna.ts +118 -0
- package/bin/examples/extensions/question.ts +286 -0
- package/bin/examples/extensions/questionnaire.ts +448 -0
- package/bin/examples/extensions/rainbow-editor.ts +88 -0
- package/bin/examples/extensions/reload-runtime.ts +37 -0
- package/bin/examples/extensions/rpc-demo.ts +118 -0
- package/bin/examples/extensions/sandbox/index.ts +321 -0
- package/bin/examples/extensions/sandbox/package-lock.json +92 -0
- package/bin/examples/extensions/sandbox/package.json +19 -0
- package/bin/examples/extensions/send-user-message.ts +97 -0
- package/bin/examples/extensions/session-name.ts +27 -0
- package/bin/examples/extensions/shutdown-command.ts +63 -0
- package/bin/examples/extensions/snake.ts +343 -0
- package/bin/examples/extensions/space-invaders.ts +560 -0
- package/bin/examples/extensions/ssh.ts +220 -0
- package/bin/examples/extensions/status-line.ts +32 -0
- package/bin/examples/extensions/structured-output.ts +65 -0
- package/bin/examples/extensions/subagent/README.md +175 -0
- package/bin/examples/extensions/subagent/agents/planner.md +37 -0
- package/bin/examples/extensions/subagent/agents/reviewer.md +35 -0
- package/bin/examples/extensions/subagent/agents/scout.md +50 -0
- package/bin/examples/extensions/subagent/agents/worker.md +24 -0
- package/bin/examples/extensions/subagent/agents.ts +126 -0
- package/bin/examples/extensions/subagent/index.ts +1015 -0
- package/bin/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
- package/bin/examples/extensions/subagent/prompts/implement.md +10 -0
- package/bin/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
- package/bin/examples/extensions/summarize.ts +199 -0
- package/bin/examples/extensions/system-prompt-header.ts +17 -0
- package/bin/examples/extensions/tic-tac-toe.ts +1008 -0
- package/bin/examples/extensions/timed-confirm.ts +70 -0
- package/bin/examples/extensions/titlebar-spinner.ts +58 -0
- package/bin/examples/extensions/todo.ts +297 -0
- package/bin/examples/extensions/tool-override.ts +144 -0
- package/bin/examples/extensions/tools.ts +146 -0
- package/bin/examples/extensions/trigger-compact.ts +50 -0
- package/bin/examples/extensions/truncated-tool.ts +195 -0
- package/bin/examples/extensions/widget-placement.ts +9 -0
- package/bin/examples/extensions/with-deps/index.ts +32 -0
- package/bin/examples/extensions/with-deps/package-lock.json +31 -0
- package/bin/examples/extensions/with-deps/package.json +22 -0
- package/bin/examples/extensions/working-indicator.ts +123 -0
- package/bin/examples/extensions/working-message-test.ts +25 -0
- package/bin/examples/rpc-extension-ui.ts +641 -0
- package/bin/examples/sdk/01-minimal.ts +26 -0
- package/bin/examples/sdk/02-custom-model.ts +49 -0
- package/bin/examples/sdk/03-custom-prompt.ts +75 -0
- package/bin/examples/sdk/04-skills.ts +55 -0
- package/bin/examples/sdk/05-tools.ts +48 -0
- package/bin/examples/sdk/06-extensions.ts +99 -0
- package/bin/examples/sdk/07-context-files.ts +47 -0
- package/bin/examples/sdk/08-prompt-templates.ts +51 -0
- package/bin/examples/sdk/09-api-keys-and-oauth.ts +34 -0
- package/bin/examples/sdk/10-settings.ts +53 -0
- package/bin/examples/sdk/11-sessions.ts +52 -0
- package/bin/examples/sdk/12-full-control.ts +74 -0
- package/bin/examples/sdk/13-session-runtime.ts +67 -0
- package/bin/examples/sdk/README.md +140 -0
- package/bin/export-html/ansi-to-html.d.ts +22 -0
- package/bin/export-html/ansi-to-html.d.ts.map +1 -0
- package/bin/export-html/ansi-to-html.js +249 -0
- package/bin/export-html/ansi-to-html.js.map +1 -0
- package/bin/export-html/index.d.ts +37 -0
- package/bin/export-html/index.d.ts.map +1 -0
- package/bin/export-html/index.js +226 -0
- package/bin/export-html/index.js.map +1 -0
- package/bin/export-html/template.css +1066 -0
- package/bin/export-html/template.html +55 -0
- package/bin/export-html/template.js +1864 -0
- package/bin/export-html/tool-renderer.d.ts +34 -0
- package/bin/export-html/tool-renderer.d.ts.map +1 -0
- package/bin/export-html/tool-renderer.js +108 -0
- package/bin/export-html/tool-renderer.js.map +1 -0
- package/bin/export-html/vendor/highlight.min.js +1213 -0
- package/bin/export-html/vendor/marked.min.js +78 -0
- package/bin/node_modules/@mariozechner/clipboard/.yarnrc.yml +1 -0
- package/bin/node_modules/@mariozechner/clipboard/Cargo.toml +45 -0
- package/bin/node_modules/@mariozechner/clipboard/README.md +60 -0
- package/bin/node_modules/@mariozechner/clipboard/build.rs +5 -0
- package/bin/node_modules/@mariozechner/clipboard/clipboard.linux-arm64-gnu.node +0 -0
- package/bin/node_modules/@mariozechner/clipboard/exp.ts +12 -0
- package/bin/node_modules/@mariozechner/clipboard/index.d.ts +37 -0
- package/bin/node_modules/@mariozechner/clipboard/index.js +606 -0
- package/bin/node_modules/@mariozechner/clipboard/package.json +56 -0
- package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/common.rs +307 -0
- package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/mod.rs +93 -0
- package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/ios.rs +313 -0
- package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/macos.rs +471 -0
- package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/mod.rs +252 -0
- package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/wayland.rs +431 -0
- package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/win.rs +712 -0
- package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/x11.rs +916 -0
- package/bin/node_modules/@mariozechner/clipboard/src/lib.rs +194 -0
- package/bin/node_modules/@mariozechner/clipboard-linux-arm64-gnu/README.md +3 -0
- package/bin/node_modules/@mariozechner/clipboard-linux-arm64-gnu/clipboard.linux-arm64-gnu.node +0 -0
- package/bin/node_modules/@mariozechner/clipboard-linux-arm64-gnu/package.json +25 -0
- package/bin/package.json +108 -0
- package/bin/photon_rs_bg.wasm +0 -0
- package/bin/pi +0 -0
- package/bin/theme/dark.json +88 -0
- package/bin/theme/light.json +87 -0
- package/bin/theme/theme-schema.json +344 -0
- package/package.json +20 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Development
|
|
2
|
+
|
|
3
|
+
See [AGENTS.md](https://github.com/earendil-works/pi-mono/blob/main/AGENTS.md) for additional guidelines.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
git clone https://github.com/earendil-works/pi-mono
|
|
9
|
+
cd pi-mono
|
|
10
|
+
npm install
|
|
11
|
+
npm run build
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Run from source:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
/path/to/pi-mono/pi-test.sh
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The script can be run from any directory. Pi keeps the caller's current working directory.
|
|
21
|
+
|
|
22
|
+
## Forking / Rebranding
|
|
23
|
+
|
|
24
|
+
Configure via `package.json`:
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"piConfig": {
|
|
29
|
+
"name": "pi",
|
|
30
|
+
"configDir": ".pi"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Change `name`, `configDir`, and `bin` field for your fork. Affects CLI banner, config paths, and environment variable names.
|
|
36
|
+
|
|
37
|
+
## Path Resolution
|
|
38
|
+
|
|
39
|
+
Three execution modes: npm install, standalone binary, tsx from source.
|
|
40
|
+
|
|
41
|
+
**Always use `src/config.ts`** for package assets:
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
import { getPackageDir, getThemeDir } from "./config.js";
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Never use `__dirname` directly for package assets.
|
|
48
|
+
|
|
49
|
+
## Debug Command
|
|
50
|
+
|
|
51
|
+
`/debug` (hidden) writes to `~/.pi/agent/pi-debug.log`:
|
|
52
|
+
- Rendered TUI lines with ANSI codes
|
|
53
|
+
- Last messages sent to the LLM
|
|
54
|
+
|
|
55
|
+
## Testing
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
./test.sh # Run non-LLM tests (no API keys needed)
|
|
59
|
+
npm test # Run all tests
|
|
60
|
+
npm test -- test/specific.test.ts # Run specific test
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Project Structure
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
packages/
|
|
67
|
+
ai/ # LLM provider abstraction
|
|
68
|
+
agent/ # Agent loop and message types
|
|
69
|
+
tui/ # Terminal UI components
|
|
70
|
+
coding-agent/ # CLI and interactive mode
|
|
71
|
+
```
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
{
|
|
2
|
+
"navigation": [
|
|
3
|
+
{
|
|
4
|
+
"title": "Start here",
|
|
5
|
+
"items": [
|
|
6
|
+
{
|
|
7
|
+
"title": "Overview",
|
|
8
|
+
"path": "index.md"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"title": "Quickstart",
|
|
12
|
+
"path": "quickstart.md"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"title": "Using Pi",
|
|
16
|
+
"path": "usage.md"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"title": "Providers",
|
|
20
|
+
"path": "providers.md"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"title": "Security",
|
|
24
|
+
"path": "security.md"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"title": "Containerization",
|
|
28
|
+
"path": "containerization.md"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"title": "Settings",
|
|
32
|
+
"path": "settings.md"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"title": "Keybindings",
|
|
36
|
+
"path": "keybindings.md"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"title": "Sessions",
|
|
40
|
+
"path": "sessions.md"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"title": "Compaction",
|
|
44
|
+
"path": "compaction.md"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"title": "Customization",
|
|
50
|
+
"items": [
|
|
51
|
+
{
|
|
52
|
+
"title": "Extensions",
|
|
53
|
+
"path": "extensions.md"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"title": "Skills",
|
|
57
|
+
"path": "skills.md"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"title": "Prompt Templates",
|
|
61
|
+
"path": "prompt-templates.md"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"title": "Themes",
|
|
65
|
+
"path": "themes.md"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"title": "Pi Packages",
|
|
69
|
+
"path": "packages.md"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"title": "Custom Models",
|
|
73
|
+
"path": "models.md"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"title": "Custom Providers",
|
|
77
|
+
"path": "custom-provider.md"
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"title": "Reference",
|
|
83
|
+
"items": [
|
|
84
|
+
{
|
|
85
|
+
"title": "Session Format",
|
|
86
|
+
"path": "session-format.md"
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"title": "Programmatic Usage",
|
|
92
|
+
"items": [
|
|
93
|
+
{
|
|
94
|
+
"title": "SDK",
|
|
95
|
+
"path": "sdk.md"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"title": "RPC Mode",
|
|
99
|
+
"path": "rpc.md"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"title": "JSON Event Stream Mode",
|
|
103
|
+
"path": "json.md"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"title": "TUI Components",
|
|
107
|
+
"path": "tui.md"
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"title": "Platform Setup",
|
|
113
|
+
"items": [
|
|
114
|
+
{
|
|
115
|
+
"title": "Windows",
|
|
116
|
+
"path": "windows.md"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"title": "Termux on Android",
|
|
120
|
+
"path": "termux.md"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"title": "tmux",
|
|
124
|
+
"path": "tmux.md"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"title": "Terminal Setup",
|
|
128
|
+
"path": "terminal-setup.md"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"title": "Shell Aliases",
|
|
132
|
+
"path": "shell-aliases.md"
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"title": "Development",
|
|
138
|
+
"items": [
|
|
139
|
+
{
|
|
140
|
+
"title": "Development",
|
|
141
|
+
"path": "development.md"
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
"redirects": [
|
|
147
|
+
{
|
|
148
|
+
"from": "session.md",
|
|
149
|
+
"to": "session-format.md"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"from": "tree.md",
|
|
153
|
+
"to": "sessions.md"
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Environment Variables
|
|
2
|
+
|
|
3
|
+
Pi uses environment variables in three ways:
|
|
4
|
+
|
|
5
|
+
- Variables such as `PI_OFFLINE` configure the Pi process.
|
|
6
|
+
- Pi sets `PI_CODING_AGENT` so child processes can detect that they run inside Pi.
|
|
7
|
+
- Commands run by the LLM-callable bash tool receive `PI_*` variables describing the current session.
|
|
8
|
+
|
|
9
|
+
Provider API-key variables are documented separately in [Providers](providers.md#environment-variables-or-auth-file).
|
|
10
|
+
|
|
11
|
+
## Process Marker
|
|
12
|
+
|
|
13
|
+
The CLI and RPC entry points set `PI_CODING_AGENT=true`. Child processes inherit it and can use it to detect that they run inside Pi. It is not session-specific and is not set automatically when Pi is embedded through the SDK.
|
|
14
|
+
|
|
15
|
+
## Bash Tool Session Environment
|
|
16
|
+
|
|
17
|
+
Commands run by the bash tool receive the current Pi session state:
|
|
18
|
+
|
|
19
|
+
| Variable | Description |
|
|
20
|
+
|----------|-------------|
|
|
21
|
+
| `PI_SESSION_ID` | Current session ID |
|
|
22
|
+
| `PI_SESSION_FILE` | Absolute path to the current session JSONL file; unset for ephemeral sessions |
|
|
23
|
+
| `PI_PROVIDER` | Currently selected model provider |
|
|
24
|
+
| `PI_MODEL` | Currently selected model ID |
|
|
25
|
+
| `PI_REASONING_LEVEL` | Current effective reasoning level: `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max` |
|
|
26
|
+
|
|
27
|
+
The values are resolved when each command starts. Switching models or changing the reasoning level therefore affects the next bash command without restarting Pi. `PI_PROVIDER` and `PI_MODEL` identify the selected Pi model, not a different upstream model that a router may choose internally.
|
|
28
|
+
|
|
29
|
+
When asked which model or provider is running, inspect these variables instead of inferring the answer from the system prompt:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
printf '%s/%s\n' "$PI_PROVIDER" "$PI_MODEL"
|
|
33
|
+
printf 'reasoning=%s session=%s\n' "$PI_REASONING_LEVEL" "$PI_SESSION_ID"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The session file can be inspected directly when the session is persistent:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
if [ -n "$PI_SESSION_FILE" ]; then
|
|
40
|
+
tail -n 1 "$PI_SESSION_FILE"
|
|
41
|
+
fi
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
These variables are injected into the LLM-callable bash tool. They are not injected into user-entered `!` or `!!` commands.
|
|
45
|
+
|
|
46
|
+
### Custom Bash Tools
|
|
47
|
+
|
|
48
|
+
Bash tools created with `createBashTool()` expose the session environment by default when registered with Pi. Injection happens before `spawnHook`, so a hook receives the variables in `ctx.env`:
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
const bashTool = createBashTool(cwd, {
|
|
52
|
+
spawnHook: (ctx) => ({
|
|
53
|
+
...ctx,
|
|
54
|
+
env: { ...ctx.env, CI: "1" },
|
|
55
|
+
}),
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Disable session metadata independently of the spawn hook:
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
const bashTool = createBashTool(cwd, {
|
|
63
|
+
exposeSessionEnvironment: false,
|
|
64
|
+
spawnHook: (ctx) => ctx,
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
When disabled, Pi removes inherited values for these variables so nested Pi processes do not expose stale parent-session metadata.
|
|
69
|
+
|
|
70
|
+
## Pi Process Configuration
|
|
71
|
+
|
|
72
|
+
These variables are read by Pi itself:
|
|
73
|
+
|
|
74
|
+
| Variable | Description |
|
|
75
|
+
|----------|-------------|
|
|
76
|
+
| `PI_CODING_AGENT_DIR` | Override the config directory; default is `~/.pi/agent` |
|
|
77
|
+
| `PI_CODING_AGENT_SESSION_DIR` | Override session storage; overridden by `--session-dir` |
|
|
78
|
+
| `PI_PACKAGE_DIR` | Override the package directory, useful for Nix/Guix store paths |
|
|
79
|
+
| `PI_OFFLINE` | Disable startup network operations, including update checks, package updates, and install/update telemetry |
|
|
80
|
+
| `PI_SKIP_VERSION_CHECK` | Disable the `pi.dev` latest-version request |
|
|
81
|
+
| `PI_TELEMETRY` | Override install/update telemetry and provider attribution headers: `1`/`true`/`yes` or `0`/`false`/`no` |
|
|
82
|
+
| `PI_CACHE_RETENTION` | Set to `long` for extended provider prompt caching where supported |
|
|
83
|
+
| `PI_SHARE_VIEWER_URL` | Override the base URL used by `/share` |
|
|
84
|
+
| `PI_HARDWARE_CURSOR` | Set to `1` to show the hardware cursor; see [Terminal setup](terminal-setup.md) |
|
|
85
|
+
| `VISUAL`, `EDITOR` | External editor fallback when `externalEditor` is unset |
|
|
86
|
+
| `HTTP_PROXY`, `HTTPS_PROXY` | Proxy outbound HTTP requests |
|
|
87
|
+
|
|
88
|
+
Provider credentials such as `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, and cloud-provider configuration are listed in [Providers](providers.md#environment-variables-or-auth-file).
|