dsh-folia 1.0.0 → 1.0.1

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
@@ -991,13 +991,16 @@ window.__ModuleLoader__.load({
991
991
  "工作能力": "Work",
992
992
  "娱乐": "Fun",
993
993
  "详情": "Details",
994
+ "助手可直接调用": "Callable by the assistant",
995
+ "需 DSH 执行": "Runs in DSH",
996
+ "仅说明": "Description only",
994
997
  "收起": "Collapse",
995
998
  "复制安装命令": "Copy install command",
996
999
  "已复制": "Copied",
997
1000
  "怎么用:": "How to use: ",
998
1001
  "前提:": "Requires: ",
999
1002
  "读取失败,重开设置页再试": "Failed to load; reopen settings and retry",
1000
- "这些是可选插件:装好后能力给 DSH 助手用,桌宠本身不受影响。不做一键安装,复制命令自行安装。": "Optional plugins: they add abilities to the DSH assistant, not the pet. No one-click install — copy the command and install it yourself.",
1003
+ "这些是可选插件:装好后能力给 DSH 助手用,桌宠本身不受影响。不做一键安装,复制命令自行安装。已装插件可由助手交给 DSH 执行,未装只能看说明。": "Optional plugins: they add abilities to the DSH assistant, not the pet. No one-click install — copy the command and install it yourself. Installed plugins can be executed by the assistant through DSH; uninstalled ones are description-only.",
1001
1004
  // pre.79:能力页精选(20 套组合 / 场景向导 / 筛选 / 导出)
1002
1005
  "精选": "Curated",
1003
1006
  "场景向导": "Scenario guide",
@@ -1611,6 +1614,13 @@ window.__ModuleLoader__.load({
1611
1614
  "Filter by site subtag (new site subtags appear after reopening the panel)",
1612
1615
  "「{name}」下没有可播放的壁纸": "No playable wallpapers under \"{name}\"",
1613
1616
  "子标签「{name}」下没有可播放的壁纸": "No playable wallpapers with subtag \"{name}\"",
1617
+ // pre.71:子标签计数按其它筛选重算 / 0 张置灰 / 选中变 0 自动回退 / 空态清空筛选。
1618
+ "子标签:{name}": "Subtag: {name}",
1619
+ "搜索「{query}」": "Search \"{query}\"",
1620
+ "当前条件:{summary},共 0 张": "Current filters: {summary} · 0 wallpapers",
1621
+ "清空筛选": "Clear filters",
1622
+ "当前缓存里没有「{name}」的壁纸,已切回全部": "No cached \"{name}\" wallpapers; switched back to All",
1623
+ "当前条件下没有「{name}」的壁纸,已切回全部": "No \"{name}\" wallpapers under the current filters; switched back to All",
1614
1624
  "打开设置对话框的「壁纸引擎」分区(外观 / 播放 / 系统与全部配置)": "Open the Wallpaper Engine section of the settings dialog (Appearance / Playback / System and all configuration)",
1615
1625
  "壁纸引擎设置 ›": "Wallpaper Engine settings ›",
1616
1626
  "壁纸面板分区": "Wallpaper panel sections",
@@ -5978,6 +5988,8 @@ window.__ModuleLoader__.load({
5978
5988
  .we-qp__group { flex: 1; min-width: 0; }
5979
5989
  .we-qp__search { width: 100%; box-sizing: border-box; }
5980
5990
  .we-qp__list { display: flex; flex-direction: column; gap: 2px; }
5991
+ /* 有筛选但 0 张:说清当前条件 + 清空筛选入口(不再只显示一句笼统空态)。 */
5992
+ .we-qp__empty { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 8px 2px; }
5981
5993
  /* 视图切换:**确定性两行**(pre.51:三个下拉)。官方右栏最窄 300px(内容 276):
5982
5994
  三个筛选下拉 + 视图按钮同排必然挤碎(下拉最短也要 ~70px),而依赖 flex-wrap
5983
5995
  的假想折行会在中间宽度碎出"只有视图按钮折下去"的行。故搜索与视图按钮包进
@@ -17324,8 +17336,14 @@ window.__ModuleLoader__.load({
17324
17336
  //("要什么"写在签名处),所以这里显式解构出那一个回调。
17325
17337
  // 四段的**顺序**是用户的明确口径(致谢压尾),判据按首次出现下标比大小钉住。
17326
17338
  function renderAboutTab(ctx) {
17327
- // 组件可见性门:关掉 about-notice 组件行时,这一页签整块不渲染。
17328
- if (!weComponentVisibleOf(ctx.sel && ctx.sel.inventory && ctx.sel.inventory.components, 'about-notice')) return null;
17339
+ // 组件可见性门:**只有明确读到 components.about-notice 且它被关**时才隐藏。
17340
+ // inventory 未就绪(components 缺失 / 空对象 / 没有该键)时按可用渲染 —— 关于页是纯静态
17341
+ // 文案,永远画得出来;拿"未知"当"关闭"会让启动早期整页空白(pre.71 的 P0)。
17342
+ const components = ctx.sel && ctx.sel.inventory && ctx.sel.inventory.components;
17343
+ const aboutExplicitlyOff = components && typeof components === "object"
17344
+ && Object.prototype.hasOwnProperty.call(components, "about-notice")
17345
+ && !weComponentVisibleOf(components, "about-notice");
17346
+ if (aboutExplicitlyOff) return null;
17329
17347
  // 纯静态文案:不发请求、不写设置、不读面板状态(verify-about 的只读契约)。
17330
17348
  const section = (title, body) => React.createElement("div", { className: "we-picker__section", key: title },
17331
17349
  React.createElement("div", { className: "we-picker__section-head" },
@@ -17366,7 +17384,7 @@ window.__ModuleLoader__.load({
17366
17384
  "写文案 / 方案 / 代码 / 诗 / 故事 / 笑话;做计划 / 讲概念 / 角色扮演 / 清唱",
17367
17385
  "换壁纸 / 调音量 / 媒体控制 / 提醒 / 通知 / 开应用或网页 / 读写工作区文档 / 剪贴板",
17368
17386
  "多步任务:先计划再逐步执行,高危步骤二次确认",
17369
- "已安装插件与技能:读取技能说明并由模型执行;逐能力开关、权限组默认询问、调用写审计",
17387
+ "已安装插件与技能:技能读取说明执行;已装插件交给 DSH 独立 agent 真执行(默认询问、可关权限、写审计)",
17370
17388
  "权限:标准 / 宽松 / 自定义三档;allow / ask / deny;写文件、剪贴板、删除等高危动作永远二次确认",
17371
17389
  ]),
17372
17390
  )),
@@ -22167,13 +22185,52 @@ window.__ModuleLoader__.load({
22167
22185
 
22168
22186
  const CAP_META = { fontSize: '11px', opacity: 0.6, marginTop: '2px', wordBreak: 'break-all' };
22169
22187
 
22188
+ /* ── pre.71:能力/精选卡的"能不能真调用"标记 ───────────────────────────────
22189
+ * direct = 已装的技能类包(capability_call 可读正文并按它执行);
22190
+ * delegate= 已装的插件/组合,交给 delegate_to_dsh 的独立 DSH agent 执行;
22191
+ * manual = 未装 / 宿主没有 agents 服务 ⇒ 只能读说明,必须如实标注。
22192
+ * 这是 UI 提示,不是权限边界;真正的权限/确认/审计在工具层与路由层。 */
22193
+ const CALL_MODE_TONES = { direct: 'ok', delegate: 'medium', manual: undefined };
22194
+
22195
+ /** 包名是否是"技能"类(技能正文可被 capability_call 读取)。 */
22196
+ function isSkillPackage(pkg) {
22197
+ return /(?:^|\/)dsh-skills?(?:-|$)/i.test(String(pkg || ''));
22198
+ }
22199
+
22200
+ /** 单个能力条目的调用方式。 */
22201
+ function capabilityCallMode(item, agentsAvailable) {
22202
+ if (!item || item.installed !== true) return 'manual';
22203
+ if (isSkillPackage(item.pkg)) return 'direct';
22204
+ return agentsAvailable === true ? 'delegate' : 'manual';
22205
+ }
22206
+
22207
+ /** 精选组合的调用方式:全装且全是技能 ⇒ direct;有已装插件且宿主有 agents ⇒ delegate。 */
22208
+ function curatedCallMode(bundle, installed, agentsAvailable) {
22209
+ const steps = Array.isArray(bundle && bundle.steps) ? bundle.steps : [];
22210
+ if (!steps.length) return 'manual';
22211
+ const installedSteps = steps.filter((s) => installed && installed[s.pkg]);
22212
+ if (!installedSteps.length) return 'manual';
22213
+ if (installedSteps.length === steps.length && installedSteps.every((s) => isSkillPackage(s.pkg))) {
22214
+ return 'direct';
22215
+ }
22216
+ return agentsAvailable === true ? 'delegate' : 'manual';
22217
+ }
22218
+
22219
+ function CallModeTag({ mode }) {
22220
+ const label = mode === 'direct'
22221
+ ? weT('助手可直接调用')
22222
+ : mode === 'delegate' ? weT('需 DSH 执行') : weT('仅说明');
22223
+ return React.createElement(CuratedTag, { tone: CALL_MODE_TONES[mode] }, label);
22224
+ }
22225
+
22170
22226
  /** 作者仓库预览占位块:固定 120px 高,图片失败时仍占位(不塌、不露裂图)。 */
22171
22227
 
22172
22228
 
22173
22229
 
22174
- function CapabilityCard({ item }) {
22230
+ function CapabilityCard({ item, agentsAvailable }) {
22175
22231
  const [open, setOpen] = React.useState(false);
22176
22232
  const [copied, setCopied] = React.useState(false);
22233
+ const callMode = capabilityCallMode(item, agentsAvailable);
22177
22234
  const copy = () => {
22178
22235
  const text = String(item.command || '');
22179
22236
  try {
@@ -22197,7 +22254,9 @@ window.__ModuleLoader__.load({
22197
22254
  ? React.createElement('span', { className: 'we-picker__hint' }, 'v' + item.installedVersion)
22198
22255
  : null),
22199
22256
  React.createElement('div', { className: 'we-picker__hint', style: { marginTop: '2px' } }, item.summary),
22200
- React.createElement('div', { style: CAP_META }, item.pkg + (item.size ? ' · ' + item.size : ''))),
22257
+ React.createElement('div', { style: { display: 'flex', alignItems: 'center', gap: '4px', flexWrap: 'wrap', marginTop: '2px' } },
22258
+ React.createElement(CallModeTag, { mode: callMode }),
22259
+ React.createElement('span', { style: CAP_META }, item.pkg + (item.size ? ' · ' + item.size : '')))),
22201
22260
  React.createElement('div', {
22202
22261
  style: { flex: '0 0 auto', textAlign: 'right', fontSize: '11px', opacity: 0.85, whiteSpace: 'nowrap' },
22203
22262
  },
@@ -22241,7 +22300,7 @@ window.__ModuleLoader__.load({
22241
22300
  return React.createElement('div', { style: CAP_CARD }, body);
22242
22301
  }
22243
22302
 
22244
- function CapGroup({ title, hint, items }) {
22303
+ function CapGroup({ title, hint, items, agentsAvailable }) {
22245
22304
  // 220 条一次性渲染会卡(每张卡都带状态),先展示 60 条,按需展开。
22246
22305
  const PAGE = 60;
22247
22306
  const [visibleCount, setVisibleCount] = React.useState(PAGE);
@@ -22256,7 +22315,7 @@ window.__ModuleLoader__.load({
22256
22315
  gap: '8px',
22257
22316
  marginTop: '8px',
22258
22317
  },
22259
- }, items.slice(0, visibleCount).map((it) => React.createElement(CapabilityCard, { key: it.pkg || it.name, item: it })),
22318
+ }, items.slice(0, visibleCount).map((it) => React.createElement(CapabilityCard, { key: it.pkg || it.name, item: it, agentsAvailable })),
22260
22319
  items.length > visibleCount
22261
22320
  ? React.createElement("button", { key: "more", type: "button", className: "we-picker__btn", style: { marginTop: "8px" }, onClick: () => setVisibleCount((n) => n + PAGE) },
22262
22321
  weT("显示更多(还有 {n} 个)", { n: items.length - visibleCount }))
@@ -22389,10 +22448,11 @@ window.__ModuleLoader__.load({
22389
22448
  }, copied ? weT('已复制') : weT('复制')) : null));
22390
22449
  }
22391
22450
 
22392
- function CuratedCard({ bundle, installed, favorite, recommended, onToggleFavorite, onCopy, onExport }) {
22451
+ function CuratedCard({ bundle, installed, favorite, recommended, agentsAvailable, onToggleFavorite, onCopy, onExport }) {
22393
22452
  const [open, setOpen] = React.useState(false);
22394
22453
  const steps = Array.isArray(bundle.steps) ? bundle.steps : [];
22395
22454
  const installedCount = steps.filter((s) => installed && installed[s.pkg]).length;
22455
+ const callMode = curatedCallMode(bundle, installed, agentsAvailable);
22396
22456
  const commands = curatedCommands(bundle);
22397
22457
  const risk = CURATED_RISK_LABELS[bundle.risk] || bundle.risk || '';
22398
22458
  const budgets = (Array.isArray(bundle.budget) ? bundle.budget : []).map((b) => CURATED_BUDGET_LABELS[b] || b).join(' / ');
@@ -22414,6 +22474,7 @@ window.__ModuleLoader__.load({
22414
22474
  React.createElement('div', { style: { display: 'flex', gap: '4px', flexWrap: 'wrap', marginTop: '4px' } },
22415
22475
  React.createElement(CuratedTag, { tone: bundle.risk }, risk),
22416
22476
  React.createElement(CuratedTag, null, budgets),
22477
+ React.createElement(CallModeTag, { mode: callMode }),
22417
22478
  high ? React.createElement(CuratedTag, { tone: 'high' }, weT('第三方 MCP,先 trust-check')) : null)),
22418
22479
  React.createElement('button', {
22419
22480
  type: 'button', className: 'we-picker__btn', title: favorite ? weT('取消收藏') : weT('收藏'),
@@ -22534,6 +22595,7 @@ window.__ModuleLoader__.load({
22534
22595
  }, list.map((bundle) => React.createElement(CuratedCard, {
22535
22596
  key: bundle.id, bundle, installed, favorite: favorites.has(bundle.id),
22536
22597
  recommended: recommended.includes(bundle.id),
22598
+ agentsAvailable: data && data.agentsAvailable === true,
22537
22599
  onToggleFavorite, onCopy: copyPlainText,
22538
22600
  onExport: (b, format) => downloadTextFile(
22539
22601
  'folia-curated-' + b.id + '.' + (format === 'json' ? 'json' : format === 'bash' ? 'sh' : 'ps1'),
@@ -22547,7 +22609,7 @@ window.__ModuleLoader__.load({
22547
22609
 
22548
22610
  function CapabilitiesSection() {
22549
22611
  // items = 市场快照;curated = 20 套组合;page = 精选/工作能力/娱乐(精选默认)
22550
- const [state, setState] = React.useState({ items: null, curated: null, page: "curated", error: null });
22612
+ const [state, setState] = React.useState({ items: null, curated: null, page: "curated", error: null, agentsAvailable: false });
22551
22613
  const [favorites, setFavorites] = React.useState(() => new Set(readCuratedFavorites()));
22552
22614
 
22553
22615
  React.useEffect(() => {
@@ -22562,6 +22624,7 @@ window.__ModuleLoader__.load({
22562
22624
  ...prev,
22563
22625
  items: catDoc && Array.isArray(catDoc.items) ? catDoc.items : prev.items,
22564
22626
  curated: curDoc && Array.isArray(curDoc.bundles) ? curDoc : prev.curated,
22627
+ agentsAvailable: Boolean((catDoc && catDoc.agentsAvailable) || (curDoc && curDoc.agentsAvailable) || prev.agentsAvailable),
22565
22628
  error: !catDoc && !curDoc ? weT("读取失败,重开设置页再试") : null,
22566
22629
  }));
22567
22630
  })();
@@ -22592,7 +22655,7 @@ window.__ModuleLoader__.load({
22592
22655
  return React.createElement("div", { style: { padding: "4px 2px" } },
22593
22656
  React.createElement("div", { style: { fontSize: "14px", fontWeight: 600 } }, weT("能力")),
22594
22657
  React.createElement("div", { className: "we-picker__hint", style: { marginTop: "2px" } },
22595
- weT("这些是可选插件:装好后能力给 DSH 助手用,桌宠本身不受影响。不做一键安装,复制命令自行安装。")),
22658
+ weT("这些是可选插件:装好后能力给 DSH 助手用,桌宠本身不受影响。不做一键安装,复制命令自行安装。已装插件可由助手交给 DSH 执行,未装只能看说明。")),
22596
22659
  // 三个页面之间切换(页内 tab),精选默认打开
22597
22660
  React.createElement("div", { style: { display: "flex", gap: "6px", marginTop: "10px" } },
22598
22661
  tabs.map((tab) => React.createElement("button", {
@@ -22609,6 +22672,7 @@ window.__ModuleLoader__.load({
22609
22672
  title: page === "work" ? weT("工作能力") : weT("娱乐"),
22610
22673
  hint: page === "work" ? weT("提高日常办事效率") : weT("让界面和对话更有趣"),
22611
22674
  items: page === "work" ? workItems : funItems,
22675
+ agentsAvailable: state.agentsAvailable === true,
22612
22676
  }));
22613
22677
  }
22614
22678
 
@@ -27782,6 +27846,43 @@ window.__ModuleLoader__.load({
27782
27846
  );
27783
27847
  }
27784
27848
 
27849
+ /**
27850
+ * 当前筛选链里"子标签之外"的条件:缓存状态 / 来源 / 搜索。
27851
+ * 抽成纯函数是为了让计数口径能被 test 直接执行(不是抄一遍断言)。
27852
+ */
27853
+ function qpFilterBase(playable, cacheFilter, sourceFilter, q) {
27854
+ return (Array.isArray(playable) ? playable : []).filter((w) => {
27855
+ const ready = Boolean(w && w.localReady === true);
27856
+ if (cacheFilter === "cached" && !ready) return false;
27857
+ if (cacheFilter === "uncached" && ready) return false;
27858
+ if (sourceFilter !== "all" && ((w.source === "folia") ? "site" : "local") !== sourceFilter) return false;
27859
+ if (q && String(w.title || "").toLowerCase().indexOf(q) === -1) return false;
27860
+ return true;
27861
+ });
27862
+ }
27863
+
27864
+ /** facets 选项 + **按当前其它条件重算**的计数(0 张由渲染器置灰)。 */
27865
+ function qpSubtagOptionsWithCounts(facetOptions, base) {
27866
+ const counts = new Map();
27867
+ for (const w of base || []) {
27868
+ const value = String((w && w.subtag) || "").trim();
27869
+ if (!value) continue;
27870
+ counts.set(value, (counts.get(value) || 0) + 1);
27871
+ }
27872
+ return (Array.isArray(facetOptions) ? facetOptions : []).map((it) => Object.assign({}, it, {
27873
+ count: counts.get(it.value) || 0,
27874
+ }));
27875
+ }
27876
+
27877
+ /** 当前子标签在"其它条件已过滤"的底数里还剩几张;0 张 ⇒ 调用方自动回退「全部」。 */
27878
+ function qpSubtagSelection(rawSubtagFilter, base) {
27879
+ const count = rawSubtagFilter
27880
+ ? (base || []).filter((w) => String((w && w.subtag) || "").trim() === rawSubtagFilter).length
27881
+ : (base || []).length;
27882
+ const lost = Boolean(rawSubtagFilter && count === 0);
27883
+ return { count, lost, effective: lost ? "" : rawSubtagFilter };
27884
+ }
27885
+
27785
27886
  // 筛选条(pre.51):只有 [缓存][子标签][来源] 三个下拉 + 搜索 + 视图切换。
27786
27887
  // 分级 / 类型两档已按用户口径删除(「侧栏快捷键壁纸筛选条改成三个下拉」)。
27787
27888
  // 取值与处理器全部经 `filters` 入参进来 —— 本函数是纯渲染器,不读外层 state,
@@ -27790,6 +27891,8 @@ window.__ModuleLoader__.load({
27790
27891
  const {
27791
27892
  cacheFilter, subtagFilter, subtagOptions, sourceFilter,
27792
27893
  onCacheFilterChange, onSubtagFilterChange,
27894
+ // 过滤器交互时清掉"自动回退"提示;提示本身由 QuickPanel 生成本地状态。
27895
+ onFilterInteract, filterNote,
27793
27896
  // 本地上传入口的 UI 态与动作也随 `filters` 这一份渲染 ctx 进来(不新开第 5 个形参:
27794
27897
  // 该签名被 verify-panel-interactions 的既有判据按字面锚定)。
27795
27898
  upload,
@@ -27803,7 +27906,10 @@ window.__ModuleLoader__.load({
27803
27906
  value: sel.qpSearch || "",
27804
27907
  placeholder: weT("搜索壁纸标题…"),
27805
27908
  "aria-label": weT("搜索壁纸标题"),
27806
- onInput: (e) => { setTransient("qpSearch", e.target.value); emit(); },
27909
+ onInput: (e) => {
27910
+ if (onFilterInteract) onFilterInteract();
27911
+ setTransient("qpSearch", e.target.value); emit();
27912
+ },
27807
27913
  }),
27808
27914
  // 本地上传入口:搜索框右边(用户点名要的位置)。窄侧栏里按钮只显示图标,
27809
27915
  // 完整文案在 title / aria-label 里 —— 见 styles-quick.js 的 420px 断点。
@@ -27842,11 +27948,16 @@ window.__ModuleLoader__.load({
27842
27948
  ),
27843
27949
  // 上传状态行:搜索行下方(进度 / 错误 / 重复提示 / 拖拽提示)。
27844
27950
  qpRenderUploadStatus(sel, upload && upload.progress, Boolean(upload && upload.dragActive)),
27951
+ // 子标签自动回退提示(例如"当前缓存里没有「原神」的壁纸,已切回全部")。
27952
+ filterNote ? React.createElement("div", { className: "we-picker__note" }, filterNote) : null,
27845
27953
  // ① 缓存状态:全部 / 已缓存 / 未缓存(pre.51 新)。
27846
27954
  React.createElement("select", {
27847
27955
  className: "we-picker__select we-qp__filter we-qp__cache",
27848
27956
  value: cacheFilter || "all",
27849
- onChange: onCacheFilterChange,
27957
+ onChange: (e) => {
27958
+ if (onFilterInteract) onFilterInteract();
27959
+ onCacheFilterChange(e);
27960
+ },
27850
27961
  "aria-label": weT("缓存状态"),
27851
27962
  title: weT("按缓存状态筛选:已缓存 = 本机已有文件,未缓存 = 需要下载"),
27852
27963
  },
@@ -27856,19 +27967,29 @@ window.__ModuleLoader__.load({
27856
27967
  React.createElement("select", {
27857
27968
  className: "we-picker__select we-qp__filter we-qp__subtag",
27858
27969
  value: subtagFilter || "",
27859
- onChange: onSubtagFilterChange,
27970
+ onChange: (e) => {
27971
+ if (onFilterInteract) onFilterInteract();
27972
+ onSubtagFilterChange(e);
27973
+ },
27860
27974
  "aria-label": weT("子标签"),
27861
27975
  title: weT("按站点子标签筛选(站点新增子标签后,重开面板即同步)"),
27862
27976
  },
27863
27977
  React.createElement("option", { value: "" }, weT("全部")),
27864
27978
  ...(Array.isArray(subtagOptions) ? subtagOptions : []).map((it) =>
27865
- React.createElement("option", { key: it.value, value: it.value }, it.label + " (" + it.count + ")")),
27979
+ React.createElement("option", {
27980
+ key: it.value, value: it.value,
27981
+ // 当前缓存/来源/搜索条件下 0 张 ⇒ 置灰,避免"点了只剩空态"的假故障。
27982
+ disabled: Number(it.count) === 0,
27983
+ }, it.label + " (" + Number(it.count || 0) + ")")),
27866
27984
  ),
27867
27985
  // ③ 来源筛选:本机 Wallpaper Engine 库 vs 我们站点(与设置页同一个键)。
27868
27986
  React.createElement("select", {
27869
27987
  className: "we-picker__select we-qp__filter we-qp__source",
27870
27988
  value: sourceFilter || "all",
27871
- onChange: (e) => { setSetting("sourceFilter", e.target.value); emit(); },
27989
+ onChange: (e) => {
27990
+ if (onFilterInteract) onFilterInteract();
27991
+ setSetting("sourceFilter", e.target.value); emit();
27992
+ },
27872
27993
  "aria-label": weT("来源筛选"),
27873
27994
  title: weT("按来源筛选:本机 Wallpaper Engine 库,还是从我们站点拉下来的壁纸"),
27874
27995
  },
@@ -27877,18 +27998,17 @@ window.__ModuleLoader__.load({
27877
27998
  );
27878
27999
  }
27879
28000
 
27880
- function qpRenderList(listRef, rows, view, cardsView, vTopH, vBtmH, q, cacheFilter, subtagFilter, subtagLabel, sel) {
27881
- // 空态文案按"当前生效的那一档"解释(分级/类型两档已删,pre.51 只剩缓存与子标签)。
27882
- let emptyText = weT("没有可播放的壁纸");
27883
- if (q) {
27884
- emptyText = weT("没有匹配「{query}」的壁纸", { query: sel.qpSearch });
27885
- } else if (cacheFilter !== "all") {
27886
- emptyText = weT("「{name}」下没有可播放的壁纸", {
27887
- name: cacheFilter === "cached" ? weT("已缓存") : weT("未缓存"),
27888
- });
27889
- } else if (subtagFilter) {
27890
- emptyText = weT("子标签「{name}」下没有可播放的壁纸", { name: subtagLabel || subtagFilter });
27891
- }
28001
+ function qpRenderList(listRef, rows, view, cardsView, vTopH, vBtmH, sel, empty) {
28002
+ // 有筛选条件但没有结果:说清"当前条件共 0 张"并给清空入口;没有筛选条件时保持原空态。
28003
+ const emptyNode = empty && empty.hasActiveFilters
28004
+ ? React.createElement("div", { className: "we-qp__empty" },
28005
+ React.createElement("span", { className: "we-picker__hint" },
28006
+ weT("当前条件:{summary},共 0 张", { summary: empty.summary || weT("全部") })),
28007
+ React.createElement("button", {
28008
+ type: "button", className: "we-picker__btn",
28009
+ onClick: empty.onClearFilters,
28010
+ }, weT("清空筛选")))
28011
+ : React.createElement("span", { className: "we-picker__hint" }, weT("没有可播放的壁纸"));
27892
28012
  return React.createElement("div", {
27893
28013
  ref: listRef,
27894
28014
  className: "we-qp__list" + (view === "cards" ? " we-qp__list--cards" : ""),
@@ -27903,7 +28023,7 @@ window.__ModuleLoader__.load({
27903
28023
  rows.map((w) => qpRenderCardGuarded(w, sel, cardsView)),
27904
28024
  vBtmH > 0 ? qpRenderSpacer("we-qp-vbtm", vBtmH) : null,
27905
28025
  )
27906
- : React.createElement("span", { className: "we-picker__hint" }, emptyText),
28026
+ : emptyNode,
27907
28027
  );
27908
28028
  }
27909
28029
 
@@ -27947,8 +28067,7 @@ window.__ModuleLoader__.load({
27947
28067
  )
27948
28068
  : React.createElement(React.Fragment, null,
27949
28069
  qpRenderViewBar(sel, view, filters, switchView),
27950
- qpRenderList(listRef, rows, view, cardsView, vTopH, vBtmH, q,
27951
- filters.cacheFilter, filters.subtagFilter, filters.subtagLabel, sel),
28070
+ qpRenderList(listRef, rows, view, cardsView, vTopH, vBtmH, sel, filters.empty),
27952
28071
  ),
27953
28072
  );
27954
28073
  }
@@ -28051,6 +28170,8 @@ window.__ModuleLoader__.load({
28051
28170
  // 用一条队列按序喂 useState,插在前面会把 fontOpen / glassDetailOpen 那几档的值顶错位。
28052
28171
  const [uploadState, setUploadState] = React.useState({ busy: false, done: 0, total: 0 });
28053
28172
  const [uploadDragActive, setUploadDragActive] = React.useState(false);
28173
+ // 子标签在当前其它条件下变 0 时,自动回退并留一句提示;下一次筛选项交互时清掉。
28174
+ const [filterNote, setFilterNote] = React.useState("");
28054
28175
  // 防连点:state 更新是异步的,同一帧里连按两次会各起一条串行链。
28055
28176
  const uploadBusyRef = React.useRef(false);
28056
28177
  const runQpUpload = async (filesIn) => {
@@ -28144,27 +28265,56 @@ window.__ModuleLoader__.load({
28144
28265
  // 缓存档:持久化键与设置页壁纸库共用;坏值回落「全部」。
28145
28266
  const cacheRaw = readPickerCacheFilter();
28146
28267
  const cacheFilter = (cacheRaw === "cached" || cacheRaw === "uncached") ? cacheRaw : "all";
28147
- // 子标签:facets 现算(站点新增子标签后,重开面板即同步);空串 = 全部。
28148
- const subtagFilter = String(readPickerSubtagFilter() || "").trim();
28149
- const subtagOptions = (() => {
28268
+ // 子标签:选项来自 facets(站点新增后重开即同步),但**计数按当前其它筛选条件重算**:
28269
+ // 缓存状态 / 来源 / 搜索先过一遍,再看每个子标签还剩几张。否则会显示"全部"的计数,
28270
+ // 用户按它选完却只剩空态(pre.71 的 P0)。
28271
+ const rawSubtagFilter = String(readPickerSubtagFilter() || "").trim();
28272
+ const facetSubtagOptions = (() => {
28150
28273
  const groups = tagOptionsFromFacets(sel.inventory && sel.inventory.facets);
28151
28274
  const g = groups.find((x) => x && x.group === "subtags");
28152
28275
  return g && Array.isArray(g.items) ? g.items : [];
28153
28276
  })();
28154
- const subtagLabel = (subtagOptions.find((it) => it.value === subtagFilter) || {}).label || subtagFilter;
28155
- const filtered = playable.filter((w) => {
28156
- // 「已缓存」只认清单条目的 localReady(与卡片「已缓存」角标同一份判据);
28157
- // 「未缓存」= localReady !== true 的全部,不叠加其它档。
28158
- const ready = Boolean(w && w.localReady === true);
28159
- if (cacheFilter === "cached" && !ready) return false;
28160
- if (cacheFilter === "uncached" && ready) return false;
28161
- // 子标签精确匹配站点 facets 的 value(与 picker-model 的 matchesSubtagFilter 同口径)。
28162
- if (subtagFilter && String((w && w.subtag) || "").trim() !== subtagFilter) return false;
28163
- // 站点条目带 `source: "folia"`;其余(本机工坊 + 上传)一律算本机。
28164
- if (sourceFilter !== "all" && ((w.source === "folia") ? "site" : "local") !== sourceFilter) return false;
28165
- if (q && String(w.title || "").toLowerCase().indexOf(q) === -1) return false;
28166
- return true;
28167
- });
28277
+ const subtagBase = qpFilterBase(playable, cacheFilter, sourceFilter, q);
28278
+ const subtagOptions = qpSubtagOptionsWithCounts(facetSubtagOptions, subtagBase);
28279
+ const subtagLabel = (subtagOptions.find((it) => it.value === rawSubtagFilter) || {}).label || rawSubtagFilter;
28280
+ const subtagSelection = qpSubtagSelection(rawSubtagFilter, subtagBase);
28281
+ // 当前选中的子标签在其它条件下变 0 ⇒ 自动回退「全部」,并留一句可读提示。
28282
+ const subtagLost = subtagSelection.lost;
28283
+ const effectiveSubtagFilter = subtagSelection.effective;
28284
+ React.useEffect(() => {
28285
+ if (!subtagLost) return;
28286
+ writePickerSubtagFilter("");
28287
+ setFilterNote(weT(
28288
+ cacheFilter === "cached"
28289
+ ? "当前缓存里没有「{name}」的壁纸,已切回全部"
28290
+ : "当前条件下没有「{name}」的壁纸,已切回全部",
28291
+ { name: subtagLabel || rawSubtagFilter },
28292
+ ));
28293
+ }, [subtagLost, rawSubtagFilter, subtagLabel, cacheFilter]);
28294
+ const filtered = subtagBase.filter((w) => (
28295
+ !effectiveSubtagFilter || String((w && w.subtag) || "").trim() === effectiveSubtagFilter
28296
+ ));
28297
+ // 空态用:当前所有生效条件 + 清空筛选入口。
28298
+ const conditionParts = [];
28299
+ if (cacheFilter !== "all") conditionParts.push(weT(cacheFilter === "cached" ? "已缓存" : "未缓存"));
28300
+ if (sourceFilter !== "all") conditionParts.push(weT(sourceFilter === "local" ? "本机" : "站点"));
28301
+ if (effectiveSubtagFilter) {
28302
+ conditionParts.push(weT("子标签:{name}", { name: subtagLabel || effectiveSubtagFilter }));
28303
+ }
28304
+ if (q) conditionParts.push(weT("搜索「{query}」", { query: sel.qpSearch }));
28305
+ const clearFilters = () => {
28306
+ writePickerCacheFilter("all");
28307
+ writePickerSubtagFilter("");
28308
+ setTransient("qpSearch", "");
28309
+ setSetting("sourceFilter", "all");
28310
+ setFilterNote("");
28311
+ emit();
28312
+ };
28313
+ const filterEmpty = {
28314
+ hasActiveFilters: conditionParts.length > 0,
28315
+ summary: conditionParts.join(" + "),
28316
+ onClearFilters: clearFilters,
28317
+ };
28168
28318
  // 虚拟滚动:列表一行一张、卡片一行 cols 张(列数由测量 effect 实测回填)。搜索 /
28169
28319
  // 筛选把列表收窄后旧窗口可能越界 —— 渲染期先钳一道(测量 effect 随 count 变化跟上);
28170
28320
  // 换视图瞬间旧窗口是另一档的几何(cards 标记对不上)⇒ 按未测量处理:先画顶部
@@ -28259,10 +28409,14 @@ window.__ModuleLoader__.load({
28259
28409
  // 库还没回来 / 扫描失败:**只有这一页**给一句话 —— 外观 / 播放两页不依赖库,
28260
28410
  // 照常可用(不能整块替换掉,那样连外观都进不去)。
28261
28411
  qpRenderLibrarySection(sel, view, {
28262
- cacheFilter, subtagFilter, subtagOptions, subtagLabel, sourceFilter,
28412
+ cacheFilter, subtagFilter: effectiveSubtagFilter, subtagOptions, subtagLabel, sourceFilter,
28263
28413
  // 两个 handler 直接从同一 bundle 作用域取(client.js 里的
28264
28414
  // onCacheFilterChange / onSubtagFilterChange:写持久化键 + emit)。
28265
28415
  onCacheFilterChange, onSubtagFilterChange,
28416
+ // 用户一改筛选项就清掉上一句自动回退提示。
28417
+ onFilterInteract: () => { if (filterNote) setFilterNote(""); },
28418
+ filterNote,
28419
+ empty: filterEmpty,
28266
28420
  // 本地上传的进度 / 拖拽态 / 动作:渲染器只读这份 ctx。
28267
28421
  upload: qpUpload,
28268
28422
  }, listRef, rows, cardsView, vTopH, vBtmH, q, switchView),
package/lib/index.js CHANGED
@@ -320,7 +320,14 @@ export function apply(ctx) {
320
320
  const safe = (name) => { try { return ctx.get(name); } catch { return null; } };
321
321
  const skills = safe('skills');
322
322
  const tools = safe('tools');
323
- return skills || tools ? { skills, tools } : null;
323
+ // pre.71:把宿主自己的 agents / sessions / 默认模型交给 delegate_to_dsh。
324
+ // 拿不到任何一项都只是降级(工具会如实说不可用),不影响插件装载。
325
+ const agents = safe('agents');
326
+ const sessions = safe('sessions');
327
+ const agentDefaultModel = safe('agentDefaultModel');
328
+ return skills || tools || agents || sessions || agentDefaultModel
329
+ ? { skills, tools, agents, sessions, agentDefaultModel }
330
+ : null;
324
331
  })(),
325
332
  // pre.62:语音链的 ffmpeg 供给(首次使用懒下载;/record 先看进度,不等 70MB)。
326
333
  ffmpegEnsure: hostKernel.transcodeKit.ensureFfmpeg,
@@ -130,7 +130,7 @@ export const PERMISSION_GROUPS = Object.freeze([
130
130
  {
131
131
  id: 'plugins', label: '已安装插件与技能', risk: 'medium', riskLabel: '中风险', default: 'ask',
132
132
  desc: '列出并调用已安装插件/技能;每个能力单独开关,默认只列不调用,调用会写审计。',
133
- tools: ['capability_list', 'capability_call'],
133
+ tools: ['capability_list', 'capability_call', 'delegate_to_dsh'],
134
134
  },
135
135
  {
136
136
  id: 'system', label: '系统操作', risk: 'high', riskLabel: '高风险', default: 'ask', advancedOnly: true,
@@ -320,6 +320,20 @@ const TOOLS = Object.freeze([
320
320
  },
321
321
  needsConfirm: false,
322
322
  },
323
+ {
324
+ name: 'delegate_to_dsh',
325
+ description: '把一件事交给 DSH 的独立 agent 真正执行(可驱动已装插件/MCP;默认询问,特殊人设不可用)',
326
+ parameters: {
327
+ type: 'object',
328
+ properties: {
329
+ request: { type: 'string', description: '要 DSH 执行的自然语言任务' },
330
+ capability: { type: 'string', description: '可选:目标能力名 / 插件名' },
331
+ },
332
+ required: ['request'],
333
+ additionalProperties: false,
334
+ },
335
+ needsConfirm: true,
336
+ },
323
337
  {
324
338
  name: 'memory_note',
325
339
  description: '记一条长期记忆(偏好或事件)',
@@ -1120,6 +1134,19 @@ export function classifyIntent(text, ctx = {}) {
1120
1134
  if (/(?:列出|有哪些|看看|查一下).*(?:插件|技能|能力)|capability_list/i.test(raw)) {
1121
1135
  return { intent: 'action', tool: 'capability_list', args: {}, confidence: 'rule', reason: 'capability-list' };
1122
1136
  }
1137
+ // pre.71:插件类请求优先走真正的 DSH 委派;技能类请求仍读 SKILL.md 正文。
1138
+ if (/(?:交给|让|委托).*(?:DSH|宿主).*(?:执行|做|处理)|delegate_to_dsh/i.test(raw)) {
1139
+ return {
1140
+ intent: 'action', tool: 'delegate_to_dsh',
1141
+ args: { request: clipChars(raw, 200) }, confidence: 'rule', reason: 'delegate-dsh',
1142
+ };
1143
+ }
1144
+ if (/(?:用|调用|使用|借助).*(?:插件|能力)/.test(raw) && !/技能/.test(raw)) {
1145
+ return {
1146
+ intent: 'action', tool: 'delegate_to_dsh',
1147
+ args: { request: clipChars(raw, 200) }, confidence: 'rule', reason: 'capability-delegate',
1148
+ };
1149
+ }
1123
1150
  if (/(?:用|调用|使用|借助).*(?:插件|技能)/.test(raw)) {
1124
1151
  return {
1125
1152
  intent: 'action', tool: 'capability_call',
@@ -1231,7 +1258,7 @@ export const CAPABILITY_DOMAINS = Object.freeze([
1231
1258
  { id: 'teaching', label: '教学', desc: '类比 + 例子讲概念(perform_teach)' },
1232
1259
  { id: 'entertainment', label: '娱乐', desc: '唱歌/笑话/故事/谜语/角色扮演/夸夸/安慰' },
1233
1260
  { id: 'desktop', label: '桌面', desc: '壁纸/桌宠/音量/媒体/通知/网页/应用/剪贴板/文档' },
1234
- { id: 'plugins', label: '插件与技能', desc: '调用已安装插件/技能(capability_call)' },
1261
+ { id: 'plugins', label: '插件与技能', desc: '列出已装插件/技能;插件交给 DSH 独立 agent 真执行(delegate_to_dsh),技能读正文(capability_call)' },
1235
1262
  { id: 'memory', label: '记忆', desc: '偏好/称呼/长期事实' },
1236
1263
  ]);
1237
1264
 
@@ -1250,7 +1277,7 @@ export const CAPABILITY_REGISTRY = Object.freeze([
1250
1277
  { id: 'plan_trip', domain: 'planning', label: '行程规划', kind: 'local', test: /(行程|旅行计划|旅游攻略|周末去哪)/ },
1251
1278
  { id: 'task', domain: 'desktop', label: '多步任务', kind: 'tool', test: /(整理.*(?:桌面|文件)|批量.*(?:壁纸|换)|提醒.*(?:并|再).*通知|写.*文档.*打开|按步骤|一步步)/ },
1252
1279
  { id: 'sing', domain: 'entertainment', label: '唱歌', kind: 'tool', test: /(唱|清唱|来首歌)/ },
1253
- { id: 'capabilities', domain: 'plugins', label: '插件与技能', kind: 'tool', test: /(插件|技能|capability|已安装.*能力|用.*插件)/ },
1280
+ { id: 'capabilities', domain: 'plugins', label: '插件与技能', kind: 'tool', test: /(插件|技能|capability|已安装.*能力|用.*(?:插件|能力))/ },
1254
1281
  { id: 'memory', domain: 'memory', label: '记忆', kind: 'tool', test: /(记住|记一下|别忘了|我叫|叫我|称呼)/ },
1255
1282
  { id: 'desktop_ops', domain: 'desktop', label: '桌面操作', kind: 'tool', test: /(壁纸|桌宠|音量|播放|暂停|下一首|通知|打开.*(?:网页|网站|记事本|计算器)|剪贴板|写.*(?:文件|进|到)|\.md)/ },
1256
1283
  { id: 'creation_model', domain: 'creation', label: '创作(模型)', kind: 'model', test: /(写.{0,6}(?:文案|方案|大纲|代码|简历|故事|自我介绍)|起名|起个名|改名|总结|简历|翻译)/ },
@@ -1269,6 +1296,7 @@ export function capabilityForText(text) {
1269
1296
  export function buildCapabilityPrompt() {
1270
1297
  const lines = CAPABILITY_DOMAINS.map((domain) => `${domain.label}:${domain.desc}`);
1271
1298
  return '【能力清单】' + lines.join(';') + '。'
1299
+ + '\n【已装插件】要真正执行时用 delegate_to_dsh(独立 DSH agent,默认询问;不可用时如实说明,不许假装已调用);技能说明继续用 capability_call。'
1272
1300
  + '\n【拒绝规则】不要说"我只是一个AI/我做不到"开头。顺序必须是:先给能做的那部分 → 再说限制 → 再给最接近的替代方案。'
1273
1301
  + '能自己动手的(桌面操作/唱歌/查时间/计算/换算)直接做,不要推给用户。';
1274
1302
  }