copilotz 1.0.0-rc.53 → 1.0.0-rc.55

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 (102) hide show
  1. package/AGENTS.md +166 -6
  2. package/CHANGELOG.md +149 -0
  3. package/README.md +2 -2
  4. package/hosts/web/mod.d.ts +5 -4
  5. package/hosts/web/mod.js +5 -4
  6. package/hosts/web/pt-br/chat.js +4 -0
  7. package/hosts/web/pt-br/toolkit.js +2 -0
  8. package/hosts/web/style.d.ts +1 -1
  9. package/hosts/web/style.js +3 -1
  10. package/hosts/web/toolkit/anchor.js +33 -7
  11. package/hosts/web/toolkit/avatar.d.ts +8 -4
  12. package/hosts/web/toolkit/avatar.js +17 -6
  13. package/hosts/web/toolkit/calendar.d.ts +6 -0
  14. package/hosts/web/toolkit/calendar.js +25 -1
  15. package/hosts/web/toolkit/data-table.d.ts +13 -1
  16. package/hosts/web/toolkit/data-table.js +19 -6
  17. package/hosts/web/toolkit/date-picker.d.ts +11 -1
  18. package/hosts/web/toolkit/date-picker.js +118 -17
  19. package/hosts/web/toolkit/date-time-picker.d.ts +28 -3
  20. package/hosts/web/toolkit/date-time-picker.js +30 -13
  21. package/hosts/web/toolkit/dates.d.ts +24 -11
  22. package/hosts/web/toolkit/dates.js +109 -19
  23. package/hosts/web/toolkit/field.d.ts +6 -3
  24. package/hosts/web/toolkit/field.js +4 -5
  25. package/hosts/web/toolkit/file-input.d.ts +22 -1
  26. package/hosts/web/toolkit/file-input.js +41 -13
  27. package/hosts/web/toolkit/grid.d.ts +1 -1
  28. package/hosts/web/toolkit/grid.js +2 -2
  29. package/hosts/web/toolkit/icon.d.ts +5 -0
  30. package/hosts/web/toolkit/icon.js +5 -0
  31. package/hosts/web/toolkit/input.d.ts +12 -0
  32. package/hosts/web/toolkit/input.js +17 -1
  33. package/hosts/web/toolkit/page.d.ts +8 -1
  34. package/hosts/web/toolkit/page.js +8 -3
  35. package/hosts/web/toolkit/picker.d.ts +11 -3
  36. package/hosts/web/toolkit/picker.js +21 -8
  37. package/hosts/web/toolkit/rows-editor.d.ts +11 -2
  38. package/hosts/web/toolkit/rows-editor.js +10 -4
  39. package/hosts/web/toolkit/screen.d.ts +20 -0
  40. package/hosts/web/toolkit/screen.js +15 -0
  41. package/hosts/web/toolkit/select.d.ts +9 -1
  42. package/hosts/web/toolkit/select.js +7 -2
  43. package/hosts/web/toolkit/toolbar.d.ts +6 -4
  44. package/hosts/web/toolkit/toolbar.js +3 -2
  45. package/hosts/web/toolkit/words.d.ts +1 -1
  46. package/hosts/web/toolkit/words.js +2 -0
  47. package/hosts/web/words.d.ts +7 -0
  48. package/hosts/web/words.js +10 -0
  49. package/package.json +1 -1
  50. package/plugins/access/accounts/actions/model-key.js +41 -13
  51. package/plugins/access/accounts/collections/model-key.d.ts +22 -4
  52. package/plugins/access/accounts/collections/model-key.js +31 -6
  53. package/plugins/access/accounts/shared/rules.js +5 -4
  54. package/plugins/access/accounts/views/web/accounts.js +3 -1
  55. package/plugins/access/accounts/views/web/own-keys.d.ts +12 -0
  56. package/plugins/access/accounts/views/web/own-keys.js +112 -0
  57. package/plugins/access/accounts/views/web/style.d.ts +1 -1
  58. package/plugins/access/accounts/views/web/style.js +17 -0
  59. package/plugins/access/accounts/web.d.ts +2 -1
  60. package/plugins/access/accounts/web.js +4 -1
  61. package/plugins/access/email/actions/send.js +8 -2
  62. package/plugins/access/email/adapters/console.js +1 -1
  63. package/plugins/access/email/adapters/resend.js +2 -0
  64. package/plugins/access/email/adapters/sendmail.d.ts +13 -0
  65. package/plugins/access/email/adapters/sendmail.js +59 -0
  66. package/plugins/access/email/contract.d.ts +24 -1
  67. package/plugins/access/email/mod.d.ts +5 -2
  68. package/plugins/access/email/mod.js +10 -3
  69. package/plugins/access/email/shared/mime.d.ts +5 -1
  70. package/plugins/access/email/shared/mime.js +34 -8
  71. package/plugins/access/spaces/shared/agents.d.ts +12 -5
  72. package/plugins/access/spaces/shared/agents.js +19 -2
  73. package/plugins/access/spaces/views/web/agents.js +2 -1
  74. package/plugins/agents/chat/actions/welcomed.d.ts +1 -0
  75. package/plugins/agents/chat/actions/welcomed.js +20 -0
  76. package/plugins/agents/chat/collections/welcome.d.ts +23 -0
  77. package/plugins/agents/chat/collections/welcome.js +27 -0
  78. package/plugins/agents/chat/contract.d.ts +1 -1
  79. package/plugins/agents/chat/mod.js +14 -2
  80. package/plugins/agents/chat/processors/turn.js +6 -4
  81. package/plugins/agents/chat/shared/agents.d.ts +8 -6
  82. package/plugins/agents/chat/shared/agents.js +18 -22
  83. package/plugins/agents/chat/shared/types.d.ts +35 -1
  84. package/plugins/agents/chat/views/web/composer.d.ts +3 -1
  85. package/plugins/agents/chat/views/web/composer.js +4 -1
  86. package/plugins/agents/chat/views/web/conversation.js +1 -1
  87. package/plugins/agents/chat/views/web/home.d.ts +4 -1
  88. package/plugins/agents/chat/views/web/home.js +18 -1
  89. package/plugins/agents/chat/views/web/style.d.ts +1 -1
  90. package/plugins/agents/chat/views/web/style.js +2 -0
  91. package/plugins/agents/chat/views/web/welcome.d.ts +25 -0
  92. package/plugins/agents/chat/views/web/welcome.js +44 -0
  93. package/plugins/agents/chat/views/web/words.d.ts +1 -1
  94. package/plugins/agents/chat/views/web/words.js +5 -0
  95. package/plugins/billing/usage/views/web/words.d.ts +1 -1
  96. package/plugins/compute/computers/program/version.d.ts +1 -1
  97. package/plugins/compute/computers/program/version.js +1 -1
  98. package/plugins/compute/computers/program/workloads/search.d.ts +1 -1
  99. package/plugins/compute/computers/resources/downloads.js +1 -1
  100. package/plugins/models/shared/choice.d.ts +4 -1
  101. package/plugins/models/shared/use.d.ts +3 -2
  102. package/plugins/models/shared/use.js +9 -3
