dsh-skill-picker 0.5.25 → 0.5.26

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/lib/client.js CHANGED
@@ -26169,6 +26169,38 @@ async function skillOp(action, payload = {}) {
26169
26169
  return { ok: false, error: String(cause?.message ?? cause) };
26170
26170
  }
26171
26171
  }
26172
+ function focusComposer(from, onlyIfFocused = false) {
26173
+ try {
26174
+ let node = from;
26175
+ for (let depth = 0; depth < 8 && node !== null && node !== void 0; depth += 1) {
26176
+ const editor = typeof node.querySelector === "function" ? node.querySelector('[contenteditable="true"], textarea') : null;
26177
+ if (editor !== null && editor !== void 0) {
26178
+ if (onlyIfFocused && document.activeElement !== editor) return false;
26179
+ if (typeof editor.focus === "function") editor.focus();
26180
+ try {
26181
+ if (editor.isContentEditable === true) {
26182
+ const range = document.createRange();
26183
+ range.selectNodeContents(editor);
26184
+ range.collapse(false);
26185
+ const selection = window.getSelection();
26186
+ if (selection !== null && selection !== void 0) {
26187
+ selection.removeAllRanges();
26188
+ selection.addRange(range);
26189
+ }
26190
+ } else if (typeof editor.setSelectionRange === "function") {
26191
+ const end = String(editor.value ?? "").length;
26192
+ editor.setSelectionRange(end, end);
26193
+ }
26194
+ } catch {
26195
+ }
26196
+ return true;
26197
+ }
26198
+ node = node.parentElement;
26199
+ }
26200
+ } catch {
26201
+ }
26202
+ return false;
26203
+ }
26172
26204
  function isUserFacingSkill(skill) {
26173
26205
  const flag = skill?.userInvocable ?? skill?.invocation?.userInvocable;
26174
26206
  return flag !== false;
@@ -26198,9 +26230,12 @@ function groupByPinned(skills, usage, pinned) {
26198
26230
  else rest.push(skill);
26199
26231
  }
26200
26232
  return [
26201
- { title: "\u{1F4CC} \u7F6E\u9876", items: pinnedList },
26202
- { title: "\u{1F525} \u6700\u8FD1\u4F7F\u7528", items: recent },
26203
- { title: "\u{1F5C2}\uFE0F \u5168\u90E8", items: rest }
26233
+ // Plain titles, no emoji: these are section headings, and DSH's own
26234
+ // headings (侧栏的「工作区」/「会话」) are plain text. 国豪: "加图标,那前面
26235
+ // 一团火,这种图标看着不像 DSH 的风格".
26236
+ { title: "\u7F6E\u9876", items: pinnedList },
26237
+ { title: "\u6700\u8FD1\u4F7F\u7528", items: recent },
26238
+ { title: "\u5168\u90E8", items: rest }
26204
26239
  ].filter((group) => group.items.length > 0);
26205
26240
  }
26206
26241
  var pinyinCache = /* @__PURE__ */ new Map();
@@ -26272,6 +26307,7 @@ var buttonStyle = {
26272
26307
  lineHeight: "1",
26273
26308
  flex: "none"
26274
26309
  };
