Skip to content

[codex] Fix dynamic tool rebuild and compact light list#305

Merged
lioensky merged 1 commit intolioensky:mainfrom
DerstedtCasper:codex/dynamic-tool-list
Apr 24, 2026
Merged

[codex] Fix dynamic tool rebuild and compact light list#305
lioensky merged 1 commit intolioensky:mainfrom
DerstedtCasper:codex/dynamic-tool-list

Conversation

@DerstedtCasper
Copy link
Copy Markdown

@DerstedtCasper DerstedtCasper commented Apr 24, 2026

Summary

  • Fix DynamicToolBridge manual rebuild so admin requests can return immediately while classification continues in the background.
  • Surface background classification state in the Vue panel and poll until rebuild completion.
  • Preserve useful abort reasons for frontend request timeouts instead of showing "signal is aborted without reason".
  • Compact Dynamic VCP light-list descriptions to keep name + category + brief near a 15-token budget, with small-model prompts and local clamps as fallback.

Context

PR #302 has already been merged. This is the incremental follow-up bugfix for the rebuild timeout path and the lightweight list token budget.

Verification

  • node --check .\modules\dynamicToolRegistry.js
  • node --check .\routes\admin\dynamicTools.js
  • node --test .\tests\dynamicToolRegistry.test.js
  • npm.cmd run lint (AdminPanel-Vue)
  • npm.cmd run build (AdminPanel-Vue)

@DerstedtCasper DerstedtCasper force-pushed the codex/dynamic-tool-list branch from 7273f6b to 2308606 Compare April 24, 2026 18:38
@DerstedtCasper DerstedtCasper changed the title [codex] Add dynamic VCP tool registry and admin panel [codex] Fix dynamic tool rebuild and compact light list Apr 24, 2026
@DerstedtCasper DerstedtCasper marked this pull request as ready for review April 24, 2026 18:38
Copilot AI review requested due to automatic review settings April 24, 2026 18:38
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR is an incremental bugfix/follow-up to the dynamic VCP tool registry/admin panel work, focusing on making manual rebuild non-blocking, surfacing background classification state to the UI, and keeping lightweight tool list entries compact.

Changes:

  • Make /admin_api/dynamic-tools/rebuild support non-blocking rebuilds via a wait flag, and expose isClassifying state from the registry.
  • Update the AdminPanel dynamic tools page to disable rebuild buttons during classification, show background status, and poll until completion.
  • Add compact-brief/token-budget handling for the lightweight tool list, including small-model prompt guidance and local clamping, plus tests.

Reviewed changes

