copilotz 1.0.0-rc.17 → 1.0.0-rc.18

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 (134) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +23 -8
  3. package/package.json +1 -1
  4. package/plugins/access/accounts/collections/account.d.ts +1 -1
  5. package/plugins/access/spaces/contract.d.ts +15 -0
  6. package/plugins/access/spaces/mod.d.ts +1 -1
  7. package/plugins/access/spaces/mod.js +4 -0
  8. package/plugins/access/spaces/views/web/agents.d.ts +6 -1
  9. package/plugins/access/spaces/views/web/agents.js +7 -5
  10. package/plugins/access/spaces/views/web/members.d.ts +3 -1
  11. package/plugins/access/spaces/views/web/members.js +26 -5
  12. package/plugins/access/spaces/views/web/style.d.ts +1 -1
  13. package/plugins/access/spaces/views/web/style.js +2 -0
  14. package/plugins/agents/chat/actions/send.js +1 -1
  15. package/plugins/agents/chat/contract.d.ts +2 -2
  16. package/plugins/agents/chat/mod.d.ts +11 -6
  17. package/plugins/agents/chat/mod.js +15 -6
  18. package/plugins/agents/chat/processors/turn.js +24 -3
  19. package/plugins/agents/chat/shared/agents.d.ts +9 -0
  20. package/plugins/agents/chat/shared/types.d.ts +5 -1
  21. package/plugins/agents/chat/views/context.d.ts +4 -2
  22. package/plugins/agents/chat/views/context.js +7 -3
  23. package/plugins/agents/chat/views/prompt.js +5 -2
  24. package/plugins/agents/history/processors/compact.js +7 -5
  25. package/plugins/agents/memory/processors/extract.js +2 -1
  26. package/plugins/agents/memory/shared/search.js +8 -2
  27. package/plugins/agents/memory/shared/settings.d.ts +5 -2
  28. package/plugins/agents/memory/shared/settings.js +6 -3
  29. package/plugins/agents/mod.d.ts +5 -3
  30. package/plugins/agents/mod.js +5 -3
  31. package/plugins/agents/team/contract.d.ts +7 -4
  32. package/plugins/agents/team/views/web/model-pick.d.ts +25 -0
  33. package/plugins/agents/team/views/web/model-pick.js +39 -0
  34. package/plugins/agents/team/views/web/model-picker.d.ts +6 -2
  35. package/plugins/agents/team/views/web/model-picker.js +20 -14
  36. package/plugins/agents/team/views/web/style.d.ts +1 -1
  37. package/plugins/agents/team/views/web/style.js +4 -0
  38. package/plugins/agents/team/web.d.ts +4 -2
  39. package/plugins/agents/team/web.js +6 -2
  40. package/plugins/agents/tiers/actions/choose.d.ts +2 -0
  41. package/plugins/agents/tiers/actions/choose.js +98 -0
  42. package/plugins/agents/tiers/actions/model.d.ts +1 -0
  43. package/plugins/agents/tiers/actions/model.js +36 -0
  44. package/plugins/agents/tiers/collections/choice.d.ts +48 -0
  45. package/plugins/agents/tiers/collections/choice.js +59 -0
  46. package/plugins/agents/tiers/contract.d.ts +19 -0
  47. package/plugins/agents/tiers/contract.js +1 -0
  48. package/plugins/agents/tiers/mod.d.ts +54 -0
  49. package/plugins/agents/tiers/mod.js +92 -0
  50. package/plugins/agents/tiers/shared/shown.d.ts +87 -0
  51. package/plugins/agents/tiers/shared/shown.js +155 -0
  52. package/plugins/agents/tiers/shared/tiers.d.ts +103 -0
  53. package/plugins/agents/tiers/shared/tiers.js +129 -0
  54. package/plugins/agents/tiers/views/web/org.d.ts +38 -0
  55. package/plugins/agents/tiers/views/web/org.js +142 -0
  56. package/plugins/agents/tiers/views/web/space.d.ts +43 -0
  57. package/plugins/agents/tiers/views/web/space.js +103 -0
  58. package/plugins/agents/tiers/views/web/style.d.ts +7 -0
  59. package/plugins/agents/tiers/views/web/style.js +87 -0
  60. package/plugins/agents/tiers/views/web/words.d.ts +21 -0
  61. package/plugins/agents/tiers/views/web/words.js +49 -0
  62. package/plugins/agents/tiers/web.d.ts +18 -0
  63. package/plugins/agents/tiers/web.js +40 -0
  64. package/plugins/agents/web.d.ts +1 -0
  65. package/plugins/agents/web.js +1 -0
  66. package/plugins/billing/credits/actions/check.d.ts +1 -0
  67. package/plugins/billing/credits/actions/check.js +14 -0
  68. package/plugins/billing/credits/actions/state.js +34 -10
  69. package/plugins/billing/credits/collections/plan.d.ts +20 -0
  70. package/plugins/billing/credits/collections/plan.js +4 -0
  71. package/plugins/billing/credits/contract.d.ts +7 -3
  72. package/plugins/billing/credits/contract.js +1 -0
  73. package/plugins/billing/credits/mod.d.ts +9 -1
  74. package/plugins/billing/credits/mod.js +13 -2
  75. package/plugins/billing/credits/shared/apply.js +5 -1
  76. package/plugins/billing/credits/shared/settings.d.ts +20 -1
  77. package/plugins/billing/credits/shared/settings.js +14 -0
  78. package/plugins/billing/credits/views/web/numbers.d.ts +37 -5
  79. package/plugins/billing/credits/views/web/numbers.js +46 -5
  80. package/plugins/billing/credits/views/web/org.js +2 -2
  81. package/plugins/billing/credits/views/web/plan.d.ts +15 -9
  82. package/plugins/billing/credits/views/web/plan.js +33 -14
  83. package/plugins/billing/credits/views/web/staff.js +1 -1
  84. package/plugins/billing/credits/views/web/style.d.ts +1 -1
  85. package/plugins/billing/credits/views/web/style.js +4 -0
  86. package/plugins/billing/stripe/actions/checkout.d.ts +1 -0
  87. package/plugins/billing/stripe/actions/checkout.js +18 -1
  88. package/plugins/billing/stripe/mod.d.ts +2 -1
  89. package/plugins/billing/stripe/mod.js +9 -3
  90. package/plugins/billing/usage/actions/activity.d.ts +84 -0
  91. package/plugins/billing/usage/actions/activity.js +310 -0
  92. package/plugins/billing/usage/actions/close.js +16 -4
  93. package/plugins/billing/usage/actions/org.d.ts +29 -1
  94. package/plugins/billing/usage/actions/org.js +21 -64
  95. package/plugins/billing/usage/collections/closed.d.ts +11 -1
  96. package/plugins/billing/usage/collections/closed.js +4 -1
  97. package/plugins/billing/usage/collections/rollup.js +8 -4
  98. package/plugins/billing/usage/collections/usage.d.ts +3 -2
  99. package/plugins/billing/usage/collections/usage.js +11 -8
  100. package/plugins/billing/usage/mod.d.ts +18 -7
  101. package/plugins/billing/usage/mod.js +25 -9
  102. package/plugins/billing/usage/shared/categories.d.ts +23 -0
  103. package/plugins/billing/usage/shared/categories.js +40 -0
  104. package/plugins/billing/usage/shared/names.d.ts +45 -0
  105. package/plugins/billing/usage/shared/names.js +60 -0
  106. package/plugins/billing/usage/shared/settings.d.ts +8 -1
  107. package/plugins/billing/usage/shared/settings.js +11 -2
  108. package/plugins/billing/usage/shared/totals.d.ts +19 -5
  109. package/plugins/billing/usage/shared/totals.js +45 -10
  110. package/plugins/billing/usage/views/web/chart.d.ts +25 -12
  111. package/plugins/billing/usage/views/web/chart.js +67 -61
  112. package/plugins/billing/usage/views/web/numbers.d.ts +75 -53
  113. package/plugins/billing/usage/views/web/numbers.js +169 -63
  114. package/plugins/billing/usage/views/web/org.d.ts +23 -13
  115. package/plugins/billing/usage/views/web/org.js +527 -231
  116. package/plugins/billing/usage/views/web/style.d.ts +9 -8
  117. package/plugins/billing/usage/views/web/style.js +147 -141
  118. package/plugins/billing/usage/web.d.ts +8 -6
  119. package/plugins/billing/usage/web.js +8 -6
  120. package/plugins/compute/apps/mod.js +2 -0
  121. package/plugins/compute/cloud/shared/meter.d.ts +4 -0
  122. package/plugins/compute/cloud/shared/meter.js +8 -4
  123. package/plugins/compute/cloud/shared/records.d.ts +7 -1
  124. package/plugins/compute/cloud/shared/records.js +8 -0
  125. package/plugins/compute/computers/collections/approval.d.ts +1 -1
  126. package/plugins/compute/computers/mod.js +4 -0
  127. package/plugins/compute/computers/program/version.d.ts +1 -1
  128. package/plugins/compute/computers/program/version.js +1 -1
  129. package/plugins/compute/computers/resources/downloads.js +1 -1
  130. package/plugins/models/actions/check.d.ts +1 -0
  131. package/plugins/models/actions/check.js +25 -0
  132. package/plugins/models/contract.d.ts +1 -0
  133. package/plugins/models/mod.d.ts +2 -1
  134. package/plugins/models/mod.js +4 -2