26310
+ var FONT_FAMILY = 'var(--dsw-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif)';
26275
26311
  var popoverStyle = {
26276
26312
  position: "fixed",
26277
26313
  right: "24px",
@@ -26284,20 +26320,34 @@ var popoverStyle = {
26284
26320
  borderRadius: "12px",
26285
26321
  boxShadow: "0 8px 28px rgba(0,0,0,0.35)",
26286
26322
  overflow: "hidden",
26287
- zIndex: 1e3
26323
+ zIndex: 1e3,
26324
+ fontFamily: FONT_FAMILY,
26325
+ fontSize: "14px",
26326
+ lineHeight: "24px"
26288
26327
  };
26289
26328
  var searchStyle = {
26290
26329
  boxSizing: "border-box",
26291
26330
  width: "calc(100% - 16px)",
26331
+ height: "32px",
26332
+ // The panel is a column flex container with a max-height, so any child that
26333
+ // can shrink will: the field measured 21px instead of the declared height
26334
+ // until this was pinned. The list below is the thing that should scroll.
26335
+ flex: "none",
26292
26336
  margin: "8px",
26293
- padding: "6px 10px",
26294
- border: "1px solid var(--dsw-alias-border-l1, rgba(128,128,128,0.3))",
26337
+ padding: "0 10px",
26338
+ border: "1px solid transparent",
26295
26339
  borderRadius: "8px",
26296
26340
  background: "var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,0.1))",
26297
26341
  color: "var(--dsw-alias-label-primary, #e6ebf2)",
26298
- fontSize: "13px",
26342
+ fontFamily: FONT_FAMILY,
26343
+ fontSize: "14px",
26344
+ lineHeight: "20px",
26299
26345
  outline: "none"
26300
26346
  };
26347
+ var searchFocusStyle = {
26348
+ background: "var(--dsw-alias-interactive-bg-active, var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,0.16)))",
26349
+ boxShadow: "0 0 0 1px var(--dsw-alias-border-l2, rgba(128,128,128,0.35))"
26350
+ };
26301
26351
  var listStyle = {
26302
26352
  overflowY: "auto",
26303
26353
  flex: "auto",
@@ -26315,15 +26365,22 @@ var itemStyle = {
26315
26365
  background: "transparent",
26316
26366
  color: "var(--dsw-alias-label-primary, #e6ebf2)",
26317
26367
  cursor: "pointer",
26318
- textAlign: "left"
26368
+ textAlign: "left",
26369
+ // Explicit: a bare <button> keeps the browser's own 13.3333px / Arial.
26370
+ fontFamily: FONT_FAMILY,
26371
+ fontSize: "14px",
26372
+ lineHeight: "22px",
26373
+ fontWeight: 400
26319
26374
  };
26320
26375
  var nameStyle = {
26321
- fontFamily: "var(--ds-font-family-code, ui-monospace, monospace)",
26322
- fontSize: "13px",
26323
- fontWeight: 500
26376
+ fontFamily: FONT_FAMILY,
26377
+ fontSize: "14px",
26378
+ fontWeight: 400,
26379
+ lineHeight: "22px"
26324
26380
  };
26325
26381
  var descStyle = {
26326
26382
  color: "var(--dsw-alias-label-tertiary, #8a94a6)",
26383
+ fontFamily: FONT_FAMILY,
26327
26384
  fontSize: "12px",
26328
26385
  lineHeight: "16px",
26329
26386
  overflow: "hidden",
@@ -26334,20 +26391,9 @@ var descStyle = {
26334
26391
  var statusStyle = {
26335
26392
  padding: "12px",
26336
26393
  color: "var(--dsw-alias-label-tertiary, #8a94a6)",
26394
+ fontFamily: FONT_FAMILY,
26337
26395
  fontSize: "13px"
26338
26396
  };
26339
- var actionSpanStyle = {
26340
- flex: "none",
26341
- marginLeft: "6px",
26342
- padding: "2px 4px",
26343
- borderRadius: "6px",
26344
- fontSize: "12px",
26345
- lineHeight: "16px",
26346
- cursor: "pointer",
26347
- color: "var(--dsw-alias-label-tertiary, #8a94a6)",
26348
- opacity: 0.55,
26349
- userSelect: "none"
26350
- };
26351
26397
  var noticeStyle = {
26352
26398
  display: "flex",
26353
26399
  alignItems: "center",
@@ -26366,18 +26412,21 @@ var menuStyle = {
26366
26412
  minWidth: "196px",
26367
26413
  padding: "4px",
26368
26414
  borderRadius: "10px",
26369
- border: "1px solid var(--dsw-alias-border-secondary, rgba(128,128,128,0.24))",
26370
- background: "var(--dsw-alias-bg-elevated, #23262e)",
26415
+ border: "1px solid var(--dsw-alias-border-l1, rgba(128,128,128,0.35))",
26416
+ background: "var(--dsw-specific-tip, #23262e)",
26417
+ backdropFilter: "blur(8px)",
26371
26418
  boxShadow: "0 8px 28px rgba(0,0,0,0.36)",
26372
- color: "var(--dsw-alias-label-primary, #e6e9ef)",
26373
- fontSize: "13px",
26419
+ color: "var(--dsw-alias-label-primary, #e6ebf2)",
26420
+ fontFamily: FONT_FAMILY,
26421
+ fontSize: "14px",
26422
+ lineHeight: "24px",
26374
26423
  userSelect: "none"
26375
26424
  };
26376
26425
  var menuHeaderStyle = {
26377
26426
  padding: "6px 10px 4px",
26378
- fontSize: "11px",
26427
+ fontSize: "12px",
26379
26428
  color: "var(--dsw-alias-label-tertiary, #8a94a6)",
26380
- borderBottom: "1px solid var(--dsw-alias-border-secondary, rgba(128,128,128,0.18))",
26429
+ borderBottom: "1px solid var(--dsw-alias-border-l1, rgba(128,128,128,0.28))",
26381
26430
  marginBottom: "4px",
26382
26431
  overflow: "hidden",
26383
26432
  textOverflow: "ellipsis",
@@ -26389,6 +26438,14 @@ var menuItemStyle = {
26389
26438
  cursor: "pointer",
26390
26439
  whiteSpace: "nowrap"
26391
26440
  };
26441
+ var menuItemHandlers = {
26442
+ onMouseEnter: (event) => {
26443
+ event.currentTarget.style.background = "var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,0.16))";
26444
+ },
26445
+ onMouseLeave: (event) => {
26446
+ event.currentTarget.style.background = "transparent";
26447
+ }
26448
+ };
26392
26449
  function BoltIcon() {
26393
26450
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", "aria-hidden": "true", style: { display: "block" }, children: [
26394
26451
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", { id: "dsh-sp-bolt-grad", x1: "0", y1: "0", x2: "0", y2: "1", children: [
@@ -26415,7 +26472,14 @@ function SkillPickerButton(props) {
26415
26472
  const [disabledSkills, setDisabledSkills] = (0, import_react.useState)([]);
26416
26473
  const [busySkill, setBusySkill] = (0, import_react.useState)("");
26417
26474
  const [notice, setNotice] = (0, import_react.useState)(void 0);
26475
+ (0, import_react.useEffect)(() => {
26476
+ if (notice === void 0) return void 0;
26477
+ const timer = window.setTimeout(() => setNotice(void 0), notice.undo === void 0 ? 2600 : 1e4);
26478
+ return () => window.clearTimeout(timer);
26479
+ }, [notice]);
26418
26480
  const [menu, setMenu] = (0, import_react.useState)(void 0);
26481
+ const [view, setView] = (0, import_react.useState)("all");
26482
+ const [searchFocus, setSearchFocus] = (0, import_react.useState)(false);
26419
26483
  const [query, setQuery] = (0, import_react.useState)("");
26420
26484
  const [usage, setUsage] = (0, import_react.useState)(() => loadUsage());
26421
26485
  const [pinned, setPinned] = (0, import_react.useState)(() => loadPinned());
@@ -26470,7 +26534,8 @@ function SkillPickerButton(props) {
26470
26534
  const res = await fetch(`/dsh-skill-picker/skills${cwd}`, { headers: { accept: "application/json" } });
26471
26535
  const json = await res.json();
26472
26536
  if (!json.ok) throw new Error(json.error || "bad response");
26473
- setSkills((Array.isArray(json.skills) ? json.skills : []).filter(isUserFacingSkill));
26537
+ const listed = Array.isArray(json.skills) ? json.skills : [];
26538
+ setSkills(listed.filter((skill) => isUserFacingSkill(skill) && skill.disabled !== true));
26474
26539
  setSource("host");
26475
26540
  } catch (cause) {
26476
26541
  setError(String(cause?.message ?? cause));
@@ -26559,6 +26624,8 @@ function SkillPickerButton(props) {
26559
26624
  }
26560
26625
  void syncSharedState();
26561
26626
  setUsage(loadUsage());
26627
+ setNotice(void 0);
26628
+ setView("all");
26562
26629
  void load();
26563
26630
  void loadDisabled();
26564
26631
  }
@@ -26582,6 +26649,11 @@ function SkillPickerButton(props) {
26582
26649
  saveUsage(nextUsage);
26583
26650
  setOpen(false);
26584
26651
  setQuery("");
26652
+ const from = boxRef.current;
26653
+ window.requestAnimationFrame(() => {
26654
+ focusComposer(from);
26655
+ window.setTimeout(() => focusComposer(from, true), 60);
26656
+ });
26585
26657
  };
26586
26658
  const togglePin = (name) => {
26587
26659
  const next = pinned.includes(name) ? pinned.filter((n) => n !== name) : [...pinned, name];
@@ -26596,7 +26668,12 @@ function SkillPickerButton(props) {
26596
26668
  document.addEventListener("mousedown", onDown);
26597
26669
  return () => document.removeEventListener("mousedown", onDown);
26598
26670
  }, [open]);
26599
- const groups = groupByPinned(skills ?? [], usage, pinned);
26671
+ const disabledNames = new Set(disabledSkills.map((skill) => skill.name));
26672
+ const groups = groupByPinned(
26673
+ (skills ?? []).filter((skill) => !disabledNames.has(skill.name)),
26674
+ usage,
26675
+ pinned
26676
+ );
26600
26677
  const flat = groups.flatMap((group) => group.items);
26601
26678
  const filtered = (() => {
26602
26679
  const q = query.trim().toLowerCase();
@@ -26605,6 +26682,11 @@ function SkillPickerButton(props) {
26605
26682
  })();
26606
26683
  const showTitles = query.trim() === "" && groups.length > 1;
26607
26684
  const filteredNames = new Set(filtered.map((skill) => skill.name));
26685
+ const offFiltered = (() => {
26686
+ const q = query.trim().toLowerCase();
26687
+ if (q === "") return disabledSkills;
26688
+ return disabledSkills.filter((skill) => matchRank(skill, q) < 4);
26689
+ })();
26608
26690
  (0, import_react.useEffect)(() => {
26609
26691
  setActive(0);
26610
26692
  }, [query]);
@@ -26630,291 +26712,277 @@ function SkillPickerButton(props) {
26630
26712
  setOpen(false);
26631
26713
  }
26632
26714
  };
26633
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ref: boxRef, style: { position: "relative", display: "inline-flex", flex: "none" }, children: [
26634
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
26635
- "button",
26636
- {
26637
- type: "button",
26638
- onClick: toggle,
26639
- title: `\u9009\u62E9\u6280\u80FD\uFF08\u63D2\u5165 /\u6280\u80FD\u540D \u5230\u53D1\u9001\u6846\uFF09${source === "host" ? "\u3000\xB7\u3000\u5217\u8868\u6765\u81EA\u672C\u5730\u626B\u63CF" : ""}${slashEnhancementMode() === "runtime" ? "\u3000\xB7\u3000/ \u589E\u5F3A\uFF1A\u8FD0\u884C\u65F6\u63A5\u7BA1" : ""}`,
26640
- "aria-label": "\u9009\u62E9\u6280\u80FD",
26641
- style: {
26642
- ...buttonStyle,
26643
- ...open ? { color: "var(--dsw-alias-label-primary-bluish, #4cc9f0)" } : {}
26644
- },
26645
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BoltIcon, {})
26646
- }
26647
- ),
26648
- open && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { ...popoverStyle, bottom: `${panelBottom}px` }, children: [
26715
+ return (
26716
+ // The marker is how dsh-pocket's mobile "file open guard" learns to leave
26717
+ // this panel alone: its rows are <button>s whose text starts with "/技能名",
26718
+ // which its looksLikeFilePath() reads as a Windows path, so it swallowed the
26719
+ // click and popped "手机上无法直接打开电脑上的文件" (see the pocket patch of
26720
+ // 2026-10-02). Guarded there, marked here.
26721
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ref: boxRef, "data-dsh-skill-picker": "1", style: { position: "relative", display: "inline-flex", flex: "none" }, children: [
26649
26722
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
26650
- "input",
26723
+ "button",
26651
26724
  {
26652
- value: query,
26653
- onChange: (event) => setQuery(event.target.value),
26654
- onKeyDown,
26655
- placeholder: "\u641C\u7D22\u6280\u80FD\u2026\uFF08\u2191\u2193 \u9009\u62E9\uFF0CEnter \u63D2\u5165\uFF09",
26656
- style: searchStyle,
26657
- autoFocus: true
26725
+ type: "button",
26726
+ onClick: toggle,
26727
+ title: `\u9009\u62E9\u6280\u80FD\uFF08\u63D2\u5165 /\u6280\u80FD\u540D \u5230\u53D1\u9001\u6846\uFF09${source === "host" ? "\u3000\xB7\u3000\u5217\u8868\u6765\u81EA\u672C\u5730\u626B\u63CF" : ""}${slashEnhancementMode() === "runtime" ? "\u3000\xB7\u3000/ \u589E\u5F3A\uFF1A\u8FD0\u884C\u65F6\u63A5\u7BA1" : ""}`,
26728
+ "aria-label": "\u9009\u62E9\u6280\u80FD",
26729
+ style: {
26730
+ ...buttonStyle,
26731
+ ...open ? { color: "var(--dsw-alias-label-primary-bluish, #4cc9f0)" } : {}
26732
+ },
26733
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BoltIcon, {})
26658
26734
  }
26659
26735
  ),
26660
- error !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: statusStyle, children: `\u52A0\u8F7D\u5931\u8D25\uFF1A${error}` }) : skills === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: statusStyle, children: "\u52A0\u8F7D\u4E2D\u2026" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
26661
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: listStyle, children: filtered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: statusStyle, children: "\u6CA1\u6709\u5339\u914D\u7684\u6280\u80FD" }) : (() => {
26662
- let itemIndex = 0;
26663
- const renderItem = (skill, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
26664
- "button",
26736
+ open && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { ...popoverStyle, bottom: `${panelBottom}px` }, children: [
26737
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
26738
+ "input",
26739
+ {
26740
+ value: query,
26741
+ onChange: (event) => setQuery(event.target.value),
26742
+ onKeyDown,
26743
+ onFocus: () => setSearchFocus(true),
26744
+ onBlur: () => setSearchFocus(false),
26745
+ placeholder: "\u641C\u7D22\u6280\u80FD\u2026\uFF08\u2191\u2193 \u9009\u62E9\uFF0CEnter \u63D2\u5165\uFF09",
26746
+ style: { ...searchStyle, ...searchFocus ? searchFocusStyle : {} },
26747
+ autoFocus: true
26748
+ }
26749
+ ),
26750
+ error !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: statusStyle, children: `\u52A0\u8F7D\u5931\u8D25\uFF1A${error}` }) : skills === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: statusStyle, children: "\u52A0\u8F7D\u4E2D\u2026" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
26751
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: listStyle, children: view === "off" ? offFiltered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: statusStyle, children: query.trim() === "" ? "\u6CA1\u6709\u88AB\u5173\u95ED\u7684\u6280\u80FD" : "\u6CA1\u6709\u5339\u914D\u7684\u5DF2\u5173\u95ED\u6280\u80FD" }) : offFiltered.map((skill) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
26752
+ "div",
26665
26753
  {
26666
- type: "button",
26667
- ref: (el) => {
26668
- itemRefs.current[index] = el;
26669
- },
26670
- onClick: () => pick(skill.name),
26671
26754
  onContextMenu: (event) => {
26672
26755
  event.preventDefault();
26673
26756
  event.stopPropagation();
26674
- openMenu(event, skill, false);
26757
+ openMenu(event, skill, true);
26675
26758
  },
26676
26759
  onTouchStart: (event) => {
26677
26760
  const touch = event.touches?.[0];
26678
26761
  if (touch === void 0) return;
26679
26762
  longPressRef.current = window.setTimeout(
26680
- () => openMenu({ clientX: touch.clientX, clientY: touch.clientY }, skill, false),
26763
+ () => openMenu({ clientX: touch.clientX, clientY: touch.clientY }, skill, true),
26681
26764
  500
26682
26765
  );
26683
26766
  },
26684
26767
  onTouchEnd: () => window.clearTimeout(longPressRef.current),
26685
26768
  onTouchMove: () => window.clearTimeout(longPressRef.current),
26686
- onMouseEnter: (event) => {
26687
- setActive(index);
26688
- event.currentTarget.style.background = "var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,0.12))";
26689
- },
26690
- onMouseLeave: (event) => {
26691
- event.currentTarget.style.background = "transparent";
26769
+ style: { ...itemStyle, flexDirection: "column", alignItems: "flex-start", opacity: 0.6 },
26770
+ children: [
26771
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: nameStyle, children: `/${skill.name}` }),
26772
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: descStyle, children: skill.description ?? "" })
26773
+ ]
26774
+ },
26775
+ `off-${skill.name}`
26776
+ )) : filtered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: statusStyle, children: "\u6CA1\u6709\u5339\u914D\u7684\u6280\u80FD" }) : (() => {
26777
+ let itemIndex = 0;
26778
+ const renderItem = (skill, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
26779
+ "button",
26780
+ {
26781
+ type: "button",
26782
+ ref: (el) => {
26783
+ itemRefs.current[index] = el;
26784
+ },
26785
+ onClick: () => pick(skill.name),
26786
+ onContextMenu: (event) => {
26787
+ event.preventDefault();
26788
+ event.stopPropagation();
26789
+ openMenu(event, skill, false);
26790
+ },
26791
+ onTouchStart: (event) => {
26792
+ const touch = event.touches?.[0];
26793
+ if (touch === void 0) return;
26794
+ longPressRef.current = window.setTimeout(
26795
+ () => openMenu({ clientX: touch.clientX, clientY: touch.clientY }, skill, false),
26796
+ 500
26797
+ );
26798
+ },
26799
+ onTouchEnd: () => window.clearTimeout(longPressRef.current),
26800
+ onTouchMove: () => window.clearTimeout(longPressRef.current),
26801
+ onMouseEnter: (event) => {
26802
+ setActive(index);
26803
+ event.currentTarget.style.background = "var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,0.12))";
26804
+ },
26805
+ onMouseLeave: (event) => {
26806
+ event.currentTarget.style.background = "transparent";
26807
+ },
26808
+ style: {
26809
+ ...itemStyle,
26810
+ flexDirection: "row",
26811
+ alignItems: "center",
26812
+ ...index === active ? { background: "var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,0.12))" } : {}
26813
+ },
26814
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { style: { display: "flex", flexDirection: "column", alignItems: "flex-start", gap: "2px", flex: "1", minWidth: "0" }, children: [
26815
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: nameStyle, children: `/${skill.name}` }),
26816
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: descStyle, children: skill.description ?? "" })
26817
+ ] })
26692
26818
  },
