dsh-magpie-connect 0.4.1 → 0.4.4

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/dsh.plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-magpie-connect",
3
3
  "description": "Magpie gateway models for the DeepSeek Harness web GUI",
4
- "version": "0.4.1",
4
+ "version": "0.4.4",
5
5
  "entry": {
6
6
  "name": "dsh-magpie-connect",
7
7
  "inject": [
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
- pluginVersion: "Plugin version:",
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
- pluginVersion: "\u63D2\u4EF6\u7248\u672C\uFF1A",
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
- `[${NAV_ICON_MARKER}] > svg { display: none; }`,
186
- `[${NAV_ICON_MARKER}]::before {`,
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 import_jsx_runtime = require("react/jsx-runtime");
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, import_jsx_runtime.jsxs)("div", { style: css.card, children: [
395
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: css.head, children: [
396
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: css.heading, children: [
397
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { style: css.cardTitle, children: text("models") }),
398
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { style: css.meta, children: text("enabled", { count: enabledRows.length }) })
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, import_jsx_runtime.jsx)(
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, import_jsx_runtime.jsx)("p", { style: css.hint, children: text("saveHint") }),
413
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
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, import_jsx_runtime.jsxs)("p", { style: css.meta, children: [
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, import_jsx_runtime.jsx)(
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, import_jsx_runtime.jsx)("p", { style: css.empty, children: models.length === 0 ? text("fetchEmpty") : text("allRemoved") }) : null,
436
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: css.list, children: visibleRows.map((row) => {
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, import_jsx_runtime.jsxs)("div", { style: css.item, children: [
439
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { style: css.itemMain, children: [
440
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: css.itemId, children: row.id }),
441
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { style: css.chips, children: [
442
- chipsFor(row).map((chip) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: css.chip, children: chip.label }, chip.key)),
443
- source === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { ...css.chip, ...css.chipStale }, children: source.label }, source.key)
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, import_jsx_runtime.jsx)(
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, import_jsx_runtime.jsx)("p", { role: "alert", style: css.error, children: fetchFailure }),
461
- status === "saving" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { style: css.hint, children: text("savingModels") }) : null,
462
- status === "saved" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { style: css.ok, children: text("modelsSaved") }) : null,
463
- status === "error" && props.failure !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { role: "alert", style: css.error, children: props.failure }) : null,
464
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
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, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
473
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { variant: "outline", onClick: closePicker, children: text("cancel") }),
474
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { variant: "primary", onClick: adoptPicked, children: text("fetchAdopt") })
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, import_jsx_runtime.jsxs)("div", { style: css.candidateToolbar, children: [
478
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
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, import_jsx_runtime.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") })
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, import_jsx_runtime.jsx)("p", { style: css.candidateEmpty, role: "status", children: text("fetchNoMatches") }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { style: css.candidateList, children: visibleCandidates.map((candidate) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { style: css.candidate, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { style: css.candidateLabel, children: [
492
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
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, import_jsx_runtime.jsxs)("span", { style: css.candidateText, children: [
502
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: css.candidateId, title: candidate.id, children: candidate.id }),
503
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: css.chips, children: chipsFor(candidate).map((chip) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: css.chip, children: chip.label }, chip.key)) })
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
  ]
@@ -558,12 +583,44 @@ function createWriteQueue(write, onSettled) {
558
583
  };
559
584
  }
560
585
 
586
+ // src/client/load-retry.ts
587
+ var PENDING_RETRY_DELAY_MS = 1500;
588
+ var PENDING_RETRY_LIMIT = 6;
589
+ function shouldRetryPending(snapshot2, attempts, limit = PENDING_RETRY_LIMIT) {
590
+ return snapshot2?.status === "pending" && attempts < limit;
591
+ }
592
+
561
593
  // src/client/page.tsx
562
- var import_jsx_runtime2 = require("react/jsx-runtime");
563
- var PLUGIN_VERSION = "0.4.1";
594
+ var import_jsx_runtime3 = require("react/jsx-runtime");
595
+ var PLUGIN_VERSION = "0.4.4";
596
+ var REPO_URL = "https://github.com/bitxeno/dsh-magpie-connect";
564
597
  var css2 = {
565
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" },
566
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
+ },
567
624
  intro: { margin: 0, fontSize: 14, lineHeight: "22px", color: "var(--dsw-alias-label-secondary)" },
568
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)" },
569
626
  cardTitle: { margin: 0, fontSize: 15, lineHeight: "22px", fontWeight: 600, color: "var(--dsw-alias-label-primary)" },
@@ -618,6 +675,7 @@ function MagpieSettings() {
618
675
  const [modelsStatus, setModelsStatus] = (0, import_react3.useState)("idle");
619
676
  const [modelsError, setModelsError] = (0, import_react3.useState)(void 0);
620
677
  const [loaded, setLoaded] = (0, import_react3.useState)(false);
678
+ const credentialsDirty = (0, import_react3.useRef)(false);
621
679
  const modelsQueue = (0, import_react3.useRef)(
622
680
  createWriteQueue((next) => saveEnabledModels(next), (outcome) => {
623
681
  if (outcome.ok) {
@@ -633,6 +691,16 @@ function MagpieSettings() {
633
691
  let alive = true;
634
692
  let retry;
635
693
  let attempts = 0;
694
+ const rereadModels = async () => {
695
+ const value = await request("/api/magpie-models");
696
+ if (!alive) return;
697
+ setModels(value.models ?? []);
698
+ if (shouldRetryPending(value.snapshot, attempts)) {
699
+ attempts += 1;
700
+ retry = setTimeout(() => void rereadModels().catch(() => {
701
+ }), PENDING_RETRY_DELAY_MS);
702
+ }
703
+ };
636
704
  const load = async () => {
637
705
  const [settingsValue, modelsValue] = await Promise.all([
638
706
  request("/api/magpie-settings"),
@@ -642,15 +710,17 @@ function MagpieSettings() {
642
710
  const settings = settingsValue;
643
711
  const listed = modelsValue.models ?? [];
644
712
  const snapshot2 = modelsValue.snapshot;
645
- setBaseUrl(settings.baseUrl ?? "");
646
- setApiKey(settings.apiKey ?? "");
713
+ if (!credentialsDirty.current) {
714
+ setBaseUrl(settings.baseUrl ?? "");
715
+ setApiKey(settings.apiKey ?? "");
716
+ }
647
717
  setEnabled(settings.enabledModels);
648
718
  setModels(listed);
649
719
  setLoaded(true);
650
- if (snapshot2?.status === "pending" && attempts < 20) {
720
+ if (shouldRetryPending(snapshot2, attempts)) {
651
721
  attempts += 1;
652
- retry = setTimeout(() => void load().catch(() => {
653
- }), 1e3);
722
+ retry = setTimeout(() => void rereadModels().catch(() => {
723
+ }), PENDING_RETRY_DELAY_MS);
654
724
  }
655
725
  };
656
726
  void load().catch((cause) => {
@@ -714,29 +784,57 @@ function MagpieSettings() {
714
784
  };
715
785
  const working = busy !== "idle";
716
786
  const incomplete = baseUrl.trim() === "" || apiKey.trim() === "";
717
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { style: css2.section, children: [
718
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { style: css2.title, children: text("title") }),
719
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { style: css2.intro, children: text("intro") }),
720
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: css2.card, children: [
721
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { style: css2.cardTitle, children: text("connection") }),
722
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { style: css2.hint, children: text("requiredNote") }),
723
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: css2.field, children: [
724
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: css2.label, children: text("baseUrl") }),
725
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.Input, { value: baseUrl, placeholder: text("baseUrlPlaceholder"), disabled: working, onChange: (event) => setBaseUrl(event.currentTarget.value) })
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") })
726
798
  ] }),
727
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: css2.field, children: [
728
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: css2.label, children: text("apiKey") }),
729
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.Input, { type: "password", value: apiKey, placeholder: text("apiKeyPlaceholder"), disabled: working, onChange: (event) => setApiKey(event.currentTarget.value) })
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) => {
818
+ credentialsDirty.current = true;
819
+ setBaseUrl(event.currentTarget.value);
820
+ } })
730
821
  ] }),
