@astralyn/pi 0.82.0 → 0.82.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 +17 -0
- package/LICENSE +21 -0
- package/README.md +14 -3
- package/dist/core/agent-session.d.ts +4 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +193 -43
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +22 -4
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +6 -13
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +4 -3
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts +13 -3
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +36 -6
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts +7 -2
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +25 -12
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/utils/output-decoder.d.ts +52 -0
- package/dist/utils/output-decoder.d.ts.map +1 -0
- package/dist/utils/output-decoder.js +134 -0
- package/dist/utils/output-decoder.js.map +1 -0
- package/dist/utils/shell.d.ts +1 -0
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +21 -0
- package/dist/utils/shell.js.map +1 -1
- package/docs/compaction.md +8 -2
- package/docs/containerization.md +1 -1
- package/docs/development.md +32 -35
- package/docs/distribution/README.md +34 -0
- package/docs/distribution/architecture.md +102 -0
- package/docs/distribution/extensions/README.md +17 -0
- package/docs/distribution/extensions/deepwiki.md +62 -0
- package/docs/distribution/extensions/question.md +59 -0
- package/docs/distribution/extensions/rewind.md +85 -0
- package/docs/distribution/extensions/router.md +139 -0
- package/docs/distribution/extensions/statusline.md +110 -0
- package/docs/distribution/extensions/subagent.md +102 -0
- package/docs/distribution/maintenance.md +121 -0
- package/docs/distribution/release.md +85 -0
- package/docs/distribution/themes.md +58 -0
- package/docs/distribution/tool-presentation.md +91 -0
- package/docs/extensions.md +4 -2
- package/docs/index.md +1 -1
- package/docs/rpc.md +2 -2
- package/docs/themes.md +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +3 -3
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +1 -1
- package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
- package/examples/extensions/doom-overlay/doom/build.sh +0 -0
- package/examples/extensions/sandbox/package-lock.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/npm-shrinkwrap.json +3481 -640
- package/package.json +30 -18
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# subagent — isolated foreground delegation
|
|
2
|
+
|
|
3
|
+
Adds the `subagent` tool and `/agents` profile settings command. It delegates a bounded task to an isolated in-process `AgentSession`; it is not a background worker or a fleet manager.
|
|
4
|
+
|
|
5
|
+
## Tool modes
|
|
6
|
+
|
|
7
|
+
Exactly one mode is required per call:
|
|
8
|
+
|
|
9
|
+
- **Single**: `agent`, `description`, and `prompt`.
|
|
10
|
+
- **Parallel**: `tasks`, an array of independent task objects.
|
|
11
|
+
- **Chain**: `chain`, an array of sequential task objects. `{previous}` in a later prompt is replaced by the previous worker's bounded final response.
|
|
12
|
+
|
|
13
|
+
Every task object has:
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
agent? Agent profile name; defaults to general
|
|
17
|
+
description Short UI label
|
|
18
|
+
prompt Self-contained worker briefing
|
|
19
|
+
cwd? Relative directory inside the parent working directory
|
|
20
|
+
model? Temporary provider/model override
|
|
21
|
+
thinking? Temporary thinking-level override
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Parallel and chain batches allow at most eight tasks. A session-scoped gate runs at most three workers concurrently, including sibling `subagent` calls from the same parent session.
|
|
25
|
+
|
|
26
|
+
## Agent profiles
|
|
27
|
+
|
|
28
|
+
Profiles are Markdown files with YAML frontmatter:
|
|
29
|
+
|
|
30
|
+
```yaml
|
|
31
|
+
---
|
|
32
|
+
name: reviewer
|
|
33
|
+
description: Read-only implementation reviewer
|
|
34
|
+
tools: read, grep, find, ls
|
|
35
|
+
model: anthropic/claude-sonnet-4-5
|
|
36
|
+
thinking: medium
|
|
37
|
+
backend: sdk
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
Review the delegated task independently and report exact evidence.
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Sources and precedence are:
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
built-in < ~/.pi/agent/agents/*.md < trusted-project/.pi/agents/*.md
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Project definitions are loaded only after Pi trusts the project. Invalid Markdown definitions appear as `/agents` diagnostics without hiding valid profiles.
|
|
50
|
+
|
|
51
|
+
Built-in profiles:
|
|
52
|
+
|
|
53
|
+
- `general`: read, bash, edit, write, grep, find, and ls.
|
|
54
|
+
- `explorer`: read-only `read`, `grep`, `find`, and `ls`, with low thinking by default.
|
|
55
|
+
|
|
56
|
+
A profile may only allow Pi built-in tools. Child sessions load no extensions, skills, or prompt templates, so a worker cannot recursively call `subagent` or inherit unrelated extension capabilities. Project context files such as `AGENTS.md` remain available.
|
|
57
|
+
|
|
58
|
+
## Model and thinking selection
|
|
59
|
+
|
|
60
|
+
The model/thinking resolution order is:
|
|
61
|
+
|
|
62
|
+
```text
|
|
63
|
+
per-call tool fields
|
|
64
|
+
> saved /agents profile override
|
|
65
|
+
> profile Markdown frontmatter
|
|
66
|
+
> current parent session
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Run `/agents` to choose a profile and set either field to:
|
|
70
|
+
|
|
71
|
+
- **inherit**: force the active parent-session value;
|
|
72
|
+
- **agent default**: clear the saved override and use Markdown/default inheritance;
|
|
73
|
+
- a configured `provider/model` or explicit supported thinking level.
|
|
74
|
+
|
|
75
|
+
Overrides are user-owned and saved atomically in:
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
~/.pi/agent/subagent.json
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
They apply only to future subagent runs and never change the parent session's `/model` or thinking level.
|
|
82
|
+
|
|
83
|
+
## Lifecycle and output
|
|
84
|
+
|
|
85
|
+
- The parent tool call waits until every worker reaches a terminal state.
|
|
86
|
+
- Parent abort, `/reload`, `/new`, `/resume`, `/fork`, and session shutdown abort active child sessions. Queued workers do not survive the call.
|
|
87
|
+
- Parallel worker failures do not cancel other independent workers. A failed or aborted chain step skips its remaining steps.
|
|
88
|
+
- Progress is rendered in Pi's native tool transcript. The collapsed view shows status, recent activity, usage, and the configured expand hint; `Ctrl+O` shows bounded activities and final Markdown reports.
|
|
89
|
+
- Full child transcripts are not stored separately. Bounded run details remain in the parent tool result, so completed calls restore naturally in the parent session tree.
|
|
90
|
+
- Nested usage is returned with the tool result and included in parent session accounting.
|
|
91
|
+
|
|
92
|
+
## Deliberate non-features
|
|
93
|
+
|
|
94
|
+
There are no background agents, persistent worker IDs, unread state, fleet panel, statusline widget, send/stop/resume control plane, completion notifications, swarm/coordinator, worktree isolation, nested agents, MCP, hooks, or agent memory.
|
|
95
|
+
|
|
96
|
+
**Files:** `src/extensions/subagent/`
|
|
97
|
+
|
|
98
|
+
- `index.ts` — registration, parent provider synchronization, `/agents`, shutdown cleanup
|
|
99
|
+
- `agents.ts` / `settings.ts` / `resolve.ts` — profile discovery, persistent overrides, task validation
|
|
100
|
+
- `sdk-runner.ts` / `runner.ts` — isolated sessions, progress, abort, concurrency, modes
|
|
101
|
+
- `activity.ts` / `render.ts` — bounded evidence, usage, native transcript rendering
|
|
102
|
+
- `schema.ts` / `types.ts` / `constants.ts` — public tool contract and data model
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Distribution maintenance
|
|
2
|
+
|
|
3
|
+
This guide describes how to keep the standalone `@astralyn/pi` package aligned with upstream Pi. The repository contract in [`AGENTS.md`](../../AGENTS.md) is authoritative; publishing is covered separately in [`release.md`](release.md).
|
|
4
|
+
|
|
5
|
+
## Repository model
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
origin private distribution repository
|
|
9
|
+
upstream earendil-works/pi monorepo
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
`main` contains a standalone package, not an upstream monorepo checkout. Upstream tags must therefore be inspected and selectively imported; never merge an upstream tag directly into `main`, because that would recreate every workspace.
|
|
13
|
+
|
|
14
|
+
## Ownership layers
|
|
15
|
+
|
|
16
|
+
| Layer | Typical paths | Policy |
|
|
17
|
+
|---|---|---|
|
|
18
|
+
| Upstream-aligned coding-agent | most of `src/**`, `test/**`, `docs/**`, `examples/**` | Import compatible changes from an upstream release tag. |
|
|
19
|
+
| Distribution-owned | `docs/distribution/**`, bundled personal extensions, ice-cream themes, release workflow, package identity | Preserve local design and update deliberately. |
|
|
20
|
+
| Hybrid | `src/core/agent-session.ts`, native tool presentation, built-in tools, keybindings, extension registration, `package.json`, `CHANGELOG.md` | Review function by function; retain upstream lifecycle semantics and local behavior. |
|
|
21
|
+
| Registry boundary | exact upstream AI, Agent core, and TUI dependencies | Upgrade together with the imported coding-agent release; never patch their installed files. |
|
|
22
|
+
|
|
23
|
+
Recurring hybrid hotspots include:
|
|
24
|
+
|
|
25
|
+
```text
|
|
26
|
+
src/extensions/index.ts
|
|
27
|
+
src/core/agent-session.ts
|
|
28
|
+
src/core/keybindings.ts
|
|
29
|
+
src/core/tools/*.ts
|
|
30
|
+
src/modes/interactive/components/tool-execution.ts
|
|
31
|
+
src/modes/interactive/interactive-mode.ts
|
|
32
|
+
src/modes/interactive/theme/theme.ts
|
|
33
|
+
package.json
|
|
34
|
+
CHANGELOG.md
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Synchronization workflow
|
|
38
|
+
|
|
39
|
+
Synchronize only against upstream release tags, never upstream `main`. Start from a clean branch and fetch tags:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
git status --short
|
|
43
|
+
git fetch upstream --tags
|
|
44
|
+
git tag --list 'v<upstream-minor>.*'
|
|
45
|
+
git switch -c sync/upstream-<version> main
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Extract the upstream coding-agent subtree into a temporary directory without changing the current checkout:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
tmp="$(mktemp -d)"
|
|
52
|
+
git archive v<version> packages/coding-agent | tar -x -C "$tmp"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Review `$tmp/packages/coding-agent/` against the standalone root. Import upstream changes in bounded groups:
|
|
56
|
+
|
|
57
|
+
1. Review source and tests, paying special attention to the hybrid hotspots above.
|
|
58
|
+
2. Update product/API documentation and examples while retaining distribution-specific references.
|
|
59
|
+
3. Adapt upstream package and TypeScript changes to the standalone root rather than copying monorepo-relative paths.
|
|
60
|
+
4. Set the exact `@earendil-works/pi-ai`, `@earendil-works/pi-agent-core`, and `@earendil-works/pi-tui` versions published for that upstream release.
|
|
61
|
+
5. Run `npm install --ignore-scripts` to refresh `npm-shrinkwrap.json`, then inspect dependency and lifecycle-script changes.
|
|
62
|
+
|
|
63
|
+
Do not copy these upstream monorepo assumptions into the standalone repository:
|
|
64
|
+
|
|
65
|
+
- workspace declarations or `packages/*` paths;
|
|
66
|
+
- TypeScript or Vitest aliases to sibling source workspaces;
|
|
67
|
+
- Server, storage, model-catalog, binary, or multi-package release scripts;
|
|
68
|
+
- cross-package source modifications needed only by an unreleased upstream checkout.
|
|
69
|
+
|
|
70
|
+
If imported coding-agent code requires an API absent from the published upstream dependencies, stop and use a later compatible release. Do not solve the mismatch by vendoring or locally forking another package.
|
|
71
|
+
|
|
72
|
+
## Conflict policy
|
|
73
|
+
|
|
74
|
+
When reconciling upstream changes:
|
|
75
|
+
|
|
76
|
+
1. Preserve security fixes, protocol correctness, execution semantics, and public API compatibility first.
|
|
77
|
+
2. Keep local behavior only where it is intentionally documented and tested.
|
|
78
|
+
3. For native UI, integrate upstream execution changes before adapting presentation.
|
|
79
|
+
4. Keep model-facing output bounded and avoid schema/result changes for display-only work.
|
|
80
|
+
5. Prefer a small local type intersection or adapter over changing an upstream dependency API.
|
|
81
|
+
|
|
82
|
+
Git may detect many imports as renames from the historical `packages/coding-agent` path. Review content, not rename percentages.
|
|
83
|
+
|
|
84
|
+
## Dependency and lock maintenance
|
|
85
|
+
|
|
86
|
+
All direct registry dependencies are exact. When package metadata changes:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npm install --ignore-scripts
|
|
90
|
+
npm run check:pinned-deps
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
`npm-shrinkwrap.json` is both the development lock and the lock published with `@astralyn/pi`. Review new or changed transitive packages, platform-specific optional packages, and lifecycle scripts before accepting it. The pre-commit hook requires an explicit `PI_ALLOW_LOCKFILE_CHANGE=1` acknowledgment when committing an intentional shrinkwrap change.
|
|
94
|
+
|
|
95
|
+
## Verification
|
|
96
|
+
|
|
97
|
+
At minimum:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
npm run build
|
|
101
|
+
npm run check
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Run focused tests for each changed subsystem. For native transcript changes, verify pending, success, error, collapsed, and expanded states, plus `Ctrl+O`, `/reload`, and `/tree` in a real TTY. The Ubuntu CI workflow runs Build, Check, and the full test suite.
|
|
105
|
+
|
|
106
|
+
Before integrating a synchronization branch:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
git status --short
|
|
110
|
+
git diff --stat main...HEAD
|
|
111
|
+
git log --oneline main..HEAD
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Changelog and release ownership
|
|
115
|
+
|
|
116
|
+
- `CHANGELOG.md` is the runtime and release changelog for `@astralyn/pi`.
|
|
117
|
+
- `docs/**` remains structurally close to upstream coding-agent user/API documentation.
|
|
118
|
+
- `docs/distribution/**` records standalone architecture, bundled behavior, maintenance, and release operations.
|
|
119
|
+
- Dependency package changelogs are not copied; consult their upstream releases during synchronization.
|
|
120
|
+
|
|
121
|
+
After synchronization and verification, follow the [release checklist](release.md).
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Release checklist
|
|
2
|
+
|
|
3
|
+
This repository publishes one npm package from its root: `@astralyn/pi`. It does not use the upstream multi-package, binary, source-archive, or model-catalog release flows. Upstream synchronization is documented in [maintenance.md](maintenance.md).
|
|
4
|
+
|
|
5
|
+
## Scope and versioning
|
|
6
|
+
|
|
7
|
+
Track the upstream Pi `major.minor` line and reserve the patch number for this distribution's release sequence:
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
upstream 0.82.x -> Fork 0.82.0, 0.82.1, 0.82.2, ...
|
|
11
|
+
upstream 0.83.x -> Fork 0.83.0, 0.83.1, 0.83.2, ...
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The first distribution release after moving to a new upstream minor uses patch `0`. Every later release on that line uses the next unused patch, including releases that absorb an upstream patch update. Use `pi-v<full-version>` Git tags so they remain distinct from fetched upstream tags such as `v0.82.0`.
|
|
15
|
+
|
|
16
|
+
## Prepare the release
|
|
17
|
+
|
|
18
|
+
1. Start from a clean `main` branch and choose the next unused distribution version.
|
|
19
|
+
2. Move current `CHANGELOG.md` entries from `[Unreleased]` into one `## [<version>] - YYYY-MM-DD` section, then leave a new empty `[Unreleased]` section.
|
|
20
|
+
3. Update `package.json` version.
|
|
21
|
+
4. Refresh and review the authoritative shrinkwrap:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install --package-lock-only --ignore-scripts
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Direct dependencies are exact. If a synchronized upstream release is still blocked by the `.npmrc` age gate, prefer waiting; use `--min-release-age=0` only after explicitly verifying the package versions, provenance, and release contents.
|
|
28
|
+
|
|
29
|
+
Confirm `package.json` and the root entry in `npm-shrinkwrap.json` carry the same `@astralyn/pi` version and that the intended exact upstream AI, Agent core, and TUI versions are locked.
|
|
30
|
+
|
|
31
|
+
## Verify
|
|
32
|
+
|
|
33
|
+
Local development verification:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm run build
|
|
37
|
+
npm run check
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Release verification runs on Ubuntu through GitHub Actions. The CI and publish workflows both install from `npm-shrinkwrap.json`, build, check, verify that generated files remain clean, and run the complete test suite.
|
|
41
|
+
|
|
42
|
+
## Review the package
|
|
43
|
+
|
|
44
|
+
After building, inspect the root package:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm pack --dry-run
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The tarball must contain the built `dist`, product documentation, examples, README, changelog, and `npm-shrinkwrap.json`. It must not contain source workspaces or local configuration. For stronger verification, create a real tarball, install it in a temporary directory outside the repository, and run `pi --version` and `pi --list-models`.
|
|
51
|
+
|
|
52
|
+
## Publish and tag
|
|
53
|
+
|
|
54
|
+
Publishing uses npm Trusted Publishing through GitHub Actions OIDC. Configure the package once on npm:
|
|
55
|
+
|
|
56
|
+
```text
|
|
57
|
+
Publisher: GitHub Actions
|
|
58
|
+
Organization or user: ming-kang
|
|
59
|
+
Repository: pi
|
|
60
|
+
Workflow filename: publish-npm.yml
|
|
61
|
+
Environment name: (blank)
|
|
62
|
+
Allowed action: Allow npm publish
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
After the release commit is pushed and CI passes, trigger the workflow from an authenticated GitHub CLI session:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
gh workflow run publish-npm.yml --repo ming-kang/pi --ref main -f version=0.82.0
|
|
69
|
+
|
|
70
|
+
gh run list --repo ming-kang/pi --workflow publish-npm.yml --limit 1
|
|
71
|
+
gh run watch <run-id> --repo ming-kang/pi --exit-status
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The workflow validates the requested version, repeats Ubuntu Build/Check/Test, publishes the repository root with provenance, and verifies the registry version. A normal push to `main` never publishes.
|
|
75
|
+
|
|
76
|
+
After publication, verify the registry and perform a global-install/self-update smoke test from a separate shell or after restarting Pi. Do not replace the package currently running the release session.
|
|
77
|
+
|
|
78
|
+
Finally tag the exact release commit:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
git tag pi-v<full-version>
|
|
82
|
+
git push origin pi-v<full-version>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
No other package is published from this repository.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Bundled theme design
|
|
2
|
+
|
|
3
|
+
This document describes the themes shipped by the distribution. For theme discovery, JSON format, and custom theme authoring, see the [Theme API documentation](../themes.md).
|
|
4
|
+
|
|
5
|
+
The Fork bundles two Pi themes using the native theme schema and loader:
|
|
6
|
+
|
|
7
|
+
| Theme | Use |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `ice-cream-dark` | Cool sea-salt dark palette with warm cream tool titles. |
|
|
10
|
+
| `ice-cream-light` | Light counterpart with the same semantic mapping. |
|
|
11
|
+
|
|
12
|
+
Both themes are built into `@astralyn/pi`. They do not require the external `pi-config` package.
|
|
13
|
+
|
|
14
|
+
## Selecting a theme
|
|
15
|
+
|
|
16
|
+
Use `/settings`, or set a single theme:
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"theme": "ice-cream-dark"
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
For automatic terminal light/dark selection:
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"theme": "ice-cream-light/ice-cream-dark"
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The left side is used for light terminals and the right side for dark terminals.
|
|
33
|
+
|
|
34
|
+
## Design intent
|
|
35
|
+
|
|
36
|
+
The palette keeps an ice-cream / sea-salt identity: cool cyan-blue accents with warm cream tooling on a calm neutral base.
|
|
37
|
+
|
|
38
|
+
- `accent` and borders use the sea-salt family;
|
|
39
|
+
- `toolTitle` uses cream/gold tones;
|
|
40
|
+
- `toolOutput`, `muted`, and `dim` form a readable text ladder;
|
|
41
|
+
- tool backgrounds remain transparent so the native `●` / `│` presentation stays light;
|
|
42
|
+
- `success`, `error`, and `warning` remain semantic pastel colors;
|
|
43
|
+
- thinking levels move from cool blue through green and gold to coral/red.
|
|
44
|
+
|
|
45
|
+
## Extension UI
|
|
46
|
+
|
|
47
|
+
Bundled dialogs, overlays, and the statusline use semantic theme helpers such as `theme.fg(...)` and `theme.bg(...)`. They do not hard-code ANSI colors or hex values.
|
|
48
|
+
|
|
49
|
+
## Theme files
|
|
50
|
+
|
|
51
|
+
The source assets are:
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
src/modes/interactive/theme/ice-cream-dark.json
|
|
55
|
+
src/modes/interactive/theme/ice-cream-light.json
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The normal package build copies all theme JSON assets into the runtime package. The themes use the schema at `src/modes/interactive/theme/theme-schema.json`.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Native tool presentation
|
|
2
|
+
|
|
3
|
+
This Fork changes Pi's native tool transcript presentation rather than replacing it with a separate `tools-view` extension.
|
|
4
|
+
|
|
5
|
+
## Visual language
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
● ToolName(args)
|
|
9
|
+
│ result
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
States use the same shell:
|
|
13
|
+
|
|
14
|
+
```text
|
|
15
|
+
● ToolName(args) completed call
|
|
16
|
+
● ToolName Working... pending call
|
|
17
|
+
● ToolName(args) failed call (error color)
|
|
18
|
+
│ result successful or failed output
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Implementation boundary
|
|
22
|
+
|
|
23
|
+
The main entry point is:
|
|
24
|
+
|
|
25
|
+
```text
|
|
26
|
+
src/modes/interactive/components/tool-execution.ts
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
It owns:
|
|
30
|
+
|
|
31
|
+
- the default call/result shell;
|
|
32
|
+
- pending, success, and error states;
|
|
33
|
+
- call titles and generic argument summaries;
|
|
34
|
+
- collapsed and expanded result behavior;
|
|
35
|
+
- generic fallback rendering;
|
|
36
|
+
- image placement and conversion.
|
|
37
|
+
|
|
38
|
+
Built-in renderers remain responsible for semantic content such as file paths, syntax highlighting, search results, Diff previews, and command output. The outer shell is native so built-in tools, bundled extensions, and compatible third-party tools share the same presentation.
|
|
39
|
+
|
|
40
|
+
Consecutive tools may opt into a shared collapsed group through `toolGroup`. Built-in `read` and `find` calls use the `explore` group: their call rows render as one compact run with a single leading gap, while `Ctrl+O` restores each tool's complete call and result.
|
|
41
|
+
|
|
42
|
+
## Renderer inheritance
|
|
43
|
+
|
|
44
|
+
| Tool definition | Behavior |
|
|
45
|
+
|---|---|
|
|
46
|
+
| No `renderCall`/`renderResult` | Uses the Fork's native call and result fallback. |
|
|
47
|
+
| Custom renderer with the default shell | Uses the native shell around the custom content. |
|
|
48
|
+
| `renderShell: "self"` | Keeps complete ownership of the tool's layout. |
|
|
49
|
+
|
|
50
|
+
Built-in tool definitions are also used when an extension overrides only one renderer slot. A custom call renderer can inherit the built-in result renderer, and vice versa.
|
|
51
|
+
|
|
52
|
+
Renderer failures fall back to native generic output rather than breaking the transcript.
|
|
53
|
+
|
|
54
|
+
## Generic fallback
|
|
55
|
+
|
|
56
|
+
When no semantic renderer is available:
|
|
57
|
+
|
|
58
|
+
- arguments are serialized into a bounded one-line summary;
|
|
59
|
+
- output is collapsed to the most recent ten visual lines;
|
|
60
|
+
- `Ctrl+O` expands the complete output;
|
|
61
|
+
- historical tools that are no longer registered still receive the same shell;
|
|
62
|
+
- failed calls use the error-colored bullet while result details keep the result bar.
|
|
63
|
+
|
|
64
|
+
The fallback does not change tool schemas, execution logic, or result protocols.
|
|
65
|
+
|
|
66
|
+
## Built-in behavior preserved
|
|
67
|
+
|
|
68
|
+
The native path continues to preserve:
|
|
69
|
+
|
|
70
|
+
- `read`, `bash`, `grep`, `find`, `ls`, `write`, and `edit` semantics;
|
|
71
|
+
- faithful width-aware raw command previews for Bash;
|
|
72
|
+
- running Bash duration after the two-second progress threshold, without a permanent completion timer;
|
|
73
|
+
- Diff previews and first-change-line metadata for `edit`;
|
|
74
|
+
- syntax highlighting;
|
|
75
|
+
- image output and Kitty conversion;
|
|
76
|
+
- native collapsed/expanded handling;
|
|
77
|
+
- custom UI explicitly using `renderShell: "self"`.
|
|
78
|
+
|
|
79
|
+
`edit` now uses the native outer shell while keeping its asynchronous Diff preview and final Diff result.
|
|
80
|
+
|
|
81
|
+
## Deliberately rejected approaches
|
|
82
|
+
|
|
83
|
+
This Fork does not use:
|
|
84
|
+
|
|
85
|
+
- prototype patching of `ToolExecutionComponent` from an extension;
|
|
86
|
+
- same-name re-registration to replace built-in tools;
|
|
87
|
+
- a global renderer registry exposed through Extension API;
|
|
88
|
+
- a restored `tools-view` extension;
|
|
89
|
+
- forced decoration of third-party tools that explicitly own their shell.
|
|
90
|
+
|
|
91
|
+
Those approaches either depend on private runtime internals, change execution ownership, or cannot reliably cover independently loaded extensions.
|
package/docs/extensions.md
CHANGED
|
@@ -457,7 +457,7 @@ pi.on("session_before_compact", async (event, ctx) => {
|
|
|
457
457
|
const { preparation, branchEntries, customInstructions, reason, willRetry, signal } = event;
|
|
458
458
|
|
|
459
459
|
// reason - "manual" (/compact), "threshold", or "overflow"
|
|
460
|
-
// willRetry - whether
|
|
460
|
+
// willRetry - whether overflow recovery intends to retry if compaction produces a safe retained context
|
|
461
461
|
|
|
462
462
|
// Cancel:
|
|
463
463
|
return { cancel: true };
|
|
@@ -477,7 +477,7 @@ pi.on("session_compact", async (event, ctx) => {
|
|
|
477
477
|
// event.compactionEntry - the saved compaction
|
|
478
478
|
// event.fromExtension - whether extension provided it
|
|
479
479
|
// event.reason - "manual" (/compact), "threshold", or "overflow"
|
|
480
|
-
// event.willRetry - whether
|
|
480
|
+
// event.willRetry - whether overflow recovery will actually retry after retained-context verification
|
|
481
481
|
});
|
|
482
482
|
```
|
|
483
483
|
|
|
@@ -585,6 +585,8 @@ pi.on("turn_end", async (event, ctx) => {
|
|
|
585
585
|
});
|
|
586
586
|
```
|
|
587
587
|
|
|
588
|
+
Between-tool auto-compaction runs after the completed tool turn's `turn_end`. If it cannot produce a safe next context, Pi stops before queue polling or another provider request. The upstream stateful Agent represents that package-local stop as an additional assistant error/aborted message lifecycle and `turn_end`, followed by `agent_end`; SDK, JSON, and RPC consumers can use the preceding `compaction_end` event for the detailed compaction failure or retained-context warning.
|
|
589
|
+
|
|
588
590
|
#### message_start / message_update / message_end
|
|
589
591
|
|
|
590
592
|
Fired for message lifecycle updates.
|
package/docs/index.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
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
4
|
|
|
5
|
-
This documentation covers product usage and public APIs.
|
|
5
|
+
This documentation covers product usage and public APIs. Distribution architecture, bundled behavior, upstream synchronization, and publishing are documented in [`docs/distribution/`](distribution/README.md).
|
|
6
6
|
|
|
7
7
|
## Quick start
|
|
8
8
|
|
package/docs/rpc.md
CHANGED
|
@@ -1359,8 +1359,8 @@ Parse errors:
|
|
|
1359
1359
|
## Types
|
|
1360
1360
|
|
|
1361
1361
|
Source files:
|
|
1362
|
-
- [
|
|
1363
|
-
- [
|
|
1362
|
+
- [upstream AI types](https://github.com/earendil-works/pi/blob/main/packages/ai/src/types.ts) - `Model`, `UserMessage`, `AssistantMessage`, `ToolResultMessage`
|
|
1363
|
+
- [upstream Agent types](https://github.com/earendil-works/pi/blob/main/packages/agent/src/types.ts) - `AgentMessage`, `AgentEvent`
|
|
1364
1364
|
- [`src/core/messages.ts`](../src/core/messages.ts) - `BashExecutionMessage`
|
|
1365
1365
|
- [`src/modes/rpc/rpc-types.ts`](../src/modes/rpc/rpc-types.ts) - RPC command/response types, extension UI request/response types
|
|
1366
1366
|
|
package/docs/themes.md
CHANGED
|
@@ -298,4 +298,4 @@ See the built-in themes:
|
|
|
298
298
|
- [ice-cream-dark.json](../src/modes/interactive/theme/ice-cream-dark.json)
|
|
299
299
|
- [ice-cream-light.json](../src/modes/interactive/theme/ice-cream-light.json)
|
|
300
300
|
|
|
301
|
-
The ice-cream palette and
|
|
301
|
+
The ice-cream palette and distribution-specific design notes are documented in [`docs/distribution/themes.md`](distribution/themes.md).
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "pi-extension-custom-provider",
|
|
2
|
+
"name": "pi-extension-custom-provider-anthropic",
|
|
3
3
|
"version": "0.82.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
|
-
"name": "pi-extension-custom-provider",
|
|
8
|
+
"name": "pi-extension-custom-provider-anthropic",
|
|
9
9
|
"version": "0.82.0",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@anthropic-ai/sdk": "
|
|
11
|
+
"@anthropic-ai/sdk": "0.52.0"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"node_modules/@anthropic-ai/sdk": {
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* npx tsx test.ts claude-sonnet-4-5-20250929 --thinking
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
import { getAgentDir } from "@astralyn/pi";
|
|
11
12
|
import { type Api, type Context, type Model, registerApiProvider, streamSimple } from "@earendil-works/pi-ai/compat";
|
|
12
13
|
import { readFileSync } from "fs";
|
|
13
|
-
import { getAgentDir } from "packages/coding-agent/src/config.js";
|
|
14
14
|
import { join } from "path";
|
|
15
15
|
import { MODELS, streamGitLabDuo } from "./index.ts";
|
|
16
16
|
|
|
File without changes
|
|
File without changes
|