agentdev 0.1.8 → 0.1.10

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 (187) hide show
  1. package/dist/BasicAgent-R7DYGTHF.js +13 -0
  2. package/dist/ExplorerAgent-DXY3OQ5U.js +13 -0
  3. package/dist/{chunk-OBOU27DM.js → chunk-3AR3JBW6.js} +6701 -1730
  4. package/dist/chunk-3AR3JBW6.js.map +1 -0
  5. package/dist/{chunk-F3PR7UTL.js → chunk-72H6A6NB.js} +5 -3
  6. package/dist/{chunk-F3PR7UTL.js.map → chunk-72H6A6NB.js.map} +1 -1
  7. package/dist/{chunk-TSASFMRF.js → chunk-BAP2GCYH.js} +1 -1
  8. package/dist/chunk-BAP2GCYH.js.map +1 -0
  9. package/dist/{chunk-3BPSNNK3.js → chunk-EECW6PYP.js} +11 -9
  10. package/dist/chunk-EECW6PYP.js.map +1 -0
  11. package/dist/chunk-G5ECPY4K.js +551 -0
  12. package/dist/chunk-G5ECPY4K.js.map +1 -0
  13. package/dist/{chunk-LLV3W326.js → chunk-NORTAQIL.js} +67 -20
  14. package/dist/chunk-NORTAQIL.js.map +1 -0
  15. package/dist/{chunk-LQTEETML.js → chunk-REOJZCSZ.js} +12 -7
  16. package/dist/chunk-REOJZCSZ.js.map +1 -0
  17. package/dist/cli/server.js +2 -2
  18. package/dist/cli/viewer.js +2 -2
  19. package/dist/create-feature-cli.js +26 -7
  20. package/dist/features/shell/templates/bash.render.d.ts +1 -1
  21. package/dist/features/websearch/templates/web-fetch.render.d.ts +1 -1
  22. package/dist/index.d.ts +1755 -497
  23. package/dist/index.js +30 -8
  24. package/dist/index.js.map +1 -1
  25. package/dist/{notification-3VEAP7YF.js → notification-NWVOS2WR.js} +3 -3
  26. package/dist/tools-LDR3LIJP.js +14 -0
  27. package/dist/tools-LDR3LIJP.js.map +1 -0
  28. package/dist/{types-DUKIIntb.d.ts → types-CF5UsxD9.d.ts} +3 -0
  29. package/node_modules/@sliverp/qqbot/LICENSE +21 -0
  30. package/node_modules/@sliverp/qqbot/README.md +427 -0
  31. package/node_modules/@sliverp/qqbot/README.standalone.zh.md +77 -0
  32. package/node_modules/@sliverp/qqbot/README.zh.md +423 -0
  33. package/node_modules/@sliverp/qqbot/bin/qqbot-cli.js +227 -0
  34. package/node_modules/@sliverp/qqbot/clawdbot.plugin.json +16 -0
  35. package/node_modules/@sliverp/qqbot/dist/index.d.ts +20 -0
  36. package/node_modules/@sliverp/qqbot/dist/index.js +25 -0
  37. package/node_modules/@sliverp/qqbot/dist/src/agent.d.ts +76 -0
  38. package/node_modules/@sliverp/qqbot/dist/src/agent.js +36 -0
  39. package/node_modules/@sliverp/qqbot/dist/src/api.d.ts +138 -0
  40. package/node_modules/@sliverp/qqbot/dist/src/api.js +523 -0
  41. package/node_modules/@sliverp/qqbot/dist/src/channel.d.ts +3 -0
  42. package/node_modules/@sliverp/qqbot/dist/src/channel.js +349 -0
  43. package/node_modules/@sliverp/qqbot/dist/src/config.d.ts +25 -0
  44. package/node_modules/@sliverp/qqbot/dist/src/config.js +156 -0
  45. package/node_modules/@sliverp/qqbot/dist/src/demo-standalone.d.ts +1 -0
  46. package/node_modules/@sliverp/qqbot/dist/src/demo-standalone.js +125 -0
  47. package/node_modules/@sliverp/qqbot/dist/src/gateway.d.ts +20 -0
  48. package/node_modules/@sliverp/qqbot/dist/src/gateway.js +2156 -0
  49. package/node_modules/@sliverp/qqbot/dist/src/image-server.d.ts +62 -0
  50. package/node_modules/@sliverp/qqbot/dist/src/image-server.js +401 -0
  51. package/node_modules/@sliverp/qqbot/dist/src/known-users.d.ts +100 -0
  52. package/node_modules/@sliverp/qqbot/dist/src/known-users.js +263 -0
  53. package/node_modules/@sliverp/qqbot/dist/src/onboarding.d.ts +10 -0
  54. package/node_modules/@sliverp/qqbot/dist/src/onboarding.js +203 -0
  55. package/node_modules/@sliverp/qqbot/dist/src/openclaw-agent-adapter.d.ts +2 -0
  56. package/node_modules/@sliverp/qqbot/dist/src/openclaw-agent-adapter.js +155 -0
  57. package/node_modules/@sliverp/qqbot/dist/src/outbound.d.ts +150 -0
  58. package/node_modules/@sliverp/qqbot/dist/src/outbound.js +1175 -0
  59. package/node_modules/@sliverp/qqbot/dist/src/proactive.d.ts +170 -0
  60. package/node_modules/@sliverp/qqbot/dist/src/proactive.js +399 -0
  61. package/node_modules/@sliverp/qqbot/dist/src/runtime.d.ts +5 -0
  62. package/node_modules/@sliverp/qqbot/dist/src/runtime.js +16 -0
  63. package/node_modules/@sliverp/qqbot/dist/src/session-store.d.ts +52 -0
  64. package/node_modules/@sliverp/qqbot/dist/src/session-store.js +254 -0
  65. package/node_modules/@sliverp/qqbot/dist/src/types.d.ts +145 -0
  66. package/node_modules/@sliverp/qqbot/dist/src/types.js +1 -0
  67. package/node_modules/@sliverp/qqbot/dist/src/utils/audio-convert.d.ts +73 -0
  68. package/node_modules/@sliverp/qqbot/dist/src/utils/audio-convert.js +645 -0
  69. package/node_modules/@sliverp/qqbot/dist/src/utils/file-utils.d.ts +46 -0
  70. package/node_modules/@sliverp/qqbot/dist/src/utils/file-utils.js +107 -0
  71. package/node_modules/@sliverp/qqbot/dist/src/utils/image-size.d.ts +51 -0
  72. package/node_modules/@sliverp/qqbot/dist/src/utils/image-size.js +234 -0
  73. package/node_modules/@sliverp/qqbot/dist/src/utils/media-tags.d.ts +14 -0
  74. package/node_modules/@sliverp/qqbot/dist/src/utils/media-tags.js +120 -0
  75. package/node_modules/@sliverp/qqbot/dist/src/utils/payload.d.ts +112 -0
  76. package/node_modules/@sliverp/qqbot/dist/src/utils/payload.js +186 -0
  77. package/node_modules/@sliverp/qqbot/dist/src/utils/platform.d.ts +126 -0
  78. package/node_modules/@sliverp/qqbot/dist/src/utils/platform.js +358 -0
  79. package/node_modules/@sliverp/qqbot/dist/src/utils/upload-cache.d.ts +34 -0
  80. package/node_modules/@sliverp/qqbot/dist/src/utils/upload-cache.js +93 -0
  81. package/node_modules/@sliverp/qqbot/dist/standalone.d.ts +6 -0
  82. package/node_modules/@sliverp/qqbot/dist/standalone.js +6 -0
  83. package/node_modules/@sliverp/qqbot/index.ts +30 -0
  84. package/node_modules/@sliverp/qqbot/moltbot.plugin.json +16 -0
  85. package/node_modules/@sliverp/qqbot/node_modules/@eshaz/web-worker/LICENSE +201 -0
  86. package/node_modules/@sliverp/qqbot/node_modules/@eshaz/web-worker/README.md +134 -0
  87. package/node_modules/@sliverp/qqbot/node_modules/@eshaz/web-worker/browser.js +17 -0
  88. package/node_modules/@sliverp/qqbot/node_modules/@eshaz/web-worker/cjs/browser.js +16 -0
  89. package/node_modules/@sliverp/qqbot/node_modules/@eshaz/web-worker/cjs/node.js +219 -0
  90. package/node_modules/@sliverp/qqbot/node_modules/@eshaz/web-worker/index.d.ts +4 -0
  91. package/node_modules/@sliverp/qqbot/node_modules/@eshaz/web-worker/node.js +223 -0
  92. package/node_modules/@sliverp/qqbot/node_modules/@eshaz/web-worker/package.json +54 -0
  93. package/node_modules/@sliverp/qqbot/node_modules/@wasm-audio-decoders/common/index.js +5 -0
  94. package/node_modules/@sliverp/qqbot/node_modules/@wasm-audio-decoders/common/package.json +36 -0
  95. package/node_modules/@sliverp/qqbot/node_modules/@wasm-audio-decoders/common/src/WASMAudioDecoderCommon.js +231 -0
  96. package/node_modules/@sliverp/qqbot/node_modules/@wasm-audio-decoders/common/src/WASMAudioDecoderWorker.js +129 -0
  97. package/node_modules/@sliverp/qqbot/node_modules/@wasm-audio-decoders/common/src/puff/README +67 -0
  98. package/node_modules/@sliverp/qqbot/node_modules/@wasm-audio-decoders/common/src/puff/build_puff.js +31 -0
  99. package/node_modules/@sliverp/qqbot/node_modules/@wasm-audio-decoders/common/src/puff/puff.c +863 -0
  100. package/node_modules/@sliverp/qqbot/node_modules/@wasm-audio-decoders/common/src/puff/puff.h +35 -0
  101. package/node_modules/@sliverp/qqbot/node_modules/@wasm-audio-decoders/common/src/utilities.js +3 -0
  102. package/node_modules/@sliverp/qqbot/node_modules/@wasm-audio-decoders/common/types.d.ts +7 -0
  103. package/node_modules/@sliverp/qqbot/node_modules/mpg123-decoder/README.md +265 -0
  104. package/node_modules/@sliverp/qqbot/node_modules/mpg123-decoder/dist/mpg123-decoder.min.js +185 -0
  105. package/node_modules/@sliverp/qqbot/node_modules/mpg123-decoder/dist/mpg123-decoder.min.js.map +1 -0
  106. package/node_modules/@sliverp/qqbot/node_modules/mpg123-decoder/index.js +8 -0
  107. package/node_modules/@sliverp/qqbot/node_modules/mpg123-decoder/package.json +58 -0
  108. package/node_modules/@sliverp/qqbot/node_modules/mpg123-decoder/src/EmscriptenWasm.js +464 -0
  109. package/node_modules/@sliverp/qqbot/node_modules/mpg123-decoder/src/MPEGDecoder.js +200 -0
  110. package/node_modules/@sliverp/qqbot/node_modules/mpg123-decoder/src/MPEGDecoderWebWorker.js +21 -0
  111. package/node_modules/@sliverp/qqbot/node_modules/mpg123-decoder/types.d.ts +30 -0
  112. package/node_modules/@sliverp/qqbot/node_modules/silk-wasm/LICENSE +21 -0
  113. package/node_modules/@sliverp/qqbot/node_modules/silk-wasm/README.md +85 -0
  114. package/node_modules/@sliverp/qqbot/node_modules/silk-wasm/lib/index.cjs +16 -0
  115. package/node_modules/@sliverp/qqbot/node_modules/silk-wasm/lib/index.d.ts +70 -0
  116. package/node_modules/@sliverp/qqbot/node_modules/silk-wasm/lib/index.mjs +16 -0
  117. package/node_modules/@sliverp/qqbot/node_modules/silk-wasm/lib/silk.wasm +0 -0
  118. package/node_modules/@sliverp/qqbot/node_modules/silk-wasm/lib/utils.d.ts +4 -0
  119. package/node_modules/@sliverp/qqbot/node_modules/silk-wasm/package.json +39 -0
  120. package/node_modules/@sliverp/qqbot/node_modules/simple-yenc/.github/FUNDING.yml +1 -0
  121. package/node_modules/@sliverp/qqbot/node_modules/simple-yenc/.prettierignore +1 -0
  122. package/node_modules/@sliverp/qqbot/node_modules/simple-yenc/LICENSE +7 -0
  123. package/node_modules/@sliverp/qqbot/node_modules/simple-yenc/README.md +163 -0
  124. package/node_modules/@sliverp/qqbot/node_modules/simple-yenc/dist/esm.js +1 -0
  125. package/node_modules/@sliverp/qqbot/node_modules/simple-yenc/dist/index.js +1 -0
  126. package/node_modules/@sliverp/qqbot/node_modules/simple-yenc/package.json +50 -0
  127. package/node_modules/@sliverp/qqbot/node_modules/simple-yenc/rollup.config.js +27 -0
  128. package/node_modules/@sliverp/qqbot/node_modules/simple-yenc/src/simple-yenc.js +302 -0
  129. package/node_modules/@sliverp/qqbot/node_modules/ws/LICENSE +20 -0
  130. package/node_modules/@sliverp/qqbot/node_modules/ws/README.md +548 -0
  131. package/node_modules/@sliverp/qqbot/node_modules/ws/browser.js +8 -0
  132. package/node_modules/@sliverp/qqbot/node_modules/ws/index.js +13 -0
  133. package/node_modules/@sliverp/qqbot/node_modules/ws/lib/buffer-util.js +131 -0
  134. package/node_modules/@sliverp/qqbot/node_modules/ws/lib/constants.js +19 -0
  135. package/node_modules/@sliverp/qqbot/node_modules/ws/lib/event-target.js +292 -0
  136. package/node_modules/@sliverp/qqbot/node_modules/ws/lib/extension.js +203 -0
  137. package/node_modules/@sliverp/qqbot/node_modules/ws/lib/limiter.js +55 -0
  138. package/node_modules/@sliverp/qqbot/node_modules/ws/lib/permessage-deflate.js +528 -0
  139. package/node_modules/@sliverp/qqbot/node_modules/ws/lib/receiver.js +706 -0
  140. package/node_modules/@sliverp/qqbot/node_modules/ws/lib/sender.js +602 -0
  141. package/node_modules/@sliverp/qqbot/node_modules/ws/lib/stream.js +161 -0
  142. package/node_modules/@sliverp/qqbot/node_modules/ws/lib/subprotocol.js +62 -0
  143. package/node_modules/@sliverp/qqbot/node_modules/ws/lib/validation.js +152 -0
  144. package/node_modules/@sliverp/qqbot/node_modules/ws/lib/websocket-server.js +554 -0
  145. package/node_modules/@sliverp/qqbot/node_modules/ws/lib/websocket.js +1393 -0
  146. package/node_modules/@sliverp/qqbot/node_modules/ws/package.json +69 -0
  147. package/node_modules/@sliverp/qqbot/node_modules/ws/wrapper.mjs +8 -0
  148. package/node_modules/@sliverp/qqbot/openclaw.plugin.json +16 -0
  149. package/node_modules/@sliverp/qqbot/package.json +81 -0
  150. package/node_modules/@sliverp/qqbot/skills/qqbot-cron/SKILL.md +513 -0
  151. package/node_modules/@sliverp/qqbot/skills/qqbot-media/SKILL.md +194 -0
  152. package/node_modules/@sliverp/qqbot/src/agent.ts +133 -0
  153. package/node_modules/@sliverp/qqbot/src/api.ts +704 -0
  154. package/node_modules/@sliverp/qqbot/src/channel.ts +380 -0
  155. package/node_modules/@sliverp/qqbot/src/config.ts +182 -0
  156. package/node_modules/@sliverp/qqbot/src/demo-standalone.ts +144 -0
  157. package/node_modules/@sliverp/qqbot/src/gateway.ts +2285 -0
  158. package/node_modules/@sliverp/qqbot/src/image-server.ts +474 -0
  159. package/node_modules/@sliverp/qqbot/src/known-users.ts +353 -0
  160. package/node_modules/@sliverp/qqbot/src/onboarding.ts +274 -0
  161. package/node_modules/@sliverp/qqbot/src/openclaw-agent-adapter.ts +168 -0
  162. package/node_modules/@sliverp/qqbot/src/openclaw-plugin-sdk.d.ts +483 -0
  163. package/node_modules/@sliverp/qqbot/src/outbound.ts +1301 -0
  164. package/node_modules/@sliverp/qqbot/src/proactive.ts +530 -0
  165. package/node_modules/@sliverp/qqbot/src/runtime.ts +22 -0
  166. package/node_modules/@sliverp/qqbot/src/session-store.ts +303 -0
  167. package/node_modules/@sliverp/qqbot/src/types.ts +153 -0
  168. package/node_modules/@sliverp/qqbot/src/utils/audio-convert.ts +738 -0
  169. package/node_modules/@sliverp/qqbot/src/utils/file-utils.ts +122 -0
  170. package/node_modules/@sliverp/qqbot/src/utils/image-size.ts +266 -0
  171. package/node_modules/@sliverp/qqbot/src/utils/media-tags.ts +134 -0
  172. package/node_modules/@sliverp/qqbot/src/utils/payload.ts +265 -0
  173. package/node_modules/@sliverp/qqbot/src/utils/platform.ts +404 -0
  174. package/node_modules/@sliverp/qqbot/src/utils/upload-cache.ts +128 -0
  175. package/node_modules/@sliverp/qqbot/standalone.ts +6 -0
  176. package/node_modules/@sliverp/qqbot/tsconfig.json +16 -0
  177. package/package.json +10 -2
  178. package/dist/BasicAgent-QWEYCLV5.js +0 -12
  179. package/dist/ExplorerAgent-4IT22VB7.js +0 -12
  180. package/dist/chunk-3BPSNNK3.js.map +0 -1
  181. package/dist/chunk-LLV3W326.js.map +0 -1
  182. package/dist/chunk-LQTEETML.js.map +0 -1
  183. package/dist/chunk-OBOU27DM.js.map +0 -1
  184. package/dist/chunk-TSASFMRF.js.map +0 -1
  185. /package/dist/{BasicAgent-QWEYCLV5.js.map → BasicAgent-R7DYGTHF.js.map} +0 -0
  186. /package/dist/{ExplorerAgent-4IT22VB7.js.map → ExplorerAgent-DXY3OQ5U.js.map} +0 -0
  187. /package/dist/{notification-3VEAP7YF.js.map → notification-NWVOS2WR.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getDefaultUDSPath
3
- } from "./chunk-TSASFMRF.js";
3
+ } from "./chunk-BAP2GCYH.js";
4
4
  import {
5
5
  __require
6
6
  } from "./chunk-BDS2QGZ5.js";