package/AGENTS.md CHANGED
@@ -4,7 +4,7 @@ A guide for coding agents (Claude Code, Codex, Cursor, Gemini) building an app w
4
4
  it whole before you write code. The last section is for work on Copilotz itself.
5
5
 
6
6
  It ships in the package (`node_modules/copilotz/AGENTS.md`, and `@copilotz/copilotz` on JSR) and
7
- goes with `copilotz@1.0.0-rc.53`. Every docs page is Markdown at
7
+ goes with `copilotz@1.0.0-rc.55`. Every docs page is Markdown at
8
8
  `https://copilotz.com/docs/<slug>.md`, and https://copilotz.com/llms.txt lists them all. When you're
9
9
  unsure of a name, fetch its page or read the package's types (`node_modules/copilotz/**/*.d.ts`).
10
10
  Don't guess.
@@ -64,12 +64,12 @@ There's no project generator. Set a project up as the docs' courses do, on Node
64
64
  ```sh
65
65
  mkdir my-app && cd my-app
66
66
  npm init -y && npm pkg set type=module
67
- npm install copilotz@1.0.0-rc.53 react@19 react-dom@19
67
+ npm install copilotz@1.0.0-rc.55 react@19 react-dom@19
68
68
  npm install -D typescript @types/node @types/react @types/react-dom esbuild
69
69
  ```
70
70
 
71
71
  Pin the version: npm's `latest` tag still points at an early release candidate. On Deno, run
72
- `deno add jsr:@copilotz/copilotz` and map `"copilotz": "jsr:@copilotz/copilotz@^1.0.0-rc.53"` in
72
+ `deno add jsr:@copilotz/copilotz` and map `"copilotz": "jsr:@copilotz/copilotz@^1.0.0-rc.55"` in
73
73
  `deno.json`, so imports read the same.
74
74
 
75
75
  Node runs `.ts` files as they are, so there's no build step. It doesn't run `.tsx`: tests that load
@@ -95,8 +95,10 @@ plugins/<name>/
95
95
  actions.ts … one file per primitive; or collections/, actions/, views/… with one file per
96
96
  declaration, as Copilotz's own plugins are laid out
97
97
  contract.ts what other plugins may import: shapes and small helpers, never code
98
- web.tsx its web front end (React Views); terminal.ts, its terminal one
98
+ web.tsx names its web Views, and nothing else; terminal.ts, its terminal front end
99
+ web/ one View per file (screen:…, dialog:…, panel:…), the components they draw beside
99
100
  server.ts the web host: reads the environment, passes settings to plugins()
101
+ front.ts the browser's plugins, in order; browser.tsx, the page's code: web({ plugins })
100
102
  tests/kit.ts the app as app.ts makes it, in memory, with a scripted model
