@astralyn/pi 0.82.2 → 0.82.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +70 -634
  3. package/dist/core/extensions/types.d.ts +2 -0
  4. package/dist/core/extensions/types.d.ts.map +1 -1
  5. package/dist/core/extensions/types.js.map +1 -1
  6. package/dist/core/model-resolver.d.ts +1 -0
  7. package/dist/core/model-resolver.d.ts.map +1 -1
  8. package/dist/core/model-resolver.js +13 -3
  9. package/dist/core/model-resolver.js.map +1 -1
  10. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  11. package/dist/core/remote-catalog-provider.js +19 -1
  12. package/dist/core/remote-catalog-provider.js.map +1 -1
  13. package/dist/core/resource-loader.d.ts.map +1 -1
  14. package/dist/core/resource-loader.js +3 -0
  15. package/dist/core/resource-loader.js.map +1 -1
  16. package/dist/extensions/llama/provider.d.ts.map +1 -1
  17. package/dist/extensions/llama/provider.js +6 -0
  18. package/dist/extensions/llama/provider.js.map +1 -1
  19. package/dist/modes/interactive/components/custom-message.d.ts +3 -1
  20. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  21. package/dist/modes/interactive/components/custom-message.js +10 -2
  22. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  23. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  24. package/dist/modes/interactive/components/scoped-models-selector.js +22 -13
  25. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  26. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  27. package/dist/modes/interactive/interactive-mode.js +28 -16
  28. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  29. package/docs/bundled/README.md +38 -0
  30. package/docs/bundled/extensions/README.md +18 -0
  31. package/docs/{distribution → bundled}/extensions/question.md +0 -11
  32. package/docs/{distribution → bundled}/extensions/rewind.md +0 -10
  33. package/docs/{distribution → bundled}/extensions/router.md +1 -14
  34. package/docs/{distribution → bundled}/extensions/statusline.md +1 -2
  35. package/docs/{distribution → bundled}/extensions/subagent.md +0 -7
  36. package/docs/bundled/extensions/todo.md +28 -0
  37. package/docs/{distribution → bundled}/themes.md +4 -11
  38. package/docs/{distribution → bundled}/tool-presentation.md +4 -10
  39. package/docs/compaction.md +12 -12
  40. package/docs/custom-provider.md +8 -8
  41. package/docs/docs.json +57 -9
  42. package/docs/extensions.md +10 -11
  43. package/docs/index.md +12 -7
  44. package/docs/json.md +4 -4
  45. package/docs/providers.md +1 -1
  46. package/docs/rpc.md +3 -9
  47. package/docs/session-format.md +5 -5
  48. package/docs/skills.md +1 -1
  49. package/docs/themes.md +4 -8
  50. package/docs/tui.md +1 -1
  51. package/examples/extensions/README.md +0 -1
  52. package/examples/extensions/custom-provider-anthropic/index.ts +4 -4
  53. package/examples/extensions/custom-provider-gitlab-duo/index.ts +2 -2
  54. package/examples/extensions/dynamic-resources/dynamic.json +1 -1
  55. package/examples/extensions/gondolin/index.ts +4 -6
  56. package/examples/extensions/message-renderer.ts +2 -2
  57. package/examples/extensions/overlay-qa-tests.ts +2 -2
  58. package/examples/extensions/project-trust.ts +2 -2
  59. package/examples/sdk/README.md +38 -44
  60. package/npm-shrinkwrap.json +2 -2
  61. package/package.json +6 -2
  62. package/docs/development.md +0 -68
  63. package/docs/distribution/README.md +0 -34
  64. package/docs/distribution/architecture.md +0 -102
  65. package/docs/distribution/extensions/README.md +0 -17
  66. package/docs/distribution/maintenance.md +0 -121
  67. package/docs/distribution/release.md +0 -85
  68. package/examples/extensions/subagent/README.md +0 -175
  69. package/examples/extensions/subagent/agents/planner.md +0 -37
  70. package/examples/extensions/subagent/agents/reviewer.md +0 -35
  71. package/examples/extensions/subagent/agents/scout.md +0 -50
  72. package/examples/extensions/subagent/agents/worker.md +0 -24
  73. package/examples/extensions/subagent/agents.ts +0 -126
  74. package/examples/extensions/subagent/index.ts +0 -1009
  75. package/examples/extensions/subagent/prompts/implement-and-review.md +0 -10
  76. package/examples/extensions/subagent/prompts/implement.md +0 -10
  77. package/examples/extensions/subagent/prompts/scout-and-plan.md +0 -9
  78. /package/docs/{distribution → bundled}/extensions/deepwiki.md +0 -0
