bazilion 0.51.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 (135) hide show
  1. package/dist/cli.js +74 -28
  2. package/dist/cli.js.map +1 -1
  3. package/dist/daemon.js +547 -187
  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-pupvtSCX.js → ConfigPage-DvBzy2MN.js} +1 -1
  7. package/dist/web/client/assets/{ConfirmDialog-GFDcHI1L.js → ConfirmDialog-CiZ5tk9R.js} +1 -1
  8. package/dist/web/client/assets/{ConnectionsView-y1CeY-6U.js → ConnectionsView-Czkpm2JY.js} +1 -1
  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-D4ezA6U4.js → SectionTabs-DENNb6Nw.js} +1 -1
  12. package/dist/web/client/assets/{SkillFindings-BzLO1lNA.js → SkillFindings-Xng11qqx.js} +1 -1
  13. package/dist/web/client/assets/SpawnDialog-CKWFQ6jk.js +1 -0
  14. package/dist/web/client/assets/TeamThread-2rm1JGSk.js +1 -0
  15. package/dist/web/client/assets/{UnsavedChangesGuard-DBJikVgc.js → UnsavedChangesGuard-nx6dv2Yw.js} +1 -1
  16. package/dist/web/client/assets/_id-B72mIpcE.js +1 -0
  17. package/dist/web/client/assets/_id-Bzavnza1.js +1 -0
  18. package/dist/web/client/assets/access-Yw9jODuk.js +1 -0
  19. package/dist/web/client/assets/agents-C9xoyL7o.js +1 -0
  20. package/dist/web/client/assets/agents-TviG16wx.js +1 -0
  21. package/dist/web/client/assets/attention-DmURtlJm.js +1 -0
  22. package/dist/web/client/assets/chevron-right-CUZiA2aG.js +1 -0
  23. package/dist/web/client/assets/config-UZz_mjO5.js +1 -0
  24. package/dist/web/client/assets/dist-BWppw70N.js +41 -0
  25. package/dist/web/client/assets/dist-D2dwY7MR.js +1 -0
  26. package/dist/web/client/assets/index-Df1oUtAP.js +14 -0
  27. package/dist/web/client/assets/login-CPfdaqsV.js +1 -0
  28. package/dist/web/client/assets/mcp-FlYnNon0.js +1 -0
  29. package/dist/web/client/assets/model-facts-DoB6QD5y.js +1 -0
  30. package/dist/web/client/assets/parts-tIDBNsYA.js +1 -0
  31. package/dist/web/client/assets/routes-BZaWCoQj.js +76 -0
  32. package/dist/web/client/assets/skills-C7yDPC8s.js +1 -0
  33. package/dist/web/client/assets/{style-Cdzqt_TJ.js → style-DDuTFJUu.js} +1 -1
  34. package/dist/web/client/assets/styles-BviXU81u.css +2 -0
  35. package/dist/web/client/assets/{system-CsI66nyZ.js → system-CL3Kz36L.js} +1 -1
  36. package/dist/web/client/assets/teams-CQTEF5gV.js +1 -0
  37. package/dist/web/client/assets/teams-DQ7SqVyF.js +1 -0
  38. package/dist/web/client/assets/{telegram-C3dGndJV.js → telegram-BLgxtGhZ.js} +1 -1
  39. package/dist/web/client/assets/tools-pOQyGVYo.js +1 -0
  40. package/dist/web/client/assets/use-resource-C3MBZJop.js +1 -0
  41. package/dist/web/client/assets/welcome-Hr6JpMef.js +1 -0
  42. package/dist/web/client/assets/wrench-6BEIqKDn.js +1 -0
  43. package/dist/web/server/assets/{AddProviderDialog-CR6TRYdZ.js → AddProviderDialog-Tn4AskPm.js} +7 -304
  44. package/dist/web/server/assets/{ConfigPage-CIh3ohea.js → ConfigPage-DqDUujmt.js} +2 -2
  45. package/dist/web/server/assets/{ConfirmDialog-B79K2KEW.js → ConfirmDialog-DfaJ--A6.js} +2 -2
  46. package/dist/web/server/assets/{ConnectionsView-BIMYdp9C.js → ConnectionsView-DAG-zNBz.js} +6 -6
  47. package/dist/web/server/assets/{Dialog-CVqpXxuN.js → Dialog-aup_yJv5.js} +1 -1
  48. package/dist/web/server/assets/ModelMenu-DUY9aHkE.js +138 -0
  49. package/dist/web/server/assets/{Rail-Cg-efcpA.js → Rail-BIC_4ptO.js} +6 -6
  50. package/dist/web/server/assets/{SectionTabs-DrcgVeZd.js → SectionTabs-BGsrf-UQ.js} +3 -3
  51. package/dist/web/server/assets/{SkillFindings-DSDiL6hn.js → SkillFindings-BdATze1A.js} +1 -1
  52. package/dist/web/server/assets/{SpawnDialog-BUUlLxE9.js → SpawnDialog-D_SMPCG_.js} +11 -8
  53. package/dist/web/server/assets/{TeamForm-CvQAs2FA.js → TeamForm-ilBaeLI4.js} +1 -1
  54. package/dist/web/server/assets/{TeamThread-5CjVPcDr.js → TeamThread-DuLlGDcw.js} +3 -3
  55. package/dist/web/server/assets/{UnsavedChangesGuard-CyF2Z9p1.js → UnsavedChangesGuard-DrOvPV14.js} +1 -1
  56. package/dist/web/server/assets/{_id-Dg6M_qfr.js → _id-BsZcsabI.js} +11 -11
  57. package/dist/web/server/assets/{_id-BvAaRSUW.js → _id-D8Kj0F30.js} +2 -2
  58. package/dist/web/server/assets/{_id-8bsYEcGg.js → _id-DJnYgisy.js} +2 -2
  59. package/dist/web/server/assets/{_id-Dji7xr9C.js → _id-QYifTM9w.js} +3 -3
  60. package/dist/web/server/assets/{_id-0fEWiVZX.js → _id-yN0z7VqE.js} +6 -6
  61. package/dist/web/server/assets/{_tanstack-start-manifest_v-sxiIH4M7.js → _tanstack-start-manifest_v-D6zrzUC7.js} +84 -75
  62. package/dist/web/server/assets/{tokens-CEdl8puR.js → access-C_pupPks.js} +3 -3
  63. package/dist/web/server/assets/{tokens-DSLwQ1Pw.js → access-DKOpcHIJ.js} +10 -10
  64. package/dist/web/server/assets/{tokens-C-oDTqnp.js → access-GMGed5O8.js} +5 -5
  65. package/dist/web/server/assets/{agents-DktqUffG.js → agents-B6OR3x99.js} +13 -13
  66. package/dist/web/server/assets/{agents-BDA5yYZ2.js → agents-B7642eRO.js} +5 -5
  67. package/dist/web/server/assets/{agents-DM7guWF2.js → agents-BJ-_oC2e.js} +2 -2
  68. package/dist/web/server/assets/{agents-BTDxmp-F.js → agents-CjV0w-Zy.js} +2 -2
  69. package/dist/web/server/assets/{agents-xgZ9rsac.js → agents-Dy_Q-9lG.js} +3 -3
  70. package/dist/web/server/assets/{attention-De3-ehuf.js → attention-CLP4HYBz.js} +3 -3
  71. package/dist/web/server/assets/{attention-CHQEQiZl.js → attention-DS3O9UmJ.js} +2 -2
  72. package/dist/web/server/assets/{config-DzgkbBoD.js → config-DjTGA4iZ.js} +2 -2
  73. package/dist/web/server/assets/{config-DOp28gcy.js → config-Q7livfa3.js} +157 -9
  74. package/dist/web/server/assets/{createSsrRpc-CcLbajrF.js → createSsrRpc-GCCF14VW.js} +1 -1
  75. package/dist/web/server/assets/{mcp-CO_tycXU.js → mcp-BI-FD-JI.js} +5 -5
  76. package/dist/web/server/assets/{mcp-D3OCoHtO.js → mcp-ZARSOxZW.js} +2 -2
  77. package/dist/web/server/assets/model-facts-mrfrWQne.js +136 -0
  78. package/dist/web/server/assets/parts-B31PJkhi.js +190 -0
  79. package/dist/web/server/assets/{router-Cs2Ak4II.js → router-Dh2-IvLL.js} +39 -39
  80. package/dist/web/server/assets/{routes-BVwqgZGI.js → routes-BJIJWCIE.js} +3 -3
  81. package/dist/web/server/assets/{routes-BSNOKE-C.js → routes-C9NawqcV.js} +21 -17
  82. package/dist/web/server/assets/{routes-CO4l-GJ0.js → routes-CDskMy5C.js} +2 -2
  83. package/dist/web/server/assets/{skills-DKYV7PTk.js → skills-BqLq3ZXq.js} +5 -5
  84. package/dist/web/server/assets/{skills-CggQJk6a.js → skills-StN15QhC.js} +2 -2
  85. package/dist/web/server/assets/{system-CZ2qzBz3.js → system-BtRA2HUs.js} +2 -2
  86. package/dist/web/server/assets/{system-DsJfpBPl.js → system-Dl-1RhoP.js} +2 -2
  87. package/dist/web/server/assets/{teams-Bp2tERZe.js → teams-5PMGvHuM.js} +2 -2
  88. package/dist/web/server/assets/{teams-C-8iz-uV.js → teams-COaU0wN9.js} +4 -4
  89. package/dist/web/server/assets/{teams-B6PzNcoy.js → teams-Ca8W4mvl.js} +5 -5
  90. package/dist/web/server/assets/{teams-B6lBhvdL.js → teams-CbIPKf99.js} +2 -2
  91. package/dist/web/server/assets/{telegram-Gy7_9yih.js → telegram-CGol0CKX2.js} +3 -3
  92. package/dist/web/server/assets/{telegram-D2RZriz_.js → telegram-Cv0D4gyz.js} +5 -5
  93. package/dist/web/server/assets/{telegram-CXrP3hMp.js → telegram-Yx8nm6Ei.js} +5 -5
  94. package/dist/web/server/assets/tools-C-wwWjLI.js +12 -0
  95. package/dist/web/server/assets/tools-OfD22R-C.js +502 -0
  96. package/dist/web/server/assets/tools-ioJcPzMW.js +12 -0
  97. package/dist/web/server/assets/{use-resource-ChQozXVI.js → use-resource-DVzK0toP.js} +1 -1
  98. package/dist/web/server/assets/utils-C_uf36nf.js +8 -0
  99. package/dist/web/server/assets/{welcome-BLw1G6SS.js → welcome-FFEbrNT1.js} +6 -5
  100. package/dist/web/server/assets/{welcome-ByAkvHSP.js → welcome-jxmpE_Jb.js} +2 -2
  101. package/dist/web/server/assets/{workspace-DeEYMPDX.js → workspace-DaitCM0t.js} +1 -8
  102. package/dist/web/server/server.js +18 -18
  103. package/dist/worker.js +202 -120
  104. package/dist/worker.js.map +1 -1
  105. package/package.json +1 -1
  106. package/dist/web/client/assets/AddProviderDialog-Diic36c_.js +0 -1
  107. package/dist/web/client/assets/Dialog-bg86_x4v.js +0 -1
  108. package/dist/web/client/assets/FieldRow-B8eIni5r.js +0 -1
  109. package/dist/web/client/assets/ModelSelect-DvCLUmkW.js +0 -1
  110. package/dist/web/client/assets/SpawnDialog-YJX6UMBC.js +0 -1
  111. package/dist/web/client/assets/TeamThread-DFvbakHo.js +0 -1
  112. package/dist/web/client/assets/_id-BjNtLwak.js +0 -1
  113. package/dist/web/client/assets/_id-BklaQf3z.js +0 -1
  114. package/dist/web/client/assets/agents-D9cUF2d9.js +0 -1
  115. package/dist/web/client/assets/agents-wuBlzx4e.js +0 -1
  116. package/dist/web/client/assets/attention-8ZkSLl2e.js +0 -1
  117. package/dist/web/client/assets/config-Con_BbSh.js +0 -1
  118. package/dist/web/client/assets/index-Br9qkGM-.js +0 -54
  119. package/dist/web/client/assets/login-llnOKSJc.js +0 -1
  120. package/dist/web/client/assets/mcp-zIUguMSI.js +0 -1
  121. package/dist/web/client/assets/routes-BY5uqJ2n.js +0 -76
  122. package/dist/web/client/assets/services-esLrcTwe.js +0 -1
  123. package/dist/web/client/assets/skills-DzYXksM0.js +0 -1
  124. package/dist/web/client/assets/styles-BRSS6yrm.css +0 -2
  125. package/dist/web/client/assets/teams-CHE_zpxS.js +0 -1
  126. package/dist/web/client/assets/teams-dxG9OESG.js +0 -1
  127. package/dist/web/client/assets/tokens-CNNH-Wr9.js +0 -1
  128. package/dist/web/client/assets/use-resource-BjnxgGvh.js +0 -1
  129. package/dist/web/client/assets/welcome-C8EOtc8P.js +0 -1
  130. package/dist/web/server/assets/FieldRow-CHVhX2rS.js +0 -173
  131. package/dist/web/server/assets/ModelSelect-DrZrdndo.js +0 -43
  132. package/dist/web/server/assets/services-DZLxUSG8.js +0 -13
  133. package/dist/web/server/assets/services-DsHRLL8q.js +0 -12
  134. package/dist/web/server/assets/services-DsvpaF3L.js +0 -74
  135. /package/dist/web/server/assets/{system-DtswhLW62.js → system-DtswhLW6.js} +0 -0
