@copilotz/team 1.0.0-rc.54 → 1.0.0-rc.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/WORDS.md +156 -0
  2. package/package.json +2 -2
  3. package/team/actions/agent.d.ts +10 -0
  4. package/team/actions/agent.js +226 -7
  5. package/team/actions/define.js +7 -3
  6. package/team/collections/agent.d.ts +52 -7
  7. package/team/collections/agent.js +56 -5
  8. package/team/mod.d.ts +7 -0
  9. package/team/mod.js +14 -1
  10. package/team/resources/propose.d.ts +1 -0
  11. package/team/resources/propose.js +97 -0
  12. package/team/shared/definition.d.ts +1 -1
  13. package/team/shared/definition.js +5 -4
  14. package/team/shared/everywhere.d.ts +11 -0
  15. package/team/shared/everywhere.js +29 -0
  16. package/team/views/web/agent-add.js +14 -4
  17. package/team/views/web/agent-describe.d.ts +38 -0
  18. package/team/views/web/agent-describe.js +44 -0
  19. package/team/views/web/agent-fields.d.ts +3 -1
  20. package/team/views/web/agent-fields.js +2 -2
  21. package/team/views/web/agent-known.js +2 -1
  22. package/team/views/web/agent-new.d.ts +4 -1
  23. package/team/views/web/agent-new.js +26 -5
  24. package/team/views/web/agent-org.d.ts +12 -0
  25. package/team/views/web/agent-org.js +89 -0
  26. package/team/views/web/agent.d.ts +7 -4
  27. package/team/views/web/agent.js +81 -28
  28. package/team/views/web/model-pick.d.ts +3 -1
  29. package/team/views/web/model-pick.js +4 -1
  30. package/team/views/web/style.d.ts +1 -1
  31. package/team/views/web/style.js +5 -0
  32. package/team/views/web/words.d.ts +1 -1
  33. package/team/views/web/words.js +28 -0
  34. package/team/web.js +2 -0
  35. package/tiers/actions/choose.d.ts +5 -1
  36. package/tiers/actions/choose.js +247 -66
  37. package/tiers/actions/model.js +31 -22
  38. package/tiers/collections/choice.d.ts +17 -10
  39. package/tiers/collections/choice.js +39 -27
  40. package/tiers/collections/template.d.ts +90 -0
  41. package/tiers/collections/template.js +41 -0
  42. package/tiers/contract.d.ts +10 -8
  43. package/tiers/mod.d.ts +30 -21
  44. package/tiers/mod.js +45 -36
  45. package/tiers/shared/shown.d.ts +131 -49
  46. package/tiers/shared/shown.js +192 -98
  47. package/tiers/shared/tiers.d.ts +105 -62
  48. package/tiers/shared/tiers.js +127 -86
  49. package/tiers/views/web/composer.d.ts +12 -0
  50. package/tiers/views/web/composer.js +79 -0
  51. package/tiers/views/web/org.d.ts +44 -21
  52. package/tiers/views/web/org.js +231 -84
  53. package/tiers/views/web/say.d.ts +138 -0
  54. package/tiers/views/web/say.js +142 -0
  55. package/tiers/views/web/setup.d.ts +23 -0
  56. package/tiers/views/web/setup.js +80 -0
  57. package/tiers/views/web/space.d.ts +8 -20
  58. package/tiers/views/web/space.js +30 -59
  59. package/tiers/views/web/style.d.ts +1 -1
  60. package/tiers/views/web/style.js +98 -4
  61. package/tiers/views/web/team.d.ts +38 -0
  62. package/tiers/views/web/team.js +118 -0
  63. package/tiers/views/web/words.d.ts +36 -16
  64. package/tiers/views/web/words.js +102 -35
  65. package/tiers/web.d.ts +18 -9
  66. package/tiers/web.js +36 -10