@@ -0,0 +1,38 @@
1
+ # Bundled features
2
+
3
+ The installed `@astralyn/pi` package includes a small set of workflows and presentation choices on top of its coding-agent behavior. Upstream Pi release tags are synchronization input, not a separate user documentation set.
4
+
5
+ ## Extensions
6
+
7
+ The following extensions are loaded as hidden built-ins. They use the same public Extension API available to external extensions.
8
+
9
+ | Extension | Tool or command | Purpose |
10
+ |---|---|---|
11
+ | `llama.cpp` | `/llama` | Manage models served by the local llama.cpp router |
12
+ | `deepwiki` | `deepwiki` | Query indexed public GitHub repository documentation |
13
+ | `question` | `question` | Ask structured questions through native interactive UI |
14
+ | `rewind` | `/rewind` | Create and restore project snapshots around session lifecycle operations |
15
+ | `router` | `/router` | Configure and probe Codex-style routing endpoints |
16
+ | `statusline` | Footer status | Show concise extension-managed activity state |
17
+ | `subagent` | `subagent`, `/agents` | Delegate bounded work to isolated child Pi sessions |
18
+ | `todo` | `todo`, `/todos` | Track multi-step work with dependencies and status |
19
+
20
+ See the [bundled extension catalog](extensions/README.md) for configuration and behavior details.
21
+
22
+ ## Context safety
23
+
24
+ Long tool loops are checked after a completed tool batch and before another provider request. When the active context crosses the configured auto-compaction threshold, Pi compacts and rebuilds the context before continuing the same run. Cancellation, compaction failure, an unavailable cut point, or retained context that remains unsafe stops before another provider request.
25
+
26
+ See [Compaction](../compaction.md).
27
+
28
+ ## Tool presentation
29
+
30
+ Native tool calls use a consistent `●` call and `│` result shell with bounded collapsed output. Built-in semantic renderers remain responsible for paths, diffs, syntax highlighting, command output, and images.
31
+
32
+ See [Native tool presentation](tool-presentation.md).
33
+
34
+ ## Themes
35
+
36
+ The package includes `ice-cream-dark` and `ice-cream-light` alongside the standard `dark` and `light` themes.
37
+
38
+ See [Bundled themes](themes.md) and [Theme authoring](../themes.md).
@@ -0,0 +1,18 @@
1
+ # Bundled extensions
2
+
3
+ These are extensions shipped in the `@astralyn/pi` npm package. For the public API used to write external extensions, see the [Extension API documentation](../../extensions.md).
4
+
5
+ They are registered as hidden built-in extensions and use the same public Extension API available to external extensions. Their implementation details are internal to the package and are not required for installation or configuration.
6
+
7
+ | Extension | Tool or command | Documentation |
8
+ |---|---|---|
9
+ | `llama.cpp` | `/llama` | [llama.cpp](../../llama-cpp.md) |
10
+ | `deepwiki` | `deepwiki` | [deepwiki.md](deepwiki.md) |
11
+ | `question` | `question` | [question.md](question.md) |
12
+ | `todo` | `todo`, `/todos` | [todo.md](todo.md) |
13
+ | `rewind` | `/rewind`, `/tree` lifecycle | [rewind.md](rewind.md) |
14
+ | `router` | `/router` | [router.md](router.md) |
15
+ | `statusline` | Footer | [statusline.md](statusline.md) |
16
+ | `subagent` | `subagent`, `/agents` | [subagent.md](subagent.md) |
17
+
18
+ The catalog documents installed-package behavior and configuration; it does not require access to the package's internal source.
@@ -46,14 +46,3 @@ The transcript uses a private `renderCall` / `renderResult` only to replace raw
46
46
  - `validateQuestions` enforces uniqueness, reserved-label rejection, and text budgets beyond what the JSON schema can express.
47
47
  - Dialog navigation follows Pi's injected select/input keybindings where applicable; custom actions such as Space-to-toggle remain explicit in the footer.
48
48
 
49
- **Files:**
50
-
51
- - `constants.ts` — tool identity and model-facing prompt copy
52
- - `index.ts` — tool registration and execution
53
- - `dialog.ts` — interactive dialog, review, and discussion flow
54
- - `schema.ts` — params and semantic validation
55
- - `state.ts` — per-question dialog state helpers and answer ordering
56
- - `results.ts` — bounded model-result builders
57
- - `render.ts` — compact transcript summaries within Pi's native tool frame
58
- - `limits.ts` — UI and model-output budgets
59
- - `types.ts` — shared interfaces and the `OTHER_OPTION` sentinel
@@ -71,15 +71,5 @@ rebuilt from them on `session_start`.
71
71
  - **Config is memory-cached.** `config.json` is re-read on `session_start` and updated in memory when `/rewind` saves.
72
72
  - **Restore path is single-scan.** The `/tree` confirm pass caches changed absolute paths; IO is concurrency-capped (16).
73
73
 
74
- **Files:**
75
-
76
- - `index.ts` — lifecycle hooks (`tool_call`, `before_agent_start`, `agent_settled`, `session_start`, `session_before_tree`/`session_tree`, `session_shutdown`) and the `/rewind` command
77
- - `engine.ts` — the file-history backup engine (track / snapshot / apply / resume-migrate), ported from Claude Code's file-history
78
- - `snapshot.ts` — persisted snapshot data shapes (pure)
79
- - `config.ts` — load/save `rewind/config.json`
80
- - `gc.ts` — age + orphan storage reclamation; storage inventory for the menu
81
- - `menu.ts` — the `/rewind` settings + storage menu
82
- - `restore.ts` — `/tree`-target → snapshot matching and restore
83
- - `paths.ts`, `text.ts`, `tool-path.ts` — private helpers owned by this plugin
84
74
 
85
75
  Architecture informed by oh-my-pi (GPL-3.0) and Claude Code's file-history; independent implementation.
@@ -4,7 +4,7 @@
4
4
 
5
5
  Configuration lives at `~/.pi/agent/router.json`.
6
6
 
