bazilion 0.50.0 → 0.52.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.
Files changed (170) hide show
  1. package/dist/cli.js +316 -90
  2. package/dist/cli.js.map +1 -1
  3. package/dist/daemon.js +1378 -364
  4. package/dist/daemon.js.map +1 -1
  5. package/dist/web/client/assets/AddProviderDialog-BiGLKnu2.js +1 -0
  6. package/dist/web/client/assets/ConfigPage-DvBzy2MN.js +1 -0
  7. package/dist/web/client/assets/ConfirmDialog-CiZ5tk9R.js +1 -0
  8. package/dist/web/client/assets/ConnectionsView-Czkpm2JY.js +1 -0
  9. package/dist/web/client/assets/Dialog-s_kPtI-W.js +1 -0
  10. package/dist/web/client/assets/ModelMenu-BfUPoRjV.js +1 -0
  11. package/dist/web/client/assets/SectionTabs-DENNb6Nw.js +1 -0
  12. package/dist/web/client/assets/Segmented-Dh77vmpp.js +1 -0
  13. package/dist/web/client/assets/SkillFindings-Xng11qqx.js +1 -0
  14. package/dist/web/client/assets/SkillsPicker-hI3YXvib.js +1 -0
  15. package/dist/web/client/assets/SpawnDialog-CKWFQ6jk.js +1 -0
  16. package/dist/web/client/assets/Tabs-f6bHvCGn.js +1 -0
  17. package/dist/web/client/assets/TeamForm-kda1HYZG.js +1 -0
  18. package/dist/web/client/assets/TeamThread-2rm1JGSk.js +1 -0
  19. package/dist/web/client/assets/UnsavedChangesGuard-nx6dv2Yw.js +1 -0
  20. package/dist/web/client/assets/_id-B72mIpcE.js +1 -0
  21. package/dist/web/client/assets/_id-Bzavnza1.js +1 -0
  22. package/dist/web/client/assets/access-Yw9jODuk.js +1 -0
  23. package/dist/web/client/assets/agents-C9xoyL7o.js +1 -0
  24. package/dist/web/client/assets/agents-TviG16wx.js +1 -0
  25. package/dist/web/client/assets/api-HC_YzjBy.js +1 -0
  26. package/dist/web/client/assets/arrow-right-Gm_FDWJ_.js +1 -0
  27. package/dist/web/client/assets/attention-DmURtlJm.js +1 -0
  28. package/dist/web/client/assets/check-BjgKoGvU.js +1 -0
  29. package/dist/web/client/assets/chevron-right-CUZiA2aG.js +1 -0
  30. package/dist/web/client/assets/config-UZz_mjO5.js +1 -0
  31. package/dist/web/client/assets/createLucideIcon-C6gOo8sD.js +1 -0
  32. package/dist/web/client/assets/dist-BWppw70N.js +41 -0
  33. package/dist/web/client/assets/dist-D2dwY7MR.js +1 -0
  34. package/dist/web/client/assets/index-Df1oUtAP.js +14 -0
  35. package/dist/web/client/assets/link-Cbztlp_R.js +1 -0
  36. package/dist/web/client/assets/login-CPfdaqsV.js +1 -0
  37. package/dist/web/client/assets/mcp-FlYnNon0.js +1 -0
  38. package/dist/web/client/assets/model-facts-DoB6QD5y.js +1 -0
  39. package/dist/web/client/assets/parts-tIDBNsYA.js +1 -0
  40. package/dist/web/client/assets/plus-CWrKMtvA.js +1 -0
  41. package/dist/web/client/assets/routes-BZaWCoQj.js +76 -0
  42. package/dist/web/client/assets/save-f9O-CQia.js +1 -0
  43. package/dist/web/client/assets/skills-C7yDPC8s.js +1 -0
  44. package/dist/web/client/assets/style-DDuTFJUu.js +7 -0
  45. package/dist/web/client/assets/styles-BviXU81u.css +2 -0
  46. package/dist/web/client/assets/system-CL3Kz36L.js +1 -0
  47. package/dist/web/client/assets/teams-CQTEF5gV.js +1 -0
  48. package/dist/web/client/assets/teams-DQ7SqVyF.js +1 -0
  49. package/dist/web/client/assets/telegram-BLgxtGhZ.js +1 -0
  50. package/dist/web/client/assets/tools-pOQyGVYo.js +1 -0
  51. package/dist/web/client/assets/use-resource-C3MBZJop.js +1 -0
  52. package/dist/web/client/assets/welcome-Hr6JpMef.js +1 -0
  53. package/dist/web/client/assets/wrench-6BEIqKDn.js +1 -0
  54. package/dist/web/server/assets/AddProviderDialog-Tn4AskPm.js +613 -0
  55. package/dist/web/server/assets/{ConfigPage-DSLM5CLw.js → ConfigPage-DqDUujmt.js} +4 -4
  56. package/dist/web/server/assets/ConfirmDialog-DfaJ--A6.js +52 -0
  57. package/dist/web/server/assets/{ConnectionsView-DVLNH81Y.js → ConnectionsView-DAG-zNBz.js} +7 -5
  58. package/dist/web/server/assets/{ConfirmDialog-CvLZgbfY.js → Dialog-aup_yJv5.js} +3 -50
  59. package/dist/web/server/assets/ModelMenu-DUY9aHkE.js +138 -0
  60. package/dist/web/server/assets/{Rail-D8LhjS38.js → Rail-BIC_4ptO.js} +8 -66
  61. package/dist/web/server/assets/{SectionTabs-CNcvxbR8.js → SectionTabs-BGsrf-UQ.js} +5 -4
  62. package/dist/web/server/assets/Segmented-3ZLdqa5U.js +18 -0
  63. package/dist/web/server/assets/{SkillFindings-DX8lCMG7.js → SkillFindings-BdATze1A.js} +1 -1
  64. package/dist/web/server/assets/{SpawnDialog-Brmkl_ll.js → SpawnDialog-D_SMPCG_.js} +11 -8
  65. package/dist/web/server/assets/{TeamForm-CvQAs2FA.js → TeamForm-ilBaeLI4.js} +1 -1
  66. package/dist/web/server/assets/{TeamThread-BNJi6gPM.js → TeamThread-DuLlGDcw.js} +4 -19
  67. package/dist/web/server/assets/{UnsavedChangesGuard-B3Lpl08z.js → UnsavedChangesGuard-DrOvPV14.js} +1 -1
  68. package/dist/web/server/assets/{_id-CO1PgvyG.js → _id-BsZcsabI.js} +11 -11
  69. package/dist/web/server/assets/{_id-CA3QO7J5.js → _id-D8Kj0F30.js} +2 -2
  70. package/dist/web/server/assets/{_id-DIXUiIaB.js → _id-DJnYgisy.js} +2 -2
  71. package/dist/web/server/assets/{_id-E2N4gZ4O.js → _id-QYifTM9w.js} +3 -3
  72. package/dist/web/server/assets/{_id-BH1631a8.js → _id-yN0z7VqE.js} +6 -6
  73. package/dist/web/server/assets/_tanstack-start-manifest_v-D6zrzUC7.js +223 -0
  74. package/dist/web/server/assets/{tokens-CEdl8puR.js → access-C_pupPks.js} +3 -3
  75. package/dist/web/server/assets/{tokens-CsqoRt5T.js → access-DKOpcHIJ.js} +10 -10
  76. package/dist/web/server/assets/{tokens-ByPTGFBQ.js → access-GMGed5O8.js} +5 -5
  77. package/dist/web/server/assets/{agents-DrkEwIpR.js → agents-B6OR3x99.js} +14 -14
  78. package/dist/web/server/assets/{agents-CalSKogx.js → agents-B7642eRO.js} +5 -5
  79. package/dist/web/server/assets/{agents-DPZVni4Q.js → agents-BJ-_oC2e.js} +2 -2
  80. package/dist/web/server/assets/{agents-CdZvooeQ.js → agents-CjV0w-Zy.js} +2 -2
  81. package/dist/web/server/assets/{agents-C63VycUw.js → agents-Dy_Q-9lG.js} +3 -3
  82. package/dist/web/server/assets/{attention-DIyX3VMB.js → attention-CLP4HYBz.js} +3 -3
  83. package/dist/web/server/assets/{attention-BbE4yc-V.js → attention-DS3O9UmJ.js} +2 -2
  84. package/dist/web/server/assets/config-DjTGA4iZ.js +17 -0
  85. package/dist/web/server/assets/config-Q7livfa3.js +1215 -0
  86. package/dist/web/server/assets/config-X7qWbbpH.js +20 -0
  87. package/dist/web/server/assets/{Page-KIL1CsME.js → createSsrRpc-GCCF14VW.js} +17 -2
  88. package/dist/web/server/assets/{mcp-Cf7KzOJ9.js → mcp-BI-FD-JI.js} +5 -5
  89. package/dist/web/server/assets/{mcp-DE14q5c0.js → mcp-ZARSOxZW.js} +2 -2
  90. package/dist/web/server/assets/model-facts-mrfrWQne.js +136 -0
  91. package/dist/web/server/assets/parts-B31PJkhi.js +190 -0
  92. package/dist/web/server/assets/{router-w2yPgmC1.js → router-Dh2-IvLL.js} +69 -81
  93. package/dist/web/server/assets/{routes-1FEodTRm.js → routes-BJIJWCIE.js} +3 -3
  94. package/dist/web/server/assets/{routes-D1NHwz6f.js → routes-C9NawqcV.js} +22 -15
  95. package/dist/web/server/assets/{routes-B6AO0LjK.js → routes-CDskMy5C.js} +2 -2
  96. package/dist/web/server/assets/{skills-DC1OTc8n.js → skills-BqLq3ZXq.js} +5 -5
  97. package/dist/web/server/assets/{skills-CA17GjuZ.js → skills-StN15QhC.js} +2 -2
  98. package/dist/web/server/assets/system-BtRA2HUs.js +138 -0
  99. package/dist/web/server/assets/system-Dl-1RhoP.js +12 -0
  100. package/dist/web/server/assets/system-DtswhLW6.js +18 -0
  101. package/dist/web/server/assets/{teams-D6Tx-Jyn.js → teams-5PMGvHuM.js} +2 -2
  102. package/dist/web/server/assets/{teams-OzHTyVi9.js → teams-COaU0wN9.js} +4 -4
  103. package/dist/web/server/assets/{teams-Cg-QQWpH.js → teams-Ca8W4mvl.js} +5 -5
  104. package/dist/web/server/assets/{teams-Bm63mbTt.js → teams-CbIPKf99.js} +2 -2
  105. package/dist/web/server/assets/{telegram-Gy7_9yih.js → telegram-CGol0CKX2.js} +3 -3
  106. package/dist/web/server/assets/{telegram-xU-vXgef.js → telegram-Cv0D4gyz.js} +5 -5
  107. package/dist/web/server/assets/{telegram-BJ4l_TA_.js → telegram-Yx8nm6Ei.js} +5 -5
  108. package/dist/web/server/assets/tools-C-wwWjLI.js +12 -0
  109. package/dist/web/server/assets/tools-OfD22R-C.js +502 -0
  110. package/dist/web/server/assets/tools-ioJcPzMW.js +12 -0
  111. package/dist/web/server/assets/use-resource-DVzK0toP.js +63 -0
  112. package/dist/web/server/assets/utils-C_uf36nf.js +8 -0
  113. package/dist/web/server/assets/welcome-CxXMI4HI.js +15 -0
  114. package/dist/web/server/assets/welcome-FFEbrNT1.js +319 -0
  115. package/dist/web/server/assets/welcome-jxmpE_Jb.js +26 -0
  116. package/dist/web/server/assets/{workspace-DeEYMPDX.js → workspace-DaitCM0t.js} +1 -8
  117. package/dist/web/server/server.js +27 -19
  118. package/dist/worker.js +277 -153
  119. package/dist/worker.js.map +1 -1
  120. package/package.json +1 -1
  121. package/dist/web/client/assets/ConfigPage-_FY--9PB.js +0 -1
  122. package/dist/web/client/assets/ConfirmDialog-BblXqMVb.js +0 -1
  123. package/dist/web/client/assets/ConnectionsView-BZHJysCa.js +0 -1
  124. package/dist/web/client/assets/FieldRow-k05wfDy9.js +0 -1
  125. package/dist/web/client/assets/ModelSelect-CvOHjUyB.js +0 -1
  126. package/dist/web/client/assets/SectionTabs-DlfXtepS.js +0 -1
  127. package/dist/web/client/assets/SkillFindings-CHf5ZGY0.js +0 -1
  128. package/dist/web/client/assets/SkillsPicker-Cr87y_W-.js +0 -1
  129. package/dist/web/client/assets/SpawnDialog-C-Ujb4bC.js +0 -1
  130. package/dist/web/client/assets/Tabs-D0LgBNIk.js +0 -1
  131. package/dist/web/client/assets/TeamForm-D6EAAF7m.js +0 -1
  132. package/dist/web/client/assets/TeamThread-DpUOwMoi.js +0 -1
  133. package/dist/web/client/assets/UnsavedChangesGuard-DTUP7hwu.js +0 -1
  134. package/dist/web/client/assets/_id-C94dgBDe.js +0 -1
  135. package/dist/web/client/assets/_id-CxmEfoEp.js +0 -1
  136. package/dist/web/client/assets/agents-C-bJ5R_0.js +0 -1
  137. package/dist/web/client/assets/agents-odqBNx-A.js +0 -1
  138. package/dist/web/client/assets/api-CPzQ_z9m.js +0 -1
  139. package/dist/web/client/assets/arrow-right-Dyta3p06.js +0 -1
  140. package/dist/web/client/assets/attention-D0e7o7fh.js +0 -1
  141. package/dist/web/client/assets/chevron-right-B2YEg9rw.js +0 -1
  142. package/dist/web/client/assets/config-B7Y5MtpM.js +0 -3
  143. package/dist/web/client/assets/createLucideIcon-Cgab8gqu.js +0 -1
  144. package/dist/web/client/assets/index-CNVw44IE.js +0 -54
  145. package/dist/web/client/assets/jsx-runtime-bzQ4Vb5N.js +0 -1
  146. package/dist/web/client/assets/link-ClwtaO_E.js +0 -1
  147. package/dist/web/client/assets/login-Br1F4rQx.js +0 -1
  148. package/dist/web/client/assets/mcp-B8bIAY6k.js +0 -1
  149. package/dist/web/client/assets/routes-BZdlkRdC.js +0 -76
  150. package/dist/web/client/assets/save-ZqeB_I-c.js +0 -1
  151. package/dist/web/client/assets/services-CPJxDrVG.js +0 -1
  152. package/dist/web/client/assets/skills-DE_kQQGj.js +0 -1
  153. package/dist/web/client/assets/style-BWShXY3e.js +0 -7
  154. package/dist/web/client/assets/styles-Tney8jZq.css +0 -2
  155. package/dist/web/client/assets/teams-AcuSLc3I.js +0 -1
  156. package/dist/web/client/assets/teams-tRamPg7O.js +0 -1
  157. package/dist/web/client/assets/telegram-Ku69-GAv.js +0 -1
  158. package/dist/web/client/assets/tokens-DuLNZMgi.js +0 -1
  159. package/dist/web/client/assets/welcome-CrQk6n6I.js +0 -1
  160. package/dist/web/server/assets/FieldRow-DQBzMtcR.js +0 -173
  161. package/dist/web/server/assets/ModelSelect-Vwro6OkL.js +0 -43
  162. package/dist/web/server/assets/_tanstack-start-manifest_v-BVfrV7LQ.js +0 -191
  163. package/dist/web/server/assets/config-3tPtOmPE.js +0 -12
  164. package/dist/web/server/assets/config-DJGZiPBJ.js +0 -798
  165. package/dist/web/server/assets/config-rUqhMjIs.js +0 -25
  166. package/dist/web/server/assets/createSsrRpc-6LHNEsSK.js +0 -16
  167. package/dist/web/server/assets/services-BjroGXgC.js +0 -74
  168. package/dist/web/server/assets/services-Cdk40QHq.js +0 -13
  169. package/dist/web/server/assets/services-DsHRLL8q.js +0 -12
  170. package/dist/web/server/assets/welcome-O6Rjd7yO.js +0 -93
