@deepseek-ai/libreoffice-kit 0.2.0-alpha5 → 0.2.0-alpha7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/NOTICE +2 -2
  2. package/README.md +7 -5
  3. package/README.zh.md +7 -5
  4. package/frame-forwarding/CMakeLists.txt +40 -0
  5. package/{native-render → frame-forwarding}/README.md +17 -17
  6. package/{native-render → frame-forwarding}/README.zh.md +16 -16
  7. package/{native-render/include/dsh_render.h → frame-forwarding/include/dsh_frame_forwarding.h} +26 -26
  8. package/{native-render/include/dsh_render_engine.h → frame-forwarding/include/dsh_frame_forwarding_engine.h} +14 -14
  9. package/{native-render/include/dsh_render_node.h → frame-forwarding/include/dsh_frame_forwarding_node.h} +8 -8
  10. package/{native-render → frame-forwarding}/include/dsh_webgpu.h +3 -3
  11. package/{native-render → frame-forwarding}/index.d.ts +24 -24
  12. package/{native-render → frame-forwarding}/index.mjs +1 -1
  13. package/{native-render → frame-forwarding}/lib/browser/display.d.ts +6 -6
  14. package/{native-render → frame-forwarding}/lib/browser/display.js +4 -4
  15. package/{native-render → frame-forwarding}/lib/browser/index.d.ts +2 -2
  16. package/frame-forwarding/lib/browser/index.js +3 -0
  17. package/{native-render → frame-forwarding}/lib/browser/painters.d.ts +2 -2
  18. package/{native-render → frame-forwarding}/lib/browser/painters.js +1 -1
  19. package/{native-render → frame-forwarding}/lib/browser/types.d.ts +11 -11
  20. package/{native-render → frame-forwarding}/lib/electron/adapter.d.ts +2 -2
  21. package/{native-render → frame-forwarding}/lib/electron/adapter.js +3 -3
  22. package/frame-forwarding/lib/electron/index.d.ts +3 -0
  23. package/frame-forwarding/lib/electron/index.js +3 -0
  24. package/{native-render → frame-forwarding}/lib/electron/preload.d.ts +4 -4
  25. package/{native-render → frame-forwarding}/lib/electron/preload.js +1 -1
  26. package/{native-render → frame-forwarding}/lib/electron/transfer.d.ts +2 -2
  27. package/{native-render → frame-forwarding}/lib/electron/transfer.js +1 -1
  28. package/{native-render/prebuilds/darwin-arm64/render.node → frame-forwarding/prebuilds/darwin-arm64/frame-forwarding.node} +0 -0
  29. package/frame-forwarding/prebuilds/darwin-arm64/libdsh_frame_forwarding_sdk.a +0 -0
  30. package/frame-forwarding/prebuilds/darwin-arm64/manifest.json +34 -0
  31. package/frame-forwarding/prebuilds/darwin-x64/frame-forwarding.node +0 -0
  32. package/frame-forwarding/prebuilds/darwin-x64/libdsh_frame_forwarding_sdk.a +0 -0
  33. package/frame-forwarding/prebuilds/darwin-x64/manifest.json +34 -0
  34. package/frame-forwarding/prebuilds/win32-arm64/dsh_frame_forwarding_sdk.lib +0 -0
  35. package/{native-render/prebuilds/win32-arm64/render.node → frame-forwarding/prebuilds/win32-arm64/frame-forwarding.node} +0 -0
  36. package/frame-forwarding/prebuilds/win32-arm64/manifest.json +34 -0
  37. package/frame-forwarding/prebuilds/win32-x64/dsh_frame_forwarding_sdk.lib +0 -0
  38. package/{native-render/prebuilds/win32-x64/render.node → frame-forwarding/prebuilds/win32-x64/frame-forwarding.node} +0 -0
  39. package/frame-forwarding/prebuilds/win32-x64/manifest.json +34 -0
  40. package/frame-forwarding/receipt.json +23 -0
  41. package/{native-render → frame-forwarding}/scripts/build-webgpu.mjs +1 -1
  42. package/{native-render → frame-forwarding}/scripts/build.mjs +7 -7
  43. package/{native-render → frame-forwarding}/scripts/metadata.mjs +5 -5
  44. package/{native-render → frame-forwarding}/scripts/source-identity.mjs +2 -2
  45. package/{native-render → frame-forwarding}/scripts/verify-prebuilds.mjs +3 -3
  46. package/{native-render → frame-forwarding}/sdk.json +9 -9
  47. package/{native-render → frame-forwarding}/src/node-producer.cc +36 -36
  48. package/frame-forwarding/src/producer-internal.h +8 -0
  49. package/{native-render → frame-forwarding}/src/producer.cc +53 -53
  50. package/{native-render → frame-forwarding}/src/receiver.cc +4 -4
  51. package/{native-render → frame-forwarding}/src/transport.cc +1 -1
  52. package/{native-render → frame-forwarding}/src/transport.h +4 -4
  53. package/{native-render → frame-forwarding}/src/webgpu.cc +13 -13
  54. package/frame-forwarding/verify.d.mts +4 -0
  55. package/{native-render → frame-forwarding}/verify.mjs +8 -8
  56. package/lib/cli.js +4 -4
  57. package/lib/editor.js +3 -3
  58. package/lib/index.js +4 -4
  59. package/lib/types/editor.d.ts +1 -1
  60. package/lib/types/engine.d.ts +1 -1
  61. package/package.json +78 -78
  62. package/native-render/CMakeLists.txt +0 -40
  63. package/native-render/lib/browser/index.js +0 -3
  64. package/native-render/lib/electron/index.d.ts +0 -3
  65. package/native-render/lib/electron/index.js +0 -3
  66. package/native-render/prebuilds/darwin-arm64/libdsh_render_sdk.a +0 -0
  67. package/native-render/prebuilds/darwin-arm64/manifest.json +0 -34
  68. package/native-render/prebuilds/darwin-x64/libdsh_render_sdk.a +0 -0
  69. package/native-render/prebuilds/darwin-x64/manifest.json +0 -34
  70. package/native-render/prebuilds/darwin-x64/render.node +0 -0
  71. package/native-render/prebuilds/win32-arm64/dsh_render_sdk.lib +0 -0
  72. package/native-render/prebuilds/win32-arm64/manifest.json +0 -34
  73. package/native-render/prebuilds/win32-x64/dsh_render_sdk.lib +0 -0
  74. package/native-render/prebuilds/win32-x64/manifest.json +0 -34
  75. package/native-render/receipt.json +0 -23
  76. package/native-render/src/producer-internal.h +0 -8
  77. package/native-render/verify.d.mts +0 -4
  78. /package/{native-render → frame-forwarding}/LICENSE +0 -0
  79. /package/{native-render → frame-forwarding}/lib/browser/types.js +0 -0
  80. /package/{native-render → frame-forwarding}/src/relay-transport.inc +0 -0
  81. /package/{native-render → frame-forwarding}/src/win-delay-load.LICENSE +0 -0
  82. /package/{native-render → frame-forwarding}/src/win-delay-load.cc +0 -0
  83. /package/{native-render → frame-forwarding}/webgpu-dependencies.json +0 -0
package/NOTICE CHANGED
@@ -1,6 +1,6 @@
1
- Browser presentation, Electron texture transfer and adapter detection, and GPU diagnostic examples originate from MIT-licensed DeepSeek Harness commit 21261bee8b9a820c62c9e42cade3ff644b747a29. They retain the native-render/LICENSE notice.
1
+ Browser presentation, Electron texture transfer and adapter detection, and GPU diagnostic examples originate from MIT-licensed DeepSeek Harness commit 21261bee8b9a820c62c9e42cade3ff644b747a29. They retain the frame-forwarding/LICENSE notice.
2
2
 
3
- The native-render subpaths contain MIT-licensed SDK sources from DeepSeek Harness at commit 4438b67c13d529c9882d89893ed5cd610ace11cc, integrated with the LibreOffice Kit WebGPU adapter from commit 2ae2de8c7e88df00e74ee538ebd5662f47c7a1df. The SDK retains its MIT license in native-render/LICENSE. The Windows Node delay-load implementation retains its separate notice in native-render/src/win-delay-load.LICENSE. Native-render does not require the LibreOffice engine.
3
+ The frame-forwarding subpaths contain MIT-licensed SDK sources from DeepSeek Harness at commit 4438b67c13d529c9882d89893ed5cd610ace11cc, integrated with the LibreOffice Kit WebGPU adapter from commit 2ae2de8c7e88df00e74ee538ebd5662f47c7a1df. The SDK retains its MIT license in frame-forwarding/LICENSE. The Windows Node delay-load implementation retains its separate notice in frame-forwarding/src/win-delay-load.LICENSE. Native-render does not require the LibreOffice engine.
4
4
 
5
5
  LibreOffice Kit incorporates font handling and conversion integration derived from DeepSeek Harness. These portions retain the following notice. LibreOffice engine sources and their separate third-party notices are distributed in the engine packages.
6
6
 
package/README.md CHANGED
@@ -8,14 +8,14 @@ The conversion and native preview entry points can run together in one process,
8
8
 
9
9
  Binary `.doc`, `.xls`, and `.ppt` inputs must be OLE compound documents, such as Office 97–2003 files. Renamed RTF/HTML and `.wps` inputs are unsupported. `missingFonts` is empty for binary inputs because their font tables are interpreted by LibreOffice rather than the OOXML inspector.
10
10
 
11
- The Node API version is independent of its platform engine versions. The 0.2.0-alpha5 adapter uses alpha5 macOS and Windows x64 engines, retains the Windows ARM64 0.1.5 engine, and uses a portable alpha5 WASM package containing the 0.1.5 engine files. `ENGINE_VERSION` and `discoverRuntime().version` identify the Node API; `ENGINE_VERSIONS` lists the exact compatible engine versions. `discoverRuntime().nativePreview` distinguishes native preview support from PDF conversion. Missing native packages select WASM; malformed installed packages reject.
11
+ The Node API version is independent of its platform engine versions. The 0.2.0-alpha7 adapter uses alpha7 macOS and Windows x64 engines, retains the Windows ARM64 0.1.5 engine, and uses a portable alpha5 WASM package containing the 0.1.5 engine files. `ENGINE_VERSION` and `discoverRuntime().version` identify the Node API; `ENGINE_VERSIONS` lists the exact compatible engine versions. `discoverRuntime().nativePreview` distinguishes native preview support from PDF conversion. Missing native packages select WASM; malformed installed packages reject.
12
12
 
