proper-base 0.6.0 → 0.8.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/README.md CHANGED
@@ -3,35 +3,87 @@
3
3
  Baseline [Pi](https://pi.dev) behavior for quieter transcripts, automatic
4
4
  session titles, model-preserving `/clear`, project prompt history, prompt
5
5
  editing, fullscreen navigation, image handling, cancellation, autocomplete,
6
- and footer layout.
6
+ footer layout, context-window and Fast-mode control, commit message checks,
7
+ proactive subagent delegation, and deferred automatic updates.
7
8
 
8
9
  ## User-facing features
9
10
 
10
11
  ### Sessions and transcript
11
12
 
12
- - Completed tools and errors collapse into separate one-line rows after a run
13
- settles. Click one row to expand it, use its `collapse` control to close it,
14
- or use Pi's normal tool-output shortcut, Ctrl+O by default, for all rows.
15
- Settlement resets Pi's global tool-output state to collapsed. Thoughts,
16
- tool-calling text, direct replies, and agent status updates remain fully
17
- visible and in their original order.
13
+ - Completed tools and errors collapse into separate one-line rows once later
14
+ output appears, or when the run settles. In fullscreen mode, click a row to
15
+ expand it and its `collapse` control to close it. Pi's tool-output shortcut,
16
+ Ctrl+O by default, expands or collapses every row, and every row returns to
17
+ collapsed when a run settles. Thoughts, tool-calling text, direct replies,
18
+ and agent status updates remain fully visible and in their original order.
18
19
  - A fresh unnamed session gets a hidden 3 to 7 word title from the first
19
20
  successful assistant response. Existing, resumed, and already-named sessions
20
21
  keep their names.
21
- - `/clear` starts an empty session but restores the exact provider and model
22
- selected in the previous one. No messages, name, or branch state carry over.
23
- - The model you pick in `/model` and the level you pick in `/thinking` become
24
- Pi's startup defaults, so the next session opens on them. Pi otherwise saves
22
+ - `/clear` starts an empty session but preserves the current provider, model,
23
+ thinking level, session Fast setting, and session context window. Global
24
+ Fast and the global context window stay unchanged.
25
+ No messages, name, or branch state carry over.
26
+ - The model you pick with `/model` or Ctrl+P and the level you pick with
27
+ `/thinking`, Shift+Tab, or `/model <model> <level>` become Pi's startup
28
+ defaults, so the next session opens on them. Pi otherwise saves
25
29
  those only when you press Ctrl+S in the picker, and because Pi re-derives the
26
30
  thinking level from the saved default on every model switch, an unsaved level
27
- is otherwise lost mid-session at the next `/model`, Ctrl+P, or `/clear`.
28
- Switching to a model that cannot reach the current level records the level
29
- you actually get. Resuming a session does not redefine the model. Set
30
- `"stickyDefaults": false` in `~/.pi/agent/proper-base.json` to turn this off.
31
+ is otherwise lost mid-session at the next `/model` or Ctrl+P.
32
+ Automatic model-switch clamps do not redefine that choice, and the router's
33
+ `llm-router/auto` placeholder persists neither itself nor its forced `off`.
34
+ Resuming a session does not redefine the model. Set `"stickyDefaults": false`
35
+ in `~/.pi/agent/proper-base.json` to turn this off.
31
36
  - Prompt-template expansions remain model-facing, while the transcript shows
32
37
  the slash command you typed, such as `/implement-ready epic-1 4`.
33
- - CLIProxyAPI `empty_stream` failures become normal retryable network errors, so
34
- Pi applies its existing retry budget and backoff.
38
+ - `/resume` builds its session list from a raw byte scan of each session file
39
+ instead of parsing every message, then loads message text in the background.
40
+ Search matches session names, IDs, and working directories at once, and
41
+ message text as it arrives.
42
+ - CLIProxyAPI `empty_stream` failures and `Selected model is at capacity`
43
+ overload errors become normal retryable network errors, so Pi applies its
44
+ existing retry budget and backoff.
45
+ - `/tokens max` raises an OpenAI model's context window from its 272K default
46
+ to the backend's 922K input cap for this session, through `openai-codex`,
47
+ CLIProxyAPI, or the `openai` API. `/tokens default` returns to
48
+ the default. Append `global` to set it for every session (saved as
49
+ `contextTokens` in `~/.pi/agent/proper-base.json`); a session choice
50
+ overrides the global one. Bare `/tokens` shows the current window. Tab on
51
+ `max` or `default` opens the scope menu, where `global` is one arrow away.
52
+ Auto-compaction then triggers at the new window minus your `reserveTokens`,
53
+ including per-model `compaction.modelOverrides`. Input above 272K bills at
54
+ the long-context rate.
55
+
56
+ ### Fast mode
57
+
58
+ With the CLIProxyAPI provider (`@router-for-me/pi-cliproxyapi-provider`),
59
+ proper-base takes over its `/fast` command and splits the priority-tier Fast
60
+ mode into two scopes:
61
+
62
+ - `/fast` toggles Fast for the current session only. proper-base never saves
63
+ it, so new, resumed, and reloaded sessions start with it off; `/clear` keeps
64
+ it.
65
+ - `/fast-global` toggles Fast for every session by saving the provider's
66
+ `fast` key in `~/.pi/agent/cliproxyapi.json`. Running sessions pick up the
67
+ change on their next request.
68
+
69
+ Fast applies when either scope is on, and only to models the provider's
70
+ catalog marks as Fast-capable. Turning one scope off tells you when the other
71
+ still keeps Fast on, and turning Fast on warns when the current model cannot
72
+ use it. While `CLIPROXYAPI_FAST` is set, `/fast-global` refuses to change the
73
+ saved setting and reports the environment value. The footer shows the `fast`
74
+ tag whenever Fast applies to the current model.
75
+
76
+ ### Automatic updates
77
+
78
+ - Pi's native background checks record available updates. proper-base installs
79
+ them on the next supported launch, with live progress and safe restart.
80
+ - No recorded updates means no additional update checks or inventory at startup.
81
+ - `/settings` → **Automatic updates** persists enable/disable. `--no-auto-update`
82
+ and `PROPER_UPDATER_OFF=1` still override it for a launch.
83
+ - Automatic updating requires npm Pi on Linux/macOS with Node 22.19+; automation
84
+ and unsupported installations are skipped. No separate package is needed.
85
+
86
+ See [update behavior, safety limits, and migration](./UPDATES.md).
35
87
 
36
88
  ### Prompt editing and cancellation
37
89
 
@@ -83,6 +135,10 @@ directory to forget all proper-base history.
83
135
  - Slash-command completion works after whitespace and on later prompt lines.
84
136
  It replaces only the active slash segment and ignores slashes inside paths
85
137
  and URLs.
138
+ - Accepting a slash command completion opens that command's argument menu
139
+ right away, such as the model list after `/model`.
140
+ - Word and line deletes (Alt+Backspace, Ctrl+W, Ctrl+U, Ctrl+K) refresh an
141
+ open menu instead of leaving suggestions for text that no longer exists.
86
142
  - `/model ` results sort by displayed model ID in descending numeric-aware
87
143
  order. Typed terms must all match when strict matches exist.
88
144
  - `/model` takes an optional thinking level after the model name, as in
@@ -108,18 +164,31 @@ Enable Pi's native fullscreen mode with `/settings` or:
108
164
  }
