@wendongfly/myhi 1.3.5 → 1.3.6

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/dist/chat.html CHANGED
@@ -334,6 +334,7 @@
334
334
  <button class="sk sk-claude" onclick="doSlashCmd('/rename')">命名</button>
335
335
  <button class="sk sk-claude" onclick="openGitSheet()" style="color:#3fb950">提交</button>
336
336
  <button class="sk sk-claude" onclick="showMemory()">记忆</button>
337
+ <span id="sk-custom-skills"></span>
337
338
  </div>
338
339
  </div>
339
340
 
@@ -1922,6 +1923,28 @@
1922
1923
  addStatusMessage('会话已命名为: ' + title);
1923
1924
  });
1924
1925
 
1926
+ // ── 动态加载 Skill 按钮 ──────────────────────────
1927
+ async function loadSkills() {
1928
+ try {
1929
+ const resp = await fetch(`/api/skills?sessionId=${SESSION_ID}`);
1930
+ const data = await resp.json();
1931
+ const container = document.getElementById('sk-custom-skills');
1932
+ if (!data.skills || !data.skills.length) { container.innerHTML = ''; return; }
1933
+ container.innerHTML = data.skills.map(s =>
1934
+ `<button class="sk sk-claude" onclick="runSkill('${escHtml(s.name)}')" title="${escHtml(s.desc)}" style="color:#9d5cf5">/${escHtml(s.name)}</button>`
1935
+ ).join('');
1936
+ } catch {}
1937
+ }
1938
+ window.runSkill = function(name) {
1939
+ if (!isController && canTakeControl()) socket.emit('take-control', { sessionId: SESSION_ID });
1940
+ const cmd = '/' + name;
1941
+ socket.emit('agent:query', { prompt: cmd });
1942
+ addInputMessage(cmd);
1943
+ showThinking();
1944
+ };
1945
+ // 加入会话后加载 skill
1946
+ socket.on('joined', () => { if (currentSession?.mode === 'agent') loadSkills(); });
1947
+
1925
1948
  // ── Git 提交推送 ──────────────────────────────
1926
1949
  const GIT_STORAGE_KEY = 'myhi-git-' + SESSION_ID;
1927
1950