Merge remote-tracking branch 'origin/main' into claude/frontend-dev-mode-7feb5b

This commit is contained in:
2026-07-16 08:22:38 +02:00
12 changed files with 446 additions and 44 deletions

View File

@@ -8,8 +8,7 @@ export interface ActivityEntry {
id: string
type: 'goal' | 'plan' | 'step_running' | 'step_done' | 'step_failed' |
'tool_running' | 'tool_done' | 'tool_error' |
'knowledge' | 'complete' | 'question' | 'error' |
'approval'
'knowledge' | 'complete' | 'question' | 'error'
description: string
detail?: string
args?: string
@@ -156,26 +155,14 @@ 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'
})
}
}
}
// Note: approval entries were removed from activityLog (2026-07-15).
// They were always `status: 'running'` and never transitioned to 'done'
// (the derived store builds from tool-call text, not execution status),
// which caused the AgentIndicator to latch onto a stale "Approval: ..."
// entry and never clear — even after the session completed. Approvals
// are tracked via the REST /approvals endpoint (context.ts, Ops.svelte)
// and rendered as InlineApproval cards in the chat (or Ops page), not
// in the activity log.
// Sort oldest first
entries.sort((a, b) => a.timestamp - b.timestamp)

View File

@@ -2,7 +2,6 @@
import { messages, streaming, connectionState, currentSession, sendMessage, cancelStream, reconnect, error, chatErrors, dismissError } from '$lib/stores/chat'
import { activityLog } from '$lib/stores/activity'
import TaskContextPanel from '$lib/components/TaskContextPanel.svelte'
import InlineApproval from '$lib/components/InlineApproval.svelte'
import AgentIndicator from '$lib/components/AgentIndicator.svelte'
import { Button } from '$lib/components/ui/button'
import { Textarea } from '$lib/components/ui/textarea'
@@ -135,9 +134,6 @@
{@html render(msg.text)}
</div>
{/if}
{#if msg.pendingApprovals.length > 0}
<InlineApproval approvals={msg.pendingApprovals} />
{/if}
</div>
{/if}
</div>