dsh-folia 4.26.0-pre.24 → 4.26.0-pre.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
@@ -762,6 +762,9 @@ window.__ModuleLoader__.load({
762
762
  "回右下角": "Back to corner",
763
763
  "不显示它": "Hide it",
764
764
  "对话": "Chat",
765
+ "可选工作能力(已安装才可用)": "Optional work capabilities (installed only)",
766
+ "正在读取…": "Loading…",
767
+ "冲突提醒:": "Conflict: ",
765
768
  "站点上还没有桌宠。": "No pets on the site yet.",
766
769
  "站点不可达": "Site unreachable",
767
770
  "预览尺寸": "Preview-size",
@@ -18658,6 +18661,8 @@ window.__ModuleLoader__.load({
18658
18661
  const [status, setStatus] = React.useState({ ok: null, text: '' });
18659
18662
  const [note, setNote] = React.useState(null);
18660
18663
  const [busy, setBusy] = React.useState(false);
18664
+ // 工作能力插件(聚合携带)的安装状态;只读展示,不加开关
18665
+ const [workPlugins, setWorkPlugins] = React.useState(null);
18661
18666
  const update = React.useCallback((patch) => setDraft((prev) => ({ ...prev, ...patch })), []);
18662
18667
 
18663
18668
  const load = React.useCallback(async () => {
@@ -18673,6 +18678,12 @@ window.__ModuleLoader__.load({
18673
18678
  } catch { /* 首次加载失败不打扰 */ }
18674
18679
  }, []);
18675
18680
  React.useEffect(() => { void load(); }, [load]);
18681
+ React.useEffect(() => {
18682
+ void (async () => {
18683
+ const resp = await apiJson('/pet-chat/work-plugins', { parse: 'always' }).catch(() => null);
18684
+ setWorkPlugins(unwrapPetChat(resp));
18685
+ })();
18686
+ }, []);
18676
18687
 
18677
18688
  const save = async () => {
18678
18689
  setBusy(true);
@@ -18741,6 +18752,33 @@ window.__ModuleLoader__.load({
18741
18752
  React.createElement('button', { type: 'button', className: 'we-picker__btn', disabled: busy, onClick: save }, weT('保存')),
18742
18753
  ));
18743
18754
 
18755
+
18756
+ // ── 工作能力(随插件携带,只读状态)─────────────────────────────────
18757
+ const workItems = (workPlugins && Array.isArray(workPlugins.items)) ? workPlugins.items : [];
18758
+ child.push(React.createElement('div', {
18759
+ key: 'work-head',
18760
+ style: { marginTop: '14px', fontSize: '12px', fontWeight: 600 },
18761
+ }, weT('可选工作能力(已安装才可用)')));
18762
+ if (!workItems.length) {
18763
+ child.push(React.createElement('div', { key: 'work-empty', className: 'we-picker__hint' }, weT('正在读取…')));
18764
+ } else {
18765
+ workItems.forEach((item) => {
18766
+ child.push(React.createElement('div', {
18767
+ key: 'work-' + item.id,
18768
+ className: 'we-picker__hint',
18769
+ style: { margin: '2px 0' },
18770
+ }, (item.installed ? '✓ ' : '· ') + item.label
18771
+ + (item.version ? ' ' + item.version : '')
18772
+ + (item.needs ? '(' + item.needs + ')' : '')));
18773
+ });
18774
+ }
18775
+ if (workPlugins && workPlugins.conflict) {
18776
+ child.push(React.createElement('div', {
18777
+ key: 'work-conflict',
18778
+ className: 'we-picker__hint',
18779
+ style: { marginTop: '4px', color: '#d9a13b' },
18780
+ }, weT('冲突提醒:') + workPlugins.conflict.note));
18781
+ }
18744
18782
  return React.createElement('div', { style: { ...PET_STYLE.card, marginTop: '10px' } }, child);
18745
18783
  }
18746
18784
 
@@ -896,6 +896,48 @@ export function registerPetChatRoutes(webServer, c) {
896
896
  }
897
897
  }
898
898
 
899
+ /**
900
+ * GET /pet-chat/work-plugins —— 工作能力插件(聚合携带)的安装状态。
901
+ * 只读探测(不 import 它们,坏插件不拖慢路由):装没装 / 版本 / 要不要配置。
902
+ */
903
+ function handleWorkPlugins(res) {
904
+ const send = (payload, status = 200) => {
905
+ res.statusCode = status;
906
+ res.setHeader('Content-Type', 'application/json; charset=utf-8');
907
+ res.end(JSON.stringify(payload));
908
+ };
909
+ const list = [
910
+ { id: 'office-reader', pkg: '@civilization/dsh-office-reader', label: '文档读取(PDF/Word/Excel)', needs: null },
911
+ { id: 'cron', pkg: '@aiwayds/dsh-cron', label: '定时任务', needs: null },
912
+ { id: 'websearch', pkg: '@240xu/dsh-websearch', label: '联网搜索', needs: '需要搜索 key(在它自己的设置里填)' },
913
+ { id: 'maildesk', pkg: '@aryacode/dsh-arya-maildesk', label: 'Outlook 邮件', needs: '需要本机安装并登录 Outlook' },
914
+ { id: 'notify-hub', pkg: '@alotop/dsh-notify-hub', label: '消息推送', needs: '需要配置推送渠道(Bark/Telegram 等)' },
915
+ ];
916
+ const profileRoot = join(homedir(), 'AppData', 'Roaming', 'dsh-desktop', 'harness', 'profiles', 'web');
917
+ const roots = [join(profileRoot, 'node_modules'), join(dirname(dirname(dirname(__dirname))), '..')];
918
+ const findPkg = (name) => {
919
+ for (const root of roots) {
920
+ const f = join(root, ...name.split('/'), 'package.json');
921
+ try {
922
+ if (existsSync(f)) {
923
+ const j = JSON.parse(readFileSync(f, 'utf8'));
924
+ return { version: j.version || null, engines: j.engines || null };
925
+ }
926
+ } catch { /* ignore */ }
927
+ }
928
+ return null;
929
+ };
930
+ const items = list.map((item) => {
931
+ const hit = findPkg(item.pkg);
932
+ return { ...item, installed: !!hit, version: hit ? hit.version : null, engines: hit ? hit.engines : null };
933
+ });
934
+ const webAll = findPkg('@linxin666/dsh-web-all');
935
+ send({
936
+ ok: true,
937
+ items,
938
+ conflict: webAll ? { pkg: '@linxin666/dsh-web-all', version: webAll.version, note: '它自带桌宠(@linxin666/dsh-pet),会和 Folia 桌宠重叠;建议只启用一个' } : null,
939
+ });
940
+ }
899
941
  /**
900
942
  * GET /pet-chat/asr —— 本地 STT 运行时的状态 / 下载进度。
901
943
  * phase: idle | downloading | loading | ready | failed
@@ -1175,7 +1217,9 @@ export function registerPetChatRoutes(webServer, c) {
1175
1217
  // 插件自己触发 preparation 并轮询进度(DSH 的 speechToText.prepare 是公开方法)。
1176
1218
  // 自检:一次性跑「ffmpeg → 设备 → 录音 → 转写」四步,把每步结果原样返回。
1177
1219
  // 目的:发版前/真机排查时**一个请求就能看到哪一步坏了**,不用来回猜。
1178
- if (tail === '/selftest' && (method === 'GET' || method === 'HEAD')) { void handleSelfTest(res); return; } if (tail === '/asr' && (method === 'GET' || method === 'HEAD')) { handleAsrStatus(res); return; }
1220
+ if (tail === '/selftest' && (method === 'GET' || method === 'HEAD')) { void handleSelfTest(res); return; }
1221
+ if (tail === '/work-plugins' && (method === 'GET' || method === 'HEAD')) { handleWorkPlugins(res); return; }
1222
+ if (tail === '/asr' && (method === 'GET' || method === 'HEAD')) { handleAsrStatus(res); return; }
1179
1223
  if (tail === '/asr' && method === 'POST') { handleAsrPrepare(res); return; }
1180
1224
  // v0.1「零配置」主动搭话:没有开关,只有内部策略 + 语音指令静默
1181
1225
  if (tail === '/proactive' && (method === 'GET' || method === 'HEAD')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-folia",
3
- "version": "4.26.0-pre.24",
3
+ "version": "4.26.0-pre.26",
4
4
  "description": "DSH 壁纸引擎:本机 WE 壁纸实时渲染,视频/网页/开机动画/桌宠皮肤,一键拉取在线素材。",
5
5
  "type": "module",
6
6
  "engines": {