@astralyn/pi 0.82.2 → 0.82.4
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 +42 -0
- package/README.md +70 -634
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +3 -2
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +3 -2
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/core/agent-session.d.ts +2 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +31 -12
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/types.d.ts +11 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/model-resolver.d.ts +1 -0
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +13 -3
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +19 -1
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +3 -0
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/extensions/index.d.ts.map +1 -1
- package/dist/extensions/index.js +2 -0
- package/dist/extensions/index.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +6 -0
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/extensions/plan/constants.d.ts +31 -0
- package/dist/extensions/plan/constants.d.ts.map +1 -0
- package/dist/extensions/plan/constants.js +57 -0
- package/dist/extensions/plan/constants.js.map +1 -0
- package/dist/extensions/plan/index.d.ts +21 -0
- package/dist/extensions/plan/index.d.ts.map +1 -0
- package/dist/extensions/plan/index.js +291 -0
- package/dist/extensions/plan/index.js.map +1 -0
- package/dist/extensions/plan/schema.d.ts +15 -0
- package/dist/extensions/plan/schema.d.ts.map +1 -0
- package/dist/extensions/plan/schema.js +13 -0
- package/dist/extensions/plan/schema.js.map +1 -0
- package/dist/extensions/plan/state.d.ts +29 -0
- package/dist/extensions/plan/state.d.ts.map +1 -0
- package/dist/extensions/plan/state.js +74 -0
- package/dist/extensions/plan/state.js.map +1 -0
- package/dist/extensions/plan/storage.d.ts +18 -0
- package/dist/extensions/plan/storage.d.ts.map +1 -0
- package/dist/extensions/plan/storage.js +58 -0
- package/dist/extensions/plan/storage.js.map +1 -0
- package/dist/extensions/rewind/anchor.d.ts +29 -0
- package/dist/extensions/rewind/anchor.d.ts.map +1 -0
- package/dist/extensions/rewind/anchor.js +35 -0
- package/dist/extensions/rewind/anchor.js.map +1 -0
- package/dist/extensions/rewind/engine.d.ts +2 -6
- package/dist/extensions/rewind/engine.d.ts.map +1 -1
- package/dist/extensions/rewind/engine.js +41 -10
- package/dist/extensions/rewind/engine.js.map +1 -1
- package/dist/extensions/rewind/index.d.ts.map +1 -1
- package/dist/extensions/rewind/index.js +55 -21
- package/dist/extensions/rewind/index.js.map +1 -1
- package/dist/extensions/rewind/menu.d.ts.map +1 -1
- package/dist/extensions/rewind/menu.js +7 -2
- package/dist/extensions/rewind/menu.js.map +1 -1
- package/dist/extensions/rewind/restore.d.ts +26 -9
- package/dist/extensions/rewind/restore.d.ts.map +1 -1
- package/dist/extensions/rewind/restore.js +58 -16
- package/dist/extensions/rewind/restore.js.map +1 -1
- package/dist/extensions/subagent/activity.d.ts +1 -0
- package/dist/extensions/subagent/activity.d.ts.map +1 -1
- package/dist/extensions/subagent/activity.js +20 -4
- package/dist/extensions/subagent/activity.js.map +1 -1
- package/dist/extensions/subagent/agents.d.ts.map +1 -1
- package/dist/extensions/subagent/agents.js +2 -13
- package/dist/extensions/subagent/agents.js.map +1 -1
- package/dist/extensions/subagent/constants.d.ts +4 -3
- package/dist/extensions/subagent/constants.d.ts.map +1 -1
- package/dist/extensions/subagent/constants.js +9 -3
- package/dist/extensions/subagent/constants.js.map +1 -1
- package/dist/extensions/subagent/index.d.ts.map +1 -1
- package/dist/extensions/subagent/index.js +12 -5
- package/dist/extensions/subagent/index.js.map +1 -1
- package/dist/extensions/subagent/render.d.ts.map +1 -1
- package/dist/extensions/subagent/render.js +166 -41
- package/dist/extensions/subagent/render.js.map +1 -1
- package/dist/extensions/subagent/resolve.d.ts +2 -5
- package/dist/extensions/subagent/resolve.d.ts.map +1 -1
- package/dist/extensions/subagent/resolve.js +8 -13
- package/dist/extensions/subagent/resolve.js.map +1 -1
- package/dist/extensions/subagent/runner.d.ts +3 -1
- package/dist/extensions/subagent/runner.d.ts.map +1 -1
- package/dist/extensions/subagent/runner.js +111 -66
- package/dist/extensions/subagent/runner.js.map +1 -1
- package/dist/extensions/subagent/schema.d.ts +0 -6
- package/dist/extensions/subagent/schema.d.ts.map +1 -1
- package/dist/extensions/subagent/schema.js +2 -3
- package/dist/extensions/subagent/schema.js.map +1 -1
- package/dist/extensions/subagent/sdk-runner.d.ts.map +1 -1
- package/dist/extensions/subagent/sdk-runner.js +32 -16
- package/dist/extensions/subagent/sdk-runner.js.map +1 -1
- package/dist/extensions/subagent/types.d.ts +3 -2
- package/dist/extensions/subagent/types.d.ts.map +1 -1
- package/dist/extensions/subagent/types.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts +3 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +10 -2
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +22 -13
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +31 -18
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/utils/coalescing-terminal.d.ts +62 -0
- package/dist/utils/coalescing-terminal.d.ts.map +1 -0
- package/dist/utils/coalescing-terminal.js +151 -0
- package/dist/utils/coalescing-terminal.js.map +1 -0
- package/docs/bundled/README.md +38 -0
- package/docs/bundled/extensions/README.md +19 -0
- package/docs/bundled/extensions/plan.md +31 -0
- package/docs/{distribution → bundled}/extensions/question.md +0 -11
- package/docs/{distribution → bundled}/extensions/rewind.md +19 -18
- package/docs/{distribution → bundled}/extensions/router.md +1 -14
- package/docs/{distribution → bundled}/extensions/statusline.md +1 -2
- package/docs/{distribution → bundled}/extensions/subagent.md +15 -22
- package/docs/bundled/extensions/todo.md +28 -0
- package/docs/{distribution → bundled}/themes.md +4 -11
- package/docs/{distribution → bundled}/tool-presentation.md +4 -10
- package/docs/compaction.md +18 -14
- package/docs/custom-provider.md +8 -8
- package/docs/docs.json +61 -9
- package/docs/extensions.md +14 -13
- package/docs/index.md +12 -7
- package/docs/json.md +4 -4
- package/docs/providers.md +1 -1
- package/docs/rpc.md +3 -9
- package/docs/session-format.md +5 -5
- package/docs/skills.md +1 -1
- package/docs/themes.md +4 -8
- package/docs/tui.md +1 -1
- package/examples/extensions/README.md +0 -1
- package/examples/extensions/custom-provider-anthropic/index.ts +4 -4
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +2 -2
- package/examples/extensions/dynamic-resources/dynamic.json +1 -1
- package/examples/extensions/gondolin/index.ts +4 -6
- package/examples/extensions/message-renderer.ts +2 -2
- package/examples/extensions/overlay-qa-tests.ts +2 -2
- package/examples/extensions/project-trust.ts +2 -2
- package/examples/sdk/README.md +38 -44
- package/npm-shrinkwrap.json +2 -2
- package/package.json +6 -2
- package/docs/development.md +0 -68
- package/docs/distribution/README.md +0 -34
- package/docs/distribution/architecture.md +0 -102
- package/docs/distribution/extensions/README.md +0 -17
- package/docs/distribution/maintenance.md +0 -121
- package/docs/distribution/release.md +0 -85
- package/examples/extensions/subagent/README.md +0 -175
- package/examples/extensions/subagent/agents/planner.md +0 -37
- package/examples/extensions/subagent/agents/reviewer.md +0 -35
- package/examples/extensions/subagent/agents/scout.md +0 -50
- package/examples/extensions/subagent/agents/worker.md +0 -24
- package/examples/extensions/subagent/agents.ts +0 -126
- package/examples/extensions/subagent/index.ts +0 -1009
- package/examples/extensions/subagent/prompts/implement-and-review.md +0 -10
- package/examples/extensions/subagent/prompts/implement.md +0 -10
- package/examples/extensions/subagent/prompts/scout-and-plan.md +0 -9
- /package/docs/{distribution → bundled}/extensions/deepwiki.md +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Native tool presentation
|
|
2
2
|
|
|
3
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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;
|
package/docs/compaction.md
CHANGED
|
@@ -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
|
|
6
|
-
- [`
|
|
7
|
-
- [`
|
|
8
|
-
- [`
|
|
9
|
-
- [`
|
|
10
|
-
- [`
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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
|
|
|
@@ -284,7 +284,7 @@ Fired before auto-compaction or `/compact`. Can cancel or provide custom summary
|
|
|
284
284
|
|
|
285
285
|
```typescript
|
|
286
286
|
pi.on("session_before_compact", async (event, ctx) => {
|
|
287
|
-
const { preparation, branchEntries, customInstructions, reason, willRetry, signal } = event;
|
|
287
|
+
const { preparation, branchEntries, customInstructions, reason, timing, willRetry, signal } = event;
|
|
288
288
|
|
|
289
289
|
// preparation.messagesToSummarize - messages to summarize
|
|
290
290
|
// preparation.turnPrefixMessages - split turn prefix (if isSplitTurn)
|
|
@@ -296,10 +296,14 @@ pi.on("session_before_compact", async (event, ctx) => {
|
|
|
296
296
|
|
|
297
297
|
// branchEntries - all entries on current branch (for custom state)
|
|
298
298
|
// reason - "manual" (/compact), "threshold", or "overflow"
|
|
299
|
+
// timing - "manual", "midTurn" (between tool batches), "postRun", or "prePrompt"
|
|
299
300
|
// willRetry - whether overflow recovery intends to retry if compaction produces a safe retained context
|
|
300
301
|
// signal - AbortSignal (pass to LLM calls)
|
|
301
302
|
|
|
302
|
-
// Cancel:
|
|
303
|
+
// Cancel. Consequences depend on timing: a "midTurn" cancel skips compaction
|
|
304
|
+
// for the rest of the run and the run continues at your risk of overflowing;
|
|
305
|
+
// other timings leave the over-threshold context to fail closed before the
|
|
306
|
+
// next provider request.
|
|
303
307
|
return { cancel: true };
|
|
304
308
|
|
|
305
309
|
// Custom summary:
|
package/docs/custom-provider.md
CHANGED
|
@@ -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
|
|
401
|
-
- [mistral.ts](https://github.com/earendil-works/pi
|
|
402
|
-
- [openai-completions.ts](https://github.com/earendil-works/pi
|
|
403
|
-
- [openai-responses.ts](https://github.com/earendil-works/pi
|
|
404
|
-
- [google.ts](https://github.com/earendil-works/pi
|
|
405
|
-
- [amazon-bedrock.ts](https://github.com/earendil-works/pi
|
|
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
|
|
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
|
|
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,59 @@
|
|
|
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": "Plan",
|
|
69
|
+
"path": "bundled/extensions/plan.md"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"title": "Question",
|
|
73
|
+
"path": "bundled/extensions/question.md"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"title": "Rewind",
|
|
77
|
+
"path": "bundled/extensions/rewind.md"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"title": "Router",
|
|
81
|
+
"path": "bundled/extensions/router.md"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"title": "Statusline",
|
|
85
|
+
"path": "bundled/extensions/statusline.md"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"title": "Subagent",
|
|
89
|
+
"path": "bundled/extensions/subagent.md"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"title": "Todo",
|
|
93
|
+
"path": "bundled/extensions/todo.md"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"title": "Bundled themes",
|
|
97
|
+
"path": "bundled/themes.md"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"title": "Native tool presentation",
|
|
101
|
+
"path": "bundled/tool-presentation.md"
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
},
|
|
48
105
|
{
|
|
49
106
|
"title": "Customization",
|
|
50
107
|
"items": [
|
|
@@ -81,6 +138,10 @@
|
|
|
81
138
|
{
|
|
82
139
|
"title": "Reference",
|
|
83
140
|
"items": [
|
|
141
|
+
{
|
|
142
|
+
"title": "Environment Variables",
|
|
143
|
+
"path": "environment-variables.md"
|
|
144
|
+
},
|
|
84
145
|
{
|
|
85
146
|
"title": "Session Format",
|
|
86
147
|
"path": "session-format.md"
|
|
@@ -132,15 +193,6 @@
|
|
|
132
193
|
"path": "shell-aliases.md"
|
|
133
194
|
}
|
|
134
195
|
]
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
"title": "Development",
|
|
138
|
-
"items": [
|
|
139
|
-
{
|
|
140
|
-
"title": "Development",
|
|
141
|
-
"path": "development.md"
|
|
142
|
-
}
|
|
143
|
-
]
|
|
144
196
|
}
|
|
145
197
|
],
|
|
146
198
|
"redirects": [
|
package/docs/extensions.md
CHANGED
|
@@ -454,12 +454,14 @@ Fired on compaction. See [compaction.md](compaction.md) for details.
|
|
|
454
454
|
|
|
455
455
|
```typescript
|
|
456
456
|
pi.on("session_before_compact", async (event, ctx) => {
|
|
457
|
-
const { preparation, branchEntries, customInstructions, reason, willRetry, signal } = event;
|
|
457
|
+
const { preparation, branchEntries, customInstructions, reason, timing, willRetry, signal } = event;
|
|
458
458
|
|
|
459
459
|
// reason - "manual" (/compact), "threshold", or "overflow"
|
|
460
|
+
// timing - "manual", "midTurn" (between tool batches), "postRun", or "prePrompt"
|
|
460
461
|
// willRetry - whether overflow recovery intends to retry if compaction produces a safe retained context
|
|
461
462
|
|
|
462
|
-
// Cancel
|
|
463
|
+
// Cancel. A "midTurn" cancel skips compaction for the rest of the run and the
|
|
464
|
+
// run continues at your risk; other timings fail closed on the oversized context.
|
|
463
465
|
return { cancel: true };
|
|
464
466
|
|
|
465
467
|
// Custom summary:
|
|
@@ -2043,13 +2045,13 @@ See [examples/extensions/tool-override.ts](../examples/extensions/tool-override.
|
|
|
2043
2045
|
**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
2046
|
|
|
2045
2047
|
Built-in tool implementations:
|
|
2046
|
-
- [read.ts](https://github.com/
|
|
2047
|
-
- [bash.ts](https://github.com/
|
|
2048
|
-
- [edit.ts](https://github.com/
|
|
2049
|
-
- [write.ts](https://github.com/
|
|
2050
|
-
- [grep.ts](https://github.com/
|
|
2051
|
-
- [find.ts](https://github.com/
|
|
2052
|
-
- [ls.ts](https://github.com/
|
|
2048
|
+
- [read.ts](https://github.com/ming-kang/pi/blob/main/src/core/tools/read.ts) - `ReadToolDetails`
|
|
2049
|
+
- [bash.ts](https://github.com/ming-kang/pi/blob/main/src/core/tools/bash.ts) - `BashToolDetails`
|
|
2050
|
+
- [edit.ts](https://github.com/ming-kang/pi/blob/main/src/core/tools/edit.ts)
|
|
2051
|
+
- [write.ts](https://github.com/ming-kang/pi/blob/main/src/core/tools/write.ts)
|
|
2052
|
+
- [grep.ts](https://github.com/ming-kang/pi/blob/main/src/core/tools/grep.ts) - `GrepToolDetails`
|
|
2053
|
+
- [find.ts](https://github.com/ming-kang/pi/blob/main/src/core/tools/find.ts) - `FindToolDetails`
|
|
2054
|
+
- [ls.ts](https://github.com/ming-kang/pi/blob/main/src/core/tools/ls.ts) - `LsToolDetails`
|
|
2053
2055
|
|
|
2054
2056
|
### Remote Execution
|
|
2055
2057
|
|
|
@@ -2180,7 +2182,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
2180
2182
|
|
|
2181
2183
|
### Custom Rendering
|
|
2182
2184
|
|
|
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/
|
|
2185
|
+
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
2186
|
|
|
2185
2187
|
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
2188
|
|
|
@@ -2793,7 +2795,7 @@ Register a custom renderer for messages with your `customType`. Use message rend
|
|
|
2793
2795
|
import { Text } from "@earendil-works/pi-tui";
|
|
2794
2796
|
|
|
2795
2797
|
pi.registerMessageRenderer("my-extension", (message, options, theme) => {
|
|
2796
|
-
const { expanded } = options;
|
|
2798
|
+
const { expanded, outputPad } = options;
|
|
2797
2799
|
let text = theme.fg("accent", `[${message.customType}] `);
|
|
2798
2800
|
text += message.content;
|
|
2799
2801
|
|
|
@@ -2801,7 +2803,7 @@ pi.registerMessageRenderer("my-extension", (message, options, theme) => {
|
|
|
2801
2803
|
text += "\n" + theme.fg("dim", JSON.stringify(message.details, null, 2));
|
|
2802
2804
|
}
|
|
2803
2805
|
|
|
2804
|
-
return new Text(text,
|
|
2806
|
+
return new Text(text, outputPad, 0);
|
|
2805
2807
|
});
|
|
2806
2808
|
```
|
|
2807
2809
|
|
|
@@ -2942,7 +2944,6 @@ All examples in [examples/extensions/](../examples/extensions/).
|
|
|
2942
2944
|
| `interactive-shell.ts` | Persistent shell session | `on("user_bash")` |
|
|
2943
2945
|
| `sandbox/` | Sandboxed tool execution | Tool operations |
|
|
2944
2946
|
| `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
2947
|
| **Games** |||
|
|
2947
2948
|
| `snake.ts` | Snake game | `registerCommand`, `ui.custom`, keyboard handling |
|
|
2948
2949
|
| `space-invaders.ts` | Space Invaders game | `registerCommand`, `ui.custom` |
|
package/docs/index.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @astralyn/pi user and API documentation
|
|
2
2
|
|
|
3
|
-
|
|
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
|
|
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/
|
|
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
|
|
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
|
|
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 [`
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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");
|
package/docs/session-format.md
CHANGED
|
@@ -28,11 +28,11 @@ Existing sessions are automatically migrated to the current version (v3) when lo
|
|
|
28
28
|
|
|
29
29
|
## Source Files
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
- [`
|
|
33
|
-
- [`
|
|
34
|
-
- [`packages/ai/src/types.ts`](https://github.com/earendil-works/pi
|
|
35
|
-
- [`packages/agent/src/types.ts`](https://github.com/earendil-works/pi
|
|
31
|
+
Distribution source on GitHub ([ming-kang/pi](https://github.com/ming-kang/pi)):
|
|
32
|
+
- [`src/core/session-manager.ts`](https://github.com/ming-kang/pi/blob/main/src/core/session-manager.ts) - Session entry types and SessionManager
|
|
33
|
+
- [`src/core/messages.ts`](https://github.com/ming-kang/pi/blob/main/src/core/messages.ts) - Extended message types (BashExecutionMessage, CustomMessage, etc.)
|
|
34
|
+
- [`packages/ai/src/types.ts`](https://github.com/earendil-works/pi/blob/v0.82.1/packages/ai/src/types.ts) - Base message types (UserMessage, AssistantMessage, ToolResultMessage)
|
|
35
|
+
- [`packages/agent/src/types.ts`](https://github.com/earendil-works/pi/blob/v0.82.1/packages/agent/src/types.ts) - AgentMessage union type
|
|
36
36
|
|
|
37
37
|
For TypeScript definitions in your project, inspect `node_modules/@astralyn/pi/dist/` and `node_modules/@earendil-works/pi-ai/dist/`.
|
|
38
38
|
|
package/docs/skills.md
CHANGED
|
@@ -131,7 +131,7 @@ cd /path/to/skill && npm install
|
|
|
131
131
|
Use relative paths from the skill directory:
|
|
132
132
|
|
|
133
133
|
```markdown
|
|
134
|
-
See
|
|
134
|
+
See the reference guide at `references/REFERENCE.md` for details.
|
|
135
135
|
```
|
|
136
136
|
|
|
137
137
|
## Frontmatter
|
package/docs/themes.md
CHANGED
|
@@ -52,7 +52,7 @@ vim ~/.pi/agent/themes/my-theme.json
|
|
|
52
52
|
|
|
53
53
|
```json
|
|
54
54
|
{
|
|
55
|
-
"$schema": "https://raw.githubusercontent.com/
|
|
55
|
+
"$schema": "https://raw.githubusercontent.com/ming-kang/pi/main/src/modes/interactive/theme/theme-schema.json",
|
|
56
56
|
"name": "my-theme",
|
|
57
57
|
"vars": {
|
|
58
58
|
"primary": "#00aaff",
|
|
@@ -123,7 +123,7 @@ vim ~/.pi/agent/themes/my-theme.json
|
|
|
123
123
|
|
|
124
124
|
```json
|
|
125
125
|
{
|
|
126
|
-
"$schema": "https://raw.githubusercontent.com/
|
|
126
|
+
"$schema": "https://raw.githubusercontent.com/ming-kang/pi/main/src/modes/interactive/theme/theme-schema.json",
|
|
127
127
|
"name": "my-theme",
|
|
128
128
|
"vars": {
|
|
129
129
|
"blue": "#0066cc",
|
|
@@ -292,10 +292,6 @@ echo $COLORTERM # Should output "truecolor" or "24bit"
|
|
|
292
292
|
|
|
293
293
|
## Examples
|
|
294
294
|
|
|
295
|
-
|
|
296
|
-
- [dark.json](../src/modes/interactive/theme/dark.json)
|
|
297
|
-
- [light.json](../src/modes/interactive/theme/light.json)
|
|
298
|
-
- [ice-cream-dark.json](../src/modes/interactive/theme/ice-cream-dark.json)
|
|
299
|
-
- [ice-cream-light.json](../src/modes/interactive/theme/ice-cream-light.json)
|
|
295
|
+
The built-in themes are selected by name: `dark`, `light`, `ice-cream-dark`, and `ice-cream-light`. When inspecting an installed package, their JSON assets are under `node_modules/@astralyn/pi/dist/modes/interactive/theme/` (the global-install equivalent is under Pi's npm package directory).
|
|
300
296
|
|
|
301
|
-
The ice-cream palette and
|
|
297
|
+
The ice-cream palette and bundled design notes are documented in [Bundled themes](bundled/themes.md).
|
package/docs/tui.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Extensions and custom tools can render custom TUI components for interactive user interfaces. This page covers the component system and available building blocks.
|
|
6
6
|
|
|
7
|
-
**Source:** [`@earendil-works/pi-tui`](https://github.com/earendil-works/pi
|
|
7
|
+
**Source:** [`@earendil-works/pi-tui@0.82.1`](https://github.com/earendil-works/pi/tree/v0.82.1/packages/tui)
|
|
8
8
|
|
|
9
9
|
## Component Interface
|
|
10
10
|
|
|
@@ -42,7 +42,6 @@ cp permission-gate.ts ~/.pi/agent/extensions/
|
|
|
42
42
|
| `minimal-mode.ts` | Override built-in tool rendering for minimal display (only tool calls, no output in collapsed mode) |
|
|
43
43
|
| `truncated-tool.ts` | Wraps ripgrep with proper output truncation (50KB/2000 lines) |
|
|
44
44
|
| `ssh.ts` | Delegate all tools to a remote machine via SSH using pluggable operations |
|
|
45
|
-
| `subagent/` | Delegate tasks to specialized subagents with isolated context windows |
|
|
46
45
|
|
|
47
46
|
### Commands & UI
|
|
48
47
|
|
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
* - API key support via environment variable
|
|
9
9
|
* - Two model definitions
|
|
10
10
|
*
|
|
11
|
-
* Usage:
|
|
11
|
+
* Usage (from the repository or package root):
|
|
12
12
|
* # First install dependencies
|
|
13
|
-
*
|
|
13
|
+
* npm install --prefix examples/extensions/custom-provider-anthropic
|
|
14
14
|
*
|
|
15
15
|
* # With OAuth (run /login custom-anthropic first)
|
|
16
|
-
* pi -e
|
|
16
|
+
* pi -e examples/extensions/custom-provider-anthropic
|
|
17
17
|
*
|
|
18
18
|
* # With API key
|
|
19
|
-
* CUSTOM_ANTHROPIC_API_KEY=sk-ant-... pi -e
|
|
19
|
+
* CUSTOM_ANTHROPIC_API_KEY=sk-ant-... pi -e examples/extensions/custom-provider-anthropic
|
|
20
20
|
*
|
|
21
21
|
* Then use /model to select custom-anthropic/claude-sonnet-4-5
|
|
22
22
|
*/
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Provides access to GitLab Duo AI models (Claude and GPT) through GitLab's AI Gateway.
|
|
5
5
|
* Delegates to pi-ai's built-in Anthropic and OpenAI streaming implementations.
|
|
6
6
|
*
|
|
7
|
-
* Usage:
|
|
8
|
-
* pi -e
|
|
7
|
+
* Usage (from the repository or package root):
|
|
8
|
+
* pi -e examples/extensions/custom-provider-gitlab-duo
|
|
9
9
|
* # Then /login gitlab-duo, or set GITLAB_TOKEN=glpat-...
|
|
10
10
|
*/
|
|
11
11
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "https://raw.githubusercontent.com/
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/ming-kang/pi/main/src/modes/interactive/theme/theme-schema.json",
|
|
3
3
|
"name": "dynamic-resources",
|
|
4
4
|
"vars": {
|
|
5
5
|
"cyan": "#00d7ff",
|
|
@@ -6,13 +6,11 @@
|
|
|
6
6
|
* /workspace write through to the host; other guest filesystem changes are
|
|
7
7
|
* isolated to the VM.
|
|
8
8
|
*
|
|
9
|
-
* Setup:
|
|
10
|
-
*
|
|
11
|
-
* npm install --ignore-scripts
|
|
9
|
+
* Setup (from the repository or package root):
|
|
10
|
+
* npm install --ignore-scripts --prefix examples/extensions/gondolin
|
|
12
11
|
*
|
|
13
|
-
* Usage:
|
|
14
|
-
*
|
|
15
|
-
* pi -e /path/to/pi/packages/coding-agent/examples/extensions/gondolin
|
|
12
|
+
* Usage (from the project that should be mounted at /workspace):
|
|
13
|
+
* pi -e /absolute/path/to/pi/examples/extensions/gondolin
|
|
16
14
|
*
|
|
17
15
|
* Requirements:
|
|
18
16
|
* - Node.js >= 23.6.0 for @earendil-works/gondolin
|
|
@@ -12,7 +12,7 @@ import { Box, Text } from "@earendil-works/pi-tui";
|
|
|
12
12
|
|
|
13
13
|
export default function (pi: ExtensionAPI) {
|
|
14
14
|
// Register custom renderer for "status-update" messages
|
|
15
|
-
pi.registerMessageRenderer("status-update", (message, { expanded }, theme) => {
|
|
15
|
+
pi.registerMessageRenderer("status-update", (message, { expanded, outputPad }, theme) => {
|
|
16
16
|
const details = message.details as { level: string; timestamp: number } | undefined;
|
|
17
17
|
const level = details?.level ?? "info";
|
|
18
18
|
|
|
@@ -29,7 +29,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
// Use Box with customMessageBg for consistent styling
|
|
32
|
-
const box = new Box(
|
|
32
|
+
const box = new Box(outputPad, 1, (t) => theme.bg("customMessageBg", t));
|
|
33
33
|
box.addChild(new Text(text, 0, 0));
|
|
34
34
|
return box;
|
|
35
35
|
});
|