13
13
  ## Installation and usage
14
14
 
15
- Use Node.js 22.19.0 or newer. This command applies after alpha5 is published; unpublished candidates must be built and qualified from source first:
15
+ Use Node.js 22.19.0 or newer. This command applies after alpha7 is published; unpublished candidates must be built and qualified from source first:
16
16
 
17
17
  ```sh
18
- npm install @deepseek-ai/libreoffice-kit@0.2.0-alpha5
18
+ npm install @deepseek-ai/libreoffice-kit@0.2.0-alpha7
19
19
  ```
20
20
 
21
21
  npm installs the shared WASM engine and any matching native engine. The adapter prefers a compatible installed native engine, then selects WASM when no native package supports the host or the optional native package is absent. A corrupt installed package rejects with `unavailable`. Conversion failures never switch engines.
@@ -70,6 +70,8 @@ The caller authorizes input access and owns private input/output directories; pa
70
70
 
71
71
  ## Native editor
72
72
 
73
+ Native views hide all comments and their hit targets. Exporting an original-format snapshot preserves comment text, authors and reply relationships; editing the document does not enable comment viewing.
74
+
73
75
  `@deepseek-ai/libreoffice-kit/editor` opens a persistent DOCX, XLSX, or PPTX document with `openDocument()`. The caller owns authorization, input bytes, rendering, and saved snapshots; `close()` joins the native process. Editing requires `writable: true`. The editor does not expose a browser document model or LibreOffice desktop windows.
74
76
 
75
77
  `openDocument({ onProgress })` reports `fonts`, `engine`, and `document` when each loading stage begins. Observer failures become warnings. Rendering can start only after the returned promise resolves; the callback does not make LibreOffice import incremental.
@@ -82,7 +84,7 @@ When migrating from 0.1.3 to the 0.2.0 preview, update the Node adapter and its
82
84
 
83
85
  Devices without a usable Graphite backend reject initialization; Linux development native engines support raster only. Borrowed WebGPU objects remain in the native document process; no device is passed through Node or a browser. Dawn manages GPU submission and completion, while the native SDK manages shared access across processes, frame credits, and consumer release. Submitting a WebGPU queue alone does not mean a display consumer has finished using an image.
84
86
 
85
- Opening requires editor protocol 4 and native-render protocol 1 from the installed engine. A missing or incompatible protocol rejects initialization without selecting another engine.
87
+ Opening requires editor protocol 4 and frame-forwarding protocol 1 from the installed engine. A missing or incompatible protocol rejects initialization without selecting another engine.
86
88
 
87
89
  `getSelection()` returns plain text or HTML for the active selection. Native JSON replies use `maxOutputBytes` with a 1 MiB minimum; a reply exceeding that budget rejects the operation while keeping the document open. Escape cancels selection even with modifiers and does not open native command popups.
88
90
 
@@ -148,4 +150,4 @@ This package is licensed under [MPL-2.0](LICENSE). The engine packages include `
148
150
 
149
151
  ## Native rendering SDK
150
152
 
151
- `@deepseek-ai/libreoffice-kit/native-render` provides the standalone Node producer/receiver and C/C++ SDK for macOS and Windows x64/ARM64. Install with `--omit=optional` when LibreOffice engines are not needed. All four addons and static libraries ship in the main Kit package. `./native-render/sdk` describes source and library paths, and `./native-render/verify` checks complete SDK payloads. Installation and normal runtime do not compile or download native code. See the [SDK documentation](../native-render/README.md) for ownership and explicit diagnostic builds.
153
+ `@deepseek-ai/libreoffice-kit/frame-forwarding` provides the standalone Node producer/receiver and C/C++ SDK for macOS and Windows x64/ARM64. Install with `--omit=optional` when LibreOffice engines are not needed. All four addons and static libraries ship in the main Kit package. `./frame-forwarding/sdk` describes source and library paths, and `./frame-forwarding/verify` checks complete SDK payloads. Installation and normal runtime do not compile or download native code. See the [SDK documentation](../frame-forwarding/README.md) for ownership and explicit diagnostic builds.
package/README.zh.md CHANGED
@@ -8,14 +8,14 @@
8
8
 
9
9
  二进制 `.doc`、`.xls`、`.ppt` 输入必须是 OLE 复合文档,例如 Office 97–2003 文件。不支持改后缀的 RTF/HTML 和 `.wps`。二进制输入的 `missingFonts` 为空,因为其字体表由 LibreOffice 读取,而不是由 OOXML 检查器读取。
10
10
 
11
- Node API 与各平台引擎独立指定版本。0.2.0-alpha5 转换器使用 alpha5 的 macOS 与 Windows x64 引擎,保留 Windows ARM64 的 0.1.5 引擎,并使用包含 0.1.5 引擎文件的通用 alpha5 WASM 包。`ENGINE_VERSION` 和 `discoverRuntime().version` 表示 Node API 版本;`ENGINE_VERSIONS` 列出各平台兼容的精确引擎版本。`discoverRuntime().nativePreview` 区分原生预览与 PDF 转换能力。缺少原生包时选择 WASM;已安装的包损坏时拒绝。
11
+ Node API 与各平台引擎独立指定版本。0.2.0-alpha7 转换器使用 alpha7 的 macOS 与 Windows x64 引擎,保留 Windows ARM64 的 0.1.5 引擎,并使用包含 0.1.5 引擎文件的通用 alpha5 WASM 包。`ENGINE_VERSION` 和 `discoverRuntime().version` 表示 Node API 版本;`ENGINE_VERSIONS` 列出各平台兼容的精确引擎版本。`discoverRuntime().nativePreview` 区分原生预览与 PDF 转换能力。缺少原生包时选择 WASM;已安装的包损坏时拒绝。
12
12
 
13
13
  ## 安装与使用
14
14
 
15
- 使用 Node.js 22.19.0 或更新版本。以下命令适用于已发布的 alpha5 包;未发布的候选包需先从源码构建并验证:
15
+ 使用 Node.js 22.19.0 或更新版本。alpha7 发布后可使用以下命令安装;未发布的候选包需先从源码构建并验证:
16
16
 
17
17
  ```sh