26819
+ skill.name
26820
+ );
26821
+ if (!showTitles) {
26822
+ return filtered.map((skill) => renderItem(skill, itemIndex++));
26823
+ }
26824
+ return groups.map((group) => {
26825
+ const items = group.items.filter((skill) => filteredNames.has(skill.name));
26826
+ if (items.length === 0) return null;
26827
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
26828
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
26829
+ "div",
26830
+ {
26831
+ style: {
26832
+ display: "flex",
26833
+ alignItems: "center",
26834
+ justifyContent: "space-between",
26835
+ padding: "6px 10px 2px",
26836
+ color: "var(--dsw-alias-label-tertiary, #8a94a6)",
26837
+ // Measured against DSH's own sidebar heading
26838
+ // (「工作区」): it is 14px / weight 400 / normal
26839
+ // letter-spacing. Mine had been 11px / 600 / 0.04em,
26840
+ // which is exactly what made it look foreign.
26841
+ fontSize: "14px",
26842
+ fontWeight: 400,
26843
+ letterSpacing: "normal",
26844
+ lineHeight: "24px"
26845
+ },
26846
+ children: [
26847
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: group.title }),
26848
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { opacity: 0.7 }, children: items.length })
26849
+ ]
26850
+ }
26851
+ ),
26852
+ items.map((skill) => renderItem(skill, itemIndex++))
26853
+ ] }, group.title);
26854
+ });
26855
+ })() }),
26856
+ notice !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: noticeStyle, children: [
26857
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { flex: "1", color: notice.kind === "err" ? "var(--dsw-alias-label-error, #ff7b72)" : void 0 }, children: notice.text }),
26858
+ typeof notice.undo === "string" && notice.undo !== "" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
26859
+ "span",
26860
+ {
26861
+ role: "button",
26862
+ tabIndex: -1,
26863
+ onClick: () => void undoUninstall(notice.undo),
26864
+ style: { cursor: "pointer", textDecoration: "underline", flex: "none" },
26865
+ children: "\u64A4\u56DE"
26866
+ }
26867
+ )
26868
+ ] }),
26869
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
26870
+ "div",
26871
+ {
26693
26872
  style: {
26694
- ...itemStyle,
26695
- flexDirection: "row",
26873
+ display: "flex",
26696
26874
  alignItems: "center",
26697
- ...index === active ? { background: "var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,0.12))" } : {}
26875
+ justifyContent: "flex-end",
26876
+ gap: "8px",
26877
+ margin: "0 12px 8px 16px",
26878
+ fontSize: "12px",
26879
+ lineHeight: "18px",
26880
+ color: "var(--dsw-alias-label-tertiary, #8a94a6)"
26698
26881
  },
26699
26882
  children: [
26700
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { style: { display: "flex", flexDirection: "column", alignItems: "flex-start", gap: "2px", flex: "1", minWidth: "0" }, children: [
26701
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: nameStyle, children: `/${skill.name}` }),
26702
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: descStyle, children: skill.description ?? "" })
26703
- ] }),
26883
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { minWidth: "0", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: view === "off" ? "\u53F3\u952E\u53EF\u5F00\u542F \xB7 \u624B\u673A\u957F\u6309" : "\u53F3\u952E\u53EF\u7BA1\u7406 \xB7 \u624B\u673A\u957F\u6309" }),
26704
26884
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
26705
26885
  "span",
