pi-pocket 0.28.0-beta.8 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/contrib/systemd/pi-pocket@.service +1 -1
- package/docs/architecture.md +10 -4
- package/docs/extensions/commands.md +1 -1
- package/docs/extensions/reference/api-versions.md +4 -0
- package/docs/extensions/reference/limits.md +1 -1
- package/docs/extensions/reference/theme-surface.md +1 -1
- package/docs/extensions/reference/web.md +1 -1
- package/docs/extensions/themes.md +1 -0
- package/docs/extensions/tools.md +1 -1
- package/docs/features.md +12 -12
- package/docs/map.md +53 -46
- package/docs/systemd.md +2 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/src/server/design/scan-fig.ts +49 -7
- package/src/server/design/system.ts +7 -0
- package/src/server/extension-commands.ts +11 -5
- package/src/server/extensions/prompt.ts +1 -0
- package/src/server/main.ts +15 -0
- package/types/pocket.d.ts +1 -1
- package/web/app.js +34 -4
- package/web/back.js +29 -6
- package/web/browser-panel.js +13 -25
- package/web/browser.js +3 -10
- package/web/chat.js +41 -30
- package/web/composer.js +308 -118
- package/web/extension-ui.js +15 -7
- package/web/files-panel.js +16 -41
- package/web/history.js +1 -4
- package/web/launcher.js +2 -1
- package/web/notes-drafts.js +129 -0
- package/web/panel-layout.js +140 -0
- package/web/peeks.js +12 -14
- package/web/person-storage.js +84 -2
- package/web/pip.js +316 -110
- package/web/quote-reply.js +2 -5
- package/web/running-board.js +3 -2
- package/web/session-cache.js +26 -2
- package/web/session-tabs.js +4 -3
- package/web/sessions.js +515 -215
- package/web/sheets/appearance.js +23 -0
- package/web/sheets/memory.js +41 -2
- package/web/store.js +356 -48
- package/web/style.css +135 -34
- package/web/theme.js +5 -0
- package/web/transcript.js +158 -15
- package/web/ui.js +100 -24
- package/web/voice.js +4 -2
- package/web/window-controls.js +7 -4
package/docs/map.md
CHANGED
|
@@ -57,46 +57,48 @@ A module split into parts keeps its name for the part others import, with the re
|
|
|
57
57
|
|
|
58
58
|
### What people ask of Pi
|
|
59
59
|
|
|
60
|
-
| File
|
|
61
|
-
|
|
|
62
|
-
| `commands.ts`
|
|
63
|
-
| `resend.ts`
|
|
64
|
-
| `extension-commands.ts`
|
|
65
|
-
| `subagent-runs.ts`
|
|
66
|
-
| `shell.ts`
|
|
67
|
-
| `background.ts`
|
|
68
|
-
| `schedules.ts`, `when.ts`
|
|
69
|
-
| `goals.ts`
|
|
70
|
-
| `titles.ts`
|
|
71
|
-
| `prompts.ts`
|
|
72
|
-
| `pi-sessions.ts`
|
|
73
|
-
| `skills.ts`
|
|
74
|
-
| `model-images.ts`
|
|
75
|
-
| `heic.ts`
|
|
76
|
-
| `models.ts`
|
|
77
|
-
| `model-facts.ts`
|
|
78
|
-
| `project-model.ts`
|
|
79
|
-
| `model-names.ts`
|
|
80
|
-
| `running.ts`
|
|
81
|
-
| `pip.ts`
|
|
82
|
-
| `compaction.ts`
|
|
83
|
-
| `pip-compact.ts`
|
|
84
|
-
| `watches.ts`
|
|
85
|
-
| `hooks.ts`
|
|
86
|
-
| `repo-watches.ts`
|
|
87
|
-
| `github.ts`
|
|
88
|
-
| `memory.ts`
|
|
89
|
-
| `folder-favorites.ts`
|
|
90
|
-
| `share.ts`
|
|
91
|
-
| `public-links.ts`
|
|
92
|
-
| `hidden.ts`
|
|
93
|
-
| `extension-points.ts`
|
|
94
|
-
| `app-events.ts`
|
|
95
|
-
| `extension-settings.ts`
|
|
96
|
-
| `artifact-state.ts`
|
|
97
|
-
| `reveal.ts`
|
|
98
|
-
| `extension-sessions.ts`
|
|
99
|
-
| `
|
|
60
|
+
| File | Owns |
|
|
61
|
+
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
62
|
+
| `commands.ts` | What people ask of Pi: sessions, messages (with skills, templates, and mentioned files expanded), forks and resends, model and folder, reset, instructions, plan mode, goals, schedules, worktrees, notes Pi is told |
|
|
63
|
+
| `resend.ts` | A message sent again: the task made with its fork that sends it |
|
|
64
|
+
| `extension-commands.ts` | Extensions' commands run: who may, a durable task per run that a retry finds and a restart never runs again, cards, and stopping |
|
|
65
|
+
| `subagent-runs.ts` | How a subagent's run ended, in the words its record keeps: for the subagent tool's reports, and for what a person's message to a failed subagent came to |
|
|
66
|
+
| `shell.ts` | `!` and `!!` commands: a background task per command that runs it and writes a `pocket.shell` entry; a restart cuts it off rather than running it again |
|
|
67
|
+
| `background.ts` | Background tasks: commands Pi runs detached, each watched by a durable task until it ends, and their ends go to Pi as one message, steered into the run in flight |
|
|
68
|
+
| `schedules.ts`, `when.ts` | Scheduled messages (a durable task) and their time grammar |
|
|
69
|
+
| `goals.ts` | "Done when" checks |
|
|
70
|
+
| `titles.ts` | A short title for a session with a long first message, or one that runs a skill or prompt template, from the session's own model |
|
|
71
|
+
| `prompts.ts` | Pi's prompt templates as slash commands, and `/skill:name` expanded |
|
|
72
|
+
| `pi-sessions.ts` | Pi's sessions from the terminal (`~/.pi/agent/sessions/`), read and never written: listing them, and one as a new session's history, with Pi's own context of it (compactions, context edits); `commands.continuePiSession` makes the session |
|
|
73
|
+
| `skills.ts` | Which skills a session's folder has, from where Pi's CLI looks and in its order, with Pi's project trust; the system prompt and `/skill:name` both use it. Reads and saves the owner's answer to "trust this project?" |
|
|
74
|
+
| `model-images.ts` | Attached images (HEIC made JPEG) made small enough for the model, with a note when it differs, started as each upload ends so a message that sends them finds them ready |
|
|
75
|
+
| `heic.ts` | A HEIC or HEIF photo as JPEG in a worker (`heic-worker.ts`; `heic-convert.d.ts` types the library), one at a time, with time, memory, and pixel limits |
|
|
76
|
+
| `models.ts` | The models people can pick (marked for Pi’s enabledModels scope and when their sign-in needs renewing), the one a conversation runs with, finding one by name, and the thinking levels |
|
|
77
|
+
| `model-facts.ts` | One short line per model of the owner's list for subagents (thinking, context window, price, which is the session's own) for the `subagent` and `team` prompt sections |
|
|
78
|
+
| `project-model.ts` | Trusted project model/thinking defaults and fresh global-only settings read for each new session, validation, and safe errors; no resource paths or per-project run policy |
|
|
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
|
+
| `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
|
+
| `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`) |
|
|
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
|
+
| `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
|
+
| `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. |
|
|
86
|
+
| `repo-watches.ts` | Repository watches: PiP's standing orders on a GitHub repository, and the durable task that looks at it and tells PiP or a session what happened |
|
|
87
|
+
| `github.ts` | GitHub through `gh`: running it unattended, repository and PR names in every form, and whether `gh`'s account can push to a repository |
|
|
88
|
+
| `memory.ts` | Memory: lessons Pi keeps across sessions, each for a project (a repository with its worktrees, or a folder) or everywhere; the lessons in force for a session, and people's view, writes, and approvals |
|
|
89
|
+
| `folder-favorites.ts` | Each person's favorite folders (`/api/folder-favorites`): starring and unstarring one in a transaction, and each person's list sent only to their own tabs |
|
|
90
|
+
| `share.ts` | Artifact shares (`/api/c/:id/shares`): publishing one artifact version, or the newest, to anyone with a link, ending it, and what a published token shows now (needs no sign-in); only people who see every session publish or end one A published bundle's files are served by `http/artifact-assets.ts`. |
|
|
91
|
+
| `public-links.ts` | Extension modules' public links (`web.links`): made, listed, and ended for their own module only, each closing at its time or after its uses; a use counts before the page handler runs and comes back when the page refuses the post (needs no sign-in) |
|
|
92
|
+
| `hidden.ts` | Values extensions hide (`host.hide`) from command output as it streams and from every tool's result, and the variables they add to each command (`host.commandEnv`), both through the environment each conversation's commands run in (`wrapEnv`) |
|
|
93
|
+
| `extension-points.ts` | `host.ask`, an extension's question on an approval card whose typed values go to the asker alone, and `host.browser`, a session's page for extensions with `fill` and controls as data, but no script |
|
|
94
|
+
| `app-events.ts` | What happens in the app, for extensions (`host.on`): sessions made, renamed, and archived, messages people send to Pi, and runs that start and end, each after its commit; PiP sends none |
|
|
95
|
+
| `extension-settings.ts` | Settings modules declare (`web.settings`): their fields checked as the module loads, the owner's values checked before config.json keeps them, and what browsers see (never a secret's value) |
|
|
96
|
+
| `artifact-state.ts` | What an artifact's page saves for each person (`/api/c/:id/artifact-state/:artifact`): one JSON value per artifact, person, and session, up to 16 KB, with a schema label that makes older values read as none, and a limit on saves; not in Pi's context, and a fork starts with none |
|
|
97
|
+
| `reveal.ts` | Ctrl+click on a path (`/api/c/:id/reveal`, the owner's): shows it in the file manager of the machine the server runs on, selected in its folder (FileManager1 over D-Bus, else `xdg-open`; `open -R`; `explorer /select,`) |
|
|
98
|
+
| `extension-sessions.ts` | Ordinary sessions an extension starts (`ExtensionSessions`, `host.sessions` as `SessionsApi` in `host.ts`): a top-level session, like New session, for the person Pi works for in the source, with its model and thinking written in that same commit and its first message sent once; the call's record is an item of `LinkedSessionCallsDoc`, written in the commit that makes the session (since 0.28.0) |
|
|
99
|
+
| `entry-presentation.ts` | How a module asks the transcript to show an input it sends (`web.presentEntry`): one line that opens to the text, live while the module is on; nothing is stored (since 0.28.0) |
|
|
100
|
+
| `extension-pi-ai-compat.ts` | The `@earendil-works/pi-ai` that drop-ins get: pi-ai plus TypeBox's `Type` and a `StringEnum`, which pi-ai's main entry dropped in Pi 1.5 (since 0.28.0) |
|
|
101
|
+
| `linked-sessions.ts` | Linked sessions (`LinkedSessions`, `host.linkedSessions` as `LinkedSessionsApi` in `host.ts`): starting a session from another and sending its first message, with a record of the call that makes a repeat find the first; the addresses each session knows its linked ones by; messages between them, sent once, as the person Pi works for, through `Commands.submit`; stopping a run and archiving a session of the team (`stop`, `archive`, since 0.28.0); and a team's bounds (one level; since 0.19.0, no count of sessions or messages) |
|
|
100
102
|
|
|
101
103
|
### Workspace providers
|
|
102
104
|
|
|
@@ -210,17 +212,19 @@ Plain ES modules, loaded as they are. `math.js` finds Markdown math delimiters;
|
|
|
210
212
|
|
|
211
213
|
| File | Owns |
|
|
212
214
|
| --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
213
|
-
| `store.js` | State, the event stream (SSE, or long polling when a tunnel holds it back), `api()`, `actions`, `workspaceOrder` (the numbers, by `session-tree.js`)
|
|
215
|
+
| `store.js` | State, the event stream (SSE, or long polling when a tunnel holds it back), `api()`, `actions`, `workspaceOrder` (the numbers, by `session-tree.js`), `openId` (the session marked open: the one under a route opened `over` it, as PiP's board is) |
|
|
214
216
|
| `live.js` | The message Pi is writing, put together from view updates that carry what changed (`liveMessage`); it imports nothing, so the server's tests run it |
|
|
215
|
-
| `back.js` | The back stack: routes and the layers over them (sheets, the drawer, panels that cover the screen, a file over the tree) as history entries, so back closes what opened last; `useBack`, `pushRoute
|
|
217
|
+
| `back.js` | The back stack: routes and the layers over them (sheets, the drawer, panels that cover the screen, a file over the tree) as history entries, so back closes what opened last; `useBack`, `pushRoute` (with state kept on the entry, read with `routeState`), `popRoute` (back to the route a route was opened over, keeping the layers still open), `goHome`, the list put under a conversation opened straight away, taps let go that land on what just slid in |
|
|
216
218
|
| `gestures.js` | Touch gestures, each following its own finger by its identifier, passive where they can be: sheets dragged down and the drawer dragged left to close (`useDragToClose`); on phones, swipes on the conversation (right back, left Files), in Files (right back), and up from the message box (the places); a swipe in from the left edge goes back in an iPhone's home screen app |
|
|
217
219
|
| `app.js` | Layout (tiled windows, and the subagents board in the conversation's place), top bar (with what changed, from `diff.js`), notices, keyboard shortcuts, routing |
|
|
218
|
-
| `transcript.js` | The conversation as turns: messages, Pi's replies with message times arranged in the reply slot, its thinking and tool calls folded into groups that open into a timeline, extensions' command cards, approvals, the live line (and Pi's thinking above it), breadcrumbs (and `linked-sessions.js`, the links between linked sessions); a message from a linked session shows as its own card (`LinkedMessage`), without its routing words, named after its session from the view's `linkedPeers`
|
|
220
|
+
| `transcript.js` | The conversation as turns: messages, Pi's replies with message times arranged in the reply slot, its thinking and tool calls folded into groups that open into a timeline, extensions' command cards, approvals, the live line (and Pi's thinking above it), breadcrumbs (and `linked-sessions.js`, the links between linked sessions); a message from a linked session shows as its own card (`LinkedMessage`), without its routing words, named after its session from the view's `linkedPeers`. Unsent picks and typed answers on a Pi asks card (never a secret field's) are kept per person through `person-storage.js`, by session and by ask (its id and its call, or when it asked), until Send, Decline, the card leaving, or sign-out; one that ended unseen goes when a card in that session next shows with the server's view of it. |
|
|
219
221
|
| `turns.js` | How the transcript reads a conversation, without drawing it: answers split into runs of words and groups of calls, and each inline call (`artifact` with `inline: true`, or an old `artifact_inline`: `isInlineCall`) as an `inline` item between them (`itemsOf`), a group in a line (`summarize`, with extensions' own tools as `extension-ui.js` gives them: `setCallSummary`), and what a call came to from what its tool printed. No imports, so Node tests it |
|
|
220
222
|
| `calls.js` | A tool call in one line, for the transcript's timeline and peek tiles; extensions' own tools as `extension-ui.js` gives them (`setCallDescriber`) |
|
|
221
223
|
| `slots.js` | Slots: the top bar's buttons, the status line's items, the places, the message box's left buttons, and the actions under answers as named items, the app's own (`defineItem`) and extensions' (`fromExtensions`), in one order: defaults, `before`/`after`, extensions' `pocket.arrange`, then the person's own choices (`prefs().layout`, Appearance → Layout) |
|
|
222
224
|
| `composer.js` | Message box, chips, the queue, plan and goal bars, `@` file suggestions, `!` commands, ↑ and Ctrl+R history, long-paste placeholders, the mic (`voice.js`), a subagent's way back to its session, the status line under it (kept to one row) |
|
|
223
225
|
| `quote-reply.js`, `quote-text.js` | Reply to a passage: the Reply and Ask PiP buttons by a selection in one of Pi's replies, and the quote lines (cut at 1,500 characters) that go before the message |
|
|
226
|
+
| `entry-presentation.js` | How this browser shows an input a module presents (`pocket.entryPresentation`): open, folded, or hidden, kept in this browser |
|
|
227
|
+
| `user-search.js` | What Find searches in a person's message: its presented label and summary, then the text written |
|
|
224
228
|
| `subagents.js` | The subagents bar above the message box: each subagent's state, what it was asked, and what it does now (its peek, through `useOnScreen` in `peeks.js`); Stop, open, put away. Its states and times (`stateOf`, `elapsed`, `ordered`) and failures dealt with (`unresolved`, `dismiss`, `seeFailure`) serve the board too |
|
|
225
229
|
| `agent-now.js` | What a subagent does this moment, from its peek (`nowDoing`): the call it waits to allow, the call it runs, or its words; the subagents bar, the board, and peek tiles all say it |
|
|
226
230
|
| `agent-tile.js` | A subagent at work as a sub-tile (`AgentTile`): its state square, name, state, and what it does now; a click picks it, a double click (or double tap) opens it. Peek tiles nest them, and the board shows them under a session's row |
|
|
@@ -234,13 +238,15 @@ Plain ES modules, loaded as they are. `math.js` finds Markdown math delimiters;
|
|
|
234
238
|
| `commands.js` | Slash commands (the app's own, and extensions'), and prompt templates |
|
|
235
239
|
| `trust.js` | Project trust: the bar that asks the owner whether to trust a session's project for its own skills and its `.pi/settings.json` model defaults, and the sheet (`/trust`, the menu) that shows and changes the answer |
|
|
236
240
|
| `sheets.js` | Which sheet is open, the component that shows it, and the nested-sheet back action supplied to `Sheet` through `SheetBack` |
|
|
237
|
-
| `sheets/*.js` | One sheet (or a few close ones) each: the model and branch pickers, folder, extensions, providers, people and invites, the file viewer (`FileView`, which the Files tile shows too), find, spend, all artifacts (`all-artifacts.js`: every session's artifacts from `GET /api/artifacts`, `PocketApp.artifactOverview`), schedules, webhooks, memory (the lessons Pi keeps, with the menu's hint), worktree, Pi's terminal sessions, appearance, shortcuts, the menu, a session's actions, the extension gallery (`gallery.js`: browsing, an entry, its source, an update, sharing; `galleryAvailable`), with the artifact viewer's **Open in Design** button (`viewers.js`)
|
|
241
|
+
| `sheets/*.js` | One sheet (or a few close ones) each: the model and branch pickers, folder, extensions, providers, people and invites, the file viewer (`FileView`, which the Files tile shows too), find, spend, all artifacts (`all-artifacts.js`: every session's artifacts from `GET /api/artifacts`, `PocketApp.artifactOverview`), a background task's output as it runs (`background.js`), schedules, webhooks, memory (the lessons Pi keeps, with the menu's hint), worktree, Pi's terminal sessions, appearance, shortcuts, the menu, a session's actions, the extension gallery (`gallery.js`: browsing, an entry, its source, an update, sharing; `galleryAvailable`), with the artifact viewer's **Open in Design** button (`viewers.js`) |
|
|
238
242
|
| `peeks.js` | Peek tiles: their switches (the top bar's and the rail's), which sessions get one and in what order (working, waiting, with subagents at work, finished, or pinned), the column and the strip, each tile's subagents at work (the first few as rows, the rest counted, opening the board at them) and their own peeks, the watch list |
|
|
239
243
|
| `seen.js` | What this browser has seen: when it last looked at each session (`markSeen`), which runs ended since (`finishedUnseen`), and the server's clock (`fromServer`). Peek tiles and the session list's squares read it; the list also puts looks back (`seenSnapshot`, `restoreSeen`) when it undoes marking sessions read |
|
|
240
244
|
| `clock.js` | The server's clock as a tab knows it, without the DOM: how far it is ahead of this browser's, fitted to what each hello proves, so a hello handled late (a tab woken from the background) moves no time shown |
|
|
241
245
|
| `text-hash.js` | A short fingerprint of a string, the same in the browser and on the server, which imports it: a tab names with it what it kept of a session (`have`), and the server checks it (`Room.push`) |
|
|
242
246
|
| `session-cache.js` | The sessions a browser keeps on the device (IndexedDB) for all its tabs: saved, read, and dropped by size, the one used longest ago first; `store.js` decides what goes in and checks what comes out |
|
|
247
|
+
| `session-tabs.js`, `tab-order.js` | Session tabs (Appearance): the strip of segments above the top bar, and which sessions it shows and each one's state (`tab-order.js`, no imports) |
|
|
243
248
|
| `chat.js` | People panel: presence roster, take-turns shortcut, chat bubbles, pins, notes; the chat sheet |
|
|
249
|
+
| `notes-drafts.js` | An unsaved edit of a session's notes, and the revision it started from, kept per person through `person-storage.js` until Save, Cancel, or Use theirs, and cleared at sign-out. |
|
|
244
250
|
| `avatar.js` | People's avatars (their picture, else initials) and colors, and folders' colors |
|
|
245
251
|
| `running-board.js` | Running now, in the conversation's place: the server's `running/board` every 2 seconds, the Coming up timeline (a lane per session, schedules as marks, how long each has been at work), the filters, the session matrix (Now and Schedule), Needs you, Next up, the schedule selected, and the phone's layout |
|
|
246
252
|
| `subagents-board.js` | The subagents board: every subagent in every session (the server's `subagents` events, while it shows), soft state-colored cells and rounded session rows, a sub-tile for each at work saying what it does now, the proportional state bar and filter pills, Needs you, the selected detail card (its peek), the arrows, and the phone's layout |
|
|
@@ -253,11 +259,12 @@ Plain ES modules, loaded as they are. `math.js` finds Markdown math delimiters;
|
|
|
253
259
|
| `share.js` | Share to Pi |
|
|
254
260
|
| `ui.js` | htm binding, Markdown (code blocks colored and labeled, split into parts around the blocks `rich.js` draws), formatting, icons, `Sheet` and its optional `SheetBack` context, `Switch`, `Keys`, `item` (a menu row), `usePresence` (animate out), `drawnFor` (draws again only for some store keys), `memo` (draws again only for new props), `useMinute` (a minute tick), `WIDE` and `NO_HOVER` (media queries that draw the app again), `useSlide` (sliding indicators), `useSide` (which side of the screen a region a theme may move is on), `railState`. Shared controls and inset `.sheet-list` groups are styled in `style.css` |
|
|
255
261
|
| `app-icon.js` | The icons in the colors in use (`iconSvg` draws `icon.svg` from a palette's variables): the tab's icon, the home-screen icon; `theme.js` calls it each time the look applies |
|
|
256
|
-
| `theme.js` | Appearance: the theme (a theme folder's stylesheets in the theme layer, swapped in as they change), the colors (palettes as CSS variables in the palette layer, a folder's own, Follow desktop), tiling, motion, text size, sidebar shape, pins; the reveal; the cache `index.html` paints from; the owner's default theme and colors for browsers whose person has not chosen
|
|
262
|
+
| `theme.js` | Appearance: the theme (a theme folder's stylesheets in the theme layer, swapped in as they change), the colors (palettes as CSS variables in the palette layer, a folder's own, Follow desktop), tiling, motion, text size, sidebar shape, where PiP opens (`pip`: `"floating"`, the default, or `"board"`), pins; the reveal; the cache `index.html` paints from; the owner's default theme and colors for browsers whose person has not chosen |
|
|
257
263
|
| `themes.js` | Omarchy's themes as palettes, generated from `/usr/share/omarchy/themes/*/colors.toml`. `themes/<id>/` holds the built-in theme folders (Pocket and Lantern); `theme-surface.js` lists the tokens and parts themes may rely on; `safe-mode.js` is `?noext=1` |
|
|
258
264
|
| `launcher.js` | The Ctrl/⌘+K launcher: search-type pills, local fuzzy matches and field highlights, leading result tiles and session status pills, live theme previews, combobox selection, focus isolation, and a New session action for each favorite folder (named as `sheets/folder.js` names them); `app.js` gives every logical opening a fresh identity |
|
|
259
|
-
| `pip.js` | PiP's panel over every screen (a rounded floating window in the corner, a bottom sheet on phones), fed by `pipview` events while open; its
|
|
265
|
+
| `pip.js` | PiP's panel over every screen (a rounded floating window in the corner, a bottom sheet on phones), fed by `pipview` events while open (`pipOpen`); with Appearance → PiP → Board, `openPip` instead opens PiP's conversation in the session's place with `navigate` (`pipBoard`, `pipShown`), `closePip` goes back to what was there, and a change of the setting moves it; its one file/image message box (in the panel, and as a board, `PipBoardBox`, in the session composer's place) with the all-project pending-memory shortcut over it, its rail button, the mark that shows while it works or has news, and `openPip`, `askPip`, `togglePip` for the places, the launcher, `/pip`, and Alt+A |
|
|
260
266
|
| `pip-attachments.js` | PiP's browser-only text/file draft controller: account/conversation scoping, uploads, object URLs, and submit tokens; drafts survive panel closes and stale callbacks cannot change newer drafts |
|
|
267
|
+
| `panel-layout.js` | Which panel each session shows beside its conversation (an extension's, Browser, Files and its tab, People), kept for the tab and the device, so a session shows again what it showed when it was left; `store.js` keeps and reads it |
|
|
261
268
|
| `browser.js` | Whether the Browser panel is open, and opening an address in it |
|
|
262
269
|
| `browser-panel.js` | The Browser panel: frames by long polling, taps, drags, wheel, and keys as input events, the live address bar, sizes, the console, the start screen's local-server list |
|
|
263
270
|
| `files-panel.js` | The Files tile: whether it is open and on which tab, the folder's tree (folders read as they open), Go to file, the open file beside the tree, and the Changes tab |
|
package/docs/systemd.md
CHANGED
|
@@ -24,6 +24,8 @@ The access mode also needs its own tools:
|
|
|
24
24
|
- `tailscale`: Tailscale connected (`tailscale up`). Listens on the Tailscale address only.
|
|
25
25
|
- `tailscale-serve`: Tailscale 1.52 or newer, `tailscaled` running, HTTPS certificates enabled in the tailnet, and the service user as its operator (`sudo tailscale set --operator=pi-pocket`, unless the service runs as root). The launcher adds the mapping and removes one it made. It also removes one that a crashed run made, which it knows by its receipt (`serve-mount.json` in the data folder). When it cannot, a start in another mode on that port stops and says how to free it, as the mapping would keep the app on the tailnet. A mapping with no receipt, such as one you made yourself, is left where it is: free it by hand with `tailscale serve --https=443 --set-path=/ off` if you need to.
|
|
26
26
|
|
|
27
|
+
The unit starts after `tailscaled` but does not start it, as the other modes do not need it: for `tailscale` and `tailscale-serve`, keep `tailscaled` enabled.
|
|
28
|
+
|
|
27
29
|
Provider sign-in does not need a terminal: sign in from the app's Providers sheet after the first start.
|
|
28
30
|
|
|
29
31
|
## Install
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-pocket",
|
|
3
|
-
"version": "0.28.0
|
|
3
|
+
"version": "0.28.0",
|
|
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.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@earendil-works/chord": "1.5.0",
|
package/package.json
CHANGED
|
@@ -73,6 +73,9 @@ function modesOf(collections: Map<string, Collection>, darkFirst: boolean) {
|
|
|
73
73
|
const collectionOf = new Map<string, string>();
|
|
74
74
|
const baseOf = new Map<string, string>();
|
|
75
75
|
const byId = new Map<string, { name: string; collection: string }>();
|
|
76
|
+
// A collection's modes by the name they take: an alias across collections reads the target's
|
|
77
|
+
// mode of the same name.
|
|
78
|
+
const named = new Map<string, Map<string, string>>();
|
|
76
79
|
const home = darkFirst ? "dark" : "light";
|
|
77
80
|
|
|
78
81
|
for (const collection of collections.values()) {
|
|
@@ -89,6 +92,7 @@ function modesOf(collections: Map<string, Collection>, darkFirst: boolean) {
|
|
|
89
92
|
: (others.find((mode) => modeNameOf(mode.name) === "dark") ??
|
|
90
93
|
others.find((mode) => isDarkMode(mode.name)));
|
|
91
94
|
const taken = new Set([home, "dark"]);
|
|
95
|
+
const names = new Map<string, string>();
|
|
92
96
|
|
|
93
97
|
collectionOf.set(collection.id, collection.id);
|
|
94
98
|
|
|
@@ -108,24 +112,32 @@ function modesOf(collections: Map<string, Collection>, darkFirst: boolean) {
|
|
|
108
112
|
}
|
|
109
113
|
|
|
110
114
|
taken.add(name);
|
|
115
|
+
names.set(name, mode.id);
|
|
111
116
|
byId.set(mode.id, { name, collection: collection.id });
|
|
112
117
|
}
|
|
118
|
+
|
|
119
|
+
named.set(collection.id, names);
|
|
113
120
|
}
|
|
114
121
|
|
|
115
|
-
return { collectionOf, baseOf, byId };
|
|
122
|
+
return { collectionOf, baseOf, byId, named };
|
|
116
123
|
}
|
|
117
124
|
|
|
118
125
|
interface Lookup {
|
|
119
126
|
named: Map<string, Shaped>;
|
|
120
127
|
byKey: Map<string, string>;
|
|
121
128
|
byId: Map<string, FigVariable>;
|
|
122
|
-
/** The
|
|
123
|
-
|
|
129
|
+
/** The name a mode takes in the tokens; none for a collection's default mode. */
|
|
130
|
+
nameOf: (mode: string) => string | undefined;
|
|
131
|
+
/** The mode of a variable that the tokens' mode `name` reads: that mode, or its default. */
|
|
132
|
+
modeIn: (variable: FigVariable, name: string | undefined) => string;
|
|
124
133
|
}
|
|
125
134
|
|
|
135
|
+
// A copy reads each variable on the way in the tokens' mode `name`, as the engine reads a
|
|
136
|
+
// reference: a collection without that mode, on the way or at the start, reads its default.
|
|
126
137
|
function literalOf(
|
|
127
138
|
variable: FigVariable,
|
|
128
139
|
mode: string,
|
|
140
|
+
name: string | undefined,
|
|
129
141
|
look: Lookup,
|
|
130
142
|
depth = 0,
|
|
131
143
|
): FigValue | undefined {
|
|
@@ -139,10 +151,15 @@ function literalOf(
|
|
|
139
151
|
|
|
140
152
|
return target === undefined || depth >= 8
|
|
141
153
|
? undefined
|
|
142
|
-
: literalOf(target, look.modeIn(target,
|
|
154
|
+
: literalOf(target, look.modeIn(target, name), name, look, depth + 1);
|
|
143
155
|
}
|
|
144
156
|
|
|
145
|
-
function valueOf(
|
|
157
|
+
function valueOf(
|
|
158
|
+
variable: FigVariable,
|
|
159
|
+
mode: string,
|
|
160
|
+
look: Lookup,
|
|
161
|
+
name = look.nameOf(mode),
|
|
162
|
+
): Obj | undefined {
|
|
146
163
|
let found = variable.values.get(mode);
|
|
147
164
|
const shape = look.named.get(variable.id);
|
|
148
165
|
|
|
@@ -164,7 +181,7 @@ function valueOf(variable: FigVariable, mode: string, look: Lookup): Obj | undef
|
|
|
164
181
|
}
|
|
165
182
|
|
|
166
183
|
// The engine refuses an alias to another type (a spacing to a number): copy the value.
|
|
167
|
-
found = literalOf(variable, mode, look);
|
|
184
|
+
found = literalOf(variable, mode, name, look);
|
|
168
185
|
}
|
|
169
186
|
|
|
170
187
|
if (found === undefined) {
|
|
@@ -263,10 +280,18 @@ export function figTokens(
|
|
|
263
280
|
named,
|
|
264
281
|
byKey,
|
|
265
282
|
byId: new Map(list.map((each) => [each.id, each])),
|
|
266
|
-
|
|
283
|
+
nameOf: (mode) => modes.byId.get(mode)?.name,
|
|
284
|
+
modeIn: (variable, name) => {
|
|
285
|
+
const collection = modes.collectionOf.get(variable.collection) ?? variable.collection;
|
|
286
|
+
const same = name === undefined ? undefined : modes.named.get(collection)?.get(name);
|
|
287
|
+
|
|
288
|
+
return same !== undefined && variable.values.has(same) ? same : baseIn(variable);
|
|
289
|
+
},
|
|
267
290
|
};
|
|
268
291
|
const entries: { path: string[]; node: Obj }[] = [];
|
|
269
292
|
const changes = new Map<string, Map<string, Obj>>();
|
|
293
|
+
// The values that read another variable, which can change in a mode their collection has not.
|
|
294
|
+
const reads: { variable: FigVariable; path: string; value: Obj }[] = [];
|
|
270
295
|
|
|
271
296
|
for (const variable of list) {
|
|
272
297
|
const shape = named.get(variable.id);
|
|
@@ -285,6 +310,10 @@ export function figTokens(
|
|
|
285
310
|
|
|
286
311
|
entries.push({ path: shape.path, node: value });
|
|
287
312
|
|
|
313
|
+
if (variable.values.get(base)?.kind === "alias") {
|
|
314
|
+
reads.push({ variable, path: shape.path.join("."), value });
|
|
315
|
+
}
|
|
316
|
+
|
|
288
317
|
for (const modeId of variable.values.keys()) {
|
|
289
318
|
const mode = modeId === base ? undefined : modes.byId.get(modeId);
|
|
290
319
|
|
|
@@ -340,6 +369,19 @@ export function figTokens(
|
|
|
340
369
|
.sort(([a], [b]) => Number(b === "dark") - Number(a === "dark"))
|
|
341
370
|
.slice(0, SYSTEM.modes);
|
|
342
371
|
|
|
372
|
+
// A reference changes in each mode of what it reads, and so does a copy (`literalOf`).
|
|
373
|
+
for (const { variable, path, value } of reads) {
|
|
374
|
+
for (const [mode, tree] of kept) {
|
|
375
|
+
const changed = tree.has(path)
|
|
376
|
+
? undefined
|
|
377
|
+
: valueOf(variable, look.modeIn(variable, mode), look, mode);
|
|
378
|
+
|
|
379
|
+
if (changed !== undefined && JSON.stringify(changed) !== JSON.stringify(value)) {
|
|
380
|
+
tree.set(path, changed);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
343
385
|
for (const [mode, tree] of kept) {
|
|
344
386
|
if (mode !== "dark") {
|
|
345
387
|
extra[mode] = dropTypes(fill(tree, renamed));
|
|
@@ -535,6 +535,13 @@ export function designSystemTool(): ToolRegistration {
|
|
|
535
535
|
});
|
|
536
536
|
|
|
537
537
|
if (args.apply !== true) {
|
|
538
|
+
// An apply of a scan with no style files is refused below: do not offer one.
|
|
539
|
+
if (scan.files.length === 0) {
|
|
540
|
+
return text(
|
|
541
|
+
`${report}\n\nNothing was saved. The scan read no style files in ${path}, so an apply would be refused: point path at the folder with the project's styles.`,
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
|
|
538
545
|
const call = JSON.stringify({
|
|
539
546
|
action: "resync",
|
|
540
547
|
apply: true,
|
|
@@ -342,11 +342,17 @@ export class ExtensionCommands {
|
|
|
342
342
|
);
|
|
343
343
|
const outcome = completed.state.outcome;
|
|
344
344
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
345
|
+
// A run that ended with no result failed, as one whose handler threw: an answer that says so, which a browser
|
|
346
|
+
// does not take for a lost one (its next send of the same command is a new request, and runs it again).
|
|
347
|
+
return {
|
|
348
|
+
taskId: Number(taskId),
|
|
349
|
+
...(outcome.result ?? {
|
|
350
|
+
status: "failed",
|
|
351
|
+
type: "toast",
|
|
352
|
+
level: "error",
|
|
353
|
+
message: "The command could not finish, and may have done part of its work.",
|
|
354
|
+
}),
|
|
355
|
+
};
|
|
350
356
|
}
|
|
351
357
|
|
|
352
358
|
/** The task of a request sent before, when it asked for the same; a 409 when the request id was used otherwise. */
|
|
@@ -20,6 +20,7 @@ You work in the conversation's working directory. Your work is durable: after a
|
|
|
20
20
|
const GUIDELINES = `- Keep replies short and easy to read on a small screen. Lead with the answer; use short paragraphs, lists, and small code blocks.
|
|
21
21
|
- Look at files with read, not cat or sed. Use edit for precise changes and write for new files or full rewrites.
|
|
22
22
|
- Show file paths clearly.
|
|
23
|
+
- Before you say work is done, check it: run its tests, build, or app, and read the result. Say plainly what you did not check; never claim a check you did not run.
|
|
23
24
|
- To show an image file from this machine, embed it: . Files the user attaches are saved on the server; the message lists their paths.
|
|
24
25
|
- Before something destructive or irreversible, say what it will do. A guard may ask a human to approve risky commands; if a call is blocked, do not try to get around the block.
|
|
25
26
|
- A message with the marker "[via PiP]" or "[via linked session …]" at its start (after any "[from: Name]" or "[scheduled]") comes from another agent. Write your answer to it, and what you send back to that agent, in the language that agent wrote in (for a linked session, the text between the <linked-session-message> tags), not the language of the marker or the notes around it. In English, use ASD-STE100 (Simplified Technical English) at about 80% adherence: short sentences (25 words or fewer), one idea each, main point first, active voice, simple tenses, articles kept, no contractions or idioms, "must" for a rule and "can" for an ability, numerals, one word for one thing, names of commands, files, and identifiers exact in backticks, every fact kept. In another language, keep the same short, plain style. Answer messages without the marker as usual, also later in the same session.`;
|
package/src/server/main.ts
CHANGED
|
@@ -35,6 +35,7 @@ function parseArgs(argv: string[]) {
|
|
|
35
35
|
cwd: process.cwd(),
|
|
36
36
|
data: dataDir(),
|
|
37
37
|
rotateToken: false,
|
|
38
|
+
keepAliveSeconds: Number(process.env.PI_POCKET_KEEPALIVE_SECONDS?.trim() || 5),
|
|
38
39
|
};
|
|
39
40
|
|
|
40
41
|
for (let index = 0; index < argv.length; index++) {
|
|
@@ -74,6 +75,16 @@ function parseArgs(argv: string[]) {
|
|
|
74
75
|
throw new Error("--port must be a number");
|
|
75
76
|
}
|
|
76
77
|
|
|
78
|
+
if (
|
|
79
|
+
!Number.isInteger(options.keepAliveSeconds) ||
|
|
80
|
+
options.keepAliveSeconds < 1 ||
|
|
81
|
+
options.keepAliveSeconds > 3600
|
|
82
|
+
) {
|
|
83
|
+
throw new Error(
|
|
84
|
+
"PI_POCKET_KEEPALIVE_SECONDS must be a whole number of seconds from 1 to 3600",
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
77
88
|
return options;
|
|
78
89
|
}
|
|
79
90
|
|
|
@@ -163,6 +174,10 @@ const server = createServer((request, response) => {
|
|
|
163
174
|
// and long polls are GET requests without a body, so their time on the connection does not count.
|
|
164
175
|
server.requestTimeout = 15 * 60_000;
|
|
165
176
|
server.headersTimeout = 60_000;
|
|
177
|
+
// How long an idle connection stays open for its next request: Node's 5 seconds by default. A reverse proxy
|
|
178
|
+
// that keeps idle connections longer can send a request on one as it closes here, and answers with a 502.
|
|
179
|
+
// The timeouts above count from a request's first byte, not from the idle time before it.
|
|
180
|
+
server.keepAliveTimeout = options.keepAliveSeconds * 1000;
|
|
166
181
|
|
|
167
182
|
// Take the port before opening the database: opening resumes interrupted work, which must not start in a process
|
|
168
183
|
// that then exits because it cannot serve.
|
package/types/pocket.d.ts
CHANGED
|
@@ -1014,7 +1014,7 @@ export interface LinkedSession {
|
|
|
1014
1014
|
* A human-facing linked session that the authenticated person can see.
|
|
1015
1015
|
* @since 0.16.0
|
|
1016
1016
|
*/
|
|
1017
|
-
export interface HumanLinkedSession extends LinkedSession {
|
|
1017
|
+
export interface HumanLinkedSession extends Omit<LinkedSession, "failed"> {
|
|
1018
1018
|
/**
|
|
1019
1019
|
* Its id, for pocket.openConversation. Other metadata keeps LinkedSession's audience rules.
|
|
1020
1020
|
* @since 0.16.0
|