@columenlabs/lumen-ui 0.1.219 → 0.1.221
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/dist/assistant/settings.d.ts +7 -1
- package/dist/assistant/settings.js +53 -10
- package/dist/settings.js +1 -1
- package/package.json +2 -2
|
@@ -4,10 +4,16 @@ import type { AssistantAdapter } from './client.js';
|
|
|
4
4
|
* The admin's section: the app's shared keys and each person's monthly allowance on them. Put it
|
|
5
5
|
* where the app keeps its admin settings, shown only to admins.
|
|
6
6
|
*/
|
|
7
|
-
export declare function assistantAdminSections({ client, allowance, }: {
|
|
7
|
+
export declare function assistantAdminSections({ client, allowance, providers, }: {
|
|
8
8
|
client: AssistantAdapter;
|
|
9
9
|
/** Add Allowance requests (the app set `allowance` on the server). */
|
|
10
10
|
allowance?: boolean;
|
|
11
|
+
/** Give each provider's shared key a section of its own (listed under Allowance) instead of one
|
|
12
|
+
* Shared model keys section: the app's providers, in order. */
|
|
13
|
+
providers?: {
|
|
14
|
+
id: string;
|
|
15
|
+
label: string;
|
|
16
|
+
}[];
|
|
11
17
|
}): SettingsSectionDef[];
|
|
12
18
|
/**
|
|
13
19
|
* The assistant's Settings sections: the assistant, then Model providers, Models, Tools, Web and
|
|
@@ -187,10 +187,32 @@ function SharedProviderKey({ client, p }) {
|
|
|
187
187
|
},
|
|
188
188
|
] }));
|
|
189
189
|
}
|
|
190
|
+
const adminOnly = _jsx("p", { className: "text-muted-foreground text-sm", children: "Only an admin can change these." });
|
|
191
|
+
/** What each person may spend on the shared keys. A one-off allowance has no monthly cap: starter and grants set it. */
|
|
192
|
+
function SharedCap({ client, s }) {
|
|
193
|
+
const { apply } = useApply(client);
|
|
194
|
+
if (s.allowance?.period === 'once')
|
|
195
|
+
return null;
|
|
196
|
+
return (_jsx(Row, { label: "Each person may spend", info: "A month on the shared keys, every provider together. Past it, a person's own key pays.", children: _jsx(CapInput, { label: "Allowance per person", value: s.caps.app, onSave: (n) => void apply('cap', () => client.appCap(n)) }) }));
|
|
197
|
+
}
|
|
190
198
|
/** Admins only: the app's shared keys and what each person may spend on them. */
|
|
191
199
|
function SharedKeys({ client }) {
|
|
192
|
-
|
|
193
|
-
|
|
200
|
+
return (_jsx(WithStatus, { client: client, children: (s) => s.admin ? (_jsxs("div", { className: "flex flex-col", children: [_jsx(LumenExpandList, { children: s.providers.map((p) => (_jsx(SharedProviderKey, { client: client, p: p }, p.id))) }), _jsx(SharedCap, { client: client, s: s })] })) : (adminOnly) }));
|
|
201
|
+
}
|
|
202
|
+
/** Admins only: one provider's shared key on a section of its own, open. */
|
|
203
|
+
function SharedKey({ client, id }) {
|
|
204
|
+
return (_jsx(WithStatus, { client: client, children: (s) => {
|
|
205
|
+
const p = s.providers.find((x) => x.id === id);
|
|
206
|
+
if (!s.admin)
|
|
207
|
+
return adminOnly;
|
|
208
|
+
if (!p)
|
|
209
|
+
return null;
|
|
210
|
+
return (_jsx(LumenExpandList, { defaultOpen: p.id, children: _jsx(SharedProviderKey, { client: client, p: p }) }));
|
|
211
|
+
} }));
|
|
212
|
+
}
|
|
213
|
+
/** Admins only: the allowance alone, for apps that give each provider its own section. */
|
|
214
|
+
function SharedAllowance({ client }) {
|
|
215
|
+
return (_jsx(WithStatus, { client: client, children: (s) => (s.admin ? _jsx(SharedCap, { client: client, s: s }) : adminOnly) }));
|
|
194
216
|
}
|
|
195
217
|
// ---------------------------------------------------------------- models
|
|
196
218
|
function Models({ client }) {
|
|
@@ -365,15 +387,36 @@ function AllowanceRequests({ client }) {
|
|
|
365
387
|
* The admin's section: the app's shared keys and each person's monthly allowance on them. Put it
|
|
366
388
|
* where the app keeps its admin settings, shown only to admins.
|
|
367
389
|
*/
|
|
368
|
-
export function assistantAdminSections({ client, allowance = false, }) {
|
|
390
|
+
export function assistantAdminSections({ client, allowance = false, providers, }) {
|
|
391
|
+
const keys = providers
|
|
392
|
+
? [
|
|
393
|
+
{
|
|
394
|
+
id: 'assistant-shared-allowance',
|
|
395
|
+
title: 'Allowance',
|
|
396
|
+
icon: CoinsIcon,
|
|
397
|
+
description: 'What each person may spend on the shared keys',
|
|
398
|
+
content: _jsx(SharedAllowance, { client: client }),
|
|
399
|
+
},
|
|
400
|
+
...providers.map((p) => ({
|
|
401
|
+
id: `assistant-shared-key-${p.id}`,
|
|
402
|
+
title: p.label,
|
|
403
|
+
icon: KeyRoundIcon,
|
|
404
|
+
description: "The key everyone's answers run on",
|
|
405
|
+
sub: true,
|
|
406
|
+
content: _jsx(SharedKey, { client: client, id: p.id }),
|
|
407
|
+
})),
|
|
408
|
+
]
|
|
409
|
+
: [
|
|
410
|
+
{
|
|
411
|
+
id: 'assistant-shared-keys',
|
|
412
|
+
title: 'Shared model keys',
|
|
413
|
+
icon: KeyRoundIcon,
|
|
414
|
+
description: "Keys everyone's answers run on, and the allowance",
|
|
415
|
+
content: _jsx(SharedKeys, { client: client }),
|
|
416
|
+
},
|
|
417
|
+
];
|
|
369
418
|
return [
|
|
370
|
-
|
|
371
|
-
id: 'assistant-shared-keys',
|
|
372
|
-
title: 'Shared model keys',
|
|
373
|
-
icon: KeyRoundIcon,
|
|
374
|
-
description: "Keys everyone's answers run on, and the allowance",
|
|
375
|
-
content: _jsx(SharedKeys, { client: client }),
|
|
376
|
-
},
|
|
419
|
+
...keys,
|
|
377
420
|
...(allowance
|
|
378
421
|
? [
|
|
379
422
|
{
|
package/dist/settings.js
CHANGED
|
@@ -172,7 +172,7 @@ export function LumenSettings({ open, section, onOpen, onClose, appLabel, profil
|
|
|
172
172
|
...(sections.length ? [{ label: appLabel, items: sections.filter(shown) }] : []),
|
|
173
173
|
].filter((g) => g.items.length);
|
|
174
174
|
const search = (_jsxs(InputGroup, { className: "bg-background", children: [_jsx(InputGroupAddon, { children: _jsx(SearchIcon, {}) }), _jsx(InputGroupInput, { type: "search", className: "[&::-webkit-search-cancel-button]:hidden", "aria-label": "Search settings", placeholder: "Search", value: query, onChange: (e) => setQuery(e.target.value) }), query && (_jsx(InputGroupAddon, { align: "inline-end", children: _jsx(InputGroupButton, { size: "icon-xs", "aria-label": "Clear search", onClick: () => setQuery(''), children: _jsx(XIcon, {}) }) }))] }));
|
|
175
|
-
const header = (s, slot) => (_jsxs("div", { className: "flex items-
|
|
175
|
+
const header = (s, slot) => (_jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5 sm:flex-row sm:items-baseline sm:gap-3", children: [_jsxs("h3", { id: `settings-${s.id}-title`, className: "flex shrink-0 items-center gap-2 text-base font-semibold", children: [_jsx(s.icon, { className: "size-4 text-muted-foreground" }), s.title, s.health && _jsx(SettingStatus, { health: s.health, title: s.healthTitle })] }), s.description && (_jsx("p", { className: "min-w-0 truncate text-sm text-muted-foreground sm:border-l sm:pl-3", title: typeof s.description === 'string' ? s.description : undefined, children: s.description }))] }), _jsx("div", { ref: slot, className: "flex shrink-0 items-center gap-2 empty:hidden" })] }));
|
|
176
176
|
return (_jsx(Dialog, { open: open, onOpenChange: (o) => {
|
|
177
177
|
if (o)
|
|
178
178
|
onOpen(section);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@columenlabs/lumen-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.221",
|
|
4
4
|
"description": "Lumen: shared React components (frame, views, widgets, charts, drawers).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@codemirror/lang-javascript": "6.2.5",
|
|
50
50
|
"@codemirror/lang-json": "6.0.2",
|
|
51
51
|
"@codemirror/lang-sql": "6.10.0",
|
|
52
|
-
"@columenlabs/lumen-ui-types": "0.1.
|
|
52
|
+
"@columenlabs/lumen-ui-types": "0.1.221",
|
|
53
53
|
"@dnd-kit/core": "6.3.1",
|
|
54
54
|
"@dnd-kit/sortable": "10.0.0",
|
|
55
55
|
"@dnd-kit/utilities": "3.2.2",
|