26706
26886
  {
26707
26887
  role: "button",
26708
26888
  tabIndex: -1,
26709
- title: pinned.includes(skill.name) ? "\u53D6\u6D88\u7F6E\u9876" : "\u7F6E\u9876\u5230\u5217\u8868\u9876\u90E8",
26710
- "aria-label": pinned.includes(skill.name) ? "\u53D6\u6D88\u7F6E\u9876" : "\u7F6E\u9876",
26711
- onClick: (event) => {
26712
- event.stopPropagation();
26713
- togglePin(skill.name);
26889
+ title: view === "off" ? "\u56DE\u5230\u5168\u90E8\u6280\u80FD" : "\u67E5\u770B\u88AB\u5173\u95ED\u7684\u6280\u80FD",
26890
+ onClick: () => {
26891
+ setView(view === "off" ? "all" : "off");
26892
+ setQuery("");
26714
26893
  },
26715
26894
  style: {
26716
26895
  flex: "none",
26717
- marginLeft: "6px",
26718
- padding: "2px 4px",
26719
- borderRadius: "6px",
26720
- fontSize: "12px",
26721
- lineHeight: "16px",
26896
+ marginLeft: "auto",
26897
+ padding: "2px 8px",
26898
+ borderRadius: "999px",
26899
+ border: "1px solid var(--dsw-alias-border-l1, rgba(128,128,128,0.35))",
26722
26900
  cursor: "pointer",
26723
- color: pinned.includes(skill.name) ? "var(--dsw-alias-label-primary-bluish, #4cc9f0)" : "var(--dsw-alias-label-tertiary, #8a94a6)",
26724
- opacity: pinned.includes(skill.name) ? 1 : 0.55,
26725
- userSelect: "none"
26901
+ whiteSpace: "nowrap"
26726
26902
  },
26727
- children: pinned.includes(skill.name) ? "\u{1F4CC}" : "\u{1F4CD}"
26903
+ children: view === "off" ? "\u2190 \u5168\u90E8\u6280\u80FD" : `\u5DF2\u5173\u95ED ${disabledSkills.length}`
26728
26904
  }
26729
26905
  )
