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
@@ -1,10 +1,10 @@
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
- //#region src/routes/config/integrations/telegram.tsx
5
- var $$splitComponentImporter = () => import("./telegram-BJ4l_TA_.js");
6
- var fetchTelegramConfig = createServerFn({ method: "GET" }).handler(createSsrRpc("00a157dd07824e1f126f06646effd1d876f280f6fc64c144d2f6429414a4e58a"));
7
- var Route = createFileRoute("/config/integrations/telegram")({
4
+ //#region src/routes/config/telegram.tsx
5
+ var $$splitComponentImporter = () => import("./telegram-Yx8nm6Ei.js");
6
+ var fetchTelegramConfig = createServerFn({ method: "GET" }).handler(createSsrRpc("9252e07d6f45cb1c4543c2ca6f1b0c4c7697c249f3e6c94fda53b8a603929a92"));
7
+ var Route = createFileRoute("/config/telegram")({
8
8
  loader: () => fetchTelegramConfig(),
9
9
  component: lazyRouteComponent($$splitComponentImporter, "component")
10
10
  });
@@ -1,7 +1,7 @@
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 { t as Route } from "./telegram-xU-vXgef.js";
4
- 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 { t as Route } from "./telegram-Cv0D4gyz.js";
4
+ import { t as ConfigPage } from "./ConfigPage-DqDUujmt.js";
5
5
  import { useEffect, useState } from "react";
6
6
  import { useRouter } from "@tanstack/react-router";
7
7
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -223,7 +223,7 @@ function NotificationSettings() {
223
223
  });
224
224
  }
225
225
  //#endregion
226
- //#region src/routes/config/integrations/telegram.tsx?tsr-split=component
226
+ //#region src/routes/config/telegram.tsx?tsr-split=component
227
227
  var BASE = "/api/config/telegram";