731
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: css2.row, children: [
732
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.Button, { variant: "primary", disabled: working || incomplete, onClick: () => void save(), children: busy === "saving" ? text("saving") : text("save") }),
733
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.Button, { variant: "outline", disabled: working || incomplete, onClick: () => void testConnection(), children: busy === "testing" ? text("testing") : text("test") })
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) => {
825
+ credentialsDirty.current = true;
826
+ setApiKey(event.currentTarget.value);
827
+ } })
734
828
  ] }),
735
- error === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { role: "alert", style: css2.error, children: error }),
736
- notice === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { style: css2.ok, children: notice }),
737
- loaded && incomplete ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { style: css2.hint, children: text("notConfigured") }) : null
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") })
832
+ ] }),
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
738
836
  ] }),
739
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
837
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
740
838
  ModelListEditor,
741
839
  {
742
840
  models,
@@ -749,12 +847,7 @@ function MagpieSettings() {
749
847
  status: modelsStatus,
750
848
  failure: modelsError
751
849
  }
752
- ),
753
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { style: css2.hint, children: [
754
- text("pluginVersion"),
755
- " dsh-magpie-connect v",
756
- PLUGIN_VERSION
757
- ] })
850
+ )
758
851
  ] });
759
852
  }
760
853
 
