fix(cua): correct system input admission verification

This commit is contained in:
creatixchu committed 2026-11-18 14:49:23 +08:00
1 parent bb5586ceb4
commit b8fcdbb052
2 files changed
+2 -2

No files matched your search

@@ -354,7 +354,7 @@ actor AXWorker {
return try ax().keyboardRecipient(identity, catalog: catalog, budget: &recovery)
}
case "typeText", "pressKey":
let system = method == "pressKey" && (try params.optionalBoolean("useSystemInput") ?? false)
let system = try method == "pressKey" && (params.optionalBoolean("useSystemInput") ?? false)
let recipient = system ? identity : try ax().keyboardRecipient(identity, catalog: catalog, budget: &recovery)
try NativePlatform.verify(recipient)
if method == "typeText" { try inputs().0.typeText(params.string("text"), to: recipient.pid) }
@@ -1453,7 +1453,7 @@ it.each([true, false])('uses the declared systemInput capability for a non-macOS
const sections = (await f.ctx.systemPrompt.assemble({ scope: f.handle.agent })).sections
const guidance = sections.find(section => section.name === 'computer-use:dsh-cua')!.text
expect(guidance.includes('relative?: boolean, useSystemInput?: boolean')).toBe(systemInput)
expect(guidance.includes('The question interrupts the user')).toBe(systemInput)
expect(guidance.includes('The first explicit system input requests permission;')).toBe(systemInput)
expect(JSON.stringify(f.ctx.tools.get('cua', f.handle.agent)!.parameters).includes('useSystemInput')).toBe(systemInput)
await selectApplication(f)
native.request.mockClear()