Copilot reviewed 6 out of 48 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/dynamicToolRegistry.test.js Adds regression tests for background rebuild behavior and compact light-list briefs.
routes/admin/dynamicTools.js Accepts wait in rebuild requests and forwards it to the registry.
modules/dynamicToolRegistry.js Implements wait:false rebuild path, exposes isClassifying, and compacts light-list briefs to a token budget.
AdminPanel-Vue/src/views/DynamicToolsManager.vue Shows background classification state, disables rebuild buttons during classification, and polls for completion.
AdminPanel-Vue/src/platform/http/httpClient.ts Preserves abort reasons (timeout + merged signals) to improve UI error reporting.
AdminPanel-Vue/src/api/dynamicTools.ts Adds isClassifying to state typing and supports wait option in rebuild API.
AdminPanel-Vue/dist/index.html Updates built AdminPanel asset hashes.
AdminPanel-Vue/dist/assets/js/useRecentVisits-Cv1J7k25.js Built output update (hash/import changes).
AdminPanel-Vue/dist/assets/js/useMarkdownRenderer-DLeytw2l.js Built output update (hash/import changes).
AdminPanel-Vue/dist/assets/js/index-DavTYS7A.js Built output update (hash/import changes).
AdminPanel-Vue/dist/assets/js/dashboard-components-B8tHL6X6.js Built output update (hash/import changes).
AdminPanel-Vue/dist/assets/js/VcpForum-Id9m3gbZ.js Built output update (hash/import changes).
AdminPanel-Vue/dist/assets/js/TvsFilesEditor-C5aiCR9A.js Built output update (hash/import changes).
AdminPanel-Vue/dist/assets/js/ToolboxManager-D56-z_F1.js Built output update (hash/import changes).
AdminPanel-Vue/dist/assets/js/ToolListEditor-ioMxub1G.js Built output update (hash/import changes).
AdminPanel-Vue/dist/assets/js/ToolApprovalManager-Bf6PJCCw.js Built output update (hash/import changes).
AdminPanel-Vue/dist/assets/js/ServerLogViewer-BdlP6B20.js Built output update (hash/import changes).
AdminPanel-Vue/dist/assets/js/SemanticGroupsEditor-BH73yceu.js Built output update (hash/import changes).
AdminPanel-Vue/dist/assets/js/ScheduleManager-Bbhal8Kk.js Built output update (hash/import changes).
AdminPanel-Vue/dist/assets/js/SarPromptEditor-Bq853TUQ.js Built output update (hash/import changes).
AdminPanel-Vue/dist/assets/js/PreprocessorOrderManager-DZK3zVsY.js Built output update (hash/import changes).
AdminPanel-Vue/dist/assets/js/PluginConfig-B_YmEtY4.js Built output update (hash/import changes).
AdminPanel-Vue/dist/assets/js/PlaceholderViewer-qyzPTnil.js Built output update (hash/import changes).
AdminPanel-Vue/dist/assets/js/Login-O5UIIymr.js Built output update (hash/import changes).
AdminPanel-Vue/dist/assets/js/ImageCacheEditor-Du3p9rj1.js Built output update (hash/import changes).
AdminPanel-Vue/dist/assets/js/DynamicToolsManager-LMmR5Ul0.js New built output for updated DynamicToolsManager page.
AdminPanel-Vue/dist/assets/js/DynamicToolsManager-JKX64yof.js Removes old built output for DynamicToolsManager page.
AdminPanel-Vue/dist/assets/js/DreamManager-B-hn_w0p.js Built output update (hash/import changes).
AdminPanel-Vue/dist/assets/js/BaseConfig-ZwMPzMSY.js Built output update (hash/import changes).
AdminPanel-Vue/dist/assets/js/AgentScores-C7Y-y85L.js Built output update (hash/import changes).
AdminPanel-Vue/dist/assets/js/AgentFilesEditor-DBKe1qSu.js Built output update (hash/import changes).
AdminPanel-Vue/dist/assets/css/VcptavernEditor-owhvFUwg.css Removes old built CSS asset.
AdminPanel-Vue/dist/assets/css/VcptavernEditor-5MCsg1Ga.css Adds new built CSS asset.
AdminPanel-Vue/dist/assets/css/SarPromptEditor-CCC5Xs9a.css Adds new built CSS asset.
AdminPanel-Vue/dist/assets/css/SarPromptEditor-C2ZOTWQD.css Removes old built CSS asset.
AdminPanel-Vue/dist/assets/css/DynamicToolsManager-bmlUkVu7.css Adds new built CSS asset for DynamicToolsManager page.
AdminPanel-Vue/dist/assets/css/DynamicToolsManager-_CapYPVW.css Removes old built CSS asset for DynamicToolsManager page.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +453 to +456
statusMessage.value = isClassifying.value ? "重建任务已开始,正在后台分类" : "重建任务已完成";
statusType.value = isClassifying.value ? "info" : "success";
showMessage(statusMessage.value, "success");
if (isClassifying.value) startRebuildPolling();
Comment on lines +201 to +205
const startedAt = Date.now();
const state = await registry.forceRebuild({ mode: 'classification', wait: false });

assert.ok(Date.now() - startedAt < 100, 'background rebuild should return before classification finishes');
assert.equal(state.isClassifying, true);
Comment on lines +94 to +109
function tokenPieces(value) {
return String(value || '').match(/[A-Za-z0-9_.-]+|[\u3400-\u9FFF\u3040-\u30FF\uAC00-\uD7AF]/g) || [];
}

function estimateTokenCount(value) {
return tokenPieces(value).length;
}

function truncateToTokenBudget(value, maxTokens) {
const text = cleanText(value, 500);
const budget = Math.max(1, Math.trunc(Number(maxTokens) || 1));
const pieces = tokenPieces(text);
if (pieces.length <= budget) return text;
if (pieces.length === 0) return cleanText(text, Math.max(12, budget * 8));
return cleanText(`${pieces.slice(0, budget).join(' ')}...`, Math.max(24, budget * 14));
}
@lioensky lioensky merged commit af7ff8e into lioensky:main Apr 24, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants