@astralyn/pi 0.86.0 → 0.87.0
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 +45 -0
- package/dist/bundle/chunks/chunk-INDBRWNK.js +2 -0
- package/dist/bundle/chunks/{chunk-MSHHFVMD.js → chunk-RKLIHRPH.js} +58 -51
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/{openai-completions-WJIA7NEB.js → openai-completions-JZCEEJ43.js} +1 -1
- package/dist/bundle/chunks/{virtual-modules-B4BILEXT.js → virtual-modules-CG7NJ5WO.js} +1 -1
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +1 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/file-processor.d.ts +1 -1
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/core/agent-session-runtime.js +1 -1
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session.d.ts +31 -4
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +395 -126
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/cache-warmer.d.ts +1 -0
- package/dist/core/cache-warmer.d.ts.map +1 -1
- package/dist/core/cache-warmer.js +15 -1
- package/dist/core/cache-warmer.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +3 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +146 -48
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/crash-log.d.ts +5 -0
- package/dist/core/crash-log.d.ts.map +1 -1
- package/dist/core/crash-log.js +68 -0
- package/dist/core/crash-log.js.map +1 -1
- package/dist/core/export-html/template.js +6 -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/runner.d.ts +16 -3
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +110 -5
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +77 -6
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/model-config.d.ts +52 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +16 -0
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +1 -0
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/prompt-templates.d.ts +6 -1
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +61 -35
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/provider-composer.d.ts +1 -0
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +19 -0
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +6 -2
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +3 -4
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +36 -9
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +97 -7
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/tools/read.d.ts +4 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +5 -1
- package/dist/core/tools/read.js.map +1 -1
- package/dist/extensions/btw/agent.d.ts.map +1 -1
- package/dist/extensions/btw/agent.js +8 -5
- package/dist/extensions/btw/agent.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +4 -3
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/bug-report.d.ts +2 -0
- package/dist/modes/interactive/bug-report.d.ts.map +1 -1
- package/dist/modes/interactive/bug-report.js +6 -5
- package/dist/modes/interactive/bug-report.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts +4 -1
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +7 -2
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +7 -0
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +5 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +74 -5
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +1 -12
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +74 -20
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/mime.js +1 -1
- package/dist/utils/mime.js.map +1 -1
- package/dist/utils/tool-result-images.d.ts +3 -1
- package/dist/utils/tool-result-images.d.ts.map +1 -1
- package/dist/utils/tool-result-images.js +4 -1
- package/dist/utils/tool-result-images.js.map +1 -1
- package/dist/utils/wsl.d.ts +3 -0
- package/dist/utils/wsl.d.ts.map +1 -0
- package/dist/utils/wsl.js +15 -0
- package/dist/utils/wsl.js.map +1 -0
- package/docs/compaction.md +23 -4
- package/docs/extensions.md +72 -8
- package/docs/models.md +30 -1
- package/docs/providers.md +8 -0
- package/docs/sdk.md +14 -3
- package/docs/session-format.md +25 -4
- package/examples/plugins/pi-example-plugin/src/session.ts +3 -2
- package/npm-shrinkwrap.json +43 -43
- package/package.json +8 -8
- package/dist/bundle/chunks/chunk-M2YWW37K.js +0 -2
package/docs/extensions.md
CHANGED
|
@@ -296,7 +296,8 @@ user sends prompt ────────────────────
|
|
|
296
296
|
│ ┌─── turn (repeats while LLM calls tools) ───┐ │
|
|
297
297
|
│ │ │ │
|
|
298
298
|
│ ├─► turn_start │ │
|
|
299
|
-
│ ├─► context (can modify messages)
|
|
299
|
+
│ ├─► context (can modify conversation messages) │
|
|
300
|
+
│ ├─► context_with_system (can modify the full transcript)
|
|
300
301
|
│ ├─► before_provider_headers (can mutate headers) |
|
|
301
302
|
│ ├─► before_provider_request (can inspect or replace payload)
|
|
302
303
|
│ ├─► after_provider_response (status + headers, before stream consume)
|
|
@@ -308,10 +309,14 @@ user sends prompt ────────────────────
|
|
|
308
309
|
│ │ ├─► tool_result (can modify) │ │
|
|
309
310
|
│ │ └─► tool_execution_end │ │
|
|
310
311
|
│ │ │ │
|
|
311
|
-
│ └─► turn_end
|
|
312
|
+
│ └─► turn_end (can append entries and continue) │ │
|
|
313
|
+
│ └─► threshold compaction before a naturally required next turn
|
|
312
314
|
│ │
|
|
313
315
|
├─► agent_end │
|
|
314
|
-
|
|
316
|
+
├─► retry backoff or final-attempt recovery (when selected)
|
|
317
|
+
│ └─► fresh agent_start on successful recovery │
|
|
318
|
+
├─► agent_before_settle (can append entries and continue)│
|
|
319
|
+
└─► agent_settled (final, notification only) │
|
|
315
320
|
│
|
|
316
321
|
user sends another prompt ◄────────────────────────────────┘
|
|
317
322
|
|
|
@@ -579,9 +584,9 @@ The `systemPromptOptions` field gives extensions access to the same structured d
|
|
|
579
584
|
|
|
580
585
|
Inside `before_agent_start`, `event.systemPrompt` and `ctx.getSystemPrompt()` both reflect the chained system prompt as of the current handler. Later `before_agent_start` handlers can still modify it again.
|
|
581
586
|
|
|
582
|
-
#### agent_start / agent_end / agent_settled
|
|
587
|
+
#### agent_start / agent_end / agent_before_settle / agent_settled
|
|
583
588
|
|
|
584
|
-
`agent_start` fires when a low-level agent run begins. `agent_end` fires when that run ends, but Pi may still auto-retry, auto-compact and retry, or continue with queued follow-up messages.
|
|
589
|
+
`agent_start` fires when a low-level agent run begins. `agent_end` fires when that run ends, but Pi may still auto-retry, auto-compact and retry, or continue with queued follow-up messages. `agent_before_settle` is the final actionable boundary: it can append session entries and request one continuation. `agent_settled` is final and notification-only; use it for status integrations that need to know Pi will not continue running automatically.
|
|
585
590
|
|
|
586
591
|
```typescript
|
|
587
592
|
pi.on("agent_start", async (_event, ctx) => {});
|
|
@@ -590,11 +595,28 @@ pi.on("agent_end", async (event, ctx) => {
|
|
|
590
595
|
// event.messages - messages from this low-level run
|
|
591
596
|
});
|
|
592
597
|
|
|
598
|
+
let addedReviewReminder = false;
|
|
599
|
+
pi.on("agent_before_settle", async (event, ctx) => {
|
|
600
|
+
if (addedReviewReminder) return;
|
|
601
|
+
addedReviewReminder = true;
|
|
602
|
+
return {
|
|
603
|
+
entries: [...event.entries, {
|
|
604
|
+
type: "custom_message",
|
|
605
|
+
customType: "review-reminder",
|
|
606
|
+
content: "Review the final diff before replying.",
|
|
607
|
+
display: false,
|
|
608
|
+
}],
|
|
609
|
+
continue: true,
|
|
610
|
+
};
|
|
611
|
+
});
|
|
612
|
+
|
|
593
613
|
pi.on("agent_settled", async (_event, ctx) => {
|
|
594
|
-
// ctx.isIdle() is true here
|
|
614
|
+
// ctx.isIdle() is true; runs requested here start after all settled handlers finish.
|
|
595
615
|
});
|
|
596
616
|
```
|
|
597
617
|
|
|
618
|
+
If the run is aborted while `agent_before_settle` handlers are running, valid returned entries are still committed, but requested continuation is suppressed. Work requested from `agent_settled` is deferred until every settled handler completes, so notification dispatch is non-reentrant. In this distribution, Background completion delivery also stays paused until those deferred runs have started, so a deferred prompt never races a completion turn for the same idle gap.
|
|
619
|
+
|
|
598
620
|
#### ui_prompt_start / ui_prompt_end
|
|
599
621
|
|
|
600
622
|
Notification-only lifecycle events for blocking user-facing extension UI prompts. They fire around `ctx.ui.select()`, `ctx.ui.confirm()`, `ctx.ui.input()`, `ctx.ui.editor()`, and `ctx.ui.custom()` so host/status integrations can report "waiting for user" instead of just "running".
|
|
@@ -622,12 +644,35 @@ pi.on("turn_start", async (event, ctx) => {
|
|
|
622
644
|
// event.turnIndex, event.timestamp
|
|
623
645
|
});
|
|
624
646
|
|
|
647
|
+
let replacedResponse = false;
|
|
625
648
|
pi.on("turn_end", async (event, ctx) => {
|
|
626
649
|
// event.turnIndex, event.message, event.toolResults
|
|
650
|
+
// event.entries contains the structural entries proposed so far.
|
|
651
|
+
if (replacedResponse || event.outcome !== "completed" || event.toolResults.length > 0) return;
|
|
652
|
+
replacedResponse = true;
|
|
653
|
+
return {
|
|
654
|
+
entries: [
|
|
655
|
+
...event.entries,
|
|
656
|
+
{ type: "context_edit", targetId: event.messageEntryId, replacement: null },
|
|
657
|
+
{
|
|
658
|
+
type: "custom_message",
|
|
659
|
+
customType: "replacement-instruction",
|
|
660
|
+
content: "Answer again using the persisted user request.",
|
|
661
|
+
display: false,
|
|
662
|
+
},
|
|
663
|
+
],
|
|
664
|
+
continue: true,
|
|
665
|
+
};
|
|
627
666
|
});
|
|
628
667
|
```
|
|
629
668
|
|
|
630
|
-
|
|
669
|
+
`turn_end` runs after the assistant and tool-result messages have been persisted and before the low-level `turn_end` event. Retry backoff and final-attempt recovery still happen after `agent_end`, preserving their existing lifecycle and queue ordering; `agent_before_settle` sees the repaired projection after that work completes. Boundary handlers run in extension load and registration order. Each handler sees prior proposals in `event.entries` and sees `event.context` rebuilt from them. Returning `entries` or `continue` replaces only that field; omitted fields preserve the current proposal. Allowed draft entry types are `custom`, `custom_message`, `context_edit`, and `compaction`. The complete proposal is validated before it is appended in list order after all handlers finish; a handler error is reported and later handlers still run. Validation prevents partially applied semantic errors, but persistence is not transactional.
|
|
670
|
+
|
|
671
|
+
`continue: true` ensures one next provider request for that boundary invocation. If tool results, steering, or a follow-up already cause that request, they satisfy the decision and no additional request is made; otherwise Pi makes one context-only request. Error and aborted responses remain hard exits. `continue: false` never suppresses natural work. Guard continuation conditions: an unconditional `continue: true` is evaluated again after the next response and can create an endless loop. A `custom_message` draft contributes a user-role model message but is extension-authored: it does not run human input hooks, slash commands, skills, or prompt templates.
|
|
672
|
+
|
|
673
|
+
Host integrations that construct `TurnEndEvent` values must provide `messageEntryId`, `toolResultEntryIds`, `outcome`, `entries`, `continue`, and `context`. `ExtensionEvent` exhaustive switches must also handle `agent_before_settle`. `ExtensionRunner.emit()` excludes actionable turn boundaries; dispatch `turn_end` and `agent_before_settle` through `emitBoundary(baseEvent, buildContext)` so handlers receive chained previews. Other dedicated runner methods still return results for events such as `session_before_*`.
|
|
674
|
+
|
|
675
|
+
Between-tool auto-compaction runs after the completed tool turn's `turn_end`, against the canonical session projection. 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.
|
|
631
676
|
|
|
632
677
|
#### message_start / message_update / message_end
|
|
633
678
|
|
|
@@ -695,12 +740,31 @@ Fired before each LLM call. Modify messages non-destructively. See [Session Form
|
|
|
695
740
|
|
|
696
741
|
```typescript
|
|
697
742
|
pi.on("context", async (event, ctx) => {
|
|
698
|
-
// event.messages - deep copy, safe to modify
|
|
743
|
+
// event.messages - deep copy without system messages, safe to modify
|
|
699
744
|
const filtered = event.messages.filter(m => !shouldPrune(m));
|
|
700
745
|
return { messages: filtered };
|
|
701
746
|
});
|
|
702
747
|
```
|
|
703
748
|
|
|
749
|
+
`event.messages` holds the conversation without system messages. The prompt and tool declarations belong to Pi and are not part of this hook: when the handler returns a changed list, Pi replays the current prompt sections and tool declarations into one leading system message ahead of the returned messages. Filtering, windowing, or slicing from a compaction summary therefore cannot drop the prompt or the tools. An unchanged list keeps mid-conversation system messages in place, so models that accept them retain their cached prefix. System messages a handler adds are kept after Pi's head. To change the prompt or the tool set durably, use [`before_agent_start`](#before_agent_start) or `pi.setActiveTools()`; to edit system messages for one request, use [`context_with_system`](#context_with_system).
|
|
750
|
+
|
|
751
|
+
#### context_with_system
|
|
752
|
+
|
|
753
|
+
Fired before each LLM call, after every `context` handler has run and Pi has restored the prompt and tool state. `event.messages` is the full transcript, including the leading system message and any mid-conversation prompt or tool patches (see [Session Format](session-format.md#sessionmessageentry)). The returned messages are sent as they are: this hook owns the prompt and tool declarations for the request.
|
|
754
|
+
|
|
755
|
+
```typescript
|
|
756
|
+
import { getCurrentSystemMessage } from "@earendil-works/pi-ai";
|
|
757
|
+
|
|
758
|
+
pi.on("context_with_system", async (event, ctx) => {
|
|
759
|
+
const cut = findCutIndex(event.messages);
|
|
760
|
+
// Fold the dropped prefix so its prompt and tool state survives as the new head.
|
|
761
|
+
const head = getCurrentSystemMessage(event.messages.slice(0, cut));
|
|
762
|
+
return { messages: head ? [head, ...event.messages.slice(cut)] : event.messages.slice(cut) };
|
|
763
|
+
});
|
|
764
|
+
```
|
|
765
|
+
|
|
766
|
+
Rules: keep a system message at index 0 (providers read the prompt and initial tool declarations there; Pi reports an error if a handler drops it). Removing a system message removes the tool declarations and section patches it carries. Check your output with `getCurrentSystemPrompt()` and `getCurrentTools()` from `@earendil-works/pi-ai`. Handlers run in extension load order; a `systemPrompt` forced from `before_agent_start` is still projected onto the request afterwards. `ctx.getContextSnapshot()` reuses the request prefix these hooks produced, so BTW sees the same transcript the provider received.
|
|
767
|
+
|
|
704
768
|
#### before_provider_headers
|
|
705
769
|
|
|
706
770
|
Fired after the outgoing HTTP headers are assembled. Use it to add, override, or remove request headers.
|
package/docs/models.md
CHANGED
|
@@ -14,6 +14,7 @@ Pi reads this file at startup and on a model refresh, including when you open `/
|
|
|
14
14
|
- [Value Resolution](#value-resolution)
|
|
15
15
|
- [Custom Headers](#custom-headers)
|
|
16
16
|
- [Model Configuration](#model-configuration)
|
|
17
|
+
- [Image Input Limits](#image-input-limits)
|
|
17
18
|
- [Thinking Level Map](#thinking-level-map)
|
|
18
19
|
- [Prompt Cache Lifetimes](#prompt-cache-lifetimes)
|
|
19
20
|
- [Overriding Built-in Providers](#overriding-built-in-providers)
|
|
@@ -243,6 +244,7 @@ A `models` entry supplies a complete custom model definition with useful default
|
|
|
243
244
|
| `reasoning` | No | `false` | Whether the model supports Pi thinking levels. |
|
|
244
245
|
| `thinkingLevelMap` | No | omitted | Maps Pi thinking levels to provider values and declares unsupported levels; see below. |
|
|
245
246
|
| `input` | No | `["text"]` | Supported input kinds: `text` and `image`. |
|
|
247
|
+
| `inputLimits` | No | omitted | Request limits and image preprocessing for this model; see [Image Input Limits](#image-input-limits). |
|
|
246
248
|
| `contextWindow` | No | `128000` | Context window in tokens. |
|
|
247
249
|
| `maxTokens` | No | `16384` | Maximum generated tokens. |
|
|
248
250
|
| `samplingParams` | No | omitted | Free-form sampling parameters merged verbatim into every request body; see [Sampling Parameters](#sampling-parameters). |
|
|
@@ -275,6 +277,33 @@ When `cost` is supplied on a `models` entry, it must contain all four base rates
|
|
|
275
277
|
}
|
|
276
278
|
```
|
|
277
279
|
|
|
280
|
+
### Image Input Limits
|
|
281
|
+
|
|
282
|
+
Use `inputLimits.images.resize` to configure how new images are encoded before they enter conversation history:
|
|
283
|
+
|
|
284
|
+
```json
|
|
285
|
+
{
|
|
286
|
+
"id": "vision-model",
|
|
287
|
+
"input": ["text", "image"],
|
|
288
|
+
"inputLimits": {
|
|
289
|
+
"images": {
|
|
290
|
+
"resize": {
|
|
291
|
+
"maxWidth": 1568,
|
|
292
|
+
"maxHeight": 1568,
|
|
293
|
+
"maxBytes": 524288,
|
|
294
|
+
"jpegQuality": 75
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
`maxBytes` is the maximum base64-encoded payload size. Omitted resize fields use Pi's conservative defaults: 2000×2000, 4.5 MiB encoded, and JPEG quality 80. Built-in vision models carry that profile explicitly so unknown gateways never receive larger images than before.
|
|
302
|
+
|
|
303
|
+
Pi applies the selected model's resize profile to `@file` attachments, the `read` tool, and images returned by tools. Images are encoded once before they enter history, after `before_agent_start` handlers have selected the request model; changing models later does not rewrite historical images or invalidate the cached conversation prefix. The `images.autoResize` setting can disable resizing globally.
|
|
304
|
+
|
|
305
|
+
The catalog can also record `inputLimits.maxRequestBytes`, `images.maxPerMessage`, and `images.maxPerRequest`. These fields describe hard provider limits; Pi does not yet rewrite or reject conversation history based on them.
|
|
306
|
+
|
|
278
307
|
### Prompt Cache Lifetimes
|
|
279
308
|
|
|
280
309
|
`promptCache` states how long the provider keeps a prompt cache entry alive for each retention tier Pi can request (`short` is the default tier; `long` is used when `PI_CACHE_RETENTION=long`). Values are seconds and are estimates: providers publish ranges, so pick the conservative end.
|
|
@@ -405,7 +434,7 @@ The built-in models remain. A new custom `id` is added, while a matching ID is r
|
|
|
405
434
|
}
|
|
406
435
|
```
|
|
407
436
|
|
|
408
|
-
An override supports `name`, `reasoning`, `thinkingLevelMap`, `input`, `cost`, `promptCache` (merged per tier), `contextWindow`, `maxTokens`, `samplingParams` (merged per key), `headers`, and `compat`. Its `cost` base rates are individually optional and retain omitted values; a supplied `tiers` array replaces the existing array. Thinking maps merge by level. `compat` merges by field, and its `openRouterRouting`, `vercelGatewayRouting`, and `chatTemplateKwargs` objects merge by key.
|
|
437
|
+
An override supports `name`, `reasoning`, `thinkingLevelMap`, `input`, `inputLimits`, `cost`, `promptCache` (merged per tier), `contextWindow`, `maxTokens`, `samplingParams` (merged per key), `headers`, and `compat`. Its `cost` base rates are individually optional and retain omitted values; a supplied `tiers` array replaces the existing array. Thinking maps merge by level. `inputLimits` deep-merges down to the `images.resize` profile. `compat` merges by field, and its `openRouterRouting`, `vercelGatewayRouting`, and `chatTemplateKwargs` objects merge by key.
|
|
409
438
|
|
|
410
439
|
Use a `promptCache` override to enable cache warming through a proxy whose backing cache you know, for example OpenRouter routed to Anthropic:
|
|
411
440
|
|
package/docs/providers.md
CHANGED
|
@@ -20,6 +20,7 @@ Use `/login` in interactive mode, then select a provider:
|
|
|
20
20
|
- Claude Pro/Max
|
|
21
21
|
- GitHub Copilot
|
|
22
22
|
- xAI (Grok/X subscription)
|
|
23
|
+
- Meta (Muse subscription)
|
|
23
24
|
- OpenRouter (OAuth-minted API key billed from OpenRouter credits)
|
|
24
25
|
- Radius
|
|
25
26
|
|
|
@@ -44,6 +45,12 @@ Anthropic subscription auth is active for Claude Pro/Max accounts. Third-party h
|
|
|
44
45
|
- Run `/login xai`, then select **Use a subscription**
|
|
45
46
|
- `XAI_API_KEY` remains available through **Use an API key**
|
|
46
47
|
|
|
48
|
+
### Meta (Muse subscription)
|
|
49
|
+
|
|
50
|
+
- Run `/login meta`, then select **Sign in with Meta** to open the device authorization flow
|
|
51
|
+
- The login mints a Model API key that is re-minted automatically about once a day
|
|
52
|
+
- `META_API_KEY` remains available through **Use an API key**
|
|
53
|
+
|
|
47
54
|
### OpenRouter
|
|
48
55
|
|
|
49
56
|
- Run `/login openrouter`, then select **Sign in with OpenRouter** to open the OpenRouter PKCE authorization flow
|
|
@@ -94,6 +101,7 @@ pi
|
|
|
94
101
|
| Together AI | `TOGETHER_API_KEY` | `together` |
|
|
95
102
|
| Baseten | `BASETEN_API_KEY` | `baseten` |
|
|
96
103
|
| Kimi For Coding | `KIMI_API_KEY` | `kimi-coding` |
|
|
104
|
+
| Meta | `META_API_KEY` | `meta` |
|
|
97
105
|
| MiniMax | `MINIMAX_API_KEY` | `minimax` |
|
|
98
106
|
| MiniMax (China) | `MINIMAX_CN_API_KEY` | `minimax-cn` |
|
|
99
107
|
| Qwen Token Plan (existing catalog) | `QWEN_TOKEN_PLAN_API_KEY` | `qwen-token-plan` |
|
package/docs/sdk.md
CHANGED
|
@@ -90,6 +90,8 @@ interface AgentSession {
|
|
|
90
90
|
|
|
91
91
|
// State access
|
|
92
92
|
agent: Agent;
|
|
93
|
+
sessionManager: SessionManager;
|
|
94
|
+
refreshContext(): void;
|
|
93
95
|
model: Model | undefined;
|
|
94
96
|
thinkingLevel: ThinkingLevel;
|
|
95
97
|
messages: AgentMessage[];
|
|
@@ -329,7 +331,7 @@ The `Agent` class (from `@earendil-works/pi-agent-core`) handles the core LLM in
|
|
|
329
331
|
// Access current state
|
|
330
332
|
const state = session.agent.state;
|
|
331
333
|
|
|
332
|
-
// state.messages: AgentMessage[] - conversation
|
|
334
|
+
// state.messages: AgentMessage[] - refreshed inspection cache of the model-visible conversation
|
|
333
335
|
// state.model: Model - current model
|
|
334
336
|
// state.thinkingLevel: ThinkingLevel - current thinking level
|
|
335
337
|
// state.systemPrompt: string - read-only, replayed from the transcript's system messages
|
|
@@ -337,8 +339,8 @@ const state = session.agent.state;
|
|
|
337
339
|
// state.streamingMessage?: AgentMessage - current partial assistant message
|
|
338
340
|
// state.errorMessage?: string - latest assistant error
|
|
339
341
|
|
|
340
|
-
//
|
|
341
|
-
|
|
342
|
+
// Model-visible messages are projected from session.sessionManager.
|
|
343
|
+
// agent.state.messages is a refreshed inspection cache; do not assign it for restoration.
|
|
342
344
|
|
|
343
345
|
// Replace tools
|
|
344
346
|
session.agent.state.tools = tools; // copies the top-level array
|
|
@@ -347,6 +349,15 @@ session.agent.state.tools = tools; // copies the top-level array
|
|
|
347
349
|
await session.agent.waitForIdle();
|
|
348
350
|
```
|
|
349
351
|
|
|
352
|
+
Provider requests use `session.sessionManager` as the canonical finalized context. Assigning `session.agent.state.messages` does not replace persisted context and is overwritten at the next request boundary. Restore externally stored history when constructing the session instead:
|
|
353
|
+
|
|
354
|
+
```typescript
|
|
355
|
+
const restoredManager = SessionManager.inMemory(process.cwd(), { id: sessionId }, entries);
|
|
356
|
+
const { session } = await createAgentSession({ sessionManager: restoredManager });
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
For an existing session, use `session.navigateTree(entryId)` to move its active branch. Use `session.sessionManager.appendMessage(...)` plus `session.refreshContext()` only when intentionally appending externally managed entries. `ctx.getContextSnapshot()` and the bundled BTW extension read the same projection.
|
|
360
|
+
|
|
350
361
|
### Events
|
|
351
362
|
|
|
352
363
|
Subscribe to events to receive streaming output and lifecycle notifications.
|
package/docs/session-format.md
CHANGED
|
@@ -33,11 +33,14 @@ The published packages provide the session and message types used here:
|
|
|
33
33
|
```typescript
|
|
34
34
|
import {
|
|
35
35
|
type CompactionEntry,
|
|
36
|
+
type ContextEditEntry,
|
|
36
37
|
type NewSessionOptions,
|
|
38
|
+
type ProjectedSessionEntry,
|
|
37
39
|
type SessionContext,
|
|
38
40
|
type SessionEntry,
|
|
39
41
|
type SessionHeader,
|
|
40
42
|
type SessionInfo,
|
|
43
|
+
type SessionProjection,
|
|
41
44
|
type SessionTreeNode,
|
|
42
45
|
SessionManager,
|
|
43
46
|
} from "@astralyn/pi";
|
|
@@ -287,7 +290,7 @@ Created when context is compacted. Stores a summary of earlier messages and a co
|
|
|
287
290
|
{"type":"compaction","id":"f6g7h8i9","parentId":"e5f6g7h8","timestamp":"2024-12-03T14:10:00.000Z","summary":"User discussed X, Y, Z...","firstKeptEntryId":"c3d4e5f6","tokensBefore":50000,"systemMessage":{"role":"system","content":"You are a coding assistant.","toolsAdded":[],"timestamp":1733235000000}}
|
|
288
291
|
```
|
|
289
292
|
|
|
290
|
-
`firstKeptEntryId` is required. It identifies the first entry retained from before the compaction entry. When rebuilding context, Pi replaces older summarized entries with the compaction summary and keeps the range beginning at this entry.
|
|
293
|
+
`firstKeptEntryId` is required. It identifies the first entry retained from before the compaction entry. When rebuilding context, Pi replaces older summarized entries with the compaction summary and keeps the range beginning at this entry. A retain-none compaction stores its own ID in this field, so no preceding entries are retained.
|
|
291
294
|
|
|
292
295
|
Optional fields:
|
|
293
296
|
- `systemMessage`: The replayed prompt sections and tool declarations at the compaction boundary; it becomes the leading system message of the compacted context, and system messages among the kept entries are dropped in its favor. It is absent on older session entries.
|
|
@@ -295,6 +298,16 @@ Optional fields:
|
|
|
295
298
|
- `details`: Implementation-specific data (e.g., `{ readFiles: string[], modifiedFiles: string[] }` for default, or custom data for extensions)
|
|
296
299
|
- `fromHook`: `true` if generated by an extension, `false`/`undefined` if pi-generated (legacy field name)
|
|
297
300
|
|
|
301
|
+
### ContextEditEntry
|
|
302
|
+
|
|
303
|
+
Append-only edit of one earlier context-producing entry. It changes only future model context; the target entry and its metadata remain unchanged in raw history, UI, exports, and session accounting.
|
|
304
|
+
|
|
305
|
+
```json
|
|
306
|
+
{"type":"context_edit","id":"g6h7i8j9","parentId":"f6g7h8i9","timestamp":"2024-12-03T14:11:00.000Z","targetId":"c3d4e5f6","replacement":null}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
Targets may be user, assistant, tool-result, or custom-message entries. `replacement: null` omits the target from model context. A non-null `replacement` replaces only the target message content. String replacements for assistant and tool-result entries are normalized to one text block because those roles require content arrays. If several edits target the same entry, the latest edit on the active branch wins. Edits are branch-relative: navigating to a point before the edit reveals the target's original contribution again. Pi writes these entries itself when auto-retry or overflow recovery abandons an assistant attempt, and extensions can append them from the `turn_end` and `agent_before_settle` boundaries; `/tree` and HTML export list them as bookkeeping entries.
|
|
310
|
+
|
|
298
311
|
### BranchSummaryEntry
|
|
299
312
|
|
|
300
313
|
Created when switching branches via `/tree` with an LLM generated summary of the left branch up to the common ancestor. Captures context from the abandoned path.
|
|
@@ -436,7 +449,9 @@ Entries normally form one tree, but navigation APIs can create multiple roots:
|
|
|
436
449
|
|
|
437
450
|
Earlier summarized entries are omitted. Non-message entries in the selected ranges remain in the returned list for rendering and state handling. If a malformed session's `firstKeptEntryId` is not found before the compaction entry, step 2 contributes no entries.
|
|
438
451
|
|
|
439
|
-
`
|
|
452
|
+
`buildSessionProjection()` applies the latest `context_edit` for each selected target and returns the model-visible messages together with their source entries (`ProjectedSessionEntry`). Omitted targets produce no message; replacements retain the source entry's role and metadata while changing only content. The raw selected entries are not modified. This projection is what `AgentSession` sends to the provider; `agent.state.messages` is only a refreshed copy of it.
|
|
453
|
+
|
|
454
|
+
`buildSessionContext()` builds on that projection and returns a `SessionContext`, not provider-ready `Message[]` directly:
|
|
440
455
|
|
|
441
456
|
1. It determines `thinkingLevel` and `model` from the entire active path, including entries omitted by compaction. A `model_change` sets the model, and an assistant message later on the path sets it from that message's `provider` and `model`.
|
|
442
457
|
2. It projects the selected entries to `AgentMessage[]` in the order above:
|
|
@@ -444,6 +459,7 @@ Earlier summarized entries are omitted. Non-message entries in the selected rang
|
|
|
444
459
|
- `compaction` → its complete system checkpoint followed by a `CompactionSummaryMessage`. Pre-compaction system messages are folded into that checkpoint rather than replayed from the retained range.
|
|
445
460
|
- `branch_summary` → `BranchSummaryMessage`.
|
|
446
461
|
- `custom_message` → `CustomMessage`.
|
|
462
|
+
- `context_edit` → no message of its own; it changes the target's contribution.
|
|
447
463
|
- `usage`, `custom`, model/thinking changes, labels, and session-info entries → no message.
|
|
448
464
|
|
|
449
465
|
Use `convertToLlm()` from `@astralyn/pi` when provider-ready `Message[]` are required. It passes base user, assistant, and tool-result messages through; it converts Pi-specific context roles to user messages and omits `bashExecution` messages marked `excludeFromContext`.
|
|
@@ -480,6 +496,9 @@ for (const line of lines) {
|
|
|
480
496
|
case "custom_message":
|
|
481
497
|
console.log(`[${entry.id}] Extension message (${entry.customType}): ${entry.content}`);
|
|
482
498
|
break;
|
|
499
|
+
case "context_edit":
|
|
500
|
+
console.log(`[${entry.id}] Context ${entry.replacement === null ? "omit" : "replace"}: ${entry.targetId}`);
|
|
501
|
+
break;
|
|
483
502
|
case "label":
|
|
484
503
|
console.log(`[${entry.id}] Label "${entry.label}" on ${entry.targetId}`);
|
|
485
504
|
break;
|
|
@@ -526,11 +545,12 @@ All of these return the appended entry ID:
|
|
|
526
545
|
- `appendMessage(message: Message | CustomMessage | BashExecutionMessage): string`
|
|
527
546
|
- `appendThinkingLevelChange(thinkingLevel: string): string`
|
|
528
547
|
- `appendModelChange(provider: string, modelId: string): string`
|
|
529
|
-
- `appendCompaction<T = unknown>(summary: string, firstKeptEntryId: string, tokensBefore: number, details?: T, fromHook?: boolean, usage?: Usage): string`
|
|
548
|
+
- `appendCompaction<T = unknown>(summary: string, firstKeptEntryId: string | null, tokensBefore: number, details?: T, fromHook?: boolean, usage?: Usage): string` — `null` creates a retain-none compaction that records its own ID as the kept boundary.
|
|
530
549
|
- `appendCustomEntry(customType: string, data?: unknown): string`
|
|
531
550
|
- `appendSessionInfo(name: string): string`
|
|
532
551
|
- `appendCustomMessageEntry<T = unknown>(customType: string, content: string | (TextContent | ImageContent)[], display: boolean, details?: T): string`
|
|
533
552
|
- `appendLabelChange(targetId: string, label: string | undefined): string`
|
|
553
|
+
- `appendContextEdit(targetId: string, replacement: { content: ContextEditableContent } | null): string` — the target must be a user, assistant, tool-result, or custom-message entry on the active branch.
|
|
534
554
|
|
|
535
555
|
### Instance Methods — Tree Navigation
|
|
536
556
|
|
|
@@ -546,7 +566,8 @@ All of these return the appended entry ID:
|
|
|
546
566
|
### Instance Methods — Context and Info
|
|
547
567
|
|
|
548
568
|
- `buildContextEntries(): SessionEntry[]` — get the compaction-aware active branch.
|
|
549
|
-
- `
|
|
569
|
+
- `buildSessionProjection(): SessionProjection` — get the context-edited model-visible messages with their source entries, plus thinking level and model.
|
|
570
|
+
- `buildSessionContext(): SessionContext` — get `AgentMessage[]`, thinking level, and model from that projection; use `convertToLlm()` for provider messages.
|
|
550
571
|
- `getEntries(): SessionEntry[]` and `getHeader(): SessionHeader | null`
|
|
551
572
|
- `getSessionName(): string | undefined`
|
|
552
573
|
- `getCwd(): string`, `getSessionDir(): string`, `getSessionId(): string`, and `getSessionFile(): string | undefined`
|
|
@@ -16,8 +16,9 @@ export default defineFacet({
|
|
|
16
16
|
},
|
|
17
17
|
});
|
|
18
18
|
env.onActivate(() => {
|
|
19
|
-
workerActivations.
|
|
20
|
-
|
|
19
|
+
workerActivations.change(BACKGROUND_CONTEXT, (draft) => {
|
|
20
|
+
draft.count += 1;
|
|
21
|
+
});
|
|
21
22
|
});
|
|
22
23
|
},
|
|
23
24
|
});
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astralyn/pi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.87.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@astralyn/pi",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.87.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@earendil-works/chord": "0.
|
|
13
|
-
"@earendil-works/pi-agent-core": "0.
|
|
14
|
-
"@earendil-works/pi-ai": "0.
|
|
15
|
-
"@earendil-works/pi-tui": "0.
|
|
12
|
+
"@earendil-works/chord": "0.87.0",
|
|
13
|
+
"@earendil-works/pi-agent-core": "0.87.0",
|
|
14
|
+
"@earendil-works/pi-ai": "0.87.0",
|
|
15
|
+
"@earendil-works/pi-tui": "0.87.0",
|
|
16
16
|
"@silvia-odwyer/photon-node": "0.3.4",
|
|
17
17
|
"chalk": "6.0.0",
|
|
18
18
|
"cross-spawn": "7.0.6",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"@anthropic-ai/sandbox-runtime": "0.0.26",
|
|
37
37
|
"@anthropic-ai/sdk": "0.52.0",
|
|
38
38
|
"@biomejs/biome": "2.3.5",
|
|
39
|
-
"@earendil-works/pi-client": "0.
|
|
40
|
-
"@earendil-works/pi-protocol": "0.
|
|
41
|
-
"@earendil-works/pi-server": "0.
|
|
39
|
+
"@earendil-works/pi-client": "0.87.0",
|
|
40
|
+
"@earendil-works/pi-protocol": "0.87.0",
|
|
41
|
+
"@earendil-works/pi-server": "0.87.0",
|
|
42
42
|
"@types/cross-spawn": "6.0.6",
|
|
43
43
|
"@types/hosted-git-info": "3.0.5",
|
|
44
44
|
"@types/ms": "2.1.0",
|
|
@@ -626,9 +626,9 @@
|
|
|
626
626
|
}
|
|
627
627
|
},
|
|
628
628
|
"node_modules/@earendil-works/chord": {
|
|
629
|
-
"version": "0.
|
|
630
|
-
"resolved": "https://registry.npmjs.org/@earendil-works/chord/-/chord-0.
|
|
631
|
-
"integrity": "sha512-
|
|
629
|
+
"version": "0.87.0",
|
|
630
|
+
"resolved": "https://registry.npmjs.org/@earendil-works/chord/-/chord-0.87.0.tgz",
|
|
631
|
+
"integrity": "sha512-t8QOTf0GTHrsDSfcdtXuA9RCkh6mnR4l25N0SM/sgH7Ih25jH4tGXNbkGs9MWpV5xTu9MRPj4A7Zn1UEwQm9+g==",
|
|
632
632
|
"license": "MIT",
|
|
633
633
|
"dependencies": {
|
|
634
634
|
"esbuild": "0.28.2"
|
|
@@ -638,14 +638,14 @@
|
|
|
638
638
|
}
|
|
639
639
|
},
|
|
640
640
|
"node_modules/@earendil-works/pi-agent-core": {
|
|
641
|
-
"version": "0.
|
|
642
|
-
"resolved": "https://registry.npmjs.org/@earendil-works/pi-agent-core/-/pi-agent-core-0.
|
|
643
|
-
"integrity": "sha512-
|
|
641
|
+
"version": "0.87.0",
|
|
642
|
+
"resolved": "https://registry.npmjs.org/@earendil-works/pi-agent-core/-/pi-agent-core-0.87.0.tgz",
|
|
643
|
+
"integrity": "sha512-c5b2FMdJ7C++HBa6AyBmusdf96gdgRqpF7J+UCq2yVGB28UETJvJ190HkgDWUaLPnOQQPbanjKMAm/TgRmFE2w==",
|
|
644
644
|
"license": "MIT",
|
|
645
645
|
"dependencies": {
|
|
646
|
-
"@earendil-works/chord": "^0.
|
|
647
|
-
"@earendil-works/pi-ai": "^0.
|
|
648
|
-
"@earendil-works/pi-telemetry": "^0.
|
|
646
|
+
"@earendil-works/chord": "^0.87.0",
|
|
647
|
+
"@earendil-works/pi-ai": "^0.87.0",
|
|
648
|
+
"@earendil-works/pi-telemetry": "^0.87.0",
|
|
649
649
|
"diff": "8.0.4",
|
|
650
650
|
"ignore": "7.0.8",
|
|
651
651
|
"typebox": "1.3.27",
|
|
@@ -656,14 +656,14 @@
|
|
|
656
656
|
}
|
|
657
657
|
},
|
|
658
658
|
"node_modules/@earendil-works/pi-ai": {
|
|
659
|
-
"version": "0.
|
|
660
|
-
"resolved": "https://registry.npmjs.org/@earendil-works/pi-ai/-/pi-ai-0.
|
|
661
|
-
"integrity": "sha512-
|
|
659
|
+
"version": "0.87.0",
|
|
660
|
+
"resolved": "https://registry.npmjs.org/@earendil-works/pi-ai/-/pi-ai-0.87.0.tgz",
|
|
661
|
+
"integrity": "sha512-lbRm+EMY6Jx3l+HLpbqbm9Yrhkc5u7EffLk2id+zJQEoBuR5I+tijGiZU8zlnuuCclmQOgH0PVjL9PLbeqJ9MQ==",
|
|
662
662
|
"license": "MIT",
|
|
663
663
|
"dependencies": {
|
|
664
664
|
"@anthropic-ai/sdk": "0.124.0",
|
|
665
665
|
"@aws-sdk/client-bedrock-runtime": "3.1127.0",
|
|
666
|
-
"@earendil-works/pi-telemetry": "^0.
|
|
666
|
+
"@earendil-works/pi-telemetry": "^0.87.0",
|
|
667
667
|
"@google/genai": "2.21.0",
|
|
668
668
|
"@smithy/node-http-handler": "4.12.1",
|
|
669
669
|
"http-proxy-agent": "9.1.0",
|
|
@@ -701,27 +701,27 @@
|
|
|
701
701
|
}
|
|
702
702
|
},
|
|
703
703
|
"node_modules/@earendil-works/pi-client": {
|
|
704
|
-
"version": "0.
|
|
705
|
-
"resolved": "https://registry.npmjs.org/@earendil-works/pi-client/-/pi-client-0.
|
|
706
|
-
"integrity": "sha512-
|
|
704
|
+
"version": "0.87.0",
|
|
705
|
+
"resolved": "https://registry.npmjs.org/@earendil-works/pi-client/-/pi-client-0.87.0.tgz",
|
|
706
|
+
"integrity": "sha512-SzlKFULcz3VchpfVizd9fTxaFHxhIe/Dpn9CDHthqRzUx6Sym2tWwlveqdjD4V81yid+r7VEziZuHYYqNt4+kA==",
|
|
707
707
|
"dev": true,
|
|
708
708
|
"license": "MIT",
|
|
709
709
|
"dependencies": {
|
|
710
|
-
"@earendil-works/chord": "^0.
|
|
711
|
-
"@earendil-works/pi-protocol": "^0.
|
|
710
|
+
"@earendil-works/chord": "^0.87.0",
|
|
711
|
+
"@earendil-works/pi-protocol": "^0.87.0"
|
|
712
712
|
},
|
|
713
713
|
"engines": {
|
|
714
714
|
"node": ">=22.19.0"
|
|
715
715
|
}
|
|
716
716
|
},
|
|
717
717
|
"node_modules/@earendil-works/pi-protocol": {
|
|
718
|
-
"version": "0.
|
|
719
|
-
"resolved": "https://registry.npmjs.org/@earendil-works/pi-protocol/-/pi-protocol-0.
|
|
720
|
-
"integrity": "sha512-
|
|
718
|
+
"version": "0.87.0",
|
|
719
|
+
"resolved": "https://registry.npmjs.org/@earendil-works/pi-protocol/-/pi-protocol-0.87.0.tgz",
|
|
720
|
+
"integrity": "sha512-H6tL0BGj5RbvwPQq7YnaGSudASvmPbHBP3FVqeIIJa91hURB6DdKCmITQkJwQz8nR/bc4B/r2tZXgzlVTBYOrQ==",
|
|
721
721
|
"dev": true,
|
|
722
722
|
"license": "MIT",
|
|
723
723
|
"dependencies": {
|
|
724
|
-
"@earendil-works/chord": "^0.
|
|
724
|
+
"@earendil-works/chord": "^0.87.0",
|
|
725
725
|
"typebox": "1.3.27"
|
|
726
726
|
},
|
|
727
727
|
"engines": {
|
|
@@ -729,33 +729,33 @@
|
|
|
729
729
|
}
|
|
730
730
|
},
|
|
731
731
|
"node_modules/@earendil-works/pi-server": {
|
|
732
|
-
"version": "0.
|
|
733
|
-
"resolved": "https://registry.npmjs.org/@earendil-works/pi-server/-/pi-server-0.
|
|
734
|
-
"integrity": "sha512-
|
|
732
|
+
"version": "0.87.0",
|
|
733
|
+
"resolved": "https://registry.npmjs.org/@earendil-works/pi-server/-/pi-server-0.87.0.tgz",
|
|
734
|
+
"integrity": "sha512-hnxO8xe1iUIvPiPiVmj/UkfVTeOHPam2b62FuvB4OJRqhqDCVRPec+KJZST70c9rb+v1QTQnbimeNop5Ji5N5A==",
|
|
735
735
|
"dev": true,
|
|
736
736
|
"license": "MIT",
|
|
737
737
|
"dependencies": {
|
|
738
|
-
"@earendil-works/chord": "^0.
|
|
739
|
-
"@earendil-works/pi-agent-core": "^0.
|
|
740
|
-
"@earendil-works/pi-protocol": "^0.
|
|
738
|
+
"@earendil-works/chord": "^0.87.0",
|
|
739
|
+
"@earendil-works/pi-agent-core": "^0.87.0",
|
|
740
|
+
"@earendil-works/pi-protocol": "^0.87.0"
|
|
741
741
|
},
|
|
742
742
|
"engines": {
|
|
743
743
|
"node": ">=22.19.0"
|
|
744
744
|
}
|
|
745
745
|
},
|
|
746
746
|
"node_modules/@earendil-works/pi-telemetry": {
|
|
747
|
-
"version": "0.
|
|
748
|
-
"resolved": "https://registry.npmjs.org/@earendil-works/pi-telemetry/-/pi-telemetry-0.
|
|
749
|
-
"integrity": "sha512-
|
|
747
|
+
"version": "0.87.0",
|
|
748
|
+
"resolved": "https://registry.npmjs.org/@earendil-works/pi-telemetry/-/pi-telemetry-0.87.0.tgz",
|
|
749
|
+
"integrity": "sha512-IEUMnV6mgHyOMfAxa4CKXoBKKfHM8KxNjbXWM4Bps/iLJcFMf8hQsEZ+95VnVTc7C0cU77Rmdxt773C35jb5AA==",
|
|
750
750
|
"license": "MIT",
|
|
751
751
|
"engines": {
|
|
752
752
|
"node": ">=22.19.0"
|
|
753
753
|
}
|
|
754
754
|
},
|
|
755
755
|
"node_modules/@earendil-works/pi-tui": {
|
|
756
|
-
"version": "0.
|
|
757
|
-
"resolved": "https://registry.npmjs.org/@earendil-works/pi-tui/-/pi-tui-0.
|
|
758
|
-
"integrity": "sha512-
|
|
756
|
+
"version": "0.87.0",
|
|
757
|
+
"resolved": "https://registry.npmjs.org/@earendil-works/pi-tui/-/pi-tui-0.87.0.tgz",
|
|
758
|
+
"integrity": "sha512-7gTC0XOgQfVWg4yGxwHINBpCnGl9p4KEC7PXIc8gAwc/cyxSW4VuFQrp+r1YD3oM+rBkoepKwAt6w6+VJ7BCaw==",
|
|
759
759
|
"license": "MIT",
|
|
760
760
|
"dependencies": {
|
|
761
761
|
"get-east-asian-width": "1.6.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astralyn/pi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.87.0",
|
|
4
4
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"piConfig": {
|
|
@@ -62,10 +62,10 @@
|
|
|
62
62
|
"prepublishOnly": "npm run clean && npm run build"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@earendil-works/chord": "0.
|
|
66
|
-
"@earendil-works/pi-agent-core": "0.
|
|
67
|
-
"@earendil-works/pi-ai": "0.
|
|
68
|
-
"@earendil-works/pi-tui": "0.
|
|
65
|
+
"@earendil-works/chord": "0.87.0",
|
|
66
|
+
"@earendil-works/pi-agent-core": "0.87.0",
|
|
67
|
+
"@earendil-works/pi-ai": "0.87.0",
|
|
68
|
+
"@earendil-works/pi-tui": "0.87.0",
|
|
69
69
|
"@silvia-odwyer/photon-node": "0.3.4",
|
|
70
70
|
"chalk": "6.0.0",
|
|
71
71
|
"cross-spawn": "7.0.6",
|
|
@@ -86,9 +86,9 @@
|
|
|
86
86
|
"@anthropic-ai/sandbox-runtime": "0.0.26",
|
|
87
87
|
"@anthropic-ai/sdk": "0.52.0",
|
|
88
88
|
"@biomejs/biome": "2.3.5",
|
|
89
|
-
"@earendil-works/pi-client": "0.
|
|
90
|
-
"@earendil-works/pi-protocol": "0.
|
|
91
|
-
"@earendil-works/pi-server": "0.
|
|
89
|
+
"@earendil-works/pi-client": "0.87.0",
|
|
90
|
+
"@earendil-works/pi-protocol": "0.87.0",
|
|
91
|
+
"@earendil-works/pi-server": "0.87.0",
|
|
92
92
|
"@types/cross-spawn": "6.0.6",
|
|
93
93
|
"@types/hosted-git-info": "3.0.5",
|
|
94
94
|
"@types/ms": "2.1.0",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{AgentSession,AgentSessionRuntime,ArminComponent,AssistantMessageComponent,BackgroundService,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CONFIG_DIR_NAME,CURRENT_SESSION_VERSION,CompactionSummaryMessageComponent,Container,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,DefaultPackageManager,DefaultResourceLoader,DynamicBorder,ExtensionEditorComponent,ExtensionInputComponent,ExtensionRunner,ExtensionSelectorComponent,FooterComponent,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,ProjectTrustStore,RpcClient,SelectList,SessionManager,SessionSelectorComponent,SettingsManager,SettingsSelectorComponent,SkillInvocationMessageComponent,Theme,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,VERSION,buildContextEntries,buildSessionContext,calculateContextTokens,collectEntriesForBranchSummary,compact,convertToLlm,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLocalPowerShellOperations,createLsTool,createLsToolDefinition,createPowerShellTool,createPowerShellToolDefinition,createReadOnlyTools,createReadTool,createReadToolDefinition,createSyntheticSourceInfo,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSize,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getAgentDir,getAvailableThemes,getDocsPath,getExamplesPath,getLanguageFromPath,getLastAssistantUsage,getLatestCompactionEntry,getMarkdownTheme,getPackageDir,getPowerShellConfig,getReadmePath,getSelectListTheme,getSettingsListTheme,getShellConfig,hasTrustRequiringProjectResources,highlightCode,initTheme,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,keyHint,keyText,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,parseArgs,parseFrontmatter,parseSessionEntries,parseSkillBlock,prepareBranchEntries,rawKeyHint,readStoredCredential,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runPrintMode,runRpcMode,serializeConversation,sessionEntryToContextMessages,shouldCompact,stripFrontmatter,truncateHead,truncateLine,truncateTail,truncateToVisualLines,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools}from"./chunk-MSHHFVMD.js";import{__export}from"./chunk-4L3WN2XY.js";var dist_exports={};__export(dist_exports,{AgentSession:()=>AgentSession,AgentSessionRuntime:()=>AgentSessionRuntime,ArminComponent:()=>ArminComponent,AssistantMessageComponent:()=>AssistantMessageComponent,BackgroundService:()=>BackgroundService,BashExecutionComponent:()=>BashExecutionComponent,BorderedLoader:()=>BorderedLoader,BranchSummaryMessageComponent:()=>BranchSummaryMessageComponent,CONFIG_DIR_NAME:()=>CONFIG_DIR_NAME,CURRENT_SESSION_VERSION:()=>CURRENT_SESSION_VERSION,CompactionSummaryMessageComponent:()=>CompactionSummaryMessageComponent,CredentialSynchronizationError:()=>CredentialSynchronizationError,CustomEditor:()=>CustomEditor,CustomMessageComponent:()=>CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS:()=>DEFAULT_COMPACTION_SETTINGS,DEFAULT_MAX_BYTES:()=>DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES:()=>DEFAULT_MAX_LINES,DefaultPackageManager:()=>DefaultPackageManager,DefaultResourceLoader:()=>DefaultResourceLoader,DynamicBorder:()=>DynamicBorder,ExtensionEditorComponent:()=>ExtensionEditorComponent,ExtensionInputComponent:()=>ExtensionInputComponent,ExtensionRunner:()=>ExtensionRunner,ExtensionSelectorComponent:()=>ExtensionSelectorComponent,FooterComponent:()=>FooterComponent,InteractiveMode:()=>InteractiveMode,LoginDialogComponent:()=>LoginDialogComponent,ModelRegistry:()=>ModelRegistry,ModelRuntime:()=>ModelRuntime,ModelSelectorComponent:()=>ModelSelectorComponent,OAuthSelectorComponent:()=>OAuthSelectorComponent,ProjectTrustStore:()=>ProjectTrustStore,RpcClient:()=>RpcClient,SessionManager:()=>SessionManager,SessionSelectorComponent:()=>SessionSelectorComponent,SettingsManager:()=>SettingsManager,SettingsSelectorComponent:()=>SettingsSelectorComponent,ShowImagesSelectorComponent:()=>ShowImagesSelectorComponent,SkillInvocationMessageComponent:()=>SkillInvocationMessageComponent,Theme:()=>Theme,ThemeSelectorComponent:()=>ThemeSelectorComponent,ThinkingSelectorComponent:()=>ThinkingSelectorComponent,ToolExecutionComponent:()=>ToolExecutionComponent,TreeSelectorComponent:()=>TreeSelectorComponent,UserMessageComponent:()=>UserMessageComponent,UserMessageSelectorComponent:()=>UserMessageSelectorComponent,VERSION:()=>VERSION,buildContextEntries:()=>buildContextEntries,buildSessionContext:()=>buildSessionContext,calculateContextTokens:()=>calculateContextTokens,collectEntriesForBranchSummary:()=>collectEntriesForBranchSummary,compact:()=>compact,convertToLlm:()=>convertToLlm,convertToPng:()=>convertToPng,copyToClipboard:()=>copyToClipboard,createAgentSession:()=>createAgentSession,createAgentSessionFromServices:()=>createAgentSessionFromServices,createAgentSessionRuntime:()=>createAgentSessionRuntime,createAgentSessionServices:()=>createAgentSessionServices,createBashTool:()=>createBashTool,createBashToolDefinition:()=>createBashToolDefinition,createCodingTools:()=>createCodingTools,createEditTool:()=>createEditTool,createEditToolDefinition:()=>createEditToolDefinition,createEventBus:()=>createEventBus,createExtensionRuntime:()=>createExtensionRuntime,createFindTool:()=>createFindTool,createFindToolDefinition:()=>createFindToolDefinition,createGrepTool:()=>createGrepTool,createGrepToolDefinition:()=>createGrepToolDefinition,createLocalBashOperations:()=>createLocalBashOperations,createLocalPowerShellOperations:()=>createLocalPowerShellOperations,createLsTool:()=>createLsTool,createLsToolDefinition:()=>createLsToolDefinition,createPowerShellTool:()=>createPowerShellTool,createPowerShellToolDefinition:()=>createPowerShellToolDefinition,createReadOnlyTools:()=>createReadOnlyTools,createReadTool:()=>createReadTool,createReadToolDefinition:()=>createReadToolDefinition,createSyntheticSourceInfo:()=>createSyntheticSourceInfo,createWriteTool:()=>createWriteTool,createWriteToolDefinition:()=>createWriteToolDefinition,defineTool:()=>defineTool,detectSupportedImageMimeTypeFromFile:()=>detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions:()=>discoverAndLoadExtensions,estimateTokens:()=>estimateTokens,findCutPoint:()=>findCutPoint,findTurnStartIndex:()=>findTurnStartIndex,formatDimensionNote:()=>formatDimensionNote,formatSize:()=>formatSize,formatSkillsForPrompt:()=>formatSkillsForPrompt,generateBranchSummary:()=>generateBranchSummary,generateDiffString:()=>generateDiffString,generateSummary:()=>generateSummary,generateSummaryWithUsage:()=>generateSummaryWithUsage,generateUnifiedPatch:()=>generateUnifiedPatch,getAgentDir:()=>getAgentDir,getDocsPath:()=>getDocsPath,getExamplesPath:()=>getExamplesPath,getLanguageFromPath:()=>getLanguageFromPath,getLastAssistantUsage:()=>getLastAssistantUsage,getLatestCompactionEntry:()=>getLatestCompactionEntry,getMarkdownTheme:()=>getMarkdownTheme,getPackageDir:()=>getPackageDir,getPowerShellConfig:()=>getPowerShellConfig,getReadmePath:()=>getReadmePath,getSelectListTheme:()=>getSelectListTheme,getSettingsListTheme:()=>getSettingsListTheme,getShellConfig:()=>getShellConfig,hasTrustRequiringProjectResources:()=>hasTrustRequiringProjectResources,highlightCode:()=>highlightCode,initTheme:()=>initTheme,isBashToolResult:()=>isBashToolResult,isEditToolResult:()=>isEditToolResult,isFindToolResult:()=>isFindToolResult,isGrepToolResult:()=>isGrepToolResult,isLsToolResult:()=>isLsToolResult,isPowerShellToolResult:()=>isPowerShellToolResult,isReadToolResult:()=>isReadToolResult,isToolCallEventType:()=>isToolCallEventType,isWriteToolResult:()=>isWriteToolResult,keyHint:()=>keyHint,keyText:()=>keyText,loadProjectContextFiles:()=>loadProjectContextFiles,loadSkills:()=>loadSkills,loadSkillsFromDir:()=>loadSkillsFromDir,main:()=>main,migrateSessionEntries:()=>migrateSessionEntries,parseArgs:()=>parseArgs,parseFrontmatter:()=>parseFrontmatter,parseSessionEntries:()=>parseSessionEntries,parseSkillBlock:()=>parseSkillBlock,prepareBranchEntries:()=>prepareBranchEntries,rawKeyHint:()=>rawKeyHint,readStoredCredential:()=>readStoredCredential,renderDiff:()=>renderDiff,resizeImage:()=>resizeImage,resolveCliModel:()=>resolveCliModel,resolveModelScopeWithDiagnostics:()=>resolveModelScopeWithDiagnostics,runPrintMode:()=>runPrintMode,runRpcMode:()=>runRpcMode,serializeConversation:()=>serializeConversation,sessionEntryToContextMessages:()=>sessionEntryToContextMessages,shouldCompact:()=>shouldCompact,stripFrontmatter:()=>stripFrontmatter,truncateHead:()=>truncateHead,truncateLine:()=>truncateLine,truncateTail:()=>truncateTail,truncateToVisualLines:()=>truncateToVisualLines,withFileMutationQueue:()=>withFileMutationQueue,wrapRegisteredTool:()=>wrapRegisteredTool,wrapRegisteredTools:()=>wrapRegisteredTools});var SHOW_IMAGES_SELECT_LIST_LAYOUT={minPrimaryColumnWidth:12,maxPrimaryColumnWidth:32},ShowImagesSelectorComponent=class extends Container{constructor(currentValue,onSelect,onCancel){super();let items=[{value:"yes",label:"Yes",description:"Show images inline in terminal"},{value:"no",label:"No",description:"Show text placeholder instead"}];this.addChild(new DynamicBorder),this.selectList=new SelectList(items,5,getSelectListTheme(),SHOW_IMAGES_SELECT_LIST_LAYOUT),this.selectList.setSelectedIndex(currentValue?0:1),this.selectList.onSelect=item=>{onSelect(item.value==="yes")},this.selectList.onCancel=()=>{onCancel()},this.addChild(this.selectList),this.addChild(new DynamicBorder)}getSelectList(){return this.selectList}};var THEME_SELECT_LIST_LAYOUT={minPrimaryColumnWidth:12,maxPrimaryColumnWidth:32},ThemeSelectorComponent=class extends Container{constructor(currentTheme,onSelect,onCancel,onPreview){super(),this.onPreview=onPreview;let themes=getAvailableThemes(),themeItems=themes.map(name=>({value:name,label:name,description:name===currentTheme?"(current)":void 0}));this.addChild(new DynamicBorder),this.selectList=new SelectList(themeItems,10,getSelectListTheme(),THEME_SELECT_LIST_LAYOUT);let currentIndex=themes.indexOf(currentTheme);currentIndex!==-1&&this.selectList.setSelectedIndex(currentIndex),this.selectList.onSelect=item=>{onSelect(item.value)},this.selectList.onCancel=()=>{onCancel()},this.selectList.onSelectionChange=item=>{this.onPreview(item.value)},this.addChild(this.selectList),this.addChild(new DynamicBorder)}getSelectList(){return this.selectList}};export{ShowImagesSelectorComponent,ThemeSelectorComponent,dist_exports};
|