pi-pocket 0.28.0 → 0.28.2-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/docs/customizing.md +1 -1
  2. package/docs/features.md +3 -3
  3. package/docs/map.md +1 -1
  4. package/npm-shrinkwrap.json +69 -65
  5. package/package.json +8 -8
  6. package/src/server/alerts.ts +21 -8
  7. package/src/server/anthropic-shape.ts +4 -3
  8. package/src/server/app.ts +18 -3
  9. package/src/server/artifact-state.ts +1 -1
  10. package/src/server/background.ts +1 -1
  11. package/src/server/cache-keeper.ts +1 -0
  12. package/src/server/commands.ts +386 -77
  13. package/src/server/compaction.ts +56 -2
  14. package/src/server/design/bundle.ts +1 -1
  15. package/src/server/docs.ts +43 -1
  16. package/src/server/extension-points.ts +1 -1
  17. package/src/server/extension-request.ts +1 -1
  18. package/src/server/extensions/codemode.ts +1 -1
  19. package/src/server/extensions/schedules.ts +1 -1
  20. package/src/server/extensions/subagents.ts +1 -1
  21. package/src/server/goals.ts +1 -1
  22. package/src/server/hidden.ts +1 -1
  23. package/src/server/host.ts +1 -1
  24. package/src/server/http/conversation-routes.ts +22 -0
  25. package/src/server/linked-sessions.ts +1 -1
  26. package/src/server/memory.ts +1 -1
  27. package/src/server/pip-compact.ts +1 -1
  28. package/src/server/pip.ts +9 -1
  29. package/src/server/public-links.ts +1 -1
  30. package/src/server/repo-watches.ts +1 -1
  31. package/src/server/resend.ts +26 -9
  32. package/src/server/room.ts +17 -1
  33. package/src/server/running.ts +3 -0
  34. package/src/server/schedules.ts +112 -12
  35. package/src/server/shell.ts +1 -1
  36. package/src/server/spend.ts +1 -1
  37. package/src/server/watches.ts +1 -1
  38. package/types/pocket.d.ts +1 -1
  39. package/web/composer.js +101 -3
  40. package/web/running-board.js +1 -0
  41. package/web/sheets/schedules.js +6 -0
  42. package/web/store.js +7 -0
  43. package/web/style.css +37 -0
  44. package/web/transcript.js +15 -0
@@ -97,7 +97,7 @@ Pi Pocket compacts a session's context with Pi's settings in `~/.pi/agent/settin
97
97
  }
98
98
  ```
99
99
 
100
- Other models keep the general values. An entry that Pi refuses (not a whole number, or a name with no provider) is left out, and the server log says so. PiP uses its model's values too. An edit of `settings.json` counts once Pi Pocket reads Pi's settings again: soon after the next message, or at once with Menu → **Refresh models**. See Pi's `settings.md` for each setting.
100
+ Other models keep the general values. With no `compaction.reserveTokens` in Pi's settings, Pi Pocket gives each model its own reserve instead of Pi Durable's 16,384: room for the whole summary the model can write, up to 32,768 tokens and a quarter of its context window (since 0.28.1). Pi Durable writes a summary in at most 80% of the reserve, thinking included, so the old 13,107 tokens cut off the cumulative summary of a long session, and from then on every run failed. A model with a 200,000-token window and 32,768 output tokens now compacts from about 167,000 tokens (before, about 184,000). A `reserveTokens` of your own, general or in a model's override, wins. An entry that Pi refuses (not a whole number, or a name with no provider) is left out, and the server log says so. PiP uses its model's values too. An edit of `settings.json` counts once Pi Pocket reads Pi's settings again: soon after the next message, or at once with Menu → **Refresh models**. See Pi's `settings.md` for each setting.
101
101
 
102
102
  ## Project model defaults for new sessions
103
103
 
package/docs/features.md CHANGED
@@ -13,7 +13,7 @@ The full tour. For setup, see the [README](../README.md).
13
13
  - **Launcher.** Ctrl/⌘+K (on a touch screen, the **Launcher** tile among the places, or the ⌘ button in the session search) opens a rounded search window for sessions, actions, and themes, with fuzzy matching. Search-type pills sit above grouped results with folder-color tiles, action icons, or four-color theme swatches; the selected row has a soft fill. **All**, **Sessions**, **Actions**, and **Themes** select the search type without clearing your words; `>`, `@`, and `#` still work. All starts with six recent sessions; **Show all** searches the whole session list, including archived sessions. Result counts show when a list is capped. Titles and folder or command details highlight matches, and sessions show their current, working, waiting, or archived state in a pill on the right. Arrowing onto colors shows them at once; Enter keeps them, Escape goes back. A theme that changes the look shows once chosen. Arrows, Tab/Shift+Tab, and PageUp/PageDown move the selection; Enter opens it. **Close**, Escape, a tap outside, or Back closes the launcher. Each opening starts with a fresh search and a focused input, even when it reopens during its fade-out. On a phone it is a sheet from the bottom edge, like the app's other sheets: drag it down to close it. On a touch screen it opens without the keyboard, so the results stay in sight; a tap on its search brings the keyboard up.
14
14
  - **The menu.** The top bar's **⋯** opens a 360px popover below it on wide screens, and a bottom sheet on phones. Three columns of rounded place tiles open Files, Changes, Browser, Artifacts, Chat, Find, Launcher (on touch screens), Branch, PiP, and Peeks when available; badges show counts or news, and open places are tinted. Session actions, Subagents, and App rows have right-aligned hints and separate groups. App includes **Keyboard shortcuts** (`?`). Arrows, Home/End, and Tab move through the controls; Esc, Back, Close, or a tap outside closes the menu. Back from a sheet it opened returns to the menu.
15
15
  - **Keyboard.** Alt+1…9 jumps to a session (hold Alt to see the numbers), Alt+↑/↓ goes to the previous or next one, Alt+N starts a new one (where Ctrl/⌘+1…9 starts it in a favorite folder), Alt+B opens or closes the browser, Alt+E the Files tile, Alt+T turns Show thinking on or off, Alt+V starts or stops dictation, and `?` lists every shortcut. On a computer, a session opens with the caret in its message box, ready to type; on a touch screen it waits for a tap, so the keyboard does not cover the conversation, and on a Mac a session opened with Alt+1…9 or Alt+↑/↓ leaves the box alone, so the next Alt shortcut still works (Option types characters in a box).