228
228
  function TelegramIntegrationPage() {
229
229
  const initial = Route.useLoaderData();
@@ -0,0 +1,12 @@
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/tools.tsx?tss-serverfn-split
5
+ var fetchTools_createServerFn_handler = createServerRpc({
6
+ id: "946c6cbff3f55931c3fb28c971d20b18b4b8a9f25417a5d1afc0550d7afa393b",
7
+ name: "fetchTools",
8
+ filename: "src/routes/config/tools.tsx"
9
+ }, (opts) => fetchTools.__executeServer(opts));
10
+ var fetchTools = createServerFn({ method: "GET" }).handler(fetchTools_createServerFn_handler, () => daemonClient().get("/api/config/tools"));
11
+ //#endregion
12
+ export { fetchTools_createServerFn_handler };
@@ -0,0 +1,502 @@
1
+ import { C as api, S as ApiError, T as errorMessage, u as Button } from "./workspace-DaitCM0t.js";
2
+ import { t as cn } from "./utils-C_uf36nf.js";
3
+ import { t as Route } from "./tools-ioJcPzMW.js";
4
+ import { t as ConfigPage } from "./ConfigPage-DqDUujmt.js";
5
+ import { c as Switch, o as SetupCard, t as Chip } from "./parts-B31PJkhi.js";
6
+ import { useId, useState } from "react";
7
+ import { useRouter } from "@tanstack/react-router";
8
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
+ import { AlertTriangle, AppWindow, ChevronRight, FileText, MessagesSquare, Search, SquareTerminal, Wrench } from "lucide-react";
10
+ //#region src/lib/tool-form.ts
11
+ /** A stored number in the unit people read: 900000 ms is 15 minutes. */
12
+ function shownNumber(field, stored) {
13
+ const input = field.input;
14
+ if (input.type !== "number") return stored;
15
+ const scale = input.scale ?? 1;
16
+ const value = Number(stored) / scale;
17
+ return Number.isInteger(value) ? String(value) : String(Math.round(value * 100) / 100);
18
+ }
19
+ /** What a typed number is stored as, or null when it is not a whole number of the unit. */
20
+ function storedNumber(field, typed) {
21
+ const input = field.input;
22
+ if (input.type !== "number") return typed;
23
+ if (!/^\d+$/.test(typed.trim())) return null;
24
+ return String(Number(typed.trim()) * (input.scale ?? 1));
25
+ }
26
+ function initialValue(field) {
27
+ if (field.kind === "secret") return "";
28
+ switch (field.input.type) {
29
+ case "number": return shownNumber(field, field.effective ?? String(field.input.default));
30
+ case "text": return field.environment ? field.effective ?? "" : field.value ?? "";
31
+ default: return field.effective ?? "";
32
+ }
33
+ }
34
+ function initialDraft(card) {
35
+ return {
36
+ values: Object.fromEntries(card.fields.map((field) => [field.envVar, initialValue(field)])),
37
+ removed: []
38
+ };
39
+ }
40
+ /** Whether a setting matters with the rest of the form as it is now. */
41
+ function applies(field, draft) {
42
+ return (field.when ?? []).every((rule) => rule.is.includes(draft.values[rule.envVar] ?? ""));
43
+ }
44
+ /** The numbers that cannot be saved as typed, with what to say about each. */
45
+ function numberProblems(card, draft) {
46
+ const problems = {};
47
+ for (const field of card.fields) {
48
+ const input = field.input;
49
+ if (input.type !== "number" || field.environment || !applies(field, draft)) continue;
50
+ const typed = draft.values[field.envVar] ?? "";
51
+ if (typed === initialValue(field) && !field.unusable) continue;
52
+ const scale = input.scale ?? 1;
53
+ const stored = storedNumber(field, typed);
54
+ const range = `from ${input.min / scale} to ${input.max / scale}`;
55
+ if (stored === null) problems[field.envVar] = `A whole number ${range}.`;
56
+ else if (Number(stored) < input.min || Number(stored) > input.max) problems[field.envVar] = `It has to be ${range}.`;
57
+ }
58
+ return problems;
59
+ }
60
+ /**
61
+ * What saving the card sends: only what was changed, as it is stored. A setting the environment
62
+ * sets is left alone, and so is one that does not matter with the choices made.
63
+ */
64
+ function changedValues(card, draft) {
65
+ const changed = {};
66
+ for (const field of card.fields) {
67
+ if (field.environment && field.kind !== "secret") continue;
68
+ const typed = draft.values[field.envVar] ?? "";
69
+ if (field.kind === "secret") {
70
+ if (typed.trim()) changed[field.envVar] = typed.trim();
71
+ else if (draft.removed.includes(field.envVar) && field.set) changed[field.envVar] = "";
72
+ continue;
73
+ }
74
+ if (typed === initialValue(field) && !field.unusable || !applies(field, draft)) continue;
75
+ changed[field.envVar] = field.input.type === "number" ? storedNumber(field, typed) ?? typed : typed.trim();
76
+ }
77
+ return changed;
78
+ }
79
+ //#endregion
80
+ //#region src/components/setup/ToolCard.tsx
81
+ var ICONS = {
82
+ "web-search": Search,
83
+ "web-pages": FileText,
84
+ browser: AppWindow,
85
+ commands: SquareTerminal,
86
+ "agent-messages": MessagesSquare
87
+ };
88
+ /** The daemon names the setting it refuses; under the setting itself, "It" reads better. */
89
+ function plain(envVar, message) {
90
+ return message?.startsWith(`${envVar} `) ? `It ${message.slice(envVar.length + 1)}.` : message;
91
+ }
92
+ var TONE = {
93
+ on: "success",
94
+ warning: "warning",
95
+ off: "neutral"
96
+ };
97
+ function ToolCard({ card, justSaved, onSaved }) {
98
+ const [draft, setDraft] = useState(() => initialDraft(card));
99
+ const [more, setMore] = useState(false);
100
+ const [busy, setBusy] = useState(false);
101
+ const [refused, setRefused] = useState({});
102
+ const [error, setError] = useState(null);
103
+ const [touched, setTouched] = useState(false);
104
+ const Icon = ICONS[card.id] ?? Wrench;
105
+ const titleId = `tool-${card.id}`;
106
+ const problems = numberProblems(card, draft);
107
+ const changes = changedValues(card, draft);
108
+ const dirty = Object.keys(changes).length > 0;
109
+ const shown = card.fields.filter((field) => applies(field, draft));
110
+ const main = shown.filter((field) => !field.advanced);
111
+ const advanced = shown.filter((field) => field.advanced);
112
+ const advancedNeedsYou = advanced.some((field) => refused[field.envVar] || problems[field.envVar] || field.unusable);
113
+ const edited = () => {
114
+ setTouched(true);
115
+ setRefused({});
116
+ setError(null);
117
+ };
118
+ const set = (envVar, value) => {
119
+ edited();
120
+ setDraft((current) => ({
121
+ values: {
122
+ ...current.values,
123
+ [envVar]: value
124
+ },
125
+ removed: current.removed.filter((name) => name !== envVar)
126
+ }));
127
+ };
128
+ const remove = (envVar, removed) => {
129
+ edited();
130
+ setDraft((current) => ({
131
+ values: {
132
+ ...current.values,
133
+ [envVar]: ""
134
+ },
135
+ removed: removed ? [...current.removed, envVar] : current.removed.filter((name) => name !== envVar)
136
+ }));
137
+ };
138
+ async function save(event) {
139
+ event.preventDefault();
140
+ if (!dirty || busy || Object.keys(problems).length > 0) return;
141
+ setBusy(true);
142
+ setError(null);
143
+ setRefused({});
144
+ try {
145
+ await api("/api/config/fields", {
146
+ method: "PUT",
147
+ body: { values: changes }
148
+ });
149
+ await onSaved();
150
+ } catch (cause) {
151
+ const errors = cause instanceof ApiError && cause.body && typeof cause.body === "object" && "errors" in cause.body ? cause.body.errors : null;
152
+ if (errors) setRefused(errors);
153
+ else setError(errorMessage(cause));
154
+ } finally {
155
+ setBusy(false);
156
+ }
157
+ }
158
+ const field = (entry) => /* @__PURE__ */ jsx(Setting, {
159
+ field: entry,
160
+ value: draft.values[entry.envVar] ?? "",
161
+ removed: draft.removed.includes(entry.envVar),
162
+ problem: plain(entry.envVar, refused[entry.envVar]) ?? problems[entry.envVar],
163
+ disabled: busy,
164
+ onChange: (value) => set(entry.envVar, value),
165
+ onRemove: (removed) => remove(entry.envVar, removed)
166
+ }, entry.envVar);
167
+ const status = Object.keys(refused).length > 0 ? {
168
+ text: "Nothing was saved: see above.",
169
+ className: "text-warning"
170
+ } : error ? {
171
+ text: `Nothing was saved: ${error}`,
172
+ className: "text-warning"
173
+ } : dirty ? {
174
+ text: "Not saved yet.",
175
+ className: "text-warning"
176
+ } : justSaved && !touched ? {
177
+ text: "Saved. It applies from the next turn.",
178
+ className: "text-success"
179
+ } : {
180
+ text: card.footnote ?? "",
181
+ className: "text-muted-foreground"
182
+ };
183
+ return /* @__PURE__ */ jsx(SetupCard, {
184
+ icon: /* @__PURE__ */ jsx(Icon, { className: "size-5" }),
185
+ title: card.displayName,
186
+ description: card.hint ?? "",
187
+ labelledBy: titleId,
188
+ action: card.state && /* @__PURE__ */ jsx(Chip, {
189
+ tone: TONE[card.state.tone],
190
+ children: card.state.label
191
+ }),
192
+ children: /* @__PURE__ */ jsxs("form", {
193
+ onSubmit: save,
194
+ className: "grid gap-4 border-t border-border px-4 py-4 sm:px-5",
195
+ children: [
196
+ card.note && /* @__PURE__ */ jsxs("p", {
197
+ role: "status",
198
+ className: "m-0 flex items-start gap-2.5 rounded-xl border border-warning/35 bg-warning/10 px-3.5 py-3 text-sm text-foreground",
199
+ children: [/* @__PURE__ */ jsx(AlertTriangle, {
200
+ className: "mt-0.5 size-4 shrink-0 text-warning",
201
+ "aria-hidden": "true"
202
+ }), /* @__PURE__ */ jsx("span", {
203
+ className: "min-w-0 break-words",
204
+ children: card.note
205
+ })]
206
+ }),
207
+ main.map(field),
208
+ advanced.length > 0 && /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("button", {
209
+ type: "button",
210
+ "aria-expanded": more || advancedNeedsYou,
211
+ onClick: () => setMore((open) => !open),
212
+ className: "flex min-h-9 items-center gap-1.5 text-sm font-semibold text-foreground",
213
+ children: [/* @__PURE__ */ jsx(ChevronRight, {
214
+ className: cn("size-4 text-muted-foreground transition-transform", (more || advancedNeedsYou) && "rotate-90"),
215
+ "aria-hidden": "true"
216
+ }), "More settings"]
217
+ }), (more || advancedNeedsYou) && /* @__PURE__ */ jsx("div", {
218
+ className: "mt-2 grid gap-4 rounded-xl border border-border bg-muted/40 p-3.5",
219
+ children: advanced.map(field)
220
+ })] }),
221
+ /* @__PURE__ */ jsxs("div", {
222
+ className: "flex flex-wrap items-center gap-x-4 gap-y-2",
223
+ children: [/* @__PURE__ */ jsx(Button, {
224
+ variant: "primary",
225
+ type: "submit",
226
+ disabled: !dirty || busy || Object.keys(problems).length > 0,
227
+ children: busy ? "Saving…" : "Save"
228
+ }), /* @__PURE__ */ jsx("p", {
229
+ role: "status",
230
+ className: cn("m-0 min-w-0 flex-1 basis-56 text-sm font-medium", status.className),
231
+ children: status.text
232
+ })]
233
+ })
234
+ ]
235
+ })
236
+ });
237
+ }
238
+ function Setting({ field, value, removed, problem, disabled, onChange, onRemove }) {
239
+ const id = useId();
240
+ const locked = disabled || field.environment === true && field.kind !== "secret";
241
+ const under = /* @__PURE__ */ jsxs(Fragment$1, { children: [
242
+ field.unusable && !field.environment && /* @__PURE__ */ jsxs("span", {
243
+ className: "mt-1 block text-xs font-semibold text-warning",
244
+ children: [
245
+ "The stored value “",
246
+ field.value,
247
+ "” cannot be used, so this is what applies. Save to replace it."
248
+ ]
249
+ }),
250
+ field.environment && /* @__PURE__ */ jsxs("span", {
251
+ className: "mt-1 block text-xs font-medium text-muted-foreground",
252
+ children: [
253
+ "Set in the daemon’s environment as ",
254
+ /* @__PURE__ */ jsx("code", { children: field.envVar }),
255
+ ", which wins over this page."
256
+ ]
257
+ }),
258
+ problem && /* @__PURE__ */ jsx("span", {
259
+ role: "alert",
260
+ className: "mt-1 block text-xs font-semibold text-warning",
261
+ children: problem
262
+ })
263
+ ] });
264
+ const input = field.input;
265
+ if (field.kind === "secret") return /* @__PURE__ */ jsx(SecretSetting, {
266
+ id,
267
+ field,
268
+ value,
269
+ removed,
270
+ disabled,
271
+ onChange,
272
+ onRemove,
273
+ children: under
274
+ });
275
+ if (input.type === "choice") return /* @__PURE__ */ jsxs("fieldset", {
276
+ className: "m-0 min-w-0 border-0 p-0",
277
+ disabled: locked,
278
+ children: [
279
+ /* @__PURE__ */ jsx("legend", {
280
+ className: "mb-2 p-0 text-sm font-semibold text-foreground",
281
+ children: field.label
282
+ }),
283
+ /* @__PURE__ */ jsx("div", {
284
+ className: "grid gap-2 md:grid-cols-2",
285
+ children: input.options.map((option, index) => {
286
+ const selected = option.value === value;
287
+ const titleId = `${id}-${index}`;
288
+ return /* @__PURE__ */ jsxs("label", {
289
+ className: cn("m-0 flex items-start gap-3 rounded-xl border px-3.5 py-3 transition-colors", locked ? "cursor-default opacity-70" : "cursor-pointer", selected ? "border-primary/50 bg-accent/40" : "border-border bg-card hover:bg-muted/40"),
290
+ children: [/* @__PURE__ */ jsx("input", {
291
+ type: "radio",
292
+ name: field.envVar,
293
+ value: option.value,
294
+ checked: selected,
295
+ onChange: () => onChange(option.value),
296
+ "aria-labelledby": titleId,
297
+ "aria-describedby": `${titleId}-about`,
298
+ className: "mt-[3px] size-[18px] shrink-0 accent-[var(--color-sapphire)]"
299
+ }), /* @__PURE__ */ jsxs("span", {
300
+ className: "min-w-0",
301
+ children: [/* @__PURE__ */ jsx("span", {
302
+ id: titleId,
303
+ className: "block text-sm font-semibold text-foreground",
304
+ children: option.label
305
+ }), /* @__PURE__ */ jsxs("span", {
306
+ id: `${titleId}-about`,
307
+ className: "block",
308
+ children: [option.hint && /* @__PURE__ */ jsx("span", {
309
+ className: "block break-words text-sm text-muted-foreground",
310
+ children: option.hint
311
+ }), selected && option.note && /* @__PURE__ */ jsx("span", {
312
+ className: cn("mt-1 block break-words text-sm font-medium", option.note.tone === "ok" ? "text-success" : "text-warning"),
313
+ children: option.note.text
314
+ })]
315
+ })]
316
+ })]
317
+ }, option.value);
318
+ })
319
+ }),
320
+ under
321
+ ]
322
+ });
323
+ if (input.type === "switch") return /* @__PURE__ */ jsxs("div", {
324
+ className: "flex items-start justify-between gap-4",
325
+ children: [/* @__PURE__ */ jsxs("div", {
326
+ className: "min-w-0",
327
+ children: [
328
+ /* @__PURE__ */ jsx("div", {
329
+ className: "text-sm font-semibold text-foreground",
330
+ children: field.label
331
+ }),
332
+ field.description && /* @__PURE__ */ jsx("div", {
333
+ className: "text-sm text-muted-foreground",
334
+ children: field.description
335
+ }),
336
+ under
337
+ ]
338
+ }), /* @__PURE__ */ jsx(Switch, {
339
+ label: field.label,
340
+ checked: value === input.on,
341
+ disabled: locked,
342
+ onChange: (checked) => onChange(checked ? input.on : input.off)
343
+ })]
344
+ });
345
+ if (input.type === "number") {
346
+ const scale = input.scale ?? 1;
347
+ return /* @__PURE__ */ jsxs("div", {
348
+ className: "flex flex-wrap items-center justify-between gap-x-4 gap-y-1.5",
349
+ children: [/* @__PURE__ */ jsxs("div", {
350
+ className: "min-w-0 flex-1 basis-52",
351
+ children: [
352
+ /* @__PURE__ */ jsx("label", {
353
+ htmlFor: id,
354
+ className: "m-0 text-sm font-semibold text-foreground",
355
+ children: field.label
356
+ }),
357
+ field.description && /* @__PURE__ */ jsx("div", {
358
+ className: "text-sm text-muted-foreground",
359
+ children: field.description
360
+ }),
361
+ under
362
+ ]
363
+ }), /* @__PURE__ */ jsxs("div", {
364
+ className: "flex shrink-0 items-center gap-2 text-sm text-muted-foreground",
365
+ children: [/* @__PURE__ */ jsx("input", {
366
+ id,
367
+ type: "number",
368
+ inputMode: "numeric",
369
+ min: input.min / scale,
370
+ max: input.max / scale,
371
+ step: 1,
372
+ value,
373
+ disabled: locked,
374
+ "aria-invalid": problem ? true : void 0,
375
+ onChange: (event) => onChange(event.target.value),
376
+ className: "w-24 text-right"
377
+ }), input.unit && /* @__PURE__ */ jsx("span", { children: input.unit })]
378
+ })]
379
+ });
380
+ }
381
+ return /* @__PURE__ */ jsxs("div", { children: [
382
+ /* @__PURE__ */ jsx("label", {
383
+ htmlFor: id,
384
+ className: "m-0 text-sm font-semibold text-foreground",
385
+ children: field.label
386
+ }),
387
+ /* @__PURE__ */ jsx("input", {
388
+ id,
389
+ type: "text",
390
+ value,
391
+ disabled: locked,
392
+ autoComplete: "off",
393
+ spellCheck: false,
394
+ placeholder: field.placeholder ?? "",
395
+ "aria-invalid": problem ? true : void 0,
396
+ onChange: (event) => onChange(event.target.value),
397
+ className: "mt-1.5 max-w-xl font-mono"
398
+ }),
399
+ field.description && /* @__PURE__ */ jsx("span", {
400
+ className: "mt-1 block text-xs text-muted-foreground",
401
+ children: field.description
402
+ }),
403
+ under
404
+ ] });
405
+ }
406
+ /** A key: shown as saved until it is replaced or removed, both of which wait for Save. */
407
+ function SecretSetting({ id, field, value, removed, disabled, onChange, onRemove, children }) {
408
+ const [replacing, setReplacing] = useState(false);
409
+ const typing = !field.set || replacing;
410
+ return /* @__PURE__ */ jsxs("div", { children: [
411
+ /* @__PURE__ */ jsx("label", {
412
+ htmlFor: id,
413
+ className: "m-0 text-sm font-semibold text-foreground",
414
+ children: field.label
415
+ }),
416
+ typing ? /* @__PURE__ */ jsxs("div", {
417
+ className: "mt-1.5 flex max-w-xl flex-wrap items-center gap-2",
418
+ children: [/* @__PURE__ */ jsx("input", {
419
+ id,
420
+ type: "password",
421
+ value,
422
+ disabled,
423
+ autoComplete: "off",
424
+ spellCheck: false,
425
+ placeholder: field.placeholder ?? "",
426
+ onChange: (event) => onChange(event.target.value),
427
+ className: "min-w-0 flex-1 basis-56 font-mono"
428
+ }), field.set && /* @__PURE__ */ jsx(Button, {
429
+ variant: "ghost",
430
+ disabled,
431
+ onClick: () => {
432
+ onChange("");
433
+ setReplacing(false);
434
+ },
435
+ children: "Keep the saved one"
436
+ })]
437
+ }) : /* @__PURE__ */ jsxs("div", {
438
+ className: "mt-1.5 flex min-h-[2.65rem] max-w-xl flex-wrap items-center gap-x-3 gap-y-2 rounded-xl border border-border bg-muted/40 px-3.5 py-1.5 text-sm",
439
+ children: [/* @__PURE__ */ jsx("span", {
440
+ className: "min-w-0 flex-1 basis-40 text-foreground",
441
+ children: removed ? "Will be removed when you save." : /* @__PURE__ */ jsxs(Fragment$1, { children: [
442
+ "Saved: ",
443
+ /* @__PURE__ */ jsx("span", {
444
+ className: "font-mono",
445
+ children: field.preview ?? "•••"
446
+ }),
447
+ ", stored encrypted"
448
+ ] })
449
+ }), removed ? /* @__PURE__ */ jsx(Button, {
450
+ variant: "ghost",
451
+ disabled,
452
+ onClick: () => onRemove(false),
453
+ children: "Keep it"
454
+ }) : /* @__PURE__ */ jsxs("span", {
455
+ className: "flex gap-2",
456
+ children: [/* @__PURE__ */ jsx(Button, {
457
+ id,
458
+ variant: "ghost",
459
+ disabled,
460
+ onClick: () => setReplacing(true),
461
+ children: "Replace"
462
+ }), /* @__PURE__ */ jsx(Button, {
463
+ variant: "ghost",
464
+ disabled,
465
+ onClick: () => onRemove(true),
466
+ children: "Remove"
467
+ })]
468
+ })]
469
+ }),
470
+ field.description && /* @__PURE__ */ jsx("span", {
471
+ className: "mt-1 block text-xs text-muted-foreground",
472
+ children: field.description
473
+ }),
474
+ children
475
+ ] });
476
+ }
477
+ //#endregion
478
+ //#region src/routes/config/tools.tsx?tsr-split=component
479
+ function ToolsPage() {
480
+ const { tools } = Route.useLoaderData();
481
+ const router = useRouter();
482
+ const [saves, setSaves] = useState({});
483
+ const [lastSaved, setLastSaved] = useState(null);
484
+ return /* @__PURE__ */ jsx(ConfigPage, {
485
+ title: "Tools",
486
+ description: "What Agents can do besides thinking: search, read pages, browse and run commands. Every setting here applies to all Agents.",
487
+ children: tools.map((card) => /* @__PURE__ */ jsx(ToolCard, {
488
+ card,
489
+ justSaved: lastSaved === card.id,
490
+ onSaved: async () => {
491
+ await router.invalidate({ sync: true });
492
+ setLastSaved(card.id);
493
+ setSaves((current) => ({
494
+ ...current,
495
+ [card.id]: (current[card.id] ?? 0) + 1
496
+ }));
497
+ }
498
+ }, `${card.id}:${saves[card.id] ?? 0}`))
499
+ });
500
+ }
501
+ //#endregion
502
+ export { ToolsPage as component };
@@ -0,0 +1,12 @@
1
+ import { n as createServerFn } from "../server.js";
2
+ import { t as createSsrRpc } from "./createSsrRpc-GCCF14VW.js";
3
+ import { createFileRoute, lazyRouteComponent } from "@tanstack/react-router";
4
+ //#region src/routes/config/tools.tsx
5
+ var $$splitComponentImporter = () => import("./tools-OfD22R-C.js");
6
+ var fetchTools = createServerFn({ method: "GET" }).handler(createSsrRpc("946c6cbff3f55931c3fb28c971d20b18b4b8a9f25417a5d1afc0550d7afa393b"));
7
+ var Route = createFileRoute("/config/tools")({
8
+ loader: () => fetchTools(),
9
+ component: lazyRouteComponent($$splitComponentImporter, "component")
10
+ });
11
+ //#endregion
12
+ export { Route as t };
@@ -0,0 +1,63 @@
1
+ import { T as errorMessage } from "./workspace-DaitCM0t.js";
2
+ import { useCallback, useEffect, useRef, useState } from "react";
3
+ //#region src/lib/use-resource.ts
4
+ /**
5
+ * Load something from the daemon when a panel opens, and again whenever a dependency changes.
6
+ * `load` gets a signal that aborts when the dependencies change or the component goes away.
7
+ */
8
+ function useResource(load, deps) {
9
+ const [data, setData] = useState(void 0);
10
+ const [error, setError] = useState(null);
11
+ const [loading, setLoading] = useState(true);
12
+ const loadRef = useRef(load);
13
+ loadRef.current = load;
14
+ const controllerRef = useRef(null);
15
+ const run = useCallback(async (reset) => {
16
+ controllerRef.current?.abort();
17
+ const controller = new AbortController();
18
+ controllerRef.current = controller;
19
+ if (reset) setData(void 0);
20
+ setLoading(true);
21
+ try {
22
+ const next = await loadRef.current(controller.signal);
23
+ if (controller.signal.aborted) return;
24
+ setData(next);
25
+ setError(null);
26
+ } catch (cause) {
27
+ if (controller.signal.aborted) return;
28
+ setError(errorMessage(cause));
29
+ } finally {
30
+ if (!controller.signal.aborted) setLoading(false);
31
+ }
32
+ }, []);
33
+ useEffect(() => {
34
+ run(true);
35
+ return () => controllerRef.current?.abort();
36
+ }, deps);
37
+ return {
38
+ data,
39
+ error,
40
+ loading,
41
+ reload: useCallback(() => run(false), [run])
42
+ };
43
+ }
44
+ /** False on the server and during hydration, true afterwards: for what only the browser knows. */
45
+ function useHydrated() {
46
+ const [hydrated, setHydrated] = useState(false);
47
+ useEffect(() => setHydrated(true), []);
48
+ return hydrated;
49
+ }
50
+ /** Whether a media query matches; `initial` until the browser says. */
51
+ function useMediaQuery(query, initial = true) {
52
+ const [matches, setMatches] = useState(initial);
53
+ useEffect(() => {
54
+ const list = window.matchMedia(query);
55
+ const update = () => setMatches(list.matches);
56
+ update();
57
+ list.addEventListener("change", update);
58
+ return () => list.removeEventListener("change", update);
59
+ }, [query]);
60
+ return matches;
61
+ }
62
+ //#endregion
63
+ export { useMediaQuery as n, useResource as r, useHydrated as t };
@@ -0,0 +1,8 @@
1
+ import { clsx } from "clsx";
2
+ import { twMerge } from "tailwind-merge";
3
+ //#region src/lib/utils.ts
4
+ function cn(...inputs) {
5
+ return twMerge(clsx(inputs));
6
+ }
7
+ //#endregion
8
+ export { cn as t };
@@ -0,0 +1,15 @@
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/welcome.tsx?tss-serverfn-split
5
+ var fetchProviders_createServerFn_handler = createServerRpc({
6
+ id: "818bf71baeed233268a5ad1a4be5a77e488be79b79ad1bd739463445a7be4d58",
7
+ name: "fetchProviders",
8
+ filename: "src/routes/welcome.tsx"
9
+ }, (opts) => fetchProviders.__executeServer(opts));
10
+ var fetchProviders = createServerFn({ method: "GET" }).handler(fetchProviders_createServerFn_handler, async () => {
11
+ const { providers } = await daemonClient().get("/api/config/providers");
12
+ return providers;
13
+ });
14
+ //#endregion
15
+ export { fetchProviders_createServerFn_handler };