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(',allowScope:'session',suggestedRules:['Bash(echo safe:*)']}} />) assert.ok(html.includes('conversation-intercept-card')) assert.ok(!html.includes('high-credit')) assert.ok(html.includes('echo <safe>')) assert.ok(html.includes('Bash(echo safe:*)')) assert.ok(html.includes('查看拦截规则')) assert.ok(!html.includes('命中询问规则')) const busy=renderToStaticMarkup() assert.equal((busy.match(/disabled=""/g)||[]).length,3) const unavailable=renderToStaticMarkup() 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')