18
- npm install @deepseek-ai/libreoffice-kit@0.2.0-alpha5
18
+ npm install @deepseek-ai/libreoffice-kit@0.2.0-alpha7
19
19
  ```
20
20
 
21
21
  npm 安装共享 WASM 引擎和匹配平台的原生引擎。转换器优先使用已安装且兼容的原生引擎;平台没有原生包或可选原生包未安装时选择 WASM。已安装的包损坏时以 `unavailable` 拒绝。转换失败不会切换引擎。
@@ -70,6 +70,8 @@ Windows 上,引擎可执行文件或程序目录路径达到 260 个字符时
70
70
 
71
71
  ## 原生编辑器
72
72
 
73
+ 原生视图隐藏所有批注及其交互区域。导出原格式快照会保留批注正文、作者和回复关系;进入编辑模式也不会启用批注查看。
74
+
73
75
  `@deepseek-ai/libreoffice-kit/editor` 通过 `openDocument()` 打开常驻的 DOCX、XLSX 或 PPTX 文档。调用方负责访问授权、输入字节、绘制和保存快照;`close()` 会等待原生进程退出。编辑需要设置 `writable: true`。编辑器不提供浏览器文档模型或 LibreOffice 桌面窗口。
74
76
 
75
77
  `openDocument({ onProgress })` 在各加载阶段开始时报告 `fonts`、`engine` 和 `document`。观察函数抛错会转为警告。只有返回的 Promise 完成后才能开始绘制;该回调不会让 LibreOffice 导入变为渐进式。
@@ -82,7 +84,7 @@ Windows 上,引擎可执行文件或程序目录路径达到 260 个字符时
82
84
 
83
85
  Graphite 后端不可用的设备会拒绝初始化;Linux 原生开发引擎仅支持 raster。共享绘制借用的 WebGPU 对象留在原生文档进程内,不通过 Node 或浏览器传递 device。GPU 提交和完成由 Dawn 管理,跨进程共享访问、帧配额和消费者释放仍由原生 SDK 管理。单独提交 WebGPU queue 不表示显示消费者已使用完该图像。
84
86
 
85
- 打开文档要求已安装的引擎提供编辑器协议 4 和 native-render 协议 1。缺失或不兼容的协议会使初始化失败,不会选择其他引擎。
87
+ 打开文档要求已安装的引擎提供编辑器协议 4 和 frame-forwarding 协议 1。缺失或不兼容的协议会使初始化失败,不会选择其他引擎。
86
88
 
87
89
  `getSelection()` 返回当前选区的纯文本或 HTML。原生 JSON 回复以 `maxOutputBytes` 为预算,最低为 1 MiB;超出预算时只拒绝当前操作,文档保持打开。Escape 即使带有修饰键也只取消选择,不打开原生命令弹窗。
88
90
 
@@ -148,4 +150,4 @@ Node WASM 的图像降采样使用 LibreOffice 的 CPU 图像过滤器。文本
148
150
 
149
151
  ## 原生渲染 SDK
150
152
 
151
- `@deepseek-ai/libreoffice-kit/native-render` 提供独立的 Node 生产者、接收者和 C/C++ SDK,支持 macOS、Windows 的 x64/ARM64。不需要 LibreOffice 引擎时可使用 `--omit=optional` 安装。四套插件及静态库均随 Kit 主包分发。`./native-render/sdk` 描述源码与库路径,`./native-render/verify` 校验完整 SDK。正常安装和运行不编译或下载原生二进制。资源所有权与显式诊断构建见 [SDK 文档](../native-render/README.zh.md)。
153
+ `@deepseek-ai/libreoffice-kit/frame-forwarding` 提供独立的 Node 生产者、接收者和 C/C++ SDK,支持 macOS、Windows 的 x64/ARM64。不需要 LibreOffice 引擎时可使用 `--omit=optional` 安装。四套插件及静态库均随 Kit 主包分发。`./frame-forwarding/sdk` 描述源码与库路径,`./frame-forwarding/verify` 校验完整 SDK。正常安装和运行不编译或下载原生二进制。资源所有权与显式诊断构建见 [SDK 文档](../frame-forwarding/README.zh.md)。
@@ -0,0 +1,40 @@
1
+ cmake_minimum_required(VERSION 3.20)
2
+ file(READ "${CMAKE_CURRENT_SOURCE_DIR}/sdk.json" DSH_FRAME_FORWARDING_METADATA)
3
+ string(JSON DSH_FRAME_FORWARDING_VERSION GET "${DSH_FRAME_FORWARDING_METADATA}" version)
4
+ string(REGEX REPLACE "-.*$" "" DSH_FRAME_FORWARDING_CMAKE_VERSION "${DSH_FRAME_FORWARDING_VERSION}")
5
+ project(dsh_frame_forwarding VERSION ${DSH_FRAME_FORWARDING_CMAKE_VERSION} LANGUAGES CXX)
6
+ add_library(dsh_frame_forwarding_sdk STATIC src/producer.cc src/transport.cc)
7
+ target_compile_features(dsh_frame_forwarding_sdk PUBLIC cxx_std_17)
8
+ target_include_directories(dsh_frame_forwarding_sdk PUBLIC include PRIVATE src)
9
+ set_target_properties(dsh_frame_forwarding_sdk PROPERTIES POSITION_INDEPENDENT_CODE ON)
10
+ target_compile_options(dsh_frame_forwarding_sdk PRIVATE $<$<PLATFORM_ID:Windows>:/EHsc>)
11
+ if(APPLE)
12
+ target_link_libraries(dsh_frame_forwarding_sdk PUBLIC "-framework IOSurface" "-framework CoreFoundation" bsm)
13
+ elseif(WIN32)
14
+ target_compile_definitions(dsh_frame_forwarding_sdk PUBLIC _WIN32_WINNT=0x0602)
15
+ target_link_libraries(dsh_frame_forwarding_sdk PUBLIC d3d11 dxgi advapi32)
16
+ else()
17
+ message(FATAL_ERROR "DSH native render requires macOS or Windows")
18
+ endif()
19
+ install(TARGETS dsh_frame_forwarding_sdk ARCHIVE DESTINATION lib)
20
+ install(FILES include/dsh_frame_forwarding.h include/dsh_frame_forwarding_engine.h include/dsh_frame_forwarding_node.h DESTINATION include)
21
+
22
+ option(DSH_FRAME_FORWARDING_WEBGPU "Build the native WebGPU producer adapter" OFF)
23
+ if(DSH_FRAME_FORWARDING_WEBGPU)
24
+ if(NOT DSH_DAWN_SOURCE_DIR)
25
+ message(FATAL_ERROR "Use scripts/build-webgpu.mjs to prepare the pinned Dawn sources")
26
+ endif()
27
+ set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
28
+ set(DAWN_BUILD_MONOLITHIC_LIBRARY STATIC CACHE STRING "" FORCE)
29
+ set(DAWN_ENABLE_INSTALL ON CACHE BOOL "" FORCE)
30
+ add_subdirectory("${DSH_DAWN_SOURCE_DIR}" dawn)
31
+ set_target_properties(webgpu_dawn PROPERTIES OUTPUT_NAME dawn)
32
+ add_library(dsh_webgpu STATIC src/webgpu.cc)
33
+ target_compile_features(dsh_webgpu PUBLIC cxx_std_20)
34
+ target_include_directories(dsh_webgpu PUBLIC include)
35
+ target_link_libraries(dsh_webgpu PUBLIC dsh_frame_forwarding_sdk dawn::webgpu_dawn)
36
+ set_target_properties(dsh_webgpu PROPERTIES POSITION_INDEPENDENT_CODE ON)
37
+ target_compile_options(dsh_webgpu PRIVATE $<$<PLATFORM_ID:Windows>:/EHsc>)
38
+ install(TARGETS dsh_webgpu ARCHIVE DESTINATION lib)
39
+ install(FILES include/dsh_webgpu.h DESTINATION include)
40
+ endif()
@@ -1,8 +1,8 @@
1
- # Native rendering SDK
1
+ # Frame forwarding SDK
2
2
 
3
3
  English | [中文](README.zh.md)
4
4
 
5
- The `@deepseek-ai/libreoffice-kit/native-render` package connects an authorized native producer to Electron Main without routing pixels through DSH Host. This public Kit subpath contains Node/TypeScript producer and receiver APIs backed by the same Electron-independent C/C++ SDK. Its payload includes explicitly listed C/C++ build sources; source globs and source maps are excluded. macOS uses IOSurface with Mach port transfer; Windows uses D3D11 shared NT handles and an owner-only named pipe. Separate browser and Electron subpaths provide presentation and texture ownership; consumers own authorization and application commands.
5
+ The `@deepseek-ai/libreoffice-kit/frame-forwarding` package connects an authorized native producer to Electron Main without routing pixels through DSH Host. This public Kit subpath contains Node/TypeScript producer and receiver APIs backed by the same Electron-independent C/C++ SDK. Its payload includes explicitly listed C/C++ build sources; source globs and source maps are excluded. macOS uses IOSurface with Mach port transfer; Windows uses D3D11 shared NT handles and an owner-only named pipe. Separate browser and Electron subpaths provide presentation and texture ownership; consumers own authorization and application commands.
6
6
 
7
7
  Installing Kit with `--omit=optional` provides the SDK without Office engines or the Windows Office pipe dependency Koffi. Normal installation retains both optional dependency selections. Neither SDK installation nor SDK communication compiles or downloads binaries.
8
8
 
@@ -26,15 +26,15 @@ The byte budget reserves one surface per macOS allocation or declared Windows sa
26
26
 
27
27
  ## Node/TypeScript producer
28
28
 
29
- Import `createProducer` from `@deepseek-ai/libreoffice-kit/native-render` inside the owning Node process. Bind the receiver to that Node process's PID; an in-process plugin uses `process.pid`. Pass the private endpoint, `maxPendingOperations`, `operationTimeoutMs`, and an optional native engine descriptor. Await `ready`, and register explicit `close()` with the owning plugin's disposal. The [TypeScript API](index.d.ts) defines operations and resource ownership.
29
+ Import `createProducer` from `@deepseek-ai/libreoffice-kit/frame-forwarding` inside the owning Node process. Bind the receiver to that Node process's PID; an in-process plugin uses `process.pid`. Pass the private endpoint, `maxPendingOperations`, `operationTimeoutMs`, and an optional native engine descriptor. Await `ready`, and register explicit `close()` with the owning plugin's disposal. The [TypeScript API](index.d.ts) defines operations and resource ownership.
30
30
 
31
- A dedicated native worker serializes connection, uploads, engine callbacks, mutex waits and submission. A separate polling thread wakes it on credit and control events; acquisition does not poll on a timer. Accepted operations may queue before readiness; excess ordinary operations reject, including control messages. Discard has one reserved queue slot per owned lease so a full queue cannot prevent release. Pending acquisitions wait for credits without blocking worker execution. Acquisition timeout rejects that request without closing the producer. Transport or uncertain GPU completion failures close the connection. `closed` resolves after queued operations settle and the worker, client and engine are destroyed. Event-listener exceptions are contained; listeners remain responsible for their own diagnostics. Worker termination uses asynchronous native cleanup. Set `DSH_RENDER_DIAGNOSTICS=1` to report contained producer callback exceptions to stderr.
31
+ A dedicated native worker serializes connection, uploads, engine callbacks, mutex waits and submission. A separate polling thread wakes it on credit and control events; acquisition does not poll on a timer. Accepted operations may queue before readiness; excess ordinary operations reject, including control messages. Discard has one reserved queue slot per owned lease so a full queue cannot prevent release. Pending acquisitions wait for credits without blocking worker execution. Acquisition timeout rejects that request without closing the producer. Transport or uncertain GPU completion failures close the connection. `closed` resolves after queued operations settle and the worker, client and engine are destroyed. Event-listener exceptions are contained; listeners remain responsible for their own diagnostics. Worker termination uses asynchronous native cleanup. Set `DSH_FRAME_FORWARDING_DIAGNOSTICS=1` to report contained producer callback exceptions to stderr.
32
32
 
33
33
  `acquire(width, height)` returns an explicit surface lease. Await `writeBgra(buffer, stride)` or `render()`, then `submit(frameId, metadata)` or `discard()`; surface `close()` is a discard alias. Busy or consumed surfaces reject reuse. Garbage collection never grants frame credit. Submission consumes the lease, but the underlying texture remains unavailable until the receiver releases its frame.
34
34
 
35
35
  CPU uploads borrow a non-shared Node Buffer until the returned promise settles. During that time callers must not modify it, detach it or transfer its backing ArrayBuffer. Row stride may exceed the packed row width. The binding retains the Buffer and avoids an intermediate binding copy; the C SDK still copies or uploads those bytes. CPU upload is not GPU zero-copy.
36
36
 
37
- For continuous GPU rendering, supply an engine exported by another Node addon using [dsh_render_node.h](include/dsh_render_node.h). Its [engine callbacks](include/dsh_render_engine.h) run serially on the producer worker. The descriptor stays alive through engine destruction. `render` borrows the acquired native texture and releases imports before returning. Windows callbacks queue work on the supplied device's immediate context while the SDK owns key 0; they must not acquire that lock themselves. macOS callbacks complete GPU work before returning. Both observe cancellation. Third-party callbacks must return promptly; the SDK cannot preempt arbitrary engine code. Engine creation, update and destruction must not call JavaScript.
37
+ For continuous GPU rendering, supply an engine exported by another Node addon using [dsh_frame_forwarding_node.h](include/dsh_frame_forwarding_node.h). Its [engine callbacks](include/dsh_frame_forwarding_engine.h) run serially on the producer worker. The descriptor stays alive through engine destruction. `render` borrows the acquired native texture and releases imports before returning. Windows callbacks queue work on the supplied device's immediate context while the SDK owns key 0; they must not acquire that lock themselves. macOS callbacks complete GPU work before returning. Both observe cancellation. Third-party callbacks must return promptly; the SDK cannot preempt arbitrary engine code. Engine creation, update and destruction must not call JavaScript.
38
38
 
39
39
  `start({ width, height, generation, frameIntervalMs })` renders continuously in native code; `update(json, inputSequence)` applies batched engine state, and `stop()` stops new frames. The interval includes rendering time and accepts fractions such as `1000 / 60`; elapsed deadlines are skipped without catch-up bursts. Manual leases must be released before starting. Frame metadata contains request ID, viewport generation, revision and the latest applied input sequence.
40
40
 
@@ -44,40 +44,40 @@ The display path can match the C producer's native path without per-frame JavaSc
44
44
 
45
45
  ## C/C++ producer
46
46
 
47
- Include `include/dsh_render.h` and link the matching `libdsh_render_sdk.a` or `dsh_render_sdk.lib`, or build the sources listed in `sdk.json`. The API has no Node or Electron dependency. Poll on one thread; acquisition, writing, submission and discard may run on another. Callers must serialize use of the same graphics context. Interrupt polling, join that thread, and close the client after all its API calls return.
47
+ Include `include/dsh_frame_forwarding.h` and link the matching `libdsh_frame_forwarding_sdk.a` or `dsh_frame_forwarding_sdk.lib`, or build the sources listed in `sdk.json`. The API has no Node or Electron dependency. Poll on one thread; acquisition, writing, submission and discard may run on another. Callers must serialize use of the same graphics context. Interrupt polling, join that thread, and close the client after all its API calls return.
48
48
 
49
- On Windows, `dsh_render_connect_with_device` accepts the application’s `ID3D11Device` and retains it until close. Passing null, or using `dsh_render_connect`, creates a default device. `dsh_render_connect_with_options` additionally bounds connection/handshake time and accepts a cancellation callback on the connecting thread. Applications choose their own GPU; DSH selects the transport. Serialize the adopted device’s immediate context with SDK writes. macOS requires a null device.
49
+ On Windows, `dsh_frame_forwarding_connect_with_device` accepts the application’s `ID3D11Device` and retains it until close. Passing null, or using `dsh_frame_forwarding_connect`, creates a default device. `dsh_frame_forwarding_connect_with_options` additionally bounds connection/handshake time and accepts a cancellation callback on the connecting thread. Applications choose their own GPU; DSH selects the transport. Serialize the adopted device’s immediate context with SDK writes. macOS requires a null device.
50
50
 
51
51
  Acquisition initially returns null while the receiver grants allocation credit. Poll and retry when the owning application is ready; do not spin. Allocation requests enter a shared FIFO budget queue. Grants cover idle pool allocations as well as displayed frames. A null acquisition otherwise indicates exhausted credits; terminal allocation errors are reported by polling with `kind = -1` and explanatory text. Stop processing on a negative poll result and preserve its diagnostic before closing. A consumer must bound its overall operation lifetime and disconnect on timeout.
52
52
 
53
- Textures use top-left BGRA8 premultiplied pixels in sRGB. Windows surfaces have a keyed mutex using key 0. Acquisition grants a lease without locking: SDK CPU uploads and engine callbacks own the write lock; external GPU writers own it themselves through `dsh_render_surface_keyed_mutex` or their import API. Writers release key 0 after queueing commands and release imported objects/views before submit or discard. CPU uploads copy the input before returning and do not wait for GPU completion; `dsh_render_write_bgra_with_timeout` bounds mutex acquisition. `AcquireSync` can block the CPU. macOS writers must complete GPU work before submit or discard. Reusing a surface requires both a new acquisition and the write lock on Windows. If GPU access release fails, close the connection without reusing the surface.
53
+ Textures use top-left BGRA8 premultiplied pixels in sRGB. Windows surfaces have a keyed mutex using key 0. Acquisition grants a lease without locking: SDK CPU uploads and engine callbacks own the write lock; external GPU writers own it themselves through `dsh_frame_forwarding_surface_keyed_mutex` or their import API. Writers release key 0 after queueing commands and release imported objects/views before submit or discard. CPU uploads copy the input before returning and do not wait for GPU completion; `dsh_frame_forwarding_write_bgra_with_timeout` bounds mutex acquisition. `AcquireSync` can block the CPU. macOS writers must complete GPU work before submit or discard. Reusing a surface requires both a new acquisition and the write lock on Windows. If GPU access release fails, close the connection without reusing the surface.
54
54
 
55
- Frame IDs must be integers from 1 through 9007199254740991 and unique among outstanding submissions. `dsh_render_submit` returns 1 when submitted and 0 on failure. A failed submission leaves a valid acquisition with the caller for retry or discard under the same GPU completion requirements.
55
+ Frame IDs must be integers from 1 through 9007199254740991 and unique among outstanding submissions. `dsh_frame_forwarding_submit` returns 1 when submitted and 0 on failure. A failed submission leaves a valid acquisition with the caller for retry or discard under the same GPU completion requirements.
56
56
 
57
- Windows Vulkan and D3D12 consumers borrow the NT handle through `dsh_render_surface_shared_handle` while the surface is acquired. They must use the SDK's GPU adapter and enable keyed-mutex synchronization in their import API, following the ownership rules above. The SDK owns the handle; callers must not close it. The function returns null on macOS. Receiver copies acquire the source mutex with a bounded timeout when the actual texture descriptor declares one; legacy textures retain the completed-write requirement.
57
+ Windows Vulkan and D3D12 consumers borrow the NT handle through `dsh_frame_forwarding_surface_shared_handle` while the surface is acquired. They must use the SDK's GPU adapter and enable keyed-mutex synchronization in their import API, following the ownership rules above. The SDK owns the handle; callers must not close it. The function returns null on macOS. Receiver copies acquire the source mutex with a bounded timeout when the actual texture descriptor declares one; legacy textures retain the completed-write requirement.
58
58
 
59
59
  Application JSON, frame correlation, input semantics, viewport generations and input acknowledgements are defined by the consuming application protocol. Control messages are limited to 16383 UTF-8 bytes. The SDK does not expose arbitrary process launching or native handles to webpages. The SDK has no LibreOffice runtime dependency; applications may install Kit with `--omit=optional` when only native rendering is needed.
60
60
 
61
61
  ## Build and validation
62
62
 
63
- Run `node scripts/build.mjs` on the target platform with complete matching Node headers available. The SDK version comes from the public Kit package metadata. Set `DSH_NODE_INCLUDE` explicitly when necessary; Windows additionally requires a developer toolchain environment and `DSH_NODE_LIB`. Builds produce precompiled Node-API and static SDK artifacts with SHA-256 receipts. Installation never invokes a compiler. Public Kit packing requires all four supported targets from one source commit. Partial payloads cannot be packed. The verifier checks addon and static-library architectures, artifact hashes, source hashes, versions and protocol before signing. Desktop runtime packaging retains only the selected target’s native-render prebuilds, along with the package license.
63
+ Run `node scripts/build.mjs` on the target platform with complete matching Node headers available. The SDK version comes from the public Kit package metadata. Set `DSH_NODE_INCLUDE` explicitly when necessary; Windows additionally requires a developer toolchain environment and `DSH_NODE_LIB`. Builds produce precompiled Node-API and static SDK artifacts with SHA-256 receipts. Installation never invokes a compiler. Public Kit packing requires all four supported targets from one source commit. Partial payloads cannot be packed. The verifier checks addon and static-library architectures, artifact hashes, source hashes, versions and protocol before signing. Desktop runtime packaging retains only the selected target’s frame-forwarding prebuilds, along with the package license.
64
64
 
65
- Run `pnpm test` in this directory after building. `DSH_NATIVE_RENDER_PACKAGE_ROOT` selects an installed SDK payload for transport and lifecycle tests; diagnostics may be retained outside the package with `DSH_NATIVE_RENDER_DIAGNOSTICS`. Fixture setup gives each complete compile/link group 120 seconds within a 180-second setup hook; protocol and runner deadlines are separate. Compiler receipts preserve the resolved executable, arguments, working directory, elapsed time, direct-child outcome and stdout/stderr. Compiler descendant exit is not observed. Parent fixtures prepare GPU inspectors and pass their paths only to owned runners, retaining the temporary files until those runners exit. The native CI lane runs C transport and Node producer integration tests serially before packing, including asynchronous shutdown and Worker termination. Performance and Electron shared-texture import require separate actual GPU validation; a successful native transport test alone does not establish those results.
65
+ Run `pnpm test` in this directory after building. `DSH_FRAME_FORWARDING_PACKAGE_ROOT` selects an installed SDK payload for transport and lifecycle tests; diagnostics may be retained outside the package with `DSH_FRAME_FORWARDING_DIAGNOSTICS`. Fixture setup gives each complete compile/link group 120 seconds within a 180-second setup hook; protocol and runner deadlines are separate. Compiler receipts preserve the resolved executable, arguments, working directory, elapsed time, direct-child outcome and stdout/stderr. Compiler descendant exit is not observed. Parent fixtures prepare GPU inspectors and pass their paths only to owned runners, retaining the temporary files until those runners exit. The native CI lane runs C transport and Node producer integration tests serially before packing, including asynchronous shutdown and Worker termination. Performance and Electron shared-texture import require separate actual GPU validation; a successful native transport test alone does not establish those results.
66
66
 
67
67
  ## Browser and Electron presentation
68
68
 
69
- `@deepseek-ai/libreoffice-kit/native-render/browser` exports `NativeFrameDisplay`, `createNativeFramePainter`, and their types. Importing this entry does not load Electron, Office or native addons and allocates no graphics resources. The generic view identifier preserves application-specific string types. Applications own view creation, authorization, producer control and input arbitration.
69
+ `@deepseek-ai/libreoffice-kit/frame-forwarding/browser` exports `FrameForwardingFrameDisplay`, `createFrameForwardingFramePainter`, and their types. Importing this entry does not load Electron, Office or native addons and allocates no graphics resources. The generic view identifier preserves application-specific string types. Applications own view creation, authorization, producer control and input arbitration.
70
70
 
71
- `NativeFrameDisplay.present()` takes ownership of a frame lease and releases it after painting or rejection. Hidden documents wait for visibility; a generation change or disposal cancels the wait. The owner separately updates producer visibility. Dispose the display before removing its canvas.
71
+ `FrameForwardingFrameDisplay.present()` takes ownership of a frame lease and releases it after painting or rejection. Hidden documents wait for visibility; a generation change or disposal cancels the wait. The owner separately updates producer visibility. Dispose the display before removing its canvas.
72
72
 
73
- `@deepseek-ai/libreoffice-kit/native-render/electron` exports `detectNativeRenderAdapter` and `sendNativeFrame` for Electron Main. Adapter detection waits for complete Chromium GPU information and observes its exported Direct3D11 texture within one supplied deadline. Unsupported backends or software compositing return `null` without creating an offscreen window. Cancellation also covers GPU initialization and window construction. After the application validates the recipient and frame metadata, `sendNativeFrame` owns the delivery credit through submission failure or Electron's final GPU-reference release. Its completion does not imply GPU release. The required failure callback synchronously stops producer I/O before Main releases its import or returns the delivery credit; the submission promise then rejects.
73
+ `@deepseek-ai/libreoffice-kit/frame-forwarding/electron` exports `detectFrameForwardingAdapter` and `sendFrameForwardingFrame` for Electron Main. Adapter detection waits for complete Chromium GPU information and observes its exported Direct3D11 texture within one supplied deadline. Unsupported backends or software compositing return `null` without creating an offscreen window. Cancellation also covers GPU initialization and window construction. After the application validates the recipient and frame metadata, `sendFrameForwardingFrame` owns the delivery credit through submission failure or Electron's final GPU-reference release. Its completion does not imply GPU release. The required failure callback synchronously stops producer I/O before Main releases its import or returns the delivery credit; the submission promise then rejects.
74
74
 
75
- `@deepseek-ai/libreoffice-kit/native-render/electron/preload` exports `createNativeTextureReceiver` for a sandboxed preload. Bundle this entry with Electron external, and install its single document-wide receiver before starting production. Register at most one listener per view. Unsubscribe and revocation stop future deliveries; consumers retain delivered leases until explicit release. Missing consumers, frame extraction failures and throwing listeners release the imported texture. IPC authorization and application lifecycle remain with the caller.
75
+ `@deepseek-ai/libreoffice-kit/frame-forwarding/electron/preload` exports `createFrameForwardingTextureReceiver` for a sandboxed preload. Bundle this entry with Electron external, and install its single document-wide receiver before starting production. Register at most one listener per view. Unsubscribe and revocation stop future deliveries; consumers retain delivered leases until explicit release. Missing consumers, frame extraction failures and throwing listeners release the imported texture. IPC authorization and application lifecycle remain with the caller.
76
76
 
77
77
  ## Distribution
78
78
 
79
79
  The public Kit package exports the Node SDK, SDK metadata, verifier, browser and Electron entries independently. Resolve the SDK JSON file and read its `header`, `sources`, and `staticLibraries[target]` paths relative to that directory. Normal installation and runtime use the bundled addon without compiling or downloading native binaries.
80
80
 
81
- The browser painters/display, Electron adapter probe and generic texture ownership tests originate from DeepSeek Harness commit `21261bee8b9a820c62c9e42cade3ff644b747a29`, under `packages/client/native-render` and `apps/desktop`. Their unit tests are maintained with these implementations; DSH retains application integration tests.
81
+ The browser painters/display, Electron adapter probe and generic texture ownership tests originate from DeepSeek Harness commit `21261bee8b9a820c62c9e42cade3ff644b747a29`, under `packages/client/frame-forwarding` and `apps/desktop`. Their unit tests are maintained with these implementations; DSH retains application integration tests.
82
82
 
83
83
  The MIT SDK originated in DeepSeek Harness commit `4438b67c13d529c9882d89893ed5cd610ace11cc`. Its WebGPU adapter retains the Office fixes from LibreOffice Kit commit `2ae2de8c7e88df00e74ee538ebd5662f47c7a1df`. The Node binding and standalone C SDK share the source tree used by the Kit engine build. Protocol version 1 and engine ABI versions 1 and 2 are unchanged.
@@ -1,8 +1,8 @@
1
- # 原生渲染 SDK
1
+ # 帧转发 SDK
2
2
 
3
3
  [English](README.md) | 中文
4
4
 
5
- `@deepseek-ai/libreoffice-kit/native-render` 将经过授权的原生生产者连接到 Electron Main,像素不经过 DSH Host。这个公开子路径提供 Node/TypeScript 生产者与接收者,以及不依赖 Electron 的 C/C++ SDK。包内明确列出可供编译的源码;macOS 使用 IOSurface 与 Mach 端口传递,Windows 使用 D3D11 共享 NT 句柄和仅拥有者可访问的命名管道。独立 browser 与 Electron 子路径提供呈现和纹理所有权管理;消费方负责鉴权和应用控制协议。
5
+ `@deepseek-ai/libreoffice-kit/frame-forwarding` 将经过授权的原生生产者连接到 Electron Main,像素不经过 DSH Host。这个公开子路径提供 Node/TypeScript 生产者与接收者,以及不依赖 Electron 的 C/C++ SDK。包内明确列出可供编译的源码;macOS 使用 IOSurface 与 Mach 端口传递,Windows 使用 D3D11 共享 NT 句柄和仅拥有者可访问的命名管道。独立 browser 与 Electron 子路径提供呈现和纹理所有权管理;消费方负责鉴权和应用控制协议。
6
6
 
7
7
  使用 `--omit=optional` 安装 Kit 可仅使用 SDK,不安装 Office 引擎或 Windows Office 管道依赖 Koffi。普通安装保留这些可选依赖的选择规则。SDK 安装和通信均不编译或下载二进制。
8
8
 
@@ -26,15 +26,15 @@ shared-texture 的 `framePolicy` 默认为 `ordered`,保留 Office 瓦片等
26
26
 
27
27
  ## Node/TypeScript 生产者
28
28
 
29
- 在所属 Node 进程中,从 `@deepseek-ai/libreoffice-kit/native-render` 导入 `createProducer`。将接收端绑定至该 Node 进程的 PID;进程内插件使用 `process.pid`。传入私有端点、`maxPendingOperations`、`operationTimeoutMs` 及可选原生引擎描述符。等待 `ready`,并在所属插件的销毁流程中注册显式 `close()`。[TypeScript API](index.d.ts) 定义操作和资源所有权。
29
+ 在所属 Node 进程中,从 `@deepseek-ai/libreoffice-kit/frame-forwarding` 导入 `createProducer`。将接收端绑定至该 Node 进程的 PID;进程内插件使用 `process.pid`。传入私有端点、`maxPendingOperations`、`operationTimeoutMs` 及可选原生引擎描述符。等待 `ready`,并在所属插件的销毁流程中注册显式 `close()`。[TypeScript API](index.d.ts) 定义操作和资源所有权。
30
30
 
31
- 专用原生工作线程串行执行连接、上传、引擎回调、锁等待及提交。独立轮询线程收到信用和控制事件后唤醒它;表面获取不使用定时器轮询。就绪前可以将操作入队;超出额度的普通操作被拒绝,包括控制消息。每个持有的租约均预留一个 discard 队列位置,因此队列满时仍可归还表面。等待额度的获取操作不会阻塞工作线程执行。获取超时仅拒绝该请求,不关闭生产者。传输故障或无法确认 GPU 完成的错误会关闭连接。`closed` 在排队操作全部完成,且工作线程、客户端和引擎销毁后解决。事件监听器异常被隔离;监听器自行负责诊断。Worker 终止通过异步原生清理处理。 设置 `DSH_RENDER_DIAGNOSTICS=1` 可将已隔离的生产者回调异常报告到 stderr。
31
+ 专用原生工作线程串行执行连接、上传、引擎回调、锁等待及提交。独立轮询线程收到信用和控制事件后唤醒它;表面获取不使用定时器轮询。就绪前可以将操作入队;超出额度的普通操作被拒绝,包括控制消息。每个持有的租约均预留一个 discard 队列位置,因此队列满时仍可归还表面。等待额度的获取操作不会阻塞工作线程执行。获取超时仅拒绝该请求,不关闭生产者。传输故障或无法确认 GPU 完成的错误会关闭连接。`closed` 在排队操作全部完成,且工作线程、客户端和引擎销毁后解决。事件监听器异常被隔离;监听器自行负责诊断。Worker 终止通过异步原生清理处理。 设置 `DSH_FRAME_FORWARDING_DIAGNOSTICS=1` 可将已隔离的生产者回调异常报告到 stderr。
32
32
 
33
33
  `acquire(width, height)` 返回显式表面租约。等待 `writeBgra(buffer, stride)` 或 `render()`,再调用 `submit(frameId, metadata)` 或 `discard()`;表面的 `close()` 等同于 discard。忙碌或已消费的表面拒绝复用。垃圾回收不会归还帧额度。提交消耗租约,但底层纹理仍须等待接收端释放该帧后才可复用。
34
34
 
35
35
  CPU 上传借用非共享的 Node Buffer,直到返回的 promise 完成。在此期间,调用者不得修改 Buffer、分离其底层 ArrayBuffer 或转移所有权。行跨度可以大于紧密排列的行宽。绑定层持有 Buffer,省去绑定层的中间复制;C SDK 仍需复制或上传像素。CPU 上传不属于 GPU 零拷贝。
36
36
 
37
- 持续 GPU 渲染需要提供由另一 Node addon 通过 [dsh_render_node.h](include/dsh_render_node.h) 导出的引擎。[引擎回调](include/dsh_render_engine.h) 在生产者工作线程上串行运行,描述符保留至引擎销毁。`render` 借用已获取的原生纹理,并在返回前释放导入对象。Windows 回调在所提供设备的即时上下文上排队命令,由 SDK 持有 key 0;回调不得重复获取该锁。macOS 回调在返回前完成 GPU 工作。两者都须遵守取消回调。第三方回调必须及时返回;SDK 无法抢占任意引擎代码。引擎创建、更新和销毁不得调用 JavaScript。
37
+ 持续 GPU 渲染需要提供由另一 Node addon 通过 [dsh_frame_forwarding_node.h](include/dsh_frame_forwarding_node.h) 导出的引擎。[引擎回调](include/dsh_frame_forwarding_engine.h) 在生产者工作线程上串行运行,描述符保留至引擎销毁。`render` 借用已获取的原生纹理,并在返回前释放导入对象。Windows 回调在所提供设备的即时上下文上排队命令,由 SDK 持有 key 0;回调不得重复获取该锁。macOS 回调在返回前完成 GPU 工作。两者都须遵守取消回调。第三方回调必须及时返回;SDK 无法抢占任意引擎代码。引擎创建、更新和销毁不得调用 JavaScript。
38
38
 
39
39
  `start({ width, height, generation, frameIntervalMs })` 在原生代码中持续渲染;`update(json, inputSequence)` 批量更新引擎状态,`stop()` 停止新帧。帧间隔包含渲染耗时,支持 `1000 / 60` 等小数;已过的截止时刻会被跳过,不会突发补帧。启动前必须释放手动租约。帧元数据包含请求 ID、视口代次、修订号和最新应用的输入序列。
40
40
 
@@ -44,17 +44,17 @@ CPU 上传借用非共享的 Node Buffer,直到返回的 promise 完成。在
44
44
 
45
45
  ## C/C++ 生产者
46
46
 
47
- 包含 `include/dsh_render.h` 并链接对应的 `libdsh_render_sdk.a` 或 `dsh_render_sdk.lib`,也可以构建 `sdk.json` 列出的源码。API 不依赖 Node 或 Electron。仅一个线程执行轮询;获取、写入、提交和归还表面可以在另一线程执行。调用者必须串行使用同一图形上下文。先中断轮询并等待该线程退出,所有 API 调用返回后再关闭客户端。
47
+ 包含 `include/dsh_frame_forwarding.h` 并链接对应的 `libdsh_frame_forwarding_sdk.a` 或 `dsh_frame_forwarding_sdk.lib`,也可以构建 `sdk.json` 列出的源码。API 不依赖 Node 或 Electron。仅一个线程执行轮询;获取、写入、提交和归还表面可以在另一线程执行。调用者必须串行使用同一图形上下文。先中断轮询并等待该线程退出,所有 API 调用返回后再关闭客户端。
48
48
 
49
- 在 Windows 上,`dsh_render_connect_with_device` 接受应用的 `ID3D11Device`,并保留引用至关闭。传入空值或使用 `dsh_render_connect` 会创建默认设备。`dsh_render_connect_with_options` 还限制连接及握手时长,并接受在连接线程执行的取消回调。应用自行选择 GPU,DSH 选择传输方式。使用被接管设备的即时上下文时须与 SDK 写入串行执行。macOS 要求传入空设备。
49
+ 在 Windows 上,`dsh_frame_forwarding_connect_with_device` 接受应用的 `ID3D11Device`,并保留引用至关闭。传入空值或使用 `dsh_frame_forwarding_connect` 会创建默认设备。`dsh_frame_forwarding_connect_with_options` 还限制连接及握手时长,并接受在连接线程执行的取消回调。应用自行选择 GPU,DSH 选择传输方式。使用被接管设备的即时上下文时须与 SDK 写入串行执行。macOS 要求传入空设备。
50
50
 
51
51
  首次获取表面时返回空值,等待接收端授予分配额度。轮询后在所属应用适合的时机重试,不得忙等。分配请求进入共享 FIFO 预算队列。额度同时覆盖闲置池和显示中的帧。其他获取空值表示额度不足;终止性分配错误由轮询返回 `kind = -1` 和说明文本。轮询返回负数时停止处理,并在关闭前保留诊断信息。消费者必须限制操作总时长,超时后断开连接。
52
52
 
53
- 纹理采用左上原点、sRGB、BGRA8 预乘像素。Windows 表面带有使用 key 0 的 keyed mutex。获取租约不加锁:SDK CPU 上传和引擎回调持有写锁;外部 GPU 写入方通过 `dsh_render_surface_keyed_mutex` 或导入 API 自行持锁。写入方将命令排队后释放 key 0,并在提交或归还前释放导入对象和视图。CPU 上传在返回前复制输入,不等待 GPU 完成;`dsh_render_write_bgra_with_timeout` 限制锁获取时间。`AcquireSync` 可能阻塞 CPU。macOS 写入方必须在提交或归还前完成 GPU 工作。复用表面需要重新获取租约,Windows 上还必须取得写锁。GPU 访问释放失败时,应关闭连接,不得复用表面。
53
+ 纹理采用左上原点、sRGB、BGRA8 预乘像素。Windows 表面带有使用 key 0 的 keyed mutex。获取租约不加锁:SDK CPU 上传和引擎回调持有写锁;外部 GPU 写入方通过 `dsh_frame_forwarding_surface_keyed_mutex` 或导入 API 自行持锁。写入方将命令排队后释放 key 0,并在提交或归还前释放导入对象和视图。CPU 上传在返回前复制输入,不等待 GPU 完成;`dsh_frame_forwarding_write_bgra_with_timeout` 限制锁获取时间。`AcquireSync` 可能阻塞 CPU。macOS 写入方必须在提交或归还前完成 GPU 工作。复用表面需要重新获取租约,Windows 上还必须取得写锁。GPU 访问释放失败时,应关闭连接,不得复用表面。
54
54
 
55
- 帧 ID 必须是 1 到 9007199254740991 之间的整数,且在尚未释放的提交中唯一。`dsh_render_submit` 提交成功返回 1,失败返回 0。提交失败后,有效的获取仍归调用方所有,可在满足相同 GPU 完成要求后重试或归还。
55
+ 帧 ID 必须是 1 到 9007199254740991 之间的整数,且在尚未释放的提交中唯一。`dsh_frame_forwarding_submit` 提交成功返回 1,失败返回 0。提交失败后,有效的获取仍归调用方所有,可在满足相同 GPU 完成要求后重试或归还。
56
56
 
57
- Windows Vulkan 和 D3D12 消费者在表面获取期间,通过 `dsh_render_surface_shared_handle` 借用 NT 句柄。消费者必须使用 SDK 所在的 GPU 适配器,并在导入 API 中启用 keyed mutex 同步,遵守上述所有权规则。句柄归 SDK 所有,调用方不得关闭。macOS 上该函数返回空值。接收端复制会在实际纹理描述符声明 keyed mutex 时有界获取源锁;旧纹理仍要求写入已经完成。
57
+ Windows Vulkan 和 D3D12 消费者在表面获取期间,通过 `dsh_frame_forwarding_surface_shared_handle` 借用 NT 句柄。消费者必须使用 SDK 所在的 GPU 适配器,并在导入 API 中启用 keyed mutex 同步,遵守上述所有权规则。句柄归 SDK 所有,调用方不得关闭。macOS 上该函数返回空值。接收端复制会在实际纹理描述符声明 keyed mutex 时有界获取源锁;旧纹理仍要求写入已经完成。
58
58
 
59
59
  应用 JSON、帧关联、输入语义、视口代次及输入确认由消费者协议定义。控制消息上限为 16383 个 UTF-8 字节。SDK 不向网页暴露任意进程启动或原生句柄。
60
60
 
@@ -62,22 +62,22 @@ Windows Vulkan 和 D3D12 消费者在表面获取期间,通过 `dsh_render_sur
62
62
 
63
63
  在目标平台运行 `node scripts/build.mjs`,并提供完整且匹配的 Node 头文件。SDK 版本读取公开 Kit 包元数据。需要时显式设置 `DSH_NODE_INCLUDE`;Windows 还需要开发者工具链环境和 `DSH_NODE_LIB`。构建产出预编译 Node-API 插件、静态 SDK 及 SHA-256 回执。正常安装不调用编译器。公开 Kit 打包必须包含同一源码提交的四个平台,不能打包局部产物。校验同时检查插件和静态库架构、二进制和源码哈希、版本及协议。Desktop 运行时仅保留目标平台插件和必要元数据、许可证。
64
64
 
65
- 构建后在本目录运行 `pnpm test`。测试沿用串行范围,覆盖 C 传输、Node 生产者、异步关闭及 Worker 终止。`DSH_NATIVE_RENDER_PACKAGE_ROOT` 可选择已安装 SDK,`DSH_NATIVE_RENDER_DIAGNOSTICS` 可将失败诊断保留到包外目录。性能及 Electron 共享纹理导入仍需实际 GPU 验证。
65
+ 构建后在本目录运行 `pnpm test`。测试沿用串行范围,覆盖 C 传输、Node 生产者、异步关闭及 Worker 终止。`DSH_FRAME_FORWARDING_PACKAGE_ROOT` 可选择已安装 SDK,`DSH_FRAME_FORWARDING_DIAGNOSTICS` 可将失败诊断保留到包外目录。性能及 Electron 共享纹理导入仍需实际 GPU 验证。
66
66
 
