@copilotz/team 0.0.0-stage → 1.0.0-rc.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +49 -2
- package/WORDS.md +200 -0
- package/contract.d.ts +8 -0
- package/contract.js +8 -0
- package/mod.d.ts +25 -0
- package/mod.js +25 -0
- package/package.json +63 -4
- package/team/actions/agent.d.ts +4 -0
- package/team/actions/agent.js +179 -0
- package/team/actions/define.d.ts +1 -0
- package/team/actions/define.js +27 -0
- package/team/collections/agent.d.ts +132 -0
- package/team/collections/agent.js +75 -0
- package/team/contract.d.ts +10 -0
- package/team/contract.js +1 -0
- package/team/mod.d.ts +21 -0
- package/team/mod.js +49 -0
- package/team/shared/definition.d.ts +3 -0
- package/team/shared/definition.js +10 -0
- package/team/views/web/agent-add.d.ts +14 -0
- package/team/views/web/agent-add.js +48 -0
- package/team/views/web/agent-fields.d.ts +33 -0
- package/team/views/web/agent-fields.js +88 -0
- package/team/views/web/agent-known.d.ts +22 -0
- package/team/views/web/agent-known.js +61 -0
- package/team/views/web/agent-new.d.ts +24 -0
- package/team/views/web/agent-new.js +129 -0
- package/team/views/web/agent-palette.d.ts +19 -0
- package/team/views/web/agent-palette.js +203 -0
- package/team/views/web/agent-steps.d.ts +23 -0
- package/team/views/web/agent-steps.js +56 -0
- package/team/views/web/agent.d.ts +17 -0
- package/team/views/web/agent.js +257 -0
- package/team/views/web/agents.d.ts +48 -0
- package/team/views/web/agents.js +59 -0
- package/team/views/web/model-pick.d.ts +25 -0
- package/team/views/web/model-pick.js +39 -0
- package/team/views/web/model-picker.d.ts +57 -0
- package/team/views/web/model-picker.js +218 -0
- package/team/views/web/places.d.ts +24 -0
- package/team/views/web/places.js +10 -0
- package/team/views/web/style.d.ts +9 -0
- package/team/views/web/style.js +246 -0
- package/team/views/web/words.d.ts +5 -0
- package/team/views/web/words.js +211 -0
- package/team/web.d.ts +22 -0
- package/team/web.js +41 -0
- package/tiers/actions/choose.d.ts +2 -0
- package/tiers/actions/choose.js +98 -0
- package/tiers/actions/model.d.ts +1 -0
- package/tiers/actions/model.js +36 -0
- package/tiers/collections/choice.d.ts +48 -0
- package/tiers/collections/choice.js +59 -0
- package/tiers/contract.d.ts +19 -0
- package/tiers/contract.js +1 -0
- package/tiers/mod.d.ts +54 -0
- package/tiers/mod.js +92 -0
- package/tiers/shared/shown.d.ts +87 -0
- package/tiers/shared/shown.js +155 -0
- package/tiers/shared/tiers.d.ts +103 -0
- package/tiers/shared/tiers.js +129 -0
- package/tiers/views/web/org.d.ts +38 -0
- package/tiers/views/web/org.js +142 -0
- package/tiers/views/web/space.d.ts +43 -0
- package/tiers/views/web/space.js +103 -0
- package/tiers/views/web/style.d.ts +7 -0
- package/tiers/views/web/style.js +87 -0
- package/tiers/views/web/words.d.ts +21 -0
- package/tiers/views/web/words.js +49 -0
- package/tiers/web.d.ts +18 -0
- package/tiers/web.js +40 -0
- package/web.d.ts +14 -0
- package/web.js +14 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* The org's agents' models (kind `tiers.org`, a section of the org's page,
|
|
4
|
+
* the web shell's `orgSettings`, at `/org?tab=models`). It opens with what's
|
|
5
|
+
* in use and who chose it, then the tiers as cards, side by side: each its
|
|
6
|
+
* name, what it's good for, what a typical reply comes to at this org's
|
|
7
|
+
* prices, and each agent's model; the one in use outlined and marked with
|
|
8
|
+
* where it comes from ("Your plan's default", "Chosen by your org"). Owners
|
|
9
|
+
* and admins move to another in one click, with Undo right after; anyone else
|
|
10
|
+
* reads it, and is told who changes it. Under the cards, each agent's model
|
|
11
|
+
* now, and Customize: a model per agent, with the picker an agent's model is
|
|
12
|
+
* chosen with (team's `model.pick`), the tier's list kept behind it, and the
|
|
13
|
+
* way back to the tier, for one agent or all. What's shown is a watched read
|
|
14
|
+
* (`modelChoice.offered`), so a change shows at once, wherever it was made.
|
|
15
|
+
*/
|
|
16
|
+
import { useEffect, useState } from "react";
|
|
17
|
+
import { Avatar, Badge, Button, Card, EmptyState, Icon, LazyView, message, Notice, Skeleton, } from "copilotz/web";
|
|
18
|
+
import { runs } from "copilotz/plugins/interfaces/contract";
|
|
19
|
+
import { STYLE } from "./style.js";
|
|
20
|
+
import { chosenSaid, effortSaid, orgFromSaid, perReply } from "./words.js";
|
|
21
|
+
/** How long "Undo" stays after a change. */
|
|
22
|
+
const UNDO_MS = 12_000;
|
|
23
|
+
export const tiersOrgView = (_, ctx) => {
|
|
24
|
+
const shown = ctx.db.collection("modelChoice").query("offered", {}).value;
|
|
25
|
+
const may = runs({
|
|
26
|
+
role: ctx.hints.role ?? null,
|
|
27
|
+
staff: ctx.hints.staff === true,
|
|
28
|
+
});
|
|
29
|
+
const org = ctx.hints.org;
|
|
30
|
+
return (_jsxs(_Fragment, { children: [_jsx("style", { href: "tiers-web", precedence: "copilotz", children: STYLE }), shown ? _jsx(OrgModels, { shown: shown, may: may, org: org?.name, call: ctx.call }) : _jsx(Loading, {})] }));
|
|
31
|
+
};
|
|
32
|
+
function Loading() {
|
|
33
|
+
return (_jsxs("div", { className: "tiers", "aria-busy": "true", children: [_jsx(Skeleton, { height: 22, width: "55%" }), _jsx("div", { className: "tiers-cards", children: [0, 1, 2, 3].map((n) => _jsx(Skeleton, { height: 300, radius: "xl" }, n)) }), _jsx(Skeleton, { height: 220, radius: "xl" })] }));
|
|
34
|
+
}
|
|
35
|
+
export function OrgModels({ shown, may, org, call }) {
|
|
36
|
+
const [busy, setBusy] = useState();
|
|
37
|
+
const [error, setError] = useState();
|
|
38
|
+
const [done, setDone] = useState();
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (!done)
|
|
41
|
+
return;
|
|
42
|
+
const timer = setTimeout(() => setDone(undefined), UNDO_MS);
|
|
43
|
+
return () => clearTimeout(timer);
|
|
44
|
+
}, [done]);
|
|
45
|
+
if (!shown.tiers.length) {
|
|
46
|
+
return (_jsx(EmptyState, { icon: "bot", title: "No tiers to choose from", children: "This app's agents each think with the model it gives them." }));
|
|
47
|
+
}
|
|
48
|
+
const now = shown.now.tier;
|
|
49
|
+
const title = (name) => shown.tiers.find((t) => t.name === name)?.title;
|
|
50
|
+
const choose = async (tier, undoing = false) => {
|
|
51
|
+
setBusy(tier ?? "plan");
|
|
52
|
+
setError(undefined);
|
|
53
|
+
try {
|
|
54
|
+
const before = shown.org.tier;
|
|
55
|
+
await call("tiers.choose", { tier });
|
|
56
|
+
const to = tier ? title(tier) : title(shown.plan);
|
|
57
|
+
setDone(undoing ? undefined : {
|
|
58
|
+
said: to
|
|
59
|
+
? `Your agents use ${to} from their next reply.`
|
|
60
|
+
: "Your agents use their own models from their next reply.",
|
|
61
|
+
tier: before,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
setError(message(e));
|
|
66
|
+
}
|
|
67
|
+
finally {
|
|
68
|
+
setBusy(undefined);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
return (_jsxs("div", { className: "tiers", children: [_jsxs("div", { className: "tiers-now", children: [_jsxs("p", { children: [now
|
|
72
|
+
? (_jsxs(_Fragment, { children: ["Your agents use ", _jsx("b", { children: title(now.name) }), now.by === "plan" ? ", your plan's default." : ", chosen by your org."] }))
|
|
73
|
+
: "Your agents each use their own model.", " Spaces can choose their own."] }), may && now?.by === "org" && shown.plan
|
|
74
|
+
? (_jsx(Button, { size: "sm", variant: "ghost", loading: busy === "plan", disabled: !!busy, onClick: () => void choose(null), children: "Back to your plan's default" }))
|
|
75
|
+
: null] }), done
|
|
76
|
+
? (_jsx(Notice, { tone: "success", role: "status", action: _jsx(Button, { size: "sm", onClick: () => void choose(done.tier, true), disabled: !!busy, children: "Undo" }), children: done.said }))
|
|
77
|
+
: null, error ? _jsx(Notice, { tone: "destructive", role: "alert", children: error }) : null, may ? null : (_jsxs(Notice, { tone: "neutral", icon: "lock", children: ["Only ", org ? `${org}'s` : "the org's", " ", "owners and admins change these. A space's managers choose for their space."] })), _jsx("ul", { className: "tiers-cards", "aria-label": "Tiers", children: shown.tiers.map((tier) => (_jsx(TierCard, { tier: tier, current: now?.name === tier.name ? now.by : undefined, plan: shown.plan === tier.name, may: may, busy: busy, agents: shown.agents, onChoose: () => void choose(tier.name) }, tier.name))) }), _jsx(EachAgent, { shown: shown, may: may, call: call }), _jsxs("p", { className: "tiers-foot", children: [_jsx(Icon, { name: "info", size: 14 }), _jsxs("span", { children: ["A typical reply here: about 20,000 tokens read, most of them from the cache, and 1,000 written, at your org's prices. Real replies vary. What agents spend stays within your", " ", _jsx("a", { href: "/org?tab=billing", children: "budget" }), "."] })] })] }));
|
|
78
|
+
}
|
|
79
|
+
/** A tier: what it's for, what a reply comes to, each agent's model, and choosing it. */
|
|
80
|
+
export function TierCard({ tier, current, plan, may, busy, agents, onChoose }) {
|
|
81
|
+
const price = perReply(tier.price);
|
|
82
|
+
const named = (agent) => agents.find((a) => a.agent === agent);
|
|
83
|
+
return (_jsxs(Card, { as: "li", className: "tier-card", "data-current": current ? true : undefined, "aria-current": current ? "true" : undefined, "aria-labelledby": `tier-${tier.name}`, children: [_jsxs("div", { className: "tier-card-top", children: [_jsx("h3", { id: `tier-${tier.name}`, children: tier.title }), current
|
|
84
|
+
? (_jsxs(Badge, { tone: "primary", children: [_jsx(Icon, { name: "check", size: 12 }), chosenSaid(current)] }))
|
|
85
|
+
: plan
|
|
86
|
+
? _jsx(Badge, { variant: "outline", children: "Plan default" })
|
|
87
|
+
: null] }), tier.description ? _jsx("p", { className: "tier-card-for", children: tier.description }) : null, _jsx("p", { className: "tier-card-price", children: price
|
|
88
|
+
? (_jsxs(_Fragment, { children: [_jsx("b", { children: price }), " a typical reply"] }))
|
|
89
|
+
: "Priced as each model is" }), _jsx("ul", { className: "tier-card-agents", "aria-label": `${tier.title}'s models`, children: tier.agents.map(({ agent, model }) => (_jsxs("li", { children: [_jsxs("span", { className: "tier-who", children: [named(agent)?.icon ? _jsx("span", { "aria-hidden": "true", children: named(agent)?.icon }) : null, named(agent)?.name ?? agent] }), _jsxs("span", { className: "tier-model", children: [model.name, effortSaid(model.effort) ? _jsx("small", { children: effortSaid(model.effort) }) : null] })] }, agent))) }), may
|
|
90
|
+
? (_jsx("div", { className: "tier-card-end", children: current
|
|
91
|
+
? (_jsxs("p", { className: "tier-card-using", children: [_jsx(Icon, { name: "check", size: 15 }), " In use"] }))
|
|
92
|
+
: (_jsxs(Button, { loading: busy === tier.name, disabled: !!busy, onClick: onChoose, "aria-describedby": `tier-${tier.name}`, children: ["Use ", tier.title] })) }))
|
|
93
|
+
: null] }));
|
|
94
|
+
}
|
|
95
|
+
/** Each agent's model now, and choosing one for it (Customize). */
|
|
96
|
+
function EachAgent({ shown, may, call }) {
|
|
97
|
+
const picks = Object.keys(shown.org.custom);
|
|
98
|
+
const [editing, setEditing] = useState(false);
|
|
99
|
+
const [busy, setBusy] = useState();
|
|
100
|
+
const [error, setError] = useState();
|
|
101
|
+
const tier = shown.tiers.find((t) => t.name === shown.now.tier?.name);
|
|
102
|
+
const act = async (key, work) => {
|
|
103
|
+
setBusy(key);
|
|
104
|
+
setError(undefined);
|
|
105
|
+
try {
|
|
106
|
+
await work();
|
|
107
|
+
}
|
|
108
|
+
catch (e) {
|
|
109
|
+
setError(message(e));
|
|
110
|
+
}
|
|
111
|
+
finally {
|
|
112
|
+
setBusy(undefined);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const allBack = () => act("all", () => call("tiers.choose", { tier: shown.org.tier, picks: null }));
|
|
116
|
+
return (_jsxs(Card, { as: "section", className: "tiers-agents", "aria-labelledby": "tiers-each", children: [_jsxs("div", { className: "tiers-agents-head", children: [_jsxs("div", { children: [_jsx("h3", { id: "tiers-each", children: "Each agent's model" }), _jsx("p", { children: editing
|
|
117
|
+
? `Pick a model for any agent: it's used from the next reply, with ${tier ? `${tier.title}'s` : "its own"} behind it in case it fails.`
|
|
118
|
+
: picks.length
|
|
119
|
+
? `${picks.length === 1 ? "One agent has" : `${picks.length} agents have`} a model ` +
|
|
120
|
+
`picked by your org; ${tier ? `${tier.title}'s` : "its own"} stays behind it, ` +
|
|
121
|
+
"in case it fails."
|
|
122
|
+
: `${tier ? `As ${tier.title} has them.` : "Each its own."}${may ? " Customize to pick a different one for any agent." : ""}` })] }), may
|
|
123
|
+
? (_jsxs("div", { className: "tiers-agents-actions", children: [picks.length
|
|
124
|
+
? (_jsx(Button, { size: "sm", variant: "ghost", loading: busy === "all", disabled: !!busy, onClick: () => void allBack(), children: tier ? `Back to ${tier.title}` : "Back to their own" }))
|
|
125
|
+
: null, _jsx(Button, { size: "sm", variant: editing ? "primary" : "secondary", icon: editing ? "check" : "pencil", "aria-pressed": editing, onClick: () => setEditing(!editing), children: editing ? "Done" : "Customize" })] }))
|
|
126
|
+
: null] }), error ? _jsx(Notice, { tone: "destructive", role: "alert", children: error }) : null, _jsx("ul", { className: "tiers-rows", children: shown.agents.map((agent) => {
|
|
127
|
+
const now = shown.now.agents[agent.agent];
|
|
128
|
+
if (!now)
|
|
129
|
+
return null;
|
|
130
|
+
return (_jsx(AgentRow, { agent: agent, now: now, picked: !!shown.org.custom[agent.agent], back: tier ? `Use ${tier.title}'s` : "Use its own", editing: may && editing, busy: busy === agent.agent, onBack: () => void act(agent.agent, () => call("tiers.pick", { agent: agent.agent, model: null })) }, agent.agent));
|
|
131
|
+
}) })] }));
|
|
132
|
+
}
|
|
133
|
+
function AgentRow({ agent, now, picked, back, editing, busy, onBack }) {
|
|
134
|
+
const price = perReply(now.model.price);
|
|
135
|
+
const from = (_jsx("span", { className: "tiers-row-from", "data-picked": picked || undefined, children: orgFromSaid(now.from) }));
|
|
136
|
+
const pick = { action: "tiers.pick", input: { agent: agent.agent } };
|
|
137
|
+
return (_jsxs("li", { className: "tiers-row", "data-editing": editing || undefined, "aria-busy": busy || undefined, children: [_jsx(Avatar, { name: agent.name, kind: "agent", icon: agent.icon, size: 32 }), _jsxs("div", { className: "tiers-row-text", children: [_jsx("p", { className: "tiers-row-name", children: agent.name }), editing
|
|
138
|
+
? (_jsxs("div", { className: "tiers-row-pick", children: [_jsx(LazyView, { kind: "model.pick", item: { value: now.model.id }, hints: pick, fallback: _jsx(Skeleton, { height: 54 }) }), _jsxs("span", { className: "tiers-row-under", children: [from, price ? _jsxs("span", { children: [price, " a typical reply"] }) : null, picked
|
|
139
|
+
? (_jsx(Button, { variant: "link", size: "sm", className: "tiers-back", disabled: busy, onClick: onBack, children: back }))
|
|
140
|
+
: null] })] }))
|
|
141
|
+
: (_jsxs("p", { className: "tiers-row-model", children: [_jsx("b", { children: now.model.name }), effortSaid(now.model.effort) ? `, ${effortSaid(now.model.effort)}` : "", " \u00B7 ", from, now.model.ownKey ? " · on your key" : ""] }))] }), editing || !price ? null : _jsxs("span", { className: "tiers-row-price", children: [price, " a reply"] })] }));
|
|
142
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
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 its agents use and where it comes from ("Expert, as the org chose"),
|
|
6
|
+
* and for its managers a choice of every tier, each with what a typical
|
|
7
|
+
* reply comes to, or the org's again. Any tier: the org's budget bounds it.
|
|
8
|
+
* - On each of the app's agents (kind `tiers.agent`, item `{ _id }`, the
|
|
9
|
+
* agent): the model it uses here and where that comes from ("Claude Haiku
|
|
10
|
+
* 5.5 · the org's Everyday"); for managers, Change (the picker an agent's
|
|
11
|
+
* model is chosen with, team's `model.pick`) and, once picked, the way back
|
|
12
|
+
* to what it had. Agents people make say nothing here: their model is theirs.
|
|
13
|
+
*
|
|
14
|
+
* Both are watched reads, so a change shows at once, wherever it was made.
|
|
15
|
+
*/
|
|
16
|
+
import { type ReactNode } from "react";
|
|
17
|
+
import type { ViewContext } from "copilotz";
|
|
18
|
+
import type { AgentNow, Shown } from "../../contract.js";
|
|
19
|
+
type Call = <R = unknown>(action: string, input?: unknown) => Promise<R>;
|
|
20
|
+
export declare const tiersSpaceView: (item: {
|
|
21
|
+
_id?: string;
|
|
22
|
+
}, ctx: ViewContext<ReactNode>) => ReactNode;
|
|
23
|
+
/** The space's tier: what applies, who chose it, and choosing another. */
|
|
24
|
+
export declare function SpaceTier({ shown, space, manage, call }: {
|
|
25
|
+
shown: Shown;
|
|
26
|
+
space: string;
|
|
27
|
+
manage: boolean;
|
|
28
|
+
call: Call;
|
|
29
|
+
}): ReactNode;
|
|
30
|
+
export declare const tiersAgentView: (item: {
|
|
31
|
+
_id?: string;
|
|
32
|
+
}, ctx: ViewContext<ReactNode>) => ReactNode;
|
|
33
|
+
/** What an agent thinks with here, where that comes from, and changing it. */
|
|
34
|
+
export declare function AgentLine({ now, agent, space, manage, call }: {
|
|
35
|
+
now: AgentNow & {
|
|
36
|
+
without?: AgentNow;
|
|
37
|
+
};
|
|
38
|
+
agent: string;
|
|
39
|
+
space: string;
|
|
40
|
+
manage: boolean;
|
|
41
|
+
call: Call;
|
|
42
|
+
}): ReactNode;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
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 its agents use and where it comes from ("Expert, as the org chose"),
|
|
7
|
+
* and for its managers a choice of every tier, each with what a typical
|
|
8
|
+
* reply comes to, or the org's again. Any tier: the org's budget bounds it.
|
|
9
|
+
* - On each of the app's agents (kind `tiers.agent`, item `{ _id }`, the
|
|
10
|
+
* agent): the model it uses here and where that comes from ("Claude Haiku
|
|
11
|
+
* 5.5 · the org's Everyday"); for managers, Change (the picker an agent's
|
|
12
|
+
* model is chosen with, team's `model.pick`) and, once picked, the way back
|
|
13
|
+
* to what it had. Agents people make say nothing here: their model is theirs.
|
|
14
|
+
*
|
|
15
|
+
* Both are watched reads, so a change shows at once, wherever it was made.
|
|
16
|
+
*/
|
|
17
|
+
import { useState } from "react";
|
|
18
|
+
import { Button, Icon, LazyView, message, Select } from "copilotz/web";
|
|
19
|
+
import { STYLE } from "./style.js";
|
|
20
|
+
import { effortSaid, perReply, spaceFromSaid } from "./words.js";
|
|
21
|
+
const style = _jsx("style", { href: "tiers-web", precedence: "copilotz", children: STYLE });
|
|
22
|
+
export const tiersSpaceView = (item, ctx) => {
|
|
23
|
+
const space = item._id ?? String(ctx.hints.in ?? "");
|
|
24
|
+
const shown = 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 applies, 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 now = shown.now.tier;
|
|
35
|
+
const above = shown.org.tier ?? shown.plan;
|
|
36
|
+
const said = now
|
|
37
|
+
? now.by === "space"
|
|
38
|
+
? `Chosen for this space.${above ? ` The org's is ${title(above)}.` : ""}`
|
|
39
|
+
: now.by === "org"
|
|
40
|
+
? "As the org chose."
|
|
41
|
+
: "Your plan's default, as the org hasn't chosen."
|
|
42
|
+
: "Each agent uses its own.";
|
|
43
|
+
const choose = async (tier) => {
|
|
44
|
+
setBusy(true);
|
|
45
|
+
setError(undefined);
|
|
46
|
+
try {
|
|
47
|
+
await call("tiers.choose", { space, tier: tier || null });
|
|
48
|
+
}
|
|
49
|
+
catch (e) {
|
|
50
|
+
setError(message(e));
|
|
51
|
+
}
|
|
52
|
+
finally {
|
|
53
|
+
setBusy(false);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
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: [_jsxs("b", { children: ["Models: ", now ? title(now.name) : "the agents' own"] }), _jsxs("span", { children: [said, " ", manage
|
|
57
|
+
? "A change applies from each chat's next reply."
|
|
58
|
+
: "This space's managers can change it."] })] }), manage
|
|
59
|
+
? (_jsxs(Select, { size: "sm", "aria-label": "This space's models", value: shown.space?.tier ?? "", disabled: busy, onChange: (event) => void choose(event.target.value), children: [_jsx("option", { value: "", children: above ? `As the org: ${title(above)}` : "As the org: the agents' own" }), shown.tiers.map((tier) => {
|
|
60
|
+
const price = perReply(tier.price);
|
|
61
|
+
return (_jsxs("option", { value: tier.name, children: [tier.title, price ? ` · ${price} a reply` : ""] }, tier.name));
|
|
62
|
+
})] }))
|
|
63
|
+
: null, error ? _jsx("p", { className: "tiers-space-error", role: "alert", children: error }) : null] }));
|
|
64
|
+
}
|
|
65
|
+
export const tiersAgentView = (item, ctx) => {
|
|
66
|
+
const agent = item._id ?? "";
|
|
67
|
+
const space = String(ctx.hints.in ?? "");
|
|
68
|
+
const now = ctx.db.collection("modelChoice").query("agent", { agent, space }).value;
|
|
69
|
+
// Not one of the app's (or still reading): nothing to say.
|
|
70
|
+
if (!now)
|
|
71
|
+
return null;
|
|
72
|
+
return (_jsxs(_Fragment, { children: [style, _jsx(AgentLine, { now: now, agent: agent, space: space, manage: ctx.hints.manage === true, call: ctx.call })] }));
|
|
73
|
+
};
|
|
74
|
+
/** What an agent thinks with here, where that comes from, and changing it. */
|
|
75
|
+
export function AgentLine({ now, agent, space, manage, call }) {
|
|
76
|
+
const [busy, setBusy] = useState(false);
|
|
77
|
+
const [error, setError] = useState();
|
|
78
|
+
const effort = effortSaid(now.model.effort);
|
|
79
|
+
const pick = {
|
|
80
|
+
action: "tiers.pick",
|
|
81
|
+
input: { space, agent },
|
|
82
|
+
look: "link",
|
|
83
|
+
label: "Change",
|
|
84
|
+
};
|
|
85
|
+
const back = async () => {
|
|
86
|
+
setBusy(true);
|
|
87
|
+
setError(undefined);
|
|
88
|
+
try {
|
|
89
|
+
await call("tiers.pick", { space, agent, model: null });
|
|
90
|
+
}
|
|
91
|
+
catch (e) {
|
|
92
|
+
setError(message(e));
|
|
93
|
+
}
|
|
94
|
+
finally {
|
|
95
|
+
setBusy(false);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
return (_jsxs(_Fragment, { children: [_jsxs("span", { className: "tiers-line", "data-picked": now.without ? true : undefined, title: effort ? `${now.model.name}, ${effort}` : undefined, children: [_jsx("b", { children: now.model.name }), " \u00B7 ", _jsx("span", { className: "tiers-line-from", children: spaceFromSaid(now.from) })] }), manage
|
|
99
|
+
? _jsx(LazyView, { kind: "model.pick", item: { value: now.model.id }, hints: pick, fallback: null })
|
|
100
|
+
: null, manage && now.without
|
|
101
|
+
? (_jsxs(Button, { variant: "link", size: "sm", className: "tiers-back", disabled: busy, onClick: () => void back(), title: `Back to ${now.without.model.name}, ${spaceFromSaid(now.without.from)}`, children: ["Back to ", now.without.model.name] }))
|
|
102
|
+
: null, error ? _jsx("span", { className: "tiers-line", role: "alert", children: error }) : null] }));
|
|
103
|
+
}
|
|
@@ -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 .copilotz-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 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 .copilotz-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-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/* Each agent's model */\n.tiers-agents { display: grid; 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 { margin: 0; font-size: 14px; font-weight: 620; }\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); align-items: start; }\n.tiers-row[data-editing] > .copilotz-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\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 .copilotz-icon { flex: none; margin-top: 2px; }\n.tiers-foot a { color: var(--primary-text); text-underline-offset: 3px; }\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 > .copilotz-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 > .copilotz-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 > .copilotz-avatar { margin-top: 2px; }\n .tiers-row-price { grid-column: 2; }\n}\n";
|
|
@@ -0,0 +1,87 @@
|
|
|
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 .copilotz-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 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 .copilotz-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-agents { display: grid; align-content: start; gap: 7px; margin: 0; padding: 10px 0 2px; border-top: 1px solid var(--border);
|
|
28
|
+
list-style: none; }
|
|
29
|
+
.tier-card-agents li { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 8px; align-items: baseline; font-size: 13px;
|
|
30
|
+
line-height: 1.35; }
|
|
31
|
+
.tier-who { display: flex; align-items: baseline; gap: 5px; min-width: 0; overflow: hidden; color: var(--muted-foreground);
|
|
32
|
+
white-space: nowrap; text-overflow: ellipsis; }
|
|
33
|
+
.tier-model { display: grid; min-width: 0; color: var(--foreground); font-weight: 560; overflow-wrap: anywhere; }
|
|
34
|
+
.tier-model small { color: var(--muted-foreground); font-size: 12px; font-weight: 450; }
|
|
35
|
+
.tier-card-end { display: grid; margin-top: 2px; }
|
|
36
|
+
.tier-card-using { display: flex; align-items: center; justify-content: center; gap: 6px; height: 36px; margin: 0;
|
|
37
|
+
border-radius: var(--radius-md); background: var(--primary-soft); color: var(--primary-text); font-size: 13.5px; font-weight: 600; }
|
|
38
|
+
|
|
39
|
+
/* Each agent's model */
|
|
40
|
+
.tiers-agents { display: grid; gap: 2px; padding: 16px 18px 8px; }
|
|
41
|
+
.tiers-agents-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 12px; }
|
|
42
|
+
.tiers-agents-head h3 { margin: 0; font-size: 15px; font-weight: 650; }
|
|
43
|
+
.tiers-agents-head p { margin: 3px 0 0; color: var(--muted-foreground); font-size: 13px; line-height: 1.45; }
|
|
44
|
+
.tiers-agents-actions { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
45
|
+
.tiers-rows { display: grid; margin: 6px 0 0; padding: 0; list-style: none; }
|
|
46
|
+
.tiers-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 11px 0; }
|
|
47
|
+
.tiers-row + .tiers-row { border-top: 1px solid var(--border); }
|
|
48
|
+
.tiers-row-text { display: grid; gap: 2px; min-width: 0; }
|
|
49
|
+
.tiers-row-name { margin: 0; font-size: 14px; font-weight: 620; }
|
|
50
|
+
.tiers-row-model { margin: 0; color: var(--secondary-foreground); font-size: 13px; line-height: 1.45; }
|
|
51
|
+
.tiers-row-model b { color: var(--foreground); font-weight: 600; }
|
|
52
|
+
.tiers-row-from[data-picked] { color: var(--primary-text); }
|
|
53
|
+
.tiers-row-price { color: var(--muted-foreground); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
54
|
+
.tiers-row[data-editing] { grid-template-columns: 32px minmax(0, 1fr); align-items: start; }
|
|
55
|
+
.tiers-row[data-editing] > .copilotz-avatar { margin-top: 2px; }
|
|
56
|
+
.tiers-row-pick { display: grid; gap: 6px; min-width: 0; }
|
|
57
|
+
.tiers-row-under { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; color: var(--muted-foreground); font-size: 12.5px; }
|
|
58
|
+
.tiers-back { height: auto; padding: 0; font-size: 12.5px; }
|
|
59
|
+
|
|
60
|
+
.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; }
|
|
61
|
+
.tiers-foot .copilotz-icon { flex: none; margin-top: 2px; }
|
|
62
|
+
.tiers-foot a { color: var(--primary-text); text-underline-offset: 3px; }
|
|
63
|
+
|
|
64
|
+
/* A space's agents: its choice, and each one's line */
|
|
65
|
+
.tiers-space { container: tiers-space / inline-size; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
|
|
66
|
+
padding: 12px 12px 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); }
|
|
67
|
+
.tiers-space-mark { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-md);
|
|
68
|
+
background: var(--primary-soft); color: var(--primary-text); }
|
|
69
|
+
.tiers-space-text { flex: 1 1 200px; display: grid; gap: 1px; min-width: 0; }
|
|
70
|
+
.tiers-space-text b { font-size: 14px; font-weight: 620; }
|
|
71
|
+
.tiers-space-text span { color: var(--muted-foreground); font-size: 12.5px; line-height: 1.45; }
|
|
72
|
+
.tiers-space > .copilotz-select { flex: 1 1 210px; max-width: 280px; }
|
|
73
|
+
.tiers-space-error { flex-basis: 100%; margin: 0; color: var(--destructive-text, var(--destructive)); font-size: 12.5px; }
|
|
74
|
+
.tiers-line { min-width: 0; color: var(--muted-foreground); font-size: 12.5px; line-height: 1.45; }
|
|
75
|
+
.tiers-line b { color: var(--secondary-foreground); font-weight: 600; }
|
|
76
|
+
.tiers-line[data-picked] .tiers-line-from { color: var(--primary-text); }
|
|
77
|
+
|
|
78
|
+
@container tiers-space (max-width: 480px) {
|
|
79
|
+
.tiers-space > .copilotz-select { flex-basis: 100%; max-width: none; }
|
|
80
|
+
}
|
|
81
|
+
@container tiers (max-width: 520px) {
|
|
82
|
+
.tiers-agents { padding: 14px 14px 6px; }
|
|
83
|
+
.tiers-row { grid-template-columns: 32px minmax(0, 1fr); align-items: start; }
|
|
84
|
+
.tiers-row > .copilotz-avatar { margin-top: 2px; }
|
|
85
|
+
.tiers-row-price { grid-column: 2; }
|
|
86
|
+
}
|
|
87
|
+
`;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiers as the web says them: what a typical reply comes to, in cents people
|
|
3
|
+
* can compare ("about 4¢ a reply"); how hard a model is asked to think; and
|
|
4
|
+
* where an agent's model comes from, as the org's page says it ("Expert,
|
|
5
|
+
* chosen by your org") and as a space's says it ("the org's Everyday").
|
|
6
|
+
*/
|
|
7
|
+
import type { From } from "../../contract.js";
|
|
8
|
+
/** A typical reply's price: "0.3¢", "4¢", "$1.20"; none when nothing prices it. */
|
|
9
|
+
export declare function perReply(usd: number | null | undefined): string | undefined;
|
|
10
|
+
/** How hard it's asked to think, in words: "high effort". */
|
|
11
|
+
export declare const effortSaid: (effort?: string) => string | undefined;
|
|
12
|
+
type Titled = From & {
|
|
13
|
+
title?: string;
|
|
14
|
+
};
|
|
15
|
+
/** Where an agent's model comes from, on the org's page: "Expert, chosen by your org". */
|
|
16
|
+
export declare function orgFromSaid(from: Titled): string;
|
|
17
|
+
/** Where an agent's model comes from, in a space: "the org's Everyday", "picked for this space". */
|
|
18
|
+
export declare function spaceFromSaid(from: Titled): string;
|
|
19
|
+
/** Who chose the tier in force, as its badge says: "Chosen by your org", "Your plan's default". */
|
|
20
|
+
export declare const chosenSaid: (by: "space" | "org" | "plan") => string;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** A typical reply's price: "0.3¢", "4¢", "$1.20"; none when nothing prices it. */
|
|
2
|
+
export function perReply(usd) {
|
|
3
|
+
if (usd === null || usd === undefined || !Number.isFinite(usd))
|
|
4
|
+
return undefined;
|
|
5
|
+
const cents = usd * 100;
|
|
6
|
+
if (cents < 0.05)
|
|
7
|
+
return "under 0.1¢";
|
|
8
|
+
if (cents < 10)
|
|
9
|
+
return `${+cents.toFixed(1)}¢`;
|
|
10
|
+
if (cents < 100)
|
|
11
|
+
return `${Math.round(cents)}¢`;
|
|
12
|
+
return `$${usd.toFixed(2)}`;
|
|
13
|
+
}
|
|
14
|
+
const EFFORTS = {
|
|
15
|
+
none: "no reasoning",
|
|
16
|
+
minimal: "minimal effort",
|
|
17
|
+
low: "low effort",
|
|
18
|
+
medium: "medium effort",
|
|
19
|
+
high: "high effort",
|
|
20
|
+
xhigh: "extra-high effort",
|
|
21
|
+
max: "max effort",
|
|
22
|
+
};
|
|
23
|
+
/** How hard it's asked to think, in words: "high effort". */
|
|
24
|
+
export const effortSaid = (effort) => effort ? EFFORTS[effort] ?? `${effort} effort` : undefined;
|
|
25
|
+
const titleOf = (from) => from.title ?? ("tier" in from ? from.tier : undefined) ?? "";
|
|
26
|
+
/** Where an agent's model comes from, on the org's page: "Expert, chosen by your org". */
|
|
27
|
+
export function orgFromSaid(from) {
|
|
28
|
+
if (from.by === "app")
|
|
29
|
+
return "its own model";
|
|
30
|
+
if ("custom" in from)
|
|
31
|
+
return "picked by your org";
|
|
32
|
+
if (from.by === "plan")
|
|
33
|
+
return `${titleOf(from)}, your plan's default`;
|
|
34
|
+
return `${titleOf(from)}, chosen by your org`;
|
|
35
|
+
}
|
|
36
|
+
/** Where an agent's model comes from, in a space: "the org's Everyday", "picked for this space". */
|
|
37
|
+
export function spaceFromSaid(from) {
|
|
38
|
+
if (from.by === "app")
|
|
39
|
+
return "its own model";
|
|
40
|
+
if ("custom" in from)
|
|
41
|
+
return from.by === "space" ? "picked for this space" : "the org's pick";
|
|
42
|
+
if (from.by === "space")
|
|
43
|
+
return `this space's ${titleOf(from)}`;
|
|
44
|
+
if (from.by === "org")
|
|
45
|
+
return `the org's ${titleOf(from)}`;
|
|
46
|
+
return `the plan's ${titleOf(from)}`;
|
|
47
|
+
}
|
|
48
|
+
/** Who chose the tier in force, as its badge says: "Chosen by your org", "Your plan's default". */
|
|
49
|
+
export const chosenSaid = (by) => by === "plan" ? "Your plan's default" : by === "org" ? "Chosen by your org" : "Chosen here";
|
package/tiers/web.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiers' web front end, for the browser. The org page's "Agents' models"
|
|
3
|
+
* section (the web shell's `orgSettings`, at `/org?tab=models`): the tiers as
|
|
4
|
+
* cards, with what each is good for, each agent's model, what a typical
|
|
5
|
+
* reply comes to and which is in use and why; choosing one, and Customize, a
|
|
6
|
+
* model per agent. Owners and admins change it; members read it, and are told
|
|
7
|
+
* who can. On a space's Members tab (spaces' `spaceAgents`): the space's tier
|
|
8
|
+
* above its agents, and on each of the app's agents the model it uses there
|
|
9
|
+
* and where that comes from, with Change for its managers. Models are chosen
|
|
10
|
+
* with team's picker (`model.pick`). Add it beside them:
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* await web({ plugins: [webShell, chatWeb, spacesWeb, teamWeb, tiersWeb], root });
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
import { type Plugin } from "copilotz";
|
|
17
|
+
export declare const tiersWeb: Plugin;
|
|
18
|
+
export default tiersWeb;
|
package/tiers/web.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiers' web front end, for the browser. The org page's "Agents' models"
|
|
3
|
+
* section (the web shell's `orgSettings`, at `/org?tab=models`): the tiers as
|
|
4
|
+
* cards, with what each is good for, each agent's model, what a typical
|
|
5
|
+
* reply comes to and which is in use and why; choosing one, and Customize, a
|
|
6
|
+
* model per agent. Owners and admins change it; members read it, and are told
|
|
7
|
+
* who can. On a space's Members tab (spaces' `spaceAgents`): the space's tier
|
|
8
|
+
* above its agents, and on each of the app's agents the model it uses there
|
|
9
|
+
* and where that comes from, with Change for its managers. Models are chosen
|
|
10
|
+
* with team's picker (`model.pick`). Add it beside them:
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* await web({ plugins: [webShell, chatWeb, spacesWeb, teamWeb, tiersWeb], root });
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
import { definePlugin } from "copilotz";
|
|
17
|
+
import { tiersOrgView } from "./views/web/org.js";
|
|
18
|
+
import { tiersAgentView, tiersSpaceView } from "./views/web/space.js";
|
|
19
|
+
export const tiersWeb = definePlugin({
|
|
20
|
+
name: "tiers-web",
|
|
21
|
+
requires: ["web-shell", "spaces-web", "team-web"],
|
|
22
|
+
views: {
|
|
23
|
+
"tiers.org": tiersOrgView,
|
|
24
|
+
"tiers.space": tiersSpaceView,
|
|
25
|
+
"tiers.agent": tiersAgentView,
|
|
26
|
+
},
|
|
27
|
+
resources: {
|
|
28
|
+
orgSettings: {
|
|
29
|
+
models: {
|
|
30
|
+
title: "Agents' models",
|
|
31
|
+
view: "tiers.org",
|
|
32
|
+
icon: "sparkles",
|
|
33
|
+
order: 22,
|
|
34
|
+
roles: ["owner", "admin", "member"],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
spaceAgents: { tiers: { view: "tiers.space", row: "tiers.agent", order: 10 } },
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
export default tiersWeb;
|
package/web.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Team's front ends, for the browser (`@copilotz/team/web`): `teamWeb` (an
|
|
3
|
+
* agent's page, making one, adding one to a space, agents in the palette)
|
|
4
|
+
* and `tiersWeb` (the org page's Agents' models, and a space's). Add them
|
|
5
|
+
* beside the web shell's and spaces':
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { teamWeb, tiersWeb } from "@copilotz/team/web";
|
|
9
|
+
*
|
|
10
|
+
* await web({ plugins: [webShell, chatWeb, spacesWeb, teamWeb, tiersWeb], root });
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export { teamWeb } from "./team/web.js";
|
|
14
|
+
export { tiersWeb } from "./tiers/web.js";
|
package/web.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Team's front ends, for the browser (`@copilotz/team/web`): `teamWeb` (an
|
|
3
|
+
* agent's page, making one, adding one to a space, agents in the palette)
|
|
4
|
+
* and `tiersWeb` (the org page's Agents' models, and a space's). Add them
|
|
5
|
+
* beside the web shell's and spaces':
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { teamWeb, tiersWeb } from "@copilotz/team/web";
|
|
9
|
+
*
|
|
10
|
+
* await web({ plugins: [webShell, chatWeb, spacesWeb, teamWeb, tiersWeb], root });
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export { teamWeb } from "./team/web.js";
|
|
14
|
+
export { tiersWeb } from "./tiers/web.js";
|