agentdev 0.1.8 → 0.1.9
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/BasicAgent-UWXLSZP2.js +13 -0
- package/dist/ExplorerAgent-LCM3JQS4.js +13 -0
- package/dist/{chunk-LQTEETML.js → chunk-5T4C2XRT.js} +12 -7
- package/dist/chunk-5T4C2XRT.js.map +1 -0
- package/dist/{chunk-OBOU27DM.js → chunk-A354ZCZF.js} +6735 -1822
- package/dist/chunk-A354ZCZF.js.map +1 -0
- package/dist/{chunk-TSASFMRF.js → chunk-BAP2GCYH.js} +1 -1
- package/dist/chunk-BAP2GCYH.js.map +1 -0
- package/dist/{chunk-3BPSNNK3.js → chunk-EECW6PYP.js} +11 -9
- package/dist/chunk-EECW6PYP.js.map +1 -0
- package/dist/chunk-G5ECPY4K.js +551 -0
- package/dist/chunk-G5ECPY4K.js.map +1 -0
- package/dist/{chunk-LLV3W326.js → chunk-NORTAQIL.js} +67 -20
- package/dist/chunk-NORTAQIL.js.map +1 -0
- package/dist/{chunk-F3PR7UTL.js → chunk-QFHPUAUQ.js} +5 -3
- package/dist/{chunk-F3PR7UTL.js.map → chunk-QFHPUAUQ.js.map} +1 -1
- package/dist/cli/server.js +2 -2
- package/dist/cli/viewer.js +2 -2
- package/dist/features/shell/templates/bash.render.d.ts +1 -1
- package/dist/features/websearch/templates/web-fetch.render.d.ts +1 -1
- package/dist/index.d.ts +1733 -500
- package/dist/index.js +30 -8
- package/dist/index.js.map +1 -1
- package/dist/{notification-3VEAP7YF.js → notification-NWVOS2WR.js} +3 -3
- package/dist/tools-LDR3LIJP.js +14 -0
- package/dist/tools-LDR3LIJP.js.map +1 -0
- package/dist/{types-DUKIIntb.d.ts → types-CF5UsxD9.d.ts} +3 -0
- package/node_modules/@sliverp/qqbot/LICENSE +21 -0
- package/node_modules/@sliverp/qqbot/README.md +427 -0
- package/node_modules/@sliverp/qqbot/README.standalone.zh.md +77 -0
- package/node_modules/@sliverp/qqbot/README.zh.md +423 -0
- package/node_modules/@sliverp/qqbot/bin/qqbot-cli.js +227 -0
- package/node_modules/@sliverp/qqbot/clawdbot.plugin.json +16 -0
- package/node_modules/@sliverp/qqbot/dist/index.d.ts +20 -0
- package/node_modules/@sliverp/qqbot/dist/index.js +25 -0
- package/node_modules/@sliverp/qqbot/dist/src/agent.d.ts +76 -0
- package/node_modules/@sliverp/qqbot/dist/src/agent.js +36 -0
- package/node_modules/@sliverp/qqbot/dist/src/api.d.ts +138 -0
- package/node_modules/@sliverp/qqbot/dist/src/api.js +523 -0
- package/node_modules/@sliverp/qqbot/dist/src/channel.d.ts +3 -0
- package/node_modules/@sliverp/qqbot/dist/src/channel.js +349 -0
- package/node_modules/@sliverp/qqbot/dist/src/config.d.ts +25 -0
- package/node_modules/@sliverp/qqbot/dist/src/config.js +156 -0
- package/node_modules/@sliverp/qqbot/dist/src/demo-standalone.d.ts +1 -0
- package/node_modules/@sliverp/qqbot/dist/src/demo-standalone.js +125 -0
- package/node_modules/@sliverp/qqbot/dist/src/gateway.d.ts +20 -0
- package/node_modules/@sliverp/qqbot/dist/src/gateway.js +2156 -0
- package/node_modules/@sliverp/qqbot/dist/src/image-server.d.ts +62 -0
- package/node_modules/@sliverp/qqbot/dist/src/image-server.js +401 -0
- package/node_modules/@sliverp/qqbot/dist/src/known-users.d.ts +100 -0
- package/node_modules/@sliverp/qqbot/dist/src/known-users.js +263 -0
- package/node_modules/@sliverp/qqbot/dist/src/onboarding.d.ts +10 -0
- package/node_modules/@sliverp/qqbot/dist/src/onboarding.js +203 -0
- package/node_modules/@sliverp/qqbot/dist/src/openclaw-agent-adapter.d.ts +2 -0
- package/node_modules/@sliverp/qqbot/dist/src/openclaw-agent-adapter.js +155 -0
- package/node_modules/@sliverp/qqbot/dist/src/outbound.d.ts +150 -0
- package/node_modules/@sliverp/qqbot/dist/src/outbound.js +1175 -0
- package/node_modules/@sliverp/qqbot/dist/src/proactive.d.ts +170 -0
- package/node_modules/@sliverp/qqbot/dist/src/proactive.js +399 -0
- package/node_modules/@sliverp/qqbot/dist/src/runtime.d.ts +5 -0
- package/node_modules/@sliverp/qqbot/dist/src/runtime.js +16 -0
- package/node_modules/@sliverp/qqbot/dist/src/session-store.d.ts +52 -0
- package/node_modules/@sliverp/qqbot/dist/src/session-store.js +254 -0
- package/node_modules/@sliverp/qqbot/dist/src/types.d.ts +145 -0
- package/node_modules/@sliverp/qqbot/dist/src/types.js +1 -0
- package/node_modules/@sliverp/qqbot/dist/src/utils/audio-convert.d.ts +73 -0
- package/node_modules/@sliverp/qqbot/dist/src/utils/audio-convert.js +645 -0
- package/node_modules/@sliverp/qqbot/dist/src/utils/file-utils.d.ts +46 -0
- package/node_modules/@sliverp/qqbot/dist/src/utils/file-utils.js +107 -0
- package/node_modules/@sliverp/qqbot/dist/src/utils/image-size.d.ts +51 -0
- package/node_modules/@sliverp/qqbot/dist/src/utils/image-size.js +234 -0
- package/node_modules/@sliverp/qqbot/dist/src/utils/media-tags.d.ts +14 -0
- package/node_modules/@sliverp/qqbot/dist/src/utils/media-tags.js +120 -0
- package/node_modules/@sliverp/qqbot/dist/src/utils/payload.d.ts +112 -0
- package/node_modules/@sliverp/qqbot/dist/src/utils/payload.js +186 -0
- package/node_modules/@sliverp/qqbot/dist/src/utils/platform.d.ts +126 -0
- package/node_modules/@sliverp/qqbot/dist/src/utils/platform.js +358 -0
- package/node_modules/@sliverp/qqbot/dist/src/utils/upload-cache.d.ts +34 -0
- package/node_modules/@sliverp/qqbot/dist/src/utils/upload-cache.js +93 -0
- package/node_modules/@sliverp/qqbot/dist/standalone.d.ts +6 -0
- package/node_modules/@sliverp/qqbot/dist/standalone.js +6 -0
- package/node_modules/@sliverp/qqbot/index.ts +30 -0
- package/node_modules/@sliverp/qqbot/moltbot.plugin.json +16 -0
- package/node_modules/@sliverp/qqbot/node_modules/@eshaz/web-worker/LICENSE +201 -0
- package/node_modules/@sliverp/qqbot/node_modules/@eshaz/web-worker/README.md +134 -0
- package/node_modules/@sliverp/qqbot/node_modules/@eshaz/web-worker/browser.js +17 -0
- package/node_modules/@sliverp/qqbot/node_modules/@eshaz/web-worker/cjs/browser.js +16 -0
- package/node_modules/@sliverp/qqbot/node_modules/@eshaz/web-worker/cjs/node.js +219 -0
- package/node_modules/@sliverp/qqbot/node_modules/@eshaz/web-worker/index.d.ts +4 -0
- package/node_modules/@sliverp/qqbot/node_modules/@eshaz/web-worker/node.js +223 -0
- package/node_modules/@sliverp/qqbot/node_modules/@eshaz/web-worker/package.json +54 -0
- package/node_modules/@sliverp/qqbot/node_modules/@wasm-audio-decoders/common/index.js +5 -0
- package/node_modules/@sliverp/qqbot/node_modules/@wasm-audio-decoders/common/package.json +36 -0
- package/node_modules/@sliverp/qqbot/node_modules/@wasm-audio-decoders/common/src/WASMAudioDecoderCommon.js +231 -0
- package/node_modules/@sliverp/qqbot/node_modules/@wasm-audio-decoders/common/src/WASMAudioDecoderWorker.js +129 -0
- package/node_modules/@sliverp/qqbot/node_modules/@wasm-audio-decoders/common/src/puff/README +67 -0
- package/node_modules/@sliverp/qqbot/node_modules/@wasm-audio-decoders/common/src/puff/build_puff.js +31 -0
- package/node_modules/@sliverp/qqbot/node_modules/@wasm-audio-decoders/common/src/puff/puff.c +863 -0
- package/node_modules/@sliverp/qqbot/node_modules/@wasm-audio-decoders/common/src/puff/puff.h +35 -0
- package/node_modules/@sliverp/qqbot/node_modules/@wasm-audio-decoders/common/src/utilities.js +3 -0
- package/node_modules/@sliverp/qqbot/node_modules/@wasm-audio-decoders/common/types.d.ts +7 -0
- package/node_modules/@sliverp/qqbot/node_modules/mpg123-decoder/README.md +265 -0
- package/node_modules/@sliverp/qqbot/node_modules/mpg123-decoder/dist/mpg123-decoder.min.js +185 -0
- package/node_modules/@sliverp/qqbot/node_modules/mpg123-decoder/dist/mpg123-decoder.min.js.map +1 -0
- package/node_modules/@sliverp/qqbot/node_modules/mpg123-decoder/index.js +8 -0
- package/node_modules/@sliverp/qqbot/node_modules/mpg123-decoder/package.json +58 -0
- package/node_modules/@sliverp/qqbot/node_modules/mpg123-decoder/src/EmscriptenWasm.js +464 -0
- package/node_modules/@sliverp/qqbot/node_modules/mpg123-decoder/src/MPEGDecoder.js +200 -0
- package/node_modules/@sliverp/qqbot/node_modules/mpg123-decoder/src/MPEGDecoderWebWorker.js +21 -0
- package/node_modules/@sliverp/qqbot/node_modules/mpg123-decoder/types.d.ts +30 -0
- package/node_modules/@sliverp/qqbot/node_modules/silk-wasm/LICENSE +21 -0
- package/node_modules/@sliverp/qqbot/node_modules/silk-wasm/README.md +85 -0
- package/node_modules/@sliverp/qqbot/node_modules/silk-wasm/lib/index.cjs +16 -0
- package/node_modules/@sliverp/qqbot/node_modules/silk-wasm/lib/index.d.ts +70 -0
- package/node_modules/@sliverp/qqbot/node_modules/silk-wasm/lib/index.mjs +16 -0
- package/node_modules/@sliverp/qqbot/node_modules/silk-wasm/lib/silk.wasm +0 -0
- package/node_modules/@sliverp/qqbot/node_modules/silk-wasm/lib/utils.d.ts +4 -0
- package/node_modules/@sliverp/qqbot/node_modules/silk-wasm/package.json +39 -0
- package/node_modules/@sliverp/qqbot/node_modules/simple-yenc/.github/FUNDING.yml +1 -0
- package/node_modules/@sliverp/qqbot/node_modules/simple-yenc/.prettierignore +1 -0
- package/node_modules/@sliverp/qqbot/node_modules/simple-yenc/LICENSE +7 -0
- package/node_modules/@sliverp/qqbot/node_modules/simple-yenc/README.md +163 -0
- package/node_modules/@sliverp/qqbot/node_modules/simple-yenc/dist/esm.js +1 -0
- package/node_modules/@sliverp/qqbot/node_modules/simple-yenc/dist/index.js +1 -0
- package/node_modules/@sliverp/qqbot/node_modules/simple-yenc/package.json +50 -0
- package/node_modules/@sliverp/qqbot/node_modules/simple-yenc/rollup.config.js +27 -0
- package/node_modules/@sliverp/qqbot/node_modules/simple-yenc/src/simple-yenc.js +302 -0
- package/node_modules/@sliverp/qqbot/node_modules/ws/LICENSE +20 -0
- package/node_modules/@sliverp/qqbot/node_modules/ws/README.md +548 -0
- package/node_modules/@sliverp/qqbot/node_modules/ws/browser.js +8 -0
- package/node_modules/@sliverp/qqbot/node_modules/ws/index.js +13 -0
- package/node_modules/@sliverp/qqbot/node_modules/ws/lib/buffer-util.js +131 -0
- package/node_modules/@sliverp/qqbot/node_modules/ws/lib/constants.js +19 -0
- package/node_modules/@sliverp/qqbot/node_modules/ws/lib/event-target.js +292 -0
- package/node_modules/@sliverp/qqbot/node_modules/ws/lib/extension.js +203 -0
- package/node_modules/@sliverp/qqbot/node_modules/ws/lib/limiter.js +55 -0
- package/node_modules/@sliverp/qqbot/node_modules/ws/lib/permessage-deflate.js +528 -0
- package/node_modules/@sliverp/qqbot/node_modules/ws/lib/receiver.js +706 -0
- package/node_modules/@sliverp/qqbot/node_modules/ws/lib/sender.js +602 -0
- package/node_modules/@sliverp/qqbot/node_modules/ws/lib/stream.js +161 -0
- package/node_modules/@sliverp/qqbot/node_modules/ws/lib/subprotocol.js +62 -0
- package/node_modules/@sliverp/qqbot/node_modules/ws/lib/validation.js +152 -0
- package/node_modules/@sliverp/qqbot/node_modules/ws/lib/websocket-server.js +554 -0
- package/node_modules/@sliverp/qqbot/node_modules/ws/lib/websocket.js +1393 -0
- package/node_modules/@sliverp/qqbot/node_modules/ws/package.json +69 -0
- package/node_modules/@sliverp/qqbot/node_modules/ws/wrapper.mjs +8 -0
- package/node_modules/@sliverp/qqbot/openclaw.plugin.json +16 -0
- package/node_modules/@sliverp/qqbot/package.json +81 -0
- package/node_modules/@sliverp/qqbot/skills/qqbot-cron/SKILL.md +513 -0
- package/node_modules/@sliverp/qqbot/skills/qqbot-media/SKILL.md +194 -0
- package/node_modules/@sliverp/qqbot/src/agent.ts +133 -0
- package/node_modules/@sliverp/qqbot/src/api.ts +704 -0
- package/node_modules/@sliverp/qqbot/src/channel.ts +380 -0
- package/node_modules/@sliverp/qqbot/src/config.ts +182 -0
- package/node_modules/@sliverp/qqbot/src/demo-standalone.ts +144 -0
- package/node_modules/@sliverp/qqbot/src/gateway.ts +2285 -0
- package/node_modules/@sliverp/qqbot/src/image-server.ts +474 -0
- package/node_modules/@sliverp/qqbot/src/known-users.ts +353 -0
- package/node_modules/@sliverp/qqbot/src/onboarding.ts +274 -0
- package/node_modules/@sliverp/qqbot/src/openclaw-agent-adapter.ts +168 -0
- package/node_modules/@sliverp/qqbot/src/openclaw-plugin-sdk.d.ts +483 -0
- package/node_modules/@sliverp/qqbot/src/outbound.ts +1301 -0
- package/node_modules/@sliverp/qqbot/src/proactive.ts +530 -0
- package/node_modules/@sliverp/qqbot/src/runtime.ts +22 -0
- package/node_modules/@sliverp/qqbot/src/session-store.ts +303 -0
- package/node_modules/@sliverp/qqbot/src/types.ts +153 -0
- package/node_modules/@sliverp/qqbot/src/utils/audio-convert.ts +738 -0
- package/node_modules/@sliverp/qqbot/src/utils/file-utils.ts +122 -0
- package/node_modules/@sliverp/qqbot/src/utils/image-size.ts +266 -0
- package/node_modules/@sliverp/qqbot/src/utils/media-tags.ts +134 -0
- package/node_modules/@sliverp/qqbot/src/utils/payload.ts +265 -0
- package/node_modules/@sliverp/qqbot/src/utils/platform.ts +404 -0
- package/node_modules/@sliverp/qqbot/src/utils/upload-cache.ts +128 -0
- package/node_modules/@sliverp/qqbot/standalone.ts +6 -0
- package/node_modules/@sliverp/qqbot/tsconfig.json +16 -0
- package/package.json +9 -1
- package/dist/BasicAgent-QWEYCLV5.js +0 -12
- package/dist/ExplorerAgent-4IT22VB7.js +0 -12
- package/dist/chunk-3BPSNNK3.js.map +0 -1
- package/dist/chunk-LLV3W326.js.map +0 -1
- package/dist/chunk-LQTEETML.js.map +0 -1
- package/dist/chunk-OBOU27DM.js.map +0 -1
- package/dist/chunk-TSASFMRF.js.map +0 -1
- /package/dist/{BasicAgent-QWEYCLV5.js.map → BasicAgent-UWXLSZP2.js.map} +0 -0
- /package/dist/{ExplorerAgent-4IT22VB7.js.map → ExplorerAgent-LCM3JQS4.js.map} +0 -0
- /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-
|
|
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
|
|
5401
|
+
function syncRollbackActionButtons() {
|
|
5400
5402
|
const allowRollback = !!getPrimaryInputRequest();
|
|
5401
|
-
|
|
5402
|
-
|
|
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("' + el.id + '")">' + getToggleButtonLabel(isCollapsed) + '</button>';
|
|
6005
6043
|
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6044
|
+
} else {
|
|
6045
|
+
const toggle = row.querySelector('.collapse-toggle');
|
|
6046
|
+
if (toggle) toggle.style.display = 'none';
|
|
6047
|
+
}
|
|
6048
|
+
});
|
|
6011
6049
|
|
|
6012
|
-
|
|
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
|
-
|
|
6466
|
-
const
|
|
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(
|
|
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
|
-
|
|
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-
|
|
7671
|
+
//# sourceMappingURL=chunk-NORTAQIL.js.map
|