67
67
  ## 浏览器与 Electron 呈现
68
68
 
69
- `@deepseek-ai/libreoffice-kit/native-render/browser` 导出 `NativeFrameDisplay`、`createNativeFramePainter` 及其类型。导入此入口不会加载 Electron、Office 或原生 addon,也不会分配图形资源。泛型视图标识保留应用定义的字符串类型。应用负责视图创建、鉴权、生产者控制和输入仲裁。
69
+ `@deepseek-ai/libreoffice-kit/frame-forwarding/browser` 导出 `FrameForwardingFrameDisplay`、`createFrameForwardingFramePainter` 及其类型。导入此入口不会加载 Electron、Office 或原生 addon,也不会分配图形资源。泛型视图标识保留应用定义的字符串类型。应用负责视图创建、鉴权、生产者控制和输入仲裁。
70
70
 
71
- `NativeFrameDisplay.present()` 接管帧租约,在绘制或拒绝后释放。隐藏文档等待恢复可见;代次变化或销毁会取消等待。所属应用另行更新生产者的可见性。移除画布前先销毁 display。
71
+ `FrameForwardingFrameDisplay.present()` 接管帧租约,在绘制或拒绝后释放。隐藏文档等待恢复可见;代次变化或销毁会取消等待。所属应用另行更新生产者的可见性。移除画布前先销毁 display。
72
72
 