@@ -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 };
@@ -1,4 +1,4 @@
1
- import { E as errorMessage } from "./workspace-DeEYMPDX.js";
1
+ import { T as errorMessage } from "./workspace-DaitCM0t.js";
2
2
  import { useCallback, useEffect, useRef, useState } from "react";
3
3
  //#region src/lib/use-resource.ts
4
4
  /**
@@ -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 };
@@ -1,9 +1,10 @@
1
- import { d as Button, w as api } from "./workspace-DeEYMPDX.js";
1
+ import { C as api, u as Button } from "./workspace-DaitCM0t.js";
2
2
  import { t as DEFAULT_PROFILE_ID } from "./entities-Dn2xzKIw.js";
3
- import { r as useResource } from "./use-resource-ChQozXVI.js";
4
- import { o as PageShell } from "./createSsrRpc-CcLbajrF.js";
5
- import { t as Route } from "./welcome-ByAkvHSP.js";
6
- import { a as ProviderConnect, i as hostOf, l as ProviderAvatar, n as ConnectedSummary, r as ProviderChooser } from "./AddProviderDialog-CR6TRYdZ.js";
3
+ import { r as useResource } from "./use-resource-DVzK0toP.js";
4
+ import { o as PageShell } from "./createSsrRpc-GCCF14VW.js";
5
+ import { t as Route } from "./welcome-jxmpE_Jb.js";
6
+ import { i as ProviderAvatar } from "./parts-B31PJkhi.js";
7
+ import { a as ProviderConnect, i as hostOf, n as ConnectedSummary, r as ProviderChooser } from "./AddProviderDialog-Tn4AskPm.js";
7
8
  import { useState } from "react";
8
9
  import { useNavigate } from "@tanstack/react-router";
9
10
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,5 +1,5 @@
1
1
  import { n as createServerFn } from "../server.js";
2
- import { t as createSsrRpc } from "./createSsrRpc-CcLbajrF.js";
2
+ import { t as createSsrRpc } from "./createSsrRpc-GCCF14VW.js";
3
3
  import { createFileRoute, lazyRouteComponent, redirect } from "@tanstack/react-router";
4
4
  //#region src/lib/auth.ts
5
5
  var fetchAuthState = createServerFn({ method: "GET" }).handler(createSsrRpc("a5d3825fc69573bb55bab6df578c750ebb0240dd394c3acee3adea02918a5dc2"));
@@ -11,7 +11,7 @@ function isSetupOpen(path) {
11
11
  }
12
12
  //#endregion
13
13
  //#region src/routes/welcome.tsx
14
- var $$splitComponentImporter = () => import("./welcome-BLw1G6SS.js");
14
+ var $$splitComponentImporter = () => import("./welcome-FFEbrNT1.js");
15
15
  var fetchProviders = createServerFn({ method: "GET" }).handler(createSsrRpc("818bf71baeed233268a5ad1a4be5a77e488be79b79ad1bd739463445a7be4d58"));
16
16
  var Route = createFileRoute("/welcome")({
17
17
  beforeLoad: async () => {
@@ -1,8 +1,6 @@
1
1
  import { r as readCookie, t as CSRF_COOKIES } from "./cookies-HnTYjKRp.js";
2
2
  import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
3
3
  import { jsx } from "react/jsx-runtime";
4
- import { clsx } from "clsx";
5
- import { twMerge } from "tailwind-merge";
6
4
  //#region src/lib/api.ts
7
5
  var ApiError = class extends Error {
8
6
  status;
@@ -576,11 +574,6 @@ function Button({ variant, type, className, ...rest }) {
576
574
  });
577
575
  }
578
576
  //#endregion
579
- //#region src/lib/utils.ts
580
- function cn(...inputs) {
581
- return twMerge(clsx(inputs));
582
- }
583
- //#endregion
584
577
  //#region src/lib/workspace.ts
585
578
  var isOneOf = (values, value) => typeof value === "string" && values.includes(value);
586
579
  var PANEL_TABS = [
@@ -655,4 +648,4 @@ function writePanelCookie(memory) {
655
648
  document.cookie = `${PANEL_COOKIE}=${value}; Path=/; Max-Age=31536000; SameSite=Lax`;
656
649
  }
657
650
  //#endregion
658
- export { ApiError as C, errorMessage as E, summarizeSteps as S, apiFetch as T, useActivity as _, isAgentSection as a, lineChange as b, parseWorkspaceSearch as c, Button as d, AgentAvatar as f, teamSummary as g, shortTime as h, PANEL_TABS as i, writePanelCookie as l, agentState as m, PANEL_COOKIE as n, isTeamSection as o, ActivityProvider as p, PANEL_LABELS as r, parsePanelCookie as s, FOCUS_VIEWS as t, cn as u, useActivityOptional as v, api as w, parseArgs as x, describeStep as y };
651
+ export { api as C, ApiError as S, errorMessage as T, useActivityOptional as _, isAgentSection as a, parseArgs as b, parseWorkspaceSearch as c, AgentAvatar as d, ActivityProvider as f, useActivity as g, teamSummary as h, PANEL_TABS as i, writePanelCookie as l, shortTime as m, PANEL_COOKIE as n, isTeamSection as o, agentState as p, PANEL_LABELS as r, parsePanelCookie as s, FOCUS_VIEWS as t, Button as u, describeStep as v, apiFetch as w, summarizeSteps as x, lineChange as y };