approval lifecycle entries in Activity timeline
Some checks failed
ci / build-test (push) Has been cancelled
ci / docker-build (push) Has been cancelled
Desktop App / Build Linux (amd64) (push) Has been cancelled
Desktop App / Attach to Release (push) Has been cancelled

- activityLog now detects 'requires approval' in tool results
- Adds approval entries with shield icon + description + execution ID
- Works for both run and remaining approval paths
This commit is contained in:
2026-07-14 13:07:49 +02:00
parent b423cf4dea
commit 24cc3b1f4e
3 changed files with 26 additions and 2 deletions

View File

@@ -8,6 +8,7 @@
import SparklesIcon from '@lucide/svelte/icons/sparkles'
import HelpCircleIcon from '@lucide/svelte/icons/help-circle'
import FlagIcon from '@lucide/svelte/icons/flag'
import ShieldIcon from '@lucide/svelte/icons/shield'
import ChevronDownIcon from '@lucide/svelte/icons/chevron-down'
import ChevronRightIcon from '@lucide/svelte/icons/chevron-right'
@@ -29,6 +30,7 @@
case 'knowledge': return SparklesIcon
case 'complete': return FlagIcon
case 'question': return HelpCircleIcon
case 'approval': return ShieldIcon
default: return null
}
}

View File

@@ -8,7 +8,8 @@ export interface ActivityEntry {
id: string
type: 'goal' | 'plan' | 'step_running' | 'step_done' | 'step_failed' |
'tool_running' | 'tool_done' | 'tool_error' |
'knowledge' | 'complete' | 'question' | 'error'
'knowledge' | 'complete' | 'question' | 'error' |
'approval'
description: string
detail?: string
timestamp: number
@@ -127,6 +128,27 @@ export const activityLog = derived([messages, planSteps, currentTask], ([$msgs,
})
}
// Approvals — detect from tool results containing 'requires approval'
for (let mi = 0; mi < $msgs.length; mi++) {
for (const t of $msgs[mi].tools) {
if (t.type !== 'tool_result') continue
const text = typeof t.result === 'string' ? t.result : JSON.stringify(t.result ?? '')
if (text.includes('requires approval')) {
const m = text.match(/execution\s+([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i)
const execId = m ? m[1] : ''
const target = (t.args as any)?.target ?? ''
const purpose = (t.args as any)?.purpose ?? ''
entries.push({
id: execId || `approval_${mi}`,
type: 'approval',
description: purpose ? `Approval: ${purpose.slice(0, 60)}` : `Approval required${target ? ` for ${target}` : ''}`,
timestamp: now - ($msgs.length - mi) * 1000,
status: 'running'
})
}
}
}
// Sort oldest first
entries.sort((a, b) => a.timestamp - b.timestamp)