@plitzi/sdk-server 0.38.13 → 0.38.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/CHANGELOG.md +255 -0
  2. package/README.md +81 -7
  3. package/dist/core/auth/createAuth.d.ts +5 -0
  4. package/dist/core/auth/createAuth.js +5 -0
  5. package/dist/core/auth/csrf.d.ts +25 -0
  6. package/dist/core/auth/csrf.js +34 -32
  7. package/dist/core/auth/session.d.ts +10 -2
  8. package/dist/core/auth/session.js +31 -6
  9. package/dist/core/createServer.js +4 -0
  10. package/dist/core/http/stages/authRoutes.js +3 -0
  11. package/dist/core/http/stages/crossSiteWrites.d.ts +23 -0
  12. package/dist/core/http/stages/crossSiteWrites.js +44 -0
  13. package/dist/core/http/stages/crossSiteWrites.test.d.ts +1 -0
  14. package/dist/core/http/stages/exchangeRoute.js +2 -0
  15. package/dist/core/http/stages/sessionRenewal.js +2 -1
  16. package/dist/core/http/stages/signInRoute.js +1 -1
  17. package/dist/core/http/stages/static.js +1 -1
  18. package/dist/core/mimeTypes.d.ts +10 -1
  19. package/dist/core/mimeTypes.js +2 -1
  20. package/dist/core/oauth/authorize.js +2 -1
  21. package/dist/core/requestParser.d.ts +6 -0
  22. package/dist/core/requestParser.js +8 -2
  23. package/dist/core/requestParser.test.d.ts +1 -0
  24. package/dist/core/server/fleet/link.d.ts +1 -1
  25. package/dist/core/server/fleet/stores.js +1 -1
  26. package/dist/core/services/action.js +1 -1
  27. package/dist/core/services/realtime.js +1 -1
  28. package/dist/core/services/registry.js +2 -0
  29. package/dist/core/staticFiles.d.ts +2 -1
  30. package/dist/core/staticFiles.js +5 -5
  31. package/dist/functions-api.d.ts +5 -2
  32. package/dist/helpers/cache/keys.d.ts +1 -0
  33. package/dist/helpers/cache/keys.js +4 -3
  34. package/dist/helpers/flagOverrides.d.ts +2 -0
  35. package/dist/helpers/flagOverrides.js +2 -1
  36. package/dist/index.d.ts +2 -0
  37. package/dist/index.js +2 -1
  38. package/dist/modules/actions/tasks/realtime.js +1 -1
  39. package/dist/modules/authoringHost/index.d.ts +49 -0
  40. package/dist/modules/authoringHost/index.js +113 -0
  41. package/dist/modules/authoringHost/index.test.d.ts +1 -0
  42. package/dist/modules/functions/contract.d.ts +5 -2
  43. package/dist/modules/project/serveProject.d.ts +3 -2
  44. package/dist/modules/project/serveProject.js +85 -15
  45. package/dist/modules/realtime/hub.d.ts +7 -2
  46. package/dist/modules/realtime/hub.js +8 -4
  47. package/dist/modules/realtime/index.js +14 -7
  48. package/dist/modules/realtime/message.d.ts +3 -0
  49. package/dist/modules/realtime/message.js +5 -0
  50. package/dist/modules/realtime/retained.d.ts +24 -0
  51. package/dist/modules/realtime/retained.js +47 -0
  52. package/dist/modules/realtime/retained.test.d.ts +1 -0
  53. package/dist/modules/realtime/socket.js +1 -1
  54. package/dist/modules/rsc/handler.js +2 -1
  55. package/dist/modules/runtime/elsewhere.test.d.ts +1 -0
  56. package/dist/modules/runtime/inside.d.ts +21 -0
  57. package/dist/modules/runtime/inside.js +51 -3
  58. package/dist/modules/runtime/ownServer.test.d.ts +1 -0
  59. package/dist/modules/runtime/stages.d.ts +4 -1
  60. package/dist/modules/ssr/prepareRender.js +3 -2
  61. package/dist/modules/ssr/spaceDocument.js +5 -1
  62. package/dist/plugins/manager.d.ts +9 -0
  63. package/dist/plugins/manager.js +43 -1
  64. package/dist/runtime.d.ts +2 -1
  65. package/dist/runtime.js +2 -2
  66. package/package.json +3 -3
  67. package/skills/plitzi-authoring/SKILL.md +1 -1
  68. package/skills/plitzi-authoring/reference/index.md +3 -2
  69. package/skills/plitzi-authoring/reference/layouts.md +10 -0
  70. package/skills/plitzi-authoring/reference/plugin-reach.md +91 -0
  71. package/skills/plitzi-authoring/reference/plugins.md +19 -35
  72. package/skills/plitzi-authoring/reference/realtime.md +11 -0
  73. package/skills/plitzi-authoring/reference/testing.md +3 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,260 @@
1
1
  # @plitzi/sdk-server
2
2
 
