@oh-my-pi/pi-coding-agent 12.7.6 → 12.8.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +37 -37
  2. package/README.md +9 -1052
  3. package/package.json +7 -7
  4. package/src/cli/args.ts +1 -0
  5. package/src/cli/update-cli.ts +49 -35
  6. package/src/cli/web-search-cli.ts +3 -2
  7. package/src/commands/web-search.ts +1 -0
  8. package/src/config/model-registry.ts +6 -0
  9. package/src/config/settings-schema.ts +25 -3
  10. package/src/config/settings.ts +1 -0
  11. package/src/extensibility/extensions/wrapper.ts +20 -13
  12. package/src/extensibility/slash-commands.ts +12 -91
  13. package/src/lsp/client.ts +24 -27
  14. package/src/lsp/index.ts +92 -42
  15. package/src/mcp/config-writer.ts +33 -0
  16. package/src/mcp/config.ts +6 -1
  17. package/src/mcp/types.ts +1 -0
  18. package/src/modes/components/custom-editor.ts +8 -5
  19. package/src/modes/components/settings-defs.ts +2 -1
  20. package/src/modes/controllers/command-controller.ts +12 -6
  21. package/src/modes/controllers/input-controller.ts +21 -186
  22. package/src/modes/controllers/mcp-command-controller.ts +60 -3
  23. package/src/modes/interactive-mode.ts +2 -2
  24. package/src/modes/types.ts +1 -1
  25. package/src/sdk.ts +23 -1
  26. package/src/secrets/index.ts +116 -0
  27. package/src/secrets/obfuscator.ts +269 -0
  28. package/src/secrets/regex.ts +21 -0
  29. package/src/session/agent-session.ts +143 -21
  30. package/src/session/compaction/branch-summarization.ts +2 -2
  31. package/src/session/compaction/compaction.ts +10 -3
  32. package/src/session/compaction/utils.ts +25 -1
  33. package/src/slash-commands/builtin-registry.ts +419 -0
  34. package/src/web/scrapers/github.ts +50 -12
  35. package/src/web/search/index.ts +5 -5
  36. package/src/web/search/provider.ts +13 -2
  37. package/src/web/search/providers/brave.ts +165 -0
  38. package/src/web/search/types.ts +1 -1
  39. package/docs/compaction.md +0 -436
  40. package/docs/config-usage.md +0 -176
  41. package/docs/custom-tools.md +0 -585
  42. package/docs/environment-variables.md +0 -257
  43. package/docs/extension-loading.md +0 -106
  44. package/docs/extensions.md +0 -1342
  45. package/docs/fs-scan-cache-architecture.md +0 -50
  46. package/docs/hooks.md +0 -906
  47. package/docs/models.md +0 -234
  48. package/docs/python-repl.md +0 -110
  49. package/docs/rpc.md +0 -1173
  50. package/docs/sdk.md +0 -1039
  51. package/docs/session-tree-plan.md +0 -84
  52. package/docs/session.md +0 -368
  53. package/docs/skills.md +0 -254
  54. package/docs/theme.md +0 -696
  55. package/docs/tree.md +0 -206
  56. package/docs/tui.md +0 -487
