feat: persist context snapshots and defer permission changes to next messages

This commit is contained in:
Codex committed 2026-10-21 17:32:41 +09:00
1 parent 607afd2f39
commit 1a913cdb67
19 files changed
+510 -66

No files matched your search

@@ -0,0 +1,14 @@
import assert from 'node:assert/strict'
import { renderToStaticMarkup } from 'react-dom/server'
import SourcePermissionControl from '../src/renderer/src/workbuddy/composer/permission/SourcePermissionControl'
for (const mode of ['default-sandbox', 'full-access'] as const) {
const render = (nextSend: boolean, disabled = false) => renderToStaticMarkup(<SourcePermissionControl
mode={mode} nextSend={nextSend} disabled={disabled} onChange={async () => { throw new Error('render must not mutate policy') }} onError={() => {}} />)
const busy = render(true)
assert.ok(busy.includes('下次发送生效'), 'busy selector must identify future policy, not claim current policy changed')
assert.ok(!busy.includes('disabled=""'), 'a running/sending turn must not disable preference selection')
assert.ok(!render(false).includes('下次发送生效'))
assert.ok(render(true, true).includes('disabled=""'), 'plan/ask and load guards remain enforceable')
}
console.log('Next-send permission labels and enabled/disabled static rendering passed')