@pairz/team 1.0.0-rc.81 → 1.0.0-rc.83
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/README.md +9 -4
- package/WORDS.md +23 -2
- package/package.json +2 -2
- package/team/actions/agent.js +12 -4
- package/team/collections/agent.d.ts +70 -15
- package/team/collections/agent.js +29 -7
- package/team/shared/definition.d.ts +15 -0
- package/team/shared/definition.js +17 -1
- package/team/views/web/model-pick.d.ts +10 -1
- package/team/views/web/model-pick.js +4 -2
- package/team/views/web/model-picker.d.ts +31 -5
- package/team/views/web/model-picker.js +74 -30
- package/team/views/web/words.d.ts +1 -1
- package/team/views/web/words.js +7 -0
- package/tiers/actions/choose.d.ts +48 -1
- package/tiers/actions/choose.js +143 -57
- package/tiers/actions/model.js +14 -9
- package/tiers/collections/choice.d.ts +15 -8
- package/tiers/collections/choice.js +22 -12
- package/tiers/collections/template.d.ts +6 -1
- package/tiers/collections/template.js +8 -4
- package/tiers/contract.d.ts +2 -2
- package/tiers/mod.d.ts +17 -9
- package/tiers/mod.js +26 -12
- package/tiers/shared/plans.d.ts +31 -33
- package/tiers/shared/plans.js +39 -54
- package/tiers/shared/shown.d.ts +16 -3
- package/tiers/shared/shown.js +43 -15
- package/tiers/shared/tiers.d.ts +38 -5
- package/tiers/shared/tiers.js +29 -3
- package/tiers/views/web/composer.d.ts +2 -1
- package/tiers/views/web/composer.js +8 -2
- package/tiers/views/web/org.d.ts +46 -11
- package/tiers/views/web/org.js +144 -61
- package/tiers/views/web/say.d.ts +17 -2
- package/tiers/views/web/say.js +17 -2
- package/tiers/views/web/space.d.ts +2 -1
- package/tiers/views/web/space.js +8 -4
- package/tiers/views/web/style.d.ts +1 -1
- package/tiers/views/web/style.js +5 -0
- package/tiers/web.d.ts +6 -5
- package/tiers/web.js +9 -8
package/tiers/shared/shown.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { agentsOf } from "pairz/plugins/agents/contract";
|
|
2
2
|
import { personOf } from "pairz";
|
|
3
|
-
import { plansFor } from "./plans.js";
|
|
4
|
-
import { entryOf, kindOf, kindsIn, ORG_CHOICE, personChoice, primaryOf, spaceChoice, threadChoice, tierIn, tiersIn, } from "./tiers.js";
|
|
3
|
+
import { harnessesOf, plansFor } from "./plans.js";
|
|
4
|
+
import { entryOf, kindOf, kindsIn, onPlans, ORG_CHOICE, personChoice, primaryOf, spaceChoice, threadChoice, tierIn, tiersIn, } from "./tiers.js";
|
|
5
5
|
/** A typical reply's tokens, where the app measured no message (see above). */
|
|
6
6
|
export const REPLY = { input: 20_000, cached: 16_000, output: 1_000 };
|
|
7
7
|
/** The org's tiers and kinds, as it keeps them. */
|
|
@@ -47,6 +47,13 @@ const entriesOf = (ctx, ref) => (Array.isArray(ref) ? ref : [ref]).flatMap((entr
|
|
|
47
47
|
const found = primaryOf(ctx, entry);
|
|
48
48
|
return found ? [found] : [];
|
|
49
49
|
});
|
|
50
|
+
/** What the models plugin offers of each model (its name, whether an org's key pays), each asked once. */
|
|
51
|
+
async function offeredOf(ctx, ids) {
|
|
52
|
+
const unique = [...new Set(ids)];
|
|
53
|
+
const offered = await Promise.all(unique.map((model) => ctx.call("models.offered", { model })
|
|
54
|
+
.then((answer) => answer.model, () => null)));
|
|
55
|
+
return new Map(unique.map((id, i) => [id, offered[i]]));
|
|
56
|
+
}
|
|
50
57
|
/**
|
|
51
58
|
* For each use, the plan of the person's (`theirs`) its chain would run on
|
|
52
59
|
* first, as their turns try it (`models.check`), when it's a plan; each
|
|
@@ -54,17 +61,18 @@ const entriesOf = (ctx, ref) => (Array.isArray(ref) ? ref : [ref]).flatMap((entr
|
|
|
54
61
|
*/
|
|
55
62
|
async function planFirsts(ctx, uses, theirs) {
|
|
56
63
|
const asked = new Map();
|
|
57
|
-
const firstOf = (
|
|
58
|
-
const
|
|
64
|
+
const firstOf = (use) => {
|
|
65
|
+
const model = { model: use.ref, ...theirs, ...use.plans };
|
|
66
|
+
const key = JSON.stringify(model);
|
|
59
67
|
let found = asked.get(key);
|
|
60
68
|
if (!found) {
|
|
61
|
-
found = ctx.call("models.check", { model
|
|
69
|
+
found = ctx.call("models.check", { model, port: "llm" })
|
|
62
70
|
.then((tried) => tried[0], () => undefined);
|
|
63
71
|
asked.set(key, found);
|
|
64
72
|
}
|
|
65
73
|
return found;
|
|
66
74
|
};
|
|
67
|
-
const firsts = await Promise.all(uses.map(
|
|
75
|
+
const firsts = await Promise.all(uses.map(firstOf));
|
|
68
76
|
return firsts.map((id) => id && theirs.harnesses.includes(id.slice(0, id.indexOf("/"))) ? id : undefined);
|
|
69
77
|
}
|
|
70
78
|
/**
|
|
@@ -80,10 +88,7 @@ async function modelsShown(ctx, uses, theirs = { harnesses: [] }) {
|
|
|
80
88
|
const typical = typicalOf(ctx);
|
|
81
89
|
const lists = uses.map((use) => entriesOf(ctx, use.ref));
|
|
82
90
|
const firsts = theirs.harnesses.length ? planFirsts(ctx, uses, theirs) : undefined;
|
|
83
|
-
const
|
|
84
|
-
const offered = await Promise.all(ids.map((model) => ctx.call("models.offered", { model })
|
|
85
|
-
.then((answer) => answer.model, () => null)));
|
|
86
|
-
const known = new Map(ids.map((id, i) => [id, offered[i]]));
|
|
91
|
+
const known = await offeredOf(ctx, lists.flat().map((entry) => entry.id));
|
|
87
92
|
const declared = (ctx.resources.provider ?? {});
|
|
88
93
|
// What one call is charged: each agent's (a plain reply's, without a measured message).
|
|
89
94
|
const callOf = (agent) => {
|
|
@@ -177,11 +182,18 @@ export async function shownAt(ctx, where = {}) {
|
|
|
177
182
|
// Every tier's chain for every kind, asked for at once, and taken back in the same order.
|
|
178
183
|
const uses = list.flatMap(([, tier]) => kindNames.flatMap((kind) => {
|
|
179
184
|
const ref = entryOf(tier, kind, kinds);
|
|
180
|
-
return ref === undefined
|
|
185
|
+
return ref === undefined
|
|
186
|
+
? []
|
|
187
|
+
: [{ ref, agent: kinds[kind].base ?? kind, plans: onPlans(levels.org, tier) }];
|
|
181
188
|
}));
|
|
182
|
-
// The person's plans they can run now
|
|
183
|
-
const theirs = person ? await plansFor(ctx
|
|
184
|
-
|
|
189
|
+
// The person's plans they can run now: what their turns go with.
|
|
190
|
+
const theirs = person ? await plansFor(ctx) : { harnesses: [] };
|
|
191
|
+
// Each tier's fallbacks on members' plans, by name.
|
|
192
|
+
const fallbacks = Object.fromEntries(list.map(([name, tier]) => [name, entriesOf(ctx, tier.fallbacks ?? [])]));
|
|
193
|
+
const [shown, named] = await Promise.all([
|
|
194
|
+
modelsShown(ctx, uses, theirs),
|
|
195
|
+
offeredOf(ctx, Object.values(fallbacks).flat().map((entry) => entry.id)),
|
|
196
|
+
]);
|
|
185
197
|
let cursor = 0;
|
|
186
198
|
const tiersShown = list.map(([name, tier]) => {
|
|
187
199
|
const own = kindNames.flatMap((kind) => entryOf(tier, kind, kinds) === undefined ? [] : [{ kind, model: shown[cursor++] }]).filter((k) => !!k.model);
|
|
@@ -200,6 +212,15 @@ export async function shownAt(ctx, where = {}) {
|
|
|
200
212
|
...(tier.changed ? { changed: true } : {}),
|
|
201
213
|
...(tier.made ? { made: true } : {}),
|
|
202
214
|
kinds: own,
|
|
215
|
+
...(tier.fallbacks
|
|
216
|
+
? {
|
|
217
|
+
fallbacks: fallbacks[name].map((entry) => ({
|
|
218
|
+
id: entry.id,
|
|
219
|
+
name: named.get(entry.id)?.name ?? entry.id.slice(entry.id.indexOf("/") + 1),
|
|
220
|
+
...(entry.effort ? { effort: entry.effort } : {}),
|
|
221
|
+
})),
|
|
222
|
+
}
|
|
223
|
+
: {}),
|
|
203
224
|
};
|
|
204
225
|
});
|
|
205
226
|
const offered = (name) => name && tiers[name] ? name : null;
|
|
@@ -223,7 +244,14 @@ export async function shownAt(ctx, where = {}) {
|
|
|
223
244
|
removed: templates.filter((t) => t.off && app[t._id])
|
|
224
245
|
.map((t) => ({ name: t._id, title: app[t._id].title })),
|
|
225
246
|
plan: offered(levels.plan),
|
|
226
|
-
org: {
|
|
247
|
+
org: {
|
|
248
|
+
tier: offered(levels.org?.tier),
|
|
249
|
+
cap: offered(levels.org?.cap),
|
|
250
|
+
fixed: levels.org?.fixed === true,
|
|
251
|
+
...(Object.keys(harnessesOf(ctx)).length
|
|
252
|
+
? { plansFirst: levels.org?.plansFirst === true }
|
|
253
|
+
: {}),
|
|
254
|
+
},
|
|
227
255
|
...(where.space ? { space: { tier: offered(levels.space?.tier) } } : {}),
|
|
228
256
|
...(where.thread ? { thread: { tier: offered(levels.thread?.tier) } } : {}),
|
|
229
257
|
person: { tier: offered(levels.person?.tier) },
|
package/tiers/shared/tiers.d.ts
CHANGED
|
@@ -16,7 +16,15 @@
|
|
|
16
16
|
* base kind's chain there.
|
|
17
17
|
* - **Which tier a turn uses**, the first that applies: the conversation's,
|
|
18
18
|
* the person's own default for new chats, the space's, the org's, the
|
|
19
|
-
* plan's (`modelChoice`)
|
|
19
|
+
* plan's (`modelChoice`); only the org's and the plan's when the org uses
|
|
20
|
+
* its default alone (`fixed`).
|
|
21
|
+
* - **In order:** the app's tiers by their `order`, an org's own order over
|
|
22
|
+
* it (`tiers.order`); a cap is "up to" a tier in that order.
|
|
23
|
+
* - **On members' plans:** a turn runs each model of its chain on the
|
|
24
|
+
* person's plans that run it, then on credits, model by model; where the
|
|
25
|
+
* org uses their subscriptions whenever possible (`plansFirst`), every
|
|
26
|
+
* model on their plans before any credits, then the tier's `fallbacks` on
|
|
27
|
+
* their plans only (`onPlans`).
|
|
20
28
|
*/
|
|
21
29
|
import type { Resources } from "pairz";
|
|
22
30
|
import type { ModelRef } from "pairz/plugins/models/contract";
|
|
@@ -29,6 +37,13 @@ export type Tier = {
|
|
|
29
37
|
order?: number;
|
|
30
38
|
/** Each kind of work's chain, by kind, as an agent's `model` takes it. */
|
|
31
39
|
agents: Record<string, ModelRef>;
|
|
40
|
+
/**
|
|
41
|
+
* Where the org uses members' subscriptions whenever possible: models
|
|
42
|
+
* tried after any agent's chain, on the member's plans only, never on
|
|
43
|
+
* credits; one per maker (`["anthropic/claude-opus-5-5",
|
|
44
|
+
* "openai/gpt-6.2-sol", …]`), each as a chain's entry (settings allowed).
|
|
45
|
+
*/
|
|
46
|
+
fallbacks?: ModelRef[];
|
|
32
47
|
};
|
|
33
48
|
/** A tier as the org has it: the app's (as it is, or `changed`), or one the org `made`. */
|
|
34
49
|
export type OrgTier = Tier & {
|
|
@@ -43,6 +58,8 @@ export type Template = {
|
|
|
43
58
|
description?: string;
|
|
44
59
|
order?: number;
|
|
45
60
|
agents?: Record<string, ModelRef>;
|
|
61
|
+
/** Its fallbacks on members' plans, over the app's. */
|
|
62
|
+
fallbacks?: ModelRef[];
|
|
46
63
|
/** One of the app's the org took away. */
|
|
47
64
|
off?: boolean;
|
|
48
65
|
/** One the org made. */
|
|
@@ -64,13 +81,15 @@ export type OrgKind = {
|
|
|
64
81
|
at: string;
|
|
65
82
|
};
|
|
66
83
|
/**
|
|
67
|
-
* What a level chose: a tier by its name; the org's also
|
|
68
|
-
*
|
|
84
|
+
* What a level chose: a tier by its name; the org's also what its members
|
|
85
|
+
* may use: tiers up to one (`cap`), or only its default (`fixed`); and
|
|
86
|
+
* whether their subscriptions are used whenever possible (`plansFirst`).
|
|
69
87
|
*/
|
|
70
88
|
export type Choice = {
|
|
71
89
|
tier?: string;
|
|
72
90
|
cap?: string;
|
|
73
|
-
|
|
91
|
+
fixed?: boolean;
|
|
92
|
+
plansFirst?: boolean;
|
|
74
93
|
};
|
|
75
94
|
/** Where a choice is kept. */
|
|
76
95
|
export declare const ORG_CHOICE = "org";
|
|
@@ -113,11 +132,25 @@ export declare function tiersIn(ctx: {
|
|
|
113
132
|
}, templates: Template[]): Record<string, OrgTier>;
|
|
114
133
|
/** A kind's chain in a tier: its own entry there, else its base kind's. */
|
|
115
134
|
export declare function entryOf(tier: Tier | undefined, kind: string | undefined, kinds: Record<string, Kind>): ModelRef | undefined;
|
|
116
|
-
/**
|
|
135
|
+
/**
|
|
136
|
+
* The tier in force, and who chose it: the conversation, the person, the
|
|
137
|
+
* space, the org, the plan; only the org and the plan where the org uses its
|
|
138
|
+
* default alone (`fixed`).
|
|
139
|
+
*/
|
|
117
140
|
export declare function tierIn(tiers: Record<string, unknown>, levels: Levels): {
|
|
118
141
|
tier: string;
|
|
119
142
|
by: By;
|
|
120
143
|
} | undefined;
|
|
144
|
+
/**
|
|
145
|
+
* How a tier's chains go with a member's plans, as the org says: where it
|
|
146
|
+
* uses their subscriptions whenever possible, every model on their plans
|
|
147
|
+
* first, then the tier's fallbacks on their plans only (the models plugin's
|
|
148
|
+
* `plansFirst` and `planFallbacks`); else nothing, model by model.
|
|
149
|
+
*/
|
|
150
|
+
export declare function onPlans(org: Choice | null | undefined, tier: Tier | undefined): {
|
|
151
|
+
plansFirst?: true;
|
|
152
|
+
planFallbacks?: ModelRef[];
|
|
153
|
+
};
|
|
121
154
|
/** Whether a tier is above the highest the org lets its members use (`cap`). */
|
|
122
155
|
export declare function aboveCap(tiers: Record<string, unknown>, tier: string, cap?: string): boolean;
|
|
123
156
|
/** A model, as a list: what's tried in order. */
|
package/tiers/shared/tiers.js
CHANGED
|
@@ -57,12 +57,16 @@ export function tiersIn(ctx, templates) {
|
|
|
57
57
|
if (mine?.off)
|
|
58
58
|
continue;
|
|
59
59
|
const changed = !!mine && (Object.keys(mine.agents ?? {}).length > 0 ||
|
|
60
|
-
mine.title !== undefined || mine.description !== undefined);
|
|
60
|
+
mine.title !== undefined || mine.description !== undefined || !!mine.fallbacks);
|
|
61
|
+
const fallbacks = mine?.fallbacks ?? tier.fallbacks;
|
|
61
62
|
out.push([name, {
|
|
62
63
|
...tier,
|
|
64
|
+
// The org's place for it, over the app's.
|
|
65
|
+
...(mine?.order !== undefined ? { order: mine.order } : {}),
|
|
63
66
|
...(mine?.title ? { title: mine.title } : {}),
|
|
64
67
|
...(mine?.description !== undefined ? { description: mine.description } : {}),
|
|
65
68
|
agents: { ...tier.agents, ...mine?.agents },
|
|
69
|
+
...(fallbacks ? { fallbacks } : {}),
|
|
66
70
|
app: true,
|
|
67
71
|
...(changed ? { changed: true } : {}),
|
|
68
72
|
}]);
|
|
@@ -75,6 +79,7 @@ export function tiersIn(ctx, templates) {
|
|
|
75
79
|
...(mine.description ? { description: mine.description } : {}),
|
|
76
80
|
order: mine.order ?? 1000,
|
|
77
81
|
agents: { ...mine.agents },
|
|
82
|
+
...(mine.fallbacks ? { fallbacks: mine.fallbacks } : {}),
|
|
78
83
|
made: true,
|
|
79
84
|
}]);
|
|
80
85
|
}
|
|
@@ -89,11 +94,18 @@ export function entryOf(tier, kind, kinds) {
|
|
|
89
94
|
const base = kinds[kind]?.base;
|
|
90
95
|
return base && tier.agents[base] !== undefined ? tier.agents[base] : undefined;
|
|
91
96
|
}
|
|
97
|
+
/** The levels that choose a tier, first first, above the plan's. */
|
|
98
|
+
const LEVELS = ["thread", "person", "space", "org"];
|
|
92
99
|
/** A tier that's still offered: one that's gone counts as none chosen. */
|
|
93
100
|
const offered = (tiers, name) => name && Object.hasOwn(tiers, name) ? name : undefined;
|
|
94
|
-
/**
|
|
101
|
+
/**
|
|
102
|
+
* The tier in force, and who chose it: the conversation, the person, the
|
|
103
|
+
* space, the org, the plan; only the org and the plan where the org uses its
|
|
104
|
+
* default alone (`fixed`).
|
|
105
|
+
*/
|
|
95
106
|
export function tierIn(tiers, levels) {
|
|
96
|
-
|
|
107
|
+
const levelsNow = levels.org?.fixed ? ["org"] : LEVELS;
|
|
108
|
+
for (const by of levelsNow) {
|
|
97
109
|
const tier = offered(tiers, levels[by]?.tier);
|
|
98
110
|
if (tier)
|
|
99
111
|
return { tier, by };
|
|
@@ -101,6 +113,20 @@ export function tierIn(tiers, levels) {
|
|
|
101
113
|
const plan = offered(tiers, levels.plan) ?? Object.keys(tiers)[0];
|
|
102
114
|
return plan ? { tier: plan, by: "plan" } : undefined;
|
|
103
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* How a tier's chains go with a member's plans, as the org says: where it
|
|
118
|
+
* uses their subscriptions whenever possible, every model on their plans
|
|
119
|
+
* first, then the tier's fallbacks on their plans only (the models plugin's
|
|
120
|
+
* `plansFirst` and `planFallbacks`); else nothing, model by model.
|
|
121
|
+
*/
|
|
122
|
+
export function onPlans(org, tier) {
|
|
123
|
+
if (!org?.plansFirst)
|
|
124
|
+
return {};
|
|
125
|
+
return {
|
|
126
|
+
plansFirst: true,
|
|
127
|
+
...(tier?.fallbacks?.length ? { planFallbacks: tier.fallbacks } : {}),
|
|
128
|
+
};
|
|
129
|
+
}
|
|
104
130
|
/** Whether a tier is above the highest the org lets its members use (`cap`). */
|
|
105
131
|
export function aboveCap(tiers, tier, cap) {
|
|
106
132
|
if (!cap || !Object.hasOwn(tiers, cap) || !Object.hasOwn(tiers, tier))
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* (`tiers.choose { thread }`), for everyone in it; on home, the person's own
|
|
8
8
|
* default for new chats (`{ mine }`). Each tier says its price; one over the
|
|
9
9
|
* org's cap is out of reach for those who don't run it, and says who sets
|
|
10
|
-
* it. Back to the default where one was chosen.
|
|
10
|
+
* it. Back to the default where one was chosen. Where the org uses only its
|
|
11
|
+
* default, it just says the tier: there's nothing to switch.
|
|
11
12
|
*/
|
|
12
13
|
import { type ReactNode } from "react";
|
|
13
14
|
import type { ViewContext } from "pairz";
|
|
@@ -8,7 +8,8 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
8
8
|
* (`tiers.choose { thread }`), for everyone in it; on home, the person's own
|
|
9
9
|
* default for new chats (`{ mine }`). Each tier says its price; one over the
|
|
10
10
|
* org's cap is out of reach for those who don't run it, and says who sets
|
|
11
|
-
* it. Back to the default where one was chosen.
|
|
11
|
+
* it. Back to the default where one was chosen. Where the org uses only its
|
|
12
|
+
* default, it just says the tier: there's nothing to switch.
|
|
12
13
|
*/
|
|
13
14
|
import { useState } from "react";
|
|
14
15
|
import { Menu, toast } from "pairz/web";
|
|
@@ -77,5 +78,10 @@ function TierPick({ shown, thread, call }) {
|
|
|
77
78
|
: []),
|
|
78
79
|
];
|
|
79
80
|
const price = tier && tierPriceSaid(tier);
|
|
80
|
-
|
|
81
|
+
const text = (_jsxs("span", { className: "tiers-pick-text", children: [_jsx("span", { className: "tiers-pick-name", children: tier?.title ?? now.tier }), price ? _jsx("span", { className: "tiers-pick-price", children: ` · ${price}` }) : null] }));
|
|
82
|
+
// Only the default: the tier, said, with nothing to choose.
|
|
83
|
+
if (shown.org.fixed) {
|
|
84
|
+
return (_jsx("span", { className: "tiers-pick", "data-fixed": "", title: say("capDefaultNote"), children: text }));
|
|
85
|
+
}
|
|
86
|
+
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: text, icon: "sparkles", variant: "ghost", size: "sm", side: "top", align: "end", items: items }) }));
|
|
81
87
|
}
|
package/tiers/views/web/org.d.ts
CHANGED
|
@@ -3,15 +3,20 @@
|
|
|
3
3
|
* shell's `orgSettings`, at `/org?tab=models`): how hard they think, then who
|
|
4
4
|
* they are.
|
|
5
5
|
*
|
|
6
|
-
* - **The tiers**, as cards side by side: each its name,
|
|
7
|
-
* what a typical message comes to at this org's prices
|
|
8
|
-
* plan's credits go, and each kind of work's model; the
|
|
9
|
-
* outlined. Owners and admins make one the default in a
|
|
10
|
-
* after), customize one (a dialog: each kind of work's
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* tier
|
|
14
|
-
*
|
|
6
|
+
* - **The tiers**, as cards side by side, in the org's order: each its name,
|
|
7
|
+
* what it's good for, what a typical message comes to at this org's prices
|
|
8
|
+
* and how far the plan's credits go, and each kind of work's model; the
|
|
9
|
+
* org's default outlined. Owners and admins make one the default in a
|
|
10
|
+
* click (Undo right after), customize one (a dialog: each kind of work's
|
|
11
|
+
* models in the order they're tried, any of them first, from every model
|
|
12
|
+
* the org can run, each saying how it's paid for), duplicate one into a
|
|
13
|
+
* new tier, make one from nothing, move one before or after another, take
|
|
14
|
+
* one away or put it back as it was, and say what members can use (all
|
|
15
|
+
* tiers, up to one, or only the default). Where the app has plans, they
|
|
16
|
+
* say whether members' subscriptions are used whenever possible (off: the
|
|
17
|
+
* tier's order, model by model), and each tier's fallbacks on members'
|
|
18
|
+
* subscriptions. On a plan of credits given once, a heavier default says
|
|
19
|
+
* how much faster it spends them.
|
|
15
20
|
* - **The team** (team.tsx): the agents every space starts with.
|
|
16
21
|
*
|
|
17
22
|
* Anyone else reads it, and is told who changes it. Everything shown is a
|
|
@@ -23,14 +28,24 @@ import type { ModelShown, Shown, TierShown } from "../../contract.js";
|
|
|
23
28
|
import { type TeamAgent } from "./team.js";
|
|
24
29
|
type Call = <R = unknown>(action: string, input?: unknown) => Promise<R>;
|
|
25
30
|
export declare const tiersOrgView: (_: unknown, ctx: ViewContext<ReactNode>) => ReactNode;
|
|
26
|
-
|
|
31
|
+
/** A tier being customized (`name`), or a new one, maybe copied from another. */
|
|
32
|
+
type Editing = {
|
|
33
|
+
name?: string;
|
|
34
|
+
from?: string;
|
|
35
|
+
title?: string;
|
|
36
|
+
};
|
|
37
|
+
export declare function OrgAgents({ shown, team, may, org, personal, call }: {
|
|
27
38
|
shown: Shown;
|
|
28
39
|
team?: TeamAgent[];
|
|
29
40
|
may: boolean;
|
|
30
41
|
/** The org's name; none for a person's own. */
|
|
31
42
|
org?: string;
|
|
43
|
+
/** A person's own org: its tiers' models are theirs alone. */
|
|
44
|
+
personal?: boolean;
|
|
32
45
|
call: Call;
|
|
33
46
|
}): ReactNode;
|
|
47
|
+
/** A list with one entry moved from `from` to `to`. */
|
|
48
|
+
export declare function moved<T>(list: T[], from: number, to: number): T[];
|
|
34
49
|
/**
|
|
35
50
|
* What the tier in use means for the plan's credits, when it's worth saying: a
|
|
36
51
|
* plan of credits given once (a trial's) spent faster than the cheapest tier
|
|
@@ -41,7 +56,7 @@ export declare function SpendNote({ shown, tier }: {
|
|
|
41
56
|
tier?: string;
|
|
42
57
|
}): ReactNode;
|
|
43
58
|
/** 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 }: {
|
|
59
|
+
export declare function TierCard({ tier, shown, current, may, busy, onChoose, onEdit, onCopy, onMove, onRemove, onRestore }: {
|
|
45
60
|
tier: TierShown;
|
|
46
61
|
shown: Shown;
|
|
47
62
|
/** It's the org's default. */
|
|
@@ -51,9 +66,29 @@ export declare function TierCard({ tier, shown, current, may, busy, onChoose, on
|
|
|
51
66
|
onChoose(): void;
|
|
52
67
|
onEdit(): void;
|
|
53
68
|
onCopy(): void;
|
|
69
|
+
/** Moves it before the one before it (-1), or after the one after it (1). */
|
|
70
|
+
onMove?(by: -1 | 1): void;
|
|
54
71
|
onRemove(): void;
|
|
55
72
|
onRestore(): void;
|
|
56
73
|
}): ReactNode;
|
|
74
|
+
/**
|
|
75
|
+
* Customizing a tier, or making one (a dialog): its name and what it's for,
|
|
76
|
+
* then each kind of work, with the agents that do it, its model and what it
|
|
77
|
+
* falls back to (team's picker, `model.pick`, offering every model the org
|
|
78
|
+
* can run, each saying how it's paid for: `members`, for an org of others,
|
|
79
|
+
* that those without a model's plan fall back to the next), and adding a
|
|
80
|
+
* kind of work of the org's own; where the app has plans, the tier's
|
|
81
|
+
* fallbacks on members' subscriptions. Saved at once (`tiers.save`): only
|
|
82
|
+
* what changed.
|
|
83
|
+
*/
|
|
84
|
+
export declare function TierEditor({ shown, team, editing, members, call, onClose }: {
|
|
85
|
+
shown: Shown;
|
|
86
|
+
team?: TeamAgent[];
|
|
87
|
+
editing: Editing;
|
|
88
|
+
members: boolean;
|
|
89
|
+
call: Call;
|
|
90
|
+
onClose(): void;
|
|
91
|
+
}): ReactNode;
|
|
57
92
|
/** What a model falls back to, each name once: "GPT-6 Luna, Claude Haiku 5.5". */
|
|
58
93
|
export declare function thenSaid(model: ModelShown): string | undefined;
|
|
59
94
|
/** A model as a short line: "Claude Haiku 5.5, low effort, then GPT-6 Luna". */
|