@@ -1,257 +0,0 @@
1
- # Environment Variables Reference
2
-
3
- This document lists all environment variables used by the coding agent.
4
-
5
- ## API Keys
6
-
7
- ### Multi-Provider Support
8
-
9
- | Variable | Description | Default |
10
- |----------|-------------|---------|
11
- | `OPENAI_API_KEY` | OpenAI API key for GPT models | - |
12
- | `ANTHROPIC_API_KEY` | Anthropic API key for Claude models | - |
13
- | `ANTHROPIC_OAUTH_TOKEN` | Anthropic OAuth token (takes precedence over `ANTHROPIC_API_KEY`) | - |
14
- | `GOOGLE_API_KEY` | Google Gemini API key | - |
15
- | `COPILOT_GITHUB_TOKEN` | GitHub Copilot personal access token | `$GH_TOKEN` or `$GITHUB_TOKEN` |
16
- | `GH_TOKEN` | GitHub CLI token (fallback for Copilot) | - |
17
- | `GITHUB_TOKEN` | GitHub token (fallback for Copilot and API access) | - |
18
- | `EXA_API_KEY` | Exa search API key | - |
19
- | `GROQ_API_KEY` | Groq API key for Llama and other models | - |
20
- | `CEREBRAS_API_KEY` | Cerebras API key | - |
21
- | `XAI_API_KEY` | xAI API key for Grok models | - |
22
- | `OPENROUTER_API_KEY` | OpenRouter aggregated models API key | - |
23
- | `MISTRAL_API_KEY` | Mistral AI API key | - |
24
- | `ZAI_API_KEY` | z.ai API key (ZhipuAI/GLM models) | - |
25
- | `MINIMAX_API_KEY` | MiniMax API key | - |
26
- | `OPENCODE_API_KEY` | OpenCode API key | - |
27
- | `CURSOR_ACCESS_TOKEN` | Cursor AI access token | - |
28
- | `AI_GATEWAY_API_KEY` | Vercel AI Gateway API key | - |
29
- | `PERPLEXITY_API_KEY` | Perplexity search API key | - |
30
-
31
- ### Provider-Specific Configuration
32
-
33
- #### AWS Bedrock
34
-
35
- | Variable | Description | Default |
36
- |----------|-------------|---------|
37
- | `AWS_REGION` | AWS region for Bedrock | `$AWS_DEFAULT_REGION` or `us-east-1` |
38
- | `AWS_DEFAULT_REGION` | AWS default region | - |
39
- | `AWS_PROFILE` | AWS CLI profile name | - |
40
- | `AWS_ACCESS_KEY_ID` | AWS access key ID | - |
41
- | `AWS_SECRET_ACCESS_KEY` | AWS secret access key | - |
42
- | `AWS_BEARER_TOKEN_BEDROCK` | AWS bearer token for Bedrock | - |
43
- | `AWS_CONTAINER_CREDENTIALS_RELATIVE_URI` | ECS container credentials URI | - |
44
- | `AWS_CONTAINER_CREDENTIALS_FULL_URI` | ECS container credentials full URI | - |
45
- | `AWS_WEB_IDENTITY_TOKEN_FILE` | Web identity token file path | - |
46
- | `AWS_ROLE_ARN` | IAM role ARN for web identity | - |
47
-
48
- #### Azure OpenAI
49
-
50
- | Variable | Description | Default |
51
- |----------|-------------|---------|
52
- | `AZURE_OPENAI_API_KEY` | Azure OpenAI API key (required) | - |
53
- | `AZURE_OPENAI_API_VERSION` | Azure OpenAI API version | `2024-10-01-preview` |
54
- | `AZURE_OPENAI_BASE_URL` | Azure OpenAI base URL | Constructed from resource name |
55
- | `AZURE_OPENAI_RESOURCE_NAME` | Azure OpenAI resource name | - |
56
- | `AZURE_OPENAI_DEPLOYMENT_NAME_MAP` | JSON map of model IDs to deployment names | `{}` |
57
-
58
- #### Google Cloud (Vertex AI)
59
-
60
- | Variable | Description | Default |
61
- |----------|-------------|---------|
62
- | `GOOGLE_CLOUD_PROJECT` | Google Cloud project ID (required for Vertex AI) | `$GCLOUD_PROJECT` |
63
- | `GCLOUD_PROJECT` | Google Cloud project ID (alternative) | - |
64
- | `GOOGLE_CLOUD_PROJECT_ID` | Google Cloud project ID (used during OAuth discovery) | `$GOOGLE_CLOUD_PROJECT` |
65
- | `GOOGLE_CLOUD_LOCATION` | Google Cloud location (required for Vertex AI) | - |
66
- | `GOOGLE_APPLICATION_CREDENTIALS` | Path to Google service account JSON | - |
67
-
68
- #### Anthropic Search & Custom Base URLs
69
-
70
- | Variable | Description | Default |
71
- |----------|-------------|---------|
72
- | `ANTHROPIC_BASE_URL` | Custom Anthropic API base URL | - |
73
- | `ANTHROPIC_SEARCH_API_KEY` | API key for Anthropic search (separate from main API) | - |
74
- | `ANTHROPIC_SEARCH_BASE_URL` | Custom base URL for Anthropic search | - |
75
- | `ANTHROPIC_SEARCH_MODEL` | Model to use for web search | `claude-sonnet-4` |
76
-
77
- #### Kimi
78
-
79
- | Variable | Description | Default |
80
- |----------|-------------|---------|
81
- | `KIMI_CODE_BASE_URL` | Kimi Code API base URL | `https://kimi.moonshot.cn` |
82
- | `KIMI_CODE_OAUTH_HOST` | Kimi Code OAuth host | `$KIMI_OAUTH_HOST` or `https://kimi.moonshot.cn` |
83
- | `KIMI_OAUTH_HOST` | Kimi OAuth host (fallback) | - |
84
-
85
- ## Model Configuration
86
-
87
- ### Model Role Overrides
88
-
89
- Override model roles via environment variables (ephemeral, not persisted):
90
-
91
- | Variable | Description | CLI Flag |
92
- |----------|-------------|----------|
93
- | `PI_SMOL_MODEL` | Fast model for lightweight tasks | `--smol` |
94
- | `PI_SLOW_MODEL` | Reasoning model for thorough analysis | `--slow` |
95
- | `PI_PLAN_MODEL` | Model for architectural planning | `--plan` |
96
-
97
- ## Agent Configuration
98
-
99
- ### Core Settings
100
-
101
- | Variable | Description | Default |
102
- |----------|-------------|---------|
103
- | `PI_CODING_AGENT_DIR` | Directory for agent data (sessions, auth, cache) | `~/.omp/agent` |
104
- | `PI_SUBPROCESS_CMD` | Custom command for spawning subagents | Auto-detected |
105
- | `PI_NO_TITLE` | Disable automatic session title generation | `false` |
106
- | `NULL_PROMPT` | Use empty system prompt (testing) | `false` |
107
- | `PI_BLOCKED_AGENT` | Override agent type in task tool | - |
108
-
109
- ### Caching
110
-
111
- | Variable | Description | Default |
112
- |----------|-------------|---------|
113
- | `PI_CACHE_RETENTION` | Prompt cache retention (`long` = 24h for OpenAI) | - |
114
-
115
- ## Python Configuration
116
-
117
- ### Python Kernel
118
-
119
- | Variable | Description | Default |
120
- |----------|-------------|---------|
121
- | `VIRTUAL_ENV` | Python virtual environment path | Auto-detected (`.venv` or `venv`) |
122
- | `PI_PY` | Python tool mode (`per-session`, `per-call`, `off`) | `per-session` |
123
- | `PI_PYTHON_SKIP_CHECK` | Skip Python availability check (testing) | `false` |
124
-
125
- ### External Python Gateway
126
-
127
- | Variable | Description | Default |
128
- |----------|-------------|---------|
129
- | `PI_PYTHON_GATEWAY_URL` | External Python gateway URL | - |
130
- | `PI_PYTHON_GATEWAY_TOKEN` | Authentication token for gateway | - |
131
-
132
- ### Debugging
133
-
134
- | Variable | Description | Default |
135
- |----------|-------------|---------|
136
- | `PI_PYTHON_IPC_TRACE` | Trace Python IPC messages (`1` = enabled) | `false` |
137
-
138
- ## Task & Subagent Configuration
139
-
140
- | Variable | Description | Default |
141
- |----------|-------------|---------|
142
- | `PI_TASK_MAX_OUTPUT_BYTES` | Maximum output bytes per subagent | `500000` |
143
- | `PI_TASK_MAX_OUTPUT_LINES` | Maximum output lines per subagent | `5000` |
144
-
145
- ## TUI & Terminal Configuration
146
-
147
- ### Terminal Capabilities
148
-
149
- | Variable | Description | Auto-Detected |
150
- |----------|-------------|---------------|
151
- | `COLORTERM` | Terminal color support (`truecolor`, `24bit`) | Yes |
152
- | `COLORFGBG` | Terminal foreground/background colors | Yes |
153
- | `TERM` | Terminal type | Yes |
154
- | `TERM_PROGRAM` | Terminal program name | Yes |
155
- | `TERM_PROGRAM_VERSION` | Terminal program version | Yes |
156
- | `TERMINAL_EMULATOR` | Terminal emulator name | Yes |
157
- | `WT_SESSION` | Windows Terminal session ID | Yes |
158
-
159
- ### TUI Behavior
160
-
161
- | Variable | Description | Default |
162
- |----------|-------------|---------|
163
- | `PI_NOTIFICATIONS` | Desktop notifications (`off`, `0`, `false` = disabled) | Enabled |
164
- | `PI_TUI_WRITE_LOG` | Log all TUI write operations to file | - |
165
- | `PI_HARDWARE_CURSOR` | Show hardware cursor (`1` = enabled) | `false` |
166
-
167
- ## Bash & Shell Configuration
168
-
169
- ### Shell Detection
170
-
171
- | Variable | Description | Auto-Detected |
172
- |----------|-------------|---------------|
173
- | `SHELL` | User's default shell | Yes (Unix) |
174
- | `ComSpec` | Command processor | Yes (Windows) |
175
-
176
- ### Editor
177
-
178
- | Variable | Description | Fallback |
179
- |----------|-------------|----------|
180
- | `VISUAL` | Visual editor for external editing (Ctrl+G) | `$EDITOR` |
181
- | `EDITOR` | Default text editor | - |
182
-
183
- ### Bash Tool Behavior
184
-
185
- | Variable | Description | Default |
186
- |----------|-------------|---------|
187
- | `PI_BASH_NO_CI` | Don't set `CI=true` in bash environment | `$CLAUDE_BASH_NO_CI` |
188
- | `CLAUDE_BASH_NO_CI` | Legacy name for `PI_BASH_NO_CI` | - |
189
- | `PI_BASH_NO_LOGIN` | Don't use login shell for bash | `$CLAUDE_BASH_NO_LOGIN` |
190
- | `CLAUDE_BASH_NO_LOGIN` | Legacy name for `PI_BASH_NO_LOGIN` | - |
191
- | `PI_SHELL_PREFIX` | Prefix for bash commands | `$CLAUDE_CODE_SHELL_PREFIX` |
192
- | `CLAUDE_CODE_SHELL_PREFIX` | Legacy name for `PI_SHELL_PREFIX` | - |
193
-
194
- ## Desktop Environment Detection
195
-
196
- These are auto-detected for system prompt context:
197
-
198
- | Variable | Purpose |
199
- |----------|---------|
200
- | `KDE_FULL_SESSION` | Detect KDE desktop |
201
- | `XDG_CURRENT_DESKTOP` | Current desktop environment |
202
- | `DESKTOP_SESSION` | Desktop session name |
203
- | `XDG_SESSION_DESKTOP` | XDG desktop session |
204
- | `GDMSESSION` | GDM session type |
205
- | `WINDOWMANAGER` | Window manager name |
206
- | `XDG_CONFIG_HOME` | User config directory |
207
- | `APPDATA` | Windows app data directory |
208
- | `HOME` | User home directory |
209
-
210
- ## LSP Configuration
211
-
212
- | Variable | Description | Default |
213
- |----------|-------------|---------|
214
- | `PI_DISABLE_LSPMUX` | Disable lspmux integration (`1` = disabled) | `false` |
215
-
216
- ## Debugging & Development
217
-
218
- ### General Debugging
219
-
220
- | Variable | Description | Default |
221
- |----------|-------------|---------|
222
- | `DEBUG` | Enable debug logging | `false` |
223
- | `PI_DEV` | Development mode (verbose native addon loading) | `false` |
224
- | `PI_TIMING` | Log tool factory and operation timings (`1` = enabled) | `false` |
225
-
226
- ### Startup Debugging
227
-
228
- | Variable | Description | Default |
229
- |----------|-------------|---------|
230
- | `PI_DEBUG_STARTUP` | Print startup stage timings to stderr | `false` |
231
-
232
- ### Provider-Specific Debugging
233
-
234
- | Variable | Description | Default |
235
- |----------|-------------|---------|
236
- | `DEBUG_CURSOR` | Cursor provider debug logging (`1` = basic, `2` or `verbose` = detailed) | `false` |
237
- | `DEBUG_CURSOR_LOG` | Path to write Cursor debug log file | - |
238
- | `PI_CODEX_DEBUG` | OpenAI Codex debug logging (`1` or `true` = enabled) | `false` |
239
-
240
- ## Commit Message Generation
241
-
242
- | Variable | Description | Default |
243
- |----------|-------------|---------|
244
- | `PI_COMMIT_TEST_FALLBACK` | Force fallback commit generation (testing) | `false` |
245
- | `PI_COMMIT_NO_FALLBACK` | Disable fallback commit generation | `false` |
246
- | `PI_COMMIT_MAP_REDUCE` | Enable/disable map-reduce for large diffs (`false` = disabled) | Enabled |
247
-
248
- ## Testing & CI
249
-
250
- These are auto-detected but documented for completeness:
251
-
252
- | Variable | Description |
253
- |----------|-------------|
254
- | `BUN_ENV` | Bun environment (`test` skips certain checks) |
255
- | `NODE_ENV` | Node environment (`test` skips certain checks) |
256
- | `E2E` | Enable end-to-end tests (`1` or `true`) |
257
- | `PI_NO_LOCAL_LLM` | Skip local LLM tests (Ollama, LM Studio) |
@@ -1,106 +0,0 @@
1
- # Extension Loading
2
-
3
- This document describes how omp discovers and loads extensions at runtime. It covers two related systems:
4
-
5
- - **Extension modules**: TypeScript/JavaScript modules that register tools, hooks, commands, etc.
6
- - **Gemini-style extensions**: `gemini-extension.json` manifests that declare MCP servers, tools, and context.
7
-
8
- ## Extension Modules (TypeScript/JavaScript)
9
-
10
- ### Discovery Locations
11
-
12
- Extension modules are auto-discovered from native config roots:
13
-
14
- - `.omp` (primary)
15
- - `.pi` (legacy alias)
16
-
17
- For each root:
18
-
19
- - **User-level**: `~/.omp/agent/extensions/`
20
- - **Project-level**: `<cwd>/.omp/extensions/`
21
-
22
- ### Configured Paths
23
-
24
- Additional extension paths can be provided via settings and CLI:
25
-
26
- - **Global settings**: `~/.omp/agent/config.yml` (or `$PI_CODING_AGENT_DIR/config.yml`)
27
- - **Project settings**: `<cwd>/.omp/settings.json`
28
- - **CLI**: `--extension` or `-e`
29
-
30
- The settings schema uses the `extensions` array (paths are files or directories):
31
-
32
- ```yaml
33
- # ~/.omp/agent/config.yml
34
- extensions:
35
- - ./local-extension.ts
36
- - ~/extensions/pack
37
- ```
38
-
39
- ```json
40
- // .omp/settings.json
41
- {
42
- "extensions": ["./project-extension.ts"]
43
- }
44
- ```
45
-
46
- Path resolution rules:
47
-
48
- - `~` expands to the home directory
49
- - Relative paths resolve against the current working directory
50
-
51
- To disable all extension loading:
52
-
53
- ```bash
54
- omp --no-extensions
55
- ```
56
-
57
- ### Entry Point Resolution
58
-
59
- Within an `extensions/` directory (auto-discovered or provided as a configured path):
60
-
61
- 1. **Direct files**: `extensions/*.ts` or `extensions/*.js`
62
- 2. **Subdirectory with index**: `extensions/<name>/index.ts` or `index.js`
63
- 3. **Subdirectory with package.json**: `extensions/<name>/package.json` containing `omp.extensions` or `pi.extensions`
64
-
65
- Example `package.json` manifest:
66
-
67
- ```json
68
- {
69
- "name": "my-extension-pack",
70
- "omp": {
71
- "extensions": ["./src/safety-gates.ts", "./src/custom-tools.ts"]
72
- }
73
- }
74
- ```
75
-
76
- Notes:
77
-
78
- - No recursion beyond one directory level. Use `package.json` manifests for nested layouts.
79
- - Extension discovery ignores dotfiles and `node_modules`.
80
- - `.gitignore`, `.ignore`, and `.fdignore` are honored for auto-discovered directories.
81
-
82
- ### Extension Naming and Disabling
83
-
84
- Extension names are derived from the entry point path:
85
-
86
- - `extensions/foo.ts` → `foo`
87
- - `extensions/foo/index.ts` → `foo`
88
-
89
- To disable an extension module, add its ID to `disabledExtensions`:
90
-
91
- ```yaml
92
- disabledExtensions:
93
- - "extension-module:foo"
94
- ```
95
-
96
- ## Gemini-Style Extensions (gemini-extension.json)
97
-
98
- `gemini-extension.json` manifests are discovered in config roots under:
99
-
100
- ```
101
- <root>/extensions/<name>/gemini-extension.json
102
- ```
103
-
104
- Where `<root>` is one of `.omp`, `.pi`, `.gemini` (at both user and project level).
105
-
106
- These manifests describe MCP servers, tools, and context. They are parsed as data (not executed as TypeScript modules). If `name` is missing from the manifest, the directory name is used instead.