16
- - **The conversation.** A column of turns, made for phones. Your messages are cards with the sender's avatar (the accent for yours, the sender's color for someone else's), who sent each and when; Pi's replies are plain prose at Appearance's text size, streamed as they come (lists keep a quiet marker column; code, tables, and rich blocks are rounded cards). The **Message time** item under completed replies shows the time, with the date for earlier days, and can be hidden or moved in Appearance → Layout. What Pi does between its words, its thinking and tool calls, folds into one line that says what it did and for how long ("Thought, searched, read 2 files, ran 1 command · 18s"), and opens, as a card, into a timeline: a line per call with a circle for how it went (✓ done, × failed or denied, ! waiting for an approval, a spinner while it runs, ⑂ for a subagent, ✦ for a thought) and what it came to (lines added and removed, lines read, matches, tests passed, an exit code, "needs approval"), and tapped, its input and output, with the diff viewer's diffs for edits (line numbers, syntax colors, and the words that changed) and bash's live output. The newest turn's groups are open and earlier ones closed, unless Appearance's **Keep activity folded** (off by default) keeps them on their line until you open one; a thought alone still follows Show thinking. An approval is a card at the end of its turn (the command, the reason, Deny and Allow; once answered, the call's line says who allowed or denied it), and while Pi works one line, a pulsing dot with the state in the accent (the warning color while it waits for an approval), says what it does (thinking, working, waiting for an approval, retrying) and for how long. With **Show thinking** on in Appearance (or Alt+T, or the launcher), the current thought shows above that line as it streams, and the thoughts in the conversation show their words once written (a thought alone in its group opens, and one on a timeline opens its step). A chevron before the line's dot folds the live thought away, and again brings it back. Alt+T shows a short on/off notice, even while Pi is idle. During tool calls the latest thought stays; a new response clears it until the model shares new thinking. Models that share none say so, rather than showing an old thought as current. A fold holds in that session, also over a reload, until you open it again; the setting is off until you turn it on, in each browser, and while it is off or folded the live thought is neither selected nor drawn. The reading area follows new words until you scroll up in it, and follows again for each new thought. While Pi works, **Steer**, **Queue**, or **Interrupt** beside the model chip says whether a message steers the run, waits for it to end, or stops the run at once (the tool call too, as Stop does, which also withdraws what waits in the queue) and is sent after; Interrupt goes back to Steer after one use, or when Pi stops before it was used, while Steer and Queue stay as chosen; Ctrl/⌘+Enter sends a message the other way while Pi works (queued when Steer is chosen, steering when Queue is) and leaves the choice as it was, and on Interrupt or with nothing running it sends as Enter does (since 0.28.0); queued messages can be withdrawn, and your own, tapped open, can go back into the message box to change (**Edit**: its words above what you were typing, on a line of their own, with its files), move to Queue or Steer until Pi reads it, or go now as an Interrupt (a second tap confirms; `CONFIRM_INTERRUPT` in `web/composer.js` turns that off), with these buttons in a quiet row at its right (since 0.28.0): that stops the run and sends only that message, while every other queued message, from everyone, stays queued in its order with its sender and mode (a restart in between loses or repeats none), and so do subagents' reports; with take turns on, moving one to Steer or Interrupt waits for your turn at the wheel, as sending does; Stop (or Esc twice) stops the run. A run stopped in the middle of a tool call ends with a "Stopped." line under its card. A session you go back to shows at once where you were in it, as this browser tab kept it, and what came while you were away rises in: at the bottom the conversation glides up to it, and scrolled up the row you read stays where it is. With Appearance's **Wait for updates** (off by default), a session that changed while you were away shows only once its updates have come (or after 2.5 seconds). Scrolled up, a round button above the end of the message box goes back down to the newest message.
16
+ - **The conversation.** A column of turns, made for phones. Your messages are cards with the sender's avatar (the accent for yours, the sender's color for someone else's), who sent each and when; Pi's replies are plain prose at Appearance's text size, streamed as they come (lists keep a quiet marker column; code, tables, and rich blocks are rounded cards). The **Message time** item under completed replies shows the time, with the date for earlier days, and can be hidden or moved in Appearance → Layout. What Pi does between its words, its thinking and tool calls, folds into one line that says what it did and for how long ("Thought, searched, read 2 files, ran 1 command · 18s"), and opens, as a card, into a timeline: a line per call with a circle for how it went (✓ done, × failed or denied, ! waiting for an approval, a spinner while it runs, ⑂ for a subagent, ✦ for a thought) and what it came to (lines added and removed, lines read, matches, tests passed, an exit code, "needs approval"), and tapped, its input and output, with the diff viewer's diffs for edits (line numbers, syntax colors, and the words that changed) and bash's live output. The newest turn's groups are open and earlier ones closed, unless Appearance's **Keep activity folded** (off by default) keeps them on their line until you open one; a thought alone still follows Show thinking. An approval is a card at the end of its turn (the command, the reason, Deny and Allow; once answered, the call's line says who allowed or denied it), and while Pi works one line, a pulsing dot with the state in the accent (the warning color while it waits for an approval), says what it does (thinking, working, waiting for an approval, retrying) and for how long. With **Show thinking** on in Appearance (or Alt+T, or the launcher), the current thought shows above that line as it streams, and the thoughts in the conversation show their words once written (a thought alone in its group opens, and one on a timeline opens its step). A chevron before the line's dot folds the live thought away, and again brings it back. Alt+T shows a short on/off notice, even while Pi is idle. During tool calls the latest thought stays; a new response clears it until the model shares new thinking. Models that share none say so, rather than showing an old thought as current. A fold holds in that session, also over a reload, until you open it again; the setting is off until you turn it on, in each browser, and while it is off or folded the live thought is neither selected nor drawn. The reading area follows new words until you scroll up in it, and follows again for each new thought. While Pi works, **Steer**, **Queue**, or **Interrupt** beside the model chip says whether a message steers the run, waits for it to end, or stops the run at once (the tool call too) and is sent first, while the queued messages stay in order with their senders and modes; **Stop** stops the run and holds the queued messages (since 0.28.1): a bar above the message box says how many, **Send** sends them in their order as the people who wrote them, and **Show** lists them, each with **Edit** for its sender and a × to withdraw it (anyone their own, the driver anyone’s), while subagents’ reports, and PiP’s queue, are still withdrawn; Interrupt goes back to Steer after one use, or when Pi stops before it was used, while Steer and Queue stay as chosen; Ctrl/⌘+Enter sends a message the other way while Pi works (queued when Steer is chosen, steering when Queue is) and leaves the choice as it was, and on Interrupt or with nothing running it sends as Enter does (since 0.28.0); queued messages can be withdrawn, and your own, tapped open, can go back into the message box to change (**Edit**: its words above what you were typing, on a line of their own, with its files), move to Queue or Steer until Pi reads it, or go now as an Interrupt (a second tap confirms; `CONFIRM_INTERRUPT` in `web/composer.js` turns that off), with these buttons in a quiet row at its right (since 0.28.0): that stops the run and sends only that message, while every other queued message, from everyone, stays queued in its order with its sender and mode (a restart in between loses or repeats none), and so do subagents' reports; with take turns on, moving one to Steer or Interrupt waits for your turn at the wheel, as sending does; Stop (or Esc twice) stops the run. A run stopped in the middle of a tool call ends with a "Stopped." line under its card. A session you go back to shows at once where you were in it, as this browser tab kept it, and what came while you were away rises in: at the bottom the conversation glides up to it, and scrolled up the row you read stays where it is. With Appearance's **Wait for updates** (off by default), a session that changed while you were away shows only once its updates have come (or after 2.5 seconds). Scrolled up, a round button above the end of the message box goes back down to the newest message.
17
17
  - **Getting around on a phone, with one hand.** Back (the swipe, Android's back button, the browser's) goes back to where you were: it closes what opened last (a sheet, the menu's next sheet back to the menu, a file back to the Files tree, back to Changes when the file was opened from there, the Files tile or the Browser panel, the drawer) before it leaves the session, and leaving goes to the session before or to the list, scrolled and searched as you left it. A session opened straight away (a link, a notification) has the list under it, so back does not leave the app. What you use most is a thumb's reach from the bottom edge: the button beside the message box (or a swipe up from it) opens the places, a short sheet of big tiles (Files, Changes, Browser, Artifacts, Chat, Find, Branch, Peeks) with the session menu below them. On the conversation, swipe left for Files and right to go back; in Files, swipe right to go back. Each swipe shows a mark that lights when letting go will act. The top bar leads back to the list (counting other sessions that wait for an approval) and keeps only the buttons with something to say. Every control is a thumb's size on a touch screen (small ones, such as a code block's Copy or a reply's Pin, keep their look and take a wider tap); a tap anywhere on the message box, off its one line of text, still goes to the text; a quick second tap does not land on whatever just slid in under it; tables in replies scroll sideways instead of crushing their columns; a diff's header keeps the file's name on a line of its own on a phone; and the command a peek tile asks about opens its session when tapped. The Files tile and the browser slide in as screens of their own and slide away on back, a file slides in over the tree, and the browser's tools sit on their own row under the address. Drag a sheet down, or the drawer left, to close it. In an iPhone home screen app, which has no back gesture of its own, swipe in from the left edge to go back.
18
18
  - **Reply to a passage.** Select words in one of Pi's replies, on a phone or a desktop, and a **Reply** button appears by the selection (below it on a touch screen, where the system's menu sits above). It puts the passage in a quote strip above the message box (tap × to drop it); the next message goes to Pi with the passage first as a Markdown quote (up to 1,500 characters), and shows in the conversation as a quote block above your words. With PiP on, PiP's orb (**Ask PiP**) sits beside **Reply** in the same pill: it opens PiP with the passage in a quote strip over its box, ready to type (as a board, Appearance → PiP → Board, the quote strip of the board's message box); your message goes with the passage quoted first, and shows with it as a quote block. PiP also gets, unseen by people, which session the passage came from (its number, title, and folder: `about` on the submit request, a `<pocket-context>` part after the message that no view or resend shows), so it can read that session for more. In Appearance, **Reply to a passage** and **Ask PiP about a passage** (both on by default) each turn their own button off in that browser; with both off, nothing shows.
