@@ -4,7 +4,6 @@ import { useState, useRef, useEffect, useCallback, useMemo, type DragEvent } fro
44import { Icon } from '@iconify/react'
55import { ModeSelector } from '@/components/mode-selector'
66import { ChatHome } from '@/components/chat-home'
7- import { KnotLogo } from '@/components/knot-logo'
87import { ChatHeader } from '@/components/chat-header'
98import type { AgentMode } from '@/components/mode-selector'
109import { usePermissions } from '@/components/permissions-toggle'
@@ -50,6 +49,7 @@ import {
5049 CODE_EDITOR_SYSTEM_PROMPT ,
5150 buildEditorContext ,
5251 getEffectiveSystemPrompt ,
52+ getAgentConfig ,
5353} from '@/lib/agent-session'
5454import {
5555 SKILL_FIRST_OVERRIDE_TOKEN ,
@@ -1829,10 +1829,14 @@ export function AgentPanel() {
18291829 setActiveDiff ( null )
18301830 } , [ activeDiff , appendMessage ] )
18311831
1832- // ─── Auto-apply when full access is enabled ──────────── ──────
1832+ // ─── Auto-apply when full access or approval tier allows ──────
18331833 const autoAppliedRef = useRef ( new Set < string > ( ) )
1834+ const currentApprovalTier = useMemo ( ( ) => {
1835+ try { return getAgentConfig ( ) ?. approvalTier ?? 'ask-all' } catch { return 'ask-all' as const }
1836+ } , [ messages . length ] ) // re-check when messages change
18341837 useEffect ( ( ) => {
1835- if ( permissions !== 'full' && agentMode !== 'agent' ) return
1838+ const tierAllows = currentApprovalTier === 'auto-edits' || currentApprovalTier === 'auto-all'
1839+ if ( permissions !== 'full' && agentMode !== 'agent' && ! tierAllows ) return
18361840 const last = messages [ messages . length - 1 ]
18371841 if ( ! last || last . role !== 'assistant' || ! last . editProposals ?. length ) return
18381842 if ( autoAppliedRef . current . has ( last . id ) ) return
@@ -1850,7 +1854,7 @@ export function AgentPanel() {
18501854 id : crypto . randomUUID ( ) ,
18511855 role : 'system' ,
18521856 type : 'tool' ,
1853- content : `Auto-applied edits to ${ fileNames } ${ agentMode === 'agent' ? ' (agent mode)' : ' (full access mode)' } .` ,
1857+ content : `Auto-applied edits to ${ fileNames } .` ,
18541858 timestamp : Date . now ( ) ,
18551859 } )
18561860 } , [ messages , permissions , agentMode , getFile , updateFileContent , openFile , appendMessage ] )
@@ -2061,7 +2065,7 @@ export function AgentPanel() {
20612065 filesChanged = { agentActivities . filter ( a => a . type === 'edit' || a . type === 'write' || a . type === 'create' ) . reduce ( ( acc , a ) => { if ( a . file ) acc . add ( a . file ) ; return acc } , new Set < string > ( ) ) . size }
20622066 />
20632067 { messages . length > 0 && (
2064- < div className = "flex items-center justify-between border-b border-[var(--border)] bg-[var(--bg-elevated)] px-2.5 py-1 shrink-0" >
2068+ < div className = "flex items-center justify-between border-b border-[var(--border)] bg-[var(--bg-elevated)] px-2.5 py-0.5 shrink-0" >
20652069 < div className = "flex min-w-0 items-center gap-1.5" >
20662070 { /* Font size controls */ }
20672071 < div className = "inline-flex items-center gap-0.5" >
@@ -2198,14 +2202,6 @@ export function AgentPanel() {
21982202 />
21992203 ) }
22002204
2201- { /* Branded footer — hidden on mobile to save space */ }
2202- < div className = "shrink-0 hidden sm:flex items-center justify-center gap-1.5 px-3 py-0.5 border-t border-[var(--border)] bg-[var(--bg-elevated)]" >
2203- < KnotLogo size = { 9 } className = "opacity-40" />
2204- < span className = "text-[8px] text-[var(--text-disabled)] font-medium tracking-wide" >
2205- KnotCode
2206- </ span >
2207- < span className = "text-[7px] text-[var(--text-disabled)] opacity-50" > v1.4.0</ span >
2208- </ div >
22092205 </ div >
22102206 )
22112207}
0 commit comments