@pairz/team 0.0.1 → 1.0.0-rc.81

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 (96) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +50 -1
  3. package/WORDS.md +357 -0
  4. package/contract.d.ts +8 -0
  5. package/contract.js +8 -0
  6. package/mod.d.ts +25 -0
  7. package/mod.js +25 -0
  8. package/package.json +61 -3
  9. package/team/actions/agent.d.ts +14 -0
  10. package/team/actions/agent.js +401 -0
  11. package/team/actions/define.d.ts +1 -0
  12. package/team/actions/define.js +45 -0
  13. package/team/collections/agent.d.ts +170 -0
  14. package/team/collections/agent.js +126 -0
  15. package/team/contract.d.ts +11 -0
  16. package/team/contract.js +1 -0
  17. package/team/mod.d.ts +28 -0
  18. package/team/mod.js +64 -0
  19. package/team/resources/propose.d.ts +1 -0
  20. package/team/resources/propose.js +102 -0
  21. package/team/shared/definition.d.ts +3 -0
  22. package/team/shared/definition.js +11 -0
  23. package/team/shared/everywhere.d.ts +11 -0
  24. package/team/shared/everywhere.js +29 -0
  25. package/team/shared/limits.d.ts +17 -0
  26. package/team/shared/limits.js +17 -0
  27. package/team/views/web/agent-add.d.ts +14 -0
  28. package/team/views/web/agent-add.js +58 -0
  29. package/team/views/web/agent-describe.d.ts +38 -0
  30. package/team/views/web/agent-describe.js +44 -0
  31. package/team/views/web/agent-fields.d.ts +35 -0
  32. package/team/views/web/agent-fields.js +88 -0
  33. package/team/views/web/agent-known.d.ts +22 -0
  34. package/team/views/web/agent-known.js +62 -0
  35. package/team/views/web/agent-new.d.ts +27 -0
  36. package/team/views/web/agent-new.js +150 -0
  37. package/team/views/web/agent-org.d.ts +12 -0
  38. package/team/views/web/agent-org.js +89 -0
  39. package/team/views/web/agent-palette.d.ts +19 -0
  40. package/team/views/web/agent-palette.js +203 -0
  41. package/team/views/web/agent-steps.d.ts +23 -0
  42. package/team/views/web/agent-steps.js +56 -0
  43. package/team/views/web/agent.d.ts +20 -0
  44. package/team/views/web/agent.js +310 -0
  45. package/team/views/web/agents.d.ts +48 -0
  46. package/team/views/web/agents.js +59 -0
  47. package/team/views/web/model-pick.d.ts +27 -0
  48. package/team/views/web/model-pick.js +42 -0
  49. package/team/views/web/model-picker.d.ts +57 -0
  50. package/team/views/web/model-picker.js +218 -0
  51. package/team/views/web/places.d.ts +24 -0
  52. package/team/views/web/places.js +10 -0
  53. package/team/views/web/style.d.ts +9 -0
  54. package/team/views/web/style.js +251 -0
  55. package/team/views/web/words.d.ts +5 -0
  56. package/team/views/web/words.js +239 -0
  57. package/team/web.d.ts +22 -0
  58. package/team/web.js +43 -0
  59. package/tiers/actions/choose.d.ts +7 -0
  60. package/tiers/actions/choose.js +315 -0
  61. package/tiers/actions/model.d.ts +1 -0
  62. package/tiers/actions/model.js +60 -0
  63. package/tiers/collections/choice.d.ts +57 -0
  64. package/tiers/collections/choice.js +79 -0
  65. package/tiers/collections/template.d.ts +76 -0
  66. package/tiers/collections/template.js +41 -0
  67. package/tiers/contract.d.ts +23 -0
  68. package/tiers/contract.js +1 -0
  69. package/tiers/mod.d.ts +72 -0
  70. package/tiers/mod.js +111 -0
  71. package/tiers/shared/plans.d.ts +65 -0
  72. package/tiers/shared/plans.js +91 -0
  73. package/tiers/shared/shown.d.ts +187 -0
  74. package/tiers/shared/shown.js +280 -0
  75. package/tiers/shared/tiers.d.ts +150 -0
  76. package/tiers/shared/tiers.js +170 -0
  77. package/tiers/views/web/composer.d.ts +14 -0
  78. package/tiers/views/web/composer.js +81 -0
  79. package/tiers/views/web/org.d.ts +61 -0
  80. package/tiers/views/web/org.js +289 -0
  81. package/tiers/views/web/say.d.ts +139 -0
  82. package/tiers/views/web/say.js +143 -0
  83. package/tiers/views/web/setup.d.ts +23 -0
  84. package/tiers/views/web/setup.js +80 -0
  85. package/tiers/views/web/space.d.ts +31 -0
  86. package/tiers/views/web/space.js +74 -0
  87. package/tiers/views/web/style.d.ts +7 -0
  88. package/tiers/views/web/style.js +191 -0
  89. package/tiers/views/web/team.d.ts +38 -0
  90. package/tiers/views/web/team.js +118 -0
  91. package/tiers/views/web/words.d.ts +48 -0
  92. package/tiers/views/web/words.js +122 -0
  93. package/tiers/web.d.ts +30 -0
  94. package/tiers/web.js +71 -0
  95. package/web.d.ts +14 -0
  96. package/web.js +14 -0
