teleton 0.8.4 → 0.8.6

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 (84) hide show
  1. package/README.md +40 -17
  2. package/dist/{bootstrap-NNEI3Z5H.js → bootstrap-PFBH6ALD.js} +11 -8
  3. package/dist/bridge-guards-HZTNH7IB.js +9 -0
  4. package/dist/{chunk-NH2CNRKJ.js → chunk-2UUGRY5B.js} +151 -159
  5. package/dist/{chunk-UMUONAD6.js → chunk-4MFN75ZK.js} +5941 -2716
  6. package/dist/{chunk-LC4TV3KL.js → chunk-4MG2AROG.js} +5 -7
  7. package/dist/{chunk-LZQOX6YY.js → chunk-6IFNQWIM.js} +7714 -8748
  8. package/dist/chunk-7KI25UJU.js +215 -0
  9. package/dist/chunk-AX5NBEHX.js +12 -0
  10. package/dist/{chunk-5LOHRZYY.js → chunk-BLUES3FJ.js} +80 -101
  11. package/dist/{chunk-CUE4UZXR.js → chunk-BT2I3ETV.js} +3 -3
  12. package/dist/chunk-CXTZPOTA.js +107 -0
  13. package/dist/{chunk-LVTKJQ7O.js → chunk-D3GT6YIY.js} +59 -7
  14. package/dist/chunk-EKCXKL5M.js +53 -0
  15. package/dist/{chunk-XDZDOKIF.js → chunk-F6S3L3OV.js} +3 -3
  16. package/dist/{chunk-C4NKJT2Z.js → chunk-J4WDJ7XS.js} +1 -1
  17. package/dist/{chunk-G7PCW63M.js → chunk-JYF2MM5I.js} +147 -113
  18. package/dist/{chunk-NVKBBTI6.js → chunk-K3QSIIMZ.js} +9 -6
  19. package/dist/{chunk-EYWNOHMJ.js → chunk-L653KKCR.js} +1 -0
  20. package/dist/chunk-OMQIAWEU.js +273 -0
  21. package/dist/chunk-PCT7GYBP.js +274 -0
  22. package/dist/chunk-QYZBWU2D.js +139 -0
  23. package/dist/{chunk-WTDAICGT.js → chunk-R6W4DJRK.js} +7 -7
  24. package/dist/{chunk-5SEMA47R.js → chunk-RILOEIK6.js} +1 -1
  25. package/dist/{chunk-6OOHHJ4N.js → chunk-TFTNZZDH.js} +20 -20
  26. package/dist/chunk-TTOZCZWE.js +96 -0
  27. package/dist/chunk-UJ54YT2T.js +12 -0
  28. package/dist/{chunk-GHMXWAXI.js → chunk-ULVL2W3D.js} +211 -445
  29. package/dist/{chunk-NQ6FZKCE.js → chunk-V3S3NXBQ.js} +3 -1
  30. package/dist/{chunk-H7MFXJZK.js → chunk-WSL4KIOI.js} +31 -26
  31. package/dist/{chunk-35MX4ZUI.js → chunk-Z5WY7BSB.js} +5 -5
  32. package/dist/{chunk-ALKAAG4O.js → chunk-ZGKE3OTA.js} +112 -49
  33. package/dist/{chunk-JROBTXWY.js → chunk-ZHRDETCX.js} +38 -4
  34. package/dist/cli/index.d.ts +2 -0
  35. package/dist/cli/index.js +272 -159
  36. package/dist/{client-5KD25NOP.js → client-S5UIK6OG.js} +10 -8
  37. package/dist/daily-logs-3WXGYAQF.js +25 -0
  38. package/dist/{get-my-gifts-Y7EN7RK4.js → get-my-gifts-3YSYM3LI.js} +3 -2
  39. package/dist/harden-permissions-PV5SGV5D.js +100 -0
  40. package/dist/index.d.ts +923 -0
  41. package/dist/index.js +29 -20
  42. package/dist/knowledge-RRWUIO3G.js +19 -0
  43. package/dist/{local-IHKJFQJS.js → local-MSZAXWUL.js} +3 -3
  44. package/dist/mcp-loader-OELDFR63.js +15 -0
  45. package/dist/{memory-QMJRM3XJ.js → memory-6U6HGRK2.js} +23 -12
  46. package/dist/memory-hook-T7Y235KY.js +19 -0
  47. package/dist/messages-KV5ADNJB.js +17 -0
  48. package/dist/{migrate-5VBAP52B.js → migrate-AX3HOKOO.js} +10 -7
  49. package/dist/{paths-XA2RJH4S.js → paths-WMVV7ZAJ.js} +1 -1
  50. package/dist/{server-WWGVDFPW.js → server-MFRYOGHR.js} +21 -23
  51. package/dist/{server-AJCOURH7.js → server-SFLCAZFR.js} +221 -27
  52. package/dist/{setup-server-VDY64CWW.js → setup-server-YWAPKZVE.js} +26 -26
  53. package/dist/{store-BY7S6IFN.js → store-PGHQASBC.js} +11 -8
  54. package/dist/{task-dependency-resolver-L6UUMTHK.js → task-dependency-resolver-YQKADDEU.js} +24 -10
  55. package/dist/{task-executor-XBNJLUCS.js → task-executor-LWAWD225.js} +4 -4
  56. package/dist/{tool-adapter-IVX2XQJE.js → tool-adapter-VKLUZSQS.js} +1 -1
  57. package/dist/{tool-index-FTERJSZK.js → tool-index-YEWDF5CK.js} +5 -5
  58. package/dist/{transcript-IM7G25OS.js → transcript-4Y3Z2BJ3.js} +3 -3
  59. package/dist/web/assets/Config-MNxA69ib.js +1 -0
  60. package/dist/web/assets/Conversations-Dk958paA.js +1 -0
  61. package/dist/web/assets/Dashboard-dM18fGOm.js +1 -0
  62. package/dist/web/assets/Hooks-D2griQnI.js +1 -0
  63. package/dist/web/assets/Mcp-CtWNzwsz.js +1 -0
  64. package/dist/web/assets/Memory-CfLwH45G.js +1 -0
  65. package/dist/web/assets/Plugins-3hoJprFo.js +1 -0
  66. package/dist/web/assets/SearchInput-CpcETdpE.js +1 -0
  67. package/dist/web/assets/Soul-BSxE73aK.js +1 -0
  68. package/dist/web/assets/Tasks-DkCkfu3A.js +1 -0
  69. package/dist/web/assets/TelegramSettingsPanel-BRzc5G6e.js +1 -0
  70. package/dist/web/assets/Tools-Du8B8Mb4.js +1 -0
  71. package/dist/web/assets/Wallet-BLILP2Gn.js +1 -0
  72. package/dist/web/assets/Workspace-qklcXpXV.js +1 -0
  73. package/dist/web/assets/index-BwEPTTKp.js +90 -0
  74. package/dist/web/assets/index-noejUsK7.css +1 -0
  75. package/dist/web/assets/{index.es-DitvF-9H.js → index.es-DdpKlnGb.js} +1 -1
  76. package/dist/web/assets/useToolManager-tdxkKn3H.js +1 -0
  77. package/dist/web/assets/utils-CnsbSMo4.js +1 -0
  78. package/dist/web/index.html +2 -2
  79. package/package.json +7 -12
  80. package/src/templates/HEARTBEAT.md +5 -0
  81. package/dist/memory-hook-VUNWZ3NY.js +0 -19
  82. package/dist/web/assets/index-BfYCdwLI.js +0 -80
  83. package/dist/web/assets/index-DmlyQVhR.css +0 -1
  84. package/dist/{chunk-WFTC3JJW.js → chunk-3NO7QU7W.js} +1 -1
@@ -1,21 +1,25 @@
1
1
  import {
2
2
  createSetupRoutes
3
- } from "./chunk-5LOHRZYY.js";
4
- import "./chunk-WFTC3JJW.js";
5
- import "./chunk-JROBTXWY.js";
6
- import "./chunk-NH2CNRKJ.js";
3
+ } from "./chunk-BLUES3FJ.js";
4
+ import "./chunk-3NO7QU7W.js";
5
+ import "./chunk-ZHRDETCX.js";
6
+ import "./chunk-2UUGRY5B.js";
7
7
  import "./chunk-VFA7QMCZ.js";
8
- import "./chunk-C4NKJT2Z.js";
9
- import "./chunk-WTDAICGT.js";
10
- import "./chunk-6OOHHJ4N.js";
8
+ import {
9
+ getErrorMessage
10
+ } from "./chunk-3UFPFWYP.js";
11
+ import "./chunk-CXTZPOTA.js";
12
+ import "./chunk-J4WDJ7XS.js";
13
+ import "./chunk-R6W4DJRK.js";
14
+ import "./chunk-TFTNZZDH.js";
11
15
  import "./chunk-XQUHC3JZ.js";
12
16
  import "./chunk-R4YSJ4EY.js";
13
17
  import {
14
18
  TELETON_ROOT
15
- } from "./chunk-EYWNOHMJ.js";
19
+ } from "./chunk-L653KKCR.js";
16
20
  import {
17
21
  createLogger
18
- } from "./chunk-NQ6FZKCE.js";
22
+ } from "./chunk-V3S3NXBQ.js";
19
23
  import "./chunk-3RG5ZIWI.js";
20
24
 
21
25
  // src/webui/setup-server.ts
@@ -23,13 +27,12 @@ import { Hono } from "hono";
23
27
  import { serve } from "@hono/node-server";
24
28
  import { cors } from "hono/cors";
25
29
  import { bodyLimit } from "hono/body-limit";
26
- import { existsSync, readFileSync } from "fs";
30
+ import { existsSync, readFileSync, writeFileSync } from "fs";
27
31
  import { join, dirname, resolve, relative } from "path";
28
32
  import { fileURLToPath } from "url";
29
- import { exec } from "child_process";
33
+ import { spawn } from "child_process";
30
34
  import { platform } from "os";
31
35
  import { randomBytes } from "crypto";
32
- import { readFileSync as readYaml, writeFileSync } from "fs";
33
36
  import YAML from "yaml";
34
37
  var log = createLogger("Setup");