7
- Providers are registered at extension load via `pi.registerProvider` (config form + `streamSimple`). They do **not** go through `models.json`. This follows Pi's documented custom-provider path ([providers.md](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/providers.md), [custom-provider.md](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/custom-provider.md)): the stream wraps the built-in `openAIResponsesApi()` from `@earendil-works/pi-ai/compat` (same approach as the GitLab Duo example), then reshapes the request for Codex-style relays.
7
+ Providers are registered at extension load via `pi.registerProvider` (config form + `streamSimple`). They do **not** go through `models.json`. This follows Pi's documented custom-provider path ([providers.md](../../providers.md), [custom-provider.md](../../custom-provider.md)): the stream wraps the built-in `openAIResponsesApi()` from `@earendil-works/pi-ai/compat` (same approach as the GitLab Duo example), then reshapes the request for Codex-style relays.
8
8
 
9
9
  ---
10
10
 
@@ -123,17 +123,4 @@ Session affinity headers use hyphenated form (`session-id`, `x-client-request-id
123
123
 
124
124
  **Multi-turn tool calls.** On a fixed relay + fixed model, tool-call ids preserve the Responses form and replay like Codex. Pi only rewrites ids across model boundaries. Staying on one model for long tool + reasoning sessions avoids id sanitization.
125
125
 
126
- **Files:**
127
126
 
128
- | File | Role |
129
- |:-:|:-:|
130
- | `index.ts` | Async factory: load config, register providers, handle `/router` commands |
131
- | `store.ts` | `router.json` read / write |
132
- | `register.ts` | `registerProvider` / unregister |
133
- | `stream.ts` | Wraps `openAIResponsesApi` + payload reshape |
134
- | `probe.ts` | `GET …/models` catalog fetch |
135
- | `presets.ts` | 272k defaults + thinking-level map helpers |
136
- | `dialog.ts` | Selectors, multi-select, thinking editor (dirty Esc warning) |
137
- | `ui.ts` | Command flows; auto-save on relay mutations |
138
- | `constants.ts` | Command name, defaults, `router-codex` API tag |
139
- | `types.ts` | Config types |
@@ -95,7 +95,7 @@ may be removed manually.
95
95
 
96
96
  ## Limits
97
97
 
98
- - Auto-enables only in TUI mode on `session_start`; RPC and print modes show the upstream footer.
98
+ - Auto-enables only in TUI mode on `session_start`; RPC and print modes have no TUI footer.
99
99
  - The native `(auto)` compaction marker is not reproduced because Pi does not expose that state to extensions.
100
100
 
101
101
  ## Implementation notes
@@ -107,4 +107,3 @@ Footer paint is hot (every TUI render). The extension caches:
107
107
 
108
108
  Both caches clear on footer `invalidate()`.
109
109
 
110
- **Files:** `index.ts` — footer lifecycle, formatting, usage aggregation, and responsive two-line left/right layout.
@@ -93,10 +93,3 @@ They apply only to future subagent runs and never change the parent session's `/
93
93
 
94
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
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,28 @@
1
+ # todo — task list overlay
2
+
3
+ Adds a `todo` tool plus `/todos` for multi-step work, with a live overlay above the editor.
4
+
5
+ ## Behavior
6
+
7
+ - Actions: `create`, `update`, `list`, `get`, `delete`, `clear`. Statuses: `pending`, `in_progress`, `completed`, `deleted`. `list` accepts an optional `status` filter and `includeDeleted`; `status: "deleted"` includes tombstones directly.
8
+ - The live overlay renders above the editor and hides itself when there are no visible tasks.
9
+ - Creation always starts a task as `pending`; `blockedBy` dependencies are supported for sequencing, and missing dependencies, deleted dependencies, self-dependencies, and cycles are rejected. A task cannot move to `in_progress` or `completed` until every `blockedBy` dependency is `completed`.
10
+ - Deletion — via `delete` or `update` with `status: "deleted"` — leaves an immutable tombstone for branch history, removes that task from every dependent `blockedBy` list, and therefore releases dependents. `clear` empties the list without reusing ids.
11
+ - Newly completed tasks remain visible for 30 seconds, then drop from the overlay; historical completions loaded by `/reload` or `/tree` stay hidden so live work remains prominent.
12
+ - **Exactly one `in_progress`.** Moving a task to `in_progress` auto-demotes any other `in_progress` tasks to `pending`; the tool result lists demoted ids so the model sees the side effect.
13
+ - **Verification soft nudge.** When a completion leaves the list fully done with 3+ completed tasks and no subject/description matching `verif|test|check|review`, the tool result appends a short NOTE (text only — `details` schema unchanged).
14
+
15
+ ## Limits
16
+
17
+ - `list` output is bounded at 50 items by default, with a trailing notice when truncated.
18
+ - The overlay body is capped at 10 rows; its truncation summary includes hidden status counts.
19
+ - Newly completed tasks remain visible for 30 seconds then drop from the overlay.
20
+
21
+ ## Implementation notes
22
+
23
+ - **Conversation-backed state.** Every tool result stores a full snapshot in `details`; lifecycle handlers replay the current branch on `/reload`, compaction, and session-tree navigation. There is no separate disk database. Compaction-safe by design: `sessionManager.getBranch()` returns the full branch history — only `buildSessionContext` summarizes for the LLM. Replay walks the branch **tail → head** and stops at the latest todo `toolResult`.
24
+ - **State is keyed per session id.** Resume and `/tree` can switch sessions within one process; `execute` and the lifecycle handlers re-point the active bucket before touching state.
25
+ - **Status transitions are gated.** `completed` can be reopened to `in_progress` or `pending`, but a `deleted` tombstone is terminal. Single-active is enforced on demote (not hard-reject) so the model does not need a retry loop.
26
+ - **Tool execution is sequential** (`executionMode: "sequential"`) so parallel tool calls cannot race on in-memory state. Validation failures **throw** so Pi marks `isError: true` and the branch replays the last good snapshot.
27
+ - **Overlay paint is pure + width-cached.** Completion visibility bookkeeping runs in `update()` plus a disposable timeout, never during `render`. Same terminal width reuses the last line array.
28
+
@@ -1,8 +1,8 @@
1
1
  # Bundled theme design
2
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).
3
+ This document describes the themes shipped in the `@astralyn/pi` package. For theme discovery, JSON format, and custom theme authoring, see the [Theme API documentation](../themes.md).
4
4
 
