feat: 完成第二版类型清理

This commit is contained in:
claude-code-best
2026-03-31 23:03:47 +08:00
parent 4c0a655a1c
commit d7a729ca68
604 changed files with 595 additions and 953 deletions

View File

@@ -15,16 +15,16 @@ function isCompletedBackgroundBash(
msg: RenderableMessage,
): msg is NormalizedUserMessage {
if (msg.type !== 'user') return false
const content = msg.message.content[0]
if (content?.type !== 'text') return false
if (!content.text.includes(`<${TASK_NOTIFICATION_TAG}`)) return false
const content0 = Array.isArray(msg.message.content) ? msg.message.content[0] : undefined
if (!content0 || typeof content0 === 'string' || content0?.type !== 'text') return false
if (!content0.text.includes(`<${TASK_NOTIFICATION_TAG}`)) return false
// Only collapse successful completions — failed/killed stay visible individually.
if (extractTag(content.text, STATUS_TAG) !== 'completed') return false
if (extractTag(content0.text, STATUS_TAG) !== 'completed') return false
// The prefix constant distinguishes bash-kind LocalShellTask completions from
// agent/workflow/monitor notifications. Monitor-kind completions have their
// own summary wording and deliberately don't collapse here.
return (
extractTag(content.text, SUMMARY_TAG)?.startsWith(
extractTag(content0.text, SUMMARY_TAG)?.startsWith(
BACKGROUND_BASH_SUMMARY_PREFIX,
) ?? false
)