@@ -0,0 +1,20 @@
1
+ import { n as createServerFn } from "../server.js";
2
+ import { t as createServerRpc } from "./createServerRpc-B7Yr1K8i.js";
3
+ import { n as daemonClient } from "./daemon-client-B_ZRIIrT.js";
4
+ //#region src/routes/config/index.tsx?tss-serverfn-split
5
+ var fetchModelsPage_createServerFn_handler = createServerRpc({
6
+ id: "71b6b12251ac92cf4ee888c1d2b6eba3beaac079f9c39eaed95fafcd15908731",
7
+ name: "fetchModelsPage",
8
+ filename: "src/routes/config/index.tsx"
9
+ }, (opts) => fetchModelsPage.__executeServer(opts));
10
+ var fetchModelsPage = createServerFn({ method: "GET" }).handler(fetchModelsPage_createServerFn_handler, async () => {
11
+ const daemon = daemonClient();
12
+ const [{ providers }, models] = await Promise.all([daemon.get("/api/config/providers"), daemon.get("/api/config/models")]);
13
+ return {
14
+ providers,
15
+ models,
16
+ now: Date.now()
17
+ };
18
+ });
19
+ //#endregion
20
+ export { fetchModelsPage_createServerFn_handler };
@@ -1,4 +1,5 @@
1
- import { u as cn } from "./workspace-DeEYMPDX.js";
1
+ import { i as getServerFnById, r as TSS_SERVER_FUNCTION } from "../server.js";
2
+ import { t as cn } from "./utils-C_uf36nf.js";
2
3
  import { jsx, jsxs } from "react/jsx-runtime";