26730
26906
  ]
26731
- },
26732
- skill.name
26733
- );
26734
- if (!showTitles) {
26735
- return filtered.map((skill) => renderItem(skill, itemIndex++));
26736
- }
26737
- return groups.map((group) => {
26738
- const items = group.items.filter((skill) => filteredNames.has(skill.name));
26739
- if (items.length === 0) return null;
26740
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
26741
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
26742
- "div",
26743
- {
26744
- style: {
26745
- display: "flex",
26746
- alignItems: "center",
26747
- justifyContent: "space-between",
26748
- padding: "6px 10px 2px",
26749
- color: "var(--dsw-alias-label-tertiary, #8a94a6)",
26750
- fontSize: "11px",
26751
- fontWeight: 600,
26752
- letterSpacing: "0.04em"
26753
- },
26754
- children: [
26755
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: group.title }),
26756
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { opacity: 0.7 }, children: items.length })
26757
- ]
26758
- }
26759
- ),
26760
- items.map((skill) => renderItem(skill, itemIndex++))
26761
- ] }, group.title);
26762
- });
26763
- })() }),
26764
- notice !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: noticeStyle, children: [
26765
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { flex: "1", color: notice.kind === "err" ? "var(--dsw-alias-label-error, #ff7b72)" : void 0 }, children: notice.text }),
26766
- typeof notice.undo === "string" && notice.undo !== "" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
26767
- "span",
26768
- {
26769
- role: "button",
26770
- tabIndex: -1,
26771
- onClick: () => void undoUninstall(notice.undo),
26772
- style: { cursor: "pointer", textDecoration: "underline", flex: "none" },
26773
- children: "\u64A4\u56DE"
26774
- }
26775
- )
26776
- ] }),
26777
- disabledSkills.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { marginTop: "4px" }, children: [
26778
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
26779
- "div",
26780
- {
26781
- style: {
26782
- display: "flex",
26783
- alignItems: "center",
26784
- justifyContent: "space-between",
26785
- padding: "6px 10px 2px",
26786
- color: "var(--dsw-alias-label-tertiary, #8a94a6)",
26787
- fontSize: "11px",
26788
- fontWeight: 600,
26789
- letterSpacing: "0.04em"
26790
- },
26791
- children: [
26792
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "\u23FB \u5DF2\u5173\u95ED" }),
26793
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { opacity: 0.7 }, children: disabledSkills.length })
26794
- ]
26795
26907
  }