101
103
  tests/*.test.ts
102
104
  .env OPENAI_API_KEY=… (optional; dev and terminal read it: --env-file-if-exists=.env)
@@ -108,7 +110,7 @@ line `@AGENTS.md` (Claude Code reads `CLAUDE.md`, and follows the import). Keep
108
110
  ```markdown
109
111
  # AGENTS.md
110
112
 
111
- This app runs on Copilotz (copilotz@1.0.0-rc.53). Read node_modules/copilotz/AGENTS.md first;
113
+ This app runs on Copilotz (copilotz@1.0.0-rc.55). Read node_modules/copilotz/AGENTS.md first;
112
114
  https://copilotz.com/llms.txt lists the docs, as Markdown.
113
115
 
114
116
  - `npm test` runs every test offline, with a scripted model: run it after each change.
@@ -306,7 +308,8 @@ Test what callers may not do as well: call as someone else, and `assert.rejects`
306
308
  - **Settings are resources, not code.** `app.ts` reads no environment: the server, the terminal or a
307
309
  test passes settings in. Agents name a model alias that the app sets.
308
310
  - **Writes that must agree go in one `ctx.transaction`.** A refused write rolls it all back. It
309
- holds the store's writer, so keep slow work out.
311
+ holds the store's writer, so keep slow work out. Another plugin's Action joins it with `tx.call`
312
+ when that Action is `atomic: true`.
310
313
  - **Who acts:** `personOf(ctx.actor)`, not `ctx.actor.id` (an agent's is its own). Where: `ctx.in`.
311
314
  A tool works where its chat is.
312
315
  - **Going past the actor's reach is a named grant,** `ctx.as(grant("…"))`, in trusted code, on the
@@ -326,6 +329,163 @@ Test what callers may not do as well: call as someone else, and `assert.rejects`
326
329
  - **Online:** `devSignIn` is for this machine only; Copilotz won't start it with a public origin.
327
330
  Keep the `links` secret (32 bytes or more) across restarts, or MCP conversations start over.
328
331
 
332
+ ## A business app's web front end
333
+
334
+ Screens for people at work: lists, forms in dialogs, dates, a home, printed documents.
335
+ [A business app's screens](https://copilotz.com/docs/guides/a-business-apps-screens.md) builds each
336
+ one in full, as files that compile;
337
+ [the web toolkit](https://copilotz.com/docs/guides/the-web-toolkit.md) has every piece, prop and
338
+ token. Read both before the first screen.
339
+
340
+ **Files and names.**
341
+
342
+ - **One View per file**, in `plugins/<name>/web/`, with the React components it draws beside it.
343
+ `web.tsx` only names the plugin's Views, as `mod.ts` assembles the server side. Not one big
344
+ `web.tsx`, and no shared UI library of the app's own.
345
+ - **A name says where a View shows.** `screen:<place>` is a whole screen at `/<place>…`.
346
+ `dialog:<name>` is a dialog over a screen, at an address of that screen (`/customers/12`), so Back
347
+ closes it and the list behind keeps its page. `panel:<name>` is a part of another View that reads
348
+ its own data.
349
+ - **The app's frame** is a View named `web.shell`, the one the web host observes for the address:
350
+ given `{ path, query }`, it draws the bars and shows ``ctx.show(`screen:${place}`, where)``. List
351
+ its plugin last among the browser's. Under Copilotz's own shell (`webShell`), `/<kind>/<id>` shows
352
+ the View named `<kind>` or `web.<kind>` instead.
353
+
354
+ **Views read, handlers call Actions.**
355
+
356
+ - **A View reads in its own body** with `ctx.db`: a named query, `.query(name, params)`, or `find`,
357
+ `findOne`, `countDocuments`. A read is `{ status: "loading" }`, then `{ status: "ready", value }`,
358
+ and the View runs again when a commit changes it. It hands values to React components. Don't fetch
359
+ in an effect, poll, or call `/api/` from the page.
360
+ - **Screens read named queries with an `allow`** (`people`): they run on the server, as whoever
361
+ asks. In the browser a View's own `find` reaches only a collection a rule speaks for (`shared`, or
362
+ a `guard`); any other answers `forbidden` ("You can't see this here").
363
+ - **Handlers call Actions** with `ctx.call(name, input)`: a click, a submit. A View never writes,
364
+ and calls nothing while it renders. Suggestions as someone types come from an unrecorded Action
365
+ (`record: false`, with an `allow`) that runs the query.
366
+ - **A View is a function the runtime runs again, not a component:** no hooks, no state. A form's
367
+ draft, a chosen file and `useShortcuts` live in a component the View returns.
368
+ - **`ctx.show(name, item)` goes in a View's body only.** It's how a View shows a View: what it
369
+ returns is a part that reads and redraws on its own, handed to a component as a child or a prop.
370
+ Another plugin's View is shown by name, without importing its code (`undefined` when there's
371
+ none). Called later (a component's render, a handler, a table's `render` or `detail`), it throws:
372
+ `<LazyView kind="panel:…" item={…} />` shows a View on demand.
373
+ - **Validation errors come from the Action.** The browser's `required` and `type` help first. Then
374
+ the Action checks, for every caller, and throws
375
+ `failure("invalid", "Give the name.", { public:
376
+ true })`: `ctx.call` rejects with those words,
377
+ and a `Form` whose `onSubmit` throws shows them at its top. A refusal about one field names it in
378
+ `detail` (`Object.assign(failure(…), { detail: {
379
+ field: "name" } })`), and the form puts it in
380
+ that `Field`'s `error`. An `input` schema's messages are for developers. A dialog closes only
381
+ after the Action answered.
382
+
383
+ **Toolkit first.**
384
+
385
+ - **Every screen is the toolkit's pieces**, `copilotz/web`, layout included. The look is the theme's
386
+ configuration and nothing else: the `theme` resource's colours (`light`, `dark`), sizes (`tokens`)
387
+ and each piece's own tokens (`button-height`, `table-stripe`…). No stylesheet, no `style={{…}}`
388
+ for a look, no rule on a `.copilotz-*` class, no restyled copy of a piece. `className` may name an
389
+ element for a test, never restyle it.
390
+ - **Something the toolkit lacks is a gap to report**, with the smallest example of what's needed,
391
+ never a reason for CSS. Compose first: most "missing" pieces are a `Grid`, a `Stack` or a `Card`
392
+ of existing ones.
393
+ - **The one exception is a printed document's paper layout**: `@media print` rules beside it.
394
+ - **Words and formats are the app's.** The toolkit's words (`toolkit.noRows`, the date presets) are
395
+ changed by key in the `words` resource
396
+ ([WORDS.md](https://github.com/copilotzhq/copilotz/blob/main/hosts/web/WORDS.md) lists them). Time
397
+ zone and date patterns are settings the screens read, never the browser's locale.
398
+ - **Where the names are:** the toolkit guide's sections and its "Every piece's tokens" tables; the
399
+ types, `node_modules/copilotz/hosts/web/toolkit/*.d.ts`, and the theme's,
400
+ `node_modules/copilotz/hosts/web/theme/default.d.ts`.
401
+
402
+ The pieces, by job:
403
+
404
+ - **Layout:** `Page`, `Screen`, `Stack`, `Grid`, `GridItem`, `Toolbar`, `Split`, `Card`,
405
+ `ListGroup`, `Tabs`, `Divider`, `Spacer`, `Heading`, `Text`.
406
+ - **Fields:** `Form`, `Field`, `Input`, `Textarea`, `Select`, `Checkbox`, `Radio`, `Switch`,
407
+ `Picker`, `MultiPicker`, `Autocomplete`, `TagsInput`, `FileInput`, `RowsEditor`, `DatePicker`,
408
+ `DateRangePicker`, `DateTimePicker`, `TimeFields`.
409
+ - **Actions and overlays:** `Button`, `IconButton`, `Menu`, `Popover`, `Dialog`, `Drawer`,
410
+ `Tooltip`, `toast` and `Toasts`.
411
+ - **Data:** `DataTable` (with `tableAddress`, `tableQuery`), `Pagination`, `DetailList`, `Badge`,
412
+ `Chip`, `Avatar`, `Notice`, `EmptyState`, `Skeleton`, `Spinner`, `Kbd`.
413
+ - **An app's own frame:** `AppBar`, `TopBar`, `TileGrid`, `LiveClock`, `Logo`, `Icon` (`drawing`: an
414
+ app's own glyph).
415
+ - **Paper and files:** `NoPrint`, `PrintOnly`, `Barcode`, `download`, `exportFile`; on a server,
416
+ `documentPdf` from `copilotz/web/export`. **Keys:** `useShortcuts`, `shortcutLabel`.
417
+
418
+ **Short recipes** (whole, in the guide):
419
+
420
+ - **A list with search, filters, paging and exports:** a `Page` (`width="lg"`, New in `actions`)
421
+ over a `Toolbar` of filters and a `DataTable`. Up to a few thousand rows, give the table every row
422
+ and it searches, sorts, pages and exports them (`exportAll`: every matching row). More, a named
423
+ query takes the table's state and answers `{ rows, total }`: spread `tableAddress(where, 25)` on
424
+ the table, give it `total`, and keep each filter in the address too, back to the first page
425
+ (`go(path + tableQuery(where, { ...state, offset: 0 }, { from, to }))`). The export menu saves the
426
+ rows shown; every row of a server-paged list is an unrecorded Action's, saved with `download`.
427
+ - **A create or edit form in a dialog:** the screen shows
428
+ `ctx.show("dialog:customer", { _id, back
429
+ })` when its address names one (`/customers/new`,
430
+ `/customers/<id>`). The dialog's View reads the record and returns a component: a `Dialog`
431
+ (`placement="top"`) around a `Form` of `Field
432
+ layout="row"`s, Save in its footer submitting the
433
+ form by its id (`form="customer"`). `onSubmit` calls the Action, then `toast()` and `go(back)`.
434
+ - **Date, date-time and date-range fields:** days are `YYYY-MM-DD` and times `YYYY-MM-DD HH:mm` or
435
+ `HH:mm:ss`, the app's clock time with no zone, never ISO timestamps. `todayIn(timeZone)` and
436
+ `nowIn(timeZone)` in the app's zone, `format` patterns from its settings. `DatePicker`;
437
+ `DateTimePicker` keeps a value's seconds until its time changes (`seconds` shows them);
438
+ `DateRangePicker` has `presets` (or `rangePresets(…)`), typed From and To, and `time` for ends
439
+ with a time of day.
440
+ - **A sign-in page:** Copilotz's own, with `passwordSignIn` (staff with usernames) or `emailSignIn`:
441
+ the theme gives its look (`themeOf([look])` on the server), the `signInPage` resource its words
442
+ and pitch. Accounts come from an Action of the app's that calls `password.set`. Don't write a
443
+ sign-in route or a session cookie. A page before sign-in is `routePage` (`copilotz/web/server`)
444
+ with a `Screen`, which centres a card and keeps a footer at the window's foot.
445
+ - **A home of tiles with an app bar:** the frame's `web.shell`: a `TopBar` (`LiveClock`, who's
446
+ signed in, Sign out with `signOut()`), an `AppBar` (`items`, `active`), the screen, and
447
+ `<Toasts />` once. At `/`, a `Page` of a `TileGrid`.
448
+ - **A printed document:** a screen at its own address: a `Page` with Print in a `NoPrint`, its
449
+ content (`DetailList`, `DataTable`, `Barcode`), `PrintOnly` for paper's words, and the paper's
450
+ `@media print` rules beside it. It prints without the bars, buttons or the page's header
451
+ (`printHeader` keeps it). The same as a PDF on a server, for e-mail: `documentPdf`.
452
+ - **Keyboard shortcuts:** `useShortcuts({ "Alt+N": add, Escape: { run: close, inFields: true } })`
453
+ in a component of the screen, and `<Kbd>{shortcutLabel("Alt+N")}</Kbd>` where it's offered. Keys
454
+ wait while someone types in a field or a dialog is open. No `keydown` listener on `document`.
455
+ - **File and image inputs:** `FileInput` (`accept`; `chooseLabel`, `changeLabel`, `removeLabel`;
456
+ `current` and `onRemove` for a stored file). A picture chosen shows in an `Avatar`
457
+ (`picture={URL.createObjectURL(file)}`, `initial={false}`). The form sends it to an Action as a
458
+ `data:` address, the Action `private: ["picture"]` so its record doesn't keep it twice; big files
459
+ are served by a route with `runtime.bytes`.
460
+
461
+ **Common mistakes:**
462
+
463
+ - A UI kit and stylesheets of the app's own, inline styles for looks, or overrides of `.copilotz-*`,
464
+ instead of the toolkit and the theme. Hand-made `<table>`s of fields (use `DataTable` with fields
465
+ in cells, or `RowsEditor`), a hidden `<input type="file">` behind buttons (`FileInput`), the
466
+ browser's `datetime-local` (`DateTimePicker`), a `document` key listener (`useShortcuts`), a form
467
+ part listening for the DOM's `submit` (`Form` and `useFormSubmit`).
468
+ - One big `web.tsx`; a View that holds state or hooks; a screen fetching `/api/queries/…` from an
469
+ effect instead of reading `ctx.db` in the View; a browser View's `find` on a collection no rule
470
+ speaks for, instead of a named query; `ctx.show` in a row's `render`.
471
+ - A refusal returned as a value (`{ ok: false }`) instead of a thrown public `failure`: the REST API
472
+ answers 200 and a script believes it worked. A second Action, or a second input shape, for
473
+ scripts.
474
+ - A table's page, sort and filters kept in component state: Back and a closed dialog lose them. Keep
475
+ them in the address.
476
+ - Forms as pages, a capability reachable only by an Action no screen calls, a disabled placeholder
477
+ for a field that should work. Open every screen in a browser and use it, not only its tests.
478
+ - A save per field on blur, racing the next one: keep a record's edits together and send them once
479
+ (Save, or a row's Update and Enter).
480
+ - Dates in the browser's locale (`toLocaleString`, `<input type="date">`) or as ISO timestamps given
481
+ to a picker; a function `format` on a range people type into (it can't be read back: use a
482
+ pattern); a record's date-time saved unchanged without its seconds.
483
+ - A `controlWidth` from rc.52–53 or from a CSS-grid habit. Both `labelWidth` and `controlWidth` are
484
+ shares of the whole row: `"33.33%"` and `"66.67%"` fill it.
485
+ - A workaround copied from an older release: rc.54 has `Screen`, typed range ends, seconds, `hidden`
486
+ on layout pieces, fields that fit table cells, `detailOpen`, `Toolbar grow`, a file field's own
487
+ words and picture previews.
488
+
329
489
  ## Recipes
330
490
 
331
491
  Each link is a page as Markdown. GS is Getting Started (a salon's bookings, 10 chapters). BC is
package/CHANGELOG.md CHANGED
@@ -1,3 +1,152 @@
1
+ ## 1.0.0-rc.55 — 2026-11-18
2
+
3
+ What an app's first minutes ask of Copilotz: a welcome, a team people can shape, models chosen by
4
+ budget rather than agent by agent, and keys of a person's own.
5
+
6
+ **Breaking, in small ways:**
7
+
8
+ - **Tiers are templates; agents hold no model where tiers apply.** Each agent does a kind of work
9
+ (one of the app's: a tier's keys, titled by the new `tierKinds` resource; or the org's own), and
10
+ the tier in force gives that kind its model chain. Agents people make do a kind too (`like`), no
11
+ longer keeping a model of their own. `tiers.pick` and per-agent picks (`modelChoice.custom`) are
12
+ gone: an org changes a tier's chain for a kind (`tiers.save`), for every agent of that kind. With
13
+ no tier chosen anywhere, the app's first applies.
14
+ - **`modelChoice.offered` answers by kind of work**: each tier's `kinds` (in place of `agents`),
15
+ `kinds` with the app's agents of each, `removed`, and `now` as `{ tier, by }`. `modelChoice.agent`
16
+ answers an agent's kind, the tier in force and its chain. The page prices a typical **message**
17
+ where the app measured one (`typicalMessage`), else a reply.
18
+ - **`agentsNamed` asks `agentSources` first**: a source's answer for one of the app's agents is an
19
+ org's own version of it, over the app's.
20
+
21
+ **Which tier, and an org's own tiers:**
22
+
23
+ - **Every conversation runs on a tier**, the first that applies: the conversation's, the person's
24
+ own default for new chats, the space's, the org's, the plan's (`tiers.choose { thread }`,
25
+ `{ mine }`, `{ space }`, `{}`). Chat passes the conversation to `agentModel`.
26
+ - **An org's tiers:** its version of one of the app's (a kind's chain, its name), new ones made from
27
+ another (`tiers.save`), the app's taken away and put back (`tiers.remove`, `tiers.restore`), kinds
28
+ of work of its own based on the app's (`tiers.kind`), and a cap on what its members choose
29
+ (`tiers.cap`). A chain set by hand keeps the `maxTokens` and `effort` of the one it replaces.
30
+ - **A typical message, measured** (`typicalMessage`: each agent's calls and tokens per message) and
31
+ **what the plan gives** (`planCredits`, credits' new `billing.credits`): the tiers say what a
32
+ message comes to, and how far the credits go. A ChatGPT-plan entry is priced at the next that
33
+ costs something.
34
+ - **On the web:** the org's Agents page (tier cards with each kind's model and fallbacks, Customize,
35
+ New tier, the members' cap, and on Free how much faster a heavier tier spends), a tier picker
36
+ beside the send button (chat's new `composerControls`), a space's default tier, and `tiers.setup`,
37
+ a short choice for a new org. Every word is the app's (`tiers.<key>`).
38
+
39
+ **The org's team** (`@copilotz/team`):
40
+
41
+ - **Every org starts with the app's agents; its owners and admins shape them.** Changing one keeps
42
+ the org's version under its name (`agent.update`); `agent.delete` takes it off the team (it leaves
43
+ every space, joins no new one), `agent.restore` puts it back, `agent.reset` drops the org's
44
+ changes. An agent made for the org (`in: "*"`) works in every space and joins new ones. Spaces
45
+ seat the org's team as they're made.
46
+ - **Making an agent starts from what it should do:** `agent.sketch` drafts its name, emoji,
47
+ description, instructions and kind of work in one quick call (the app's `cheap` model), for the
48
+ person to check; the form asks for a kind of work instead of a model where tiers apply.
49
+ - **An agent proposes one** (`propose_agent`): its person is asked as chat asks for everything, and
50
+ it's made only on their yes, where they could have made it themselves.
51
+
52
+ **A welcome, and keys of one's own:**
53
+
54
+ - **Chat's `welcome`:** steps an app and its front ends add (a View each, with roles and kinds of
55
+ org), shown once per person per org over home, in a dialog; `/?welcome=1` shows it again
56
+ (`chat.welcomed`, `welcome.seen`). Credits adds a plan step for a new team org (`billing.setup`),
57
+ whose payment page comes back to the welcome (`billing.checkout`'s new `back`).
58
+ - **A person's own API keys** (`modelKey.set { mine }`): any provider a key can be brought for; a
59
+ model call for them uses theirs, then the org's, then the app's. The Connected accounts page lists
60
+ them, and says where the org's tiers use each provider's models.
61
+
62
+ **Words:**
63
+
64
+ - **`sayText`** (`copilotz/web/words`): text the app's data holds, in the app's words where it gives
65
+ them under `text.` and the English (a tier's description, a kind of work, an agent's description);
66
+ else as it is. The tiers' and team's pages say them so.
67
+ - **The tiers' prices follow the page's language** ("2,3¢" in Portuguese).
68
+
69
+ ## 1.0.0-rc.54 — 2026-11-17
70
+
71
+ What a business app's screens still asked of the toolkit and of e-mail, and the docs that show a
72
+ coding agent how to build them.
73
+
74
+ **Changed:**
75
+
76
+ - **`Field`'s `controlWidth` is a share of the whole row** (label and control), as a grid column is,
77
+ no longer of the control's column: `labelWidth="33.33%"` with `controlWidth="66.67%"` fills the
78
+ row. Its token `field-row-control-width` is `1fr` by default.
79
+ - **A `Page`'s header doesn't print**, as the toolkit's bars don't; `printHeader` keeps it.
80
+
81
+ **Dates:**
82
+
83
+ - **`DateRangePicker`** has typed From and To fields over its months, in the field's `format`: a
84
+ date moves the range and the months, anything else is marked and changes nothing. A long range
85
+ opens on its start's months. `time` gives each end a time of day. Apply and Cancel stay in view
86
+ when the panel scrolls.
87
+ - **`DateTimePicker`** and the day-time helpers take `YYYY-MM-DD HH:mm:ss`: a value's seconds are
88
+ kept until its time is changed (a form saving a record's date unchanged dropped them), and
89
+ `seconds` shows them in a field of their own.
90
+ - **A popover with no room over or under its field** (a range's panel low in a short window) goes on
91
+ the roomier side, as tall as that room, and scrolls inside: it no longer runs past the window's
92
+ foot, so the range's Apply and Cancel stay in view.
93
+ - **New exports:** `TimeFields` (a time of day's fields alone, the pickers' own; its value a
94
+ `Clock`, `{ hour, minute, second? }`), `parseDay` (a day read back in a picker's `format`),
95
+ `parsePattern` (a day read back by a pattern) and `partsOfDayTime`.
96
+
97
+ **Tables and fields:**
98
+
99
+ - **Fields in `DataTable` cells** fill their column and shrink with it, `Select` and the pickers
100
+ without their minimum width there; `layout="fixed"` keeps columns at their `width`s.
101
+ - **`detailOpen`** opens a table's detail rows: all of them (`true`, with no button) or those a
102
+ function picks.
103
+ - **A wide table no longer widens the page**: its screen-reader header words stay inside its scroll.
104
+ - **`Select`, `Picker` and `MultiPicker` take `addon` and `addonEnd`**, as `Input` does.
105
+ - **`FileInput`** takes its own words (`chooseLabel`, `changeLabel`, `removeLabel`) and a file
106
+ already stored (`current`, removed by `onRemove`).
107
+ - **`FileInput` wraps in a narrow column** (a phone, a table's cell): the name takes a line of its
108
+ own, cut short, and its buttons' words wrap, so Remove no longer runs past the field.
109
+ - **`RowsEditor`**: `add={false}` leaves out its add buttons; `removeIcon` and `removeLabel` set the
110
+ remove button.
111
+ - **`Avatar`** shows a picture picked but not yet sent (`blob:`, image `data:`), and
112
+ `initial={false}` draws an empty box.
113
+
114
+ **Layout:**
115
+
116
+ - **`hidden` hides any toolkit piece**: a `Stack`'s or `Grid`'s own display no longer wins over it.
117
+ - **`Screen`**: a frame that fills the window, centring what it holds and keeping a `footer` at the
118
+ window's foot: a sign-in's card, a route's own page.
119
+ - **`Page` `align="center"`** centres the title and description; **`Toolbar` `grow`** takes the room
120
+ left (a search field).
121
+ - **Icons:** `cart`, `gift`, `credit-card`, `piggy-bank`, `tags`.
122
+
123
+ **E-mail:**
124
+
125
+ - **The `sendmail` adapter** hands a message to a sendmail program (Postfix's, Exim's, msmtp's):
126
+ `adapter: "sendmail"`, `sendmail: { path, args, timeout }`. It runs the program with arguments,
127
+ never a shell, recipients after `--`. The e-mail plugin exports its MIME writer (`mime`) for an
128
+ app's own adapter, and the writer refuses a line break in a header.
129
+ - **Inline images:** an attachment with an `id` is inline, and the HTML shows it as `cid:<id>` (a
130
+ receipt's logo, without a data address counting against the HTML's 500,000 characters). SMTP,
131
+ sendmail and Resend send them.
132
+
133
+ **Docs:**
134
+
135
+ - **AGENTS.md has a business app's web front end:** the files (`plugins/<name>/web/`, one View per
136
+ file, `web.tsx` only naming them), the names (`screen:`, `dialog:`, `panel:`), an app's own frame
137
+ (`web.shell`), Views that read with `ctx.db` and handlers that call Actions, `ctx.show` in a
138
+ View's body, where a form's errors come from, the toolkit first with no CSS, its pieces by job,
139
+ short recipes, and the common mistakes.
140
+ - **[A business app's screens](docs/guides/a-business-apps-screens.md)**, a new guide: the recipes
141
+ in full, as files that compile: an app's frame and home of tiles, a list with search, filters,
142
+ paging and exports, a form in a dialog, a View inside a View, dates, sign-in, a printed document,
143
+ keyboard shortcuts, files and pictures.
144
+ - **[The web toolkit](docs/guides/the-web-toolkit.md)** for rc.54: `Screen` for a sign-in or a
145
+ route's own page; `Field`'s widths as shares of the whole row, and how to convert one from rc.53;
146
+ the range's typed From and To, and why a typed range wants a pattern `format` (a function can't be
147
+ read back); ends with times, a preset's `00:00` to `23:59`; seconds in day-times; `TimeFields` and
148
+ the day-time helpers.
149
+
1
150
  ## 1.0.0-rc.53 — 2026-11-16
2
151
 
3
152
  **A page on `*.localhost` connects.** A page served on a `*.localhost` host (`shop.localhost`) now
package/README.md CHANGED
@@ -152,7 +152,7 @@ ana sees: Tue 10:00, Wed 15:00
152
152
  ```sh
153
153
  npm install copilotz@next # Node 24+ (npm, pnpm, yarn)
154
154
  bun add copilotz@next # Bun
155
- deno add jsr:@copilotz/copilotz@^1.0.0-rc.53 # Deno 2.9+ (or `deno add npm:copilotz@next`)
155
+ deno add jsr:@copilotz/copilotz@^1.0.0-rc.55 # Deno 2.9+ (or `deno add npm:copilotz@next`)
156
156
  ```
157
157
 
158
158
  Until 1.0, the release candidates are on npm's `next` tag, and a plain `npm install copilotz` or
@@ -166,7 +166,7 @@ OPENAI_API_KEY=sk-… node salon.ts # or bun salon.ts, or deno run -A salon.t
166
166
  ```
167
167
 
168
168
  On Deno, map the name `copilotz` in `deno.json`
169
- (`"copilotz": "jsr:@copilotz/copilotz@^1.0.0-rc.53"`) so the imports read the same everywhere.
169
+ (`"copilotz": "jsr:@copilotz/copilotz@^1.0.0-rc.55"`) so the imports read the same everywhere.
170
170
  Copilotz runs on Node 24+, Deno 2.9+ and Bun, and it's built on web standards for Cloudflare Workers
171
171
  and the browser.
172
172
 
@@ -11,7 +11,7 @@
11
11
  */
