mirror of
https://github.com/harivansh-afk/clanker-agent.git
synced 2026-04-15 10:05:14 +00:00
refactor: finish companion rename migration
Complete the remaining pi-to-companion rename across companion-os, web, vm-orchestrator, docker, and archived fixtures. Verification: - semantic rg sweeps for Pi/piConfig/getPi/.pi runtime references - npm run check in apps/companion-os (fails in this worktree: biome not found) Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
parent
e8fe3d54af
commit
536241053c
303 changed files with 3603 additions and 3602 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -1,24 +1,24 @@
|
|||
<p align="center">
|
||||
<a href="https://shittycodingagent.ai">
|
||||
<img src="https://shittycodingagent.ai/logo.svg" alt="pi logo" width="128">
|
||||
<img src="https://shittycodingagent.ai/logo.svg" alt="companion logo" width="128">
|
||||
</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://discord.com/invite/3cU7Bz4UPx"><img alt="Discord" src="https://img.shields.io/badge/discord-community-5865F2?style=flat-square&logo=discord&logoColor=white" /></a>
|
||||
<a href="https://www.npmjs.com/package/@mariozechner/pi-coding-agent"><img alt="npm" src="https://img.shields.io/npm/v/@mariozechner/pi-coding-agent?style=flat-square" /></a>
|
||||
<a href="https://www.npmjs.com/package/@mariozechner/companion-coding-agent"><img alt="npm" src="https://img.shields.io/npm/v/@mariozechner/companion-coding-agent?style=flat-square" /></a>
|
||||
<a href="https://github.com/getcompanion-ai/co-mono/actions/workflows/ci.yml"><img alt="Build status" src="https://img.shields.io/github/actions/workflow/status/getcompanion-ai/co-mono/ci.yml?style=flat-square&branch=main" /></a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://pi.dev">pi.dev</a> domain graciously donated by
|
||||
<a href="https://companion.dev">companion.dev</a> domain graciously donated by
|
||||
<br /><br />
|
||||
<a href="https://exe.dev"><img src="docs/images/exy.png" alt="Exy mascot" width="48" /><br />exe.dev</a>
|
||||
</p>
|
||||
|
||||
Pi is a minimal terminal coding harness. Adapt pi to your workflows, not the other way around, without having to fork and modify pi internals. Extend it with TypeScript [Extensions](#extensions), [Skills](#skills), [Prompt Templates](#prompt-templates), and [Themes](#themes). Put your extensions, skills, prompt templates, and themes in [Pi Packages](#pi-packages) and share them with others via npm or git.
|
||||
Companion is a minimal terminal coding harness. Adapt companion to your workflows, not the other way around, without having to fork and modify companion internals. Extend it with TypeScript [Extensions](#extensions), [Skills](#skills), [Prompt Templates](#prompt-templates), and [Themes](#themes). Put your extensions, skills, prompt templates, and themes in [Companion Packages](#companion-packages) and share them with others via npm or git.
|
||||
|
||||
Pi ships with powerful defaults but skips features like sub agents and plan mode. Instead, you can ask pi to build what you want or install a third party pi package that matches your workflow.
|
||||
Companion ships with powerful defaults but skips features like sub agents and plan mode. Instead, you can ask companion to build what you want or install a third party companion package that matches your workflow.
|
||||
|
||||
Pi runs in four modes: interactive, print or JSON, RPC for process integration, and an SDK for embedding in your own apps. See [openclaw/openclaw](https://github.com/openclaw/openclaw) for a real-world SDK integration.
|
||||
Companion runs in four modes: interactive, print or JSON, RPC for process integration, and an SDK for embedding in your own apps. See [openclaw/openclaw](https://github.com/openclaw/openclaw) for a real-world SDK integration.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
|
|
@ -39,7 +39,7 @@ Pi runs in four modes: interactive, print or JSON, RPC for process integration,
|
|||
- [Skills](#skills)
|
||||
- [Extensions](#extensions)
|
||||
- [Themes](#themes)
|
||||
- [Pi Packages](#pi-packages)
|
||||
- [Companion Packages](#companion-packages)
|
||||
- [Programmatic Usage](#programmatic-usage)
|
||||
- [Philosophy](#philosophy)
|
||||
- [CLI Reference](#cli-reference)
|
||||
|
|
@ -49,24 +49,24 @@ Pi runs in four modes: interactive, print or JSON, RPC for process integration,
|
|||
## Quick Start
|
||||
|
||||
```bash
|
||||
npm install -g @mariozechner/pi-coding-agent
|
||||
npm install -g @mariozechner/companion-coding-agent
|
||||
```
|
||||
|
||||
Authenticate with an API key:
|
||||
|
||||
```bash
|
||||
export ANTHROPIC_API_KEY=sk-ant-...
|
||||
pi
|
||||
companion
|
||||
```
|
||||
|
||||
Or use your existing subscription:
|
||||
|
||||
```bash
|
||||
pi
|
||||
companion
|
||||
/login # Then select provider
|
||||
```
|
||||
|
||||
Then just talk to pi. By default, pi gives the model four tools: `read`, `write`, `edit`, and `bash`. The model uses these to fulfill your requests. Add capabilities via [skills](#skills), [prompt templates](#prompt-templates), [extensions](#extensions), or [pi packages](#pi-packages).
|
||||
Then just talk to companion. By default, companion gives the model four tools: `read`, `write`, `edit`, and `bash`. The model uses these to fulfill your requests. Add capabilities via [skills](#skills), [prompt templates](#prompt-templates), [extensions](#extensions), or [companion packages](#companion-packages).
|
||||
|
||||
**Platform notes:** [Windows](docs/windows.md) | [Termux (Android)](docs/termux.md) | [Terminal setup](docs/terminal-setup.md) | [Shell aliases](docs/shell-aliases.md)
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ Then just talk to pi. By default, pi gives the model four tools: `read`, `write`
|
|||
|
||||
## Providers & Models
|
||||
|
||||
For each built-in provider, pi maintains a list of tool-capable models, updated with every release. Authenticate via subscription (`/login`) or API key, then select any model from that provider via `/model` (or Ctrl+L).
|
||||
For each built-in provider, companion maintains a list of tool-capable models, updated with every release. Authenticate via subscription (`/login`) or API key, then select any model from that provider via `/model` (or Ctrl+L).
|
||||
|
||||
**Subscriptions:**
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ For each built-in provider, pi maintains a list of tool-capable models, updated
|
|||
|
||||
See [docs/providers.md](docs/providers.md) for detailed setup instructions.
|
||||
|
||||
**Custom providers & models:** Add providers via `~/.pi/agent/models.json` if they speak a supported API (OpenAI, Anthropic, Google). For custom APIs or OAuth, use extensions. See [docs/models.md](docs/models.md) and [docs/custom-provider.md](docs/custom-provider.md).
|
||||
**Custom providers & models:** Add providers via `~/.companion/agent/models.json` if they speak a supported API (OpenAI, Anthropic, Google). For custom APIs or OAuth, use extensions. See [docs/models.md](docs/models.md) and [docs/custom-provider.md](docs/custom-provider.md).
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -159,11 +159,11 @@ Type `/` in the editor to trigger commands. [Extensions](#extensions) can regist
|
|||
| `/reload` | Reload extensions, skills, prompts, context files (themes hot-reload automatically) |
|
||||
| `/hotkeys` | Show all keyboard shortcuts |
|
||||
| `/changelog` | Display version history |
|
||||
| `/quit`, `/exit` | Quit pi |
|
||||
| `/quit`, `/exit` | Quit companion |
|
||||
|
||||
### Keyboard Shortcuts
|
||||
|
||||
See `/hotkeys` for the full list. Customize via `~/.pi/agent/keybindings.json`. See [docs/keybindings.md](docs/keybindings.md).
|
||||
See `/hotkeys` for the full list. Customize via `~/.companion/agent/keybindings.json`. See [docs/keybindings.md](docs/keybindings.md).
|
||||
|
||||
**Commonly used:**
|
||||
|
||||
|
|
@ -198,13 +198,13 @@ Sessions are stored as JSONL files with a tree structure. Each entry has an `id`
|
|||
|
||||
### Management
|
||||
|
||||
Sessions auto-save to `~/.pi/agent/sessions/` organized by working directory.
|
||||
Sessions auto-save to `~/.companion/agent/sessions/` organized by working directory.
|
||||
|
||||
```bash
|
||||
pi -c # Continue most recent session
|
||||
pi -r # Browse and select from past sessions
|
||||
pi --no-session # Ephemeral mode (don't save)
|
||||
pi --session <path> # Use specific session file or ID
|
||||
companion -c # Continue most recent session
|
||||
companion -r # Browse and select from past sessions
|
||||
companion --no-session # Ephemeral mode (don't save)
|
||||
companion --session <path> # Use specific session file or ID
|
||||
```
|
||||
|
||||
### Branching
|
||||
|
|
@ -237,8 +237,8 @@ Use `/settings` to modify common options, or edit JSON files directly:
|
|||
|
||||
| Location | Scope |
|
||||
| --------------------------- | -------------------------- |
|
||||
| `~/.pi/agent/settings.json` | Global (all projects) |
|
||||
| `.pi/settings.json` | Project (overrides global) |
|
||||
| `~/.companion/agent/settings.json` | Global (all projects) |
|
||||
| `.companion/settings.json` | Project (overrides global) |
|
||||
|
||||
See [docs/settings.md](docs/settings.md) for all options.
|
||||
|
||||
|
|
@ -246,9 +246,9 @@ See [docs/settings.md](docs/settings.md) for all options.
|
|||
|
||||
## Context Files
|
||||
|
||||
Pi loads `AGENTS.md` (or `CLAUDE.md`) at startup from:
|
||||
Companion loads `AGENTS.md` (or `CLAUDE.md`) at startup from:
|
||||
|
||||
- `~/.pi/agent/AGENTS.md` (global)
|
||||
- `~/.companion/agent/AGENTS.md` (global)
|
||||
- Parent directories (walking up from cwd)
|
||||
- Current directory
|
||||
|
||||
|
|
@ -256,7 +256,7 @@ Use for project instructions, conventions, common commands. All matching files a
|
|||
|
||||
### System Prompt
|
||||
|
||||
Replace the default system prompt with `.pi/SYSTEM.md` (project) or `~/.pi/agent/SYSTEM.md` (global). Append without replacing via `APPEND_SYSTEM.md`.
|
||||
Replace the default system prompt with `.companion/SYSTEM.md` (project) or `~/.companion/agent/SYSTEM.md` (global). Append without replacing via `APPEND_SYSTEM.md`.
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -267,20 +267,20 @@ Replace the default system prompt with `.pi/SYSTEM.md` (project) or `~/.pi/agent
|
|||
Reusable prompts as Markdown files. Type `/name` to expand.
|
||||
|
||||
```markdown
|
||||
<!-- ~/.pi/agent/prompts/review.md -->
|
||||
<!-- ~/.companion/agent/prompts/review.md -->
|
||||
|
||||
Review this code for bugs, security issues, and performance problems.
|
||||
Focus on: {{focus}}
|
||||
```
|
||||
|
||||
Place in `~/.pi/agent/prompts/`, `.pi/prompts/`, or a [pi package](#pi-packages) to share with others. See [docs/prompt-templates.md](docs/prompt-templates.md).
|
||||
Place in `~/.companion/agent/prompts/`, `.companion/prompts/`, or a [companion package](#companion-packages) to share with others. See [docs/prompt-templates.md](docs/prompt-templates.md).
|
||||
|
||||
### Skills
|
||||
|
||||
On-demand capability packages following the [Agent Skills standard](https://agentskills.io). Invoke via `/skill:name` or let the agent load them automatically.
|
||||
|
||||
```markdown
|
||||
<!-- ~/.pi/agent/skills/my-skill/SKILL.md -->
|
||||
<!-- ~/.companion/agent/skills/my-skill/SKILL.md -->
|
||||
|
||||
# My Skill
|
||||
|
||||
|
|
@ -292,19 +292,19 @@ Use this skill when the user asks about X.
|
|||
2. Then that
|
||||
```
|
||||
|
||||
Place in `~/.pi/agent/skills/`, `~/.agents/skills/`, `.pi/skills/`, or `.agents/skills/` (from `cwd` up through parent directories) or a [pi package](#pi-packages) to share with others. See [docs/skills.md](docs/skills.md).
|
||||
Place in `~/.companion/agent/skills/`, `~/.agents/skills/`, `.companion/skills/`, or `.agents/skills/` (from `cwd` up through parent directories) or a [companion package](#companion-packages) to share with others. See [docs/skills.md](docs/skills.md).
|
||||
|
||||
### Extensions
|
||||
|
||||
<p align="center"><img src="docs/images/doom-extension.png" alt="Doom Extension" width="600"></p>
|
||||
|
||||
TypeScript modules that extend pi with custom tools, commands, keyboard shortcuts, event handlers, and UI components.
|
||||
TypeScript modules that extend companion with custom tools, commands, keyboard shortcuts, event handlers, and UI components.
|
||||
|
||||
```typescript
|
||||
export default function (pi: ExtensionAPI) {
|
||||
pi.registerTool({ name: "deploy", ... });
|
||||
pi.registerCommand("stats", { ... });
|
||||
pi.on("tool_call", async (event, ctx) => { ... });
|
||||
export default function (companion: ExtensionAPI) {
|
||||
companion.registerTool({ name: "deploy", ... });
|
||||
companion.registerCommand("stats", { ... });
|
||||
companion.on("tool_call", async (event, ctx) => { ... });
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -319,50 +319,50 @@ export default function (pi: ExtensionAPI) {
|
|||
- Git checkpointing and auto-commit
|
||||
- SSH and sandbox execution
|
||||
- MCP server integration
|
||||
- Make pi look like Claude Code
|
||||
- Make companion look like Claude Code
|
||||
- Games while waiting (yes, Doom runs)
|
||||
- ...anything you can dream up
|
||||
|
||||
Place in `~/.pi/agent/extensions/`, `.pi/extensions/`, or a [pi package](#pi-packages) to share with others. See [docs/extensions.md](docs/extensions.md).
|
||||
Place in `~/.companion/agent/extensions/`, `.companion/extensions/`, or a [companion package](#companion-packages) to share with others. See [docs/extensions.md](docs/extensions.md).
|
||||
|
||||
### Themes
|
||||
|
||||
Built-in: `dark`, `light`. Themes hot-reload: modify the active theme file and pi immediately applies changes.
|
||||
Built-in: `dark`, `light`. Themes hot-reload: modify the active theme file and companion immediately applies changes.
|
||||
|
||||
Place in `~/.pi/agent/themes/`, `.pi/themes/`, or a [pi package](#pi-packages) to share with others. See [docs/themes.md](docs/themes.md).
|
||||
Place in `~/.companion/agent/themes/`, `.companion/themes/`, or a [companion package](#companion-packages) to share with others. See [docs/themes.md](docs/themes.md).
|
||||
|
||||
### Pi Packages
|
||||
### Companion Packages
|
||||
|
||||
Bundle and share extensions, skills, prompts, and themes via npm or git. Find packages on [npmjs.com](https://www.npmjs.com/search?q=keywords%3Api-package) or [Discord](https://discord.com/channels/1456806362351669492/1457744485428629628).
|
||||
Bundle and share extensions, skills, prompts, and themes via npm or git. Find packages on [npmjs.com](https://www.npmjs.com/search?q=keywords%3Acompanion-package) or [Discord](https://discord.com/channels/1456806362351669492/1457744485428629628).
|
||||
|
||||
> **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.
|
||||
> **Security:** Companion 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.
|
||||
|
||||
```bash
|
||||
pi install npm:@foo/pi-tools
|
||||
pi install npm:@foo/pi-tools@1.2.3 # pinned version
|
||||
pi install git:github.com/user/repo
|
||||
pi install git:github.com/user/repo@v1 # tag or commit
|
||||
pi install git:git@github.com:user/repo
|
||||
pi install git:git@github.com:user/repo@v1 # tag or commit
|
||||
pi install https://github.com/user/repo
|
||||
pi install https://github.com/user/repo@v1 # tag or commit
|
||||
pi install ssh://git@github.com/user/repo
|
||||
pi install ssh://git@github.com/user/repo@v1 # tag or commit
|
||||
pi remove npm:@foo/pi-tools
|
||||
pi list
|
||||
pi update # skips pinned packages
|
||||
pi config # enable/disable extensions, skills, prompts, themes
|
||||
companion install npm:@foo/companion-tools
|
||||
companion install npm:@foo/companion-tools@1.2.3 # pinned version
|
||||
companion install git:github.com/user/repo
|
||||
companion install git:github.com/user/repo@v1 # tag or commit
|
||||
companion install git:git@github.com:user/repo
|
||||
companion install git:git@github.com:user/repo@v1 # tag or commit
|
||||
companion install https://github.com/user/repo
|
||||
companion install https://github.com/user/repo@v1 # tag or commit
|
||||
companion install ssh://git@github.com/user/repo
|
||||
companion install ssh://git@github.com/user/repo@v1 # tag or commit
|
||||
companion remove npm:@foo/companion-tools
|
||||
companion list
|
||||
companion update # skips pinned packages
|
||||
companion config # enable/disable extensions, skills, prompts, themes
|
||||
```
|
||||
|
||||
Packages install to `~/.pi/agent/git/` (git) or global npm. Use `-l` for project-local installs (`.pi/git/`, `.pi/npm/`).
|
||||
Packages install to `~/.companion/agent/git/` (git) or global npm. Use `-l` for project-local installs (`.companion/git/`, `.companion/npm/`).
|
||||
|
||||
Create a package by adding a `pi` key to `package.json`:
|
||||
Create a package by adding a `companion` key to `package.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "my-pi-package",
|
||||
"keywords": ["pi-package"],
|
||||
"pi": {
|
||||
"name": "my-companion-package",
|
||||
"keywords": ["companion-package"],
|
||||
"companion": {
|
||||
"extensions": ["./extensions"],
|
||||
"skills": ["./skills"],
|
||||
"prompts": ["./prompts"],
|
||||
|
|
@ -371,7 +371,7 @@ Create a package by adding a `pi` key to `package.json`:
|
|||
}
|
||||
```
|
||||
|
||||
Without a `pi` manifest, pi auto-discovers from conventional directories (`extensions/`, `skills/`, `prompts/`, `themes/`).
|
||||
Without a `companion` manifest, companion auto-discovers from conventional directories (`extensions/`, `skills/`, `prompts/`, `themes/`).
|
||||
|
||||
See [docs/packages.md](docs/packages.md).
|
||||
|
||||
|
|
@ -387,7 +387,7 @@ import {
|
|||
createAgentSession,
|
||||
ModelRegistry,
|
||||
SessionManager,
|
||||
} from "@mariozechner/pi-coding-agent";
|
||||
} from "@mariozechner/companion-coding-agent";
|
||||
|
||||
const { session } = await createAgentSession({
|
||||
sessionManager: SessionManager.inMemory(),
|
||||
|
|
@ -405,7 +405,7 @@ See [docs/sdk.md](docs/sdk.md).
|
|||
For non-Node.js integrations, use RPC mode over stdin/stdout:
|
||||
|
||||
```bash
|
||||
pi --mode rpc
|
||||
companion --mode rpc
|
||||
```
|
||||
|
||||
See [docs/rpc.md](docs/rpc.md) for the protocol.
|
||||
|
|
@ -414,11 +414,11 @@ See [docs/rpc.md](docs/rpc.md) for the protocol.
|
|||
|
||||
## Philosophy
|
||||
|
||||
Pi is aggressively extensible so it doesn't have to dictate your workflow. Features that other tools bake in can be built with [extensions](#extensions), [skills](#skills), or installed from third-party [pi packages](#pi-packages). This keeps the core minimal while letting you shape pi to fit how you work.
|
||||
Companion is aggressively extensible so it doesn't have to dictate your workflow. Features that other tools bake in can be built with [extensions](#extensions), [skills](#skills), or installed from third-party [companion packages](#companion-packages). This keeps the core minimal while letting you shape companion to fit how you work.
|
||||
|
||||
**No MCP.** Build CLI tools with READMEs (see [Skills](#skills)), or build an extension that adds MCP support. [Why?](https://mariozechner.at/posts/2025-11-02-what-if-you-dont-need-mcp/)
|
||||
|
||||
**No sub-agents.** There's many ways to do this. Spawn pi instances via tmux, or build your own with [extensions](#extensions), or install a package that does it your way.
|
||||
**No sub-agents.** There's many ways to do this. Spawn companion instances via tmux, or build your own with [extensions](#extensions), or install a package that does it your way.
|
||||
|
||||
**No permission popups.** Run in a container, or build your own confirmation flow with [extensions](#extensions) inline with your environment and security requirements.
|
||||
|
||||
|
|
@ -428,24 +428,24 @@ Pi is aggressively extensible so it doesn't have to dictate your workflow. Featu
|
|||
|
||||
**No background bash.** Use tmux. Full observability, direct interaction.
|
||||
|
||||
Read the [blog post](https://mariozechner.at/posts/2025-11-30-pi-coding-agent/) for the full rationale.
|
||||
Read the [blog post](https://mariozechner.at/posts/2025-11-30-companion-coding-agent/) for the full rationale.
|
||||
|
||||
---
|
||||
|
||||
## CLI Reference
|
||||
|
||||
```bash
|
||||
pi [options] [@files...] [messages...]
|
||||
companion [options] [@files...] [messages...]
|
||||
```
|
||||
|
||||
### Package Commands
|
||||
|
||||
```bash
|
||||
pi install <source> [-l] # Install package, -l for project-local
|
||||
pi remove <source> [-l] # Remove package
|
||||
pi update [source] # Update packages (skips pinned)
|
||||
pi list # List installed packages
|
||||
pi config # Enable/disable package resources
|
||||
companion install <source> [-l] # Install package, -l for project-local
|
||||
companion remove <source> [-l] # Remove package
|
||||
companion update [source] # Update packages (skips pinned)
|
||||
companion list # List installed packages
|
||||
companion config # Enable/disable package resources
|
||||
```
|
||||
|
||||
### Modes
|
||||
|
|
@ -519,47 +519,47 @@ Combine `--no-*` with explicit flags to load exactly what you need, ignoring set
|
|||
Prefix files with `@` to include in the message:
|
||||
|
||||
```bash
|
||||
pi @prompt.md "Answer this"
|
||||
pi -p @screenshot.png "What's in this image?"
|
||||
pi @code.ts @test.ts "Review these files"
|
||||
companion @prompt.md "Answer this"
|
||||
companion -p @screenshot.png "What's in this image?"
|
||||
companion @code.ts @test.ts "Review these files"
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```bash
|
||||
# Interactive with initial prompt
|
||||
pi "List all .ts files in src/"
|
||||
companion "List all .ts files in src/"
|
||||
|
||||
# Non-interactive
|
||||
pi -p "Summarize this codebase"
|
||||
companion -p "Summarize this codebase"
|
||||
|
||||
# Different model
|
||||
pi --provider openai --model gpt-4o "Help me refactor"
|
||||
companion --provider openai --model gpt-4o "Help me refactor"
|
||||
|
||||
# Model with provider prefix (no --provider needed)
|
||||
pi --model openai/gpt-4o "Help me refactor"
|
||||
companion --model openai/gpt-4o "Help me refactor"
|
||||
|
||||
# Model with thinking level shorthand
|
||||
pi --model sonnet:high "Solve this complex problem"
|
||||
companion --model sonnet:high "Solve this complex problem"
|
||||
|
||||
# Limit model cycling
|
||||
pi --models "claude-*,gpt-4o"
|
||||
companion --models "claude-*,gpt-4o"
|
||||
|
||||
# Read-only mode
|
||||
pi --tools read,grep,find,ls -p "Review the code"
|
||||
companion --tools read,grep,find,ls -p "Review the code"
|
||||
|
||||
# High thinking level
|
||||
pi --thinking high "Solve this complex problem"
|
||||
companion --thinking high "Solve this complex problem"
|
||||
```
|
||||
|
||||
### Environment Variables
|
||||
|
||||
| Variable | Description |
|
||||
| ----------------------- | ---------------------------------------------------------------------------------- |
|
||||
| `PI_CODING_AGENT_DIR` | Override config directory (default: `~/.pi/agent`) |
|
||||
| `PI_PACKAGE_DIR` | Override package directory (useful for Nix/Guix where store paths tokenize poorly) |
|
||||
| `PI_SKIP_VERSION_CHECK` | Skip version check at startup |
|
||||
| `PI_CACHE_RETENTION` | Set to `long` for extended prompt cache (Anthropic: 1h, OpenAI: 24h) |
|
||||
| `COMPANION_CODING_AGENT_DIR` | Override config directory (default: `~/.companion/agent`) |
|
||||
| `COMPANION_PACKAGE_DIR` | Override package directory (useful for Nix/Guix where store paths tokenize poorly) |
|
||||
| `COMPANION_SKIP_VERSION_CHECK` | Skip version check at startup |
|
||||
| `COMPANION_CACHE_RETENTION` | Set to `long` for extended prompt cache (Anthropic: 1h, OpenAI: 24h) |
|
||||
| `VISUAL`, `EDITOR` | External editor for Ctrl+G |
|
||||
|
||||
---
|
||||
|
|
@ -576,6 +576,6 @@ MIT
|
|||
|
||||
## See Also
|
||||
|
||||
- [@mariozechner/pi-ai](https://www.npmjs.com/package/@mariozechner/pi-ai): Core LLM toolkit
|
||||
- [@mariozechner/pi-agent](https://www.npmjs.com/package/@mariozechner/pi-agent): Agent framework
|
||||
- [@mariozechner/pi-tui](https://www.npmjs.com/package/@mariozechner/pi-tui): Terminal UI components
|
||||
- [@mariozechner/companion-ai](https://www.npmjs.com/package/@mariozechner/companion-ai): Core LLM toolkit
|
||||
- [@mariozechner/companion-agent](https://www.npmjs.com/package/@mariozechner/companion-agent): Agent framework
|
||||
- [@mariozechner/companion-tui](https://www.npmjs.com/package/@mariozechner/companion-tui): Terminal UI components
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
# Compaction & Branch Summarization
|
||||
|
||||
LLMs have limited context windows. When conversations grow too long, pi uses compaction to summarize older content while preserving recent work. This page covers both auto-compaction and branch summarization.
|
||||
LLMs have limited context windows. When conversations grow too long, companion uses compaction to summarize older content while preserving recent work. This page covers both auto-compaction and branch summarization.
|
||||
|
||||
**Source files** ([pi-mono](https://github.com/badlogic/pi-mono)):
|
||||
**Source files** ([companion-mono](https://github.com/badlogic/companion-mono)):
|
||||
|
||||
- [`packages/coding-agent/src/core/compaction/compaction.ts`](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/src/core/compaction/compaction.ts) - Auto-compaction logic
|
||||
- [`packages/coding-agent/src/core/compaction/branch-summarization.ts`](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts) - Branch summarization
|
||||
- [`packages/coding-agent/src/core/compaction/utils.ts`](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/src/core/compaction/utils.ts) - Shared utilities (file tracking, serialization)
|
||||
- [`packages/coding-agent/src/core/session-manager.ts`](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/src/core/session-manager.ts) - Entry types (`CompactionEntry`, `BranchSummaryEntry`)
|
||||
- [`packages/coding-agent/src/core/extensions/types.ts`](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/src/core/extensions/types.ts) - Extension event types
|
||||
- [`packages/coding-agent/src/core/compaction/compaction.ts`](https://github.com/badlogic/companion-mono/blob/main/packages/coding-agent/src/core/compaction/compaction.ts) - Auto-compaction logic
|
||||
- [`packages/coding-agent/src/core/compaction/branch-summarization.ts`](https://github.com/badlogic/companion-mono/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts) - Branch summarization
|
||||
- [`packages/coding-agent/src/core/compaction/utils.ts`](https://github.com/badlogic/companion-mono/blob/main/packages/coding-agent/src/core/compaction/utils.ts) - Shared utilities (file tracking, serialization)
|
||||
- [`packages/coding-agent/src/core/session-manager.ts`](https://github.com/badlogic/companion-mono/blob/main/packages/coding-agent/src/core/session-manager.ts) - Entry types (`CompactionEntry`, `BranchSummaryEntry`)
|
||||
- [`packages/coding-agent/src/core/extensions/types.ts`](https://github.com/badlogic/companion-mono/blob/main/packages/coding-agent/src/core/extensions/types.ts) - Extension event types
|
||||
|
||||
For TypeScript definitions in your project, inspect `node_modules/@mariozechner/pi-coding-agent/dist/`.
|
||||
For TypeScript definitions in your project, inspect `node_modules/@mariozechner/companion-coding-agent/dist/`.
|
||||
|
||||
## Overview
|
||||
|
||||
Pi has two summarization mechanisms:
|
||||
Companion has two summarization mechanisms:
|
||||
|
||||
| Mechanism | Trigger | Purpose |
|
||||
| -------------------- | ---------------------------------------- | ----------------------------------------- |
|
||||
|
|
@ -33,13 +33,13 @@ Auto-compaction triggers when:
|
|||
contextTokens > contextWindow - reserveTokens
|
||||
```
|
||||
|
||||
By default, `reserveTokens` is 16384 tokens (configurable in `~/.pi/agent/settings.json` or `<project-dir>/.pi/settings.json`). This leaves room for the LLM's response.
|
||||
By default, `reserveTokens` is 16384 tokens (configurable in `~/.companion/agent/settings.json` or `<project-dir>/.companion/settings.json`). This leaves room for the LLM's response.
|
||||
|
||||
You can also trigger manually with `/compact [instructions]`, where optional instructions focus the summary.
|
||||
|
||||
### How It Works
|
||||
|
||||
1. **Find cut point**: Walk backwards from newest message, accumulating token estimates until `keepRecentTokens` (default 20k, configurable in `~/.pi/agent/settings.json` or `<project-dir>/.pi/settings.json`) is reached
|
||||
1. **Find cut point**: Walk backwards from newest message, accumulating token estimates until `keepRecentTokens` (default 20k, configurable in `~/.companion/agent/settings.json` or `<project-dir>/.companion/settings.json`) is reached
|
||||
2. **Extract messages**: Collect messages from previous compaction (or start) up to cut point
|
||||
3. **Generate summary**: Call LLM to summarize with structured format
|
||||
4. **Append entry**: Save `CompactionEntry` with summary and `firstKeptEntryId`
|
||||
|
|
@ -101,7 +101,7 @@ Split turn (one huge turn exceeds budget):
|
|||
turnPrefixMessages = [usr, ass, tool, ass, tool, tool]
|
||||
```
|
||||
|
||||
For split turns, pi generates two summaries and merges them:
|
||||
For split turns, companion generates two summaries and merges them:
|
||||
|
||||
1. **History summary**: Previous context (if any)
|
||||
2. **Turn prefix summary**: The early part of the split turn
|
||||
|
|
@ -119,7 +119,7 @@ Never cut at tool results (they must stay with their tool call).
|
|||
|
||||
### CompactionEntry Structure
|
||||
|
||||
Defined in [`session-manager.ts`](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/src/core/session-manager.ts):
|
||||
Defined in [`session-manager.ts`](https://github.com/badlogic/companion-mono/blob/main/packages/coding-agent/src/core/session-manager.ts):
|
||||
|
||||
```typescript
|
||||
interface CompactionEntry<T = unknown> {
|
||||
|
|
@ -143,13 +143,13 @@ interface CompactionDetails {
|
|||
|
||||
Extensions can store any JSON-serializable data in `details`. The default compaction tracks file operations, but custom extension implementations can use their own structure.
|
||||
|
||||
See [`prepareCompaction()`](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/src/core/compaction/compaction.ts) and [`compact()`](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/src/core/compaction/compaction.ts) for the implementation.
|
||||
See [`prepareCompaction()`](https://github.com/badlogic/companion-mono/blob/main/packages/coding-agent/src/core/compaction/compaction.ts) and [`compact()`](https://github.com/badlogic/companion-mono/blob/main/packages/coding-agent/src/core/compaction/compaction.ts) for the implementation.
|
||||
|
||||
## Branch Summarization
|
||||
|
||||
### When It Triggers
|
||||
|
||||
When you use `/tree` to navigate to a different branch, pi offers to summarize the work you're leaving. This injects context from the left branch into the new branch.
|
||||
When you use `/tree` to navigate to a different branch, companion offers to summarize the work you're leaving. This injects context from the left branch into the new branch.
|
||||
|
||||
### How It Works
|
||||
|
||||
|
|
@ -178,7 +178,7 @@ After navigation with summary:
|
|||
|
||||
### Cumulative File Tracking
|
||||
|
||||
Both compaction and branch summarization track files cumulatively. When generating a summary, pi extracts file operations from:
|
||||
Both compaction and branch summarization track files cumulatively. When generating a summary, companion extracts file operations from:
|
||||
|
||||
- Tool calls in the messages being summarized
|
||||
- Previous compaction or branch summary `details` (if any)
|
||||
|
|
@ -187,7 +187,7 @@ This means file tracking accumulates across multiple compactions or nested branc
|
|||
|
||||
### BranchSummaryEntry Structure
|
||||
|
||||
Defined in [`session-manager.ts`](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/src/core/session-manager.ts):
|
||||
Defined in [`session-manager.ts`](https://github.com/badlogic/companion-mono/blob/main/packages/coding-agent/src/core/session-manager.ts):
|
||||
|
||||
```typescript
|
||||
interface BranchSummaryEntry<T = unknown> {
|
||||
|
|
@ -210,7 +210,7 @@ interface BranchSummaryDetails {
|
|||
|
||||
Same as compaction, extensions can store custom data in `details`.
|
||||
|
||||
See [`collectEntriesForBranchSummary()`](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts), [`prepareBranchEntries()`](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts), and [`generateBranchSummary()`](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts) for the implementation.
|
||||
See [`collectEntriesForBranchSummary()`](https://github.com/badlogic/companion-mono/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts), [`prepareBranchEntries()`](https://github.com/badlogic/companion-mono/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts), and [`generateBranchSummary()`](https://github.com/badlogic/companion-mono/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts) for the implementation.
|
||||
|
||||
## Summary Format
|
||||
|
||||
|
|
@ -263,7 +263,7 @@ path/to/changed.ts
|
|||
|
||||
### Message Serialization
|
||||
|
||||
Before summarization, messages are serialized to text via [`serializeConversation()`](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/src/core/compaction/utils.ts):
|
||||
Before summarization, messages are serialized to text via [`serializeConversation()`](https://github.com/badlogic/companion-mono/blob/main/packages/coding-agent/src/core/compaction/utils.ts):
|
||||
|
||||
```
|
||||
[User]: What they said
|
||||
|
|
@ -277,14 +277,14 @@ This prevents the model from treating it as a conversation to continue.
|
|||
|
||||
## Custom Summarization via Extensions
|
||||
|
||||
Extensions can intercept and customize both compaction and branch summarization. See [`extensions/types.ts`](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/src/core/extensions/types.ts) for event type definitions.
|
||||
Extensions can intercept and customize both compaction and branch summarization. See [`extensions/types.ts`](https://github.com/badlogic/companion-mono/blob/main/packages/coding-agent/src/core/extensions/types.ts) for event type definitions.
|
||||
|
||||
### session_before_compact
|
||||
|
||||
Fired before auto-compaction or `/compact`. Can cancel or provide custom summary. See `SessionBeforeCompactEvent` and `CompactionPreparation` in the types file.
|
||||
|
||||
```typescript
|
||||
pi.on("session_before_compact", async (event, ctx) => {
|
||||
companion.on("session_before_compact", async (event, ctx) => {
|
||||
const { preparation, branchEntries, customInstructions, signal } = event;
|
||||
|
||||
// preparation.messagesToSummarize - messages to summarize
|
||||
|
|
@ -323,9 +323,9 @@ To generate a summary with your own model, convert messages to text using `seria
|
|||
import {
|
||||
convertToLlm,
|
||||
serializeConversation,
|
||||
} from "@mariozechner/pi-coding-agent";
|
||||
} from "@mariozechner/companion-coding-agent";
|
||||
|
||||
pi.on("session_before_compact", async (event, ctx) => {
|
||||
companion.on("session_before_compact", async (event, ctx) => {
|
||||
const { preparation } = event;
|
||||
|
||||
// Convert AgentMessage[] to Message[], then serialize to text
|
||||
|
|
@ -359,7 +359,7 @@ See [custom-compaction.ts](../examples/extensions/custom-compaction.ts) for a co
|
|||
Fired before `/tree` navigation. Always fires regardless of whether user chose to summarize. Can cancel navigation or provide custom summary.
|
||||
|
||||
```typescript
|
||||
pi.on("session_before_tree", async (event, ctx) => {
|
||||
companion.on("session_before_tree", async (event, ctx) => {
|
||||
const { preparation, signal } = event;
|
||||
|
||||
// preparation.targetId - where we're navigating to
|
||||
|
|
@ -389,7 +389,7 @@ See `SessionBeforeTreeEvent` and `TreePreparation` in the types file.
|
|||
|
||||
## Settings
|
||||
|
||||
Configure compaction in `~/.pi/agent/settings.json` or `<project-dir>/.pi/settings.json`:
|
||||
Configure compaction in `~/.companion/agent/settings.json` or `<project-dir>/.companion/settings.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Custom Providers
|
||||
|
||||
Extensions can register custom model providers via `pi.registerProvider()`. This enables:
|
||||
Extensions can register custom model providers via `companion.registerProvider()`. This enables:
|
||||
|
||||
- **Proxies** - Route requests through corporate proxies or API gateways
|
||||
- **Custom endpoints** - Use self-hosted or private model deployments
|
||||
|
|
@ -22,16 +22,16 @@ Extensions can register custom model providers via `pi.registerProvider()`. This
|
|||
## Quick Reference
|
||||
|
||||
```typescript
|
||||
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
||||
import type { ExtensionAPI } from "@mariozechner/companion-coding-agent";
|
||||
|
||||
export default function (pi: ExtensionAPI) {
|
||||
export default function (companion: ExtensionAPI) {
|
||||
// Override baseUrl for existing provider
|
||||
pi.registerProvider("anthropic", {
|
||||
companion.registerProvider("anthropic", {
|
||||
baseUrl: "https://proxy.example.com",
|
||||
});
|
||||
|
||||
// Register new provider with models
|
||||
pi.registerProvider("my-provider", {
|
||||
companion.registerProvider("my-provider", {
|
||||
baseUrl: "https://api.example.com",
|
||||
apiKey: "MY_API_KEY",
|
||||
api: "openai-completions",
|
||||
|
|
@ -56,19 +56,19 @@ The simplest use case: redirect an existing provider through a proxy.
|
|||
|
||||
```typescript
|
||||
// All Anthropic requests now go through your proxy
|
||||
pi.registerProvider("anthropic", {
|
||||
companion.registerProvider("anthropic", {
|
||||
baseUrl: "https://proxy.example.com",
|
||||
});
|
||||
|
||||
// Add custom headers to OpenAI requests
|
||||
pi.registerProvider("openai", {
|
||||
companion.registerProvider("openai", {
|
||||
headers: {
|
||||
"X-Custom-Header": "value",
|
||||
},
|
||||
});
|
||||
|
||||
// Both baseUrl and headers
|
||||
pi.registerProvider("google", {
|
||||
companion.registerProvider("google", {
|
||||
baseUrl: "https://ai-gateway.corp.com/google",
|
||||
headers: {
|
||||
"X-Corp-Auth": "CORP_AUTH_TOKEN", // env var or literal
|
||||
|
|
@ -83,7 +83,7 @@ When only `baseUrl` and/or `headers` are provided (no `models`), all existing mo
|
|||
To add a completely new provider, specify `models` along with the required configuration.
|
||||
|
||||
```typescript
|
||||
pi.registerProvider("my-llm", {
|
||||
companion.registerProvider("my-llm", {
|
||||
baseUrl: "https://api.my-llm.com/v1",
|
||||
apiKey: "MY_LLM_API_KEY", // env var name or literal value
|
||||
api: "openai-completions", // which streaming API to use
|
||||
|
|
@ -110,11 +110,11 @@ When `models` is provided, it **replaces** all existing models for that provider
|
|||
|
||||
## Unregister Provider
|
||||
|
||||
Use `pi.unregisterProvider(name)` to remove a provider that was previously registered via `pi.registerProvider(name, ...)`:
|
||||
Use `companion.unregisterProvider(name)` to remove a provider that was previously registered via `companion.registerProvider(name, ...)`:
|
||||
|
||||
```typescript
|
||||
// Register
|
||||
pi.registerProvider("my-llm", {
|
||||
companion.registerProvider("my-llm", {
|
||||
baseUrl: "https://api.my-llm.com/v1",
|
||||
apiKey: "MY_LLM_API_KEY",
|
||||
api: "openai-completions",
|
||||
|
|
@ -132,7 +132,7 @@ pi.registerProvider("my-llm", {
|
|||
});
|
||||
|
||||
// Later, remove it
|
||||
pi.unregisterProvider("my-llm");
|
||||
companion.unregisterProvider("my-llm");
|
||||
```
|
||||
|
||||
Unregistering removes that provider's dynamic models, API key fallback, OAuth provider registration, and custom stream handler registrations. Any built-in models or provider behavior that were overridden are restored.
|
||||
|
|
@ -167,7 +167,7 @@ models: [
|
|||
supportsDeveloperRole: false, // use "system" instead of "developer"
|
||||
supportsReasoningEffort: true,
|
||||
reasoningEffortMap: {
|
||||
// map pi-ai levels to provider values
|
||||
// map companion-ai levels to provider values
|
||||
minimal: "default",
|
||||
low: "default",
|
||||
medium: "default",
|
||||
|
|
@ -191,7 +191,7 @@ models: [
|
|||
If your provider expects `Authorization: Bearer <key>` but doesn't use a standard API, set `authHeader: true`:
|
||||
|
||||
```typescript
|
||||
pi.registerProvider("custom-api", {
|
||||
companion.registerProvider("custom-api", {
|
||||
baseUrl: "https://api.example.com",
|
||||
apiKey: "MY_API_KEY",
|
||||
authHeader: true, // adds Authorization: Bearer header
|
||||
|
|
@ -205,9 +205,9 @@ pi.registerProvider("custom-api", {
|
|||
Add OAuth/SSO authentication that integrates with `/login`:
|
||||
|
||||
```typescript
|
||||
import type { OAuthCredentials, OAuthLoginCallbacks } from "@mariozechner/pi-ai";
|
||||
import type { OAuthCredentials, OAuthLoginCallbacks } from "@mariozechner/companion-ai";
|
||||
|
||||
pi.registerProvider("corporate-ai", {
|
||||
companion.registerProvider("corporate-ai", {
|
||||
baseUrl: "https://ai.corp.com/v1",
|
||||
api: "openai-responses",
|
||||
models: [...],
|
||||
|
|
@ -283,7 +283,7 @@ interface OAuthLoginCallbacks {
|
|||
|
||||
### OAuthCredentials
|
||||
|
||||
Credentials are persisted in `~/.pi/agent/auth.json`:
|
||||
Credentials are persisted in `~/.companion/agent/auth.json`:
|
||||
|
||||
```typescript
|
||||
interface OAuthCredentials {
|
||||
|
|
@ -299,12 +299,12 @@ For providers with non-standard APIs, implement `streamSimple`. Study the existi
|
|||
|
||||
**Reference implementations:**
|
||||
|
||||
- [anthropic.ts](https://github.com/badlogic/pi-mono/blob/main/packages/ai/src/providers/anthropic.ts) - Anthropic Messages API
|
||||
- [mistral.ts](https://github.com/badlogic/pi-mono/blob/main/packages/ai/src/providers/mistral.ts) - Mistral Conversations API
|
||||
- [openai-completions.ts](https://github.com/badlogic/pi-mono/blob/main/packages/ai/src/providers/openai-completions.ts) - OpenAI Chat Completions
|
||||
- [openai-responses.ts](https://github.com/badlogic/pi-mono/blob/main/packages/ai/src/providers/openai-responses.ts) - OpenAI Responses API
|
||||
- [google.ts](https://github.com/badlogic/pi-mono/blob/main/packages/ai/src/providers/google.ts) - Google Generative AI
|
||||
- [amazon-bedrock.ts](https://github.com/badlogic/pi-mono/blob/main/packages/ai/src/providers/amazon-bedrock.ts) - AWS Bedrock
|
||||
- [anthropic.ts](https://github.com/badlogic/companion-mono/blob/main/packages/ai/src/providers/anthropic.ts) - Anthropic Messages API
|
||||
- [mistral.ts](https://github.com/badlogic/companion-mono/blob/main/packages/ai/src/providers/mistral.ts) - Mistral Conversations API
|
||||
- [openai-completions.ts](https://github.com/badlogic/companion-mono/blob/main/packages/ai/src/providers/openai-completions.ts) - OpenAI Chat Completions
|
||||
- [openai-responses.ts](https://github.com/badlogic/companion-mono/blob/main/packages/ai/src/providers/openai-responses.ts) - OpenAI Responses API
|
||||
- [google.ts](https://github.com/badlogic/companion-mono/blob/main/packages/ai/src/providers/google.ts) - Google Generative AI
|
||||
- [amazon-bedrock.ts](https://github.com/badlogic/companion-mono/blob/main/packages/ai/src/providers/amazon-bedrock.ts) - AWS Bedrock
|
||||
|
||||
### Stream Pattern
|
||||
|
||||
|
|
@ -319,7 +319,7 @@ import {
|
|||
type SimpleStreamOptions,
|
||||
calculateCost,
|
||||
createAssistantMessageEventStream,
|
||||
} from "@mariozechner/pi-ai";
|
||||
} from "@mariozechner/companion-ai";
|
||||
|
||||
function streamMyProvider(
|
||||
model: Model<any>,
|
||||
|
|
@ -487,7 +487,7 @@ calculateCost(model, output.usage);
|
|||
Register your stream function:
|
||||
|
||||
```typescript
|
||||
pi.registerProvider("my-provider", {
|
||||
companion.registerProvider("my-provider", {
|
||||
baseUrl: "https://api.example.com",
|
||||
apiKey: "MY_API_KEY",
|
||||
api: "my-custom-api",
|
||||
|
|
@ -498,7 +498,7 @@ pi.registerProvider("my-provider", {
|
|||
|
||||
## Testing Your Implementation
|
||||
|
||||
Test your provider against the same test suites used by built-in providers. Copy and adapt these test files from [packages/ai/test/](https://github.com/badlogic/pi-mono/tree/main/packages/ai/test):
|
||||
Test your provider against the same test suites used by built-in providers. Copy and adapt these test files from [packages/ai/test/](https://github.com/badlogic/companion-mono/tree/main/packages/ai/test):
|
||||
|
||||
| Test | Purpose |
|
||||
| ---------------------------------- | --------------------------------- |
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ See [AGENTS.md](../../../AGENTS.md) for additional guidelines.
|
|||
## Setup
|
||||
|
||||
```bash
|
||||
git clone https://github.com/badlogic/pi-mono
|
||||
cd pi-mono
|
||||
git clone https://github.com/badlogic/companion-mono
|
||||
cd companion-mono
|
||||
npm install
|
||||
npm run build
|
||||
```
|
||||
|
|
@ -14,7 +14,7 @@ npm run build
|
|||
Run from source:
|
||||
|
||||
```bash
|
||||
./pi-test.sh
|
||||
./companion-test.sh
|
||||
```
|
||||
|
||||
## Forking / Rebranding
|
||||
|
|
@ -23,9 +23,9 @@ Configure via `package.json`:
|
|||
|
||||
```json
|
||||
{
|
||||
"piConfig": {
|
||||
"name": "pi",
|
||||
"configDir": ".pi"
|
||||
"companionConfig": {
|
||||
"name": "companion",
|
||||
"configDir": ".companion"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
@ -46,7 +46,7 @@ Never use `__dirname` directly for package assets.
|
|||
|
||||
## Debug Command
|
||||
|
||||
`/debug` (hidden) writes to `~/.pi/agent/pi-debug.log`:
|
||||
`/debug` (hidden) writes to `~/.companion/agent/companion-debug.log`:
|
||||
|
||||
- Rendered TUI lines with ANSI codes
|
||||
- Last messages sent to the LLM
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,14 +1,14 @@
|
|||
# JSON Event Stream Mode
|
||||
|
||||
```bash
|
||||
pi --mode json "Your prompt"
|
||||
companion --mode json "Your prompt"
|
||||
```
|
||||
|
||||
Outputs all session events as JSON lines to stdout. Useful for integrating pi into other tools or custom UIs.
|
||||
Outputs all session events as JSON lines to stdout. Useful for integrating companion into other tools or custom UIs.
|
||||
|
||||
## Event Types
|
||||
|
||||
Events are defined in [`AgentSessionEvent`](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/src/core/agent-session.ts#L102):
|
||||
Events are defined in [`AgentSessionEvent`](https://github.com/badlogic/companion-mono/blob/main/packages/coding-agent/src/core/agent-session.ts#L102):
|
||||
|
||||
```typescript
|
||||
type AgentSessionEvent =
|
||||
|
|
@ -36,7 +36,7 @@ type AgentSessionEvent =
|
|||
};
|
||||
```
|
||||
|
||||
Base events from [`AgentEvent`](https://github.com/badlogic/pi-mono/blob/main/packages/agent/src/types.ts#L179):
|
||||
Base events from [`AgentEvent`](https://github.com/badlogic/companion-mono/blob/main/packages/agent/src/types.ts#L179):
|
||||
|
||||
```typescript
|
||||
type AgentEvent =
|
||||
|
|
@ -83,13 +83,13 @@ type AgentEvent =
|
|||
|
||||
## Message Types
|
||||
|
||||
Base messages from [`packages/ai/src/types.ts`](https://github.com/badlogic/pi-mono/blob/main/packages/ai/src/types.ts#L134):
|
||||
Base messages from [`packages/ai/src/types.ts`](https://github.com/badlogic/companion-mono/blob/main/packages/ai/src/types.ts#L134):
|
||||
|
||||
- `UserMessage` (line 134)
|
||||
- `AssistantMessage` (line 140)
|
||||
- `ToolResultMessage` (line 152)
|
||||
|
||||
Extended messages from [`packages/coding-agent/src/core/messages.ts`](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/src/core/messages.ts#L29):
|
||||
Extended messages from [`packages/coding-agent/src/core/messages.ts`](https://github.com/badlogic/companion-mono/blob/main/packages/coding-agent/src/core/messages.ts#L29):
|
||||
|
||||
- `BashExecutionMessage` (line 29)
|
||||
- `CustomMessage` (line 46)
|
||||
|
|
@ -125,5 +125,5 @@ Followed by events as they occur:
|
|||
## Example
|
||||
|
||||
```bash
|
||||
pi --mode json "List files" 2>/dev/null | jq -c 'select(.type == "message_end")'
|
||||
companion --mode json "List files" 2>/dev/null | jq -c 'select(.type == "message_end")'
|
||||
```
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Keybindings
|
||||
|
||||
All keyboard shortcuts can be customized via `~/.pi/agent/keybindings.json`. Each action can be bound to one or more keys.
|
||||
All keyboard shortcuts can be customized via `~/.companion/agent/keybindings.json`. Each action can be bound to one or more keys.
|
||||
|
||||
## Key Format
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ Modifier combinations: `ctrl+shift+x`, `alt+ctrl+x`, `ctrl+shift+alt+x`, etc.
|
|||
|
||||
## Custom Configuration
|
||||
|
||||
Create `~/.pi/agent/keybindings.json`:
|
||||
Create `~/.companion/agent/keybindings.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Custom Models
|
||||
|
||||
Add custom providers and models (Ollama, vLLM, LM Studio, proxies) via `~/.pi/agent/models.json`.
|
||||
Add custom providers and models (Ollama, vLLM, LM Studio, proxies) via `~/.companion/agent/models.json`.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
> pi can help you create pi packages. Ask it to bundle your extensions, skills, prompt templates, or themes.
|
||||
> companion can help you create companion packages. Ask it to bundle your extensions, skills, prompt templates, or themes.
|
||||
|
||||
# Pi Packages
|
||||
# Companion Packages
|
||||
|
||||
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.
|
||||
Companion 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 `companion` key, or use conventional directories.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Install and Manage](#install-and-manage)
|
||||
- [Package Sources](#package-sources)
|
||||
- [Creating a Pi Package](#creating-a-pi-package)
|
||||
- [Creating a Companion Package](#creating-a-companion-package)
|
||||
- [Package Structure](#package-structure)
|
||||
- [Dependencies](#dependencies)
|
||||
- [Package Filtering](#package-filtering)
|
||||
|
|
@ -17,32 +17,32 @@ Pi packages bundle extensions, skills, prompt templates, and themes so you can s
|
|||
|
||||
## Install and Manage
|
||||
|
||||
> **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.
|
||||
> **Security:** Companion 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.
|
||||
|
||||
```bash
|
||||
pi install npm:@foo/bar@1.0.0
|
||||
pi install git:github.com/user/repo@v1
|
||||
pi install https://github.com/user/repo # raw URLs work too
|
||||
pi install /absolute/path/to/package
|
||||
pi install ./relative/path/to/package
|
||||
companion install npm:@foo/bar@1.0.0
|
||||
companion install git:github.com/user/repo@v1
|
||||
companion install https://github.com/user/repo # raw URLs work too
|
||||
companion install /absolute/path/to/package
|
||||
companion install ./relative/path/to/package
|
||||
|
||||
pi remove npm:@foo/bar
|
||||
pi list # show installed packages from settings
|
||||
pi update # update all non-pinned packages
|
||||
companion remove npm:@foo/bar
|
||||
companion list # show installed packages from settings
|
||||
companion update # update all non-pinned packages
|
||||
```
|
||||
|
||||
By default, `install` and `remove` write to global 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.
|
||||
By default, `install` and `remove` write to global settings (`~/.companion/agent/settings.json`). Use `-l` to write to project settings (`.companion/settings.json`) instead. Project settings can be shared with your team, and companion installs any missing packages automatically on startup.
|
||||
|
||||
To try a package without installing it, use `--extension` or `-e`. This installs to a temporary directory for the current run only:
|
||||
|
||||
```bash
|
||||
pi -e npm:@foo/bar
|
||||
pi -e git:github.com/user/repo
|
||||
companion -e npm:@foo/bar
|
||||
companion -e git:github.com/user/repo
|
||||
```
|
||||
|
||||
## Package Sources
|
||||
|
||||
Pi accepts three source types in settings and `pi install`.
|
||||
Companion accepts three source types in settings and `companion install`.
|
||||
|
||||
### npm
|
||||
|
||||
|
|
@ -51,9 +51,9 @@ npm:@scope/pkg@1.2.3
|
|||
npm:pkg
|
||||
```
|
||||
|
||||
- Versioned specs are pinned and skipped by `pi update`.
|
||||
- Versioned specs are pinned and skipped by `companion update`.
|
||||
- Global installs use `npm install -g`.
|
||||
- Project installs go under `.pi/npm/`.
|
||||
- Project installs go under `.companion/npm/`.
|
||||
|
||||
### git
|
||||
|
||||
|
|
@ -69,21 +69,21 @@ ssh://git@github.com/user/repo@v1
|
|||
- HTTPS and SSH URLs are both supported.
|
||||
- SSH URLs use your configured SSH keys automatically (respects `~/.ssh/config`).
|
||||
- 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.
|
||||
- Refs pin the package and skip `pi update`.
|
||||
- Cloned to `~/.pi/agent/git/<host>/<path>` (global) or `.pi/git/<host>/<path>` (project).
|
||||
- Refs pin the package and skip `companion update`.
|
||||
- Cloned to `~/.companion/agent/git/<host>/<path>` (global) or `.companion/git/<host>/<path>` (project).
|
||||
- Runs `npm install` after clone or pull if `package.json` exists.
|
||||
|
||||
**SSH examples:**
|
||||
|
||||
```bash
|
||||
# git@host:path shorthand (requires git: prefix)
|
||||
pi install git:git@github.com:user/repo
|
||||
companion install git:git@github.com:user/repo
|
||||
|
||||
# ssh:// protocol format
|
||||
pi install ssh://git@github.com/user/repo
|
||||
companion install ssh://git@github.com/user/repo
|
||||
|
||||
# With version ref
|
||||
pi install git:git@github.com:user/repo@v1.0.0
|
||||
companion install git:git@github.com:user/repo@v1.0.0
|
||||
```
|
||||
|
||||
### Local Paths
|
||||
|
|
@ -93,17 +93,17 @@ pi install git:git@github.com:user/repo@v1.0.0
|
|||
./relative/path/to/package
|
||||
```
|
||||
|
||||
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.
|
||||
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, companion loads resources using package rules.
|
||||
|
||||
## Creating a Pi Package
|
||||
## Creating a Companion Package
|
||||
|
||||
Add a `pi` manifest to `package.json` or use conventional directories. Include the `pi-package` keyword for discoverability.
|
||||
Add a `companion` manifest to `package.json` or use conventional directories. Include the `companion-package` keyword for discoverability.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "my-package",
|
||||
"keywords": ["pi-package"],
|
||||
"pi": {
|
||||
"keywords": ["companion-package"],
|
||||
"companion": {
|
||||
"extensions": ["./extensions"],
|
||||
"skills": ["./skills"],
|
||||
"prompts": ["./prompts"],
|
||||
|
|
@ -116,13 +116,13 @@ Paths are relative to the package root. Arrays support glob patterns and `!exclu
|
|||
|
||||
### Gallery Metadata
|
||||
|
||||
The [package gallery](https://shittycodingagent.ai/packages) displays packages tagged with `pi-package`. Add `video` or `image` fields to show a preview:
|
||||
The [package gallery](https://shittycodingagent.ai/packages) displays packages tagged with `companion-package`. Add `video` or `image` fields to show a preview:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "my-package",
|
||||
"keywords": ["pi-package"],
|
||||
"pi": {
|
||||
"keywords": ["companion-package"],
|
||||
"companion": {
|
||||
"extensions": ["./extensions"],
|
||||
"video": "https://example.com/demo.mp4",
|
||||
"image": "https://example.com/screenshot.png"
|
||||
|
|
@ -139,7 +139,7 @@ If both are set, video takes precedence.
|
|||
|
||||
### Convention Directories
|
||||
|
||||
If no `pi` manifest is present, pi auto-discovers resources from these directories:
|
||||
If no `companion` manifest is present, companion auto-discovers resources from these directories:
|
||||
|
||||
- `extensions/` loads `.ts` and `.js` files
|
||||
- `skills/` recursively finds `SKILL.md` folders and loads top-level `.md` files as skills
|
||||
|
|
@ -148,11 +148,11 @@ If no `pi` manifest is present, pi auto-discovers resources from these directori
|
|||
|
||||
## Dependencies
|
||||
|
||||
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.
|
||||
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 companion installs a package from npm or git, it runs `npm install`, so those dependencies are installed automatically.
|
||||
|
||||
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: `@mariozechner/pi-ai`, `@mariozechner/pi-agent-core`, `@mariozechner/pi-coding-agent`, `@mariozechner/pi-tui`, `@sinclair/typebox`.
|
||||
Companion 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: `@mariozechner/companion-ai`, `@mariozechner/companion-agent-core`, `@mariozechner/companion-coding-agent`, `@mariozechner/companion-tui`, `@sinclair/typebox`.
|
||||
|
||||
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.
|
||||
Other companion packages must be bundled in your tarball. Add them to `dependencies` and `bundledDependencies`, then reference their resources through `node_modules/` paths. Companion loads packages with separate module roots, so separate installs do not collide or share modules.
|
||||
|
||||
Example:
|
||||
|
||||
|
|
@ -162,7 +162,7 @@ Example:
|
|||
"shitty-extensions": "^1.0.1"
|
||||
},
|
||||
"bundledDependencies": ["shitty-extensions"],
|
||||
"pi": {
|
||||
"companion": {
|
||||
"extensions": ["extensions", "node_modules/shitty-extensions/extensions"],
|
||||
"skills": ["skills", "node_modules/shitty-extensions/skills"]
|
||||
}
|
||||
|
|
@ -199,7 +199,7 @@ Filter what a package loads using the object form in settings:
|
|||
|
||||
## Enable and Disable Resources
|
||||
|
||||
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.
|
||||
Use `companion config` to enable or disable extensions, skills, prompt templates, and themes from installed packages and local directories. Works for both global (`~/.companion/agent`) and project (`.companion/`) scopes.
|
||||
|
||||
## Scope and Deduplication
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
> pi can create prompt templates. Ask it to build one for your workflow.
|
||||
> companion can create prompt templates. Ask it to build one for your workflow.
|
||||
|
||||
# Prompt Templates
|
||||
|
||||
|
|
@ -6,11 +6,11 @@ Prompt templates are Markdown snippets that expand into full prompts. Type `/nam
|
|||
|
||||
## Locations
|
||||
|
||||
Pi loads prompt templates from:
|
||||
Companion loads prompt templates from:
|
||||
|
||||
- Global: `~/.pi/agent/prompts/*.md`
|
||||
- Project: `.pi/prompts/*.md`
|
||||
- Packages: `prompts/` directories or `pi.prompts` entries in `package.json`
|
||||
- Global: `~/.companion/agent/prompts/*.md`
|
||||
- Project: `.companion/prompts/*.md`
|
||||
- Packages: `prompts/` directories or `companion.prompts` entries in `package.json`
|
||||
- Settings: `prompts` array with files or directories
|
||||
- CLI: `--prompt-template <path>` (repeatable)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Providers
|
||||
|
||||
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.
|
||||
Companion supports subscription-based providers via OAuth and API key providers via environment variables or auth file. For each provider, companion knows all available models. The list is updated with every companion release.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ Use `/login` in interactive mode, then select a provider:
|
|||
- Google Gemini CLI
|
||||
- Google Antigravity
|
||||
|
||||
Use `/logout` to clear credentials. Tokens are stored in `~/.pi/agent/auth.json` and auto-refresh when expired.
|
||||
Use `/logout` to clear credentials. Tokens are stored in `~/.companion/agent/auth.json` and auto-refresh when expired.
|
||||
|
||||
### GitHub Copilot
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ Set via environment variable:
|
|||
|
||||
```bash
|
||||
export ANTHROPIC_API_KEY=sk-ant-...
|
||||
pi
|
||||
companion
|
||||
```
|
||||
|
||||
| Provider | Environment Variable | `auth.json` key |
|
||||
|
|
@ -71,11 +71,11 @@ pi
|
|||
| MiniMax | `MINIMAX_API_KEY` | `minimax` |
|
||||
| MiniMax (China) | `MINIMAX_CN_API_KEY` | `minimax-cn` |
|
||||
|
||||
Reference for environment variables and `auth.json` keys: [`const envMap`](https://github.com/badlogic/pi-mono/blob/main/packages/ai/src/env-api-keys.ts) in [`packages/ai/src/env-api-keys.ts`](https://github.com/badlogic/pi-mono/blob/main/packages/ai/src/env-api-keys.ts).
|
||||
Reference for environment variables and `auth.json` keys: [`const envMap`](https://github.com/badlogic/companion-mono/blob/main/packages/ai/src/env-api-keys.ts) in [`packages/ai/src/env-api-keys.ts`](https://github.com/badlogic/companion-mono/blob/main/packages/ai/src/env-api-keys.ts).
|
||||
|
||||
#### Auth File
|
||||
|
||||
Store credentials in `~/.pi/agent/auth.json`:
|
||||
Store credentials in `~/.companion/agent/auth.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
|
|
@ -144,7 +144,7 @@ export AWS_REGION=us-west-2
|
|||
Also supports ECS task roles (`AWS_CONTAINER_CREDENTIALS_*`) and IRSA (`AWS_WEB_IDENTITY_TOKEN_FILE`).
|
||||
|
||||
```bash
|
||||
pi --provider amazon-bedrock --model us.anthropic.claude-sonnet-4-20250514-v1:0
|
||||
companion --provider amazon-bedrock --model us.anthropic.claude-sonnet-4-20250514-v1:0
|
||||
```
|
||||
|
||||
If you are connecting to a Bedrock API proxy, the following environment variables can be used:
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
RPC mode enables headless operation of the coding agent via a JSON protocol over stdin/stdout. This is useful for embedding the agent in other applications, IDEs, or custom UIs.
|
||||
|
||||
**Note for Node.js/TypeScript users**: If you're building a Node.js application, consider using `AgentSession` directly from `@mariozechner/pi-coding-agent` instead of spawning a subprocess. See [`src/core/agent-session.ts`](../src/core/agent-session.ts) for the API. For a subprocess-based TypeScript client, see [`src/modes/rpc/rpc-client.ts`](../src/modes/rpc/rpc-client.ts).
|
||||
**Note for Node.js/TypeScript users**: If you're building a Node.js application, consider using `AgentSession` directly from `@mariozechner/companion-coding-agent` instead of spawning a subprocess. See [`src/core/agent-session.ts`](../src/core/agent-session.ts) for the API. For a subprocess-based TypeScript client, see [`src/modes/rpc/rpc-client.ts`](../src/modes/rpc/rpc-client.ts).
|
||||
|
||||
## Starting RPC Mode
|
||||
|
||||
```bash
|
||||
pi --mode rpc [options]
|
||||
companion --mode rpc [options]
|
||||
```
|
||||
|
||||
Common options:
|
||||
|
|
@ -60,7 +60,7 @@ With images:
|
|||
|
||||
If the agent is streaming and no `streamingBehavior` is specified, the command returns an error.
|
||||
|
||||
**Extension commands**: If the message is an extension command (e.g., `/mycommand`), it executes immediately even during streaming. Extension commands manage their own LLM interaction via `pi.sendMessage()`.
|
||||
**Extension commands**: If the message is an extension command (e.g., `/mycommand`), it executes immediately even during streaming. Extension commands manage their own LLM interaction via `companion.sendMessage()`.
|
||||
|
||||
**Input expansion**: Skill commands (`/skill:name`) and prompt templates (`/template`) are expanded before sending/queueing.
|
||||
|
||||
|
|
@ -503,7 +503,7 @@ If output was truncated, includes `fullOutputPath`:
|
|||
"exitCode": 0,
|
||||
"cancelled": false,
|
||||
"truncated": true,
|
||||
"fullOutputPath": "/tmp/pi-bash-abc123.log"
|
||||
"fullOutputPath": "/tmp/companion-bash-abc123.log"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
@ -752,21 +752,21 @@ Response:
|
|||
"name": "session-name",
|
||||
"description": "Set or clear session name",
|
||||
"source": "extension",
|
||||
"path": "/home/user/.pi/agent/extensions/session.ts"
|
||||
"path": "/home/user/.companion/agent/extensions/session.ts"
|
||||
},
|
||||
{
|
||||
"name": "fix-tests",
|
||||
"description": "Fix failing tests",
|
||||
"source": "prompt",
|
||||
"location": "project",
|
||||
"path": "/home/user/myproject/.pi/agent/prompts/fix-tests.md"
|
||||
"path": "/home/user/myproject/.companion/agent/prompts/fix-tests.md"
|
||||
},
|
||||
{
|
||||
"name": "skill:brave-search",
|
||||
"description": "Web search via Brave API",
|
||||
"source": "skill",
|
||||
"location": "user",
|
||||
"path": "/home/user/.pi/agent/skills/brave-search/SKILL.md"
|
||||
"path": "/home/user/.companion/agent/skills/brave-search/SKILL.md"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -778,12 +778,12 @@ Each command has:
|
|||
- `name`: Command name (invoke with `/name`)
|
||||
- `description`: Human-readable description (optional for extension commands)
|
||||
- `source`: What kind of command:
|
||||
- `"extension"`: Registered via `pi.registerCommand()` in an extension
|
||||
- `"extension"`: Registered via `companion.registerCommand()` in an extension
|
||||
- `"prompt"`: Loaded from a prompt template `.md` file
|
||||
- `"skill"`: Loaded from a skill directory (name is prefixed with `skill:`)
|
||||
- `location`: Where it was loaded from (optional, not present for extensions):
|
||||
- `"user"`: User-level (`~/.pi/agent/`)
|
||||
- `"project"`: Project-level (`./.pi/agent/`)
|
||||
- `"user"`: User-level (`~/.companion/agent/`)
|
||||
- `"project"`: Project-level (`./.companion/agent/`)
|
||||
- `"path"`: Explicit path via CLI or settings
|
||||
- `path`: Absolute file path to the command source (optional)
|
||||
|
||||
|
|
@ -1173,7 +1173,7 @@ Set the terminal window/tab title. Fire-and-forget.
|
|||
"type": "extension_ui_request",
|
||||
"id": "uuid-8",
|
||||
"method": "setTitle",
|
||||
"title": "pi - my project"
|
||||
"title": "companion - my project"
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -1372,7 +1372,7 @@ import subprocess
|
|||
import json
|
||||
|
||||
proc = subprocess.Popen(
|
||||
["pi", "--mode", "rpc", "--no-session"],
|
||||
["companion", "--mode", "rpc", "--no-session"],
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
text=True
|
||||
|
|
@ -1411,7 +1411,7 @@ For a complete example of handling the extension UI protocol, see [`examples/rpc
|
|||
const { spawn } = require("child_process");
|
||||
const readline = require("readline");
|
||||
|
||||
const agent = spawn("pi", ["--mode", "rpc", "--no-session"]);
|
||||
const agent = spawn("companion", ["--mode", "rpc", "--no-session"]);
|
||||
|
||||
readline.createInterface({ input: agent.stdout }).on("line", (line) => {
|
||||
const event = JSON.parse(line);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
> pi can help you use the SDK. Ask it to build an integration for your use case.
|
||||
> companion can help you use the SDK. Ask it to build an integration for your use case.
|
||||
|
||||
# SDK
|
||||
|
||||
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.
|
||||
The SDK provides programmatic access to companion's agent capabilities. Use it to embed companion in other applications, build custom interfaces, or integrate with automated workflows.
|
||||
|
||||
**Example use cases:**
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ import {
|
|||
createAgentSession,
|
||||
ModelRegistry,
|
||||
SessionManager,
|
||||
} from "@mariozechner/pi-coding-agent";
|
||||
} from "@mariozechner/companion-coding-agent";
|
||||
|
||||
// Set up credential storage and model registry
|
||||
const authStorage = AuthStorage.create();
|
||||
|
|
@ -49,7 +49,7 @@ await session.prompt("What files are in the current directory?");
|
|||
## Installation
|
||||
|
||||
```bash
|
||||
npm install @mariozechner/pi-coding-agent
|
||||
npm install @mariozechner/companion-coding-agent
|
||||
```
|
||||
|
||||
The SDK is included in the main package. No separate installation needed.
|
||||
|
|
@ -63,7 +63,7 @@ The main factory function. Creates an `AgentSession` with configurable options.
|
|||
`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.
|
||||
|
||||
```typescript
|
||||
import { createAgentSession } from "@mariozechner/pi-coding-agent";
|
||||
import { createAgentSession } from "@mariozechner/companion-coding-agent";
|
||||
|
||||
// Minimal: defaults with DefaultResourceLoader
|
||||
const { session } = await createAgentSession();
|
||||
|
|
@ -170,7 +170,7 @@ await session.prompt("After you're done, also check X", {
|
|||
|
||||
**Behavior:**
|
||||
|
||||
- **Extension commands** (e.g., `/mycommand`): Execute immediately, even during streaming. They manage their own LLM interaction via `pi.sendMessage()`.
|
||||
- **Extension commands** (e.g., `/mycommand`): Execute immediately, even during streaming. They manage their own LLM interaction via `companion.sendMessage()`.
|
||||
- **File-based prompt templates** (from `.md` files): Expanded to their content before sending/queueing.
|
||||
- **During streaming without `streamingBehavior`**: Throws an error. Use `steer()` or `followUp()` directly, or specify the option.
|
||||
|
||||
|
|
@ -188,7 +188,7 @@ Both `steer()` and `followUp()` expand file-based prompt templates but error on
|
|||
|
||||
### Agent and AgentState
|
||||
|
||||
The `Agent` class (from `@mariozechner/pi-agent-core`) handles the core LLM interaction. Access it via `session.agent`.
|
||||
The `Agent` class (from `@mariozechner/companion-agent-core`) handles the core LLM interaction. Access it via `session.agent`.
|
||||
|
||||
```typescript
|
||||
// Access current state
|
||||
|
|
@ -279,17 +279,17 @@ const { session } = await createAgentSession({
|
|||
cwd: process.cwd(), // default
|
||||
|
||||
// Global config directory
|
||||
agentDir: "~/.pi/agent", // default (expands ~)
|
||||
agentDir: "~/.companion/agent", // default (expands ~)
|
||||
});
|
||||
```
|
||||
|
||||
`cwd` is used by `DefaultResourceLoader` for:
|
||||
|
||||
- Project extensions (`.pi/extensions/`)
|
||||
- Project extensions (`.companion/extensions/`)
|
||||
- Project skills:
|
||||
- `.pi/skills/`
|
||||
- `.companion/skills/`
|
||||
- `.agents/skills/` in `cwd` and ancestor directories (up to git repo root, or filesystem root when not in a repo)
|
||||
- Project prompts (`.pi/prompts/`)
|
||||
- Project prompts (`.companion/prompts/`)
|
||||
- Context files (`AGENTS.md` walking up from cwd)
|
||||
- Session directory naming
|
||||
|
||||
|
|
@ -297,7 +297,7 @@ const { session } = await createAgentSession({
|
|||
|
||||
- Global extensions (`extensions/`)
|
||||
- Global skills:
|
||||
- `skills/` under `agentDir` (for example `~/.pi/agent/skills/`)
|
||||
- `skills/` under `agentDir` (for example `~/.companion/agent/skills/`)
|
||||
- `~/.agents/skills/`
|
||||
- Global prompts (`prompts/`)
|
||||
- Global context file (`AGENTS.md`)
|
||||
|
|
@ -311,8 +311,8 @@ When you pass a custom `ResourceLoader`, `cwd` and `agentDir` no longer control
|
|||
### Model
|
||||
|
||||
```typescript
|
||||
import { getModel } from "@mariozechner/pi-ai";
|
||||
import { AuthStorage, ModelRegistry } from "@mariozechner/pi-coding-agent";
|
||||
import { getModel } from "@mariozechner/companion-ai";
|
||||
import { AuthStorage, ModelRegistry } from "@mariozechner/companion-coding-agent";
|
||||
|
||||
const authStorage = AuthStorage.create();
|
||||
const modelRegistry = new ModelRegistry(authStorage);
|
||||
|
|
@ -359,9 +359,9 @@ API key resolution priority (handled by AuthStorage):
|
|||
4. Fallback resolver (for custom provider keys from `models.json`)
|
||||
|
||||
```typescript
|
||||
import { AuthStorage, ModelRegistry } from "@mariozechner/pi-coding-agent";
|
||||
import { AuthStorage, ModelRegistry } from "@mariozechner/companion-coding-agent";
|
||||
|
||||
// Default: uses ~/.pi/agent/auth.json and ~/.pi/agent/models.json
|
||||
// Default: uses ~/.companion/agent/auth.json and ~/.companion/agent/models.json
|
||||
const authStorage = AuthStorage.create();
|
||||
const modelRegistry = new ModelRegistry(authStorage);
|
||||
|
||||
|
|
@ -396,7 +396,7 @@ Use a `ResourceLoader` to override the system prompt:
|
|||
import {
|
||||
createAgentSession,
|
||||
DefaultResourceLoader,
|
||||
} from "@mariozechner/pi-coding-agent";
|
||||
} from "@mariozechner/companion-coding-agent";
|
||||
|
||||
const loader = new DefaultResourceLoader({
|
||||
systemPromptOverride: () => "You are a helpful assistant.",
|
||||
|
|
@ -419,7 +419,7 @@ import {
|
|||
grepTool,
|
||||
findTool,
|
||||
lsTool,
|
||||
} from "@mariozechner/pi-coding-agent";
|
||||
} from "@mariozechner/companion-coding-agent";
|
||||
|
||||
// Use built-in tool set
|
||||
const { session } = await createAgentSession({
|
||||
|
|
@ -447,7 +447,7 @@ import {
|
|||
createGrepTool,
|
||||
createFindTool,
|
||||
createLsTool,
|
||||
} from "@mariozechner/pi-coding-agent";
|
||||
} from "@mariozechner/companion-coding-agent";
|
||||
|
||||
const cwd = "/path/to/project";
|
||||
|
||||
|
|
@ -466,7 +466,7 @@ const { session } = await createAgentSession({
|
|||
|
||||
**When you don't need factories:**
|
||||
|
||||
- If you omit `tools`, pi automatically creates them with the correct `cwd`
|
||||
- If you omit `tools`, companion automatically creates them with the correct `cwd`
|
||||
- If you use `process.cwd()` as your `cwd`, the pre-built instances work fine
|
||||
|
||||
**When you must use factories:**
|
||||
|
|
@ -480,7 +480,7 @@ import { Type } from "@sinclair/typebox";
|
|||
import {
|
||||
createAgentSession,
|
||||
type ToolDefinition,
|
||||
} from "@mariozechner/pi-coding-agent";
|
||||
} from "@mariozechner/companion-coding-agent";
|
||||
|
||||
// Inline custom tool
|
||||
const myTool: ToolDefinition = {
|
||||
|
|
@ -502,23 +502,23 @@ const { session } = await createAgentSession({
|
|||
});
|
||||
```
|
||||
|
||||
Custom tools passed via `customTools` are combined with extension-registered tools. Extensions loaded by the ResourceLoader can also register tools via `pi.registerTool()`.
|
||||
Custom tools passed via `customTools` are combined with extension-registered tools. Extensions loaded by the ResourceLoader can also register tools via `companion.registerTool()`.
|
||||
|
||||
### Extensions
|
||||
|
||||
Extensions are loaded by the `ResourceLoader`. `DefaultResourceLoader` discovers extensions from `~/.pi/agent/extensions/`, `.pi/extensions/`, and settings.json extension sources.
|
||||
Extensions are loaded by the `ResourceLoader`. `DefaultResourceLoader` discovers extensions from `~/.companion/agent/extensions/`, `.companion/extensions/`, and settings.json extension sources.
|
||||
|
||||
```typescript
|
||||
import {
|
||||
createAgentSession,
|
||||
DefaultResourceLoader,
|
||||
} from "@mariozechner/pi-coding-agent";
|
||||
} from "@mariozechner/companion-coding-agent";
|
||||
|
||||
const loader = new DefaultResourceLoader({
|
||||
additionalExtensionPaths: ["/path/to/my-extension.ts"],
|
||||
extensionFactories: [
|
||||
(pi) => {
|
||||
pi.on("agent_start", () => {
|
||||
(companion) => {
|
||||
companion.on("agent_start", () => {
|
||||
console.log("[Inline Extension] Agent starting");
|
||||
});
|
||||
},
|
||||
|
|
@ -531,13 +531,13 @@ const { session } = await createAgentSession({ resourceLoader: loader });
|
|||
|
||||
Extensions can register tools, subscribe to events, add commands, and more. See [extensions.md](extensions.md) for the full API.
|
||||
|
||||
**Event Bus:** Extensions can communicate via `pi.events`. Pass a shared `eventBus` to `DefaultResourceLoader` if you need to emit or listen from outside:
|
||||
**Event Bus:** Extensions can communicate via `companion.events`. Pass a shared `eventBus` to `DefaultResourceLoader` if you need to emit or listen from outside:
|
||||
|
||||
```typescript
|
||||
import {
|
||||
createEventBus,
|
||||
DefaultResourceLoader,
|
||||
} from "@mariozechner/pi-coding-agent";
|
||||
} from "@mariozechner/companion-coding-agent";
|
||||
|
||||
const eventBus = createEventBus();
|
||||
const loader = new DefaultResourceLoader({
|
||||
|
|
@ -555,7 +555,7 @@ import {
|
|||
createAgentSession,
|
||||
DefaultResourceLoader,
|
||||
type Skill,
|
||||
} from "@mariozechner/pi-coding-agent";
|
||||
} from "@mariozechner/companion-coding-agent";
|
||||
|
||||
const customSkill: Skill = {
|
||||
name: "my-skill",
|
||||
|
|
@ -582,7 +582,7 @@ const { session } = await createAgentSession({ resourceLoader: loader });
|
|||
import {
|
||||
createAgentSession,
|
||||
DefaultResourceLoader,
|
||||
} from "@mariozechner/pi-coding-agent";
|
||||
} from "@mariozechner/companion-coding-agent";
|
||||
|
||||
const loader = new DefaultResourceLoader({
|
||||
agentsFilesOverride: (current) => ({
|
||||
|
|
@ -604,7 +604,7 @@ import {
|
|||
createAgentSession,
|
||||
DefaultResourceLoader,
|
||||
type PromptTemplate,
|
||||
} from "@mariozechner/pi-coding-agent";
|
||||
} from "@mariozechner/companion-coding-agent";
|
||||
|
||||
const customCommand: PromptTemplate = {
|
||||
name: "deploy",
|
||||
|
|
@ -632,7 +632,7 @@ Sessions use a tree structure with `id`/`parentId` linking, enabling in-place br
|
|||
import {
|
||||
createAgentSession,
|
||||
SessionManager,
|
||||
} from "@mariozechner/pi-coding-agent";
|
||||
} from "@mariozechner/companion-coding-agent";
|
||||
|
||||
// In-memory (no persistence)
|
||||
const { session } = await createAgentSession({
|
||||
|
|
@ -707,7 +707,7 @@ import {
|
|||
createAgentSession,
|
||||
SettingsManager,
|
||||
SessionManager,
|
||||
} from "@mariozechner/pi-coding-agent";
|
||||
} from "@mariozechner/companion-coding-agent";
|
||||
|
||||
// Default: loads from files (global + project merged)
|
||||
const { session } = await createAgentSession({
|
||||
|
|
@ -743,8 +743,8 @@ const { session } = await createAgentSession({
|
|||
|
||||
Settings load from two locations and merge:
|
||||
|
||||
1. Global: `~/.pi/agent/settings.json`
|
||||
2. Project: `<cwd>/.pi/settings.json`
|
||||
1. Global: `~/.companion/agent/settings.json`
|
||||
2. Project: `<cwd>/.companion/settings.json`
|
||||
|
||||
Project overrides global. Nested objects merge keys. Setters modify global settings by default.
|
||||
|
||||
|
|
@ -763,7 +763,7 @@ Use `DefaultResourceLoader` to discover extensions, skills, prompts, themes, and
|
|||
import {
|
||||
DefaultResourceLoader,
|
||||
getAgentDir,
|
||||
} from "@mariozechner/pi-coding-agent";
|
||||
} from "@mariozechner/companion-coding-agent";
|
||||
|
||||
const loader = new DefaultResourceLoader({
|
||||
cwd,
|
||||
|
|
@ -804,7 +804,7 @@ interface LoadExtensionsResult {
|
|||
## Complete Example
|
||||
|
||||
```typescript
|
||||
import { getModel } from "@mariozechner/pi-ai";
|
||||
import { getModel } from "@mariozechner/companion-ai";
|
||||
import { Type } from "@sinclair/typebox";
|
||||
import {
|
||||
AuthStorage,
|
||||
|
|
@ -816,7 +816,7 @@ import {
|
|||
readTool,
|
||||
bashTool,
|
||||
type ToolDefinition,
|
||||
} from "@mariozechner/pi-coding-agent";
|
||||
} from "@mariozechner/companion-coding-agent";
|
||||
|
||||
// Set up auth storage (custom location)
|
||||
const authStorage = AuthStorage.create("/custom/agent/auth.json");
|
||||
|
|
@ -899,7 +899,7 @@ Full TUI interactive mode with editor, chat history, and all built-in commands:
|
|||
import {
|
||||
createAgentSession,
|
||||
InteractiveMode,
|
||||
} from "@mariozechner/pi-coding-agent";
|
||||
} from "@mariozechner/companion-coding-agent";
|
||||
|
||||
const { session } = await createAgentSession({
|
||||
/* ... */
|
||||
|
|
@ -925,7 +925,7 @@ Single-shot mode: send prompts, output result, exit:
|
|||
import {
|
||||
createAgentSession,
|
||||
runPrintMode,
|
||||
} from "@mariozechner/pi-coding-agent";
|
||||
} from "@mariozechner/companion-coding-agent";
|
||||
|
||||
const { session } = await createAgentSession({
|
||||
/* ... */
|
||||
|
|
@ -944,7 +944,7 @@ await runPrintMode(session, {
|
|||
JSON-RPC mode for subprocess integration:
|
||||
|
||||
```typescript
|
||||
import { createAgentSession, runRpcMode } from "@mariozechner/pi-coding-agent";
|
||||
import { createAgentSession, runRpcMode } from "@mariozechner/companion-coding-agent";
|
||||
|
||||
const { session } = await createAgentSession({
|
||||
/* ... */
|
||||
|
|
@ -960,7 +960,7 @@ See [RPC documentation](rpc.md) for the JSON protocol.
|
|||
For subprocess-based integration without building with the SDK, use the CLI directly:
|
||||
|
||||
```bash
|
||||
pi --mode rpc --no-session
|
||||
companion --mode rpc --no-session
|
||||
```
|
||||
|
||||
See [RPC documentation](rpc.md) for the JSON protocol.
|
||||
|
|
|
|||
|
|
@ -5,16 +5,16 @@ Sessions are stored as JSONL (JSON Lines) files. Each line is a JSON object with
|
|||
## File Location
|
||||
|
||||
```
|
||||
~/.pi/agent/sessions/--<path>--/<timestamp>_<uuid>.jsonl
|
||||
~/.companion/agent/sessions/--<path>--/<timestamp>_<uuid>.jsonl
|
||||
```
|
||||
|
||||
Where `<path>` is the working directory with `/` replaced by `-`.
|
||||
|
||||
## Deleting Sessions
|
||||
|
||||
Sessions can be removed by deleting their `.jsonl` files under `~/.pi/agent/sessions/`.
|
||||
Sessions can be removed by deleting their `.jsonl` files under `~/.companion/agent/sessions/`.
|
||||
|
||||
Pi also supports deleting sessions interactively from `/resume` (select a session and press `Ctrl+D`, then confirm). When available, pi uses the `trash` CLI to avoid permanent deletion.
|
||||
Companion also supports deleting sessions interactively from `/resume` (select a session and press `Ctrl+D`, then confirm). When available, companion uses the `trash` CLI to avoid permanent deletion.
|
||||
|
||||
## Session Version
|
||||
|
||||
|
|
@ -28,14 +28,14 @@ Existing sessions are automatically migrated to the current version (v3) when lo
|
|||
|
||||
## Source Files
|
||||
|
||||
Source on GitHub ([pi-mono](https://github.com/badlogic/pi-mono)):
|
||||
Source on GitHub ([companion-mono](https://github.com/badlogic/companion-mono)):
|
||||
|
||||
- [`packages/coding-agent/src/core/session-manager.ts`](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/src/core/session-manager.ts) - Session entry types and SessionManager
|
||||
- [`packages/coding-agent/src/core/messages.ts`](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/src/core/messages.ts) - Extended message types (BashExecutionMessage, CustomMessage, etc.)
|
||||
- [`packages/ai/src/types.ts`](https://github.com/badlogic/pi-mono/blob/main/packages/ai/src/types.ts) - Base message types (UserMessage, AssistantMessage, ToolResultMessage)
|
||||
- [`packages/agent/src/types.ts`](https://github.com/badlogic/pi-mono/blob/main/packages/agent/src/types.ts) - AgentMessage union type
|
||||
- [`packages/coding-agent/src/core/session-manager.ts`](https://github.com/badlogic/companion-mono/blob/main/packages/coding-agent/src/core/session-manager.ts) - Session entry types and SessionManager
|
||||
- [`packages/coding-agent/src/core/messages.ts`](https://github.com/badlogic/companion-mono/blob/main/packages/coding-agent/src/core/messages.ts) - Extended message types (BashExecutionMessage, CustomMessage, etc.)
|
||||
- [`packages/ai/src/types.ts`](https://github.com/badlogic/companion-mono/blob/main/packages/ai/src/types.ts) - Base message types (UserMessage, AssistantMessage, ToolResultMessage)
|
||||
- [`packages/agent/src/types.ts`](https://github.com/badlogic/companion-mono/blob/main/packages/agent/src/types.ts) - AgentMessage union type
|
||||
|
||||
For TypeScript definitions in your project, inspect `node_modules/@mariozechner/pi-coding-agent/dist/` and `node_modules/@mariozechner/pi-ai/dist/`.
|
||||
For TypeScript definitions in your project, inspect `node_modules/@mariozechner/companion-coding-agent/dist/` and `node_modules/@mariozechner/companion-ai/dist/`.
|
||||
|
||||
## Message Types
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ interface ToolCall {
|
|||
}
|
||||
```
|
||||
|
||||
### Base Message Types (from pi-ai)
|
||||
### Base Message Types (from companion-ai)
|
||||
|
||||
```typescript
|
||||
interface UserMessage {
|
||||
|
|
@ -117,7 +117,7 @@ interface Usage {
|
|||
}
|
||||
```
|
||||
|
||||
### Extended Message Types (from pi-coding-agent)
|
||||
### Extended Message Types (from companion-coding-agent)
|
||||
|
||||
```typescript
|
||||
interface BashExecutionMessage {
|
||||
|
|
@ -269,7 +269,7 @@ Created when context is compacted. Stores a summary of earlier messages.
|
|||
Optional fields:
|
||||
|
||||
- `details`: Implementation-specific data (e.g., `{ readFiles: string[], modifiedFiles: string[] }` for default, or custom data for extensions)
|
||||
- `fromHook`: `true` if generated by an extension, `false`/`undefined` if pi-generated (legacy field name)
|
||||
- `fromHook`: `true` if generated by an extension, `false`/`undefined` if companion-generated (legacy field name)
|
||||
|
||||
### BranchSummaryEntry
|
||||
|
||||
|
|
@ -289,7 +289,7 @@ Created when switching branches via `/tree` with an LLM generated summary of the
|
|||
Optional fields:
|
||||
|
||||
- `details`: File tracking data (`{ readFiles: string[], modifiedFiles: string[] }`) for default, or custom data for extensions
|
||||
- `fromHook`: `true` if generated by an extension, `false`/`undefined` if pi-generated (legacy field name)
|
||||
- `fromHook`: `true` if generated by an extension, `false`/`undefined` if companion-generated (legacy field name)
|
||||
|
||||
### CustomEntry
|
||||
|
||||
|
|
@ -349,7 +349,7 @@ Set `label` to `undefined` to clear a label.
|
|||
|
||||
### SessionInfoEntry
|
||||
|
||||
Session metadata (e.g., user-defined display name). Set via `/name` command or `pi.setSessionName()` in extensions.
|
||||
Session metadata (e.g., user-defined display name). Set via `/name` command or `companion.setSessionName()` in extensions.
|
||||
|
||||
```json
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
# Settings
|
||||
|
||||
Pi uses JSON settings files with project settings overriding global settings.
|
||||
Companion uses JSON settings files with project settings overriding global settings.
|
||||
|
||||
| Location | Scope |
|
||||
| --------------------------- | --------------------------- |
|
||||
| `~/.pi/agent/settings.json` | Global (all projects) |
|
||||
| `.pi/settings.json` | Project (current directory) |
|
||||
| `~/.companion/agent/settings.json` | Global (all projects) |
|
||||
| `.companion/settings.json` | Project (current directory) |
|
||||
|
||||
Edit directly or use `/settings` for common options.
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ When a provider requests a retry delay longer than `maxDelayMs` (e.g., Google's
|
|||
|
||||
These settings define where to load extensions, skills, prompts, and themes from.
|
||||
|
||||
Paths in `~/.pi/agent/settings.json` resolve relative to `~/.pi/agent`. Paths in `.pi/settings.json` resolve relative to `.pi`. Absolute paths and `~` are supported.
|
||||
Paths in `~/.companion/agent/settings.json` resolve relative to `~/.companion/agent`. Paths in `.companion/settings.json` resolve relative to `.companion`. Absolute paths and `~` are supported.
|
||||
|
||||
| Setting | Type | Default | Description |
|
||||
| --------------------- | -------- | ------- | ------------------------------------------ |
|
||||
|
|
@ -159,7 +159,7 @@ String form loads all resources from a package:
|
|||
|
||||
```json
|
||||
{
|
||||
"packages": ["pi-skills", "@org/my-extension"]
|
||||
"packages": ["companion-skills", "@org/my-extension"]
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -169,7 +169,7 @@ Object form filters which resources to load:
|
|||
{
|
||||
"packages": [
|
||||
{
|
||||
"source": "pi-skills",
|
||||
"source": "companion-skills",
|
||||
"skills": ["brave-search", "transcribe"],
|
||||
"extensions": []
|
||||
}
|
||||
|
|
@ -197,22 +197,22 @@ See [packages.md](packages.md) for package management details.
|
|||
"maxRetries": 3
|
||||
},
|
||||
"enabledModels": ["claude-*", "gpt-4o"],
|
||||
"packages": ["pi-skills"]
|
||||
"packages": ["companion-skills"]
|
||||
}
|
||||
```
|
||||
|
||||
## Project Overrides
|
||||
|
||||
Project settings (`.pi/settings.json`) override global settings. Nested objects are merged:
|
||||
Project settings (`.companion/settings.json`) override global settings. Nested objects are merged:
|
||||
|
||||
```json
|
||||
// ~/.pi/agent/settings.json (global)
|
||||
// ~/.companion/agent/settings.json (global)
|
||||
{
|
||||
"theme": "dark",
|
||||
"compaction": { "enabled": true, "reserveTokens": 16384 }
|
||||
}
|
||||
|
||||
// .pi/settings.json (project)
|
||||
// .companion/settings.json (project)
|
||||
{
|
||||
"compaction": { "reserveTokens": 8192 }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
# Shell Aliases
|
||||
|
||||
Pi runs bash in non-interactive mode (`bash -c`), which doesn't expand aliases by default.
|
||||
Companion runs bash in non-interactive mode (`bash -c`), which doesn't expand aliases by default.
|
||||
|
||||
To enable your shell aliases, add to `~/.pi/agent/settings.json`:
|
||||
To enable your shell aliases, add to `~/.companion/agent/settings.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
> pi can create skills. Ask it to build one for your use case.
|
||||
> companion can create skills. Ask it to build one for your use case.
|
||||
|
||||
# Skills
|
||||
|
||||
Skills are self-contained capability packages that the agent loads on-demand. A skill provides specialized workflows, setup instructions, helper scripts, and reference documentation for specific tasks.
|
||||
|
||||
Pi implements the [Agent Skills standard](https://agentskills.io/specification), warning about violations but remaining lenient.
|
||||
Companion implements the [Agent Skills standard](https://agentskills.io/specification), warning about violations but remaining lenient.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
|
|
@ -21,15 +21,15 @@ Pi implements the [Agent Skills standard](https://agentskills.io/specification),
|
|||
|
||||
> **Security:** Skills can instruct the model to perform any action and may include executable code the model invokes. Review skill content before use.
|
||||
|
||||
Pi loads skills from:
|
||||
Companion loads skills from:
|
||||
|
||||
- Global:
|
||||
- `~/.pi/agent/skills/`
|
||||
- `~/.companion/agent/skills/`
|
||||
- `~/.agents/skills/`
|
||||
- Project:
|
||||
- `.pi/skills/`
|
||||
- `.companion/skills/`
|
||||
- `.agents/skills/` in `cwd` and ancestor directories (up to git repo root, or filesystem root when not in a repo)
|
||||
- Packages: `skills/` directories or `pi.skills` entries in `package.json`
|
||||
- Packages: `skills/` directories or `companion.skills` entries in `package.json`
|
||||
- Settings: `skills` array with files or directories
|
||||
- CLI: `--skill <path>` (repeatable, additive even with `--no-skills`)
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ To use skills from Claude Code or OpenAI Codex, add their directories to setting
|
|||
}
|
||||
```
|
||||
|
||||
For project-level Claude Code skills, add to `.pi/settings.json`:
|
||||
For project-level Claude Code skills, add to `.companion/settings.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
|
|
@ -60,7 +60,7 @@ For project-level Claude Code skills, add to `.pi/settings.json`:
|
|||
|
||||
## How Skills Work
|
||||
|
||||
1. At startup, pi scans skill locations and extracts names and descriptions
|
||||
1. At startup, companion scans skill locations and extracts names and descriptions
|
||||
2. The system prompt includes available skills in XML format per the [specification](https://agentskills.io/integrate-skills)
|
||||
3. When a task matches, the agent uses `read` to load the full SKILL.md (models don't always do this; use prompting or `/skill:name` to force it)
|
||||
4. The agent follows the instructions, using relative paths to reference scripts and assets
|
||||
|
|
@ -174,7 +174,7 @@ description: Helps with PDFs.
|
|||
|
||||
## Validation
|
||||
|
||||
Pi validates skills against the Agent Skills standard. Most issues produce warnings but still load the skill:
|
||||
Companion validates skills against the Agent Skills standard. Most issues produce warnings but still load the skill:
|
||||
|
||||
- Name doesn't match parent directory
|
||||
- Name exceeds 64 characters or contains invalid characters
|
||||
|
|
@ -229,4 +229,4 @@ cd /path/to/brave-search && npm install
|
|||
## Skill Repositories
|
||||
|
||||
- [Anthropic Skills](https://github.com/anthropics/skills) - Document processing (docx, pdf, pptx, xlsx), web development
|
||||
- [Pi Skills](https://github.com/badlogic/pi-skills) - Web search, browser automation, Google APIs, transcription
|
||||
- [Companion Skills](https://github.com/badlogic/companion-skills) - Web search, browser automation, Google APIs, transcription
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Terminal Setup
|
||||
|
||||
Pi uses the [Kitty keyboard protocol](https://sw.kovidgoyal.net/kitty/keyboard-protocol/) for reliable modifier key detection. Most modern terminals support this protocol, but some require configuration.
|
||||
Companion uses the [Kitty keyboard protocol](https://sw.kovidgoyal.net/kitty/keyboard-protocol/) for reliable modifier key detection. Most modern terminals support this protocol, but some require configuration.
|
||||
|
||||
## Kitty, iTerm2
|
||||
|
||||
|
|
@ -66,6 +66,6 @@ If you already have an `actions` array, add the object to it.
|
|||
|
||||
The built-in terminal has limited escape sequence support. Shift+Enter cannot be distinguished from Enter in IntelliJ's terminal.
|
||||
|
||||
If you want the hardware cursor visible, set `PI_HARDWARE_CURSOR=1` before running pi (disabled by default for compatibility).
|
||||
If you want the hardware cursor visible, set `COMPANION_HARDWARE_CURSOR=1` before running companion (disabled by default for compatibility).
|
||||
|
||||
Consider using a dedicated terminal emulator for the best experience.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Termux (Android) Setup
|
||||
|
||||
Pi runs on Android via [Termux](https://termux.dev/), a terminal emulator and Linux environment for Android.
|
||||
Companion runs on Android via [Termux](https://termux.dev/), a terminal emulator and Linux environment for Android.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
|
|
@ -16,14 +16,14 @@ pkg update && pkg upgrade
|
|||
# Install dependencies
|
||||
pkg install nodejs termux-api git
|
||||
|
||||
# Install pi
|
||||
npm install -g @mariozechner/pi-coding-agent
|
||||
# Install companion
|
||||
npm install -g @mariozechner/companion-coding-agent
|
||||
|
||||
# Create config directory
|
||||
mkdir -p ~/.pi/agent
|
||||
mkdir -p ~/.companion/agent
|
||||
|
||||
# Run pi
|
||||
pi
|
||||
# Run companion
|
||||
companion
|
||||
```
|
||||
|
||||
## Clipboard Support
|
||||
|
|
@ -34,7 +34,7 @@ Image clipboard is not supported on Termux (the `ctrl+v` image paste feature wil
|
|||
|
||||
## Example AGENTS.md for Termux
|
||||
|
||||
Create `~/.pi/agent/AGENTS.md` to help the agent understand the Termux environment:
|
||||
Create `~/.companion/agent/AGENTS.md` to help the agent understand the Termux environment:
|
||||
|
||||
````markdown
|
||||
# Agent Environment: Termux on Android
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
> pi can create themes. Ask it to build one for your setup.
|
||||
> companion can create themes. Ask it to build one for your setup.
|
||||
|
||||
# Themes
|
||||
|
||||
|
|
@ -16,12 +16,12 @@ Themes are JSON files that define colors for the TUI.
|
|||
|
||||
## Locations
|
||||
|
||||
Pi loads themes from:
|
||||
Companion loads themes from:
|
||||
|
||||
- Built-in: `dark`, `light`
|
||||
- Global: `~/.pi/agent/themes/*.json`
|
||||
- Project: `.pi/themes/*.json`
|
||||
- Packages: `themes/` directories or `pi.themes` entries in `package.json`
|
||||
- Global: `~/.companion/agent/themes/*.json`
|
||||
- Project: `.companion/themes/*.json`
|
||||
- Packages: `themes/` directories or `companion.themes` entries in `package.json`
|
||||
- Settings: `themes` array with files or directories
|
||||
- CLI: `--theme <path>` (repeatable)
|
||||
|
||||
|
|
@ -37,22 +37,22 @@ Select a theme via `/settings` or in `settings.json`:
|
|||
}
|
||||
```
|
||||
|
||||
On first run, pi detects your terminal background and defaults to `dark` or `light`.
|
||||
On first run, companion detects your terminal background and defaults to `dark` or `light`.
|
||||
|
||||
## Creating a Custom Theme
|
||||
|
||||
1. Create a theme file:
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.pi/agent/themes
|
||||
vim ~/.pi/agent/themes/my-theme.json
|
||||
mkdir -p ~/.companion/agent/themes
|
||||
vim ~/.companion/agent/themes/my-theme.json
|
||||
```
|
||||
|
||||
2. Define the theme with all required colors (see [Color Tokens](#color-tokens)):
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/badlogic/pi-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
|
||||
"$schema": "https://raw.githubusercontent.com/badlogic/companion-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
|
||||
"name": "my-theme",
|
||||
"vars": {
|
||||
"primary": "#00aaff",
|
||||
|
|
@ -116,13 +116,13 @@ vim ~/.pi/agent/themes/my-theme.json
|
|||
|
||||
3. Select the theme via `/settings`.
|
||||
|
||||
**Hot reload:** When you edit the currently active custom theme file, pi reloads it automatically for immediate visual feedback.
|
||||
**Hot reload:** When you edit the currently active custom theme file, companion reloads it automatically for immediate visual feedback.
|
||||
|
||||
## Theme Format
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/badlogic/pi-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
|
||||
"$schema": "https://raw.githubusercontent.com/badlogic/companion-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
|
||||
"name": "my-theme",
|
||||
"vars": {
|
||||
"blue": "#0066cc",
|
||||
|
|
@ -268,7 +268,7 @@ Four formats are supported:
|
|||
|
||||
### Terminal Compatibility
|
||||
|
||||
Pi uses 24-bit RGB colors. Most modern terminals support this (iTerm2, Kitty, WezTerm, Windows Terminal, VS Code). For older terminals with only 256-color support, pi falls back to the nearest approximation.
|
||||
Companion uses 24-bit RGB colors. Most modern terminals support this (iTerm2, Kitty, WezTerm, Windows Terminal, VS Code). For older terminals with only 256-color support, companion falls back to the nearest approximation.
|
||||
|
||||
Check truecolor support:
|
||||
|
||||
|
|
|
|||
|
|
@ -209,8 +209,8 @@ interface SessionTreeEvent {
|
|||
### Example: Custom Summarizer
|
||||
|
||||
```typescript
|
||||
export default function (pi: HookAPI) {
|
||||
pi.on("session_before_tree", async (event, ctx) => {
|
||||
export default function (companion: HookAPI) {
|
||||
companion.on("session_before_tree", async (event, ctx) => {
|
||||
if (!event.preparation.userWantsSummary) return;
|
||||
if (event.preparation.entriesToSummarize.length === 0) return;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
> pi can create TUI components. Ask it to build one for your use case.
|
||||
> companion can create TUI components. Ask it to build one for your use case.
|
||||
|
||||
# TUI Components
|
||||
|
||||
Extensions and custom tools can render custom TUI components for interactive user interfaces. This page covers the component system and available building blocks.
|
||||
|
||||
**Source:** [`@mariozechner/pi-tui`](https://github.com/badlogic/pi-mono/tree/main/packages/tui)
|
||||
**Source:** [`@mariozechner/companion-tui`](https://github.com/badlogic/companion-mono/tree/main/packages/tui)
|
||||
|
||||
## Component Interface
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ import {
|
|||
CURSOR_MARKER,
|
||||
type Component,
|
||||
type Focusable,
|
||||
} from "@mariozechner/pi-tui";
|
||||
} from "@mariozechner/companion-tui";
|
||||
|
||||
class MyInput implements Component, Focusable {
|
||||
focused: boolean = false; // Set by TUI when focus changes
|
||||
|
|
@ -66,7 +66,7 @@ This enables IME candidate windows to appear at the correct position for CJK inp
|
|||
When a container component (dialog, selector, etc.) contains an `Input` or `Editor` child, the container must implement `Focusable` and propagate the focus state to the child. Otherwise, the hardware cursor won't be positioned correctly for IME input.
|
||||
|
||||
```typescript
|
||||
import { Container, type Focusable, Input } from "@mariozechner/pi-tui";
|
||||
import { Container, type Focusable, Input } from "@mariozechner/companion-tui";
|
||||
|
||||
class SearchDialog extends Container implements Focusable {
|
||||
private searchInput: Input;
|
||||
|
|
@ -96,18 +96,18 @@ Without this propagation, typing with an IME (Chinese, Japanese, Korean, etc.) w
|
|||
**In extensions** via `ctx.ui.custom()`:
|
||||
|
||||
```typescript
|
||||
pi.on("session_start", async (_event, ctx) => {
|
||||
companion.on("session_start", async (_event, ctx) => {
|
||||
const handle = ctx.ui.custom(myComponent);
|
||||
// handle.requestRender() - trigger re-render
|
||||
// handle.close() - restore normal UI
|
||||
});
|
||||
```
|
||||
|
||||
**In custom tools** via `pi.ui.custom()`:
|
||||
**In custom tools** via `companion.ui.custom()`:
|
||||
|
||||
```typescript
|
||||
async execute(toolCallId, params, onUpdate, ctx, signal) {
|
||||
const handle = pi.ui.custom(myComponent);
|
||||
const handle = companion.ui.custom(myComponent);
|
||||
// ...
|
||||
handle.close();
|
||||
}
|
||||
|
|
@ -191,10 +191,10 @@ See [overlay-qa-tests.ts](../examples/extensions/overlay-qa-tests.ts) for compre
|
|||
|
||||
## Built-in Components
|
||||
|
||||
Import from `@mariozechner/pi-tui`:
|
||||
Import from `@mariozechner/companion-tui`:
|
||||
|
||||
```typescript
|
||||
import { Text, Box, Container, Spacer, Markdown } from "@mariozechner/pi-tui";
|
||||
import { Text, Box, Container, Spacer, Markdown } from "@mariozechner/companion-tui";
|
||||
```
|
||||
|
||||
### Text
|
||||
|
|
@ -276,7 +276,7 @@ const image = new Image(
|
|||
Use `matchesKey()` for key detection:
|
||||
|
||||
```typescript
|
||||
import { matchesKey, Key } from "@mariozechner/pi-tui";
|
||||
import { matchesKey, Key } from "@mariozechner/companion-tui";
|
||||
|
||||
handleInput(data: string) {
|
||||
if (matchesKey(data, Key.up)) {
|
||||
|
|
@ -303,7 +303,7 @@ handleInput(data: string) {
|
|||
**Critical:** Each line from `render()` must not exceed the `width` parameter.
|
||||
|
||||
```typescript
|
||||
import { visibleWidth, truncateToWidth } from "@mariozechner/pi-tui";
|
||||
import { visibleWidth, truncateToWidth } from "@mariozechner/companion-tui";
|
||||
|
||||
render(width: number): string[] {
|
||||
// Truncate long lines
|
||||
|
|
@ -327,7 +327,7 @@ import {
|
|||
Key,
|
||||
truncateToWidth,
|
||||
visibleWidth,
|
||||
} from "@mariozechner/pi-tui";
|
||||
} from "@mariozechner/companion-tui";
|
||||
|
||||
class MySelector {
|
||||
private items: string[];
|
||||
|
|
@ -382,7 +382,7 @@ class MySelector {
|
|||
Usage in an extension:
|
||||
|
||||
```typescript
|
||||
pi.registerCommand("pick", {
|
||||
companion.registerCommand("pick", {
|
||||
description: "Pick an item",
|
||||
handler: async (args, ctx) => {
|
||||
const items = ["Option A", "Option B", "Option C"];
|
||||
|
|
@ -444,8 +444,8 @@ renderResult(result, options, theme) {
|
|||
**For Markdown**, use `getMarkdownTheme()`:
|
||||
|
||||
```typescript
|
||||
import { getMarkdownTheme } from "@mariozechner/pi-coding-agent";
|
||||
import { Markdown } from "@mariozechner/pi-tui";
|
||||
import { getMarkdownTheme } from "@mariozechner/companion-coding-agent";
|
||||
import { Markdown } from "@mariozechner/companion-tui";
|
||||
|
||||
renderResult(result, options, theme) {
|
||||
const mdTheme = getMarkdownTheme();
|
||||
|
|
@ -464,10 +464,10 @@ interface MyTheme {
|
|||
|
||||
## Debug logging
|
||||
|
||||
Set `PI_TUI_WRITE_LOG` to capture the raw ANSI stream written to stdout.
|
||||
Set `COMPANION_TUI_WRITE_LOG` to capture the raw ANSI stream written to stdout.
|
||||
|
||||
```bash
|
||||
PI_TUI_WRITE_LOG=/tmp/tui-ansi.log npx tsx packages/tui/test/chat-simple.ts
|
||||
COMPANION_TUI_WRITE_LOG=/tmp/tui-ansi.log npx tsx packages/tui/test/chat-simple.ts
|
||||
```
|
||||
|
||||
## Performance
|
||||
|
|
@ -606,19 +606,19 @@ These patterns cover the most common UI needs in extensions. **Copy these patter
|
|||
|
||||
### Pattern 1: Selection Dialog (SelectList)
|
||||
|
||||
For letting users pick from a list of options. Use `SelectList` from `@mariozechner/pi-tui` with `DynamicBorder` for framing.
|
||||
For letting users pick from a list of options. Use `SelectList` from `@mariozechner/companion-tui` with `DynamicBorder` for framing.
|
||||
|
||||
```typescript
|
||||
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
||||
import { DynamicBorder } from "@mariozechner/pi-coding-agent";
|
||||
import type { ExtensionAPI } from "@mariozechner/companion-coding-agent";
|
||||
import { DynamicBorder } from "@mariozechner/companion-coding-agent";
|
||||
import {
|
||||
Container,
|
||||
type SelectItem,
|
||||
SelectList,
|
||||
Text,
|
||||
} from "@mariozechner/pi-tui";
|
||||
} from "@mariozechner/companion-tui";
|
||||
|
||||
pi.registerCommand("pick", {
|
||||
companion.registerCommand("pick", {
|
||||
handler: async (_args, ctx) => {
|
||||
const items: SelectItem[] = [
|
||||
{ value: "opt1", label: "Option 1", description: "First option" },
|
||||
|
|
@ -691,9 +691,9 @@ pi.registerCommand("pick", {
|
|||
For operations that take time and should be cancellable. `BorderedLoader` shows a spinner and handles escape to cancel.
|
||||
|
||||
```typescript
|
||||
import { BorderedLoader } from "@mariozechner/pi-coding-agent";
|
||||
import { BorderedLoader } from "@mariozechner/companion-coding-agent";
|
||||
|
||||
pi.registerCommand("fetch", {
|
||||
companion.registerCommand("fetch", {
|
||||
handler: async (_args, ctx) => {
|
||||
const result = await ctx.ui.custom<string | null>(
|
||||
(tui, theme, _kb, done) => {
|
||||
|
|
@ -722,18 +722,18 @@ pi.registerCommand("fetch", {
|
|||
|
||||
### Pattern 3: Settings/Toggles (SettingsList)
|
||||
|
||||
For toggling multiple settings. Use `SettingsList` from `@mariozechner/pi-tui` with `getSettingsListTheme()`.
|
||||
For toggling multiple settings. Use `SettingsList` from `@mariozechner/companion-tui` with `getSettingsListTheme()`.
|
||||
|
||||
```typescript
|
||||
import { getSettingsListTheme } from "@mariozechner/pi-coding-agent";
|
||||
import { getSettingsListTheme } from "@mariozechner/companion-coding-agent";
|
||||
import {
|
||||
Container,
|
||||
type SettingItem,
|
||||
SettingsList,
|
||||
Text,
|
||||
} from "@mariozechner/pi-tui";
|
||||
} from "@mariozechner/companion-tui";
|
||||
|
||||
pi.registerCommand("settings", {
|
||||
companion.registerCommand("settings", {
|
||||
handler: async (_args, ctx) => {
|
||||
const items: SettingItem[] = [
|
||||
{
|
||||
|
|
@ -854,8 +854,8 @@ Token stats available via `ctx.sessionManager.getBranch()` and `ctx.model`.
|
|||
Replace the main input editor with a custom implementation. Useful for modal editing (vim), different keybindings (emacs), or specialized input handling.
|
||||
|
||||
```typescript
|
||||
import { CustomEditor, type ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
||||
import { matchesKey, truncateToWidth } from "@mariozechner/pi-tui";
|
||||
import { CustomEditor, type ExtensionAPI } from "@mariozechner/companion-coding-agent";
|
||||
import { matchesKey, truncateToWidth } from "@mariozechner/companion-tui";
|
||||
|
||||
type Mode = "normal" | "insert";
|
||||
|
||||
|
|
@ -917,8 +917,8 @@ class VimEditor extends CustomEditor {
|
|||
}
|
||||
}
|
||||
|
||||
export default function (pi: ExtensionAPI) {
|
||||
pi.on("session_start", (_event, ctx) => {
|
||||
export default function (companion: ExtensionAPI) {
|
||||
companion.on("session_start", (_event, ctx) => {
|
||||
// Factory receives theme and keybindings from the app
|
||||
ctx.ui.setEditorComponent(
|
||||
(tui, theme, keybindings) => new VimEditor(theme, keybindings),
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
# Windows Setup
|
||||
|
||||
Pi requires a bash shell on Windows. Checked locations (in order):
|
||||
Companion requires a bash shell on Windows. Checked locations (in order):
|
||||
|
||||
1. Custom path from `~/.pi/agent/settings.json`
|
||||
1. Custom path from `~/.companion/agent/settings.json`
|
||||
2. Git Bash (`C:\Program Files\Git\bin\bash.exe`)
|
||||
3. `bash.exe` on PATH (Cygwin, MSYS2, WSL)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
{
|
||||
"name": "@mariozechner/pi-coding-agent",
|
||||
"name": "@mariozechner/companion-coding-agent",
|
||||
"version": "0.56.2",
|
||||
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
||||
"type": "module",
|
||||
"piConfig": {
|
||||
"name": "pi",
|
||||
"configDir": ".pi"
|
||||
"companionConfig": {
|
||||
"name": "companion",
|
||||
"configDir": ".companion"
|
||||
},
|
||||
"bin": {
|
||||
"pi": "dist/cli.js"
|
||||
"companion": "dist/cli.js"
|
||||
},
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
"clean": "shx rm -rf dist",
|
||||
"dev": "tsgo -p tsconfig.build.json --watch --preserveWatchOutput",
|
||||
"build": "tsgo -p tsconfig.build.json && shx chmod +x dist/cli.js && npm run copy-assets",
|
||||
"build:binary": "npm --prefix ../tui run build && npm --prefix ../ai run build && npm --prefix ../agent run build && npm run build && bun build --compile ./dist/cli.js --outfile dist/pi && npm run copy-binary-assets",
|
||||
"build:binary": "npm --prefix ../tui run build && npm --prefix ../ai run build && npm --prefix ../agent run build && npm run build && bun build --compile ./dist/cli.js --outfile dist/companion && npm run copy-binary-assets",
|
||||
"copy-assets": "shx mkdir -p dist/modes/interactive/theme && shx cp src/modes/interactive/theme/*.json dist/modes/interactive/theme/ && shx mkdir -p dist/core/export-html/vendor && shx cp src/core/export-html/template.html src/core/export-html/template.css src/core/export-html/template.js dist/core/export-html/ && shx cp src/core/export-html/vendor/*.js dist/core/export-html/vendor/",
|
||||
"copy-binary-assets": "shx cp package.json dist/ && shx cp README.md dist/ && shx cp CHANGELOG.md dist/ && shx mkdir -p dist/theme && shx cp src/modes/interactive/theme/*.json dist/theme/ && shx mkdir -p dist/export-html/vendor && shx cp src/core/export-html/template.html dist/export-html/ && shx cp src/core/export-html/vendor/*.js dist/export-html/vendor/ && shx cp -r docs dist/ && shx cp -r examples dist/ && shx cp ../../node_modules/@silvia-odwyer/photon-node/photon_rs_bg.wasm dist/",
|
||||
"test": "vitest --run",
|
||||
|
|
@ -40,9 +40,9 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@mariozechner/jiti": "^2.6.2",
|
||||
"@mariozechner/pi-agent-core": "^0.56.2",
|
||||
"@mariozechner/pi-ai": "^0.56.2",
|
||||
"@mariozechner/pi-tui": "^0.56.2",
|
||||
"@mariozechner/companion-agent-core": "^0.56.2",
|
||||
"@mariozechner/companion-ai": "^0.56.2",
|
||||
"@mariozechner/companion-tui": "^0.56.2",
|
||||
"@silvia-odwyer/photon-node": "^0.3.4",
|
||||
"chalk": "^5.5.0",
|
||||
"cli-highlight": "^2.1.11",
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Migrate sessions from ~/.pi/agent/*.jsonl to proper session directories.
|
||||
# Migrate sessions from ~/.companion/agent/*.jsonl to proper session directories.
|
||||
# This fixes sessions created by the bug in v0.30.0 where sessions were
|
||||
# saved to ~/.pi/agent/ instead of ~/.pi/agent/sessions/<encoded-cwd>/.
|
||||
# saved to ~/.companion/agent/ instead of ~/.companion/agent/sessions/<encoded-cwd>/.
|
||||
#
|
||||
# Usage: ./migrate-sessions.sh [--dry-run]
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
AGENT_DIR="${PI_AGENT_DIR:-$HOME/.pi/agent}"
|
||||
AGENT_DIR="${COMPANION_AGENT_DIR:-$HOME/.companion/agent}"
|
||||
DRY_RUN=false
|
||||
|
||||
if [[ "$1" == "--dry-run" ]]; then
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@
|
|||
*
|
||||
* Test with: npx tsx src/cli-new.ts [args...]
|
||||
*/
|
||||
process.title = "pi";
|
||||
process.title = "companion";
|
||||
|
||||
import { bedrockProviderModule } from "@mariozechner/pi-ai/bedrock-provider";
|
||||
import { setBedrockProviderModule } from "@mariozechner/pi-ai";
|
||||
import { bedrockProviderModule } from "@mariozechner/companion-ai/bedrock-provider";
|
||||
import { setBedrockProviderModule } from "@mariozechner/companion-ai";
|
||||
import { EnvHttpProxyAgent, setGlobalDispatcher } from "undici";
|
||||
import { main } from "./main.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* CLI argument parsing and help display
|
||||
*/
|
||||
|
||||
import type { ThinkingLevel } from "@mariozechner/pi-agent-core";
|
||||
import type { ThinkingLevel } from "@mariozechner/companion-agent-core";
|
||||
import chalk from "chalk";
|
||||
import { APP_NAME, CONFIG_DIR_NAME, ENV_AGENT_DIR } from "../config.js";
|
||||
import {
|
||||
|
|
@ -245,7 +245,7 @@ ${chalk.bold("Options:")}
|
|||
--export <file> Export session file to HTML and exit
|
||||
--list-models [search] List available models (with optional fuzzy search)
|
||||
--verbose Force verbose startup (overrides quietStartup setting)
|
||||
--offline Disable startup network operations (same as PI_OFFLINE=1)
|
||||
--offline Disable startup network operations (same as COMPANION_OFFLINE=1)
|
||||
--help, -h Show this help
|
||||
--version, -v Show version number
|
||||
|
||||
|
|
@ -324,10 +324,10 @@ ${chalk.bold("Environment Variables:")}
|
|||
AWS_BEARER_TOKEN_BEDROCK - Bedrock API key (bearer token)
|
||||
AWS_REGION - AWS region for Amazon Bedrock (e.g., us-east-1)
|
||||
${ENV_AGENT_DIR.padEnd(32)} - Session storage directory (default: ~/${CONFIG_DIR_NAME}/agent)
|
||||
PI_PACKAGE_DIR - Override package directory (for Nix/Guix store paths)
|
||||
PI_OFFLINE - Disable startup network operations when set to 1/true/yes
|
||||
PI_SHARE_VIEWER_URL - Base URL for /share command (default: https://pi.dev/session/)
|
||||
PI_AI_ANTIGRAVITY_VERSION - Override Antigravity User-Agent version (e.g., 1.23.0)
|
||||
COMPANION_PACKAGE_DIR - Override package directory (for Nix/Guix store paths)
|
||||
COMPANION_OFFLINE - Disable startup network operations when set to 1/true/yes
|
||||
COMPANION_SHARE_VIEWER_URL - Base URL for /share command (default: https://companion.dev/session/)
|
||||
COMPANION_AI_ANTIGRAVITY_VERSION - Override Antigravity User-Agent version (e.g., 1.23.0)
|
||||
|
||||
${chalk.bold(`Available Tools (default: ${defaultToolsText}):`)}
|
||||
read - Read file contents
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* TUI config selector for `pi config` command
|
||||
* TUI config selector for `companion config` command
|
||||
*/
|
||||
|
||||
import { ProcessTerminal, TUI } from "@mariozechner/pi-tui";
|
||||
import { ProcessTerminal, TUI } from "@mariozechner/companion-tui";
|
||||
import type { ResolvedPaths } from "../core/package-manager.js";
|
||||
import type { SettingsManager } from "../core/settings-manager.js";
|
||||
import { ConfigSelectorComponent } from "../modes/interactive/components/config-selector.js";
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
|
||||
import { access, readFile, stat } from "node:fs/promises";
|
||||
import type { ImageContent } from "@mariozechner/pi-ai";
|
||||
import type { ImageContent } from "@mariozechner/companion-ai";
|
||||
import chalk from "chalk";
|
||||
import { resolve } from "path";
|
||||
import { resolveReadPath } from "../core/tools/path-utils.js";
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
* List available models with optional fuzzy search
|
||||
*/
|
||||
|
||||
import type { Api, Model } from "@mariozechner/pi-ai";
|
||||
import { fuzzyFilter } from "@mariozechner/pi-tui";
|
||||
import type { Api, Model } from "@mariozechner/companion-ai";
|
||||
import { fuzzyFilter } from "@mariozechner/companion-tui";
|
||||
import type { ModelRegistry } from "../core/model-registry.js";
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* TUI session selector for --resume flag
|
||||
*/
|
||||
|
||||
import { ProcessTerminal, TUI } from "@mariozechner/pi-tui";
|
||||
import { ProcessTerminal, TUI } from "@mariozechner/companion-tui";
|
||||
import { KeybindingsManager } from "../core/keybindings.js";
|
||||
import type {
|
||||
SessionInfo,
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ export function getUpdateInstruction(packageName: string): string {
|
|||
const method = detectInstallMethod();
|
||||
switch (method) {
|
||||
case "bun-binary":
|
||||
return `Download from: https://github.com/badlogic/pi-mono/releases/latest`;
|
||||
return `Download from: https://github.com/badlogic/companion-mono/releases/latest`;
|
||||
case "pnpm":
|
||||
return `Run: pnpm install -g ${packageName}`;
|
||||
case "yarn":
|
||||
|
|
@ -99,7 +99,7 @@ export function getUpdateInstruction(packageName: string): string {
|
|||
*/
|
||||
export function getPackageDir(): string {
|
||||
// Allow override via environment variable (useful for Nix/Guix where store paths tokenize poorly)
|
||||
const envDir = process.env.PI_PACKAGE_DIR;
|
||||
const envDir = process.env.COMPANION_PACKAGE_DIR;
|
||||
if (envDir) {
|
||||
if (envDir === "~") return homedir();
|
||||
if (envDir.startsWith("~/")) return homedir() + envDir.slice(1);
|
||||
|
|
@ -174,31 +174,32 @@ export function getChangelogPath(): string {
|
|||
}
|
||||
|
||||
// =============================================================================
|
||||
// App Config (from package.json piConfig)
|
||||
// App Config (from package.json companionConfig)
|
||||
// =============================================================================
|
||||
|
||||
const pkg = JSON.parse(readFileSync(getPackageJsonPath(), "utf-8"));
|
||||
|
||||
export const APP_NAME: string = pkg.piConfig?.name || "pi";
|
||||
export const CONFIG_DIR_NAME: string = pkg.piConfig?.configDir || ".pi";
|
||||
export const APP_NAME: string = pkg.companionConfig?.name || "companion";
|
||||
export const CONFIG_DIR_NAME: string =
|
||||
pkg.companionConfig?.configDir || ".companion";
|
||||
export const VERSION: string = pkg.version;
|
||||
|
||||
// e.g., PI_CODING_AGENT_DIR or TAU_CODING_AGENT_DIR
|
||||
// e.g., COMPANION_CODING_AGENT_DIR or TAU_CODING_AGENT_DIR
|
||||
export const ENV_AGENT_DIR = `${APP_NAME.toUpperCase()}_CODING_AGENT_DIR`;
|
||||
|
||||
const DEFAULT_SHARE_VIEWER_URL = "https://pi.dev/session/";
|
||||
const DEFAULT_SHARE_VIEWER_URL = "https://companion.dev/session/";
|
||||
|
||||
/** Get the share viewer URL for a gist ID */
|
||||
export function getShareViewerUrl(gistId: string): string {
|
||||
const baseUrl = process.env.PI_SHARE_VIEWER_URL || DEFAULT_SHARE_VIEWER_URL;
|
||||
const baseUrl = process.env.COMPANION_SHARE_VIEWER_URL || DEFAULT_SHARE_VIEWER_URL;
|
||||
return `${baseUrl}#${gistId}`;
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// User Config Paths (~/.pi/agent/*)
|
||||
// User Config Paths (~/.companion/agent/*)
|
||||
// =============================================================================
|
||||
|
||||
/** Get the agent config directory (e.g., ~/.pi/agent/) */
|
||||
/** Get the agent config directory (e.g., ~/.companion/agent/) */
|
||||
export function getAgentDir(): string {
|
||||
const envDir = process.env[ENV_AGENT_DIR];
|
||||
if (envDir) {
|
||||
|
|
|
|||
|
|
@ -22,20 +22,20 @@ import type {
|
|||
AgentState,
|
||||
AgentTool,
|
||||
ThinkingLevel,
|
||||
} from "@mariozechner/pi-agent-core";
|
||||
} from "@mariozechner/companion-agent-core";
|
||||
import type {
|
||||
AssistantMessage,
|
||||
ImageContent,
|
||||
Message,
|
||||
Model,
|
||||
TextContent,
|
||||
} from "@mariozechner/pi-ai";
|
||||
} from "@mariozechner/companion-ai";
|
||||
import {
|
||||
isContextOverflow,
|
||||
modelsAreEqual,
|
||||
resetApiProviders,
|
||||
supportsXhigh,
|
||||
} from "@mariozechner/pi-ai";
|
||||
} from "@mariozechner/companion-ai";
|
||||
import { getDocsPath } from "../config.js";
|
||||
import { theme } from "../modes/interactive/theme/theme.js";
|
||||
import { stripFrontmatter } from "../utils/frontmatter.js";
|
||||
|
|
@ -1023,7 +1023,7 @@ export class AgentSession {
|
|||
|
||||
/**
|
||||
* Send a prompt to the agent.
|
||||
* - Handles extension commands (registered via pi.registerCommand) immediately, even during streaming
|
||||
* - Handles extension commands (registered via companion.registerCommand) immediately, even during streaming
|
||||
* - Expands file-based prompt templates by default
|
||||
* - During streaming, queues via steer() or followUp() based on streamingBehavior option
|
||||
* - Validates model and API key before sending (when not streaming)
|
||||
|
|
@ -1034,7 +1034,7 @@ export class AgentSession {
|
|||
const expandPromptTemplates = options?.expandPromptTemplates ?? true;
|
||||
|
||||
// Handle extension commands first (execute immediately, even during streaming)
|
||||
// Extension commands manage their own LLM interaction via pi.sendMessage()
|
||||
// Extension commands manage their own LLM interaction via companion.sendMessage()
|
||||
if (expandPromptTemplates && text.startsWith("/")) {
|
||||
const handled = await this._tryExecuteExtensionCommand(text);
|
||||
if (handled) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Credential storage for API keys and OAuth tokens.
|
||||
* Handles loading, saving, and refreshing credentials from auth.json.
|
||||
*
|
||||
* Uses file locking to prevent race conditions when multiple pi instances
|
||||
* Uses file locking to prevent race conditions when multiple companion instances
|
||||
* try to refresh tokens simultaneously.
|
||||
*/
|
||||
|
||||
|
|
@ -11,12 +11,12 @@ import {
|
|||
type OAuthCredentials,
|
||||
type OAuthLoginCallbacks,
|
||||
type OAuthProviderId,
|
||||
} from "@mariozechner/pi-ai";
|
||||
} from "@mariozechner/companion-ai";
|
||||
import {
|
||||
getOAuthApiKey,
|
||||
getOAuthProvider,
|
||||
getOAuthProviders,
|
||||
} from "@mariozechner/pi-ai/oauth";
|
||||
} from "@mariozechner/companion-ai/oauth";
|
||||
import {
|
||||
chmodSync,
|
||||
existsSync,
|
||||
|
|
@ -373,7 +373,7 @@ export class AuthStorage {
|
|||
|
||||
/**
|
||||
* Refresh OAuth token with backend locking to prevent race conditions.
|
||||
* Multiple pi instances may try to refresh simultaneously when tokens expire.
|
||||
* Multiple companion instances may try to refresh simultaneously when tokens expire.
|
||||
*/
|
||||
private async refreshOAuthTokenWithLock(
|
||||
providerId: OAuthProviderId,
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ export function executeBash(
|
|||
// Start writing to temp file if exceeds threshold
|
||||
if (totalBytes > DEFAULT_MAX_BYTES && !tempFilePath) {
|
||||
const id = randomBytes(8).toString("hex");
|
||||
tempFilePath = join(tmpdir(), `pi-bash-${id}.log`);
|
||||
tempFilePath = join(tmpdir(), `companion-bash-${id}.log`);
|
||||
tempFileStream = createWriteStream(tempFilePath);
|
||||
// Write already-buffered chunks to temp file
|
||||
for (const chunk of outputChunks) {
|
||||
|
|
@ -223,7 +223,7 @@ export async function executeBashWithOperations(
|
|||
// Start writing to temp file if exceeds threshold
|
||||
if (totalBytes > DEFAULT_MAX_BYTES && !tempFilePath) {
|
||||
const id = randomBytes(8).toString("hex");
|
||||
tempFilePath = join(tmpdir(), `pi-bash-${id}.log`);
|
||||
tempFilePath = join(tmpdir(), `companion-bash-${id}.log`);
|
||||
tempFileStream = createWriteStream(tempFilePath);
|
||||
for (const chunk of outputChunks) {
|
||||
tempFileStream.write(chunk);
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
* a summary of the branch being left so context isn't lost.
|
||||
*/
|
||||
|
||||
import type { AgentMessage } from "@mariozechner/pi-agent-core";
|
||||
import type { Model } from "@mariozechner/pi-ai";
|
||||
import { completeSimple } from "@mariozechner/pi-ai";
|
||||
import type { AgentMessage } from "@mariozechner/companion-agent-core";
|
||||
import type { Model } from "@mariozechner/companion-ai";
|
||||
import { completeSimple } from "@mariozechner/companion-ai";
|
||||
import {
|
||||
convertToLlm,
|
||||
createBranchSummaryMessage,
|
||||
|
|
@ -206,7 +206,7 @@ export function prepareBranchEntries(
|
|||
|
||||
// First pass: collect file ops from ALL entries (even if they don't fit in token budget)
|
||||
// This ensures we capture cumulative file tracking from nested branch summaries
|
||||
// Only extract from pi-generated summaries (fromHook !== true), not extension-generated ones
|
||||
// Only extract from companion-generated summaries (fromHook !== true), not extension-generated ones
|
||||
for (const entry of entries) {
|
||||
if (entry.type === "branch_summary" && !entry.fromHook && entry.details) {
|
||||
const details = entry.details as BranchSummaryDetails;
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
* and after compaction the session is reloaded.
|
||||
*/
|
||||
|
||||
import type { AgentMessage } from "@mariozechner/pi-agent-core";
|
||||
import type { AssistantMessage, Model, Usage } from "@mariozechner/pi-ai";
|
||||
import { completeSimple } from "@mariozechner/pi-ai";
|
||||
import type { AgentMessage } from "@mariozechner/companion-agent-core";
|
||||
import type { AssistantMessage, Model, Usage } from "@mariozechner/companion-ai";
|
||||
import { completeSimple } from "@mariozechner/companion-ai";
|
||||
import {
|
||||
convertToLlm,
|
||||
createBranchSummaryMessage,
|
||||
|
|
@ -45,7 +45,7 @@ function extractFileOperations(
|
|||
): FileOperations {
|
||||
const fileOps = createFileOps();
|
||||
|
||||
// Collect from previous compaction's details (if pi-generated)
|
||||
// Collect from previous compaction's details (if companion-generated)
|
||||
if (prevCompactionIndex >= 0) {
|
||||
const prevCompaction = entries[prevCompactionIndex] as CompactionEntry;
|
||||
if (!prevCompaction.fromHook && prevCompaction.details) {
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
* Shared utilities for compaction and branch summarization.
|
||||
*/
|
||||
|
||||
import type { AgentMessage } from "@mariozechner/pi-agent-core";
|
||||
import type { Message } from "@mariozechner/pi-ai";
|
||||
import type { AgentMessage } from "@mariozechner/companion-agent-core";
|
||||
import type { Message } from "@mariozechner/companion-ai";
|
||||
|
||||
// ============================================================================
|
||||
// File Operation Tracking
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
import type { ThinkingLevel } from "@mariozechner/pi-agent-core";
|
||||
import type { ThinkingLevel } from "@mariozechner/companion-agent-core";
|
||||
|
||||
export const DEFAULT_THINKING_LEVEL: ThinkingLevel = "medium";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { AgentState } from "@mariozechner/pi-agent-core";
|
||||
import type { AgentState } from "@mariozechner/companion-agent-core";
|
||||
import { existsSync, readFileSync, writeFileSync } from "fs";
|
||||
import { basename, join } from "path";
|
||||
import { APP_NAME, getExportTemplateDir } from "../../config.js";
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
// Parse URL parameters for deep linking: leafId and targetId
|
||||
// Check for injected params (when loaded in iframe via srcdoc) or use window.location
|
||||
const injectedParams = document.querySelector('meta[name="pi-url-params"]');
|
||||
const injectedParams = document.querySelector('meta[name="companion-url-params"]');
|
||||
const searchString = injectedParams
|
||||
? injectedParams.content
|
||||
: window.location.search.substring(1);
|
||||
|
|
@ -1227,7 +1227,7 @@
|
|||
function buildShareUrl(entryId) {
|
||||
// Check for injected base URL (used when loaded in iframe via srcdoc)
|
||||
const baseUrlMeta = document.querySelector(
|
||||
'meta[name="pi-share-base-url"]',
|
||||
'meta[name="companion-share-base-url"]',
|
||||
);
|
||||
const baseUrl = baseUrlMeta
|
||||
? baseUrlMeta.content
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* and converting the ANSI output to HTML.
|
||||
*/
|
||||
|
||||
import type { ImageContent, TextContent } from "@mariozechner/pi-ai";
|
||||
import type { ImageContent, TextContent } from "@mariozechner/companion-ai";
|
||||
import type { Theme } from "../../modes/interactive/theme/theme.js";
|
||||
import type { ToolDefinition } from "../extensions/types.js";
|
||||
import { ansiLinesToHtml } from "./ansi-to-html.js";
|
||||
|
|
|
|||
|
|
@ -4864,7 +4864,7 @@ var hljs = (function () {
|
|||
keyword:
|
||||
"and break do else elseif end for goto if in local not or repeat return then until while",
|
||||
built_in:
|
||||
"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove",
|
||||
"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp companion cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove",
|
||||
},
|
||||
contains: i.concat([
|
||||
{
|
||||
|
|
@ -6293,7 +6293,7 @@ var hljs = (function () {
|
|||
literal:
|
||||
"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",
|
||||
built_in:
|
||||
"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm",
|
||||
"LETTERS letters month.abb month.name companion T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm",
|
||||
},
|
||||
contains: [
|
||||
e.COMMENT(/#'/, /$/, {
|
||||
|
|
|
|||
|
|
@ -10,18 +10,18 @@ import * as os from "node:os";
|
|||
import * as path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { createJiti } from "@mariozechner/jiti";
|
||||
import * as _bundledPiAgentCore from "@mariozechner/pi-agent-core";
|
||||
import * as _bundledPiAi from "@mariozechner/pi-ai";
|
||||
import * as _bundledPiAiOauth from "@mariozechner/pi-ai/oauth";
|
||||
import type { KeyId } from "@mariozechner/pi-tui";
|
||||
import * as _bundledPiTui from "@mariozechner/pi-tui";
|
||||
import * as _bundledPiAgentCore from "@mariozechner/companion-agent-core";
|
||||
import * as _bundledPiAi from "@mariozechner/companion-ai";
|
||||
import * as _bundledPiAiOauth from "@mariozechner/companion-ai/oauth";
|
||||
import type { KeyId } from "@mariozechner/companion-tui";
|
||||
import * as _bundledPiTui from "@mariozechner/companion-tui";
|
||||
// Static imports of packages that extensions may use.
|
||||
// These MUST be static so Bun bundles them into the compiled binary.
|
||||
// The virtualModules option then makes them available to extensions.
|
||||
import * as _bundledTypebox from "@sinclair/typebox";
|
||||
import { getAgentDir, isBunBinary } from "../../config.js";
|
||||
// NOTE: This import works because loader.ts exports are NOT re-exported from index.ts,
|
||||
// avoiding a circular dependency. Extensions can import from @mariozechner/pi-coding-agent.
|
||||
// avoiding a circular dependency. Extensions can import from @mariozechner/companion-coding-agent.
|
||||
import * as _bundledPiCodingAgent from "../../index.js";
|
||||
import { createEventBus, type EventBus } from "../event-bus.js";
|
||||
import type { ExecOptions } from "../exec.js";
|
||||
|
|
@ -41,11 +41,11 @@ import type {
|
|||
/** Modules available to extensions via virtualModules (for compiled Bun binary) */
|
||||
const VIRTUAL_MODULES: Record<string, unknown> = {
|
||||
"@sinclair/typebox": _bundledTypebox,
|
||||
"@mariozechner/pi-agent-core": _bundledPiAgentCore,
|
||||
"@mariozechner/pi-tui": _bundledPiTui,
|
||||
"@mariozechner/pi-ai": _bundledPiAi,
|
||||
"@mariozechner/pi-ai/oauth": _bundledPiAiOauth,
|
||||
"@mariozechner/pi-coding-agent": _bundledPiCodingAgent,
|
||||
"@mariozechner/companion-agent-core": _bundledPiAgentCore,
|
||||
"@mariozechner/companion-tui": _bundledPiTui,
|
||||
"@mariozechner/companion-ai": _bundledPiAi,
|
||||
"@mariozechner/companion-ai/oauth": _bundledPiAiOauth,
|
||||
"@mariozechner/companion-coding-agent": _bundledPiCodingAgent,
|
||||
};
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
|
|
@ -80,22 +80,22 @@ function getAliases(): Record<string, string> {
|
|||
};
|
||||
|
||||
_aliases = {
|
||||
"@mariozechner/pi-coding-agent": packageIndex,
|
||||
"@mariozechner/pi-agent-core": resolveWorkspaceOrImport(
|
||||
"@mariozechner/companion-coding-agent": packageIndex,
|
||||
"@mariozechner/companion-agent-core": resolveWorkspaceOrImport(
|
||||
"agent/dist/index.js",
|
||||
"@mariozechner/pi-agent-core",
|
||||
"@mariozechner/companion-agent-core",
|
||||
),
|
||||
"@mariozechner/pi-tui": resolveWorkspaceOrImport(
|
||||
"@mariozechner/companion-tui": resolveWorkspaceOrImport(
|
||||
"tui/dist/index.js",
|
||||
"@mariozechner/pi-tui",
|
||||
"@mariozechner/companion-tui",
|
||||
),
|
||||
"@mariozechner/pi-ai": resolveWorkspaceOrImport(
|
||||
"@mariozechner/companion-ai": resolveWorkspaceOrImport(
|
||||
"ai/dist/index.js",
|
||||
"@mariozechner/pi-ai",
|
||||
"@mariozechner/companion-ai",
|
||||
),
|
||||
"@mariozechner/pi-ai/oauth": resolveWorkspaceOrImport(
|
||||
"@mariozechner/companion-ai/oauth": resolveWorkspaceOrImport(
|
||||
"ai/dist/oauth.js",
|
||||
"@mariozechner/pi-ai/oauth",
|
||||
"@mariozechner/companion-ai/oauth",
|
||||
),
|
||||
"@sinclair/typebox": typeboxRoot,
|
||||
};
|
||||
|
|
@ -454,8 +454,8 @@ function readPiManifest(packageJsonPath: string): PiManifest | null {
|
|||
try {
|
||||
const content = fs.readFileSync(packageJsonPath, "utf-8");
|
||||
const pkg = JSON.parse(content);
|
||||
if (pkg.pi && typeof pkg.pi === "object") {
|
||||
return pkg.pi as PiManifest;
|
||||
if (pkg.companion && typeof pkg.companion === "object") {
|
||||
return pkg.companion as PiManifest;
|
||||
}
|
||||
return null;
|
||||
} catch {
|
||||
|
|
@ -471,13 +471,13 @@ function isExtensionFile(name: string): boolean {
|
|||
* Resolve extension entry points from a directory.
|
||||
*
|
||||
* Checks for:
|
||||
* 1. package.json with "pi.extensions" field -> returns declared paths
|
||||
* 1. package.json with "companion.extensions" field -> returns declared paths
|
||||
* 2. index.ts or index.js -> returns the index file
|
||||
*
|
||||
* Returns resolved paths or null if no entry points found.
|
||||
*/
|
||||
function resolveExtensionEntries(dir: string): string[] | null {
|
||||
// Check for package.json with "pi" field first
|
||||
// Check for package.json with "companion" field first
|
||||
const packageJsonPath = path.join(dir, "package.json");
|
||||
if (fs.existsSync(packageJsonPath)) {
|
||||
const manifest = readPiManifest(packageJsonPath);
|
||||
|
|
@ -514,7 +514,7 @@ function resolveExtensionEntries(dir: string): string[] | null {
|
|||
* Discovery rules:
|
||||
* 1. Direct files: `extensions/*.ts` or `*.js` → load
|
||||
* 2. Subdirectory with index: `extensions/* /index.ts` or `index.js` → load
|
||||
* 3. Subdirectory with package.json: `extensions/* /package.json` with "pi" field → load what it declares
|
||||
* 3. Subdirectory with package.json: `extensions/* /package.json` with "companion" field → load what it declares
|
||||
*
|
||||
* No recursion beyond one level. Complex packages must use package.json manifest.
|
||||
*/
|
||||
|
|
@ -577,8 +577,8 @@ export async function discoverAndLoadExtensions(
|
|||
}
|
||||
};
|
||||
|
||||
// 1. Project-local extensions: cwd/.pi/extensions/
|
||||
const localExtDir = path.join(cwd, ".pi", "extensions");
|
||||
// 1. Project-local extensions: cwd/.companion/extensions/
|
||||
const localExtDir = path.join(cwd, ".companion", "extensions");
|
||||
addPaths(discoverExtensionsInDir(localExtDir));
|
||||
|
||||
// 2. Global extensions: agentDir/extensions/
|
||||
|
|
@ -589,7 +589,7 @@ export async function discoverAndLoadExtensions(
|
|||
for (const p of configuredPaths) {
|
||||
const resolved = resolvePath(p, cwd);
|
||||
if (fs.existsSync(resolved) && fs.statSync(resolved).isDirectory()) {
|
||||
// Check for package.json with pi manifest or index.ts
|
||||
// Check for package.json with companion manifest or index.ts
|
||||
const entries = resolveExtensionEntries(resolved);
|
||||
if (entries) {
|
||||
addPaths(entries);
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
* Extension runner - executes extensions and manages their lifecycle.
|
||||
*/
|
||||
|
||||
import type { AgentMessage } from "@mariozechner/pi-agent-core";
|
||||
import type { ImageContent, Model } from "@mariozechner/pi-ai";
|
||||
import type { KeyId } from "@mariozechner/pi-tui";
|
||||
import type { AgentMessage } from "@mariozechner/companion-agent-core";
|
||||
import type { ImageContent, Model } from "@mariozechner/companion-ai";
|
||||
import type { KeyId } from "@mariozechner/companion-tui";
|
||||
import { type Theme, theme } from "../../modes/interactive/theme/theme.js";
|
||||
import type { ResourceDiagnostic } from "../diagnostics.js";
|
||||
import type { KeyAction, KeybindingsConfig } from "../keybindings.js";
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import type {
|
|||
AgentToolResult,
|
||||
AgentToolUpdateCallback,
|
||||
ThinkingLevel,
|
||||
} from "@mariozechner/pi-agent-core";
|
||||
} from "@mariozechner/companion-agent-core";
|
||||
import type {
|
||||
Api,
|
||||
AssistantMessageEvent,
|
||||
|
|
@ -26,7 +26,7 @@ import type {
|
|||
SimpleStreamOptions,
|
||||
TextContent,
|
||||
ToolResultMessage,
|
||||
} from "@mariozechner/pi-ai";
|
||||
} from "@mariozechner/companion-ai";
|
||||
import type {
|
||||
AutocompleteItem,
|
||||
Component,
|
||||
|
|
@ -36,7 +36,7 @@ import type {
|
|||
OverlayHandle,
|
||||
OverlayOptions,
|
||||
TUI,
|
||||
} from "@mariozechner/pi-tui";
|
||||
} from "@mariozechner/companion-tui";
|
||||
import type { Static, TSchema } from "@sinclair/typebox";
|
||||
import type { Theme } from "../../modes/interactive/theme/theme.js";
|
||||
import type { BashResult } from "../bash-executor.js";
|
||||
|
|
@ -223,12 +223,12 @@ export interface ExtensionUIContext {
|
|||
* - `keybindings`: KeybindingsManager for app-level keybindings
|
||||
*
|
||||
* For full app keybinding support (escape, ctrl+d, model switching, etc.),
|
||||
* extend `CustomEditor` from `@mariozechner/pi-coding-agent` and call
|
||||
* extend `CustomEditor` from `@mariozechner/companion-coding-agent` and call
|
||||
* `super.handleInput(data)` for keys you don't handle.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* import { CustomEditor } from "@mariozechner/pi-coding-agent";
|
||||
* import { CustomEditor } from "@mariozechner/companion-coding-agent";
|
||||
*
|
||||
* class VimEditor extends CustomEditor {
|
||||
* private mode: "normal" | "insert" = "insert";
|
||||
|
|
@ -316,7 +316,7 @@ export interface ExtensionContext {
|
|||
abort(): void;
|
||||
/** Whether there are queued messages waiting */
|
||||
hasPendingMessages(): boolean;
|
||||
/** Gracefully shutdown pi and exit. Available in all contexts. */
|
||||
/** Gracefully shutdown companion and exit. Available in all contexts. */
|
||||
shutdown(): void;
|
||||
/** Get current context usage for the active model. */
|
||||
getContextUsage(): ContextUsage | undefined;
|
||||
|
|
@ -1251,7 +1251,7 @@ export interface ExtensionAPI {
|
|||
*
|
||||
* @example
|
||||
* // Register a new provider with custom models
|
||||
* pi.registerProvider("my-proxy", {
|
||||
* companion.registerProvider("my-proxy", {
|
||||
* baseUrl: "https://proxy.example.com",
|
||||
* apiKey: "PROXY_API_KEY",
|
||||
* api: "anthropic-messages",
|
||||
|
|
@ -1270,13 +1270,13 @@ export interface ExtensionAPI {
|
|||
*
|
||||
* @example
|
||||
* // Override baseUrl for an existing provider
|
||||
* pi.registerProvider("anthropic", {
|
||||
* companion.registerProvider("anthropic", {
|
||||
* baseUrl: "https://proxy.example.com"
|
||||
* });
|
||||
*
|
||||
* @example
|
||||
* // Register provider with OAuth support
|
||||
* pi.registerProvider("corporate-ai", {
|
||||
* companion.registerProvider("corporate-ai", {
|
||||
* baseUrl: "https://ai.corp.com",
|
||||
* api: "openai-responses",
|
||||
* models: [...],
|
||||
|
|
@ -1301,7 +1301,7 @@ export interface ExtensionAPI {
|
|||
* the initial load phase.
|
||||
*
|
||||
* @example
|
||||
* pi.unregisterProvider("my-proxy");
|
||||
* companion.unregisterProvider("my-proxy");
|
||||
*/
|
||||
unregisterProvider(name: string): void;
|
||||
|
||||
|
|
@ -1313,7 +1313,7 @@ export interface ExtensionAPI {
|
|||
// Provider Registration Types
|
||||
// ============================================================================
|
||||
|
||||
/** Configuration for registering a provider via pi.registerProvider(). */
|
||||
/** Configuration for registering a provider via companion.registerProvider(). */
|
||||
export interface ProviderConfig {
|
||||
/** Base URL for the API endpoint. Required when defining models. */
|
||||
baseUrl?: string;
|
||||
|
|
@ -1381,7 +1381,7 @@ export interface ProviderModelConfig {
|
|||
}
|
||||
|
||||
/** Extension factory function type. Supports both sync and async initialization. */
|
||||
export type ExtensionFactory = (pi: ExtensionAPI) => void | Promise<void>;
|
||||
export type ExtensionFactory = (companion: ExtensionAPI) => void | Promise<void>;
|
||||
|
||||
// ============================================================================
|
||||
// Loaded Extension Types
|
||||
|
|
@ -1480,7 +1480,7 @@ export interface ExtensionRuntimeState {
|
|||
}
|
||||
|
||||
/**
|
||||
* Action implementations for pi.* API methods.
|
||||
* Action implementations for companion.* API methods.
|
||||
* Provided to runner.initialize(), copied into the shared runtime.
|
||||
*/
|
||||
export interface ExtensionActions {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
import type {
|
||||
AgentTool,
|
||||
AgentToolUpdateCallback,
|
||||
} from "@mariozechner/pi-agent-core";
|
||||
} from "@mariozechner/companion-agent-core";
|
||||
import type { ExtensionRunner } from "./runner.js";
|
||||
import type { RegisteredTool, ToolCallEventResult } from "./types.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { AgentMessage } from "@mariozechner/pi-agent-core";
|
||||
import type { AgentMessage } from "@mariozechner/companion-agent-core";
|
||||
import type { AgentSession } from "../agent-session.js";
|
||||
import type {
|
||||
GatewayMessageRequest,
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ let activeGatewayRuntime: GatewayRuntime | null = null;
|
|||
|
||||
type JsonRecord = Record<string, unknown>;
|
||||
|
||||
type PiChannelsSettings = JsonRecord & {
|
||||
type CompanionChannelsSettings = JsonRecord & {
|
||||
adapters?: Record<string, JsonRecord>;
|
||||
bridge?: JsonRecord;
|
||||
slack?: JsonRecord;
|
||||
|
|
@ -1031,7 +1031,7 @@ export class GatewayRuntime {
|
|||
path.slice(this.config.webhook.basePath.length).replace(/^\/+/, "") ||
|
||||
"default";
|
||||
if (this.config.webhook.secret) {
|
||||
const presentedSecret = request.headers["x-pi-webhook-secret"];
|
||||
const presentedSecret = request.headers["x-companion-webhook-secret"];
|
||||
if (presentedSecret !== this.config.webhook.secret) {
|
||||
this.writeJson(response, 401, { error: "Invalid webhook secret" });
|
||||
return;
|
||||
|
|
@ -1388,7 +1388,7 @@ export class GatewayRuntime {
|
|||
this.primarySession.settingsManager.applyOverrides(patch as Settings);
|
||||
}
|
||||
|
||||
private getPiChannelsSettings(): PiChannelsSettings {
|
||||
private getCompanionChannelsSettings(): CompanionChannelsSettings {
|
||||
const globalSettings = this.primarySession.settingsManager.getGlobalSettings();
|
||||
const projectSettings =
|
||||
this.primarySession.settingsManager.getProjectSettings();
|
||||
|
|
@ -1396,12 +1396,12 @@ export class GatewayRuntime {
|
|||
isRecord(globalSettings) ? globalSettings : {},
|
||||
isRecord(projectSettings) ? projectSettings : {},
|
||||
);
|
||||
const piChannels = mergedSettings["pi-channels"];
|
||||
return isRecord(piChannels) ? (piChannels as PiChannelsSettings) : {};
|
||||
const piChannels = mergedSettings["companion-channels"];
|
||||
return isRecord(piChannels) ? (piChannels as CompanionChannelsSettings) : {};
|
||||
}
|
||||
|
||||
private buildSlackChannelStatus(
|
||||
config: PiChannelsSettings,
|
||||
config: CompanionChannelsSettings,
|
||||
bridgeEnabled: boolean,
|
||||
): ChannelStatus {
|
||||
const adapters = isRecord(config.adapters) ? config.adapters : {};
|
||||
|
|
@ -1419,13 +1419,13 @@ export class GatewayRuntime {
|
|||
|
||||
if (hasConfig) {
|
||||
if (!adapter) {
|
||||
error = 'Slack requires `pi-channels.adapters.slack = { "type": "slack" }`.';
|
||||
error = 'Slack requires `companion-channels.adapters.slack = { "type": "slack" }`.';
|
||||
} else if (adapterType !== "slack") {
|
||||
error = 'Slack adapter type must be "slack".';
|
||||
} else if (!appToken) {
|
||||
error = "Slack requires pi-channels.slack.appToken.";
|
||||
error = "Slack requires companion-channels.slack.appToken.";
|
||||
} else if (!botToken) {
|
||||
error = "Slack requires pi-channels.slack.botToken.";
|
||||
error = "Slack requires companion-channels.slack.botToken.";
|
||||
} else {
|
||||
configured = true;
|
||||
}
|
||||
|
|
@ -1433,7 +1433,7 @@ export class GatewayRuntime {
|
|||
|
||||
if (configured && !bridgeEnabled) {
|
||||
error =
|
||||
"Slack is configured, but pi-channels.bridge.enabled is false, so messages will not reach the agent.";
|
||||
"Slack is configured, but companion-channels.bridge.enabled is false, so messages will not reach the agent.";
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
@ -1447,7 +1447,7 @@ export class GatewayRuntime {
|
|||
}
|
||||
|
||||
private buildTelegramChannelStatus(
|
||||
config: PiChannelsSettings,
|
||||
config: CompanionChannelsSettings,
|
||||
bridgeEnabled: boolean,
|
||||
): ChannelStatus {
|
||||
const adapters = isRecord(config.adapters) ? config.adapters : {};
|
||||
|
|
@ -1464,14 +1464,14 @@ export class GatewayRuntime {
|
|||
if (hasConfig) {
|
||||
if (!adapter) {
|
||||
error =
|
||||
'Telegram requires `pi-channels.adapters.telegram = { "type": "telegram", "botToken": "...", "polling": true }`.';
|
||||
'Telegram requires `companion-channels.adapters.telegram = { "type": "telegram", "botToken": "...", "polling": true }`.';
|
||||
} else if (adapterType !== "telegram") {
|
||||
error = 'Telegram adapter type must be "telegram".';
|
||||
} else if (!botToken) {
|
||||
error = "Telegram requires pi-channels.adapters.telegram.botToken.";
|
||||
error = "Telegram requires companion-channels.adapters.telegram.botToken.";
|
||||
} else if (!pollingEnabled) {
|
||||
error =
|
||||
"Telegram requires pi-channels.adapters.telegram.polling = true.";
|
||||
"Telegram requires companion-channels.adapters.telegram.polling = true.";
|
||||
} else {
|
||||
configured = true;
|
||||
}
|
||||
|
|
@ -1479,7 +1479,7 @@ export class GatewayRuntime {
|
|||
|
||||
if (configured && !bridgeEnabled) {
|
||||
error =
|
||||
"Telegram is configured, but pi-channels.bridge.enabled is false, so messages will not reach the agent.";
|
||||
"Telegram is configured, but companion-channels.bridge.enabled is false, so messages will not reach the agent.";
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
@ -1493,7 +1493,7 @@ export class GatewayRuntime {
|
|||
}
|
||||
|
||||
private handleGetChannelsStatus(): ChannelStatus[] {
|
||||
const config = this.getPiChannelsSettings();
|
||||
const config = this.getCompanionChannelsSettings();
|
||||
const bridgeEnabled = config.bridge?.enabled === true;
|
||||
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { AgentMessage } from "@mariozechner/pi-agent-core";
|
||||
import type { AgentMessage } from "@mariozechner/companion-agent-core";
|
||||
import type { HistoryMessage, HistoryPart } from "./types.js";
|
||||
|
||||
export interface GatewayTransientToolResult {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { ImageContent } from "@mariozechner/pi-ai";
|
||||
import type { ImageContent } from "@mariozechner/companion-ai";
|
||||
import type { AgentSession } from "../agent-session.js";
|
||||
|
||||
export interface GatewayConfig {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import {
|
|||
type KeyId,
|
||||
matchesKey,
|
||||
setEditorKeybindings,
|
||||
} from "@mariozechner/pi-tui";
|
||||
} from "@mariozechner/companion-tui";
|
||||
import { existsSync, readFileSync } from "fs";
|
||||
import { join } from "path";
|
||||
import { getAgentDir } from "../config.js";
|
||||
|
|
|
|||
|
|
@ -9,17 +9,17 @@ import {
|
|||
import { createRequire } from "node:module";
|
||||
import { homedir } from "node:os";
|
||||
import { basename, join, resolve } from "node:path";
|
||||
import type { AgentMessage } from "@mariozechner/pi-agent-core";
|
||||
import type { AgentMessage } from "@mariozechner/companion-agent-core";
|
||||
import {
|
||||
completeSimple,
|
||||
type Model,
|
||||
type TextContent,
|
||||
} from "@mariozechner/pi-ai";
|
||||
} from "@mariozechner/companion-ai";
|
||||
import { parseFrontmatter } from "../../utils/frontmatter.js";
|
||||
import type { SettingsManager } from "../settings-manager.js";
|
||||
import type { ReadonlySessionManager } from "../session-manager.js";
|
||||
|
||||
const DEFAULT_STORAGE_DIR = join(homedir(), ".pi", "memory");
|
||||
const DEFAULT_STORAGE_DIR = join(homedir(), ".companion", "memory");
|
||||
const MAX_EPISODE_CHARS = 4_000;
|
||||
const MAX_EPISODES = 5_000;
|
||||
const DEFAULT_CORE_TOKEN_BUDGET = 700;
|
||||
|
|
@ -1487,9 +1487,9 @@ function resolveLegacyProjectDir(
|
|||
cwd: string,
|
||||
): string | null {
|
||||
const settings = asRecord(settingsManager.getGlobalSettings()) ?? {};
|
||||
const legacySettings = asRecord(settings["pi-memory-md"]) ?? {};
|
||||
const legacySettings = asRecord(settings["companion-memory-md"]) ?? {};
|
||||
const configuredRoot =
|
||||
asString(legacySettings.localPath) ?? join(homedir(), ".pi", "memory-md");
|
||||
asString(legacySettings.localPath) ?? join(homedir(), ".companion", "memory-md");
|
||||
const legacyRoot = expandHomePath(configuredRoot);
|
||||
const legacyProjectDir = join(legacyRoot, basename(cwd));
|
||||
if (existsSync(legacyProjectDir)) {
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
* and provides a transformer to convert them to LLM-compatible messages.
|
||||
*/
|
||||
|
||||
import type { AgentMessage } from "@mariozechner/pi-agent-core";
|
||||
import type { ImageContent, Message, TextContent } from "@mariozechner/pi-ai";
|
||||
import type { AgentMessage } from "@mariozechner/companion-agent-core";
|
||||
import type { ImageContent, Message, TextContent } from "@mariozechner/companion-ai";
|
||||
|
||||
export const COMPACTION_SUMMARY_PREFIX = `The conversation history before this point was compacted into the following summary:
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ export interface CompactionSummaryMessage {
|
|||
}
|
||||
|
||||
// Extend CustomAgentMessages via declaration merging
|
||||
declare module "@mariozechner/pi-agent-core" {
|
||||
declare module "@mariozechner/companion-agent-core" {
|
||||
interface CustomAgentMessages {
|
||||
bashExecution: BashExecutionMessage;
|
||||
custom: CustomMessage;
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ import {
|
|||
registerApiProvider,
|
||||
resetApiProviders,
|
||||
type SimpleStreamOptions,
|
||||
} from "@mariozechner/pi-ai";
|
||||
} from "@mariozechner/companion-ai";
|
||||
import {
|
||||
registerOAuthProvider,
|
||||
resetOAuthProviders,
|
||||
} from "@mariozechner/pi-ai/oauth";
|
||||
} from "@mariozechner/companion-ai/oauth";
|
||||
import { type Static, Type } from "@sinclair/typebox";
|
||||
import AjvModule from "ajv";
|
||||
import { existsSync, readFileSync } from "fs";
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
* Model resolution, scoping, and initial selection
|
||||
*/
|
||||
|
||||
import type { ThinkingLevel } from "@mariozechner/pi-agent-core";
|
||||
import type { ThinkingLevel } from "@mariozechner/companion-agent-core";
|
||||
import {
|
||||
type Api,
|
||||
type KnownProvider,
|
||||
type Model,
|
||||
modelsAreEqual,
|
||||
} from "@mariozechner/pi-ai";
|
||||
} from "@mariozechner/companion-ai";
|
||||
import chalk from "chalk";
|
||||
import { minimatch } from "minimatch";
|
||||
import { isValidThinkingLevel } from "../cli/args.js";
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import type { PackageSource, SettingsManager } from "./settings-manager.js";
|
|||
const NETWORK_TIMEOUT_MS = 10000;
|
||||
|
||||
function isOfflineModeEnabled(): boolean {
|
||||
const value = process.env.PI_OFFLINE;
|
||||
const value = process.env.COMPANION_OFFLINE;
|
||||
if (!value) return false;
|
||||
return (
|
||||
value === "1" ||
|
||||
|
|
@ -445,8 +445,8 @@ function collectAutoThemeEntries(dir: string): string[] {
|
|||
function readPiManifestFile(packageJsonPath: string): PiManifest | null {
|
||||
try {
|
||||
const content = readFileSync(packageJsonPath, "utf-8");
|
||||
const pkg = JSON.parse(content) as { pi?: PiManifest };
|
||||
return pkg.pi ?? null;
|
||||
const pkg = JSON.parse(content) as { companion?: PiManifest };
|
||||
return pkg.companion ?? null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -1529,7 +1529,7 @@ export class DefaultPackageManager implements PackageManager {
|
|||
this.ensureGitIgnore(installRoot);
|
||||
const packageJsonPath = join(installRoot, "package.json");
|
||||
if (!existsSync(packageJsonPath)) {
|
||||
const pkgJson = { name: "pi-extensions", private: true };
|
||||
const pkgJson = { name: "companion-extensions", private: true };
|
||||
writeFileSync(packageJsonPath, JSON.stringify(pkgJson, null, 2), "utf-8");
|
||||
}
|
||||
}
|
||||
|
|
@ -1595,7 +1595,7 @@ export class DefaultPackageManager implements PackageManager {
|
|||
.update(`${prefix}-${suffix ?? ""}`)
|
||||
.digest("hex")
|
||||
.slice(0, 8);
|
||||
return join(tmpdir(), "pi-extensions", prefix, hash, suffix ?? "");
|
||||
return join(tmpdir(), "companion-extensions", prefix, hash, suffix ?? "");
|
||||
}
|
||||
|
||||
private getBaseDirForScope(scope: SourceScope): string {
|
||||
|
|
@ -1784,8 +1784,8 @@ export class DefaultPackageManager implements PackageManager {
|
|||
|
||||
try {
|
||||
const content = readFileSync(packageJsonPath, "utf-8");
|
||||
const pkg = JSON.parse(content) as { pi?: PiManifest };
|
||||
return pkg.pi ?? null;
|
||||
const pkg = JSON.parse(content) as { companion?: PiManifest };
|
||||
return pkg.companion ?? null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ import {
|
|||
Agent,
|
||||
type AgentMessage,
|
||||
type ThinkingLevel,
|
||||
} from "@mariozechner/pi-agent-core";
|
||||
import type { Message, Model } from "@mariozechner/pi-ai";
|
||||
} from "@mariozechner/companion-agent-core";
|
||||
import type { Message, Model } from "@mariozechner/companion-ai";
|
||||
import { getAgentDir, getDocsPath } from "../config.js";
|
||||
import { AgentSession } from "./agent-session.js";
|
||||
import { AuthStorage } from "./auth-storage.js";
|
||||
|
|
@ -52,7 +52,7 @@ import {
|
|||
export interface CreateAgentSessionOptions {
|
||||
/** Working directory for project-local discovery. Default: process.cwd() */
|
||||
cwd?: string;
|
||||
/** Global config directory. Default: ~/.pi/agent */
|
||||
/** Global config directory. Default: ~/.companion/agent */
|
||||
agentDir?: string;
|
||||
|
||||
/** Auth storage for credentials. Default: AuthStorage.create(agentDir/auth.json) */
|
||||
|
|
@ -149,7 +149,7 @@ function getDefaultAgentDir(): string {
|
|||
* const { session } = await createAgentSession();
|
||||
*
|
||||
* // With explicit model
|
||||
* import { getModel } from '@mariozechner/pi-ai';
|
||||
* import { getModel } from '@mariozechner/companion-ai';
|
||||
* const { session } = await createAgentSession({
|
||||
* model: getModel('anthropic', 'claude-opus-4-6'),
|
||||
* thinkingLevel: 'high',
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { AgentMessage } from "@mariozechner/pi-agent-core";
|
||||
import type { ImageContent, Message, TextContent } from "@mariozechner/pi-ai";
|
||||
import type { AgentMessage } from "@mariozechner/companion-agent-core";
|
||||
import type { ImageContent, Message, TextContent } from "@mariozechner/companion-ai";
|
||||
import { randomUUID } from "crypto";
|
||||
import {
|
||||
appendFileSync,
|
||||
|
|
@ -72,7 +72,7 @@ export interface CompactionEntry<T = unknown> extends SessionEntryBase {
|
|||
tokensBefore: number;
|
||||
/** Extension-specific data (e.g., ArtifactIndex, version markers for structured compaction) */
|
||||
details?: T;
|
||||
/** True if generated by an extension, undefined/false if pi-generated (backward compatible) */
|
||||
/** True if generated by an extension, undefined/false if companion-generated (backward compatible) */
|
||||
fromHook?: boolean;
|
||||
}
|
||||
|
||||
|
|
@ -82,7 +82,7 @@ export interface BranchSummaryEntry<T = unknown> extends SessionEntryBase {
|
|||
summary: string;
|
||||
/** Extension-specific data (not sent to LLM) */
|
||||
details?: T;
|
||||
/** True if generated by an extension, false if pi-generated */
|
||||
/** True if generated by an extension, false if companion-generated */
|
||||
fromHook?: boolean;
|
||||
}
|
||||
|
||||
|
|
@ -448,7 +448,7 @@ export function buildSessionContext(
|
|||
|
||||
/**
|
||||
* Compute the default session directory for a cwd.
|
||||
* Encodes cwd into a safe directory name under ~/.pi/agent/sessions/.
|
||||
* Encodes cwd into a safe directory name under ~/.companion/agent/sessions/.
|
||||
*/
|
||||
function getDefaultSessionDir(cwd: string): string {
|
||||
const safePath = `--${cwd.replace(/^[/\\]/, "").replace(/[/\\:]/g, "-")}--`;
|
||||
|
|
@ -1332,7 +1332,7 @@ export class SessionManager {
|
|||
/**
|
||||
* Create a new session.
|
||||
* @param cwd Working directory (stored in session header)
|
||||
* @param sessionDir Optional session directory. If omitted, uses default (~/.pi/agent/sessions/<encoded-cwd>/).
|
||||
* @param sessionDir Optional session directory. If omitted, uses default (~/.companion/agent/sessions/<encoded-cwd>/).
|
||||
*/
|
||||
static create(cwd: string, sessionDir?: string): SessionManager {
|
||||
const dir = sessionDir ?? getDefaultSessionDir(cwd);
|
||||
|
|
@ -1359,7 +1359,7 @@ export class SessionManager {
|
|||
/**
|
||||
* Continue the most recent session, or create new if none.
|
||||
* @param cwd Working directory
|
||||
* @param sessionDir Optional session directory. If omitted, uses default (~/.pi/agent/sessions/<encoded-cwd>/).
|
||||
* @param sessionDir Optional session directory. If omitted, uses default (~/.companion/agent/sessions/<encoded-cwd>/).
|
||||
*/
|
||||
static continueRecent(cwd: string, sessionDir?: string): SessionManager {
|
||||
const dir = sessionDir ?? getDefaultSessionDir(cwd);
|
||||
|
|
@ -1438,7 +1438,7 @@ export class SessionManager {
|
|||
/**
|
||||
* List all sessions for a directory.
|
||||
* @param cwd Working directory (used to compute default session directory)
|
||||
* @param sessionDir Optional session directory. If omitted, uses default (~/.pi/agent/sessions/<encoded-cwd>/).
|
||||
* @param sessionDir Optional session directory. If omitted, uses default (~/.companion/agent/sessions/<encoded-cwd>/).
|
||||
* @param onProgress Optional callback for progress updates (loaded, total)
|
||||
*/
|
||||
static async list(
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { Transport } from "@mariozechner/pi-ai";
|
||||
import type { Transport } from "@mariozechner/companion-ai";
|
||||
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
||||
import { dirname, join } from "path";
|
||||
import lockfile from "proper-lockfile";
|
||||
|
|
@ -944,7 +944,7 @@ export class SettingsManager {
|
|||
if (this.settings.terminal?.clearOnShrink !== undefined) {
|
||||
return this.settings.terminal.clearOnShrink;
|
||||
}
|
||||
return process.env.PI_CLEAR_ON_SHRINK === "1";
|
||||
return process.env.COMPANION_CLEAR_ON_SHRINK === "1";
|
||||
}
|
||||
|
||||
setClearOnShrink(enabled: boolean): void {
|
||||
|
|
@ -1023,7 +1023,7 @@ export class SettingsManager {
|
|||
|
||||
getShowHardwareCursor(): boolean {
|
||||
return (
|
||||
this.settings.showHardwareCursor ?? process.env.PI_HARDWARE_CURSOR === "1"
|
||||
this.settings.showHardwareCursor ?? process.env.COMPANION_HARDWARE_CURSOR === "1"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -361,7 +361,7 @@ function escapeXml(str: string): string {
|
|||
export interface LoadSkillsOptions {
|
||||
/** Working directory for project-local skills. Default: process.cwd() */
|
||||
cwd?: string;
|
||||
/** Agent config directory for global skills. Default: ~/.pi/agent */
|
||||
/** Agent config directory for global skills. Default: ~/.companion/agent */
|
||||
agentDir?: string;
|
||||
/** Explicit skill paths (files or directories) */
|
||||
skillPaths?: string[];
|
||||
|
|
|
|||
|
|
@ -40,5 +40,5 @@ export const BUILTIN_SLASH_COMMANDS: ReadonlyArray<BuiltinSlashCommand> = [
|
|||
name: "reload",
|
||||
description: "Reload extensions, skills, prompts, and themes",
|
||||
},
|
||||
{ name: "quit", description: "Quit pi" },
|
||||
{ name: "quit", description: "Quit companion" },
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
/**
|
||||
* Central timing instrumentation for startup profiling.
|
||||
* Enable with PI_TIMING=1 environment variable.
|
||||
* Enable with COMPANION_TIMING=1 environment variable.
|
||||
*/
|
||||
|
||||
const ENABLED = process.env.PI_TIMING === "1";
|
||||
const ENABLED = process.env.COMPANION_TIMING === "1";
|
||||
const timings: Array<{ label: string; ms: number }> = [];
|
||||
let lastTime = Date.now();
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { randomBytes } from "node:crypto";
|
|||
import { createWriteStream, existsSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import type { AgentTool } from "@mariozechner/pi-agent-core";
|
||||
import type { AgentTool } from "@mariozechner/companion-agent-core";
|
||||
import { type Static, Type } from "@sinclair/typebox";
|
||||
import { spawn } from "child_process";
|
||||
import {
|
||||
|
|
@ -23,7 +23,7 @@ import {
|
|||
*/
|
||||
function getTempFilePath(): string {
|
||||
const id = randomBytes(8).toString("hex");
|
||||
return join(tmpdir(), `pi-bash-${id}.log`);
|
||||
return join(tmpdir(), `companion-bash-${id}.log`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { randomBytes } from "node:crypto";
|
|||
import { existsSync, mkdirSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join, resolve } from "node:path";
|
||||
import type { AgentTool } from "@mariozechner/pi-agent-core";
|
||||
import type { AgentTool } from "@mariozechner/companion-agent-core";
|
||||
import { type Static, Type } from "@sinclair/typebox";
|
||||
import { getAgentDir } from "../../config.js";
|
||||
import {
|
||||
|
|
@ -28,7 +28,7 @@ const browserSnapshotModes = ["interactive", "full"] as const;
|
|||
const browserLoadStates = ["load", "domcontentloaded", "networkidle"] as const;
|
||||
|
||||
const DEFAULT_BROWSER_COMMAND =
|
||||
process.env.PI_AGENT_BROWSER_COMMAND || "agent-browser";
|
||||
process.env.COMPANION_AGENT_BROWSER_COMMAND || "agent-browser";
|
||||
const DEFAULT_BROWSER_TIMEOUT_SECONDS = 90;
|
||||
|
||||
const browserSchema = Type.Object({
|
||||
|
|
@ -78,7 +78,7 @@ const browserSchema = Type.Object({
|
|||
stateName: Type.Optional(
|
||||
Type.String({
|
||||
description:
|
||||
"Named browser state checkpoint stored under ~/.pi/agent/browser/states/",
|
||||
"Named browser state checkpoint stored under ~/.companion/agent/browser/states/",
|
||||
}),
|
||||
),
|
||||
});
|
||||
|
|
@ -230,7 +230,7 @@ function getBrowserStateDir(cwd: string, options?: BrowserToolOptions): string {
|
|||
|
||||
function createTempScreenshotPath(): string {
|
||||
const id = randomBytes(8).toString("hex");
|
||||
return join(tmpdir(), `pi-browser-screenshot-${id}.png`);
|
||||
return join(tmpdir(), `companion-browser-screenshot-${id}.png`);
|
||||
}
|
||||
|
||||
function normalizeOutput(chunks: Buffer[]): string {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { AgentTool } from "@mariozechner/pi-agent-core";
|
||||
import type { AgentTool } from "@mariozechner/companion-agent-core";
|
||||
import { type Static, Type } from "@sinclair/typebox";
|
||||
import { constants } from "fs";
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { AgentTool } from "@mariozechner/pi-agent-core";
|
||||
import type { AgentTool } from "@mariozechner/companion-agent-core";
|
||||
import { type Static, Type } from "@sinclair/typebox";
|
||||
import { spawnSync } from "child_process";
|
||||
import { existsSync } from "fs";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { createInterface } from "node:readline";
|
||||
import type { AgentTool } from "@mariozechner/pi-agent-core";
|
||||
import type { AgentTool } from "@mariozechner/companion-agent-core";
|
||||
import { type Static, Type } from "@sinclair/typebox";
|
||||
import { spawn } from "child_process";
|
||||
import { readFileSync, statSync } from "fs";
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ export {
|
|||
writeTool,
|
||||
} from "./write.js";
|
||||
|
||||
import type { AgentTool } from "@mariozechner/pi-agent-core";
|
||||
import type { AgentTool } from "@mariozechner/companion-agent-core";
|
||||
import { type BashToolOptions, bashTool, createBashTool } from "./bash.js";
|
||||
import {
|
||||
browserTool,
|
||||
|
|
@ -91,7 +91,7 @@ import { createLsTool, lsTool } from "./ls.js";
|
|||
import { createReadTool, type ReadToolOptions, readTool } from "./read.js";
|
||||
import { createWriteTool, writeTool } from "./write.js";
|
||||
|
||||
/** Tool type (AgentTool from pi-ai) */
|
||||
/** Tool type (AgentTool from companion-ai) */
|
||||
export type Tool = AgentTool<any>;
|
||||
|
||||
// Read-only tools for exploration without modification (using process.cwd())
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { AgentTool } from "@mariozechner/pi-agent-core";
|
||||
import type { AgentTool } from "@mariozechner/companion-agent-core";
|
||||
import { type Static, Type } from "@sinclair/typebox";
|
||||
import { existsSync, readdirSync, statSync } from "fs";
|
||||
import nodePath from "path";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { AgentTool } from "@mariozechner/pi-agent-core";
|
||||
import type { ImageContent, TextContent } from "@mariozechner/pi-ai";
|
||||
import type { AgentTool } from "@mariozechner/companion-agent-core";
|
||||
import type { ImageContent, TextContent } from "@mariozechner/companion-ai";
|
||||
import { type Static, Type } from "@sinclair/typebox";
|
||||
import { constants } from "fs";
|
||||
import { access as fsAccess, readFile as fsReadFile } from "fs/promises";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { AgentTool } from "@mariozechner/pi-agent-core";
|
||||
import type { AgentTool } from "@mariozechner/companion-agent-core";
|
||||
import { type Static, Type } from "@sinclair/typebox";
|
||||
import { mkdir as fsMkdir, writeFile as fsWriteFile } from "fs/promises";
|
||||
import { dirname } from "path";
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import {
|
|||
type ImageContent,
|
||||
modelsAreEqual,
|
||||
supportsXhigh,
|
||||
} from "@mariozechner/pi-ai";
|
||||
} from "@mariozechner/companion-ai";
|
||||
import chalk from "chalk";
|
||||
import { createInterface } from "readline";
|
||||
import { type Args, parseArgs, printHelp } from "./cli/args.js";
|
||||
|
|
@ -123,7 +123,7 @@ function printDaemonHelp(): void {
|
|||
${APP_NAME} gateway [options] [messages...]
|
||||
${APP_NAME} daemon [options] [messages...]
|
||||
|
||||
Run pi as a long-lived gateway (non-interactive) with extensions enabled.
|
||||
Run companion as a long-lived gateway (non-interactive) with extensions enabled.
|
||||
Messages passed as positional args are sent once at startup.
|
||||
|
||||
Options:
|
||||
|
|
@ -154,7 +154,7 @@ function printPackageCommandHelp(command: PackageCommand): void {
|
|||
Install a package and add it to settings.
|
||||
|
||||
Options:
|
||||
-l, --local Install project-locally (.pi/settings.json)
|
||||
-l, --local Install project-locally (.companion/settings.json)
|
||||
|
||||
Examples:
|
||||
${APP_NAME} install npm:@foo/bar
|
||||
|
|
@ -173,7 +173,7 @@ Examples:
|
|||
Remove a package and its source from settings.
|
||||
|
||||
Options:
|
||||
-l, --local Remove from project settings (.pi/settings.json)
|
||||
-l, --local Remove from project settings (.companion/settings.json)
|
||||
|
||||
Example:
|
||||
${APP_NAME} remove npm:@foo/bar
|
||||
|
|
@ -661,10 +661,10 @@ export async function main(args: string[]) {
|
|||
const isGatewayCommand = args[0] === "daemon" || args[0] === "gateway";
|
||||
const parsedArgs = isGatewayCommand ? args.slice(1) : args;
|
||||
const offlineMode =
|
||||
parsedArgs.includes("--offline") || isTruthyEnvFlag(process.env.PI_OFFLINE);
|
||||
parsedArgs.includes("--offline") || isTruthyEnvFlag(process.env.COMPANION_OFFLINE);
|
||||
if (offlineMode) {
|
||||
process.env.PI_OFFLINE = "1";
|
||||
process.env.PI_SKIP_VERSION_CHECK = "1";
|
||||
process.env.COMPANION_OFFLINE = "1";
|
||||
process.env.COMPANION_SKIP_VERSION_CHECK = "1";
|
||||
}
|
||||
|
||||
if (await handlePackageCommand(args)) {
|
||||
|
|
@ -993,7 +993,7 @@ export async function main(args: string[]) {
|
|||
} catch (error) {
|
||||
const message =
|
||||
error instanceof Error ? error.stack || error.message : String(error);
|
||||
console.error(`[pi-gateway] daemon crashed: ${message}`);
|
||||
console.error(`[companion-gateway] daemon crashed: ${message}`);
|
||||
try {
|
||||
session.dispose();
|
||||
} catch {
|
||||
|
|
@ -1005,20 +1005,20 @@ export async function main(args: string[]) {
|
|||
if (runtimeMs < GATEWAY_MIN_RUNTIME_MS) {
|
||||
consecutiveFailures += 1;
|
||||
console.error(
|
||||
`[pi-gateway] exited quickly (${runtimeMs}ms), failure ${consecutiveFailures}/${GATEWAY_MAX_CONSECUTIVE_FAILURES}`,
|
||||
`[companion-gateway] exited quickly (${runtimeMs}ms), failure ${consecutiveFailures}/${GATEWAY_MAX_CONSECUTIVE_FAILURES}`,
|
||||
);
|
||||
if (consecutiveFailures >= GATEWAY_MAX_CONSECUTIVE_FAILURES) {
|
||||
console.error("[pi-gateway] crash loop detected, exiting");
|
||||
console.error("[companion-gateway] crash loop detected, exiting");
|
||||
process.exit(1);
|
||||
}
|
||||
} else {
|
||||
consecutiveFailures = 0;
|
||||
console.error(`[pi-gateway] exited after ${runtimeMs}ms, restarting`);
|
||||
console.error(`[companion-gateway] exited after ${runtimeMs}ms, restarting`);
|
||||
}
|
||||
|
||||
if (GATEWAY_RESTART_DELAY_MS > 0) {
|
||||
console.error(
|
||||
`[pi-gateway] restarting in ${GATEWAY_RESTART_DELAY_MS}ms`,
|
||||
`[companion-gateway] restarting in ${GATEWAY_RESTART_DELAY_MS}ms`,
|
||||
);
|
||||
await sleep(GATEWAY_RESTART_DELAY_MS);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@ import { dirname, join } from "path";
|
|||
import { CONFIG_DIR_NAME, getAgentDir, getBinDir } from "./config.js";
|
||||
|
||||
const MIGRATION_GUIDE_URL =
|
||||
"https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/CHANGELOG.md#extensions-migration";
|
||||
"https://github.com/badlogic/companion-mono/blob/main/packages/coding-agent/CHANGELOG.md#extensions-migration";
|
||||
const EXTENSIONS_DOC_URL =
|
||||
"https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/extensions.md";
|
||||
"https://github.com/badlogic/companion-mono/blob/main/packages/coding-agent/docs/extensions.md";
|
||||
|
||||
/**
|
||||
* Migrate legacy oauth.json and settings.json apiKeys to auth.json.
|
||||
|
|
@ -80,13 +80,13 @@ export function migrateAuthToAuthJson(): string[] {
|
|||
}
|
||||
|
||||
/**
|
||||
* Migrate sessions from ~/.pi/agent/*.jsonl to proper session directories.
|
||||
* Migrate sessions from ~/.companion/agent/*.jsonl to proper session directories.
|
||||
*
|
||||
* Bug in v0.30.0: Sessions were saved to ~/.pi/agent/ instead of
|
||||
* ~/.pi/agent/sessions/<encoded-cwd>/. This migration moves them
|
||||
* Bug in v0.30.0: Sessions were saved to ~/.companion/agent/ instead of
|
||||
* ~/.companion/agent/sessions/<encoded-cwd>/. This migration moves them
|
||||
* to the correct location based on the cwd in their session header.
|
||||
*
|
||||
* See: https://github.com/badlogic/pi-mono/issues/320
|
||||
* See: https://github.com/badlogic/companion-mono/issues/320
|
||||
*/
|
||||
export function migrateSessionsFromAgentRoot(): void {
|
||||
const agentDir = getAgentDir();
|
||||
|
|
@ -207,7 +207,7 @@ function migrateToolsToBin(): void {
|
|||
|
||||
/**
|
||||
* Check for deprecated hooks/ and tools/ directories.
|
||||
* Note: tools/ may contain fd/rg binaries extracted by pi, so only warn if it has other files.
|
||||
* Note: tools/ may contain fd/rg binaries extracted by companion, so only warn if it has other files.
|
||||
*/
|
||||
function checkDeprecatedExtensionDirs(
|
||||
baseDir: string,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* until explicitly stopped.
|
||||
*/
|
||||
|
||||
import type { ImageContent } from "@mariozechner/pi-ai";
|
||||
import type { ImageContent } from "@mariozechner/companion-ai";
|
||||
import type { AgentSession } from "../core/agent-session.js";
|
||||
import {
|
||||
GatewayRuntime,
|
||||
|
|
@ -98,13 +98,13 @@ export async function runDaemonMode(
|
|||
resolveReady = resolve;
|
||||
});
|
||||
const gatewayBind =
|
||||
process.env.PI_GATEWAY_BIND ?? options.gateway.bind ?? "127.0.0.1";
|
||||
process.env.COMPANION_GATEWAY_BIND ?? options.gateway.bind ?? "127.0.0.1";
|
||||
const gatewayPort =
|
||||
Number.parseInt(process.env.PI_GATEWAY_PORT ?? "", 10) ||
|
||||
Number.parseInt(process.env.COMPANION_GATEWAY_PORT ?? "", 10) ||
|
||||
options.gateway.port ||
|
||||
8787;
|
||||
const gatewayToken =
|
||||
process.env.PI_GATEWAY_TOKEN ?? options.gateway.bearerToken;
|
||||
process.env.COMPANION_GATEWAY_TOKEN ?? options.gateway.bearerToken;
|
||||
const gateway = new GatewayRuntime({
|
||||
config: {
|
||||
bind: gatewayBind,
|
||||
|
|
@ -118,7 +118,7 @@ export async function runDaemonMode(
|
|||
enabled: options.gateway.webhook?.enabled ?? true,
|
||||
basePath: options.gateway.webhook?.basePath ?? "/webhooks",
|
||||
secret:
|
||||
process.env.PI_GATEWAY_WEBHOOK_SECRET ??
|
||||
process.env.COMPANION_GATEWAY_WEBHOOK_SECRET ??
|
||||
options.gateway.webhook?.secret,
|
||||
},
|
||||
},
|
||||
|
|
@ -126,7 +126,7 @@ export async function runDaemonMode(
|
|||
primarySession: session,
|
||||
createSession: options.createSession,
|
||||
log: (message) => {
|
||||
console.error(`[pi-gateway] ${message}`);
|
||||
console.error(`[companion-gateway] ${message}`);
|
||||
},
|
||||
});
|
||||
setActiveGatewayRuntime(gateway);
|
||||
|
|
@ -135,7 +135,7 @@ export async function runDaemonMode(
|
|||
if (isShuttingDown) return;
|
||||
isShuttingDown = true;
|
||||
|
||||
console.error(`[pi-gateway] shutdown requested: ${reason}`);
|
||||
console.error(`[companion-gateway] shutdown requested: ${reason}`);
|
||||
setActiveGatewayRuntime(null);
|
||||
await gateway.stop();
|
||||
|
||||
|
|
@ -151,7 +151,7 @@ export async function runDaemonMode(
|
|||
const handleShutdownSignal = (signal: NodeJS.Signals) => {
|
||||
void shutdown("signal").catch((error) => {
|
||||
console.error(
|
||||
`[pi-gateway] shutdown failed for ${signal}: ${error instanceof Error ? error.message : String(error)}`,
|
||||
`[companion-gateway] shutdown failed for ${signal}: ${error instanceof Error ? error.message : String(error)}`,
|
||||
);
|
||||
resolveReady({ reason: "shutdown" });
|
||||
});
|
||||
|
|
@ -162,7 +162,7 @@ export async function runDaemonMode(
|
|||
const sighupHandler = () => handleShutdownSignal("SIGHUP");
|
||||
const unhandledRejectionHandler = (error: unknown) => {
|
||||
console.error(
|
||||
`[pi-gateway] unhandled rejection: ${error instanceof Error ? error.message : String(error)}`,
|
||||
`[companion-gateway] unhandled rejection: ${error instanceof Error ? error.message : String(error)}`,
|
||||
);
|
||||
};
|
||||
|
||||
|
|
@ -177,7 +177,7 @@ export async function runDaemonMode(
|
|||
shutdownHandler: () => {
|
||||
void shutdown("extension").catch((error) => {
|
||||
console.error(
|
||||
`[pi-gateway] extension shutdown failed: ${error instanceof Error ? error.message : String(error)}`,
|
||||
`[companion-gateway] extension shutdown failed: ${error instanceof Error ? error.message : String(error)}`,
|
||||
);
|
||||
resolveReady({ reason: "shutdown" });
|
||||
});
|
||||
|
|
@ -208,7 +208,7 @@ export async function runDaemonMode(
|
|||
|
||||
await gateway.start();
|
||||
console.error(
|
||||
`[pi-gateway] startup complete (session=${session.sessionId ?? "unknown"}, bind=${gatewayBind}, port=${gatewayPort})`,
|
||||
`[companion-gateway] startup complete (session=${session.sessionId ?? "unknown"}, bind=${gatewayBind}, port=${gatewayPort})`,
|
||||
);
|
||||
|
||||
// Keep process alive forever.
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Armin says hi! A fun easter egg with animated XBM art.
|
||||
*/
|
||||
|
||||
import type { Component, TUI } from "@mariozechner/pi-tui";
|
||||
import type { Component, TUI } from "@mariozechner/companion-tui";
|
||||
import { theme } from "../theme/theme.js";
|
||||
|
||||
// XBM image: 31x36 pixels, LSB first, 1=background, 0=foreground
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import type { AssistantMessage } from "@mariozechner/pi-ai";
|
||||
import type { AssistantMessage } from "@mariozechner/companion-ai";
|
||||
import {
|
||||
Container,
|
||||
Markdown,
|
||||
type MarkdownTheme,
|
||||
Spacer,
|
||||
Text,
|
||||
} from "@mariozechner/pi-tui";
|
||||
} from "@mariozechner/companion-tui";
|
||||
import { getMarkdownTheme, theme } from "../theme/theme.js";
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import {
|
|||
Spacer,
|
||||
Text,
|
||||
type TUI,
|
||||
} from "@mariozechner/pi-tui";
|
||||
} from "@mariozechner/companion-tui";
|
||||
import stripAnsi from "strip-ansi";
|
||||
import {
|
||||
DEFAULT_MAX_BYTES,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import {
|
|||
Spacer,
|
||||
Text,
|
||||
type TUI,
|
||||
} from "@mariozechner/pi-tui";
|
||||
} from "@mariozechner/companion-tui";
|
||||
import type { Theme } from "../theme/theme.js";
|
||||
import { DynamicBorder } from "./dynamic-border.js";
|
||||
import { keyHint } from "./keybinding-hints.js";
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import {
|
|||
type MarkdownTheme,
|
||||
Spacer,
|
||||
Text,
|
||||
} from "@mariozechner/pi-tui";
|
||||
} from "@mariozechner/companion-tui";
|
||||
import type { BranchSummaryMessage } from "../../../core/messages.js";
|
||||
import { getMarkdownTheme, theme } from "../theme/theme.js";
|
||||
import { editorKey } from "./keybinding-hints.js";
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import {
|
|||
type MarkdownTheme,
|
||||
Spacer,
|
||||
Text,
|
||||
} from "@mariozechner/pi-tui";
|
||||
} from "@mariozechner/companion-tui";
|
||||
import type { CompactionSummaryMessage } from "../../../core/messages.js";
|
||||
import { getMarkdownTheme, theme } from "../theme/theme.js";
|
||||
import { editorKey } from "./keybinding-hints.js";
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import {
|
|||
Spacer,
|
||||
truncateToWidth,
|
||||
visibleWidth,
|
||||
} from "@mariozechner/pi-tui";
|
||||
} from "@mariozechner/companion-tui";
|
||||
import { CONFIG_DIR_NAME } from "../../../config.js";
|
||||
import type {
|
||||
PathMetadata,
|
||||
|
|
@ -68,7 +68,7 @@ function getGroupLabel(metadata: PathMetadata): string {
|
|||
}
|
||||
// Top-level resources
|
||||
if (metadata.source === "auto") {
|
||||
return metadata.scope === "user" ? "User (~/.pi/agent/)" : "Project (.pi/)";
|
||||
return metadata.scope === "user" ? "User (~/.companion/agent/)" : "Project (.companion/)";
|
||||
}
|
||||
return metadata.scope === "user" ? "User settings" : "Project settings";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Reusable countdown timer for dialog components.
|
||||
*/
|
||||
|
||||
import type { TUI } from "@mariozechner/pi-tui";
|
||||
import type { TUI } from "@mariozechner/companion-tui";
|
||||
|
||||
export class CountdownTimer {
|
||||
private intervalId: ReturnType<typeof setInterval> | undefined;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import {
|
|||
type EditorOptions,
|
||||
type EditorTheme,
|
||||
type TUI,
|
||||
} from "@mariozechner/pi-tui";
|
||||
} from "@mariozechner/companion-tui";
|
||||
import type {
|
||||
AppAction,
|
||||
KeybindingsManager,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { TextContent } from "@mariozechner/pi-ai";
|
||||
import type { Component } from "@mariozechner/pi-tui";
|
||||
import type { TextContent } from "@mariozechner/companion-ai";
|
||||
import type { Component } from "@mariozechner/companion-tui";
|
||||
import {
|
||||
Box,
|
||||
Container,
|
||||
|
|
@ -7,7 +7,7 @@ import {
|
|||
type MarkdownTheme,
|
||||
Spacer,
|
||||
Text,
|
||||
} from "@mariozechner/pi-tui";
|
||||
} from "@mariozechner/companion-tui";
|
||||
import type { MessageRenderer } from "../../../core/extensions/types.js";
|
||||
import type { CustomMessage } from "../../../core/messages.js";
|
||||
import { getMarkdownTheme, theme } from "../theme/theme.js";
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* A heartfelt tribute to dax (@thdxr) for providing free Kimi K2.5 access via OpenCode.
|
||||
*/
|
||||
|
||||
import type { Component, TUI } from "@mariozechner/pi-tui";
|
||||
import type { Component, TUI } from "@mariozechner/companion-tui";
|
||||
import { theme } from "../theme/theme.js";
|
||||
|
||||
// 32x32 RGB image of dax, hex encoded (3 bytes per pixel)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { Component } from "@mariozechner/pi-tui";
|
||||
import type { Component } from "@mariozechner/companion-tui";
|
||||
import { theme } from "../theme/theme.js";
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import {
|
|||
Spacer,
|
||||
Text,
|
||||
type TUI,
|
||||
} from "@mariozechner/pi-tui";
|
||||
} from "@mariozechner/companion-tui";
|
||||
import type { KeybindingsManager } from "../../../core/keybindings.js";
|
||||
import { getEditorTheme, theme } from "../theme/theme.js";
|
||||
import { DynamicBorder } from "./dynamic-border.js";
|
||||
|
|
@ -121,7 +121,7 @@ export class ExtensionEditorComponent extends Container implements Focusable {
|
|||
const currentText = this.editor.getText();
|
||||
const tmpFile = path.join(
|
||||
os.tmpdir(),
|
||||
`pi-extension-editor-${Date.now()}.md`,
|
||||
`companion-extension-editor-${Date.now()}.md`,
|
||||
);
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import {
|
|||
Spacer,
|
||||
Text,
|
||||
type TUI,
|
||||
} from "@mariozechner/pi-tui";
|
||||
} from "@mariozechner/companion-tui";
|
||||
import { theme } from "../theme/theme.js";
|
||||
import { CountdownTimer } from "./countdown-timer.js";
|
||||
import { DynamicBorder } from "./dynamic-border.js";
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import {
|
|||
Spacer,
|
||||
Text,
|
||||
type TUI,
|
||||
} from "@mariozechner/pi-tui";
|
||||
} from "@mariozechner/companion-tui";
|
||||
import { theme } from "../theme/theme.js";
|
||||
import { CountdownTimer } from "./countdown-timer.js";
|
||||
import { DynamicBorder } from "./dynamic-border.js";
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import {
|
|||
type Component,
|
||||
truncateToWidth,
|
||||
visibleWidth,
|
||||
} from "@mariozechner/pi-tui";
|
||||
} from "@mariozechner/companion-tui";
|
||||
import type { AgentSession } from "../../../core/agent-session.js";
|
||||
import type { ReadonlyFooterDataProvider } from "../../../core/footer-data-provider.js";
|
||||
import { theme } from "../theme/theme.js";
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import {
|
|||
type EditorAction,
|
||||
getEditorKeybindings,
|
||||
type KeyId,
|
||||
} from "@mariozechner/pi-tui";
|
||||
} from "@mariozechner/companion-tui";
|
||||
import type {
|
||||
AppAction,
|
||||
KeybindingsManager,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { getOAuthProviders } from "@mariozechner/pi-ai/oauth";
|
||||
import { getOAuthProviders } from "@mariozechner/companion-ai/oauth";
|
||||
import {
|
||||
Container,
|
||||
type Focusable,
|
||||
|
|
@ -7,7 +7,7 @@ import {
|
|||
Spacer,
|
||||
Text,
|
||||
type TUI,
|
||||
} from "@mariozechner/pi-tui";
|
||||
} from "@mariozechner/companion-tui";
|
||||
import { exec } from "child_process";
|
||||
import { theme } from "../theme/theme.js";
|
||||
import { DynamicBorder } from "./dynamic-border.js";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { type Model, modelsAreEqual } from "@mariozechner/pi-ai";
|
||||
import { type Model, modelsAreEqual } from "@mariozechner/companion-ai";
|
||||
import {
|
||||
Container,
|
||||
type Focusable,
|
||||
|
|
@ -8,7 +8,7 @@ import {
|
|||
Spacer,
|
||||
Text,
|
||||
type TUI,
|
||||
} from "@mariozechner/pi-tui";
|
||||
} from "@mariozechner/companion-tui";
|
||||
import type { ModelRegistry } from "../../../core/model-registry.js";
|
||||
import type { SettingsManager } from "../../../core/settings-manager.js";
|
||||
import { theme } from "../theme/theme.js";
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import type { OAuthProviderInterface } from "@mariozechner/pi-ai";
|
||||
import { getOAuthProviders } from "@mariozechner/pi-ai/oauth";
|
||||
import type { OAuthProviderInterface } from "@mariozechner/companion-ai";
|
||||
import { getOAuthProviders } from "@mariozechner/companion-ai/oauth";
|
||||
import {
|
||||
Container,
|
||||
getEditorKeybindings,
|
||||
Spacer,
|
||||
TruncatedText,
|
||||
} from "@mariozechner/pi-tui";
|
||||
} from "@mariozechner/companion-tui";
|
||||
import type { AuthStorage } from "../../../core/auth-storage.js";
|
||||
import { theme } from "../theme/theme.js";
|
||||
import { DynamicBorder } from "./dynamic-border.js";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { Model } from "@mariozechner/pi-ai";
|
||||
import type { Model } from "@mariozechner/companion-ai";
|
||||
import {
|
||||
Container,
|
||||
type Focusable,
|
||||
|
|
@ -9,7 +9,7 @@ import {
|
|||
matchesKey,
|
||||
Spacer,
|
||||
Text,
|
||||
} from "@mariozechner/pi-tui";
|
||||
} from "@mariozechner/companion-tui";
|
||||
import { theme } from "../theme/theme.js";
|
||||
import { DynamicBorder } from "./dynamic-border.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { fuzzyMatch } from "@mariozechner/pi-tui";
|
||||
import { fuzzyMatch } from "@mariozechner/companion-tui";
|
||||
import type { SessionInfo } from "../../../core/session-manager.js";
|
||||
|
||||
export type SortMode = "threaded" | "recent" | "relevance";
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import {
|
|||
Text,
|
||||
truncateToWidth,
|
||||
visibleWidth,
|
||||
} from "@mariozechner/pi-tui";
|
||||
} from "@mariozechner/companion-tui";
|
||||
import { KeybindingsManager } from "../../../core/keybindings.js";
|
||||
import type {
|
||||
SessionInfo,
|
||||
|
|
@ -607,7 +607,7 @@ class SessionList implements Component, Focusable {
|
|||
void this.onDeleteSession?.(pathToDelete);
|
||||
return;
|
||||
}
|
||||
// Allow both Escape and Ctrl+C to cancel (consistent with pi UX)
|
||||
// Allow both Escape and Ctrl+C to cancel (consistent with companion UX)
|
||||
if (
|
||||
kb.matches(keyData, "selectCancel") ||
|
||||
matchesKey(keyData, "ctrl+c")
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { ThinkingLevel } from "@mariozechner/pi-agent-core";
|
||||
import type { Transport } from "@mariozechner/pi-ai";
|
||||
import type { ThinkingLevel } from "@mariozechner/companion-agent-core";
|
||||
import type { Transport } from "@mariozechner/companion-ai";
|
||||
import {
|
||||
Container,
|
||||
getCapabilities,
|
||||
|
|
@ -9,7 +9,7 @@ import {
|
|||
SettingsList,
|
||||
Spacer,
|
||||
Text,
|
||||
} from "@mariozechner/pi-tui";
|
||||
} from "@mariozechner/companion-tui";
|
||||
import {
|
||||
getSelectListTheme,
|
||||
getSettingsListTheme,
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue