proper-base 0.8.2 → 0.8.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 +292 -0
- package/README.md +1 -1
- package/package.json +2 -4
- package/src/auto-update/availability.ts +21 -10
- package/src/auto-update/runtime.ts +8 -1
- package/src/clipboard-selection.ts +12 -0
- package/src/prompt-display-host.ts +16 -7
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.8.4]
|
|
4
|
+
|
|
5
|
+
Restores prompt display on Pi 1.5.1 and later, where slash-command prompts showed their expanded body and extra skill blocks appeared as raw text. Update notices and the updater's progress line also work again. The package is tested against Pi 1.5.2.
|
|
6
|
+
|
|
7
|
+
### Fixes
|
|
8
|
+
|
|
9
|
+
- **Raw slash commands and skill disclosures on Pi 1.5.1 and later** - Prompt-template submissions show the command you typed again, and every skill block in a message collapses into its own disclosure.
|
|
10
|
+
- **Restart hint in update notices** - When an update is recorded for the next launch, Pi's update notices now say to restart Pi and keep saying it after a theme change.
|
|
11
|
+
- **Copied text matches the selection on Pi 1.5.0 and later** - Copy-on-select and the copy shortcut no longer return the line above the selection in messages with several paragraphs.
|
|
12
|
+
- **Updater progress after package updates** - The update widget moves on to the Pi version check when Pi 1.5.1's new package summaries appear, instead of staying on the last package.
|
|
13
|
+
|
|
14
|
+
## [0.8.3] - 2026-11-02
|
|
15
|
+
|
|
16
|
+
Clipboard copies from Markdown blocks now render cleanly on Pi 1.5.0, dropping the stale quote borders and soft wraps that leaked in from Pi's new per-block render cache. The package is tested against Pi 1.5.0, and development lockfiles follow suit.
|
|
17
|
+
|
|
18
|
+
### Fixes
|
|
19
|
+
|
|
20
|
+
- **Clean Markdown clipboard copies on Pi 1.5.0** - Clipboard selection drops Pi 1.5.0's new per-block render cache before replaying tokens, so copied text no longer carries quote borders or soft-wrap artifacts.
|
|
21
|
+
|
|
22
|
+
### Upgrade Notes
|
|
23
|
+
|
|
24
|
+
- Requires Pi 1.5.0; the `undici` and `minimatch` overrides are gone because Pi now pins them itself.
|
|
25
|
+
|
|
26
|
+
## [0.8.2] - 2026-10-29
|
|
27
|
+
|
|
28
|
+
Pi 1.4.0 compatibility release. Skill tools come back correctly after resume, and automatic compaction no longer competes with reasoning budgets on chunked input.
|
|
29
|
+
|
|
30
|
+
### Improvements
|
|
31
|
+
|
|
32
|
+
- **Smarter summary sizing** - Automatic compaction now scales the summary budget to the summarizer's own output limit (capped at half its context window) so long reasoning runs no longer exhaust a fixed cap.
|
|
33
|
+
- **Reliable skill tool restoration** - Explicitly enabled skill tools are reinstated after resume, and `/skill-context on` restores a recorded removal even across restarts.
|
|
34
|
+
|
|
35
|
+
### Fixes
|
|
36
|
+
|
|
37
|
+
- **Security patch for Undici** - Pinned Undici to 8.12.3 to close a known vulnerability in the transitive dependency.
|
|
38
|
+
- **Workflow worker completion** - Workflow workers now use native completion notices, keeping chunked input and multi-step runs on track.
|
|
39
|
+
|
|
40
|
+
### Upgrade Notes
|
|
41
|
+
|
|
42
|
+
- Tested against Pi 1.4.0; upgrade Pi alongside this release. `maxOutputTokens` in proper-compact now accepts `null`/blank/`auto` and defaults to automatic sizing; explicit numeric values continue to behave as before.
|
|
43
|
+
|
|
44
|
+
lat.md sync: no code changes made here, docs untouched.
|
|
45
|
+
|
|
46
|
+
## [0.8.1] - 2026-10-21
|
|
47
|
+
|
|
48
|
+
Overlay transcript scrolling now works cleanly with Pi 1.3.0, preserving native wheel behavior while keeping keyboard navigation available behind focused overlays. Updated dependencies also resolve a graphics-library security advisory.
|
|
49
|
+
|
|
50
|
+
### Improvements
|
|
51
|
+
|
|
52
|
+
- **Current Pi compatibility** - Verified proper-base against Pi 1.3.0 and adapted overlay scrolling to Pi’s native wheel-event handling.
|
|
53
|
+
- **Focused overlay navigation** - Page Up, Page Down, Ctrl+Home, and Ctrl+End continue scrolling the transcript while an overlay has focus.
|
|
54
|
+
|
|
55
|
+
### Fixes
|
|
56
|
+
|
|
57
|
+
- **Safer image processing dependency** - Updated Sharp to resolve its librsvg security advisory without dropping optional macOS artifacts.
|
|
58
|
+
|
|
59
|
+
## [0.8.0] - 2026-10-05
|
|
60
|
+
|
|
61
|
+
Persistent skill context keeps selected instructions intact across turns, branches, and compaction, with multi-skill loading and explicit controls. Supported OpenAI models can also use a 922,000-token input window per session or globally.
|
|
62
|
+
|
|
63
|
+
### Highlights
|
|
64
|
+
|
|
65
|
+
- **Persistent skill workflows** - Load multiple skills, retain complete instruction snapshots through compaction and branching, and manage selections with `/skill-context`.
|
|
66
|
+
- **Larger OpenAI context windows** - `/tokens max` raises supported GPT models from 272,000 to 922,000 input tokens, while session and global scopes provide control over where it applies.
|
|
67
|
+
|
|
68
|
+
### Improvements
|
|
69
|
+
|
|
70
|
+
- **Clear sessions without losing active choices** - `/clear` now preserves the provider, model, thinking level, session Fast setting, and session context-window choice.
|
|
71
|
+
- **Cleaner skill transcripts** - Multiple expanded skills render as individually collapsible sections while requests remain visible and complete instructions still reach the model.
|
|
72
|
+
- **Consistent proactive delegation** - Proactive multi-agent guidance now applies when pi-subagents starts with only its loader active.
|
|
73
|
+
|
|
74
|
+
### Fixes
|
|
75
|
+
|
|
76
|
+
- **Large skill selections remain complete** - Selections above 200,000 characters now request confirmation instead of being rejected or truncated, with approval remembered for unchanged selections.
|
|
77
|
+
|
|
78
|
+
### Upgrade Notes
|
|
79
|
+
|
|
80
|
+
- Skill context management is enabled by default. Use `/skill-context off` or the settings menu to restore native Pi skill behavior.
|
|
81
|
+
- `/tokens max` is opt-in and may incur long-context pricing for input above 272,000 tokens.
|
|
82
|
+
|
|
83
|
+
## [0.7.0] - 2026-09-21
|
|
84
|
+
|
|
85
|
+
Deferred automatic updates now install detected Pi and package updates on the next eligible launch, with live progress and safe restart handling. Fullscreen Markdown copying is cleaner, while long sessions and image previews stay more responsive.
|
|
86
|
+
|
|
87
|
+
### Highlights
|
|
88
|
+
|
|
89
|
+
- **Deferred automatic updates** - Detected updates install on the next supported launch and restart Pi when safe. Control the default-enabled feature through `/settings`, `--no-auto-update`, or `PROPER_UPDATER_OFF=1`.
|
|
90
|
+
- **Clean Markdown copying** - Fullscreen paragraphs and blockquotes copy without borders, margins, or soft-wrap newlines while preserving intentional line breaks and code indentation.
|
|
91
|
+
|
|
92
|
+
### Improvements
|
|
93
|
+
|
|
94
|
+
- **Smoother long sessions** - Footer rendering reuses cached usage data, session search results refresh as indexing completes, and image preview preparation no longer blocks the editor.
|
|
95
|
+
- **More reliable saved preferences** - Model and thinking selections persist through live Pi settings without saving automatic clamps or router placeholder values.
|
|
96
|
+
|
|
97
|
+
### Fixes
|
|
98
|
+
|
|
99
|
+
- **Context stays intact across extensions and compaction** - Prompt contributions compose correctly, slash-command display metadata follows message identity, and edited or removed skill context is no longer restored incorrectly.
|
|
100
|
+
|
|
101
|
+
### Upgrade Notes
|
|
102
|
+
|
|
103
|
+
- Restart Pi once after upgrading from releases with permanent host patches. Automatic updates require npm-installed Pi 0.86+ on Linux or macOS with Node 22.19+; unsupported launches retain manual update instructions.
|
|
104
|
+
|
|
105
|
+
## [0.6.0] - 2026-09-11
|
|
106
|
+
|
|
107
|
+
Proactive multi-agent delegation now routes worthwhile parallel work to suitable enabled models while keeping tightly coupled tasks local. Overlay sessions remain navigable, live widgets scroll naturally, and Fast status appears immediately.
|
|
108
|
+
|
|
109
|
+
### Highlights
|
|
110
|
+
|
|
111
|
+
- **Smarter automatic delegation** - Independent work can run concurrently using session-enabled models, while small, sequential, and same-area tasks stay in the current session.
|
|
112
|
+
- **Scrollable overlay sessions** - Wheel controls and transcript scroll keys keep earlier context reachable while questionnaires and other overlays have focus.
|
|
113
|
+
|
|
114
|
+
### Improvements
|
|
115
|
+
|
|
116
|
+
- **Live widgets follow the conversation** - Extension widgets now scroll at the transcript tail and release unused rows as their content shrinks.
|
|
117
|
+
- **Immediate Fast status** - Session-scoped `/fast` toggles update the footer chip immediately without duplicating provider indicators.
|
|
118
|
+
|
|
119
|
+
### Fixes
|
|
120
|
+
|
|
121
|
+
- **Astra capacity failures recover automatically** - Model-at-capacity responses now enter Pi's normal retry and backoff flow.
|
|
122
|
+
|
|
123
|
+
### Upgrade Notes
|
|
124
|
+
|
|
125
|
+
- Proactive delegation is enabled by default. Set `"proactiveDelegation": false` in `proper-base.json` to retain explicit-only delegation.
|
|
126
|
+
|
|
127
|
+
## [0.5.1] - 2026-09-05
|
|
128
|
+
|
|
129
|
+
`/model` now sets the model and thinking level in one autocomplete-driven command. Model and thinking-level choices also persist as Pi startup defaults. Prompt editing gains safer history recall and control over click-to-position behavior.
|
|
130
|
+
|
|
131
|
+
### Highlights
|
|
132
|
+
|
|
133
|
+
- **Set model and thinking level together** - Use `/model provider/model level` to apply both choices, with level autocomplete and immediate submission after completing the final level.
|
|
134
|
+
- **Keep preferred defaults across sessions** - Model and thinking-level selections become Pi startup defaults, and unsupported levels are saved as the level Pi actually applies.
|
|
135
|
+
|
|
136
|
+
### Improvements
|
|
137
|
+
|
|
138
|
+
- **Protect typed drafts** - Up recalls history only from an empty prompt, so Home then Up no longer replaces text already entered.
|
|
139
|
+
- **Control prompt mouse clicks** - A new `/settings` toggle prevents prompt clicks from moving the cursor while preserving drag-to-select and border clicks.
|
|
140
|
+
|
|
141
|
+
### Fixes
|
|
142
|
+
|
|
143
|
+
- **Wait for actual tool output** - Transcript cleanup recognizes Pi 0.85.0's updated Working indicator, preventing premature compaction while output is still pending.
|
|
144
|
+
|
|
145
|
+
### Upgrade Notes
|
|
146
|
+
|
|
147
|
+
- `Tab` on a model completion no longer switches immediately. Press `Enter` to keep the current thinking level, or complete a level and press `Tab` or `Enter` to apply both.
|
|
148
|
+
- Model and thinking-level selections now persist by default. Set `"stickyDefaults": false` in `~/.pi/agent/proper-base.json` to retain session-only behavior.
|
|
149
|
+
|
|
150
|
+
## [0.5.0] - 2026-09-01
|
|
151
|
+
|
|
152
|
+
A new session action rail makes long transcripts easier to navigate, with clickable markers for prompts, replies, tools, and failures. Autocomplete and paste handling now remain reliable through command selection, history search, and image previews.
|
|
153
|
+
|
|
154
|
+
### Highlights
|
|
155
|
+
|
|
156
|
+
- **Navigate sessions at a glance** - A color-coded rail marks each session action, highlights the current position, reveals labels on hover, and jumps directly to an action when clicked.
|
|
157
|
+
- **Keep the transcript uncluttered** - A persisted settings toggle disables the session action rail when it is not needed.
|
|
158
|
+
|
|
159
|
+
### Improvements
|
|
160
|
+
|
|
161
|
+
- **Continue slash commands without interruption** - Accepting a command immediately opens its argument suggestions, while word and line deletion keeps the menu synchronized with the edited prompt.
|
|
162
|
+
|
|
163
|
+
### Fixes
|
|
164
|
+
|
|
165
|
+
- **Large pastes remain intact** - Reverse history search and image preview updates no longer cause paste markers to submit as literal tags.
|
|
166
|
+
- **Images pasted during active runs stay usable** - Image markers waiting in the editor continue resolving to their source paths after the current run finishes.
|
|
167
|
+
|
|
168
|
+
## [0.4.0] - 2026-08-30
|
|
169
|
+
|
|
170
|
+
Links in Scribe now remain one clickable target when URLs wrap across rows. Fullscreen transcript scrolling is faster and configurable. Prompt cancellation, selection copying, and Linux clipboard use are more reliable.
|
|
171
|
+
|
|
172
|
+
### Highlights
|
|
173
|
+
|
|
174
|
+
- **Whole-link activation in Scribe** - Wrapped URLs now highlight and open as one link, avoiding partial URL clicks.
|
|
175
|
+
- **Faster fullscreen scrolling** - Mouse-wheel scrolling now moves three lines by default, with `PROPER_WHEEL_SCROLL_LINES` available for per-terminal tuning.
|
|
176
|
+
|
|
177
|
+
### Improvements
|
|
178
|
+
|
|
179
|
+
- **Stable Linux clipboard use** - Clipboard reads avoid an X11 connection leak that could eventually exhaust Xorg clients and cause desktop-wide paste failures.
|
|
180
|
+
|
|
181
|
+
### Fixes
|
|
182
|
+
|
|
183
|
+
- **Cancelled prompts stay cancelled** - Pressing Esc before assistant content arrives now removes the aborted turn from model context.
|
|
184
|
+
- **Copy preserves fullscreen selections** - Pi 0.84.4’s `app.message.copy` binding no longer clears the selection before copying.
|
|
185
|
+
|
|
186
|
+
### Upgrade Notes
|
|
187
|
+
|
|
188
|
+
- Linux clipboard text reads now require `wl-paste`, `xclip`, or `xsel`. Install one if none is available.
|
|
189
|
+
- Compatibility is tested against Pi 0.84.4.
|
|
190
|
+
|
|
191
|
+
## [0.3.0] - 2026-08-28
|
|
192
|
+
|
|
193
|
+
Fast mode now separates session and global priority control for supported CLIProxyAPI models. The `/resume` picker opens much faster on large transcript collections, while fullscreen interactions behave more predictably.
|
|
194
|
+
|
|
195
|
+
### Highlights
|
|
196
|
+
|
|
197
|
+
- **Choose the right Fast mode scope** - `/fast` applies priority service to the current session; `/fast-global` persists it across sessions and updates running sessions on their next request.
|
|
198
|
+
- **Resume large histories sooner** - `/resume` displays rows before full-text search finishes; measured listing time fell from 6.4 seconds to 1.0 second across 394 sessions totaling 2.7 GB.
|
|
199
|
+
- **Dismiss stale selections naturally** - Typing or pasting now clears fullscreen mouse highlights without consuming input, preventing old selections from repainting over new content.
|
|
200
|
+
|
|
201
|
+
### Improvements
|
|
202
|
+
|
|
203
|
+
- **Expand extension entries directly** - Clicking a custom transcript entry header now expands that entry, matching existing tool-summary behavior.
|
|
204
|
+
- **Keep long sessions responsive** - Idle autocomplete and image-preview frames avoid unnecessary layout work, while prompt-position readings reuse unchanged results.
|
|
205
|
+
|
|
206
|
+
### Fixes
|
|
207
|
+
|
|
208
|
+
- **Cancel rewritten prompts cleanly** - Cancelling an unprocessed prompt now removes related extension entries from the active branch instead of leaving orphan transcript rows.
|
|
209
|
+
|
|
210
|
+
### Upgrade Notes
|
|
211
|
+
|
|
212
|
+
- `/fast` no longer persists globally; it resets when a session starts or resumes. Use `/fast-global` wherever existing workflows depended on the provider’s previous persistent `/fast` behavior.
|
|
213
|
+
|
|
214
|
+
## [0.2.8] - 2026-08-26
|
|
215
|
+
|
|
216
|
+
Prompt navigation arrows now jump between user prompts and scroll to the latest output. Skill reuse consumes less context while keeping instructions available after compaction.
|
|
217
|
+
|
|
218
|
+
### Highlights
|
|
219
|
+
|
|
220
|
+
- **Jump between prompts** - Use the transcript’s corner arrows to move through prompts, see the current prompt position, or return to the end.
|
|
221
|
+
- **Reuse skills without duplicate context** - Repeated skill invocations keep the request but replace identical instruction copies with a short note. Compaction restores needed instructions within bounded context limits.
|
|
222
|
+
|
|
223
|
+
### Fixes
|
|
224
|
+
|
|
225
|
+
- **Collapsed rows remain clickable while scrolling** - Transcript controls now respond to the row currently visible, even when scrolling briefly advances ahead of the painted screen.
|
|
226
|
+
|
|
227
|
+
## [0.2.7] - 2026-08-25
|
|
228
|
+
|
|
229
|
+
Clipboard images now appear as bounded thumbnails in Kitty-compatible terminals, making pasted images easier to review before sending. Loading feedback and text fallbacks keep the editor usable when previews are delayed or unavailable.
|
|
230
|
+
|
|
231
|
+
### Highlights
|
|
232
|
+
|
|
233
|
+
- **Preview pasted images before sending** - Clipboard image markers render as compact thumbnails without repeatedly loading full-size image data.
|
|
234
|
+
|
|
235
|
+
### Improvements
|
|
236
|
+
|
|
237
|
+
- **Edit image markers as single items** - Navigation and deletion now treat each image marker as one highlighted editor token.
|
|
238
|
+
|
|
239
|
+
### Fixes
|
|
240
|
+
|
|
241
|
+
- **Restore previews after focus changes** - Returning to the terminal retransmits thumbnails that may have disappeared while focus was elsewhere.
|
|
242
|
+
|
|
243
|
+
## [0.2.6] - 2026-08-24
|
|
244
|
+
|
|
245
|
+
`/refine` replaces `/backlog` with planning built around selected cards and scoped sources. Collapsed transcripts now identify proxied MCP tools and keep controls accurate while scrolling.
|
|
246
|
+
|
|
247
|
+
### Highlights
|
|
248
|
+
|
|
249
|
+
- **Refine work from relevant context** - Plan from a selected card and limit which sources inform the result.
|
|
250
|
+
- **Identify proxied tool calls** - Collapsed transcript entries show the underlying MCP tool name.
|
|
251
|
+
|
|
252
|
+
### Improvements
|
|
253
|
+
|
|
254
|
+
- **Cleaner transcript controls** - Bold chevrons and scroll-aware mouse targets improve navigation while removing interaction hints and terminal links.
|
|
255
|
+
|
|
256
|
+
### Upgrade Notes
|
|
257
|
+
|
|
258
|
+
- Replace `/backlog` with `/refine` in saved prompts, documentation, and workflows.
|
|
259
|
+
|
|
260
|
+
## [0.2.5] - 2026-08-24
|
|
261
|
+
|
|
262
|
+
Commit commands that break project rules are now blocked before they run, with all problems reported together. Router controls, transcript following, and footer model labels also behave more reliably.
|
|
263
|
+
|
|
264
|
+
### Highlights
|
|
265
|
+
|
|
266
|
+
- **Safer automated commits** - Bash and Quill commit commands must use direct, compliant invocations and valid messages, reducing failed hooks and malformed commit history.
|
|
267
|
+
|
|
268
|
+
### Improvements
|
|
269
|
+
|
|
270
|
+
- **Faster router configuration** - Config pickers open on saved values, wrap between list boundaries, and correctly locate the active judge configuration.
|
|
271
|
+
- **Transcript follows new output** - Submitting a prompt restores output-following mode in the fullscreen transcript.
|
|
272
|
+
|
|
273
|
+
### Fixes
|
|
274
|
+
|
|
275
|
+
- **Model tags remain visible** - Footer labels such as CLIProxyAPI's fast tag no longer disappear when terminal width is limited.
|
|
276
|
+
|
|
277
|
+
## [0.2.4] - 2026-08-23
|
|
278
|
+
|
|
279
|
+
Long transcripts now stay responsive instead of repeatedly rebuilding settled messages and consuming full CPU. Installation is more predictable because proper-base no longer changes Pi settings or runs post-install setup.
|
|
280
|
+
|
|
281
|
+
### Highlights
|
|
282
|
+
|
|
283
|
+
- **Responsive long sessions** - Settled transcript content is reused until relevant state changes, eliminating per-frame rebuilds while preserving updates after resizing, theme changes, and terminal changes.
|
|
284
|
+
|
|
285
|
+
### Improvements
|
|
286
|
+
|
|
287
|
+
- **Side-effect-free installation** - Installing proper-base no longer writes to Pi settings, so existing preferences remain untouched.
|
|
288
|
+
- **Safer optional flow setup** - Setup installs proper-flow and beads-flow only when `bd` is available and checks for `jq` before running the beads-flow installer.
|
|
289
|
+
|
|
290
|
+
## [0.2.3] - 2026-08-22
|
|
291
|
+
|
|
292
|
+
Maintenance release — no user-facing changes.
|
package/README.md
CHANGED
|
@@ -389,7 +389,7 @@ highlight. Custom replacement footers are not changed.
|
|
|
389
389
|
|
|
390
390
|
## Install
|
|
391
391
|
|
|
392
|
-
Node 22.19 or newer is required. The package is tested against Pi 1.
|
|
392
|
+
Node 22.19 or newer is required. The package is tested against Pi 1.5.2.
|
|
393
393
|
|
|
394
394
|
From npm:
|
|
395
395
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "proper-base",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"description": "Baseline Pi behavior for session naming, history, prompt editing, fullscreen navigation, and footer styling",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"index.ts",
|
|
38
38
|
"src",
|
|
39
39
|
"README.md",
|
|
40
|
+
"CHANGELOG.md",
|
|
40
41
|
"UPDATES.md",
|
|
41
42
|
"LICENSE"
|
|
42
43
|
],
|
|
@@ -59,9 +60,6 @@
|
|
|
59
60
|
"@types/node": "25.9.5",
|
|
60
61
|
"typescript": "6.0.2"
|
|
61
62
|
},
|
|
62
|
-
"overrides": {
|
|
63
|
-
"undici@8.10.2": "8.12.3"
|
|
64
|
-
},
|
|
65
63
|
"pi": {
|
|
66
64
|
"extensions": [
|
|
67
65
|
"./index.ts"
|
|
@@ -4,26 +4,37 @@ import {
|
|
|
4
4
|
type ExtensionContext,
|
|
5
5
|
InteractiveMode,
|
|
6
6
|
} from "@earendil-works/pi-coding-agent";
|
|
7
|
+
import { Text } from "@earendil-works/pi-tui";
|
|
7
8
|
import { installWrapper } from "../host-interop.ts";
|
|
8
9
|
import type { UpdateKind } from "./readiness.ts";
|
|
9
10
|
|
|
11
|
+
function restartHint(text: string): string {
|
|
12
|
+
const lines = text.split("\n");
|
|
13
|
+
const instruction = stripVTControlCharacters(lines[1] ?? "").match(
|
|
14
|
+
/^(New version .+ is available\.|Package updates are available\.) Run pi update(?: --extensions)?$/,
|
|
15
|
+
);
|
|
16
|
+
if (!instruction) return text;
|
|
17
|
+
lines[1] = `${instruction[1]} Restart Pi to install detected updates.`;
|
|
18
|
+
return lines.join("\n");
|
|
19
|
+
}
|
|
20
|
+
|
|
10
21
|
function showRestartHint(receiver: object, start: number): void {
|
|
11
22
|
const chat = Reflect.get(receiver, "chatContainer") as
|
|
12
23
|
| { children?: object[] }
|
|
13
24
|
| undefined;
|
|
14
25
|
if (!Array.isArray(chat?.children)) return;
|
|
15
26
|
for (const child of chat.children.slice(start)) {
|
|
16
|
-
if (child
|
|
27
|
+
if (!(child instanceof Text)) continue;
|
|
28
|
+
// Pi's notices are ThemedText: empty until first render and rebuilt from
|
|
29
|
+
// `build` after every theme change, so the hint has to live in `build`.
|
|
30
|
+
const build = Reflect.get(child, "build");
|
|
31
|
+
if (typeof build === "function")
|
|
32
|
+
Reflect.set(child, "build", () =>
|
|
33
|
+
restartHint(Reflect.apply(build, child, [])),
|
|
34
|
+
);
|
|
17
35
|
const text = Reflect.get(child, "text");
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
20
|
-
const lines = text.split("\n");
|
|
21
|
-
const instruction = stripVTControlCharacters(lines[1] ?? "").match(
|
|
22
|
-
/^(New version .+ is available\.|Package updates are available\.) Run pi update(?: --extensions)?$/,
|
|
23
|
-
);
|
|
24
|
-
if (!instruction) continue;
|
|
25
|
-
lines[1] = `${instruction[1]} Restart Pi to install detected updates.`;
|
|
26
|
-
Reflect.apply(setText, child, [lines.join("\n")]);
|
|
36
|
+
const hinted = typeof text === "string" ? restartHint(text) : text;
|
|
37
|
+
if (hinted !== text) child.setText(hinted);
|
|
27
38
|
}
|
|
28
39
|
}
|
|
29
40
|
|
|
@@ -130,7 +130,14 @@ export function summary(items: string[]): string {
|
|
|
130
130
|
// command arguments, registry credentials, or private repository URLs.
|
|
131
131
|
export function updateStatus(line: string): string | undefined {
|
|
132
132
|
const text = stripVTControlCharacters(line).trim();
|
|
133
|
-
|
|
133
|
+
// Pi 1.5.1 replaced "Updated packages" with these summaries; the per-package
|
|
134
|
+
// lines after them stay unrecognized because they can name private sources.
|
|
135
|
+
if (
|
|
136
|
+
/^(?:Updated packages|Updated \d+ packages?:|Packages are already up to date|No packages were updated, see the warnings above|Skipped package updates \(offline mode\))$/.test(
|
|
137
|
+
text,
|
|
138
|
+
)
|
|
139
|
+
)
|
|
140
|
+
return "Checking Pi version…";
|
|
134
141
|
if (text === "Updating user npm packages...")
|
|
135
142
|
return "Updating global packages…";
|
|
136
143
|
if (text === "Updating project npm packages...")
|
|
@@ -30,6 +30,7 @@ type MarkdownHost = Component & {
|
|
|
30
30
|
paddingY: number;
|
|
31
31
|
theme: { codeBlockIndent?: string };
|
|
32
32
|
cachedLines?: string[];
|
|
33
|
+
blocks?: unknown;
|
|
33
34
|
renderToken(token: Token, width: number, ...rest: unknown[]): string[];
|
|
34
35
|
};
|
|
35
36
|
type Layout = {
|
|
@@ -93,6 +94,17 @@ function markdownRows(component: MarkdownHost, width: number) {
|
|
|
93
94
|
component,
|
|
94
95
|
) as MarkdownHost;
|
|
95
96
|
delete clone.cachedLines;
|
|
97
|
+
// Pi 1.5.0 reuses a rendered block whenever its source repeats, across renders and
|
|
98
|
+
// within one (every "\n\n" between paragraphs), skipping renderToken for it. The
|
|
99
|
+
// replay counts rows per renderToken call, so defeat the lookup on the map Pi
|
|
100
|
+
// stores in `blocks` and every token replays.
|
|
101
|
+
Object.defineProperty(clone, "blocks", {
|
|
102
|
+
get: () => undefined,
|
|
103
|
+
set: (ref: { deref?(): Map<string, unknown> | undefined } | undefined) => {
|
|
104
|
+
const blocks = ref?.deref?.();
|
|
105
|
+
if (blocks) blocks.get = () => undefined;
|
|
106
|
+
},
|
|
107
|
+
});
|
|
96
108
|
const renderToken = component.renderToken;
|
|
97
109
|
const rows = new Map<number, Row>();
|
|
98
110
|
let depth = 0;
|
|
@@ -15,6 +15,20 @@ type Controller = { activate(manager: Manager): void; dispose(): void };
|
|
|
15
15
|
const INSTALLED = Symbol.for("pi-proper-base.prompt-display");
|
|
16
16
|
const host = globalThis as typeof globalThis & { [INSTALLED]?: Controller };
|
|
17
17
|
|
|
18
|
+
// Pi 1.5.1 hands out a fresh closure per registered transformer, so only the
|
|
19
|
+
// runner's registration record still identifies the UI this extension owns.
|
|
20
|
+
function owns(session: AgentSession, marker: MarkdownTransformer): boolean {
|
|
21
|
+
const runner = session.extensionRunner;
|
|
22
|
+
const extensions: unknown = runner && Reflect.get(runner, "extensions");
|
|
23
|
+
return (
|
|
24
|
+
Array.isArray(extensions) &&
|
|
25
|
+
extensions.some((extension) => {
|
|
26
|
+
const registered = extension?.markdownTransformer;
|
|
27
|
+
return registered === marker || registered?.transformer === marker;
|
|
28
|
+
})
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
18
32
|
/** Pi 0.86 has neither input correlation nor message identity in Markdown hooks.
|
|
19
33
|
* Keep this adapter removable when those APIs exist. Never emulate expansion.
|
|
20
34
|
* @lat: [[lat.md/proper-base/lifecycle#Prompt history lifecycle#Prompt display]]
|
|
@@ -103,7 +117,6 @@ export function installPromptDisplayHost(
|
|
|
103
117
|
type InteractiveHost = {
|
|
104
118
|
session: AgentSession;
|
|
105
119
|
getUserMessageText(message: Message): string;
|
|
106
|
-
getMarkdownTransformers(): MarkdownTransformer[];
|
|
107
120
|
addMessageToChat(
|
|
108
121
|
message: Message,
|
|
109
122
|
options?: { populateHistory?: boolean },
|
|
@@ -113,7 +126,7 @@ export function installPromptDisplayHost(
|
|
|
113
126
|
const prototype = InteractiveMode.prototype as unknown as InteractiveHost;
|
|
114
127
|
const original = prototype.getUserMessageText;
|
|
115
128
|
const wrapped: typeof original = function (this: InteractiveHost, message) {
|
|
116
|
-
if (!active || !this.
|
|
129
|
+
if (!active || !owns(this.session, marker))
|
|
117
130
|
return original.call(this, message);
|
|
118
131
|
if (manager !== this.session.sessionManager) {
|
|
119
132
|
// Reload rebuilds chat before session_start. Resolve entry identities now.
|
|
@@ -132,11 +145,7 @@ export function installPromptDisplayHost(
|
|
|
132
145
|
message,
|
|
133
146
|
options,
|
|
134
147
|
) {
|
|
135
|
-
if (
|
|
136
|
-
!active ||
|
|
137
|
-
message.role !== "user" ||
|
|
138
|
-
!this.getMarkdownTransformers().includes(marker)
|
|
139
|
-
)
|
|
148
|
+
if (!active || message.role !== "user" || !owns(this.session, marker))
|
|
140
149
|
return addMessage.call(this, message, options);
|
|
141
150
|
const text = this.getUserMessageText(message);
|
|
142
151
|
const { skills, request } = splitSkillText(text);
|