@wendongfly/myhi 1.3.30 → 1.3.31

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.
Files changed (2) hide show
  1. package/dist/chat.html +51 -4
  2. package/package.json +1 -1
package/dist/chat.html CHANGED
@@ -452,6 +452,19 @@
452
452
  </div>
453
453
  </div>
454
454
 
455
+ <!-- 自定义 Slash Commands 弹窗 -->
456
+ <div id="cmd-sheet" class="action-sheet">
457
+ <div class="action-sheet-backdrop" onclick="closeCmdSheet()"></div>
458
+ <div class="action-sheet-box" style="max-height:75vh;display:flex;flex-direction:column">
459
+ <div class="action-sheet-title">自定义命令</div>
460
+ <div style="padding:0.3rem 0.2rem">
461
+ <input id="cmd-filter" class="slash-inp" placeholder="搜索命令..." autocomplete="off">
462
+ </div>
463
+ <div id="cmd-sheet-list" style="flex:1;overflow-y:auto;padding:0.3rem 0;scrollbar-width:thin"></div>
464
+ <button class="action-sheet-cancel" onclick="closeCmdSheet()">取消</button>
465
+ </div>
466
+ </div>
467
+
455
468
  <!-- AskUserQuestion 弹窗 -->
456
469
  <div id="ask-sheet" class="action-sheet">
457
470
  <div class="action-sheet-backdrop" onclick="closeAskSheet()"></div>
@@ -2067,15 +2080,22 @@
2067
2080
  });
2068
2081
 
2069
2082
  // ── 动态加载 Skill 按钮 ──────────────────────────
2083
+ let _customSkills = [];
2070
2084
  async function loadSkills() {
2071
2085
  try {
2072
2086
  const resp = await fetch(`/api/skills?sessionId=${SESSION_ID}`);
2073
2087
  const data = await resp.json();
2074
2088
  const container = document.getElementById('sk-custom-skills');
2075
- if (!data.skills || !data.skills.length) { container.innerHTML = ''; return; }
2076
- container.innerHTML = data.skills.map(s =>
2077
- `<button class="sk sk-claude" onclick="runSkill('${escHtml(s.name)}')" title="${escHtml(s.desc)}" style="color:#9d5cf5">/${escHtml(s.name)}</button>`
2078
- ).join('');
2089
+ _customSkills = data.skills || [];
2090
+ if (!_customSkills.length) { container.innerHTML = ''; return; }
2091
+ // ≤3 个:直接显示按钮;>3 个:显示 "/命令 (N)" 入口
2092
+ if (_customSkills.length <= 3) {
2093
+ container.innerHTML = _customSkills.map(s =>
2094
+ `<button class="sk sk-claude" onclick="runSkill('${escHtml(s.name)}')" title="${escHtml(s.desc)}" style="color:#9d5cf5">/${escHtml(s.name)}</button>`
2095
+ ).join('');
2096
+ } else {
2097
+ container.innerHTML = `<button class="sk sk-claude" onclick="openCmdSheet()" style="color:#9d5cf5">/命令 (${_customSkills.length})</button>`;
2098
+ }
2079
2099
  } catch {}
2080
2100
  }
2081
2101
  window.runSkill = function(name) {
@@ -2085,6 +2105,33 @@
2085
2105
  addInputMessage(cmd);
2086
2106
  showThinking();
2087
2107
  };
2108
+ window.openCmdSheet = function() {
2109
+ const sheet = document.getElementById('cmd-sheet');
2110
+ const listEl = document.getElementById('cmd-sheet-list');
2111
+ const filterInp = document.getElementById('cmd-filter');
2112
+ filterInp.value = '';
2113
+ const render = (keyword = '') => {
2114
+ const kw = keyword.toLowerCase();
2115
+ const filtered = _customSkills.filter(s =>
2116
+ !kw || s.name.toLowerCase().includes(kw) || (s.desc || '').toLowerCase().includes(kw));
2117
+ listEl.innerHTML = filtered.length
2118
+ ? filtered.map(s => `<div class="action-sheet-item" onclick="runSkillAndClose('${escHtml(s.name)}')">
2119
+ <div><div style="color:#d2a8ff">/${escHtml(s.name)}</div>${s.desc ? `<div class="desc">${escHtml(s.desc)}</div>` : ''}</div>
2120
+ </div>`).join('')
2121
+ : '<div style="text-align:center;color:#8b949e;padding:1.5rem 0;font-size:0.82rem">无匹配命令</div>';
2122
+ };
2123
+ render();
2124
+ filterInp.oninput = (e) => render(e.target.value);
2125
+ sheet.classList.add('open');
2126
+ setTimeout(() => filterInp.focus(), 100);
2127
+ };
2128
+ window.closeCmdSheet = function() {
2129
+ document.getElementById('cmd-sheet').classList.remove('open');
2130
+ };
2131
+ window.runSkillAndClose = function(name) {
2132
+ closeCmdSheet();
2133
+ runSkill(name);
2134
+ };
2088
2135
  // 加入会话后加载 skill
2089
2136
  socket.on('joined', () => { if (currentSession?.mode === 'agent') loadSkills(); });
2090
2137
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wendongfly/myhi",
3
- "version": "1.3.30",
3
+ "version": "1.3.31",
4
4
  "description": "Web-based terminal sharing with chat UI — control your terminal from phone via LAN/Tailscale",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",