fix(assistant): close review gaps in delivery and action recovery
Address PR4 comments 66-69 with safe delivery retries, capacity stops, preserved effect evidence and stale proposal rejection. Prevent archived queue snapshots from resurrecting cancelled reminders.
This commit is contained in:
1 parent
1d5dcead84
commit
5ceffb935a
24 files changed
+1425
-125
No files matched your search
@@ -10,6 +10,7 @@ window.AssistantContextPanel = {
|
||||
settings,
|
||||
isActive,
|
||||
onExecute,
|
||||
onReject,
|
||||
onRepair,
|
||||
showRight,
|
||||
ensureConversation,
|
||||
@@ -165,10 +166,13 @@ window.AssistantContextPanel = {
|
||||
list
|
||||
.map(
|
||||
({ a, t }) =>
|
||||
`<article class="assistant-action" data-action-card="${esc(a.id)}"><strong>${esc(a.label)}</strong><div class="small text-secondary mt-2">目标:${esc(a.targetId)}</div><div class="small text-secondary mt-1">影响:${esc({ check_storage: '发起一次存储连接检查', scan_bpm: '只读重新扫描,更新到达记录', retry_archive: '向原目标重试明确失败的归档', collect_field_samples: '读取待办样本并保存字段证据', collect_history_samples: '只读采集历史字段样本', prepare_field_mapping: '生成并检查草稿,不自动生效', repair_code: '在隔离 Git 工作区执行固定测试,不自动合并部署' }[a.kind] || '仅执行已列出的受控操作')}</div><div class="small text-secondary mt-1">操作编号:${esc(a.id)}</div>${['update_configuration', 'manage_schedule'].includes(a.kind) ? `<div class="aw-config-summary">${a.diff.map((d) => `<p>${esc(d.label)}:${esc(JSON.stringify(d.before))} → ${esc(JSON.stringify(d.after))}</p>`).join('')}<strong>风险与影响</strong><ul>${a.risks.map((r) => `<li>${esc(r)}</li>`).join('')}</ul><small>审查并授权后才会保存;建议过期或配置变化须重新生成。</small></div>` : ''}${a.kind === 'repair_code' ? `<p class="aw-verify-warning">以本机服务身份运行固定测试;工作区不是操作系统沙箱,通过后仍待人工审查。</p>${a.files.map((f) => `<details><summary>${esc(f.path)} · 查看修改前后</summary><div>修改前</div><pre>${esc(a.beforeFiles?.find((b) => b.path === f.path)?.content || '')}</pre><div>建议内容</div><pre>${esc(f.content)}</pre></details>`).join('')}` : ''}${a.progress ? `<p class="small mt-2">采样进度 ${esc(a.progress.completed)} / ${esc(a.progress.total)},成功 ${esc(a.progress.captured)},受阻 ${esc(a.progress.failed)}</p>` : ''}<div class="mt-3">${a.status === 'proposed' ? `<button class="btn btn-sm btn-outline-primary" type="button" data-assistant-action="${esc(a.id)}" ${(!settings.allowActions && a.kind !== 'manage_schedule') || conversation.archived || conversation.deletedAt || user.role === 'viewer' ? 'disabled' : ''}>${['update_configuration', 'manage_schedule'].includes(a.kind) ? '审查修改' : '执行:' + esc(a.label)}</button>` : `<strong>${esc(window.AssistantConversation.actionState(a))}</strong>`}</div>${a.error ? `<p class="small text-danger mt-2">${esc(a.error)}</p>` : ''}${a.result || ['success', 'error', 'needs_review', 'interrupted'].includes(a.status) ? `<details class="mt-2 aw-action-result"><summary>结果详情</summary><p class="mt-2">${esc(window.AssistantConversation.actionSummary(a))}</p>${a.result && (typeof a.result !== 'object' || Object.keys(a.result).length) ? `<pre>${esc(JSON.stringify(a.result, null, 2))}</pre>` : ''}</details>` : ''}${a.result?.link ? '<a class="btn btn-sm mt-2" href="' + esc(a.kind === 'update_configuration' ? a.result.link : '#rule-fields') + '">' + (a.kind === 'update_configuration' ? '查看设置' : '查看字段映射') + '</a>' : ''}</article>`,
|
||||
`<article class="assistant-action" data-action-card="${esc(a.id)}"><strong>${esc(a.label)}</strong><div class="small text-secondary mt-2">目标:${esc(a.targetId)}</div><div class="small text-secondary mt-1">影响:${esc({ check_storage: '发起一次存储连接检查', scan_bpm: '只读重新扫描,更新到达记录', retry_archive: '向原目标重试明确失败的归档', collect_field_samples: '读取待办样本并保存字段证据', collect_history_samples: '只读采集历史字段样本', prepare_field_mapping: '生成并检查草稿,不自动生效', repair_code: '在隔离 Git 工作区执行固定测试,不自动合并部署' }[a.kind] || '仅执行已列出的受控操作')}</div><div class="small text-secondary mt-1">操作编号:${esc(a.id)}</div>${['update_configuration', 'manage_schedule'].includes(a.kind) ? `<div class="aw-config-summary">${a.diff.map((d) => `<p>${esc(d.label)}:${esc(JSON.stringify(d.before))} → ${esc(JSON.stringify(d.after))}</p>`).join('')}<strong>风险与影响</strong><ul>${a.risks.map((r) => `<li>${esc(r)}</li>`).join('')}</ul><small>审查并授权后才会保存;建议过期或配置变化须重新生成。</small></div>` : ''}${a.kind === 'repair_code' ? `<p class="aw-verify-warning">以本机服务身份运行固定测试;工作区不是操作系统沙箱,通过后仍待人工审查。</p>${a.files.map((f) => `<details><summary>${esc(f.path)} · 查看修改前后</summary><div>修改前</div><pre>${esc(a.beforeFiles?.find((b) => b.path === f.path)?.content || '')}</pre><div>建议内容</div><pre>${esc(f.content)}</pre></details>`).join('')}` : ''}${a.progress ? `<p class="small mt-2">采样进度 ${esc(a.progress.completed)} / ${esc(a.progress.total)},成功 ${esc(a.progress.captured)},受阻 ${esc(a.progress.failed)}</p>` : ''}<div class="mt-3">${a.status === 'proposed' ? `<button class="btn btn-sm btn-outline-primary" type="button" data-assistant-action="${esc(a.id)}" ${(!settings.allowActions && a.kind !== 'manage_schedule') || conversation.archived || conversation.deletedAt || user.role === 'viewer' ? 'disabled' : ''}>${['update_configuration', 'manage_schedule'].includes(a.kind) ? '审查修改' : '执行:' + esc(a.label)}</button>${['update_configuration', 'manage_schedule'].includes(a.kind) ? `<button type="button" class="btn btn-sm ms-2" data-assistant-reject="${esc(a.id)}" ${conversation.archived || conversation.deletedAt || user.role === 'viewer' || (a.kind === 'update_configuration' && user.role !== 'admin') ? 'disabled' : ''}>拒绝建议</button>` : ''}` : `<strong>${esc(window.AssistantConversation.actionState(a))}</strong>`}</div>${a.error ? `<p class="small text-danger mt-2">${esc(a.error)}</p>` : ''}${a.result || ['success', 'error', 'needs_review', 'interrupted'].includes(a.status) ? `<details class="mt-2 aw-action-result"><summary>结果详情</summary><p class="mt-2">${esc(window.AssistantConversation.actionSummary(a))}</p>${a.result && (typeof a.result !== 'object' || Object.keys(a.result).length) ? `<pre>${esc(JSON.stringify(a.result, null, 2))}</pre>` : ''}</details>` : ''}${a.result?.link ? '<a class="btn btn-sm mt-2" href="' + esc(a.kind === 'update_configuration' ? a.result.link : '#rule-fields') + '">' + (a.kind === 'update_configuration' ? '查看设置' : '查看字段映射') + '</a>' : ''}</article>`,
|
||||
)
|
||||
.join('') +
|
||||
(list.length ? '' : '<p class="text-secondary">建议将在这里展示,确认前不会执行。</p>');
|
||||
panels.actions
|
||||
.querySelectorAll('[data-assistant-reject]')
|
||||
.forEach((b) => (b.onclick = () => onReject(b.dataset.assistantReject, b)));
|
||||
panels.actions
|
||||
.querySelectorAll('[data-assistant-action]')
|
||||
.forEach(
|
||||
|
||||
Reference in new issue
Block a user