kcode-cli 1.3.21 → 1.3.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +187 -0
- package/dist/cli.js +85 -6
- package/dist/web/assets/{dialog-XMzptB8h.js → dialog-CteKqVmT.js} +1 -1
- package/dist/web/assets/{dialog-fork-D6v09HNl.js → dialog-fork-B3LXJpJh.js} +1 -1
- package/dist/web/assets/{dialog-manage-models-Bm6CtoIz.js → dialog-manage-models-5xQ1zR-B.js} +2 -2
- package/dist/web/assets/{dialog-model-config-gyTP8r4J.js → dialog-model-config-B47APffm.js} +2 -2
- package/dist/web/assets/{dialog-select-file-Dknr4kkI.js → dialog-select-file-wI0iGY1t.js} +1 -1
- package/dist/web/assets/{dialog-select-mcp-Cu7sZ2gM.js → dialog-select-mcp-BM9RTM96.js} +1 -1
- package/dist/web/assets/{ghostty-web-CQPt5osq.js → ghostty-web-BdZkvDED.js} +1 -1
- package/dist/web/assets/{home-DAGgJkXQ.js → home-pMJc-Y7o.js} +1 -1
- package/dist/web/assets/{index-0V_fi__s.js → index-BAnxnkd7.js} +33 -33
- package/dist/web/assets/{session-C8MftpUd.js → session-ClhjIKqG.js} +8 -8
- package/dist/web/e2e-bootstrap.html +65 -0
- package/dist/web/index.html +1 -1
- package/package.json +3 -2
- package/dist/cli.js.map +0 -7
package/README.md
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
# KCode CLI
|
|
2
|
+
|
|
3
|
+
`kcode-cli` 用来启动本地 KCode 服务。默认模式下会同时提供内置的 Web UI,因此安装后通常只需要执行一个命令就能开始使用。
|
|
4
|
+
|
|
5
|
+
## 环境要求
|
|
6
|
+
|
|
7
|
+
- Node.js `>= 20`
|
|
8
|
+
|
|
9
|
+
## 安装
|
|
10
|
+
|
|
11
|
+
全局安装:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install -g kcode-cli
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
安装完成后可直接使用:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
kcode --help
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
如果只是临时运行一次,也可以使用:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npx kcode-cli --help
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 最快启动
|
|
30
|
+
|
|
31
|
+
在当前目录启动 API 和内置 Web UI:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
kcode
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
这等价于:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
kcode web
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
默认值:
|
|
44
|
+
|
|
45
|
+
- Host: `127.0.0.1`
|
|
46
|
+
- Port: `4096`
|
|
47
|
+
- Directory: 当前工作目录
|
|
48
|
+
|
|
49
|
+
## 启动模式
|
|
50
|
+
|
|
51
|
+
### `kcode`
|
|
52
|
+
|
|
53
|
+
默认等价于 `kcode web`,会同时启动:
|
|
54
|
+
|
|
55
|
+
- 本地 API 服务
|
|
56
|
+
- 内置 Web UI
|
|
57
|
+
|
|
58
|
+
适合直接在浏览器里使用 KCode。
|
|
59
|
+
|
|
60
|
+
### `kcode serve`
|
|
61
|
+
|
|
62
|
+
只启动 API 服务,不挂载内置 Web UI。
|
|
63
|
+
|
|
64
|
+
适合:
|
|
65
|
+
|
|
66
|
+
- 只把 KCode 当本地后端使用
|
|
67
|
+
- 由自己的客户端或脚本连接 API
|
|
68
|
+
- 需要把 Web UI 与 API 分开处理
|
|
69
|
+
|
|
70
|
+
## 常见场景
|
|
71
|
+
|
|
72
|
+
### 在当前目录直接使用
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
kcode
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 打开指定项目目录
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
kcode --directory E:\project\demo
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 只启动 API
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
kcode serve
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 改端口运行
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
kcode --port 4310
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 对局域网开放
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
kcode --hostname 0.0.0.0 --port 4310
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
如果要从其他设备访问,请在浏览器里使用这台机器的实际 IP,例如 `http://192.168.1.10:4310`。
|
|
103
|
+
|
|
104
|
+
### 同时指定目录、主机和端口
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
kcode web --directory E:\project\demo --hostname 127.0.0.1 --port 4310
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## 命令与参数
|
|
111
|
+
|
|
112
|
+
```text
|
|
113
|
+
Usage: kcode [web|serve] [options]
|
|
114
|
+
|
|
115
|
+
Commands:
|
|
116
|
+
web Start the API and bundled web UI (default)
|
|
117
|
+
serve Start the API only
|
|
118
|
+
|
|
119
|
+
Options:
|
|
120
|
+
--hostname <host> Bind address (default: 127.0.0.1)
|
|
121
|
+
--port <port> Bind port (default: 4096)
|
|
122
|
+
--directory <path> Override project directory (default: current working directory)
|
|
123
|
+
--log-level <level> Accepted for SDK compatibility
|
|
124
|
+
-h, --help Show this message
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
支持两种写法:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
kcode --port 4310
|
|
131
|
+
kcode --port=4310
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## 环境变量
|
|
135
|
+
|
|
136
|
+
可以用环境变量设置默认值:
|
|
137
|
+
|
|
138
|
+
| 变量 | 默认值 | 作用 |
|
|
139
|
+
| ---- | ------ | ---- |
|
|
140
|
+
| `KCODE_DIRECTORY` | 当前工作目录 | 默认项目目录 |
|
|
141
|
+
| `KCODE_SERVER_HOST` | `127.0.0.1` | 默认监听地址 |
|
|
142
|
+
| `KCODE_SERVER_PORT` | `4096` | 默认监听端口 |
|
|
143
|
+
|
|
144
|
+
优先级如下:
|
|
145
|
+
|
|
146
|
+
1. CLI 参数
|
|
147
|
+
2. 环境变量
|
|
148
|
+
3. 内置默认值
|
|
149
|
+
|
|
150
|
+
示例:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
KCODE_DIRECTORY=E:\project\demo KCODE_SERVER_PORT=4310 kcode
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## 默认行为
|
|
157
|
+
|
|
158
|
+
- 不传子命令时,默认使用 `web` 模式
|
|
159
|
+
- 不传 `--directory` 时,使用当前工作目录
|
|
160
|
+
- 不传 `--hostname` 时,使用 `127.0.0.1`
|
|
161
|
+
- 不传 `--port` 时,使用 `4096`
|
|
162
|
+
- `--log-level` 当前仅用于 SDK 兼容,不会改变 CLI 输出行为
|
|
163
|
+
|
|
164
|
+
## 排查
|
|
165
|
+
|
|
166
|
+
### 端口被占用
|
|
167
|
+
|
|
168
|
+
换一个端口重试:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
kcode --port 4310
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### 想确认实际参数
|
|
175
|
+
|
|
176
|
+
先看帮助:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
kcode --help
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 需要仓库源码或开发说明
|
|
183
|
+
|
|
184
|
+
如果你是在仓库源码里阅读这份文件,可以继续看:
|
|
185
|
+
|
|
186
|
+
- 根目录 `README.md`
|
|
187
|
+
- `docs/README.md`
|
package/dist/cli.js
CHANGED
|
@@ -122659,6 +122659,84 @@ function formatHelp() {
|
|
|
122659
122659
|
].join("\n");
|
|
122660
122660
|
}
|
|
122661
122661
|
|
|
122662
|
+
// src/startup-output.ts
|
|
122663
|
+
var COLORS = {
|
|
122664
|
+
badge: [213, 162, 106],
|
|
122665
|
+
label: [145, 163, 184],
|
|
122666
|
+
logoAccent: [213, 162, 106],
|
|
122667
|
+
logoStrong: [130, 175, 216],
|
|
122668
|
+
logoWeak: [91, 126, 164],
|
|
122669
|
+
title: [237, 243, 250],
|
|
122670
|
+
value: [157, 193, 231]
|
|
122671
|
+
};
|
|
122672
|
+
function createAnsiStyle(color, options2 = {}) {
|
|
122673
|
+
const prefixes = [];
|
|
122674
|
+
if (options2.bold) {
|
|
122675
|
+
prefixes.push("\x1B[1m");
|
|
122676
|
+
}
|
|
122677
|
+
if (options2.dim) {
|
|
122678
|
+
prefixes.push("\x1B[2m");
|
|
122679
|
+
}
|
|
122680
|
+
prefixes.push(`\x1B[38;2;${color[0]};${color[1]};${color[2]}m`);
|
|
122681
|
+
return (value) => `${prefixes.join("")}${value}\x1B[0m`;
|
|
122682
|
+
}
|
|
122683
|
+
function buildPlainLines(input) {
|
|
122684
|
+
const lines = [`KCode [${input.mode}]`, `server: ${input.address}`, `directory: ${input.defaultDirectory}`];
|
|
122685
|
+
if (input.mode === "web") {
|
|
122686
|
+
lines.push(`web: ${input.address}`);
|
|
122687
|
+
}
|
|
122688
|
+
return lines;
|
|
122689
|
+
}
|
|
122690
|
+
function buildRichLines(input) {
|
|
122691
|
+
const logo = [
|
|
122692
|
+
createAnsiStyle(COLORS.logoStrong, { bold: true })("|\\ ".padEnd(3)),
|
|
122693
|
+
createAnsiStyle(COLORS.logoAccent, { bold: true })("| >"),
|
|
122694
|
+
createAnsiStyle(COLORS.logoWeak, { bold: true })("|/ ".padEnd(3))
|
|
122695
|
+
];
|
|
122696
|
+
const title = createAnsiStyle(COLORS.title, { bold: true })("KCode");
|
|
122697
|
+
const badge = createAnsiStyle(COLORS.badge, { bold: true })(`[${input.mode}]`);
|
|
122698
|
+
const label = createAnsiStyle(COLORS.label, { dim: true });
|
|
122699
|
+
const value = createAnsiStyle(COLORS.value, { bold: true });
|
|
122700
|
+
const lines = [
|
|
122701
|
+
`${logo[0]} ${title} ${badge}`,
|
|
122702
|
+
`${logo[1]} ${label("server".padEnd(9))} ${value(input.address)}`,
|
|
122703
|
+
`${logo[2]} ${label("directory".padEnd(9))} ${value(input.defaultDirectory)}`
|
|
122704
|
+
];
|
|
122705
|
+
if (input.mode === "web") {
|
|
122706
|
+
lines.push(`${" ".repeat(5)}${label("web".padEnd(9))} ${value(input.address)}`);
|
|
122707
|
+
}
|
|
122708
|
+
return lines;
|
|
122709
|
+
}
|
|
122710
|
+
function supportsRichStartupOutput(env = process.env, output2 = process.stdout) {
|
|
122711
|
+
if (output2.isTTY !== true) {
|
|
122712
|
+
return false;
|
|
122713
|
+
}
|
|
122714
|
+
if ((env.TERM ?? "").toLowerCase() === "dumb") {
|
|
122715
|
+
return false;
|
|
122716
|
+
}
|
|
122717
|
+
if ("NO_COLOR" in env) {
|
|
122718
|
+
return false;
|
|
122719
|
+
}
|
|
122720
|
+
if (env.FORCE_COLOR === "0") {
|
|
122721
|
+
return false;
|
|
122722
|
+
}
|
|
122723
|
+
return true;
|
|
122724
|
+
}
|
|
122725
|
+
function formatPlainStartupOutput(input) {
|
|
122726
|
+
return buildPlainLines(input).join("\n");
|
|
122727
|
+
}
|
|
122728
|
+
function formatRichStartupOutput(input) {
|
|
122729
|
+
return buildRichLines(input).join("\n");
|
|
122730
|
+
}
|
|
122731
|
+
function formatStartupOutput(input, options2 = {}) {
|
|
122732
|
+
const env = options2.env ?? process.env;
|
|
122733
|
+
const output2 = { isTTY: options2.isTTY ?? process.stdout.isTTY };
|
|
122734
|
+
if (!supportsRichStartupOutput(env, output2)) {
|
|
122735
|
+
return formatPlainStartupOutput(input);
|
|
122736
|
+
}
|
|
122737
|
+
return formatRichStartupOutput(input);
|
|
122738
|
+
}
|
|
122739
|
+
|
|
122662
122740
|
// src/cli.ts
|
|
122663
122741
|
function addCandidate(set2, input) {
|
|
122664
122742
|
if (!input) {
|
|
@@ -122728,11 +122806,13 @@ async function main() {
|
|
|
122728
122806
|
port: input.port,
|
|
122729
122807
|
quiet: true
|
|
122730
122808
|
});
|
|
122731
|
-
console.log(
|
|
122732
|
-
|
|
122733
|
-
|
|
122734
|
-
|
|
122735
|
-
|
|
122809
|
+
console.log(
|
|
122810
|
+
formatStartupOutput({
|
|
122811
|
+
address,
|
|
122812
|
+
defaultDirectory: runtime.DEFAULT_DIRECTORY,
|
|
122813
|
+
mode: input.mode
|
|
122814
|
+
})
|
|
122815
|
+
);
|
|
122736
122816
|
} catch (error2) {
|
|
122737
122817
|
const message2 = error2 instanceof Error ? error2.message : String(error2);
|
|
122738
122818
|
console.error(`[kcode] ${message2}`);
|
|
@@ -122752,4 +122832,3 @@ undici/lib/web/websocket/frame.js:
|
|
|
122752
122832
|
chokidar/esm/index.js:
|
|
122753
122833
|
(*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) *)
|
|
122754
122834
|
*/
|
|
122755
|
-
//# sourceMappingURL=cli.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{k as r,i as a,S as d,bz as l,a2 as f,a3 as g,a_ as m,l as w,X as c,t as u,b5 as b}from"./index-
|
|
1
|
+
import{k as r,i as a,S as d,bz as l,a2 as f,a3 as g,a_ as m,l as w,X as c,t as u,b5 as b}from"./index-BAnxnkd7.js";var D=u("<div data-slot=dialog-header>"),_=u("<div data-slot=dialog-body>"),$=u("<div data-component=dialog><div data-slot=dialog-container>");function S(t){const h=b();return(()=>{var n=$(),v=n.firstChild;return r(v,a(l.Content,{"data-slot":"dialog-content",get"data-no-header"(){return!t.title&&!t.action?"":void 0},get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},onOpenAutoFocus:e=>{const i=e.currentTarget?.querySelector("[autofocus]");i&&(e.preventDefault(),i.focus())},get children(){return[a(d,{get when(){return t.title||t.action},get children(){var e=D();return r(e,a(d,{get when(){return t.title},get children(){return a(l.Title,{"data-slot":"dialog-title",get children(){return t.title}})}}),null),r(e,a(f,{get children(){return[a(g,{get when(){return t.action},get children(){return t.action}}),a(g,{when:!0,get children(){return a(l.CloseButton,{"data-slot":"dialog-close-button",as:m,icon:"close",variant:"ghost",get"aria-label"(){return h.t("ui.common.close")}})}})]}}),null),e}}),a(d,{get when(){return t.description},get children(){return a(l.Description,{"data-slot":"dialog-description",style:{"margin-left":"-4px"},get children(){return t.description}})}}),(()=>{var e=_();return r(e,()=>t.children),e})()]}})),w(e=>{var o=t.fit?!0:void 0,i=t.size||"normal",s=t.transition?!0:void 0;return o!==e.e&&c(n,"data-fit",e.e=o),i!==e.t&&c(n,"data-size",e.t=i),s!==e.a&&c(n,"data-transition",e.a=s),e},{e:void 0,t:void 0,a:void 0}),n})()}export{S as D};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aN as D,a as v,aT as S,aR as k,bf as b,bj as _,c as $,i as d,k as u,d as w,b1 as g,t as P,b0 as F}from"./index-
|
|
1
|
+
import{aN as D,a as v,aT as S,aR as k,bf as b,bj as _,c as $,i as d,k as u,d as w,b1 as g,t as P,b0 as F}from"./index-BAnxnkd7.js";import{D as L}from"./dialog-CteKqVmT.js";import{L as T,e as I}from"./session-ClhjIKqG.js";var q=P('<div class="w-full flex items-center gap-2"><span class="truncate flex-1 min-w-0 text-left font-normal"></span><span class="text-text-weak shrink-0 font-normal">');function C(i){return i.toLocaleTimeString(void 0,{timeStyle:"short"})}const N=()=>{const i=D(),p=v(),c=S(),l=k(),f=b(),h=_(),o=F(),x=$(()=>{const t=i.id;if(!t)return[];const a=c.data.message[t]??[],r=[];for(const s of a){if(s.role!=="user")continue;const e=(c.data.part[s.id]??[]).find(n=>n.type==="text"&&!n.synthetic&&!n.ignored);e&&r.push({id:s.id,text:e.text.replace(/\n/g," ").slice(0,200),time:C(new Date(s.time.created))})}return r.reverse()}),y=t=>{if(!t)return;const a=i.id;if(!a)return;const r=c.data.part[t.id]??[],s=I(r,{directory:l.directory}),m=w(l.directory);l.client.session.fork({sessionID:a,messageID:t.id}).then(e=>{if(!e.data){g({title:o.t("common.requestFailed")});return}h.close(),f.set(s,void 0,{dir:m,id:e.data.id}),p(`/${m}/session/${e.data.id}`)}).catch(e=>{const n=e instanceof Error?e.message:String(e);g({title:o.t("common.requestFailed"),description:n})})};return d(L,{get title(){return o.t("command.session.fork")},get children(){return d(T,{class:"flex-1 min-h-0 [&_[data-slot=list-scroll]]:flex-1 [&_[data-slot=list-scroll]]:min-h-0",get search(){return{placeholder:o.t("common.search.placeholder"),autofocus:!0}},get emptyMessage(){return o.t("dialog.fork.empty")},key:t=>t.id,items:x,filterKeys:["text"],onSelect:y,children:t=>(()=>{var a=q(),r=a.firstChild,s=r.nextSibling;return u(r,()=>t.text),u(s,()=>t.time),a})()})}})};export{N as DialogFork};
|
package/dist/web/assets/{dialog-manage-models-Bm6CtoIz.js → dialog-manage-models-5xQ1zR-B.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dialog-model-config-
|
|
2
|
-
import{k as m,t as f,bj as h,u as I,c as D,i as c,S as W,V as $,as as u,l as z,X as C,b0 as L,bk as N,b1 as M}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dialog-model-config-B47APffm.js","assets/index-BAnxnkd7.js","assets/index-eOIcRPgw.css","assets/dialog-CteKqVmT.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{k as m,t as f,bj as h,u as I,c as D,i as c,S as W,V as $,as as u,l as z,X as C,b0 as L,bk as N,b1 as M}from"./index-BAnxnkd7.js";import{D as E}from"./dialog-CteKqVmT.js";var R=f('<div class="bg-surface-base px-4 rounded-lg">');const U=e=>(()=>{var t=R();return m(t,()=>e.children),t})(),x=1e3,b=128,v=b*x;function S(e){return e.replace(/\/+$/,"")}function w(e){const t=typeof e=="number"?Math.trunc(e):Number.NaN;return Number.isInteger(t)&&t>=v?t:v}function X(e){return String(Math.round(w(e)/x))}function T(e){return Array.isArray(e?.model_configs)?e.model_configs.flatMap(t=>{if(!t||typeof t!="object")return[];const r=typeof t.id=="string"?t.id.trim():"",n=typeof t.modelID=="string"?t.modelID.trim():"",s=typeof t.name=="string"?t.name.trim():"",i=typeof t.baseURL=="string"?S(t.baseURL.trim()):"",a=typeof t.apiKey=="string"?t.apiKey.trim():"",o=w(t.contextWindowSize);return!r||!n||!s||!i||!a?[]:[{id:r,modelID:n,name:s,baseURL:i,apiKey:a,contextWindowSize:o}]}):[]}function F(e){const t=e.form.modelID.trim(),r=e.form.name.trim(),n=S(e.form.baseURL.trim()),s=e.form.apiKey.trim(),i=e.form.contextWindowSize.trim(),a=/^\d+$/.test(i)?Number(i):Number.NaN,o={modelID:t?void 0:e.t("model.config.error.modelID.required"),name:r?void 0:e.t("model.config.error.name.required"),baseURL:n?/^https?:\/\//i.test(n)?void 0:e.t("model.config.error.baseURL.format"):e.t("model.config.error.baseURL.required"),apiKey:s?void 0:e.t("model.config.error.apiKey.required"),contextWindowSize:i?Number.isSafeInteger(a)?a<b?e.t("model.config.error.contextWindowSize.min",{min:b}):void 0:e.t("model.config.error.contextWindowSize.integer"):e.t("model.config.error.contextWindowSize.required")};return o.modelID||o.name||o.baseURL||o.apiKey||o.contextWindowSize?{err:o}:{err:o,result:{modelID:t,name:r,baseURL:n,apiKey:s,contextWindowSize:a*x}}}function k(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"model"}function Z(e){const t=new Set(e.existing.map(i=>i.id).filter(i=>i!==e.currentID)),r=k(e.modelID);let n=r,s=2;for(;t.has(n);)n=`${r}-${s++}`;return n}var K=f('<div class="px-2.5 pb-3 overflow-y-auto max-h-[60vh]">'),O=f('<div class="py-4 text-14-regular text-text-weak">'),q=f('<div class="flex flex-wrap items-center justify-between gap-4 min-h-16 py-3 border-b border-border-weak-base last:border-none"data-component=model-config-row><div class="flex flex-col min-w-0"><span class="text-14-medium text-text-strong"></span><span class="text-12-regular text-text-weak"></span><span class="text-12-regular text-text-weak truncate"></span></div><div class="flex items-center gap-1">');const j=()=>{const e=h(),t=I(),r=L(),n=D(()=>T(t.data.config)),s=a=>{const o=n().find(l=>l.id===a);N(()=>import("./dialog-model-config-B47APffm.js"),__vite__mapDeps([0,1,2,3])).then(l=>{e.show(()=>c(l.DialogModelConfig,{item:o}))})},i=async a=>{const o=n(),l=o.filter(d=>d.id!==a);t.set("config","model_configs",l);try{await t.updateConfig({model_configs:l})}catch(d){t.set("config","model_configs",o);const g=d instanceof Error?d.message:String(d);M({title:r.t("common.requestFailed"),description:g})}};return c(E,{get title(){return r.t("dialog.model.manage")},get description(){return r.t("dialog.model.manage.description")},get action(){return c(u,{class:"h-7 -my-1 text-14-medium",icon:"plus-small",tabIndex:-1,onClick:()=>s(),get children(){return r.t("common.add")}})},transition:!0,get children(){var a=K();return m(a,c(U,{get children(){return c(W,{get when(){return n().length>0},get fallback(){return(()=>{var o=O();return m(o,()=>r.t("dialog.model.manage.empty")),o})()},get children(){return c($,{get each(){return n()},children:o=>(()=>{var l=q(),d=l.firstChild,g=d.firstChild,p=g.nextSibling,y=p.nextSibling,_=d.nextSibling;return m(g,()=>o.name),m(p,()=>o.modelID),m(y,()=>o.baseURL),m(_,c(u,{size:"large",variant:"ghost",onClick:()=>s(o.id),get children(){return r.t("common.edit")}}),null),m(_,c(u,{size:"large",variant:"ghost",onClick:()=>void i(o.id),get children(){return r.t("common.delete")}}),null),z(()=>C(l,"data-model-config-id",o.id)),l})()})}})}})),a}})},B=Object.freeze(Object.defineProperty({__proto__:null,DialogManageModels:j},Symbol.toStringTag,{value:"Module"}));export{Z as a,B as d,X as f,T as r,F as v};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dialog-manage-models-
|
|
2
|
-
import{bj as I,u as C,h as x,i as r,k as d,j as S,bi as m,as as z,a_ as L,t as W,b0 as K,b1 as R,bk as U}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dialog-manage-models-5xQ1zR-B.js","assets/index-BAnxnkd7.js","assets/index-eOIcRPgw.css","assets/dialog-CteKqVmT.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{bj as I,u as C,h as x,i as r,k as d,j as S,bi as m,as as z,a_ as L,t as W,b0 as K,b1 as R,bk as U}from"./index-BAnxnkd7.js";import{D as M}from"./dialog-CteKqVmT.js";import{f as $,v as k,a as B,r as E}from"./dialog-manage-models-5xQ1zR-B.js";var F=W('<div class="flex flex-col gap-6 px-2.5 pb-3 overflow-y-auto max-h-[60vh]"><div class=px-2.5><div class="text-16-medium text-text-strong"></div></div><form class="px-2.5 pb-6 flex flex-col gap-4">');function q(i){const D=I(),u=C(),e=K(),[t,f]=x({modelID:i.item?.modelID??"",name:i.item?.name??"",baseURL:i.item?.baseURL??"",apiKey:i.item?.apiKey??"",contextWindowSize:$(i.item?.contextWindowSize),err:{}}),[v,b]=x({saving:!1}),_=()=>E(u.data.config),p=()=>{U(()=>import("./dialog-manage-models-5xQ1zR-B.js").then(o=>o.d),__vite__mapDeps([0,1,2,3])).then(o=>{D.show(()=>r(o.DialogManageModels,{}))})},g=(o,l)=>{f(o,l),f("err",o,void 0)},w=async o=>{if(o.preventDefault(),v.saving)return;const l=k({form:t,t:e.t});f("err",l.err);const c="result"in l?l.result:void 0;if(!c)return;const a=_(),n={id:B({modelID:c.modelID,existing:a,currentID:i.item?.id}),...c},h=i.item?a.map(s=>s.id===i.item?.id?n:s):[...a,n];u.set("config","model_configs",h),b("saving",!0);try{await u.updateConfig({model_configs:h}),p()}catch(s){u.set("config","model_configs",a);const y=s instanceof Error?s.message:String(s);R({title:e.t("common.requestFailed"),description:y})}finally{b("saving",!1)}};return r(M,{get title(){return r(L,{tabIndex:-1,icon:"arrow-left",variant:"ghost",onClick:p,get"aria-label"(){return e.t("common.goBack")}})},transition:!0,get children(){var o=F(),l=o.firstChild,c=l.firstChild,a=l.nextSibling;return d(c,(()=>{var n=S(()=>!!i.item);return()=>n()?e.t("dialog.model.manage.edit"):e.t("dialog.model.manage.add")})()),a.addEventListener("submit",w),d(a,r(m,{autofocus:!0,get label(){return e.t("model.config.field.modelID.label")},get placeholder(){return e.t("model.config.field.modelID.placeholder")},get value(){return t.modelID},onChange:n=>g("modelID",n),get validationState(){return t.err.modelID?"invalid":void 0},get error(){return t.err.modelID}}),null),d(a,r(m,{get label(){return e.t("model.config.field.name.label")},get placeholder(){return e.t("model.config.field.name.placeholder")},get value(){return t.name},onChange:n=>g("name",n),get validationState(){return t.err.name?"invalid":void 0},get error(){return t.err.name}}),null),d(a,r(m,{get label(){return e.t("model.config.field.baseURL.label")},get placeholder(){return e.t("model.config.field.baseURL.placeholder")},get value(){return t.baseURL},onChange:n=>g("baseURL",n),get validationState(){return t.err.baseURL?"invalid":void 0},get error(){return t.err.baseURL}}),null),d(a,r(m,{get label(){return e.t("model.config.field.apiKey.label")},get placeholder(){return e.t("model.config.field.apiKey.placeholder")},get value(){return t.apiKey},onChange:n=>g("apiKey",n),get validationState(){return t.err.apiKey?"invalid":void 0},get error(){return t.err.apiKey}}),null),d(a,r(m,{type:"number",min:128,step:1,inputMode:"numeric",get label(){return e.t("model.config.field.contextWindowSize.label")},get description(){return e.t("model.config.field.contextWindowSize.description")},get placeholder(){return e.t("model.config.field.contextWindowSize.placeholder")},get value(){return t.contextWindowSize},onChange:n=>g("contextWindowSize",n),get validationState(){return t.err.contextWindowSize?"invalid":void 0},get error(){return t.err.contextWindowSize}}),null),d(a,r(z,{class:"w-auto self-start mt-2",type:"submit",size:"large",variant:"primary",get disabled(){return v.saving},get children(){return S(()=>!!v.saving)()?e.t("common.saving"):e.t("common.save")}}),null),o}})}export{q as DialogModelConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aO as Q,aM as U,b9 as X,bj as Z,a as ee,bE as te,u as ne,g as se,c as b,o as re,i as v,aV as ae,a2 as oe,a3 as O,k as p,S as F,at as ie,l as j,bd as ce,ba as P,b0 as le,d as de,t as k}from"./index-
|
|
1
|
+
import{aO as Q,aM as U,b9 as X,bj as Z,a as ee,bE as te,u as ne,g as se,c as b,o as re,i as v,aV as ae,a2 as oe,a3 as O,k as p,S as F,at as ie,l as j,bd as ce,ba as P,b0 as le,d as de,t as k}from"./index-BAnxnkd7.js";import{D as ue}from"./dialog-CteKqVmT.js";import{u as fe,c as ge,L as he,F as me}from"./session-ClhjIKqG.js";function pe(t,n){const i=new Date(t),s=new Date().getTime()-i.getTime(),c=Math.floor(s/1e3),d=Math.floor(c/60),a=Math.floor(d/60),u=Math.floor(a/24);return c<60?n("common.time.justNow"):d<60?n("common.time.minutesAgo.short",{count:d}):a<24?n("common.time.hoursAgo.short",{count:a}):n("common.time.daysAgo.short",{count:u})}var A=k('<span class="text-14-regular text-text-weak truncate">'),we=k('<div class="w-full flex items-center gap-4"><div class="flex items-center gap-2 min-w-0"><span class="text-14-regular text-text-strong whitespace-nowrap">'),ye=k('<span class="text-12-regular text-text-weak whitespace-nowrap ml-2">'),ve=k('<div class="w-full flex items-center justify-between rounded-md pl-1"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center gap-2 min-w-0"><span class="text-14-regular text-text-strong truncate">'),be=k('<div class="w-full flex items-center justify-between rounded-md pl-1"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center text-14-regular"><span class="text-text-weak whitespace-nowrap overflow-hidden overflow-ellipsis truncate min-w-0"></span><span class="text-text-strong whitespace-nowrap">');const T=5,xe=["session.new","session.previous","session.next","terminal.toggle","review.toggle"],N=t=>{const n=new Set,i=[];for(const f of t)n.has(f.id)||(n.add(f.id),i.push(f));return i},q=(t,n)=>({id:"command:"+t.id,type:"command",title:t.title,description:t.description,category:n,option:t}),D=(t,n)=>({id:"file:"+t,type:"file",title:t,category:n,path:t}),Se=(t,n)=>({id:`session:${t.directory}:${t.id}`,type:"session",title:t.title,description:t.description,category:n,directory:t.directory,sessionID:t.id,archived:t.archived,updated:t.updated});function $e(t){const n=b(()=>t.filesOnly()?[]:t.command.options.filter(s=>!s.disabled&&!s.id.startsWith("suggested.")&&s.id!=="file.open")),i=b(()=>{const s=t.language.t("palette.group.commands");return n().map(c=>q(c,s))}),f=b(()=>{const s=n(),c=new Map(xe.map((o,l)=>[o,l])),d=s.filter(o=>c.has(o.id)),a=d.length?d:s.slice(0,T),u=d.length?[...a].sort((o,l)=>(c.get(o.id)??0)-(c.get(l.id)??0)):a,y=t.language.t("palette.group.commands");return u.map(o=>q(o,y))});return{allowed:n,list:i,picks:f}}function _e(t){const n=ge({tabs:t.tabs,pathFromTab:t.file.pathFromTab,normalizeTab:s=>s.startsWith("file://")?t.file.tab(s):s}),i=b(()=>{const s=n.openedTabs(),c=n.activeFileTab(),d=c?[c,...s.filter(o=>o!==c)]:s,a=new Set,u=t.language.t("palette.group.files"),y=[];for(const o of d){const l=t.file.pathFromTab(o);l&&(a.has(l)||(a.add(l),y.push(D(l,u))))}return y.slice(0,T)}),f=b(()=>{const s=t.language.t("palette.group.files");return t.file.tree.children("").filter(a=>a.type==="file").map(a=>a.path).sort((a,u)=>a.localeCompare(u)).slice(0,T).map(a=>D(a,s))});return{recent:i,root:f}}function ke(t){const n={token:0,inflight:void 0,cached:void 0};return{sessions:f=>{if(!f.trim())return n.token+=1,n.inflight=void 0,n.cached=void 0,[];if(n.cached)return n.cached;if(n.inflight)return n.inflight;const c=n.token,d=t.directories();return d.length===0?[]:(n.inflight=Promise.all(d.map(a=>{const u=t.label(a);return t.globalSDK.client.session.list({directory:a,roots:!0}).then(y=>(y.data??[]).filter(o=>!!o?.id).map(o=>({id:o.id,title:o.title??t.language.t("command.session.new"),description:u,directory:a,archived:o.time?.archived,updated:o.time?.updated}))).catch(()=>[])})).then(a=>{if(n.token!==c)return[];const u=new Set,y=t.language.t("command.category.session"),o=a.flat().filter(l=>{const x=`${l.directory}:${l.id}`;return u.has(x)?!1:(u.add(x),!0)}).map(l=>Se(l,y));return n.cached=o,o}).catch(()=>[]).finally(()=>{n.inflight=void 0}),n.inflight)}}}function Fe(t){const n=Q(),i=le(),f=U(),s=X(),c=Z(),d=ee(),a=te(),u=ne(),{params:y,tabs:o,view:l}=fe(),x=()=>t.mode==="files",S={cleanup:void 0,committed:!1},[K,z]=se(!1),E=$e({filesOnly:x,command:n,language:i}),_=_e({file:s,tabs:o,language:i}),I=b(()=>ae(y.dir)??""),L=b(()=>{const e=I();if(e)return f.projects.list().find(r=>r.worktree===e)}),G=b(()=>{const e=I(),r=L();return r?[r.worktree]:e?[e]:[]}),R=b(()=>u.data.path.home),H=e=>{const r=L();if(r?.name)return r.name;const[h]=u.child(e,{bootstrap:!1}),g=R(),m=g?e.replace(g,"~"):e;return(h.vcs?.branch??P(e))||m},{sessions:W}=ke({directories:G,label:H,globalSDK:a,language:i}),B=async e=>{const r=e.trim();if(z(r.length>0),!r&&x()){const $=s.tree.state("")?.loaded,C=$?Promise.resolve():s.tree.list(""),M=N([..._.recent(),..._.root()]);return $||M.length>0?M:(await C,N([..._.recent(),..._.root()]))}if(!r)return[...E.picks(),..._.recent()];if(x()){const $=await s.searchFiles(r),C=i.t("palette.group.files");return $.map(M=>D(M,C))}const[h,g]=await Promise.all([s.searchFiles(r),Promise.resolve(W(r))]),m=i.t("palette.group.files"),w=h.map($=>D($,m));return[...E.list(),...g,...w]},V=e=>{S.cleanup?.(),e&&e.type==="command"&&(S.cleanup=e.option?.onHighlight?.())},Y=e=>{const r=s.tab(e);o().open(r),s.load(e),l().reviewPanel.opened()||l().reviewPanel.open(),f.fileTree.setTab("all"),t.onOpenFile?.(e),o().setActive(r)},J=e=>{if(e){if(S.committed=!0,S.cleanup=void 0,c.close(),e.type==="command"){e.option?.onSelect?.("palette");return}if(e.type==="session"){if(!e.directory||!e.sessionID)return;d(`/${de(e.directory)}/session/${e.sessionID}`);return}e.path&&Y(e.path)}};return re(()=>{S.committed||S.cleanup?.()}),v(ue,{class:"pt-3 pb-0 !max-h-[480px]",transition:!0,get children(){return v(he,{get search(){return{placeholder:x()?i.t("session.header.searchFiles"):i.t("palette.search.placeholder"),autofocus:!0,hideIcon:!0}},get emptyMessage(){return i.t("palette.empty")},get loadingMessage(){return i.t("common.loading")},items:B,key:e=>e.id,filterKeys:["title","description","category"],get groupBy(){return K()?e=>e.category:()=>""},onMove:V,onSelect:J,children:e=>v(oe,{get fallback(){return(()=>{var r=be(),h=r.firstChild,g=h.firstChild,m=g.firstChild,w=m.nextSibling;return p(h,v(me,{get node(){return{path:e.path??"",type:"file"}},class:"shrink-0 size-4"}),g),p(m,()=>ce(e.path??"")),p(w,()=>P(e.path??"")),r})()},get children(){return[v(O,{get when(){return e.type==="command"},get children(){var r=we(),h=r.firstChild,g=h.firstChild;return p(g,()=>e.title),p(h,v(F,{get when(){return e.description},get children(){var m=A();return p(m,()=>e.description),m}}),null),r}}),v(O,{get when(){return e.type==="session"},get children(){var r=ve(),h=r.firstChild,g=h.firstChild,m=g.firstChild;return p(h,v(ie,{name:"bubble-5",size:"small",class:"shrink-0 text-icon-weak"}),g),p(m,()=>e.title),p(g,v(F,{get when(){return e.description},get children(){var w=A();return p(w,()=>e.description),j(()=>w.classList.toggle("opacity-70",!!e.archived)),w}}),null),p(r,v(F,{get when(){return e.updated},get children(){var w=ye();return p(w,()=>pe(new Date(e.updated).toISOString(),i.t)),w}}),null),j(()=>m.classList.toggle("opacity-70",!!e.archived)),r}})]}})})}})}export{Fe as DialogSelectFile};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as Q,L as D,Q as F,ak as U,g as M,an as W,ao as Z,c as P,i as r,Z as R,m as w,z as T,T as B,ap as V,R as O,ad as X,aa as Y,ab as ee,aj as te,W as ne,a7 as ae,a8 as re,r as se,a5 as oe,aq as ce,ar as ie,j as $,J as S,w as le,bx as de,a6 as ue,S as x,aT as ge,aR as he,h as me,b as q,D as pe,b1 as fe,bq as Ce,b0 as be,ay as we,k as C,t as I}from"./index-
|
|
1
|
+
import{_ as Q,L as D,Q as F,ak as U,g as M,an as W,ao as Z,c as P,i as r,Z as R,m as w,z as T,T as B,ap as V,R as O,ad as X,aa as Y,ab as ee,aj as te,W as ne,a7 as ae,a8 as re,r as se,a5 as oe,aq as ce,ar as ie,j as $,J as S,w as le,bx as de,a6 as ue,S as x,aT as ge,aR as he,h as me,b as q,D as pe,b1 as fe,bq as Ce,b0 as be,ay as we,k as C,t as I}from"./index-BAnxnkd7.js";import{D as ve}from"./dialog-CteKqVmT.js";import{a as ye,L as Se}from"./session-ClhjIKqG.js";var xe={};ue(xe,{Control:()=>j,Description:()=>N,ErrorMessage:()=>A,Input:()=>H,Label:()=>z,Root:()=>G,Switch:()=>b,Thumb:()=>J,useSwitchContext:()=>v});var K=se();function v(){const a=le(K);if(a===void 0)throw new Error("[kobalte]: `useSwitchContext` must be used within a `Switch` component");return a}function j(a){const e=O(),t=v(),h=D({id:t.generateId("control")},a),[s,u]=F(h,["onClick","onKeyDown"]);return r(R,w({as:"div",onClick:f=>{S(f,s.onClick),t.toggle(),t.inputRef()?.focus()},onKeyDown:f=>{S(f,s.onKeyDown),f.key===de.Space&&(t.toggle(),t.inputRef()?.focus())}},()=>e.dataset(),()=>t.dataset(),u))}function N(a){const e=v();return r(re,w(()=>e.dataset(),a))}function A(a){const e=v();return r(ae,w(()=>e.dataset(),a))}function H(a){const e=O(),t=v(),h=D({id:t.generateId("input")},a),[s,u,l]=F(h,["ref","style","onChange","onFocus","onBlur"],Y),{fieldProps:p}=ee(u);return r(R,w({as:"input",ref(o){var i=B(t.setInputRef,s.ref);typeof i=="function"&&i(o)},type:"checkbox",role:"switch",get id(){return p.id()},get name(){return e.name()},get value(){return t.value()},get checked(){return t.checked()},get required(){return e.isRequired()},get disabled(){return e.isDisabled()},get readonly(){return e.isReadOnly()},get style(){return te({...ne},s.style)},get"aria-checked"(){return t.checked()},get"aria-label"(){return p.ariaLabel()},get"aria-labelledby"(){return p.ariaLabelledBy()},get"aria-describedby"(){return p.ariaDescribedBy()},get"aria-invalid"(){return e.validationState()==="invalid"||void 0},get"aria-required"(){return e.isRequired()||void 0},get"aria-disabled"(){return e.isDisabled()||void 0},get"aria-readonly"(){return e.isReadOnly()||void 0},onChange:o=>{S(o,s.onChange),o.stopPropagation();const i=o.target;t.setIsChecked(i.checked),i.checked=t.checked()},onFocus:o=>{S(o,s.onFocus),t.setIsFocused(!0)},onBlur:o=>{S(o,s.onBlur),t.setIsFocused(!1)}},()=>e.dataset(),()=>t.dataset(),l))}function z(a){const e=v();return r(X,w(()=>e.dataset(),a))}function G(a){let e;const t=`switch-${Q()}`,h=D({value:"on",id:t},a),[s,u,l]=F(h,["ref","children","value","checked","defaultChecked","onChange","onPointerDown"],U),[p,f]=M(),[n,c]=M(!1),{formControlContext:o}=W(u),i=ye({isSelected:()=>s.checked,defaultIsSelected:()=>s.defaultChecked,onSelectedChange:d=>s.onChange?.(d),isDisabled:()=>o.isDisabled(),isReadOnly:()=>o.isReadOnly()});Z(()=>e,()=>i.setIsSelected(s.defaultChecked??!1));const k=d=>{S(d,s.onPointerDown),n()&&d.preventDefault()},_=P(()=>({"data-checked":i.isSelected()?"":void 0})),g={value:()=>s.value,dataset:_,checked:()=>i.isSelected(),inputRef:p,generateId:oe(()=>T(u.id)),toggle:()=>i.toggle(),setIsChecked:d=>i.setIsSelected(d),setIsFocused:c,setInputRef:f};return r(V.Provider,{value:o,get children(){return r(K.Provider,{value:g,get children(){return r(R,w({as:"div",ref(d){var y=B(L=>e=L,s.ref);typeof y=="function"&&y(d)},role:"group",get id(){return T(u.id)},onPointerDown:k},()=>o.dataset(),_,l,{get children(){return r(ke,{state:g,get children(){return s.children}})}}))}})}})}function ke(a){const e=ce(()=>{const t=a.children;return ie(t)?t(a.state):t});return $(e)}function J(a){const e=O(),t=v(),h=D({id:t.generateId("thumb")},a);return r(R,w({as:"div"},()=>e.dataset(),()=>t.dataset(),h))}var b=Object.assign(G,{Control:j,Description:N,ErrorMessage:A,Input:H,Label:z,Thumb:J});function _e(a){const[e,t]=F(a,["children","class","hideLabel","description"]);return r(b,w(t,{get class(){return e.class},"data-component":"switch",get children(){return[r(b.Input,{"data-slot":"switch-input"}),r(x,{get when(){return e.children},get children(){return r(b.Label,{"data-slot":"switch-label",get classList(){return{"sr-only":e.hideLabel}},get children(){return e.children}})}}),r(x,{get when(){return e.description},get children(){return r(b.Description,{"data-slot":"switch-description",get children(){return e.description}})}}),r(b.ErrorMessage,{"data-slot":"switch-error"}),r(b.Control,{"data-slot":"switch-control",get children(){return r(b.Thumb,{"data-slot":"switch-thumb"})}})]}}))}var Pe=I('<span class="text-11-regular text-text-weaker">'),De=I('<span class="text-11-regular text-text-weak">'),Fe=I('<span class="text-11-regular text-text-weaker truncate">'),Re=I('<div class="w-full flex items-center justify-between gap-x-3"><div class="flex flex-col gap-0.5 min-w-0"><div class="flex items-center gap-2"><span class=truncate></span></div></div><div>');const Ie={connected:"mcp.status.connected",failed:"mcp.status.failed",needs_auth:"mcp.status.needs_auth",disabled:"mcp.status.disabled"},Ee=()=>{const a=ge(),e=he(),t=be(),[h,s]=me({done:!1,loading:!1});q(pe(()=>a.data.mcp_ready,(n,c)=>{!n&&c&&s("done",!1)},{defer:!0})),q(()=>{if(!(h.done||h.loading)){if(a.data.mcp_ready){s("done",!0);return}s("loading",!0),e.client.mcp.status().then(n=>{a.set("mcp",n.data??{}),a.set("mcp_ready",!0),s("done",!0)}).catch(n=>{s("done",!0),fe({variant:"error",title:t.t("common.requestFailed"),description:n instanceof Error?n.message:String(n)})}).finally(()=>{s("loading",!1)})}});const u=P(()=>Object.entries(a.data.mcp??{}).map(([n,c])=>({name:n,status:c.status})).sort((n,c)=>n.name.localeCompare(c.name))),l=Ce(()=>({mutationFn:async n=>{a.data.mcp[n]?.status==="connected"?await e.client.mcp.disconnect({name:n}):await e.client.mcp.connect({name:n});const o=await e.client.mcp.status();o.data&&a.set("mcp",o.data)}})),p=P(()=>u().filter(n=>n.status==="connected").length),f=P(()=>u().length);return r(ve,{get title(){return t.t("dialog.mcp.title")},get description(){return t.t("dialog.mcp.description",{enabled:p(),total:f()})},get children(){return r(Se,{get search(){return{placeholder:t.t("common.search.placeholder"),autofocus:!0}},get emptyMessage(){return t.t("dialog.mcp.empty")},key:n=>n?.name??"",items:u,filterKeys:["name","status"],sortBy:(n,c)=>n.name.localeCompare(c.name),onSelect:n=>{!n||l.isPending||l.mutate(n.name)},children:n=>{const c=()=>a.data.mcp[n.name],o=()=>c()?.status,i=()=>{const g=o()?Ie[o()]:void 0;if(g)return t.t(g)},k=()=>{const g=c();return g?.status==="failed"?g.error:void 0},_=()=>o()==="connected";return(()=>{var g=Re(),d=g.firstChild,y=d.firstChild,L=y.firstChild,E=d.nextSibling;return C(L,()=>n.name),C(y,r(x,{get when(){return i()},get children(){var m=Pe();return C(m,i),m}}),null),C(y,r(x,{get when(){return $(()=>!!l.isPending)()&&l.variables===n.name},get children(){var m=De();return C(m,()=>t.t("common.loading.ellipsis")),m}}),null),C(d,r(x,{get when(){return k()},get children(){var m=Fe();return C(m,k),m}}),null),E.$$click=m=>m.stopPropagation(),C(E,r(_e,{get checked(){return _()},get disabled(){return $(()=>!!l.isPending)()&&l.variables===n.name},onChange:()=>{l.isPending||l.mutate(n.name)}})),g})()}})}})};we(["click"]);export{Ee as DialogSelectMcp};
|