12
12
  export { go, signOut, web, type WebOptions, type Where, type Who } from "./host.js";
13
13
  export { appBase } from "./base.js";
14
- export { type Blanks, defineWords, fill, formatDate, formatDateTime, formatList, formatNumber, formatTime, knownWords, lang, type Phrase, type Say, setWords, type Words, wordsOf, } from "./words.js";
14
+ export { type Blanks, defineWords, fill, formatDate, formatDateTime, formatList, formatNumber, formatTime, knownWords, lang, type Phrase, type Say, sayText, setWords, type Words, wordsOf, } from "./words.js";
15
15
  export { message, node, Part } from "./part.js";
16
16
  export { display, type DisplayMode, openLink, remind, surface, tell, useRefresh, } from "./surface.js";
17
17
  export { LazyView } from "./lazy.js";
@@ -56,6 +56,7 @@ export { type Space } from "./toolkit/space.js";
56
56
  export { type Align, Divider, type Justify, Spacer, Stack } from "./toolkit/stack.js";
57
57
  export { Grid, GridItem } from "./toolkit/grid.js";
58
58
  export { Toolbar } from "./toolkit/toolbar.js";
59
+ export { Screen } from "./toolkit/screen.js";
59
60
  export { Split } from "./toolkit/split.js";
60
61
  export { ListGroup, type ListGroupItem } from "./toolkit/list-group.js";
