MCPcopy Create free account
hub / github.com/astercloud/aster / renderToolStartWeb

Function renderToolStartWeb

examples/plan-explore-ui/static/main.js:178–213  ·  view source on GitHub ↗
(uiState, call)

Source from the content-addressed store, hash-verified

176 }
177
178 function renderToolStartWeb(uiState, call) {
179 if (!call || !call.name) return;
180 const name = call.name;
181 const args = call.arguments || {};
182
183 if (name === "TodoWrite" || name === "write_todos") {
184 const title = extractActiveTaskTitleWeb(args) || "任务规划";
185 appendPhaseLine(`Plan(${title})`, "plan");
186 uiState.currentPhase = { kind: "Plan", title: title, count: 0 };
187 return;
188 }
189
190 if (name === "Task" || name === "task") {
191 const subType = getStringArgWeb(args, "subagent_type");
192 const prompt = getStringArgWeb(args, "prompt") || "子代理任务";
193 const labelType = subType || "Task";
194 const className = labelType === "Explore" ? "explore" : labelType === "Plan" ? "plan" : "tool";
195 appendPhaseLine(`${labelType}(${prompt})`, className);
196 uiState.currentPhase = { kind: labelType, title: prompt, count: 0 };
197 return;
198 }
199
200 const label = formatToolCallLabelWeb(call);
201 if (!label) return;
202
203 if (uiState.currentPhase) {
204 if (uiState.currentPhase.count === 0) {
205 appendPhaseLine(` └─ ${label}`, "tool");
206 } else {
207 appendPhaseLine(` ${label}`, "tool");
208 }
209 uiState.currentPhase.count += 1;
210 } else {
211 appendPhaseLine(`[Tool] ${label}`, "tool");
212 }
213 }
214
215 function extractActiveTaskTitleWeb(args) {
216 const todos = args.todos;

Callers 1

renderUIEventFunction · 0.85

Calls 4

appendPhaseLineFunction · 0.85
getStringArgWebFunction · 0.85
formatToolCallLabelWebFunction · 0.85

Tested by

no test coverage detected