dsh-magpie-connect 0.4.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/cordis.patch.yml +6 -1
- package/dsh.plugin.json +1 -1
- package/lib/client.js +147 -67
- package/lib/index.js +164 -33
- package/lib/index.js.map +4 -4
- package/lib/types/client/nav-icon.d.ts +54 -19
- package/lib/types/client/section-icon.d.ts +31 -0
- package/lib/types/config.d.ts +2 -1
- package/lib/types/homeDir.d.ts +11 -0
- package/lib/types/settings.d.ts +9 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -90,8 +90,12 @@ Key 无效、网关不通)不会清空本地目录,避免把选择器误清
|
|
|
90
90
|
**从旧版本升级,我原来的删除记录还在吗?**
|
|
91
91
|
|
|
92
92
|
在。首次启动会自动把旧的 `hiddenModels`(黑名单)换算成 `enabledModels`(白名单),
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
只执行一次。若升级时网关不可达、算不出旧列表,则退回「继承网关目录」,不会误删你能用的模型。
|
|
94
|
+
|
|
95
|
+
> 配置文件位置:从 0.5.0 起写在 `$DSH_HOME/storages/magpie-connect/settings.json`
|
|
96
|
+
>(默认 `~/.dsh/storages/magpie-connect/settings.json`)。老版本的
|
|
97
|
+
> `~/.dsh-magpie-connect/settings.json` **不迁移、不删除**,只做只读兼容——升级后不改任何文件;
|
|
98
|
+
> 你第一次在设置页保存(或删除模型触发自动保存)时,新配置才会写入新位置,同时清掉旧文件。
|
|
95
99
|
|
|
96
100
|
**为什么我删掉的模型又出现了?**
|
|
97
101
|
|
|
@@ -144,7 +148,7 @@ Key 无效、网关不通)不会清空本地目录,避免把选择器误清
|
|
|
144
148
|
| `displayName` | `Magpie` | 模型选择器里的分组名。 |
|
|
145
149
|
| `baseUrl` | `http://127.0.0.1:3425/v1` | 带版本号的 API 地址。 |
|
|
146
150
|
| `apiKey` | `''`(未配置) | 网关凭据。必填,即使网关不校验——地址有默认值,Key 没有。 |
|
|
147
|
-
| `dataDir` |
|
|
151
|
+
| `dataDir` | `$DSH_HOME/storages/magpie-connect` | 状态目录(状态快照、设置文件、模型缓存)。默认 `~/.dsh/storages/magpie-connect`;显式指定后不会读写旧目录。 |
|
|
148
152
|
| `refreshSeconds` | `300` | 模型目录刷新间隔(秒)。 |
|
|
149
153
|
| `maxRetries` | `2` | 遇到 429/5xx 时的连接重试次数。 |
|
|
150
154
|
| `timeoutMs` | `300000` | 单次请求的总超时(毫秒)。 |
|
|
@@ -177,7 +181,7 @@ http://127.0.0.1:3425/v1 ← 按 native_endpoints 选择 chat/completions 或 r
|
|
|
177
181
|
- **容错** — 启动即注册,目录在后台预热;静默挂起会被看门狗快速判为超时;
|
|
178
182
|
上游截断如实上报,不做自动续写。
|
|
179
183
|
|
|
180
|
-
运行状态快照写在 `~/.dsh
|
|
184
|
+
运行状态快照写在 `<dataDir>/adapter-status.json`(默认 `~/.dsh/storages/magpie-connect/adapter-status.json`),设置与缓存在同一目录。
|
|
181
185
|
|
|
182
186
|
## 开发
|
|
183
187
|
|
package/cordis.patch.yml
CHANGED
|
@@ -8,12 +8,17 @@
|
|
|
8
8
|
# (saved to <dataDir>/settings.json, applied without restart) and hides models
|
|
9
9
|
# from the picker. Page values win per-field; the patch config below stays as
|
|
10
10
|
# fallback (e.g. headless compositions without the settings page).
|
|
11
|
+
# <dataDir> defaults to $DSH_HOME/storages/magpie-connect
|
|
12
|
+
# (~/.dsh/storages/magpie-connect). The pre-0.5 dir ~/.dsh-magpie-connect is
|
|
13
|
+
# read once as a fallback and removed on the first save; it is never migrated
|
|
14
|
+
# eagerly, so an upgrade that changes nothing touches no file.
|
|
11
15
|
#
|
|
12
16
|
# - baseUrl: versioned API root (default http://127.0.0.1:3425/v1). Include the
|
|
13
17
|
# version segment: the plugin appends only the resource (/models, /responses),
|
|
14
18
|
# so a gateway on /v2 or /v3 is reached by changing this one string.
|
|
15
19
|
# - apiKey: gateway credential (required, even if /models needs none).
|
|
16
|
-
# - dataDir: plugin state dir (status snapshot, settings file, catalog cache)
|
|
20
|
+
# - dataDir: plugin state dir (status snapshot, settings file, catalog cache);
|
|
21
|
+
# defaults to $DSH_HOME/storages/magpie-connect.
|
|
17
22
|
# - displayName: cosmetic label in the model picker (route id stays providerId).
|
|
18
23
|
# - providerId: RENAME the route id itself (existing sessions pointing at the
|
|
19
24
|
# old id will orphan — prefer displayName for a cosmetic rename).
|
package/dsh.plugin.json
CHANGED
package/lib/client.js
CHANGED
|
@@ -83,7 +83,7 @@ var EN = {
|
|
|
83
83
|
context: "{window} ctx",
|
|
84
84
|
saveHint: "These are the models the picker offers; the gateway\u2019s catalog is not shown until you add from it. Changes save on their own \u2014 the credential fields above still need Save.",
|
|
85
85
|
notConfigured: "Not fully configured: the model picker stays empty and calls fail until both fields are saved.",
|
|
86
|
-
|
|
86
|
+
github: "Open the GitHub repository",
|
|
87
87
|
loadFailed: "Failed to load settings: {message}",
|
|
88
88
|
requestFailed: "Request failed (HTTP {status})",
|
|
89
89
|
requestTimeout: "Request timed out. Check the gateway address and try again."
|
|
@@ -136,7 +136,7 @@ var ZH = {
|
|
|
136
136
|
context: "{window} \u4E0A\u4E0B\u6587",
|
|
137
137
|
saveHint: "\u4EE5\u4E0B\u5373\u9009\u62E9\u5668\u63D0\u4F9B\u7684\u6A21\u578B\uFF0C\u7F51\u5173\u76EE\u5F55\u91CC\u7684\u5176\u4F59\u6A21\u578B\u4E0D\u4F1A\u81EA\u52A8\u51FA\u73B0\uFF1B\u6539\u52A8\u4F1A\u81EA\u52A8\u4FDD\u5B58\uFF0C\u4E0A\u65B9\u7684\u5730\u5740\u4E0E Key \u4ECD\u9700\u70B9\u201C\u4FDD\u5B58\u201D\u3002",
|
|
138
138
|
notConfigured: "\u914D\u7F6E\u4E0D\u5B8C\u6574\uFF1A\u4E24\u4E2A\u5B57\u6BB5\u90FD\u4FDD\u5B58\u540E\uFF0C\u6A21\u578B\u9009\u62E9\u5668\u624D\u4F1A\u6709\u5185\u5BB9\uFF0C\u8C03\u7528\u624D\u4F1A\u653E\u884C\u3002",
|
|
139
|
-
|
|
139
|
+
github: "\u5728 GitHub \u4E0A\u67E5\u770B\u4ED3\u5E93",
|
|
140
140
|
loadFailed: "\u52A0\u8F7D\u8BBE\u7F6E\u5931\u8D25\uFF1A{message}",
|
|
141
141
|
requestFailed: "\u8BF7\u6C42\u5931\u8D25\uFF08HTTP {status}\uFF09",
|
|
142
142
|
requestTimeout: "\u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u68C0\u67E5\u7F51\u5173\u5730\u5740\u540E\u91CD\u8BD5\u3002"
|
|
@@ -167,6 +167,7 @@ function useLocaleRevision() {
|
|
|
167
167
|
|
|
168
168
|
// src/client/nav-icon.ts
|
|
169
169
|
var NAV_ICON_MARKER = "data-dsh-magpie-nav-icon";
|
|
170
|
+
var SLOT_GLYPH_MARKER = "data-dsh-magpie-slot-glyph";
|
|
170
171
|
var NAV_ROW_SELECTOR = '[role="dialog"] nav button';
|
|
171
172
|
var BIRD_PATH = "M1.5 5.5C1.3 5.7 1.2 6.5 1.2 6.9C1.2 6.9 1.2 7 1.2 7.1C1.1 7.4 1.3 8 1.4 8.3C1.4 8.4 1.5 8.5 1.5 8.7C1.5 8.9 1.7 9 1.8 9.3C2.2 9.9 2.2 10 2.3 10.1C2.4 10.2 2.5 10.3 2.6 10.5C2.8 10.8 3 11.1 3.2 11.3C3.3 11.3 3.4 11.6 3.6 11.8C3.8 12 4.1 12.4 4.2 12.5C4.7 13 5.2 13.7 5.4 13.9C6 14.5 6.5 15.1 6.7 15.3C6.7 15.4 6.9 15.5 6.9 15.7C7.3 15.9 7.7 16.5 7.9 16.8C7.9 16.8 8 16.9 8 16.9C8.1 16.9 8.2 17.2 8.2 17.3C8.2 17.3 8.1 17.2 8.1 17.1C7.9 16.9 7.9 16.9 7.6 16.6C7.5 16.5 7.4 16.5 7.4 16.3C7.2 16.2 6.7 15.7 6.3 15.2C6.1 15.1 6 14.9 6 14.9C5.9 14.8 5.7 14.7 5.7 14.6C5.6 14.5 5.4 14.3 5.3 14.2C5.1 14.1 4.9 13.8 4.7 13.5C4.5 13.3 4.2 13.1 4.1 12.9C4.1 12.9 3.8 12.7 3.8 12.5C3.5 12.3 3 11.8 2.8 11.4C1.8 10.5 0.9 9.6 0.7 9.6C0.6 9.7 0.6 9.8 0.5 10C0.5 10.1 0.6 10.2 0.5 10.3C0.5 10.4 0.6 10.5 0.6 10.6C0.5 10.7 0.5 10.9 0.6 11C0.5 11.1 0.6 11.4 0.6 11.5C0.9 12.9 1.3 13.8 2.8 14.9C2.9 15.1 3.3 15.3 3.4 15.4C3.4 15.5 3.6 15.6 3.7 15.7C4.2 16 6.4 17.8 7 18.4C7.4 18.8 7.4 18.8 7.5 18.9C7.6 19 7.7 19 7.7 19.1C7.7 19.2 7.8 19.2 7.9 19.2C7.9 19.3 8.1 19.4 8.1 19.5C8.2 19.6 8.2 19.7 8.3 19.7C8.3 19.7 8.3 19.7 8.2 19.7C8.2 19.6 8.1 19.6 8 19.6C7.9 19.5 7.9 19.4 7.8 19.4C7.7 19.3 7.6 19.2 7.6 19.2C7.6 19.1 7.5 19 7.3 18.9C7.2 18.9 6.9 18.6 6.7 18.4C6.1 17.8 4.5 16.6 3.5 16C3.4 15.8 3 15.6 2.9 15.5C2.6 15.3 1.5 14.6 0.9 14.3C0.7 14.1 0.6 14.1 0.6 14.2C0.5 14.5 0.8 15.9 0.9 16.1C0.9 16.2 1 16.2 0.9 16.3C1.2 16.8 1.9 17.6 2.7 18.3C2.8 18.5 4 19.2 4.7 19.5C6.2 20.5 6.6 20.7 7.4 21.5C8.2 22.2 8.7 22.7 9.3 23.6C9.5 24.1 9.9 24.4 10.3 25.3C10.4 25.5 10.5 25.8 10.5 25.8C10.7 25.8 10.8 25.7 11 25.4C11.6 25 11.9 24.6 12.3 24.3C12.8 24 13 23.8 13 23.7C13.1 23.7 13.1 23.8 13 24C12 24.8 11 26 10.2 26.9C10.1 27.1 9.9 27.5 9.7 27.7C9.5 27.8 9.4 28 9.4 28C9.4 28 9.3 28.3 9.1 28.5C8.6 29.2 7.7 30.8 7.7 30.9C7.7 31 7.8 31 8.3 30.8C9 30.4 9.5 30.2 10.4 30C11.7 29.6 12.5 29.6 11.6 30C10.5 30.2 9.7 30.6 9.2 31.2C8.8 31.7 8.8 31.7 9.3 31.7C10.1 31.8 10.9 31.9 11.6 32.2C12.8 32.7 13.5 33.1 15.5 34.8C16.4 35.5 17.3 36.2 17.8 36.4C17.9 36.5 18.1 36.7 18.2 36.8C19.1 37.3 21.2 38.1 22.3 38.3C22.4 38.3 22.7 38.3 22.8 38.3C22.8 38.5 23 38.5 23 38.5C23.1 38.5 23.2 38.5 23.3 38.5C23.6 38.6 25.9 38.6 26.1 38.5C26.2 38.5 26.3 38.5 26.4 38.5C26.5 38.5 26.6 38.5 26.7 38.3C26.7 38.3 27 38.3 27.1 38.3C28.3 38.1 30.2 37.3 31.4 36.7C31.5 36.7 31.7 36.4 31.8 36.4C32.2 36.2 33.2 35.4 33.4 35.2C34.2 34.5 35.5 33 35.8 32.6C35.8 32.5 36 32.2 36.1 32C36.4 31.8 36.6 31.4 36.6 31.2C36.7 31.1 36.8 30.9 36.9 30.8C37.2 30.4 37.5 29.6 37.7 29.2C37.7 29.1 37.8 28.7 37.9 28.7C38.1 28.5 38.4 27.1 38.5 26.8C39 25.2 39.1 23.7 39 22.4C39 22.2 38.9 21.9 38.9 21.8C38.9 21.7 38.9 21.6 38.9 21.4C38.6 20.5 38.5 19.9 38.2 19C37.9 18.5 37.5 17.5 37.3 17.2C37 16.8 36.8 15.8 36.8 15.2C36.8 13.8 37.7 12.7 39.6 12.2C40.1 12.1 41.3 11.8 42.1 11.7C43.5 11.5 43.5 11.5 43.4 11.3C42.9 10.7 40.9 9.9 39.2 9.7C37.9 9.5 38.1 9.5 37.6 9C37 8.6 36.4 8 36 7.9C36 7.8 35.8 7.8 35.7 7.7C35.1 7.3 34.2 7 33.1 6.9C32.6 6.7 31.6 6.9 31 7C29.6 7.3 28.3 8 27.3 9.2C26.7 9.8 26.2 10.8 25.7 11.7C25.5 12.1 24.8 13.4 24.7 13.7C24.6 13.9 24.5 14.1 24.1 14.7C23.5 15.7 22.1 16.9 20.6 17.8C20.5 18 20.3 18.2 20.1 18.3C19.7 18.5 19.4 18.8 19.1 19C18.9 19.1 18.7 19.3 18.5 19.4C18 19.8 17.2 20.3 17 20.5C16.9 20.5 16.8 20.6 16.7 20.7C16.3 20.8 16.1 20.9 16 20.9C15.5 20.8 14.9 20.5 14.2 20.2C13.7 19.8 12.7 18.9 12.4 18.6C12.3 18.5 12.2 18.4 12.1 18.2C11.9 18 11.2 17.1 11 16.6C10.9 16.5 10.8 16.4 10.7 16.3C10.7 16.2 10.6 16.1 10.6 15.9C10.5 15.9 10.4 15.7 10.4 15.6C10.3 15.5 10.2 15.2 10.1 15C10 14.8 9.8 14.4 9.7 14.2C9.6 14 9.5 13.7 9.4 13.6C9.4 13.4 9.3 13.2 9.2 13C9.2 12.8 9 12.6 9 12.5C8.9 12.3 8.7 12.1 8.7 12C8.7 12 8.5 11.7 8.5 11.7C8.3 11.2 8.2 10.9 7.5 10C6.4 8.3 4.2 6.4 2.7 5.8C2 5.5 1.6 5.4 1.5 5.5ZM28.4 16.7C29.2 16.9 29.7 17.2 29.9 17.7C30.1 18.2 30 18.9 29.6 19.4C29.2 19.9 28.2 20.9 27.6 21.2C26.8 21.7 25.3 22.4 24.2 22.7C23.9 22.8 23.6 22.9 23.5 22.9C22.8 23.2 20.7 23.7 19.6 24C19 24.2 18.4 24.3 18.1 24.4C17.9 24.4 16.1 24.9 15.3 25.1C14.6 25.2 14.7 25.1 15.7 23.6C16.4 22.7 18.5 20.6 19.4 19.9C20.8 18.8 21.4 18.4 23.2 17.6C23.8 17.4 25.6 16.8 25.9 16.8C25.9 16.8 26.3 16.8 26.6 16.7C26.8 16.7 28.2 16.7 28.4 16.7ZM30.4 20.2C30.5 20.3 30.6 20.6 30.6 20.7C31.7 23.1 33.4 24.6 35.6 25.3C36.1 25.5 36.7 25.7 37.2 25.8C37.7 25.8 37.8 25.9 37.8 26.1C37.7 26.2 37.7 26.3 37.7 26.5C37.7 26.6 37.7 26.8 37.6 27C37.4 28.5 36.8 29.9 36.1 31C36.1 31.2 35.9 31.4 35.9 31.6C35.7 31.9 35.2 32.6 34.7 33.3C32.6 35.6 29.7 37.3 26.6 37.8C26.5 37.8 26.3 37.9 26.2 37.9C25.8 37.9 23.7 37.9 23.3 37.9C23.2 37.9 23 37.8 22.9 37.8C21.1 37.6 19.3 36.8 18 35.7C17.7 35.4 17 34.7 16.8 34.5C16.3 33.8 16.1 33 16.3 32.5C16.5 31.8 16.8 31.6 17.9 31.1C19.1 30.5 19.4 30.4 20.2 30C21.4 29.4 23.2 28.4 23.9 27.9C23.9 27.8 24.2 27.7 24.5 27.6C26.3 26.3 28 24.6 28.9 22.9C29.5 22.2 29.7 21.6 29.9 20.7C30.1 20 30.2 19.9 30.4 20.2Z";
|
|
172
173
|
function birdMaskSvg() {
|
|
@@ -181,9 +182,13 @@ function isOwnNavRow(rowText, wantedLabel) {
|
|
|
181
182
|
return String(rowText ?? "").trim() === wanted;
|
|
182
183
|
}
|
|
183
184
|
function navIconCss(maskUrl) {
|
|
185
|
+
const ownRow = `[${NAV_ICON_MARKER}]:not(:has([${SLOT_GLYPH_MARKER}]))`;
|
|
184
186
|
return [
|
|
185
|
-
|
|
186
|
-
`
|
|
187
|
+
// Descendant (not `>`) so it also hides the gear on shells that wrap it in a
|
|
188
|
+
// `span.navIcon` (0.2.2+) — on those the svg is a grandchild of the button,
|
|
189
|
+
// which a child combinator missed (gear stayed visible under the bird).
|
|
190
|
+
`${ownRow} svg { display: none; }`,
|
|
191
|
+
`${ownRow}::before {`,
|
|
187
192
|
` content: '';`,
|
|
188
193
|
` flex: none;`,
|
|
189
194
|
` width: 18px;`,
|
|
@@ -236,6 +241,26 @@ function installSettingsNavIcon(ctx, resolveLabel) {
|
|
|
236
241
|
}, "dsh-magpie-connect: settings nav icon");
|
|
237
242
|
}
|
|
238
243
|
|
|
244
|
+
// src/client/section-icon.tsx
|
|
245
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
246
|
+
function MagpieSectionIcon(props) {
|
|
247
|
+
const size = props.size ?? 16;
|
|
248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
249
|
+
"svg",
|
|
250
|
+
{
|
|
251
|
+
...{ [SLOT_GLYPH_MARKER]: "" },
|
|
252
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
253
|
+
width: size,
|
|
254
|
+
height: size,
|
|
255
|
+
viewBox: "0 0 44 44",
|
|
256
|
+
fill: "currentColor",
|
|
257
|
+
"aria-hidden": "true",
|
|
258
|
+
focusable: "false",
|
|
259
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { fillRule: "evenodd", d: BIRD_PATH })
|
|
260
|
+
}
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
|
|
239
264
|
// src/client/page.tsx
|
|
240
265
|
var import_react3 = require("react");
|
|
241
266
|
var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
@@ -270,7 +295,7 @@ function toggleAllPicked(current, visible) {
|
|
|
270
295
|
}
|
|
271
296
|
|
|
272
297
|
// src/client/model-list.tsx
|
|
273
|
-
var
|
|
298
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
274
299
|
var css = {
|
|
275
300
|
card: { display: "flex", flexDirection: "column", gap: 14, padding: 18, border: "1px solid var(--dsw-alias-border-l2)", borderRadius: 12, background: "var(--dsw-alias-bg-layer-1)" },
|
|
276
301
|
head: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 12 },
|
|
@@ -391,13 +416,13 @@ function ModelListEditor(props) {
|
|
|
391
416
|
closePicker();
|
|
392
417
|
};
|
|
393
418
|
const working = disabled || busy;
|
|
394
|
-
return /* @__PURE__ */ (0,
|
|
395
|
-
/* @__PURE__ */ (0,
|
|
396
|
-
/* @__PURE__ */ (0,
|
|
397
|
-
/* @__PURE__ */ (0,
|
|
398
|
-
/* @__PURE__ */ (0,
|
|
419
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: css.card, children: [
|
|
420
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: css.head, children: [
|
|
421
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: css.heading, children: [
|
|
422
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { style: css.cardTitle, children: text("models") }),
|
|
423
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { style: css.meta, children: text("enabled", { count: enabledRows.length }) })
|
|
399
424
|
] }),
|
|
400
|
-
/* @__PURE__ */ (0,
|
|
425
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
401
426
|
"button",
|
|
402
427
|
{
|
|
403
428
|
type: "button",
|
|
@@ -409,8 +434,8 @@ function ModelListEditor(props) {
|
|
|
409
434
|
}
|
|
410
435
|
)
|
|
411
436
|
] }),
|
|
412
|
-
/* @__PURE__ */ (0,
|
|
413
|
-
/* @__PURE__ */ (0,
|
|
437
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { style: css.hint, children: text("saveHint") }),
|
|
438
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
414
439
|
import_dsh_client_ui_primitives.Input,
|
|
415
440
|
{
|
|
416
441
|
value: filter,
|
|
@@ -419,9 +444,9 @@ function ModelListEditor(props) {
|
|
|
419
444
|
onChange: (event) => setFilter(event.currentTarget.value)
|
|
420
445
|
}
|
|
421
446
|
),
|
|
422
|
-
/* @__PURE__ */ (0,
|
|
447
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { style: css.meta, children: [
|
|
423
448
|
inheriting ? text("modelsInherited") : text("modelsCustomized", { count: enabledRows.length }),
|
|
424
|
-
inheriting || disabled ? null : /* @__PURE__ */ (0,
|
|
449
|
+
inheriting || disabled ? null : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
425
450
|
"button",
|
|
426
451
|
{
|
|
427
452
|
type: "button",
|
|
@@ -432,18 +457,18 @@ function ModelListEditor(props) {
|
|
|
432
457
|
}
|
|
433
458
|
)
|
|
434
459
|
] }),
|
|
435
|
-
enabledRows.length === 0 ? /* @__PURE__ */ (0,
|
|
436
|
-
/* @__PURE__ */ (0,
|
|
460
|
+
enabledRows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { style: css.empty, children: models.length === 0 ? text("fetchEmpty") : text("allRemoved") }) : null,
|
|
461
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: css.list, children: visibleRows.map((row) => {
|
|
437
462
|
const source = sourceChip(row);
|
|
438
|
-
return /* @__PURE__ */ (0,
|
|
439
|
-
/* @__PURE__ */ (0,
|
|
440
|
-
/* @__PURE__ */ (0,
|
|
441
|
-
/* @__PURE__ */ (0,
|
|
442
|
-
chipsFor(row).map((chip) => /* @__PURE__ */ (0,
|
|
443
|
-
source === void 0 ? null : /* @__PURE__ */ (0,
|
|
463
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: css.item, children: [
|
|
464
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { style: css.itemMain, children: [
|
|
465
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: css.itemId, children: row.id }),
|
|
466
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { style: css.chips, children: [
|
|
467
|
+
chipsFor(row).map((chip) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: css.chip, children: chip.label }, chip.key)),
|
|
468
|
+
source === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { ...css.chip, ...css.chipStale }, children: source.label }, source.key)
|
|
444
469
|
] })
|
|
445
470
|
] }),
|
|
446
|
-
/* @__PURE__ */ (0,
|
|
471
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
447
472
|
"button",
|
|
448
473
|
{
|
|
449
474
|
type: "button",
|
|
@@ -457,11 +482,11 @@ function ModelListEditor(props) {
|
|
|
457
482
|
)
|
|
458
483
|
] }, row.id);
|
|
459
484
|
}) }),
|
|
460
|
-
fetchFailure === void 0 ? null : /* @__PURE__ */ (0,
|
|
461
|
-
status === "saving" ? /* @__PURE__ */ (0,
|
|
462
|
-
status === "saved" ? /* @__PURE__ */ (0,
|
|
463
|
-
status === "error" && props.failure !== void 0 ? /* @__PURE__ */ (0,
|
|
464
|
-
/* @__PURE__ */ (0,
|
|
485
|
+
fetchFailure === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { role: "alert", style: css.error, children: fetchFailure }),
|
|
486
|
+
status === "saving" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { style: css.hint, children: text("savingModels") }) : null,
|
|
487
|
+
status === "saved" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { style: css.ok, children: text("modelsSaved") }) : null,
|
|
488
|
+
status === "error" && props.failure !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { role: "alert", style: css.error, children: props.failure }) : null,
|
|
489
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
465
490
|
import_dsh_client_ui_primitives.Modal,
|
|
466
491
|
{
|
|
467
492
|
open: candidates !== void 0,
|
|
@@ -469,13 +494,13 @@ function ModelListEditor(props) {
|
|
|
469
494
|
title: text("fetchTitle"),
|
|
470
495
|
closeLabel: text("close"),
|
|
471
496
|
description: text("fetchDescription"),
|
|
472
|
-
footer: /* @__PURE__ */ (0,
|
|
473
|
-
/* @__PURE__ */ (0,
|
|
474
|
-
/* @__PURE__ */ (0,
|
|
497
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
498
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Button, { variant: "outline", onClick: closePicker, children: text("cancel") }),
|
|
499
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Button, { variant: "primary", onClick: adoptPicked, children: text("fetchAdopt") })
|
|
475
500
|
] }),
|
|
476
501
|
children: [
|
|
477
|
-
/* @__PURE__ */ (0,
|
|
478
|
-
/* @__PURE__ */ (0,
|
|
502
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: css.candidateToolbar, children: [
|
|
503
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
479
504
|
import_dsh_client_ui_primitives.Input,
|
|
480
505
|
{
|
|
481
506
|
type: "search",
|
|
@@ -486,10 +511,10 @@ function ModelListEditor(props) {
|
|
|
486
511
|
style: css.candidateSearch
|
|
487
512
|
}
|
|
488
513
|
),
|
|
489
|
-
/* @__PURE__ */ (0,
|
|
514
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Button, { variant: "ghost", size: "sm", disabled: visibleCandidates.length === 0, onClick: () => setPicked((current) => toggleAllPicked(current, visibleCandidates)), children: wouldClear ? text("fetchDeselectAll") : text("fetchSelectAll") })
|
|
490
515
|
] }),
|
|
491
|
-
visibleCandidates.length === 0 ? /* @__PURE__ */ (0,
|
|
492
|
-
/* @__PURE__ */ (0,
|
|
516
|
+
visibleCandidates.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { style: css.candidateEmpty, role: "status", children: text("fetchNoMatches") }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ul", { style: css.candidateList, children: visibleCandidates.map((candidate) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { style: css.candidate, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { style: css.candidateLabel, children: [
|
|
517
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
493
518
|
"input",
|
|
494
519
|
{
|
|
495
520
|
type: "checkbox",
|
|
@@ -498,9 +523,9 @@ function ModelListEditor(props) {
|
|
|
498
523
|
onChange: () => togglePicked(candidate.id)
|
|
499
524
|
}
|
|
500
525
|
),
|
|
501
|
-
/* @__PURE__ */ (0,
|
|
502
|
-
/* @__PURE__ */ (0,
|
|
503
|
-
/* @__PURE__ */ (0,
|
|
526
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { style: css.candidateText, children: [
|
|
527
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: css.candidateId, title: candidate.id, children: candidate.id }),
|
|
528
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: css.chips, children: chipsFor(candidate).map((chip) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: css.chip, children: chip.label }, chip.key)) })
|
|
504
529
|
] })
|
|
505
530
|
] }) }, candidate.id)) })
|
|
506
531
|
]
|
|
@@ -566,11 +591,36 @@ function shouldRetryPending(snapshot2, attempts, limit = PENDING_RETRY_LIMIT) {
|
|
|
566
591
|
}
|
|
567
592
|
|
|
568
593
|
// src/client/page.tsx
|
|
569
|
-
var
|
|
570
|
-
var PLUGIN_VERSION = "0.
|
|
594
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
595
|
+
var PLUGIN_VERSION = "0.5.0";
|
|
596
|
+
var REPO_URL = "https://github.com/bitxeno/dsh-magpie-connect";
|
|
571
597
|
var css2 = {
|
|
572
598
|
section: { display: "flex", flexDirection: "column", gap: 16, maxWidth: 780, paddingBottom: 32 },
|
|
599
|
+
/**
|
|
600
|
+
* Title row: brand block (title + version, then the intro) on the left, the
|
|
601
|
+
* GitHub action pinned right. Sits where the bare `<h2>` used to, so the rest
|
|
602
|
+
* of the page keeps its spacing.
|
|
603
|
+
*/
|
|
604
|
+
header: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 16, margin: 0 },
|
|
605
|
+
brand: { display: "flex", flexDirection: "column", gap: 4, minWidth: 0 },
|
|
606
|
+
heading: { display: "flex", alignItems: "baseline", gap: 8, flexWrap: "wrap" },
|
|
573
607
|
title: { margin: 0, fontSize: 22, lineHeight: "30px", fontWeight: 600, color: "var(--dsw-alias-label-primary)" },
|
|
608
|
+
version: { fontSize: 11, lineHeight: "16px", fontWeight: 500, letterSpacing: 0, fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace", color: "var(--dsw-alias-label-tertiary)" },
|
|
609
|
+
actions: { display: "flex", alignItems: "center", gap: 8, flex: "none" },
|
|
610
|
+
iconLink: {
|
|
611
|
+
display: "inline-grid",
|
|
612
|
+
placeItems: "center",
|
|
613
|
+
width: 30,
|
|
614
|
+
height: 30,
|
|
615
|
+
padding: 0,
|
|
616
|
+
boxSizing: "border-box",
|
|
617
|
+
border: "1px solid var(--dsw-alias-border-l2)",
|
|
618
|
+
borderRadius: 8,
|
|
619
|
+
color: "var(--dsw-alias-label-secondary)",
|
|
620
|
+
background: "var(--dsw-alias-bg-layer-1)",
|
|
621
|
+
textDecoration: "none",
|
|
622
|
+
cursor: "pointer"
|
|
623
|
+
},
|
|
574
624
|
intro: { margin: 0, fontSize: 14, lineHeight: "22px", color: "var(--dsw-alias-label-secondary)" },
|
|
575
625
|
card: { display: "flex", flexDirection: "column", gap: 14, padding: 18, border: "1px solid var(--dsw-alias-border-l2)", borderRadius: 12, background: "var(--dsw-alias-bg-layer-1)" },
|
|
576
626
|
cardTitle: { margin: 0, fontSize: 15, lineHeight: "22px", fontWeight: 600, color: "var(--dsw-alias-label-primary)" },
|
|
@@ -734,35 +784,57 @@ function MagpieSettings() {
|
|
|
734
784
|
};
|
|
735
785
|
const working = busy !== "idle";
|
|
736
786
|
const incomplete = baseUrl.trim() === "" || apiKey.trim() === "";
|
|
737
|
-
return /* @__PURE__ */ (0,
|
|
738
|
-
/* @__PURE__ */ (0,
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
787
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { style: css2.section, children: [
|
|
788
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("header", { style: css2.header, children: [
|
|
789
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: css2.brand, children: [
|
|
790
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: css2.heading, children: [
|
|
791
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { style: css2.title, children: text("title") }),
|
|
792
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { style: css2.version, children: [
|
|
793
|
+
"v",
|
|
794
|
+
PLUGIN_VERSION
|
|
795
|
+
] })
|
|
796
|
+
] }),
|
|
797
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { style: css2.intro, children: text("intro") })
|
|
798
|
+
] }),
|
|
799
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: css2.actions, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
800
|
+
"a",
|
|
801
|
+
{
|
|
802
|
+
href: REPO_URL,
|
|
803
|
+
target: "_blank",
|
|
804
|
+
rel: "noopener noreferrer",
|
|
805
|
+
"aria-label": text("github"),
|
|
806
|
+
title: text("github"),
|
|
807
|
+
style: css2.iconLink,
|
|
808
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { width: 18, height: 18, viewBox: "0 0 16 16", fill: "currentColor", focusable: "false", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.65 7.65 0 0 1 2-.27c.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8Z" }) })
|
|
809
|
+
}
|
|
810
|
+
) })
|
|
811
|
+
] }),
|
|
812
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: css2.card, children: [
|
|
813
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { style: css2.cardTitle, children: text("connection") }),
|
|
814
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { style: css2.hint, children: text("requiredNote") }),
|
|
815
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: css2.field, children: [
|
|
816
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: css2.label, children: text("baseUrl") }),
|
|
817
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.Input, { value: baseUrl, placeholder: text("baseUrlPlaceholder"), disabled: working, onChange: (event) => {
|
|
746
818
|
credentialsDirty.current = true;
|
|
747
819
|
setBaseUrl(event.currentTarget.value);
|
|
748
820
|
} })
|
|
749
821
|
] }),
|
|
750
|
-
/* @__PURE__ */ (0,
|
|
751
|
-
/* @__PURE__ */ (0,
|
|
752
|
-
/* @__PURE__ */ (0,
|
|
822
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: css2.field, children: [
|
|
823
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: css2.label, children: text("apiKey") }),
|
|
824
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.Input, { type: "password", value: apiKey, placeholder: text("apiKeyPlaceholder"), disabled: working, onChange: (event) => {
|
|
753
825
|
credentialsDirty.current = true;
|
|
754
826
|
setApiKey(event.currentTarget.value);
|
|
755
827
|
} })
|
|
756
828
|
] }),
|
|
757
|
-
/* @__PURE__ */ (0,
|
|
758
|
-
/* @__PURE__ */ (0,
|
|
759
|
-
/* @__PURE__ */ (0,
|
|
829
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: css2.row, children: [
|
|
830
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.Button, { variant: "primary", disabled: working || incomplete, onClick: () => void save(), children: busy === "saving" ? text("saving") : text("save") }),
|
|
831
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.Button, { variant: "outline", disabled: working || incomplete, onClick: () => void testConnection(), children: busy === "testing" ? text("testing") : text("test") })
|
|
760
832
|
] }),
|
|
761
|
-
error === void 0 ? null : /* @__PURE__ */ (0,
|
|
762
|
-
notice === void 0 ? null : /* @__PURE__ */ (0,
|
|
763
|
-
loaded && incomplete ? /* @__PURE__ */ (0,
|
|
833
|
+
error === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { role: "alert", style: css2.error, children: error }),
|
|
834
|
+
notice === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { style: css2.ok, children: notice }),
|
|
835
|
+
loaded && incomplete ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { style: css2.hint, children: text("notConfigured") }) : null
|
|
764
836
|
] }),
|
|
765
|
-
/* @__PURE__ */ (0,
|
|
837
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
766
838
|
ModelListEditor,
|
|
767
839
|
{
|
|
768
840
|
models,
|
|
@@ -775,12 +847,7 @@ function MagpieSettings() {
|
|
|
775
847
|
status: modelsStatus,
|
|
776
848
|
failure: modelsError
|
|
777
849
|
}
|
|
778
|
-
)
|
|
779
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { style: css2.hint, children: [
|
|
780
|
-
text("pluginVersion"),
|
|
781
|
-
" dsh-magpie-connect v",
|
|
782
|
-
PLUGIN_VERSION
|
|
783
|
-
] })
|
|
850
|
+
)
|
|
784
851
|
] });
|
|
785
852
|
}
|
|
786
853
|
|
|
@@ -825,6 +892,19 @@ function apply(ctx) {
|
|
|
825
892
|
MagpieSettings
|
|
826
893
|
)
|
|
827
894
|
);
|
|
895
|
+
ctx.slots.inject(
|
|
896
|
+
"settings.section.icon",
|
|
897
|
+
() => ctx.slots.register(
|
|
898
|
+
{
|
|
899
|
+
name: "settings.section.icon",
|
|
900
|
+
id: "dsh-magpie-connect",
|
|
901
|
+
order: 12,
|
|
902
|
+
locale: NS,
|
|
903
|
+
label: () => text("nav")
|
|
904
|
+
},
|
|
905
|
+
MagpieSectionIcon
|
|
906
|
+
)
|
|
907
|
+
);
|
|
828
908
|
installSettingsNavIcon(ctx, () => text("nav"));
|
|
829
909
|
}
|
|
830
910
|
var inject = ["slots", "locale"];
|