@astralyn/pi 0.81.1-1 → 0.81.1-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +677 -677
- package/dist/cli.js +0 -0
- package/dist/core/tools/bash-command-summary.d.ts +7 -0
- package/dist/core/tools/bash-command-summary.d.ts.map +1 -0
- package/dist/core/tools/bash-command-summary.js +261 -0
- package/dist/core/tools/bash-command-summary.js.map +1 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +101 -11
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/rpc-entry.js +0 -0
- package/docs/compaction.md +401 -401
- package/docs/containerization.md +111 -111
- package/docs/custom-provider.md +763 -763
- package/docs/extensions.md +2953 -2953
- package/docs/index.md +77 -77
- package/docs/packages.md +228 -228
- package/docs/quickstart.md +165 -165
- package/docs/rpc.md +1559 -1559
- package/docs/sdk.md +1186 -1186
- package/docs/session-format.md +436 -436
- package/docs/termux.md +127 -127
- package/docs/tui.md +942 -942
- package/examples/extensions/README.md +213 -213
- package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
- package/examples/extensions/doom-overlay/doom/build.sh +0 -0
- package/examples/sdk/README.md +140 -140
- package/npm-shrinkwrap.json +2 -2
- package/package.json +6 -1
package/docs/index.md
CHANGED
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
# Pi Documentation
|
|
2
|
-
|
|
3
|
-
Pi is a minimal terminal coding harness. It is designed to stay small at the core while being extended through TypeScript extensions, skills, prompt templates, themes, and pi packages.
|
|
4
|
-
|
|
5
|
-
## Quick start
|
|
6
|
-
|
|
7
|
-
Install Pi with npm:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install -g --ignore-scripts @astralyn/pi
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
`--ignore-scripts` disables dependency lifecycle scripts during install. Pi does not require install scripts for normal npm installs.
|
|
14
|
-
|
|
15
|
-
To uninstall the npm package:
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npm uninstall -g @astralyn/pi
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
For pnpm, Yarn, or Bun installs, use the matching global remove command: `pnpm remove -g @astralyn/pi`, `yarn global remove @astralyn/pi`, or `bun uninstall -g @astralyn/pi`.
|
|
22
|
-
|
|
23
|
-
Then run it in a project directory:
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
pi
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Authenticate with `/login` for subscription providers, or set an API key such as `ANTHROPIC_API_KEY` before starting pi.
|
|
30
|
-
|
|
31
|
-
For the full first-run flow, see [Quickstart](quickstart.md).
|
|
32
|
-
|
|
33
|
-
## Start here
|
|
34
|
-
|
|
35
|
-
- [Quickstart](quickstart.md) - install, authenticate, and run a first session.
|
|
36
|
-
- [Using Pi](usage.md) - interactive mode, slash commands, context files, and CLI reference.
|
|
37
|
-
- [Providers](providers.md) - subscription and API-key setup for built-in providers.
|
|
38
|
-
- [llama.cpp](llama-cpp.md) - run a local router and manage models with `/llama`.
|
|
39
|
-
- [Security](security.md) - project trust, sandbox boundaries, and vulnerability reporting.
|
|
40
|
-
- [Containerization](containerization.md) - sandbox pi with Gondolin, Docker, or OpenShell.
|
|
41
|
-
- [Settings](settings.md) - global and project settings.
|
|
42
|
-
- [Keybindings](keybindings.md) - default shortcuts and custom keybindings.
|
|
43
|
-
- [Sessions](sessions.md) - session management, branching, and tree navigation.
|
|
44
|
-
- [Compaction](compaction.md) - context compaction and branch summarization.
|
|
45
|
-
|
|
46
|
-
## Customization
|
|
47
|
-
|
|
48
|
-
- [Extensions](extensions.md) - TypeScript modules for tools, commands, events, and custom UI.
|
|
49
|
-
- [Skills](skills.md) - Agent Skills for reusable on-demand capabilities.
|
|
50
|
-
- [Prompt templates](prompt-templates.md) - reusable prompts that expand from slash commands.
|
|
51
|
-
- [Themes](themes.md) - built-in and custom terminal themes.
|
|
52
|
-
- [Pi packages](packages.md) - bundle and share extensions, skills, prompts, and themes.
|
|
53
|
-
- [Custom models](models.md) - add model entries for supported provider APIs.
|
|
54
|
-
- [Custom providers](custom-provider.md) - implement custom APIs and OAuth flows.
|
|
55
|
-
|
|
56
|
-
## Programmatic usage
|
|
57
|
-
|
|
58
|
-
- [SDK](sdk.md) - embed pi in Node.js applications.
|
|
59
|
-
- [RPC mode](rpc.md) - integrate over stdin/stdout JSONL.
|
|
60
|
-
- [JSON event stream mode](json.md) - print mode with structured events.
|
|
61
|
-
- [TUI components](tui.md) - build custom terminal UI for extensions.
|
|
62
|
-
|
|
63
|
-
## Reference
|
|
64
|
-
|
|
65
|
-
- [Session format](session-format.md) - JSONL session file format, entry types, and SessionManager API.
|
|
66
|
-
|
|
67
|
-
## Platform setup
|
|
68
|
-
|
|
69
|
-
- [Windows](windows.md)
|
|
70
|
-
- [Termux on Android](termux.md)
|
|
71
|
-
- [tmux](tmux.md)
|
|
72
|
-
- [Terminal setup](terminal-setup.md)
|
|
73
|
-
- [Shell aliases](shell-aliases.md)
|
|
74
|
-
|
|
75
|
-
## Development
|
|
76
|
-
|
|
77
|
-
- [Development](development.md) - local setup, project structure, and debugging.
|
|
1
|
+
# Pi Documentation
|
|
2
|
+
|
|
3
|
+
Pi is a minimal terminal coding harness. It is designed to stay small at the core while being extended through TypeScript extensions, skills, prompt templates, themes, and pi packages.
|
|
4
|
+
|
|
5
|
+
## Quick start
|
|
6
|
+
|
|
7
|
+
Install Pi with npm:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g --ignore-scripts @astralyn/pi
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
`--ignore-scripts` disables dependency lifecycle scripts during install. Pi does not require install scripts for normal npm installs.
|
|
14
|
+
|
|
15
|
+
To uninstall the npm package:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm uninstall -g @astralyn/pi
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
For pnpm, Yarn, or Bun installs, use the matching global remove command: `pnpm remove -g @astralyn/pi`, `yarn global remove @astralyn/pi`, or `bun uninstall -g @astralyn/pi`.
|
|
22
|
+
|
|
23
|
+
Then run it in a project directory:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pi
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Authenticate with `/login` for subscription providers, or set an API key such as `ANTHROPIC_API_KEY` before starting pi.
|
|
30
|
+
|
|
31
|
+
For the full first-run flow, see [Quickstart](quickstart.md).
|
|
32
|
+
|
|
33
|
+
## Start here
|
|
34
|
+
|
|
35
|
+
- [Quickstart](quickstart.md) - install, authenticate, and run a first session.
|
|
36
|
+
- [Using Pi](usage.md) - interactive mode, slash commands, context files, and CLI reference.
|
|
37
|
+
- [Providers](providers.md) - subscription and API-key setup for built-in providers.
|
|
38
|
+
- [llama.cpp](llama-cpp.md) - run a local router and manage models with `/llama`.
|
|
39
|
+
- [Security](security.md) - project trust, sandbox boundaries, and vulnerability reporting.
|
|
40
|
+
- [Containerization](containerization.md) - sandbox pi with Gondolin, Docker, or OpenShell.
|
|
41
|
+
- [Settings](settings.md) - global and project settings.
|
|
42
|
+
- [Keybindings](keybindings.md) - default shortcuts and custom keybindings.
|
|
43
|
+
- [Sessions](sessions.md) - session management, branching, and tree navigation.
|
|
44
|
+
- [Compaction](compaction.md) - context compaction and branch summarization.
|
|
45
|
+
|
|
46
|
+
## Customization
|
|
47
|
+
|
|
48
|
+
- [Extensions](extensions.md) - TypeScript modules for tools, commands, events, and custom UI.
|
|
49
|
+
- [Skills](skills.md) - Agent Skills for reusable on-demand capabilities.
|
|
50
|
+
- [Prompt templates](prompt-templates.md) - reusable prompts that expand from slash commands.
|
|
51
|
+
- [Themes](themes.md) - built-in and custom terminal themes.
|
|
52
|
+
- [Pi packages](packages.md) - bundle and share extensions, skills, prompts, and themes.
|
|
53
|
+
- [Custom models](models.md) - add model entries for supported provider APIs.
|
|
54
|
+
- [Custom providers](custom-provider.md) - implement custom APIs and OAuth flows.
|
|
55
|
+
|
|
56
|
+
## Programmatic usage
|
|
57
|
+
|
|
58
|
+
- [SDK](sdk.md) - embed pi in Node.js applications.
|
|
59
|
+
- [RPC mode](rpc.md) - integrate over stdin/stdout JSONL.
|
|
60
|
+
- [JSON event stream mode](json.md) - print mode with structured events.
|
|
61
|
+
- [TUI components](tui.md) - build custom terminal UI for extensions.
|
|
62
|
+
|
|
63
|
+
## Reference
|
|
64
|
+
|
|
65
|
+
- [Session format](session-format.md) - JSONL session file format, entry types, and SessionManager API.
|
|
66
|
+
|
|
67
|
+
## Platform setup
|
|
68
|
+
|
|
69
|
+
- [Windows](windows.md)
|
|
70
|
+
- [Termux on Android](termux.md)
|
|
71
|
+
- [tmux](tmux.md)
|
|
72
|
+
- [Terminal setup](terminal-setup.md)
|
|
73
|
+
- [Shell aliases](shell-aliases.md)
|
|
74
|
+
|
|
75
|
+
## Development
|
|
76
|
+
|
|
77
|
+
- [Development](development.md) - local setup, project structure, and debugging.
|
package/docs/packages.md
CHANGED
|
@@ -1,228 +1,228 @@
|
|
|
1
|
-
> pi can help you create pi packages. Ask it to bundle your extensions, skills, prompt templates, or themes.
|
|
2
|
-
|
|
3
|
-
# Pi Packages
|
|
4
|
-
|
|
5
|
-
Pi packages bundle extensions, skills, prompt templates, and themes so you can share them through npm or git. A package can declare resources in `package.json` under the `pi` key, or use conventional directories.
|
|
6
|
-
|
|
7
|
-
## Table of Contents
|
|
8
|
-
|
|
9
|
-
- [Install and Manage](#install-and-manage)
|
|
10
|
-
- [Package Sources](#package-sources)
|
|
11
|
-
- [Creating a Pi Package](#creating-a-pi-package)
|
|
12
|
-
- [Package Structure](#package-structure)
|
|
13
|
-
- [Dependencies](#dependencies)
|
|
14
|
-
- [Package Filtering](#package-filtering)
|
|
15
|
-
- [Enable and Disable Resources](#enable-and-disable-resources)
|
|
16
|
-
- [Scope and Deduplication](#scope-and-deduplication)
|
|
17
|
-
|
|
18
|
-
## Install and Manage
|
|
19
|
-
|
|
20
|
-
> **Security:** Pi packages run with full system access. Extensions execute arbitrary code, and skills can instruct the model to perform any action including running executables. Review source code before installing third-party packages.
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
pi install npm:@foo/bar@1.0.0
|
|
24
|
-
pi install git:github.com/user/repo@v1
|
|
25
|
-
pi install https://github.com/user/repo # raw URLs work too
|
|
26
|
-
pi install /absolute/path/to/package
|
|
27
|
-
pi install ./relative/path/to/package
|
|
28
|
-
|
|
29
|
-
pi remove npm:@foo/bar
|
|
30
|
-
pi list # show installed packages from settings
|
|
31
|
-
pi update # update pi only
|
|
32
|
-
pi update --all # update pi, update packages, and reconcile pinned git refs
|
|
33
|
-
pi update --extensions # update packages and reconcile pinned git refs only
|
|
34
|
-
pi update --models # refresh model catalogs only
|
|
35
|
-
pi update --self # update pi only
|
|
36
|
-
pi update --self --force # reinstall pi even if current
|
|
37
|
-
pi update npm:@foo/bar # update one package
|
|
38
|
-
pi update --extension npm:@foo/bar
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
These commands manage pi packages and `pi update` can update the pi CLI installation. To uninstall pi itself, see [Quickstart](quickstart.md#uninstall).
|
|
42
|
-
|
|
43
|
-
By default, `install` and `remove` write to user settings (`~/.pi/agent/settings.json`). Use `-l` to write to project settings (`.pi/settings.json`) instead. Project settings can be shared with your team, and pi installs any missing packages automatically on startup after the project is trusted.
|
|
44
|
-
|
|
45
|
-
To try a package without installing it, use `--extension` or `-e`. This installs to a temporary directory for the current run only:
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
pi -e npm:@foo/bar
|
|
49
|
-
pi -e git:github.com/user/repo
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## Package Sources
|
|
53
|
-
|
|
54
|
-
Pi accepts three source types in settings and `pi install`.
|
|
55
|
-
|
|
56
|
-
### npm
|
|
57
|
-
|
|
58
|
-
```
|
|
59
|
-
npm:@scope/pkg@1.2.3
|
|
60
|
-
npm:pkg
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
- Versioned specs are pinned and skipped by package updates (`pi update --extensions`, `pi update --all`).
|
|
64
|
-
- User installs go under `~/.pi/agent/npm/`.
|
|
65
|
-
- Project installs go under `.pi/npm/`.
|
|
66
|
-
- Set `npmCommand` in `settings.json` to pin npm package lookup and install operations to a specific wrapper command such as `mise` or `asdf`.
|
|
67
|
-
|
|
68
|
-
Example:
|
|
69
|
-
|
|
70
|
-
```json
|
|
71
|
-
{
|
|
72
|
-
"npmCommand": ["mise", "exec", "node@20", "--", "npm"]
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### git
|
|
77
|
-
|
|
78
|
-
```
|
|
79
|
-
git:github.com/user/repo@v1
|
|
80
|
-
git:git@github.com:user/repo@v1
|
|
81
|
-
https://github.com/user/repo@v1
|
|
82
|
-
ssh://git@github.com/user/repo@v1
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
- Without `git:` prefix, only protocol URLs are accepted (`https://`, `http://`, `ssh://`, `git://`).
|
|
86
|
-
- With `git:` prefix, shorthand formats are accepted, including `github.com/user/repo` and `git@github.com:user/repo`.
|
|
87
|
-
- HTTPS and SSH URLs are both supported.
|
|
88
|
-
- SSH URLs use your configured SSH keys automatically (respects `~/.ssh/config`).
|
|
89
|
-
- 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.
|
|
90
|
-
- Refs are pinned tags or commits. `pi update --extensions` and `pi update --all` do not move them to newer refs, but they do reconcile an existing clone to the configured ref.
|
|
91
|
-
- Use `pi install git:host/user/repo@new-ref` to update settings and move an existing package to a new pinned ref.
|
|
92
|
-
- Cloned to `~/.pi/agent/git/<host>/<path>` (global) or `.pi/git/<host>/<path>` (project).
|
|
93
|
-
- When reconciliation changes the checkout, pi resets and cleans the clone, then runs `npm install` if `package.json` exists.
|
|
94
|
-
|
|
95
|
-
**SSH examples:**
|
|
96
|
-
```bash
|
|
97
|
-
# git@host:path shorthand (requires git: prefix)
|
|
98
|
-
pi install git:git@github.com:user/repo
|
|
99
|
-
|
|
100
|
-
# ssh:// protocol format
|
|
101
|
-
pi install ssh://git@github.com/user/repo
|
|
102
|
-
|
|
103
|
-
# With version ref
|
|
104
|
-
pi install git:git@github.com:user/repo@v1.0.0
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### Local Paths
|
|
108
|
-
|
|
109
|
-
```
|
|
110
|
-
/absolute/path/to/package
|
|
111
|
-
./relative/path/to/package
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
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.
|
|
115
|
-
|
|
116
|
-
## Creating a Pi Package
|
|
117
|
-
|
|
118
|
-
Add a `pi` manifest to `package.json` or use conventional directories. Include the `pi-package` keyword for discoverability.
|
|
119
|
-
|
|
120
|
-
```json
|
|
121
|
-
{
|
|
122
|
-
"name": "my-package",
|
|
123
|
-
"keywords": ["pi-package"],
|
|
124
|
-
"pi": {
|
|
125
|
-
"extensions": ["./extensions"],
|
|
126
|
-
"skills": ["./skills"],
|
|
127
|
-
"prompts": ["./prompts"],
|
|
128
|
-
"themes": ["./themes"]
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
Paths are relative to the package root. Arrays support glob patterns and `!exclusions`.
|
|
134
|
-
|
|
135
|
-
### Gallery Metadata
|
|
136
|
-
|
|
137
|
-
The [package gallery](https://pi.dev/packages) displays packages tagged with `pi-package`. Add `video` or `image` fields to show a preview:
|
|
138
|
-
|
|
139
|
-
```json
|
|
140
|
-
{
|
|
141
|
-
"name": "my-package",
|
|
142
|
-
"keywords": ["pi-package"],
|
|
143
|
-
"pi": {
|
|
144
|
-
"extensions": ["./extensions"],
|
|
145
|
-
"video": "https://example.com/demo.mp4",
|
|
146
|
-
"image": "https://example.com/screenshot.png"
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
- **video**: MP4 only. On desktop, autoplays on hover. Clicking opens a fullscreen player.
|
|
152
|
-
- **image**: PNG, JPEG, GIF, or WebP. Displayed as a static preview.
|
|
153
|
-
|
|
154
|
-
If both are set, video takes precedence.
|
|
155
|
-
|
|
156
|
-
## Package Structure
|
|
157
|
-
|
|
158
|
-
### Convention Directories
|
|
159
|
-
|
|
160
|
-
If no `pi` manifest is present, pi auto-discovers resources from these directories:
|
|
161
|
-
|
|
162
|
-
- `extensions/` loads `.ts` and `.js` files
|
|
163
|
-
- `skills/` recursively finds `SKILL.md` folders and loads top-level `.md` files as skills
|
|
164
|
-
- `prompts/` loads `.md` files
|
|
165
|
-
- `themes/` loads `.json` files
|
|
166
|
-
|
|
167
|
-
## Dependencies
|
|
168
|
-
|
|
169
|
-
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.
|
|
170
|
-
|
|
171
|
-
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: `@earendil-works/pi-ai`, `@earendil-works/pi-agent-core`, `@astralyn/pi`, `@earendil-works/pi-tui`, `typebox`.
|
|
172
|
-
|
|
173
|
-
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.
|
|
174
|
-
|
|
175
|
-
Example:
|
|
176
|
-
|
|
177
|
-
```json
|
|
178
|
-
{
|
|
179
|
-
"dependencies": {
|
|
180
|
-
"shitty-extensions": "^1.0.1"
|
|
181
|
-
},
|
|
182
|
-
"bundledDependencies": ["shitty-extensions"],
|
|
183
|
-
"pi": {
|
|
184
|
-
"extensions": ["extensions", "node_modules/shitty-extensions/extensions"],
|
|
185
|
-
"skills": ["skills", "node_modules/shitty-extensions/skills"]
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
## Package Filtering
|
|
191
|
-
|
|
192
|
-
Filter what a package loads using the object form in settings:
|
|
193
|
-
|
|
194
|
-
```json
|
|
195
|
-
{
|
|
196
|
-
"packages": [
|
|
197
|
-
"npm:simple-pkg",
|
|
198
|
-
{
|
|
199
|
-
"source": "npm:my-package",
|
|
200
|
-
"extensions": ["extensions/*.ts", "!extensions/legacy.ts"],
|
|
201
|
-
"skills": [],
|
|
202
|
-
"prompts": ["prompts/review.md"],
|
|
203
|
-
"themes": ["+themes/legacy.json"]
|
|
204
|
-
}
|
|
205
|
-
]
|
|
206
|
-
}
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
`+path` and `-path` are exact paths relative to the package root.
|
|
210
|
-
|
|
211
|
-
- Omit a key to load all of that type.
|
|
212
|
-
- Use `[]` to load none of that type.
|
|
213
|
-
- `!pattern` excludes matches.
|
|
214
|
-
- `+path` force-includes an exact path.
|
|
215
|
-
- `-path` force-excludes an exact path.
|
|
216
|
-
- Filters layer on top of the manifest. They narrow down what is already allowed.
|
|
217
|
-
|
|
218
|
-
## Enable and Disable Resources
|
|
219
|
-
|
|
220
|
-
Use `pi config` to enable or disable extensions, skills, prompt templates, and themes from installed packages and local directories. `pi config` starts in global settings (`~/.pi/agent/settings.json`); press Tab to switch between global and project-local modes. Use `pi config -l` to start in project overrides (`.pi/settings.json`) with inherited global resources dimmed.
|
|
221
|
-
|
|
222
|
-
## Scope and Deduplication
|
|
223
|
-
|
|
224
|
-
Packages can appear in both global and project settings. If the same package appears in both, the project entry wins unless the project entry has `autoload: false`, in which case it is applied as a delta over the global entry. Identity is determined by:
|
|
225
|
-
|
|
226
|
-
- npm: package name
|
|
227
|
-
- git: repository URL without ref
|
|
228
|
-
- local: resolved absolute path
|
|
1
|
+
> pi can help you create pi packages. Ask it to bundle your extensions, skills, prompt templates, or themes.
|
|
2
|
+
|
|
3
|
+
# Pi Packages
|
|
4
|
+
|
|
5
|
+
Pi packages bundle extensions, skills, prompt templates, and themes so you can share them through npm or git. A package can declare resources in `package.json` under the `pi` key, or use conventional directories.
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
- [Install and Manage](#install-and-manage)
|
|
10
|
+
- [Package Sources](#package-sources)
|
|
11
|
+
- [Creating a Pi Package](#creating-a-pi-package)
|
|
12
|
+
- [Package Structure](#package-structure)
|
|
13
|
+
- [Dependencies](#dependencies)
|
|
14
|
+
- [Package Filtering](#package-filtering)
|
|
15
|
+
- [Enable and Disable Resources](#enable-and-disable-resources)
|
|
16
|
+
- [Scope and Deduplication](#scope-and-deduplication)
|
|
17
|
+
|
|
18
|
+
## Install and Manage
|
|
19
|
+
|
|
20
|
+
> **Security:** Pi packages run with full system access. Extensions execute arbitrary code, and skills can instruct the model to perform any action including running executables. Review source code before installing third-party packages.
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pi install npm:@foo/bar@1.0.0
|
|
24
|
+
pi install git:github.com/user/repo@v1
|
|
25
|
+
pi install https://github.com/user/repo # raw URLs work too
|
|
26
|
+
pi install /absolute/path/to/package
|
|
27
|
+
pi install ./relative/path/to/package
|
|
28
|
+
|
|
29
|
+
pi remove npm:@foo/bar
|
|
30
|
+
pi list # show installed packages from settings
|
|
31
|
+
pi update # update pi only
|
|
32
|
+
pi update --all # update pi, update packages, and reconcile pinned git refs
|
|
33
|
+
pi update --extensions # update packages and reconcile pinned git refs only
|
|
34
|
+
pi update --models # refresh model catalogs only
|
|
35
|
+
pi update --self # update pi only
|
|
36
|
+
pi update --self --force # reinstall pi even if current
|
|
37
|
+
pi update npm:@foo/bar # update one package
|
|
38
|
+
pi update --extension npm:@foo/bar
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
These commands manage pi packages and `pi update` can update the pi CLI installation. To uninstall pi itself, see [Quickstart](quickstart.md#uninstall).
|
|
42
|
+
|
|
43
|
+
By default, `install` and `remove` write to user settings (`~/.pi/agent/settings.json`). Use `-l` to write to project settings (`.pi/settings.json`) instead. Project settings can be shared with your team, and pi installs any missing packages automatically on startup after the project is trusted.
|
|
44
|
+
|
|
45
|
+
To try a package without installing it, use `--extension` or `-e`. This installs to a temporary directory for the current run only:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pi -e npm:@foo/bar
|
|
49
|
+
pi -e git:github.com/user/repo
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Package Sources
|
|
53
|
+
|
|
54
|
+
Pi accepts three source types in settings and `pi install`.
|
|
55
|
+
|
|
56
|
+
### npm
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
npm:@scope/pkg@1.2.3
|
|
60
|
+
npm:pkg
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
- Versioned specs are pinned and skipped by package updates (`pi update --extensions`, `pi update --all`).
|
|
64
|
+
- User installs go under `~/.pi/agent/npm/`.
|
|
65
|
+
- Project installs go under `.pi/npm/`.
|
|
66
|
+
- Set `npmCommand` in `settings.json` to pin npm package lookup and install operations to a specific wrapper command such as `mise` or `asdf`.
|
|
67
|
+
|
|
68
|
+
Example:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"npmCommand": ["mise", "exec", "node@20", "--", "npm"]
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### git
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
git:github.com/user/repo@v1
|
|
80
|
+
git:git@github.com:user/repo@v1
|
|
81
|
+
https://github.com/user/repo@v1
|
|
82
|
+
ssh://git@github.com/user/repo@v1
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
- Without `git:` prefix, only protocol URLs are accepted (`https://`, `http://`, `ssh://`, `git://`).
|
|
86
|
+
- With `git:` prefix, shorthand formats are accepted, including `github.com/user/repo` and `git@github.com:user/repo`.
|
|
87
|
+
- HTTPS and SSH URLs are both supported.
|
|
88
|
+
- SSH URLs use your configured SSH keys automatically (respects `~/.ssh/config`).
|
|
89
|
+
- 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.
|
|
90
|
+
- Refs are pinned tags or commits. `pi update --extensions` and `pi update --all` do not move them to newer refs, but they do reconcile an existing clone to the configured ref.
|
|
91
|
+
- Use `pi install git:host/user/repo@new-ref` to update settings and move an existing package to a new pinned ref.
|
|
92
|
+
- Cloned to `~/.pi/agent/git/<host>/<path>` (global) or `.pi/git/<host>/<path>` (project).
|
|
93
|
+
- When reconciliation changes the checkout, pi resets and cleans the clone, then runs `npm install` if `package.json` exists.
|
|
94
|
+
|
|
95
|
+
**SSH examples:**
|
|
96
|
+
```bash
|
|
97
|
+
# git@host:path shorthand (requires git: prefix)
|
|
98
|
+
pi install git:git@github.com:user/repo
|
|
99
|
+
|
|
100
|
+
# ssh:// protocol format
|
|
101
|
+
pi install ssh://git@github.com/user/repo
|
|
102
|
+
|
|
103
|
+
# With version ref
|
|
104
|
+
pi install git:git@github.com:user/repo@v1.0.0
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Local Paths
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
/absolute/path/to/package
|
|
111
|
+
./relative/path/to/package
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
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.
|
|
115
|
+
|
|
116
|
+
## Creating a Pi Package
|
|
117
|
+
|
|
118
|
+
Add a `pi` manifest to `package.json` or use conventional directories. Include the `pi-package` keyword for discoverability.
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
{
|
|
122
|
+
"name": "my-package",
|
|
123
|
+
"keywords": ["pi-package"],
|
|
124
|
+
"pi": {
|
|
125
|
+
"extensions": ["./extensions"],
|
|
126
|
+
"skills": ["./skills"],
|
|
127
|
+
"prompts": ["./prompts"],
|
|
128
|
+
"themes": ["./themes"]
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Paths are relative to the package root. Arrays support glob patterns and `!exclusions`.
|
|
134
|
+
|
|
135
|
+
### Gallery Metadata
|
|
136
|
+
|
|
137
|
+
The [package gallery](https://pi.dev/packages) displays packages tagged with `pi-package`. Add `video` or `image` fields to show a preview:
|
|
138
|
+
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"name": "my-package",
|
|
142
|
+
"keywords": ["pi-package"],
|
|
143
|
+
"pi": {
|
|
144
|
+
"extensions": ["./extensions"],
|
|
145
|
+
"video": "https://example.com/demo.mp4",
|
|
146
|
+
"image": "https://example.com/screenshot.png"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
- **video**: MP4 only. On desktop, autoplays on hover. Clicking opens a fullscreen player.
|
|
152
|
+
- **image**: PNG, JPEG, GIF, or WebP. Displayed as a static preview.
|
|
153
|
+
|
|
154
|
+
If both are set, video takes precedence.
|
|
155
|
+
|
|
156
|
+
## Package Structure
|
|
157
|
+
|
|
158
|
+
### Convention Directories
|
|
159
|
+
|
|
160
|
+
If no `pi` manifest is present, pi auto-discovers resources from these directories:
|
|
161
|
+
|
|
162
|
+
- `extensions/` loads `.ts` and `.js` files
|
|
163
|
+
- `skills/` recursively finds `SKILL.md` folders and loads top-level `.md` files as skills
|
|
164
|
+
- `prompts/` loads `.md` files
|
|
165
|
+
- `themes/` loads `.json` files
|
|
166
|
+
|
|
167
|
+
## Dependencies
|
|
168
|
+
|
|
169
|
+
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.
|
|
170
|
+
|
|
171
|
+
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: `@earendil-works/pi-ai`, `@earendil-works/pi-agent-core`, `@astralyn/pi`, `@earendil-works/pi-tui`, `typebox`.
|
|
172
|
+
|
|
173
|
+
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.
|
|
174
|
+
|
|
175
|
+
Example:
|
|
176
|
+
|
|
177
|
+
```json
|
|
178
|
+
{
|
|
179
|
+
"dependencies": {
|
|
180
|
+
"shitty-extensions": "^1.0.1"
|
|
181
|
+
},
|
|
182
|
+
"bundledDependencies": ["shitty-extensions"],
|
|
183
|
+
"pi": {
|
|
184
|
+
"extensions": ["extensions", "node_modules/shitty-extensions/extensions"],
|
|
185
|
+
"skills": ["skills", "node_modules/shitty-extensions/skills"]
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Package Filtering
|
|
191
|
+
|
|
192
|
+
Filter what a package loads using the object form in settings:
|
|
193
|
+
|
|
194
|
+
```json
|
|
195
|
+
{
|
|
196
|
+
"packages": [
|
|
197
|
+
"npm:simple-pkg",
|
|
198
|
+
{
|
|
199
|
+
"source": "npm:my-package",
|
|
200
|
+
"extensions": ["extensions/*.ts", "!extensions/legacy.ts"],
|
|
201
|
+
"skills": [],
|
|
202
|
+
"prompts": ["prompts/review.md"],
|
|
203
|
+
"themes": ["+themes/legacy.json"]
|
|
204
|
+
}
|
|
205
|
+
]
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
`+path` and `-path` are exact paths relative to the package root.
|
|
210
|
+
|
|
211
|
+
- Omit a key to load all of that type.
|
|
212
|
+
- Use `[]` to load none of that type.
|
|
213
|
+
- `!pattern` excludes matches.
|
|
214
|
+
- `+path` force-includes an exact path.
|
|
215
|
+
- `-path` force-excludes an exact path.
|
|
216
|
+
- Filters layer on top of the manifest. They narrow down what is already allowed.
|
|
217
|
+
|
|
218
|
+
## Enable and Disable Resources
|
|
219
|
+
|
|
220
|
+
Use `pi config` to enable or disable extensions, skills, prompt templates, and themes from installed packages and local directories. `pi config` starts in global settings (`~/.pi/agent/settings.json`); press Tab to switch between global and project-local modes. Use `pi config -l` to start in project overrides (`.pi/settings.json`) with inherited global resources dimmed.
|
|
221
|
+
|
|
222
|
+
## Scope and Deduplication
|
|
223
|
+
|
|
224
|
+
Packages can appear in both global and project settings. If the same package appears in both, the project entry wins unless the project entry has `autoload: false`, in which case it is applied as a delta over the global entry. Identity is determined by:
|
|
225
|
+
|
|
226
|
+
- npm: package name
|
|
227
|
+
- git: repository URL without ref
|
|
228
|
+
- local: resolved absolute path
|