package/CHANGELOG.md CHANGED
@@ -1,3 +1,43 @@
1
+ ## 1.0.0-rc.18 — 2026-11-03
2
+
3
+ - **Model tiers for the app's agents** (the new `tiers` plugin, in `copilotz/plugins/agents`). An
4
+ app declares its tiers (`tiers` resource: a title, what it's good for, and a model for each of its
5
+ agents, as an agent's `model` takes one). Which one an agent thinks with, first that applies: a
6
+ model picked for it in the space, the space's tier, a model picked for it by the org, the org's
7
+ tier, the tier the org's plan names (`planTier`), else its own model.
8
+ - An org's owners and admins choose for the org, a space's managers for the space (`tiers.choose`,
9
+ `tiers.pick`); everyone who reaches them sees it (`modelChoice.offered`, `modelChoice.agent`).
10
+ Choices keep the tier's name, so retuning a tier moves everyone on it.
11
+ - A pick keeps the tier's list behind it as fallback, and carries the `maxTokens` of the entry it
12
+ replaces, and its `effort` when the picked model takes it (`models.efforts`, from the catalog).
13
+ - Chat asks through a new `agentModel` resource, once per run, for the app's agents only; agents
14
+ people make keep their own model. A turn's usage now says its `space`.
15
+ - On the web (`tiersWeb`): "Agents' models" in org settings (the tiers with a typical reply's
16
+ price, choosing one with Undo, a model per agent), and on a space's Members tab its tier and
17
+ each app agent's model with where it comes from. Team's model picker is a View (`model.pick`)
18
+ other plugins show.
19
+ - **Plans say whom they're for and which tier they give.** `PlanTerms.for` (`"personal"` or
20
+ `"team"`) is enforced on every move to a plan (checkout, staff, a provider's webhook);
21
+ `PlanTerms.models` names the plan's tier (`billing.tier`). The Billing page offers an org only the
22
+ plans for its kind that its seller can sell (`billing.sellable`), says how much of this period's
23
+ plan credits is left and when they lapse, and speaks of seats only to teams.
24
+ - **The Usage page, rebuilt around money.** One line: spent this billing month, against the budget,
25
+ what's left and how long it lasts at this pace. One "By" switch (kind, space, person, agent,
26
+ model) drives a stacked daily chart and a ranked list; a row filters the page. Activity shows
27
+ turns, computer sessions, app days and conversation upkeep instead of ledger records; staff see
28
+ cost and margin in place.
29
+ - `usage.calls` is gone: `usage.activity` replaces it. `usage.org` groups and filters by
30
+ `category` (agents, computers, apps; `usage.categories`) and by `tags.space`, and names what it
31
+ groups by as the caller reads them, through a new `usageNames` resource kind each owning plugin
32
+ contributes (spaces, conversations, computers, apps).
33
+ - Cloud computers' records say their `space` and, for VM time, their `session`; summaries, memory
34
+ notes and their embeddings say their conversation's `thread` and `space`.
35
+ - Rollups keep `tags.space`. A closed day remembers its shape; days closed with an older one are
36
+ read from records until `usage.close` closes them again (the next nightly close, or by hand).
37
+ - **An app's own instructions are sent as instructions.** A `context` entry with
38
+ `instructions: true` (`system` only) goes right after the agent's instructions, without the
39
+ `<context>` tag that marks other contexts as information, not instructions.
40
+
1
41
  ## 1.0.0-rc.17 — 2026-11-03
2
42
 
3
43
  - **A model's state goes back with its answers.** What a model returns to be sent back (Anthropic's
package/README.md CHANGED
@@ -22,7 +22,7 @@ bun add copilotz # Bun
22
22
  deno add jsr:@copilotz/copilotz # Deno (or `deno add npm:copilotz`)
23
23
  ```
24
24
 
25
- On Deno, name it `copilotz` in `deno.json` (`"copilotz": "jsr:@copilotz/copilotz@^1.0.0-rc.17"`),
25
+ On Deno, name it `copilotz` in `deno.json` (`"copilotz": "jsr:@copilotz/copilotz@^1.0.0-rc.18"`),
26
26
  and the imports below are the same everywhere. Some pieces need a package of their own, installed
27
27
  beside it: `esbuild` to bundle the web host on Node, `@electric-sql/pglite` for PostgreSQL in the
28
28
  process, and `@types/react` for the front ends' types.
@@ -99,8 +99,8 @@ The package's entry points, the same names on npm (`copilotz/…`) and JSR (`@co
99
99
  | `copilotz/blobs/files` | `fileBlobs({ dir })`: blobs as files |
100
100
  | `copilotz/blobs/http` | `httpBlobs({ url, headers })`: blobs in a bucket (S3, GCS, R2…) |
101
101
  | `copilotz/plugins/models` | `models`: llm, embeddings, transcription, the models.dev catalog |
102
- | `copilotz/plugins/agents` | `chat`, `history`, `memory`, `memoryExtraction`, `team`, `skills`, `routines`, `tool` |
103
- | `copilotz/plugins/agents/web` | their web front ends: `chatWeb`, `teamWeb`, `memoryWeb`, `skillsWeb`, `routinesWeb` |
102
+ | `copilotz/plugins/agents` | `chat`, `history`, `memory`, `memoryExtraction`, `team`, `skills`, `routines`, `tiers`, `tool` |
103
+ | `copilotz/plugins/agents/web` | their web front ends: `chatWeb`, `teamWeb`, `memoryWeb`, `skillsWeb`, `routinesWeb`, `tiersWeb` |
104
104
  | `copilotz/plugins/agents/terminal` | their terminal front ends: `chatTerminal`, `memoryTerminal` |
105
105
  | `copilotz/plugins/access` | `access` (`spaces`, `identity`), `accounts`, `directory`, `googleSignIn` |
106
106
  | `copilotz/plugins/access/web` | `spacesWeb`, `accountsWeb` |
@@ -204,7 +204,7 @@ and an app serves it from there by default:
204
204
  import { computerDownloads } from "copilotz/plugins/compute/downloads";
205
205
 
206
206
  plugins: [...plugins, await computerDownloads()], // this Copilotz's release
207
- plugins: [...plugins, await computerDownloads({ dir: "dist/computer/1.0.0-rc.17" })], // its own: /computer/download/
207
+ plugins: [...plugins, await computerDownloads({ dir: "dist/computer/1.0.0-rc.18" })], // its own: /computer/download/
208
208
  plugins: [...plugins, await computerDownloads({ url: "https://downloads.example.com/computer/" })], // or elsewhere
209
209
  ```
210
210
 
@@ -354,6 +354,11 @@ name, never by importing its code.
354
354
  - **`routines`**: a message sent to an agent on a schedule, in a space ("every weekday at 9:00, ask
355
355
  @researcher for the news"), as whoever made it, reaching only what they reach; each run's chat and
356
356
  outcome are kept. Agents make them from a conversation too (`schedule_routine`).
357
+ - **`tiers`**: which models the app's agents think with, named by what the work needs (Everyday,
358
+ Expert…): the app declares each tier's model for each agent; an org chooses one, a space can
359
+ choose another, and either can pick a model for one agent, the tier's list kept behind it. Kept by
360
+ name, so retuning a tier moves everyone on it; while an org hasn't chosen, its plan's tier
361
+ applies. Each tier shows what a typical reply comes to at the org's prices.
357
362
 
358
363
  **`access/`**: who can see and do what (see [design/access.md](design/access.md)).
359
364
 
@@ -404,9 +409,19 @@ name, never by importing its code.
404
409
  from an older day. `schedules: { "usage.close": null }` turns them off.
405
410
  - **Re-rating** (`usage.rerate`) never changes a record: it appends adjustments, dated when made,
406
411
  and totals follow.
407
- - **On the web** (`usageWeb`): an org's Usage page, day by day and against the period before, by
408
- person, agent and model, with what the cache read, wrote and saved; owners and admins see
409
- everyone's, anyone else their own.
412
+ - **Categories:** each meter is one (`llm`, `embeddings` and `transcription` are agents',
413
+ `computer` computers', `app` apps'; any other its own); totals group and filter by `category`,
414
+ and rollups serve it. Rollups keep `tags.space` too; days rolled up in another shape are closed
415
+ again, and read from records until then.
416
+ - **Across an org:** `usage.org` (totals, naming what they're grouped by as the caller reaches it)
417
+ and `usage.activity` (agents' turns, computers' sessions, apps' days and conversations' upkeep,
418
+ newest first): owners and admins see everyone's, anyone else their own. What a tag points to is
419
+ named by the plugin that owns it, in the `usageNames` resource kind
420
+ (`{ tag: "tags.app", collection: "app", field: "name" }`); a tag nobody names shows as its id.
421
+ - **On the web** (`usageWeb`): an org's Usage page: the billing month's spend against the budget
422
+ and credits left (from the credits plugin, when it's there) and the same point last month; a
423
+ daily chart and a ranked list by kind, space, person, agent or model, whose rows filter the
424
+ page; and activity. Staff see cost and margin in place.
410
425
 
411
426
  **`compute/`**: **`computers`**, machines people connect (the computer program in
412
427
  `computers/program/`, a worker of the plugin's `computer` kind) and their desks, one per space
@@ -833,7 +848,7 @@ exporters/ where measurements go: the Exporter port's implementations (OTLP
833
848
  plugins/ the features, by theme
834
849
  models/ one plugin: llm, embeddings, transcription; shared/ (providers, model choice,
835
850
  models.dev catalog)
836
- agents/ chat, history, memory, team, skills, routines
851
+ agents/ chat, history, memory, team, skills, routines, tiers
837
852
  billing/ usage (the ledger)
838
853
  access/ spaces (members, reach, rules), identity, Google sign-in, connected accounts, the
839
854
  directory of orgs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "copilotz",
3
- "version": "1.0.0-rc.17",
3
+ "version": "1.0.0-rc.18",
4
4
  "description": "Copilotz: one runtime for Node, Deno, Bun, Cloudflare Workers and the browser.",
5
5
  "keywords": [
6
6
  "agents",
@@ -95,8 +95,8 @@ export declare const account: {
95
95
  [x: string]: unknown;
96
96
  rev?: number | undefined;
97
97
  problem?: string | undefined;
98
- expires?: string | undefined;
99
98
  plan?: string | undefined;
99
+ expires?: string | undefined;
100
100
  refreshed?: string | undefined;
101
101
  status: "revoked" | "connected" | "needs_reconnect";
102
102
  person: string;
@@ -35,6 +35,10 @@
35
35
  * hints `{ in }`, for those who manage the space; `personal: true` when
36
36
  * it joins a Personal space too (agents do; people don't). The words for
37
37
  * the roles agents work in are `AGENT_ROLES`.
38
+ * - `spaceAgents`: what a front end adds to a space's agents (its Members
39
+ * tab): a View above them (`view`: item `{ _id }`, the space), and one on
40
+ * each agent's row (`row`: item `{ _id }`, the agent), both with hints
41
+ * `{ in, manage, mode }` (`manage`: whether the person manages the space).
38
42
  *
39
43
  * ```ts