@@ -799,6 +892,19 @@ function apply(ctx) {
799
892
  MagpieSettings
800
893
  )
801
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
+ );
802
908
  installSettingsNavIcon(ctx, () => text("nav"));
803
909
  }
804
910
  var inject = ["slots", "locale"];
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Policy for the settings page's "catalog still warming up" re-read.
3
+ *
4
+ * The Host answers `GET /api/magpie-models` before its catalog has warmed, with
5
+ * a `pending` snapshot. The page re-reads until it turns `ready`, but the first
6
+ * version retried a *full* load (settings **and** models) every second for 20
7
+ * rounds. Each round unconditionally wrote `baseUrl`/`apiKey` back from the
8
+ * server, so a user editing the URL had their keystrokes overwritten about once
9
+ * a second — the field looked like it "auto-typed" the stored value. Extracted
10
+ * here so the policy is testable and the page cannot regress it.
11
+ */
12
+ /** Status emitted by the catalog while no live directory has landed yet. */
13
+ export type SnapshotStatus = {
14
+ status?: string;
15
+ } | undefined;
16
+ /**
17
+ * Gap between pending re-reads. Long enough that a human typing is not fighting
18
+ * the loop, short enough that a local warm-up (usually well under a second) is
19
+ * caught on the first or second try.
20
+ */
21
+ export declare const PENDING_RETRY_DELAY_MS = 1500;
22
+ /**
23
+ * Cap on re-reads. 20 rounds (~20 s) was both noisy and pointless: a gateway
24
+ * that is genuinely unreachable does not become reachable by polling, and the
25
+ * directory has its own refresh loop. Six rounds span ~9 s — plenty for a cold
26
+ * local catalog, far short of twenty seconds of churn.
27
+ */
28
+ export declare const PENDING_RETRY_LIMIT = 6;
29
+ /**
30
+ * Whether a pending snapshot still warrants another read.
31
+ *
32
+ * Only `pending` retries: `ready`/`stale`/`error` are terminal — `stale` means a
33
+ * directory exists (re-reading would not change it), and `error` needs a user
34
+ * action (fix the URL/key), not a spin.
35
+ * @param snapshot - the catalog snapshot from the last models read.
36
+ * @param attempts - how many retries have already been scheduled.
37
+ * @param limit - maximum retries; defaults to {@link PENDING_RETRY_LIMIT}.
38
+ */
39
+ export declare function shouldRetryPending(snapshot: SnapshotStatus, attempts: number, limit?: number): boolean;
@@ -1,24 +1,51 @@
1
1
  /**
2
- * The Magpie glyph in the settings nav rail.
3
- *
4
- * `settings.section` projects only `id` / `order` / `label` (see
5
- * `SettingsRoot` in `dsh-client-ui-settings-general`), and its nav glyph is a
6
- * hardcoded `navIcon(id)` map — `account`, `models`, `agent-presets`,
7
- * `plugins`, `archived-sessions`, then a fallback gear for every other id.
8
- * A registrant cannot supply an icon, so this plugin's row would draw the
9
- * fallback gear.
10
- *
11
- * Until that slot grows an `icon` field, the row is claimed after the dialog
12
- * mounts and the gear is swapped for the mark: the same technique
13
- * `dshmarket` and `dsh-better-sidebar` use. Scope is deliberately narrow —
14
- * only the row whose visible text equals this plugin's own localized section
15
- * label is marked, the marker and the stylesheet belong to a `ctx.effect` so
16
- * they are removed with the fiber, and a locale switch re-claims the row
17
- * through the MutationObserver so the label and the glyph never disagree.
18
- *
19
- * Delete this module (and its call in `client/index.ts`) the day
20
- * `settings.section` grows an `icon` field.
2
+ * The Magpie glyph in the settings nav rail (legacy DOM fallback).
3
+ *
4
+ * Newer DSH shells declare a `settings.section.icon` slot addressed by the
5
+ * matching section id, so on those hosts the mark is supplied as real slot
6
+ * content (see `section-icon.tsx` / `client/index.ts`) and no DOM surgery is
7
+ * needed.
8
+ *
9
+ * Older shells (before `settings.section.icon` existed) project only
10
+ * `id` / `order` / `label` from `settings.section` and draw the nav glyph from
11
+ * a hardcoded `navIcon(id)` map — `account`, `models`, `agent-presets`,
12
+ * `plugins`, `archived-sessions`, then a fallback gear for every other id. A
13
+ * registrant cannot supply an icon there, so this plugin's row would draw the
14
+ * fallback gear. This module keeps that old path working: it claims the row
15
+ * after the dialog mounts and swaps the gear for the mark (the same technique
16
+ * `dshmarket` and `dsh-better-sidebar` use).
17
+ *
18
+ * Because a host that DOES render the slot icon also matches this row, the
19
+ * fallback must stand down whenever the slot glyph is present — otherwise the
20
+ * row shows two icons (the CSS bird plus the slot's SVG). The stylesheet gates
21
+ * both the gear-hiding and the bird on `:not(:has([data-dsh-magpie-slot-glyph]))`,
22
+ * so a rendered slot icon owns the row and the fallback paints nothing.
23
+ *
24
+ * Scope is deliberately narrow — only the row whose visible text equals this
25
+ * plugin's own localized section label is marked, the marker and the
26
+ * stylesheet belong to a `ctx.effect` so they are removed with the fiber, and
27
+ * a locale switch re-claims the row through the MutationObserver so the label
28
+ * and the glyph never disagree.
29
+ *
30
+ * Delete this module (and its call in `client/index.ts`) once the plugin no
31
+ * longer supports hosts without `settings.section.icon`.
32
+ */
33
+ /**
34
+ * Marks the real slot glyph rendered by `MagpieSectionIcon`
35
+ * (see `section-icon.tsx`). When the host renders it, the legacy fallback below
36
+ * stands down so the row never shows two birds.
21
37
  */
