@wendongfly/myhi 1.3.5 → 1.3.7

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
 
@@ -1159,6 +1160,8 @@
1159
1160
  } else if (msg.subtype === 'interrupted') {
1160
1161
  addStatusMessage('查询已中断');
1161
1162
  setWorkState('idle');
1163
+ } else if (msg.subtype === 'info' && msg.message) {
1164
+ addStatusMessage(msg.message);
1162
1165
  }
1163
1166
  break;
1164
1167
  case 'assistant':
@@ -1182,6 +1185,9 @@
1182
1185
  case 'result':
1183
1186
  removeThinking();
1184
1187
  setWorkState('idle');
1188
+ if (msg.result) {
1189
+ addAssistantMessage(typeof msg.result === 'string' ? msg.result : JSON.stringify(msg.result));
1190
+ }
1185
1191
  const cost = msg.total_cost_usd ? ` ($${msg.total_cost_usd.toFixed(4)})` : '';
1186
1192
  addStatusMessage(`完成${cost}`);
1187
1193
  break;
@@ -1922,6 +1928,28 @@
1922
1928
  addStatusMessage('会话已命名为: ' + title);
1923
1929
  });
1924
1930
 
1931
+ // ── 动态加载 Skill 按钮 ──────────────────────────
1932
+ async function loadSkills() {
1933
+ try {
1934
+ const resp = await fetch(`/api/skills?sessionId=${SESSION_ID}`);
1935
+ const data = await resp.json();
1936
+ const container = document.getElementById('sk-custom-skills');
1937
+ if (!data.skills || !data.skills.length) { container.innerHTML = ''; return; }
1938
+ container.innerHTML = data.skills.map(s =>
1939
+ `<button class="sk sk-claude" onclick="runSkill('${escHtml(s.name)}')" title="${escHtml(s.desc)}" style="color:#9d5cf5">/${escHtml(s.name)}</button>`
1940
+ ).join('');
1941
+ } catch {}
1942
+ }
1943
+ window.runSkill = function(name) {
1944
+ if (!isController && canTakeControl()) socket.emit('take-control', { sessionId: SESSION_ID });
1945
+ const cmd = '/' + name;
1946
+ socket.emit('agent:query', { prompt: cmd });
1947
+ addInputMessage(cmd);
1948
+ showThinking();
1949
+ };
1950
+ // 加入会话后加载 skill
1951
+ socket.on('joined', () => { if (currentSession?.mode === 'agent') loadSkills(); });
1952
+
1925
1953
  // ── Git 提交推送 ──────────────────────────────
1926
1954
  const GIT_STORAGE_KEY = 'myhi-git-' + SESSION_ID;
1927
1955