19
19
  - **Forks.** Tap Pi's reply → More → **Fork from here**: a new session with everything up to that reply, which then goes its own way. Tap one of your messages to **edit it and send it again**, or send any message again, to the same model or another one (a retry). Each makes a new session that forks just before the message; the original stays as it is. A fork gets its own chat (with the pins of what it inherited), a link back to where it came from, and optionally a git worktree of its own.
@@ -22,7 +22,7 @@ The full tour. For setup, see the [README](../README.md).
22
22
  - **Memory.** Short lessons Pi keeps across sessions: how to build and test a project, a gotcha it hit, a convention, a preference someone stated. Pi proposes one with its `memory` tool (one or two sentences each, never secrets) only when a person asks for it, or when Pi is sure that it will help in many later sessions, never for a one-off detail, and proposes fixing or forgetting one that turns out wrong; the owner approves. What Pi reads (a web page, a post, a comment, a file) could talk it into a "lesson" that would reach every later session, so nothing Pi saves, changes, or forgets counts until the owner says: **Approve** and **Discard** show right under Pi's memory call, with the words that wait and where they would apply (this project, or everywhere: every session and PiP), and in the sheet. Approve approves only what you saw: if Pi changed it since, the app says so and shows the new words. Lessons and project names are kept on one line, without invisible characters, so Pi reads only what the owner saw. A change or forgetting Pi proposes leaves the lesson as it was until then. Lessons you add yourself count at once. Each is for this project or for everywhere: a project's lessons reach every later session in the same repository, its worktrees included (or the same folder, outside a repository), and everywhere's reach every session and PiP. Menu → **Memory** (its hint says how many apply here and everywhere) lists them in those two groups, each with who saved it and a link to the session it came from (when you may see it), with Edit and Forget; type one in to add it by hand, for this project or everywhere, or use `/remember run the tests with make check` or **Remember…** on a message. A guest's lessons wait for the owner too, and a guest's change to one in force is a proposal they can withdraw. What waits shows at the top of the owner's sheet; the menu's hint says how many. Lessons waiting take no room from the approved ones, and a person (or Pi for them) may have 20 waiting at most. Only the owner, or whoever saved a lesson, changes or forgets it; viewers only read. A project keeps 40 lessons and everywhere 30; past that, forget one first. Changes show as lines in the chat. Turn it off in Extensions.
23
23
  - **A lean prompt.** A new session gets only the tools most conversations use. `browser`, `subagent`, `background`, `schedule`, `watch_pr`, `ask_someone`, and the design tools wait, and so do their prompt sections; the prompt lists them with a line each, and Pi loads one with `tool_search` when a task needs it. On a model whose provider takes tool changes in the messages (Claude 4.8 and 5, and later), the tool joins the list and stays for the conversation; on any other, Pi calls it from a `codemode` script, so the tool list and the prompt cache never change. Long guides, such as the design guide and the page-to-app messages of artifacts, are files that Pi reads when it needs them. Turn the **Tool search** module off in Menu → Extensions to offer every tool every time. A test keeps Pi Pocket's own part of a plain session's prompt under 14,000 characters (about 5,000 tokens: schemas and this prose run at about 2.75 characters a token), so it does not grow by accident.
24
24
  - **Plan mode.** The **Plan** chip by the message box (or `/plan`): Pi reads files, runs read-only commands, and uses tools their extensions mark read-only, then proposes a plan; writing, editing, and other commands are blocked. Subagents inherit plan mode and explore under the same restrictions. **Approve plan** turns plan mode off and tells Pi to go ahead; it waits until Pi has answered since plan mode went on.
25
- - **Scheduled messages.** `/schedule in 2h check the deploy`, `/schedule tomorrow 9am …`, or `/schedule every weekday 8:00 summarize CI`, or Menu → **Scheduled messages**: Pi gets the message at its time, in this device's time zone, even with nobody watching, and the people in the session get the usual "Pi finished" notification. Pi can schedule its own follow-ups with its `schedule` tool. Each schedule is a durable task: a restart while it waits keeps waiting, one after its time sends at once, and none is ever sent twice. A schedule is cancelled, with a line in the chat saying why, once its person can no longer steer the session or a spend limit is reached. Limits (settable since 0.24.0): a session holds 50 schedules, a message 4000 characters, a repeat comes at most every 10 minutes (a short repeat can cost money in model calls), and `in …` reaches 366 days ahead. The owner changes each in Menu → Extensions, under Scheduled messages; a change applies at once, to new schedules only. Archiving a session that has repeating schedules says how many keep running there, with a tap to see them, and its Schedules sheet marks it as archived; nothing stops or moves (since 0.28.0).
25
+ - **Scheduled messages.** `/schedule in 2h check the deploy`, `/schedule tomorrow 9am …`, or `/schedule every weekday 8:00 summarize CI`, or Menu → **Scheduled messages**: Pi gets the message at its time, in this device's time zone, even with nobody watching, and the people in the session get the usual "Pi finished" notification. Pi can schedule its own follow-ups with its `schedule` tool. Each schedule is a durable task: a restart while it waits keeps waiting, one after its time sends at once, and none is ever sent twice. A schedule is cancelled, with a line in the chat saying why, once its person can no longer steer the session or a spend limit is reached. A repeat whose last message still waits in the session's queue (Pi is at work, or a run failed and holds it) sends no other at its next time: the time is skipped, a line in the chat counts the skips, and the Schedules sheet, the Running now board, and Pi's `schedule` tool list show how many there were (since 0.28.1). Limits (settable since 0.24.0): a session holds 50 schedules, a message 4000 characters, a repeat comes at most every 10 minutes (a short repeat can cost money in model calls), and `in …` reaches 366 days ahead. The owner changes each in Menu → Extensions, under Scheduled messages; a change applies at once, to new schedules only. Archiving a session that has repeating schedules says how many keep running there, with a tap to see them, and its Schedules sheet marks it as archived; nothing stops or moves (since 0.28.0).
26
26
  - **Done when.** `/until npm test`: after each of Pi's answers, the check runs in the session's folder; while it fails, Pi gets the end of its output and keeps going, for five checks at most. A bar above the message box shows how it stands. With Lancet Guard on, the check must be a command the guard allows outright. In plan mode the check waits until the plan is approved, and past a spend limit Pi stops going on. A check cut off by a server restart is not run again, as it may have done part of its work: Pi hears so, and its next answer is checked.
27
27
  - **Mention files.** Type `@` in the message box to pick a file or folder from the session's folder: `@` alone lists its top, `@src/` a folder's own files, and anything else matches across the whole folder (`@srvapp` finds `src/server/app.ts`). Tab or Enter (or a tap) puts the path in, and a folder opens to its files. Pi gets the message as written, `@src/server/app.ts` and all, and reads what it names; or tap **Send them along** above the box to send the files' contents with the message, as Claude Code does (text files up to 100 KB each, images as images when the model takes them). The list is git's in a repository (so ignored files stay out), and a walk that skips hidden and dependency folders elsewhere; your browser fetches it once and matches as you type, so suggestions never wait on the network.