26796
26908
  ),
26797
- disabledSkills.map((skill) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
26909
+ menu !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
26798
26910
  "div",
26799
26911
  {
26800
- onContextMenu: (event) => {
26801
- event.preventDefault();
26802
- event.stopPropagation();
26803
- openMenu(event, skill, true);
26804
- },
26805
- style: {
26806
- ...itemStyle,
26807
- flexDirection: "row",
26808
- alignItems: "center",
26809
- opacity: 0.55
26810
- },
26912
+ style: { ...menuStyle, left: `${menu.x}px`, top: `${menu.y}px` },
26913
+ onPointerDown: (event) => event.stopPropagation(),
26811
26914
  children: [
26812
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { style: { display: "flex", flexDirection: "column", alignItems: "flex-start", gap: "2px", flex: "1", minWidth: "0" }, children: [
26813
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: nameStyle, children: `/${skill.name}` }),
26814
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: descStyle, children: skill.description ?? "" })
26815
- ] }),
26915
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: menuHeaderStyle, children: `/${menu.skill.name}` }),
26916
+ !menu.disabled && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
26917
+ "div",
26918
+ {
26919
+ style: menuItemStyle,
26920
+ role: "button",
26921
+ tabIndex: -1,
26922
+ ...menuItemHandlers,
26923
+ onClick: () => {
26924
+ setMenu(void 0);
26925
+ togglePin(menu.skill.name);
26926
+ },
26927
+ children: pinned.includes(menu.skill.name) ? "\u53D6\u6D88\u7F6E\u9876" : "\u7F6E\u9876\u5230\u9876\u90E8"
26928
+ }
26929
+ ),
26816
26930
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
26817
- "span",
26931
+ "div",
26818
26932
  {
26933
+ style: menuItemStyle,
26819
26934
  role: "button",
26820
26935
  tabIndex: -1,
26821
- title: "\u91CD\u65B0\u5F00\u542F\uFF08\u628A SKILL.md.disabled \u6539\u56DE SKILL.md\uFF09",
26822
- "aria-label": "\u91CD\u65B0\u5F00\u542F",
26823
- onClick: () => void runSkillOp("enable", skill),
26824
- style: actionSpanStyle,
26825
- children: busySkill === skill.name ? "\u2026" : "\u23FB \u5F00\u542F"
26936
+ ...menuItemHandlers,
26937
+ onClick: () => {
26938
+ const target = menu.skill;
26939
+ const turningOff = !menu.disabled;
26940
+ setMenu(void 0);
26941
+ void runSkillOp(turningOff ? "disable" : "enable", target);
26942
+ },
26943
+ children: menu.disabled ? "\u5F00\u542F" : "\u5173\u95ED\uFF08agent \u4E5F\u4E0D\u518D\u52A0\u8F7D\uFF09"
26826
26944
  }