3
4
  //#region src/components/Page.tsx
4
5
  var PAGE_SIZE_CLASS = {
@@ -151,4 +152,18 @@ function Stat({ label, value, detail }) {
151
152
  });
152
153
  }
153
154
  //#endregion
154
- export { PageShell as a, StatusBadge as c, PageHeader as i, ItemList as n, SectionCard as o, ItemRow as r, Stat as s, EmptyState as t };
155
+ //#region ../../node_modules/.pnpm/@tanstack+start-server-core@1.169.17/node_modules/@tanstack/start-server-core/dist/esm/createSsrRpc.js
156
+ var createSsrRpc = (functionId) => {
157
+ const url = "/_serverFn/" + functionId;
158
+ const serverFnMeta = { id: functionId };
159
+ const fn = async (...args) => {
160
+ return (await getServerFnById(functionId, { origin: "server" }))(...args);
161
+ };
162
+ return Object.assign(fn, {
163
+ url,
164
+ serverFnMeta,
165
+ [TSS_SERVER_FUNCTION]: true
166
+ });
167
+ };
168
+ //#endregion
169
+ export { PageHeader as a, Stat as c, ItemRow as i, StatusBadge as l, EmptyState as n, PageShell as o, ItemList as r, SectionCard as s, createSsrRpc as t };
@@ -1,8 +1,8 @@
1
- import { E as errorMessage, d as Button, w as api } from "./workspace-DeEYMPDX.js";
2
- import { t as ConfirmDialog } from "./ConfirmDialog-CvLZgbfY.js";
3
- import { c as StatusBadge, n as ItemList, o as SectionCard, r as ItemRow } from "./Page-KIL1CsME.js";
4
- import { t as Route } from "./mcp-DE14q5c0.js";
5
- import { t as ConfigPage } from "./ConfigPage-DSLM5CLw.js";
1
+ import { C as api, T as errorMessage, u as Button } from "./workspace-DaitCM0t.js";
2
+ import { t as ConfirmDialog } from "./ConfirmDialog-DfaJ--A6.js";
3
+ import { i as ItemRow, l as StatusBadge, r as ItemList, s as SectionCard } from "./createSsrRpc-GCCF14VW.js";
4
+ import { t as Route } from "./mcp-ZARSOxZW.js";
5
+ import { t as ConfigPage } from "./ConfigPage-DqDUujmt.js";
6
6
  import { useState } from "react";