@@ -2509,6 +2509,8 @@ function generateViewerHtml(port) {
2509
2509
  border-radius: 0 0 6px 6px;
2510
2510
  padding: 12px;
2511
2511
  overflow-x: auto;
2512
+ overflow-y: auto;
2513
+ max-height: 400px;
2512
2514
  font-size: 13px;
2513
2515
  }
2514
2516
 
@@ -2920,7 +2922,7 @@ function generateViewerHtml(port) {
2920
2922
  // \u52A0\u8F7D Feature \u6A21\u677F\u6620\u5C04
2921
2923
  async function loadFeatureTemplateMap() {
2922
2924
  try {
2923
- const response = await fetch('/api/templates/feature');
2925
+ const response = await fetch('/api/templates/feature' + (currentAgentId ? '?agentId=' + encodeURIComponent(currentAgentId) : ''));
2924
2926
  if (response.ok) {
2925
2927
  const data = await response.json();
2926
2928
  if (Object.keys(data).length > 0) {
@@ -5396,13 +5398,44 @@ function generateViewerHtml(port) {
5396
5398
  }
5397
5399
  }
5398
5400
 
5399
- function updateRollbackActionVisibility() {
5401
+ function syncRollbackActionButtons() {
5400
5402
  const allowRollback = !!getPrimaryInputRequest();
5401
- document.querySelectorAll('.message-row.user .message-action').forEach((button) => {
5402
- button.style.display = allowRollback ? '' : 'none';
5403
+ const rows = container.querySelectorAll('.message-row');
5404
+
5405
+ rows.forEach((row, index) => {
5406
+ const msg = currentMessages[index];
5407
+ const meta = row.querySelector('.message-meta');
5408
+ if (!meta) return;
5409
+
5410
+ const existingButton = meta.querySelector('.message-action');
5411
+ const shouldShow = allowRollback && !!msg && msg.role === 'user';
5412
+
5413
+ if (!shouldShow) {
5414
+ if (existingButton) {
5415
+ existingButton.remove();
5416
+ }
5417
+ return;
5418
+ }
5419
+
5420
+ if (existingButton) {
5421
+ existingButton.setAttribute('onclick', 'requestRollbackEdit(' + index + ')');
5422
+ existingButton.style.display = '';
5423
+ return;
5424
+ }
5425
+
5426
+ const button = document.createElement('button');
5427
+ button.className = 'message-action';
5428
+ button.type = 'button';
5429
+ button.textContent = '\u7F16\u8F91\u6B64\u8F6E';
5430
+ button.setAttribute('onclick', 'requestRollbackEdit(' + index + ')');
5431
+ meta.appendChild(button);
5403
5432
  });
5404
5433
  }
5405
5434
 
5435
+ function updateRollbackActionVisibility() {
5436
+ syncRollbackActionButtons();
5437
+ }
5438
+
5406
5439
  function autoResize(textarea) {
5407
5440
  textarea.style.height = 'auto';
5408
5441
  textarea.style.height = Math.min(textarea.scrollHeight, 200) + 'px';
@@ -5590,6 +5623,9 @@ function generateViewerHtml(port) {
5590
5623
  </div>
5591
5624
  </div>
5592
5625
  \`;
5626
+ } else if (msg.content.startsWith('[Error:')) {
5627
+ // \u9519\u8BEF\u6D88\u606F\u4F7F\u7528\u7EA2\u8272\u6837\u5F0F
5628
+ innerContent += \`<div class="tool-error">\${escapeHtml(msg.content)}</div>\`;
5593
5629
  } else {
5594
5630
  innerContent += \`<div class="markdown-body">\${marked.parse(msg.content)}</div>\`;
5595
5631
  }
@@ -5707,6 +5743,7 @@ function generateViewerHtml(port) {
5707
5743
 
5708
5744
  // \u5BF9\u65B0\u6D88\u606F\u5E94\u7528\u6298\u53E0\u903B\u8F91
5709
5745
  applyCollapseLogic(container, startIndex);
5746
+ updateRollbackActionVisibility();
5710
5747
  updateFollowLatestButton();
5711
5748
  if (followLatestEnabled) {
5712
5749
  scheduleScrollToLatest('smooth');
@@ -5759,6 +5796,7 @@ function generateViewerHtml(port) {
5759
5796
  }
5760
5797
  }
5761
5798
 
5799
+ updateRollbackActionVisibility();
5762
5800
  updateFollowLatestButton();
5763
5801
  if (followLatestEnabled) {
5764
5802
  scheduleScrollToLatest('smooth');
@@ -6003,13 +6041,13 @@ function generateViewerHtml(port) {
6003
6041
  const isCollapsed = el.classList.contains('collapsed');
6004
6042
  btnBar.innerHTML = '<button class="expand-toggle-btn" onclick="toggleMessage(&quot;' + el.id + '&quot;)">' + getToggleButtonLabel(isCollapsed) + '</button>';
6005
6043
 
6006
- } else {
6007
- const toggle = row.querySelector('.collapse-toggle');
6008
- if (toggle) toggle.style.display = 'none';
6009
- }
6010
- });
6044
+ } else {
6045
+ const toggle = row.querySelector('.collapse-toggle');
6046
+ if (toggle) toggle.style.display = 'none';
6047
+ }
6048
+ });
6011
6049
 
6012
- updateRollbackActionVisibility();
6050
+ updateRollbackActionVisibility();
6013
6051
  updateFollowLatestButton();
6014
6052
  if (followLatestEnabled) {
6015
6053
  scheduleScrollToLatest('auto');
@@ -6079,8 +6117,8 @@ var ViewerWorker = class {
6079
6117
  agentSessions = /* @__PURE__ */ new Map();
6080
6118
  // 当前选中的 Agent ID
6081
6119
  currentAgentId = null;
6082
- // Feature 模板路径映射(模板名 -> 文件路径)
6083
- featureTemplateMap = {};
6120
+ // Feature 模板路径映射(agentId -> 模板名 -> URL)
6121
+ featureTemplateMap = /* @__PURE__ */ new Map();
6084
6122
  debuggerMcp = new DebuggerMCPServer({
6085
6123
  listAgents: () => this.listAgentSummaries(),
6086
6124
  getAgent: (agentId) => this.getAgentDetails(agentId),
@@ -6311,7 +6349,7 @@ var ViewerWorker = class {
6311
6349
  return;
6312
6350
  }
6313
6351
  if (url === "/api/templates/feature" && req.method === "GET") {
6314
- this.handleGetFeatureTemplates(req, res);
6352
+ this.handleGetFeatureTemplates(req, res, urlObj.searchParams);
6315
6353
  return;
6316
6354
  }
6317
6355
  if (url === "/api/logs" && req.method === "GET") {
@@ -6461,11 +6499,18 @@ var ViewerWorker = class {
6461
6499
  /**
6462
6500
  * GET /api/templates/feature - 获取 Feature 模板映射
6463
6501
  */
6464
- handleGetFeatureTemplates(req, res) {
6465
- console.log("[Viewer Worker] handleGetFeatureTemplates called, featureTemplateMap keys:", Object.keys(this.featureTemplateMap));
6466
- const projectRoot = this.currentAgentId ? this.agentSessions.get(this.currentAgentId)?.projectRoot : void 0;
6502
+ handleGetFeatureTemplates(req, res, searchParams) {
6503
+ const targetAgentId = searchParams?.get("agentId") || this.currentAgentId;
6504
+ const session = targetAgentId ? this.agentSessions.get(targetAgentId) : void 0;
6505
+ const projectRoot = session?.projectRoot;
6506
+ const templates = targetAgentId ? this.featureTemplateMap.get(targetAgentId) : void 0;
6507
+ if (!templates || Object.keys(templates).length === 0) {
6508
+ res.writeHead(200, { "Content-Type": "application/json; charset=utf-8" });
6509
+ res.end("{}");
6510
+ return;
6511
+ }
6467
6512
  const featureTemplateMapForFrontend = {};
6468
- for (const [templateName, absolutePath] of Object.entries(this.featureTemplateMap)) {
6513
+ for (const [templateName, absolutePath] of Object.entries(templates)) {
6469
6514
  const normalizedPath = absolutePath.replace(/\\/g, "/");
6470
6515
  const url = this.templatePathToUrl(normalizedPath, projectRoot);
6471
6516
  if (url) {
@@ -6913,7 +6958,7 @@ var ViewerWorker = class {
6913
6958
  session.clientId = clientId;
6914
6959
  }
6915
6960
  if (featureTemplates && typeof featureTemplates === "object") {
6916
- Object.assign(this.featureTemplateMap, featureTemplates);
6961
+ this.featureTemplateMap.set(agentId, featureTemplates);
6917
6962
  }
6918
6963
  if (hookInspector) {
6919
6964
  session.hookInspector = hookInspector;
@@ -6960,6 +7005,7 @@ var ViewerWorker = class {
6960
7005
  * 清空 Feature 模板映射(当 Agent 断开连接时调用)
6961
7006
  */
6962
7007
  clearFeatureTemplates(agentId) {
7008
+ this.featureTemplateMap.delete(agentId);
6963
7009
  }
6964
7010
  /**
6965
7011
  * 处理推送消息(带去重优化)
@@ -7077,6 +7123,7 @@ var ViewerWorker = class {
7077
7123
  handleUnregisterAgent(msg) {
7078
7124
  const { agentId } = msg;
7079
7125
  this.agentSessions.delete(agentId);
7126
+ this.clearFeatureTemplates(agentId);
7080
7127
  console.log(`[Viewer Worker] Agent \u5DF2\u6CE8\u9500: ${agentId}`);
7081
7128
  if (this.currentAgentId === agentId) {
7082
7129
  const remaining = Array.from(this.agentSessions.keys());
@@ -7621,4 +7668,4 @@ if (isMainModule(import.meta.url)) {
7621
7668
  export {
7622
7669
  ViewerWorker
7623
7670
  };
7624
- //# sourceMappingURL=chunk-LLV3W326.js.map
7671
+ //# sourceMappingURL=chunk-NORTAQIL.js.map