38
+ export declare const SLOT_GLYPH_MARKER = "data-dsh-magpie-slot-glyph";
39
+ /**
40
+ * The Magpie bird path, verbatim from the source art (44×44 viewBox).
41
+ *
42
+ * Painted pure black in the mask below on purpose: a mask reads alpha only,
43
+ * and the visible colour comes from the element's `background-color:
44
+ * currentColor`, so the mark follows the nav row's own active/hover colours.
45
+ */
46
+ export declare const 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";
47
+ /** The mask URL for the mark (encoded at runtime, never hand-escaped). */
48
+ export declare function birdMaskUrl(svg?: string): string;
22
49
  /**
23
50
  * Whether a nav row is this plugin's own.
24
51
  *
@@ -31,6 +58,14 @@
31
58
  * @returns whether the row belongs to this plugin.
32
59
  */
33
60
  export declare function isOwnNavRow(rowText: unknown, wantedLabel: unknown): boolean;
61
+ /**
62
+ * Stylesheet for the marked row: hide the shell's gear, draw the mark.
63
+ *
64
+ * Both rules are gated on the row NOT already carrying the real slot glyph
65
+ * (`:not(:has(...))`), so on a host that renders `settings.section.icon` the
66
+ * fallback paints nothing and the row keeps exactly one icon.
67
+ */
68
+ export declare function navIconCss(maskUrl: string): string;
34
69
  /** Minimal surface this feature needs from the client context. */
35
70
  export interface NavIconContext {
36
71
  effect(fn: () => () => void, label?: string): unknown;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The Magpie mark as real `settings.section.icon` slot content.
3
+ *
4
+ * Newer DSH shells declare a `settings.section.icon` list slot: the shell keeps
5
+ * the nav button and label, and any entry whose registration id equals a
6
+ * section id supplies that row's glyph (otherwise the shell's default gear is
7
+ * used). Registering here is the supported way to give the Magpie section its
8
+ * bird, and it replaces — not accompanies — the fallback gear, so exactly one
9
+ * icon is drawn.
10
+ *
11
+ * Older shells never declare this slot, so the injection simply never runs and
12
+ * the legacy DOM claim in `nav-icon.ts` takes over. The glyph carries
13
+ * {@link SLOT_GLYPH_MARKER} so that fallback knows to stand down here.
14
+ */
15
+ /** Owner share the shell supplies to a nav icon. */
16
+ export interface SettingsSectionIconOwnerProps {
17
+ /** Requested square edge in pixels. */
18
+ size: number;
19
+ /** Whether this section is currently selected. */
20
+ active: boolean;
21
+ }
22
+ /**
23
+ * Render the mark.
24
+ *
25
+ * `fill="currentColor"` makes the bird follow the row's own label colour, so
26
+ * the active/hover states stay consistent without extra styling. The source
27
+ * art is a 44×44 viewBox; scaling to the requested size is exact.
28
+ * @param props - the shell's icon owner share.
29
+ * @returns the SVG glyph.
30
+ */
31
+ export declare function MagpieSectionIcon(props: Partial<SettingsSectionIconOwnerProps>): unknown;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-magpie-connect",
3
3
  "description": "Magpie gateway models for DeepSeek Harness (DSH): native dsh-llm adapter plugin with image + responses + thinking levels.",
4
- "version": "0.4.1",
4
+ "version": "0.4.4",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "repository": {