7
7
  import { useRouter } from "@tanstack/react-router";
8
8
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -1,8 +1,8 @@
1
1
  import { n as createServerFn } from "../server.js";
2
- import { t as createSsrRpc } from "./createSsrRpc-6LHNEsSK.js";
2
+ import { t as createSsrRpc } from "./createSsrRpc-GCCF14VW.js";
3
3
  import { createFileRoute, lazyRouteComponent } from "@tanstack/react-router";
4
4
  //#region src/routes/config/mcp.tsx
5
- var $$splitComponentImporter = () => import("./mcp-Cf7KzOJ9.js");
5
+ var $$splitComponentImporter = () => import("./mcp-BI-FD-JI.js");
6
6
  var fetchServers = createServerFn({ method: "GET" }).handler(createSsrRpc("278849457893891c3d22806d15e11a0a42cc3630b30e9e62b74cf2d3b982ded7"));
7
7
  var Route = createFileRoute("/config/mcp")({
8
8
  loader: () => fetchServers(),
@@ -0,0 +1,136 @@
1
+ //#region src/lib/model-facts.ts
2
+ function modelName(model) {
3
+ return model.name ?? model.id;
4
+ }
5
+ /** A context window in the units people say: `1M`, `272K`. */
6
+ function formatContext(tokens) {
7
+ if (!tokens || tokens <= 0) return null;
8
+ if (tokens >= 1e6) return `${(tokens / 1e6).toFixed(1).replace(/\.0$/, "")}M`;
9
+ return `${Math.round(tokens / 1e3)}K`;
10
+ }
11
+ /** A dollar amount with cents, and the third decimal only when it carries something. */
12
+ function formatUsd(value) {
13
+ if (Number.isInteger(value)) return `$${value}`;
14
+ const fixed = value.toFixed(3);
15
+ return `$${fixed.endsWith("0") ? fixed.slice(0, -1) : fixed}`;
16
+ }
17
+ /** What a model can do, in one line. A model the catalog does not know has nothing to say. */
18
+ function factsLine(model, connect) {
19
+ const context = formatContext(model.contextWindow);
20
+ if (!model.name && !context) return connect === "local" ? "Loaded on the server" : "Not in the bundled catalog";
21
+ return [
22
+ context ? `${context} context` : null,
23
+ model.images ? "sees images" : "text only",
24
+ model.reasoning ? "reasoning" : null
25
+ ].filter(Boolean).join(" · ");
26
+ }
27
+ /** What a model costs: the list price per million tokens, or who pays instead. */
28
+ function priceLine(model, connect) {
29
+ if (connect === "signin") return "Included in your plan";
30
+ if (connect === "local") return "Runs on your hardware";
31
+ if (!model.price) return "No list price";
32
+ return `${formatUsd(model.price.input)} in · ${formatUsd(model.price.output)} out`;
33
+ }
34
+ function usedByLine(usedBy) {
35
+ const parts = [...usedBy.templates.map((name) => `${name} template`), usedBy.agents === 1 ? "1 Agent" : usedBy.agents > 1 ? `${usedBy.agents} Agents` : null].filter(Boolean);
36
+ return parts.length > 0 ? parts.join(", ") : "Not used yet";
37
+ }
38
+ /** The two facts that matter when choosing a model: how much it reads, whether it sees images. */
39
+ function menuFacts(model) {
40
+ const context = formatContext(model.contextWindow);
41
+ if (!context) return model.providerConnect === "local" ? "on this computer" : "";
42
+ return `${context} · ${model.images ? "sees images" : "text only"}`;
43
+ }
44
+ /** Chat models by provider, in the order the Models page lists them. */
45
+ function menuGroups(models) {
46
+ const groups = /* @__PURE__ */ new Map();
47
+ for (const model of models) {
48
+ const group = groups.get(model.provider) ?? {
49
+ provider: model.provider,
50
+ name: model.providerName,
51
+ trouble: model.providerState === "failing" || model.providerState === "incomplete" ? "not working" : null,
52
+ models: []
53
+ };
54
+ group.models.push(model);
55
+ groups.set(model.provider, group);
56
+ }
57
+ return [...groups.values()];
58
+ }
59
+ /** Whether a model matches what was typed: every word, in its name or id. */
60
+ function matchesModel(model, query) {
61
+ const haystack = `${model.name ?? ""} ${model.id}`.toLowerCase();
62
+ return query.toLowerCase().split(/\s+/).filter(Boolean).every((word) => haystack.includes(word));
63
+ }
64
+ /** "2 minutes ago", for something that happened at `at`. */
65
+ function ago(at, now) {
66
+ const seconds = Math.max(0, Math.round((now - at) / 1e3));
67
+ if (seconds < 45) return "just now";
68
+ const minutes = Math.round(seconds / 60);
69
+ if (minutes < 60) return minutes === 1 ? "1 minute ago" : `${minutes} minutes ago`;
70
+ const hours = Math.round(minutes / 60);
71
+ if (hours < 24) return hours === 1 ? "1 hour ago" : `${hours} hours ago`;
72
+ const days = Math.round(hours / 24);
73
+ if (days < 30) return days === 1 ? "yesterday" : `${days} days ago`;
74
+ return `on ${new Date(at).toISOString().slice(0, 10)}`;
75
+ }
76
+ var FAILURE_LABEL = {
77
+ credentials: "Key rejected",
78
+ unreachable: "Not answering",
79
+ model: "Model unavailable",
80
+ limit: "Limit reached",
81
+ other: "Failing"
82
+ };
83
+ /** A provider's state as a chip: a few words and how loud they are. */
84
+ function providerStatus(provider, now) {
85
+ switch (provider.state) {
86
+ case "working": return {
87
+ label: provider.check ? `Working · tested ${ago(provider.check.at, now)}` : "Working",
88
+ tone: "success"
89
+ };
90
+ case "failing": {
91
+ const kind = provider.check?.failure?.kind ?? "other";
92
+ const label = kind === "credentials" && provider.connect === "signin" ? "Sign-in rejected" : FAILURE_LABEL[kind];
93
+ return {
94
+ label: provider.check ? `${label} · tried ${ago(provider.check.at, now)}` : label,
95
+ tone: "warning"
96
+ };
97
+ }
98
+ case "incomplete": return {
99
+ label: provider.connect === "signin" ? "Not signed in" : provider.fields.some((field) => field.kind === "secret") ? "Needs a key" : "Needs credentials",
100
+ tone: "warning"
101
+ };
102
+ case "off": return {
103
+ label: provider.models.length === 0 ? "Saved, not in use" : "Turned off",
104
+ tone: "neutral"
105
+ };
106
+ default: return {
107
+ label: "Not tested yet",
108
+ tone: "neutral"
109
+ };
110
+ }
111
+ }
112
+ /** How a provider is connected, in a few words, for its row. */
113
+ function credentialLine(provider) {
114
+ if (provider.connect === "signin") return provider.configured ? "Signed in with your ChatGPT account" : "Not signed in";
115
+ if (provider.connect === "local") return provider.address ?? "A model server on this network";
116
+ const key = provider.fields.find((field) => field.kind === "secret" && field.set);
117
+ if (key) return `${key.label} ${key.preview ?? "saved"}`;
118
+ if (provider.configured) return "Credentials from the daemon’s environment";
119
+ return "No credentials saved";
120
+ }
121
+ /** The models to ask first: suggested ones, then the ones already in use. */
122
+ function initialPicks(models) {
123
+ const selected = models.filter((model) => model.selected).map((model) => model.id);
124
+ if (selected.length > 0) return selected;
125
+ return models.filter((model) => model.suggested).map((model) => model.id);
126
+ }
127
+ /** The cheapest of the given models by list price; unpriced ones come last, in order. */
128
+ function cheapest(models) {
129
+ const cost = (model) => model.price ? model.price.input + model.price.output : Number.POSITIVE_INFINITY;
130
+ return models.map((model, index) => ({
131
+ model,
132
+ index
133
+ })).sort((a, b) => cost(a.model) - cost(b.model) || a.index - b.index)[0]?.model;
134
+ }
135
+ //#endregion
136
+ export { initialPicks as a, menuGroups as c, providerStatus as d, usedByLine as f, factsLine as i, modelName as l, cheapest as n, matchesModel as o, credentialLine as r, menuFacts as s, ago as t, priceLine as u };
@@ -0,0 +1,190 @@
1
+ import { t as cn } from "./utils-C_uf36nf.js";
2
+ import { d as providerStatus, i as factsLine, l as modelName, u as priceLine } from "./model-facts-mrfrWQne.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { AlertTriangle, Search } from "lucide-react";
5
+ //#region src/components/setup/parts.tsx
6
+ /** A provider's initial on a tile: no logos, they are other companies' marks. */
7
+ function ProviderAvatar({ name, tone = "neutral", className }) {
8
+ return /* @__PURE__ */ jsx("span", {
9
+ "aria-hidden": "true",
10
+ className: cn("flex size-9 shrink-0 items-center justify-center rounded-xl text-[0.95rem] font-bold", tone === "success" && "bg-success/10 text-success", tone === "warning" && "bg-warning/10 text-warning", tone === "accent" && "bg-accent text-accent-foreground", tone === "neutral" && "bg-muted text-muted-foreground", className),
11
+ children: name.replace(/[^\p{L}\p{N}]/gu, "").slice(0, 1) || "?"
12
+ });
13
+ }
14
+ var CHIP = {
15
+ success: "bg-success/10 text-success",
16
+ warning: "bg-warning/10 text-warning",
17
+ neutral: "bg-muted text-muted-foreground"
18
+ };
19
+ function Chip({ tone, children }) {
20
+ return /* @__PURE__ */ jsxs("span", {
21
+ className: cn("inline-flex min-h-7 items-center gap-1.5 rounded-full px-3 text-xs font-semibold", CHIP[tone]),
22
+ children: [/* @__PURE__ */ jsx("span", {
23
+ "aria-hidden": "true",
24
+ className: "size-1.5 shrink-0 rounded-full bg-current"
25
+ }), children]
26
+ });
27
+ }
28
+ /** What a provider is doing for Agents, as a chip. */
29
+ function StateChip({ provider, now }) {
30
+ const status = providerStatus(provider, now);
31
+ return /* @__PURE__ */ jsx(Chip, {
32
+ tone: status.tone,
33
+ children: status.label
34
+ });
35
+ }
36
+ /** A failed test: what happened, what to do, and the provider's own words one click away. */
37
+ function FailureBox({ failure, children }) {
38
+ return /* @__PURE__ */ jsxs("div", {
39
+ role: "alert",
40
+ className: "rounded-2xl border border-warning/35 bg-warning/10 p-4 text-sm",
41
+ children: [/* @__PURE__ */ jsxs("div", {
42
+ className: "flex items-start gap-3",
43
+ children: [/* @__PURE__ */ jsx(AlertTriangle, {
44
+ className: "mt-0.5 size-5 shrink-0 text-warning",
45
+ "aria-hidden": "true"
46
+ }), /* @__PURE__ */ jsxs("div", {
47
+ className: "min-w-0 flex-1",
48
+ children: [
49
+ /* @__PURE__ */ jsx("div", {
50
+ className: "font-semibold text-foreground",
51
+ children: failure.title
52
+ }),
53
+ /* @__PURE__ */ jsx("div", {
54
+ className: "mt-0.5 text-muted-foreground",
55
+ children: failure.hint
56
+ }),
57
+ failure.detail && /* @__PURE__ */ jsxs("details", {
58
+ className: "mt-2 text-xs text-muted-foreground",
59
+ children: [/* @__PURE__ */ jsx("summary", {
60
+ className: "cursor-pointer font-semibold",
61
+ children: "Details"
62
+ }), /* @__PURE__ */ jsx("div", {
63
+ className: "mt-1 break-words font-mono",
64
+ children: failure.detail
65
+ })]
66
+ })
67
+ ]
68
+ })]
69
+ }), children && /* @__PURE__ */ jsx("div", {
70
+ className: "mt-3 flex flex-wrap justify-end gap-2",
71
+ children
72
+ })]
73
+ });
74
+ }
75
+ /** A search box: the magnifier and the input are one field, with one focus ring. */
76
+ function SearchField({ label, placeholder, value, onChange, className }) {
77
+ return /* @__PURE__ */ jsxs("label", {
78
+ className: cn("m-0 flex min-w-0 items-center gap-2 rounded-xl border border-border bg-muted/40 px-3 transition-shadow focus-within:border-primary focus-within:bg-card focus-within:shadow-[0_0_0_3px_var(--color-sapphire-glow)]", className),
79
+ children: [/* @__PURE__ */ jsx(Search, {
80
+ className: "size-4 shrink-0 text-muted-foreground",
81
+ "aria-hidden": "true"
82
+ }), /* @__PURE__ */ jsx("input", {
83
+ type: "search",
84
+ "aria-label": label,
85
+ placeholder,
86
+ value,
87
+ onChange: (event) => onChange(event.target.value),
88
+ className: "min-h-10 border-0 bg-transparent px-0 shadow-none focus:bg-transparent focus:shadow-none",
89
+ style: { outline: "none" }
90
+ })]
91
+ });
92
+ }
93
+ /**
94
+ * One model in a list to tick: its name and id, what it can do, what it costs. On a narrow screen
95
+ * the facts sit under the name instead of beside it.
96
+ */
97
+ function ModelRow({ model, connect, checked, disabled, onToggle, className }) {
98
+ return /* @__PURE__ */ jsxs("label", {
99
+ className: cn("m-0 grid cursor-pointer grid-cols-[auto_minmax(0,1fr)] items-center gap-x-3 gap-y-0.5 border-b border-border py-2.5 sm:grid-cols-[auto_minmax(0,1.5fr)_minmax(0,1.2fr)_9.5rem]", className),
100
+ children: [
101
+ /* @__PURE__ */ jsx("input", {
102
+ type: "checkbox",
103
+ checked,
104
+ disabled,
105
+ onChange: onToggle,
106
+ className: "m-0 size-[18px]"
107
+ }),
108
+ /* @__PURE__ */ jsxs("span", {
109
+ className: "min-w-0",
110
+ children: [
111
+ /* @__PURE__ */ jsx("span", {
112
+ className: "text-sm font-semibold text-foreground",
113
+ children: modelName(model)
114
+ }),
115
+ model.suggested && /* @__PURE__ */ jsx("span", {
116
+ className: "ml-2 rounded-full bg-accent px-2 py-0.5 text-[0.7rem] font-semibold text-accent-foreground",
117
+ children: "Suggested"
118
+ }),
119
+ model.name && /* @__PURE__ */ jsx("span", {
120
+ className: "block break-all font-mono text-[0.72rem] text-muted-foreground",
121
+ children: model.id
122
+ })
123
+ ]
124
+ }),
125
+ /* @__PURE__ */ jsx("span", {
126
+ className: "col-start-2 text-xs text-muted-foreground sm:col-start-auto",
127
+ children: factsLine(model, connect)
128
+ }),
129
+ /* @__PURE__ */ jsx("span", {
130
+ className: "col-start-2 text-xs text-foreground sm:col-start-auto sm:text-right",
131
+ children: priceLine(model, connect)
132
+ })
133
+ ]
134
+ });
135
+ }
136
+ /** A yes/no setting. */
137
+ function Switch({ checked, label, disabled = false, onChange }) {
138
+ return /* @__PURE__ */ jsx("button", {
139
+ type: "button",
140
+ role: "switch",
141
+ "aria-checked": checked,
142
+ "aria-label": label,
143
+ disabled,
144
+ onClick: () => onChange(!checked),
145
+ className: cn("relative h-7 w-[46px] shrink-0 rounded-full transition-colors disabled:opacity-50", checked ? "bg-primary" : "bg-fawn"),
146
+ children: /* @__PURE__ */ jsx("span", { className: cn("absolute top-[3px] size-[22px] rounded-full bg-white shadow transition-[left]", checked ? "left-[21px]" : "left-[3px]") })
147
+ });
148
+ }
149
+ /** Something is being waited for. */
150
+ function Waiting({ children }) {
151
+ return /* @__PURE__ */ jsxs("div", {
152
+ role: "status",
153
+ className: "flex items-center gap-3 text-sm font-semibold text-foreground",
154
+ children: [/* @__PURE__ */ jsx("span", {
155
+ "aria-hidden": "true",
156
+ className: "flex size-5 shrink-0 items-center justify-center",
157
+ children: /* @__PURE__ */ jsx("span", { className: "size-2.5 animate-pulse rounded-full bg-primary" })
158
+ }), /* @__PURE__ */ jsx("span", { children })]
159
+ });
160
+ }
161
+ /** A card of the Models page: an icon, what it holds, an action, then its rows. */
162
+ function SetupCard({ icon, title, description, action, labelledBy, children }) {
163
+ return /* @__PURE__ */ jsxs("section", {
164
+ "aria-labelledby": labelledBy,
165
+ className: "min-w-0 overflow-hidden rounded-2xl border border-border bg-card shadow-baziu-sm",
166
+ children: [/* @__PURE__ */ jsxs("div", {
167
+ className: "flex flex-wrap items-center gap-x-4 gap-y-3 px-4 py-4 sm:px-5",
168
+ children: [/* @__PURE__ */ jsxs("div", {
169
+ className: "flex min-w-0 flex-1 basis-64 items-center gap-4",
170
+ children: [/* @__PURE__ */ jsx("span", {
171
+ "aria-hidden": "true",
172
+ className: "flex size-10 shrink-0 items-center justify-center rounded-xl bg-accent text-accent-foreground",
173
+ children: icon
174
+ }), /* @__PURE__ */ jsxs("div", {
175
+ className: "min-w-0",
176
+ children: [/* @__PURE__ */ jsx("h2", {
177
+ id: labelledBy,
178
+ className: "m-0 font-body text-[1.05rem] font-semibold text-foreground",
179
+ children: title
180
+ }), /* @__PURE__ */ jsx("div", {
181
+ className: "text-sm text-muted-foreground",
182
+ children: description
183
+ })]
184
+ })]
185
+ }), action]
186
+ }), children]
187
+ });
188
+ }
189
+ //#endregion
190
+ export { SearchField as a, Switch as c, ProviderAvatar as i, Waiting as l, FailureBox as n, SetupCard as o, ModelRow as r, StateChip as s, Chip as t };