feat: align conversation state, composer and scoped approvals

This commit is contained in:
dot committed 2026-10-21 03:46:53 +09:00
1 parent 771ca540f7
commit 308b98df23
61 files changed
+1701 -292

No files matched your search

@@ -0,0 +1,17 @@
import assert from 'node:assert/strict'
import { renderToStaticMarkup } from 'react-dom/server'
import { PermissionConfirm } from '../src/renderer/src/workbuddy/conversation/PermissionConfirm'
const base = {pendingId:'a',toolName:'Bash',options:[{optionId:'once',name:'Once',kind:'allow_once'},{optionId:'session',name:'Session',kind:'allow_always'}],resolve:()=>{},reject:()=>{}}
const html=renderToStaticMarkup(<PermissionConfirm {...base} details={{requestKind:'permission',toolName:'Bash',command:'echo <safe>',allowScope:'session',suggestedRules:['Bash(echo safe:*)']}} />)
assert.ok(html.includes('conversation-intercept-card'))
assert.ok(!html.includes('high-credit'))
assert.ok(html.includes('echo &lt;safe&gt;'))
assert.ok(html.includes('Bash(echo safe:*)'))
assert.ok(html.includes('查看拦截规则'))
assert.ok(!html.includes('命中询问规则'))
const busy=renderToStaticMarkup(<PermissionConfirm {...base} status="responding" />)
assert.equal((busy.match(/disabled=""/g)||[]).length,3)
const unavailable=renderToStaticMarkup(<PermissionConfirm {...base} options={base.options.slice(0,1)} details={{requestKind:'permission',toolName:'Bash',allowScope:'once',sessionUnavailableReason:'Only once'}} />)
assert.ok(unavailable.includes('Only once'))
assert.ok(!unavailable.includes('data-option-id="session"'))
console.log('Permission intercept static rendering passed; interactive keyboard/focus remains UI acceptance')