109
165
  ```
110
166
 
111
- proper-base keeps the prompt, queued messages, status, widgets, and footer
112
- pinned while Pi scrolls the transcript above them.
167
+ Pi keeps the prompt, queued messages, status, and footer pinned while the
168
+ transcript scrolls above them. Submitting a prompt scrolls the transcript back
169
+ to the newest output.
113
170
 
114
171
  | Input | Behavior in fullscreen mode |
115
172
  | --- | --- |
116
173
  | Home, End, PageUp, PageDown | Stay assigned to the prompt editor. |
117
174
  | Ctrl+Shift+Home or End | Jump the transcript to its top or bottom. |
118
175
  | Ctrl+Shift+PageUp or PageDown | Scroll the transcript by one page. |
176
+ | Mouse wheel | Scroll three lines per notch instead of Pi's one. |
177
+ | Double-click | Select a complete one-line URL, path, flag, qualified identifier, or quoted value when possible. |
119
178
 
179
+ Set `PROPER_WHEEL_SCROLL_LINES` to a positive integer to change the wheel step,
180
+ for example `1` in a terminal that already sends one report per scrolled line.
120
181
  Wheel and transcript scroll keys keep working while an `ask_user_question`
121
182
  questionnaire or other overlay has focus, so earlier context stays reachable.
122
- | Double-click | Select a complete one-line URL, path, flag, qualified identifier, or quoted value when possible. |
183
+
184
+ Typing or pasting clears a mouse selection, so a stale highlight never sits
185
+ over changing text. The copy shortcut leaves the selection in place, so it can
186
+ still be copied.
187
+
188
+ Copying fullscreen Markdown paragraphs and blockquotes removes display margins,
189
+ quote borders, and screen-width line breaks. Real newlines, paragraph boundaries,
190
+ and code indentation stay intact. Works with copy-on-select and Pi's configured
191
+ copy shortcut. Lists, tables, and unmatched custom output keep native copying.
123
192
 
124
193
  Scrolling away from current output adds a `↓ jump to bottom` row above the
125
194
  prompt. Clicking it returns to the newest output without disabling scrollbar
@@ -136,6 +205,16 @@ to the bottom. While you are scrolled up, a dimmer `position/total` reading sits
136
205
  centred under the arrows and counts the prompts in the session; it disappears
137
206
  once the viewport is following output again.
138
207
 
208
+ A column of colored symbols along the transcript's right edge marks each
209
+ prompt, reply, and tool call in session order, newest at the bottom. `›` marks
210
+ your prompts, `‹` replies, and `×` failures. Tools show `/` for search, `≡`
211
+ for reads, `±` for edits, `+` for writes, `$` for shell commands, `@` for web
212
+ requests, `&` for agents, and `·` for anything else. Click a symbol to scroll
213
+ to that action. The action the viewport sits in shows in inverse video. At
214
+ rest the rail is faint and gives way to transcript text in its column, and
215
+ hovering it brings it to full strength with each action's name. Under a
216
+ terminal multiplexer, where Pi receives no hover events, it stays fully lit.
217
+
139
218
  Pi 0.85.0 moves the prompt cursor to wherever you click in the prompt. If you
140
219
  click the prompt area to focus the terminal or to select text, turn off
141
220
  `Prompt mouse clicks` in `/settings`: clicks on the prompt text then leave the
@@ -148,9 +227,9 @@ as `editorMouse` and `sessionRail`.
148
227
  Ctrl+V and Ctrl+Shift+V both use Pi's image-or-text clipboard action. Readable
149
228
  clipboard image paths appear as short `[image N]` markers. Image-capable
150
229
  terminals render compact previews; text-only terminals show marker source paths.
151
- Oversized sources are converted to pixel-bounded PNG thumbnails with the
152
- package's asynchronous `sharp` dependency instead of transmitting the full image
153
- for a tiny preview. `sharp` ships prebuilt macOS arm64/x64 and Linux binaries, so
230
+ Source metadata and bytes are read asynchronously; oversized sources become
231
+ pixel-bounded PNG thumbnails through `sharp` instead of blocking the editor or
232
+ transmitting the full image for a tiny preview. `sharp` ships prebuilt macOS arm64/x64 and Linux binaries, so
154
233
  no external image command is required. Pi's accent braille loader animates while conversion runs; the
155
234
  marker and path appear only if conversion is unavailable or fails. When terminal
156
235
  focus returns, active Kitty previews are retransmitted so a lost terminal-side
@@ -160,27 +239,145 @@ inverse-highlights the complete marker; Backspace removes the whole highlighted
160
239
  token. On submit, each marker expands back to the original path the agent can
161
240
  read.
162
241
 
163
- Under `TERM_PROGRAM=Scribe`, proper-base enables Kitty capability before Pi's
164
- renderer starts. Other terminals keep Pi's detected capabilities. Images remain
165
- in model context for every tool loop in the turn that introduced them. A later
166
- user message replaces older image blocks only in the outbound context copy, so
167
- saved sessions, exports, resumes, and branches retain the originals.
242
+ Images remain in model context for every tool loop in the turn that introduced
243
+ them. A later user message replaces older image blocks only in the outbound
244
+ context copy, so saved sessions, exports, resumes, and branches retain the
245
+ originals.
246
+
247
+ Under `TERM_PROGRAM=Scribe`, proper-base enables Kitty images and OSC 8
248
+ hyperlinks before Pi's renderer starts, so previews render and Ctrl+click on
249
+ any row of a wrapped link opens the full URL. Other terminals keep Pi's
250
+ detected capabilities. Every row of a wrapped link carries the same OSC 8 id,
251
+ so terminals that group links by id highlight and open it as one link.
252
+
253
+ On Linux, proper-base reads clipboard text through `wl-paste`, `xclip`, or
254
+ `xsel`, the tools Pi already uses to copy, instead of Pi's native clipboard
255
+ addon. That addon leaks two X connections on every read, and a long session
256
+ eventually hits the X server's client limit, after which paste silently stops
257
+ working. Image paste is unchanged, and macOS and Windows keep the addon.
168
258
 
169
259
  ### Skill context
170
260
 
171
- Pi expands `/skill:<name>` into a user message holding the whole `SKILL.md`
172
- body, then treats it like any other message. Invoking the same skill twice
173
- therefore sends two full copies, and compaction summarizes the body away while
174
- the model keeps following instructions it can no longer read.
261
+ Load several skills before one request:
262
+
263
+ ```text
264
+ /skill:security /skill:testing fix the login flow
265
+ ```
266
+
267
+ Only complete `/skill:name` tokens matching Pi's discovered catalog activate
268
+ skills. Matching is exact and case-sensitive; duplicate selections load once.
269
+ The first unknown or malformed token starts the literal request, with all
270
+ remaining text preserved. URLs, paths, queries, fragments, filename suffixes and
271
+ punctuation do not partially match names. Ambiguous, unreadable or malformed
272
+ registered selections reject the whole request. Explicit `/skill-context load`
273
+ and model-tool loads still report unknown names.
274
+
275
+ Use `--` after the command chain when the request itself starts with a literal
276
+ `/skill:` example. Inline, quoted, escaped, and fenced mentions are not commands.
277
+ Pi autocomplete completes partial input to `/skill:name`; submitted `/name`,
278
+ `$name`, `/skill name` and `/ skill:name` are not Pi skill aliases and remain
279
+ untouched. Other registered commands keep their own behavior. Pi's explicit
280
+ expansion opt-out remains respected, including RPC and queued prompts.
281
+
282
+ Each expanded skill appears as a collapsible section in terminal history,
283
+ including skills loaded through `skill_context`. Use Pi's tool-expansion shortcut
284
+ or click an individual section in fullscreen mode to view its instructions.
285
+ The request stays visible; the model still receives the full skill bodies.
286
+
287
+ Each selected skill retains a full snapshot and SHA-256 identity. Unchanged
288
+ instructions appear once in outbound context; repeating a workflow command
289
+ still submits its new request. Explicit reinvocation or refresh loads the current
290
+ file and supersedes older instructions. Compaction restores the selected
291
+ snapshots, never silently rereads changed files, and never replays the original
292
+ request. Normal task progress determines which workflow steps remain to do.
293
+
294
+ Manage the working set without starting a model turn:
295
+
296
+ ```text
297
+ /skill-context
298
+ /skill-context load security testing
299
+ /skill-context remove testing
300
+ /skill-context refresh security
301
+ /skill-context clear
302
+ ```
175
303
 
176
- proper-base keeps each invoked skill present exactly once in the outbound
177
- context. A repeat invocation of an unchanged body keeps its request and shows
178
- the model a one-line already-loaded note instead of a second copy; a body that
179
- changed with its arguments is sent in full. After a compaction, the newest body
180
- of each dropped skill is restored on the first user turn following the summary,
181
- truncated to a character ceiling per skill and in total so the restored text
182
- cannot re-trigger the compaction that just ran. Only the outbound copy changes,
183
- so saved sessions, exports, resumes, and branches retain the originals.
304
+ The list shows selected and removed snapshots, their version hashes, source
305
+ paths, changes on disk, character count, and confirmation threshold. Selections follow the current
306
+ session branch through resume, forks, context edits, and repeated compaction.
307
+ New sessions start empty. There is no guessed task expiry: reference instructions
308
+ apply only where relevant, and removal explicitly ends a selection. Removing a
309
+ skill omits its instruction blocks from future managed requests without deleting
310
+ historical user requests or the saved transcript. Conflicts are reported rather
311
+ than resolved by mention order; loading never grants extra tool permissions.
312
+
313
+ The model can use `skill_context` to list or load the smallest relevant set from
314
+ Pi's catalog. Explicit-only skills require the user's `/skill:` invocation.
315
+ Ordinary file reads remain available but do not automatically pin every skill
316
+ file inspected. Supporting resources load on demand; their files are not
317
+ snapshotted or version-pinned by this feature.
318
+
319
+ Selected instructions above 200,000 characters trigger a confirmation dialog.
320
+ Continue to keep every skill, or cancel to leave new selections unloaded.
321
+ Approval is remembered for the unchanged selection during the session, including
322
+ compaction. Changing the selection or reloading can require another confirmation.
323
+ There is no hard character cap or model-scaled limit; Pi and provider context
324
+ limits still apply. This count includes skill markup and separators, not tokens.
325
+
326
+ Restored selections are checked before reaching the model. Cancelling that check
327
+ stops the run; use `/skill-context remove <name>` or `/skill-context clear` to
328
+ reduce the selection, or retry and confirm. Runs without an interactive or RPC
329
+ confirmation UI stop with an explanation. No skill is silently truncated or
330
+ dropped.
331
+
332
+ **Skill context management** in `/settings` enables or disables the feature.
333
+ The preference is enabled by default and saved as `"skillContext"` in
334
+ `~/.pi/agent/proper-base.json`. `/skill-context on` and `/skill-context off`
335
+ provide a fallback when the native menu adapter is unavailable. Changes apply
336
+ to the next agent run. Disabled mode restores Pi's normal expansion and context
337
+ behavior; it does not erase instructions already delivered. Malformed or
338
+ unreadable configuration disables skill management until repaired.
339
+
340
+ Native menu integration and multi-command expansion use guarded Pi compatibility
341
+ adapters. `/skill-context load` remains available if expansion internals change.
342
+ The rest uses public command, tool, context, and session APIs. No new dependencies
343
+ or external registry are required.
344
+
345
+ ### Commit message guard
346
+
347
+ proper-base checks each `git commit` the agent runs through the `bash` or
348
+ `quill_execute` tool, and blocks the call unless all of these hold:
349
+
350
+ - The command is one direct `git commit` call. Chains (`&&`, `||`, `;`, `|`),
351
+ wrappers such as `sh -c`, `env`, `sudo`, or `timeout`, variable-assignment
352
+ prefixes, and dynamic text (`$(...)`, backticks, `$VAR`) are rejected.
353
+ - The message comes only from literal `-m` or `--message` text. `-F`, `-e`,
354
+ `-c`, `-C`, `-t`, `-s`, `--fixup`, `--squash`, `--trailer`, `--cleanup`,
355
+ `--allow-empty-message`, and `--no-verify` are rejected.
356
+ - The subject and every body line fit in 72 columns, the second line is blank,
357
+ and no line carries a `Co-Authored-By`, `noreply@anthropic`, or
358
+ `Generated with Claude` attribution. A final block of `Key: value` trailers
359
+ may exceed the length limit.
360
+
361
+ A blocked call lists every problem at once, so the agent can fix the whole
362
+ message in one retry. Commands that do not contain both `git` and `commit` skip
363
+ the check, and a commit command the guard cannot parse is blocked. There is no
364
+ setting to turn the guard off.
365
+
366
+ ### Proactive delegation
367
+
368
+ When pi-subagents' `subagent` tool or its `subagents_enable` loader is active,
369
+ proper-base replaces its rule to delegate only when needed with a proactive
370
+ multi-agent mode. The agent hands independent work that is large enough to
371
+ justify a fresh context to subagents without waiting to be asked. It keeps sequential steps, small tasks, and edits
372
+ to the same area in the main session, and writes the final answer itself. Your
373
+ own instructions still take priority.
374
+
375
+ If the session has scoped models (from `--models`, `enabledModels`, or
376
+ `/scoped-models`), the prompt names them as the only models subagents may use
377
+ and asks the agent to pick one per task by difficulty and cost. The
378
+ `llm-router/auto` placeholder is left out. Sessions without either tool keep
379
+ their system prompt unchanged. Set `"proactiveDelegation": false` in
380
+ `~/.pi/agent/proper-base.json` to keep pi-subagents' ask-first policy.
184
381
 
185
382
  ### Footer
186
383
 
@@ -192,7 +389,7 @@ highlight. Custom replacement footers are not changed.
192
389
 
193
390
  ## Install
194
391
 
195
- Node 22.19 or newer is required. The package is tested against Pi 0.85.1.
392
+ Node 22.19 or newer is required. The package is tested against Pi 1.0.1.
196
393
 
197
394
  From npm:
198
395
 
@@ -207,17 +404,45 @@ pi install /path/to/proper-pi-extensions/proper-base
207
404
  ```