73
- `@deepseek-ai/libreoffice-kit/native-render/electron` 为 Electron Main 导出 `detectNativeRenderAdapter` 和 `sendNativeFrame`。适配器探测在同一指定期限内等待 Chromium 完整 GPU 信息,并观察其导出的 Direct3D11 纹理。不支持的后端或软件合成模式会返回 `null`,不创建离屏窗口。取消操作同时覆盖 GPU 初始化和窗口构造。应用验证接收方和帧元数据后,`sendNativeFrame` 接管交付信用,直至提交失败或 Electron 释放最后一个 GPU 引用。其完成不代表 GPU 已释放。必需的失败回调在 Main 释放导入引用或归还交付信用前同步停止生产者 I/O;随后提交 Promise 拒绝。
73
+ `@deepseek-ai/libreoffice-kit/frame-forwarding/electron` 为 Electron Main 导出 `detectFrameForwardingAdapter` 和 `sendFrameForwardingFrame`。适配器探测在同一指定期限内等待 Chromium 完整 GPU 信息,并观察其导出的 Direct3D11 纹理。不支持的后端或软件合成模式会返回 `null`,不创建离屏窗口。取消操作同时覆盖 GPU 初始化和窗口构造。应用验证接收方和帧元数据后,`sendFrameForwardingFrame` 接管交付信用,直至提交失败或 Electron 释放最后一个 GPU 引用。其完成不代表 GPU 已释放。必需的失败回调在 Main 释放导入引用或归还交付信用前同步停止生产者 I/O;随后提交 Promise 拒绝。
74
74
 
