pi-pocket 0.27.0-beta.7 → 0.27.0-beta.8
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/examples/design-system/README.md +1 -1
- package/docs/examples/design-system/pocket/.pi/design/guidelines.md +1 -1
- package/docs/features.md +3 -3
- package/docs/map.md +24 -30
- package/package.json +1 -2
- package/src/server/design/color.ts +25 -543
- package/src/server/design/docsite-color-section.ts +99 -197
- package/src/server/design/docsite-components.ts +40 -45
- package/src/server/design/docsite-core.ts +171 -302
- package/src/server/design/docsite-css.ts +267 -0
- package/src/server/design/docsite-js.ts +215 -0
- package/src/server/design/docsite-markdown.ts +0 -14
- package/src/server/design/docsite-reference.ts +74 -212
- package/src/server/design/docsite-space.ts +75 -231
- package/src/server/design/docsite-type.ts +146 -114
- package/src/server/design/docsite.ts +208 -339
- package/src/server/design/fix.ts +63 -15
- package/src/server/design/lint-analyze-system.ts +22 -8
- package/src/server/design/lint-color.ts +26 -3
- package/src/server/design/scan-categorize.ts +41 -56
- package/src/server/design/scan-colors.ts +608 -15
- package/src/server/design/scan-facts-files.ts +71 -198
- package/src/server/design/scan-facts-use.ts +131 -323
- package/src/server/design/scan-facts.ts +90 -94
- package/src/server/design/scan-files.ts +62 -196
- package/src/server/design/scan-import-convert.ts +29 -60
- package/src/server/design/scan-import-eval.ts +85 -352
- package/src/server/design/scan-import.ts +414 -139
- package/src/server/design/scan-infer.ts +73 -57
- package/src/server/design/scan-palette.ts +52 -135
- package/src/server/design/scan-parse.ts +140 -561
- package/src/server/design/scan-prepare.ts +142 -151
- package/src/server/design/scan-render-pages.ts +76 -89
- package/src/server/design/scan-render-probe.ts +7 -17
- package/src/server/design/scan-render.ts +101 -146
- package/src/server/design/scan-roles.ts +492 -162
- package/src/server/design/scan-scales.ts +223 -479
- package/src/server/design/scan-tailwind.ts +93 -0
- package/src/server/design/scan-tree.ts +29 -99
- package/src/server/design/scan-variables.ts +198 -182
- package/src/server/design/scan.ts +150 -291
- package/src/server/design/system.ts +34 -104
- package/src/server/design/tokens-model-defs.ts +7 -1
- package/src/server/extensions/design/canvas.js +1 -1
- package/src/server/extensions/design/check.js +25 -31
- package/src/server/extensions/design/color.d.ts +29 -0
- package/src/server/extensions/design/color.js +398 -252
- package/src/server/extensions/design/parts.js +3 -3
- package/src/server/extensions/design/style.css +16 -79
- package/src/server/extensions/design/system-api.ts +11 -18
- package/src/server/extensions/design/system-routes.ts +337 -433
- package/src/server/extensions/design/system-sections.js +361 -482
- package/src/server/extensions/design/system-view.js +151 -246
- package/src/server/extensions/design/system-widgets.js +245 -307
- package/src/server/extensions/design/system.css +121 -304
- package/src/server/extensions/design/system.js +17 -32
- package/src/server/extensions/design/workspace.js +1 -1
- package/docs/design/design-system.md +0 -165
- package/docs/examples/design-system/pocket/.pi/design/dist/components.css +0 -730
- package/docs/examples/design-system/pocket/.pi/design/dist/names.md +0 -495
- package/docs/examples/design-system/pocket/.pi/design/dist/tailwind.css +0 -1132
- package/docs/examples/design-system/pocket/.pi/design/dist/tokens.css +0 -1126
- package/docs/examples/design-system/pocket/.pi/design/dist/tokens.dark.resolved.json +0 -2022
- package/docs/examples/design-system/pocket/.pi/design/dist/tokens.high-contrast.resolved.json +0 -2022
- package/docs/examples/design-system/pocket/.pi/design/dist/tokens.light.resolved.json +0 -2022
- package/docs/examples/design-system/pocket/.pi/design/dist/tokens.resolved.json +0 -371
- package/docs/examples/design-system/pocket/.pi/design/dist/tokens.studio.json +0 -5915
- package/src/server/design/check-cli.ts +0 -266
- package/src/server/design/docsite-assets.ts +0 -21
- package/src/server/design/docsite-color.ts +0 -267
- package/src/server/design/docsite-css-base.ts +0 -395
- package/src/server/design/docsite-css-content.ts +0 -474
- package/src/server/design/docsite-css-phone.ts +0 -246
- package/src/server/design/docsite-css-reference.ts +0 -363
- package/src/server/design/docsite-css-specimens.ts +0 -463
- package/src/server/design/docsite-js-code.ts +0 -90
- package/src/server/design/docsite-js-core.ts +0 -69
- package/src/server/design/docsite-js-demos.ts +0 -22
- package/src/server/design/docsite-js-links.ts +0 -22
- package/src/server/design/docsite-js-nav.ts +0 -68
- package/src/server/design/docsite-js-stages.ts +0 -78
- package/src/server/design/docsite-js-table.ts +0 -78
- package/src/server/design/docsite-motion.ts +0 -110
- package/src/server/design/docsite-shadows.ts +0 -38
- package/src/server/design/scan-braces.ts +0 -109
- package/src/server/design/scan-channels.ts +0 -102
- package/src/server/design/scan-color-base.ts +0 -191
- package/src/server/design/scan-color-names.ts +0 -397
- package/src/server/design/scan-color-palette.ts +0 -85
- package/src/server/design/scan-color-roles.ts +0 -552
- package/src/server/design/scan-facts-antd.ts +0 -157
- package/src/server/design/scan-facts-lists.ts +0 -502
- package/src/server/design/scan-facts-sass.ts +0 -105
- package/src/server/design/scan-facts-theme.ts +0 -377
- package/src/server/design/scan-facts-wordpress.ts +0 -359
- package/src/server/design/scan-import-material.ts +0 -691
- package/src/server/design/scan-import-sd-config.ts +0 -338
- package/src/server/design/scan-import-sd.ts +0 -408
- package/src/server/design/scan-import-studio.ts +0 -220
- package/src/server/design/scan-js-eval.ts +0 -1235
- package/src/server/design/scan-review.ts +0 -47
- package/src/server/design/scan-sass-colors.ts +0 -264
- package/src/server/design/scan-sass-eval.ts +0 -228
- package/src/server/design/scan-sass-expr.ts +0 -878
- package/src/server/design/scan-sass-modules.ts +0 -313
- package/src/server/design/scan-sass-run.ts +0 -969
- package/src/server/design/scan-sass-stmt.ts +0 -242
- package/src/server/design/scan-sass-values.ts +0 -853
- package/src/server/design/scan-theme-shapes.ts +0 -559
- package/src/server/design/scan-util.ts +0 -37
- package/src/server/design/system-schema.ts +0 -51
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Example design system: Pi Pocket
|
|
2
2
|
|
|
3
|
-
`pocket/.pi/design/` is Pi Pocket's own design system, written the way Design mode expects it (see [
|
|
3
|
+
`pocket/.pi/design/` is Pi Pocket's own design system, written the way Design mode expects it (see the design system in [features.md](../../features.md)). It is the reference for the file format and a ready system to try.
|
|
4
4
|
|
|
5
5
|
| File | What it holds |
|
|
6
6
|
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -64,7 +64,7 @@ Pi Pocket looks like a tiling window manager that learned to be gentle: soft til
|
|
|
64
64
|
## Using the system
|
|
65
65
|
|
|
66
66
|
- Link `ds/tokens.css` and use `var(--…)` for every color, size, space, radius, shadow, and duration.
|
|
67
|
-
- Reuse a component from `components/` before you write a new one. Copy its markup and its classes.
|
|
67
|
+
- Reuse a component from `components/` before you write a new one. Copy its markup and its classes. Link `ds/components.css` for the CSS of every component.
|
|
68
68
|
- For dark mode, set `data-theme="dark"` on the root. The system also follows `prefers-color-scheme`.
|
|
69
69
|
- A design that needs a value the system does not have asks for a new token. It does not invent one in place.
|
|
70
70
|
|
package/docs/features.md
CHANGED
|
@@ -70,10 +70,10 @@ The full tour. For setup, see the [README](../README.md).
|
|
|
70
70
|
- **Variations.** Artifacts of one group show as a grid of live thumbnails. **Use this one** puts a message about it in the message box.
|
|
71
71
|
- **Export and share.** PNG, PDF, PPTX (decks), and an HTML zip, from the menu. The file is written in the session's `exports/` folder and the browser downloads it. **Share a link** is the artifact viewer's Share. There is no Canva export.
|
|
72
72
|
- **What Pi does.** Its guide (a prompt section, only while the module is on) gives Pi an order of work, after Claude Design's (since 0.27.0): one round of questions when the work is new or unclear, then a start from what exists (the design system, the code, the screens) rather than a mock from scratch, a first version early, iterations, a check, and a short reply. A screen that exists is redesigned from itself: Pi reads its code and data first, makes version 1 the screen as it is today (in its place in the app, compared with a screenshot of the real one when it can get one), and then changes it in new versions, within what the code supports; a change that needs new data or server work is marked in the design and named in the reply, and a different direction becomes a new artifact in the same group. The product's own type sizes, spacing, and density win over the guide's craft defaults. It also gives Pi a page skeleton and craft rules: one HTML artifact for each design, `data-pid` on meaningful elements, a tweaks manifest of 3 to 8 knobs bound to the system's tokens, assets for images and fonts, variations as a group of 2 to 4 artifacts, a link to `ds/tokens.css` when the project has a design system, and a check with `design_preview` before it replies. When the project has a system, the guide carries a summary of it (roles and components first) as untrusted project data. Its tools: `design_preview` renders a version in a private headless Chromium (never the browser people watch) at mobile and desktop sizes, or the sizes asked for, and returns screenshots and a short report (see **Checks**); its options are `checks` (on by default), `tweaks`, `colorScheme`, `page` (another page of the bundle), and `actions` (hover, click, or focus on a selector before the screenshot). `design_export` writes PNG, PDF, PPTX, or an HTML zip, by default as `exports/<id>-v<version>.<ext>`, and refuses a path outside the session's folder; it also takes `tweaks`, a custom `viewport`, and, for a deck's PNG, `slide` (a number, or `"all"` for a zip of every slide). A page's PDF is as wide as its viewport, and PPTX slide images have twice the pixels. `design_system` reads, scans, and changes the project's design system (see **The design system**). The private renderer serves the bundle on a loopback address under a random path and gives Chromium no sign-in; other requests go through `host.fetchPublic`, so a design reaches only public addresses. Renders run 2 at once, and more wait their turn; each has 90 seconds.
|
|
73
|
-
- **The design system.** A project's design system lives in `.pi/design/` in the session's folder: `tokens.json` (W3C Design Tokens, DTCG: groups, `$value`, `$type`, references such as `{color.blue.500}`, tiers for primitives, semantic roles, and component tokens), `tokens.<mode>.json` for each other mode (dark, high contrast, a brand), `components/<slug>.html` (a component specimen with its states), and `guidelines.md`. Pi Pocket checks it (broken or circular references, raw values in semantic roles, declared contrast pairs in every mode) and builds `dist/`: `tokens.css` (`:root`, a `[data-theme]` block for each mode, and a `prefers-color-scheme` block), `tailwind.css` (a Tailwind v4 `@theme`, with utilities such as `bg-surface` and `text-primary`), `tokens.<mode>.resolved.json` (DTCG, one for each mode), `tokens.studio.json` (Tokens Studio), `tokens.resolved.json` (a compact summary), and `components.css`. A design that links `ds/tokens.css`, `ds/tailwind.css`, or `ds/components.css` gets the current files as assets when Pi publishes it, a snapshot kept with that version. Pi's `design_system` tool has the actions `scan` (a structured draft from the project's style files: colors in every CSS syntax, roles, the type, spacing, and radius scales, shadows,
|
|
73
|
+
- **The design system.** A project's design system lives in `.pi/design/` in the session's folder: `tokens.json` (W3C Design Tokens, DTCG: groups, `$value`, `$type`, references such as `{color.blue.500}`, tiers for primitives, semantic roles, and component tokens), `tokens.<mode>.json` for each other mode (dark, high contrast, a brand), `components/<slug>.html` (a component specimen with its states), and `guidelines.md`. Pi Pocket checks it (broken or circular references, raw values in semantic roles, declared contrast pairs in every mode) and builds `dist/`: `tokens.css` (`:root`, a `[data-theme]` block for each mode, and a `prefers-color-scheme` block), `tailwind.css` (a Tailwind v4 `@theme`, with utilities such as `bg-surface` and `text-primary`), `tokens.<mode>.resolved.json` (DTCG, one for each mode), `tokens.studio.json` (Tokens Studio), `tokens.resolved.json` (a compact summary), and `components.css`. A design that links `ds/tokens.css`, `ds/tailwind.css`, or `ds/components.css` gets the current files as assets when Pi publishes it, a snapshot kept with that version. Pi's `design_system` tool has the actions `scan` (a structured draft from the project's style files: colors in every CSS syntax, roles, the type, spacing, and radius scales, shadows, breakpoints, and dark mode, from CSS custom properties and rules in CSS, SCSS, Less, and page style blocks, Sass and Less variables with literal values, Tailwind's `@theme` and a `tailwind.config` theme read as a literal, and DTCG, Style Dictionary, and Tokens Studio JSON files; a browser renders the project's pages to fill in what the files leave out), `init` (from a scan or given tokens; it refuses to replace a system unless asked), `set`, `validate`, `compile`, `component`, `guidelines`, and the 0.26 `read` and `write`. A project with only `.pi/design-system.md` (the 0.26 format) keeps working.
|
|
74
74
|
- **The System view.** The first row of the design picker (or `/design-open system`, or the launcher's "Open the design system") shows the system: **Colors** (role cards with contrast badges first, a live sample card, and the palette as ramp strips in a folded group), **Type**, **Spacing**, **Radii**, **Shadows** (each with its value), **Motion** (durations and easings that play), **Components** (every state, in a frame that runs nothing and loads nothing), and **Guidelines**. A section's count is its role tokens; the palette and component tokens show their own counts inside it. Modes show one at a time or side by side, and a mode's value says whether it is its own or inherited from the default. People who steer change a color, a size, a time, a weight, a font, an easing, or a shadow's layers in place, or link a token to another; the open design shows each change live when it uses the system's variables. The editor lists every contrast pair of a color (an exempt pair shows as exempt, not as a failure). **Undo** and **Redo** step through the changes, **Discard** gives them up, and **Save** writes the files and the generated CSS with no run of Pi (it refuses a change that the checks refuse, or one made on a system that changed meanwhile). The menu publishes the documentation page as a design, exports the generated files as a zip, and adds or removes a mode. People who only view see everything and change nothing. **Focus mode** hides the conversation for wide work. On a phone, the canvas fits the screen's width, and until a size is chosen it takes the size of its panel. The Design module loads only a small shell at app start; the workspace and the System view load when first opened.
|
|
75
|
-
- **Checks.** A design's **Check** tab
|
|
76
|
-
- **The documentation page.** The System view's menu (and `design_system`) makes a documentation page of the system as a design: navigation, a filter of names and values, and links to every section; color roles with their values, contrast, and copy buttons for the CSS variable
|
|
75
|
+
- **Checks.** A design's **Check** tab and `design_preview` render the page on the server and judge only what the author's CSS sets, never the browser's defaults. They report values that are not the system's (colors, fonts, and sizes, each with the exact CSS edit and the nearest token of the matching role), contrast (WCAG 2.2 AA, judged only where the background is certain), non-text contrast of focus rings and icon buttons (3:1), tap targets (an error under 24 px, a warning under 44 px), sideways overflow, image alt text, heading order, a missing `lang`, form controls with no label (a placeholder is not a label), links, buttons, and widgets with no accessible name, no `main` landmark, fonts that did not load, a missing viewport tag, missing `data-pid`s, elements with no visible focus style, long motion with no `prefers-reduced-motion` rule, and author-set input text under 16 px on a phone. A check runs in any mode of the system. The tab follows the mode and size on the canvas, puts a pin on each element, and **Send to Pi** puts one message with every finding in the message box. **Fix N exact matches** rewrites literals that equal a token exactly to `var(--token)` and saves a new version with no run of Pi. On a phone, the tab starts as a bar with the counts, so the page keeps most of the screen.
|
|
76
|
+
- **The documentation page.** The System view's menu (and `design_system`) makes a documentation page of the system as a design: navigation, a filter of names and values, and links to every section; color roles with their values, contrast, and copy buttons for the CSS variable and the Tailwind class; the contrast pairs in every mode (exempt pairs labelled); palettes, type specimens, spacing, radii, shadows, and motion demos; component state grids with their code; guidelines; every token with a column for each mode; and a list of the generated files with how to use them. Component states are drawn in shadow roots after an allowlist sanitizer, under a nonce-only script policy, so they paint in screenshots and PDFs and run nothing. It runs in the artifact sandbox with no network, so it can be shared with a link or exported like any design.
|
|
77
77
|
- **Decks.** A deck is a page with `<meta name="pocket-kind" content="deck">` and its slides as `<section class="slide">`, written at 1920×1080 (`<meta name="pocket-slide-size" content="1280x720">` changes that). The canvas shows one slide at a time, scaled to fit, with a slide strip, a full-screen present mode, arrow keys, and swipes, and the page needs no navigation script of its own. PNG, PDF, and PPTX exports use the same slide size. PPTX slides are images with the slide's text as speaker notes, not editable shapes. A deck opened in its own tab or published shows one slide at a time too, and printing it gives one page for each slide.
|
|
78
78
|
- **For page authors.** `data-pid` names an element for comments and pins. The tweaks manifest is `<script type="application/json" id="pocket-tweaks">[…]</script>`, an array of up to 40 knobs `{ name, label?, type: "range" | "color" | "select" | "toggle" | "text", value, min?, max?, step?, unit?, options? }`. A name that starts with `--` sets that CSS custom property on `:root`; any other name reaches the page as a `pocket:tweak` event on `window`. The app speaks to the page through the bridge's `pocket-inspect`, `pocket-edit-text`, `pocket-tweak-set`, `pocket-highlight`, and `pocket-goto` messages, and the page answers with `pocket-picked`, `pocket-text-edited`, `pocket-tweaks`, and `pocket-deck`. Only the app's inspector can send those answers, and the app checks their shape and length before it uses them.
|
|
79
79
|
- **Who.** People who see every session load the module; people who steer comment, edit, tweak, go back, and export; viewers read the canvas, versions, and comments. Someone invited to one session never loads it. While **Take turns** is on, only the driver writes.
|
package/docs/map.md
CHANGED
|
@@ -140,35 +140,29 @@ A module split into parts keeps its name for the part others import, with the re
|
|
|
140
140
|
|
|
141
141
|
The agent's side of Design mode. `extensions/design.ts` installs it (see Extensions below).
|
|
142
142
|
|
|
143
|
-
| File | Owns
|
|
144
|
-
| ----------------------------- |
|
|
145
|
-
| `design/index.ts` | `designTools(host)` (`design_preview`, `design_export`, `design_system`), `designGuide(host)` (the prompt section), and `designRoutes(web, host)` (`POST /api/x/design/c/:conversation/export`, steer access)
|
|
146
|
-
| `design/bundle.ts` | `readBundle`: a version's page and assets from the artifact documents, by hash, in a tool call or a route (no `PocketApp` reader)
|
|
147
|
-
| `design/render.ts` | Private headless Chromium renders: a process and profile for each render, a loopback endpoint under a random path that serves one bundle, public fetches only, limits (2 at once, 90 s); deck slide size and slides
|
|
148
|
-
| `design/export.ts` | `saveDesignExport` (shared by the tool and the route): PNG, PDF, PPTX, and the HTML zip, written to `exports/` by default
|
|
149
|
-
| `design/files.ts` | Where an export may be written: inside the session folder, never through a link, replaced atomically
|
|
150
|
-
| `design/pptx.ts` | The PPTX writer: one image for each slide, at the deck's slide size (16:9 by default), with the slide's text as speaker notes, through `zip.ts`
|
|
151
|
-
| `design/system-types.ts` | The shared shapes: `DesignSystem`, `ResolvedToken`, `ComponentSpec`, `SystemChange`, `CheckReport`, `CheckFinding`
|
|
152
|
-
| `design/tokens.ts` | The tokens engine: `loadDesignSystem`, `writeDesignSystem` (validate, atomic writes, rebuild `dist/`), `compileDesignSystem`, `systemSummary`; `tokens-model.ts` (`buildSystem`: the phases in order) with `tokens-model-defs.ts` (definitions and modes), `tokens-model-resolve.ts` (types and references), `tokens-model-checks.ts` (the warnings and contrast), and `tokens-model-report.ts` (the problem list), `tokens-values.ts` (value forms), `tokens-ramps.ts` (the ramp-order warning), `tokens-compile.ts` (`tokens.css`, `components.css`), `tokens-tailwind.ts` (the Tailwind v4 theme), `tokens-names.ts` (the names table, `names.md`), `tokens-dtcg.ts` (the DTCG files for each mode, the 2025.10 forms, and `tokens.studio.json`), `tokens-io.ts` (bounded reads without links), `tokens-summary.ts` (the prompt summary: roles and components first), `tokens-base.ts`
|
|
153
|
-
| `design/components.ts` | Component specimens: `components/<slug>.html` with its metadata, CSS, and one template for each state
|
|
154
|
-
| `design/color.ts` | Color math: every CSS color syntax, OKLab and OKLCH, WCAG luminance and contrast, hex
|
|
155
|
-
| `design/system.ts` | `design_system`: the actions on `.pi/design/` and the 0.26 `.pi/design-system.md`, bounded, read and written without following links, output fenced as project data
|
|
156
|
-
| `design/scan.ts` | `design_system` scan: a bounded walk that follows no link, and the structured draft
|
|
157
|
-
| `design/scan-worker.ts` | The static scan in a worker thread, which `scanProject` starts: the server goes on meanwhile, and a scan past 20 s or a 256 MB heap is stopped
|
|
158
|
-
| `design/scan-render.ts` | The rendered scan: a project's HTML pages shown offline in the private Chromium, once as they are and once in dark mode, and read as the browser computed them; the static scan wins where it is sure, the rendered values fill the rest
|
|
159
|
-
| `design/scan-render-pages.ts` | The pages the rendered scan shows: the project's HTML (and its built output), the files they need, and the custom property names and dark-mode switches the stylesheets name; a bounded walk that follows no link
|
|
160
|
-
| `design/scan-render-probe.ts` | The script that reads a rendered page in an isolated world: only values the author's styles set (it reads the page again with all styles off), as bounded plain data
|
|
161
|
-
| `design/
|
|
162
|
-
| `design/
|
|
163
|
-
| `design/
|
|
164
|
-
| `design/
|
|
165
|
-
| `design/
|
|
166
|
-
| `design/lint.ts` | `checkDesign` and `checkPage`: the page checks of `design_preview`, the Check tab, and the CLI; `lint-page.ts` and `lint-page-*.ts` (the script the page runs, in an isolated world: setup, the author's CSS index, values, elements, states, focus, and page checks), `lint-color.ts` (token sets and OKLab distance); `analyze` calls its phases in `lint-analyze-system.ts` (color, font, size), `lint-analyze-contrast.ts`, `lint-analyze-page.ts`, and `lint-analyze-util.ts` |
|
|
167
|
-
| `design/lint-suggest.ts` | Which token a check suggests for a color: what a token is for, how the page uses the color, and the order of preference |
|
|
168
|
-
| `design/fix.ts` | `applyExactFixes`: one-tap fixes; a literal that equals a token exactly becomes `var(--token)`, only in `<style>` and `style=""`, only where the place is certain |
|
|
169
|
-
| `design/check-cli.ts` | The check for CI (`npm run design:check`): `checkDesign` on an HTML file and a `.pi/design` folder; exit 0 when clean, 1 on an error, 2 on bad arguments or no Chromium |
|
|
170
|
-
| `design/docsite.ts` | `renderSystemDoc`: the documentation page of a system; `docsite-core.ts` (the context, counts, and the nonce CSP), one file for each section (`docsite-color-section.ts`, `docsite-type.ts`, `docsite-space.ts`, `docsite-shadows.ts`, `docsite-motion.ts`, `docsite-components.ts`, `docsite-reference.ts`), `docsite-sanitize.ts` (the allowlist sanitizer and CSS parser for component specimens, drawn in shadow roots), `docsite-css-*.ts` and `docsite-js-*.ts` (the page's style and script, joined in `docsite-assets.ts`), `docsite-color.ts`, `docsite-markdown.ts` |
|
|
171
|
-
| `design/guide.ts` | The prompt section: a page skeleton, craft rules, and the design system's summary as fenced, untrusted data |
|
|
143
|
+
| File | Owns |
|
|
144
|
+
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
145
|
+
| `design/index.ts` | `designTools(host)` (`design_preview`, `design_export`, `design_system`), `designGuide(host)` (the prompt section), and `designRoutes(web, host)` (`POST /api/x/design/c/:conversation/export`, steer access) |
|
|
146
|
+
| `design/bundle.ts` | `readBundle`: a version's page and assets from the artifact documents, by hash, in a tool call or a route (no `PocketApp` reader) |
|
|
147
|
+
| `design/render.ts` | Private headless Chromium renders: a process and profile for each render, a loopback endpoint under a random path that serves one bundle, public fetches only, limits (2 at once, 90 s); deck slide size and slides |
|
|
148
|
+
| `design/export.ts` | `saveDesignExport` (shared by the tool and the route): PNG, PDF, PPTX, and the HTML zip, written to `exports/` by default |
|
|
149
|
+
| `design/files.ts` | Where an export may be written: inside the session folder, never through a link, replaced atomically |
|
|
150
|
+
| `design/pptx.ts` | The PPTX writer: one image for each slide, at the deck's slide size (16:9 by default), with the slide's text as speaker notes, through `zip.ts` |
|
|
151
|
+
| `design/system-types.ts` | The shared shapes: `DesignSystem`, `ResolvedToken`, `ComponentSpec`, `SystemChange`, `CheckReport`, `CheckFinding` |
|
|
152
|
+
| `design/tokens.ts` | The tokens engine: `loadDesignSystem`, `writeDesignSystem` (validate, atomic writes, rebuild `dist/`), `compileDesignSystem`, `systemSummary`; `tokens-model.ts` (`buildSystem`: the phases in order) with `tokens-model-defs.ts` (definitions and modes), `tokens-model-resolve.ts` (types and references), `tokens-model-checks.ts` (the warnings and contrast), and `tokens-model-report.ts` (the problem list), `tokens-values.ts` (value forms), `tokens-ramps.ts` (the ramp-order warning), `tokens-compile.ts` (`tokens.css`, `components.css`), `tokens-tailwind.ts` (the Tailwind v4 theme), `tokens-names.ts` (the names table, `names.md`), `tokens-dtcg.ts` (the DTCG files for each mode, the 2025.10 forms, and `tokens.studio.json`), `tokens-io.ts` (bounded reads without links), `tokens-summary.ts` (the prompt summary: roles and components first), `tokens-base.ts` |
|
|
153
|
+
| `design/components.ts` | Component specimens: `components/<slug>.html` with its metadata, CSS, and one template for each state |
|
|
154
|
+
| `design/color.ts` | Color math: re-exports `extensions/design/color.js` (every CSS color syntax and DTCG color objects, OKLab and OKLCH, WCAG luminance and contrast, hex), the one copy that the server and the System view share, and adds `mixColors` |
|
|
155
|
+
| `design/system.ts` | `design_system`: the actions on `.pi/design/` and the 0.26 `.pi/design-system.md`, its parameters, bounded, read and written without following links, output fenced as project data |
|
|
156
|
+
| `design/scan.ts` | `design_system` scan: a bounded walk that follows no link, and the structured draft, from CSS custom properties and declarations (with dark scopes and channel colors), literal Sass and Less variables, Tailwind (`@theme`, the v3 config's `theme`), and token files (DTCG, Style Dictionary JSON, Tokens Studio); `scan-files.ts` (the walk), `scan-parse.ts`, `scan-facts*.ts` (the facts), `scan-import*.ts` (token files, one reading in `scan-import-eval.ts`), `scan-variables.ts`, `scan-prepare.ts`, `scan-infer.ts` (the phases), `scan-colors.ts`, `scan-roles.ts`, `scan-palette.ts`, `scan-scales.ts`, `scan-categorize.ts`, `scan-tree.ts`, `scan-tailwind.ts` (Tailwind's default palette and the v3 config reader) |
|
|
157
|
+
| `design/scan-worker.ts` | The static scan in a worker thread, which `scanProject` starts: the server goes on meanwhile, and a scan past 20 s or a 256 MB heap is stopped |
|
|
158
|
+
| `design/scan-render.ts` | The rendered scan: a project's HTML pages shown offline in the private Chromium, once as they are and once in dark mode, and read as the browser computed them; the static scan wins where it is sure, the rendered values fill the rest |
|
|
159
|
+
| `design/scan-render-pages.ts` | The pages the rendered scan shows: the project's HTML (and its built output), the files they need, and the custom property names and dark-mode switches the stylesheets name; a bounded walk that follows no link |
|
|
160
|
+
| `design/scan-render-probe.ts` | The script that reads a rendered page in an isolated world: only values the author's styles set (it reads the page again with all styles off), as bounded plain data |
|
|
161
|
+
| `design/lint.ts` | `checkDesign` and `checkPage`: the page checks of `design_preview`, the Check tab, and the CLI; `lint-page.ts` and `lint-page-*.ts` (the script the page runs, in an isolated world: setup, the author's CSS index, values, elements, states, focus, and page checks), `lint-color.ts` (token sets and OKLab distance); `analyze` calls its phases in `lint-analyze-system.ts` (color, font, size), `lint-analyze-contrast.ts`, `lint-analyze-page.ts`, and `lint-analyze-util.ts` |
|
|
162
|
+
| `design/lint-suggest.ts` | Which token a check suggests for a color: what a token is for, how the page uses the color, and the order of preference |
|
|
163
|
+
| `design/fix.ts` | `applyExactFixes`: one-tap fixes; a literal that equals a token exactly becomes `var(--token)`, only in `<style>` and `style=""`, only where the place is certain |
|
|
164
|
+
| `design/docsite.ts` | `renderSystemDoc`: the documentation page of a system; `docsite-core.ts` (the context, counts, and the nonce CSP), one file for each group of sections (`docsite-color-section.ts`, `docsite-type.ts`, `docsite-space.ts`, `docsite-components.ts`, `docsite-reference.ts`), `docsite-sanitize.ts` (the allowlist sanitizer and CSS parser for component specimens, drawn in shadow roots), `docsite-css.ts` and `docsite-js.ts` (the page's one sheet and one script), `docsite-markdown.ts` |
|
|
165
|
+
| `design/guide.ts` | The prompt section: a page skeleton, craft rules, and the design system's summary as fenced, untrusted data |
|
|
172
166
|
|
|
173
167
|
### Elsewhere
|
|
174
168
|
|
|
@@ -192,7 +186,7 @@ Outside `src/`: `flake.nix` and `nix/` build Pi Pocket with Nix (`nix/package.ni
|
|
|
192
186
|
|
|
193
187
|
## Extensions: `src/server/extensions/`
|
|
194
188
|
|
|
195
|
-
Each default-exports `(host: PocketHost, web: ExtensionWeb) => Extension | Extension[] | void` (`web` adds to the app: [extensions/app.md](extensions/app.md)) and is installed in this order: `prompt` (system prompt, with where Pi Pocket's docs are), `artifacts` (the `artifact` and `artifact_inline` tools: one store, `publish`, and bundles: `assets`, `removeAssets`, `group`, `kind`), `browser` (browser tool and its prompt section; through `host.browsers`), `subagents` (subagent tool and its tasks: anchors, reporters, and the courier that sends waiting reports to the parent together; a subagent runs on its session's model, or one the owner allowed, and the app rebuilds the module when that list changes), `agent-teams` (Agent Teams, off by default: the `team` tool and its prompt section, through `host.linkedSessions`; its browser module `agent-teams.js` describes the tool's calls with `pocket.toolCall`; it imports of Pi Pocket's only types and `model-facts.ts`, a pure helper that formats model facts), `schedules` (schedule tool and its four limits, as settings; installs the schedule task), `background` (the background tool and its one setting, through `host.background`; installs the watch task), `goals` (hook after each answer), `plan` (tool hook and prompt section), `anthropic-subscription` (Claude subscription billing), `guard` (tool hook that asks for approval), `codemode` (codemode tool; a script's calls go through the same hooks), `memory` (memory tool and the prompt section of lessons in force; through `host.memory`), `pip` (PiP's tools, prompt, and follow task, through `host.pip`; only PiP's conversation selects it, as `PocketApp`'s settings leave it out of every other conversation's), `triggers` (the PR and repository watch tasks and the `watch_pr` tool, through `host.watches` and `host.repoWatches`; webhooks need it on), `gallery` (the extension gallery's owner-only routes under `/api/x/gallery/`, through `host.gallery`, and its twice-daily look for revoked versions; it installs `pocket-gallery`, which tells the web app it is on), `session-tags` (Session tags, off by default: its `x.session-tags.tags` document, routes that check ids with `request.sessions()`, and its browser folder `session-tags/`, which uses the session list's extension points; it imports nothing of Pi Pocket's but types, as a drop-in would), `ask` (Ask: Pi's `ask` tool and its prompt section, questions with answers to pick on a card through `host.ask`; subagents do not get it, and plan mode lets it run), `ask-someone` (Ask someone, off by default: the `ask_someone` tool, which saves a draft question in its `x.ask-someone.questions` document; routes to edit, share, and end them; a public page (`web.publicPage`) for one answer through each link; and its browser folder `ask-someone/`; it imports nothing of Pi Pocket's but types), `updates` (Updates of Pi Pocket itself: owner-only routes under `/api/x/updates/`, through `host.updates`, its three settings (look, install by itself, beta updates), the look every 6 hours and the install by itself, and its browser folder `updates/`, the menu row, launcher action, and sheet, which says in words how the copy was installed and shows the hints that the server gives for a local or npx install), and `design` (Design mode's workspace: its routes under `/api/x/design/` for comments, tweaks, "go back to this one", and the designs list, the `pocket.design-comments` document, the `/design-open` command, and the agent side from `../design/index.ts` (tools, prompt guide, export route); its browser folder `design/` is the canvas: only `index.js` (the store, the rail button, the launcher actions, the command, and a loading state), `paths.js`, and `state.js` (the workspace's one store) load at app start; `app.js` (the workspace, with `style.css`) loads when the panel first opens, and `docks.js`, `views.js`, and the System view (`system-ui.js`, with `system.css`) when first used; `unsaved.js` carries the System view's unsaved count and save; `workspace.js` is the picker, toolbar, and modes, `canvas.js` the frame and its bridge, `docks.js` the versions, comments, text edits, and tweaks, `system-view.js`, `system-sections.js`, `system-widgets.js`, `system-actions.js`, `system-data.js`, and `system-preview.js` the System view, `check.js` the Check tab, `picker.js` the design picker, `views.js` compare, the variations grid, the slide strip, and present mode, `data.js` what it asks of the server, `parts.js` small pieces, `style.css` the workspace's sheet, and `system.css` the System view's; `devices.js`, `tweaks.js`, `edits.js`, `messages.js`, `comments.js`, `system.js`, `color.js`, and `specimen.js` are pure helpers; `system-routes.ts` and `system-api.ts` are the System view's routes (`system`, `system/check`, `system/docs`, `system/export`) and the engines they call; it imports the app's own `/store.js` and `/artifact-bridge.js`).
|
|
189
|
+
Each default-exports `(host: PocketHost, web: ExtensionWeb) => Extension | Extension[] | void` (`web` adds to the app: [extensions/app.md](extensions/app.md)) and is installed in this order: `prompt` (system prompt, with where Pi Pocket's docs are), `artifacts` (the `artifact` and `artifact_inline` tools: one store, `publish`, and bundles: `assets`, `removeAssets`, `group`, `kind`), `browser` (browser tool and its prompt section; through `host.browsers`), `subagents` (subagent tool and its tasks: anchors, reporters, and the courier that sends waiting reports to the parent together; a subagent runs on its session's model, or one the owner allowed, and the app rebuilds the module when that list changes), `agent-teams` (Agent Teams, off by default: the `team` tool and its prompt section, through `host.linkedSessions`; its browser module `agent-teams.js` describes the tool's calls with `pocket.toolCall`; it imports of Pi Pocket's only types and `model-facts.ts`, a pure helper that formats model facts), `schedules` (schedule tool and its four limits, as settings; installs the schedule task), `background` (the background tool and its one setting, through `host.background`; installs the watch task), `goals` (hook after each answer), `plan` (tool hook and prompt section), `anthropic-subscription` (Claude subscription billing), `guard` (tool hook that asks for approval), `codemode` (codemode tool; a script's calls go through the same hooks), `memory` (memory tool and the prompt section of lessons in force; through `host.memory`), `pip` (PiP's tools, prompt, and follow task, through `host.pip`; only PiP's conversation selects it, as `PocketApp`'s settings leave it out of every other conversation's), `triggers` (the PR and repository watch tasks and the `watch_pr` tool, through `host.watches` and `host.repoWatches`; webhooks need it on), `gallery` (the extension gallery's owner-only routes under `/api/x/gallery/`, through `host.gallery`, and its twice-daily look for revoked versions; it installs `pocket-gallery`, which tells the web app it is on), `session-tags` (Session tags, off by default: its `x.session-tags.tags` document, routes that check ids with `request.sessions()`, and its browser folder `session-tags/`, which uses the session list's extension points; it imports nothing of Pi Pocket's but types, as a drop-in would), `ask` (Ask: Pi's `ask` tool and its prompt section, questions with answers to pick on a card through `host.ask`; subagents do not get it, and plan mode lets it run), `ask-someone` (Ask someone, off by default: the `ask_someone` tool, which saves a draft question in its `x.ask-someone.questions` document; routes to edit, share, and end them; a public page (`web.publicPage`) for one answer through each link; and its browser folder `ask-someone/`; it imports nothing of Pi Pocket's but types), `updates` (Updates of Pi Pocket itself: owner-only routes under `/api/x/updates/`, through `host.updates`, its three settings (look, install by itself, beta updates), the look every 6 hours and the install by itself, and its browser folder `updates/`, the menu row, launcher action, and sheet, which says in words how the copy was installed and shows the hints that the server gives for a local or npx install), and `design` (Design mode's workspace: its routes under `/api/x/design/` for comments, tweaks, "go back to this one", and the designs list, the `pocket.design-comments` document, the `/design-open` command, and the agent side from `../design/index.ts` (tools, prompt guide, export route); its browser folder `design/` is the canvas: only `index.js` (the store, the rail button, the launcher actions, the command, and a loading state), `paths.js`, and `state.js` (the workspace's one store) load at app start; `app.js` (the workspace, with `style.css`) loads when the panel first opens, and `docks.js`, `views.js`, and the System view (`system-ui.js`, with `system.css`) when first used; `unsaved.js` carries the System view's unsaved count and save; `workspace.js` is the picker, toolbar, and modes, `canvas.js` the frame and its bridge, `docks.js` the versions, comments, text edits, and tweaks, `system-view.js`, `system-sections.js`, `system-widgets.js`, `system-actions.js`, `system-data.js`, and `system-preview.js` the System view, `check.js` the Check tab, `picker.js` the design picker, `views.js` compare, the variations grid, the slide strip, and present mode, `data.js` what it asks of the server, `parts.js` small pieces, `style.css` the workspace's sheet, and `system.css` the System view's; `devices.js`, `tweaks.js`, `edits.js`, `messages.js`, `comments.js`, `system.js`, `color.js`, and `specimen.js` are pure helpers (`color.js`, with `color.d.ts`, is also the server's color math, through `../design/color.ts`); `system-routes.ts` and `system-api.ts` are the System view's routes (`system`, `system/check`, `system/docs`, `system/export`) and the engines they call; it imports the app's own `/store.js` and `/artifact-bridge.js`).
|
|
196
190
|
|
|
197
191
|
## Web: `web/` (Preact and htm, no build)
|
|
198
192
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-pocket",
|
|
3
|
-
"version": "0.27.0-beta.
|
|
3
|
+
"version": "0.27.0-beta.8",
|
|
4
4
|
"description": "A durable, multiplayer, mobile-first web app for Pi agents, built on Pi Durable",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi",
|
|
@@ -45,7 +45,6 @@
|
|
|
45
45
|
"dev": "node bin/pi-pocket.js --cwd .",
|
|
46
46
|
"check": "tsc --noEmit -p . && node test/types-file.ts && node docs-site/check-reference.mjs",
|
|
47
47
|
"test": "node --test --test-concurrency=4 test/*.test.ts",
|
|
48
|
-
"design:check": "node --import ./bin/strip-types.js src/server/design/check-cli.ts",
|
|
49
48
|
"site:publish": "gh workflow run pages.yml",
|
|
50
49
|
"format": "eslint --fix . && prettier --write .",
|
|
51
50
|
"format:check": "prettier --check . && eslint .",
|