40
44
  * resources: {
@@ -44,6 +48,7 @@
44
48
  * },
45
49
  * spaceSidebar: { chats: { view: "chats.recent", title: "chats" } },
46
50
  * spaceInvite: { agents: { title: "Agents", view: "agent.add", personal: true } },
51
+ * spaceAgents: { tiers: { view: "tiers.space", row: "tiers.agent" } },
47
52
  * }
48
53
  * ```
49
54
  */
@@ -87,6 +92,16 @@ export type SpaceSidebar = {
87
92
  title?: string;
88
93
  order?: number;
89
94
  };
95
+ /**
96
+ * A `spaceAgents` resource: what a front end adds to a space's agents: a View
97
+ * above them (item `{ _id }`, the space) and one on each agent's row (item
98
+ * `{ _id }`, the agent), with hints `{ in, manage, mode: "page" | "panel" }`.
99
+ */
100
+ export type SpaceAgents = {
101
+ view?: string;
102
+ row?: string;
103
+ order?: number;
104
+ };
90
105
  /** A `spaceInvite` resource: a kind of member added to a space, a tab of its invite surface. */
91
106
  export type SpaceInvite = {
92
107
  title: string;
@@ -49,7 +49,7 @@ export type { Invitation } from "./collections/invitation.js";
49
49
  export type { DirectoryPort } from "./actions/org.js";
50
50
  export type { Member } from "./collections/member.js";
51
51
  export type { Reached, Space } from "./collections/space.js";
52
- export type { SpaceInvite, SpaceSidebar, SpaceTab } from "./contract.js";
52
+ export type { SpaceAgents, SpaceInvite, SpaceSidebar, SpaceTab } from "./contract.js";
53
53
  export type { Request } from "./collections/request.js";
54
54
  export { idsIn, nameOf, namesFor, namesIn, namesOf, type NamesResource, PROFILE, withNames, } from "./shared/names.js";
55
55
  export { memberKey, ORG, ORG_ROLES, type OrgRole, orgRoleOf, type Reach, reachOf, ROLES, type Verb, } from "./shared/reach.js";
@@ -122,6 +122,10 @@ export const spaces = definePlugin({
122
122
  roster: { spaces: { action: "space.roster" } },
123
123
  // Where people's names are, for whatever shows a person (pages, agents' prompts).
124
124
  names: { collection: PROFILE },
125
+ // Spaces by name on Usage (a Personal space says whose it is).
126
+ usageNames: {
127
+ space: { tag: "tags.space", collection: "space", field: "name", owner: "owner" },
128
+ },
125
129
  },
126
130
  processors: { "spaces.agentGone": agentGoneProcessor, "spaces.profile": profileProcessor },
127
131
  });
@@ -6,6 +6,8 @@
6
6
  * change an agent's role, have it answer new chats, open it to edit (when
7
7
  * they manage where it belongs; otherwise to view), take it out, and add
8
8
  * one (the invite surface, at Agents). What agents are, said in a line.
9
+ * Other front ends add to it (`spaceAgents`): above the agents, and a line
10
+ * on each one's row.
9
11
  */
10
12
  import { type ReactNode } from "react";
11
13
  import type { Member, Reached } from "../../contract.js";
@@ -23,13 +25,16 @@ export type Roster = {
23
25
  default: string[];
24
26
  agents: Record<string, AgentShown>;
25
27
  };
26
- export declare function Agents({ space, spaces, members, roster, manage, adds, onAdd, call }: {
28
+ export declare function Agents({ space, spaces, members, roster, above, lines, manage, adds, onAdd, call }: {
27
29
  space: Reached;
28
30
  /** Every space the person reaches: where each agent belongs, and whether they manage it. */
29
31
  spaces: Reached[];
30
32
  /** The space's agent members. */
31
33
  members: Member[];
32
34
  roster?: Roster;
35
+ /** What other front ends show above the agents (`spaceAgents`), and on each one's row. */
36
+ above?: ReactNode[];
37
+ lines?: Record<string, ReactNode[]>;
33
38
  manage: boolean;
34
39
  /** Whether agents can be added here (the app has them). */
35
40
  adds: boolean;
@@ -7,12 +7,14 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
7
7
  * change an agent's role, have it answer new chats, open it to edit (when
8
8
  * they manage where it belongs; otherwise to view), take it out, and add
9
9
  * one (the invite surface, at Agents). What agents are, said in a line.
10
+ * Other front ends add to it (`spaceAgents`): above the agents, and a line
11
+ * on each one's row.
10
12
  */
11
13
  import { useState } from "react";
12
14
  import { Avatar, Badge, Button, Card, Menu, message, Select, } from "../../../../../hosts/web/mod.js";
13
15
  import { AGENT_ROLES, roleName, spaceName, whoOf } from "./who.js";
14
16
  const pageOf = (id, edit = false) => `/agent/${encodeURIComponent(id)}${edit ? "?edit=1" : ""}`;
15
- export function Agents({ space, spaces, members, roster, manage, adds, onAdd, call }) {
17
+ export function Agents({ space, spaces, members, roster, above = [], lines = {}, manage, adds, onAdd, call }) {
16
18
  const personal = space.kind === "personal";
17
19
  const answers = roster?.default[0];
18
20
  const shown = (id) => roster?.agents[id];
@@ -30,19 +32,19 @@ export function Agents({ space, spaces, members, roster, manage, adds, onAdd, ca
30
32
  : null] }), _jsx("p", { className: "space-section-about", children: personal
31
33
  ? "They work here for you. One answers new chats; @name asks another."
32
34
  : "They work for whoever asks them, and reach only what that person can. One answers " +
33
- "new chats; @name asks another." }), members.length
35
+ "new chats; @name asks another." }), members.length ? above : null, members.length
34
36
  ? (_jsx("ul", { className: "space-rows", children: sorted.map((m) => {
35
37
  const id = whoOf(m.member).id;
36
38
  const home = shown(id)?.in;
37
39
  const edits = !!home && !!spaces.find((s) => s._id === home)?.can.includes("manage");
38
- return (_jsx(AgentRow, { member: m, id: id, agent: shown(id), home: home ? spaces.find((s) => s._id === home) : undefined, answers: id === answers, space: space, manage: manage, edits: edits, call: call }, m._id));
40
+ return (_jsx(AgentRow, { member: m, id: id, agent: shown(id), home: home ? spaces.find((s) => s._id === home) : undefined, answers: id === answers, space: space, manage: manage, edits: edits, line: lines[id], call: call }, m._id));
39
41
  }) }))
40
42
  : (_jsxs(Card, { className: "space-agents-none", children: [_jsx("p", { children: "No agent works here yet: chats here have no one to answer them." }), manage && !space.archived
41
43
  ? (_jsx(Button, { size: "sm", variant: "primary", icon: "plus", onClick: onAdd, children: "Add an agent" }))
42
44
  : null] }))] }));
43
45
  }
44
46
  /** One agent working here: who it is, its role, and what a manager does with it. */
45
- function AgentRow({ member: m, id, agent, home, answers, space, manage, edits, call }) {
47
+ function AgentRow({ member: m, id, agent, home, answers, space, manage, edits, line, call }) {
46
48
  const [busy, setBusy] = useState(false);
47
49
  const [error, setError] = useState();
48
50
  const name = agent?.name || id;
@@ -85,7 +87,7 @@ function AgentRow({ member: m, id, agent, home, answers, space, manage, edits, c
85
87
  onSelect: () => void act("member.remove", member),
86
88
  },
87
89
  ];
88
- return (_jsxs(Card, { as: "li", padding: "none", className: "space-row space-row-agent", "aria-busy": busy || undefined, children: [_jsx("a", { className: "space-row-face", href: pageOf(id), tabIndex: -1, "aria-hidden": "true", children: _jsx(Avatar, { name: name, kind: "agent", icon: agent?.icon, size: 32 }) }), _jsxs("div", { className: "space-row-text", children: [_jsxs("p", { className: "space-row-name", children: [_jsx("a", { className: "space-row-link", href: pageOf(id), children: name }), _jsxs("span", { className: "space-row-handle", children: ["@", id] }), answers ? _jsx(Badge, { tone: "primary", children: "Answers new chats" }) : null] }), _jsx("p", { className: "space-row-what", children: error ? _jsx("span", { className: "space-invite-error", children: error }) : what })] }), _jsx("div", { className: "space-row-end", children: manage
90
+ return (_jsxs(Card, { as: "li", padding: "none", className: "space-row space-row-agent", "aria-busy": busy || undefined, children: [_jsx("a", { className: "space-row-face", href: pageOf(id), tabIndex: -1, "aria-hidden": "true", children: _jsx(Avatar, { name: name, kind: "agent", icon: agent?.icon, size: 32 }) }), _jsxs("div", { className: "space-row-text", children: [_jsxs("p", { className: "space-row-name", children: [_jsx("a", { className: "space-row-link", href: pageOf(id), children: name }), _jsxs("span", { className: "space-row-handle", children: ["@", id] }), answers ? _jsx(Badge, { tone: "primary", children: "Answers new chats" }) : null] }), _jsx("p", { className: "space-row-what", children: error ? _jsx("span", { className: "space-invite-error", children: error }) : what }), line?.length ? _jsx("div", { className: "space-row-more", children: line }) : null] }), _jsx("div", { className: "space-row-end", children: manage
89
91
  ? (_jsxs(_Fragment, { children: [_jsxs(Select, { size: "sm", value: m.role, disabled: busy, "aria-label": `${name}'s role`, onChange: (event) => void act("member.set", { ...member, role: event.target.value }), children: [AGENT_ROLES.map((r) => _jsx("option", { value: r.value, children: r.label }, r.value)), AGENT_ROLES.some((r) => r.value === m.role)
90
92
  ? null