5
- The Fork bundles two Pi themes using the native theme schema and loader:
5
+ The package bundles two Pi themes using the native theme schema and loader:
6
6
 
7
7
  | Theme | Use |
8
8
  |---|---|
@@ -46,13 +46,6 @@ The palette keeps an ice-cream / sea-salt identity: cool cyan-blue accents with
46
46
 
47
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
48
 
49
- ## Theme files
49
+ ## Theme assets
50
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`.
51
+ The built-in theme names are stable user-facing identifiers. In an installed package, the JSON assets are available under `dist/modes/interactive/theme/` if you need to inspect them; normal use does not require accessing those internal files.
@@ -1,6 +1,6 @@
1
1
  # Native tool presentation
2
2
 
3
- This Fork changes Pi's native tool transcript presentation rather than replacing it with a separate `tools-view` extension.
3
+ The `@astralyn/pi` package uses Pi's native tool transcript presentation rather than replacing it with a separate `tools-view` extension.
4
4
 
5
5
  ## Visual language
6
6
 
@@ -20,13 +20,7 @@ States use the same shell:
20
20
 
21
21
  ## Implementation boundary
22
22
 
23
- The main entry point is:
24
-
25
- ```text
26
- src/modes/interactive/components/tool-execution.ts
27
- ```
28
-
29
- It owns:
23
+ The native tool presentation owns:
30
24
 
31
25
  - the default call/result shell;
32
26
  - pending, success, and error states;
@@ -43,7 +37,7 @@ Consecutive tools may opt into a shared collapsed group through `toolGroup`. Bui
43
37
 
44
38
  | Tool definition | Behavior |
45
39
  |---|---|
46
- | No `renderCall`/`renderResult` | Uses the Fork's native call and result fallback. |
40
+ | No `renderCall`/`renderResult` | Uses the package's native call and result fallback. |
47
41
  | Custom renderer with the default shell | Uses the native shell around the custom content. |
48
42
  | `renderShell: "self"` | Keeps complete ownership of the tool's layout. |
49
43
 
@@ -80,7 +74,7 @@ The native path continues to preserve:
80
74
 
81
75
  ## Deliberately rejected approaches
82
76
 
83
- This Fork does not use:
77
+ The package does not use:
84
78
 
85
79
  - prototype patching of `ToolExecutionComponent` from an extension;
86
80
  - same-name re-registration to replace built-in tools;
@@ -2,12 +2,12 @@
2
2
 
3
3
  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.
4
4
 
5
- **Source files** ([pi-mono](https://github.com/earendil-works/pi-mono)):
6
- - [`packages/coding-agent/src/core/compaction/compaction.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/compaction/compaction.ts) - Auto-compaction logic
7
- - [`packages/coding-agent/src/core/compaction/branch-summarization.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts) - Branch summarization
8
- - [`packages/coding-agent/src/core/compaction/utils.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/compaction/utils.ts) - Shared utilities (file tracking, serialization)
9
- - [`packages/coding-agent/src/core/session-manager.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/session-manager.ts) - Entry types (`CompactionEntry`, `BranchSummaryEntry`)
10
- - [`packages/coding-agent/src/core/extensions/types.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/extensions/types.ts) - Extension event types
5
+ **Source files** ([ming-kang/pi](https://github.com/ming-kang/pi)):
6
+ - [`src/core/compaction/compaction.ts`](https://github.com/ming-kang/pi/blob/main/src/core/compaction/compaction.ts) - Auto-compaction logic
7
+ - [`src/core/compaction/branch-summarization.ts`](https://github.com/ming-kang/pi/blob/main/src/core/compaction/branch-summarization.ts) - Branch summarization
8
+ - [`src/core/compaction/utils.ts`](https://github.com/ming-kang/pi/blob/main/src/core/compaction/utils.ts) - Shared utilities (file tracking, serialization)
9
+ - [`src/core/session-manager.ts`](https://github.com/ming-kang/pi/blob/main/src/core/session-manager.ts) - Entry types (`CompactionEntry`, `BranchSummaryEntry`)
10
+ - [`src/core/extensions/types.ts`](https://github.com/ming-kang/pi/blob/main/src/core/extensions/types.ts) - Extension event types
11
11
 
12
12
  For TypeScript definitions in your project, inspect `node_modules/@astralyn/pi/dist/`.
13
13
 
@@ -124,7 +124,7 @@ Never cut at tool results (they must stay with their tool call).
124
124
 
125
125
  ### CompactionEntry Structure
126
126
 
127
- Defined in [`session-manager.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/session-manager.ts):
127
+ Defined in [`session-manager.ts`](https://github.com/ming-kang/pi/blob/main/src/core/session-manager.ts):
128
128
 
129
129
  ```typescript
130
130
  interface CompactionEntry<T = unknown> {
@@ -149,7 +149,7 @@ interface CompactionDetails {
149
149
 
150
150
  Extensions can store any JSON-serializable data in `details`. The default compaction tracks file operations, but custom extension implementations can use their own structure. Generated and extension-provided summaries store their LLM `usage` when available so session totals include summarization work.
151
151
 
152
- See [`prepareCompaction()`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/compaction/compaction.ts) and [`compact()`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/compaction/compaction.ts) for the implementation. For direct programmatic summarization, `generateSummary()` returns the summary text and `generateSummaryWithUsage()` returns `{ text, usage }`.
152
+ See [`prepareCompaction()`](https://github.com/ming-kang/pi/blob/main/src/core/compaction/compaction.ts) and [`compact()`](https://github.com/ming-kang/pi/blob/main/src/core/compaction/compaction.ts) for the implementation. For direct programmatic summarization, `generateSummary()` returns the summary text and `generateSummaryWithUsage()` returns `{ text, usage }`.
153
153
 
154
154
  ## Branch Summarization
155
155
 
@@ -192,7 +192,7 @@ This means file tracking accumulates across multiple compactions or nested branc
192
192
 
193
193
  ### BranchSummaryEntry Structure
194
194
 
195
- Defined in [`session-manager.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/session-manager.ts):
195
+ Defined in [`session-manager.ts`](https://github.com/ming-kang/pi/blob/main/src/core/session-manager.ts):
196
196
 
197
197
  ```typescript
198
198
  interface BranchSummaryEntry<T = unknown> {
@@ -216,7 +216,7 @@ interface BranchSummaryDetails {
216
216
 
217
217
  Same as compaction, extensions can store custom data in `details`.
218
218
 
219
- See [`collectEntriesForBranchSummary()`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts), [`prepareBranchEntries()`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts), and [`generateBranchSummary()`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts) for the implementation.
219
+ See [`collectEntriesForBranchSummary()`](https://github.com/ming-kang/pi/blob/main/src/core/compaction/branch-summarization.ts), [`prepareBranchEntries()`](https://github.com/ming-kang/pi/blob/main/src/core/compaction/branch-summarization.ts), and [`generateBranchSummary()`](https://github.com/ming-kang/pi/blob/main/src/core/compaction/branch-summarization.ts) for the implementation.
220
220
 
221
221
  ## Summary Format
222
222
 
@@ -260,7 +260,7 @@ path/to/changed.ts
260
260
 
261
261
  ### Message Serialization
262
262
 
263
- Before summarization, messages are serialized to text via [`serializeConversation()`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/compaction/utils.ts):
263
+ Before summarization, messages are serialized to text via [`serializeConversation()`](https://github.com/ming-kang/pi/blob/main/src/core/compaction/utils.ts):
264
264
 
265
265
  ```
266
266
  [User]: What they said
@@ -276,7 +276,7 @@ Tool results are truncated to 2000 characters during serialization. Content beyo
276
276
 
277
277
  ## Custom Summarization via Extensions
278
278
 
279
- Extensions can intercept and customize both compaction and branch summarization. See [`extensions/types.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/extensions/types.ts) for event type definitions.
279
+ Extensions can intercept and customize both compaction and branch summarization. See [`extensions/types.ts`](https://github.com/ming-kang/pi/blob/main/src/core/extensions/types.ts) for event type definitions.
280
280
 
281
281
  ### session_before_compact
282
282
 
@@ -397,12 +397,12 @@ interface OAuthCredentials {
397
397
  For providers with non-standard APIs, implement `streamSimple`. Study the existing provider implementations before writing your own:
398
398
 
399
399
  **Reference implementations:**
400
- - [anthropic.ts](https://github.com/earendil-works/pi-mono/blob/main/packages/ai/src/providers/anthropic.ts) - Anthropic Messages API
401
- - [mistral.ts](https://github.com/earendil-works/pi-mono/blob/main/packages/ai/src/providers/mistral.ts) - Mistral Conversations API
402
- - [openai-completions.ts](https://github.com/earendil-works/pi-mono/blob/main/packages/ai/src/providers/openai-completions.ts) - OpenAI Chat Completions
403
- - [openai-responses.ts](https://github.com/earendil-works/pi-mono/blob/main/packages/ai/src/providers/openai-responses.ts) - OpenAI Responses API
404
- - [google.ts](https://github.com/earendil-works/pi-mono/blob/main/packages/ai/src/providers/google.ts) - Google Generative AI
405
- - [amazon-bedrock.ts](https://github.com/earendil-works/pi-mono/blob/main/packages/ai/src/providers/amazon-bedrock.ts) - AWS Bedrock
400
+ - [anthropic.ts](https://github.com/earendil-works/pi/blob/v0.82.1/packages/ai/src/providers/anthropic.ts) - Anthropic Messages API
401
+ - [mistral.ts](https://github.com/earendil-works/pi/blob/v0.82.1/packages/ai/src/providers/mistral.ts) - Mistral Conversations API
402
+ - [openai-completions.ts](https://github.com/earendil-works/pi/blob/v0.82.1/packages/ai/src/providers/openai-completions.ts) - OpenAI Chat Completions
403
+ - [openai-responses.ts](https://github.com/earendil-works/pi/blob/v0.82.1/packages/ai/src/providers/openai-responses.ts) - OpenAI Responses API
404
+ - [google.ts](https://github.com/earendil-works/pi/blob/v0.82.1/packages/ai/src/providers/google.ts) - Google Generative AI
405
+ - [amazon-bedrock.ts](https://github.com/earendil-works/pi/blob/v0.82.1/packages/ai/src/providers/amazon-bedrock.ts) - AWS Bedrock
406
406
 
407
407
  ### Stream Pattern
408
408
 
@@ -565,7 +565,7 @@ When a request exceeds the model's context window, pi can recover automatically
565
565
  Detection runs on the finalized assistant message:
566
566
 
567
567
  - `stopReason === "error"`
568
- - `errorMessage` matches one of pi's known overflow patterns (see [`packages/ai/src/utils/overflow.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/ai/src/utils/overflow.ts))
568
+ - `errorMessage` matches one of pi's known overflow patterns (see [`packages/ai/src/utils/overflow.ts`](https://github.com/earendil-works/pi/blob/v0.82.1/packages/ai/src/utils/overflow.ts))
569
569
 
570
570
  If your provider returns overflow errors with a message pi does not recognize, normalize the error from the same extension that registers the provider. Use a `message_end` handler to rewrite the assistant message so its `errorMessage` starts with a phrase pi recognizes. The generic fallback `context_length_exceeded` is the safest choice.
571
571
 
@@ -628,7 +628,7 @@ pi.registerProvider("my-provider", {
628
628
 
629
629
  ## Testing Your Implementation
630
630
 
631
- 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/earendil-works/pi-mono/tree/main/packages/ai/test):
631
+ 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/earendil-works/pi/tree/v0.82.1/packages/ai/test):
632
632
 
633
633
  | Test | Purpose |
634
634
  |------|---------|
package/docs/docs.json CHANGED
@@ -19,6 +19,10 @@
19
19
  "title": "Providers",
20
20
  "path": "providers.md"
21
21
  },
22
+ {
23
+ "title": "llama.cpp",
24
+ "path": "llama-cpp.md"
25
+ },
22
26
  {
23
27
  "title": "Security",
24
28
  "path": "security.md"
@@ -45,6 +49,55 @@
45
49
  }
46
50
  ]
47
51
  },
52
+ {
53
+ "title": "Bundled features",
54
+ "items": [
55
+ {
56
+ "title": "Overview",
57
+ "path": "bundled/README.md"
58
+ },
59
+ {
60
+ "title": "Extension catalog",
61
+ "path": "bundled/extensions/README.md"
62
+ },
63
+ {
64
+ "title": "DeepWiki",
65
+ "path": "bundled/extensions/deepwiki.md"
66
+ },
67
+ {
68
+ "title": "Question",
69
+ "path": "bundled/extensions/question.md"
70
+ },
71
+ {
72
+ "title": "Rewind",
73
+ "path": "bundled/extensions/rewind.md"
74
+ },
75
+ {
76
+ "title": "Router",
77
+ "path": "bundled/extensions/router.md"
78
+ },
79
+ {
80
+ "title": "Statusline",
81
+ "path": "bundled/extensions/statusline.md"
82
+ },
83
+ {
84
+ "title": "Subagent",
85
+ "path": "bundled/extensions/subagent.md"
86
+ },
87
+ {
88
+ "title": "Todo",
89
+ "path": "bundled/extensions/todo.md"
90
+ },
91
+ {
92
+ "title": "Bundled themes",
93
+ "path": "bundled/themes.md"
94
+ },
95
+ {
96
+ "title": "Native tool presentation",
97
+ "path": "bundled/tool-presentation.md"
98
+ }
99
+ ]
100
+ },
48
101
  {
49
102
  "title": "Customization",
50
103
  "items": [
@@ -81,6 +134,10 @@
81
134
  {
82
135
  "title": "Reference",
83
136
  "items": [
137
+ {
138
+ "title": "Environment Variables",
139
+ "path": "environment-variables.md"
140
+ },
84
141
  {
85
142
  "title": "Session Format",
86
143
  "path": "session-format.md"
@@ -132,15 +189,6 @@
132
189
  "path": "shell-aliases.md"
133
190
  }
134
191
  ]
135
- },
136
- {
137
- "title": "Development",
138
- "items": [
139
- {
140
- "title": "Development",
141
- "path": "development.md"
142
- }
143
- ]
144
192
  }
145
193
  ],
146
194
  "redirects": [
@@ -2043,13 +2043,13 @@ See [examples/extensions/tool-override.ts](../examples/extensions/tool-override.
2043
2043
  **Your implementation must match the exact result shape**, including the `details` type. The UI and session logic depend on these shapes for rendering and state tracking.
2044
2044
 
2045
2045
  Built-in tool implementations:
2046
- - [read.ts](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/tools/read.ts) - `ReadToolDetails`
2047
- - [bash.ts](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/tools/bash.ts) - `BashToolDetails`
2048
- - [edit.ts](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/tools/edit.ts)
2049
- - [write.ts](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/tools/write.ts)
2050
- - [grep.ts](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/tools/grep.ts) - `GrepToolDetails`
2051
- - [find.ts](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/tools/find.ts) - `FindToolDetails`
2052
- - [ls.ts](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/tools/ls.ts) - `LsToolDetails`
2046
+ - [read.ts](https://github.com/ming-kang/pi/blob/main/src/core/tools/read.ts) - `ReadToolDetails`
2047
+ - [bash.ts](https://github.com/ming-kang/pi/blob/main/src/core/tools/bash.ts) - `BashToolDetails`
2048
+ - [edit.ts](https://github.com/ming-kang/pi/blob/main/src/core/tools/edit.ts)
2049
+ - [write.ts](https://github.com/ming-kang/pi/blob/main/src/core/tools/write.ts)
2050
+ - [grep.ts](https://github.com/ming-kang/pi/blob/main/src/core/tools/grep.ts) - `GrepToolDetails`
2051
+ - [find.ts](https://github.com/ming-kang/pi/blob/main/src/core/tools/find.ts) - `FindToolDetails`
2052
+ - [ls.ts](https://github.com/ming-kang/pi/blob/main/src/core/tools/ls.ts) - `LsToolDetails`
2053
2053
 
2054
2054
  ### Remote Execution
2055
2055
 
@@ -2180,7 +2180,7 @@ export default function (pi: ExtensionAPI) {
2180
2180
 
2181
2181
  ### Custom Rendering
2182
2182
 
2183
- Tools can provide `renderCall` and `renderResult` for custom TUI display. See [tui.md](tui.md) for the full component API and [tool-execution.ts](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/modes/interactive/components/tool-execution.ts) for how tool rows are composed.
2183
+ Tools can provide `renderCall` and `renderResult` for custom TUI display. See [tui.md](tui.md) for the full component API and [tool-execution.ts](https://github.com/ming-kang/pi/blob/main/src/modes/interactive/components/tool-execution.ts) for how tool rows are composed.
2184
2184
 
2185
2185
  By default, tool output is wrapped in a `Box` that handles padding and background. A defined `renderCall` or `renderResult` must return a `Component`. If a slot renderer is not defined, `tool-execution.ts` uses fallback rendering for that slot.
2186
2186
 
@@ -2793,7 +2793,7 @@ Register a custom renderer for messages with your `customType`. Use message rend
2793
2793
  import { Text } from "@earendil-works/pi-tui";
2794
2794
 
2795
2795
  pi.registerMessageRenderer("my-extension", (message, options, theme) => {
2796
- const { expanded } = options;
2796
+ const { expanded, outputPad } = options;
2797
2797
  let text = theme.fg("accent", `[${message.customType}] `);
2798
2798
  text += message.content;
2799
2799
 
@@ -2801,7 +2801,7 @@ pi.registerMessageRenderer("my-extension", (message, options, theme) => {
2801
2801
  text += "\n" + theme.fg("dim", JSON.stringify(message.details, null, 2));
2802
2802
  }
2803
2803
 
2804
- return new Text(text, 0, 0);
2804
+ return new Text(text, outputPad, 0);
2805
2805
  });
2806
2806
  ```
2807
2807
 
@@ -2942,7 +2942,6 @@ All examples in [examples/extensions/](../examples/extensions/).
2942
2942
  | `interactive-shell.ts` | Persistent shell session | `on("user_bash")` |
2943
2943
  | `sandbox/` | Sandboxed tool execution | Tool operations |
2944
2944
  | `gondolin/` | Route built-in tools and `!` commands into a Gondolin micro-VM | Tool operations, built-in tool overrides, `on("user_bash")` |
2945
- | `subagent/` | Spawn sub-agents | `registerTool`, `exec` |
2946
2945
  | **Games** |||
2947
2946
  | `snake.ts` | Snake game | `registerCommand`, `ui.custom`, keyboard handling |
2948
2947
  | `space-invaders.ts` | Space Invaders game | `registerCommand`, `ui.custom` |
package/docs/index.md CHANGED
@@ -1,8 +1,8 @@
1
- # Pi user and API documentation
1
+ # @astralyn/pi user and API documentation
2
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.
3
+ @astralyn/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. Distribution architecture, bundled behavior, upstream synchronization, and publishing are documented in [`docs/distribution/`](distribution/README.md).
5
+ This documentation is owned by @astralyn/pi and describes the behavior of the installed npm package, including its bundled features and public APIs. Upstream Pi documentation and release tags are used only as synchronization input; they are not the user-facing source for these docs.
6
6
 
7
7
  ## Quick start
8
8
 
@@ -45,6 +45,15 @@ For the full first-run flow, see [Quickstart](quickstart.md).
45
45
  - [Sessions](sessions.md) - session management, branching, and tree navigation.
46
46
  - [Compaction](compaction.md) - context compaction and branch summarization.
47
47
 
48
+ ## Bundled features
49
+
50
+ The installed package includes built-in extensions, themes, and native tool presentation:
51
+
52
+ - [Bundled overview](bundled/README.md) - package features and how they fit together.
53
+ - [Bundled extensions](bundled/extensions/README.md) - catalog and links to every bundled extension.
54
+ - [Bundled themes](bundled/themes.md) - the ice-cream themes included with the package.
55
+ - [Native tool presentation](bundled/tool-presentation.md) - the shared tool-call and result layout.
56
+
48
57
  ## Customization
49
58
 
50
59
  - [Extensions](extensions.md) - TypeScript modules for tools, commands, events, and custom UI.
@@ -74,7 +83,3 @@ For the full first-run flow, see [Quickstart](quickstart.md).
74
83
  - [tmux](tmux.md)
75
84
  - [Terminal setup](terminal-setup.md)
76
85
  - [Shell aliases](shell-aliases.md)
77
-
78
- ## Development
79
-
80
- - [Development](development.md) - local setup, project structure, and debugging.
package/docs/json.md CHANGED
@@ -8,7 +8,7 @@ Outputs all session events as JSON lines to stdout. Useful for integrating pi in
8
8
 
9
9
  ## Event Types
10
10
 
11
- Events are defined in [`AgentSessionEvent`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/agent-session.ts#L102):
11
+ Events are defined in [`AgentSessionEvent`](https://github.com/ming-kang/pi/blob/main/src/core/agent-session.ts#L102):
12
12
 
13
13
  ```typescript
14
14
  type AgentSessionEvent =
@@ -26,7 +26,7 @@ type AgentSessionEvent =
26
26
 
27
27
  `queue_update` emits the full pending steering and follow-up queues whenever they change. `compaction_start` and `compaction_end` cover both manual and automatic compaction.
28
28
 
29
- Base events from [`AgentEvent`](https://github.com/earendil-works/pi-mono/blob/main/packages/agent/src/types.ts#L179):
29
+ Base events from [`AgentEvent`](https://github.com/earendil-works/pi/blob/v0.82.1/packages/agent/src/types.ts#L179):
30
30
 
31
31
  ```typescript
32
32
  type AgentEvent =
@@ -48,12 +48,12 @@ type AgentEvent =
48
48
 
49
49
  ## Message Types
50
50
 
51
- Base messages from [`packages/ai/src/types.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/ai/src/types.ts#L134):
51
+ Base messages from [`packages/ai/src/types.ts`](https://github.com/earendil-works/pi/blob/v0.82.1/packages/ai/src/types.ts#L134):
52
52
  - `UserMessage` (line 134)
53
53
  - `AssistantMessage` (line 140)
54
54
  - `ToolResultMessage` (line 152)
55
55
 
56
- Extended messages from [`packages/coding-agent/src/core/messages.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/messages.ts#L29):
56
+ Extended messages from [`src/core/messages.ts`](https://github.com/ming-kang/pi/blob/main/src/core/messages.ts#L29):
57
57
  - `BashExecutionMessage` (line 29)
58
58
  - `CustomMessage` (line 46)
59
59
  - `BranchSummaryMessage` (line 55)
package/docs/providers.md CHANGED
@@ -101,7 +101,7 @@ pi
101
101
  | Xiaomi MiMo Token Plan (Amsterdam) | `XIAOMI_TOKEN_PLAN_AMS_API_KEY` | `xiaomi-token-plan-ams` |
102
102
  | Xiaomi MiMo Token Plan (Singapore) | `XIAOMI_TOKEN_PLAN_SGP_API_KEY` | `xiaomi-token-plan-sgp` |
103
103
 
104
- Reference for environment variables and `auth.json` keys: [`const envMap`](https://github.com/earendil-works/pi-mono/blob/main/packages/ai/src/env-api-keys.ts) in [`packages/ai/src/env-api-keys.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/ai/src/env-api-keys.ts).
104
+ Reference for environment variables and `auth.json` keys: [`const envMap`](https://github.com/earendil-works/pi/blob/v0.82.1/packages/ai/src/env-api-keys.ts) in [`packages/ai/src/env-api-keys.ts`](https://github.com/earendil-works/pi/blob/v0.82.1/packages/ai/src/env-api-keys.ts).
105
105
 
106
106
  #### Auth File
107
107
 
package/docs/rpc.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  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.
4
4
 
5
- **Note for Node.js/TypeScript users**: If you're building a Node.js application, consider using `AgentSession` directly from `@astralyn/pi` 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).
5
+ **Note for Node.js/TypeScript users**: If you're building a Node.js application, consider using `AgentSession` directly from `@astralyn/pi` instead of spawning a subprocess; see the [public SDK API](sdk.md). For a subprocess-based client, use the RPC protocol described below. The published [RPC extension UI example](../examples/rpc-extension-ui.ts) pairs with the published [RPC demo extension](../examples/extensions/rpc-demo.ts).
6
6
 
7
7
  ## Starting RPC Mode
8
8
 
@@ -1358,11 +1358,7 @@ Parse errors:
1358
1358
 
1359
1359
  ## Types
1360
1360
 
1361
- Source files:
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
- - [`src/core/messages.ts`](../src/core/messages.ts) - `BashExecutionMessage`
1365
- - [`src/modes/rpc/rpc-types.ts`](../src/modes/rpc/rpc-types.ts) - RPC command/response types, extension UI request/response types
1361
+ RPC messages use the public SDK and protocol types documented by this package. The model and agent message shapes are summarized below; applications embedding Pi should import the public API from `@astralyn/pi` rather than relying on package source files.
1366
1362
 
1367
1363
  ### Model
1368
1364
 
@@ -1519,9 +1515,7 @@ for event in read_events():
1519
1515
 
1520
1516
  ## Example: Interactive Client (Node.js)
1521
1517
 
1522
- See [`test/rpc-example.ts`](../test/rpc-example.ts) for a complete interactive example, or [`src/modes/rpc/rpc-client.ts`](../src/modes/rpc/rpc-client.ts) for a typed client implementation.
1523
-
1524
- For a complete example of handling the extension UI protocol, see [`examples/rpc-extension-ui.ts`](../examples/rpc-extension-ui.ts) which pairs with the [`examples/extensions/rpc-demo.ts`](../examples/extensions/rpc-demo.ts) extension.
1518
+ For a complete interactive example, see the published [RPC extension UI example](../examples/rpc-extension-ui.ts), which pairs with the published [RPC demo extension](../examples/extensions/rpc-demo.ts). For embedded Node.js or TypeScript clients, use the [public SDK API](sdk.md).
1525
1519
 
1526
1520
  ```javascript
1527
1521
  const { spawn } = require("child_process");