Files
deepseek-harness/apps/desktop/scripts/verify-shared-texture.mjs
T
Yudong Hanandimccyu f7cb4926dc feat(frame-forwarding): video-frame forwarding support (#8440)
* fix(desktop): hide the Windows menu entries while the document is fullscreen

Frame forwarding offers plugins the Fullscreen API; the Application and Edit caption entries now stay hidden during fullscreen and return when it ends.

* feat(desktop): build declared native addons for development and packaging

* feat(frame-forwarding): receive native frames and submit them to the Desktop sink

* feat(frame-forwarding): route Host channels to video mounts in the Client

Keep the producer interface internal while Office integration evolves. Include channel lifecycle, receiver integration and video presentation tests.

Co-authored-by: imccyu <276526105+imccyu@users.noreply.github.com>

* test(frame-forwarding): cover wire packet and endpoint parsing with fuzz tests

* refactor(desktop): preinstall the native frame receiver

* build(desktop): compile the preinstalled receiver from the plugin workspace

* refactor(frame-forwarding): load the preinstalled receiver inside the plugin

* refactor(desktop): pass the frame receiver path as a Host argument

---------

Co-authored-by: imccyu <276526105+imccyu@users.noreply.github.com>
2026-11-27 06:39:04 +00:00

39 lines
2.1 KiB
JavaScript

/** Verify Desktop's frame receiver and shared-texture addons on macOS and Windows. */
import { createHash } from 'node:crypto'
import { existsSync } from 'node:fs'
import { readFile } from 'node:fs/promises'
import { join } from 'node:path'
import { matchingArchitecture } from './native-package-builds.mjs'
/**
* Addons required by Desktop's texture transport.
* @param {string} platform - Electron execution platform.
* @returns {readonly string[]} Addon basenames without `.node`; empty on unsupported platforms.
*/
export function sharedTextureAddonNames(platform) {
return platform === 'darwin' || platform === 'win32' ? ['shared-texture-hop', 'shared-texture-ingress', 'frame-forwarding'] : []
}
async function verifyAddon(directory, name, target) {
const platform = `${target.platform}-${target.arch}`
const addon = join(directory, `${name}.node`)
if (!existsSync(addon)) throw new Error(`shared-texture: ${addon} is missing; run pnpm --filter @deepseek-ai/dsh-desktop run build:native --arch ${target.arch}`)
const bytes = await readFile(addon)
const record = JSON.parse(await readFile(join(directory, `${name}.json`), 'utf8'))
if (record.platform !== platform || record.sha256 !== createHash('sha256').update(bytes).digest('hex')) {
throw new Error(`shared-texture: ${addon} differs from its build record`)
}
if (!['x64', 'arm64'].includes(target.arch) || !matchingArchitecture(bytes, target)) throw new Error(`shared-texture: ${name} addon is not ${platform}`)
}
/**
* Require the target's built addons, their build records, and their architecture.
* @param {string} appDir - Desktop application directory containing `lib/`.
* @param {{ platform: string, arch: string }} target - Electron execution target.
* @returns {Promise<void>} Completion after presence, record, hash, and architecture checks.
*/
export async function verifySharedTextureAddons(appDir, target) {
const directory = join(appDir, 'lib', 'native', `${target.platform}-${target.arch}`)
for (const name of sharedTextureAddonNames(target.platform)) await verifyAddon(directory, name, target)
}