chore: rebuild release package

This commit is contained in:
shiyue
2026-07-20 15:44:07 +08:00
parent a038485ab5
commit 9adc7c99f1
11 changed files with 662 additions and 9 deletions

View File

@@ -6488,6 +6488,80 @@
return tool?.name || 'Tool';
}
function normalizePlanProgress(value) {
if (!value || typeof value !== 'object') return null;
const source = value.progress && typeof value.progress === 'object' ? value.progress : value;
const total = Number(source.total);
const completed = Number(source.completed);
if (!Number.isFinite(total) || !Number.isFinite(completed) || total <= 0) return null;
const normalizedTotal = Math.max(0, Math.floor(total));
const normalizedCompleted = Math.min(normalizedTotal, Math.max(0, Math.floor(completed)));
return { completed: normalizedCompleted, total: normalizedTotal };
}
function planProgressFromPayload(payload) {
let value = payload;
if (typeof value === 'string') {
try {
value = JSON.parse(value);
} catch {
return null;
}
}
const explicitProgress = normalizePlanProgress(value);
if (explicitProgress) return explicitProgress;
if (!Array.isArray(value?.items) || value.items.length === 0) return null;
return {
completed: value.items.filter((item) => item?.completed).length,
total: value.items.length,
};
}
function resolveToolPlanProgress(tool) {
if (toolKind(tool) !== 'todo_list') return null;
const candidates = [tool?.meta?.progress, tool?.input, tool?.result];
for (const candidate of candidates) {
const progress = planProgressFromPayload(candidate);
if (progress) return progress;
}
return null;
}
function createPlanProgressElement(tool) {
const progress = resolveToolPlanProgress(tool);
if (!progress) return null;
const meter = document.createElement('span');
meter.className = 'plan-progress';
meter.setAttribute('role', 'img');
const progressLabel = `计划进度:已完成 ${progress.completed} 项,共 ${progress.total}`;
meter.setAttribute('aria-label', progressLabel);
meter.title = progressLabel;
const dots = document.createElement('span');
dots.className = 'plan-progress-dots';
dots.setAttribute('aria-hidden', 'true');
const visibleDotCount = Math.min(progress.total, 12);
const completedDotCount = progress.total <= visibleDotCount
? progress.completed
: Math.round((progress.completed / progress.total) * visibleDotCount);
for (let index = 0; index < visibleDotCount; index += 1) {
const dot = document.createElement('span');
dot.className = `plan-progress-dot ${index < completedDotCount ? 'is-complete' : 'is-remaining'}`;
dots.appendChild(dot);
}
meter.appendChild(dots);
if (progress.total > visibleDotCount) {
const count = document.createElement('span');
count.className = 'plan-progress-count';
count.setAttribute('aria-hidden', 'true');
count.textContent = `${progress.completed}/${progress.total}`;
meter.appendChild(count);
}
return meter;
}
function toolSubtitle(tool) {
if (toolKind(tool) === 'file_change') {
return '';
@@ -6554,7 +6628,12 @@
main.className = 'tool-call-summary-main';
const label = document.createElement('span');
label.className = 'tool-call-label';
label.textContent = toolTitle(tool);
const labelText = document.createElement('span');
labelText.className = 'tool-call-label-text';
labelText.textContent = toolTitle(tool);
label.appendChild(labelText);
const planProgress = createPlanProgressElement(tool);
if (planProgress) label.appendChild(planProgress);
main.appendChild(label);
const subtitleText = toolSubtitle(tool);