@copilotz/team 1.0.0-rc.53 → 1.0.0-rc.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/WORDS.md +156 -0
- package/package.json +2 -2
- package/team/actions/agent.d.ts +10 -0
- package/team/actions/agent.js +226 -7
- package/team/actions/define.js +7 -3
- package/team/collections/agent.d.ts +52 -7
- package/team/collections/agent.js +56 -5
- package/team/mod.d.ts +7 -0
- package/team/mod.js +14 -1
- package/team/resources/propose.d.ts +1 -0
- package/team/resources/propose.js +97 -0
- package/team/shared/definition.d.ts +1 -1
- package/team/shared/definition.js +5 -4
- package/team/shared/everywhere.d.ts +11 -0
- package/team/shared/everywhere.js +29 -0
- package/team/views/web/agent-add.js +14 -4
- package/team/views/web/agent-describe.d.ts +38 -0
- package/team/views/web/agent-describe.js +44 -0
- package/team/views/web/agent-fields.d.ts +3 -1
- package/team/views/web/agent-fields.js +2 -2
- package/team/views/web/agent-known.js +2 -1
- package/team/views/web/agent-new.d.ts +4 -1
- package/team/views/web/agent-new.js +26 -5
- package/team/views/web/agent-org.d.ts +12 -0
- package/team/views/web/agent-org.js +89 -0
- package/team/views/web/agent.d.ts +7 -4
- package/team/views/web/agent.js +81 -28
- package/team/views/web/model-pick.d.ts +3 -1
- package/team/views/web/model-pick.js +4 -1
- package/team/views/web/style.d.ts +1 -1
- package/team/views/web/style.js +5 -0
- package/team/views/web/words.d.ts +1 -1
- package/team/views/web/words.js +28 -0
- package/team/web.js +2 -0
- package/tiers/actions/choose.d.ts +5 -1
- package/tiers/actions/choose.js +247 -66
- package/tiers/actions/model.js +31 -22
- package/tiers/collections/choice.d.ts +17 -10
- package/tiers/collections/choice.js +39 -27
- package/tiers/collections/template.d.ts +90 -0
- package/tiers/collections/template.js +41 -0
- package/tiers/contract.d.ts +10 -8
- package/tiers/mod.d.ts +30 -21
- package/tiers/mod.js +45 -36
- package/tiers/shared/shown.d.ts +131 -49
- package/tiers/shared/shown.js +192 -98
- package/tiers/shared/tiers.d.ts +105 -62
- package/tiers/shared/tiers.js +127 -86
- package/tiers/views/web/composer.d.ts +12 -0
- package/tiers/views/web/composer.js +79 -0
- package/tiers/views/web/org.d.ts +44 -21
- package/tiers/views/web/org.js +231 -84
- package/tiers/views/web/say.d.ts +138 -0
- package/tiers/views/web/say.js +142 -0
- package/tiers/views/web/setup.d.ts +23 -0
- package/tiers/views/web/setup.js +80 -0
- package/tiers/views/web/space.d.ts +8 -20
- package/tiers/views/web/space.js +30 -59
- package/tiers/views/web/style.d.ts +1 -1
- package/tiers/views/web/style.js +98 -4
- package/tiers/views/web/team.d.ts +38 -0
- package/tiers/views/web/team.js +118 -0
- package/tiers/views/web/words.d.ts +36 -16
- package/tiers/views/web/words.js +102 -35
- package/tiers/web.d.ts +18 -9
- package/tiers/web.js +36 -10
package/tiers/shared/tiers.js
CHANGED
|
@@ -1,26 +1,117 @@
|
|
|
1
|
-
import { agentsOf,
|
|
2
|
-
/** Where a choice is kept
|
|
1
|
+
import { agentsOf, defaults } from "copilotz/plugins/agents/contract";
|
|
2
|
+
/** Where a choice is kept. */
|
|
3
3
|
export const ORG_CHOICE = "org";
|
|
4
4
|
export const spaceChoice = (space) => `space:${space}`;
|
|
5
|
-
|
|
6
|
-
export const
|
|
5
|
+
export const threadChoice = (thread) => `thread:${thread}`;
|
|
6
|
+
export const personChoice = (person) => `person:${person}`;
|
|
7
|
+
/** The app's tiers, as it declares them. */
|
|
8
|
+
export const appTiersOf = (ctx) => (ctx.resources.tiers ?? {});
|
|
9
|
+
/** The app's kinds of work: its tiers' keys, in the order its agents are declared, titled. */
|
|
10
|
+
export function appKindsOf(ctx) {
|
|
11
|
+
const named = (ctx.resources.tierKinds ?? {});
|
|
12
|
+
const agents = agentsOf(ctx);
|
|
13
|
+
const keys = new Set(Object.values(appTiersOf(ctx)).flatMap((t) => Object.keys(t.agents ?? {})));
|
|
14
|
+
const order = [
|
|
15
|
+
...Object.keys(agents).filter((a) => keys.has(a)),
|
|
16
|
+
...[...keys].filter((k) => !agents[k]),
|
|
17
|
+
];
|
|
18
|
+
return Object.fromEntries(order.map((key) => [key, {
|
|
19
|
+
title: named[key]?.title ?? agents[key]?.name ?? key[0].toUpperCase() + key.slice(1),
|
|
20
|
+
...(named[key]?.description ? { description: named[key].description } : {}),
|
|
21
|
+
}]));
|
|
22
|
+
}
|
|
23
|
+
/** Every kind of work: the app's, then those the org added (on an app's kind still there). */
|
|
24
|
+
export function kindsIn(ctx, own) {
|
|
25
|
+
const app = appKindsOf(ctx);
|
|
26
|
+
const added = own.filter((k) => !app[k._id] && app[k.base])
|
|
27
|
+
.sort((a, b) => a.at.localeCompare(b.at) || a._id.localeCompare(b._id));
|
|
28
|
+
return {
|
|
29
|
+
...app,
|
|
30
|
+
...Object.fromEntries(added.map((k) => [k._id, {
|
|
31
|
+
title: k.title,
|
|
32
|
+
...(k.description ? { description: k.description } : {}),
|
|
33
|
+
base: k.base,
|
|
34
|
+
}])),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** The kind an agent works as: what it says (`like`); its own, where tiers name it; else the app's first. */
|
|
38
|
+
export function kindOf(ctx, name, like, kinds) {
|
|
39
|
+
if (like && kinds[like])
|
|
40
|
+
return like;
|
|
41
|
+
if (kinds[name])
|
|
42
|
+
return name;
|
|
43
|
+
const agents = agentsOf(ctx);
|
|
44
|
+
return defaults(agents).find((a) => kinds[a]) ?? Object.keys(kinds)[0];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The org's tiers: the app's as the org keeps them (its version over them,
|
|
48
|
+
* those it took away left out), then those it made; each by its name, in
|
|
49
|
+
* order.
|
|
50
|
+
*/
|
|
51
|
+
export function tiersIn(ctx, templates) {
|
|
52
|
+
const app = appTiersOf(ctx);
|
|
53
|
+
const kept = new Map(templates.map((t) => [t._id, t]));
|
|
54
|
+
const out = [];
|
|
55
|
+
for (const [name, tier] of Object.entries(app)) {
|
|
56
|
+
const mine = kept.get(name);
|
|
57
|
+
if (mine?.off)
|
|
58
|
+
continue;
|
|
59
|
+
const changed = !!mine && (Object.keys(mine.agents ?? {}).length > 0 ||
|
|
60
|
+
mine.title !== undefined || mine.description !== undefined);
|
|
61
|
+
out.push([name, {
|
|
62
|
+
...tier,
|
|
63
|
+
...(mine?.title ? { title: mine.title } : {}),
|
|
64
|
+
...(mine?.description !== undefined ? { description: mine.description } : {}),
|
|
65
|
+
agents: { ...tier.agents, ...mine?.agents },
|
|
66
|
+
app: true,
|
|
67
|
+
...(changed ? { changed: true } : {}),
|
|
68
|
+
}]);
|
|
69
|
+
}
|
|
70
|
+
for (const mine of templates) {
|
|
71
|
+
if (!mine.made || app[mine._id] || mine.off)
|
|
72
|
+
continue;
|
|
73
|
+
out.push([mine._id, {
|
|
74
|
+
title: mine.title ?? mine._id,
|
|
75
|
+
...(mine.description ? { description: mine.description } : {}),
|
|
76
|
+
order: mine.order ?? 1000,
|
|
77
|
+
agents: { ...mine.agents },
|
|
78
|
+
made: true,
|
|
79
|
+
}]);
|
|
80
|
+
}
|
|
81
|
+
return Object.fromEntries(out.sort(([a, x], [b, y]) => (x.order ?? 0) - (y.order ?? 0) || a.localeCompare(b)));
|
|
82
|
+
}
|
|
83
|
+
/** A kind's chain in a tier: its own entry there, else its base kind's. */
|
|
84
|
+
export function entryOf(tier, kind, kinds) {
|
|
85
|
+
if (!tier || !kind)
|
|
86
|
+
return undefined;
|
|
87
|
+
if (tier.agents[kind] !== undefined)
|
|
88
|
+
return tier.agents[kind];
|
|
89
|
+
const base = kinds[kind]?.base;
|
|
90
|
+
return base && tier.agents[base] !== undefined ? tier.agents[base] : undefined;
|
|
91
|
+
}
|
|
7
92
|
/** A tier that's still offered: one that's gone counts as none chosen. */
|
|
8
93
|
const offered = (tiers, name) => name && Object.hasOwn(tiers, name) ? name : undefined;
|
|
9
|
-
/** The tier in force: the
|
|
94
|
+
/** The tier in force, and who chose it: the conversation, the person, the space, the org, the plan. */
|
|
10
95
|
export function tierIn(tiers, levels) {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const plan = offered(tiers, levels.plan);
|
|
96
|
+
for (const by of ["thread", "person", "space", "org"]) {
|
|
97
|
+
const tier = offered(tiers, levels[by]?.tier);
|
|
98
|
+
if (tier)
|
|
99
|
+
return { tier, by };
|
|
100
|
+
}
|
|
101
|
+
const plan = offered(tiers, levels.plan) ?? Object.keys(tiers)[0];
|
|
18
102
|
return plan ? { tier: plan, by: "plan" } : undefined;
|
|
19
103
|
}
|
|
104
|
+
/** Whether a tier is above the highest the org lets its members use (`cap`). */
|
|
105
|
+
export function aboveCap(tiers, tier, cap) {
|
|
106
|
+
if (!cap || !Object.hasOwn(tiers, cap) || !Object.hasOwn(tiers, tier))
|
|
107
|
+
return false;
|
|
108
|
+
const names = Object.keys(tiers);
|
|
109
|
+
return names.indexOf(tier) > names.indexOf(cap);
|
|
110
|
+
}
|
|
20
111
|
/** A model, as a list: what's tried in order. */
|
|
21
|
-
const listOf = (ref) => Array.isArray(ref) ? ref : [ref];
|
|
112
|
+
export const listOf = (ref) => Array.isArray(ref) ? ref : [ref];
|
|
22
113
|
/** The model a ref tries first, as `"provider/model"` when it says so plainly. */
|
|
23
|
-
const firstId = (ref) => {
|
|
114
|
+
export const firstId = (ref) => {
|
|
24
115
|
const first = listOf(ref)[0];
|
|
25
116
|
if (typeof first === "string")
|
|
26
117
|
return first;
|
|
@@ -29,58 +120,9 @@ const firstId = (ref) => {
|
|
|
29
120
|
}
|
|
30
121
|
return undefined;
|
|
31
122
|
};
|
|
32
|
-
/**
|
|
33
|
-
* Which model one of the app's agents thinks with, and where it comes from,
|
|
34
|
-
* the first that applies: the space's pick for it, the space's tier, the
|
|
35
|
-
* org's pick, the org's tier, the plan's tier. A tier that doesn't name the
|
|
36
|
-
* agent leaves it on its own model; so does nothing chosen (`model` null).
|
|
37
|
-
* A pick keeps the list it stands in front of behind it (the tier in force
|
|
38
|
-
* below it, or the agent's own), so a model that fails falls back as before;
|
|
39
|
-
* `carried` gives it that entry's settings. An agent that isn't the app's is
|
|
40
|
-
* none of this: null.
|
|
41
|
-
*/
|
|
42
|
-
export function resolve(ctx, agent, levels) {
|
|
43
|
-
const tiers = tiersOf(ctx);
|
|
44
|
-
const own = agentsOf(ctx)[agent];
|
|
45
|
-
if (!own)
|
|
46
|
-
return { model: null, from: { by: "app" } };
|
|
47
|
-
const below = (from) => {
|
|
48
|
-
const rest = from === "space" ? levels : { ...levels, space: null };
|
|
49
|
-
const tier = tierIn(tiers, rest);
|
|
50
|
-
return tier && Object.hasOwn(tiers[tier.tier].agents, agent)
|
|
51
|
-
? { list: tiers[tier.tier].agents[agent], tier: tier.tier }
|
|
52
|
-
: { list: modelOf(own) };
|
|
53
|
-
};
|
|
54
|
-
for (const by of ["space", "org"]) {
|
|
55
|
-
const choice = levels[by];
|
|
56
|
-
const pick = choice?.custom?.[agent];
|
|
57
|
-
if (pick !== undefined) {
|
|
58
|
-
const { list, tier } = below(by);
|
|
59
|
-
const picked = firstId(pick);
|
|
60
|
-
const behind = listOf(list).filter((ref) => !picked || firstId(ref) !== picked);
|
|
61
|
-
return {
|
|
62
|
-
model: [...listOf(pick), ...behind],
|
|
63
|
-
from: { by, custom: true, ...(tier ? { tier } : {}) },
|
|
64
|
-
pick: { ref: pick, replaces: listOf(list)[0], behind },
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
const tier = offered(tiers, choice?.tier);
|
|
68
|
-
if (tier) {
|
|
69
|
-
return Object.hasOwn(tiers[tier].agents, agent)
|
|
70
|
-
? { model: tiers[tier].agents[agent], from: { by, tier } }
|
|
71
|
-
: { model: null, from: { by: "app" } };
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
const plan = offered(tiers, levels.plan);
|
|
75
|
-
if (plan && Object.hasOwn(tiers[plan].agents, agent)) {
|
|
76
|
-
return { model: tiers[plan].agents[agent], from: { by: "plan", tier: plan } };
|
|
77
|
-
}
|
|
78
|
-
return { model: null, from: { by: "app" } };
|
|
79
|
-
}
|
|
80
123
|
/**
|
|
81
124
|
* The model a ref tries first, with the effort and most tokens it's asked
|
|
82
|
-
* for, following aliases (`resources.model`): what a page shows of it
|
|
83
|
-
* what a pick carries over.
|
|
125
|
+
* for, following aliases (`resources.model`): what a page shows of it.
|
|
84
126
|
*/
|
|
85
127
|
export function primaryOf(ctx, ref, outer = {}, seen = []) {
|
|
86
128
|
if (Array.isArray(ref))
|
|
@@ -103,27 +145,26 @@ export function primaryOf(ctx, ref, outer = {}, seen = []) {
|
|
|
103
145
|
}, seen);
|
|
104
146
|
}
|
|
105
147
|
/**
|
|
106
|
-
*
|
|
107
|
-
* its `maxTokens`, and its `effort`
|
|
108
|
-
* (the catalog's, `models.efforts`)
|
|
109
|
-
*
|
|
110
|
-
* pick sets itself wins.
|
|
148
|
+
* A chain someone set on a page (each entry a model), with what the chain it
|
|
149
|
+
* replaces sets on its first entry: its `maxTokens`, and its `effort` where
|
|
150
|
+
* each model takes it and none was said (the catalog's, `models.efforts`).
|
|
151
|
+
* So a chain set by hand isn't cut short by an adapter's default.
|
|
111
152
|
*/
|
|
112
|
-
export async function
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
153
|
+
export async function settled(ctx, chain, like) {
|
|
154
|
+
const from = like ? primaryOf(ctx, like) : undefined;
|
|
155
|
+
return await Promise.all(chain.map(async (entry) => {
|
|
156
|
+
const picked = primaryOf(ctx, entry);
|
|
157
|
+
if (!picked || !from)
|
|
158
|
+
return entry;
|
|
159
|
+
const levels = from.effort && !picked.effort
|
|
160
|
+
? await ctx.call("models.efforts", { model: picked.id }).catch(() => null)
|
|
161
|
+
: null;
|
|
162
|
+
const settings = {
|
|
163
|
+
...(from.maxTokens !== undefined && picked.maxTokens === undefined
|
|
164
|
+
? { maxTokens: from.maxTokens }
|
|
165
|
+
: {}),
|
|
166
|
+
...(from.effort && levels?.includes(from.effort) ? { effort: from.effort } : {}),
|
|
167
|
+
};
|
|
168
|
+
return Object.keys(settings).length ? { model: entry, ...settings } : entry;
|
|
169
|
+
}));
|
|
129
170
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The tier beside the send button (kind `tiers.composer`, chat's
|
|
3
|
+
* `composerControls`, hints `{ thread?, in? }`): what what's sent runs on,
|
|
4
|
+
* with what a typical message comes to. In a conversation, choosing one sets
|
|
5
|
+
* that conversation's tier (`tiers.choose { thread }`), for everyone in it;
|
|
6
|
+
* on home, the person's own default for new chats (`{ mine }`). Each tier
|
|
7
|
+
* says its price; one over the org's cap is out of reach for those who don't
|
|
8
|
+
* run it, and says who sets it. Back to the default where one was chosen.
|
|
9
|
+
*/
|
|
10
|
+
import { type ReactNode } from "react";
|
|
11
|
+
import type { ViewContext } from "copilotz";
|
|
12
|
+
export declare const tiersComposerView: (_: unknown, ctx: ViewContext<ReactNode>) => ReactNode;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* The tier beside the send button (kind `tiers.composer`, chat's
|
|
4
|
+
* `composerControls`, hints `{ thread?, in? }`): what what's sent runs on,
|
|
5
|
+
* with what a typical message comes to. In a conversation, choosing one sets
|
|
6
|
+
* that conversation's tier (`tiers.choose { thread }`), for everyone in it;
|
|
7
|
+
* on home, the person's own default for new chats (`{ mine }`). Each tier
|
|
8
|
+
* says its price; one over the org's cap is out of reach for those who don't
|
|
9
|
+
* run it, and says who sets it. Back to the default where one was chosen.
|
|
10
|
+
*/
|
|
11
|
+
import { useState } from "react";
|
|
12
|
+
import { Menu, toast } from "copilotz/web";
|
|
13
|
+
import { runs, useStanding } from "copilotz/plugins/interfaces/contract";
|
|
14
|
+
import { STYLE } from "./style.js";
|
|
15
|
+
import { say } from "./say.js";
|
|
16
|
+
import { bySaid, perReply, shownSaid } from "./words.js";
|
|
17
|
+
export const tiersComposerView = (_, ctx) => {
|
|
18
|
+
const thread = typeof ctx.hints.thread === "string" ? ctx.hints.thread : undefined;
|
|
19
|
+
const space = typeof ctx.hints.in === "string" ? ctx.hints.in : undefined;
|
|
20
|
+
const shown = shownSaid(ctx.db.collection("modelChoice").query("offered", {
|
|
21
|
+
...(space ? { space } : {}),
|
|
22
|
+
...(thread ? { thread } : {}),
|
|
23
|
+
}).value);
|
|
24
|
+
if (!shown?.tiers.length || !shown.now)
|
|
25
|
+
return null;
|
|
26
|
+
return (_jsxs(_Fragment, { children: [_jsx("style", { href: "tiers-web", precedence: "copilotz", children: STYLE }), _jsx(TierPick, { shown: shown, thread: thread, call: ctx.call })] }));
|
|
27
|
+
};
|
|
28
|
+
function TierPick({ shown, thread, call }) {
|
|
29
|
+
const standing = useStanding(call);
|
|
30
|
+
const [busy, setBusy] = useState(false);
|
|
31
|
+
const free = !!standing && runs(standing);
|
|
32
|
+
const now = shown.now;
|
|
33
|
+
const tier = shown.tiers.find((t) => t.name === now.tier);
|
|
34
|
+
const capIndex = shown.org.cap ? shown.tiers.findIndex((t) => t.name === shown.org.cap) : -1;
|
|
35
|
+
const capTitle = capIndex >= 0 ? shown.tiers[capIndex].title : undefined;
|
|
36
|
+
// What's been chosen right here: the conversation's, or on home the person's own.
|
|
37
|
+
const own = thread ? shown.thread?.tier : shown.person.tier;
|
|
38
|
+
const choose = async (name) => {
|
|
39
|
+
setBusy(true);
|
|
40
|
+
try {
|
|
41
|
+
await call("tiers.choose", { tier: name, ...(thread ? { thread } : { mine: true }) });
|
|
42
|
+
const title = shown.tiers.find((t) => t.name === name)?.title;
|
|
43
|
+
toast(thread
|
|
44
|
+
? title ? say("chatRunsOn", { tier: title }) : say("chatRunsDefault")
|
|
45
|
+
: title
|
|
46
|
+
? say("newChatsOn", { tier: title })
|
|
47
|
+
: say("newChatsDefault"));
|
|
48
|
+
}
|
|
49
|
+
catch (e) {
|
|
50
|
+
toast(e.message, { tone: "destructive" });
|
|
51
|
+
}
|
|
52
|
+
finally {
|
|
53
|
+
setBusy(false);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const items = [
|
|
57
|
+
...shown.tiers.map((t, i) => {
|
|
58
|
+
const price = perReply(t.price);
|
|
59
|
+
const over = !free && capIndex >= 0 && i > capIndex;
|
|
60
|
+
return {
|
|
61
|
+
label: `${t.title}${price ? ` · ${price}` : ""}`,
|
|
62
|
+
...(t.name === now.tier ? { icon: "check" } : {}),
|
|
63
|
+
...(over ? { disabled: true } : {}),
|
|
64
|
+
onSelect: () => void choose(t.name),
|
|
65
|
+
};
|
|
66
|
+
}),
|
|
67
|
+
...(own
|
|
68
|
+
? [
|
|
69
|
+
"separator",
|
|
70
|
+
{
|
|
71
|
+
label: thread ? say("backToDefault") : say("backToOrgDefault"),
|
|
72
|
+
onSelect: () => void choose(null),
|
|
73
|
+
},
|
|
74
|
+
]
|
|
75
|
+
: []),
|
|
76
|
+
];
|
|
77
|
+
const price = perReply(tier?.price);
|
|
78
|
+
return (_jsx("span", { className: "tiers-pick", "aria-busy": busy || undefined, children: _jsx(Menu, { label: `${say("pickLabel", { tier: tier?.title ?? now.tier, by: bySaid(now.by) })}${capTitle && !free ? `. ${say("pickCap", { cap: capTitle })}` : ""}`, text: `${tier?.title ?? now.tier}${price ? ` · ${price}` : ""}`, icon: "sparkles", variant: "ghost", size: "sm", side: "top", align: "end", items: items }) }));
|
|
79
|
+
}
|
package/tiers/views/web/org.d.ts
CHANGED
|
@@ -1,38 +1,61 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The org's agents
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
2
|
+
* The org's agents (kind `tiers.org`, the org page's Agents section, the web
|
|
3
|
+
* shell's `orgSettings`, at `/org?tab=models`): how hard they think, then who
|
|
4
|
+
* they are.
|
|
5
|
+
*
|
|
6
|
+
* - **The tiers**, as cards side by side: each its name, what it's good for,
|
|
7
|
+
* what a typical message comes to at this org's prices and how far the
|
|
8
|
+
* plan's credits go, and each kind of work's model; the org's default
|
|
9
|
+
* outlined. Owners and admins make one the default in a click (Undo right
|
|
10
|
+
* after), customize one (a dialog: each kind of work's model and what it
|
|
11
|
+
* falls back to, its name), duplicate one into a new tier, make one from
|
|
12
|
+
* nothing, take one away or put it back as it was, and set the highest
|
|
13
|
+
* tier members may choose. On a plan of credits given once, a heavier
|
|
14
|
+
* default says how much faster it spends them.
|
|
15
|
+
* - **The team** (team.tsx): the agents every space starts with.
|
|
16
|
+
*
|
|
17
|
+
* Anyone else reads it, and is told who changes it. Everything shown is a
|
|
18
|
+
* watched read (`modelChoice.offered`), so a change shows at once.
|
|
14
19
|
*/
|
|
15
20
|
import { type ReactNode } from "react";
|
|
16
21
|
import type { ViewContext } from "copilotz";
|
|
17
|
-
import type { Shown, TierShown } from "../../contract.js";
|
|
22
|
+
import type { ModelShown, Shown, TierShown } from "../../contract.js";
|
|
23
|
+
import { type TeamAgent } from "./team.js";
|
|
18
24
|
type Call = <R = unknown>(action: string, input?: unknown) => Promise<R>;
|
|
19
25
|
export declare const tiersOrgView: (_: unknown, ctx: ViewContext<ReactNode>) => ReactNode;
|
|
20
|
-
export declare function
|
|
26
|
+
export declare function OrgAgents({ shown, team, may, org, call }: {
|
|
21
27
|
shown: Shown;
|
|
28
|
+
team?: TeamAgent[];
|
|
22
29
|
may: boolean;
|
|
30
|
+
/** The org's name; none for a person's own. */
|
|
23
31
|
org?: string;
|
|
24
32
|
call: Call;
|
|
25
33
|
}): ReactNode;
|
|
26
|
-
/**
|
|
27
|
-
|
|
34
|
+
/**
|
|
35
|
+
* What the tier in use means for the plan's credits, when it's worth saying: a
|
|
36
|
+
* plan of credits given once (a trial's) spent faster than the cheapest tier
|
|
37
|
+
* would, or a plan that gives none.
|
|
38
|
+
*/
|
|
39
|
+
export declare function SpendNote({ shown, tier }: {
|
|
40
|
+
shown: Shown;
|
|
41
|
+
tier?: string;
|
|
42
|
+
}): ReactNode;
|
|
43
|
+
/** A tier: what it's for, what a message comes to, each kind of work's model, and choosing it. */
|
|
44
|
+
export declare function TierCard({ tier, shown, current, may, busy, onChoose, onEdit, onCopy, onRemove, onRestore }: {
|
|
28
45
|
tier: TierShown;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
plan: boolean;
|
|
46
|
+
shown: Shown;
|
|
47
|
+
/** It's the org's default. */
|
|
48
|
+
current: boolean;
|
|
33
49
|
may: boolean;
|
|
34
50
|
busy?: string;
|
|
35
|
-
agents: Shown["agents"];
|
|
36
51
|
onChoose(): void;
|
|
52
|
+
onEdit(): void;
|
|
53
|
+
onCopy(): void;
|
|
54
|
+
onRemove(): void;
|
|
55
|
+
onRestore(): void;
|
|
37
56
|
}): ReactNode;
|
|
57
|
+
/** What a model falls back to, each name once: "GPT-6 Luna, Claude Haiku 5.5". */
|
|
58
|
+
export declare function thenSaid(model: ModelShown): string | undefined;
|
|
59
|
+
/** A model as a short line: "Claude Haiku 5.5, low effort, then GPT-6 Luna". */
|
|
60
|
+
export declare const modelLine: (model: ModelShown) => string;
|
|
38
61
|
export {};
|