@@ -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 {};
@@ -0,0 +1,118 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ /**
3
+ * The org's team, on its page's Agents section (under the tiers): the agents
4
+ * every space in the org starts with, each with its kind of work and the
5
+ * model that gives it on the org's default tier. The app's agents as the org
6
+ * has them (as they are, or changed: "Changed"), then those the org made
7
+ * ("Your org's"). Owners and admins add one (team's `agent.org`, in a
8
+ * dialog), edit one (its page, `?edit=1`), take one off the team
9
+ * (`agent.delete`, after a question: it leaves every space) and put one of
10
+ * the app's back (`agent.restore`) or back as the app has it
11
+ * (`agent.reset`). Anyone else reads it. Models are the tiers', set by kind
12
+ * of work above it, never per agent.
13
+ */
14
+ import { useState } from "react";
15
+ import { Avatar, Badge, Button, Card, Dialog, LazyView, Menu, message, Notice, Skeleton, } from "copilotz/web";
16
+ import { say } from "./say.js";
17
+ import { sayText } from "copilotz/web/words";
18
+ import { modelSaid } from "./words.js";
19
+ /** A description's first sentence. */
20
+ const firstSentence = (text) => {
21
+ if (!text)
22
+ return undefined;
23
+ const end = text.search(/[.!?](\s|$)/);
24
+ return end > 0 ? text.slice(0, end + 1) : text;
25
+ };
26
+ /** The kind of work an agent of the team does: its own, what it works like, else the first. */
27
+ export function kindFor(shown, agent) {
28
+ const kinds = shown.kinds.map((k) => k.kind);
29
+ if (agent.like && kinds.includes(agent.like))
30
+ return agent.like;
31
+ const own = shown.kinds.find((k) => k.agents.some((a) => a.agent === agent.id));
32
+ return own?.kind ?? kinds[0];
33
+ }
34
+ export function Team({ shown, team, may, org, tier, call }) {
35
+ const [adding, setAdding] = useState(false);
36
+ const [removing, setRemoving] = useState();
37
+ const [busy, setBusy] = useState();
38
+ const [error, setError] = useState();
39
+ if (!team)
40
+ return _jsx(Skeleton, { height: 260, radius: "xl" });
41
+ const onTier = shown.tiers.find((t) => t.name === tier);
42
+ const on = team.filter((a) => !a.off);
43
+ const off = team.filter((a) => a.off);
44
+ const act = async (key, work) => {
45
+ setBusy(key);
46
+ setError(undefined);
47
+ try {
48
+ await work();
49
+ }
50
+ catch (e) {
51
+ setError(message(e));
52
+ }
53
+ finally {
54
+ setBusy(undefined);
55
+ }
56
+ };
57
+ const menuOf = (agent) => {
58
+ if (!may)
59
+ return null;
60
+ const items = [
61
+ { label: say("edit"), icon: "pencil", href: `/agent/${encodeURIComponent(agent.id)}?edit=1` },
62
+ ...(agent.kind === "changed"
63
+ ? [{
64
+ label: say("backToOriginal"),
65
+ icon: "restore",
66
+ onSelect: () => void act(agent.id, () => call("agent.reset", { agent: agent.id })),
67
+ }]
68
+ : []),
69
+ "separator",
70
+ {
71
+ label: say("removeFromTeam"),
72
+ icon: "trash",
73
+ tone: "destructive",
74
+ onSelect: () => setRemoving(agent),
75
+ },
76
+ ];
77
+ return _jsx(Menu, { label: say("tierMore", { tier: agent.name }), align: "end", items: items });
78
+ };
79
+ return (_jsxs(Card, { as: "section", className: "tiers-agents", "aria-labelledby": "tiers-team", children: [_jsxs("div", { className: "tiers-agents-head", children: [_jsxs("div", { children: [_jsx("h3", { id: "tiers-team", children: say("teamTitle") }), _jsx("p", { children: org ? say("teamAbout", { org }) : say("teamAboutMine") })] }), may
80
+ ? (_jsx("div", { className: "tiers-agents-actions", children: _jsx(Button, { size: "sm", variant: "secondary", icon: "plus", onClick: () => setAdding(true), children: say("addAgent") }) }))
81
+ : null] }), error ? _jsx(Notice, { tone: "destructive", role: "alert", children: error }) : null, _jsx("ul", { className: "tiers-rows", children: on.map((agent) => {
82
+ const kind = kindFor(shown, agent);
83
+ const kindTitle = shown.kinds.find((k) => k.kind === kind)?.title;
84
+ const model = onTier?.kinds.find((k) => k.kind === kind)?.model;
85
+ return (_jsxs("li", { className: "tiers-row", "aria-busy": busy === agent.id || undefined, children: [_jsx(Avatar, { name: agent.name, kind: "agent", icon: agent.icon, size: 32 }), _jsxs("div", { className: "tiers-row-text", children: [_jsxs("p", { className: "tiers-row-name", children: [agent.name, _jsxs("span", { className: "tiers-row-handle", children: ["@", agent.id] }), agent.kind === "changed"
86
+ ? _jsx(Badge, { variant: "outline", children: say("badgeChanged") })
87
+ : null, agent.kind === "org" ? _jsx(Badge, { tone: "primary", children: say("badgeOrgs") }) : null] }), agent.description
88
+ ? _jsx("p", { className: "tiers-row-about", children: firstSentence(sayText(agent.description)) })
89
+ : null, _jsxs("p", { className: "tiers-row-model", children: [kindTitle ? _jsx("span", { className: "tiers-row-kind", children: kindTitle }) : null, model
90
+ ? say.nodes("onTier", {
91
+ model: _jsx("b", { children: modelSaid(model) }),
92
+ tier: onTier?.title ?? "",
93
+ })
94
+ : null] })] }), _jsx("span", { className: "tiers-row-end", children: menuOf(agent) })] }, agent.id));
95
+ }) }), off.length
96
+ ? (_jsxs("div", { className: "tiers-off", children: [_jsx("h4", { children: say("notOnTeam") }), off.map((agent) => (_jsxs("div", { className: "tiers-off-row", children: [_jsx(Avatar, { name: agent.name, kind: "agent", icon: agent.icon, size: 24 }), _jsxs("span", { className: "tiers-off-text", children: [agent.name, agent.description ? `: ${firstSentence(sayText(agent.description))}` : ""] }), may
97
+ ? (_jsx(Button, { size: "sm", variant: "ghost", icon: "plus", loading: busy === agent.id, onClick: () => void act(agent.id, () => call("agent.restore", { agent: agent.id })), children: say("addBack") }))
98
+ : null] }, agent.id)))] }))
99
+ : null, may
100
+ ? (_jsxs(_Fragment, { children: [_jsx(Dialog, { open: adding, onClose: () => setAdding(false), size: "lg", title: say("addAgentTitle"), description: org ? say("addAgentAbout", { org }) : say("addAgentAboutMine"), children: adding
101
+ ? (_jsx(LazyView, { kind: "agent.org", hints: {
102
+ done: () => setAdding(false),
103
+ kinds: shown.kinds.map((k) => ({
104
+ kind: k.kind,
105
+ title: k.title,
106
+ agents: k.agents.map((a) => a.name),
107
+ })),
108
+ }, fallback: _jsx(Skeleton, { height: 320, radius: "lg" }) }))
109
+ : null }), _jsx(Dialog, { open: !!removing, onClose: () => setRemoving(undefined), size: "sm", title: removing ? say("removeTitle", { name: removing.name }) : "", footer: _jsxs(_Fragment, { children: [_jsx(Button, { variant: "ghost", onClick: () => setRemoving(undefined), children: say("cancel") }), _jsx(Button, { variant: "destructive", loading: !!removing && busy === removing.id, onClick: () => {
110
+ const agent = removing;
111
+ void act(agent.id, () => call("agent.delete", { agent: agent.id })).then(() => setRemoving(undefined));
112
+ }, children: say("remove") })] }), children: removing
113
+ ? (_jsxs("p", { className: "tiers-remove-said", children: [org
114
+ ? say("removeSaid", { name: removing.name, org })
115
+ : say("removeSaidMine", { name: removing.name }), " ", removing.kind === "org" ? say("removeDeletes") : say("removeBack")] }))
116
+ : null })] }))
117
+ : null] }));
118
+ }
@@ -1,21 +1,41 @@
1
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").
2
+ * Tiers as the web says them: what a typical message (or reply) comes to, in
3
+ * cents people can compare ("2¢ a message"), and how far the plan's credits
4
+ * go at that ("about 220 messages with Free's $5"); how hard a model is asked
5
+ * to think; who chose the tier in force ("the org's default"); and who runs
6
+ * a model ("OpenAI").
6
7
  */