26827
26945
  ),
26828
26946
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
26829
- "span",
26947
+ "div",
26830
26948
  {
26949
+ style: menuItemStyle,
26831
26950
  role: "button",
26832
26951
  tabIndex: -1,
26833
- title: "\u5728\u6587\u4EF6\u7BA1\u7406\u5668\u4E2D\u5B9A\u4F4D",
26834
- "aria-label": "\u5728\u6587\u4EF6\u7BA1\u7406\u5668\u4E2D\u5B9A\u4F4D",
26835
- onClick: () => void runSkillOp("reveal", skill),
26836
- style: actionSpanStyle,
26837
- children: "\u{1F4C2}"
26952
+ ...menuItemHandlers,
26953
+ onClick: () => {
26954
+ const target = menu.skill;
26955
+ setMenu(void 0);
26956
+ void runSkillOp("reveal", target);
26957
+ },
26958
+ children: "\u5728\u6587\u4EF6\u7BA1\u7406\u5668\u4E2D\u5B9A\u4F4D"
26838
26959
  }
26839
- )
26840
- ]
26841
- },
26842
- `off-${skill.name}`
26843
- ))
26844
- ] }),
26845
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { margin: "0 10px 8px", fontSize: "11px", color: "var(--dsw-alias-label-tertiary, #8a94a6)" }, children: "\u53F3\u952E\u6280\u80FD = \u7F6E\u9876 / \u5173\u95ED / \u5B9A\u4F4D / \u5378\u8F7D\uFF08\u624B\u673A\u957F\u6309\uFF09" }),
26846
- menu !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
26847
- "div",
26848
- {
26849
- style: { ...menuStyle, left: `${menu.x}px`, top: `${menu.y}px` },
26850
- onPointerDown: (event) => event.stopPropagation(),
26851
- children: [
26852
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: menuHeaderStyle, children: `/${menu.skill.name}` }),
26853
- !menu.disabled && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
26854
- "div",
26855
- {
26856
- style: menuItemStyle,
26857
- role: "button",
26858
- tabIndex: -1,
26859
- onClick: () => {
26860
- setMenu(void 0);
26861
- togglePin(menu.skill.name);
26862
- },
26863
- children: pinned.includes(menu.skill.name) ? "\u{1F4CC} \u53D6\u6D88\u7F6E\u9876" : "\u{1F4CC} \u7F6E\u9876\u5230\u9876\u90E8"
26864
- }
26865
- ),
26866
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
26867
- "div",
26868
- {
26869
- style: menuItemStyle,
26870
- role: "button",
26871
- tabIndex: -1,
26872
- onClick: () => {
26873
- const target = menu.skill;
26874
- const turningOff = !menu.disabled;
26875
- setMenu(void 0);
26876
- void runSkillOp(turningOff ? "disable" : "enable", target);
26877
- },
26878
- children: menu.disabled ? "\u23FB \u5F00\u542F" : "\u23FB \u5173\u95ED\uFF08agent \u4E5F\u4E0D\u518D\u52A0\u8F7D\uFF09"
26879
- }
26880
- ),
26881
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
26882
- "div",
26883
- {
26884
- style: menuItemStyle,
26885
- role: "button",
26886
- tabIndex: -1,
26887
- onClick: () => {
26888
- const target = menu.skill;
26889
- setMenu(void 0);
26890
- void runSkillOp("reveal", target);
26891
- },
26892
- children: "\u{1F4C2} \u5728\u6587\u4EF6\u7BA1\u7406\u5668\u4E2D\u5B9A\u4F4D"
26893
- }
26894
- ),
26895
- !menu.disabled && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
26896
- "div",
26897
- {
26898
- style: { ...menuItemStyle, color: "var(--dsw-alias-label-error, #ff7b72)" },
26899
- role: "button",
26900
- tabIndex: -1,
26901
- onClick: () => {
26902
- const target = menu.skill;
26903
- setMenu(void 0);
26904
- if (!window.confirm(`\u5378\u8F7D /${target.name}\uFF1F
26960
+ ),
26961
+ !menu.disabled && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
26962
+ "div",
26963
+ {
26964
+ style: { ...menuItemStyle, color: "var(--dsw-alias-label-error, #e5534b)" },
26965
+ role: "button",
26966
+ tabIndex: -1,
26967
+ ...menuItemHandlers,
26968
+ onClick: () => {
26969
+ const target = menu.skill;
26970
+ setMenu(void 0);
26971
+ if (!window.confirm(`\u5378\u8F7D /${target.name}\uFF1F
26905
26972
 
26906
26973
  \u5B83\u4F1A\u88AB\u79FB\u8FDB\u5907\u4EFD\u76EE\u5F55\uFF08\u4E0D\u662F\u5220\u9664\uFF09\uFF0C\u9762\u677F\u91CC\u53EF\u4EE5\u64A4\u56DE\u3002`)) return;
26907
- void runSkillOp("uninstall", target);
26908
- },
26909
- children: "\u{1F5D1} \u5378\u8F7D\uFF08\u79FB\u5165\u5907\u4EFD\uFF0C\u53EF\u64A4\u56DE\uFF09"
26910
- }
26911
- )
26912
- ]
26913
- }
26914
- )
26974
+ void runSkillOp("uninstall", target);
26975
+ },
26976
+ children: "\u5378\u8F7D\uFF08\u79FB\u5165\u5907\u4EFD\uFF0C\u53EF\u64A4\u56DE\uFF09"
26977
+ }
26978
+ )
26979
+ ]
26980
+ }
26981
+ )
26982
+ ] })
26915
26983
  ] })
26916
26984
  ] })
26917
- ] });
26985
+ );
26918
26986
  }
26919
26987
  function apply(ctx) {
26920
26988
  void syncSharedState();