fix(cua): keep async lifetime check and type native test requests
This commit is contained in:
1 parent
e87b4298fd
commit
1d40e9bf31
3 files changed
+5
-2
No files matched your search
@@ -81,6 +81,8 @@ export class ApplicationAccess {
|
||||
const saved = identity.persistable && this.options.grants().some(grant => grant.id === identity.id)
|
||||
let scope: Selection['scope'] = 'persistent'
|
||||
if (!saved && this.rejected.get(agent)?.has(identity.id)) throw this.denied(identity)
|
||||
// The awaited user decision can outlive the helper, so re-read its live getter.
|
||||
// oxlint-disable-next-line typescript/no-unnecessary-condition
|
||||
if (client.disposed) throw new NativeError('NATIVE_CLOSED', 'Helper is closed; acquire fresh application handles')
|
||||
if (!saved) {
|
||||
const questions = this.ctx.get('userQuestions')
|
||||
|
||||
@@ -30,7 +30,7 @@ function fixture(withSink = true) {
|
||||
snapshotId: `snapshot-${++generation}`, tree: `Tree ${generation}`, truncated: false,
|
||||
windows: params.windowId === undefined ? windows : windows.filter(window => window.windowId === params.windowId),
|
||||
}
|
||||
case 'screenshot': return { mimeType: 'image/png', data: PNG, pixelWidth: 1, pixelHeight: 1, windowId: params.windowId!, bounds, coordinateSpace: 'window-points' }
|
||||
case 'screenshot': return { mimeType: 'image/png', data: PNG, pixelWidth: 1, pixelHeight: 1, windowId: params.windowId, bounds, coordinateSpace: 'window-points' }
|
||||
default: return delivered
|
||||
}
|
||||
})
|
||||
|
||||
@@ -24,12 +24,13 @@ import { SessionId } from '@deepseek-ai/dsh-session'
|
||||
import Subprocess from '@deepseek-ai/dsh-subprocess'
|
||||
import { expect, it, onTestFinished, vi } from 'vitest'
|
||||
import * as NativeProvider from '../src/index.ts'
|
||||
import type { NativeClient } from '../src/native-client.ts'
|
||||
import type { NativeBuildSpec } from '../src/native-build.ts'
|
||||
|
||||
const native = vi.hoisted(() => ({
|
||||
prepare: vi.fn<(spec: NativeBuildSpec) => Promise<string>>(),
|
||||
architecture: vi.fn(() => 'arm64' as const),
|
||||
request: vi.fn(), dispose: vi.fn(), instances: [] as Array<{ disposed: boolean }>,
|
||||
request: vi.fn<NativeClient['request']>(), dispose: vi.fn(), instances: [] as Array<{ disposed: boolean }>,
|
||||
}))
|
||||
vi.mock('../src/native-build.ts', async importOriginal => ({
|
||||
...await importOriginal<typeof import('../src/native-build.ts')>(),
|
||||
|
||||
Reference in new issue
Block a user