3
+ ## 0.38.15
4
+
5
+ ### Patch Changes
6
+
7
+ - 6cdd5cf: ## Security
8
+
9
+ - **A write another site caused is refused, cookie or none** (`@plitzi/sdk-server`, `@plitzi/sdk-shared`): the page
10
+ server guarded nothing it answers past `/auth` — a server action (`/_action`), a realtime publish, a space's `/fn/`
11
+ route, its runtime's endpoints, the deployment's own `data` stages, the adapter-only `loginPath`, `logoutPath` and
12
+ `exchangePath`. A plain `text/plain` POST from any page open in the same browser ran them, with the visitor's session
13
+ cookie when there was one (`SameSite=None` off this machine) and, in a project nobody signs in to, as whoever holds
14
+ the server's own credentials. Every unsafe request a browser says another site caused (`Sec-Fetch-Site: cross-site`,
15
+ or a foreign `Origin`) is now refused `403 reason: 'foreign'`, saying how to allow it: `crossSiteWrites.origins`
16
+ (with `auth`, `identity.platformOrigins` too) and `crossSiteWrites.paths` for a form other sites post to by design.
17
+ `Authorization`, and callers that are not browsers — webhooks, scripts — pass as before. One rule for this and the
18
+ sign-in check (`crossSiteRequest`, `csrf.ts`). A self-hosted runtime's endpoints now sit where the platform forwards a
19
+ space's — after the auth chain and this guard (`data`, was `preAuth`).
20
+
21
+ ## Testing
22
+ - **`page check` and `page shot` anywhere the project is served** (`@plitzi/cli`): `--url <origin>` for a second server
23
+ of it, staging or a deploy, instead of `npm start`'s port; `page check --space <module>` holds the pages to that space
24
+ instead of the project's — an agent's page — authored with `authorIsolated`.
25
+ - **A route with a query is checked as its page** (`@plitzi/cli`): `page check "/?v=2"` matched the query as part of
26
+ the path, found no page, and checked the space's "not found" page in its place.
27
+
28
+ - **What an element that chooses its children draws is checked** (`@plitzi/sdk-authoring`, `@plitzi/cli`): with
29
+ `choosesChildren`, the page checks owed none of its children — and checked none of them either: a dashboard drawing
30
+ three panels reported `checked: 1`. Each child it may draw, and what is inside one under no condition of its own,
31
+ now carries `shownWith` (the child it comes with) on its handle: once that child is on screen it and everything
32
+ named in it are owed like the rest of the page, and `checked` counts them. `onScreenIfChosen(handles, page)` lists
33
+ them.
34
+ - **A page that met a server error is looked at once more** (`@plitzi/cli`): `page check` and `verify` failed a page
35
+ for a `500` from somebody else's service having a bad second (`/fn/<space>/weather`), and passed on the next run with
36
+ nothing changed. A page whose requests got a `5xx` is checked again once; its report is the second look, and says
37
+ what failed the first time (`retriedAfter`). A `4xx` fails the same way twice, and is never retried.
38
+
39
+ ## Plugins
40
+ - **`useNotify`** (`@plitzi/plitzi-sdk`): a plugin shows the page's notifications — `notify('Deleted 79 recordings', {
41
+ appearance: 'danger' })` — the same toasts an `addNotification` step shows, in the space's theme and `notifications`
42
+ look, with no trigger, flow or `window` event of the space's to wire. The step's vocabulary (`NOTIFICATION_PLACEMENTS`,
43
+ `NOTIFICATION_APPEARANCES`, `NOTIFICATION_DEFAULTS`) is one list in `@plitzi/sdk-shared`, read by both.
44
+ - **`appearance: 'danger'` looks like one** (`@plitzi/plitzi-sdk`): it reached the toast library as a type it does not
45
+ know, so a danger notification showed neither the error icon nor the colour `notifications.danger` sets.
46
+ A value a notification does not take — from a flow, or a plugin in plain JavaScript — is set aside by name and said
47
+ in the console, rather than shown as the default in silence (`readNotificationOptions`, `@plitzi/sdk-shared`).
48
+ - **`useServerAction`** (`@plitzi/plitzi-sdk`, `@plitzi/sdk-authoring`, `@plitzi/sdk-interactions`,
49
+ `@plitzi/sdk-server`): a plugin runs one of the space's server actions, awaited —
50
+ `useServerAction<typeof habitDone>('habits-done')({ id })` answers `{ ok, output }` or `{ ok: false, reason, error }`
51
+ — through the `runServerAction` step itself: the same access, refusals, session handling and dev-tools entry.
52
+ `defineAction` keeps the literal types of its `call` way in, so the input is typed by the fields it declares (the
53
+ required ones required); `taskAction` types both ends from the task's `run`, and `FunctionTask<T, R>` takes what
54
+ `run` answers. `CallInputOf` / `CallOutputOf` read them. One operation is one action, never a `case` in one route.
55
+ What a run answers is typed (`ServerActionStatus`): a status the server never uses reads as a run that did not
56
+ complete, never as one that did.
57
+ The key those types ride under (`CALL_TYPES`) is exported, by `@plitzi/sdk-shared` and `@plitzi/sdk-authoring` with
58
+ `TypedActionEntry`, `CallInputOf` and `CallOutputOf`: a package that emits declarations could not write the type of an
59
+ action it exports (`TS4023` on every `export const actions = [defineAction(…)]`).
60
+ - **A plugin is drawn on the server first** (docs): a preference per device belongs in kept state (`keepState`,
61
+ `paintedState`) as a bound prop, never read from `localStorage` while rendering — React discards the whole tree on the
62
+ mismatch, and only in the browser of whoever saved something. `@plitzi/plitzi-ui` is not the page's: a plugin
63
+ importing it bundles its own copy, with its own contexts and its own look. The authoring skill's `plugin-reach.md`
64
+ says what a plugin says and to whom: a notification, another element (an event and the space's flow), a server
65
+ action, shared state, other pages.
66
+
67
+ ## Realtime
68
+ - **A channel that retains** (`@plitzi/sdk-shared`, `@plitzi/sdk-server`, `@plitzi/sdk-elements`): declared
69
+ `retain: true` (with `publish: 'server'`, which authoring requires), the server keeps the latest message of each type
70
+ on a topic — said by `ctx.publish` or a flow's `realtime.publish` — and hands them to every page that joins, marked
71
+ `retained`. A page reads them as `<channel>.retained.<type>`, a plugin as `useChannel(topic).retained`, the newest of
72
+ a type holding whichever order they arrive in; `null` forgets a type. Kept in the store the actions' `kv` uses (beside
73
+ the grants, by compare-and-swap), so every replica hands out the same; a topic keeps at most 64 types and 512 KB, and
74
+ a publish past that is refused before anything is sent. State every screen shares is one publish and one binding —
75
+ no kv key, initial read or copy in `state` of the project's own. The fleet store `realtime.grants` is now
76
+ `realtime.kv`.
77
+ - **The MCP writes every field a channel takes** (`@plitzi/sdk-mcp`): `patchSettings`'s channel had no `grant` — which
78
+ the guide taught — nor `retain` or the limits, so an agent could not declare a private channel at all. All are there
79
+ now, and the guide says what `retain` is for and that `channel_<id>.retained` holds it.
80
+
81
+ ## Authoring
82
+ - **`plitzi explain` knows every `@plitzi` package installed** (`@plitzi/cli`): a name that was not
83
+ `@plitzi/sdk-authoring`'s (`createServer`, `createJsonAdapters`, `useChannel`) was answered as the project's own code,
84
+ to `grep` in `src/`. It is read from the published types of every one installed, through their re-exports and entry
85
+ points (`@plitzi/sdk-server/handlers`), and a name two packages export — `createServer` is sdk-server's and sdk-mcp's
86
+ — is answered with both.
87
+
88
+ - **A space module somebody else wrote, authored where it reaches nothing** (`@plitzi/sdk-authoring`):
89
+ `authorIsolated(file, { timeoutMs })` of `@plitzi/sdk-authoring/node` runs `authorSpace` on it in a process Node's
90
+ permission model holds to reading the module's folder and its packages — no file written, no process started, no
91
+ variable of the caller's environment — kills one that runs too long, and validates what it answers again, so a forged
92
+ answer gains nothing. A refusal comes back as `authorSpace` says it, with the problems as data.
93
+ - **Pages an agent writes, served** (`@plitzi/sdk-server`): `createAuthoringHost({ dir, frameAncestors })` serves each
94
+ space it is handed at an address of its own (`put(space, { id }) → /?__pt=<id>`) as a draft of its one space, kept in
95
+ `dir` across restarts; `drop(id)` forgets one, and anything else answers `404` saying where the pages are.
96
+ - **A space is chosen by host or credential** (`@plitzi/sdk-server`, docs): `getSpaceDeployment` is asked on every
97
+ request, and what a page fetches after it carries nothing of its address but the host — a space chosen by the page's
98
+ query or path lost everything it asked for, and `/_plitzi/space/<hash>.json` answered a bare `404`. The contract and
99
+ the README say so (the README offered "by path prefix"), and that `404` says why.
100
+
101
+ - **`plitzi explain on` says how to read what a trigger carries** (`@plitzi/sdk-authoring`): its doc sat above a
102
+ helper, so `explain` printed only the signature. It now leads with `[named('picked', on('onPick')), …('{{ picked.seat
103
+ }}')]`, and the CLI skill's plugin section says the same.
104
+
105
+ - Updated dependencies [6cdd5cf]
106
+ - @plitzi/plitzi-sdk@0.38.15
107
+ - @plitzi/sdk-shared@0.38.15
108
+
109
+ ## 0.38.14
110
+
111
+ ### Patch Changes
112
+
113
+ - 493955a: ## SDK
114
+
115
+ - **An embedded space leaves the page's theme alone** (`@plitzi/plitzi-sdk`, `@plitzi/plitzi-builder`): plitzi-ui's
116
+ `Provider` stamps `dark` on `<html>` by default — and, being `light`, takes it off — so every space mounted with
117
+ `themeScope: 'container'` turned the page around it light, and nothing put it back. The SDK and the builder now leave
118
+ the class to their own theme provider (`applyColorModeClass={false}`).
119
+ - **A space inside a space** (`@plitzi/plitzi-sdk`, `@plitzi/sdk-shared`): one drawn inside another — the `plitziSdk`
120
+ element, a plugin rendering one, the builder's canvas — knows it (`render.enclosed`). It is `container` unless it
121
+ says otherwise, wears its theme on its own root and starts from the page's when its own is `system`, keeps its
122
+ stylesheet to its own root (`@scope` — its `:root` palette and `.dark` rules repainted the outer page, its
123
+ `.plitzi-sdk` rule restyled the outer root), writes no `<title>` (`ownsHead`) and no `theme` cookie.
124
+ - **The `plitziSdk` element draws** (`@plitzi/plitzi-sdk`): it rendered in `widget` mode with no page to show, so it
125
+ drew nothing. A widget with no `currentPageId` now shows the page its home address would. And it takes a space's
126
+ documents as well as a key: `offlineData`, bound whole (an `apiContainer`'s answer, a runtime's route, what
127
+ `plitzi_render` returns) or as `offlineData.schema` and `offlineData.style` from two elements — waiting, without an
128
+ error, for the half that has not answered; one that cannot be drawn is said why, in the console and on the canvas.
129
+ - **`<PlitziSdk>` inside a plugin draws** (`@plitzi/plitzi-sdk`): it mounted a router of its own inside the page's, and
130
+ React Router refused it — `routing: 'memory'` or not. A space inside another is a widget: `raw` becomes `widget`
131
+ there, one page and no router (a frame of its own, `iframe` or `shadow`, is left as asked).
132
+ - **A space inside another is as tall as what it holds** (`@plitzi/plitzi-sdk`): its root was `min-h-screen`, as a
133
+ space that IS the page is, so a card of three lines drawn in a panel took the window's height.
134
+ - **`<PlitziSdk.Plugin component>` takes a component with its own props** (`@plitzi/plitzi-sdk`), as `render()`'s
135
+ plugins do: typed `ComponentPluginFC`, it refused any component that read its attributes.
136
+ - **An edited page keeps its address in step** (`@plitzi/plitzi-sdk`): the routes are built from the pages' own
137
+ elements, and those were read again only when the list of pages changed — an edit to one page (its slug, its flag)
138
+ leaves that list the same, and the routes kept its old address until something else rebuilt them.
139
+ - **Packages declare only what they use** (`@plitzi/sdk-dev-tools`, `@plitzi/sdk-shared`): `@plitzi/sdk-plugins`, which
140
+ the dev tools no longer import, and `terser`, which no build here runs, are no longer dependencies.
141
+ - **An edited page keeps its route up to date** (`@plitzi/plitzi-sdk`): the routes are built from the pages' own
142
+ elements, which were read again only when the list of pages changed — an edit to one page (its slug, its flag) left
143
+ the list the same and the route at the old address. They follow every edit to a page now, and stay the same object
144
+ while no page changes.
145
+ - **`@plitzi/sdk-dev-tools` no longer depends on `@plitzi/sdk-plugins`**, which nothing in it imports.
146
+ - **A dropdown's menu opens inside a card that lifts or clips** (`@plitzi/sdk-elements`, `@plitzi/sdk-shared`): drawn
147
+ inside the dropdown, an ancestor with a `transform` — a card lifting on hover — made itself the containing block of
148
+ the menu's `position: fixed`, and one with `overflow: hidden` cut it off: the menu opened and nobody saw it. The open
149
+ menu and its backdrop are drawn at the space's root (`spaceRootOf`, `@plitzi/sdk-shared/helpers/spaceRoot`); a
150
+ style written for the popup by an ancestor's selector no longer reaches it — its own classes do.
151
+ - **A copy button says when it could not copy** (`@plitzi/sdk-elements`, `@plitzi/sdk-shared`,
152
+ `@plitzi/sdk-interactions`, `@plitzi/sdk-variables`, `@plitzi/sdk-dev-tools`): a page not served over https has no
153
+ clipboard — a phone opening a development server by its address — and a code block's "Copy" threw there. It reads
154
+ "Not copied", and says why. `clipboardWriter` and `copyText` (`@plitzi/sdk-shared/helpers/clipboard`) are the one
155
+ check, the `copyToClipboard` step's too.
156
+
157
+ ## Authoring
158
+ - **`plitziSdk` is authored like any element** (`@plitzi/sdk-authoring`, `@plitzi/sdk-elements`): its declaration moved
159
+ to `@plitzi/sdk-elements` beside the others, so it has a factory — `plitziSdk({ id, bind: { offlineData: 'view.data'
160
+ } })` —, its attributes typed, and `plitzi explain` knows it.
161
+ - **A binding may write part of an attribute** (`@plitzi/sdk-authoring`): `offlineData.schema` writes into
162
+ `offlineData`, as the runtime always did; authoring refused it as an attribute nothing reads.
163
+ - **`choosesChildren`** (`@plitzi/sdk-shared`, `@plitzi/sdk-authoring`): a plugin that shows only some of the elements
164
+ put inside it — a dashboard's panels, a wizard's step — says so in its declaration, and the page checks owe none of
165
+ them on screen; what it draws is still read by the checks of the whole page (images, sideways scroll, legibility).
166
+ `verify` was red on every such page.
167
+
168
+ - **A page says how the document scrolls** (`@plitzi/sdk-elements`, `@plitzi/sdk-authoring`, `@plitzi/sdk-mcp`):
169
+ `documentScroll: 'locked'` holds the document still while the page is open — a dashboard or a board used with a
170
+ finger, where the whole page was dragged and bounced back though nothing in it scrolls — and `'noBounce'` keeps the
171
+ scroll without the rubber band or pull-to-refresh. The page draws the rule itself, so it is in the server's HTML and
172
+ leaves with the page; never inside a widget, a space drawn in another, or the builder's canvas. A Settings select,
173
+ `PageSpec.documentScroll`, `upsertPage`'s `documentScroll` (`null` undoes it) and the page read; an unknown value is
174
+ refused (`attribute-value`). `upsertPage` is now held to the lint of the page it writes, as element writes are.
175
+
176
+ ## MCP
177
+ - **`@plitzi/sdk-mcp/render`** (`@plitzi/sdk-mcp`): `plitzi_render`'s widget render on its own — no MCP server, no SSR,
178
+ no OAuth — for a project whose own agent draws in its own pages: `render`, `renderWidgetShape` to declare it as a
179
+ tool, `renderGuideText` for the agent. `base`, the style of the project's space, brings its tokens, classes and fonts
180
+ to the widget.
181
+
182
+ ## Server
183
+ - **`publicUrl` says where people reach the server** (`@plitzi/sdk-server`): it was `http://127.0.0.1:<port>` whatever
184
+ the server was. It is `https` once `serverOptions.tls` gives it a certificate, and this machine's network address
185
+ with `HOST` open to the network (what a tablet opens, what an OAuth provider sends it back to); `PUBLIC_URL` still
186
+ wins. The network addresses it prints say `https` too.
187
+ - **A server serving TLS reaches itself** (`@plitzi/sdk-server`): with a local certificate (mkcert) Node trusts nothing
188
+ the browsers were told to, so a runtime calling its own MCP failed. Its requests to its own address now connect to its
189
+ listener and are taken when it presents exactly its certificate (`reachOwnServer`, exported from `/runtime`).
190
+ - **A runtime reads compressed answers again** (`@plitzi/sdk-server`): the dispatcher `reachOwnServer` (and the
191
+ platform's `reachSpaceInside`) installs reached every other host with an undici connector that offers HTTP/2, and an
192
+ answer that came back over h2 reached Node's `fetch` without its `content-encoding` — every API that compresses read
193
+ as Brotli bytes. Other hosts are reached over HTTP/1.1 now, as Node's own `fetch` reaches them.
194
+ - **A project's server serves HTTPS from `.env`** (`@plitzi/sdk-server`, `@plitzi/sdk-shared`): `TLS_CERT` and
195
+ `TLS_KEY`, the certificate's and the key's paths — what `plitzi cert` writes — with no code of the project's;
196
+ `serverOptions.tls` still wins. A network address the certificate does not name is said at boot, the machine's
197
+ `.local` name is printed among the addresses when it is named, and a server on loopback alone says how to open it to
198
+ the network.
199
+ - **A session survives a phone on the Wi-Fi** (`@plitzi/sdk-server`): a private network address (`192.168.…`, `10.…`,
200
+ Tailscale's `100.64/10`, IPv6 unique- and link-local) and a machine's mDNS name (`studio.local`) get the local
201
+ cookie profile — `SameSite=Lax`, no `Secure`, no `Domain`. They got `SameSite=None; Secure`, which a browser drops
202
+ over http: nobody could sign in from a tablet. A deployment's own `.local` sub-domains (`app.example.local`) keep the
203
+ strict profile.
204
+ - **Hiding the dev tools on a server over HTTPS hydrates** (`@plitzi/sdk-server`): a server with a certificate speaks
205
+ HTTP/2, which sends no `Host` — only `:authority` — and the cookies named for the origin's port (the dev tools'
206
+ `plitzi_debug_<port>`, forced flags, painted state) were looked for without it. Shift+F12 hid the dev tools in the
207
+ browser, the server rendered them back, and the page failed to hydrate. Every one is read off `requestAuthority`.
208
+ - **A rebuild of plugins says it finished** (`@plitzi/sdk-server`): bundles removed under a running server (`tmp/`
209
+ deleted) were each a warning, "rebuilding…", and their "ready" at a level a project's terminal does not show. It is
210
+ one episode now: said when noticed, and again when the last is built — how many, how long, which failed.
211
+ - **`tmp/dev-server.json` records the scheme** (`@plitzi/sdk-server`): `url` is `https` with a certificate, and the
212
+ file adds the network addresses and the `publicUrl`.
213
+ - **`public/` is asked about every time** (`@plitzi/sdk-server`): it was cached for an hour — a `.js` or `.css` in it
214
+ for a year, `immutable` — so a file a project rewrites while it runs arrived stale. It is `no-cache` now, answered
215
+ `304` by its `ETag` while unchanged; `immutable` stays for what is versioned (the SDK, the plugins).
216
+
217
+ ## CLI
218
+ - **`check`, `shot`, `verify` and `visual` find a server on HTTPS** (`@plitzi/cli`): they rebuilt
219
+ `http://127.0.0.1:<port>`, so a project serving a certificate had no page checked. They read the URL `npm start`
220
+ recorded, and take a local certificate on this machine only. A project's `playwright.config.ts` comes from
221
+ `plitzi upgrade`.
222
+ - **`verify` runs the project's tests** (`@plitzi/cli`): a step `test`, after the lint, when `package.json` has a
223
+ `test` script.
224
+ - **`tsconfig.json` is the project's** (`@plitzi/cli`): the compiler options moved to `plitzi/tsconfig.base.json`, which
225
+ the CLI keeps up and `tsconfig.json` extends — so a folder of the project's own (`scripts/`, `tools/`) goes in its
226
+ `include` without changing a file of the CLI's. `plitzi doctor --fix` makes an older `tsconfig.json` extend it,
227
+ keeping only the options the project changed.
228
+ - **`doctor --fix` and `upgrade` write as the project's Prettier does** (`@plitzi/cli`): a repaired `tsconfig.json` or
229
+ `package.json` left `verify`'s format step red.
230
+ - **`upgrade` renames `usePlitziServiceContext`** (`@plitzi/cli`): with `PlitziServiceProvider` and
231
+ `PlitziServiceContextValue`, renamed in 0.38.12 with no alias — import, use and the module path that named it.
232
+ - **`skills update` compares every file** (`@plitzi/cli`): only `SKILL.md` was, so a change in a reference alone was
233
+ "up to date".
234
+ - **`NOTES.md`, the project's notes for agents** (`@plitzi/cli`): `AGENTS.md` and `CLAUDE.md` are the CLI's and
235
+ `upgrade` replaces them, so what a project's own sessions had to know had nowhere to live. `CLAUDE.md` imports
236
+ `NOTES.md`, `AGENTS.md` sends every agent to it, and nothing the CLI does touches it; `doctor --fix` writes one for
237
+ a project that has none.
238
+
239
+ - **`start:dev-inspect`** (`@plitzi/cli`): a server project's `start:dev` with Node's inspector open on
240
+ 127.0.0.1:9229, so a debugger (VS Code, `chrome://inspect`) attaches to the server, and again after each restart.
241
+ `plitzi upgrade` adds it; `plitzi runtime add` has it restart on the runtime too.
242
+ - **`plitzi cert`** (`@plitzi/cli`): HTTPS while developing, for a phone or a tablet on the Wi-Fi — over http its
243
+ browser gives a page no microphone, camera or clipboard. A certificate from mkcert's local authority for this machine,
244
+ its network addresses and its `.local` name, in `tmp/tls/`, named in `.env`; what to install on the phone, said.
245
+ - **A browser project opens to the network** (`@plitzi/cli`): its `vite.config.ts` reads `HOST`, `TLS_CERT` and
246
+ `TLS_KEY` from `.env`, as a server project does, and writes `tmp/dev-server.json` — the port Vite took and the scheme
247
+ — so `page check`, `page shot` and `visual` find it on another port or over HTTPS. `plitzi upgrade` brings it.
248
+
249
+ ## Docs
250
+ - **Two plugins share through `state`** (`@plitzi/sdk-authoring` skill): each plugin is a bundle of its own, so a module
251
+ both import is two copies, and what one keeps there the other never sees.
252
+ - **`verify --help`** names the project's tests among its steps.
253
+
254
+ - Updated dependencies [493955a]
255
+ - @plitzi/plitzi-sdk@0.38.14
256
+ - @plitzi/sdk-shared@0.38.14
257
+
3
258
  ## 0.38.13
4
259
 
5
260
  ### Patch Changes
package/README.md CHANGED
@@ -210,7 +210,18 @@ a plugin with no `declaration.ts`, no `.env.example` — is printed while develo
210
210
  What it wires from the project:
211
211
 
212
212
  - **The port.** `PORT`, or 8080 — while developing, the next free one from there (`freePort`). `HOST`, loopback by
213
- default (`0.0.0.0` in a container). `PUBLIC_URL` is where people reach it, behind a proxy.
213
+ default (`0.0.0.0` in a container, or for a phone on the Wi-Fi — it prints every address to open, and while it
214
+ listens on loopback alone, how to open it).
215
+ - **HTTPS.** `TLS_CERT` and `TLS_KEY` in `.env`, the paths of a PEM certificate and its key — what `plitzi cert` makes
216
+ for this machine and its network addresses — unless `serverOptions.tls` gives one itself. Over plain http a phone's
217
+ browser gives a page no microphone, camera or clipboard. A network address the certificate does not name (the
218
+ router handed the machine a new one) is said at boot; this machine's mDNS name (`studio.local`), when the
219
+ certificate names it, is printed among the addresses, and outlives them.
220
+ - **Where people reach it** — the runtime's `publicUrl`: `PUBLIC_URL` behind a proxy; with `HOST` open to the network,
221
+ this machine's address there (what a tablet on the Wi-Fi opens, and an OAuth provider sends it back to); this
222
+ machine's loopback otherwise — `https` whenever it serves a certificate. Serving TLS itself, its
223
+ own requests to that address (a runtime calling its own MCP) connect to its listener here and take its certificate —
224
+ exactly that one — however local it is (`reachOwnServer`).
214
225
  - **Its plugins.** Every folder of `src/plugins` under its name in camelCase, built from its `index.ts` (or
215
226
  `index.tsx`, `pluginEntry`) and rendered
216
227
  on the server (`action: 'compile'`), with its server half (`functions/`); every plugin of `vendor/plugins`, run as it
@@ -221,7 +232,8 @@ What it wires from the project:
221
232
  - **Its files.** `public/` served as it is, `src/data/` read and never served (`dataDir`), the `kv` in `state/kv.json`
222
233
  (`createFileKv`), `PLITZI_SIGNING_SECRET` what `ctx.sign` signs with.
223
234
  - **Where it is.** `/health` answers with the space's permanent URL (or the cloud `name`), and `tmp/dev-server.json`
224
- records the name, the port and the URL for `plitzi page check`, `shot` and `visual`. A signal closes it (`closeOnSignals`).
235
+ records the name, the port, the URL this machine reaches it at (`https` with a certificate), its network addresses
236
+ and its `publicUrl` — for `plitzi page check`, `shot`, `verify` and `visual`. A signal closes it (`closeOnSignals`).
225
237
 
226
238
  While developing — `NODE_ENV` other than `production` — `devMode` and `devReload` are on, and:
227
239
 
@@ -354,8 +366,13 @@ createServer({ adapters: { ...spaces.adapters, getOfflineData } });
354
366
  **Resolvers are an ordered list**, and the order is the policy. Each returns a resolution, a refusal, or nothing —
355
367
  and the difference between the last two is the point: a refusal ENDS the chain, so a request that tried to act for
356
368
  a space and failed is never quietly served as an anonymous visitor of whatever else that host resolves to. Three
357
- are built in and a fourth is `(req) => …` of your own, which is how a deployment that identifies tenants by header,
358
- by path prefix or by a table nobody else has still gets everything below.
369
+ are built in and a fourth is `(req) => …` of your own, which is how a deployment that identifies tenants by a header
370
+ its proxy sets or by a table nobody else has still gets everything below.
371
+
372
+ **A space is chosen by host or credential, never by the page's path or query.** `getSpaceDeployment` is asked on every
373
+ request, and what a page fetches after it — `/_plitzi/space/<hash>.json`, `/_action`, `/fn/…`, `/_realtime` — carries
374
+ nothing of the page's address but its host: a space chosen by `?space=` or `/s/<id>/` renders its first page and then
375
+ loses everything it asks for. Many spaces on one server are a sub-domain each (`wildcardSubdomain`).
359
376
 
360
377
  | Built in | What it is |
361
378
  |---|---|
@@ -379,6 +396,39 @@ a single-process deployment. `invalidate.resolution(host)` and `invalidate.domai
379
396
  untrue, which matters the moment an owner edits a domain list: until then the old framing policy stands, and a TTL
380
397
  is not a security boundary.
381
398
 
399
+ ## Pages an agent writes (`createAuthoringHost`)
400
+
401
+ A product where an agent designs the screen — a dashboard's panel, a page a visitor asks for — authors a space module
402
+ per page and needs it served with the quality of a project's, without trusting what the module does. Two pieces:
403
+
404
+ ```ts
405
+ import { authorIsolated } from '@plitzi/sdk-authoring/node';
406
+ import { createAuthoringHost } from '@plitzi/sdk-server';
407
+
408
+ const host = createAuthoringHost({ dir: 'state/pages', port: 8091, tls, frameAncestors: ['https://localhost:8080'] });
409
+ await host.server.listen(8091, '0.0.0.0');
410
+
411
+ const result = await authorIsolated('tmp/pages/weather.ts'); // its own process: reads the module and its packages, nothing else
412
+ if (result.ok) {
413
+ const { path } = host.put(result.space, { id: 'weather' }); // `/?__pt=weather`, kept in state/pages/weather.json
414
+ } else {
415
+ reply(result.message); // a refusal reads as authorSpace's: every problem, located
416
+ }
417
+ ```
418
+
419
+ - **`authorIsolated`** authors the module in a process Node's permission model holds to reading the module's folder and
420
+ the packages it imports: no file written, no process or worker started, no variable of the caller's environment. A
421
+ module that runs too long is killed (`timeoutMs`), and what it answers is validated again in the caller, so one that
422
+ forges its answer gains nothing. Before Node 25 the permission model leaves the network open: serve the result on an
423
+ origin of its own, never the app's.
424
+ - **`createAuthoringHost`** serves each page as a draft of its one space, at the address `put` answers — the way a page
425
+ server tells many spaces apart on one host (a space is chosen by host or credential, never by path). The page
426
+ arrives with its whole space, navigation is the browser's, and a reload that lost the address finds it in the draft's
427
+ cookie. So a page here is data and its look: no server provider, action, function or channel of its own. Anything
428
+ but a page it holds answers `404`, saying where they are.
429
+ - **Checked like a project's page:** `plitzi page check "/?__pt=weather" --url https://localhost:8091 --space
430
+ tmp/pages/weather.ts` — the CLI's whole check (elements on screen, hydration, console, contrast) against that module.
431
+
382
432
  ## JSON adapters (offline mode)
383
433
 
384
434
  `createJsonAdapters` provides a ready-made adapter set that reads a space from local JSON files, useful for offline mode, integration tests, and static deployments.
@@ -496,7 +546,7 @@ createServer({
496
546
  });
497
547
  ```
498
548
 
499
- Static responses include `ETag`, `Last-Modified`, and `Cache-Control` headers. Subsequent requests with `If-None-Match` receive `304 Not Modified` when the file has not changed. JS, CSS, and font files are served with `Cache-Control: immutable`; all other assets use a 1-hour max-age.
549
+ Static responses include `ETag`, `Last-Modified`, and `Cache-Control` headers. Subsequent requests with `If-None-Match` receive `304 Not Modified` when the file has not changed. Under a versioned URL — the SDK bundle, the plugins, `static` mounts, fonts — JS, CSS and font files are served `immutable` and everything else with a 1-hour max-age. `publicDir` is the project's files by name, which it may rewrite while it runs: `no-cache`, asked about every time and answered `304` while unchanged.
500
550
 
501
551
  ### Images
502
552
 
@@ -1162,7 +1212,7 @@ and every refusal names a machine-readable `reason`, so a client can tell "renew
1162
1212
 
1163
1213
  | Config | Effect |
1164
1214
  |---|---|
1165
- | `cookie` | Name, domain, `SameSite`, `Secure`, the refresh path, the hint suffix. Defaults derive from the request host |
1215
+ | `cookie` | Name, domain, `SameSite`, `Secure`, the refresh path, the hint suffix. Defaults derive from the request host: this machine — loopback, a `.localhost` name, a private network address, its mDNS name (`studio.local`), as a phone on the Wi-Fi opens it over http — gets `SameSite=Lax` with no `Secure` and no `Domain`; any other host `SameSite=None; Secure`, shared across its sub-domains |
1166
1216
  | `api.password` | What a password has to be. `minLength` defaults to 8 (NIST SP 800-63B's floor); `validate` is where a breach-list lookup or a strength estimator goes. Applied wherever one is set — signing up, resetting, changing |
1167
1217
  | `api.rateLimit` | May this attempt proceed? **Defaults to an in-memory sliding window**, so no deployment is unthrottled by omission; supply one to put a single counter behind a whole fleet. Called before the password is checked, so a throttled attempt costs no hash |
1168
1218
  | `api.adminPermission` | The global capability the `/auth/admin/*` routes require. Default `userManage` |
@@ -1181,7 +1231,7 @@ write, `04-mysql` over one you do not.
1181
1231
 
1182
1232
  ### Cross-site request forgery
1183
1233
 
1184
- **On by default.** The session cookie defaults to `SameSite=None` off localhost — a space is embedded in an iframe
1234
+ **On by default.** The session cookie defaults to `SameSite=None` off this machine and its network — a space is embedded in an iframe
1185
1235
  on somebody else's domain — so the browser attaches it to requests another site caused. That is the attack, and
1186
1236
  `Lax` is what would otherwise prevent it.
1187
1237
 
@@ -1239,6 +1289,30 @@ There is nothing to configure: the secret, the cookie scope and the origins all
1239
1289
  `createAuth`. Turn it off entirely with `csrf: false`. Outside this package, `createCsrfMiddleware` from
1240
1290
  `@plitzi/sdk-server/handlers` applies the same check to your own routes.
1241
1291
 
1292
+ #### The page server's own writes
1293
+
1294
+ Everything a page server answers past its self-gating flows — server actions (`/_action`), realtime publishes, a
1295
+ space's `/fn/` routes, its runtime's endpoints, your own `data` stages, and the adapter-only `loginPath`, `logoutPath`
1296
+ and `exchangePath` — refuses a write that a browser says **another site caused**, with `403` and `reason: 'foreign'`.
1297
+ **Whether or not a session cookie came with it**: a server holding credentials of its own (a token for somebody's
1298
+ calendar, an API key) or a tool nobody signs in to acts for whoever reaches it, and a plain `text/plain` POST from any
1299
+ page open in the same browser reaches it without a preflight.
1300
+
1301
+ The same two headers decide, under the same rules: what passes is a safe method, anything with `Authorization`, a
1302
+ caller that is not a browser (a webhook, `curl`), a page of this site (`same-origin`, `same-site`), and what you name:
1303
+
1304
+ ```ts
1305
+ createServer({
1306
+ adapters,
1307
+ crossSiteWrites: {
1308
+ // Exactly as a browser sends them. With `auth`, `identity.platformOrigins` are added for you.
1309
+ origins: ['https://app.example.com'],
1310
+ // A form other sites post to by design.
1311
+ paths: path => path === '/fn/newsletter'
1312
+ }
1313
+ });
1314
+ ```
1315
+
1242
1316
  ### `SSRUser`
1243
1317
 
1244
1318
  What a rendered page sees, so a schema can restrict pages to signed-in visitors — the SDK reads `authenticated` and
@@ -195,6 +195,11 @@ export declare const createAuth: (config: AuthConfig) => {
195
195
  pageAuth: Omit<ServerAuth, "sessionHintCookie">;
196
196
  /** The naming this was built with, so a page server takes it from here instead of being told a second time. */
197
197
  cookieConfig: SSRAuthCookie | undefined;
198
+ /**
199
+ * The sites this deployment's own pages are served from (`identity.platformOrigins`): a page server counts their
200
+ * writes as its own (`crossSiteWrites`), as the sign-in check here does.
201
+ */
202
+ platformOrigins: string[];
198
203
  /**
199
204
  * Cross-site request forgery: issuing tokens, writing the readable cookie, and the check. `undefined` when the
200
205
  * deployment turned it off. The `/auth` routes below already enforce it.
@@ -134,6 +134,11 @@ var createAuth = (config) => {
134
134
  /** The naming this was built with, so a page server takes it from here instead of being told a second time. */
135
135
  cookieConfig: config.cookie,
136
136
  /**
137
+ * The sites this deployment's own pages are served from (`identity.platformOrigins`): a page server counts their
138
+ * writes as its own (`crossSiteWrites`), as the sign-in check here does.
139
+ */
140
+ platformOrigins: config.identity?.platformOrigins ?? [],
141
+ /**
137
142
  * Cross-site request forgery: issuing tokens, writing the readable cookie, and the check. `undefined` when the
138
143
  * deployment turned it off. The `/auth` routes below already enforce it.
139
144
  */
@@ -56,6 +56,31 @@ export declare const carrierOf: (req: {
56
56
  cookies?: unknown;
57
57
  body?: unknown;
58
58
  }, method?: string | undefined) => CsrfCarrier;
59
+ /**
60
+ * Did this request come from a site this deployment does not recognise — `allowed` naming the origins it does?
61
+ *
62
+ * This is what protects signing in, where there is no session to bind a token to and no cookie to look for, and
63
+ * every write a page server answers, cookie or none (`crossSiteWritesStage`). It rests on two headers a page CANNOT
64
+ * set — the browser attaches both, and script may not override either:
65
+ *
66
+ * - **`Sec-Fetch-Site`** is the browser's own account of where the request came from, and is believed first.
67
+ * Anything but `cross-site` (`same-origin`, `same-site`, or `none` for a typed URL) is this deployment's own.
68
+ * The browser works that out with the real public suffix list, which is why it is worth more than anything
69
+ * derivable here.
70
+ * - **`Origin`** is the fallback, for a browser too old to send the above — Safari only did from 16.4. Matched
71
+ * **exactly**, against this host or an origin the deployment named.
72
+ *
73
+ * That exactness is deliberate and was a bug once: this compared *registrable domains*, last-two-labels, the
74
+ * same helper that scopes the session cookie. It has no public suffix list, so on a deployment at `acme.co.uk`
75
+ * every other `.co.uk` in the world counted as the same site and could sign a visitor in. Guessing where a
76
+ * domain boundary falls is not something to do in a security decision — a sibling sub-domain that needs to be
77
+ * trusted is one line in `allowedOrigins`, which `createAuth` already fills from `identity.platformOrigins`.
78
+ *
79
+ * **Neither header means this is not a browser**, and a client that is not a browser cannot be made to forge
80
+ * anything: there is no victim's session sitting in it. That is what keeps every API client, mobile app and
81
+ * script signing in with nothing extra to send.
82
+ */
83
+ export declare const crossSiteRequest: (carrier: CsrfCarrier, allowed?: (origin: string) => boolean) => boolean;
59
84
  export declare const createCsrf: (config: CsrfConfig) => {
60
85
  issue: (sessionToken?: string) => string;
61
86
  /** The name the cookie lands under, for a client that reads it by hand. */
@@ -83,40 +83,42 @@ var originHost = (origin) => {
83
83
  return;
84
84
  }
85
85
  };
86
+ /**
87
+ * Did this request come from a site this deployment does not recognise — `allowed` naming the origins it does?
88
+ *
89
+ * This is what protects signing in, where there is no session to bind a token to and no cookie to look for, and
90
+ * every write a page server answers, cookie or none (`crossSiteWritesStage`). It rests on two headers a page CANNOT
91
+ * set — the browser attaches both, and script may not override either:
92
+ *
93
+ * - **`Sec-Fetch-Site`** is the browser's own account of where the request came from, and is believed first.
94
+ * Anything but `cross-site` (`same-origin`, `same-site`, or `none` for a typed URL) is this deployment's own.
95
+ * The browser works that out with the real public suffix list, which is why it is worth more than anything
96
+ * derivable here.
97
+ * - **`Origin`** is the fallback, for a browser too old to send the above — Safari only did from 16.4. Matched
98
+ * **exactly**, against this host or an origin the deployment named.
99
+ *
100
+ * That exactness is deliberate and was a bug once: this compared *registrable domains*, last-two-labels, the
101
+ * same helper that scopes the session cookie. It has no public suffix list, so on a deployment at `acme.co.uk`
102
+ * every other `.co.uk` in the world counted as the same site and could sign a visitor in. Guessing where a
103
+ * domain boundary falls is not something to do in a security decision — a sibling sub-domain that needs to be
104
+ * trusted is one line in `allowedOrigins`, which `createAuth` already fills from `identity.platformOrigins`.
105
+ *
106
+ * **Neither header means this is not a browser**, and a client that is not a browser cannot be made to forge
107
+ * anything: there is no victim's session sitting in it. That is what keeps every API client, mobile app and
108
+ * script signing in with nothing extra to send.
109
+ */
110
+ var crossSiteRequest = (carrier, allowed = () => false) => {
111
+ const site = header(carrier, "sec-fetch-site");
112
+ const origin = header(carrier, "origin");
113
+ const vouched = origin !== void 0 && allowed(origin);
114
+ if (site !== void 0) return site === "cross-site" && !vouched;
115
+ if (!origin) return false;
116
+ return originHost(origin) !== carrier.hostname && !vouched;
117
+ };
86
118
  var createCsrf = (config) => {
87
119
  const { secret, cookie, allowedOrigins = [] } = config;
88
120
  const permitted = (origin) => typeof allowedOrigins === "function" ? allowedOrigins(origin) : allowedOrigins.includes(origin);
89
- /**
90
- * Did this request come from a site this deployment does not recognise?
91
- *
92
- * This is what protects signing in, where there is no session to bind a token to and no cookie to look for. It
93
- * rests on two headers a page CANNOT set — the browser attaches both, and script may not override either:
94
- *
95
- * - **`Sec-Fetch-Site`** is the browser's own account of where the request came from, and is believed first.
96
- * Anything but `cross-site` (`same-origin`, `same-site`, or `none` for a typed URL) is this deployment's own.
97
- * The browser works that out with the real public suffix list, which is why it is worth more than anything
98
- * derivable here.
99
- * - **`Origin`** is the fallback, for a browser too old to send the above — Safari only did from 16.4. Matched
100
- * **exactly**, against this host or an origin the deployment named.
101
- *
102
- * That exactness is deliberate and was a bug once: this compared *registrable domains*, last-two-labels, the
103
- * same helper that scopes the session cookie. It has no public suffix list, so on a deployment at `acme.co.uk`
104
- * every other `.co.uk` in the world counted as the same site and could sign a visitor in. Guessing where a
105
- * domain boundary falls is not something to do in a security decision — a sibling sub-domain that needs to be
106
- * trusted is one line in `allowedOrigins`, which `createAuth` already fills from `identity.platformOrigins`.
107
- *
108
- * **Neither header means this is not a browser**, and a client that is not a browser cannot be made to forge
109
- * anything: there is no victim's session sitting in it. That is what keeps every API client, mobile app and
110
- * script signing in with nothing extra to send.
111
- */
112
- const foreign = (carrier, alsoAllowed = []) => {
113
- const site = header(carrier, "sec-fetch-site");
114
- const origin = header(carrier, "origin");
115
- const allowed = origin !== void 0 && (permitted(origin) || alsoAllowed.includes(origin));
116
- if (site !== void 0) return site === "cross-site" && !allowed;
117
- if (!origin) return false;
118
- return originHost(origin) !== carrier.hostname && !allowed;
119
- };
121
+ const foreign = (carrier, alsoAllowed = []) => crossSiteRequest(carrier, (origin) => permitted(origin) || alsoAllowed.includes(origin));
120
122
  const nameFor = (hostname) => `${sessionCookieParams(hostname, cookie).name}_csrf`;
121
123
  const sign = (nonce, expiry, binding) => createHmac("sha256", secret).update(`${nonce}.${expiry}.${binding}`).digest("base64url");
122
124
  /**
@@ -256,4 +258,4 @@ var createCsrf = (config) => {
256
258
  };
257
259
  };
258
260
  //#endregion
259
- export { carrierOf, createCsrf, csrfFailureMessage };
261
+ export { carrierOf, createCsrf, crossSiteRequest, csrfFailureMessage };
@@ -22,6 +22,13 @@ export type SessionCookieParams = {
22
22
  * refuse one on a single-label host) and lax SameSite, because Secure + SameSite=None over plain http is dropped.
23
23
  */
24
24
  export declare const isLocalHost: (hostname: string) => boolean;
25
+ /**
26
+ * Whether the host is this machine as another device on its network reaches it: a private address, or the name
27
+ * mDNS gives it (`studio.local` — one label before `.local`, so a deployment's own `app.example.local` sub-domains,
28
+ * which share cookies across siblings over https, are not taken for one). Such a server is opened over plain http
29
+ * from a tablet, and gets the local cookie profile: a Secure cookie written over http is dropped.
30
+ */
31
+ export declare const isPrivateNetworkHost: (hostname: string) => boolean;
25
32
  /**
26
33
  * The last two labels of the host, so a session established on one sub-domain is carried by its siblings — an app
27
34
  * and the API it talks to are rarely the same host. Local and IP hosts get no domain at all: browsers refuse a
@@ -31,8 +38,9 @@ export declare const registrableDomain: (hostname: string) => string | undefined
31
38
  /**
32
39
  * Everything about how a session cookie is written, derived from the request host unless the deployment says
33
40
  * otherwise. The defaults are the ones a server on a real domain needs: a cookie shared across sub-domains, and
34
- * SameSite=None + Secure so it survives the app and the API being different hosts. A local server gets the
35
- * opposite, because Secure + SameSite=None over plain http is dropped by every browser.
41
+ * SameSite=None + Secure so it survives the app and the API being different hosts. A local server — this machine, or
42
+ * this machine as its network reaches it — gets the opposite, because Secure + SameSite=None over plain http is
43
+ * dropped by every browser.
36
44
  */
37
45
  export declare const sessionCookieParams: (hostname: string, config?: SSRAuthCookie) => SessionCookieParams;
38
46
  /** The readable companion cookie's name — the one a page is told to look for (`server.auth.sessionHintCookie`). */