91
93
  : _jsx("option", { value: m.role, children: roleName(m.role) })] }), _jsx(Menu, { label: `${name}: more`, align: "end", size: "sm", items: items })] }))
@@ -5,7 +5,9 @@
5
5
  * shows them: see agents.tsx); and the spaces that draw on it. Those who
6
6
  * manage it invite people, take an invitation back, change roles, take
7
7
  * someone out (never its last manager), let in or turn down who asked to
8
- * join, and add agents (the invite surface, at Agents). A Personal space is
8
+ * join, and add agents (the invite surface, at Agents). Other front ends add
9
+ * to its agents (`spaceAgents`): above them, and on each agent's row (tiers:
10
+ * the space's models). A Personal space is
9
11
  * just you and your agents, and says how to work with others; an archived
10
12
  * one invites no one.
11
13
  */
@@ -6,11 +6,13 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
6
6
  * shows them: see agents.tsx); and the spaces that draw on it. Those who
7
7
  * manage it invite people, take an invitation back, change roles, take
8
8
  * someone out (never its last manager), let in or turn down who asked to
9
- * join, and add agents (the invite surface, at Agents). A Personal space is
9
+ * join, and add agents (the invite surface, at Agents). Other front ends add
10
+ * to its agents (`spaceAgents`): above them, and on each agent's row (tiers:
11
+ * the space's models). A Personal space is
10
12
  * just you and your agents, and says how to work with others; an archived
11
13
  * one invites no one.
12
14
  */
13
- import { useState } from "react";
15
+ import { Fragment, useState } from "react";
14
16
  import { Avatar, Badge, Button, Card, IconButton, message, Notice, Select, Skeleton, Time, } from "../../../../../hosts/web/mod.js";
15
17
  import { Agents } from "./agents.js";
16
18
  import { InviteDialog } from "./invite-dialog.js";
@@ -52,9 +54,28 @@ export const membersView = (item, ctx) => {
52
54
  const roster = adds || byKind(members).agents.length
53
55
  ? ctx.db.collection("thread").query("agents", { in: id }).value
54
56
  : undefined;
55
- return (_jsxs(_Fragment, { children: [style, _jsx(Members, { space: space, spaces: spaces, members: byMember(members, ctx.viewer?.name, names), roster: roster, adds: adds, requests: requests, invitations: invitations, me: ctx.viewer?.name, compact: compact, call: ctx.call, names: names })] }));
57
+ // What other front ends add to its agents (`spaceAgents`): above them, and on each one's row.
58
+ const extras = Object.entries((ctx.resources.spaceAgents ?? {}))
59
+ .filter(([, extra]) => extra?.view || extra?.row)
60
+ .sort(([a, x], [b, y]) => (x.order ?? 0) - (y.order ?? 0) || a.localeCompare(b));
61
+ const hints = {
62
+ in: id,
63
+ manage: space.can.includes("manage"),
64
+ mode: compact ? "panel" : "page",
65
+ };
66
+ const above = extras.flatMap(([key, extra]) => extra.view ? [_jsx(Fragment, { children: ctx.show(extra.view, { _id: id }, hints) }, key)] : []);
67
+ const lines = Object.fromEntries(byKind(members).agents.map((m) => {
68
+ const agent = whoOf(m.member).id;
69
+ return [
70
+ agent,
71
+ extras.flatMap(([key, extra]) => extra.row
72
+ ? [_jsx(Fragment, { children: ctx.show(extra.row, { _id: agent }, hints) }, key)]
73
+ : []),
74
+ ];
75
+ }));
76
+ return (_jsxs(_Fragment, { children: [style, _jsx(Members, { space: space, spaces: spaces, members: byMember(members, ctx.viewer?.name, names), roster: roster, above: above, lines: lines, adds: adds, requests: requests, invitations: invitations, me: ctx.viewer?.name, compact: compact, call: ctx.call, names: names })] }));
56
77
  };