28
28
  - **Shell commands.** `!git status` runs in the session's folder, and Pi sees the command and what it printed with your next message, as in Pi's terminal app; `!!git status` shows it only to the people here. While it runs, a row says so, with Stop (it is in Running now too). A restart while it runs does not run it again: its entry says it was cut off. With Lancet Guard on, a command from anyone but the owner must be one the guard allows outright. A command Pi sees counts as its person's message: Pi works for them from there, as for a steer. These are a person's own commands, not Pi's: plan mode does not hold them back. Stop one from its row, or from Running now on any device.
@@ -63,7 +63,7 @@ The full tour. For setup, see the [README](../README.md).
63
63
  - Under Pi's answers: emoji reactions, **Discuss**, and **Pin**. Queued messages show who queued them. Approved or denied tool calls show who decided.
64
64
  - **Take turns.** Menu → **Take turns**: one person drives and only they send to Pi or change its settings. Others tap **Ask to drive**, the driver hands over, and anyone can take the wheel when the driver has left (the owner always can). Anyone who can steer can still stop a run.
65
65
  - **Roles and invites.** An invite can let someone **steer** or make them **view only** (they read, react, and chat, but cannot send to Pi, approve, or upload). It can cover **every session** or **only this session**, and lasts 15 minutes, an hour, a day, or a week (**Expires after**); either way it works once, and a restart keeps it. Changing what the sheet's invite grants, or how long it lasts, ends the one it showed; **New invite** makes another and leaves the one before working. Only the owner can make an owner invite (**Sign in as me (owner)**): it makes no one new, but signs the device in with the owner's token, so it has full control, works once, and always expires in 15 minutes; rotating the owner token (`--rotate-token`) signs out every device signed in that way, and ends owner invites not yet used. Menu → **People** lists everyone, who is online, and when the others were last here. The owner can change what each person may do or remove them. The session list shows who is in each session, and a dot marks new chat messages.
66
- - **Notifications.** Menu → **Notifications** turns on push notifications for a device: Pi finished, Pi needs approval, someone @mentioned you, or a chat message in a session you take part in. You only get them while you are not looking at that session. An approval can be denied from the notification, and allowed there when the whole call fits on one short line. The home-screen icon counts the sessions that need you. They need an https address: the Cloudflare Tunnel or Tailscale Serve, or another tunnel such as ngrok in front of **This device only** (`--access local`). On iPhone, add Pi Pocket to the home screen first. The server signs pushes with its own keys in `~/.pi-pocket/push.json`. In a host around Pi Pocket (an app such as Pi Pocket GUI), they come as the app's own notifications, with no https address needed, while the app runs ([docs/embedders.md](embedders.md)).
66
+ - **Notifications.** Menu → **Notifications** turns on push notifications for a device: Pi finished (or Pi stopped with an error, with why: a run that failed with no answer of its own, as when its context could not be compacted, says so too, and the open session keeps a "Run failed" line until the next run starts; since 0.28.1), Pi needs approval, someone @mentioned you, or a chat message in a session you take part in. You only get them while you are not looking at that session. An approval can be denied from the notification, and allowed there when the whole call fits on one short line. The home-screen icon counts the sessions that need you. They need an https address: the Cloudflare Tunnel or Tailscale Serve, or another tunnel such as ngrok in front of **This device only** (`--access local`). On iPhone, add Pi Pocket to the home screen first. The server signs pushes with its own keys in `~/.pi-pocket/push.json`. In a host around Pi Pocket (an app such as Pi Pocket GUI), they come as the app's own notifications, with no https address needed, while the app runs ([docs/embedders.md](embedders.md)).
67
67
  - **Built-in browser.** Menu → **Browser** (or Alt+B, `/browser localhost:5173`, or the globe in the top bar while a page is open; on a phone, a dot on the places button by the message box says so) opens a real Chromium page that runs on the server: beside the conversation on wide screens, full screen on phones. Type an address (`localhost:5173`, `example.com`), or (the owner) tap a row under **Running on this machine** on the start screen; a green dot in the rounded address field marks an open page. Tap, drag to scroll, and type into the page (the keyboard button sends text from a phone). The size button switches between fitting the panel (the page follows the panel when it changes size), desktop, phone, and tablet sizes, and the console button shows the page's logs and errors, with a warning-colored error count. Pi's `browser` tool uses the same page: it opens addresses (dev servers, HTML files on the machine, any site), reads a snapshot of the page's text and controls, clicks, types, takes screenshots it can see, reads the console, and runs JavaScript in the page, while everyone in the session watches. Each session has one page, in a browser context of its own; links that open a new tab open there instead, and dialogs are accepted. Anyone in the session can watch; using the page takes steering rights (and the wheel, while take turns is on), the addresses people open show in the chat, and only the owner opens files from the address bar. The browser reaches what the server reaches, `localhost` and its network included, and Lancet Guard does not check it (see SECURITY.md). A restart closes the pages, and each opens again at its last address and size. Where the panel covers the conversation, Esc closes it, unless the page has the keys (then Alt+B does). In plan mode Pi may look at pages but not click, type, or run scripts in them. It needs Chromium, Chrome, Brave, or Edge on the server (or `PI_POCKET_BROWSER`); the owner can turn it off in Extensions, which closes the panel too.