7
- import type { From } from "../../contract.js";
8
- /** A typical reply's price: "0.3¢", "4¢", "$1.20"; none when nothing prices it. */
8
+ import type { By, CreditsShown, KindShown, Shown, TierShown } from "../../contract.js";
9
+ /** What prices are for: "a message", or "a reply" where the app measured no message. */
10
+ export declare const unitSaid: (per: Shown["per"]) => string;
11
+ /** About how many: exact under 20, then to the nearest 5, and the nearest 10 from 100. */
12
+ export declare function about(count: number): number;
13
+ /**
14
+ * How far the plan's credits go at a price: "about 220 messages with Free's
15
+ * $5", "about 490 messages a month with Personal's $10", "about 980 messages
16
+ * a month for each seat on Team"; none when nothing's priced or given.
17
+ */
18
+ export declare function creditsGo(credits: CreditsShown | null, price: number | null, per: Shown["per"]): string | undefined;
19
+ /** How many times faster one price spends than another: "13×"; none when it's no faster. */
20
+ export declare function faster(price: number | null, than: number | null): string | undefined;
21
+ /** A typical message's price: "0.3¢", "4¢", "$1.20"; none when nothing prices it. */
9
22
  export declare function perReply(usd: number | null | undefined): string | undefined;
10
23
  /** How hard it's asked to think, in words: "high effort". */
