test(cua): keep Host marker checks out of the Client compiler

This commit is contained in:
creatixchu committed 2026-10-19 19:48:35 +08:00
1 parent 4da281c933
commit 57af330bf5
2 files changed
+12 -3

No files matched your search

@@ -1,5 +1,7 @@
/** CUA's public types distinguish object consumers from its generated permission transport. */
import { expectTypeOf, it } from 'vitest'
import { expect, expectTypeOf, it } from 'vitest'
import { Context } from '@deepseek-ai/cordis'
import * as Cua from '../src/index.ts'
import type { CuaApi } from '@deepseek-ai/dsh-cua/api'
import type { CuaApplicationState } from '@deepseek-ai/dsh-cua/types'
// @ts-expect-error Permission payloads are not part of the platform-provider root entry.
@@ -16,3 +18,12 @@ it('keeps application operations and the necessary Remote payload types availabl
expectTypeOf<CuaApplicationState>().toHaveProperty('allowedApps')
expectTypeOf<[RemovedRoot, RemovedApi, RemovedTypes, RemovedGrant]>().toBeArray()
})
it('mounts the Host marker without installing native or browser services', async () => {
const ctx = new Context()
try {
await ctx.plugin(Cua)
expect(ctx.get('cuaAccess')).toBeUndefined()
expect(ctx.get('computerUse')).toBeUndefined()
} finally { await ctx.fiber.dispose() }
})
@@ -10,7 +10,6 @@ import type { CuaApplicationState, CuaSystemPermissionState } from '../src/acces
import { expect, it, vi } from 'vitest'
import type { PermissionFace } from '../src/client/controller.ts'
import { mountCuaPermissions, inject } from '../src/client/mount.ts'
import { apply as hostApply } from '../src/index.ts'
const contribution: TypertRemoteContribution = { package: '@deepseek-ai/dsh-cua', descriptors: [] }
const value: CuaApplicationState & { system: CuaSystemPermissionState } = {
@@ -72,7 +71,6 @@ async function fixture(fail = false) {
}
it('withdraws the permission Remote and all controls with the optional plugin', async () => {
hostApply()
const f = await fixture()
try {
const fiber = f.ctx.plugin({ inject: [...inject], apply: ctx => mountCuaPermissions(ctx, contribution) })