35
38
  function findWebDist() {
@@ -45,19 +48,19 @@ function findWebDist() {
45
48
  }
46
49
  function autoOpenBrowser(url) {
47
50
  const os = platform();
48
- let cmd;
51
+ let prog;
49
52
  if (os === "darwin") {
50
- cmd = `open "${url}"`;
53
+ prog = "open";
51
54
  } else if (os === "win32") {
52
- cmd = `start "${url}"`;
55
+ prog = "explorer";
53
56
  } else {
54
- cmd = `xdg-open "${url}"`;
57
+ prog = "xdg-open";
55
58
  }
56
- exec(cmd, (err) => {
57
- if (err) {
58
- log.info(`Open this URL in your browser: ${url}`);
59
- }
59
+ const child = spawn(prog, [url], { detached: true, stdio: "ignore" });
60
+ child.on("error", () => {
61
+ log.info(`Open this URL in your browser: ${url}`);
60
62
  });
63
+ child.unref();
61
64
  }
62
65
  var SetupServer = class {
63
66
  constructor(port = 7777) {
@@ -119,7 +122,7 @@ var SetupServer = class {
119
122
  try {
120
123
  const token = randomBytes(32).toString("hex");
121
124
  const configPath = join(TELETON_ROOT, "config.yaml");
122
- const raw = readYaml(configPath, "utf-8");
125
+ const raw = readFileSync(configPath, "utf-8");
123
126
  const config = YAML.parse(raw);
124
127
  config.webui = { ...config.webui || {}, enabled: true, auth_token: token };
125
128
  writeFileSync(configPath, YAML.stringify(config), { encoding: "utf-8", mode: 384 });
@@ -130,11 +133,8 @@ var SetupServer = class {
130
133
  setTimeout(() => resolve2(token), 500);
131
134
  }
132
135
  return c.json({ success: true, data: { token } });
133
- } catch (err) {
134
- return c.json(
135
- { success: false, error: err instanceof Error ? err.message : String(err) },
136
- 500
137
- );
136
+ } catch (error) {
137
+ return c.json({ success: false, error: getErrorMessage(error) }, 500);
138
138
  }
139
139
  });
140
140
  this.app.onError((err, c) => {
@@ -9,17 +9,20 @@ import {
9
9
  saveSessionStore,
10
10
  shouldResetSession,
11
11
  updateSession
12
- } from "./chunk-XDZDOKIF.js";
13
- import "./chunk-GHMXWAXI.js";
14
- import "./chunk-35MX4ZUI.js";
12
+ } from "./chunk-F6S3L3OV.js";
13
+ import "./chunk-ULVL2W3D.js";
14
+ import "./chunk-QYZBWU2D.js";
15
+ import "./chunk-OMQIAWEU.js";
16
+ import "./chunk-4L66JHQE.js";
17
+ import "./chunk-TTOZCZWE.js";
18
+ import "./chunk-Z5WY7BSB.js";
15
19
  import "./chunk-VFA7QMCZ.js";
16
- import "./chunk-C4NKJT2Z.js";
20
+ import "./chunk-J4WDJ7XS.js";
17
21
  import "./chunk-XQUHC3JZ.js";
18
22
  import "./chunk-R4YSJ4EY.js";
19
- import "./chunk-CUE4UZXR.js";
20
- import "./chunk-EYWNOHMJ.js";
21
- import "./chunk-NQ6FZKCE.js";
22
- import "./chunk-4L66JHQE.js";
23
+ import "./chunk-BT2I3ETV.js";
24
+ import "./chunk-L653KKCR.js";
25
+ import "./chunk-V3S3NXBQ.js";
23
26
  import "./chunk-3RG5ZIWI.js";
24
27
  export {
25
28
  getOrCreateSession,
@@ -1,20 +1,21 @@
1
1
  import {
2
2
  MAX_DEPENDENTS_PER_TASK
3
- } from "./chunk-C4NKJT2Z.js";
3
+ } from "./chunk-J4WDJ7XS.js";
4
4
  import {
5
5
  BATCH_TRIGGER_DELAY_MS
6
6
  } from "./chunk-R4YSJ4EY.js";
7
7
  import {
8
8
  createLogger
9
- } from "./chunk-NQ6FZKCE.js";
9
+ } from "./chunk-V3S3NXBQ.js";
10
10
  import "./chunk-3RG5ZIWI.js";
11
11
 
12
12
  // src/telegram/task-dependency-resolver.ts
13
13
  var log = createLogger("Telegram");
14
14
  var TaskDependencyResolver = class {
15
- constructor(taskStore, bridge) {
15
+ constructor(taskStore, bridge, config) {
16
16
  this.taskStore = taskStore;
17
17
  this.bridge = bridge;
18
+ this.config = config;
18
19
  }
19
20
  /**
20
21
  * Called when a task completes successfully
@@ -127,13 +128,26 @@ var TaskDependencyResolver = class {
127
128
  log.warn(`Cannot trigger task ${taskId}: not found`);
128
129
  return;
129
130
  }
130
- log.info(`\u{1F680} Triggering dependent task: ${task.description}`);
131
- const gramJsClient = this.bridge.getClient().getClient();
132
- const me = await gramJsClient.getMe();
133
- await gramJsClient.sendMessage(me, {
134
- message: `[TASK:${taskId}] ${task.description}`
135
- });
136
- log.info(`\u21B3 Sent [TASK:${taskId}] to Saved Messages`);
131
+ log.info(`Triggering dependent task: ${task.description}`);
132
+ if (this.bridge.getMode() === "bot") {
133
+ const adminId = this.config?.telegram?.admin_ids?.[0];
134
+ if (adminId) {
135
+ await this.bridge.sendMessage({
136
+ chatId: String(adminId),
137
+ text: `[TASK:${taskId}] ${task.description}`
138
+ });
139
+ log.info(`\u21B3 Sent [TASK:${taskId}] to admin ${adminId}`);
140
+ } else {
141
+ log.warn(`\u21B3 Cannot trigger [TASK:${taskId}]: no admin_id configured in bot mode`);
142
+ }
143
+ } else {
144
+ const gramJsClient = this.bridge.getRawClient();
145
+ const me = await gramJsClient.getMe();
146
+ await gramJsClient.sendMessage(me, {
147
+ message: `[TASK:${taskId}] ${task.description}`
148
+ });
149
+ log.info(`\u21B3 Sent [TASK:${taskId}] to Saved Messages`);
150
+ }
137
151
  } catch (error) {
138
152
  log.error({ err: error }, `Error triggering task ${taskId}`);
139
153
  this.taskStore.failTask(taskId, `Failed to trigger: ${error}`);
@@ -6,7 +6,7 @@ import {
6
6
  MAX_TOTAL_PROMPT_CHARS,
7
7
  SECONDS_PER_DAY,
8
8
  SECONDS_PER_HOUR
9
- } from "./chunk-C4NKJT2Z.js";
9
+ } from "./chunk-J4WDJ7XS.js";
10
10
  import "./chunk-3RG5ZIWI.js";
11
11
 
12
12
  // src/telegram/task-executor.ts
@@ -98,7 +98,7 @@ function buildAgentPrompt(task, executionData, parentResults) {
98
98
  `;
99
99
  return prompt;
100
100
  }
101
- if (executionData.toolExecuted) {
101
+ if ("toolExecuted" in executionData) {
102
102
  prompt += `TOOL EXECUTED:
103
103
  `;
104
104
  prompt += `\u2022 Name: ${executionData.toolExecuted}
@@ -107,7 +107,7 @@ function buildAgentPrompt(task, executionData, parentResults) {
107
107
  `;
108
108
  prompt += `
109
109
  `;
110
- if (executionData.toolError) {
110
+ if ("toolError" in executionData) {
111
111
  prompt += `\u274C ERROR:
112
112
  ${executionData.toolError}
113
113
 
@@ -126,7 +126,7 @@ ${truncateJson(executionData.toolResult)}
126
126
  prompt += `\u2192 Analyze this result and decide what action to take.
127
127
  `;
128
128
  }
129
- } else if (executionData.instructions) {
129
+ } else if ("instructions" in executionData) {
130
130
  prompt += `INSTRUCTIONS:
131
131
  ${executionData.instructions}
132
132
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createLogger
3
- } from "./chunk-NQ6FZKCE.js";
3
+ } from "./chunk-V3S3NXBQ.js";
4
4
  import "./chunk-3RG5ZIWI.js";
5
5
 
6
6
  // src/cocoon/tool-adapter.ts
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  serializeEmbedding
3
- } from "./chunk-35MX4ZUI.js";
3
+ } from "./chunk-Z5WY7BSB.js";
4
4
  import "./chunk-VFA7QMCZ.js";
5
5
  import {
6
6
  TOOL_RAG_KEYWORD_WEIGHT,
7
7
  TOOL_RAG_MIN_SCORE,
8
8
  TOOL_RAG_VECTOR_WEIGHT
9
- } from "./chunk-C4NKJT2Z.js";
9
+ } from "./chunk-J4WDJ7XS.js";
10
10
  import "./chunk-XQUHC3JZ.js";
11
11
  import "./chunk-R4YSJ4EY.js";
12
- import "./chunk-CUE4UZXR.js";
13
- import "./chunk-EYWNOHMJ.js";
12
+ import "./chunk-BT2I3ETV.js";
13
+ import "./chunk-L653KKCR.js";
14
14
  import {
15
15
  createLogger
16
- } from "./chunk-NQ6FZKCE.js";
16
+ } from "./chunk-V3S3NXBQ.js";
17
17
  import "./chunk-3RG5ZIWI.js";
18
18
 
19
19
  // src/agent/tools/tool-index.ts
@@ -7,9 +7,9 @@ import {
7
7
  getTranscriptSize,
8
8
  readTranscript,
9
9
  transcriptExists
10
- } from "./chunk-LC4TV3KL.js";
11
- import "./chunk-EYWNOHMJ.js";
12
- import "./chunk-NQ6FZKCE.js";
10
+ } from "./chunk-4MG2AROG.js";
11
+ import "./chunk-L653KKCR.js";
12
+ import "./chunk-V3S3NXBQ.js";
13
13
  import "./chunk-3RG5ZIWI.js";
14
14
  export {
15
15
  appendToTranscript,
@@ -0,0 +1 @@
1
+ import{j as e,r as b,u as _,a as u,S as L}from"./index-BwEPTTKp.js";import{I as p,a as N,E as j,u as S,A as w,T as P}from"./TelegramSettingsPanel-BRzc5G6e.js";function T({tabs:d,activeTab:i,onTabChange:l}){return e.jsx("div",{className:"pill-bar",children:d.map(a=>e.jsx("button",{className:a.id===i?"active":void 0,onClick:()=>l(a.id),children:a.label},a.id))})}function k({keys:d,configKeys:i,getLocal:l,getServer:a,setLocal:x,saveConfig:c,cancelLocal:y,onArraySave:t,title:v}){const m=d.map(s=>i.find(g=>g.key===s)).filter(s=>s!=null);return m.length===0?null:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[v&&e.jsx("div",{className:"section-title",children:v}),m.map(s=>{const g=s.hotReload==="restart";if(s.type==="boolean"){const r=l(s.key)==="true";return e.jsx("div",{className:"form-group",children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{children:s.label}),s.description&&e.jsx(p,{text:s.description}),g&&e.jsx("span",{style:{fontSize:11,color:"var(--text-secondary)"},children:"(requires restart)"})]}),e.jsxs("label",{className:"toggle",style:{margin:0},children:[e.jsx("input",{type:"checkbox",checked:r,onChange:o=>c(s.key,String(o.target.checked))}),e.jsx("span",{className:"toggle-track"}),e.jsx("span",{className:"toggle-thumb"})]})]})},s.key)}if(s.type==="enum"&&s.options)return e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[s.label,s.description&&e.jsx(p,{text:s.description}),g&&e.jsx("span",{style:{fontSize:11,color:"var(--text-secondary)"},children:"(requires restart)"})]})}),e.jsx("select",{value:l(s.key),onChange:r=>c(s.key,r.target.value),style:{padding:"6px 10px",fontSize:14,border:"1px solid var(--border)",background:"var(--bg-glass)",color:"var(--text-primary)"},children:s.options.map(r=>{var o;return e.jsx("option",{value:r,children:((o=s.optionLabels)==null?void 0:o[r])??r},r)})})]},s.key);if(s.type==="array"){const r=l(s.key);let o=[];if(r)try{o=JSON.parse(r).map(String)}catch{o=[]}return e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[s.label,s.description&&e.jsx(p,{text:s.description}),g&&e.jsx("span",{style:{fontSize:11,color:"var(--text-secondary)"},children:"(requires restart)"})]})}),e.jsx(N,{value:o,onChange:C=>{t&&t(s.key,C)},placeholder:`Add ${s.label.toLowerCase()}`})]},s.key)}const f=s.type==="number"?"number":s.sensitive?"password":"text",n=s.sensitive?s.set?"Set":"Not set":void 0;return e.jsx(j,{label:s.label,description:s.description,configKey:s.key,type:f,value:l(s.key),serverValue:a(s.key),onChange:r=>x(s.key,r),onSave:r=>c(s.key,r),onCancel:()=>y(s.key),hotReload:s.hotReload,badge:n,placeholder:s.sensitive?"********":void 0,inline:f==="number"},s.key)})]})}function h({children:d}){const[i,l]=b.useState(!1);return e.jsxs("div",{className:"info-banner","data-open":i||void 0,children:[e.jsxs("button",{type:"button",className:"info-banner-trigger",onClick:()=>l(!i),"aria-expanded":i,children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,opacity:.6},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),e.jsx("span",{children:"Info"}),e.jsx("svg",{className:"info-banner-chevron",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),i&&e.jsx("div",{className:"info-banner-content",children:d})]})}const I=[{id:"llm",label:"LLM"},{id:"telegram",label:"Telegram"},{id:"heartbeat",label:"Heartbeat"},{id:"api-keys",label:"API Keys"},{id:"ton-proxy",label:"TON Proxy"},{id:"advanced",label:"Advanced"},{id:"sessions",label:"Sessions"},{id:"tool-rag",label:"Tool RAG"}],A=["agent.api_key","telegram.bot_token","tavily_api_key","tonapi_key","toncenter_api_key"],R=["embedding.provider","embedding.model","webui.port","webui.log_requests","deals.enabled","deals.expiry_seconds","deals.buy_max_floor_percent","deals.sell_min_floor_percent","agent.base_url","dev.hot_reload"],E=["agent.session_reset_policy.daily_reset_enabled","agent.session_reset_policy.daily_reset_hour","agent.session_reset_policy.idle_expiry_enabled","agent.session_reset_policy.idle_expiry_minutes"];function z(){const[d,i]=_(),l=d.get("tab")||"llm",a=S(),x=a.configKeys,[c,y]=b.useState(!1),[t,v]=b.useState(null),[m,s]=b.useState(null),g=n=>{i({tab:n},{replace:!0})};b.useEffect(()=>{l==="ton-proxy"&&u.getTonProxyStatus().then(n=>v(n.data)).catch(()=>{})},[l]);const f=async(n,r)=>{a.setError(null);try{await u.setConfigKey(n,r),a.loadData()}catch(o){a.setError(o instanceof Error?o.message:String(o))}};return a.loading?e.jsx("div",{className:"loading",children:"Loading..."}):e.jsxs("div",{children:[e.jsxs("div",{className:"header",children:[e.jsx("h1",{children:"Configuration"}),e.jsx("p",{children:"Manage settings and API keys"})]}),a.error&&e.jsxs("div",{className:"alert error",style:{marginBottom:"14px"},children:[a.error,e.jsx("button",{onClick:()=>a.setError(null),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},children:"Dismiss"})]}),e.jsx(T,{tabs:I,activeTab:l,onTabChange:g}),l==="llm"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"card-header",children:e.jsx("div",{className:"section-title",children:"Agent"})}),e.jsx(h,{children:"Choose the AI provider and model that powers the agent. Stronger models reason better but cost more per message. The API key is sent only to the selected provider."}),e.jsx("div",{className:"card",children:e.jsx(w,{getLocal:a.getLocal,getServer:a.getServer,setLocal:a.setLocal,saveConfig:a.saveConfig,cancelLocal:a.cancelLocal,modelOptions:a.modelOptions,pendingProvider:a.pendingProvider,pendingMeta:a.pendingMeta,pendingApiKey:a.pendingApiKey,setPendingApiKey:a.setPendingApiKey,pendingValidating:a.pendingValidating,pendingError:a.pendingError,setPendingError:a.setPendingError,handleProviderChange:a.handleProviderChange,handleProviderConfirm:a.handleProviderConfirm,handleProviderCancel:a.handleProviderCancel})}),a.getLocal("agent.provider")==="cocoon"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"card-header",children:e.jsx("div",{className:"section-title",children:"Cocoon"})}),e.jsx("div",{className:"card",children:e.jsx(j,{label:"Proxy Port",description:"Cocoon Network proxy port",configKey:"cocoon.port",type:"text",value:a.getLocal("cocoon.port"),serverValue:a.getServer("cocoon.port"),onChange:n=>a.setLocal("cocoon.port",n),onSave:n=>a.saveConfig("cocoon.port",n),onCancel:()=>a.cancelLocal("cocoon.port"),min:1,max:65535,placeholder:"11434",hotReload:"restart"})})]})]}),l==="telegram"&&e.jsx(P,{getLocal:a.getLocal,getServer:a.getServer,setLocal:a.setLocal,saveConfig:a.saveConfig,cancelLocal:a.cancelLocal,configKeys:x,onArraySave:f,extended:!0}),l==="heartbeat"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"card-header",children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("div",{className:"section-title",style:{margin:0},children:"Heartbeat"}),e.jsxs("label",{className:"toggle",style:{margin:0},children:[e.jsx("input",{type:"checkbox",checked:a.getLocal("heartbeat.enabled")==="true"||a.getLocal("heartbeat.enabled")===!0,onChange:async n=>{const r=n.target.checked;await a.saveConfig("heartbeat.enabled",String(r))}}),e.jsx("span",{className:"toggle-track"}),e.jsx("span",{className:"toggle-thumb"})]})]})}),e.jsx(h,{children:"The agent wakes up on a timer, reads its HEARTBEAT.md checklist, and executes each task autonomously (check feeds, send reports, monitor wallets...). If nothing needs doing, it stays silent. Edit HEARTBEAT.md in the Soul tab to define what the agent should do on each tick."}),e.jsx("div",{className:"card",children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsx(j,{label:"Interval",description:"How often the agent wakes up to run its checklist. Lower = more responsive, higher = less resource usage. Restart required.",configKey:"heartbeat.interval_ms",type:"number",value:String(Math.round(Number(a.getLocal("heartbeat.interval_ms")||18e5)/6e4)),serverValue:String(Math.round(Number(a.getServer("heartbeat.interval_ms")||18e5)/6e4)),onChange:n=>a.setLocal("heartbeat.interval_ms",String(Number(n)*6e4)),onSave:n=>a.saveConfig("heartbeat.interval_ms",String(Number(n)*6e4)),onCancel:()=>a.cancelLocal("heartbeat.interval_ms"),min:1,max:1440,placeholder:"30",hotReload:"restart",inline:!0}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{children:"Self-configurable"}),e.jsx(p,{text:"When on, the agent can adjust its own wake-up interval and prompt. When off, only you (admin) can change these settings from this dashboard."})]}),e.jsxs("label",{className:"toggle",style:{margin:0},children:[e.jsx("input",{type:"checkbox",checked:a.getLocal("heartbeat.self_configurable")==="true"||a.getLocal("heartbeat.self_configurable")===!0,onChange:async n=>{const r=n.target.checked;await a.saveConfig("heartbeat.self_configurable",String(r))}}),e.jsx("span",{className:"toggle-track"}),e.jsx("span",{className:"toggle-thumb"})]})]})]})})]}),l==="api-keys"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"card-header",children:e.jsx("div",{className:"section-title",children:"API Keys"})}),e.jsx(h,{children:"Secrets used to connect to external services. Keys are stored locally in your config file and never shared. Leave a field empty to disable that integration."}),e.jsx("div",{className:"card",children:e.jsx(k,{keys:A,configKeys:x,getLocal:a.getLocal,getServer:a.getServer,setLocal:a.setLocal,saveConfig:a.saveConfig,cancelLocal:a.cancelLocal})})]}),l==="ton-proxy"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"card-header",children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("div",{className:"section-title",style:{margin:0},children:"TON Proxy"}),e.jsxs("label",{className:"toggle",style:{margin:0},children:[e.jsx("input",{type:"checkbox",disabled:c,checked:(t==null?void 0:t.enabled)??a.getLocal("ton_proxy.enabled")==="true",onChange:async n=>{const r=n.target.checked;y(!0),s(null);try{const o=r?await u.startTonProxy():await u.stopTonProxy();v(o.data),a.loadData()}catch(o){s(o instanceof Error?o.message:String(o))}finally{y(!1)}}}),e.jsx("span",{className:"toggle-track"}),e.jsx("span",{className:"toggle-thumb"})]}),c&&e.jsxs("span",{style:{fontSize:12,color:"var(--text-secondary)",display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{className:"spinner",style:{display:"inline-block",width:14,height:14,border:"2px solid var(--border)",borderTopColor:"var(--accent)",borderRadius:"50%",animation:"spin 0.8s linear infinite"}}),(t==null?void 0:t.installed)===!1?"Downloading...":"Starting..."]}),!c&&(t==null?void 0:t.running)&&e.jsxs("span",{style:{fontSize:12,color:"var(--green)"},children:["Running (PID ",t.pid,")"]})]})}),e.jsx(h,{children:"Local HTTP proxy that lets the agent browse .ton websites and TON Sites. The binary is auto-downloaded on first enable, no manual install needed."}),e.jsxs("div",{className:"card",children:[m&&e.jsxs("div",{className:"alert error",style:{marginBottom:"14px"},children:[m,e.jsx("button",{onClick:()=>s(null),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},children:"Dismiss"})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[!(t!=null&&t.enabled)&&e.jsx("div",{children:e.jsx("button",{disabled:c||!(t!=null&&t.installed),onClick:async()=>{if(confirm("Remove the TON Proxy binary from disk?")){y(!0),s(null);try{const n=await u.uninstallTonProxy();v(n.data),a.loadData()}catch(n){s(n instanceof Error?n.message:String(n))}finally{y(!1)}}},style:{padding:"5px 12px",fontSize:12,fontWeight:500,background:t!=null&&t.installed?"var(--red)":"var(--text-secondary)",color:"var(--text-on-accent)",border:"none",borderRadius:6,cursor:t!=null&&t.installed?"pointer":"default",opacity:t!=null&&t.installed?1:.5},children:"Uninstall"})}),e.jsx(j,{label:"Proxy Port",description:"HTTP proxy listen address port",configKey:"ton_proxy.port",type:"text",value:a.getLocal("ton_proxy.port")||"8080",serverValue:a.getServer("ton_proxy.port")||"8080",onChange:n=>a.setLocal("ton_proxy.port",n),onSave:n=>a.saveConfig("ton_proxy.port",n),onCancel:()=>a.cancelLocal("ton_proxy.port"),min:1,max:65535,placeholder:"8080",hotReload:"restart"}),e.jsx(j,{label:"Binary Path",description:"Custom path to tonutils-proxy-cli binary",configKey:"ton_proxy.binary_path",type:"text",value:a.getLocal("ton_proxy.binary_path"),serverValue:a.getServer("ton_proxy.binary_path"),onChange:n=>a.setLocal("ton_proxy.binary_path",n),onSave:n=>a.saveConfig("ton_proxy.binary_path",n),onCancel:()=>a.cancelLocal("ton_proxy.binary_path"),placeholder:"~/.teleton/bin/tonutils-proxy-cli (auto-download)",hotReload:"restart"})]})]})]}),l==="advanced"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"card-header",children:e.jsx("div",{className:"section-title",children:"Advanced"})}),e.jsx(h,{children:"Low-level settings for embeddings, deals, WebUI, and dev mode. Only change these if you know what you're doing, wrong values can break the agent."}),e.jsx("div",{className:"card",children:e.jsx(k,{keys:R,configKeys:x,getLocal:a.getLocal,getServer:a.getServer,setLocal:a.setLocal,saveConfig:a.saveConfig,cancelLocal:a.cancelLocal})})]}),l==="sessions"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"card-header",children:e.jsx("div",{className:"section-title",children:"Sessions"})}),e.jsx(h,{children:"Controls how the agent manages conversation memory. Daily reset clears context at a set hour to keep responses fresh. Idle expiry forgets inactive chats after a timeout, saving tokens."}),e.jsx("div",{className:"card",children:e.jsx(k,{keys:E,configKeys:x,getLocal:a.getLocal,getServer:a.getServer,setLocal:a.setLocal,saveConfig:a.saveConfig,cancelLocal:a.cancelLocal})})]}),l==="tool-rag"&&a.toolRag&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"card-header",children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("div",{className:"section-title",style:{margin:0},children:"Tool RAG"}),e.jsxs("label",{className:"toggle",style:{margin:0},children:[e.jsx("input",{type:"checkbox",checked:a.toolRag.enabled,onChange:()=>a.saveToolRag({enabled:!a.toolRag.enabled})}),e.jsx("span",{className:"toggle-track"}),e.jsx("span",{className:"toggle-thumb"})]})]})}),e.jsxs(h,{children:["Instead of sending all ",">","100 tools to the LLM every time, Tool RAG picks only the most relevant ones per message. Saves tokens and improves accuracy. Disable if the agent misses tools it should use."]}),e.jsxs("div",{className:"card",children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("label",{style:{fontSize:"13px",color:"var(--text-primary)"},children:["Top-K ",e.jsx(p,{text:"Max tools sent to the LLM per message. Higher = more coverage but more tokens. 20-30 is a good default."})]}),e.jsx(L,{value:String(a.toolRag.topK),options:["10","15","20","25","30","40","50"],onChange:n=>a.saveToolRag({topK:Number(n)}),style:{minWidth:"80px"}})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("label",{style:{fontSize:"13px",color:"var(--text-primary)",cursor:"pointer"},htmlFor:"skip-unlimited",children:["Skip Unlimited ",e.jsx(p,{text:"When on, providers that accept unlimited tools (like Anthropic) get all tools directly, no filtering needed."})]}),e.jsxs("label",{className:"toggle",children:[e.jsx("input",{id:"skip-unlimited",type:"checkbox",checked:a.toolRag.skipUnlimitedProviders??!1,onChange:()=>a.saveToolRag({skipUnlimitedProviders:!a.toolRag.skipUnlimitedProviders})}),e.jsx("span",{className:"toggle-track"}),e.jsx("span",{className:"toggle-thumb"})]})]})]}),e.jsxs("div",{style:{marginTop:"12px"},children:[e.jsxs("label",{style:{fontSize:"13px",color:"var(--text-primary)",display:"block",marginBottom:"6px"},children:["Always Include (glob patterns) ",e.jsx(p,{text:"Tools matching these patterns are always sent, even if RAG doesn't pick them. Use for critical tools the agent must always have access to."})]}),e.jsx(N,{value:a.toolRag.alwaysInclude??[],onChange:n=>a.saveToolRag({alwaysInclude:n}),placeholder:"e.g. telegram_send_*"})]})]})]})]})}export{z as Config};
@@ -0,0 +1 @@
1
+ import{r as n,a as j,j as e,R as k}from"./index-BwEPTTKp.js";import{f as b}from"./utils-CnsbSMo4.js";function A(){const[o,C]=n.useState(""),[p,S]=n.useState([]),[l,x]=n.useState(!0),[c,i]=n.useState(null),[g,h]=n.useState(null),[y,m]=n.useState([]),[w,u]=n.useState(!1),d=n.useCallback(async()=>{x(!0),i(null);try{const t=await j.getConversations();S(t.data??[])}catch(t){i(t instanceof Error?t.message:String(t))}finally{x(!1)}},[]);n.useEffect(()=>{d()},[d]);const f=async t=>{if(g===t){h(null),m([]);return}h(t),u(!0);try{const r=await j.getConversationMessages(t);m(r.data??[])}catch(r){i(r instanceof Error?r.message:String(r))}finally{u(!1)}},a=o.toLowerCase(),v=a?p.filter(t=>(t.title??"").toLowerCase().includes(a)||(t.username??"").toLowerCase().includes(a)||t.id.toLowerCase().includes(a)):p;return e.jsxs("div",{children:[e.jsxs("div",{className:"header",children:[e.jsx("h1",{children:"Conversations"}),e.jsx("p",{children:"Browse chat history"})]}),e.jsxs("div",{className:"card",style:{padding:0},children:[e.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center",padding:"12px 14px",borderBottom:"1px solid var(--border)"},children:[e.jsx("input",{type:"text",value:o,onChange:t=>C(t.target.value),placeholder:"Filter chats...",style:{flex:1,padding:"6px 10px",fontSize:"13px"}}),e.jsx("button",{onClick:d,disabled:l,className:"btn-ghost btn-sm",children:l?"Loading...":"Refresh"})]}),c&&e.jsxs("div",{className:"alert error",style:{margin:"12px 14px"},children:[c,e.jsx("button",{onClick:()=>i(null),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},children:"Dismiss"})]}),l?e.jsx("div",{style:{padding:"20px",textAlign:"center"},children:"Loading..."}):v.length===0?e.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--text-secondary)",fontSize:"13px"},children:o?"No matching chats":"No conversations yet"}):e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{borderBottom:"1px solid var(--border)",color:"var(--text-secondary)",fontSize:"11px",textTransform:"uppercase"},children:[e.jsx("th",{style:{textAlign:"left",padding:"8px 14px"},children:"Chat"}),e.jsx("th",{style:{textAlign:"left",padding:"8px 14px",width:"80px"},children:"Type"}),e.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:"80px"},children:"Messages"}),e.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:"140px"},children:"Last Active"})]})}),e.jsx("tbody",{children:v.map(t=>{const r=g===t.id;return e.jsxs(k.Fragment,{children:[e.jsxs("tr",{onClick:()=>f(t.id),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),f(t.id))},tabIndex:0,role:"button",style:{cursor:"pointer",borderBottom:r?"none":"1px solid var(--border)",backgroundColor:r?"var(--glass-micro)":void 0},className:"file-row",children:[e.jsxs("td",{style:{padding:"6px 14px"},children:[e.jsx("span",{style:{display:"inline-block",width:"14px",fontSize:"10px",color:"var(--text-secondary)",marginRight:"8px"},children:r?"▼":"▶"}),t.title||t.username||t.id]}),e.jsx("td",{style:{padding:"6px 14px"},children:e.jsx("span",{style:{display:"inline-block",padding:"1px 6px",fontSize:"11px",borderRadius:"3px",backgroundColor:t.type==="dm"?"var(--accent-dim)":"var(--purple-dim)",color:t.type==="dm"?"var(--accent-soft)":"var(--purple)"},children:t.type})}),e.jsx("td",{style:{textAlign:"right",padding:"6px 14px",color:"var(--text-secondary)"},children:t.message_count}),e.jsx("td",{style:{textAlign:"right",padding:"6px 14px",color:"var(--text-secondary)"},children:t.last_message_at?b(t.last_message_at):"—"})]}),r&&e.jsx("tr",{style:{backgroundColor:"var(--glass-micro)",borderBottom:"1px solid var(--border)"},children:e.jsx("td",{colSpan:4,style:{padding:"0 14px 14px 14px"},children:w?e.jsx("div",{style:{padding:"12px 0",textAlign:"center",color:"var(--text-secondary)",fontSize:"12px"},children:"Loading messages..."}):y.length===0?e.jsx("div",{style:{padding:"12px 0",textAlign:"center",color:"var(--text-secondary)",fontSize:"12px"},children:"No messages"}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px",paddingTop:"8px"},children:y.map(s=>e.jsxs("div",{style:{padding:"10px 12px",border:"1px solid var(--border)",borderRadius:"4px",backgroundColor:"var(--bg-glass)"},children:[e.jsxs("div",{style:{fontSize:"11px",color:"var(--text-secondary)",marginBottom:"6px",display:"flex",alignItems:"center",gap:"6px"},children:[e.jsx("span",{children:s.sender_id||"Unknown"}),s.is_from_agent===1&&e.jsx("span",{style:{display:"inline-block",padding:"0px 5px",fontSize:"10px",borderRadius:"3px",backgroundColor:"var(--green-dim)",color:"var(--green)"},children:"Agent"}),e.jsx("span",{style:{marginLeft:"auto"},children:b(s.timestamp)})]}),e.jsx("pre",{style:{margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word",fontSize:"12px",fontFamily:"monospace",lineHeight:"1.5",maxHeight:"300px",minHeight:"20px",overflow:"auto",resize:"vertical",color:"var(--text-primary)"},children:s.text||(s.has_media?`[${s.media_type||"media"}]`:"[empty]")})]},s.id))})})})]},t.id)})})]})]})]})}export{A as Conversations};
@@ -0,0 +1 @@
1
+ import{j as e,S as U,r as o,l as x,a as z}from"./index-BwEPTTKp.js";import{I as O,u as D,A as K,T as R}from"./TelegramSettingsPanel-BRzc5G6e.js";function W({getLocal:s,saveConfig:l}){const c=s("capabilities.exec.mode")==="yolo";return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:"10px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[e.jsx("span",{className:"section-title",style:{marginBottom:0},children:"Coding Agent"}),e.jsxs("label",{style:{fontSize:"13px",color:"var(--text-secondary)",display:"flex",alignItems:"center",gap:4},htmlFor:"exec-yolo",children:["YOLO",e.jsx(O,{text:"Full system access - exec_run, exec_install, exec_service, exec_status. Requires restart."})]}),e.jsxs("label",{className:"toggle",children:[e.jsx("input",{id:"exec-yolo",type:"checkbox",checked:c,onChange:a=>l("capabilities.exec.mode",a.target.checked?"yolo":"off")}),e.jsx("span",{className:"toggle-track"}),e.jsx("span",{className:"toggle-thumb"})]})]}),e.jsx(U,{value:s("capabilities.exec.scope")||"admin-only",options:["admin-only","allowlist","all"],labels:["Admin Only","Allowlist","Everyone"],onChange:a=>l("capabilities.exec.scope",a)})]})}function i({label:s,value:l,mono:c}){return e.jsxs("div",{className:"metric",children:[e.jsx("span",{className:"metric-label",children:s}),e.jsx("span",{className:`metric-value${c?" mono":""}`,children:l})]})}function q(){const{loading:s,error:l,setError:c,status:a,stats:d,getLocal:p,getServer:n,setLocal:m,cancelLocal:u,saveConfig:g,modelOptions:v,pendingProvider:f,pendingMeta:y,pendingApiKey:b,setPendingApiKey:S,pendingValidating:N,pendingError:C,setPendingError:k,handleProviderChange:w,handleProviderConfirm:E,handleProviderCancel:L}=D(),[I,P]=o.useState(null);o.useEffect(()=>{let r=!0;const F=setInterval(()=>{z.getStatus().then(M=>{r&&P(M.data)}).catch(()=>{})},1e4);return()=>{r=!1,clearInterval(F)}},[]);const $=I??a,h=o.useSyncExternalStore(r=>x.subscribe(r),()=>x.getLogs()),T=o.useSyncExternalStore(r=>x.subscribe(r),()=>x.isConnected()),j=o.useRef(null);if(o.useEffect(()=>{x.connect()},[]),o.useEffect(()=>{var r;(r=j.current)==null||r.scrollIntoView({behavior:"smooth"})},[h]),s)return e.jsx("div",{className:"loading",children:"Loading..."});if(!a||!d)return e.jsx("div",{className:"alert error",children:"Failed to load dashboard data"});const t=$??a,A=t.uptime<3600?`${Math.floor(t.uptime/60)}m`:`${Math.floor(t.uptime/3600)}h ${Math.floor(t.uptime%3600/60)}m`;return e.jsxs("div",{className:"dashboard-root",children:[e.jsxs("div",{className:"header",children:[e.jsx("h1",{children:"Dashboard"}),e.jsx("p",{children:"System overview"})]}),l&&e.jsxs("div",{className:"alert error",style:{marginBottom:"14px"},children:[l,e.jsx("button",{onClick:()=>c(null),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},children:"Dismiss"})]}),e.jsx("div",{className:"card status-bar",children:e.jsxs("div",{className:"status-row",children:[e.jsx(i,{label:"Uptime",value:A}),e.jsx(i,{label:"Sessions",value:t.sessionCount}),e.jsx(i,{label:"Tools",value:t.toolCount}),e.jsx(i,{label:"Knowledge",value:d.knowledge}),e.jsx(i,{label:"Messages",value:d.messages.toLocaleString()}),e.jsx(i,{label:"Chats",value:d.chats}),e.jsx(i,{label:"Tokens",value:t.tokenUsage?`${(t.tokenUsage.totalTokens/1e3).toFixed(1)}K`:"0",mono:!0}),e.jsx(i,{label:"Cost",value:t.tokenUsage?`$${t.tokenUsage.totalCost.toFixed(3)}`:"$0.000",mono:!0})]})}),e.jsxs("div",{className:"dashboard-settings",children:[e.jsx("div",{className:"card",children:e.jsx(K,{compact:!0,getLocal:p,getServer:n,setLocal:m,saveConfig:g,cancelLocal:u,modelOptions:v,pendingProvider:f,pendingMeta:y,pendingApiKey:b,setPendingApiKey:S,pendingValidating:N,pendingError:C,setPendingError:k,handleProviderChange:w,handleProviderConfirm:E,handleProviderCancel:L})}),e.jsx("div",{className:"card",children:e.jsx(R,{getLocal:p,getServer:n,setLocal:m,saveConfig:g,cancelLocal:u})}),t.platform==="linux"&&e.jsx("div",{className:"card",style:{gridColumn:"1 / -1"},children:e.jsx(W,{getLocal:p,saveConfig:g})})]}),e.jsx(_,{logs:h,connected:T,bottomRef:j})]})}function _({logs:s,connected:l,bottomRef:c}){const[a,d]=o.useState(!0),p=o.useCallback(()=>d(n=>!n),[]);return e.jsxs("div",{className:"card",style:{padding:0,overflow:"hidden",marginTop:"12px"},children:[e.jsxs("button",{onClick:p,style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:"10px 14px",background:"none",border:"none",cursor:"pointer",color:"var(--text-primary)",fontSize:"13px",fontWeight:600},children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{className:`status-dot ${l?"connected":"disconnected"}`}),"Live Logs",s.length>0&&e.jsxs("span",{style:{fontSize:"11px",color:"var(--text-tertiary)",fontWeight:400},children:["(",s.length,")"]})]}),e.jsx("span",{style:{fontSize:"11px",color:"var(--text-tertiary)",transition:"transform 0.2s",transform:a?"rotate(180deg)":"none"},children:"▼"})]}),a&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{display:"flex",justifyContent:"flex-end",padding:"0 14px 6px"},children:e.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>x.clear(),children:"Clear"})}),e.jsxs("div",{className:"dashboard-logs-scroll",children:[s.length===0?e.jsx("div",{className:"empty",children:"Waiting for logs..."}):s.map((n,m)=>e.jsxs("div",{className:"log-entry",children:[e.jsx("span",{className:`badge ${n.level==="warn"?"warn":n.level==="error"?"error":"info"}`,children:n.level.toUpperCase()})," ",e.jsx("span",{style:{color:"var(--text-tertiary)"},children:new Date(n.timestamp).toLocaleTimeString()})," ",n.message]},m)),e.jsx("div",{ref:c})]})]})]})}export{q as Dashboard};
@@ -0,0 +1 @@
1
+ import{r,a as l,j as t}from"./index-BwEPTTKp.js";function V(){const[v,S]=r.useState(!1),[a,m]=r.useState([]),[M,C]=r.useState(""),[u,f]=r.useState(""),[b,c]=r.useState([]),[j,B]=r.useState(""),[k,N]=r.useState(""),[x,w]=r.useState(null),[E,T]=r.useState(""),[z,K]=r.useState(""),[A,R]=r.useState(!0),[I,o]=r.useState(null),[p,h]=r.useState(!1),g=r.useRef(null),d=r.useRef({enabled:!1,keywords:[],message:""}),D=async()=>{R(!0);try{const[e,s]=await Promise.all([l.getBlocklist(),l.getTriggers()]),n=e.data;S(n.enabled),m(n.keywords),C(n.message),d.current={enabled:n.enabled,keywords:n.keywords,message:n.message},c(s.data)}catch(e){o(e instanceof Error?e.message:String(e))}finally{R(!1)}};r.useEffect(()=>(D(),()=>{g.current&&clearTimeout(g.current)}),[]);const y=r.useCallback(e=>{d.current=e,g.current&&clearTimeout(g.current),g.current=setTimeout(async()=>{try{await l.updateBlocklist(e)}catch(s){o(s instanceof Error?s.message:String(s))}},400)},[]),H=()=>{const e=!v;S(e),y({...d.current,enabled:e})},F=()=>{const e=u.trim();if(e.length<2)return;if(a.includes(e)){f("");return}const s=[...a,e];m(s),f(""),y({...d.current,keywords:s})},W=e=>{const s=a.filter(n=>n!==e);m(s),y({...d.current,keywords:s})},P=e=>{C(e),y({...d.current,message:e})},q=async()=>{const e=j.trim(),s=k.trim();if(!(e.length<2||s.length<1)){h(!0);try{const n=await l.createTrigger({keyword:e,context:s});c(i=>[...i,n.data]),B(""),N("")}catch(n){o(n instanceof Error?n.message:String(n))}finally{h(!1)}}},G=async e=>{try{await l.deleteTrigger(e),c(s=>s.filter(n=>n.id!==e))}catch(s){o(s instanceof Error?s.message:String(s))}},J=async(e,s)=>{try{await l.toggleTrigger(e,!s),c(n=>n.map(i=>i.id===e?{...i,enabled:!s}:i))}catch(n){o(n instanceof Error?n.message:String(n))}},O=e=>{w(e.id),T(e.keyword),K(e.context)},Q=async()=>{if(!x)return;const e=E.trim(),s=z.trim();if(!(e.length<2||s.length<1)){h(!0);try{const n=await l.updateTrigger(x,{keyword:e,context:s});c(i=>i.map(L=>L.id===x?n.data:L)),w(null)}catch(n){o(n instanceof Error?n.message:String(n))}finally{h(!1)}}};return A?t.jsx("div",{className:"loading",children:"Loading..."}):t.jsxs("div",{children:[t.jsxs("div",{className:"header",children:[t.jsx("h1",{children:"Hooks"}),t.jsx("p",{children:"Keyword blocklist and context injection triggers"})]}),I&&t.jsxs("div",{className:"alert error",style:{marginBottom:"14px",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[t.jsx("span",{children:I}),t.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>o(null),children:"Dismiss"})]}),t.jsxs("div",{className:"card",style:{marginBottom:"16px"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},children:[t.jsx("h2",{style:{margin:0,fontSize:"16px"},children:"Keyword Blocklist"}),t.jsxs("label",{className:"toggle",children:[t.jsx("input",{type:"checkbox",checked:v,onChange:H}),t.jsx("span",{className:"toggle-track"}),t.jsx("span",{className:"toggle-thumb"})]})]}),t.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"13px",marginBottom:"12px"},children:"Messages containing these keywords will be blocked. Word-boundary matching (no substring matches)."}),t.jsxs("div",{style:{marginBottom:"10px"},children:[t.jsx("label",{style:{fontSize:"13px",fontWeight:600,display:"block",marginBottom:"4px"},children:"Keywords"}),t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px",border:"1px solid var(--border)",borderRadius:"8px",minHeight:"36px",alignItems:"center"},children:[a.map(e=>t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"12px",background:"var(--accent-subtle)",color:"var(--text-primary)",fontSize:"13px"},children:[e,t.jsx("button",{onClick:()=>W(e),style:{background:"none",border:"none",cursor:"pointer",padding:"0 2px",color:"var(--text-secondary)",fontSize:"12px",lineHeight:1,height:"auto",borderRadius:0},children:"✕"})]},e)),t.jsx("input",{type:"text",placeholder:"Add keyword...",value:u,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key==="Enter"&&(e.preventDefault(),F()),e.key==="Backspace"&&!u&&a.length>0&&W(a[a.length-1])},style:{border:"none",outline:"none",background:"transparent",color:"var(--text-primary)",fontSize:"13px",flex:1,minWidth:"100px",padding:"2px 0"}})]})]}),t.jsxs("div",{children:[t.jsx("label",{style:{fontSize:"13px",fontWeight:600,display:"block",marginBottom:"4px"},children:"Block reply (optional)"}),t.jsx("input",{type:"text",placeholder:"Message sent when a message is blocked...",value:M,onChange:e=>P(e.target.value),maxLength:500,style:{width:"100%"}})]})]}),t.jsxs("div",{className:"card",children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},children:[t.jsx("h2",{style:{margin:0,fontSize:"16px"},children:"Context Triggers"}),t.jsxs("span",{style:{fontSize:"12px",color:"var(--text-secondary)"},children:[b.length,"/50"]})]}),t.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"13px",marginBottom:"12px"},children:"When a keyword is detected, the associated context is injected into the LLM prompt."}),b.length>0&&t.jsx("div",{style:{display:"grid",gap:"8px",marginBottom:"14px"},children:b.map(e=>t.jsx("div",{className:"tool-row",style:{padding:"10px 12px",opacity:e.enabled?1:.5,transition:"opacity 0.15s"},children:x===e.id?t.jsxs("div",{style:{width:"100%"},children:[t.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"6px"},children:[t.jsx("input",{type:"text",value:E,onChange:s=>T(s.target.value),placeholder:"Keyword",style:{flex:"0 0 200px"}}),t.jsx("button",{className:"btn-sm",onClick:Q,disabled:p,children:p?"Saving...":"Save"}),t.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>w(null),children:"Cancel"})]}),t.jsx("textarea",{value:z,onChange:s=>K(s.target.value),placeholder:"Context to inject...",maxLength:2e3,rows:3,style:{width:"100%",resize:"vertical"}})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"4px"},children:t.jsxs("span",{style:{fontWeight:600,fontSize:"13px"},children:['"',e.keyword,'"']})}),t.jsx("div",{style:{fontSize:"12px",color:"var(--text-secondary)",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:"80px",overflow:"hidden"},children:e.context})]}),t.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center",flexShrink:0},children:[t.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>O(e),style:{fontSize:"12px"},children:"Edit"}),t.jsxs("label",{className:"toggle",children:[t.jsx("input",{type:"checkbox",checked:e.enabled,onChange:()=>J(e.id,e.enabled)}),t.jsx("span",{className:"toggle-track"}),t.jsx("span",{className:"toggle-thumb"})]}),t.jsx("button",{onClick:()=>G(e.id),className:"hover-fade-half",style:{background:"none",border:"none",cursor:"pointer",padding:"4px",color:"var(--red)",height:"auto",borderRadius:0},children:"✕"})]})]})},e.id))}),t.jsxs("div",{style:{padding:"12px",border:"1px solid var(--border)",borderRadius:"8px",background:"var(--glass-ultrathin)"},children:[t.jsx("div",{style:{fontSize:"13px",fontWeight:600,marginBottom:"8px",color:"var(--text-secondary)"},children:"New Trigger"}),t.jsx("div",{style:{display:"flex",gap:"8px",marginBottom:"8px"},children:t.jsx("input",{type:"text",placeholder:"Keyword (min 2 chars)",value:j,onChange:e=>B(e.target.value),maxLength:100,style:{flex:"0 0 200px"}})}),t.jsx("textarea",{placeholder:"Context to inject when keyword is detected...",value:k,onChange:e=>N(e.target.value),maxLength:2e3,rows:3,style:{width:"100%",resize:"vertical",marginBottom:"8px"}}),t.jsx("button",{className:"btn-sm",onClick:q,disabled:p||j.trim().length<2||k.trim().length<1,children:p?"Adding...":"Add Trigger"})]})]})]})}export{V as Hooks};
@@ -0,0 +1 @@
1
+ import{r as a,j as e,a as v}from"./index-BwEPTTKp.js";function T(){const[i,R]=a.useState([]),[N,x]=a.useState(!0),[j,r]=a.useState(null),[S,P]=a.useState(new Set),[p,g]=a.useState(!1),[l,b]=a.useState(""),[m,C]=a.useState(""),[k,z]=a.useState(""),[d,c]=a.useState([]),[A,w]=a.useState(!1),[y,B]=a.useState(null),[E,h]=a.useState(null),u=(t=!1)=>{t&&x(!0),v.getMcpServers().then(s=>{R(s.data),x(!1)}).catch(s=>{r(s instanceof Error?s.message:String(s)),x(!1)})};a.useEffect(()=>{u(!0)},[]);const I=t=>{P(s=>{const n=new Set(s);return n.has(t)?n.delete(t):n.add(t),n})},M=async()=>{if(l.trim()){w(!0),r(null);try{const t=m.trim()?m.trim().split(/\s+/):void 0,s=l.startsWith("http://")||l.startsWith("https://"),n={};for(const f of d)f.key.trim()&&(n[f.key.trim()]=f.value);const o=await v.addMcpServer({...s?{url:l.trim()}:{package:l.trim()},name:k.trim()||void 0,args:s?void 0:t,env:Object.keys(n).length>0?n:void 0});h(o.data.message),b(""),C(""),z(""),c([]),g(!1),u()}catch(t){r(t instanceof Error?t.message:String(t))}finally{w(!1)}}},L=async t=>{if(confirm(`Remove MCP server "${t}"?`)){B(t),r(null);try{const s=await v.removeMcpServer(t);h(s.data.message),u()}catch(s){r(s instanceof Error?s.message:String(s))}finally{B(null)}}};if(N)return e.jsx("div",{className:"loading",children:"Loading..."});const D=i.filter(t=>t.connected).length;return e.jsxs("div",{children:[e.jsx("div",{className:"header",children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("div",{children:[e.jsx("h1",{children:"MCP Servers"}),e.jsx("p",{children:"External tool servers connected via Model Context Protocol"})]}),e.jsx("button",{onClick:()=>g(!p),style:{fontSize:"13px"},children:p?"Cancel":"+ Add Server"})]})}),j&&e.jsxs("div",{className:"alert error",style:{marginBottom:"14px"},children:[j,e.jsx("button",{onClick:()=>r(null),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},children:"Dismiss"})]}),E&&e.jsxs("div",{className:"alert success",style:{marginBottom:"14px"},children:[E,e.jsx("button",{onClick:()=>h(null),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},children:"Dismiss"})]}),p&&e.jsxs("div",{className:"card",style:{marginBottom:"14px"},children:[e.jsx("h2",{style:{margin:"0 0 10px"},children:"Add MCP Server"}),e.jsxs("div",{style:{display:"grid",gap:"8px"},children:[e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:"12px",color:"var(--text-secondary)",marginBottom:"4px"},children:"Package or URL *"}),e.jsx("input",{type:"text",value:l,onChange:t=>b(t.target.value),placeholder:"@modelcontextprotocol/server-filesystem or http://localhost:3001/mcp",style:{width:"100%",fontSize:"13px"}})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px"},children:[e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:"12px",color:"var(--text-secondary)",marginBottom:"4px"},children:"Arguments (space-separated)"}),e.jsx("input",{type:"text",value:m,onChange:t=>C(t.target.value),placeholder:"/tmp /home/user/docs",style:{width:"100%",fontSize:"13px"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:"12px",color:"var(--text-secondary)",marginBottom:"4px"},children:"Name (auto-derived if empty)"}),e.jsx("input",{type:"text",value:k,onChange:t=>z(t.target.value),placeholder:"filesystem",style:{width:"100%",fontSize:"13px"}})]})]}),e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"4px"},children:[e.jsx("label",{style:{fontSize:"12px",color:"var(--text-secondary)"},children:"Environment Variables"}),e.jsx("button",{type:"button",onClick:()=>c([...d,{key:"",value:"",id:crypto.randomUUID()}]),style:{fontSize:"11px",padding:"1px 6px",opacity:.7},children:"+ Add"})]}),d.map((t,s)=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 2fr auto",gap:"6px",marginBottom:"4px"},children:[e.jsx("input",{type:"text",value:t.key,onChange:n=>{const o=[...d];o[s]={...o[s],key:n.target.value},c(o)},placeholder:"BRAVE_API_KEY",style:{fontSize:"12px",fontFamily:"monospace"}}),e.jsx("input",{type:"password",value:t.value,onChange:n=>{const o=[...d];o[s]={...o[s],value:n.target.value},c(o)},placeholder:"sk-xxx...",style:{fontSize:"12px",fontFamily:"monospace"}}),e.jsx("button",{type:"button",onClick:()=>c(d.filter((n,o)=>o!==s)),style:{fontSize:"11px",padding:"2px 6px",opacity:.6},children:"×"})]},t.id))]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"4px"},children:[e.jsx("button",{onClick:()=>g(!1),style:{fontSize:"13px",opacity:.7},children:"Cancel"}),e.jsx("button",{onClick:M,disabled:A||!l.trim(),style:{fontSize:"13px"},children:A?"Adding...":"Add Server"})]})]}),e.jsx("p",{style:{fontSize:"11px",color:"var(--text-secondary)",margin:"8px 0 0"},children:"Changes are saved to config.yaml. Restart teleton to connect."})]}),i.length===0&&!p&&e.jsxs("div",{className:"empty",children:[e.jsx("p",{children:"No MCP servers configured"}),e.jsxs("p",{style:{fontSize:"13px",color:"var(--text-secondary)",marginTop:"8px"},children:['Click "+ Add Server" above or use CLI: ',e.jsx("code",{children:"teleton mcp add @modelcontextprotocol/server-filesystem /tmp"})]})]}),i.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{fontSize:"13px",color:"var(--text-secondary)",marginBottom:"14px"},children:[D,"/",i.length," connected · ",i.reduce((t,s)=>t+s.toolCount,0)," tools total"]}),i.map(t=>e.jsxs("div",{className:"card",style:{marginBottom:"10px"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"6px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("h2",{style:{margin:0},children:t.name}),e.jsx("span",{style:{fontSize:"11px",padding:"1px 6px",borderRadius:"3px",background:"var(--bg-glass)",color:"var(--text-secondary)"},children:t.type}),t.scope!=="always"&&e.jsx("span",{style:{fontSize:"11px",padding:"1px 6px",borderRadius:"3px",background:"var(--bg-glass)",color:"var(--text-secondary)"},children:t.scope})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"12px",color:t.connected?"var(--green)":"var(--red)"},children:[e.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:t.connected?"var(--green)":"var(--red)"}}),t.connected?"Connected":"Disconnected"]}),!t.enabled&&e.jsx("span",{style:{fontSize:"11px",color:"var(--text-secondary)"},children:"disabled"}),e.jsx("button",{onClick:()=>L(t.name),disabled:y===t.name,style:{fontSize:"11px",padding:"2px 8px",opacity:.6,cursor:y===t.name?"wait":"pointer"},children:y===t.name?"...":"Remove"})]})]}),e.jsx("div",{style:{fontSize:"12px",fontFamily:"monospace",color:"var(--text-secondary)",marginBottom:"8px"},children:t.target}),t.envKeys.length>0&&e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",marginBottom:"8px"},children:t.envKeys.map(s=>e.jsxs("span",{style:{fontSize:"11px",padding:"1px 6px",borderRadius:"3px",background:"var(--bg-glass)",color:"var(--text-secondary)",fontFamily:"monospace"},children:[s,"=••••"]},s))}),t.toolCount>0&&e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>I(t.name),style:{background:"none",border:"none",padding:0,fontSize:"12px",color:"var(--accent)",cursor:"pointer"},children:[S.has(t.name)?"▾":"▸"," ",t.toolCount," tools"]}),S.has(t.name)&&e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",marginTop:"8px"},children:t.tools.map(s=>e.jsx("span",{style:{fontSize:"11px",padding:"2px 6px",borderRadius:"3px",background:"var(--bg-glass)",color:"var(--text-secondary)"},children:s},s))})]})]},t.name))]})]})}export{T as Mcp};
@@ -0,0 +1 @@
1
+ import{r as n,a as v,j as e,R as k}from"./index-BwEPTTKp.js";import{f as S}from"./utils-CnsbSMo4.js";function A(){const[i,b]=n.useState(""),[d,w]=n.useState([]),[a,x]=n.useState(!0),[c,o]=n.useState(null),[p,g]=n.useState(null),[h,u]=n.useState([]),[C,y]=n.useState(!1),l=n.useCallback(async()=>{x(!0),o(null);try{const t=await v.getMemorySources();w(t.data??[])}catch(t){o(t instanceof Error?t.message:String(t))}finally{x(!1)}},[]);n.useEffect(()=>{l()},[l]);const m=async t=>{if(p===t){g(null),u([]);return}g(t),y(!0);try{const s=await v.getSourceChunks(t);u(s.data??[])}catch(s){o(s instanceof Error?s.message:String(s))}finally{y(!1)}},f=i.toLowerCase(),j=f?d.filter(t=>t.source.toLowerCase().includes(f)):d;return e.jsxs("div",{children:[e.jsxs("div",{className:"header",children:[e.jsx("h1",{children:"Memory"}),e.jsx("p",{children:"Browse indexed knowledge sources"})]}),e.jsxs("div",{className:"card",style:{padding:0},children:[e.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center",padding:"12px 14px",borderBottom:"1px solid var(--border)"},children:[e.jsx("input",{type:"text",value:i,onChange:t=>b(t.target.value),placeholder:"Filter sources...",style:{flex:1,padding:"6px 10px",fontSize:"13px"}}),e.jsx("button",{onClick:l,disabled:a,className:"btn-ghost btn-sm",children:a?"Loading...":"Refresh"})]}),c&&e.jsxs("div",{className:"alert error",style:{margin:"12px 14px"},children:[c,e.jsx("button",{onClick:()=>o(null),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},children:"Dismiss"})]}),a?e.jsx("div",{style:{padding:"20px",textAlign:"center"},children:"Loading..."}):j.length===0?e.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--text-secondary)",fontSize:"13px"},children:i?"No matching sources":"No memory files indexed"}):e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{borderBottom:"1px solid var(--border)",color:"var(--text-secondary)",fontSize:"11px",textTransform:"uppercase"},children:[e.jsx("th",{style:{textAlign:"left",padding:"8px 14px"},children:"Source"}),e.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:"80px"},children:"Chunks"}),e.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:"140px"},children:"Last Updated"})]})}),e.jsx("tbody",{children:j.map(t=>{const s=p===t.source;return e.jsxs(k.Fragment,{children:[e.jsxs("tr",{onClick:()=>m(t.source),onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),m(t.source))},tabIndex:0,role:"button",style:{cursor:"pointer",borderBottom:s?"none":"1px solid var(--border)",backgroundColor:s?"var(--glass-micro)":void 0},className:"file-row",children:[e.jsxs("td",{style:{padding:"6px 14px"},children:[e.jsx("span",{style:{display:"inline-block",width:"14px",fontSize:"10px",color:"var(--text-secondary)",marginRight:"8px"},children:s?"▼":"▶"}),t.source]}),e.jsx("td",{style:{textAlign:"right",padding:"6px 14px",color:"var(--text-secondary)"},children:t.entryCount}),e.jsx("td",{style:{textAlign:"right",padding:"6px 14px",color:"var(--text-secondary)"},children:S(t.lastUpdated,1e3)})]}),s&&e.jsx("tr",{style:{backgroundColor:"var(--glass-micro)",borderBottom:"1px solid var(--border)"},children:e.jsx("td",{colSpan:3,style:{padding:"0 14px 14px 14px"},children:C?e.jsx("div",{style:{padding:"12px 0",textAlign:"center",color:"var(--text-secondary)",fontSize:"12px"},children:"Loading chunks..."}):h.length===0?e.jsx("div",{style:{padding:"12px 0",textAlign:"center",color:"var(--text-secondary)",fontSize:"12px"},children:"No chunks"}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px",paddingTop:"8px"},children:h.map(r=>e.jsxs("div",{style:{padding:"10px 12px",border:"1px solid var(--border)",borderRadius:"4px",backgroundColor:"var(--bg-glass)"},children:[e.jsxs("div",{style:{fontSize:"11px",color:"var(--text-secondary)",marginBottom:"6px"},children:[r.startLine!=null&&r.endLine!=null&&e.jsxs("span",{children:["Lines ",r.startLine,"–",r.endLine," · "]}),S(r.updatedAt,1e3)]}),e.jsx("pre",{style:{margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word",fontSize:"12px",fontFamily:"monospace",lineHeight:"1.5",maxHeight:"300px",minHeight:"60px",overflow:"auto",resize:"vertical",color:"var(--text-primary)"},children:r.text})]},r.id))})})})]},t.source)})})]})]})]})}export{A as Memory};
@@ -0,0 +1 @@
1
+ import{r as l,j as e,S as se,R as ne,a as d}from"./index-BwEPTTKp.js";import{u as ke,T as Ce}from"./useToolManager-tdxkKn3H.js";import{S as Ne}from"./SearchInput-CpcETdpE.js";function Te(){const[m,T]=l.useState("installed"),[w,ae]=l.useState([]),[E,le]=l.useState([]),[re,I]=l.useState(!0),[p,ie]=l.useState([]),[v,B]=l.useState(!1),[c,g]=l.useState(null),[y,oe]=l.useState(""),[j,de]=l.useState(""),[k,C]=l.useState(null),[O,V]=l.useState({}),[L,K]=l.useState(!1),[H,N]=l.useState(null),[M,G]=l.useState(null),[U,R]=l.useState(null),[ce,S]=l.useState(null),[W,$]=l.useState(""),u=()=>(I(!0),Promise.all([d.getPlugins(),d.getTools()]).then(([s,t])=>{ae(s.data),le(t.data.filter(n=>n.isPlugin)),I(!1)}).catch(s=>{q.setError(s.message),I(!1)})),b=(s=!1)=>(B(!0),d.getMarketplace(s).then(t=>{ie(t.data),B(!1)}).catch(t=>{q.setError(t.message),B(!1)})),q=ke(u),{updating:Y,error:J,setError:x,toggleEnabled:xe,updateScope:pe,bulkToggle:he,bulkScope:ge}=q;l.useEffect(()=>{u(),b()},[]);const me=async s=>{const t=p.find(n=>n.id===s);g(s);try{if(await d.installPlugin(s),await Promise.all([b(),u()]),t!=null&&t.secrets&&Object.keys(t.secrets).length>0){try{const n=await d.getPluginSecrets(s),r=Object.entries(t.secrets).filter(([,i])=>i.required).map(([i])=>i);if(r.every(i=>n.data.configured.includes(i))&&r.length>0)return}catch{}C({pluginId:s,pluginName:t.name,secrets:t.secrets}),V({})}}catch(n){x(n instanceof Error?n.message:String(n))}finally{g(null)}},P=async s=>{if(confirm(`Uninstall plugin "${s}"? This will remove its files.`)){g(s);try{await d.uninstallPlugin(s),await Promise.all([b(),u()])}catch(t){x(t instanceof Error?t.message:String(t))}finally{g(null)}}},F=async s=>{g(s);try{await d.updatePlugin(s),await Promise.all([b(),u()])}catch(t){x(t instanceof Error?t.message:String(t))}finally{g(null)}},Q=async()=>{const s=p.filter(t=>t.status==="updatable");for(const t of s){g(t.id);try{await d.updatePlugin(t.id)}catch(n){x(n instanceof Error?n.message:String(n));break}}g(null),await Promise.all([b(),u()])},ue=async s=>{if(M===s){G(null),S(null);return}try{const t=await d.getPluginSecrets(s);R(t.data),G(s),S(null)}catch(t){x(t instanceof Error?t.message:String(t))}},ye=async(s,t)=>{if(W.trim())try{await d.setPluginSecret(s,t,W.trim()),S(null),$("");const n=await d.getPluginSecrets(s);R(n.data)}catch(n){x(n instanceof Error?n.message:String(n))}},je=async(s,t)=>{try{await d.unsetPluginSecret(s,t);const n=await d.getPluginSecrets(s);R(n.data)}catch(n){x(n instanceof Error?n.message:String(n))}},X=p.filter(s=>{if(y){const t=y.toLowerCase();if(!s.name.toLowerCase().includes(t)&&!s.description.toLowerCase().includes(t))return!1}return!(j&&!s.tags.includes(j))}),D=Array.from(new Set(p.flatMap(s=>s.tags))).sort(),f=p.filter(s=>s.status==="updatable").length;if(re)return e.jsx("div",{className:"loading",children:"Loading..."});const Z=w.filter(s=>{if(y){const t=y.toLowerCase();if(!s.name.toLowerCase().includes(t)&&!(s.description??"").toLowerCase().includes(t))return!1}if(j){const t=p.find(n=>n.name===s.name);if(!t||!t.tags.includes(j))return!1}return!0}),be=E.reduce((s,t)=>s+t.toolCount,0),fe=E.reduce((s,t)=>s+t.tools.filter(n=>n.enabled).length,0);return e.jsxs("div",{children:[e.jsxs("div",{className:"header",children:[e.jsx("h1",{children:"Plugins"}),e.jsx("p",{children:"Manage installed plugins and browse the marketplace"})]}),J&&e.jsxs("div",{className:"alert error",style:{marginBottom:"14px",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("span",{children:J}),e.jsxs("div",{style:{display:"flex",gap:"6px"},children:[e.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>x(null),children:"Dismiss"}),e.jsx("button",{className:"btn-sm",onClick:()=>{x(null),u()},children:"Retry"})]})]}),e.jsxs("div",{className:"card",style:{padding:"10px 14px",marginBottom:"14px",display:"flex",gap:"16px",alignItems:"center",flexWrap:"wrap",overflow:"visible",position:"relative",zIndex:2,borderRadius:"var(--radius-pill)"},children:[e.jsxs("div",{className:"tabs",style:{marginBottom:0,flexShrink:0,width:"auto",display:"inline-flex"},children:[e.jsxs("button",{className:`tab ${m==="installed"?"active":""}`,style:{flex:"none"},onClick:()=>T("installed"),children:["Installed",e.jsx("span",{className:"tab-count",children:w.length})]}),e.jsxs("button",{className:`tab ${m==="marketplace"?"active":""}`,style:{flex:"none"},onClick:()=>T("marketplace"),children:["Marketplace",f>0&&e.jsx("span",{className:"tab-count",style:{background:"rgba(255,255,255,0.08)",color:"var(--text-secondary)"},children:f})]})]}),m==="installed"&&w.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{style:{fontSize:"13px",color:"var(--text-secondary)"},children:[e.jsx("span",{style:{color:"var(--green)",fontWeight:600},children:fe})," enabled"]}),e.jsxs("span",{style:{fontSize:"13px",color:"var(--text-secondary)"},children:[e.jsx("span",{style:{color:"var(--text-primary)",fontWeight:600},children:be})," tools"]})]}),e.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Ne,{value:y,onChange:oe,placeholder:"Search plugins...",style:{borderRadius:"14px"}}),D.length>0&&e.jsx(se,{value:j,options:["",...D],labels:["All tags",...D],onChange:s=>de(s),style:{minWidth:"120px"}}),m==="installed"&&f>0&&e.jsx("button",{className:"btn-sm",onClick:Q,disabled:!!c||v,style:{whiteSpace:"nowrap"},children:c?"Updating...":`Update All (${f})`}),m==="marketplace"&&e.jsxs(e.Fragment,{children:[f>0?e.jsx("button",{className:"btn-sm",onClick:Q,disabled:!!c||v,style:{whiteSpace:"nowrap"},children:c?"Updating...":`Update All (${f})`}):p.length>0?e.jsx("span",{style:{fontSize:"12px",color:"var(--text-tertiary)",whiteSpace:"nowrap"},children:"All up to date"}):null,e.jsx("button",{className:"btn-ghost",onClick:()=>b(!0),disabled:v,style:{whiteSpace:"nowrap"},children:v?"Refreshing...":"Refresh"})]})]})]}),m==="installed"&&e.jsx("div",{className:"card",style:{padding:0},children:w.length===0?e.jsxs("div",{style:{padding:"40px 20px",textAlign:"center"},children:[e.jsx("p",{style:{color:"var(--text-secondary)",marginBottom:"12px"},children:"No plugins installed yet"}),e.jsx("button",{className:"btn-sm",onClick:()=>T("marketplace"),children:"Browse Marketplace"})]}):Z.length===0?e.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--text-secondary)"},children:"No installed plugins match your search"}):e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{borderBottom:"1px solid var(--border)",color:"var(--text-secondary)",fontSize:"11px",textTransform:"uppercase"},children:[e.jsx("th",{style:{textAlign:"left",padding:"8px 14px"},children:"Plugin"}),e.jsx("th",{style:{textAlign:"center",padding:"8px 10px",width:60},children:"Tools"}),e.jsx("th",{style:{textAlign:"center",padding:"8px 10px",width:60},children:"Version"}),e.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:200},children:"Controls"})]})}),e.jsx("tbody",{children:Z.map(s=>{const t=E.find(a=>a.name===s.name),n=p.find(a=>a.name===s.name),r=(n==null?void 0:n.secrets)&&Object.keys(n.secrets).length>0,h=H===s.name,i=t?t.tools.some(a=>a.enabled):!1,o=t?t.tools.every(a=>!a.enabled):!0,_=t?new Set(t.tools.map(a=>a.scope)):new Set,ee=_.size>1,ve=ee?"":_.values().next().value??"always",Se=Y===s.name,te=(n==null?void 0:n.status)==="updatable";return e.jsxs(ne.Fragment,{children:[e.jsxs("tr",{onClick:()=>N(h?null:s.name),onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),N(h?null:s.name))},tabIndex:0,role:"button",style:{cursor:"pointer",borderBottom:h?"none":"1px solid var(--border)",backgroundColor:h?"var(--glass-micro)":void 0},className:"file-row",children:[e.jsxs("td",{style:{padding:"10px 14px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{display:"inline-block",width:"14px",fontSize:"10px",color:"var(--text-secondary)"},children:h?"▼":"▶"}),e.jsx("span",{style:{fontWeight:600},children:s.name}),o&&t&&t.tools.length>0&&e.jsx("span",{className:"badge warn",children:"Disabled"})]}),s.description&&e.jsx("div",{style:{fontSize:"11px",color:"var(--text-secondary)",marginTop:"2px",paddingLeft:"22px"},children:s.description})]}),e.jsx("td",{style:{textAlign:"center",padding:"8px 10px"},children:t?e.jsx("span",{className:"badge count",children:t.toolCount}):e.jsx("span",{style:{color:"var(--text-tertiary)"},children:"-"})}),e.jsx("td",{style:{textAlign:"center",padding:"8px 10px"},onClick:a=>a.stopPropagation(),children:te&&n?e.jsx("button",{className:"btn-sm",onClick:()=>F(n.id),disabled:!!c,style:{fontSize:"11px",padding:"3px 8px"},children:c===n.id?"...":`v${n.remoteVersion}`}):e.jsxs("span",{style:{color:"var(--text-secondary)",fontSize:"12px"},children:["v",s.version]})}),e.jsx("td",{style:{textAlign:"right",padding:"8px 14px",whiteSpace:"nowrap"},onClick:a=>a.stopPropagation(),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"8px"},children:[t&&t.tools.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(se,{value:ve,options:["","open","dm-only","group-only","admin-only","allowlist","disabled"],labels:[ee?"Mixed":"Scope","All","DM only","Group only","Admin only","Allowlist","Disabled"],onChange:a=>a&&ge(t,a),style:{minWidth:"100px"}}),e.jsxs("label",{className:"toggle",children:[e.jsx("input",{type:"checkbox",checked:i,onChange:()=>he(t,!i),disabled:Se}),e.jsx("span",{className:"toggle-track"}),e.jsx("span",{className:"toggle-thumb"})]})]}),e.jsx("button",{onClick:()=>P((n==null?void 0:n.id)??s.name),title:"Uninstall",disabled:!!c,className:"hover-fade",style:{background:"none",border:"none",cursor:"pointer",padding:"4px",color:"var(--red)",display:"flex",alignItems:"center"},children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"3 6 5 6 21 6"}),e.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),e.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),e.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})})]})})]}),h&&e.jsx("tr",{style:{backgroundColor:"var(--glass-micro)",borderBottom:"1px solid var(--border)"},children:e.jsxs("td",{colSpan:4,style:{padding:"0 14px 14px 14px"},children:[t&&t.tools.length>0&&e.jsx("div",{style:{display:"grid",gap:"6px",paddingTop:"6px"},children:t.tools.map(a=>e.jsx(Ce,{tool:a,updating:Y,onToggle:xe,onScope:pe},a.name))}),e.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"10px",paddingTop:"10px",borderTop:"1px solid var(--border)"},children:[r&&n&&e.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>ue(n.id),children:M===n.id?"Hide Secrets":"Manage Secrets"}),te&&n&&e.jsx("button",{className:"btn-sm",onClick:()=>F(n.id),disabled:!!c,children:c===n.id?"Updating...":`Update to v${n.remoteVersion}`}),n&&e.jsx("button",{className:"btn-danger btn-sm",onClick:()=>P(n.id),disabled:!!c,style:{marginLeft:"auto"},children:"Uninstall"})]}),r&&n&&M===n.id&&U&&e.jsx("div",{style:{marginTop:"8px",display:"grid",gap:"6px"},children:Object.entries(U.declared).map(([a,A])=>{const z=U.configured.includes(a);return e.jsxs("div",{className:"tool-row",style:{padding:"8px 12px",flexWrap:"wrap"},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("span",{style:{fontWeight:600,fontSize:"13px"},children:a}),A.required&&e.jsx("span",{style:{color:"var(--text-secondary)",marginLeft:"4px",fontSize:"11px"},children:"required"}),e.jsx("span",{className:`badge ${z?"always":"warn"}`,style:{marginLeft:"8px",fontSize:"10px"},children:z?"Set":"Not set"}),e.jsx("p",{style:{fontSize:"12px",color:"var(--text-tertiary)",margin:"2px 0 0 0"},children:A.description}),A.env&&e.jsxs("code",{style:{fontSize:"11px",color:"var(--text-tertiary)",opacity:.7},children:["Env: ",A.env]})]}),e.jsx("div",{style:{display:"flex",gap:"4px",alignItems:"center"},children:ce===a?e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"password",value:W,onChange:we=>$(we.target.value),placeholder:"Enter value...",style:{width:"200px"}}),e.jsx("button",{className:"btn-sm",onClick:()=>ye(n.id,a),children:"Save"}),e.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>S(null),children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>{S(a),$("")},children:z?"Change":"Set"}),z&&e.jsx("button",{className:"btn-danger btn-sm",onClick:()=>je(n.id,a),children:"Remove"})]})})]},a)})})]})})]},s.name)})})]})}),k&&e.jsx("div",{className:"modal-overlay",onClick:()=>!L&&C(null),children:e.jsxs("div",{className:"modal",onClick:s=>s.stopPropagation(),children:[e.jsxs("h2",{style:{marginBottom:"4px"},children:["Configure ",k.pluginName]}),e.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"13px",marginBottom:"16px"},children:"This plugin needs API keys to work. You can configure them now or later."}),Object.entries(k.secrets).map(([s,t])=>e.jsxs("div",{style:{marginBottom:"12px"},children:[e.jsxs("label",{style:{display:"block",fontSize:"13px",fontWeight:600,marginBottom:"4px"},children:[s," ",t.required&&e.jsx("span",{style:{color:"var(--text-secondary)"},children:"*"})]}),e.jsx("p",{style:{fontSize:"12px",color:"var(--text-tertiary)",margin:"0 0 4px 0"},children:t.description}),t.env&&e.jsxs("code",{style:{display:"block",fontSize:"11px",color:"var(--text-tertiary)",opacity:.7,marginBottom:"6px"},children:["Env: ",t.env]}),e.jsx("input",{type:"password",placeholder:`Enter ${s}...`,value:O[s]||"",onChange:n=>V(r=>({...r,[s]:n.target.value})),style:{width:"100%"}})]},s)),e.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end",marginTop:"16px"},children:[e.jsx("button",{className:"btn-ghost",onClick:()=>C(null),children:"Skip"}),e.jsx("button",{className:"btn-sm",disabled:L,onClick:async()=>{K(!0);try{for(const[s,t]of Object.entries(O))t.trim()&&await d.setPluginSecret(k.pluginId,s,t.trim());C(null)}catch(s){x(s instanceof Error?s.message:String(s))}finally{K(!1)}},children:L?"Saving...":"Save"})]})]})}),m==="marketplace"&&e.jsx("div",{className:"card",style:{padding:0},children:v&&p.length===0?e.jsx("div",{style:{padding:"20px",textAlign:"center"},children:"Loading marketplace..."}):X.length===0?e.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--text-secondary)"},children:y||j?"No plugins match your search":"Marketplace is empty"}):(()=>{const s=[...X].sort((t,n)=>{const r={updatable:0,installed:1,available:2};return r[t.status]-r[n.status]});return e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{borderBottom:"1px solid var(--border)",color:"var(--text-secondary)",fontSize:"11px",textTransform:"uppercase"},children:[e.jsx("th",{style:{textAlign:"left",padding:"8px 14px"},children:"Plugin"}),e.jsx("th",{style:{textAlign:"center",padding:"8px 10px",width:60},children:"Tools"}),e.jsx("th",{style:{textAlign:"center",padding:"8px 10px",width:60},children:"Version"}),e.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:140}})]})}),e.jsx("tbody",{children:s.map(t=>{const n=c===t.id,r=!!c,h=t.secrets&&Object.values(t.secrets).some(o=>o.required),i=H===`market-${t.id}`;return e.jsxs(ne.Fragment,{children:[e.jsxs("tr",{onClick:()=>N(i?null:`market-${t.id}`),onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),N(i?null:`market-${t.id}`))},tabIndex:0,role:"button",style:{cursor:"pointer",borderBottom:i?"none":"1px solid var(--border)",backgroundColor:i?"var(--glass-micro)":void 0},className:"file-row",children:[e.jsx("td",{style:{padding:"10px 14px"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{display:"inline-block",width:"14px",fontSize:"10px",color:"var(--text-secondary)"},children:i?"▼":"▶"}),e.jsx("span",{style:{fontWeight:600},children:t.name}),h&&t.status==="available"&&e.jsx("span",{className:"badge warn",children:"API Key"})]})}),e.jsx("td",{style:{textAlign:"center",padding:"8px 10px"},children:e.jsx("span",{className:"badge count",children:t.toolCount})}),e.jsxs("td",{style:{textAlign:"center",padding:"8px 10px",color:"var(--text-secondary)",fontSize:"12px"},children:["v",t.remoteVersion]}),e.jsxs("td",{style:{textAlign:"right",padding:"8px 14px",whiteSpace:"nowrap"},onClick:o=>o.stopPropagation(),children:[t.status==="available"&&e.jsx("button",{className:"btn-sm",onClick:()=>me(t.id),disabled:r,children:n?"Installing...":"Install"}),t.status==="installed"&&e.jsx("button",{className:"btn-danger btn-sm",onClick:()=>P(t.id),disabled:r,children:n?"Removing...":"Uninstall"}),t.status==="updatable"&&e.jsxs("div",{style:{display:"flex",gap:"6px",justifyContent:"flex-end"},children:[e.jsx("button",{className:"btn-sm",onClick:()=>F(t.id),disabled:r,children:n?"Updating...":"Update"}),e.jsx("button",{className:"btn-danger btn-sm",onClick:()=>P(t.id),disabled:r,children:"Uninstall"})]})]})]}),i&&e.jsx("tr",{style:{backgroundColor:"var(--glass-micro)",borderBottom:"1px solid var(--border)"},children:e.jsx("td",{colSpan:4,style:{padding:"0 14px 14px 14px"},children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"80px 1fr",gap:"4px 12px",fontSize:"12px",padding:"8px 0"},children:[e.jsx("span",{style:{color:"var(--text-secondary)"},children:"Author"}),e.jsx("span",{children:t.author}),e.jsx("span",{style:{color:"var(--text-secondary)"},children:"Description"}),e.jsx("span",{style:{color:"var(--text-secondary)"},children:t.description}),t.tags.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:"var(--text-secondary)"},children:"Tags"}),e.jsx("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap"},children:t.tags.map(o=>e.jsx("span",{style:{fontSize:"10px",padding:"1px 6px",borderRadius:"4px",background:"var(--bg-glass)",color:"var(--text-tertiary)"},children:o},o))})]}),t.tools&&t.tools.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:"var(--text-secondary)"},children:"Tools"}),e.jsx("span",{style:{color:"var(--text-tertiary)"},children:t.tools.map(o=>o.name).join(", ")})]})]})})})]},t.id)})})]})})()})]})}export{Te as Plugins};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-BwEPTTKp.js";function a({value:e,onChange:t,placeholder:n="Search...",style:i}){return o.jsxs("div",{style:{position:"relative"},children:[o.jsx("input",{type:"text",placeholder:n,value:e,onChange:r=>t(r.target.value),onKeyDown:r=>{r.key==="Escape"&&t("")},style:{padding:"4px 24px 4px 12px",fontSize:"13px",border:"1px solid var(--border)",backgroundColor:"transparent",color:"var(--text-primary)",width:"180px",outline:"none",...i}}),e&&o.jsx("button",{onClick:()=>t(""),style:{position:"absolute",right:"4px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",color:"var(--text-secondary)",cursor:"pointer",padding:"0 2px",fontSize:"14px",lineHeight:1},children:"✕"})]})}export{a as S};
@@ -0,0 +1 @@
1
+ import{r as s,a as p,j as t}from"./index-BwEPTTKp.js";const v=["SOUL.md","SECURITY.md","STRATEGY.md","MEMORY.md","HEARTBEAT.md"];function b(){const[n,g]=s.useState(v[0]),[i,c]=s.useState(""),[f,d]=s.useState(""),[y,x]=s.useState(!1),[u,m]=s.useState(!1),[o,l]=s.useState(null),r=i!==f,h=s.useCallback(async e=>{x(!0),l(null);try{const a=await p.getSoulFile(e);c(a.data.content),d(a.data.content)}catch(a){l({type:"error",text:a instanceof Error?a.message:String(a)})}finally{x(!1)}},[]),S=async()=>{m(!0),l(null);try{const e=await p.updateSoulFile(n,i);d(i),l({type:"success",text:e.data.message})}catch(e){l({type:"error",text:e instanceof Error?e.message:String(e)})}finally{m(!1)}};s.useEffect(()=>{const e=a=>{r&&a.preventDefault()};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[r]);const E=e=>{e!==n&&(r&&!window.confirm("You have unsaved changes. Discard them?")||g(e))};return s.useEffect(()=>{h(n)},[n,h]),t.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"calc(100vh - 64px)",overflow:"hidden"},children:[t.jsxs("div",{className:"header",style:{marginBottom:"16px"},children:[t.jsx("h1",{children:"Soul Editor"}),t.jsx("p",{children:"Edit system prompt files"})]}),o&&t.jsx("div",{className:`alert ${o.type}`,style:{marginBottom:"8px"},children:o.text}),t.jsxs("div",{className:"card",style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",padding:"12px"},children:[t.jsx("div",{className:"tabs",style:{marginBottom:"8px"},children:v.map(e=>t.jsxs("button",{className:`tab ${n===e?"active":""}`,onClick:()=>E(e),children:[e,n===e&&r?" *":""]},e))}),y?t.jsx("div",{className:"loading",children:"Loading..."}):t.jsxs(t.Fragment,{children:[t.jsx("textarea",{value:i,onChange:e=>c(e.target.value),placeholder:`Edit ${n}...`,style:{flex:1,minHeight:"200px"}}),t.jsxs("div",{style:{marginTop:"8px",display:"flex",alignItems:"center",gap:"10px"},children:[t.jsx("button",{onClick:S,disabled:u||!r,children:u?"Saving...":"Save"}),r&&t.jsx("span",{style:{color:"var(--text-secondary)",fontSize:"13px"},children:"Unsaved changes"})]})]})]})]})}export{b as Soul};
@@ -0,0 +1 @@
1
+ import{r as l,a as v,j as e,R as I}from"./index-BwEPTTKp.js";import{f as g}from"./utils-CnsbSMo4.js";import{S as O}from"./SearchInput-CpcETdpE.js";const S={pending:"var(--warning)",in_progress:"var(--accent)",done:"var(--green)",failed:"var(--red)",cancelled:"var(--text-secondary)"},y={pending:"Pending",in_progress:"Running",done:"Done",failed:"Failed",cancelled:"Cancelled"};function T({status:s}){return e.jsx("span",{style:{display:"inline-block",padding:"2px 8px",borderRadius:"10px",fontSize:"11px",fontWeight:600,color:"var(--text-on-accent)",backgroundColor:S[s]},children:y[s]})}function M({priority:s}){if(s===0)return e.jsx("span",{style:{color:"var(--text-secondary)",fontSize:"11px"},children:"-"});const d=Math.min(s,10);return e.jsxs("span",{title:`Priority: ${s}/10`,style:{fontSize:"11px",letterSpacing:"1px"},children:["●".repeat(Math.min(d,5)),"○".repeat(Math.max(0,5-d))]})}function w(s,d){return s?s.length>d?s.slice(0,d)+"...":s:""}function J(){const[s,d]=l.useState([]),[B,z]=l.useState(!0),[L,c]=l.useState(null),[a,A]=l.useState(""),[N,R]=l.useState(""),[n,p]=l.useState(null),[j,m]=l.useState(!1),[x,f]=l.useState(null),b=l.useRef(null),h=l.useCallback(async()=>{z(!0),c(null);try{const r=(await v.tasksList()).data??[];d(r),p(o=>o?r.find(W=>W.id===o.id)??null:null)}catch(t){c(t instanceof Error?t.message:String(t))}finally{z(!1)}},[]);l.useEffect(()=>{h()},[h]),l.useEffect(()=>{function t(r){b.current&&!b.current.contains(r.target)&&m(!1)}if(j)return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[j]);const E=async t=>{f(null),m(!1);try{await v.tasksClean(t),c(null),h(),p(null)}catch(r){c(r instanceof Error?r.message:String(r))}},D=async t=>{if(confirm("Cancel this task?"))try{await v.tasksCancel(t),h(),(n==null?void 0:n.id)===t&&p(null)}catch(r){c(r instanceof Error?r.message:String(r))}},P=async t=>{if(confirm("Permanently delete this task?"))try{await v.tasksDelete(t),h(),(n==null?void 0:n.id)===t&&p(null)}catch(r){c(r instanceof Error?r.message:String(r))}},i=s.reduce((t,r)=>(t[r.status]=(t[r.status]||0)+1,t),{}),F=(i.done||0)+(i.failed||0)+(i.cancelled||0),C=a?s.filter(t=>t.status===a):s,u=N.trim().toLowerCase(),k=u?C.filter(t=>t.description.toLowerCase().includes(u)||(t.reason??"").toLowerCase().includes(u)||t.id.toLowerCase().includes(u)):C;return e.jsxs("div",{children:[e.jsxs("div",{className:"header",children:[e.jsx("h1",{children:"Tasks"}),e.jsx("p",{children:"Scheduled and queued agent tasks"})]}),L&&e.jsxs("div",{className:"alert error",style:{marginBottom:"14px"},children:[L,e.jsx("button",{onClick:()=>c(null),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},children:"Dismiss"})]}),e.jsxs("div",{className:"card",style:{padding:"10px 14px",marginBottom:"14px",display:"flex",gap:"16px",alignItems:"center",flexWrap:"wrap",overflow:"visible",position:"relative",zIndex:2,borderRadius:"var(--radius-pill)"},children:[e.jsxs("span",{onClick:()=>A(""),style:{cursor:"pointer",fontWeight:a===""?"bold":"normal",color:a===""?"var(--text-primary)":"var(--text-secondary)",fontSize:"13px"},children:["All (",s.length,")"]}),["pending","in_progress","done","failed","cancelled"].map(t=>e.jsxs("span",{onClick:()=>A(a===t?"":t),style:{cursor:"pointer",fontWeight:a===t?"bold":"normal",color:a===t?S[t]:"var(--text-secondary)",fontSize:"13px"},children:[y[t]," (",i[t]||0,")"]},t)),e.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(O,{value:N,onChange:R,placeholder:"Search tasks..."}),u&&e.jsxs("span",{style:{fontSize:"11px",color:"var(--text-secondary)",whiteSpace:"nowrap"},children:[k.length," of ",C.length," tasks"]})]}),F>0&&e.jsxs("div",{ref:b,style:{position:"relative"},children:[e.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>m(!j),children:"Clean"}),j&&e.jsx("div",{className:"custom-select-menu",style:{position:"absolute",top:"100%",right:0,marginTop:"4px",zIndex:10,minWidth:"170px",width:"auto"},children:["done","failed","cancelled"].filter(t=>(i[t]||0)>0).map(t=>e.jsxs("div",{className:"custom-select-option",onClick:()=>{m(!1),f(t)},style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:S[t],flexShrink:0}}),y[t]," (",i[t],")"]},t))})]}),e.jsx("button",{className:"btn-ghost btn-sm",onClick:h,children:"Refresh"})]}),x&&e.jsx("div",{className:"modal-overlay",onClick:()=>f(null),children:e.jsxs("div",{className:"modal",style:{maxWidth:"380px"},onClick:t=>t.stopPropagation(),children:[e.jsxs("h2",{style:{marginBottom:"4px"},children:["Clean ",y[x].toLowerCase()," tasks"]}),e.jsxs("p",{style:{color:"var(--text-secondary)",fontSize:"13px",marginBottom:"16px"},children:["Permanently delete all ",i[x]||0," ",e.jsx("span",{style:{color:S[x],fontWeight:600},children:y[x].toLowerCase()})," ","tasks? This cannot be undone."]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px"},children:[e.jsx("button",{className:"btn-ghost",onClick:()=>f(null),children:"Cancel"}),e.jsxs("button",{className:"btn-danger btn-sm",onClick:()=>E(x),children:["Delete ",i[x]||0," tasks"]})]})]})}),e.jsx("div",{className:"card",style:{padding:0},children:B?e.jsx("div",{style:{padding:"20px",textAlign:"center"},children:"Loading..."}):k.length===0?e.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--text-secondary)"},children:u?"No tasks match your search":a?`No ${y[a].toLowerCase()} tasks`:"No tasks yet"}):e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px",tableLayout:"fixed"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{borderBottom:"1px solid var(--border)",color:"var(--text-secondary)",fontSize:"11px",textTransform:"uppercase"},children:[e.jsx("th",{style:{textAlign:"left",padding:"8px 14px"},children:"Description"}),e.jsx("th",{style:{textAlign:"center",padding:"8px 10px",width:80},children:"Status"}),e.jsx("th",{style:{textAlign:"center",padding:"8px 10px",width:60},children:"Priority"}),e.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:120},children:"Scheduled"}),e.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:120},children:"Created"}),e.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:70}})]})}),e.jsx("tbody",{children:k.map(t=>{const r=(n==null?void 0:n.id)===t.id;return e.jsxs(I.Fragment,{children:[e.jsxs("tr",{onClick:()=>p(r?null:t),onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),p(r?null:t))},tabIndex:0,role:"button",style:{cursor:"pointer",borderBottom:r?"none":"1px solid var(--border)",backgroundColor:r?"var(--glass-micro)":void 0},className:"file-row",children:[e.jsxs("td",{style:{padding:"8px 14px"},children:[e.jsxs("div",{children:[e.jsx("span",{style:{display:"inline-block",width:"14px",fontSize:"10px",color:"var(--text-secondary)"},children:r?"▼":"▶"}),w(t.description,80)]}),t.reason&&e.jsx("div",{style:{fontSize:"11px",color:"var(--text-secondary)",marginTop:"2px",paddingLeft:"14px"},children:w(t.reason,60)})]}),e.jsx("td",{style:{textAlign:"center",padding:"8px 10px"},children:e.jsx(T,{status:t.status})}),e.jsx("td",{style:{textAlign:"center",padding:"8px 10px"},children:e.jsx(M,{priority:t.priority})}),e.jsx("td",{style:{textAlign:"right",padding:"8px 14px",color:"var(--text-secondary)"},children:g(t.scheduledFor)}),e.jsx("td",{style:{textAlign:"right",padding:"8px 14px",color:"var(--text-secondary)"},children:g(t.createdAt)}),e.jsxs("td",{style:{textAlign:"right",padding:"8px 14px",whiteSpace:"nowrap"},onClick:o=>o.stopPropagation(),children:[(t.status==="pending"||t.status==="in_progress")&&e.jsx("button",{className:"icon-button",onClick:()=>D(t.id),title:"Cancel",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),e.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]})}),e.jsx("button",{className:"icon-button",onClick:()=>P(t.id),title:"Delete",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"3 6 5 6 21 6"}),e.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})]}),r&&n&&e.jsx("tr",{style:{backgroundColor:"var(--glass-micro)",borderBottom:"1px solid var(--border)"},children:e.jsxs("td",{colSpan:6,style:{padding:"0 14px 14px 14px",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"120px 1fr",gap:"6px 12px",fontSize:"13px",padding:"10px 0"},children:[e.jsx("span",{style:{color:"var(--text-secondary)"},children:"ID"}),e.jsx("code",{style:{fontSize:"11px",wordBreak:"break-all"},children:n.id}),e.jsx("span",{style:{color:"var(--text-secondary)"},children:"Status"}),e.jsx("span",{children:e.jsx(T,{status:n.status})}),e.jsx("span",{style:{color:"var(--text-secondary)"},children:"Priority"}),e.jsxs("span",{children:[n.priority,"/10"]}),e.jsx("span",{style:{color:"var(--text-secondary)"},children:"Description"}),e.jsx("span",{children:n.description}),n.reason&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:"var(--text-secondary)"},children:"Reason"}),e.jsx("span",{children:n.reason})]}),e.jsx("span",{style:{color:"var(--text-secondary)"},children:"Created by"}),e.jsx("span",{children:n.createdBy||"—"}),e.jsx("span",{style:{color:"var(--text-secondary)"},children:"Created"}),e.jsx("span",{children:g(n.createdAt)}),e.jsx("span",{style:{color:"var(--text-secondary)"},children:"Scheduled for"}),e.jsx("span",{children:g(n.scheduledFor)}),e.jsx("span",{style:{color:"var(--text-secondary)"},children:"Started"}),e.jsx("span",{children:g(n.startedAt)}),e.jsx("span",{style:{color:"var(--text-secondary)"},children:"Completed"}),e.jsx("span",{children:g(n.completedAt)}),n.dependencies.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:"var(--text-secondary)"},children:"Depends on"}),e.jsxs("span",{style:{fontSize:"11px"},children:[n.dependencies.length," task(s)"]})]}),n.dependents.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:"var(--text-secondary)"},children:"Dependents"}),e.jsxs("span",{style:{fontSize:"11px"},children:[n.dependents.length," task(s)"]})]})]}),n.payload&&e.jsxs("div",{style:{marginTop:"4px"},children:[e.jsx("div",{style:{fontSize:"12px",color:"var(--text-secondary)",marginBottom:"4px"},children:"Payload"}),e.jsx("pre",{style:{padding:"8px",borderRadius:"4px",backgroundColor:"rgba(0,0,0,0.2)",fontSize:"11px",overflow:"auto",maxHeight:"150px",margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:(()=>{try{return JSON.stringify(JSON.parse(n.payload),null,2)}catch{return n.payload}})()})]}),n.result&&e.jsxs("div",{style:{marginTop:"12px"},children:[e.jsx("div",{style:{fontSize:"12px",color:"var(--green)",marginBottom:"4px"},children:"Result"}),e.jsx("pre",{style:{padding:"8px",borderRadius:"4px",backgroundColor:"rgba(0,0,0,0.2)",fontSize:"11px",overflow:"auto",maxHeight:"200px",margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:w(n.result,2e3)})]}),n.error&&e.jsxs("div",{style:{marginTop:"12px"},children:[e.jsx("div",{style:{fontSize:"12px",color:"var(--red)",marginBottom:"4px"},children:"Error"}),e.jsx("pre",{style:{padding:"8px",borderRadius:"4px",backgroundColor:"var(--red-dim)",fontSize:"11px",overflow:"auto",maxHeight:"150px",margin:0,color:"var(--red)"},children:n.error})]})]})})]},t.id)})})]})})]})}export{J as Tasks};
@@ -0,0 +1 @@
1
+ import{r,a as K,j as e,b as Y,S as G}from"./index-BwEPTTKp.js";function re(){const[l,g]=r.useState(null),[c,d]=r.useState(null),[m,i]=r.useState(null),[y,p]=r.useState([]),[w,S]=r.useState(!0),[b,t]=r.useState(null),[v,I]=r.useState([]),[k,h]=r.useState(null),[j,o]=r.useState(null),[D,E]=r.useState(""),[P,N]=r.useState(!1),[O,A]=r.useState(null),[T,s]=r.useState({}),[a,n]=r.useState({}),f=r.useCallback(()=>{Promise.all([K.getStatus(),K.getMemoryStats(),K.getConfigKeys(),K.getToolRag()]).then(([u,x,C,B])=>{g(u.data),d(x.data),i(B.data),p(C.data);const q={};for(const U of C.data)U.value!=null&&(q[U.key]=U.value);s(q),n(q),S(!1)}).catch(u=>{t(u.message),S(!1)})},[]);r.useEffect(()=>{f()},[f]);const _=u=>a[u]??"",F=u=>T[u]??"",V=u=>{n(x=>({...x,[u]:T[u]??""}))},z=async(u,x)=>{if(x.trim())try{t(null),await K.setConfigKey(u,x.trim()),await f()}catch(C){t(C instanceof Error?C.message:String(C))}},H=async u=>{try{const x=await K.updateToolRag(u);i(x.data)}catch(x){t(x instanceof Error?x.message:String(x))}},X=(u,x)=>{n(C=>({...C,[u]:x}))},W=_("agent.provider");return r.useEffect(()=>{W&&K.getModelsForProvider(W).then(u=>{const x=u.data.map(B=>({value:B.value,name:B.name}));I(x);const C=a["agent.model"]??"";x.length>0&&!x.some(B=>B.value===C)&&z("agent.model",x[0].value)}).catch(()=>I([]))},[W]),{loading:w,error:b,setError:t,status:l,stats:c,toolRag:m,configKeys:y,localInputs:a,getLocal:_,getServer:F,setLocal:X,cancelLocal:V,saveConfig:z,saveToolRag:H,modelOptions:v,pendingProvider:k,pendingMeta:j,pendingApiKey:D,setPendingApiKey:E,pendingValidating:P,pendingError:O,setPendingError:A,handleProviderChange:async u=>{if(u!==W)try{const C=(await K.getProviderMeta(u)).data;C.needsKey?(h(u),o(C),E(""),A(null)):(await z("agent.provider",u),h(null),o(null))}catch(x){t(x instanceof Error?x.message:String(x))}},handleProviderConfirm:async()=>{if(!(!k||!j)){if(j.needsKey&&!D.trim()){A("API key is required");return}N(!0),A(null);try{const u=await K.validateApiKey(k,D);if(!u.data.valid){A(u.data.error||"Invalid API key"),N(!1);return}await K.setConfigKey("agent.api_key",D.trim()),await z("agent.provider",k),h(null),o(null),E("")}catch(u){A(u instanceof Error?u.message:String(u))}finally{N(!1)}}},handleProviderCancel:()=>{h(null),o(null),E(""),A(null)},loadData:f}}const Z="var(--bg-secondary)",Q=75;function M({text:l}){const[g,c]=r.useState(!1),d=r.useId(),m=r.useRef(null),i=r.useCallback(()=>{m.current&&clearTimeout(m.current),c(!0)},[]),y=r.useCallback(()=>{m.current=setTimeout(()=>c(!1),Q)},[]);return r.useEffect(()=>{if(!g)return;const p=w=>{w.key==="Escape"&&c(!1)};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[g]),r.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),e.jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center",marginLeft:"6px"},onMouseEnter:i,onMouseLeave:y,onFocus:i,onBlur:y,children:[e.jsx("span",{tabIndex:0,role:"button","aria-describedby":g?d:void 0,"aria-label":"Info",style:{cursor:"help",display:"inline-flex",color:g?"var(--text-primary)":"var(--text-secondary)",transition:"color 0.15s",outline:"none"},children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("circle",{cx:"7",cy:"7",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("text",{x:"7",y:"10.5",textAnchor:"middle",fill:"currentColor",fontSize:"9",fontWeight:"600",fontFamily:"sans-serif",children:"i"})]})}),e.jsxs("span",{id:d,role:"tooltip",onMouseEnter:i,onMouseLeave:y,style:{position:"absolute",bottom:"calc(100% + 8px)",left:"50%",transform:g?"translateX(-50%) translateY(0)":"translateX(-50%) translateY(4px)",width:"max-content",maxWidth:"250px",minWidth:"64px",padding:"6px 12px",background:"var(--bg-tertiary)",border:"1px solid var(--border)",borderRadius:"6px",color:"var(--text-primary)",fontSize:"var(--font-sm)",fontWeight:400,lineHeight:"1.4",textAlign:"center",overflowWrap:"break-word",whiteSpace:"normal",zIndex:50,opacity:g?1:0,visibility:g?"visible":"hidden",transition:"opacity 200ms cubic-bezier(0.16,1,0.3,1), transform 200ms cubic-bezier(0.16,1,0.3,1), visibility 200ms",pointerEvents:g?"auto":"none"},children:[l,e.jsx("span",{style:{position:"absolute",bottom:"-4px",left:"50%",transform:"translateX(-50%) rotate(45deg)",width:"8px",height:"8px",background:Z,borderRight:"1px solid var(--border-glass)",borderBottom:"1px solid var(--border-glass)"}})]})]})}function R({label:l,description:g,type:c="text",value:d,serverValue:m,onChange:i,onSave:y,onCancel:p,min:w,max:S,step:b,placeholder:t,hotReload:v,badge:I,inline:k}){const[h,j]=r.useState(!1),o=r.useRef(null),D=d!==m,E=async()=>{if(!(!D||h)){j(!0);try{await y(d)}finally{j(!1)}}},P=()=>{h||p()},N=n=>{n.key==="Enter"?(n.preventDefault(),E()):n.key==="Escape"&&(n.preventDefault(),P())};r.useEffect(()=>{h&&o.current&&o.current.blur()},[h]);const O=I?e.jsx("span",{style:{fontSize:11,padding:"2px 8px",backgroundColor:I==="Set"?"color-mix(in srgb, var(--accent) 15%, transparent)":"color-mix(in srgb, var(--red) 15%, transparent)",color:I==="Set"?"var(--accent)":"var(--red)",marginLeft:6,fontWeight:600,borderRadius:"var(--radius-pill)",letterSpacing:"0.3px"},children:I}):null,A=v==="restart"?e.jsx("span",{style:{fontSize:11,color:"var(--text-secondary)",marginLeft:6},children:"(requires restart)"}):null,T=e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("span",{children:l}),g&&e.jsx(M,{text:g}),O,A]}),s=D?e.jsxs("div",{style:{display:"flex",gap:4,flexShrink:0},children:[e.jsx("button",{onClick:E,disabled:h,style:{padding:"4px 8px",fontSize:13,border:"1px solid var(--accent)",background:"var(--accent)",color:"var(--text-on-accent)",cursor:h?"wait":"pointer",opacity:h?.6:1,lineHeight:1},children:h?"...":"✓"}),e.jsx("button",{onClick:P,disabled:h,style:{padding:"4px 8px",fontSize:13,border:"1px solid var(--border)",background:"var(--bg-glass)",color:"var(--text-primary)",cursor:"pointer",lineHeight:1},children:"✗"})]}):null,a=c==="number"?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("span",{style:{fontSize:15,fontWeight:600,color:"var(--text-primary)",minWidth:20,textAlign:"center"},children:d}),e.jsx(Y,{value:parseFloat(d)||0,onChange:n=>{const f=String(n);i(f),y(f)},min:w,max:S,step:b,disabled:h})]}):e.jsx("input",{ref:o,type:c,value:d,onChange:n=>i(n.target.value),onKeyDown:N,disabled:h,placeholder:t,min:w,max:S,step:b,style:{flex:1,padding:"6px 10px",fontSize:14,border:"1px solid var(--border)",background:"var(--bg-glass)",color:"var(--text-primary)",minWidth:0}});return k?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,minHeight:36},children:[e.jsx("div",{style:{flex:"0 0 auto",minWidth:120},children:T}),e.jsxs("div",{style:{flex:1,display:"flex",gap:6,alignItems:"center",justifyContent:"flex-end"},children:[a,c!=="number"&&s]})]}):e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:T}),e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",justifyContent:c==="number"?"space-between":void 0},children:[a,c!=="number"&&s]})]})}function se({getLocal:l,getServer:g=()=>"",setLocal:c,saveConfig:d,cancelLocal:m=()=>{},modelOptions:i,pendingProvider:y,pendingMeta:p,pendingApiKey:w,setPendingApiKey:S,pendingValidating:b,pendingError:t,setPendingError:v,handleProviderChange:I,handleProviderConfirm:k,handleProviderCancel:h,compact:j=!1}){return e.jsx(e.Fragment,{children:e.jsxs("div",{style:{display:"grid",gap:"16px"},children:[e.jsxs("div",{className:"form-group",style:{marginBottom:0},children:[e.jsxs("label",{children:["Provider ",e.jsx(M,{text:"LLM provider"})]}),e.jsx(G,{value:y??l("agent.provider"),options:["claude-code","anthropic","openai","google","xai","groq","openrouter","moonshot","mistral","cerebras","zai","minimax","huggingface","cocoon","local"],labels:["Claude Code","Anthropic","OpenAI","Google","xAI","Groq","OpenRouter","Moonshot","Mistral","Cerebras","ZAI (Zhipu)","MiniMax","HuggingFace","Cocoon","Local"],onChange:I})]}),y&&p&&e.jsxs("div",{className:"provider-switch-zone",children:[e.jsxs("div",{style:{fontSize:"13px",fontWeight:500,marginBottom:"12px"},children:["Switching to ",p.displayName]}),p.needsKey&&e.jsxs("div",{className:"form-group",style:{marginBottom:"8px"},children:[e.jsx("label",{children:"API Key"}),e.jsx("input",{type:"password",placeholder:p.keyHint,value:w,onChange:o=>{S(o.target.value),v(null)},onKeyDown:o=>o.key==="Enter"&&k(),style:{width:"100%"},autoFocus:!0}),p.consoleUrl&&e.jsxs("a",{href:p.consoleUrl,target:"_blank",rel:"noopener noreferrer",style:{fontSize:"12px",color:"var(--text-secondary)",marginTop:"4px",display:"inline-block"},children:["Get key at ",new URL(p.consoleUrl).hostname," ↗"]})]}),t&&e.jsx("div",{style:{fontSize:"12px",color:"var(--red)",marginBottom:"8px"},children:t}),e.jsxs("div",{style:{display:"flex",gap:"8px"},children:[e.jsx("button",{className:"btn-ghost btn-sm",onClick:h,disabled:b,children:"Cancel"}),e.jsx("button",{className:"btn-sm",onClick:k,disabled:b,children:b?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"spinner sm"})," Validating..."]}):"Validate & Save"})]})]}),e.jsxs("div",{className:"form-group",style:{marginBottom:0},children:[e.jsxs("label",{children:["Model ",e.jsx(M,{text:"Main LLM model ID"})]}),e.jsx(G,{value:l("agent.model"),options:i.map(o=>o.value),labels:i.map(o=>o.name),onChange:o=>d("agent.model",o)})]}),!j&&e.jsxs("div",{style:{display:"grid",gap:"12px"},children:[e.jsx(R,{label:"Temperature",description:"Response creativity (0.0 = deterministic, 1.0 = max)",configKey:"agent.temperature",type:"number",value:l("agent.temperature"),serverValue:g("agent.temperature"),onChange:o=>c("agent.temperature",o),onSave:o=>d("agent.temperature",o),onCancel:()=>m("agent.temperature"),min:0,max:1,step:.1,inline:!0}),e.jsx(R,{label:"Max Tokens",description:"Maximum response length in tokens",configKey:"agent.max_tokens",type:"number",value:l("agent.max_tokens"),serverValue:g("agent.max_tokens"),onChange:o=>c("agent.max_tokens",o),onSave:o=>d("agent.max_tokens",o),onCancel:()=>m("agent.max_tokens"),min:100,step:100,inline:!0}),e.jsx(R,{label:"Max Iterations",description:"Max tool-call loop iterations per message",configKey:"agent.max_agentic_iterations",type:"number",value:l("agent.max_agentic_iterations"),serverValue:g("agent.max_agentic_iterations"),onChange:o=>c("agent.max_agentic_iterations",o),onSave:o=>d("agent.max_agentic_iterations",o),onCancel:()=>m("agent.max_agentic_iterations"),min:1,max:20,inline:!0})]})]})})}function $({value:l,onChange:g,validate:c,placeholder:d,disabled:m}){const[i,y]=r.useState(l),[p,w]=r.useState(""),[S,b]=r.useState(null),[t,v]=r.useState(-1),[I,k]=r.useState(-1),h=r.useRef(null),j=r.useRef([]);r.useEffect(()=>{y(l)},[l]);const o=JSON.stringify(i)!==JSON.stringify(l),D=r.useCallback(s=>{const a=s.trim();if(a){if(c){const n=c(a);if(n){b(n);return}}if(i.includes(a)){b("Duplicate item");return}b(null),y(n=>[...n,a]),w("")}},[i,c]),E=r.useCallback(s=>{var a;if(y(n=>n.filter((f,_)=>_!==s)),i.length<=1)(a=h.current)==null||a.focus(),v(-1);else if(s>=i.length-1){const n=s-1;v(n),setTimeout(()=>{var f;return(f=j.current[n])==null?void 0:f.focus()},0)}else v(s),setTimeout(()=>{var n;return(n=j.current[s])==null?void 0:n.focus()},0)},[i.length]),P=r.useCallback(s=>{var a;if(!s.nativeEvent.isComposing){if(s.key==="Enter")s.preventDefault(),D(p);else if(s.key==="Backspace"&&p===""&&i.length>0){const n=i.length-1;v(n),(a=j.current[n])==null||a.focus()}}},[p,D,i.length]),N=r.useCallback((s,a)=>{var n,f,_,F,V,z;switch(s.key){case"ArrowLeft":s.preventDefault(),a>0&&(v(a-1),(n=j.current[a-1])==null||n.focus());break;case"ArrowRight":s.preventDefault(),a<i.length-1?(v(a+1),(f=j.current[a+1])==null||f.focus()):(v(-1),(_=h.current)==null||_.focus());break;case"Delete":case"Backspace":s.preventDefault(),E(a);break;case"Escape":s.preventDefault(),v(-1),(F=h.current)==null||F.focus();break;case"Home":s.preventDefault(),v(0),(V=j.current[0])==null||V.focus();break;case"End":if(s.preventDefault(),i.length>0){const H=i.length-1;v(H),(z=j.current[H])==null||z.focus()}break}},[i.length,E]),O=r.useCallback(s=>{const n=s.clipboardData.getData("text").split(/[,;\n\t]+/).map(_=>_.trim()).filter(Boolean);if(n.length<=1)return;s.preventDefault();const f=[];for(const _ of n)i.includes(_)||f.includes(_)||c&&c(_)||f.push(_);f.length>0&&(y(_=>[..._,...f]),b(null))},[i,c]),A=()=>{g(i)},T=()=>{y(l),b(null)};return e.jsxs("div",{style:{opacity:m?.5:1},children:[i.length>0&&e.jsx("div",{role:"listbox","aria-orientation":"horizontal",style:{display:"flex",flexWrap:"wrap",gap:"6px",marginBottom:"var(--space-sm)"},children:i.map((s,a)=>e.jsxs("div",{ref:n=>{j.current[a]=n},role:"option","aria-selected":"true",tabIndex:t===a?0:-1,onKeyDown:n=>N(n,a),onFocus:()=>v(a),onBlur:()=>{t===a&&v(-1)},style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",background:"color-mix(in srgb, var(--accent) 15%, transparent)",border:"none",color:"var(--text-primary)",borderRadius:"6px",fontSize:"var(--font-sm)",lineHeight:"1.4",outline:t===a?"2px solid var(--border-strong)":"none",outlineOffset:t===a?"1px":void 0,cursor:"default"},children:[e.jsx("span",{style:{fontFamily:"var(--font-mono)",letterSpacing:"-0.2px"},children:s}),e.jsx("button",{type:"button","aria-label":`Remove ${s}`,disabled:m,onClick:n=>{n.stopPropagation(),E(a)},onMouseEnter:()=>k(a),onMouseLeave:()=>k(-1),style:{all:"unset",color:I===a?"var(--red)":"var(--text-tertiary)",cursor:m?"not-allowed":"pointer",fontSize:"12px",lineHeight:"1",transition:"color 0.15s"},children:"×"})]},`${s}-${a}`))}),e.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center"},children:[e.jsx("input",{ref:h,type:"text",value:p,onChange:s=>{w(s.target.value),b(null)},onKeyDown:P,onPaste:O,placeholder:d??"Add pattern…",disabled:m,"aria-invalid":S?!0:void 0,style:{flex:1,background:"var(--bg-glass)",border:"1px solid var(--border-glass)",color:"var(--text-primary)",fontSize:"var(--font-sm)",padding:"5px 10px",outline:"none",fontFamily:"var(--font-mono)"},onFocus:s=>{s.target.style.borderColor="var(--border-strong)"},onBlur:s=>{s.target.style.borderColor="var(--border-glass)"}}),e.jsx("button",{type:"button",disabled:m||!p.trim(),onClick:()=>D(p),style:{padding:"4px 10px",fontSize:"var(--font-sm)",minHeight:"auto",lineHeight:"1.4"},children:"Add"})]}),S&&e.jsx("div",{style:{fontSize:"var(--font-sm)",color:"var(--red)",marginTop:"4px"},children:S}),o&&e.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"var(--space-sm)"},children:[e.jsx("button",{type:"button",onClick:A,disabled:m,style:{padding:"4px 12px",fontSize:"var(--font-sm)",minHeight:"auto"},children:"Save"}),e.jsx("button",{type:"button",className:"btn-ghost",onClick:T,disabled:m,style:{padding:"4px 12px",fontSize:"var(--font-sm)",minHeight:"auto"},children:"Cancel"})]})]})}function J(l){if(!l)return[];try{return JSON.parse(l).map(String)}catch{return[]}}function ae({getLocal:l,getServer:g=()=>"",setLocal:c,saveConfig:d,cancelLocal:m=()=>{},onArraySave:i,extended:y}){const p=e.jsx("div",{className:"card-header",children:e.jsx("div",{className:"section-title",children:"Telegram"})}),w=e.jsx(e.Fragment,{children:e.jsxs("div",{style:{display:"grid",gap:"16px"},children:[y&&e.jsxs("div",{style:{display:"grid",gap:"12px"},children:[e.jsx(R,{label:"Bot Username",description:"Bot username without @",configKey:"telegram.bot_username",value:l("telegram.bot_username"),serverValue:g("telegram.bot_username"),onChange:t=>c("telegram.bot_username",t),onSave:t=>d("telegram.bot_username",t),onCancel:()=>m("telegram.bot_username")}),e.jsx(R,{label:"Owner Name",description:"Owner's first name (used in system prompt)",configKey:"telegram.owner_name",value:l("telegram.owner_name"),serverValue:g("telegram.owner_name"),onChange:t=>c("telegram.owner_name",t),onSave:t=>d("telegram.owner_name",t),onCancel:()=>m("telegram.owner_name")}),e.jsx(R,{label:"Owner Username",description:"Owner's Telegram username (without @)",configKey:"telegram.owner_username",value:l("telegram.owner_username"),serverValue:g("telegram.owner_username"),onChange:t=>c("telegram.owner_username",t),onSave:t=>d("telegram.owner_username",t),onCancel:()=>m("telegram.owner_username")}),e.jsx(R,{label:"Owner ID",description:"Primary admin Telegram user ID (auto-added to Admin IDs)",configKey:"telegram.owner_id",type:"text",value:l("telegram.owner_id"),serverValue:g("telegram.owner_id"),onChange:t=>c("telegram.owner_id",t),onSave:t=>d("telegram.owner_id",t),onCancel:()=>m("telegram.owner_id"),placeholder:"123456789"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px"},children:[e.jsxs("div",{className:"form-group",style:{marginBottom:0},children:[e.jsx("label",{children:e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:["DM Policy",e.jsx(M,{text:"Controls who can DM the agent. 'Open' = anyone, 'Allow Users' = only IDs in the allow list below, 'Admin Only' = only admins."})]})}),e.jsx(G,{value:l("telegram.dm_policy"),options:["admin-only","allowlist","open","disabled"],labels:["Admin Only","Allow Users","Open","Disabled"],onChange:t=>d("telegram.dm_policy",t)})]}),e.jsxs("div",{className:"form-group",style:{marginBottom:0},children:[e.jsx("label",{children:e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:["Group Policy",e.jsx(M,{text:"Controls which group chats the agent responds in. 'Open' = all groups, 'Allow Groups' = only IDs in the allow list, 'Admin Only' = only admin-owned groups."})]})}),e.jsx(G,{value:l("telegram.group_policy"),options:["admin-only","allowlist","open","disabled"],labels:["Admin Only","Allow Groups","Open","Disabled"],onChange:t=>d("telegram.group_policy",t)})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("label",{style:{fontSize:"13px",color:"var(--text-primary)",cursor:"pointer",display:"flex",alignItems:"center",gap:4},htmlFor:"require-mention",children:["Require Mention",e.jsx(M,{text:"When on, the agent ignores group messages unless it's @mentioned. Keeps it quiet in busy chats."})]}),e.jsxs("label",{className:"toggle",children:[e.jsx("input",{id:"require-mention",type:"checkbox",checked:l("telegram.require_mention")==="true",onChange:t=>d("telegram.require_mention",String(t.target.checked))}),e.jsx("span",{className:"toggle-track"}),e.jsx("span",{className:"toggle-thumb"})]})]}),y&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("label",{style:{fontSize:"13px",color:"var(--text-primary)",cursor:"pointer",display:"flex",alignItems:"center",gap:4},htmlFor:"typing-sim",children:["Typing Simulation",e.jsx(M,{text:"Shows a 'typing...' bubble in the chat before the agent replies, like a real person."})]}),e.jsxs("label",{className:"toggle",children:[e.jsx("input",{id:"typing-sim",type:"checkbox",checked:l("telegram.typing_simulation")==="true",onChange:t=>d("telegram.typing_simulation",String(t.target.checked))}),e.jsx("span",{className:"toggle-track"}),e.jsx("span",{className:"toggle-thumb"})]})]})]})}),S=e.jsx("div",{className:"card-header",children:e.jsx("div",{className:"section-title",children:"Advanced Telegram"})}),b=e.jsx(e.Fragment,{children:e.jsxs("div",{style:{display:"grid",gap:"16px"},children:[e.jsxs("div",{style:{display:"grid",gap:"12px"},children:[e.jsx(R,{label:"Debounce (ms)",description:"Group message debounce delay in ms (0 = disabled)",configKey:"telegram.debounce_ms",type:"number",value:l("telegram.debounce_ms"),serverValue:g("telegram.debounce_ms"),onChange:t=>c("telegram.debounce_ms",t),onSave:t=>d("telegram.debounce_ms",t),onCancel:()=>m("telegram.debounce_ms"),min:0,step:100,inline:!0}),e.jsx(R,{label:"Max Message Length",description:"Maximum message length in characters",configKey:"telegram.max_message_length",type:"number",value:l("telegram.max_message_length"),serverValue:g("telegram.max_message_length"),onChange:t=>c("telegram.max_message_length",t),onSave:t=>d("telegram.max_message_length",t),onCancel:()=>m("telegram.max_message_length"),min:1,step:100,inline:!0})]}),i&&e.jsxs("div",{style:{display:"grid",gap:"16px"},children:[e.jsxs("div",{className:"form-group",style:{marginBottom:0},children:[e.jsx("label",{children:e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:["Admin IDs",e.jsx(M,{text:"Telegram user IDs with full control: can use all tools, bypass restrictions, and manage the agent."})]})}),e.jsx($,{value:J(l("telegram.admin_ids")),onChange:t=>i("telegram.admin_ids",t),validate:t=>/^\d+$/.test(t)?null:"Must be a number",placeholder:"Enter ID..."})]}),e.jsxs("div",{className:"form-group",style:{marginBottom:0},children:[e.jsx("label",{children:e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:["Allowed Users",e.jsx(M,{text:"Telegram user IDs that can DM the agent when DM policy is set to 'Allow Users'."})]})}),e.jsx($,{value:J(l("telegram.allow_from")),onChange:t=>i("telegram.allow_from",t),validate:t=>/^\d+$/.test(t)?null:"Must be a number",placeholder:"Enter ID..."})]}),e.jsxs("div",{className:"form-group",style:{marginBottom:0},children:[e.jsx("label",{children:e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:["Allowed Groups",e.jsx(M,{text:"Group/channel IDs where the agent can respond when group policy is set to 'Allow Groups'."})]})}),e.jsx($,{value:J(l("telegram.group_allow_from")),onChange:t=>i("telegram.group_allow_from",t),validate:t=>/^\d+$/.test(t)?null:"Must be a number",placeholder:"Enter ID..."})]})]}),e.jsxs("div",{style:{display:"grid",gap:"12px"},children:[e.jsx(R,{label:"Rate Limit · Messages/sec",description:"Rate limit: messages per second (requires restart)",configKey:"telegram.rate_limit_messages_per_second",type:"number",value:l("telegram.rate_limit_messages_per_second"),serverValue:g("telegram.rate_limit_messages_per_second"),onChange:t=>c("telegram.rate_limit_messages_per_second",t),onSave:t=>d("telegram.rate_limit_messages_per_second",t),onCancel:()=>m("telegram.rate_limit_messages_per_second"),hotReload:"restart",min:0,step:.1,inline:!0}),e.jsx(R,{label:"Rate Limit · Groups/min",description:"Rate limit: groups per minute (requires restart)",configKey:"telegram.rate_limit_groups_per_minute",type:"number",value:l("telegram.rate_limit_groups_per_minute"),serverValue:g("telegram.rate_limit_groups_per_minute"),onChange:t=>c("telegram.rate_limit_groups_per_minute",t),onSave:t=>d("telegram.rate_limit_groups_per_minute",t),onCancel:()=>m("telegram.rate_limit_groups_per_minute"),hotReload:"restart",min:1,inline:!0})]})]})});return y?e.jsxs(e.Fragment,{children:[p,e.jsx("div",{className:"card",children:w}),S,e.jsx("div",{className:"card",children:b})]}):e.jsxs(e.Fragment,{children:[p,w]})}export{se as A,R as E,M as I,ae as T,$ as a,re as u};