11
24
  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 {};
25
+ /** Who chose the tier in force, as a line says it: "chosen for this chat", "the org's default". */
26
+ export declare function bySaid(by: By): string;
27
+ /** Who runs a model, from its id: "OpenAI", "your ChatGPT plan". */
28
+ export declare function providerSaid(id: string): string;
29
+ /** A model, with its effort: "Claude Haiku 5.5, low effort". */
30
+ export declare const modelSaid: (model: {
31
+ name: string;
32
+ effort?: string;
33
+ }) => string;
34
+ /**
35
+ * What the tiers show, in the app's words (`sayText`): each tier's name and description, each
36
+ * kind of work's title and description, as the app declared them; what an org wrote shows as is.
37
+ */
38
+ export declare function shownSaid<T extends {
39
+ tiers?: TierShown[];
40
+ kinds?: KindShown[];
41
+ }>(shown: T | undefined): T | undefined;
@@ -1,49 +1,116 @@
1
- /** A typical reply's price: "0.3¢", "4¢", "$1.20"; none when nothing prices it. */
1
+ import { formatNumber, sayText } from "copilotz/web/words";
2
+ import { say } from "./say.js";
3
+ /** What prices are for: "a message", or "a reply" where the app measured no message. */
4
+ export const unitSaid = (per) => per === "message" ? say("perMessage") : say("perReply");
5
+ /** About how many: exact under 20, then to the nearest 5, and the nearest 10 from 100. */
6
+ export function about(count) {
7
+ if (count < 20)
8
+ return Math.floor(count);
9
+ if (count < 100)
10
+ return Math.round(count / 5) * 5;
11
+ return Math.round(count / 10) * 10;
12
+ }
13
+ /** Dollars as people write them: "$5", "$12.50". */
14
+ const dollars = (usd) => `$${formatNumber(usd, Number.isInteger(usd) ? {} : CENTS)}`;
15
+ /** Two decimals, always: "$1.20". */
16
+ const CENTS = { minimumFractionDigits: 2, maximumFractionDigits: 2 };
17
+ /**
18
+ * How far the plan's credits go at a price: "about 220 messages with Free's
19
+ * $5", "about 490 messages a month with Personal's $10", "about 980 messages
20
+ * a month for each seat on Team"; none when nothing's priced or given.
21
+ */
22
+ export function creditsGo(credits, price, per) {
23
+ if (!credits?.amount || !price)
24
+ return undefined;
25
+ const count = about(credits.amount / price);
26
+ const things = say(per === "message" ? "messages" : "replies", { count });
27
+ const amount = dollars(credits.amount);
28
+ if (credits.every === "once")
29
+ return say("creditsOnce", { things, plan: credits.title, amount });
30
+ if (credits.perSeat)
31
+ return say("creditsSeat", { things, plan: credits.title });
32
+ return say("creditsMonth", { things, plan: credits.title, amount });
33
+ }
34
+ /** How many times faster one price spends than another: "13×"; none when it's no faster. */
35
+ export function faster(price, than) {
36
+ if (!price || !than || price <= than * 1.05)
37
+ return undefined;
38
+ const times = price / than;
39
+ return `${formatNumber(times < 10 ? +times.toFixed(1) : Math.round(times))}×`;
40
+ }
41
+ /** A typical message's price: "0.3¢", "4¢", "$1.20"; none when nothing prices it. */
2
42
  export function perReply(usd) {
3
43
  if (usd === null || usd === undefined || !Number.isFinite(usd))
4
44
  return undefined;
5
45
  const cents = usd * 100;
6
46
  if (cents < 0.05)
7
- return "under 0.1¢";
47
+ return say("underTenth");
8
48
  if (cents < 10)
9
- return `${+cents.toFixed(1)}¢`;
49
+ return `${formatNumber(+cents.toFixed(1))}¢`;
10
50
  if (cents < 100)
11
51
  return `${Math.round(cents)}¢`;
12
- return `$${usd.toFixed(2)}`;
52
+ return `$${formatNumber(usd, CENTS)}`;
13
53
  }