75
- `@deepseek-ai/libreoffice-kit/native-render/electron/preload` 为沙箱 preload 导出 `createNativeTextureReceiver`。打包此入口时将 Electron 保持为外部依赖,并在启动生产前安装文档唯一的接收器。每个视图最多注册一个监听器。取消订阅和撤销只停止未来交付;消费者显式释放前仍持有已交付租约。无消费者、提取帧失败或监听器抛错均会释放导入纹理。调用方负责 IPC 鉴权和应用生命周期。
75
+ `@deepseek-ai/libreoffice-kit/frame-forwarding/electron/preload` 为沙箱 preload 导出 `createFrameForwardingTextureReceiver`。打包此入口时将 Electron 保持为外部依赖,并在启动生产前安装文档唯一的接收器。每个视图最多注册一个监听器。取消订阅和撤销只停止未来交付;消费者显式释放前仍持有已交付租约。无消费者、提取帧失败或监听器抛错均会释放导入纹理。调用方负责 IPC 鉴权和应用生命周期。
76
76
 
77
77
  ## 分发
78
78
 
79
79
  公开 Kit 包独立提供 Node SDK、SDK 元数据、校验器、browser 和 Electron 入口。以 SDK JSON 所在目录为根解析 `header`、`sources` 和 `staticLibraries[target]`。原生渲染无需 LibreOffice 引擎,只使用此功能时可用 `--omit=optional` 安装 Kit。正常安装和运行使用包内插件,不编译或下载额外原生二进制。
80
80
 
81
- 浏览器绘制器、display、Electron 适配器探测及通用纹理所有权测试源自 DeepSeek Harness 提交 `21261bee8b9a820c62c9e42cade3ff644b747a29` 的 `packages/client/native-render` 与 `apps/desktop`。单元测试随实现维护;DSH 保留产品集成测试。
81
+ 浏览器绘制器、display、Electron 适配器探测及通用纹理所有权测试源自 DeepSeek Harness 提交 `21261bee8b9a820c62c9e42cade3ff644b747a29` 的 `packages/client/frame-forwarding` 与 `apps/desktop`。单元测试随实现维护;DSH 保留产品集成测试。
82
82
 
83
83
  MIT SDK 来自 DeepSeek Harness 提交 `4438b67c13d529c9882d89893ed5cd610ace11cc`,WebGPU 适配器保留 LibreOffice Kit 提交 `2ae2de8c7e88df00e74ee538ebd5662f47c7a1df` 的 Office 修复。Node 绑定、独立 C SDK 与 Kit 引擎使用同一源码目录。协议版本 1 及引擎 ABI 版本 1、2 保持不变。
@@ -1,100 +1,100 @@
1
- #ifndef DSH_RENDER_H
2
- #define DSH_RENDER_H
1
+ #ifndef DSH_FRAME_FORWARDING_H
2
+ #define DSH_FRAME_FORWARDING_H
3
3
  #include <stddef.h>
4
4
  #include <stdint.h>
5
5
  #ifdef __cplusplus
6
6
  extern "C" {
7
7
  #endif
8
- #define DSH_RENDER_PROTOCOL_VERSION 1
9
- #define DSH_RENDER_TEXT_CAPACITY 16384
8
+ #define DSH_FRAME_FORWARDING_PROTOCOL_VERSION 1
9
+ #define DSH_FRAME_FORWARDING_TEXT_CAPACITY 16384
10
10
  /** Opaque connected producer. One thread may poll while another acquires, writes,
11
11
  * submits or discards. Callers must serialize use of the same graphics context.
12
12
  */
13
- typedef struct dsh_render_client dsh_render_client;
13
+ typedef struct dsh_frame_forwarding_client dsh_frame_forwarding_client;
14
14
  /** Pool-owned surface. Borrowed resources and imported objects are usable only
15
15
  * during the acquisition; never destroy the SDK-owned resource.
16
16
  */
17
- typedef struct dsh_render_surface dsh_render_surface;
17
+ typedef struct dsh_frame_forwarding_surface dsh_frame_forwarding_surface;
18
18
  /** kind: 0 credit/timeout, 1 incoming JSON, -1 closed/error.
19
19
  * Terminal events carry diagnostic text when available.
20
20
  */
21
- typedef struct dsh_render_event { int kind; char text[DSH_RENDER_TEXT_CAPACITY]; } dsh_render_event;
21
+ typedef struct dsh_frame_forwarding_event { int kind; char text[DSH_FRAME_FORWARDING_TEXT_CAPACITY]; } dsh_frame_forwarding_event;
22
22
  /** Connect to a private receiver. Blocks until the receiver binds this process. */
23
- dsh_render_client* dsh_render_connect(const char* endpoint, char* error, size_t error_size);
23
+ dsh_frame_forwarding_client* dsh_frame_forwarding_connect(const char* endpoint, char* error, size_t error_size);
24
24
  /** Connect using the application's ID3D11Device on Windows; NULL selects the default
25
25
  * device. The client retains a device reference until close. macOS requires NULL.
26
26
  * Serialize the device's immediate context with all SDK writes.
27
27
  */
28
- dsh_render_client* dsh_render_connect_with_device(const char* endpoint, void* device, char* error, size_t error_size);
28
+ dsh_frame_forwarding_client* dsh_frame_forwarding_connect_with_device(const char* endpoint, void* device, char* error, size_t error_size);
29
29
  /** Bounded connection options. cancelled is optional and runs on the connecting
30
30
  * thread; its context must remain alive until connect_with_options returns.
31
31
  */
32
- typedef struct dsh_render_connect_options {
32
+ typedef struct dsh_frame_forwarding_connect_options {
33
33
  void* device;
34
34
  uint32_t timeout_ms;
35
35
  void* cancellation_context;
36
36
  int (*cancelled)(void*);
37
- } dsh_render_connect_options;
37
+ } dsh_frame_forwarding_connect_options;
38
38
  /** Connect with a positive timeout and optional cancellation, including PID bind
39
39
  * waiting. Device ownership and platform rules match connect_with_device.
40
40
  */
41
- dsh_render_client* dsh_render_connect_with_options(const char* endpoint,
42
- const dsh_render_connect_options* options, char* error, size_t error_size);
41
+ dsh_frame_forwarding_client* dsh_frame_forwarding_connect_with_options(const char* endpoint,
42
+ const dsh_frame_forwarding_connect_options* options, char* error, size_t error_size);
43
43
  /** Acquire BGRA8 premultiplied top-left pixels; NULL means allocation pending or no credit; poll reports terminal allocation errors. */
44
- dsh_render_surface* dsh_render_acquire(dsh_render_client* client, uint32_t width, uint32_t height);
44
+ dsh_frame_forwarding_surface* dsh_frame_forwarding_acquire(dsh_frame_forwarding_client* client, uint32_t width, uint32_t height);
45
45
  /** Borrow an IOSurfaceRef (macOS) or ID3D11Texture2D* (Windows) while acquired.
46
46
  * Windows external writers acquire/release key 0 around GPU commands (see
47
47
  * surface_keyed_mutex); macOS writers complete GPU writes before submit/discard.
48
48
  * Release imported objects/views before ending the acquisition.
49
49
  */
50
- void* dsh_render_surface_native(dsh_render_surface* surface);
50
+ void* dsh_frame_forwarding_surface_native(dsh_frame_forwarding_surface* surface);
51
51
  /** Borrow the Windows shared NT handle while this surface is acquired; NULL on macOS.
52
52
  * Do not close the borrowed handle. External imports must synchronize with key 0
53
53
  * and release access and imported objects before submit/discard.
54
54
  */
55
- void* dsh_render_surface_shared_handle(dsh_render_surface* surface);
55
+ void* dsh_frame_forwarding_surface_shared_handle(dsh_frame_forwarding_surface* surface);
56
56
  /** Return the ID3D11Device* borrowed until client close, or NULL on macOS.
57
57
  * External GPU imports must use the same adapter as this device.
58
58
  */
59
- void* dsh_render_device(dsh_render_client* client);
59
+ void* dsh_frame_forwarding_device(dsh_frame_forwarding_client* client);
60
60
  /** Borrow the acquired Windows surface's IDXGIKeyedMutex, or NULL on macOS.
61
61
  * acquire itself never locks. External writers acquire key 0 before issuing GPU
62
62
  * commands and release key 0 before submit/discard, without waiting for completion.
63
63
  * SDK write_bgra and engine render own this lock; do not lock around those calls.
64
64
  * Do not release the borrowed COM reference. AcquireSync may block the CPU.
65
65
  */
66
- void* dsh_render_surface_keyed_mutex(dsh_render_surface* surface);
66
+ void* dsh_frame_forwarding_surface_keyed_mutex(dsh_frame_forwarding_surface* surface);
67
67
  /** Copy CPU BGRA rows; return 1 on success, 0 on failure.
68
68
  * Windows acquires key 0 with a 1000 ms timeout and releases it after enqueueing
69
69
  * the upload. Input memory may be reused on return; GPU completion is asynchronous.
70
70
  */
71
- int dsh_render_write_bgra(dsh_render_surface* surface, const void* pixels, size_t stride);
71
+ int dsh_frame_forwarding_write_bgra(dsh_frame_forwarding_surface* surface, const void* pixels, size_t stride);
72
72
  /** CPU upload with a positive keyed-mutex acquisition timeout. Failure leaves completion
73
73
  * uncertain; close the client without discarding or reusing the acquisition.
74
74
  */
75
- int dsh_render_write_bgra_with_timeout(dsh_render_surface* surface, const void* pixels, size_t stride, uint32_t timeout_ms);
75
+ int dsh_frame_forwarding_write_bgra_with_timeout(dsh_frame_forwarding_surface* surface, const void* pixels, size_t stride, uint32_t timeout_ms);
76
76
  /** Submit after Windows GPU writes are queued and the writer released key 0;
77
77
  * macOS GPU writes must be complete. Release all imported objects/views first.
78
78
  * frame_id must be 1..9007199254740991 and unique among outstanding submissions.
79
79
  * Return 1 on submission; the surface cannot be reused until it is reacquired.
80
80
  * Return 0 on failure; a valid acquisition stays with the caller for retry or discard.
81
81
  */
82
- int dsh_render_submit(dsh_render_client* client, dsh_render_surface* surface, uint64_t frame_id, const char* metadata_json);
82
+ int dsh_frame_forwarding_submit(dsh_frame_forwarding_client* client, dsh_frame_forwarding_surface* surface, uint64_t frame_id, const char* metadata_json);
83
83
  /** Return an acquired, unsubmitted surface under the same GPU ownership rules as
84
84
  * submit. If releasing GPU access failed, terminate the connection instead of
85
85
  * discarding. The next writer must acquire key 0 even after a discard.
86
86
  */
87
- void dsh_render_discard(dsh_render_client* client, dsh_render_surface* surface);
87
+ void dsh_frame_forwarding_discard(dsh_frame_forwarding_client* client, dsh_frame_forwarding_surface* surface);
88
88
  /** Poll and apply credits; return event->kind. Only one thread may poll at a time.
89
89
  * A negative result ends processing; preserve any diagnostic text before closing.
90
90
  */
91
- int dsh_render_poll(dsh_render_client* client, uint32_t timeout_ms, dsh_render_event* event);
91
+ int dsh_frame_forwarding_poll(dsh_frame_forwarding_client* client, uint32_t timeout_ms, dsh_frame_forwarding_event* event);
92
92
  /** Send application JSON to the receiver; never sends pixel bytes. */
93
- int dsh_render_send(dsh_render_client* client, const char* json);
93
+ int dsh_frame_forwarding_send(dsh_frame_forwarding_client* client, const char* json);
94
94
  /** Interrupt polling without freeing client. Join polling thread before close. */
95
- void dsh_render_interrupt(dsh_render_client* client);
95
+ void dsh_frame_forwarding_interrupt(dsh_frame_forwarding_client* client);
96
96
  /** Destroy producer after all its API calls have returned. Receiver references stay valid. */
97
- void dsh_render_close(dsh_render_client* client);
97
+ void dsh_frame_forwarding_close(dsh_frame_forwarding_client* client);
98
98
  #ifdef __cplusplus
99
99
  }
