@pairz/team 0.0.0-stage → 1.0.0-rc.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +51 -2
- package/WORDS.md +357 -0
- package/contract.d.ts +8 -0
- package/contract.js +8 -0
- package/mod.d.ts +25 -0
- package/mod.js +25 -0
- package/package.json +63 -4
- package/team/actions/agent.d.ts +14 -0
- package/team/actions/agent.js +401 -0
- package/team/actions/define.d.ts +1 -0
- package/team/actions/define.js +45 -0
- package/team/collections/agent.d.ts +170 -0
- package/team/collections/agent.js +126 -0
- package/team/contract.d.ts +11 -0
- package/team/contract.js +1 -0
- package/team/mod.d.ts +28 -0
- package/team/mod.js +64 -0
- package/team/resources/propose.d.ts +1 -0
- package/team/resources/propose.js +102 -0
- package/team/shared/definition.d.ts +3 -0
- package/team/shared/definition.js +11 -0
- package/team/shared/everywhere.d.ts +11 -0
- package/team/shared/everywhere.js +29 -0
- package/team/shared/limits.d.ts +17 -0
- package/team/shared/limits.js +17 -0
- package/team/views/web/agent-add.d.ts +14 -0
- package/team/views/web/agent-add.js +58 -0
- 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 +35 -0
- package/team/views/web/agent-fields.js +88 -0
- package/team/views/web/agent-known.d.ts +22 -0
- package/team/views/web/agent-known.js +62 -0
- package/team/views/web/agent-new.d.ts +27 -0
- package/team/views/web/agent-new.js +150 -0
- package/team/views/web/agent-org.d.ts +12 -0
- package/team/views/web/agent-org.js +89 -0
- package/team/views/web/agent-palette.d.ts +19 -0
- package/team/views/web/agent-palette.js +203 -0
- package/team/views/web/agent-steps.d.ts +23 -0
- package/team/views/web/agent-steps.js +56 -0
- package/team/views/web/agent.d.ts +20 -0
- package/team/views/web/agent.js +310 -0
- package/team/views/web/agents.d.ts +48 -0
- package/team/views/web/agents.js +59 -0
- package/team/views/web/model-pick.d.ts +27 -0
- package/team/views/web/model-pick.js +42 -0
- package/team/views/web/model-picker.d.ts +57 -0
- package/team/views/web/model-picker.js +218 -0
- package/team/views/web/places.d.ts +24 -0
- package/team/views/web/places.js +10 -0
- package/team/views/web/style.d.ts +9 -0
- package/team/views/web/style.js +251 -0
- package/team/views/web/words.d.ts +5 -0
- package/team/views/web/words.js +239 -0
- package/team/web.d.ts +22 -0
- package/team/web.js +43 -0
- package/tiers/actions/choose.d.ts +7 -0
- package/tiers/actions/choose.js +315 -0
- package/tiers/actions/model.d.ts +1 -0
- package/tiers/actions/model.js +60 -0
- package/tiers/collections/choice.d.ts +57 -0
- package/tiers/collections/choice.js +79 -0
- package/tiers/collections/template.d.ts +76 -0
- package/tiers/collections/template.js +41 -0
- package/tiers/contract.d.ts +23 -0
- package/tiers/contract.js +1 -0
- package/tiers/mod.d.ts +72 -0
- package/tiers/mod.js +111 -0
- package/tiers/shared/plans.d.ts +65 -0
- package/tiers/shared/plans.js +91 -0
- package/tiers/shared/shown.d.ts +187 -0
- package/tiers/shared/shown.js +280 -0
- package/tiers/shared/tiers.d.ts +150 -0
- package/tiers/shared/tiers.js +170 -0
- package/tiers/views/web/composer.d.ts +14 -0
- package/tiers/views/web/composer.js +81 -0
- package/tiers/views/web/org.d.ts +61 -0
- package/tiers/views/web/org.js +289 -0
- package/tiers/views/web/say.d.ts +139 -0
- package/tiers/views/web/say.js +143 -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 +31 -0
- package/tiers/views/web/space.js +74 -0
- package/tiers/views/web/style.d.ts +7 -0
- package/tiers/views/web/style.js +191 -0
- package/tiers/views/web/team.d.ts +38 -0
- package/tiers/views/web/team.js +118 -0
- package/tiers/views/web/words.d.ts +48 -0
- package/tiers/views/web/words.js +122 -0
- package/tiers/web.d.ts +30 -0
- package/tiers/web.js +71 -0
- package/web.d.ts +14 -0
- package/web.js +14 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agents as team's web front end makes them: each by what it's shown as
|
|
3
|
+
* (the name people gave it, "Maya"; one of the app's, by what it's called)
|
|
4
|
+
* with its emoji; what `agent.options` answers; the name a new one is
|
|
5
|
+
* called by (`Maya` is `@maya`, as `agent.create` makes it); finding one
|
|
6
|
+
* among those someone knows; what a new one starts with (the app's usual
|
|
7
|
+
* agent's tools, an emoji to pick); and names in a sentence.
|
|
8
|
+
*/
|
|
9
|
+
import { type Agent } from "pairz/plugins/agents/contract";
|
|
10
|
+
/** What `agent.options` answers: what an agent can be made with. */
|
|
11
|
+
export type Options = {
|
|
12
|
+
tools: {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
}[];
|
|
16
|
+
models: string[];
|
|
17
|
+
};
|
|
18
|
+
/** How an agent shows: its name, and its emoji if it has one. */
|
|
19
|
+
export type Shown = {
|
|
20
|
+
name: string;
|
|
21
|
+
icon?: string;
|
|
22
|
+
};
|
|
23
|
+
/** How agent `id` shows: by its name, or its id when it has none (the app's). */
|
|
24
|
+
export declare const shownAs: (id: string, agent?: Pick<Agent, "name" | "icon">) => Shown;
|
|
25
|
+
/** An agent's page; `edit`, open to change it. */
|
|
26
|
+
export declare const agentPath: (id: string, edit?: boolean) => string;
|
|
27
|
+
/**
|
|
28
|
+
* What a new agent named `name` is called by, as `agent.create` makes it
|
|
29
|
+
* ("Maya Lima" is `maya-lima`), or the next one free when it's `taken`
|
|
30
|
+
* (`maya-2`).
|
|
31
|
+
*/
|
|
32
|
+
export declare function handleOf(name: string, taken?: (id: string) => boolean): string;
|
|
33
|
+
/** The agents what's typed finds: every word in its name, what it's called by, or what it does. */
|
|
34
|
+
export declare function found<A extends {
|
|
35
|
+
id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
}>(agents: A[], typed: string): A[];
|
|
39
|
+
/**
|
|
40
|
+
* The tools a new agent starts with: those the app's usual agent has (its
|
|
41
|
+
* default one, or its first) that an agent may be given; without any,
|
|
42
|
+
* messaging others.
|
|
43
|
+
*/
|
|
44
|
+
export declare function usualTools(known: Record<string, Agent>, offered: string[]): string[];
|
|
45
|
+
/** Emoji a new agent may be shown with, a few to pick from. */
|
|
46
|
+
export declare const ICONS: string[];
|
|
47
|
+
/** Names as a sentence says them: "a", "a and b", "a, b and c" (the app's words say how). */
|
|
48
|
+
export declare const listed: (items: string[]) => string;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agents as team's web front end makes them: each by what it's shown as
|
|
3
|
+
* (the name people gave it, "Maya"; one of the app's, by what it's called)
|
|
4
|
+
* with its emoji; what `agent.options` answers; the name a new one is
|
|
5
|
+
* called by (`Maya` is `@maya`, as `agent.create` makes it); finding one
|
|
6
|
+
* among those someone knows; what a new one starts with (the app's usual
|
|
7
|
+
* agent's tools, an emoji to pick); and names in a sentence.
|
|
8
|
+
*/
|
|
9
|
+
import { SEND } from "pairz/plugins/agents/contract";
|
|
10
|
+
import { say } from "./words.js";
|
|
11
|
+
/** How agent `id` shows: by its name, or its id when it has none (the app's). */
|
|
12
|
+
export const shownAs = (id, agent) => ({
|
|
13
|
+
name: agent?.name || id,
|
|
14
|
+
...(agent?.icon ? { icon: agent.icon } : {}),
|
|
15
|
+
});
|
|
16
|
+
/** An agent's page; `edit`, open to change it. */
|
|
17
|
+
export const agentPath = (id, edit = false) => `/agent/${encodeURIComponent(id)}${edit ? "?edit=1" : ""}`;
|
|
18
|
+
/** Text as it's matched: any case, any accents. */
|
|
19
|
+
const fold = (text) => text.normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase();
|
|
20
|
+
/**
|
|
21
|
+
* What a new agent named `name` is called by, as `agent.create` makes it
|
|
22
|
+
* ("Maya Lima" is `maya-lima`), or the next one free when it's `taken`
|
|
23
|
+
* (`maya-2`).
|
|
24
|
+
*/
|
|
25
|
+
export function handleOf(name, taken = () => false) {
|
|
26
|
+
const base = fold(name).replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 32) ||
|
|
27
|
+
"agent";
|
|
28
|
+
for (let n = 1;; n++) {
|
|
29
|
+
const handle = n === 1 ? base : `${base}-${n}`;
|
|
30
|
+
if (!taken(handle))
|
|
31
|
+
return handle;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** The agents what's typed finds: every word in its name, what it's called by, or what it does. */
|
|
35
|
+
export function found(agents, typed) {
|
|
36
|
+
const words = fold(typed.replace(/@/g, " ")).split(/\s+/).filter(Boolean);
|
|
37
|
+
return agents.filter((a) => {
|
|
38
|
+
const text = fold(`${a.name} ${a.id} ${a.description ?? ""}`);
|
|
39
|
+
return words.every((w) => text.includes(w));
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The tools a new agent starts with: those the app's usual agent has (its
|
|
44
|
+
* default one, or its first) that an agent may be given; without any,
|
|
45
|
+
* messaging others.
|
|
46
|
+
*/
|
|
47
|
+
export function usualTools(known, offered) {
|
|
48
|
+
const app = Object.values(known).filter((agent) => !agent.in);
|
|
49
|
+
const usual = app.find((agent) => agent.default) ?? app[0];
|
|
50
|
+
const tools = (usual?.tools ?? []).filter((tool) => offered.includes(tool));
|
|
51
|
+
return tools.length ? tools : offered.filter((tool) => tool === SEND);
|
|
52
|
+
}
|
|
53
|
+
/** Emoji a new agent may be shown with, a few to pick from. */
|
|
54
|
+
export const ICONS = ["✨", "🧭", "🔎", "✍️", "📊", "🧠", "🛠️", "🎨", "📅", "🧪", "📚", "🦉"];
|
|
55
|
+
/** Names as a sentence says them: "a", "a and b", "a, b and c" (the app's words say how). */
|
|
56
|
+
export const listed = (items) => items.length < 2 ? items.join("") : say("listEnd", {
|
|
57
|
+
rest: items.slice(0, -1).join(say("listJoin")),
|
|
58
|
+
last: items.at(-1),
|
|
59
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A model to choose, for another front end's page (kind `model.pick`): the
|
|
3
|
+
* same picker an agent's model is chosen with. Item `{ value }`, the model
|
|
4
|
+
* chosen now (`"provider/model"`; none: nothing yet); hints `{ action, input,
|
|
5
|
+
* look?, label?, disabled? }`: choosing one calls `action` with `input` and
|
|
6
|
+
* the `model` chosen, and says so if that fails. What changes shows where it's
|
|
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").
|
|
9
|
+
*
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <LazyView kind="model.pick" item={{ value }} hints={{ action: "tiers.pick", input: { agent } }} />
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
import { type ReactNode } from "react";
|
|
15
|
+
import type { ViewContext } from "pairz";
|
|
16
|
+
export type ModelPick = {
|
|
17
|
+
action?: string;
|
|
18
|
+
input?: Record<string, unknown>;
|
|
19
|
+
/** Called with the model chosen, in place of `action`: a page that does more with it. */
|
|
20
|
+
onPick?(model: string): Promise<unknown>;
|
|
21
|
+
look?: "field" | "link";
|
|
22
|
+
label?: string;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
};
|
|
25
|
+
export declare const modelPickView: (item: {
|
|
26
|
+
value?: string;
|
|
27
|
+
}, ctx: ViewContext<ReactNode>) => ReactNode;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* A model to choose, for another front end's page (kind `model.pick`): the
|
|
4
|
+
* same picker an agent's model is chosen with. Item `{ value }`, the model
|
|
5
|
+
* chosen now (`"provider/model"`; none: nothing yet); hints `{ action, input,
|
|
6
|
+
* look?, label?, disabled? }`: choosing one calls `action` with `input` and
|
|
7
|
+
* the `model` chosen, and says so if that fails. What changes shows where it's
|
|
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").
|
|
10
|
+
*
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <LazyView kind="model.pick" item={{ value }} hints={{ action: "tiers.pick", input: { agent } }} />
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
import { useState } from "react";
|
|
16
|
+
import { message } from "pairz/web";
|
|
17
|
+
import { ModelPicker } from "./model-picker.js";
|
|
18
|
+
import { STYLE } from "./style.js";
|
|
19
|
+
export const modelPickView = (item, ctx) => (_jsxs(_Fragment, { children: [_jsx("style", { href: "team-web", precedence: "pairz", children: STYLE }), _jsx(Pick, { value: item.value ?? "", pick: ctx.hints, call: ctx.call })] }));
|
|
20
|
+
function Pick({ value, pick, call }) {
|
|
21
|
+
const [busy, setBusy] = useState(false);
|
|
22
|
+
const [error, setError] = useState();
|
|
23
|
+
const choose = async (model) => {
|
|
24
|
+
if (model === value)
|
|
25
|
+
return;
|
|
26
|
+
setBusy(true);
|
|
27
|
+
setError(undefined);
|
|
28
|
+
try {
|
|
29
|
+
if (pick.onPick)
|
|
30
|
+
await pick.onPick(model);
|
|
31
|
+
else if (pick.action)
|
|
32
|
+
await call(pick.action, { ...pick.input, model });
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
setError(message(e));
|
|
36
|
+
}
|
|
37
|
+
finally {
|
|
38
|
+
setBusy(false);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
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] }));
|
|
42
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Choosing the model an agent thinks with, from every provider the app can
|
|
3
|
+
* reach (`models.offered`, from the models.dev catalog). Closed, it shows
|
|
4
|
+
* what's chosen, and says so when it can't run yet; or, where a line already
|
|
5
|
+
* says what's chosen (`look: "link"`), it's just a small "Change". Open, a dialog: search
|
|
6
|
+
* across providers and models, or browse the providers, those ready first, and
|
|
7
|
+
* then one's models, newest first, with what each costs and can do. A provider
|
|
8
|
+
* without a key asks for one: the org's owners and admins add it here
|
|
9
|
+
* (`modelKey.set`), and it's never shown again; anyone else is told whom to ask.
|
|
10
|
+
*/
|
|
11
|
+
import { type ReactNode } from "react";
|
|
12
|
+
import type { OfferedModel, OfferedProvider } from "pairz/plugins/models/contract";
|
|
13
|
+
type Call = <R = unknown>(action: string, input?: unknown) => Promise<R>;
|
|
14
|
+
export declare function ModelPicker({ value, onChange, call, disabled, id, look, label }: {
|
|
15
|
+
value: string;
|
|
16
|
+
onChange(model: string): void;
|
|
17
|
+
call: Call;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
id?: string;
|
|
20
|
+
/** A field showing what's chosen (the default), or a small button saying `label` ("Change"). */
|
|
21
|
+
look?: "field" | "link";
|
|
22
|
+
label?: string;
|
|
23
|
+
}): ReactNode;
|
|
24
|
+
type Listing = {
|
|
25
|
+
providers: OfferedProvider[];
|
|
26
|
+
set: boolean;
|
|
27
|
+
};
|
|
28
|
+
type Found = {
|
|
29
|
+
providers: OfferedProvider[];
|
|
30
|
+
models: OfferedModel[];
|
|
31
|
+
};
|
|
32
|
+
/** The providers: those that can be used now, then those that take a key. */
|
|
33
|
+
export declare function Providers({ listing, onProvider }: {
|
|
34
|
+
listing?: Listing;
|
|
35
|
+
onProvider(id: string): void;
|
|
36
|
+
}): ReactNode;
|
|
37
|
+
export declare function ModelRow({ model, value, withProvider, onChoose }: {
|
|
38
|
+
model: OfferedModel;
|
|
39
|
+
value: string;
|
|
40
|
+
/** Who it's from, where several providers' are listed. */
|
|
41
|
+
withProvider?: string;
|
|
42
|
+
onChoose(): void;
|
|
43
|
+
}): ReactNode;
|
|
44
|
+
export declare function Results({ found, value, onProvider, onChoose }: {
|
|
45
|
+
found?: Found;
|
|
46
|
+
value: string;
|
|
47
|
+
onProvider(id: string): void;
|
|
48
|
+
onChoose(model: string): void;
|
|
49
|
+
}): ReactNode;
|
|
50
|
+
/** The org's key for a provider: added, replaced or removed by those who run it. */
|
|
51
|
+
export declare function ProviderKey({ provider, may, call, onChange }: {
|
|
52
|
+
provider: OfferedProvider;
|
|
53
|
+
may: boolean;
|
|
54
|
+
call: Call;
|
|
55
|
+
onChange(): void;
|
|
56
|
+
}): ReactNode;
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Choosing the model an agent thinks with, from every provider the app can
|
|
4
|
+
* reach (`models.offered`, from the models.dev catalog). Closed, it shows
|
|
5
|
+
* what's chosen, and says so when it can't run yet; or, where a line already
|
|
6
|
+
* says what's chosen (`look: "link"`), it's just a small "Change". Open, a dialog: search
|
|
7
|
+
* across providers and models, or browse the providers, those ready first, and
|
|
8
|
+
* then one's models, newest first, with what each costs and can do. A provider
|
|
9
|
+
* without a key asks for one: the org's owners and admins add it here
|
|
10
|
+
* (`modelKey.set`), and it's never shown again; anyone else is told whom to ask.
|
|
11
|
+
*/
|
|
12
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
13
|
+
import { createPortal } from "react-dom";
|
|
14
|
+
import { Badge, Button, Dialog, formatNumber, Icon, IconButton, Input, message, Notice, Skeleton, } from "pairz/web";
|
|
15
|
+
import { say } from "./words.js";
|
|
16
|
+
/** How long after typing it searches. */
|
|
17
|
+
const TYPING_MS = 180;
|
|
18
|
+
/** Tokens, shortly: `200K`, `1M`. */
|
|
19
|
+
const tokens = (count) => count >= 1_000
|
|
20
|
+
? formatNumber(count, {
|
|
21
|
+
notation: "compact",
|
|
22
|
+
maximumFractionDigits: count >= 1_000_000 ? 1 : 0,
|
|
23
|
+
})
|
|
24
|
+
: formatNumber(count);
|
|
25
|
+
/** Dollars, in the page's language; the currency stays. */
|
|
26
|
+
const usd = (amount) => formatNumber(+amount.toFixed(amount < 1 ? 3 : 2), {
|
|
27
|
+
style: "currency",
|
|
28
|
+
currency: "USD",
|
|
29
|
+
minimumFractionDigits: 0,
|
|
30
|
+
maximumFractionDigits: 3,
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* What a model costs, per million tokens in and out; nothing, when it says so. On
|
|
34
|
+
* the org's own key it's its provider's to charge, and uses none of the org's
|
|
35
|
+
* credits, which is worth knowing before choosing it.
|
|
36
|
+
*/
|
|
37
|
+
function priced({ price, ownKey }) {
|
|
38
|
+
if (price?.input === undefined || price.output === undefined)
|
|
39
|
+
return undefined;
|
|
40
|
+
if (!price.input && !price.output)
|
|
41
|
+
return say("noCreditsUsed");
|
|
42
|
+
const per = say("priceLine", { input: usd(price.input), output: usd(price.output) });
|
|
43
|
+
return ownKey ? say("priceOwnKey", { price: per }) : per;
|
|
44
|
+
}
|
|
45
|
+
/** What a kind of input is called. */
|
|
46
|
+
const media = (kind) => kind === "image"
|
|
47
|
+
? say("mediaImage")
|
|
48
|
+
: kind === "pdf"
|
|
49
|
+
? say("mediaPdf")
|
|
50
|
+
: kind === "audio"
|
|
51
|
+
? say("mediaAudio")
|
|
52
|
+
: kind === "video"
|
|
53
|
+
? say("mediaVideo")
|
|
54
|
+
: kind;
|
|
55
|
+
/** What a model can do, in a line. */
|
|
56
|
+
function abilities(model) {
|
|
57
|
+
return [
|
|
58
|
+
...(model.context ? [say("contextSize", { size: tokens(model.context) })] : []),
|
|
59
|
+
...(model.input ?? []).map(media),
|
|
60
|
+
...(model.reasons ? [say("reasoning")] : []),
|
|
61
|
+
];
|
|
62
|
+
}
|
|
63
|
+
export function ModelPicker({ value, onChange, call, disabled, id, look = "field", label }) {
|
|
64
|
+
const [open, setOpen] = useState(false);
|
|
65
|
+
const [chosen, setChosen] = useState();
|
|
66
|
+
// What's chosen, by name, for the field; a link leaves that to the line it's on.
|
|
67
|
+
const load = useCallback(() => {
|
|
68
|
+
if (!value || look === "link")
|
|
69
|
+
return setChosen(undefined);
|
|
70
|
+
call("models.offered", {
|
|
71
|
+
model: value,
|
|
72
|
+
}).then(setChosen, () => setChosen(undefined));
|
|
73
|
+
}, [value, call, look]);
|
|
74
|
+
useEffect(load, [load]);
|
|
75
|
+
// Known and not ready: nothing can reach it until its key is added.
|
|
76
|
+
const stuck = chosen?.provider && !chosen.provider.ready;
|
|
77
|
+
const dialog = open
|
|
78
|
+
? createPortal(_jsx(Dialog, { open: true, onClose: () => {
|
|
79
|
+
setOpen(false);
|
|
80
|
+
load();
|
|
81
|
+
}, title: say("chooseModel"), className: "model-dialog", children: _jsx(Choosing, { value: value, call: call, onChoose: (model) => {
|
|
82
|
+
onChange(model);
|
|
83
|
+
setOpen(false);
|
|
84
|
+
} }) }), document.body)
|
|
85
|
+
: null;
|
|
86
|
+
if (look === "link") {
|
|
87
|
+
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
|
+
}
|
|
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, chosen?.model && priced(chosen.model) ? ` · ${priced(chosen.model)}` : ""] })] }), stuck ? _jsx(Badge, { tone: "warning", children: say("needsKey") }) : null, _jsx(Icon, { name: "selector", size: 16 })] }), dialog] }));
|
|
90
|
+
}
|
|
91
|
+
/** What's in the dialog: the search, then what it found, the providers, or one provider. */
|
|
92
|
+
function Choosing({ value, call, onChoose }) {
|
|
93
|
+
const [listing, setListing] = useState();
|
|
94
|
+
const [typed, setTyped] = useState("");
|
|
95
|
+
const [found, setFound] = useState();
|
|
96
|
+
const [at, setAt] = useState();
|
|
97
|
+
const [error, setError] = useState();
|
|
98
|
+
const list = useCallback(() => {
|
|
99
|
+
call("models.offered", {}).then(setListing, (e) => setError(message(e)));
|
|
100
|
+
}, [call]);
|
|
101
|
+
useEffect(list, [list]);
|
|
102
|
+
// The last search asked is the one that shows.
|
|
103
|
+
const asked = useRef(0);
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
const search = typed.trim();
|
|
106
|
+
const mine = ++asked.current;
|
|
107
|
+
if (!search)
|
|
108
|
+
return setFound(undefined);
|
|
109
|
+
const timer = setTimeout(() => {
|
|
110
|
+
call("models.offered", { search }).then((answer) => mine === asked.current && setFound(answer), (e) => mine === asked.current && setError(message(e)));
|
|
111
|
+
}, TYPING_MS);
|
|
112
|
+
return () => clearTimeout(timer);
|
|
113
|
+
}, [typed, call]);
|
|
114
|
+
if (at) {
|
|
115
|
+
return (_jsx(ProviderModels, { id: at, value: value, call: call, may: !!listing?.set, onBack: () => {
|
|
116
|
+
setAt(undefined);
|
|
117
|
+
list();
|
|
118
|
+
}, onChoose: onChoose }));
|
|
119
|
+
}
|
|
120
|
+
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 })] }));
|
|
123
|
+
}
|
|
124
|
+
const Loading = () => (_jsx("div", { className: "model-list", "aria-busy": "true", children: [0, 1, 2, 3].map((n) => _jsx(Skeleton, { height: 46 }, n)) }));
|
|
125
|
+
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 ? _jsx(Badge, { tone: "primary", children: say("yourKey") }) : null, _jsx(Icon, { name: "chevron", size: 15 })] }) }));
|
|
127
|
+
}
|
|
128
|
+
/** The providers: those that can be used now, then those that take a key. */
|
|
129
|
+
export function Providers({ listing, onProvider }) {
|
|
130
|
+
if (!listing)
|
|
131
|
+
return _jsx(Loading, {});
|
|
132
|
+
const ready = listing.providers.filter((p) => p.ready);
|
|
133
|
+
const others = listing.providers.filter((p) => !p.ready);
|
|
134
|
+
return (_jsxs("div", { className: "model-groups", children: [ready.length
|
|
135
|
+
? (_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
|
+
: null, others.length
|
|
137
|
+
? (_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
|
+
: null] }));
|
|
139
|
+
}
|
|
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.ready, "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
|
+
}
|
|
144
|
+
export function Results({ found, value, onProvider, onChoose }) {
|
|
145
|
+
if (!found)
|
|
146
|
+
return _jsx(Loading, {});
|
|
147
|
+
if (!found.providers.length && !found.models.length) {
|
|
148
|
+
return _jsx("p", { className: "model-none", children: say("nothingMatches") });
|
|
149
|
+
}
|
|
150
|
+
return (_jsxs("div", { className: "model-groups", children: [found.providers.length
|
|
151
|
+
? (_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
|
+
: 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.ready
|
|
154
|
+
? (_jsx(ModelRow, { model: m, value: value, withProvider: m.from, onChoose: () => onChoose(m.id) }, m.id))
|
|
155
|
+
: (_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
|
+
: null] }));
|
|
157
|
+
}
|
|
158
|
+
/** One provider: its key, if it takes one, and its models. */
|
|
159
|
+
function ProviderModels({ id, value, call, may, onBack, onChoose }) {
|
|
160
|
+
const [shown, setShown] = useState();
|
|
161
|
+
const [error, setError] = useState();
|
|
162
|
+
const load = useCallback(() => {
|
|
163
|
+
call("models.offered", {
|
|
164
|
+
provider: id,
|
|
165
|
+
}).then(setShown, (e) => setError(message(e)));
|
|
166
|
+
}, [id, call]);
|
|
167
|
+
useEffect(load, [load]);
|
|
168
|
+
const provider = shown?.provider;
|
|
169
|
+
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
|
+
? _jsx(ProviderKey, { provider: provider, may: may, call: call, onChange: load })
|
|
171
|
+
: 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))) }))
|
|
173
|
+
: _jsx(Loading, {})] }));
|
|
174
|
+
}
|
|
175
|
+
/** The org's key for a provider: added, replaced or removed by those who run it. */
|
|
176
|
+
export function ProviderKey({ provider, may, call, onChange }) {
|
|
177
|
+
const [editing, setEditing] = useState(false);
|
|
178
|
+
const [key, setKey] = useState("");
|
|
179
|
+
const [busy, setBusy] = useState(false);
|
|
180
|
+
const [error, setError] = useState();
|
|
181
|
+
const act = async (work) => {
|
|
182
|
+
setBusy(true);
|
|
183
|
+
setError(undefined);
|
|
184
|
+
try {
|
|
185
|
+
await work();
|
|
186
|
+
setKey("");
|
|
187
|
+
setEditing(false);
|
|
188
|
+
onChange();
|
|
189
|
+
}
|
|
190
|
+
catch (e) {
|
|
191
|
+
setError(message(e));
|
|
192
|
+
}
|
|
193
|
+
finally {
|
|
194
|
+
setBusy(false);
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
if (!may) {
|
|
198
|
+
return provider.ready ? null : (_jsx(Notice, { tone: "neutral", icon: "info", children: say("noKeyForProvider", { provider: provider.name }) }));
|
|
199
|
+
}
|
|
200
|
+
// Asked for at once where nothing else can reach this provider.
|
|
201
|
+
if (editing || (!provider.ready && !provider.hint)) {
|
|
202
|
+
return (_jsxs("form", { className: "model-key", onSubmit: (event) => {
|
|
203
|
+
event.preventDefault();
|
|
204
|
+
// React hands it on to the form this picker was opened from.
|
|
205
|
+
event.stopPropagation();
|
|
206
|
+
if (key.trim()) {
|
|
207
|
+
void act(() => call("modelKey.set", { provider: provider.id, key: key.trim() }));
|
|
208
|
+
}
|
|
209
|
+
}, children: [_jsx("label", { htmlFor: `key-${provider.id}`, children: say("apiKeyLabel", { provider: provider.name }) }), _jsxs("div", { className: "model-key-entry", children: [_jsx(Input, { id: `key-${provider.id}`, type: "password", autoComplete: "off", spellCheck: false, placeholder: say("pasteIt"), value: key, invalid: !!error, disabled: busy, onChange: (event) => setKey(event.target.value) }), _jsx(Button, { type: "submit", variant: "primary", disabled: busy || !key.trim(), children: say("save") }), provider.ready || provider.hint
|
|
210
|
+
? (_jsx(Button, { type: "button", variant: "ghost", disabled: busy, onClick: () => setEditing(false), children: say("cancel") }))
|
|
211
|
+
: null] }), _jsx("p", { children: say("keyNote", { provider: provider.name }) }), error ? _jsx("p", { className: "model-key-error", role: "alert", children: error }) : null] }));
|
|
212
|
+
}
|
|
213
|
+
return (_jsxs("div", { className: "model-key-kept", children: [_jsx("span", { children: provider.hint
|
|
214
|
+
? say.nodes("orgKey", { hint: _jsx("code", { children: provider.hint }) })
|
|
215
|
+
: say("usesAppKey") }), _jsxs("span", { className: "model-key-actions", children: [_jsx(Button, { type: "button", variant: "ghost", size: "sm", disabled: busy, onClick: () => setEditing(true), children: provider.hint ? say("replace") : say("useOwnKey") }), provider.hint
|
|
216
|
+
? (_jsx(Button, { type: "button", variant: "ghost", size: "sm", disabled: busy, onClick: () => void act(() => call("modelKey.remove", { provider: provider.id })), children: say("remove") }))
|
|
217
|
+
: null] }), error ? _jsx("p", { className: "model-key-error", role: "alert", children: error }) : null] }));
|
|
218
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spaces as chat's web front end reads them (the spaces plugin's
|
|
3
|
+
* `space.reached`, by name): what each is called (yours is "Personal"),
|
|
4
|
+
* whether the person manages one, and those they manage and still use,
|
|
5
|
+
* Personal first: where they make agents and add them.
|
|
6
|
+
*/
|
|
7
|
+
/** A space, as `space.reached` answers: with what the person may do there. */
|
|
8
|
+
export type Place = {
|
|
9
|
+
_id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
kind: string;
|
|
12
|
+
can?: string[];
|
|
13
|
+
/** The agent that answers its new chats. */
|
|
14
|
+
agent?: string;
|
|
15
|
+
archived?: string;
|
|
16
|
+
};
|
|
17
|
+
/** What a space is called where it shows: yours is "Personal". */
|
|
18
|
+
export declare const placeName: (place: Pick<Place, "name" | "kind">) => string;
|
|
19
|
+
/** Whether the person manages it. */
|
|
20
|
+
export declare const manages: (place?: Pick<Place, "can"> | null) => boolean;
|
|
21
|
+
/** The spaces the person manages, in use: Personal first, then by name. */
|
|
22
|
+
export declare const managed: <P extends Place>(places: P[]) => P[];
|
|
23
|
+
/** A space's page, at a tab. */
|
|
24
|
+
export declare const placePath: (place: string, tab?: string) => string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { say } from "./words.js";
|
|
2
|
+
/** What a space is called where it shows: yours is "Personal". */
|
|
3
|
+
export const placeName = (place) => place.kind === "personal" ? say("personalSpace") : place.name;
|
|
4
|
+
/** Whether the person manages it. */
|
|
5
|
+
export const manages = (place) => !!place?.can?.includes("manage");
|
|
6
|
+
/** The spaces the person manages, in use: Personal first, then by name. */
|
|
7
|
+
export const managed = (places) => places.filter((p) => manages(p) && !p.archived).sort((a, b) => Number(b.kind === "personal") - Number(a.kind === "personal") ||
|
|
8
|
+
a.name.localeCompare(b.name, undefined, { sensitivity: "base" }));
|
|
9
|
+
/** A space's page, at a tab. */
|
|
10
|
+
export const placePath = (place, tab) => `/space/${encodeURIComponent(place)}${tab ? `?tab=${encodeURIComponent(tab)}` : ""}`;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agents' layout on the web, on the theme's variables: adding one to a
|
|
3
|
+
* space (those someone knows, and making one), the form an agent is made
|
|
4
|
+
* and changed with (its emoji, its instructions being written, its model, its tools),
|
|
5
|
+
* what making one says after, and an agent's page (where it works, what
|
|
6
|
+
* it's told, what it uses, changing and deleting it). Only layout: the
|
|
7
|
+
* pieces are the toolkit's.
|
|
8
|
+
*/
|
|
9
|
+
export declare const STYLE = "\n/* Choosing a model */\n.model-chosen { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 54px;\n padding: 8px 12px; border: 1px solid var(--input); border-radius: var(--radius-md);\n background: var(--background); color: inherit; font: inherit; text-align: left; cursor: pointer;\n transition: border-color .15s, background-color .15s; }\n.model-chosen:hover:not(:disabled) { background: var(--accent); }\n.model-chosen:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }\n.model-chosen:disabled { opacity: .6; cursor: default; }\n.model-chosen > .pairz-icon { flex: none; color: var(--muted-foreground); }\n.model-chosen-text, .model-row-text { display: grid; flex: 1; min-width: 0; gap: 1px; }\n.model-chosen-text b, .model-row-text b { overflow: hidden; font-size: 14px; font-weight: 580;\n text-overflow: ellipsis; white-space: nowrap; }\n.model-chosen-text span, .model-row-text span { overflow: hidden; color: var(--muted-foreground);\n font-size: 12.5px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }\n.model-dialog .pairz-dialog-body { display: flex; min-height: min(560px, calc(100dvh - 130px)); }\n.model-choose { display: flex; flex: 1; flex-direction: column; gap: 12px; min-width: 0; }\n.model-groups { display: grid; gap: 16px; }\n.model-group { margin: 0 0 6px; color: var(--muted-foreground); font-size: 12px; font-weight: 600; }\n.model-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }\n.model-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px;\n padding: 7px 10px; border: 0; border-radius: var(--radius-md); background: transparent;\n color: inherit; font: inherit; text-align: left; cursor: pointer; }\n.model-row:hover:not(:disabled) { background: var(--accent); }\n.model-row:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }\n.model-row:disabled { opacity: .55; cursor: not-allowed; }\n.model-row[aria-current] { background: var(--primary-soft); }\n.model-row > .pairz-icon { flex: none; color: var(--muted-foreground); }\n.model-row[aria-current] > .pairz-icon { color: var(--primary); }\n.model-row .model-row-text span { white-space: normal; }\n.model-none { margin: 24px 0; color: var(--muted-foreground); font-size: 14px; text-align: center; }\n.model-provider-head { display: flex; align-items: center; gap: 8px; margin-left: -6px; }\n.model-provider-head h3 { margin: 0; overflow-wrap: anywhere; font-size: 15px; font-weight: 600; }\n.model-provider-note { margin: -6px 0 0; color: var(--muted-foreground); font-size: 13px; }\n.model-key { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--border);\n border-radius: var(--radius-lg); background: var(--card); }\n.model-key label { font-size: 13.5px; font-weight: 600; }\n.model-key p { margin: 0; color: var(--muted-foreground); font-size: 12.5px; line-height: 1.45; }\n.model-key-entry { display: flex; flex-wrap: wrap; gap: 8px; }\n.model-key-entry > .pairz-input { flex: 1 1 180px; min-width: 0; }\n.model-key p.model-key-error, .model-key-error { margin: 0; color: var(--destructive-text, var(--destructive));\n font-size: 13px; }\n.model-key-kept { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;\n gap: 4px 10px; padding: 6px 6px 6px 12px; border: 1px solid var(--border);\n border-radius: var(--radius-lg); background: var(--card); font-size: 13px; }\n.model-key-actions { display: flex; }\n.model-key-kept .model-key-error { flex-basis: 100%; }\n.model-pick { display: grid; gap: 4px; min-width: 0; }\n.model-pick[data-look=link] { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }\n.model-pick-error { color: var(--destructive-text, var(--destructive)); font-size: 12.5px; line-height: 1.4; }\n.model-change { height: auto; padding: 0; font-size: 13px; }\n\n/* Adding an agent to a space */\n.agent-add { container: agent-add / inline-size; display: grid; gap: 14px; }\n.agent-known { display: grid; gap: 12px; }\n.agent-known-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; }\n.agent-known-find { flex: 1; min-width: 0; }\n.agent-known-intro { margin: 0; color: var(--muted-foreground); font-size: 13px; }\n.agent-known-role { flex: none; display: inline-flex; align-items: center; gap: 8px; color: var(--muted-foreground);\n font-size: 13px; }\n.agent-known-role .pairz-select { min-width: 112px; }\n.agent-known-list { list-style: none; display: grid; margin: 0; padding: 4px; border: 1px solid var(--border);\n border-radius: var(--radius-xl); background: var(--card); max-height: min(420px, 52vh); overflow-y: auto;\n scrollbar-width: thin; }\n.agent-known-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 12px;\n width: 100%; min-height: 56px; padding: 8px 8px 8px 10px; border: 0; border-radius: var(--radius-lg);\n background: transparent; color: inherit; font: inherit; text-align: left; }\n.agent-known-row + .agent-known-row, li + .agent-known-row { border-top: 1px solid var(--border); border-radius: 0; }\n.agent-known-new { cursor: pointer; transition: background-color .12s; }\n.agent-known-new:hover { background: var(--accent); }\n.agent-known-new > .pairz-icon { color: var(--muted-foreground); margin-right: 6px; }\n.agent-known-plus { display: grid; place-items: center; width: 34px; height: 34px; border: 1px dashed var(--primary-border);\n border-radius: var(--radius-md); background: var(--primary-soft); color: var(--primary-text); }\n.agent-known-text { display: grid; gap: 1px; min-width: 0; line-height: 1.35; }\n.agent-known-name { overflow: hidden; font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }\n.agent-known-what { overflow: hidden; color: var(--muted-foreground); font-size: 12.5px; text-overflow: ellipsis;\n white-space: nowrap; }\n.agent-known-from { margin-left: 8px; color: var(--muted-foreground); font-size: 12px; font-weight: 450; }\n.agent-known-from::before { content: \"\u00B7\"; margin-right: 8px; }\n.agent-known-none { margin: 0 2px; color: var(--muted-foreground); font-size: 13px; text-align: center; }\n.agent-handle { color: var(--muted-foreground); font: 500 12px var(--font-mono); }\n.agent-form-note b.agent-handle, .pairz-field-note b.agent-handle { color: var(--secondary-foreground); }\n.agent-done { display: inline-flex; align-items: center; gap: 6px; color: var(--success-text); }\n.agent-error { color: var(--destructive-text); }\n@container agent-add (max-width: 420px) {\n .agent-known-tools { flex-wrap: wrap; }\n .agent-known-find { flex-basis: 100%; }\n .agent-known-from { display: block; margin-left: 0; }\n .agent-known-from::before { content: none; }\n}\n\n/* Making one */\n.agent-new { display: grid; gap: 20px; }\n.agent-new :is(input, textarea, select, button) { scroll-margin-bottom: 84px; }\n.agent-new-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: -4px; }\n.agent-new-top > .pairz-button { margin-left: -8px; }\n.agent-new-from { display: inline-flex; align-items: center; gap: 8px; color: var(--muted-foreground); font-size: 13px; }\n.agent-new-from .pairz-select { min-width: 170px; }\n.agent-new-end { position: sticky; bottom: -22px; z-index: 1; display: flex; align-items: center; justify-content: flex-end;\n gap: 14px; margin: 0 -22px -22px; padding: 12px 22px 16px; border-top: 1px solid var(--border);\n background: var(--popover); }\n.agent-new-end .agent-form-note { flex: 1; min-width: 0; }\n.agent-new-end .agent-form-note:empty { visibility: hidden; }\n\n/* The form: who it is, what it does, what it's told, what it uses */\n.agent-form { display: grid; gap: 20px; }\n.agent-form-who { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 16px; }\n.agent-form-who > .pairz-avatar { margin-top: 22px; box-shadow: var(--shadow-sm); }\n.agent-face-empty { display: grid; place-items: center; width: 56px; height: 56px; margin-top: 22px;\n border: 1.5px dashed var(--input); border-radius: var(--radius-xl); background: var(--muted);\n color: var(--muted-foreground); }\n.agent-form-field { display: grid; gap: 7px; min-width: 0; }\n.agent-form-label { font-size: 13.5px; font-weight: 600; color: var(--foreground); }\n.agent-form-label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 30px;\n margin: -4px 0 -3px; }\n.agent-form-label-row > .pairz-button { margin-right: -6px; }\n.agent-form-count { margin-left: 6px; color: var(--muted-foreground); font-weight: 500; font-variant-numeric: tabular-nums; }\n.agent-form-note { margin: 0; color: var(--muted-foreground); font-size: 12.5px; line-height: 1.45; }\n.agent-undo { min-height: 0; padding: 0; vertical-align: baseline; }\n.agent-icons { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }\n.agent-icon { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--border);\n border-radius: var(--radius-md); background: var(--card); color: var(--secondary-foreground); font-size: 18px;\n line-height: 1; cursor: pointer; transition: background-color .12s, border-color .12s, transform .12s; }\n.agent-icon:hover:not(:disabled) { background: var(--accent); transform: translateY(-1px); }\n.agent-icon[aria-checked=true] { border-color: var(--ring); background: var(--primary-soft);\n outline: 2px solid color-mix(in oklab, var(--ring) 22%, transparent); }\n.agent-icon:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }\n.agent-icon-none { font-size: 13px; font-weight: 650; }\n.agent-icon-own { width: 84px; height: 36px; }\n.agent-icon-own:has(input[data-chosen]) { border-color: var(--ring); background: var(--primary-soft); }\n.agent-instructions { position: relative; }\n.agent-instructions .pairz-textarea { font-size: 14px; line-height: 1.55; }\n.agent-instructions[data-busy] .pairz-textarea { color: transparent; }\n.agent-drafting { position: absolute; inset: 1px; display: grid; align-content: start; gap: 10px; overflow: hidden;\n padding: 12px 14px; border-radius: var(--radius-lg); background: color-mix(in oklab, var(--card) 94%, transparent);\n animation: agent-fade .2s ease-out; }\n.agent-drafting-say { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 2px; color: var(--primary-text);\n font-size: 13px; font-weight: 560; }\n@keyframes agent-fade { from { opacity: 0; } }\n.agent-tools { display: grid; gap: 6px; padding: 6px 6px 8px 12px; border: 1px solid var(--border);\n border-radius: var(--radius-lg); background: color-mix(in oklab, var(--muted) 35%, var(--card)); }\n.agent-tools ul { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));\n gap: 8px 16px; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; scrollbar-width: thin; }\n.agent-tools-all { display: flex; gap: 12px; }\n.agent-tools-all .pairz-button { min-height: 26px; padding: 0; }\n.agent-tool { display: grid; gap: 1px; }\n.agent-tool code { font: 600 12.5px var(--font-mono); }\n.agent-tool span { color: var(--muted-foreground); font-size: 12.5px; line-height: 1.4; }\n.agent-tools-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; color: var(--muted-foreground);\n font-size: 12.5px; }\n.agent-tools-line code { padding: 2px 7px; border-radius: var(--radius-full); background: var(--muted);\n color: var(--secondary-foreground); font: 500 12px var(--font-mono); }\n\n/* Made: what's next */\n.agent-made { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 16px; padding: 18px;\n border: 1px solid var(--success-border); border-radius: var(--radius-xl);\n background: color-mix(in oklab, var(--success-soft) 55%, var(--card)); animation: agent-rise .25s ease-out; }\n@keyframes agent-rise { from { opacity: 0; transform: translateY(4px); } }\n.agent-made-face { position: relative; }\n.agent-made-check { position: absolute; right: -4px; bottom: -4px; display: grid; place-items: center; width: 20px;\n height: 20px; border: 2px solid var(--card); border-radius: var(--radius-full); background: var(--success);\n color: var(--success-foreground); }\n.agent-made-text { display: grid; gap: 4px; min-width: 0; }\n.agent-made-text h3 { margin: 0; font-family: var(--font-display); font-size: 16px; font-weight: 650; }\n.agent-made-text p { margin: 0; color: var(--secondary-foreground); font-size: 13.5px; }\n.agent-made-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }\n\n/* An agent's page */\n.agent-mark { box-shadow: var(--shadow-sm); }\n.agent-narrow { display: none; }\n@container pairz-page (max-width: 640px) {\n .agent-wide { display: none; }\n .agent-narrow { display: inline-grid; }\n .agent-mark { --size: 40px !important; }\n}\n.agent-page-handle { font: 500 12px var(--font-mono); }\n.agent-page { display: grid; gap: 26px; }\n.agent-page-error { margin-bottom: 16px; }\n.agent-page-note { display: flex; align-items: center; gap: 7px; margin: -6px 0 -8px; color: var(--muted-foreground);\n font-size: 13px; }\n.agent-section { display: grid; gap: 10px; }\n.agent-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 30px;\n margin-bottom: -4px; }\n.agent-section-head .pairz-button { margin-right: -6px; }\n.agent-section-title { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted-foreground);\n font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }\n.agent-count { font-variant-numeric: tabular-nums; letter-spacing: 0; }\n.agent-seats { list-style: none; display: grid; margin: 0; padding: 4px; border: 1px solid var(--border);\n border-radius: var(--radius-xl); background: var(--card); box-shadow: var(--shadow-sm); }\n.agent-seat { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 12px 8px 10px;\n border-radius: var(--radius-lg); color: inherit; text-decoration: none; transition: background-color .12s; }\n.agent-seat:hover { background: var(--accent); }\n.agent-seat > .pairz-icon { color: var(--muted-foreground); }\n.agent-seat-personal { display: grid; place-items: center; flex: none; width: 28px; height: 28px;\n border-radius: var(--radius-md); background: var(--primary-soft); color: var(--primary-text); }\n.agent-seat-name { flex: 1; min-width: 0; overflow: hidden; font-weight: 580; text-overflow: ellipsis; white-space: nowrap; }\n.agent-none { margin: 0; color: var(--muted-foreground); font-size: 13.5px; }\n.agent-instructions-read { font-size: 14.5px; line-height: 1.6; }\n.agent-tool-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));\n gap: 10px 22px; margin: 0; padding: 0; }\n.agent-tool-list li { display: grid; gap: 1px; min-width: 0; }\n.agent-tool-list code { font: 600 12.5px var(--font-mono); }\n.agent-tool-list span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;\n color: var(--muted-foreground); font-size: 12.5px; line-height: 1.45; }\n.agent-tool-list span:empty { display: none; }\n.agent-tools-read { display: grid; justify-items: start; gap: 8px; }\n.agent-tools-read > .pairz-button { min-height: 0; padding: 0; }\n.agent-edit { display: grid; gap: 14px; }\n.agent-edit-card { padding: 20px; }\n.agent-edit-end { position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; gap: 10px;\n margin: 0 -24px -64px; padding: 14px 24px 18px; border-top: 1px solid var(--border);\n background: color-mix(in oklab, var(--background) 92%, transparent); backdrop-filter: blur(8px); }\n.agent-edit-end .agent-form-note { flex: 1; min-width: 0; }\n.agent-delete-means { display: grid; gap: 10px; margin: 0 0 4px; padding: 0 0 0 18px; color: var(--secondary-foreground);\n font-size: 14px; line-height: 1.5; }\n.agent-delete-means b { color: var(--foreground); font-weight: 620; }\n.agent-delete-means + .pairz-notice { margin-top: 14px; }\n.agent-missing { display: grid; place-items: center; height: 100%; padding: 32px; }\n@container pairz-page (max-width: 560px) {\n .agent-edit-card { padding: 16px; }\n .agent-edit-end { flex-wrap: wrap; margin: 0 -16px -48px; padding: 12px 16px 14px; }\n .agent-edit-end .agent-form-note { flex-basis: 100%; }\n .agent-edit-end .pairz-button { flex: 1; }\n .agent-form-who { gap: 12px; }\n .agent-form-who > .pairz-avatar { --size: 44px !important; margin-top: 24px; }\n .agent-face-empty { width: 44px; height: 44px; margin-top: 24px; }\n}\n@container agent-add (max-width: 420px) {\n .agent-form-who { gap: 12px; }\n .agent-form-who > .pairz-avatar { --size: 44px !important; margin-top: 24px; }\n .agent-face-empty { width: 44px; height: 44px; margin-top: 24px; }\n .agent-new-top { flex-wrap: wrap; }\n .agent-new-end { flex-wrap: wrap; }\n .agent-new-end .agent-form-note { flex-basis: 100%; }\n .agent-new-end .agent-form-note:empty { display: none; }\n .agent-new-end .pairz-button { flex: 1; }\n}\n\n/* Making an agent: what it should do, first */\n.agent-describe { display: grid; gap: 12px; }\n.agent-describe-end { display: flex; justify-content: flex-end; gap: 8px; }\n.agent-describe-wait { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted-foreground); font-size: 13px; }\n";
|