61
62
  export { Heading, Text, type TextTone } from "./toolkit/text.js";
@@ -67,10 +68,10 @@ export { type Column, type Key as RowKey, PAGE_SIZES, type TableState, tableView
67
68
  export { tableAddress, tableQuery, tableState } from "./table-address.js";
68
69
  export { download, EXPORT_FORMATS, exportFile, type ExportFormat, type ExportOptions, type Sheet, toCsv, toExcel, toJson, toPdf, toSql, toXlsx, toXml, } from "./toolkit/export.js";
69
70
  export { documentPdf, type Drawn, type PageSize, type PdfFont, type PdfOptions, tablePdf, textWidth, wrapText, } from "./toolkit/pdf.js";
70
- export { Calendar, type CalendarValue, type DayFormat, formatDay } from "./toolkit/calendar.js";
71
+ export { Calendar, type CalendarValue, type DayFormat, formatDay, parseDay, } from "./toolkit/calendar.js";
71
72
  export { DatePicker, DateRangePicker, type RangePreset, rangePresets, STANDARD_PRESETS, } from "./toolkit/date-picker.js";
72
- export { addDays, addMonths, clampDayTime, type DateRange, type DayTime, formatPattern, isDay, isDayTime, nowIn, type Preset, presetRange, todayIn, } from "./toolkit/dates.js";
73
- export { DateTimePicker, type DayTimeFormat, formatDayTime } from "./toolkit/date-time-picker.js";
73
+ export { addDays, addMonths, clampDayTime, type DateRange, type DayTime, formatPattern, isDay, isDayTime, nowIn, parsePattern, partsOfDayTime, type Preset, presetRange, todayIn, } from "./toolkit/dates.js";
74
+ export { type Clock, DateTimePicker, type DayTimeFormat, formatDayTime, TimeFields, } from "./toolkit/date-time-picker.js";
74
75
  export { LiveClock } from "./toolkit/live-clock.js";
75
76
  export { dismissToast, toast, type ToastOptions, type ToastPlacement, Toasts, type ToastTone, } from "./toolkit/toast.js";
76
77
  export { type Binding, shortcutLabel, useShortcuts } from "./toolkit/shortcuts.js";
package/hosts/web/mod.js CHANGED
@@ -12,7 +12,7 @@
12
12
  export { go, signOut, web } from "./host.js";
13
13
  export { appBase } from "./base.js";
14
14
  // The words every front end says, by key: the app's `words` resource over the English.
15
- export { defineWords, fill, formatDate, formatDateTime, formatList, formatNumber, formatTime, knownWords, lang, setWords, wordsOf, } from "./words.js";
15
+ export { defineWords, fill, formatDate, formatDateTime, formatList, formatNumber, formatTime, knownWords, lang, sayText, setWords, wordsOf, } from "./words.js";
16
16
  export { message, node, Part } from "./part.js";
17
17
  // Where Views are drawn (the page, or a widget in an outside assistant), and what a widget asks of
18
18
  // its host: no-ops on the page.
@@ -64,6 +64,7 @@ export { Tooltip } from "./toolkit/tooltip.js";
64
64
  export { Divider, Spacer, Stack } from "./toolkit/stack.js";
65
65
  export { Grid, GridItem } from "./toolkit/grid.js";
66
66
  export { Toolbar } from "./toolkit/toolbar.js";
67
+ export { Screen } from "./toolkit/screen.js";
67
68
  export { Split } from "./toolkit/split.js";
68
69
  export { ListGroup } from "./toolkit/list-group.js";
69
70
  export { Heading, Text } from "./toolkit/text.js";
@@ -78,10 +79,10 @@ export { tableAddress, tableQuery, tableState } from "./table-address.js";
78
79
  export { download, EXPORT_FORMATS, exportFile, toCsv, toExcel, toJson, toPdf, toSql, toXlsx, toXml, } from "./toolkit/export.js";
79
80
  export { documentPdf, tablePdf, textWidth, wrapText, } from "./toolkit/pdf.js";
80
81
  // Dates: days as `YYYY-MM-DD`, in the app's format and time zone.
81
- export { Calendar, formatDay } from "./toolkit/calendar.js";
82
+ export { Calendar, formatDay, parseDay, } from "./toolkit/calendar.js";
82
83
  export { DatePicker, DateRangePicker, rangePresets, STANDARD_PRESETS, } from "./toolkit/date-picker.js";
83
- export { addDays, addMonths, clampDayTime, formatPattern, isDay, isDayTime, nowIn, presetRange, todayIn, } from "./toolkit/dates.js";
84
- export { DateTimePicker, formatDayTime } from "./toolkit/date-time-picker.js";
84
+ export { addDays, addMonths, clampDayTime, formatPattern, isDay, isDayTime, nowIn, parsePattern, partsOfDayTime, presetRange, todayIn, } from "./toolkit/dates.js";
85
+ export { DateTimePicker, formatDayTime, TimeFields, } from "./toolkit/date-time-picker.js";
85
86
  export { LiveClock } from "./toolkit/live-clock.js";
86
87
  // Telling: a few seconds' word over the page.
87
88
  export { dismissToast, toast, Toasts, } from "./toolkit/toast.js";
@@ -161,6 +161,10 @@ export const chat = {
161
161
  "chat.notFoundTitle": "Conversa não encontrada",
162
162
  "chat.notInSpace": "Você não está neste espaço",
163
163
  "chat.notInSpaceBody": "As conversas daqui são para os membros. Escolha um dos seus espaços para começar uma, ou peça a alguém daqui para convidar você.",
164
+ "chat.welcomeStep": "{at} de {count}",
165
+ "chat.welcomeBack": "Voltar",
166
+ "chat.welcomeNext": "Próximo",
167
+ "chat.welcomeDone": "Começar",
164
168
  "chat.notYourSpaceTitle": "Este espaço não é seu",
165
169
  "chat.ofMinutes": {
166
170
  one: ", de no máximo {count} minuto",
@@ -65,6 +65,8 @@ export const toolkit = {
65
65
  "toolkit.previousMonth": "Mês anterior",
66
66
  "toolkit.previousPage": "Página anterior",
67
67
  "toolkit.print": "Imprimir",
68
+ "toolkit.rangeFrom": "De",
69
+ "toolkit.rangeTo": "Até",
68
70
  "toolkit.removeFile": "Remover",
69
71
  "toolkit.removeRow": "Remover a linha {row}",
70
72
  "toolkit.removeTag": "Remover {tag}",
@@ -13,4 +13,4 @@
13
13
  * toolkit's own layer; a printed document's own layout (a receipt's width,
14
14
  * an invoice's margins) is its app's CSS, the one place an app writes some.
15
15
  */
16
- export declare const BASE = "\n@layer copilotz-base, copilotz-toolkit;\n@layer copilotz-base {\n:root {\n font: 15px/1.55 var(--font-sans);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n text-rendering: optimizeLegibility;\n -webkit-text-size-adjust: 100%;\n text-size-adjust: 100%;\n}\n*, *::before, *::after { box-sizing: border-box; }\nhtml, body, #app { height: 100%; }\n/* An app's page: it never scrolls sideways or bounces as a whole (its panes scroll); a tap is a\n tap (no double-tap zoom, no grey flash), and pinching still zooms. */\nhtml, body { overflow-x: clip; overscroll-behavior: none; }\nhtml { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }\nbody { margin: 0; background: var(--background); color: var(--foreground); }\nbutton, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }\na { color: inherit; }\ncode, kbd, pre, samp { font-family: var(--font-mono); font-variant-ligatures: none; }\n:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }\n::selection { background: color-mix(in oklab, var(--primary-text) 28%, transparent); }\n.copilotz-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;\n overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }\n/* Touch screens: text a little larger, and fields at 16px at least, so phones never zoom in on\n one you type in (Safari does under 16px). Important, so every field's size gives way. */\n@media (pointer: coarse) {\n :root { font-size: 16px; }\n input, textarea, select { font-size: max(16px, 1em) !important; }\n}\n@media (prefers-reduced-motion: reduce) {\n *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important;\n transition-duration: .01ms !important; scroll-behavior: auto !important; }\n}\n/* Printed: all of the page, without what's for working the screen. */\n@media print {\n html, body, #app { height: auto !important; overflow: visible !important; }\n .copilotz-page-full { height: auto !important; overflow: visible !important; }\n .copilotz-no-print, .copilotz-appbar, .copilotz-topbar, .copilotz-toolbar, .copilotz-toasts,\n .copilotz-table-toolbar, .copilotz-table-control, .copilotz-pagination,\n .copilotz-button, .copilotz-icon-button, .copilotz-popover, .copilotz-menu, .copilotz-tooltip,\n .copilotz-autocomplete, .copilotz-going, .copilotz-skip { display: none !important; }\n .copilotz-table-box { overflow: visible !important; }\n}\n@media not print { .copilotz-print-only { display: none !important; } }\n}\n";
16
+ export declare const BASE = "\n@layer copilotz-base, copilotz-toolkit;\n@layer copilotz-base {\n:root {\n font: 15px/1.55 var(--font-sans);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n text-rendering: optimizeLegibility;\n -webkit-text-size-adjust: 100%;\n text-size-adjust: 100%;\n}\n*, *::before, *::after { box-sizing: border-box; }\nhtml, body, #app { height: 100%; }\n/* An app's page: it never scrolls sideways or bounces as a whole (its panes scroll); a tap is a\n tap (no double-tap zoom, no grey flash), and pinching still zooms. */\nhtml, body { overflow-x: clip; overscroll-behavior: none; }\nhtml { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }\nbody { margin: 0; background: var(--background); color: var(--foreground); }\nbutton, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }\na { color: inherit; }\ncode, kbd, pre, samp { font-family: var(--font-mono); font-variant-ligatures: none; }\n:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }\n::selection { background: color-mix(in oklab, var(--primary-text) 28%, transparent); }\n/* `hidden` hides every toolkit piece, whatever display its own rule gives it. */\n:where([class*=\"copilotz-\"])[hidden] { display: none !important; }\n.copilotz-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;\n overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }\n/* Touch screens: text a little larger, and fields at 16px at least, so phones never zoom in on\n one you type in (Safari does under 16px). Important, so every field's size gives way. */\n@media (pointer: coarse) {\n :root { font-size: 16px; }\n input, textarea, select { font-size: max(16px, 1em) !important; }\n}\n@media (prefers-reduced-motion: reduce) {\n *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important;\n transition-duration: .01ms !important; scroll-behavior: auto !important; }\n}\n/* Printed: all of the page, without what's for working the screen. */\n@media print {\n html, body, #app { height: auto !important; overflow: visible !important; }\n .copilotz-page-full { height: auto !important; overflow: visible !important; }\n .copilotz-page-head:not(.copilotz-page-head-print), .copilotz-no-print, .copilotz-appbar, .copilotz-topbar, .copilotz-toolbar, .copilotz-toasts,\n .copilotz-table-toolbar, .copilotz-table-control, .copilotz-pagination,\n .copilotz-button, .copilotz-icon-button, .copilotz-popover, .copilotz-menu, .copilotz-tooltip,\n .copilotz-autocomplete, .copilotz-going, .copilotz-skip { display: none !important; }\n .copilotz-table-box { overflow: visible !important; }\n}\n@media not print { .copilotz-print-only { display: none !important; } }\n}\n";
@@ -36,6 +36,8 @@ a { color: inherit; }
36
36
  code, kbd, pre, samp { font-family: var(--font-mono); font-variant-ligatures: none; }
37
37
  :focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
38
38
  ::selection { background: color-mix(in oklab, var(--primary-text) 28%, transparent); }
39
+ /* \`hidden\` hides every toolkit piece, whatever display its own rule gives it. */
40
+ :where([class*="copilotz-"])[hidden] { display: none !important; }
39
41
  .copilotz-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
40
42
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
41
43
  /* Touch screens: text a little larger, and fields at 16px at least, so phones never zoom in on
@@ -52,7 +54,7 @@ code, kbd, pre, samp { font-family: var(--font-mono); font-variant-ligatures: no
52
54
  @media print {
53
55
  html, body, #app { height: auto !important; overflow: visible !important; }
54
56
  .copilotz-page-full { height: auto !important; overflow: visible !important; }
55
- .copilotz-no-print, .copilotz-appbar, .copilotz-topbar, .copilotz-toolbar, .copilotz-toasts,
57
+ .copilotz-page-head:not(.copilotz-page-head-print), .copilotz-no-print, .copilotz-appbar, .copilotz-topbar, .copilotz-toolbar, .copilotz-toasts,
56
58
  .copilotz-table-toolbar, .copilotz-table-control, .copilotz-pagination,
57
59
  .copilotz-button, .copilotz-icon-button, .copilotz-popover, .copilotz-menu, .copilotz-tooltip,
58
60
  .copilotz-autocomplete, .copilotz-going, .copilotz-skip { display: none !important; }
@@ -2,7 +2,9 @@
2
2
  * Keeps a popover beside what it belongs to while it's open (a menu under
3
3
  * its button, a tooltip over what it explains, or beside it: `end` after it,
4
4
  * beside a rail's item, `start` before it), by script: placed when it opens and again on scroll and
5
- * resize, on the other side when there's no room. Not by CSS anchor positioning: Safari's can loop on its style (a
5
+ * resize, on the other side when there's no room. Over or under, with room on neither side, it
6
+ * goes on the roomier one, as tall as that room, and scrolls inside: never past the window, never
7
+ * over what it belongs to. Not by CSS anchor positioning: Safari's can loop on its style (a
6
8
  * tooltip or menu whose anchor goes or hides as a page changes keeps it
7
9
  * re-resolving, and the page hangs). Render `ANCHORED` with the popover,
8
10
  * which carries `copilotz-anchored`.
@@ -13,8 +15,15 @@ export const ANCHORED = sheet("anchored", `.copilotz-anchored { position: fixed;
13
15
  export function anchor(popover, target, { side = "bottom", align = "start", gap = 6 } = {}) {
14
16
  popover.dataset.side = side;
15
17
  popover.dataset.align = align;
18
+ /** Whether its height is the room it was given, not its own. */
19
+ let capped = false;
16
20
  const place = () => {
17
21
  const at = target.getBoundingClientRect();
22
+ // Measured at its own height: a cap set before is lifted, keeping where its content was scrolled.
23
+ const scrolled = popover.scrollTop;
24
+ const lifted = capped;
25
+ if (lifted)
26
+ popover.style.maxHeight = "";
18
27
  const size = popover.getBoundingClientRect();
19
28
  if (side === "end" || side === "start") {
20
29
  const after = at.right + gap;
@@ -32,10 +41,20 @@ export function anchor(popover, target, { side = "bottom", align = "start", gap
32
41
  return;
33
42
  }
34
43
  const below = at.bottom + gap;
35
- const above = at.top - gap - size.height;
36
- const top = side === "bottom"
37
- ? (below + size.height > innerHeight && above >= 0 ? above : below)
38
- : (above < 0 && below + size.height <= innerHeight ? below : above);
44
+ const fitsBelow = below + size.height <= innerHeight;
45
+ const fitsAbove = at.top - gap - size.height >= 0;
46
+ const room = { below: innerHeight - below - 8, above: at.top - gap - 8 };
47
+ // Its own side when it fits there, else the other; with room on neither, the roomier one.
48
+ const up = fitsBelow || fitsAbove
49
+ ? (side === "bottom" ? !fitsBelow : fitsAbove)
50
+ : room.above > room.below;
51
+ capped = !fitsBelow && !fitsAbove;
52
+ const height = capped ? Math.max(0, up ? room.above : room.below) : size.height;
53
+ if (capped)
54
+ popover.style.maxHeight = `${height}px`;
55
+ if (lifted)
56
+ popover.scrollTop = scrolled;
57
+ const top = up ? at.top - gap - height : below;
39
58
  const left = align === "start"
40
59
  ? at.left
41
60
  : align === "end"
@@ -44,11 +63,18 @@ export function anchor(popover, target, { side = "bottom", align = "start", gap
44
63
  popover.style.top = `${Math.max(8, top)}px`;
45
64
  popover.style.left = `${Math.max(8, Math.min(left, innerWidth - size.width - 8))}px`;
46
65
  };
66
+ // Its own content scrolling doesn't move it.
67
+ const onScroll = (event) => {
68
+ if (!(event.target instanceof Node && popover.contains(event.target)))
69
+ place();
70
+ };
47
71
  place();
48
- addEventListener("scroll", place, true);
72
+ addEventListener("scroll", onScroll, true);
49
73
  addEventListener("resize", place);
50
74
  return () => {
51
- removeEventListener("scroll", place, true);
75
+ removeEventListener("scroll", onScroll, true);
52
76
  removeEventListener("resize", place);
77
+ if (capped)
78
+ popover.style.maxHeight = "";
53
79
  };
54
80
  }
@@ -3,14 +3,16 @@
3
3
  * a bright rounded square, a space's in a soft one, an org's initials (two,
4
4
  * from its first words) on a tile of its own; or, given an `icon` (an
5
5
  * emoji: an agent's), that on a soft tile of its color. Given a `picture`
6
- * (a person's photo, from where they signed in: an `https:` address or a
7
- * path on the app's own origin), that, with the initial until it loads and
8
- * if it fails. The color comes from the name (or a `tint` given: an org's
6
+ * (a person's photo, from where they signed in: an `https:` address, a
7
+ * path on the app's own origin, or an image chosen but not yet sent: a
8
+ * `blob:` URL or a png, jpeg, gif or webp `data:` URL), that, with the
9
+ * initial until it loads and if it fails. `initial={false}` draws no initial:
10
+ * an empty box (soft, outlined) until the picture is there. The color comes from the name (or a `tint` given: an org's
9
11
  * id, so renaming it keeps its colour), so someone looks the same
10
12
  * everywhere. Decorative: say the name beside it.
11
13
  */
12
14
  import { type ReactNode } from "react";
13
- export declare function Avatar({ name, kind, size, icon, picture, tint, title, className }: {
15
+ export declare function Avatar({ name, kind, size, icon, picture, initial, tint, title, className }: {
14
16
  name: string;
15
17
  kind?: "person" | "agent" | "space" | "org";
16
18
  size?: number;
@@ -18,6 +20,8 @@ export declare function Avatar({ name, kind, size, icon, picture, tint, title, c
18
20
  icon?: string;
19
21
  /** A photo to show instead: a person's, from their sign-in. */
20
22
  picture?: string;
23
+ /** Draw the initial (yes); `false`: an empty box with no picture. */
24
+ initial?: boolean;
21
25
  /** What the colour comes from, when not the name: an id that never changes. */
22
26
  tint?: string;
23
27
  title?: string;