68
68
  - **Artifacts.** The `artifact` tool publishes versioned HTML pages, Markdown documents (shown in the app's theme), or SVG images. Give it `content`, `edits` against the latest version, or a `path` to a UTF-8 text file on the server (up to 2 MB). A path can be absolute, start with `~/`, or be relative to the session's folder. The file is copied into a durable version, not linked: changing or deleting the source does not change the artifact. For a new artifact, `.html`, `.md`/`.markdown`, and `.svg` infer its type; a path update keeps the existing id's type. A page can carry a bundle of files (since 0.26.0). `assets` adds up to 200 entries, each `{ name, path }` (a file on the server, binary allowed, copied and not linked) or `{ name, content }` (UTF-8 text): images, fonts, stylesheets, scripts, data files, or more HTML pages. A name is a relative path of letters, digits, dots, underscores, and hyphens, up to 200 characters, with no `.` or `..` segment. A new version keeps the assets of the one before it; an entry with the same name replaces one, and `removeAssets` drops some. One asset is up to 5 MB, and one version's assets up to 20 MB. A relative URL in the page (`assets/logo.png`, `about.html`) loads from the bundle in the viewer, in an inline card after Run, in the artifact's own tab, and in a published link. Each file is sent with the sandbox's policy, `nosniff`, and a type from its extension (an unknown one is never HTML). Assets are stored once for each content hash. A private page reaches its assets through a signed address that lasts 12 hours, so a page left open longer loads new assets only after a reload. `group` (a lowercase slug) puts artifacts together as variations of one design, and `kind` (`page` or `deck`) says what a design is; Design uses both. Artifacts from before 0.26.0 work as they did. `inline: true` (since 0.28.0, one tool; before it a second tool, `artifact_inline`, sent almost the same schema again on every request) is the same store for HTML only (`content` or `edits`, no path, no `type` but `html`): the call shows as a card in the reply, between Pi's words, instead of a link (see Rich replies). Pi's guide says when to use which: the card for a small interactive piece that belongs to what it is explaining, the viewer for a whole page, a game, a Markdown document, or an SVG image. An id made by either tool takes versions from both, but an `inline: true` call refuses an id that is Markdown or SVG, and the `artifact` tool cannot change the type of an id that has had an inline version (a card names a version, and the page comes by the artifact's type): Pi uses a new id for that. Pi's guide mentions `inline` only in sessions whose `artifact` tool has it (PiP's has not), and says that only a direct call shows a card. Sessions from before 0.28.0 keep their `artifact_inline` calls and results as stored, and still show them as cards, also in forks; the model is shown those calls as `artifact` with `inline: true` in its requests, so it does not repeat a tool it is no longer offered. The Artifacts sheet lists every version in a rounded card grid; opening one shows the sandboxed viewer (or its own tab). The list does not run artifacts as previews. Artifacts cannot reach the app or its cookies. In the viewer, an HTML artifact can ask for two things, which Pi knows how to build: a **follow-up**, a message it puts in your message box (after your draft, starting with which artifact it is from, with any selection as JSON) for you to read and send, never sent by itself, and only after you tap the page (a real tap or key press in the page, up to 5 seconds before: the page cannot fake one, and `window.focus()` does not count; each tap serves one follow-up), at most every 2 seconds (the viewer then closes, so the box shows); and **saved state**, up to 16 KB of JSON that it saves for you alone, so its filters and inputs come back after a reload, a restart, or on another device. Saved state stays out of Pi's context, belongs to the artifact rather than a version, and starts empty in a fork; a page that changes the state's shape names a new schema, and the old state then reads as none. Only people who can write to Pi get a follow-up; a viewer gets a notice. HTML run from a reply (▶ Run) can offer a follow-up too, but keeps no state. Only the artifact's first page is heard: as it starts, it opens a private channel to the app (a script the server puts first in an HTML artifact's page when a frame asks for it, and in the frame page that runs a reply's HTML), and everything goes over that channel, so a page the frame goes on to cannot use it and an answer still on its way never reaches it. `schema` is a string (a number is refused, for a get and a set alike). The bridge is for HTML artifacts, not Markdown or SVG. Neither works in a published link or an artifact's own tab. A session keeps up to 300 saved values; a person removed from the app keeps theirs until the session goes. **Share** in the viewer publishes one artifact to anyone with the link (`/pub/<token>`), with no sign-in: the page is the artifact's own sandboxed one, so it still cannot reach the app, and its address is the whole of the access. A bundle's files are at `/pub/<token>/<name>`, checked on every request: ending or expiring the link closes every file, a link that follows the newest version follows its assets, and a pinned link keeps its own. A published page gets no bridge. A share either stays at the version it was made from or follows the artifact's newest, and either lasts until it is ended or closes after a day, a week, or a month; **End** closes it at once, and the address then answers nothing. Only people who steer and see every session publish or end one, or see its address, never viewers or someone invited to a single session. The sheet lists the session's links still in force, with the address to copy; it starts at the server's public address when a tunnel gives one, else at this browser's.
69
69
  - **All artifacts.** The rail's artifact button opens every artifact in every session you can see, grouped by session (archived sessions are left out), newest first. Each row shows its type, size, age, and the number of its current (latest) version, as `v3 / 3` of the versions it has (`v1` when it has one). A tap opens that version in its session. The launcher's **All artifacts** opens it too, which is the way on a phone. The list is `GET /api/artifacts`.
package/docs/map.md CHANGED
@@ -79,7 +79,7 @@ A module split into parts keeps its name for the part others import, with the re
79
79
  | `model-names.ts` | Which models a text names, word by word: PiP passes or names a model only when its person named it |
80
80
  | `running.ts` | Running now, from Pi Durable's task graph, and the Running now board's data (`runningBoard`): the sessions at work with their model and spend, every scheduled message with its next times and whether it is held |
81
81
  | `pip.ts` | PiP, the owner's assistant: its conversation (made on first open, kept out of the session list), what its tools do as its person, and the follows (a durable task each) that report to it when a session's run ends |
82
- | `compaction.ts` | When a session's context is compacted: Pi's compaction settings for Pi Durable, with each model's own values (`compaction.modelOverrides`) |
82
+ | `compaction.ts` | When a session's context is compacted: Pi's compaction settings for Pi Durable, with each model's own values (`compaction.modelOverrides`), and room for each model's summary (`summaryReserve`) |
83
83
  | `pip-compact.ts` | PiP's context kept small: when it compacts itself, and its own summaries, written with what came from outside left out and counted in its spend |
84
84
  | `watches.ts` | A session's PR watch: the durable task that looks at the PR with `gh` and tells Pi about failed checks, conflicts, and comments that count |
85
85
  | `hooks.ts` | Creates, edits, and removes webhooks. Checks each post's secret or GitHub signature, then sends the post to Pi as a message from the hook's creator. |
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "pi-pocket",
3
- "version": "0.28.0",
3
+ "version": "0.28.2-beta.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-pocket",
9
- "version": "0.28.0",
9
+ "version": "0.28.2-beta.1",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
- "@earendil-works/chord": "1.5.0",
13
- "@earendil-works/pi-ai": "1.5.0",
14
- "@earendil-works/pi-codemode": "1.5.0",
15
- "@earendil-works/pi-coding-agent": "1.5.0",
16
- "@earendil-works/pi-durable": "1.5.0",
17
- "@earendil-works/pi-mcp": "1.5.0",
18
- "@earendil-works/pi-schema": "1.5.0",
12
+ "@earendil-works/chord": "1.5.2",
13
+ "@earendil-works/pi-ai": "1.5.2",
14
+ "@earendil-works/pi-codemode": "1.5.2",
15
+ "@earendil-works/pi-coding-agent": "1.5.2",
16
+ "@earendil-works/pi-durable": "1.5.2",
17
+ "@earendil-works/pi-mcp": "1.5.2",
18
+ "@earendil-works/pi-schema": "1.5.2",
19
19
  "dompurify": "^3.4.17",
20
20
  "heic-convert": "^2.1.0",
21
21
  "htm": "^3.1.1",
@@ -442,53 +442,57 @@
442
442
  }
443
443
  },
444
444
  "node_modules/@earendil-works/chord": {
445
- "version": "1.5.0",
446
- "resolved": "https://registry.npmjs.org/@earendil-works/chord/-/chord-1.5.0.tgz",
447
- "integrity": "sha512-jf555zbCM21E03DVBDPD/Tuae0lz64YjaHx/athUxNZ/H7phVVb0dWfZsaYnxaXPQ1odW8iHEoVLOlE/prvUPg==",
445
+ "version": "1.5.2",
446
+ "resolved": "https://registry.npmjs.org/@earendil-works/chord/-/chord-1.5.2.tgz",
447
+ "integrity": "sha512-3g088g7qVXL2cpRAKWjj9za6RLls9FBnuUo5c0hBZ0xCftBQjae0opS+34M22vdXTVE7BNqkRG/FPc9BsM7eEg==",
448
448
  "license": "MIT",
449
449
  "dependencies": {
450
- "@earendil-works/pi-schema": "1.5.0",
451
- "@earendil-works/pi-telemetry": "1.5.0"
450
+ "@earendil-works/pi-schema": "1.5.2",
451
+ "@earendil-works/pi-telemetry": "1.5.2"
452
452
  },
453
453
  "engines": {
454
454
  "node": ">=22.19.0"
455
455
  },
456
456
  "peerDependencies": {
457
457
  "esbuild": "0.28.2",
458
+ "react": "19.3.0",
458
459
  "ws": "8.21.0"
459
460
  },
460
461
  "peerDependenciesMeta": {
461
462
  "esbuild": {
462
463
  "optional": true
463
464
  },
465
+ "react": {
466
+ "optional": true
467
+ },
464
468
  "ws": {
465
469
  "optional": true
466
470
  }
467
471
  }
468
472
  },
469
473
  "node_modules/@earendil-works/pi-agent-core": {
470
- "version": "1.5.0",
471
- "resolved": "https://registry.npmjs.org/@earendil-works/pi-agent-core/-/pi-agent-core-1.5.0.tgz",
472
- "integrity": "sha512-FOj+jXj48DbzMycR/ghNa2KcsqWmvOln24e0FnQOVgnd8vn5H79g335WdHaZUVdRo+zCeogb40/qPPlCWFuvmA==",
474
+ "version": "1.5.2",
475
+ "resolved": "https://registry.npmjs.org/@earendil-works/pi-agent-core/-/pi-agent-core-1.5.2.tgz",
476
+ "integrity": "sha512-ie5mejS7mGfXt//9As7i3LfxVXdktZvF1JP4EQsUXTp4mU437h23MNGx7wXZ5VYs3YiG/Qnj3e7OZ2HC069OMw==",
473
477
  "license": "MIT",
474
478
  "dependencies": {
475
- "@earendil-works/pi-ai": "1.5.0",
476
- "@earendil-works/pi-schema": "1.5.0"
479
+ "@earendil-works/pi-ai": "1.5.2",
480
+ "@earendil-works/pi-schema": "1.5.2"
477
481
  },
478
482
  "engines": {
479
483
  "node": ">=22.19.0"
480
484
  }
481
485
  },
482
486
  "node_modules/@earendil-works/pi-ai": {
483
- "version": "1.5.0",
484
- "resolved": "https://registry.npmjs.org/@earendil-works/pi-ai/-/pi-ai-1.5.0.tgz",
485
- "integrity": "sha512-VeWxNqTHSqRCf8AcY/6kvNwh+neRL6MPxZPePVztIQy6qqK9MR/YoCSN/ZgDnIyCD3pqEXgRyQbzk4KV4uvjbg==",
487
+ "version": "1.5.2",
488
+ "resolved": "https://registry.npmjs.org/@earendil-works/pi-ai/-/pi-ai-1.5.2.tgz",
489
+ "integrity": "sha512-2tWPSnV3qzfiDIY3aWluBag3vC++Vs+VsXt/UquSU5onPMohPih72FUhIhaqmDdMYubOgB3Byl9uF4Vk40JLvQ==",
486
490
  "license": "MIT",
487
491
  "dependencies": {
488
492
  "@anthropic-ai/sdk": "0.129.0",
489
493
  "@aws-sdk/client-bedrock-runtime": "3.1127.0",
490
- "@earendil-works/pi-schema": "1.5.0",
491
- "@earendil-works/pi-telemetry": "1.5.0",
494
+ "@earendil-works/pi-schema": "1.5.2",
495
+ "@earendil-works/pi-telemetry": "1.5.2",
492
496
  "@google/genai": "2.21.0",
493
497
  "@smithy/node-http-handler": "4.12.1",
494
498
  "http-proxy-agent": "9.1.0",
@@ -504,9 +508,9 @@
504
508
  }
505
509
  },
506
510
  "node_modules/@earendil-works/pi-codemode": {
507
- "version": "1.5.0",
508
- "resolved": "https://registry.npmjs.org/@earendil-works/pi-codemode/-/pi-codemode-1.5.0.tgz",
509
- "integrity": "sha512-PLBJZ17AEWGzOlAAcFuOkw3PxkOti0JlFuZQyeF2GRTqbpuYo4k9t8YqUV2uOQVzrUnKdxahwaFUqc1eNS1WAg==",
511
+ "version": "1.5.2",
512
+ "resolved": "https://registry.npmjs.org/@earendil-works/pi-codemode/-/pi-codemode-1.5.2.tgz",
513
+ "integrity": "sha512-HoZQ40a9RgdZ1VgmrX6x8887cNXedaRJT1l+Ie5YRIMK4gY7v0EpsiNqf6dmixrKylZlTgUSyR+vE8xhjfkr+w==",
510
514
  "license": "MIT",
511
515
  "dependencies": {
512
516
  "quickjs-wasi": "3.6.2"
@@ -516,26 +520,26 @@
516
520
  }
517
521
  },
518
522
  "node_modules/@earendil-works/pi-coding-agent": {
519
- "version": "1.5.0",
520
- "resolved": "https://registry.npmjs.org/@earendil-works/pi-coding-agent/-/pi-coding-agent-1.5.0.tgz",
521
- "integrity": "sha512-xNDZ5kqowO6Z03FS2gwAkPEGk1ssxVcYKQ6qZId84mFEvwACvvyc2l0vAMOS+c5zvxLRMLBE9r4y44IGYkMJaQ==",
523
+ "version": "1.5.2",
524
+ "resolved": "https://registry.npmjs.org/@earendil-works/pi-coding-agent/-/pi-coding-agent-1.5.2.tgz",
525
+ "integrity": "sha512-mUWI04rqF1Vd/m1q+Ps1XeWsTXEVvRUnsmRa83I3Dzua0Tx5bYS93imeqtIfrXf7PkkaR6ERz+AuQhIJlom5yA==",
522
526
  "license": "MIT",
523
527
  "dependencies": {
524
- "@earendil-works/pi-agent-core": "1.5.0",
525
- "@earendil-works/pi-ai": "1.5.0",
526
- "@earendil-works/pi-codemode": "1.5.0",
527
- "@earendil-works/pi-mcp": "1.5.0",
528
- "@earendil-works/pi-tui": "1.5.0",
528
+ "@earendil-works/pi-agent-core": "1.5.2",
529
+ "@earendil-works/pi-ai": "1.5.2",
530
+ "@earendil-works/pi-codemode": "1.5.2",
531
+ "@earendil-works/pi-mcp": "1.5.2",
532
+ "@earendil-works/pi-tui": "1.5.2",
529
533
  "@silvia-odwyer/photon-node": "0.3.4",
530
534
  "brace-expansion": "5.0.12",
531
535
  "chalk": "6.0.0",
532
536
  "cross-spawn": "7.0.6",
533
537
  "diff": "8.0.4",
534
- "grok-mermaid": "0.2.3",
535
538
  "highlight.js": "10.7.3",
536
539
  "hosted-git-info": "9.0.3",
537
540
  "ignore": "7.0.8",
538
541
  "jiti": "2.7.0",
542
+ "lovely-mermaid": "0.3.3",
539
543
  "minimatch": "11.0.3",
540
544
  "proper-lockfile": "4.1.2",
541
545
  "quickjs-wasi": "3.6.2",
@@ -568,16 +572,16 @@
568
572
  }
569
573
  },
570
574
  "node_modules/@earendil-works/pi-durable": {
571
- "version": "1.5.0",
572
- "resolved": "https://registry.npmjs.org/@earendil-works/pi-durable/-/pi-durable-1.5.0.tgz",
573
- "integrity": "sha512-xeBP2vIo5NvsCMQ4Y/V+Z164xQEi9JWiBWHdjn4Z15EnFqV3c0FxJAX26FqyyyintrYyk+Enre94GNcvRlBA5g==",
575
+ "version": "1.5.2",
576
+ "resolved": "https://registry.npmjs.org/@earendil-works/pi-durable/-/pi-durable-1.5.2.tgz",
577
+ "integrity": "sha512-zDB3anbI/yD0IG+VVY+g5tU+c5XOVqQAFwLkXRMiqZb4p/afWro0voZtLNoRAWcDA2r73kvmH6kKin9Ka8l55g==",
574
578
  "license": "MIT",
575
579
  "dependencies": {
576
- "@earendil-works/chord": "1.5.0",
577
- "@earendil-works/pi-ai": "1.5.0",
578
- "@earendil-works/pi-codemode": "1.5.0",
579
- "@earendil-works/pi-schema": "1.5.0",
580
- "@earendil-works/pi-telemetry": "1.5.0",
580
+ "@earendil-works/chord": "1.5.2",
581
+ "@earendil-works/pi-ai": "1.5.2",
582
+ "@earendil-works/pi-codemode": "1.5.2",
583
+ "@earendil-works/pi-schema": "1.5.2",
584
+ "@earendil-works/pi-telemetry": "1.5.2",
581
585
  "@silvia-odwyer/photon": "0.3.3",
582
586
  "diff": "8.0.4"
583
587
  },
@@ -586,9 +590,9 @@
586
590
  }
587
591
  },