@@ -0,0 +1,143 @@
1
+ /** Every word tiers' web front end shows, to be changed by the app (`tiers.<key>`). */
2
+ import { defineWords } from "pairz/web/words";
3
+ export const tiers = {
4
+ // What prices are for, and how far credits go
5
+ perMessage: "a message",
6
+ perReply: "a reply",
7
+ messages: { one: "{count} message", other: "{count} messages" },
8
+ replies: { one: "{count} reply", other: "{count} replies" },
9
+ creditsOnce: "about {things} with {plan}'s {amount}",
10
+ creditsSeat: "about {things} a month for each seat on {plan}",
11
+ creditsMonth: "about {things} a month with {plan}'s {amount}",
12
+ underTenth: "under 0.1¢",
13
+ // How hard a model thinks
14
+ effortNone: "no reasoning",
15
+ effortMinimal: "minimal effort",
16
+ effortLow: "low effort",
17
+ effortMedium: "medium effort",
18
+ effortHigh: "high effort",
19
+ effortXhigh: "extra-high effort",
20
+ effortMax: "max effort",
21
+ effortOther: "{effort} effort",
22
+ providerChatgpt: "your ChatGPT plan",
23
+ // Who chose the tier in force
24
+ byThread: "chosen for this chat",
25
+ byPerson: "your default",
26
+ bySpace: "this space's default",
27
+ byOrg: "the org's default",
28
+ byPlan: "your plan's default",
29
+ // The org's page: its tiers
30
+ emptyTitle: "No tiers to choose from",
31
+ emptyBody: "This app's agents each think with the model it gives them.",
32
+ nowOrg: "New chats use {tier}, your org's default.",
33
+ nowPlan: "New chats use {tier}, your plan's default.",
34
+ nowMore: "Anyone can switch a chat's tier as they write, and spaces can set their own.",
35
+ backToPlan: "Back to your plan's default",
36
+ doneSaid: "New chats use {tier} from now on.",
37
+ undo: "Undo",
38
+ onlyRunners: "Only {org}'s owners and admins change these. You can switch a chat's tier as you write.",
39
+ onlyRunnersHere: "Only the org's owners and admins change these. You can switch a chat's tier as you write.",
40
+ tiersLabel: "Tiers",
41
+ newTier: "New tier",
42
+ newTierAbout: "Mix models your way: one for deciding, another for checking.",
43
+ takenAway: "Taken away:",
44
+ addBackTier: "Add back {tier}",
45
+ capLabel: "Members can choose up to",
46
+ capAny: "Any tier",
47
+ capNote: "Owners and admins can always use any of them.",
48
+ noCredits: "{plan} gives this org no credits.",
49
+ noCreditsMore: "Choose a plan or add credits for your agents to start working.",
50
+ billing: "Billing",
51
+ faster: "{tier} uses your credits about {times} faster than {cheapest}.",
52
+ fasterGoes: "That's {goes}.",
53
+ changeAnyTime: "You can change it any time.",
54
+ footMessage: "A typical message here, measured from how people use these agents: the one who answers often calls its model a few times, and others join some messages.",
55
+ footReply: "A typical reply here: about 20,000 tokens read, most of them from the cache, and 1,000 written.",
56
+ footPrices: "At your org's prices; real ones vary. What agents spend stays within your {budget}.",
57
+ budget: "budget",
58
+ // A tier's card
59
+ tierMore: "{tier}: more",
60
+ customize: "Customize…",
61
+ duplicate: "Duplicate…",
62
+ copyOf: "{tier} copy",
63
+ backToOriginal: "Back to the original",
64
+ deleteTier: "Delete",
65
+ takeAway: "Take away",
66
+ badgeDefault: "Default",
67
+ badgePlan: "Plan's",
68
+ badgeYours: "Yours",
69
+ badgeChanged: "Changed",
70
+ pricedEach: "Priced as each model is",
71
+ tierModels: "{tier}'s models",
72
+ then: "then {names}",
73
+ defaultForNew: "Default for new chats",
74
+ makeDefault: "Make it the default",
75
+ // Customizing a tier, or making one
76
+ newTierTitle: "A new tier",
77
+ customizeTitle: "Customize {tier}",
78
+ newTierStarts: "It starts as {tier}: change the model for any kind of work.",
79
+ customizeAbout: "Each kind of work's model, and what it falls back to when that one fails. Changes apply from each chat's next reply.",
80
+ cancel: "Cancel",
81
+ createTier: "Create tier",
82
+ save: "Save",
83
+ name: "Name",
84
+ namePlaceholder: "Balanced",
85
+ forLabel: "What it's for",
86
+ forPlaceholder: "Strong judgment, quick checks.",
87
+ nobodyYet: "No agent does this yet",
88
+ newKind: "A new kind of work",
89
+ newKindPlaceholder: "Numbers",
90
+ startsFrom: "Starts from",
91
+ add: "Add",
92
+ addKind: "Add a kind of work",
93
+ fallbacks: "If it fails, then",
94
+ moveUp: "Move up",
95
+ moveDown: "Move down",
96
+ remove: "Remove",
97
+ noFallback: "Nothing: if it fails, the reply fails.",
98
+ addFallback: "Add a fallback",
99
+ // The team
100
+ teamTitle: "Your team",
101
+ teamAbout: "Every space in {org} starts with these agents. Each does a kind of work, and the tier gives it its model.",
102
+ teamAboutMine: "Every space of yours starts with these agents. Each does a kind of work, and the tier gives it its model.",
103
+ addAgent: "Add an agent",
104
+ edit: "Edit",
105
+ removeFromTeam: "Remove from the team",
106
+ badgeOrgs: "Your org's",
107
+ onTier: "{model} on {tier}",
108
+ notOnTeam: "Not on your team",
109
+ addBack: "Add back",
110
+ addAgentTitle: "Add an agent to the team",
111
+ addAgentAbout: "It works in every space in {org}, and every new one.",
112
+ addAgentAboutMine: "It works in every space of yours, and every new one.",
113
+ removeTitle: "Remove {name} from the team?",
114
+ removeSaid: "{name} leaves every space in {org} and won't join new ones. What it already said stays in its chats.",
115
+ removeSaidMine: "{name} leaves every space of yours and won't join new ones. What it already said stays in its chats.",
116
+ removeDeletes: "This deletes it.",
117
+ removeBack: "You can add it back from this page.",
118
+ // A new org's choice
119
+ recommended: "Recommended",
120
+ ownersChoose: "Your org's owners and admins choose this.",
121
+ // A space
122
+ spaceStartsOn: "New chats here start on {tier}",
123
+ spaceChosen: "Chosen for this space. The org's default is {tier}.",
124
+ spaceAsOrg: "As the org's default.",
125
+ spaceSwitch: "Anyone can switch a chat's tier as they write.",
126
+ spaceManagers: "This space's managers can change its default.",
127
+ spaceSelect: "This space's default tier",
128
+ asOrg: "As the org: {tier}",
129
+ agentLine: "{model} · {kind} · on {tier}",
130
+ // Beside the send button
131
+ onPlans: "on your plans · model $0",
132
+ pickLabel: "Tier: {tier}, {by}",
133
+ pickCap: "Members can use up to {cap}.",
134
+ backToDefault: "Back to the default",
135
+ backToOrgDefault: "Back to the org's default",
136
+ chatRunsOn: "This chat runs on {tier} from its next reply.",
137
+ chatRunsDefault: "This chat runs on its default.",
138
+ newChatsOn: "Your new chats start on {tier}.",
139
+ newChatsDefault: "Your new chats start on the default.",
140
+ };
141
+ export const say = defineWords("tiers", tiers);
142
+ /** Every word of tiers' front end, by area (team's WORDS.md lists them). */
143
+ export const PHRASES = { tiers };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Choosing the org's tier when it's new (kind `tiers.setup`): a step of a
3
+ * welcome, or anywhere a page wants the choice short. The tiers as one choice,
4
+ * each its name, what it's good for, what a typical message comes to at this
5
+ * org's prices, how far the plan's credits go at that, and a meter of how
6
+ * much it spends next to the others; the plan's own marked Recommended. A
7
+ * click chooses it for the org at once (`tiers.choose`, as the org's page
8
+ * does: the plan's own goes back to following the plan), and on a plan of
9
+ * credits given once, a heavier tier says how much faster it spends them. A
10
+ * link goes on to the org's page, to pick a model per agent. Owners and
11
+ * admins choose; anyone else reads it, and is told who can.
12
+ */
13
+ import { type ReactNode } from "react";
14
+ import type { ViewContext } from "pairz";
15
+ import type { Shown } from "../../contract.js";
16
+ type Call = <R = unknown>(action: string, input?: unknown) => Promise<R>;
17
+ export declare const tiersSetupView: (_: unknown, ctx: ViewContext<ReactNode>) => ReactNode;
18
+ export declare function SetupTiers({ shown, may: given, call }: {
19
+ shown: Shown;
20
+ may?: boolean;
21
+ call: Call;
22
+ }): ReactNode;
23
+ export {};
@@ -0,0 +1,80 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Choosing the org's tier when it's new (kind `tiers.setup`): a step of a
4
+ * welcome, or anywhere a page wants the choice short. The tiers as one choice,
5
+ * each its name, what it's good for, what a typical message comes to at this
6
+ * org's prices, how far the plan's credits go at that, and a meter of how
7
+ * much it spends next to the others; the plan's own marked Recommended. A
8
+ * click chooses it for the org at once (`tiers.choose`, as the org's page
9
+ * does: the plan's own goes back to following the plan), and on a plan of
10
+ * credits given once, a heavier tier says how much faster it spends them. A
11
+ * link goes on to the org's page, to pick a model per agent. Owners and
12
+ * admins choose; anyone else reads it, and is told who can.
13
+ */
14
+ import { useState } from "react";
15
+ import { Badge, Icon, message, Notice, Skeleton, Spinner } from "pairz/web";
16
+ import { runs, useStanding } from "pairz/plugins/interfaces/contract";
17
+ import { SpendNote } from "./org.js";
18
+ import { STYLE } from "./style.js";
19
+ import { say } from "./say.js";
20
+ import { creditsGo, perReply, shownSaid, unitSaid } from "./words.js";
21
+ export const tiersSetupView = (_, ctx) => {
22
+ const shown = shownSaid(ctx.db.collection("modelChoice").query("offered", {}).value);
23
+ // Given the person's role where it's shown (the org's page), else asked (a welcome's step).
24
+ const given = "role" in ctx.hints
25
+ ? runs({
26
+ role: ctx.hints.role ?? null,
27
+ staff: ctx.hints.staff === true,
28
+ })
29
+ : undefined;
30
+ return (_jsxs(_Fragment, { children: [_jsx("style", { href: "tiers-web", precedence: "pairz", children: STYLE }), shown
31
+ ? _jsx(SetupTiers, { shown: shown, may: given, call: ctx.call })
32
+ : (_jsx("div", { className: "tiers-setup", "aria-busy": "true", children: [0, 1, 2, 3].map((n) => _jsx(Skeleton, { height: 74, radius: "lg" }, n)) }))] }));
33
+ };
34
+ export function SetupTiers({ shown, may: given, call }) {
35
+ const standing = useStanding(call, given === undefined);
36
+ const may = given ?? (standing ? runs(standing) : false);
37
+ const [busy, setBusy] = useState();
38
+ const [error, setError] = useState();
39
+ // The org's default: what new chats start on.
40
+ const now = shown.org.tier ?? shown.plan ?? shown.tiers[0]?.name;
41
+ const top = Math.max(...shown.tiers.map((t) => t.price ?? 0));
42
+ const choose = async (tier) => {
43
+ if (!may || busy || tier.name === now)
44
+ return;
45
+ setBusy(tier.name);
46
+ setError(undefined);
47
+ try {
48
+ // The plan's own: back to following the plan, so a new plan moves it.
49
+ await call("tiers.choose", { tier: tier.name === shown.plan ? null : tier.name });
50
+ }
51
+ catch (e) {
52
+ setError(message(e));
53
+ }
54
+ finally {
55
+ setBusy(undefined);
56
+ }
57
+ };
58
+ return (_jsxs("div", { className: "tiers-setup", children: [_jsx("div", { className: "tiers-options", role: "radiogroup", "aria-label": say("tiersLabel"), children: shown.tiers.map((tier) => {
59
+ const price = perReply(tier.price);
60
+ const goes = creditsGo(shown.credits, tier.price, shown.per);
61
+ const checked = tier.name === now;
62
+ // How much it spends next to the others: a quarter of the bar at least, the dearest full.
63
+ const share = tier.price && top ? Math.max(tier.price / top, 0.04) : 0;
64
+ return (_jsxs("button", { type: "button", role: "radio", "aria-checked": checked, "aria-disabled": !may || undefined, "aria-busy": busy === tier.name || undefined, className: "tiers-option", "data-checked": checked || undefined, onClick: () => void choose(tier), children: [_jsx("span", { className: "tiers-option-mark", "aria-hidden": "true", children: busy === tier.name
65
+ ? _jsx(Spinner, { size: 14 })
66
+ : checked
67
+ ? _jsx(Icon, { name: "check", size: 13 })
68
+ : null }), _jsxs("span", { className: "tiers-option-text", children: [_jsxs("span", { className: "tiers-option-name", children: [tier.title, tier.name === shown.plan
69
+ ? _jsx(Badge, { tone: "primary", children: say("recommended") })
70
+ : null] }), tier.description
71
+ ? _jsx("span", { className: "tiers-option-for", children: tier.description })
72
+ : null, goes ? _jsx("span", { className: "tiers-option-goes", children: goes }) : null] }), _jsxs("span", { className: "tiers-option-price", children: [price
73
+ ? (_jsxs(_Fragment, { children: [_jsx("b", { children: price }), _jsx("small", { children: unitSaid(shown.per) })] }))
74
+ : _jsx("small", { children: say("pricedEach") }), share
75
+ ? (_jsx("span", { className: "tiers-option-meter", "aria-hidden": "true", children: _jsx("span", { style: { inlineSize: `${Math.round(share * 100)}%` } }) }))
76
+ : null] })] }, tier.name));
77
+ }) }), error ? _jsx(Notice, { tone: "destructive", role: "alert", children: error }) : null, may || (given === undefined && !standing)
78
+ ? _jsx(SpendNote, { shown: shown, tier: now })
79
+ : (_jsx(Notice, { tone: "neutral", icon: "lock", children: say("ownersChoose") }))] }));
80
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * A space's agents' models, on its Members tab (spaces' `spaceAgents`).
3
+ *
4
+ * - Above its agents (kind `tiers.space`, item `{ _id }`, the space): the
5
+ * tier new chats here start on, and for its managers a choice of every
6
+ * tier, each with what a typical message comes to, or the org's default
7
+ * again. Anyone still switches a chat's own as they write.
8
+ * - On each agent (kind `tiers.agent`, item `{ _id }`, the agent): its model
9
+ * here, its kind of work and the tier ("Claude Haiku 5.5 · Checks · on
10
+ * Everyday"). Models are the tiers', by kind of work: none is picked here.
11
+ *
12
+ * Both are watched reads, so a change shows at once, wherever it was made.
13
+ */
14
+ import { type ReactNode } from "react";
15
+ import type { ViewContext } from "pairz";
16
+ import type { Shown } from "../../contract.js";
17
+ type Call = <R = unknown>(action: string, input?: unknown) => Promise<R>;
18
+ export declare const tiersSpaceView: (item: {
19
+ _id?: string;
20
+ }, ctx: ViewContext<ReactNode>) => ReactNode;
21
+ /** The space's tier: what new chats here start on, who chose it, and choosing another. */
22
+ export declare function SpaceTier({ shown, space, manage, call }: {
23
+ shown: Shown;
24
+ space: string;
25
+ manage: boolean;
26
+ call: Call;
27
+ }): ReactNode;
28
+ export declare const tiersAgentView: (item: {
29
+ _id?: string;
30
+ }, ctx: ViewContext<ReactNode>) => ReactNode;
31
+ export {};
@@ -0,0 +1,74 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * A space's agents' models, on its Members tab (spaces' `spaceAgents`).
4
+ *
5
+ * - Above its agents (kind `tiers.space`, item `{ _id }`, the space): the
6
+ * tier new chats here start on, and for its managers a choice of every
7
+ * tier, each with what a typical message comes to, or the org's default
8
+ * again. Anyone still switches a chat's own as they write.
9
+ * - On each agent (kind `tiers.agent`, item `{ _id }`, the agent): its model
10
+ * here, its kind of work and the tier ("Claude Haiku 5.5 · Checks · on
11
+ * Everyday"). Models are the tiers', by kind of work: none is picked here.
12
+ *
13
+ * Both are watched reads, so a change shows at once, wherever it was made.
14
+ */
15
+ import { useState } from "react";
16
+ import { Icon, message, Select } from "pairz/web";
17
+ import { STYLE } from "./style.js";
18
+ import { say } from "./say.js";
19
+ import { sayText } from "pairz/web/words";
20
+ import { bySaid, modelSaid, perReply, shownSaid, unitSaid } from "./words.js";
21
+ const style = _jsx("style", { href: "tiers-web", precedence: "pairz", children: STYLE });
22
+ export const tiersSpaceView = (item, ctx) => {
23
+ const space = item._id ?? String(ctx.hints.in ?? "");
24
+ const shown = shownSaid(ctx.db.collection("modelChoice").query("offered", { space }).value);
25
+ if (!shown?.tiers.length)
26
+ return null;
27
+ return (_jsxs(_Fragment, { children: [style, _jsx(SpaceTier, { shown: shown, space: space, manage: ctx.hints.manage === true, call: ctx.call })] }));
28
+ };
29
+ /** The space's tier: what new chats here start on, who chose it, and choosing another. */
30
+ export function SpaceTier({ shown, space, manage, call }) {
31
+ const [busy, setBusy] = useState(false);
32
+ const [error, setError] = useState();
33
+ const title = (name) => shown.tiers.find((t) => t.name === name)?.title;
34
+ const above = shown.org.tier ?? shown.plan ?? shown.tiers[0]?.name;
35
+ const here = shown.space?.tier ?? above;
36
+ const said = shown.space?.tier
37
+ ? say("spaceChosen", { tier: title(above) ?? "" })
38
+ : say("spaceAsOrg");
39
+ const choose = async (tier) => {
40
+ setBusy(true);
41
+ setError(undefined);
42
+ try {
43
+ await call("tiers.choose", { space, tier: tier || null });
44
+ }
45
+ catch (e) {
46
+ setError(message(e));
47
+ }
48
+ finally {
49
+ setBusy(false);
50
+ }
51
+ };
52
+ return (_jsxs("div", { className: "tiers-space", "aria-busy": busy || undefined, children: [_jsx("span", { className: "tiers-space-mark", "aria-hidden": "true", children: _jsx(Icon, { name: "sparkles", size: 16 }) }), _jsxs("div", { className: "tiers-space-text", children: [_jsx("b", { children: say("spaceStartsOn", { tier: title(here) ?? "" }) }), _jsxs("span", { children: [said, " ", say("spaceSwitch"), " ", manage ? "" : say("spaceManagers")] })] }), manage
53
+ ? (_jsxs(Select, { size: "sm", "aria-label": say("spaceSelect"), value: shown.space?.tier ?? "", disabled: busy, onChange: (event) => void choose(event.target.value), children: [_jsx("option", { value: "", children: say("asOrg", { tier: title(above) ?? "" }) }), shown.tiers.map((tier) => {
54
+ const price = perReply(tier.price);
55
+ return (_jsxs("option", { value: tier.name, children: [tier.title, price ? ` · ${price} ${unitSaid(shown.per)}` : ""] }, tier.name));
56
+ })] }))
57
+ : null, error ? _jsx("p", { className: "tiers-space-error", role: "alert", children: error }) : null] }));
58
+ }
59
+ export const tiersAgentView = (item, ctx) => {
60
+ const agent = item._id ?? "";
61
+ const space = String(ctx.hints.in ?? "");
62
+ const now = ctx.db.collection("modelChoice").query("agent", {
63
+ agent,
64
+ ...(space ? { space } : {}),
65
+ }).value;
66
+ // No tier applies (or still reading): nothing to say.
67
+ if (!now)
68
+ return null;
69
+ return (_jsxs(_Fragment, { children: [style, _jsx("span", { className: "tiers-line", title: `${modelSaid(now.model)}, ${bySaid(now.by)}`, children: say.nodes("agentLine", {
70
+ model: _jsx("b", { children: now.model.name }),
71
+ kind: sayText(now.kindTitle),
72
+ tier: sayText(now.tierTitle),
73
+ }) })] }));
74
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Tiers' layout on the web, on the theme's variables: the org's tiers as
3
+ * cards side by side where there's room (the one in use outlined), each
4
+ * agent's model in rows, the line a space's agents get, and the space's own
5
+ * choice above them. Only layout: the pieces are the toolkit's.
6
+ */
7
+ export declare const STYLE = "\n.tiers { container: tiers / inline-size; display: grid; gap: 16px; min-width: 0; }\n.tiers-now { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; }\n.tiers-now p { margin: 0; color: var(--secondary-foreground); font-size: 14.5px; line-height: 1.5; }\n.tiers-now b { color: var(--foreground); font-weight: 650; }\n.tiers-now .pairz-button { flex: none; }\n\n/* The tiers, as cards */\n.tiers-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(214px, 1fr)); gap: 12px; margin: 0; padding: 0;\n list-style: none; }\n.tier-card { display: grid; grid-template-rows: auto auto auto auto 1fr auto; gap: 10px; min-width: 0; padding: 16px 16px 14px;\n transition: border-color .15s, outline-color .15s; }\n.tier-card[data-current] { border-color: var(--ring); outline: 1px solid var(--ring); outline-offset: -2px; }\n.tier-card-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; min-height: 22px; }\n.tier-card h3 { margin: 0; font-family: var(--font-display); font-size: 18px; font-weight: 660; letter-spacing: -.012em; }\n.tier-card-top .pairz-badge { gap: 4px; }\n.tier-card-for { margin: -4px 0 0; color: var(--secondary-foreground); font-size: 13.5px; line-height: 1.45; }\n.tier-card-price { display: flex; align-items: baseline; gap: 6px; margin: 0; color: var(--muted-foreground); font-size: 12.5px; }\n.tier-card-price b { color: var(--foreground); font-family: var(--font-display); font-size: 21px; font-weight: 660;\n letter-spacing: -.015em; font-variant-numeric: tabular-nums; }\n.tier-card-goes { margin: -6px 0 0; color: var(--muted-foreground); font-size: 12.5px; line-height: 1.4; }\n.tier-card-goes:empty { margin-top: -10px; }\n.tier-card-agents { display: grid; align-content: start; gap: 7px; margin: 0; padding: 10px 0 2px; border-top: 1px solid var(--border);\n list-style: none; }\n.tier-card-agents li { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 8px; align-items: baseline; font-size: 13px;\n line-height: 1.35; }\n.tier-who { display: flex; align-items: baseline; gap: 5px; min-width: 0; overflow: hidden; color: var(--muted-foreground);\n white-space: nowrap; text-overflow: ellipsis; }\n.tier-model { display: grid; min-width: 0; color: var(--foreground); font-weight: 560; overflow-wrap: anywhere; }\n.tier-model small { color: var(--muted-foreground); font-size: 12px; font-weight: 450; }\n.tier-card-end { display: grid; margin-top: 2px; }\n.tier-card-using { display: flex; align-items: center; justify-content: center; gap: 6px; height: 36px; margin: 0;\n border-radius: var(--radius-md); background: var(--primary-soft); color: var(--primary-text); font-size: 13.5px; font-weight: 600; }\n\n.tier-card-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }\n.tier-card-badges .pairz-badge { gap: 4px; }\n.tier-model small { display: block; }\n.tier-new { display: grid; min-height: 160px; }\n.tier-new-button { display: grid; place-content: center; justify-items: center; gap: 6px; padding: 18px; border: 1.5px dashed var(--border);\n border-radius: var(--radius-xl); background: transparent; color: var(--muted-foreground); font: inherit; text-align: center;\n cursor: pointer; transition: border-color .12s, color .12s; }\n.tier-new-button:hover, .tier-new-button:focus-visible { border-color: var(--ring); color: var(--foreground); }\n.tier-new-button b { color: var(--foreground); font-size: 15px; font-weight: 650; }\n.tier-new-button span { max-width: 22ch; font-size: 12.5px; line-height: 1.45; }\n.tiers-removed { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: -4px 0 0; color: var(--muted-foreground);\n font-size: 13px; }\n.tiers-cap { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--secondary-foreground); font-size: 13.5px; }\n.tiers-cap > .pairz-select { width: auto; min-width: 160px; }\n.tiers-cap span { color: var(--muted-foreground); font-size: 12.5px; }\n\n/* Customizing a tier */\n.tiers-editor { display: grid; gap: 16px; min-width: 0; }\n.tiers-editor-names { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 12px; }\n.tiers-editor-error { margin-inline-end: auto; align-self: center; color: var(--destructive-text, var(--destructive)); font-size: 13px; }\n.tiers-kinds { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }\n.tiers-kind { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); }\n.tiers-kind-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }\n.tiers-kind-head b { font-size: 14.5px; font-weight: 650; }\n.tiers-kind-head span { color: var(--muted-foreground); font-size: 12.5px; }\n.tiers-chain { display: grid; gap: 6px; min-width: 0; }\n.tiers-kind-new { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 10px; padding: 12px 14px;\n border: 1px dashed var(--border); border-radius: var(--radius-lg); }\n.tiers-kind-new-end { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 6px; }\n@container tiers (max-width: 520px) {\n .tiers-editor-names, .tiers-kind-new { grid-template-columns: minmax(0, 1fr); }\n}\n\n/* Beside the send button */\n.tiers-pick { display: inline-flex; flex: 0 1 auto; min-width: 0; max-width: 100%; }\n.tiers-pick .pairz-button { min-width: 0; max-width: 100%; color: var(--muted-foreground); font-weight: 550; }\n.tiers-pick .pairz-button > svg, .tiers-pick .pairz-button > .pairz-icon { flex: none; }\n/* Never wider than the row leaves it: the name shortens with an ellipsis, the send button stays. */\n.tiers-pick-text { display: flex; min-width: 0; overflow: hidden; }\n.tiers-pick-name, .tiers-pick-price { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.tiers-pick-name { flex: 0 1 auto; min-width: 2ch; }\n.tiers-pick-price { flex: 0 100 auto; min-width: 0; }\n/* A narrow composer (a phone, a side panel), by its own width (chat's `chat-box` container): the name only. */\n@container chat-box (max-width: 520px) {\n .tiers-pick-price { display: none; }\n}\n.tiers-remove-said { margin: 0; color: var(--secondary-foreground); font-size: 14px; line-height: 1.5; }\n.tiers-row-kind { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: var(--radius-full);\n background: var(--muted); color: var(--secondary-foreground); font-size: 11.5px; font-weight: 600; }\n\n/* Each agent's model */\n.tiers-agents { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 16px 18px 8px; }\n.tiers-agents-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 12px; }\n.tiers-agents-head h3 { margin: 0; font-size: 15px; font-weight: 650; }\n.tiers-agents-head p { margin: 3px 0 0; color: var(--muted-foreground); font-size: 13px; line-height: 1.45; }\n.tiers-agents-actions { display: flex; flex-wrap: wrap; gap: 6px; }\n.tiers-rows { display: grid; margin: 6px 0 0; padding: 0; list-style: none; }\n.tiers-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 11px 0; }\n.tiers-row + .tiers-row { border-top: 1px solid var(--border); }\n.tiers-row-text { display: grid; gap: 2px; min-width: 0; }\n.tiers-row-name { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin: 0; font-size: 14px; font-weight: 620; }\n.tiers-row-handle { color: var(--muted-foreground); font-family: var(--font-mono); font-size: 12px; font-weight: 450; }\n.tiers-row-about { margin: 0; overflow: hidden; color: var(--muted-foreground); font-size: 13px; line-height: 1.45;\n text-overflow: ellipsis; white-space: nowrap; }\n.tiers-row-end { display: flex; align-items: center; gap: 6px; }\n.tiers-off { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin: 4px 0 8px; padding-top: 12px; border-top: 1px solid var(--border); }\n.tiers-off h4 { margin: 0; color: var(--muted-foreground); font-size: 12px; font-weight: 650; letter-spacing: .05em;\n text-transform: uppercase; }\n.tiers-off-row { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--secondary-foreground); font-size: 13.5px; }\n.tiers-off-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.tiers-row-model { margin: 0; color: var(--secondary-foreground); font-size: 13px; line-height: 1.45; }\n.tiers-row-model b { color: var(--foreground); font-weight: 600; }\n.tiers-row-from[data-picked] { color: var(--primary-text); }\n.tiers-row-price { color: var(--muted-foreground); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }\n.tiers-row[data-editing] { grid-template-columns: 32px minmax(0, 1fr) auto; align-items: start; }\n.tiers-row[data-editing] > .pairz-avatar { margin-top: 2px; }\n.tiers-row-pick { display: grid; gap: 6px; min-width: 0; }\n.tiers-row-under { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; color: var(--muted-foreground); font-size: 12.5px; }\n.tiers-back { height: auto; padding: 0; font-size: 12.5px; }\n.tiers-row-then { margin: 1px 0 0; color: var(--muted-foreground); font-size: 12.5px; line-height: 1.45; }\n.tiers-fallbacks { display: grid; gap: 4px; margin-top: 6px; padding: 8px 10px; border: 1px dashed var(--border);\n border-radius: var(--radius-md); }\n.tiers-fallbacks-head { margin: 0; color: var(--secondary-foreground); font-size: 12.5px; font-weight: 600; }\n.tiers-fallbacks-head span { color: var(--muted-foreground); font-weight: 450; }\n.tiers-fallbacks-list { display: grid; gap: 2px; margin: 0; padding: 0 0 0 18px; font-size: 13px; }\n.tiers-fallbacks-list li { padding-left: 2px; }\n.tiers-fallback-name { display: inline-flex; align-items: baseline; gap: 6px; min-width: 0; margin-right: 4px; }\n.tiers-fallback-name b { font-weight: 600; }\n.tiers-fallback-name small { color: var(--muted-foreground); font-size: 12px; }\n.tiers-fallbacks-none { margin: 0; color: var(--muted-foreground); font-size: 12.5px; }\n\n.tiers-foot { display: flex; align-items: flex-start; gap: 7px; margin: 0 2px; color: var(--muted-foreground); font-size: 12.5px; line-height: 1.5; }\n.tiers-foot .pairz-icon { flex: none; margin-top: 2px; }\n.tiers-foot a { color: var(--primary-text); text-underline-offset: 3px; }\n\n/* Choosing a tier when the org is new: one choice, a row each */\n.tiers-setup { container: tiers-setup / inline-size; display: grid; gap: 12px; min-width: 0; }\n.tiers-options { display: grid; gap: 8px; }\n.tiers-option { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: start; gap: 12px; width: 100%;\n padding: 13px 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card);\n color: inherit; font: inherit; text-align: left; cursor: pointer; transition: border-color .12s, background-color .12s; }\n.tiers-option:hover { border-color: var(--ring); }\n.tiers-option:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }\n.tiers-option[data-checked] { border-color: var(--ring); outline: 1px solid var(--ring); outline-offset: -2px;\n background: color-mix(in oklab, var(--primary-soft) 40%, var(--card)); }\n.tiers-option[aria-disabled] { cursor: default; }\n.tiers-option-mark { display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; border: 1.5px solid var(--input);\n border-radius: var(--radius-full); color: var(--primary-foreground); }\n.tiers-option[data-checked] .tiers-option-mark { border-color: var(--primary); background: var(--primary); }\n.tiers-option[aria-busy] .tiers-option-mark { border-color: transparent; color: var(--primary-text); }\n.tiers-option-text { display: grid; gap: 3px; min-width: 0; }\n.tiers-option-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-family: var(--font-display);\n font-size: 15.5px; font-weight: 650; letter-spacing: -.01em; }\n.tiers-option-for { color: var(--secondary-foreground); font-size: 13.5px; line-height: 1.45; }\n.tiers-option-goes { color: var(--muted-foreground); font-size: 12.5px; line-height: 1.45; }\n.tiers-option-price { display: grid; justify-items: end; gap: 1px; min-width: 76px; color: var(--muted-foreground); font-size: 12px;\n white-space: nowrap; }\n.tiers-option-price b { color: var(--foreground); font-family: var(--font-display); font-size: 19px; font-weight: 660;\n letter-spacing: -.015em; font-variant-numeric: tabular-nums; }\n.tiers-option-meter { display: block; width: 64px; height: 4px; margin-top: 6px; border-radius: var(--radius-full);\n background: var(--muted); overflow: hidden; }\n.tiers-option-meter > span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }\n@container tiers-setup (max-width: 420px) {\n .tiers-option { grid-template-columns: 22px minmax(0, 1fr); }\n .tiers-option-price { grid-column: 2; justify-items: start; }\n}\n\n/* A space's agents: its choice, and each one's line */\n.tiers-space { container: tiers-space / inline-size; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;\n padding: 12px 12px 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); }\n.tiers-space-mark { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-md);\n background: var(--primary-soft); color: var(--primary-text); }\n.tiers-space-text { flex: 1 1 200px; display: grid; gap: 1px; min-width: 0; }\n.tiers-space-text b { font-size: 14px; font-weight: 620; }\n.tiers-space-text span { color: var(--muted-foreground); font-size: 12.5px; line-height: 1.45; }\n.tiers-space > .pairz-select { flex: 1 1 210px; max-width: 280px; }\n.tiers-space-error { flex-basis: 100%; margin: 0; color: var(--destructive-text, var(--destructive)); font-size: 12.5px; }\n.tiers-line { min-width: 0; color: var(--muted-foreground); font-size: 12.5px; line-height: 1.45; }\n.tiers-line b { color: var(--secondary-foreground); font-weight: 600; }\n.tiers-line[data-picked] .tiers-line-from { color: var(--primary-text); }\n\n@container tiers-space (max-width: 480px) {\n .tiers-space > .pairz-select { flex-basis: 100%; max-width: none; }\n}\n@container tiers (max-width: 520px) {\n .tiers-agents { padding: 14px 14px 6px; }\n .tiers-row { grid-template-columns: 32px minmax(0, 1fr); align-items: start; }\n .tiers-row > .pairz-avatar { margin-top: 2px; }\n .tiers-row-price { grid-column: 2; }\n}\n";
@@ -0,0 +1,191 @@
1
+ /**
2
+ * Tiers' layout on the web, on the theme's variables: the org's tiers as
3
+ * cards side by side where there's room (the one in use outlined), each
4
+ * agent's model in rows, the line a space's agents get, and the space's own
5
+ * choice above them. Only layout: the pieces are the toolkit's.
6
+ */
7
+ export const STYLE = `
8
+ .tiers { container: tiers / inline-size; display: grid; gap: 16px; min-width: 0; }
9
+ .tiers-now { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; }
10
+ .tiers-now p { margin: 0; color: var(--secondary-foreground); font-size: 14.5px; line-height: 1.5; }
11
+ .tiers-now b { color: var(--foreground); font-weight: 650; }
12
+ .tiers-now .pairz-button { flex: none; }
13
+
14
+ /* The tiers, as cards */
15
+ .tiers-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(214px, 1fr)); gap: 12px; margin: 0; padding: 0;
16
+ list-style: none; }
17
+ .tier-card { display: grid; grid-template-rows: auto auto auto auto 1fr auto; gap: 10px; min-width: 0; padding: 16px 16px 14px;
18
+ transition: border-color .15s, outline-color .15s; }
19
+ .tier-card[data-current] { border-color: var(--ring); outline: 1px solid var(--ring); outline-offset: -2px; }
20
+ .tier-card-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; min-height: 22px; }
21
+ .tier-card h3 { margin: 0; font-family: var(--font-display); font-size: 18px; font-weight: 660; letter-spacing: -.012em; }
22
+ .tier-card-top .pairz-badge { gap: 4px; }
23
+ .tier-card-for { margin: -4px 0 0; color: var(--secondary-foreground); font-size: 13.5px; line-height: 1.45; }
24
+ .tier-card-price { display: flex; align-items: baseline; gap: 6px; margin: 0; color: var(--muted-foreground); font-size: 12.5px; }
25
+ .tier-card-price b { color: var(--foreground); font-family: var(--font-display); font-size: 21px; font-weight: 660;
26
+ letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
27
+ .tier-card-goes { margin: -6px 0 0; color: var(--muted-foreground); font-size: 12.5px; line-height: 1.4; }
28
+ .tier-card-goes:empty { margin-top: -10px; }
29
+ .tier-card-agents { display: grid; align-content: start; gap: 7px; margin: 0; padding: 10px 0 2px; border-top: 1px solid var(--border);
30
+ list-style: none; }
31
+ .tier-card-agents li { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 8px; align-items: baseline; font-size: 13px;
32
+ line-height: 1.35; }
33
+ .tier-who { display: flex; align-items: baseline; gap: 5px; min-width: 0; overflow: hidden; color: var(--muted-foreground);
34
+ white-space: nowrap; text-overflow: ellipsis; }
35
+ .tier-model { display: grid; min-width: 0; color: var(--foreground); font-weight: 560; overflow-wrap: anywhere; }
36
+ .tier-model small { color: var(--muted-foreground); font-size: 12px; font-weight: 450; }
37
+ .tier-card-end { display: grid; margin-top: 2px; }
38
+ .tier-card-using { display: flex; align-items: center; justify-content: center; gap: 6px; height: 36px; margin: 0;
39
+ border-radius: var(--radius-md); background: var(--primary-soft); color: var(--primary-text); font-size: 13.5px; font-weight: 600; }
40
+
41
+ .tier-card-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
42
+ .tier-card-badges .pairz-badge { gap: 4px; }
43
+ .tier-model small { display: block; }
44
+ .tier-new { display: grid; min-height: 160px; }
45
+ .tier-new-button { display: grid; place-content: center; justify-items: center; gap: 6px; padding: 18px; border: 1.5px dashed var(--border);
46
+ border-radius: var(--radius-xl); background: transparent; color: var(--muted-foreground); font: inherit; text-align: center;
47
+ cursor: pointer; transition: border-color .12s, color .12s; }
48
+ .tier-new-button:hover, .tier-new-button:focus-visible { border-color: var(--ring); color: var(--foreground); }
49
+ .tier-new-button b { color: var(--foreground); font-size: 15px; font-weight: 650; }
50
+ .tier-new-button span { max-width: 22ch; font-size: 12.5px; line-height: 1.45; }
51
+ .tiers-removed { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: -4px 0 0; color: var(--muted-foreground);
52
+ font-size: 13px; }
53
+ .tiers-cap { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--secondary-foreground); font-size: 13.5px; }
54
+ .tiers-cap > .pairz-select { width: auto; min-width: 160px; }
55
+ .tiers-cap span { color: var(--muted-foreground); font-size: 12.5px; }
56
+
57
+ /* Customizing a tier */
58
+ .tiers-editor { display: grid; gap: 16px; min-width: 0; }
59
+ .tiers-editor-names { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 12px; }
60
+ .tiers-editor-error { margin-inline-end: auto; align-self: center; color: var(--destructive-text, var(--destructive)); font-size: 13px; }
61
+ .tiers-kinds { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
62
+ .tiers-kind { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); }
63
+ .tiers-kind-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
64
+ .tiers-kind-head b { font-size: 14.5px; font-weight: 650; }
65
+ .tiers-kind-head span { color: var(--muted-foreground); font-size: 12.5px; }
66
+ .tiers-chain { display: grid; gap: 6px; min-width: 0; }
67
+ .tiers-kind-new { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 10px; padding: 12px 14px;
68
+ border: 1px dashed var(--border); border-radius: var(--radius-lg); }
69
+ .tiers-kind-new-end { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 6px; }
70
+ @container tiers (max-width: 520px) {
71
+ .tiers-editor-names, .tiers-kind-new { grid-template-columns: minmax(0, 1fr); }
72
+ }
73
+
74
+ /* Beside the send button */
75
+ .tiers-pick { display: inline-flex; flex: 0 1 auto; min-width: 0; max-width: 100%; }
76
+ .tiers-pick .pairz-button { min-width: 0; max-width: 100%; color: var(--muted-foreground); font-weight: 550; }
77
+ .tiers-pick .pairz-button > svg, .tiers-pick .pairz-button > .pairz-icon { flex: none; }
78
+ /* Never wider than the row leaves it: the name shortens with an ellipsis, the send button stays. */
79
+ .tiers-pick-text { display: flex; min-width: 0; overflow: hidden; }
80
+ .tiers-pick-name, .tiers-pick-price { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
81
+ .tiers-pick-name { flex: 0 1 auto; min-width: 2ch; }
82
+ .tiers-pick-price { flex: 0 100 auto; min-width: 0; }
83
+ /* A narrow composer (a phone, a side panel), by its own width (chat's \`chat-box\` container): the name only. */
84
+ @container chat-box (max-width: 520px) {
85
+ .tiers-pick-price { display: none; }
86
+ }
87
+ .tiers-remove-said { margin: 0; color: var(--secondary-foreground); font-size: 14px; line-height: 1.5; }
88
+ .tiers-row-kind { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: var(--radius-full);
89
+ background: var(--muted); color: var(--secondary-foreground); font-size: 11.5px; font-weight: 600; }
90
+
91
+ /* Each agent's model */
92
+ .tiers-agents { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 16px 18px 8px; }
93
+ .tiers-agents-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 12px; }
94
+ .tiers-agents-head h3 { margin: 0; font-size: 15px; font-weight: 650; }
95
+ .tiers-agents-head p { margin: 3px 0 0; color: var(--muted-foreground); font-size: 13px; line-height: 1.45; }
96
+ .tiers-agents-actions { display: flex; flex-wrap: wrap; gap: 6px; }
97
+ .tiers-rows { display: grid; margin: 6px 0 0; padding: 0; list-style: none; }
98
+ .tiers-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 11px 0; }
99
+ .tiers-row + .tiers-row { border-top: 1px solid var(--border); }
100
+ .tiers-row-text { display: grid; gap: 2px; min-width: 0; }
101
+ .tiers-row-name { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin: 0; font-size: 14px; font-weight: 620; }
102
+ .tiers-row-handle { color: var(--muted-foreground); font-family: var(--font-mono); font-size: 12px; font-weight: 450; }
103
+ .tiers-row-about { margin: 0; overflow: hidden; color: var(--muted-foreground); font-size: 13px; line-height: 1.45;
104
+ text-overflow: ellipsis; white-space: nowrap; }
105
+ .tiers-row-end { display: flex; align-items: center; gap: 6px; }
106
+ .tiers-off { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin: 4px 0 8px; padding-top: 12px; border-top: 1px solid var(--border); }
107
+ .tiers-off h4 { margin: 0; color: var(--muted-foreground); font-size: 12px; font-weight: 650; letter-spacing: .05em;
108
+ text-transform: uppercase; }
109
+ .tiers-off-row { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--secondary-foreground); font-size: 13.5px; }
110
+ .tiers-off-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
111
+ .tiers-row-model { margin: 0; color: var(--secondary-foreground); font-size: 13px; line-height: 1.45; }
112
+ .tiers-row-model b { color: var(--foreground); font-weight: 600; }
113
+ .tiers-row-from[data-picked] { color: var(--primary-text); }
114
+ .tiers-row-price { color: var(--muted-foreground); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
115
+ .tiers-row[data-editing] { grid-template-columns: 32px minmax(0, 1fr) auto; align-items: start; }
116
+ .tiers-row[data-editing] > .pairz-avatar { margin-top: 2px; }
117
+ .tiers-row-pick { display: grid; gap: 6px; min-width: 0; }
118
+ .tiers-row-under { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; color: var(--muted-foreground); font-size: 12.5px; }
119
+ .tiers-back { height: auto; padding: 0; font-size: 12.5px; }
120
+ .tiers-row-then { margin: 1px 0 0; color: var(--muted-foreground); font-size: 12.5px; line-height: 1.45; }
121
+ .tiers-fallbacks { display: grid; gap: 4px; margin-top: 6px; padding: 8px 10px; border: 1px dashed var(--border);
122
+ border-radius: var(--radius-md); }
123
+ .tiers-fallbacks-head { margin: 0; color: var(--secondary-foreground); font-size: 12.5px; font-weight: 600; }
124
+ .tiers-fallbacks-head span { color: var(--muted-foreground); font-weight: 450; }
125
+ .tiers-fallbacks-list { display: grid; gap: 2px; margin: 0; padding: 0 0 0 18px; font-size: 13px; }
126
+ .tiers-fallbacks-list li { padding-left: 2px; }
127
+ .tiers-fallback-name { display: inline-flex; align-items: baseline; gap: 6px; min-width: 0; margin-right: 4px; }
128
+ .tiers-fallback-name b { font-weight: 600; }
129
+ .tiers-fallback-name small { color: var(--muted-foreground); font-size: 12px; }
130
+ .tiers-fallbacks-none { margin: 0; color: var(--muted-foreground); font-size: 12.5px; }
131
+
132
+ .tiers-foot { display: flex; align-items: flex-start; gap: 7px; margin: 0 2px; color: var(--muted-foreground); font-size: 12.5px; line-height: 1.5; }
133
+ .tiers-foot .pairz-icon { flex: none; margin-top: 2px; }
134
+ .tiers-foot a { color: var(--primary-text); text-underline-offset: 3px; }
135
+
136
+ /* Choosing a tier when the org is new: one choice, a row each */
137
+ .tiers-setup { container: tiers-setup / inline-size; display: grid; gap: 12px; min-width: 0; }
138
+ .tiers-options { display: grid; gap: 8px; }
139
+ .tiers-option { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: start; gap: 12px; width: 100%;
140
+ padding: 13px 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card);
141
+ color: inherit; font: inherit; text-align: left; cursor: pointer; transition: border-color .12s, background-color .12s; }
142
+ .tiers-option:hover { border-color: var(--ring); }
143
+ .tiers-option:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
144
+ .tiers-option[data-checked] { border-color: var(--ring); outline: 1px solid var(--ring); outline-offset: -2px;
145
+ background: color-mix(in oklab, var(--primary-soft) 40%, var(--card)); }
146
+ .tiers-option[aria-disabled] { cursor: default; }
147
+ .tiers-option-mark { display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; border: 1.5px solid var(--input);
148
+ border-radius: var(--radius-full); color: var(--primary-foreground); }
149
+ .tiers-option[data-checked] .tiers-option-mark { border-color: var(--primary); background: var(--primary); }
150
+ .tiers-option[aria-busy] .tiers-option-mark { border-color: transparent; color: var(--primary-text); }
151
+ .tiers-option-text { display: grid; gap: 3px; min-width: 0; }
152
+ .tiers-option-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-family: var(--font-display);
153
+ font-size: 15.5px; font-weight: 650; letter-spacing: -.01em; }
154
+ .tiers-option-for { color: var(--secondary-foreground); font-size: 13.5px; line-height: 1.45; }
155
+ .tiers-option-goes { color: var(--muted-foreground); font-size: 12.5px; line-height: 1.45; }
156
+ .tiers-option-price { display: grid; justify-items: end; gap: 1px; min-width: 76px; color: var(--muted-foreground); font-size: 12px;
157
+ white-space: nowrap; }
158
+ .tiers-option-price b { color: var(--foreground); font-family: var(--font-display); font-size: 19px; font-weight: 660;
159
+ letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
160
+ .tiers-option-meter { display: block; width: 64px; height: 4px; margin-top: 6px; border-radius: var(--radius-full);
161
+ background: var(--muted); overflow: hidden; }
162
+ .tiers-option-meter > span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
163
+ @container tiers-setup (max-width: 420px) {
164
+ .tiers-option { grid-template-columns: 22px minmax(0, 1fr); }
165
+ .tiers-option-price { grid-column: 2; justify-items: start; }
166
+ }
167
+
168
+ /* A space's agents: its choice, and each one's line */
169
+ .tiers-space { container: tiers-space / inline-size; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
170
+ padding: 12px 12px 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); }
171
+ .tiers-space-mark { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-md);
172
+ background: var(--primary-soft); color: var(--primary-text); }
173
+ .tiers-space-text { flex: 1 1 200px; display: grid; gap: 1px; min-width: 0; }
174
+ .tiers-space-text b { font-size: 14px; font-weight: 620; }
175
+ .tiers-space-text span { color: var(--muted-foreground); font-size: 12.5px; line-height: 1.45; }
176
+ .tiers-space > .pairz-select { flex: 1 1 210px; max-width: 280px; }
177
+ .tiers-space-error { flex-basis: 100%; margin: 0; color: var(--destructive-text, var(--destructive)); font-size: 12.5px; }
178
+ .tiers-line { min-width: 0; color: var(--muted-foreground); font-size: 12.5px; line-height: 1.45; }
179
+ .tiers-line b { color: var(--secondary-foreground); font-weight: 600; }
180
+ .tiers-line[data-picked] .tiers-line-from { color: var(--primary-text); }
181
+
182
+ @container tiers-space (max-width: 480px) {
183
+ .tiers-space > .pairz-select { flex-basis: 100%; max-width: none; }
184
+ }
185
+ @container tiers (max-width: 520px) {
186
+ .tiers-agents { padding: 14px 14px 6px; }
187
+ .tiers-row { grid-template-columns: 32px minmax(0, 1fr); align-items: start; }
188
+ .tiers-row > .pairz-avatar { margin-top: 2px; }
189
+ .tiers-row-price { grid-column: 2; }
190
+ }
191
+ `;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * The org's team, on its page's Agents section (under the tiers): the agents
3
+ * every space in the org starts with, each with its kind of work and the
4
+ * model that gives it on the org's default tier. The app's agents as the org
5
+ * has them (as they are, or changed: "Changed"), then those the org made
6
+ * ("Your org's"). Owners and admins add one (team's `agent.org`, in a
7
+ * dialog), edit one (its page, `?edit=1`), take one off the team
8
+ * (`agent.delete`, after a question: it leaves every space) and put one of
9
+ * the app's back (`agent.restore`) or back as the app has it
10
+ * (`agent.reset`). Anyone else reads it. Models are the tiers', set by kind
11
+ * of work above it, never per agent.
12
+ */
13
+ import { type ReactNode } from "react";
14
+ import type { Shown } from "../../contract.js";
15
+ type Call = <R = unknown>(action: string, input?: unknown) => Promise<R>;
16
+ /** An agent of the org's team, as team's `agent.team` query answers. */
17
+ export type TeamAgent = {
18
+ id: string;
19
+ name: string;
20
+ icon?: string;
21
+ description?: string;
22
+ kind: "app" | "changed" | "org";
23
+ off?: true;
24
+ like?: string;
25
+ model?: string;
26
+ };
27
+ /** The kind of work an agent of the team does: its own, what it works like, else the first. */
28
+ export declare function kindFor(shown: Shown, agent: Pick<TeamAgent, "id" | "like">): string | undefined;
29
+ export declare function Team({ shown, team, may, org, tier, call }: {
30
+ shown: Shown;
31
+ team?: TeamAgent[];
32
+ may: boolean;
33
+ org?: string;
34
+ /** The org's default tier: what each agent's model is shown on. */
35
+ tier: string;
36
+ call: Call;
37
+ }): ReactNode;
38
+ export {};