pi-pocket 0.28.0 → 0.28.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.
- package/docs/customizing.md +1 -1
- package/docs/features.md +3 -3
- package/docs/map.md +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/src/server/alerts.ts +21 -8
- package/src/server/app.ts +15 -2
- package/src/server/commands.ts +385 -77
- package/src/server/compaction.ts +56 -2
- package/src/server/docs.ts +42 -0
- package/src/server/extensions/schedules.ts +1 -1
- package/src/server/http/conversation-routes.ts +22 -0
- package/src/server/pip.ts +8 -0
- package/src/server/resend.ts +25 -8
- package/src/server/room.ts +17 -1
- package/src/server/running.ts +3 -0
- package/src/server/schedules.ts +111 -11
- package/web/composer.js +101 -3
- package/web/running-board.js +1 -0
- package/web/sheets/schedules.js +6 -0
- package/web/store.js +7 -0
- package/web/style.css +37 -0
- package/web/transcript.js +15 -0
package/docs/customizing.md
CHANGED
|
@@ -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,
|
|
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. |
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-pocket",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-pocket",
|
|
9
|
-
"version": "0.28.
|
|
9
|
+
"version": "0.28.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@earendil-works/chord": "1.5.0",
|
package/package.json
CHANGED
package/src/server/alerts.ts
CHANGED
|
@@ -86,8 +86,11 @@ export class Alerts {
|
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
/**
|
|
90
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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];
|