588
592
  "node_modules/@earendil-works/pi-mcp": {
589
- "version": "1.5.0",
590
- "resolved": "https://registry.npmjs.org/@earendil-works/pi-mcp/-/pi-mcp-1.5.0.tgz",
591
- "integrity": "sha512-DURw3IwHCTMHV8CzUJWVp9css27NowsCWfXt4xg2r09IZ+P1O/Uq58hp0hb9WJO0dbkaKGXKBIkV4LVXcu2nlg==",
593
+ "version": "1.5.2",
594
+ "resolved": "https://registry.npmjs.org/@earendil-works/pi-mcp/-/pi-mcp-1.5.2.tgz",
595
+ "integrity": "sha512-zU1UgeXDlbixPqGEWD7Ql0brEMIpYr7aEWjoEE5h5enJbM/kQ2jIr7lN8JoR80oUnq1fJSU7SC8kLx2Fx/IZYg==",
592
596
  "license": "MIT",
593
597
  "dependencies": {
594
598
  "cross-spawn": "7.0.6"
@@ -598,27 +602,27 @@
598
602
  }
599
603
  },
600
604
  "node_modules/@earendil-works/pi-schema": {
601
- "version": "1.5.0",
602
- "resolved": "https://registry.npmjs.org/@earendil-works/pi-schema/-/pi-schema-1.5.0.tgz",
603
- "integrity": "sha512-RW0MbT2tR65OY6xMsgB/yVBb7m/RTNwA+9hurSN1vVXfHZRVmVnXbruBPrx/PzbrQnW5yLVlMRWxErGDQtF1Hg==",
605
+ "version": "1.5.2",
606
+ "resolved": "https://registry.npmjs.org/@earendil-works/pi-schema/-/pi-schema-1.5.2.tgz",
607
+ "integrity": "sha512-hJoyCXWUhsSrXY5wJo2Q4kHXUsR51pNhkJHAMkWRwVMLDRtMDPkKNaa+JlVRVqTw1hjdSxcVVaFLSDbKlaTXEQ==",
604
608
  "license": "MIT",
605
609
  "engines": {
606
610
  "node": ">=22.19.0"
607
611
  }
608
612
  },
