bazilion 0.52.0 → 0.54.0
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/cli.js +3 -3
- package/dist/cli.js.map +1 -1
- package/dist/daemon.js +296 -232
- package/dist/daemon.js.map +1 -1
- package/dist/web/client/assets/AddProviderDialog-CkwSq3C7.js +1 -0
- package/dist/web/client/assets/AgentTemplateParts-CEn_4qVs.js +1 -0
- package/dist/web/client/assets/Button-UiegBKOK.js +1 -0
- package/dist/web/client/assets/ConfigPage-CUbHBhzx.js +1 -0
- package/dist/web/client/assets/ConfirmDialog-VqBOFZEp.js +1 -0
- package/dist/web/client/assets/ConnectionsView-ByARMcWP.js +1 -0
- package/dist/web/client/assets/ManagePage-BJWZd1ts.js +1 -0
- package/dist/web/client/assets/SectionTabs-ViZKm3-B.js +1 -0
- package/dist/web/client/assets/Segmented-MYKKTuZO.js +1 -0
- package/dist/web/client/assets/SkillsParts-UvNK5SYP.js +1 -0
- package/dist/web/client/assets/SpawnTeamModal-DG5UbJNK.js +1 -0
- package/dist/web/client/assets/TeamForm-DGlxWv4e.js +1 -0
- package/dist/web/client/assets/TeamThread-mkwODO0S.js +1 -0
- package/dist/web/client/assets/UnsavedChangesGuard-BmdwLH99.js +1 -0
- package/dist/web/client/assets/_id-CvcxNmBH.js +1 -0
- package/dist/web/client/assets/_id-UyBk7gRl.js +1 -0
- package/dist/web/client/assets/access-C8d8vaQ6.js +1 -0
- package/dist/web/client/assets/agent-actions-BgE9fKHH.js +1 -0
- package/dist/web/client/assets/agents-CgtzqBpD.js +1 -0
- package/dist/web/client/assets/agents-D7W4BT8r.js +1 -0
- package/dist/web/client/assets/arrow-right-D0HKRb7U.js +1 -0
- package/dist/web/client/assets/attention-D9mQWoKt.js +1 -0
- package/dist/web/client/assets/bot-Bb--PFVU.js +1 -0
- package/dist/web/client/assets/chevron-right-bs0TUSl2.js +1 -0
- package/dist/web/client/assets/config-Dw6GWf38.js +1 -0
- package/dist/web/client/assets/createLucideIcon-DkniuEtD.js +1 -0
- package/dist/web/client/assets/download-C4t9l5wR.js +1 -0
- package/dist/web/client/assets/file-text-DzbjpYrV.js +1 -0
- package/dist/web/client/assets/images-DSYgPKM7.js +1 -0
- package/dist/web/client/assets/index-YW0gXPfk.js +14 -0
- package/dist/web/client/assets/key-round-BpK4-E3T.js +1 -0
- package/dist/web/client/assets/list-checks-JNXcmws9.js +1 -0
- package/dist/web/client/assets/login-DcQJk5-U.js +1 -0
- package/dist/web/client/assets/manage-SRGSx8n2.js +1 -0
- package/dist/web/client/assets/mcp-BUWu4TvS.js +1 -0
- package/dist/web/client/assets/message-square-DM2MP9vF.js +1 -0
- package/dist/web/client/assets/network-BJ4iPjQO.js +1 -0
- package/dist/web/client/assets/parts-LZxl9Gvc.js +41 -0
- package/dist/web/client/assets/plus-CLGNN5QX.js +1 -0
- package/dist/web/client/assets/routes-BxIIyGho.js +85 -0
- package/dist/web/client/assets/skills-C7DzIwFJ.js +1 -0
- package/dist/web/client/assets/square-terminal-Dmm6cV-G.js +1 -0
- package/dist/web/client/assets/style-CA2GAk9b.js +7 -0
- package/dist/web/client/assets/styles-C3CDSGAr.css +2 -0
- package/dist/web/client/assets/system-zQ0NnQML.js +1 -0
- package/dist/web/client/assets/teams-BEIJHObN.js +1 -0
- package/dist/web/client/assets/teams-DlOc7Ods.js +1 -0
- package/dist/web/client/assets/telegram-DKHq5DpE.js +1 -0
- package/dist/web/client/assets/tools-BKIpLaiC.js +1 -0
- package/dist/web/client/assets/use-resource-CQaIZbpy.js +1 -0
- package/dist/web/client/assets/users-round-BJrym3FG.js +1 -0
- package/dist/web/client/assets/welcome-CyS4Hrd-.js +1 -0
- package/dist/web/client/assets/wrench-GbE1M1RJ.js +1 -0
- package/dist/web/server/assets/{AddProviderDialog-Tn4AskPm.js → AddProviderDialog-Nc5mc_P6.js} +106 -8
- package/dist/web/server/assets/AgentTemplateParts-DZK_r3nQ.js +266 -0
- package/dist/web/server/assets/{ConfigPage-DqDUujmt.js → ConfigPage-CxzL-gTm.js} +2 -2
- package/dist/web/server/assets/{ConfirmDialog-DfaJ--A6.js → ConfirmDialog-4xeCXKHe.js} +1 -2
- package/dist/web/server/assets/{ConnectionsView-DAG-zNBz.js → ConnectionsView-B02FjNsM.js} +9 -9
- package/dist/web/server/assets/ManagePage-BfCWE8Lj.js +29 -0
- package/dist/web/server/assets/ModelMenu-D-hTgYOO.js +278 -0
- package/dist/web/server/assets/{Rail-BIC_4ptO.js → Rail-3gbidhyv.js} +17 -110
- package/dist/web/server/assets/{SectionTabs-BGsrf-UQ.js → SectionTabs-CWQ5orUW.js} +9 -2
- package/dist/web/server/assets/SkillsParts-D58l8voo.js +199 -0
- package/dist/web/server/assets/SpawnDialog-MJWwppgC.js +1648 -0
- package/dist/web/server/assets/SpawnTeamModal-RjzAeX_Q.js +124 -0
- package/dist/web/server/assets/TeamForm-DdOgIMiV.js +138 -0
- package/dist/web/server/assets/{TeamThread-DuLlGDcw.js → TeamThread-D-PvO3fu.js} +9 -9
- package/dist/web/server/assets/{UnsavedChangesGuard-DrOvPV14.js → UnsavedChangesGuard-Bb5frygQ.js} +1 -1
- package/dist/web/server/assets/{_id-TVruGcOd.js → _id-BKzOw78O.js} +11 -3
- package/dist/web/server/assets/_id-BPjVkcNb.js +396 -0
- package/dist/web/server/assets/_id-BUfy-GwH.js +16 -0
- package/dist/web/server/assets/{_id-yN0z7VqE.js → _id-C1_l6oSR.js} +257 -207
- package/dist/web/server/assets/{_id-DJnYgisy.js → _id-CHvYQhWt.js} +8 -4
- package/dist/web/server/assets/_id-De3Bm0SG.js +39 -0
- package/dist/web/server/assets/_tanstack-start-manifest_v-CR3jm1nY.js +256 -0
- package/dist/web/server/assets/access-CNfvQ3NB.js +295 -0
- package/dist/web/server/assets/{access-GMGed5O8.js → access-Cm_izIIC.js} +2 -2
- package/dist/web/server/assets/{access-C_pupPks.js → access-WWspT0v4.js} +2 -1
- package/dist/web/server/assets/agent-actions-COnfW5AU.js +20 -0
- package/dist/web/server/assets/agents-C7UmTjfO.js +13 -0
- package/dist/web/server/assets/{agents-BnWgFo6o.js → agents-CRtMfKqX.js} +9 -6
- package/dist/web/server/assets/agents-D0hfGIMK.js +134 -0
- package/dist/web/server/assets/agents-DQowl6Ly.js +31 -0
- package/dist/web/server/assets/agents-DzpqlIuJ.js +12 -0
- package/dist/web/server/assets/agents-NOkh61dV.js +323 -0
- package/dist/web/server/assets/attention-CRvxt22X.js +232 -0
- package/dist/web/server/assets/{attention-Cr7puThv.js → attention-CgWhXjX7.js} +4 -1
- package/dist/web/server/assets/{attention-DS3O9UmJ.js → attention-Cx9ZWPOO.js} +4 -2
- package/dist/web/server/assets/{config-DjTGA4iZ.js → config-B5CS8juO.js} +2 -2
- package/dist/web/server/assets/{config-Q7livfa3.js → config-D117117T.js} +51 -102
- package/dist/web/server/assets/createSsrRpc-CwTd0zrB.js +72 -0
- package/dist/web/server/assets/{login-VV10kZBl.js → login-IF0Gbsuq.js} +36 -2
- package/dist/web/server/assets/{login-JoIjlcmu.js → login-va4EtvA8.js} +34 -45
- package/dist/web/server/assets/manage-Ce6cI4eW.js +240 -0
- package/dist/web/server/assets/{mcp-ZARSOxZW.js → mcp-Bm9U6x7N.js} +2 -2
- package/dist/web/server/assets/mcp-C96PBxpb.js +376 -0
- package/dist/web/server/assets/page-title-CwcbXMhx.js +95 -0
- package/dist/web/server/assets/{router-Dh2-IvLL.js → router-8Iq19GOz.js} +366 -203
- package/dist/web/server/assets/{routes-C9NawqcV.js → routes-BLo-fWbQ.js} +2681 -1667
- package/dist/web/server/assets/{routes-CDskMy5C.js → routes-BXvYYFrN.js} +2 -2
- package/dist/web/server/assets/routes-Kwam6JmS.js +89 -0
- package/dist/web/server/assets/{skills-StN15QhC.js → skills-BqCnA-74.js} +2 -2
- package/dist/web/server/assets/skills-DSezIdDc.js +157 -0
- package/dist/web/server/assets/{skills-h5aHa7Q8.js → skills-DWzlT_hC.js} +9 -1
- package/dist/web/server/assets/{style-GYDODk2F.js → style-C2hIPY_Y.js} +2 -2
- package/dist/web/server/assets/{system-Dl-1RhoP.js → system-CcLCmkIC.js} +2 -2
- package/dist/web/server/assets/{system-DtswhLW6.js → system-D3th6n2E.js} +4 -2
- package/dist/web/server/assets/system-E0VePdzO.js +145 -0
- package/dist/web/server/assets/{teams-BxnvFTyn.js → teams-70u1XQTr.js} +1 -3
- package/dist/web/server/assets/{teams-YrmyutM4.js → teams-BopOP4x7.js} +8 -1
- package/dist/web/server/assets/teams-CQVV18D3.js +216 -0
- package/dist/web/server/assets/teams-CdCmBJIj.js +174 -0
- package/dist/web/server/assets/{teams-5PMGvHuM.js → teams-DScFp8mK.js} +2 -2
- package/dist/web/server/assets/{teams-CbIPKf99.js → teams-DxA-vnzY.js} +4 -2
- package/dist/web/server/assets/telegram-DJ8s_91Y.js +1057 -0
- package/dist/web/server/assets/{telegram-Cv0D4gyz.js → telegram-DR7xijeS.js} +2 -2
- package/dist/web/server/assets/{tools-ioJcPzMW.js → tools-CsH9DI-4.js} +2 -2
- package/dist/web/server/assets/{tools-OfD22R-C.js → tools-V6kezUpL.js} +55 -218
- package/dist/web/server/assets/{use-resource-DVzK0toP.js → use-resource-CjcJwn7F.js} +1 -1
- package/dist/web/server/assets/{welcome-jxmpE_Jb.js → welcome-BpmcD-ia.js} +2 -2
- package/dist/web/server/assets/{welcome-FFEbrNT1.js → welcome-Ya8TkL4v.js} +10 -10
- package/dist/web/server/server.js +19 -19
- package/dist/worker.js +17 -0
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
- package/dist/web/client/assets/AddProviderDialog-BiGLKnu2.js +0 -1
- package/dist/web/client/assets/ConfigPage-DvBzy2MN.js +0 -1
- package/dist/web/client/assets/ConfirmDialog-CiZ5tk9R.js +0 -1
- package/dist/web/client/assets/ConnectionsView-Czkpm2JY.js +0 -1
- package/dist/web/client/assets/Dialog-s_kPtI-W.js +0 -1
- package/dist/web/client/assets/ModelMenu-BfUPoRjV.js +0 -1
- package/dist/web/client/assets/SectionTabs-DENNb6Nw.js +0 -1
- package/dist/web/client/assets/Segmented-Dh77vmpp.js +0 -1
- package/dist/web/client/assets/SkillFindings-Xng11qqx.js +0 -1
- package/dist/web/client/assets/SkillsPicker-hI3YXvib.js +0 -1
- package/dist/web/client/assets/SpawnDialog-CKWFQ6jk.js +0 -1
- package/dist/web/client/assets/Tabs-f6bHvCGn.js +0 -1
- package/dist/web/client/assets/TeamForm-kda1HYZG.js +0 -1
- package/dist/web/client/assets/TeamThread-2rm1JGSk.js +0 -1
- package/dist/web/client/assets/UnsavedChangesGuard-nx6dv2Yw.js +0 -1
- package/dist/web/client/assets/_id-B72mIpcE.js +0 -1
- package/dist/web/client/assets/_id-Bzavnza1.js +0 -1
- package/dist/web/client/assets/access-Yw9jODuk.js +0 -1
- package/dist/web/client/assets/agents-C9xoyL7o.js +0 -1
- package/dist/web/client/assets/agents-TviG16wx.js +0 -1
- package/dist/web/client/assets/api-HC_YzjBy.js +0 -1
- package/dist/web/client/assets/arrow-right-Gm_FDWJ_.js +0 -1
- package/dist/web/client/assets/attention-DmURtlJm.js +0 -1
- package/dist/web/client/assets/check-BjgKoGvU.js +0 -1
- package/dist/web/client/assets/chevron-right-CUZiA2aG.js +0 -1
- package/dist/web/client/assets/config-UZz_mjO5.js +0 -1
- package/dist/web/client/assets/createLucideIcon-C6gOo8sD.js +0 -1
- package/dist/web/client/assets/dist-BWppw70N.js +0 -41
- package/dist/web/client/assets/dist-D2dwY7MR.js +0 -1
- package/dist/web/client/assets/entities-xVoB-p2j.js +0 -1
- package/dist/web/client/assets/index-Df1oUtAP.js +0 -14
- package/dist/web/client/assets/link-Cbztlp_R.js +0 -1
- package/dist/web/client/assets/login-CPfdaqsV.js +0 -1
- package/dist/web/client/assets/mcp-FlYnNon0.js +0 -1
- package/dist/web/client/assets/model-facts-DoB6QD5y.js +0 -1
- package/dist/web/client/assets/parts-tIDBNsYA.js +0 -1
- package/dist/web/client/assets/plus-CWrKMtvA.js +0 -1
- package/dist/web/client/assets/routes-BZaWCoQj.js +0 -76
- package/dist/web/client/assets/save-f9O-CQia.js +0 -1
- package/dist/web/client/assets/skills-C7yDPC8s.js +0 -1
- package/dist/web/client/assets/style-DDuTFJUu.js +0 -7
- package/dist/web/client/assets/styles-BviXU81u.css +0 -2
- package/dist/web/client/assets/system-CL3Kz36L.js +0 -1
- package/dist/web/client/assets/teams-CQTEF5gV.js +0 -1
- package/dist/web/client/assets/teams-DQ7SqVyF.js +0 -1
- package/dist/web/client/assets/telegram-BLgxtGhZ.js +0 -1
- package/dist/web/client/assets/tools-pOQyGVYo.js +0 -1
- package/dist/web/client/assets/use-resource-C3MBZJop.js +0 -1
- package/dist/web/client/assets/welcome-Hr6JpMef.js +0 -1
- package/dist/web/client/assets/wrench-6BEIqKDn.js +0 -1
- package/dist/web/server/assets/Dialog-aup_yJv5.js +0 -85
- package/dist/web/server/assets/ModelMenu-DUY9aHkE.js +0 -138
- package/dist/web/server/assets/SkillFindings-BdATze1A.js +0 -46
- package/dist/web/server/assets/SkillsPicker-DlqEfRWh.js +0 -67
- package/dist/web/server/assets/SpawnDialog-D_SMPCG_.js +0 -132
- package/dist/web/server/assets/Tabs-BhF41MfQ.js +0 -20
- package/dist/web/server/assets/TeamForm-ilBaeLI4.js +0 -96
- package/dist/web/server/assets/_id-BsZcsabI.js +0 -383
- package/dist/web/server/assets/_id-D8Kj0F30.js +0 -18
- package/dist/web/server/assets/_id-QYifTM9w.js +0 -28
- package/dist/web/server/assets/_tanstack-start-manifest_v-D6zrzUC7.js +0 -223
- package/dist/web/server/assets/access-DKOpcHIJ.js +0 -232
- package/dist/web/server/assets/agents-B6OR3x99.js +0 -327
- package/dist/web/server/assets/agents-B7642eRO.js +0 -130
- package/dist/web/server/assets/agents-BJ-_oC2e.js +0 -14
- package/dist/web/server/assets/agents-CjV0w-Zy.js +0 -12
- package/dist/web/server/assets/agents-Dy_Q-9lG.js +0 -27
- package/dist/web/server/assets/attention-CLP4HYBz.js +0 -216
- package/dist/web/server/assets/createSsrRpc-GCCF14VW.js +0 -169
- package/dist/web/server/assets/entities-Dn2xzKIw.js +0 -16
- package/dist/web/server/assets/mcp-BI-FD-JI.js +0 -250
- package/dist/web/server/assets/model-facts-mrfrWQne.js +0 -136
- package/dist/web/server/assets/parts-B31PJkhi.js +0 -190
- package/dist/web/server/assets/routes-BJIJWCIE.js +0 -16
- package/dist/web/server/assets/skills-BqLq3ZXq.js +0 -275
- package/dist/web/server/assets/system-BtRA2HUs.js +0 -138
- package/dist/web/server/assets/teams-COaU0wN9.js +0 -108
- package/dist/web/server/assets/teams-Ca8W4mvl.js +0 -88
- package/dist/web/server/assets/telegram-Yx8nm6Ei.js +0 -984
- package/dist/web/server/assets/utils-C_uf36nf.js +0 -8
- package/dist/web/server/assets/workspace-DaitCM0t.js +0 -651
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { G as DialogActions, K as Button, W as Dialog, dt as errorMessage, f as TextField, k as Notice, lt as api, n as CheckboxRow, r as ChoiceCards } from "./SpawnDialog-MJWwppgC.js";
|
|
2
|
+
import { n as ModelMenu } from "./ModelMenu-D-hTgYOO.js";
|
|
3
|
+
import { S as slugify, x as slugProblem } from "./manage-Ce6cI4eW.js";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { useNavigate } from "@tanstack/react-router";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/manage/AgentTemplateParts.tsx
|
|
8
|
+
var TEMPLATE_FILES = [
|
|
9
|
+
{
|
|
10
|
+
key: "soul",
|
|
11
|
+
name: "SOUL.md",
|
|
12
|
+
hint: "Persona, values and operating principles. Part of every session.",
|
|
13
|
+
optional: false
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
key: "identity",
|
|
17
|
+
name: "IDENTITY.md",
|
|
18
|
+
hint: "Name, creature, vibe, emoji and avatar: filled in during the first conversation.",
|
|
19
|
+
optional: false
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
key: "bootstrap",
|
|
23
|
+
name: "BOOTSTRAP.md",
|
|
24
|
+
hint: "The first-run ritual in which the Agent introduces itself; it retires the file once done.",
|
|
25
|
+
optional: true
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
key: "agents",
|
|
29
|
+
name: "AGENTS.md",
|
|
30
|
+
hint: "How the Agent works in its workspace: memory, red lines, who it hands work to.",
|
|
31
|
+
optional: true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
key: "tools",
|
|
35
|
+
name: "TOOLS.md",
|
|
36
|
+
hint: "Notes on its tools and environment beyond the tool descriptions.",
|
|
37
|
+
optional: true
|
|
38
|
+
}
|
|
39
|
+
];
|
|
40
|
+
var SKILL_MODES = [{
|
|
41
|
+
value: "all",
|
|
42
|
+
label: "All skills",
|
|
43
|
+
hint: "Every installed skill, including ones imported later."
|
|
44
|
+
}, {
|
|
45
|
+
value: "selected",
|
|
46
|
+
label: "Chosen skills",
|
|
47
|
+
hint: "Only the ones ticked below."
|
|
48
|
+
}];
|
|
49
|
+
/** Which skills a template attaches at spawn: all of them, or the ticked ones. */
|
|
50
|
+
function SkillsChoice({ mode, picked, skills, disabled, onModeChange, onPickedChange }) {
|
|
51
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
52
|
+
className: "grid gap-3",
|
|
53
|
+
children: [
|
|
54
|
+
/* @__PURE__ */ jsx(ChoiceCards, {
|
|
55
|
+
legend: "Skills at spawn",
|
|
56
|
+
name: "template-skills",
|
|
57
|
+
value: mode,
|
|
58
|
+
options: SKILL_MODES,
|
|
59
|
+
disabled,
|
|
60
|
+
onChange: onModeChange
|
|
61
|
+
}),
|
|
62
|
+
mode === "selected" && (skills.length === 0 ? /* @__PURE__ */ jsxs("p", {
|
|
63
|
+
className: "m-0 text-sm text-muted-foreground",
|
|
64
|
+
children: [
|
|
65
|
+
"No skills are installed yet. Import some under ",
|
|
66
|
+
/* @__PURE__ */ jsx("a", {
|
|
67
|
+
href: "/skills",
|
|
68
|
+
children: "Skills"
|
|
69
|
+
}),
|
|
70
|
+
"."
|
|
71
|
+
]
|
|
72
|
+
}) : /* @__PURE__ */ jsxs("fieldset", {
|
|
73
|
+
className: "m-0 grid max-h-64 min-w-0 gap-2.5 overflow-y-auto rounded-xl border border-border bg-muted/30 p-3.5",
|
|
74
|
+
children: [/* @__PURE__ */ jsx("legend", {
|
|
75
|
+
className: "sr-only",
|
|
76
|
+
children: "Chosen skills"
|
|
77
|
+
}), skills.map((skill) => /* @__PURE__ */ jsx(CheckboxRow, {
|
|
78
|
+
checked: picked.has(skill.name),
|
|
79
|
+
disabled,
|
|
80
|
+
label: /* @__PURE__ */ jsxs("span", {
|
|
81
|
+
className: "min-w-0",
|
|
82
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
83
|
+
className: "font-mono text-[0.9em] font-semibold",
|
|
84
|
+
children: skill.name
|
|
85
|
+
}), skill.description && /* @__PURE__ */ jsxs("span", {
|
|
86
|
+
className: "text-muted-foreground",
|
|
87
|
+
children: [" · ", skill.description]
|
|
88
|
+
})]
|
|
89
|
+
}),
|
|
90
|
+
onChange: (checked) => {
|
|
91
|
+
const next = new Set(picked);
|
|
92
|
+
if (checked) next.add(skill.name);
|
|
93
|
+
else next.delete(skill.name);
|
|
94
|
+
onPickedChange(next);
|
|
95
|
+
}
|
|
96
|
+
}, skill.name))]
|
|
97
|
+
})),
|
|
98
|
+
/* @__PURE__ */ jsx("p", {
|
|
99
|
+
className: "m-0 text-xs text-muted-foreground",
|
|
100
|
+
children: "Each Agent can still attach or detach skills after it is spawned."
|
|
101
|
+
})
|
|
102
|
+
]
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/** Create an Agent template from the starter files, then open it to edit them. */
|
|
106
|
+
function CreateAgentTemplateDialog({ chat, skills, starter, onClose }) {
|
|
107
|
+
const navigate = useNavigate();
|
|
108
|
+
const [name, setName] = useState("");
|
|
109
|
+
const [id, setId] = useState("");
|
|
110
|
+
const [idTouched, setIdTouched] = useState(false);
|
|
111
|
+
const [model, setModel] = useState("");
|
|
112
|
+
const [mode, setMode] = useState("all");
|
|
113
|
+
const [picked, setPicked] = useState(/* @__PURE__ */ new Set());
|
|
114
|
+
const [optional, setOptional] = useState({
|
|
115
|
+
soul: true,
|
|
116
|
+
identity: true,
|
|
117
|
+
bootstrap: true,
|
|
118
|
+
agents: true,
|
|
119
|
+
tools: true
|
|
120
|
+
});
|
|
121
|
+
const [busy, setBusy] = useState(false);
|
|
122
|
+
const [error, setError] = useState(null);
|
|
123
|
+
const shownId = idTouched ? id : slugify(name);
|
|
124
|
+
const idProblem = slugProblem(shownId);
|
|
125
|
+
const ready = shownId !== "" && !idProblem && model !== "";
|
|
126
|
+
async function create(event) {
|
|
127
|
+
event.preventDefault();
|
|
128
|
+
if (!ready || busy) return;
|
|
129
|
+
setBusy(true);
|
|
130
|
+
setError(null);
|
|
131
|
+
try {
|
|
132
|
+
await api("/api/profiles", { body: {
|
|
133
|
+
id: shownId,
|
|
134
|
+
name: name.trim() || void 0,
|
|
135
|
+
defaultModel: model,
|
|
136
|
+
skillsMode: mode,
|
|
137
|
+
defaultSkills: mode === "selected" ? [...picked] : [],
|
|
138
|
+
soul: starter.soul,
|
|
139
|
+
identity: starter.identity,
|
|
140
|
+
bootstrap: optional.bootstrap ? starter.bootstrap : null,
|
|
141
|
+
agents: optional.agents ? starter.agents : null,
|
|
142
|
+
tools: optional.tools ? starter.tools : null
|
|
143
|
+
} });
|
|
144
|
+
await navigate({
|
|
145
|
+
to: "/templates/agents/$id",
|
|
146
|
+
params: { id: shownId }
|
|
147
|
+
});
|
|
148
|
+
} catch (cause) {
|
|
149
|
+
setError(errorMessage(cause));
|
|
150
|
+
setBusy(false);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return /* @__PURE__ */ jsx(Dialog, {
|
|
154
|
+
title: "New Agent template",
|
|
155
|
+
description: "It starts from the built-in files, which you can edit next. Agents spawned from it get their own copies.",
|
|
156
|
+
busy,
|
|
157
|
+
onClose,
|
|
158
|
+
className: "max-w-xl",
|
|
159
|
+
children: /* @__PURE__ */ jsxs("form", {
|
|
160
|
+
onSubmit: (event) => void create(event),
|
|
161
|
+
className: "grid gap-4",
|
|
162
|
+
children: [
|
|
163
|
+
/* @__PURE__ */ jsxs("div", {
|
|
164
|
+
className: "grid items-start gap-x-3 gap-y-4 sm:grid-cols-2",
|
|
165
|
+
children: [/* @__PURE__ */ jsx(TextField, {
|
|
166
|
+
label: "Name",
|
|
167
|
+
value: name,
|
|
168
|
+
disabled: busy,
|
|
169
|
+
placeholder: "Writer",
|
|
170
|
+
className: "max-w-none",
|
|
171
|
+
onChange: setName
|
|
172
|
+
}), /* @__PURE__ */ jsx(TextField, {
|
|
173
|
+
label: "ID",
|
|
174
|
+
value: shownId,
|
|
175
|
+
disabled: busy,
|
|
176
|
+
placeholder: "writer",
|
|
177
|
+
mono: true,
|
|
178
|
+
className: "max-w-none",
|
|
179
|
+
problem: idProblem,
|
|
180
|
+
onChange: (value) => {
|
|
181
|
+
setIdTouched(true);
|
|
182
|
+
setId(value);
|
|
183
|
+
}
|
|
184
|
+
})]
|
|
185
|
+
}),
|
|
186
|
+
/* @__PURE__ */ jsx(ModelMenu, {
|
|
187
|
+
kit: true,
|
|
188
|
+
label: "Default model",
|
|
189
|
+
value: model,
|
|
190
|
+
onChange: setModel,
|
|
191
|
+
models: chat,
|
|
192
|
+
required: true
|
|
193
|
+
}),
|
|
194
|
+
chat.length === 0 && /* @__PURE__ */ jsxs(Notice, {
|
|
195
|
+
tone: "warning",
|
|
196
|
+
children: [
|
|
197
|
+
"No chat model is in use yet. Add one under ",
|
|
198
|
+
/* @__PURE__ */ jsx("a", {
|
|
199
|
+
href: "/config",
|
|
200
|
+
children: "Setup → Models"
|
|
201
|
+
}),
|
|
202
|
+
" first."
|
|
203
|
+
]
|
|
204
|
+
}),
|
|
205
|
+
/* @__PURE__ */ jsx(SkillsChoice, {
|
|
206
|
+
mode,
|
|
207
|
+
picked,
|
|
208
|
+
skills,
|
|
209
|
+
disabled: busy,
|
|
210
|
+
onModeChange: setMode,
|
|
211
|
+
onPickedChange: setPicked
|
|
212
|
+
}),
|
|
213
|
+
/* @__PURE__ */ jsxs("fieldset", {
|
|
214
|
+
className: "m-0 grid min-w-0 gap-2.5 border-0 p-0",
|
|
215
|
+
children: [
|
|
216
|
+
/* @__PURE__ */ jsx("legend", {
|
|
217
|
+
className: "mb-2 p-0 text-sm font-semibold text-foreground",
|
|
218
|
+
children: "Files"
|
|
219
|
+
}),
|
|
220
|
+
/* @__PURE__ */ jsx("p", {
|
|
221
|
+
className: "m-0 text-xs text-muted-foreground",
|
|
222
|
+
children: "SOUL.md and IDENTITY.md are always there. These three can be left out:"
|
|
223
|
+
}),
|
|
224
|
+
TEMPLATE_FILES.filter((file) => file.optional).map((file) => /* @__PURE__ */ jsx(CheckboxRow, {
|
|
225
|
+
checked: optional[file.key],
|
|
226
|
+
disabled: busy,
|
|
227
|
+
label: /* @__PURE__ */ jsxs("span", {
|
|
228
|
+
className: "min-w-0",
|
|
229
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
230
|
+
className: "font-mono text-[0.9em] font-semibold",
|
|
231
|
+
children: file.name
|
|
232
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
233
|
+
className: "text-muted-foreground",
|
|
234
|
+
children: [" · ", file.hint]
|
|
235
|
+
})]
|
|
236
|
+
}),
|
|
237
|
+
onChange: (checked) => setOptional((current) => ({
|
|
238
|
+
...current,
|
|
239
|
+
[file.key]: checked
|
|
240
|
+
}))
|
|
241
|
+
}, file.key))
|
|
242
|
+
]
|
|
243
|
+
}),
|
|
244
|
+
error && /* @__PURE__ */ jsx(Notice, {
|
|
245
|
+
tone: "warning",
|
|
246
|
+
role: "alert",
|
|
247
|
+
title: "The template was not created.",
|
|
248
|
+
children: error
|
|
249
|
+
}),
|
|
250
|
+
/* @__PURE__ */ jsxs(DialogActions, { children: [/* @__PURE__ */ jsx(Button, {
|
|
251
|
+
variant: "ghost",
|
|
252
|
+
disabled: busy,
|
|
253
|
+
onClick: onClose,
|
|
254
|
+
children: "Cancel"
|
|
255
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
256
|
+
variant: "primary",
|
|
257
|
+
type: "submit",
|
|
258
|
+
disabled: busy || !ready,
|
|
259
|
+
children: busy ? "Creating…" : "Create and edit its files"
|
|
260
|
+
})] })
|
|
261
|
+
]
|
|
262
|
+
})
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
//#endregion
|
|
266
|
+
export { SkillsChoice as n, TEMPLATE_FILES as r, CreateAgentTemplateDialog as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { n as PageHeader, r as PageShell } from "./createSsrRpc-CwTd0zrB.js";
|
|
2
|
+
import { r as SectionTabs, t as CONFIG_TABS } from "./SectionTabs-CWQ5orUW.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/ConfigPage.tsx
|
|
5
5
|
function ConfigPage({ title, description, children, actions, size = "default" }) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as DialogActions, t as Dialog } from "./Dialog-aup_yJv5.js";
|
|
1
|
+
import { G as DialogActions, K as Button, W as Dialog, dt as errorMessage } from "./SpawnDialog-MJWwppgC.js";
|
|
3
2
|
import { useEffect, useState } from "react";
|
|
4
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
4
|
//#region src/components/ConfirmDialog.tsx
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as endpointLabel, c as liveEdges, l as sameDocument, n as OUTSIDE, o as hasEdge, s as liveDocument, t as TeamPolicyMatrix, u as setEdge } from "./style-
|
|
3
|
-
import { r as useResource } from "./use-resource-
|
|
4
|
-
import { t as ConfirmDialog } from "./ConfirmDialog-
|
|
1
|
+
import { K as Button, dt as errorMessage, lt as api, nt as useActivity, q as AgentAvatar } from "./SpawnDialog-MJWwppgC.js";
|
|
2
|
+
import { a as endpointLabel, c as liveEdges, l as sameDocument, n as OUTSIDE, o as hasEdge, s as liveDocument, t as TeamPolicyMatrix, u as setEdge } from "./style-C2hIPY_Y.js";
|
|
3
|
+
import { r as useResource } from "./use-resource-CjcJwn7F.js";
|
|
4
|
+
import { t as ConfirmDialog } from "./ConfirmDialog-4xeCXKHe.js";
|
|
5
5
|
import { t as Segmented } from "./Segmented-3ZLdqa5U.js";
|
|
6
|
-
import { t as UnsavedChangesGuard } from "./UnsavedChangesGuard-
|
|
7
|
-
import { c as useWorkspace, i as STATE_DOT } from "./Rail-
|
|
8
|
-
import { i as pairKey, n as useTeamMessages, o as FocusFrame, t as TeamThread } from "./TeamThread-
|
|
6
|
+
import { t as UnsavedChangesGuard } from "./UnsavedChangesGuard-Bb5frygQ.js";
|
|
7
|
+
import { c as useWorkspace, i as STATE_DOT } from "./Rail-3gbidhyv.js";
|
|
8
|
+
import { i as pairKey, n as useTeamMessages, o as FocusFrame, t as TeamThread } from "./TeamThread-D-PvO3fu.js";
|
|
9
9
|
import { useEffect, useMemo, useState } from "react";
|
|
10
10
|
import { Link, useRouter } from "@tanstack/react-router";
|
|
11
11
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -54,7 +54,7 @@ function MemberNodeView({ data, selected }) {
|
|
|
54
54
|
className: "block truncate text-sm font-semibold text-chocolate",
|
|
55
55
|
children: member.name
|
|
56
56
|
}), /* @__PURE__ */ jsxs("span", {
|
|
57
|
-
className: `mt-0.5 flex min-w-0 items-center gap-1.5 text-
|
|
57
|
+
className: `mt-0.5 flex min-w-0 items-center gap-1.5 text-xs ${member.isolated ? "font-semibold text-warning" : "text-mocha"}`,
|
|
58
58
|
children: [/* @__PURE__ */ jsx("span", {
|
|
59
59
|
className: `size-[7px] shrink-0 rounded-full ${STATE_DOT[member.state.kind]}`,
|
|
60
60
|
"aria-hidden": "true"
|
|
@@ -533,7 +533,7 @@ function Editor({ team, policy }) {
|
|
|
533
533
|
children: "Select an Agent to choose who it can message, or a line to see what two Agents said to each other. You can always talk to every Agent, and every Agent can always reach you."
|
|
534
534
|
})] }),
|
|
535
535
|
/* @__PURE__ */ jsx("h2", {
|
|
536
|
-
className: "m-0 mb-1.5 mt-5 font-body text-
|
|
536
|
+
className: "m-0 mb-1.5 mt-5 font-body text-xs font-bold uppercase tracking-[0.08em] text-muted-foreground",
|
|
537
537
|
children: pair ? "Messages between them" : selectedActor ? `Messages of ${endpointLabel(draft, selectedActor)}` : "Recent messages"
|
|
538
538
|
}),
|
|
539
539
|
messages.error ? /* @__PURE__ */ jsx("p", {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { n as PageHeader, r as PageShell } from "./createSsrRpc-CwTd0zrB.js";
|
|
2
|
+
import { n as MANAGE_TABS, r as SectionTabs } from "./SectionTabs-CWQ5orUW.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/ManagePage.tsx
|
|
5
|
+
/** A page of Manage: Agents, Teams, their templates and the skills, under one tab bar. */
|
|
6
|
+
function ManagePage({ title, description, children, actions, size = "default" }) {
|
|
7
|
+
return /* @__PURE__ */ jsxs(PageShell, {
|
|
8
|
+
size,
|
|
9
|
+
children: [
|
|
10
|
+
/* @__PURE__ */ jsx(PageHeader, {
|
|
11
|
+
eyebrow: "Manage",
|
|
12
|
+
title,
|
|
13
|
+
description,
|
|
14
|
+
actions
|
|
15
|
+
}),
|
|
16
|
+
/* @__PURE__ */ jsx(SectionTabs, {
|
|
17
|
+
label: "Manage sections",
|
|
18
|
+
base: "",
|
|
19
|
+
tabs: MANAGE_TABS
|
|
20
|
+
}),
|
|
21
|
+
/* @__PURE__ */ jsx("div", {
|
|
22
|
+
className: "space-y-6",
|
|
23
|
+
children
|
|
24
|
+
})
|
|
25
|
+
]
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { ManagePage as t };
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { useId } from "react";
|
|
2
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Check, ChevronDown } from "lucide-react";
|
|
4
|
+
import { Select } from "radix-ui";
|
|
5
|
+
import { clsx } from "clsx";
|
|
6
|
+
import { twMerge } from "tailwind-merge";
|
|
7
|
+
//#region src/lib/utils.ts
|
|
8
|
+
function cn(...inputs) {
|
|
9
|
+
return twMerge(clsx(inputs));
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/lib/model-facts.ts
|
|
13
|
+
function modelName(model) {
|
|
14
|
+
return model.name ?? model.id;
|
|
15
|
+
}
|
|
16
|
+
/** A context window in the units people say: `1M`, `272K`. */
|
|
17
|
+
function formatContext(tokens) {
|
|
18
|
+
if (!tokens || tokens <= 0) return null;
|
|
19
|
+
if (tokens >= 1e6) return `${(tokens / 1e6).toFixed(1).replace(/\.0$/, "")}M`;
|
|
20
|
+
return `${Math.round(tokens / 1e3)}K`;
|
|
21
|
+
}
|
|
22
|
+
/** A dollar amount with cents, and the third decimal only when it carries something. */
|
|
23
|
+
function formatUsd(value) {
|
|
24
|
+
if (Number.isInteger(value)) return `$${value}`;
|
|
25
|
+
const fixed = value.toFixed(3);
|
|
26
|
+
return `$${fixed.endsWith("0") ? fixed.slice(0, -1) : fixed}`;
|
|
27
|
+
}
|
|
28
|
+
/** What a model can do, in one line. A model the catalog does not know has nothing to say. */
|
|
29
|
+
function factsLine(model, connect) {
|
|
30
|
+
const context = formatContext(model.contextWindow);
|
|
31
|
+
if (!model.name && !context) return connect === "local" ? "Loaded on the server" : "Not in the bundled catalog";
|
|
32
|
+
return [
|
|
33
|
+
context ? `${context} context` : null,
|
|
34
|
+
model.images ? "sees images" : "text only",
|
|
35
|
+
model.reasoning ? "reasoning" : null
|
|
36
|
+
].filter(Boolean).join(" · ");
|
|
37
|
+
}
|
|
38
|
+
/** What a model costs: the list price per million tokens, or who pays instead. */
|
|
39
|
+
function priceLine(model, connect) {
|
|
40
|
+
if (connect === "signin") return "Included in your plan";
|
|
41
|
+
if (connect === "local") return "Runs on your hardware";
|
|
42
|
+
if (!model.price) return "No list price";
|
|
43
|
+
return `${formatUsd(model.price.input)} in · ${formatUsd(model.price.output)} out`;
|
|
44
|
+
}
|
|
45
|
+
function usedByLine(usedBy) {
|
|
46
|
+
const parts = [...usedBy.templates.map((name) => `${name} template`), usedBy.agents === 1 ? "1 Agent" : usedBy.agents > 1 ? `${usedBy.agents} Agents` : null].filter(Boolean);
|
|
47
|
+
return parts.length > 0 ? parts.join(", ") : "Not used yet";
|
|
48
|
+
}
|
|
49
|
+
/** The two facts that matter when choosing a model: how much it reads, whether it sees images. */
|
|
50
|
+
function menuFacts(model) {
|
|
51
|
+
const context = formatContext(model.contextWindow);
|
|
52
|
+
if (!context) return model.providerConnect === "local" ? "on this computer" : "";
|
|
53
|
+
return `${context} · ${model.images ? "sees images" : "text only"}`;
|
|
54
|
+
}
|
|
55
|
+
/** Chat models by provider, in the order the Models page lists them. */
|
|
56
|
+
function menuGroups(models) {
|
|
57
|
+
const groups = /* @__PURE__ */ new Map();
|
|
58
|
+
for (const model of models) {
|
|
59
|
+
const group = groups.get(model.provider) ?? {
|
|
60
|
+
provider: model.provider,
|
|
61
|
+
name: model.providerName,
|
|
62
|
+
trouble: model.providerState === "failing" || model.providerState === "incomplete" ? "not working" : null,
|
|
63
|
+
models: []
|
|
64
|
+
};
|
|
65
|
+
group.models.push(model);
|
|
66
|
+
groups.set(model.provider, group);
|
|
67
|
+
}
|
|
68
|
+
return [...groups.values()];
|
|
69
|
+
}
|
|
70
|
+
/** Whether a model matches what was typed: every word, in its name or id. */
|
|
71
|
+
function matchesModel(model, query) {
|
|
72
|
+
const haystack = `${model.name ?? ""} ${model.id}`.toLowerCase();
|
|
73
|
+
return query.toLowerCase().split(/\s+/).filter(Boolean).every((word) => haystack.includes(word));
|
|
74
|
+
}
|
|
75
|
+
/** "2 minutes ago", for something that happened at `at`. */
|
|
76
|
+
function ago(at, now) {
|
|
77
|
+
const seconds = Math.max(0, Math.round((now - at) / 1e3));
|
|
78
|
+
if (seconds < 45) return "just now";
|
|
79
|
+
const minutes = Math.round(seconds / 60);
|
|
80
|
+
if (minutes < 60) return minutes === 1 ? "1 minute ago" : `${minutes} minutes ago`;
|
|
81
|
+
const hours = Math.round(minutes / 60);
|
|
82
|
+
if (hours < 24) return hours === 1 ? "1 hour ago" : `${hours} hours ago`;
|
|
83
|
+
const days = Math.round(hours / 24);
|
|
84
|
+
if (days < 30) return days === 1 ? "yesterday" : `${days} days ago`;
|
|
85
|
+
return `on ${new Date(at).toISOString().slice(0, 10)}`;
|
|
86
|
+
}
|
|
87
|
+
var FAILURE_LABEL = {
|
|
88
|
+
credentials: "Key rejected",
|
|
89
|
+
unreachable: "Not answering",
|
|
90
|
+
model: "Model unavailable",
|
|
91
|
+
limit: "Limit reached",
|
|
92
|
+
other: "Failing"
|
|
93
|
+
};
|
|
94
|
+
/** A provider's state as a chip: a few words and how loud they are. */
|
|
95
|
+
function providerStatus(provider, now) {
|
|
96
|
+
switch (provider.state) {
|
|
97
|
+
case "working": return {
|
|
98
|
+
label: provider.check ? `Working · tested ${ago(provider.check.at, now)}` : "Working",
|
|
99
|
+
tone: "success"
|
|
100
|
+
};
|
|
101
|
+
case "failing": {
|
|
102
|
+
const kind = provider.check?.failure?.kind ?? "other";
|
|
103
|
+
const label = kind === "credentials" && provider.connect === "signin" ? "Sign-in rejected" : FAILURE_LABEL[kind];
|
|
104
|
+
return {
|
|
105
|
+
label: provider.check ? `${label} · tried ${ago(provider.check.at, now)}` : label,
|
|
106
|
+
tone: "warning"
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
case "incomplete": return {
|
|
110
|
+
label: provider.connect === "signin" ? "Not signed in" : provider.fields.some((field) => field.kind === "secret") ? "Needs a key" : "Needs credentials",
|
|
111
|
+
tone: "warning"
|
|
112
|
+
};
|
|
113
|
+
case "off": return {
|
|
114
|
+
label: provider.models.length === 0 ? "Saved, not in use" : "Turned off",
|
|
115
|
+
tone: "neutral"
|
|
116
|
+
};
|
|
117
|
+
default: return {
|
|
118
|
+
label: "Not tested yet",
|
|
119
|
+
tone: "neutral"
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/** How a provider is connected, in a few words, for its row. */
|
|
124
|
+
function credentialLine(provider) {
|
|
125
|
+
if (provider.connect === "signin") return provider.configured ? "Signed in with your ChatGPT account" : "Not signed in";
|
|
126
|
+
if (provider.connect === "local") return provider.address ?? "A model server on this network";
|
|
127
|
+
const key = provider.fields.find((field) => field.kind === "secret" && field.set);
|
|
128
|
+
if (key) return `${key.label} ${key.preview ?? "saved"}`;
|
|
129
|
+
if (provider.configured) return "Credentials from the daemon’s environment";
|
|
130
|
+
return "No credentials saved";
|
|
131
|
+
}
|
|
132
|
+
/** The models to ask first: suggested ones, then the ones already in use. */
|
|
133
|
+
function initialPicks(models) {
|
|
134
|
+
const selected = models.filter((model) => model.selected).map((model) => model.id);
|
|
135
|
+
if (selected.length > 0) return selected;
|
|
136
|
+
return models.filter((model) => model.suggested).map((model) => model.id);
|
|
137
|
+
}
|
|
138
|
+
/** The cheapest of the given models by list price; unpriced ones come last, in order. */
|
|
139
|
+
function cheapest(models) {
|
|
140
|
+
const cost = (model) => model.price ? model.price.input + model.price.output : Number.POSITIVE_INFINITY;
|
|
141
|
+
return models.map((model, index) => ({
|
|
142
|
+
model,
|
|
143
|
+
index
|
|
144
|
+
})).sort((a, b) => cost(a.model) - cost(b.model) || a.index - b.index)[0]?.model;
|
|
145
|
+
}
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region src/components/ModelMenu.tsx
|
|
148
|
+
/** The Models overview, whose `chat` list the menu shows. */
|
|
149
|
+
var MODELS_PATH = "/api/config/models";
|
|
150
|
+
var INHERITED = ":inherited";
|
|
151
|
+
var ITEM = "relative flex cursor-pointer select-none items-baseline gap-x-3 rounded-lg py-2 pl-8 pr-3 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground";
|
|
152
|
+
function ModelMenu({ label, value, onChange, models, inherited, required, disabled = false, kit = false }) {
|
|
153
|
+
const id = useId();
|
|
154
|
+
const find = (candidate) => models.find((model) => model.value === candidate);
|
|
155
|
+
const named = (candidate) => {
|
|
156
|
+
const model = find(candidate);
|
|
157
|
+
return model ? modelName(model) : candidate;
|
|
158
|
+
};
|
|
159
|
+
const chosen = find(value);
|
|
160
|
+
const unlisted = value !== "" && !chosen;
|
|
161
|
+
const groups = menuGroups(models);
|
|
162
|
+
const empty = models.length === 0 && !inherited;
|
|
163
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
164
|
+
className: kit ? "min-w-0" : "my-[0.6rem]",
|
|
165
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
166
|
+
id: `${id}-label`,
|
|
167
|
+
className: kit ? "mb-1.5 block text-sm font-semibold text-foreground" : "block text-[0.9em] text-mocha",
|
|
168
|
+
children: label
|
|
169
|
+
}), /* @__PURE__ */ jsxs(Select.Root, {
|
|
170
|
+
value: value === "" ? inherited ? INHERITED : "" : value,
|
|
171
|
+
onValueChange: (next) => onChange(next === INHERITED ? "" : next),
|
|
172
|
+
required,
|
|
173
|
+
disabled: empty || disabled,
|
|
174
|
+
children: [/* @__PURE__ */ jsxs(Select.Trigger, {
|
|
175
|
+
"aria-labelledby": `${id}-label ${id}-value`,
|
|
176
|
+
className: "flex min-h-[2.65rem] w-full items-center justify-between gap-2 rounded-[var(--radius-md)] border border-frost bg-[color-mix(in_srgb,var(--color-snow)_82%,var(--color-ivory))] px-[0.8rem] py-[0.5rem] text-left text-[0.95em] text-chocolate transition-all focus-visible:border-sapphire focus-visible:bg-snow focus-visible:shadow-[0_0_0_3px_var(--color-sapphire-glow)] disabled:opacity-60 data-[state=open]:border-sapphire",
|
|
177
|
+
style: { outline: "none" },
|
|
178
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
179
|
+
id: `${id}-value`,
|
|
180
|
+
className: "min-w-0 flex-1 truncate",
|
|
181
|
+
children: value === "" ? inherited ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
182
|
+
inherited.model ? named(inherited.model) : inherited.label,
|
|
183
|
+
" ",
|
|
184
|
+
inherited.model && /* @__PURE__ */ jsx("span", {
|
|
185
|
+
className: "ml-1 text-[0.9em] text-mocha-light",
|
|
186
|
+
children: inherited.label.toLowerCase()
|
|
187
|
+
})
|
|
188
|
+
] }) : /* @__PURE__ */ jsx("span", {
|
|
189
|
+
className: "text-mocha-light",
|
|
190
|
+
children: empty ? "No chat model yet" : "Pick a model"
|
|
191
|
+
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
192
|
+
named(value),
|
|
193
|
+
" ",
|
|
194
|
+
/* @__PURE__ */ jsx("span", {
|
|
195
|
+
className: "ml-1 text-[0.9em] text-mocha-light",
|
|
196
|
+
children: chosen ? chosen.providerName : "not in Chat"
|
|
197
|
+
})
|
|
198
|
+
] })
|
|
199
|
+
}), /* @__PURE__ */ jsx(Select.Icon, {
|
|
200
|
+
asChild: true,
|
|
201
|
+
children: /* @__PURE__ */ jsx(ChevronDown, {
|
|
202
|
+
className: "size-4 shrink-0 text-mocha-light",
|
|
203
|
+
"aria-hidden": "true"
|
|
204
|
+
})
|
|
205
|
+
})]
|
|
206
|
+
}), /* @__PURE__ */ jsx(Select.Portal, { children: /* @__PURE__ */ jsxs(Select.Content, {
|
|
207
|
+
position: "popper",
|
|
208
|
+
sideOffset: 6,
|
|
209
|
+
className: "z-50 max-h-[min(26rem,var(--radix-select-content-available-height))] w-[max(var(--radix-select-trigger-width),18rem)] max-w-[calc(100vw-1.5rem)] overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-baziu-lg",
|
|
210
|
+
children: [/* @__PURE__ */ jsxs(Select.Viewport, {
|
|
211
|
+
className: "p-1.5",
|
|
212
|
+
children: [
|
|
213
|
+
inherited && /* @__PURE__ */ jsx(Option, {
|
|
214
|
+
value: INHERITED,
|
|
215
|
+
name: inherited.label,
|
|
216
|
+
children: inherited.model ? named(inherited.model) : ""
|
|
217
|
+
}),
|
|
218
|
+
unlisted && /* @__PURE__ */ jsx(Option, {
|
|
219
|
+
value,
|
|
220
|
+
name: value,
|
|
221
|
+
mono: true,
|
|
222
|
+
children: "not in Chat"
|
|
223
|
+
}),
|
|
224
|
+
groups.map((group) => /* @__PURE__ */ jsxs(Select.Group, { children: [/* @__PURE__ */ jsxs(Select.Label, {
|
|
225
|
+
className: "flex items-baseline gap-2 px-3 pb-1 pt-2.5 text-xs font-bold uppercase tracking-[0.08em] text-muted-foreground",
|
|
226
|
+
children: [group.name, group.trouble && /* @__PURE__ */ jsx("span", {
|
|
227
|
+
className: "font-semibold normal-case tracking-normal text-warning",
|
|
228
|
+
children: group.trouble
|
|
229
|
+
})]
|
|
230
|
+
}), group.models.map((model) => /* @__PURE__ */ jsx(Option, {
|
|
231
|
+
value: model.value,
|
|
232
|
+
name: modelName(model),
|
|
233
|
+
mono: !model.name,
|
|
234
|
+
children: menuFacts(model)
|
|
235
|
+
}, model.value))] }, group.provider)),
|
|
236
|
+
models.length === 0 && /* @__PURE__ */ jsx("p", {
|
|
237
|
+
className: "m-0 px-3 py-2 text-sm text-muted-foreground",
|
|
238
|
+
children: "No chat model is in use yet."
|
|
239
|
+
})
|
|
240
|
+
]
|
|
241
|
+
}), /* @__PURE__ */ jsx("a", {
|
|
242
|
+
href: "/config?pick=true",
|
|
243
|
+
className: "block border-t border-border px-4 py-2.5 text-sm font-semibold text-primary hover:bg-muted/50",
|
|
244
|
+
children: "Add models in Setup"
|
|
245
|
+
})]
|
|
246
|
+
}) })]
|
|
247
|
+
})]
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
function Option({ value, name, mono = false, children }) {
|
|
251
|
+
return /* @__PURE__ */ jsxs(Select.Item, {
|
|
252
|
+
value,
|
|
253
|
+
className: ITEM,
|
|
254
|
+
style: { outline: "none" },
|
|
255
|
+
children: [
|
|
256
|
+
/* @__PURE__ */ jsx(Select.ItemIndicator, {
|
|
257
|
+
className: "absolute left-2.5 top-1/2 -translate-y-1/2",
|
|
258
|
+
children: /* @__PURE__ */ jsx(Check, {
|
|
259
|
+
className: "size-4 text-primary",
|
|
260
|
+
"aria-hidden": "true"
|
|
261
|
+
})
|
|
262
|
+
}),
|
|
263
|
+
/* @__PURE__ */ jsx(Select.ItemText, {
|
|
264
|
+
asChild: true,
|
|
265
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
266
|
+
className: cn("min-w-0 flex-1 break-words", mono ? "font-mono text-[0.85em] font-medium" : "font-semibold"),
|
|
267
|
+
children: name
|
|
268
|
+
})
|
|
269
|
+
}),
|
|
270
|
+
children && /* @__PURE__ */ jsx("span", {
|
|
271
|
+
className: "shrink-0 text-xs text-muted-foreground",
|
|
272
|
+
children
|
|
273
|
+
})
|
|
274
|
+
]
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
//#endregion
|
|
278
|
+
export { credentialLine as a, matchesModel as c, providerStatus as d, usedByLine as f, cheapest as i, modelName as l, ModelMenu as n, factsLine as o, cn as p, ago as r, initialPicks as s, MODELS_PATH as t, priceLine as u };
|