14
54
  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",
55
+ none: "effortNone",
56
+ minimal: "effortMinimal",
57
+ low: "effortLow",
58
+ medium: "effortMedium",
59
+ high: "effortHigh",
60
+ xhigh: "effortXhigh",
61
+ max: "effortMax",
22
62
  };
23
63
  /** 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`;
64
+ export const effortSaid = (effort) => effort
65
+ ? Object.hasOwn(EFFORTS, effort)
66
+ ? say(EFFORTS[effort])
67
+ : say("effortOther", { effort })
68
+ : undefined;
69
+ /** Who chose the tier in force, as a line says it: "chosen for this chat", "the org's default". */
70
+ export function bySaid(by) {
71
+ switch (by) {
72
+ case "thread":
73
+ return say("byThread");
74
+ case "person":
75
+ return say("byPerson");
76
+ case "space":
77
+ return say("bySpace");
78
+ case "org":
79
+ return say("byOrg");
80
+ default:
81
+ return say("byPlan");
82
+ }
83
+ }
84
+ /** Who runs a model, from its id: "OpenAI", "your ChatGPT plan". */
85
+ export function providerSaid(id) {
86
+ const provider = id.slice(0, id.indexOf("/"));
87
+ const known = {
88
+ chatgpt: say("providerChatgpt"),
89
+ openai: "OpenAI",
90
+ anthropic: "Anthropic",
91
+ google: "Google",
92
+ deepseek: "DeepSeek",
93
+ minimax: "MiniMax",
94
+ };
95
+ return known[provider] ?? provider;
35
96
  }
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)}`;
97
+ /** A model, with its effort: "Claude Haiku 5.5, low effort". */
98
+ export const modelSaid = (model) => effortSaid(model.effort) ? `${model.name}, ${effortSaid(model.effort)}` : model.name;
99
+ /**
100
+ * What the tiers show, in the app's words (`sayText`): each tier's name and description, each
101
+ * kind of work's title and description, as the app declared them; what an org wrote shows as is.
102
+ */
103
+ export function shownSaid(shown) {
104
+ if (!shown)
105
+ return shown;
106
+ const said = (x) => ({
107
+ ...x,
108
+ title: sayText(x.title),
109
+ ...(x.description ? { description: sayText(x.description) } : {}),
110
+ });
111
+ return {
112
+ ...shown,
113
+ ...(shown.tiers ? { tiers: shown.tiers.map(said) } : {}),
114
+ ...(shown.kinds ? { kinds: shown.kinds.map(said) } : {}),
115
+ };
47
116
  }
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 CHANGED
@@ -1,13 +1,22 @@
1
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:
2
+ * Tiers' web front end, for the browser.
3
+ *
4
+ * - **The org page's Agents section** (the web shell's `orgSettings`, at
5
+ * `/org?tab=models`): the tiers as cards, each with what a typical message
6
+ * comes to and each kind of work's model; making one the default,
7
+ * customizing one (each kind's model and fallbacks), making new ones,
8
+ * taking them away, the members' cap; and the org's team under them.
9
+ * - **Beside the send button** (chat's `composerControls`): the tier a chat
10
+ * runs on, to switch it there, or on home the person's default.
11
+ * - **On a space's Members tab** (spaces' `spaceAgents`): the tier new chats
12
+ * there start on, for its managers to change, and on each agent its model
13
+ * there and its kind of work.
14
+ * - **For a new org** (`tiers.setup`, a step of chat's `welcome` for its
15
+ * owners and admins): the tiers as one short choice.
16
+ * - **For team's front end** (`agentKinds`): where to read the kinds of work,
17
+ * so making an agent asks for its kind instead of a model.
18
+ *
19
+ * Models are chosen with team's picker (`model.pick`). Add it beside them:
11
20
  *
12
21
  * ```ts