609
613
  "node_modules/@earendil-works/pi-telemetry": {
610
- "version": "1.5.0",
611
- "resolved": "https://registry.npmjs.org/@earendil-works/pi-telemetry/-/pi-telemetry-1.5.0.tgz",
612
- "integrity": "sha512-VW3tcVdnNfl/Vk8wHPTzZdKkxcsCOM12ppiO4DXnd9wMxUCmOfLt/wvUnWeKWbTVlVSRg0uqKtnnhE2UCsG2Bw==",
614
+ "version": "1.5.2",
615
+ "resolved": "https://registry.npmjs.org/@earendil-works/pi-telemetry/-/pi-telemetry-1.5.2.tgz",
616
+ "integrity": "sha512-m+cumjIqNh1aMISi/9ttcG3ZOwIdriPbz/eMyWmRMJCGa/WcgY1RX4lrb7HvsHhSfI/JUeBESA4nOCr8C3y5ow==",
613
617
  "license": "MIT",
614
618
  "engines": {
615
619
  "node": ">=22.19.0"
616
620
  }
617
621
  },
618
622
  "node_modules/@earendil-works/pi-tui": {
619
- "version": "1.5.0",
620
- "resolved": "https://registry.npmjs.org/@earendil-works/pi-tui/-/pi-tui-1.5.0.tgz",
621
- "integrity": "sha512-56KqrDVeLF18k+syppVbT35Ai1opbM44ot+sL7O3K40CaWwXCiwOpqEFugDBAILtAhseZh6uYIuYxPPOJHLFAA==",
623
+ "version": "1.5.2",
624
+ "resolved": "https://registry.npmjs.org/@earendil-works/pi-tui/-/pi-tui-1.5.2.tgz",
625
+ "integrity": "sha512-WK8ih+c88GWizaB79y7Pq3PV7ySf5VI1pZ1i/6aBBjDOAiG2EE3ojKjl+pxQqLfyQGnzHYu4VfakOBJgumuoyw==",
622
626
  "license": "MIT",
623
627
  "dependencies": {
624
628
  "get-east-asian-width": "1.6.0",
@@ -2168,15 +2172,6 @@
2168
2172
  "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
2169
2173
  "license": "ISC"
2170
2174
  },
2171
- "node_modules/grok-mermaid": {
2172
- "version": "0.2.3",
2173
- "resolved": "https://registry.npmjs.org/grok-mermaid/-/grok-mermaid-0.2.3.tgz",
2174
- "integrity": "sha512-/4KopAbsjvuRP9MdPtlDjOHUmUVEohOX73JNcsWpzAtFxh+bq5+Dhb6gzvRieLDwIPQIR3/vy8V1NNTuz4Zsmg==",
2175
- "license": "Apache-2.0",
2176
- "engines": {
2177
- "node": ">=18"
2178
- }
2179
- },
2180
2175
  "node_modules/hashery": {
2181
2176
  "version": "1.5.1",
2182
2177
  "resolved": "https://registry.npmjs.org/hashery/-/hashery-1.5.1.tgz",
@@ -2483,6 +2478,15 @@
2483
2478
  "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==",
2484
2479
  "license": "Apache-2.0"
2485
2480
  },
2481
+ "node_modules/lovely-mermaid": {
2482
+ "version": "0.3.3",
2483
+ "resolved": "https://registry.npmjs.org/lovely-mermaid/-/lovely-mermaid-0.3.3.tgz",
2484
+ "integrity": "sha512-EMLJS934qwt2MLO/a5o+T/89HGbuXZPwmCpHIhHO+DVrm+y5tHlEHgpZzlC2o4yW/rFPHRFO9xSMafzqH4wH5A==",
2485
+ "license": "Apache-2.0",
2486
+ "engines": {
2487
+ "node": ">=18"
2488
+ }
2489
+ },
2486
2490
  "node_modules/lru-cache": {
2487
2491
  "version": "11.5.3",
2488
2492
  "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-pocket",
3
- "version": "0.28.0",
3
+ "version": "0.28.2-beta.1",
4
4
  "description": "A durable, multiplayer, mobile-first web app for Pi agents, built on Pi Durable",
5
5
  "keywords": [
6
6
  "pi",
@@ -54,13 +54,13 @@
54
54
  "prepublishOnly": "npm run check && npm run lint && npm test"
55
55
  },
56
56
  "dependencies": {
57
- "@earendil-works/chord": "1.5.0",
58
- "@earendil-works/pi-ai": "1.5.0",
59
- "@earendil-works/pi-codemode": "1.5.0",
60
- "@earendil-works/pi-coding-agent": "1.5.0",
61
- "@earendil-works/pi-durable": "1.5.0",
62
- "@earendil-works/pi-mcp": "1.5.0",
63
- "@earendil-works/pi-schema": "1.5.0",
57
+ "@earendil-works/chord": "1.5.2",
58
+ "@earendil-works/pi-ai": "1.5.2",
59
+ "@earendil-works/pi-codemode": "1.5.2",
60
+ "@earendil-works/pi-coding-agent": "1.5.2",
61
+ "@earendil-works/pi-durable": "1.5.2",
62
+ "@earendil-works/pi-mcp": "1.5.2",
63
+ "@earendil-works/pi-schema": "1.5.2",
64
64
  "dompurify": "^3.4.17",
65
65
  "heic-convert": "^2.1.0",
66
66
  "htm": "^3.1.1",
@@ -86,8 +86,11 @@ export class Alerts {
86
86
  });
87
87
  }
88
88
 
89
- /** A run started or ended. "Pi finished" goes out once it has stayed finished for a moment. */
90
- runChanged(id: ConversationId, busy: boolean): void {
89
+ /**
90
+ * A run started or ended. "Pi finished" goes out once it has stayed finished for a moment. `failure`: the run failed
91
+ * with this line (`app.ts` `failureText`), also when no answer of Pi's says so, as when its compaction failed.
92
+ */
93
+ runChanged(id: ConversationId, busy: boolean, failure?: string): void {
91
94
  clearTimeout(this.#doneTimers.get(id));
92
95
  this.#doneTimers.delete(id);
93
96
 
@@ -97,7 +100,7 @@ export class Alerts {
97
100
 
98
101
  const timer = setTimeout(() => {
99
102
  this.#doneTimers.delete(id);
100
- void this.#pushDone(id).catch((error: unknown) =>
103
+ void this.#pushDone(id, failure).catch((error: unknown) =>
101
104
  this.#app.log(`push failed: ${describe(error)}`),
102
105
  );
103
106
  }, DONE_DELAY_MS);
@@ -106,7 +109,7 @@ export class Alerts {
106
109
  this.#doneTimers.set(id, timer);
107
110
  }
108
111
 
109
- async #pushDone(id: ConversationId): Promise<void> {
112
+ async #pushDone(id: ConversationId, failure?: string): Promise<void> {
110
113
  const app = this.#app;
111
114
 
112
115
  if (app.isBusy(id)) {
@@ -124,12 +127,18 @@ export class Alerts {
124
127
  .map((entry) => projectEntry(entry))
125
128
  .find((entry) => entry?.kind === "assistant");
126
129
 
127
- if (last?.kind !== "assistant" || last.stopReason === "aborted") {
130
+ // A run that failed before any answer (its compaction failed, its model is gone) leaves the last answer as it
131
+ // was: the failure says what happened, not that answer.
132
+ if (
133
+ failure === undefined &&
134
+ (last?.kind !== "assistant" || last.stopReason === "aborted")
135
+ ) {
128
136
  return;
129
137
  }
130
138
 
131
139
  const title = await app.conversationTitle(id);
132
- const failed = last.stopReason === "error";
140
+ const failed = failure !== undefined || last?.stopReason === "error";
141
+ const answer = last?.kind === "assistant" ? last : undefined;
133
142
  // PiP's answers open its panel, over whatever the app shows, rather than a session.
134
143
  const pip = app.sessionMeta(id)?.pip !== undefined;
135
144
  const message: PushMessage = {
@@ -139,7 +148,10 @@ export class Alerts {
139
148
  ? `Pi stopped with an error · ${title}`
140
149
  : `Pi finished · ${title}`,
141
150
  body: snippet(
142
- failed ? (last.error ?? "The model request failed.") : entryText(last) || "Done.",
151
+ failure ??
152
+ (failed
153
+ ? (answer?.error ?? "The model request failed.")
154
+ : (answer === undefined ? "" : entryText(answer)) || "Done."),
143
155
  400,
144
156
  ),
145
157
  url: pip ? "/?pip=1" : `/s/${String(id)}`,
@@ -152,7 +164,8 @@ export class Alerts {
152
164
  continue;
153
165
  }
154
166
 
155
- void this.push(userId, id, "done", message);
167
+ // A failure waits for a person: it goes out at once, also to a phone that saves its battery.
168
+ void this.push(userId, id, "done", message, failed ? "high" : "normal");
156
169
  }
157
170
  }
158
171
 
@@ -19,10 +19,11 @@ const ENTRYPOINT = "sdk-cli";
19
19
 
20
20
  /**
21
21
  * The Claude Code version requests are shaped as: the one pi-ai's Anthropic transport reports in its
22
- * `claude-cli/<version>` user-agent, which Anthropic gates models on. Set the environment variable to raise it when
23
- * a model's floor is higher. It is read when the server starts.
22
+ * `claude-cli/<version>` user-agent, which Anthropic gates models on. Raise it with each Pi update that raises that
23
+ * user-agent: `test/anthropic-shape.test.ts` checks that the two match. The environment variable overrides it, read when
24
+ * the server starts.
24
25
  */
25
- const VERSION = process.env.PI_POCKET_ANTHROPIC_CC_VERSION ?? "2.1.280";
26
+ const VERSION = process.env.PI_POCKET_ANTHROPIC_CC_VERSION ?? "2.1.322";
26
27
 
27
28
  /** A system block of an Anthropic request body. */
28
29
  type TextBlock = { type?: string; text?: string; [key: string]: unknown };
package/src/server/app.ts CHANGED
@@ -1319,7 +1319,7 @@ export class PocketApp {
1319
1319
  }
1320
1320
 
1321
1321
  sessionsChanged = true;
1322
- this.alerts.runChanged(id, busy);
1322
+ this.alerts.runChanged(id, busy, failure);
1323
1323
 
1324
1324
  if (!busy) {
1325
1325
  this.spend.runEnded(id);
@@ -1449,7 +1449,12 @@ export class PocketApp {
1449
1449
 
1450
1450
  const registry = () => this.#registry;
1451
1451
  const stream = () => this.streamSettings();
1452
- const compaction = compactionReader(settings, (line) => this.#log(line));
1452
+ // Every model Pi knows, so each gets room for its summary when Pi's settings set no reserve (`compaction.ts`).
1453
+ const compaction = compactionReader(
1454
+ settings,
1455
+ (line) => this.#log(line),
1456
+ () => safe(() => this.models.getModels()) ?? [],
1457
+ );
1453
1458
 
1454
1459
  return {
1455
1460
  // A phase can wait for hours without changing state; repeated process kills must not park it.
@@ -2871,6 +2876,14 @@ export class PocketApp {
2871
2876
  return this.#busy.has(id);
2872
2877
  }
2873
2878
 
2879
+ /**
2880
+ * Why the session's last run failed, while it is idle after it: also a failure that left no failed answer, such as
2881
+ * a compaction that could not be written. Undefined once a run starts again.
2882
+ */
2883
+ runFailure(id: ConversationId): string | undefined {
2884
+ return this.#busy.has(id) ? undefined : this.#failed.get(id);
2885
+ }
2886
+
2874
2887
  /** The conversations with a run going. */
2875
2888
  busyConversations(): ConversationId[] {
2876
2889
  return [...this.#busy];
@@ -4233,7 +4246,8 @@ export class PocketApp {
4233
4246
  /**
4234
4247
  * Continue on the runtime's calls: after Pi and the caller shaped a request, each shaper may replace the payload, the
4235
4248
  * last one closest to the wire. With no shaper, the call goes on untouched. A shaper may answer with a promise. One
4236
- * that throws is logged and skipped: a faulty module must not fail the model call.
4249
+ * that throws is logged and skipped: a faulty module must not fail the model call. A shaped call sends its whole
4250
+ * request: an Anthropic thread continuation would leave out the system blocks and tools a shaper may have changed.
4237
4251
  */
4238
4252
  export function installRequestShaping(
4239
4253
  models: { streamSimple: ModelRuntime["streamSimple"] },
@@ -4249,6 +4263,7 @@ export function installRequestShaping(
4249
4263
 
4250
4264
  return stream(model, context, {
4251
4265
  ...options,
4266
+ disableContinuation: true,
4252
4267
  onPayload: async (payload, payloadModel) => {
4253
4268
  const asked = await options?.onPayload?.(payload, payloadModel);
4254
4269
  let next = asked ?? payload;
@@ -3,7 +3,7 @@
3
3
  * JSON value for each artifact, person, and session, kept apart from the artifact's versions and from Pi's context.
4
4
  * A page names a schema to tell old values from new ones: a value saved under another schema reads as none.
5
5
  */
6
- import type { JsonValue } from "@earendil-works/chord";
6
+ import type { JsonValue } from "@earendil-works/chord/json";
7
7
  import { BACKGROUND_CONTEXT } from "@earendil-works/chord/context";
8
8
  import type { ConversationId } from "@earendil-works/pi-durable";
9
9
  import type { PocketApp } from "./app.ts";
@@ -31,7 +31,7 @@ import {
31
31
  statSync,
32
32
  } from "node:fs";
33
33
  import { join } from "node:path";
34
- import type { Context } from "@earendil-works/chord";
34
+ import type { Context } from "@earendil-works/chord/context";
35
35
  import { BACKGROUND_CONTEXT } from "@earendil-works/chord/context";
36
36
  import {
37
37
  type ConversationId,
@@ -502,6 +502,7 @@ export class CacheKeeper {
502
502
  const options: ObservedOptions = {
503
503
  ...rest,
504
504
  maxTokens: 1,
505
+ disableContinuation: true,
505
506
  maxRetries: 0,
506
507
  signal: abort.signal,
507
508
  [FINAL_PAYLOAD]: (payload) => {