57
- function Members({ space, spaces: reached, members, roster, adds, requests, invitations, me, compact, call, names, }) {
78
+ function Members({ space, spaces: reached, members, roster, above, lines, adds, requests, invitations, me, compact, call, names, }) {
58
79
  const [adding, setAdding] = useState(false);
59
80
  const personal = space.kind === "personal";
60
81
  const manage = space.can.includes("manage");
@@ -68,7 +89,7 @@ function Members({ space, spaces: reached, members, roster, adds, requests, invi
68
89
  ? (_jsxs("section", { className: "space-section", "aria-labelledby": "space-invite", children: [_jsx("h3", { id: "space-invite", className: "space-section-title", children: "Invite people" }), _jsx(InviteForm, { space: space, call: call, compact: compact })] }))
69
90
  : null, _jsxs("section", { className: "space-section", "aria-labelledby": "space-people", children: [_jsxs("h3", { id: "space-people", className: "space-section-title", children: ["People ", _jsx("span", { className: "space-count", children: people.length })] }), _jsx("ul", { className: "space-rows", children: rows(people) })] }), !personal && manage
70
91
  ? _jsx(Pending, { invitations: invitations, me: me, call: call, names: names })
71
- : null, _jsx(Agents, { space: space, spaces: reached, members: agents, roster: roster, manage: manage, adds: adds, onAdd: () => setAdding(true), call: call }), spaces.length
92
+ : null, _jsx(Agents, { space: space, spaces: reached, members: agents, roster: roster, above: above, lines: lines, manage: manage, adds: adds, onAdd: () => setAdding(true), call: call }), spaces.length
72
93
  ? (_jsxs("section", { className: "space-section", "aria-labelledby": "space-drawing", children: [_jsxs("h3", { id: "space-drawing", className: "space-section-title", children: ["Spaces drawing on it ", _jsx("span", { className: "space-count", children: spaces.length })] }), _jsx("ul", { className: "space-rows", children: rows(spaces) })] }))
73
94
  : null, manage && adds
74
95
  ? (_jsx(InviteDialog, { open: adding, onClose: () => setAdding(false), space: space, tab: "agents" }))
@@ -6,4 +6,4 @@
6
6
  * the org's sections (About, Members). Only layout: the pieces are the
7
7
  * toolkit's.
8
8
  */
9
- export declare const STYLE = "\n/* The sidebar: spaces as a tree */\n.spaces { list-style: none; display: grid; gap: 1px; margin: 0; padding: 0; }\n.spaces-item { display: grid; }\n.spaces-row { position: relative; }\n.spaces-row > .copilotz-nav-item { padding-right: 36px; }\n.spaces-fold { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); color: var(--muted-foreground); }\n.spaces-fold .copilotz-icon { transition: transform .15s; }\n.spaces-fold[aria-expanded=true] .copilotz-icon { transform: rotate(90deg); }\n.spaces-under { position: relative; display: grid; margin: 1px 0 8px 20px; padding-left: 10px; }\n.spaces-under::before { content: \"\"; position: absolute; top: 3px; bottom: 3px; left: 0; width: 1px;\n background: var(--sidebar-border); }\n.spaces-under > .copilotz-loading { min-height: 32px; padding: 6px; }\n.spaces-personal, .spaces-new-icon { display: grid; place-items: center; flex: none; width: 22px; height: 22px;\n border-radius: var(--radius-full); background: var(--muted); color: var(--secondary-foreground); }\n.spaces [aria-current] .spaces-personal { background: var(--card); color: var(--primary-text); }\n.spaces-new-icon { border: 1px dashed var(--input); border-radius: var(--radius-sm); background: transparent; }\n.spaces-form { margin-top: 2px; }\n.spaces-error { margin: 6px 10px 0; color: var(--destructive-text); font-size: 12.5px; }\n.spaces-archived { display: grid; margin-top: 4px; }\n.spaces-archived-icon { display: grid; place-items: center; flex: none; width: 22px; height: 22px; }\n.spaces-archived-end { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }\n.spaces-archived-end .copilotz-icon { transition: transform .15s; }\n.spaces-archived[data-open] .spaces-archived-end .copilotz-icon { transform: rotate(90deg); }\n.spaces-archived-list { margin: 1px 0 6px 12px; }\n.spaces-archived-list .copilotz-avatar { opacity: .75; }\n\n/* Invitations to you: in the sidebar, and on home */\n.invitations { list-style: none; display: grid; gap: 8px; margin: 0; padding: 0; }\n.invitation { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px;\n padding: 14px 14px 14px 16px; border-color: var(--primary-border);\n background: color-mix(in oklab, var(--primary-soft) 45%, var(--card)); animation: invitation-in .3s ease-out; }\n@keyframes invitation-in { from { opacity: 0; transform: translateY(-4px); } }\n.invitation-compact { grid-template-columns: 26px minmax(0, 1fr); align-items: start; gap: 10px;\n margin: 2px 0 4px; padding: 11px 12px; }\n.invitation-mark { display: grid; place-items: center; width: 26px; height: 26px; border-radius: var(--radius-full);\n background: var(--primary-soft); color: var(--primary-text); }\n.invitation-text { display: grid; gap: 2px; min-width: 0; }\n.invitation-title { margin: 0; font-size: 14.5px; line-height: 1.45; overflow-wrap: anywhere; }\n.invitation-compact .invitation-title { font-size: 13.5px; }\n.invitation-title b { font-weight: 650; }\n.invitation-meta { margin: 0; color: var(--muted-foreground); font-size: 12.5px; line-height: 1.45;\n overflow-wrap: anywhere; }\n.invitation-answers { display: flex; flex-wrap: wrap; gap: 6px; }\n.invitation-compact .invitation-answers { margin-top: 8px; }\n@media (max-width: 600px) {\n .invitation:not(.invitation-compact) { grid-template-columns: auto minmax(0, 1fr); }\n .invitation:not(.invitation-compact) .invitation-answers { grid-column: 2; }\n}\n\n/* A space's page */\n.space-mark-personal { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius-lg);\n background: var(--primary-soft); color: var(--primary-text); }\n.space-rename { color: var(--muted-foreground); }\n.space-faces { display: flex; align-items: center; padding: 0 4px 0 6px; border-radius: var(--radius-full);\n text-decoration: none; }\n.space-faces > * { margin-left: -6px; outline: 2px solid var(--background); }\n.space-faces-more { min-width: 28px; min-height: 28px; }\n.space-narrow { display: none; }\n.space-tabs { position: sticky; top: 0; z-index: 4; display: flex; width: 100%; margin-top: -2px;\n background: var(--background); -webkit-mask-image: linear-gradient(to right, currentColor calc(100% - 24px), transparent);\n mask-image: linear-gradient(to right, currentColor calc(100% - 24px), transparent); }\n.space-tabs .copilotz-tab { padding: 0 10px; }\n.space-tab { padding-top: 22px; }\n.space-loading { display: grid; gap: 14px; margin-top: 8px; }\n.space-missing { display: grid; place-items: center; padding: 32px; }\n.space-empty { margin-top: 48px; }\n.space-archived { margin: -4px 0 18px; }\n@container copilotz-page (max-width: 640px) {\n .space-wide, .space-faces { display: none; }\n .space-narrow { display: inline-grid; }\n .space-mark { --size: 36px !important; }\n .space-mark-personal { width: 36px; height: 36px; border-radius: var(--radius-md); }\n}\n@media (max-width: 760px) {\n .space-tabs { position: static; }\n}\n\n/* A tab's sections (sections.tsx): a menu beside them (settings), or tabs above (the computer's) */\n.space-sections { container: space-sections / inline-size; }\n.space-sections-side { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 36px; align-items: start; }\n.space-sections-menu { position: sticky; top: 60px; display: grid; gap: 2px; }\n.space-sections-group { margin: 14px 0 4px; padding: 0 10px; color: var(--muted-foreground);\n font-family: var(--font-display); font-size: 11.5px; font-weight: 650; letter-spacing: .08em;\n text-transform: uppercase; }\n.space-sections-chevron { display: none; color: var(--muted-foreground); }\n.space-sections-body { min-width: 0; }\n.space-sections-back { display: none; }\n.space-sections-back-link { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; margin-left: -6px;\n padding-right: 8px; color: var(--muted-foreground); font-size: 14px; text-decoration: none; }\n.space-sections-back-link:hover { color: var(--foreground); }\n.space-sections-title { margin: 0; font-family: var(--font-display); font-size: 20px; font-weight: 640;\n letter-spacing: -.01em; }\n.space-sections-top { display: grid; gap: 20px; }\n.space-sections-tabs { justify-self: start; }\n/* Without room for both (a phone): the menu is a list to tap into; a section says how to get back */\n@container space-sections (max-width: 640px) {\n .space-sections-side { grid-template-columns: minmax(0, 1fr); gap: 0; }\n .space-sections-side[data-picked=false] .space-sections-body,\n .space-sections-side[data-picked=true] .space-sections-menu { display: none; }\n .space-sections-menu { position: static; gap: 0; }\n .space-sections-menu .copilotz-nav-item { min-height: 52px; padding: 8px 12px; font-size: 15px; }\n .space-sections-chevron { display: inline-flex; }\n /* Listed, nothing is open yet: none looks chosen */\n .space-sections-side[data-picked=false] .copilotz-nav-item[aria-current] { border-color: transparent;\n background: transparent; box-shadow: none; }\n .space-sections-side[data-picked=false] .copilotz-nav-item[aria-current] .copilotz-nav-label { font-weight: inherit; }\n .space-sections-side[data-picked=true] .space-sections-back { display: grid; gap: 4px; margin: -12px 0 18px; }\n}\n\n/* Members, and inviting people */\n.space-members, .space-settings, .space-inviting { container: space-tab / inline-size; display: grid; gap: 24px; }\n.space-inviting { gap: 16px; }\n.space-inviting-kind { display: grid; gap: 22px; }\n.space-members-compact, .space-settings-compact { gap: 18px; }\n.space-section { display: grid; gap: 10px; }\n.space-section-title { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted-foreground);\n font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }\n.space-count { font-variant-numeric: tabular-nums; letter-spacing: 0; }\n.space-rows { list-style: none; display: grid; gap: 8px; margin: 0; padding: 0; }\n.space-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 12px;\n padding: 10px 10px 10px 14px; }\n.space-row-asking { border-color: var(--warning-border); }\n.space-row-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-md);\n background: var(--primary-soft); color: var(--primary-text); }\n.space-row-text { display: grid; gap: 1px; min-width: 0; }\n.space-row-name { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0; font-weight: 620; }\n.space-row-name .copilotz-time { color: var(--muted-foreground); font-size: 12px; font-weight: 450; }\n.space-row-what { margin: 0; overflow: hidden; color: var(--muted-foreground); font-size: 12.5px;\n text-overflow: ellipsis; white-space: nowrap; }\n.space-row-end { display: flex; align-items: center; gap: 6px; }\n.space-row-end > .copilotz-select { min-width: 116px; }\n.space-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;\n min-height: 30px; margin-bottom: -4px; }\n.space-section-head .copilotz-button { margin-right: -6px; }\n.space-section-about { margin: -2px 2px 2px; color: var(--muted-foreground); font-size: 13px; line-height: 1.5; }\n\n/* Agents among the members */\n.space-row-face { display: grid; }\n.space-row-link { min-width: 0; overflow: hidden; color: inherit; text-decoration: none; text-overflow: ellipsis;\n white-space: nowrap; }\n.space-row-link:hover { text-decoration: underline; text-underline-offset: 3px;\n text-decoration-color: color-mix(in oklab, currentColor 35%, transparent); }\n.space-row-handle { flex: none; color: var(--muted-foreground); font: 500 12.5px var(--font-mono); }\n.space-row-name .copilotz-badge { flex: none; }\n.space-row-agent[aria-busy] { opacity: .7; }\n.space-agents-none { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px;\n padding: 14px 16px; border-style: dashed; box-shadow: none; background: transparent; }\n.space-agents-none p { margin: 0; color: var(--muted-foreground); font-size: 13.5px; }\n.space-invite { display: grid; gap: 7px; }\n.space-invite-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; }\n.space-invite-row > .copilotz-select { min-width: 128px; }\n.space-invite-note { margin: 0 2px; color: var(--muted-foreground); font-size: 12.5px; }\n.space-invite-note > span { display: inline-flex; align-items: center; gap: 6px; }\n.space-row-mail { border-radius: var(--radius-full); background: var(--muted); color: var(--muted-foreground); }\n.space-row-email { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.space-invite-error { color: var(--destructive-text); }\n.space-invite-done { color: var(--success-text); }\n@container space-tab (max-width: 520px) {\n .space-row { gap: 10px; padding-left: 12px; }\n .space-row-agent { grid-template-columns: 32px minmax(0, 1fr); }\n .space-row-agent .space-row-end { grid-column: 2; }\n .space-row-agent .space-row-handle { display: none; }\n .space-row-asking { grid-template-columns: 32px minmax(0, 1fr); }\n .space-row-asking .space-row-end { grid-column: 1 / -1; flex-wrap: wrap; }\n .space-invite-row { grid-template-columns: minmax(0, 1fr) auto; }\n .space-invite-row > .copilotz-input { grid-column: 1 / -1; }\n}\n@container space-tab (max-width: 340px) {\n .space-row { grid-template-columns: 32px minmax(0, 1fr); }\n .space-row-end { grid-column: 2; }\n}\n\n/* A message naming agents that don't answer here: over where you type */\n.space-not-here-title { display: inline-flex; align-items: center; gap: 8px; }\n.space-not-here-faces { display: inline-flex; }\n.space-not-here-faces > * + * { margin-left: -5px; outline: 2px solid var(--info-soft); }\n@media (max-width: 760px) {\n .space-not-here { flex-wrap: wrap; }\n .space-not-here .copilotz-notice-body { flex-basis: calc(100% - 30px); }\n .space-not-here .copilotz-notice-action { width: 100%; justify-content: flex-end; margin: 2px 0 0; }\n}\n\n/* Settings */\n.space-setting-list { display: grid; }\n.space-setting { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 400px); align-items: start;\n gap: 10px 32px; padding: 18px 20px; }\n.space-setting + .space-setting { border-top: 1px solid var(--border); }\n.space-setting h3 { margin: 0 0 3px; font-size: 14.5px; font-weight: 650; }\n.space-setting-text { margin: 0; color: var(--muted-foreground); font-size: 13.5px; line-height: 1.5; }\n.space-setting-control { display: grid; justify-items: start; min-width: 0; }\n.space-setting-form { display: grid; gap: 6px; width: 100%; }\n.space-setting-inline { display: flex; gap: 8px; }\n.space-setting-inline > .copilotz-input { flex: 1; min-width: 0; }\n.space-setting-control > .copilotz-input { width: 100%; }\n.space-setting-form > .copilotz-select { width: 100%; }\n.space-setting-note { display: flex; align-items: center; gap: 6px; margin: 0 2px; font-size: 12.5px; }\n.space-setting-about { display: grid; gap: 14px; padding: 18px 20px; }\n.space-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 9px 22px; margin: 0;\n font-size: 14px; }\n.space-facts dt { color: var(--muted-foreground); }\n.space-facts dd { min-width: 0; margin: 0; }\n.space-facts-id { display: flex; align-items: center; gap: 6px; }\n.space-facts-id code { min-width: 0; overflow: hidden; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }\n.space-archive-means { display: grid; gap: 10px; margin: 0; padding: 0 0 0 18px; color: var(--secondary-foreground);\n font-size: 14px; line-height: 1.5; }\n.space-archive-means b { color: var(--foreground); font-weight: 620; }\n.space-archive-means + .copilotz-notice { margin-top: 14px; }\n@container space-tab (max-width: 620px) {\n .space-setting { grid-template-columns: minmax(0, 1fr); padding: 16px; }\n .space-setting-control { justify-items: stretch; }\n}\n\n/* In the side panel */\n.space-panel { container: space-panel / inline-size; display: flex; flex-direction: column; height: 100%; min-height: 0; }\n.space-panel-head { flex: none; display: flex; align-items: center; gap: 10px; min-height: 58px;\n padding: 9px max(10px, var(--copilotz-inset-end, 0px)) 9px 16px; border-bottom: 1px solid var(--border); }\n.space-panel-mark { display: grid; place-items: center; flex: none; width: 26px; height: 26px;\n border-radius: var(--radius-full); background: var(--primary-soft); color: var(--primary-text); }\n.space-panel-titles { flex: 1; display: grid; min-width: 0; line-height: 1.25; }\n.space-panel-titles h2 { margin: 0; overflow: hidden; font-family: var(--font-display); font-size: 15px;\n font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }\n.space-panel-titles span { color: var(--muted-foreground); font-size: 12px; }\n.space-panel-tabs { flex: none; align-self: flex-start; max-width: calc(100% - 24px); margin: 10px 12px 0; }\n.space-panel-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;\n scrollbar-color: var(--input) transparent; }\n.space-panel-tab { min-height: 100%; padding: 14px 14px 20px; }\n.space-panel-tab[hidden] { display: none; }\n/* A tab with sections, in the panel: its own tabs, under the panel's */\n.space-panel-part { min-height: 100%; display: flex; flex-direction: column; }\n.space-panel-part[hidden] { display: none; }\n.space-panel-part > .space-sections-top { flex: 1; display: flex; flex-direction: column; gap: 0; }\n.space-panel-part .space-sections-tabs { flex: none; max-width: calc(100% - 28px); margin: 12px 14px 0; }\n.space-panel-part .space-sections-body { flex: 1; display: flex; flex-direction: column; }\n.space-panel-part .space-sections-body > .space-panel-tab { flex: 1; min-height: auto; }\n.space-panel-missing { padding: 24px; color: var(--muted-foreground); }\n@container space-panel (max-width: 560px) {\n .space-panel-tabs .copilotz-tab[aria-selected=false] { padding: 0 9px; }\n .space-panel-tabs .copilotz-tab[aria-selected=false] .space-panel-tab-label { position: absolute; width: 1px;\n height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }\n}\n\n/* The org's sections: its people, and what it is */\n.org-row { grid-template-columns: 34px minmax(0, 1fr) auto; }\n.org-row-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.org-row-spacer { width: 30px; }\n.org-row .space-row-end > .copilotz-badge { min-width: 116px; justify-content: center; }\n.org-note { margin: -8px 0 0; }\n.org-remove { display: grid; gap: 18px; }\n.org-remove-means { list-style: none; display: grid; gap: 10px; margin: 0; padding: 0; color: var(--secondary-foreground);\n font-size: 14px; line-height: 1.5; }\n.org-remove-means li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; }\n.org-remove-means .copilotz-icon { margin-top: 3px; color: var(--muted-foreground); }\n.org-about-role { display: inline-flex; padding-top: 4px; }\n.org-about-role .copilotz-badge { gap: 4px; font-size: 12.5px; padding: 3px 10px; }\n.org-about-roles { display: grid; gap: 6px; color: var(--secondary-foreground); line-height: 1.5; }\n.org-about-roles b { color: var(--foreground); font-weight: 620; }\n.org-about-sees .copilotz-notice-body { line-height: 1.55; }\n@container space-tab (max-width: 520px) {\n .org-row { grid-template-columns: 34px minmax(0, 1fr); }\n .org-row .space-row-end { grid-column: 2; }\n}\n";
9
+ export declare const STYLE = "\n/* The sidebar: spaces as a tree */\n.spaces { list-style: none; display: grid; gap: 1px; margin: 0; padding: 0; }\n.spaces-item { display: grid; }\n.spaces-row { position: relative; }\n.spaces-row > .copilotz-nav-item { padding-right: 36px; }\n.spaces-fold { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); color: var(--muted-foreground); }\n.spaces-fold .copilotz-icon { transition: transform .15s; }\n.spaces-fold[aria-expanded=true] .copilotz-icon { transform: rotate(90deg); }\n.spaces-under { position: relative; display: grid; margin: 1px 0 8px 20px; padding-left: 10px; }\n.spaces-under::before { content: \"\"; position: absolute; top: 3px; bottom: 3px; left: 0; width: 1px;\n background: var(--sidebar-border); }\n.spaces-under > .copilotz-loading { min-height: 32px; padding: 6px; }\n.spaces-personal, .spaces-new-icon { display: grid; place-items: center; flex: none; width: 22px; height: 22px;\n border-radius: var(--radius-full); background: var(--muted); color: var(--secondary-foreground); }\n.spaces [aria-current] .spaces-personal { background: var(--card); color: var(--primary-text); }\n.spaces-new-icon { border: 1px dashed var(--input); border-radius: var(--radius-sm); background: transparent; }\n.spaces-form { margin-top: 2px; }\n.spaces-error { margin: 6px 10px 0; color: var(--destructive-text); font-size: 12.5px; }\n.spaces-archived { display: grid; margin-top: 4px; }\n.spaces-archived-icon { display: grid; place-items: center; flex: none; width: 22px; height: 22px; }\n.spaces-archived-end { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }\n.spaces-archived-end .copilotz-icon { transition: transform .15s; }\n.spaces-archived[data-open] .spaces-archived-end .copilotz-icon { transform: rotate(90deg); }\n.spaces-archived-list { margin: 1px 0 6px 12px; }\n.spaces-archived-list .copilotz-avatar { opacity: .75; }\n\n/* Invitations to you: in the sidebar, and on home */\n.invitations { list-style: none; display: grid; gap: 8px; margin: 0; padding: 0; }\n.invitation { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px;\n padding: 14px 14px 14px 16px; border-color: var(--primary-border);\n background: color-mix(in oklab, var(--primary-soft) 45%, var(--card)); animation: invitation-in .3s ease-out; }\n@keyframes invitation-in { from { opacity: 0; transform: translateY(-4px); } }\n.invitation-compact { grid-template-columns: 26px minmax(0, 1fr); align-items: start; gap: 10px;\n margin: 2px 0 4px; padding: 11px 12px; }\n.invitation-mark { display: grid; place-items: center; width: 26px; height: 26px; border-radius: var(--radius-full);\n background: var(--primary-soft); color: var(--primary-text); }\n.invitation-text { display: grid; gap: 2px; min-width: 0; }\n.invitation-title { margin: 0; font-size: 14.5px; line-height: 1.45; overflow-wrap: anywhere; }\n.invitation-compact .invitation-title { font-size: 13.5px; }\n.invitation-title b { font-weight: 650; }\n.invitation-meta { margin: 0; color: var(--muted-foreground); font-size: 12.5px; line-height: 1.45;\n overflow-wrap: anywhere; }\n.invitation-answers { display: flex; flex-wrap: wrap; gap: 6px; }\n.invitation-compact .invitation-answers { margin-top: 8px; }\n@media (max-width: 600px) {\n .invitation:not(.invitation-compact) { grid-template-columns: auto minmax(0, 1fr); }\n .invitation:not(.invitation-compact) .invitation-answers { grid-column: 2; }\n}\n\n/* A space's page */\n.space-mark-personal { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius-lg);\n background: var(--primary-soft); color: var(--primary-text); }\n.space-rename { color: var(--muted-foreground); }\n.space-faces { display: flex; align-items: center; padding: 0 4px 0 6px; border-radius: var(--radius-full);\n text-decoration: none; }\n.space-faces > * { margin-left: -6px; outline: 2px solid var(--background); }\n.space-faces-more { min-width: 28px; min-height: 28px; }\n.space-narrow { display: none; }\n.space-tabs { position: sticky; top: 0; z-index: 4; display: flex; width: 100%; margin-top: -2px;\n background: var(--background); -webkit-mask-image: linear-gradient(to right, currentColor calc(100% - 24px), transparent);\n mask-image: linear-gradient(to right, currentColor calc(100% - 24px), transparent); }\n.space-tabs .copilotz-tab { padding: 0 10px; }\n.space-tab { padding-top: 22px; }\n.space-loading { display: grid; gap: 14px; margin-top: 8px; }\n.space-missing { display: grid; place-items: center; padding: 32px; }\n.space-empty { margin-top: 48px; }\n.space-archived { margin: -4px 0 18px; }\n@container copilotz-page (max-width: 640px) {\n .space-wide, .space-faces { display: none; }\n .space-narrow { display: inline-grid; }\n .space-mark { --size: 36px !important; }\n .space-mark-personal { width: 36px; height: 36px; border-radius: var(--radius-md); }\n}\n@media (max-width: 760px) {\n .space-tabs { position: static; }\n}\n\n/* A tab's sections (sections.tsx): a menu beside them (settings), or tabs above (the computer's) */\n.space-sections { container: space-sections / inline-size; }\n.space-sections-side { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 36px; align-items: start; }\n.space-sections-menu { position: sticky; top: 60px; display: grid; gap: 2px; }\n.space-sections-group { margin: 14px 0 4px; padding: 0 10px; color: var(--muted-foreground);\n font-family: var(--font-display); font-size: 11.5px; font-weight: 650; letter-spacing: .08em;\n text-transform: uppercase; }\n.space-sections-chevron { display: none; color: var(--muted-foreground); }\n.space-sections-body { min-width: 0; }\n.space-sections-back { display: none; }\n.space-sections-back-link { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; margin-left: -6px;\n padding-right: 8px; color: var(--muted-foreground); font-size: 14px; text-decoration: none; }\n.space-sections-back-link:hover { color: var(--foreground); }\n.space-sections-title { margin: 0; font-family: var(--font-display); font-size: 20px; font-weight: 640;\n letter-spacing: -.01em; }\n.space-sections-top { display: grid; gap: 20px; }\n.space-sections-tabs { justify-self: start; }\n/* Without room for both (a phone): the menu is a list to tap into; a section says how to get back */\n@container space-sections (max-width: 640px) {\n .space-sections-side { grid-template-columns: minmax(0, 1fr); gap: 0; }\n .space-sections-side[data-picked=false] .space-sections-body,\n .space-sections-side[data-picked=true] .space-sections-menu { display: none; }\n .space-sections-menu { position: static; gap: 0; }\n .space-sections-menu .copilotz-nav-item { min-height: 52px; padding: 8px 12px; font-size: 15px; }\n .space-sections-chevron { display: inline-flex; }\n /* Listed, nothing is open yet: none looks chosen */\n .space-sections-side[data-picked=false] .copilotz-nav-item[aria-current] { border-color: transparent;\n background: transparent; box-shadow: none; }\n .space-sections-side[data-picked=false] .copilotz-nav-item[aria-current] .copilotz-nav-label { font-weight: inherit; }\n .space-sections-side[data-picked=true] .space-sections-back { display: grid; gap: 4px; margin: -12px 0 18px; }\n}\n\n/* Members, and inviting people */\n.space-members, .space-settings, .space-inviting { container: space-tab / inline-size; display: grid; gap: 24px; }\n.space-inviting { gap: 16px; }\n.space-inviting-kind { display: grid; gap: 22px; }\n.space-members-compact, .space-settings-compact { gap: 18px; }\n.space-section { display: grid; gap: 10px; }\n.space-section-title { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted-foreground);\n font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }\n.space-count { font-variant-numeric: tabular-nums; letter-spacing: 0; }\n.space-rows { list-style: none; display: grid; gap: 8px; margin: 0; padding: 0; }\n.space-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 12px;\n padding: 10px 10px 10px 14px; }\n.space-row-asking { border-color: var(--warning-border); }\n.space-row-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-md);\n background: var(--primary-soft); color: var(--primary-text); }\n.space-row-text { display: grid; gap: 1px; min-width: 0; }\n.space-row-name { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0; font-weight: 620; }\n.space-row-name .copilotz-time { color: var(--muted-foreground); font-size: 12px; font-weight: 450; }\n.space-row-what { margin: 0; overflow: hidden; color: var(--muted-foreground); font-size: 12.5px;\n text-overflow: ellipsis; white-space: nowrap; }\n.space-row-end { display: flex; align-items: center; gap: 6px; }\n.space-row-end > .copilotz-select { min-width: 116px; }\n.space-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;\n min-height: 30px; margin-bottom: -4px; }\n.space-section-head .copilotz-button { margin-right: -6px; }\n.space-section-about { margin: -2px 2px 2px; color: var(--muted-foreground); font-size: 13px; line-height: 1.5; }\n\n/* Agents among the members */\n.space-row-face { display: grid; }\n.space-row-link { min-width: 0; overflow: hidden; color: inherit; text-decoration: none; text-overflow: ellipsis;\n white-space: nowrap; }\n.space-row-link:hover { text-decoration: underline; text-underline-offset: 3px;\n text-decoration-color: color-mix(in oklab, currentColor 35%, transparent); }\n.space-row-handle { flex: none; color: var(--muted-foreground); font: 500 12.5px var(--font-mono); }\n.space-row-name .copilotz-badge { flex: none; }\n.space-row-agent[aria-busy] { opacity: .7; }\n.space-row-more { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; margin-top: 2px; }\n.space-row-more:empty { display: none; }\n.space-agents-none { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px;\n padding: 14px 16px; border-style: dashed; box-shadow: none; background: transparent; }\n.space-agents-none p { margin: 0; color: var(--muted-foreground); font-size: 13.5px; }\n.space-invite { display: grid; gap: 7px; }\n.space-invite-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; }\n.space-invite-row > .copilotz-select { min-width: 128px; }\n.space-invite-note { margin: 0 2px; color: var(--muted-foreground); font-size: 12.5px; }\n.space-invite-note > span { display: inline-flex; align-items: center; gap: 6px; }\n.space-row-mail { border-radius: var(--radius-full); background: var(--muted); color: var(--muted-foreground); }\n.space-row-email { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.space-invite-error { color: var(--destructive-text); }\n.space-invite-done { color: var(--success-text); }\n@container space-tab (max-width: 520px) {\n .space-row { gap: 10px; padding-left: 12px; }\n .space-row-agent { grid-template-columns: 32px minmax(0, 1fr); }\n .space-row-agent .space-row-end { grid-column: 2; }\n .space-row-agent .space-row-handle { display: none; }\n .space-row-asking { grid-template-columns: 32px minmax(0, 1fr); }\n .space-row-asking .space-row-end { grid-column: 1 / -1; flex-wrap: wrap; }\n .space-invite-row { grid-template-columns: minmax(0, 1fr) auto; }\n .space-invite-row > .copilotz-input { grid-column: 1 / -1; }\n}\n@container space-tab (max-width: 340px) {\n .space-row { grid-template-columns: 32px minmax(0, 1fr); }\n .space-row-end { grid-column: 2; }\n}\n\n/* A message naming agents that don't answer here: over where you type */\n.space-not-here-title { display: inline-flex; align-items: center; gap: 8px; }\n.space-not-here-faces { display: inline-flex; }\n.space-not-here-faces > * + * { margin-left: -5px; outline: 2px solid var(--info-soft); }\n@media (max-width: 760px) {\n .space-not-here { flex-wrap: wrap; }\n .space-not-here .copilotz-notice-body { flex-basis: calc(100% - 30px); }\n .space-not-here .copilotz-notice-action { width: 100%; justify-content: flex-end; margin: 2px 0 0; }\n}\n\n/* Settings */\n.space-setting-list { display: grid; }\n.space-setting { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 400px); align-items: start;\n gap: 10px 32px; padding: 18px 20px; }\n.space-setting + .space-setting { border-top: 1px solid var(--border); }\n.space-setting h3 { margin: 0 0 3px; font-size: 14.5px; font-weight: 650; }\n.space-setting-text { margin: 0; color: var(--muted-foreground); font-size: 13.5px; line-height: 1.5; }\n.space-setting-control { display: grid; justify-items: start; min-width: 0; }\n.space-setting-form { display: grid; gap: 6px; width: 100%; }\n.space-setting-inline { display: flex; gap: 8px; }\n.space-setting-inline > .copilotz-input { flex: 1; min-width: 0; }\n.space-setting-control > .copilotz-input { width: 100%; }\n.space-setting-form > .copilotz-select { width: 100%; }\n.space-setting-note { display: flex; align-items: center; gap: 6px; margin: 0 2px; font-size: 12.5px; }\n.space-setting-about { display: grid; gap: 14px; padding: 18px 20px; }\n.space-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 9px 22px; margin: 0;\n font-size: 14px; }\n.space-facts dt { color: var(--muted-foreground); }\n.space-facts dd { min-width: 0; margin: 0; }\n.space-facts-id { display: flex; align-items: center; gap: 6px; }\n.space-facts-id code { min-width: 0; overflow: hidden; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }\n.space-archive-means { display: grid; gap: 10px; margin: 0; padding: 0 0 0 18px; color: var(--secondary-foreground);\n font-size: 14px; line-height: 1.5; }\n.space-archive-means b { color: var(--foreground); font-weight: 620; }\n.space-archive-means + .copilotz-notice { margin-top: 14px; }\n@container space-tab (max-width: 620px) {\n .space-setting { grid-template-columns: minmax(0, 1fr); padding: 16px; }\n .space-setting-control { justify-items: stretch; }\n}\n\n/* In the side panel */\n.space-panel { container: space-panel / inline-size; display: flex; flex-direction: column; height: 100%; min-height: 0; }\n.space-panel-head { flex: none; display: flex; align-items: center; gap: 10px; min-height: 58px;\n padding: 9px max(10px, var(--copilotz-inset-end, 0px)) 9px 16px; border-bottom: 1px solid var(--border); }\n.space-panel-mark { display: grid; place-items: center; flex: none; width: 26px; height: 26px;\n border-radius: var(--radius-full); background: var(--primary-soft); color: var(--primary-text); }\n.space-panel-titles { flex: 1; display: grid; min-width: 0; line-height: 1.25; }\n.space-panel-titles h2 { margin: 0; overflow: hidden; font-family: var(--font-display); font-size: 15px;\n font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }\n.space-panel-titles span { color: var(--muted-foreground); font-size: 12px; }\n.space-panel-tabs { flex: none; align-self: flex-start; max-width: calc(100% - 24px); margin: 10px 12px 0; }\n.space-panel-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;\n scrollbar-color: var(--input) transparent; }\n.space-panel-tab { min-height: 100%; padding: 14px 14px 20px; }\n.space-panel-tab[hidden] { display: none; }\n/* A tab with sections, in the panel: its own tabs, under the panel's */\n.space-panel-part { min-height: 100%; display: flex; flex-direction: column; }\n.space-panel-part[hidden] { display: none; }\n.space-panel-part > .space-sections-top { flex: 1; display: flex; flex-direction: column; gap: 0; }\n.space-panel-part .space-sections-tabs { flex: none; max-width: calc(100% - 28px); margin: 12px 14px 0; }\n.space-panel-part .space-sections-body { flex: 1; display: flex; flex-direction: column; }\n.space-panel-part .space-sections-body > .space-panel-tab { flex: 1; min-height: auto; }\n.space-panel-missing { padding: 24px; color: var(--muted-foreground); }\n@container space-panel (max-width: 560px) {\n .space-panel-tabs .copilotz-tab[aria-selected=false] { padding: 0 9px; }\n .space-panel-tabs .copilotz-tab[aria-selected=false] .space-panel-tab-label { position: absolute; width: 1px;\n height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }\n}\n\n/* The org's sections: its people, and what it is */\n.org-row { grid-template-columns: 34px minmax(0, 1fr) auto; }\n.org-row-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.org-row-spacer { width: 30px; }\n.org-row .space-row-end > .copilotz-badge { min-width: 116px; justify-content: center; }\n.org-note { margin: -8px 0 0; }\n.org-remove { display: grid; gap: 18px; }\n.org-remove-means { list-style: none; display: grid; gap: 10px; margin: 0; padding: 0; color: var(--secondary-foreground);\n font-size: 14px; line-height: 1.5; }\n.org-remove-means li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; }\n.org-remove-means .copilotz-icon { margin-top: 3px; color: var(--muted-foreground); }\n.org-about-role { display: inline-flex; padding-top: 4px; }\n.org-about-role .copilotz-badge { gap: 4px; font-size: 12.5px; padding: 3px 10px; }\n.org-about-roles { display: grid; gap: 6px; color: var(--secondary-foreground); line-height: 1.5; }\n.org-about-roles b { color: var(--foreground); font-weight: 620; }\n.org-about-sees .copilotz-notice-body { line-height: 1.55; }\n@container space-tab (max-width: 520px) {\n .org-row { grid-template-columns: 34px minmax(0, 1fr); }\n .org-row .space-row-end { grid-column: 2; }\n}\n";
@@ -152,6 +152,8 @@ export const STYLE = `
152
152
  .space-row-handle { flex: none; color: var(--muted-foreground); font: 500 12.5px var(--font-mono); }
153
153
  .space-row-name .copilotz-badge { flex: none; }
154
154
  .space-row-agent[aria-busy] { opacity: .7; }
155
+ .space-row-more { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; margin-top: 2px; }
156
+ .space-row-more:empty { display: none; }
155
157
  .space-agents-none { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px;
156
158
  padding: 14px 16px; border-style: dashed; box-shadow: none; background: transparent; }
157
159
  .space-agents-none p { margin: 0; color: var(--muted-foreground); font-size: 13.5px; }
@@ -121,7 +121,7 @@ export const sendAction = defineAction({
121
121
  audio: f.data,
122
122
  type: f.type,
123
123
  filename: f.name,
124
- tags: { thread: threadId, purpose: "transcription" },
124
+ tags: { thread: threadId, purpose: "transcription", ...(where ? { space: where } : {}) },
125
125
  });
126
126
  return heard.text.trim();
127
127
  }
@@ -2,7 +2,7 @@
2
2
  * The chat plugin's contract: what plugins built on chat (memory, history,
3
3
  * spaces, computers) may import from it: the shapes of its documents and of
4
4
  * the resource kinds it reads (`agents`, `tools`, `context`, `roster`,
5
- * `agentSources`; on the web, `conversation`, `home`, `toolViews`,
5
+ * `agentSources`, `agentModel`; on the web, `conversation`, `home`, `toolViews`,
6
6
  * `refusals` and `composerNotes`),
7
7
  * `tool()` to declare a tool, and what knowing agents takes (`agentsOf`,
8
8
  * `defaults`, `modelOf`, `agentsNamed`, `agentsShown`, `SEND`).
@@ -21,7 +21,7 @@ export type { Agent, ChatSettings, ComposerNote, ContextEntry, ConversationView,
21
21
  export { tool } from "./shared/types.js";
22
22
  export { principalOf } from "./shared/send.js";
23
23
  export { type Origin, originKey, originOf } from "./shared/origin.js";
24
- export type { AgentSource, Roster, RosterSource, Team } from "./shared/agents.js";
24
+ export type { AgentModel, AgentSource, Roster, RosterSource, Team } from "./shared/agents.js";
25
25
  /**
26
26
  * The app's agents (`agentsOf`), who of them answer new conversations
27
27
  * (`defaults`), an agent's model (`modelOf`), which names are agents and
@@ -21,14 +21,18 @@
21
21
  * its parent's conversation up to the message it started at, through every
22
22
  * level, without copying it; a new thread starts from its first message.
23
23
  *
24
- * - Agents are the app's (its `agents` resource). Two optional hooks widen
24
+ * - Agents are the app's (its `agents` resource). Three optional hooks widen
25
25
  * that, each an unrecorded Action called as the asker, and cost nothing
26
26
  * when absent: `agentSources` say what agents beyond the app's are (the
27
- * team plugin's, agents people make), and the `roster` says who answers
27
+ * team plugin's, agents people make), the `roster` says who answers
28
28
  * in a space (the spaces plugin's): new conversations there go to its
29
- * default, and only its agents are mentioned or messaged there. Without
30
- * a roster, every agent answers everywhere. `thread.agents` answers both
31
- * for front ends.
29
+ * default, and only its agents are mentioned or messaged there, and
30
+ * `agentModel` says which model an agent thinks with in a space (the
31
+ * tiers plugin's), asked once each run of a turn; null, or none, is its
32
+ * own. Without a roster, every agent answers everywhere. `thread.agents`
33
+ * answers both for front ends.
34
+ * - Each model call is tagged with its thread, agent, turn and space, for
35
+ * whoever records its use.
32
36
  *
33
37
  * Declares resource kinds the app (or another plugin) fills in, plain objects:
34
38
  * - `agents`: { instructions, model, effort?, maxTokens?, temperature?,
@@ -36,7 +40,8 @@
36
40
  * `"provider/model"`, an alias, or a list tried in order (see the models plugin);
37
41
  * - `tools`: { description, input?, run(input) };
38
42
  * - `agentSources`: { action }: `{ names }` in, the definitions of those the asker meets out;
39
- * - `roster`: { action }: `{ space }` in, `{ agents, default? }` out.
43
+ * - `roster`: { action }: `{ space }` in, `{ agents, default? }` out;
44
+ * - `agentModel`: { action }: `{ agent, space? }` in, a model or null out.
40
45
  */
41
46
  import { type Plugin } from "../../../runtime/mod.js";
42
47
  export * from "./contract.js";
@@ -21,14 +21,18 @@
21
21
  * its parent's conversation up to the message it started at, through every
22
22
  * level, without copying it; a new thread starts from its first message.
23
23
  *
24
- * - Agents are the app's (its `agents` resource). Two optional hooks widen
24
+ * - Agents are the app's (its `agents` resource). Three optional hooks widen
25
25
  * that, each an unrecorded Action called as the asker, and cost nothing
26
26
  * when absent: `agentSources` say what agents beyond the app's are (the
27
- * team plugin's, agents people make), and the `roster` says who answers
27
+ * team plugin's, agents people make), the `roster` says who answers
28
28
  * in a space (the spaces plugin's): new conversations there go to its
29
- * default, and only its agents are mentioned or messaged there. Without
30
- * a roster, every agent answers everywhere. `thread.agents` answers both
31
- * for front ends.
29
+ * default, and only its agents are mentioned or messaged there, and
30
+ * `agentModel` says which model an agent thinks with in a space (the
31
+ * tiers plugin's), asked once each run of a turn; null, or none, is its
32
+ * own. Without a roster, every agent answers everywhere. `thread.agents`
33
+ * answers both for front ends.
34
+ * - Each model call is tagged with its thread, agent, turn and space, for
35
+ * whoever records its use.
32
36
  *
33
37
  * Declares resource kinds the app (or another plugin) fills in, plain objects:
34
38
  * - `agents`: { instructions, model, effort?, maxTokens?, temperature?,
@@ -36,7 +40,8 @@
36
40
  * `"provider/model"`, an alias, or a list tried in order (see the models plugin);
37
41
  * - `tools`: { description, input?, run(input) };
38
42
  * - `agentSources`: { action }: `{ names }` in, the definitions of those the asker meets out;
39
- * - `roster`: { action }: `{ space }` in, `{ agents, default? }` out.
43
+ * - `roster`: { action }: `{ space }` in, `{ agents, default? }` out;
44
+ * - `agentModel`: { action }: `{ agent, space? }` in, a model or null out.
40
45
  */
41
46
  import { definePlugin } from "../../../runtime/mod.js";
42
47
  import { forkAction } from "./actions/fork.js";
@@ -90,6 +95,10 @@ export const chat = definePlugin({
90
95
  "chat.move": moveAction,
91
96
  },
92
97
  events: { "turn.requested": turnRequested },
98
+ // Conversations by title on Usage.
99
+ resources: {
100
+ usageNames: { thread: { tag: "tags.thread", collection: "thread", field: "title" } },
101
+ },
93
102
  processors: {
94
103
  "chat.turn": turnProcessor,
95
104
  "chat.failed": failedProcessor,
@@ -18,6 +18,20 @@ const asAgent = (ctx, agent, at) => {
18
18
  };
19
19
  /** The space a thread is in, where its turns work: what they write elsewhere needs a person. */
20
20
  const spaceOf = async (ctx, thread) => (await ctx.as().db.collection("thread").findOne({ _id: thread }))?.in;
21
+ /**
22
+ * The model it thinks with this turn: what the `agentModel` resource says for
23
+ * it in this space, when one says anything, else its own.
24
+ */
25
+ async function modelFor(ctx, name, agent, space) {
26
+ const [source] = Object.values((ctx.resources.agentModel ?? {}));
27
+ if (!source)
28
+ return modelOf(agent);
29
+ const chosen = await ctx.call(source.action, {
30
+ agent: name,
31
+ ...(space ? { space } : {}),
32
+ });
33
+ return chosen ?? modelOf(agent);
34
+ }
21
35
  export const turnProcessor = {
22
36
  on: ["turn.requested", "wait.updated"],
23
37
  // A turn requested, or a wait whose last reply just came in.
@@ -85,6 +99,8 @@ const turn = async (ctx, event) => {
85
99
  });
86
100
  // What it writes shows as it comes: the turn's live document.
87
101
  const live = liveWriter(ctx, t, run, current.in);
102
+ // Asked once a run: a change reaches its next reply, never a step halfway.
103
+ const model = await modelFor(ctx, t.agent, agent, current.in);
88
104
  const { maxSteps } = settingsOf(ctx);
89
105
  for (; maxSteps === undefined || step < maxSteps; step++) {
90
106
  live.begin();
@@ -92,12 +108,17 @@ const turn = async (ctx, event) => {
92
108
  let state;
93
109
  const calls = [];
94
110
  for await (const chunk of await ctx.call("llm.stream", {
95
- model: modelOf(agent),
111
+ model,
96
112
  instructions,
97
113
  messages: conversation,
98
114
  tools: offered,
99
- // Its usage record says whose turn it was, in which thread.
100
- tags: { thread: t.thread, agent: t.agent, turn: run },
115
+ // Its usage record says whose turn it was, in which thread and space.
116
+ tags: {
117
+ thread: t.thread,
118
+ agent: t.agent,
119
+ turn: run,
120
+ ...(current.in ? { space: current.in } : {}),
121
+ },
101
122
  })) {
102
123
  if (chunk.type === "text") {
103
124
  text += chunk.text;