13
22
  * await web({ plugins: [webShell, chatWeb, spacesWeb, teamWeb, tiersWeb], root });
package/tiers/web.js CHANGED
@@ -1,20 +1,31 @@
1
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:
2
+ * Tiers' web front end, for the browser.
3
+ *
4
+ * - **The org page's Agents section** (the web shell's `orgSettings`, at
5
+ * `/org?tab=models`): the tiers as cards, each with what a typical message
6
+ * comes to and each kind of work's model; making one the default,
7
+ * customizing one (each kind's model and fallbacks), making new ones,
8
+ * taking them away, the members' cap; and the org's team under them.
9
+ * - **Beside the send button** (chat's `composerControls`): the tier a chat
10
+ * runs on, to switch it there, or on home the person's default.
11
+ * - **On a space's Members tab** (spaces' `spaceAgents`): the tier new chats
12
+ * there start on, for its managers to change, and on each agent its model
13
+ * there and its kind of work.
14
+ * - **For a new org** (`tiers.setup`, a step of chat's `welcome` for its
15
+ * owners and admins): the tiers as one short choice.
16
+ * - **For team's front end** (`agentKinds`): where to read the kinds of work,
17
+ * so making an agent asks for its kind instead of a model.
18
+ *
19
+ * Models are chosen with team's picker (`model.pick`). Add it beside them:
11
20
  *
12
21
  * ```ts
13
22
  * await web({ plugins: [webShell, chatWeb, spacesWeb, teamWeb, tiersWeb], root });
14
23
  * ```
15
24
  */
16
25
  import { definePlugin } from "copilotz";
26
+ import { tiersComposerView } from "./views/web/composer.js";
17
27
  import { tiersOrgView } from "./views/web/org.js";
28
+ import { tiersSetupView } from "./views/web/setup.js";
18
29
  import { tiersAgentView, tiersSpaceView } from "./views/web/space.js";
19
30
  export const tiersWeb = definePlugin({
20
31
  name: "tiers-web",
@@ -23,11 +34,13 @@ export const tiersWeb = definePlugin({
23
34
  "tiers.org": tiersOrgView,
24
35
  "tiers.space": tiersSpaceView,
25
36
  "tiers.agent": tiersAgentView,
37
+ "tiers.setup": tiersSetupView,
38
+ "tiers.composer": tiersComposerView,
26
39
  },
27
40
  resources: {
28
41
  orgSettings: {
29
42
  models: {
30
- title: "Agents' models",
43
+ title: "Agents",
31
44
  view: "tiers.org",
32
45
  icon: "sparkles",
33
46
  order: 22,
@@ -35,6 +48,19 @@ export const tiersWeb = definePlugin({
35
48
  },
36
49
  },
37
50
  spaceAgents: { tiers: { view: "tiers.space", row: "tiers.agent", order: 10 } },
51
+ composerControls: { tiers: { view: "tiers.composer", order: 10 } },
52
+ agentKinds: { query: "modelChoice.offered" },
53
+ // Chat's welcome, for who runs the org: choosing its tier as they start.
54
+ welcome: {
55
+ tiers: {
56
+ title: "How hard should your agents think?",
57
+ description: "Pick the default for new chats. Anyone can switch a chat's tier as they " +
58
+ "write, and you can change this any time in your org's settings.",
59
+ view: "tiers.setup",
60
+ order: 30,
61
+ roles: ["owner", "admin"],
62
+ },
63
+ },
38
64
  },
39
65
  });
40
66
  export default tiersWeb;