@pairz/team 1.0.0-rc.81 → 1.0.0-rc.82
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 +4 -3
- package/WORDS.md +15 -2
- package/package.json +2 -2
- 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 +1 -1
- package/tiers/actions/choose.js +74 -53
- package/tiers/actions/model.js +8 -7
- package/tiers/collections/choice.d.ts +5 -8
- package/tiers/collections/choice.js +14 -12
- package/tiers/collections/template.d.ts +1 -1
- package/tiers/collections/template.js +5 -4
- package/tiers/contract.d.ts +2 -2
- package/tiers/mod.d.ts +13 -10
- package/tiers/mod.js +15 -12
- package/tiers/shared/plans.d.ts +29 -33
- package/tiers/shared/plans.js +37 -54
- package/tiers/shared/shown.d.ts +3 -1
- package/tiers/shared/shown.js +7 -3
- package/tiers/shared/tiers.d.ts +12 -5
- package/tiers/shared/tiers.js +11 -2
- package/tiers/views/web/composer.d.ts +2 -1
- package/tiers/views/web/composer.js +8 -2
- package/tiers/views/web/org.d.ts +19 -11
- package/tiers/views/web/org.js +80 -35
- package/tiers/views/web/say.d.ts +9 -2
- package/tiers/views/web/say.js +9 -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 +2 -0
- package/tiers/web.d.ts +6 -5
- package/tiers/web.js +9 -8
package/README.md
CHANGED
|
@@ -39,9 +39,10 @@ import { teamWeb, tiersWeb } from "@pairz/team/web";
|
|
|
39
39
|
- **`tiers`**: which model each of the app's agents thinks with, by tier ("Everyday", "Expert"): the
|
|
40
40
|
first that applies of a space's pick, the space's tier, the org's pick, the org's tier and its
|
|
41
41
|
plan's (the `planTier` resource, which `@pairz/billing`'s credits fill). Its collection is
|
|
42
|
-
`modelChoice`; chat asks it through the `agentModel` resource.
|
|
43
|
-
(
|
|
44
|
-
(`tiers.
|
|
42
|
+
`modelChoice`; chat asks it through the `agentModel` resource. An org puts its tiers in its own
|
|
43
|
+
order (`tiers.order`), and says what members can use: all tiers, up to one, or only the default
|
|
44
|
+
(`tiers.cap`). Where the app has people's plans (Claude Code, ChatGPT…), each turn's chain runs on
|
|
45
|
+
its person's plans first, in the plans' own order: a subscription pays for every model it runs.
|
|
45
46
|
|
|
46
47
|
Its front end's words are `team.<key>`: see
|
|
47
48
|
[WORDS.md](https://github.com/pairzhq/pairz/blob/main/packages/team/WORDS.md).
|
package/WORDS.md
CHANGED
|
@@ -49,6 +49,7 @@ Generated: `deno run -A packages/team/tests/words.ts`.
|
|
|
49
49
|
| `team.createNamed` | Create {name} |
|
|
50
50
|
| `team.createNewAgent` | Create a new agent |
|
|
51
51
|
| `team.createNewAgentBody` | Say what it should do; it can write its own instructions. |
|
|
52
|
+
| `team.credits` | Credits |
|
|
52
53
|
| `team.deleteButton` | Delete {name} |
|
|
53
54
|
| `team.deleteChats` | {bold} with what it said. |
|
|
54
55
|
| `team.deleteChatsBold` | Chats it was in stay as they are, |
|
|
@@ -158,6 +159,10 @@ Generated: `deno run -A packages/team/tests/words.ts`.
|
|
|
158
159
|
| `team.orgKey` | This org's key {hint} |
|
|
159
160
|
| `team.orgsTeam` | Your org's team |
|
|
160
161
|
| `team.otherEmoji` | Other |
|
|
162
|
+
| `team.paidConnect` | Connect {plans} to use |
|
|
163
|
+
| `team.paidCredits` | Credits · {price} |
|
|
164
|
+
| `team.paidFallBack` | Members without {plans} fall back to the next model |
|
|
165
|
+
| `team.paidYours` | Your {plan} · $0 |
|
|
161
166
|
| `team.paletteAgents` | Agents |
|
|
162
167
|
| `team.paletteCreate` | Create |
|
|
163
168
|
| `team.paletteThisAgent` | This agent |
|
|
@@ -224,6 +229,7 @@ Generated: `deno run -A packages/team/tests/words.ts`.
|
|
|
224
229
|
| `team.youAreDefaultName` | Maya |
|
|
225
230
|
| `team.youArePlaceholder` | You are {name}. You… |
|
|
226
231
|
| `team.yourKey` | Your key |
|
|
232
|
+
| `team.yourPlan` | Your {plan} |
|
|
227
233
|
|
|
228
234
|
## tiers
|
|
229
235
|
|
|
@@ -257,9 +263,12 @@ Generated: `deno run -A packages/team/tests/words.ts`.
|
|
|
257
263
|
| `tiers.bySpace` | this space's default |
|
|
258
264
|
| `tiers.byThread` | chosen for this chat |
|
|
259
265
|
| `tiers.cancel` | Cancel |
|
|
260
|
-
| `tiers.
|
|
261
|
-
| `tiers.
|
|
266
|
+
| `tiers.capAll` | All tiers |
|
|
267
|
+
| `tiers.capDefault` | Only the default |
|
|
268
|
+
| `tiers.capDefaultNote` | Every chat runs on the default: nobody switches a chat's or a space's tier. |
|
|
269
|
+
| `tiers.capLabel` | Members can use |
|
|
262
270
|
| `tiers.capNote` | Owners and admins can always use any of them. |
|
|
271
|
+
| `tiers.capUpTo` | Up to {tier} |
|
|
263
272
|
| `tiers.changeAnyTime` | You can change it any time. |
|
|
264
273
|
| `tiers.chatRunsDefault` | This chat runs on its default. |
|
|
265
274
|
| `tiers.chatRunsOn` | This chat runs on {tier} from its next reply. |
|
|
@@ -296,6 +305,8 @@ Generated: `deno run -A packages/team/tests/words.ts`.
|
|
|
296
305
|
| `tiers.forPlaceholder` | Strong judgment, quick checks. |
|
|
297
306
|
| `tiers.makeDefault` | Make it the default |
|
|
298
307
|
| `tiers.messages` | one: {count} message / other: {count} messages |
|
|
308
|
+
| `tiers.moveAfter` | Move after {tier} |
|
|
309
|
+
| `tiers.moveBefore` | Move before {tier} |
|
|
299
310
|
| `tiers.moveDown` | Move down |
|
|
300
311
|
| `tiers.moveUp` | Move up |
|
|
301
312
|
| `tiers.name` | Name |
|
|
@@ -317,6 +328,7 @@ Generated: `deno run -A packages/team/tests/words.ts`.
|
|
|
317
328
|
| `tiers.nowOrg` | New chats use {tier}, your org's default. |
|
|
318
329
|
| `tiers.nowPlan` | New chats use {tier}, your plan's default. |
|
|
319
330
|
| `tiers.onlyRunners` | Only {org}'s owners and admins change these. You can switch a chat's tier as you write. |
|
|
331
|
+
| `tiers.onlyRunnersFixed` | Only the org's owners and admins change these, and every chat runs on the default. |
|
|
320
332
|
| `tiers.onlyRunnersHere` | Only the org's owners and admins change these. You can switch a chat's tier as you write. |
|
|
321
333
|
| `tiers.onPlans` | on your plans · model $0 |
|
|
322
334
|
| `tiers.onTier` | {model} on {tier} |
|
|
@@ -353,5 +365,6 @@ Generated: `deno run -A packages/team/tests/words.ts`.
|
|
|
353
365
|
| `tiers.tierModels` | {tier}'s models |
|
|
354
366
|
| `tiers.tierMore` | {tier}: more |
|
|
355
367
|
| `tiers.tiersLabel` | Tiers |
|
|
368
|
+
| `tiers.tryFirst` | Try it first |
|
|
356
369
|
| `tiers.underTenth` | under 0.1¢ |
|
|
357
370
|
| `tiers.undo` | Undo |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pairz/team",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.82",
|
|
4
4
|
"description": "Agents people make, and the models an org's agents think with (tiers). A Pairz plugin.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pairz",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"dependencies": {},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@types/react": "^19.3.0",
|
|
56
|
-
"pairz": "1.0.0-rc.
|
|
56
|
+
"pairz": "1.0.0-rc.82",
|
|
57
57
|
"react": "^19.3.1",
|
|
58
58
|
"react-dom": "^19.3.1"
|
|
59
59
|
},
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
* look?, label?, disabled? }`: choosing one calls `action` with `input` and
|
|
6
6
|
* the `model` chosen, and says so if that fails. What changes shows where it's
|
|
7
7
|
* read (a watched read), so it hands nothing back. `look`: the picker's field
|
|
8
|
-
* (the default), or a small button saying `label` ("Change").
|
|
8
|
+
* (the default), or a small button saying `label` ("Change"). `plans`: for a
|
|
9
|
+
* model people's turns run on their plans first (a tier's), every model the
|
|
10
|
+
* org can run, each saying how it's paid for (see model-picker.tsx).
|
|
9
11
|
*
|
|
10
12
|
* ```tsx
|
|
11
13
|
* <LazyView kind="model.pick" item={{ value }} hints={{ action: "tiers.pick", input: { agent } }} />
|
|
@@ -13,6 +15,7 @@
|
|
|
13
15
|
*/
|
|
14
16
|
import { type ReactNode } from "react";
|
|
15
17
|
import type { ViewContext } from "pairz";
|
|
18
|
+
import { type Paid } from "./model-picker.js";
|
|
16
19
|
export type ModelPick = {
|
|
17
20
|
action?: string;
|
|
18
21
|
input?: Record<string, unknown>;
|
|
@@ -21,6 +24,12 @@ export type ModelPick = {
|
|
|
21
24
|
look?: "field" | "link";
|
|
22
25
|
label?: string;
|
|
23
26
|
disabled?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* For a model that runs on people's plans first: `members` (an org's
|
|
29
|
+
* tier), a model only a plan runs is theirs to fall back from; `mine` (a
|
|
30
|
+
* person's own), it needs their plan.
|
|
31
|
+
*/
|
|
32
|
+
plans?: Paid;
|
|
24
33
|
};
|
|
25
34
|
export declare const modelPickView: (item: {
|
|
26
35
|
value?: string;
|
|
@@ -6,7 +6,9 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
6
6
|
* look?, label?, disabled? }`: choosing one calls `action` with `input` and
|
|
7
7
|
* the `model` chosen, and says so if that fails. What changes shows where it's
|
|
8
8
|
* read (a watched read), so it hands nothing back. `look`: the picker's field
|
|
9
|
-
* (the default), or a small button saying `label` ("Change").
|
|
9
|
+
* (the default), or a small button saying `label` ("Change"). `plans`: for a
|
|
10
|
+
* model people's turns run on their plans first (a tier's), every model the
|
|
11
|
+
* org can run, each saying how it's paid for (see model-picker.tsx).
|
|
10
12
|
*
|
|
11
13
|
* ```tsx
|
|
12
14
|
* <LazyView kind="model.pick" item={{ value }} hints={{ action: "tiers.pick", input: { agent } }} />
|
|
@@ -38,5 +40,5 @@ function Pick({ value, pick, call }) {
|
|
|
38
40
|
setBusy(false);
|
|
39
41
|
}
|
|
40
42
|
};
|
|
41
|
-
return (_jsxs("span", { className: "model-pick", "data-look": pick.look ?? "field", "aria-busy": busy || undefined, children: [_jsx(ModelPicker, { value: value, call: call, look: pick.look, label: pick.label, disabled: busy || pick.disabled, onChange: (model) => void choose(model) }), error ? _jsx("span", { className: "model-pick-error", role: "alert", children: error }) : null] }));
|
|
43
|
+
return (_jsxs("span", { className: "model-pick", "data-look": pick.look ?? "field", "aria-busy": busy || undefined, children: [_jsx(ModelPicker, { value: value, call: call, look: pick.look, label: pick.label, plans: pick.plans, disabled: busy || pick.disabled, onChange: (model) => void choose(model) }), error ? _jsx("span", { className: "model-pick-error", role: "alert", children: error }) : null] }));
|
|
42
44
|
}
|
|
@@ -7,11 +7,32 @@
|
|
|
7
7
|
* then one's models, newest first, with what each costs and can do. A provider
|
|
8
8
|
* without a key asks for one: the org's owners and admins add it here
|
|
9
9
|
* (`modelKey.set`), and it's never shown again; anyone else is told whom to ask.
|
|
10
|
+
*
|
|
11
|
+
* For a model people's turns run on their plans first (a tier's, `plans`),
|
|
12
|
+
* it offers every model the org can run, each saying how it's paid for the
|
|
13
|
+
* person looking: "Your Claude · $0" where a subscription of theirs runs it,
|
|
14
|
+
* "Credits" where a key covers it, and for a model only plans run, "Members
|
|
15
|
+
* without Claude fall back to the next model" (`members`: an org's tier, so
|
|
16
|
+
* it can be chosen) or "Connect Claude to use" (`mine`: their own).
|
|
10
17
|
*/
|
|
11
18
|
import { type ReactNode } from "react";
|
|
12
19
|
import type { OfferedModel, OfferedProvider } from "pairz/plugins/models/contract";
|
|
13
20
|
type Call = <R = unknown>(action: string, input?: unknown) => Promise<R>;
|
|
14
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Whose model it is, where turns run on people's plans first: `members` (an
|
|
23
|
+
* org's tier, whose members without a model's plan fall back from it), or
|
|
24
|
+
* `mine` (the person's own, which needs their plan).
|
|
25
|
+
*/
|
|
26
|
+
export type Paid = "members" | "mine";
|
|
27
|
+
/** Whether a model can be chosen: a key covers it, or a plan runs it that's theirs, or members'. */
|
|
28
|
+
export declare const choosable: (model: OfferedModel, plans?: Paid) => boolean;
|
|
29
|
+
/**
|
|
30
|
+
* How a model is paid for, for the person looking, where turns run on plans
|
|
31
|
+
* first: their subscription ("Your Claude · $0"), else credits, at its price,
|
|
32
|
+
* else, for a model only plans run, who falls back or what to connect.
|
|
33
|
+
*/
|
|
34
|
+
export declare function paidSaid(model: OfferedModel, plans: Paid): string | undefined;
|
|
35
|
+
export declare function ModelPicker({ value, onChange, call, disabled, id, look, label, plans }: {
|
|
15
36
|
value: string;
|
|
16
37
|
onChange(model: string): void;
|
|
17
38
|
call: Call;
|
|
@@ -20,6 +41,8 @@ export declare function ModelPicker({ value, onChange, call, disabled, id, look,
|
|
|
20
41
|
/** A field showing what's chosen (the default), or a small button saying `label` ("Change"). */
|
|
21
42
|
look?: "field" | "link";
|
|
22
43
|
label?: string;
|
|
44
|
+
/** Turns run on people's plans first: whose model it is (see the module's doc). */
|
|
45
|
+
plans?: Paid;
|
|
23
46
|
}): ReactNode;
|
|
24
47
|
type Listing = {
|
|
25
48
|
providers: OfferedProvider[];
|
|
@@ -29,21 +52,24 @@ type Found = {
|
|
|
29
52
|
providers: OfferedProvider[];
|
|
30
53
|
models: OfferedModel[];
|
|
31
54
|
};
|
|
32
|
-
/** The providers: those that can be used now, then those that take a key. */
|
|
33
|
-
export declare function Providers({ listing, onProvider }: {
|
|
55
|
+
/** The providers: those that can be used now (a key, or a plan), then those that take a key. */
|
|
56
|
+
export declare function Providers({ listing, plans, onProvider }: {
|
|
34
57
|
listing?: Listing;
|
|
58
|
+
plans?: Paid;
|
|
35
59
|
onProvider(id: string): void;
|
|
36
60
|
}): ReactNode;
|
|
37
|
-
export declare function ModelRow({ model, value, withProvider, onChoose }: {
|
|
61
|
+
export declare function ModelRow({ model, value, withProvider, plans, onChoose }: {
|
|
38
62
|
model: OfferedModel;
|
|
39
63
|
value: string;
|
|
40
64
|
/** Who it's from, where several providers' are listed. */
|
|
41
65
|
withProvider?: string;
|
|
66
|
+
plans?: Paid;
|
|
42
67
|
onChoose(): void;
|
|
43
68
|
}): ReactNode;
|
|
44
|
-
export declare function Results({ found, value, onProvider, onChoose }: {
|
|
69
|
+
export declare function Results({ found, value, plans, onProvider, onChoose }: {
|
|
45
70
|
found?: Found;
|
|
46
71
|
value: string;
|
|
72
|
+
plans?: Paid;
|
|
47
73
|
onProvider(id: string): void;
|
|
48
74
|
onChoose(model: string): void;
|
|
49
75
|
}): ReactNode;
|
|
@@ -8,11 +8,43 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
8
8
|
* then one's models, newest first, with what each costs and can do. A provider
|
|
9
9
|
* without a key asks for one: the org's owners and admins add it here
|
|
10
10
|
* (`modelKey.set`), and it's never shown again; anyone else is told whom to ask.
|
|
11
|
+
*
|
|
12
|
+
* For a model people's turns run on their plans first (a tier's, `plans`),
|
|
13
|
+
* it offers every model the org can run, each saying how it's paid for the
|
|
14
|
+
* person looking: "Your Claude · $0" where a subscription of theirs runs it,
|
|
15
|
+
* "Credits" where a key covers it, and for a model only plans run, "Members
|
|
16
|
+
* without Claude fall back to the next model" (`members`: an org's tier, so
|
|
17
|
+
* it can be chosen) or "Connect Claude to use" (`mine`: their own).
|
|
11
18
|
*/
|
|
12
19
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
13
20
|
import { createPortal } from "react-dom";
|
|
14
21
|
import { Badge, Button, Dialog, formatNumber, Icon, IconButton, Input, message, Notice, Skeleton, } from "pairz/web";
|
|
22
|
+
import { formatList } from "pairz/web/words";
|
|
15
23
|
import { say } from "./words.js";
|
|
24
|
+
/** Whether a model can be chosen: a key covers it, or a plan runs it that's theirs, or members'. */
|
|
25
|
+
export const choosable = (model, plans) => model.ready || (!!plans && (!!model.yours || (plans === "members" && !!model.plans?.length)));
|
|
26
|
+
/** Whether a provider has models to choose now, as `choosable` says of one. */
|
|
27
|
+
const reachable = (provider, plans) => provider.ready ||
|
|
28
|
+
(!!plans && (!!provider.yours?.length || (plans === "members" && !!provider.plans?.length)));
|
|
29
|
+
/**
|
|
30
|
+
* How a model is paid for, for the person looking, where turns run on plans
|
|
31
|
+
* first: their subscription ("Your Claude · $0"), else credits, at its price,
|
|
32
|
+
* else, for a model only plans run, who falls back or what to connect.
|
|
33
|
+
*/
|
|
34
|
+
export function paidSaid(model, plans) {
|
|
35
|
+
if (model.yours)
|
|
36
|
+
return say("paidYours", { plan: model.yours });
|
|
37
|
+
if (model.ready) {
|
|
38
|
+
const cost = priced(model);
|
|
39
|
+
return model.ownKey ? cost : cost ? say("paidCredits", { price: cost }) : say("credits");
|
|
40
|
+
}
|
|
41
|
+
if (!model.plans?.length)
|
|
42
|
+
return undefined;
|
|
43
|
+
const names = formatList(model.plans, "disjunction");
|
|
44
|
+
return plans === "members"
|
|
45
|
+
? say("paidFallBack", { plans: names })
|
|
46
|
+
: say("paidConnect", { plans: names });
|
|
47
|
+
}
|
|
16
48
|
/** How long after typing it searches. */
|
|
17
49
|
const TYPING_MS = 180;
|
|
18
50
|
/** Tokens, shortly: `200K`, `1M`. */
|
|
@@ -60,7 +92,7 @@ function abilities(model) {
|
|
|
60
92
|
...(model.reasons ? [say("reasoning")] : []),
|
|
61
93
|
];
|
|
62
94
|
}
|
|
63
|
-
export function ModelPicker({ value, onChange, call, disabled, id, look = "field", label }) {
|
|
95
|
+
export function ModelPicker({ value, onChange, call, disabled, id, look = "field", label, plans }) {
|
|
64
96
|
const [open, setOpen] = useState(false);
|
|
65
97
|
const [chosen, setChosen] = useState();
|
|
66
98
|
// What's chosen, by name, for the field; a link leaves that to the line it's on.
|
|
@@ -69,16 +101,20 @@ export function ModelPicker({ value, onChange, call, disabled, id, look = "field
|
|
|
69
101
|
return setChosen(undefined);
|
|
70
102
|
call("models.offered", {
|
|
71
103
|
model: value,
|
|
104
|
+
...(plans ? { plans: true } : {}),
|
|
72
105
|
}).then(setChosen, () => setChosen(undefined));
|
|
73
|
-
}, [value, call, look]);
|
|
106
|
+
}, [value, call, look, plans]);
|
|
74
107
|
useEffect(load, [load]);
|
|
75
|
-
// Known and not ready: nothing can reach it until its key is added.
|
|
76
|
-
const stuck =
|
|
108
|
+
// Known and not ready: nothing can reach it until its key is added (or, on plans, theirs).
|
|
109
|
+
const stuck = plans
|
|
110
|
+
? !!chosen?.model && !choosable(chosen.model, plans)
|
|
111
|
+
: chosen?.provider && !chosen.provider.ready;
|
|
112
|
+
const line = chosen?.model && (plans ? paidSaid(chosen.model, plans) : priced(chosen.model));
|
|
77
113
|
const dialog = open
|
|
78
114
|
? createPortal(_jsx(Dialog, { open: true, onClose: () => {
|
|
79
115
|
setOpen(false);
|
|
80
116
|
load();
|
|
81
|
-
}, title: say("chooseModel"), className: "model-dialog", children: _jsx(Choosing, { value: value, call: call, onChoose: (model) => {
|
|
117
|
+
}, title: say("chooseModel"), className: "model-dialog", children: _jsx(Choosing, { value: value, call: call, plans: plans, onChoose: (model) => {
|
|
82
118
|
onChange(model);
|
|
83
119
|
setOpen(false);
|
|
84
120
|
} }) }), document.body)
|
|
@@ -86,62 +122,69 @@ export function ModelPicker({ value, onChange, call, disabled, id, look = "field
|
|
|
86
122
|
if (look === "link") {
|
|
87
123
|
return (_jsxs(_Fragment, { children: [_jsx(Button, { id: id, variant: "link", size: "sm", className: "model-change", disabled: disabled, "aria-haspopup": "dialog", onClick: () => setOpen(true), children: label ?? say("change") }), dialog] }));
|
|
88
124
|
}
|
|
89
|
-
return (_jsxs(_Fragment, { children: [_jsxs("button", { type: "button", id: id, className: "model-chosen", disabled: disabled, "aria-haspopup": "dialog", onClick: () => setOpen(true), children: [_jsxs("span", { className: "model-chosen-text", children: [_jsx("b", { children: chosen?.model?.name ?? (value || say("chooseModel")) }), _jsxs("span", { children: [chosen?.provider?.name,
|
|
125
|
+
return (_jsxs(_Fragment, { children: [_jsxs("button", { type: "button", id: id, className: "model-chosen", disabled: disabled, "aria-haspopup": "dialog", onClick: () => setOpen(true), children: [_jsxs("span", { className: "model-chosen-text", children: [_jsx("b", { children: chosen?.model?.name ?? (value || say("chooseModel")) }), _jsxs("span", { children: [chosen?.model?.from ?? chosen?.provider?.name, line ? ` · ${line}` : ""] })] }), stuck && !chosen?.model?.plans?.length
|
|
126
|
+
? _jsx(Badge, { tone: "warning", children: say("needsKey") })
|
|
127
|
+
: null, _jsx(Icon, { name: "selector", size: 16 })] }), dialog] }));
|
|
90
128
|
}
|
|
91
129
|
/** What's in the dialog: the search, then what it found, the providers, or one provider. */
|
|
92
|
-
function Choosing({ value, call, onChoose }) {
|
|
130
|
+
function Choosing({ value, call, plans, onChoose }) {
|
|
93
131
|
const [listing, setListing] = useState();
|
|
94
132
|
const [typed, setTyped] = useState("");
|
|
95
133
|
const [found, setFound] = useState();
|
|
96
134
|
const [at, setAt] = useState();
|
|
97
135
|
const [error, setError] = useState();
|
|
136
|
+
const asked = plans ? { plans: true } : {};
|
|
98
137
|
const list = useCallback(() => {
|
|
99
|
-
call("models.offered", {}).then(setListing, (e) => setError(message(e)));
|
|
100
|
-
}, [call]);
|
|
138
|
+
call("models.offered", { ...asked }).then(setListing, (e) => setError(message(e)));
|
|
139
|
+
}, [call, plans]);
|
|
101
140
|
useEffect(list, [list]);
|
|
102
141
|
// The last search asked is the one that shows.
|
|
103
|
-
const
|
|
142
|
+
const last = useRef(0);
|
|
104
143
|
useEffect(() => {
|
|
105
144
|
const search = typed.trim();
|
|
106
|
-
const mine = ++
|
|
145
|
+
const mine = ++last.current;
|
|
107
146
|
if (!search)
|
|
108
147
|
return setFound(undefined);
|
|
109
148
|
const timer = setTimeout(() => {
|
|
110
|
-
call("models.offered", { search }).then((answer) => mine ===
|
|
149
|
+
call("models.offered", { search, ...asked }).then((answer) => mine === last.current && setFound(answer), (e) => mine === last.current && setError(message(e)));
|
|
111
150
|
}, TYPING_MS);
|
|
112
151
|
return () => clearTimeout(timer);
|
|
113
|
-
}, [typed, call]);
|
|
152
|
+
}, [typed, call, plans]);
|
|
114
153
|
if (at) {
|
|
115
|
-
return (_jsx(ProviderModels, { id: at, value: value, call: call, may: !!listing?.set, onBack: () => {
|
|
154
|
+
return (_jsx(ProviderModels, { id: at, value: value, call: call, plans: plans, may: !!listing?.set, onBack: () => {
|
|
116
155
|
setAt(undefined);
|
|
117
156
|
list();
|
|
118
157
|
}, onChoose: onChoose }));
|
|
119
158
|
}
|
|
120
159
|
return (_jsxs("div", { className: "model-choose", children: [_jsx(Input, { icon: "search", placeholder: say("searchModels"), "aria-label": say("searchModels"), value: typed, autoFocus: true, onChange: (event) => setTyped(event.target.value) }), error ? _jsx(Notice, { tone: "destructive", role: "alert", children: error }) : null, typed.trim()
|
|
121
|
-
? _jsx(Results, { found: found, value: value, onProvider: setAt, onChoose: onChoose })
|
|
122
|
-
: _jsx(Providers, { listing: listing, onProvider: setAt })] }));
|
|
160
|
+
? (_jsx(Results, { found: found, value: value, plans: plans, onProvider: setAt, onChoose: onChoose }))
|
|
161
|
+
: _jsx(Providers, { listing: listing, plans: plans, onProvider: setAt })] }));
|
|
123
162
|
}
|
|
124
163
|
const Loading = () => (_jsx("div", { className: "model-list", "aria-busy": "true", children: [0, 1, 2, 3].map((n) => _jsx(Skeleton, { height: 46 }, n)) }));
|
|
125
164
|
function ProviderRow({ provider, onOpen }) {
|
|
126
|
-
return (_jsx("li", { children: _jsxs("button", { type: "button", className: "model-row", onClick: onOpen, children: [_jsxs("span", { className: "model-row-text", children: [_jsx("b", { children: provider.name }), _jsxs("span", { children: [say("providerModels", { count: provider.models }), provider.note ? ` · ${provider.note}` : ""] })] }), provider.hint
|
|
165
|
+
return (_jsx("li", { children: _jsxs("button", { type: "button", className: "model-row", onClick: onOpen, children: [_jsxs("span", { className: "model-row-text", children: [_jsx("b", { children: provider.name }), _jsxs("span", { children: [say("providerModels", { count: provider.models }), provider.note ? ` · ${provider.note}` : ""] })] }), provider.hint
|
|
166
|
+
? _jsx(Badge, { tone: "primary", children: say("yourKey") })
|
|
167
|
+
: provider.yours?.length
|
|
168
|
+
? _jsx(Badge, { tone: "primary", children: say("yourPlan", { plan: provider.yours[0] }) })
|
|
169
|
+
: null, _jsx(Icon, { name: "chevron", size: 15 })] }) }));
|
|
127
170
|
}
|
|
128
|
-
/** The providers: those that can be used now, then those that take a key. */
|
|
129
|
-
export function Providers({ listing, onProvider }) {
|
|
171
|
+
/** The providers: those that can be used now (a key, or a plan), then those that take a key. */
|
|
172
|
+
export function Providers({ listing, plans, onProvider }) {
|
|
130
173
|
if (!listing)
|
|
131
174
|
return _jsx(Loading, {});
|
|
132
|
-
const ready = listing.providers.filter((p) => p
|
|
133
|
-
const others = listing.providers.filter((p) => !p
|
|
175
|
+
const ready = listing.providers.filter((p) => reachable(p, plans));
|
|
176
|
+
const others = listing.providers.filter((p) => !reachable(p, plans));
|
|
134
177
|
return (_jsxs("div", { className: "model-groups", children: [ready.length
|
|
135
178
|
? (_jsxs("section", { children: [_jsx("h3", { className: "model-group", children: say("readyToUse") }), _jsx("ul", { className: "model-list", children: ready.map((p) => (_jsx(ProviderRow, { provider: p, onOpen: () => onProvider(p.id) }, p.id))) })] }))
|
|
136
179
|
: null, others.length
|
|
137
180
|
? (_jsxs("section", { children: [_jsx("h3", { className: "model-group", children: say("withOwnKey") }), _jsx("ul", { className: "model-list", children: others.map((p) => (_jsx(ProviderRow, { provider: p, onOpen: () => onProvider(p.id) }, p.id))) })] }))
|
|
138
181
|
: null] }));
|
|
139
182
|
}
|
|
140
|
-
export function ModelRow({ model, value, withProvider, onChoose }) {
|
|
141
|
-
const cost = priced(model);
|
|
142
|
-
return (_jsx("li", { children: _jsxs("button", { type: "button", className: "model-row model-row-model", disabled: !model
|
|
183
|
+
export function ModelRow({ model, value, withProvider, plans, onChoose }) {
|
|
184
|
+
const cost = plans ? paidSaid(model, plans) : priced(model);
|
|
185
|
+
return (_jsx("li", { children: _jsxs("button", { type: "button", className: "model-row model-row-model", disabled: !choosable(model, plans), "aria-current": model.id === value || undefined, onClick: onChoose, children: [_jsxs("span", { className: "model-row-text", children: [_jsx("b", { children: model.name }), _jsx("span", { children: [withProvider, ...abilities(model)].filter(Boolean).join(" · ") }), cost ? _jsx("span", { children: cost }) : null] }), model.id === value ? _jsx(Icon, { name: "check", size: 16 }) : null] }) }));
|
|
143
186
|
}
|
|
144
|
-
export function Results({ found, value, onProvider, onChoose }) {
|
|
187
|
+
export function Results({ found, value, plans, onProvider, onChoose }) {
|
|
145
188
|
if (!found)
|
|
146
189
|
return _jsx(Loading, {});
|
|
147
190
|
if (!found.providers.length && !found.models.length) {
|
|
@@ -150,26 +193,27 @@ export function Results({ found, value, onProvider, onChoose }) {
|
|
|
150
193
|
return (_jsxs("div", { className: "model-groups", children: [found.providers.length
|
|
151
194
|
? (_jsxs("section", { children: [_jsx("h3", { className: "model-group", children: say("providers") }), _jsx("ul", { className: "model-list", children: found.providers.map((p) => (_jsx(ProviderRow, { provider: p, onOpen: () => onProvider(p.id) }, p.id))) })] }))
|
|
152
195
|
: null, found.models.length
|
|
153
|
-
? (_jsxs("section", { children: [_jsx("h3", { className: "model-group", children: say("models") }), _jsx("ul", { className: "model-list", children: found.models.map((m) => m.
|
|
154
|
-
? (_jsx(ModelRow, { model: m, value: value, withProvider: m.from, onChoose: () => onChoose(m.id) }, m.id))
|
|
196
|
+
? (_jsxs("section", { children: [_jsx("h3", { className: "model-group", children: say("models") }), _jsx("ul", { className: "model-list", children: found.models.map((m) => choosable(m, plans) || m.plans?.length
|
|
197
|
+
? (_jsx(ModelRow, { model: m, value: value, withProvider: m.from, plans: plans, onChoose: () => onChoose(m.id) }, m.id))
|
|
155
198
|
: (_jsx("li", { children: _jsxs("button", { type: "button", className: "model-row", onClick: () => onProvider(m.provider), children: [_jsxs("span", { className: "model-row-text", children: [_jsx("b", { children: m.name }), _jsx("span", { children: m.from })] }), _jsx(Badge, { children: say("needsKey") })] }) }, m.id))) })] }))
|
|
156
199
|
: null] }));
|
|
157
200
|
}
|
|
158
201
|
/** One provider: its key, if it takes one, and its models. */
|
|
159
|
-
function ProviderModels({ id, value, call, may, onBack, onChoose }) {
|
|
202
|
+
function ProviderModels({ id, value, call, plans, may, onBack, onChoose }) {
|
|
160
203
|
const [shown, setShown] = useState();
|
|
161
204
|
const [error, setError] = useState();
|
|
162
205
|
const load = useCallback(() => {
|
|
163
206
|
call("models.offered", {
|
|
164
207
|
provider: id,
|
|
208
|
+
...(plans ? { plans: true } : {}),
|
|
165
209
|
}).then(setShown, (e) => setError(message(e)));
|
|
166
|
-
}, [id, call]);
|
|
210
|
+
}, [id, call, plans]);
|
|
167
211
|
useEffect(load, [load]);
|
|
168
212
|
const provider = shown?.provider;
|
|
169
213
|
return (_jsxs("div", { className: "model-choose", children: [_jsxs("div", { className: "model-provider-head", children: [_jsx(IconButton, { icon: "chevron-left", label: say("allProviders"), size: "sm", onClick: onBack }), _jsx("h3", { children: provider?.name ?? id })] }), provider?.note ? _jsx("p", { className: "model-provider-note", children: provider.note }) : null, error ? _jsx(Notice, { tone: "destructive", role: "alert", children: error }) : null, provider?.keyed
|
|
170
214
|
? _jsx(ProviderKey, { provider: provider, may: may, call: call, onChange: load })
|
|
171
215
|
: null, shown
|
|
172
|
-
? (_jsx("ul", { className: "model-list", children: shown.models.map((m) => (_jsx(ModelRow, { model: m, value: value, onChoose: () => onChoose(m.id) }, m.id))) }))
|
|
216
|
+
? (_jsx("ul", { className: "model-list", children: shown.models.map((m) => (_jsx(ModelRow, { model: m, value: value, plans: plans, onChoose: () => onChoose(m.id) }, m.id))) }))
|
|
173
217
|
: _jsx(Loading, {})] }));
|
|
174
218
|
}
|
|
175
219
|
/** The org's key for a provider: added, replaced or removed by those who run it. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Every word Team's web front end shows, to be changed by the app (`team.<key>`). */
|
|
2
2
|
import { type Phrase } from "pairz/web/words";
|
|
3
|
-
export declare const say: import("pairz/web/words").Say<"instructions" | "model" | "effort" | "tools" | "replace" | "cancel" | "change" | "listJoin" | "listEnd" | "personalSpace" | "noSuchAgentTitle" | "noSuchAgent" | "noSuchAgentBody" | "goHome" | "partOfApp" | "madeIn" | "madeElsewhere" | "answersNewChatsHere" | "askAgent" | "edit" | "editAgent" | "moreMenu" | "makeAnswerIn" | "addToSpaceMenu" | "startFromIt" | "deleteMenu" | "addToTitle" | "addToNote" | "newLikeTitle" | "newLikeNote" | "newAgentIn" | "startingFrom" | "appAgentNotice" | "startFromShort" | "managersChangeIt" | "managersChangeItElsewhere" | "worksIn" | "addToSpace" | "answersNewChats" | "roleViewer" | "roleEditor" | "worksNowhere" | "modelAndTools" | "thinks" | "toolsLabel" | "noTools" | "showFewer" | "showAll" | "modelsThenJoin" | "changeAgent" | "keepsHandle" | "saveChanges" | "deleteTitle" | "deleteButton" | "deleteLeavesBold" | "deleteLeavesNamed" | "deleteLeaves" | "deleteGoneBold" | "deleteGone" | "deleteChatsBold" | "deleteChats" | "findSpace" | "spacesYouManage" | "justYou" | "keywordPersonal" | "deleteStepNote" | "deleteStepKeep" | "fieldName" | "calledIn" | "nameHint" | "namePlaceholder" | "emoji" | "noEmoji" | "anotherEmoji" | "otherEmoji" | "fieldDoes" | "doesHint" | "doesPlaceholder" | "modelHint" | "rewriteForMe" | "writeForMe" | "sayNameFirst" | "youArePlaceholder" | "youAreDefaultName" | "writingFor" | "draftNote" | "undo" | "instructionsHint" | "instructionsEmptyHint" | "toolsOf" | "toolsChooseDone" | "toolsChoose" | "toolsAll" | "toolsNone" | "toolsMore" | "newAgentForm" | "agentsYouKnow" | "startFrom" | "startBlank" | "worksInAs" | "belongsHint" | "createNamed" | "createAgent" | "worksNow" | "askHandle" | "readsOnly" | "makeAnswer" | "openPage" | "makeAnother" | "notYourSpace" | "archivedSpace" | "managersAdd" | "addAnAgentTitle" | "addAnAgentNote" | "oneOfApps" | "madeInOther" | "findAgent" | "findAgentKnown" | "knownIntro" | "addsAs" | "createNewAgent" | "createNewAgentBody" | "addAgentTo" | "add" | "noneCalled" | "allWorkHere" | "worksNowNames" | "paletteThisAgent" | "paletteThisSpace" | "paletteAgents" | "paletteCreate" | "makeNamedAnswerIn" | "makeNamedAnswer" | "keywordDefault" | "keywordAnswer" | "keywordNewChats" | "addNamedTo" | "addNamedNote" | "keywordMember" | "keywordJoin" | "keywordWork" | "editNamed" | "keywordChange" | "keywordInstructions" | "keywordRename" | "startNewFrom" | "keywordCopy" | "keywordLike" | "keywordCreate" | "addAnAgentTo" | "keywordInvite" | "keywordAgent" | "worksHere" | "newAgent" | "newAgentInHere" | "keywordMake" | "newAgentInStep" | "newAgentInNote" | "chooseModel" | "needsKey" | "yourKey" | "providerModels" | "searchModels" | "readyToUse" | "withOwnKey" | "providers" | "models" | "nothingMatches" | "allProviders" | "noKeyForProvider" | "apiKeyLabel" | "pasteIt" | "save" | "keyNote" | "orgKey" | "usesAppKey" | "useOwnKey" | "remove" | "noCreditsUsed" | "priceLine" | "priceOwnKey" | "contextSize" | "mediaImage" | "mediaPdf" | "mediaAudio" | "mediaVideo" | "reasoning" | "describeHint" | "describePlaceholder" | "fillMyself" | "draftIt" | "drafting" | "draftingWait" | "kindLabel" | "kindHint" | "kindLike" | "orgForm" | "orgJoins" | "back" | "addToTeamNamed" | "addToTeam" | "removeFromTeamMenu" | "changedForOrg" | "orgsTeam" | "tierModel" | "tierModelPlace" | "removeTeamTitle" | "removeButton" | "teamLeaves" | "teamLeavesBold" | "teamSaidStays" | "teamAddBack" | "teamDeleted">;
|
|
3
|
+
export declare const say: import("pairz/web/words").Say<"instructions" | "model" | "effort" | "tools" | "replace" | "cancel" | "change" | "listJoin" | "listEnd" | "personalSpace" | "noSuchAgentTitle" | "noSuchAgent" | "noSuchAgentBody" | "goHome" | "partOfApp" | "madeIn" | "madeElsewhere" | "answersNewChatsHere" | "askAgent" | "edit" | "editAgent" | "moreMenu" | "makeAnswerIn" | "addToSpaceMenu" | "startFromIt" | "deleteMenu" | "addToTitle" | "addToNote" | "newLikeTitle" | "newLikeNote" | "newAgentIn" | "startingFrom" | "appAgentNotice" | "startFromShort" | "managersChangeIt" | "managersChangeItElsewhere" | "worksIn" | "addToSpace" | "answersNewChats" | "roleViewer" | "roleEditor" | "worksNowhere" | "modelAndTools" | "thinks" | "toolsLabel" | "noTools" | "showFewer" | "showAll" | "modelsThenJoin" | "changeAgent" | "keepsHandle" | "saveChanges" | "deleteTitle" | "deleteButton" | "deleteLeavesBold" | "deleteLeavesNamed" | "deleteLeaves" | "deleteGoneBold" | "deleteGone" | "deleteChatsBold" | "deleteChats" | "findSpace" | "spacesYouManage" | "justYou" | "keywordPersonal" | "deleteStepNote" | "deleteStepKeep" | "fieldName" | "calledIn" | "nameHint" | "namePlaceholder" | "emoji" | "noEmoji" | "anotherEmoji" | "otherEmoji" | "fieldDoes" | "doesHint" | "doesPlaceholder" | "modelHint" | "rewriteForMe" | "writeForMe" | "sayNameFirst" | "youArePlaceholder" | "youAreDefaultName" | "writingFor" | "draftNote" | "undo" | "instructionsHint" | "instructionsEmptyHint" | "toolsOf" | "toolsChooseDone" | "toolsChoose" | "toolsAll" | "toolsNone" | "toolsMore" | "newAgentForm" | "agentsYouKnow" | "startFrom" | "startBlank" | "worksInAs" | "belongsHint" | "createNamed" | "createAgent" | "worksNow" | "askHandle" | "readsOnly" | "makeAnswer" | "openPage" | "makeAnother" | "notYourSpace" | "archivedSpace" | "managersAdd" | "addAnAgentTitle" | "addAnAgentNote" | "oneOfApps" | "madeInOther" | "findAgent" | "findAgentKnown" | "knownIntro" | "addsAs" | "createNewAgent" | "createNewAgentBody" | "addAgentTo" | "add" | "noneCalled" | "allWorkHere" | "worksNowNames" | "paletteThisAgent" | "paletteThisSpace" | "paletteAgents" | "paletteCreate" | "makeNamedAnswerIn" | "makeNamedAnswer" | "keywordDefault" | "keywordAnswer" | "keywordNewChats" | "addNamedTo" | "addNamedNote" | "keywordMember" | "keywordJoin" | "keywordWork" | "editNamed" | "keywordChange" | "keywordInstructions" | "keywordRename" | "startNewFrom" | "keywordCopy" | "keywordLike" | "keywordCreate" | "addAnAgentTo" | "keywordInvite" | "keywordAgent" | "worksHere" | "newAgent" | "newAgentInHere" | "keywordMake" | "newAgentInStep" | "newAgentInNote" | "chooseModel" | "needsKey" | "yourKey" | "providerModels" | "searchModels" | "readyToUse" | "withOwnKey" | "providers" | "models" | "nothingMatches" | "allProviders" | "noKeyForProvider" | "apiKeyLabel" | "pasteIt" | "save" | "keyNote" | "orgKey" | "usesAppKey" | "useOwnKey" | "remove" | "noCreditsUsed" | "priceLine" | "priceOwnKey" | "paidYours" | "paidCredits" | "credits" | "paidFallBack" | "paidConnect" | "yourPlan" | "contextSize" | "mediaImage" | "mediaPdf" | "mediaAudio" | "mediaVideo" | "reasoning" | "describeHint" | "describePlaceholder" | "fillMyself" | "draftIt" | "drafting" | "draftingWait" | "kindLabel" | "kindHint" | "kindLike" | "orgForm" | "orgJoins" | "back" | "addToTeamNamed" | "addToTeam" | "removeFromTeamMenu" | "changedForOrg" | "orgsTeam" | "tierModel" | "tierModelPlace" | "removeTeamTitle" | "removeButton" | "teamLeaves" | "teamLeavesBold" | "teamSaidStays" | "teamAddBack" | "teamDeleted">;
|
|
4
4
|
/** Every word of team's front end, by area (WORDS.md lists them). */
|
|
5
5
|
export declare const PHRASES: Record<string, Record<string, Phrase>>;
|
package/team/views/web/words.js
CHANGED
|
@@ -199,6 +199,13 @@ const team = {
|
|
|
199
199
|
noCreditsUsed: "No credits used",
|
|
200
200
|
priceLine: "{input} in · {output} out per 1M tokens",
|
|
201
201
|
priceOwnKey: "No credits used: your key, at {price}",
|
|
202
|
+
// How a model is paid for, where turns run on people's plans first
|
|
203
|
+
paidYours: "Your {plan} · $0",
|
|
204
|
+
paidCredits: "Credits · {price}",
|
|
205
|
+
credits: "Credits",
|
|
206
|
+
paidFallBack: "Members without {plans} fall back to the next model",
|
|
207
|
+
paidConnect: "Connect {plans} to use",
|
|
208
|
+
yourPlan: "Your {plan}",
|
|
202
209
|
contextSize: "{size} context",
|
|
203
210
|
mediaImage: "Images",
|
|
204
211
|
mediaPdf: "PDFs",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const chooseAction: import("pairz").ActionDef;
|
|
2
2
|
export declare const capAction: import("pairz").ActionDef;
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const orderAction: import("pairz").ActionDef;
|
|
4
4
|
export declare const saveAction: import("pairz").ActionDef;
|
|
5
5
|
export declare const removeAction: import("pairz").ActionDef;
|
|
6
6
|
export declare const restoreAction: import("pairz").ActionDef;
|