208
405
 
209
406
  Pi supplies the core `@earendil-works/pi-coding-agent` and
210
- `@earendil-works/pi-tui` peer packages. The package has no runtime
211
- dependencies, no build step, and no install-time npm scripts, and it does
212
- not modify Pi settings during installation or runtime. `npm install` only
213
- prepares the development checks below.
407
+ `@earendil-works/pi-tui` peer packages. `sharp` is a runtime dependency for
408
+ image previews. Run `npm install` for a local checkout; it also prepares the
409
+ development checks below. There is no build step or install-time npm script.
214
410
 
215
411
  This package replaces the former local `proper-customs` identity. Keep only one
216
412
  registration. Existing data under the legacy `proper-history` path remains
217
413
  compatible.
218
414
 
415
+ ## Configuration
416
+
417
+ proper-base needs no configuration. Optional settings live in
418
+ `~/.pi/agent/proper-base.json`, and a missing or unreadable file keeps every
419
+ default.
420
+
421
+ | Key | Default | Effect |
422
+ | --- | --- | --- |
423
+ | `stickyDefaults` | `true` | `false` stops model and thinking choices from becoming Pi's startup defaults. |
424
+ | `contextTokens` | unset | Global `/tokens` window, `"max"` or `"default"`. `/tokens <mode> global` writes it. |
425
+ | `sessionRail` | `true` | Shows the session action rail. Toggle it with `Session action rail` in `/settings`. |
426
+ | `editorMouse` | `true` | Lets prompt clicks move the cursor. Toggle it with `Prompt mouse clicks` in `/settings`. |
427
+ | `proactiveDelegation` | `true` | `false` keeps pi-subagents' ask-first delegation policy. |
428
+
429
+ The **Automatic updates** entry in `/settings` is stored separately, as
430
+ described in [UPDATES.md](./UPDATES.md#disable).
431
+
432
+ | Environment variable | Effect |
433
+ | --- | --- |
434
+ | `PROPER_WHEEL_SCROLL_LINES` | Lines per mouse-wheel notch in fullscreen mode. Default `3`. |
435
+ | `PROPER_UPDATER_OFF=1` | Skips automatic updates for one launch, like `--no-auto-update`. |
436
+ | `CLIPROXYAPI_FAST` | The provider's Fast override. While it is set, `/fast-global` refuses to write. |
437
+ | `CLIPROXYAPI_PROVIDER_ID` | Provider ID that Fast mode and `/tokens` treat as CLIProxyAPI. Otherwise `providerId` from `cliproxyapi.json`, then `cliproxyapi`. |
438
+ | `TERM_PROGRAM=Scribe` | Set by the Scribe terminal. Enables Kitty image previews and OSC 8 links. |
439
+
219
440
  ## Compatibility
220
441
 
442
+ Restart Pi once when upgrading from releases with permanent host patches.
443
+ Those releases did not retain original methods or bindings for restoration.
444
+ New installations restore owned patches on unload and support reload takeover.
445
+
221
446
  - Fullscreen behavior uses Pi's native `tuiMode: "fullscreen"` renderer.
222
447
  - Questionnaire cancellation activates only when `ask_user_question` is
223
448
  installed.
@@ -226,7 +451,6 @@ compatible.
226
451
  disable individual enhancements; later-loaded replacements still win.
227
452
  - Ctrl+Shift fullscreen keys require a terminal that reports modifiers
228
453
  distinctly.
229
- - proper-base has no extension-specific runtime config file or feature toggles.
230
454
  - Slash commands beginning with `__proper-` are reserved for internal session
231
455
  recovery.
232
456
 
package/UPDATES.md ADDED
@@ -0,0 +1,129 @@
1
+ # Automatic updates
2
+
3
+ Built into proper-base. Records Pi's existing background update checks, then installs available updates
4
+ on the next interactive launch. With nothing recorded, startup does no updater
5
+ checks, inventory, or installation. During installation, shows one live status
6
+ line, a short changed-version summary, and actionable warnings.
7
+ Restarts Pi when installed code changes and the launch can be replayed safely.
8
+ No LLM calls, shell wrapper, or extra runtime dependencies.
9
+
10
+ ## Availability
11
+
12
+ Included with proper-base; no separate extension installation is needed.
13
+ Automatic updating requires Pi 0.86+, Node 22.19+, and an npm-installed Pi under
14
+ `lib/node_modules` on Linux or macOS. Other proper-base features retain their
15
+ existing platform support.
16
+
17
+ If you installed the former standalone proper-updater, remove its registration
18
+ from Pi's package list. Existing `proper-updater.*` preferences, lock files,
19
+ readiness records, environment overrides, and process guards remain compatible;
20
+ no state migration is required.
21
+
22
+ ## Startup behavior
23
+
24
+ - First launch: Pi performs its usual background checks and shows native update
25
+ notices. This extension records positive results only, without extra checks.
26
+ When automatic updates are enabled, the launcher is supported, and readiness
27
+ is saved, notices say: **Restart Pi to install detected updates.** Otherwise
28
+ they retain Pi's manual update commands.
29
+ - Next launch: previously recorded updates trigger Pi's native `update --self`,
30
+ `update --extensions`, or `update --all`. No record means no updater widget,
31
+ inventory subprocess, installer, or restart.
32
+ - Shows the current operation and elapsed seconds: reading installed versions,
33
+ checking packages, updating a package or batch, checking/updating Pi, verifying
34
+ installed versions, and preparing restart. No typing hint or raw installer logs.
35
+ - Runs once per process, not on `/reload`, `/new`, `/resume`, or `/fork`.
36
+ - Pi and global-package notices apply across working directories. Project notices
37
+ apply only when relaunching that same project with trust still granted.
38
+ Global-only notices never authorize project installation. Updates may include
39
+ proper-base itself; the extension never independently grants project trust.
40
+ - Readiness lives under `<agentDir>/proper-updater-ready/` as empty files with
41
+ per-process random identifiers and hashed project paths. Successful verified
42
+ runs clear only the records they handled; failures retain records for retry.
43
+ Notices from the current process are never consumed by that process.
44
+ - Preserves npm version pins and git refs. Pi may reconcile a managed git clone
45
+ to its configured ref. Local paths and directly loaded extension files are
46
+ not pulled or rewritten. Edit local checkouts, not Pi-managed git clones.
47
+ - Compares Pi versions, npm versions, git commits, and npm dependency lock
48
+ fingerprints. No change means no restart and no success notification.
49
+ - Checks installed state even after an update fails, because Pi can update
50
+ packages before self-update fails. A failure is never reported as fully current.
51
+ - Uses one lock per Pi agent directory. A concurrent launch skips updates with
52
+ a warning instead of racing npm/git. After a crash, inspect the PID in
53
+ `proper-updater.lock` and remove that file only when its owner has exited.
54
+ - Update subprocesses time out after 3 minutes. Inventory and restart probes
55
+ have shorter deadlines. Termination includes installer descendants.
56
+
57
+ Availability observation wraps Pi's existing package-check method and Pi-version
58
+ notification methods through its virtual host exports. Native checks remain
59
+ intact. Eligible notices replace only the instruction line, preserving versions,
60
+ package lists, release notes, and changelog links. These are not a public update-event API; incompatible method
61
+ shapes disable automatic updates with a warning. No notification or failed check
62
+ is not proof of being up to date. Native checks skip pinned/missing sources, so
63
+ this extension does not proactively repair those installations without a notice.
64
+
65
+ Native Pi updates download and execute code from sources you already installed.
66
+ Automatic updates are enabled by default in proper-base and can be disabled
67
+ in `/settings` before a subsequent launch installs anything. New
68
+ package versions can change behavior or break compatibility. No rollback is
69
+ provided; offline, failed, pinned, or skipped updates cannot guarantee latest.
70
+
71
+ ## Restart safety
72
+
73
+ On a safe launch, Pi shuts down normally first: terminal restoration and all
74
+ extension cleanup handlers finish before Node replaces the process. PID,
75
+ working directory, Node arguments, Pi options, environment, and the selected
76
+ persisted session are preserved. A PID-scoped one-shot marker prevents an
77
+ update/restart loop and is removed before descendants inherit it.
78
+
79
+ Pi has no public restart API. This implementation relies on Pi 0.86's graceful
80
+ quit ending in `process.exit(0)` and Node's experimental `process.execve`.
81
+ The restart executable is checked against the installed version before quitting.
82
+
83
+ Automatic restart is deferred, with a warning, when:
84
+
85
+ - You type during updates, have an editor draft, or have active/queued work.
86
+ - The launch includes a prompt, `@file`, `--resume`, `--fork`, `--session-id`,
87
+ unknown extension flags, or invalid arguments.
88
+ - A selected session cannot be verified on disk, or the updated executable
89
+ fails its version probe.
90
+
91
+ Previously recorded updates still install for those interactive launches. Restart manually to activate
92
+ them. Signals cancel update work and suppress any pending automatic restart.
93
+
94
+ RPC, print/JSON, SDK hosts, non-TTY invocations, Windows, Bun, pnpm paths,
95
+ installer-managed releases, and unrecognized launchers do not auto-update.
96
+ This avoids corrupting protocols, replaying piped input, or restarting an old
97
+ immutable executable. Use `pi update --all` between runs for these environments.
98
+
99
+ ## Disable
100
+
101
+ Open `/settings` and set **Automatic updates** to **false**. The choice persists
102
+ across launches as an empty `<agentDir>/proper-updater.disabled` marker. Set it
103
+ back to **true** to re-enable. An unreadable preference disables installation
104
+ with a warning; failed writes leave the previous setting unchanged.
105
+
106
+ Disabling also stops recording new availability in this session, but does not
107
+ interrupt an installer already running. Existing readiness records are retained.
108
+ Re-enabling does not install immediately; the next launch can consume those
109
+ records. When disabled, Pi's own checks and manual update notices remain intact.
110
+
111
+ For a single launch, these overrides still take precedence over the setting:
112
+
113
+ ```bash
114
+ pi --no-auto-update
115
+ PROPER_UPDATER_OFF=1 pi
116
+ pi --offline
117
+ ```
118
+
119
+ `PI_OFFLINE` is also respected. The `/settings` entry uses a guarded native-menu
120
+ adapter and coexists with proper-base's settings; flags remain available if a
121
+ future Pi version changes that menu. Update output is captured, not dumped into chat or model context;
122
+ run `pi update --all` yourself to see detailed failure output.
123
+
124
+ ## Development
125
+
126
+ Updater code lives in `src/auto-update/`; its tests run with the rest of
127
+ proper-base's suite. Tests use temporary settings and fake subprocesses. They never update your Pi
128
+ installation or installed extensions. A subprocess test verifies native process
129
+ replacement; real registry updates and terminal rendering remain manual checks.