100
100
  #endif
@@ -1,12 +1,12 @@
1
- #ifndef DSH_RENDER_ENGINE_H
2
- #define DSH_RENDER_ENGINE_H
1
+ #ifndef DSH_FRAME_FORWARDING_ENGINE_H
2
+ #define DSH_FRAME_FORWARDING_ENGINE_H
3
3
  #include <stddef.h>
4
4
  #include <stdint.h>
5
5
  #ifdef __cplusplus
6
6
  extern "C" {
7
7
  #endif
8
8
  /** A borrowed GPU target valid only during render(). Native objects never enter JS. */
9
- typedef struct dsh_render_target {
9
+ typedef struct dsh_frame_forwarding_target {
10
10
  void* texture; /* IOSurfaceRef on macOS; ID3D11Texture2D* on Windows. */
11
11
  void* shared_handle; /* Borrowed Windows NT handle; NULL on macOS. */
12
12
  void* device; /* Borrowed ID3D11Device*; NULL on macOS. */
@@ -15,7 +15,7 @@ typedef struct dsh_render_target {
15
15
  double time_seconds; /* Monotonic time since this producer was created. */
16
16
  void* cancellation_context;
17
17
  int (*cancelled)(void*); /* Close or operation deadline; callable from this worker. */
18
- } dsh_render_target;
18
+ } dsh_frame_forwarding_target;
19
19
  /** Native engine adapter ABI v1. The factory and its configuration outlive the
20
20
  * producer. Every callback runs serially on that producer's native worker.
21
21
  * create/destroy own one engine instance; device returns its borrowed D3D11
@@ -28,24 +28,24 @@ typedef struct dsh_render_target {
28
28
  * instead of reusing a target whose completion is uncertain. Long-running work
29
29
  * must observe target.cancelled. No callback may throw across this C ABI.
30
30
  */
31
- typedef struct dsh_render_engine_v1 {
31
+ typedef struct dsh_frame_forwarding_engine_v1 {
32
32
  uint32_t version, size;
33
33
  void* configuration;
34
34
  void* (*create)(void* configuration, char* error, size_t error_size);
35
35
  void (*destroy)(void* engine);
36
36
  void* (*device)(void* engine);
37
37
  int (*update)(void* engine, const char* json, char* error, size_t error_size);
38
- int (*render)(void* engine, const dsh_render_target* target, char* error, size_t error_size);
39
- } dsh_render_engine_v1;
38
+ int (*render)(void* engine, const dsh_frame_forwarding_target* target, char* error, size_t error_size);
39
+ } dsh_frame_forwarding_engine_v1;
40
40
  /** Surface-free frame information borrowed during prepare(). */
41
- typedef struct dsh_render_frame_info {
41
+ typedef struct dsh_frame_forwarding_frame_info {
42
42
  uint32_t width, height;
43
43
  uint64_t input_sequence;
44
44
  double time_seconds;
45
45
  void* cancellation_context;
46
46
  int (*cancelled)(void*);
47
- } dsh_render_frame_info;
48
- /** Engine ABI v2: base.version is 2 and base.size is sizeof(dsh_render_engine_v2).
47
+ } dsh_frame_forwarding_frame_info;
48
+ /** Engine ABI v2: base.version is 2 and base.size is sizeof(dsh_frame_forwarding_engine_v2).
49
49
  * The v1 callbacks and ownership rules are unchanged. prepare runs on the same
50
50
  * worker before acquiring a surface: 1 declares a changed frame, 0 declares no
51
51
  * change, and -1 reports failure with diagnostic text. It must honor cancelled
@@ -56,10 +56,10 @@ typedef struct dsh_render_frame_info {
56
56
  * resizing a stream forces one render even when prepare reports no change.
57
57
  * Manual surface.render() invokes base.render directly, without prepare.
58
58
  */
59
- typedef struct dsh_render_engine_v2 {
60
- dsh_render_engine_v1 base;
61
- int (*prepare)(void* engine, const dsh_render_frame_info* frame, char* error, size_t error_size);
62
- } dsh_render_engine_v2;
59
+ typedef struct dsh_frame_forwarding_engine_v2 {
60
+ dsh_frame_forwarding_engine_v1 base;
61
+ int (*prepare)(void* engine, const dsh_frame_forwarding_frame_info* frame, char* error, size_t error_size);
62
+ } dsh_frame_forwarding_engine_v2;
63
63
  #ifdef __cplusplus
64
64
  }
65
65
  #endif
@@ -1,27 +1,27 @@
1
- #ifndef DSH_RENDER_NODE_H
2
- #define DSH_RENDER_NODE_H
1
+ #ifndef DSH_FRAME_FORWARDING_NODE_H
2
+ #define DSH_FRAME_FORWARDING_NODE_H
3
3
  #include <node_api.h>
4
- #include "dsh_render_engine.h"
4
+ #include "dsh_frame_forwarding_engine.h"
5
5
  /** Shared type tag for engine objects produced by cooperating native addons. */
6
- static const napi_type_tag dsh_render_engine_tag = {0xe1910c31bb654d4aULL, 0x9c30d42b2c88ee15ULL};
6
+ static const napi_type_tag dsh_frame_forwarding_engine_tag = {0xe1910c31bb654d4aULL, 0x9c30d42b2c88ee15ULL};
7
7
  /** Export a native engine factory as an opaque JS object. The descriptor and its
8
8
  * configuration must remain alive until finalize runs. The producer retains the
9
9
  * object through native teardown. The addon supplying callbacks must remain
10
10
  * loaded for the object's lifetime. No graphics work runs in this helper.
11
11
  */
12
- static inline napi_status dsh_render_export_engine(napi_env env, dsh_render_engine_v1* factory,
12
+ static inline napi_status dsh_frame_forwarding_export_engine(napi_env env, dsh_frame_forwarding_engine_v1* factory,
13
13
  napi_finalize finalize, void* hint, napi_value* result) {
14
14
  napi_status status = napi_create_object(env, result);
15
15
  if (status == napi_ok) status = napi_wrap(env, *result, factory, finalize, hint, NULL);
16
16
  if (status == napi_ok) {
17
- status = napi_type_tag_object(env, *result, &dsh_render_engine_tag);
17
+ status = napi_type_tag_object(env, *result, &dsh_frame_forwarding_engine_tag);
18
18
  if (status != napi_ok) { void* removed = NULL; napi_remove_wrap(env, *result, &removed); }
19
19
  }
20
20
  return status;
21
21
  }
22
22
  /** Export v2 with the same descriptor, configuration, and addon lifetime as v1. */
23
- static inline napi_status dsh_render_export_engine_v2(napi_env env, dsh_render_engine_v2* factory,
23
+ static inline napi_status dsh_frame_forwarding_export_engine_v2(napi_env env, dsh_frame_forwarding_engine_v2* factory,
24
24
  napi_finalize finalize, void* hint, napi_value* result) {
25
- return dsh_render_export_engine(env, &factory->base, finalize, hint, result);
25
+ return dsh_frame_forwarding_export_engine(env, &factory->base, finalize, hint, result);
26
26
  }
27
27
  #endif