@binblink/wasmnest-plugin-sdk-desktop 0.0.1 → 0.0.2

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 (219) hide show
  1. package/README.md +24 -4
  2. package/README_en.md +1 -1
  3. package/bin/cli.js +5 -5
  4. package/bin/manifest-gen.js +4 -0
  5. package/bin/manifest-validate.js +68 -6
  6. package/bin/permission-vocabulary.json +2 -2
  7. package/dev-shell/README.md +6 -5
  8. package/dev-shell/src/loader.ts +0 -5
  9. package/dev-shell/src/mock/commands.ts +1 -1
  10. package/dev-shell/src/mock/domain-context.ts +1 -1
  11. package/dev-shell/src/shell/types.ts +21 -32
  12. package/dev-shell/src/styles/shell.css +208 -2
  13. package/dev-shell/src/styles/style.css +72 -26
  14. package/dist/index.d.ts +44 -3
  15. package/dist/index.js +69 -1
  16. package/dist/types.d.ts +52 -5
  17. package/go/.gitignore +5 -0
  18. package/go/README.md +80 -0
  19. package/go/gen/wasmnest/api-call/host-api-call/empty.s +3 -0
  20. package/go/gen/wasmnest/api-call/host-api-call/host-api-call.wasm.go +13 -0
  21. package/go/gen/wasmnest/api-call/host-api-call/host-api-call.wit.go +34 -0
  22. package/go/gen/wasmnest/app/host-app/empty.s +3 -0
  23. package/go/gen/wasmnest/app/host-app/host-app.wasm.go +29 -0
  24. package/go/gen/wasmnest/app/host-app/host-app.wit.go +108 -0
  25. package/go/gen/wasmnest/auth-center/host-auth-center/abi.go +14 -0
  26. package/go/gen/wasmnest/auth-center/host-auth-center/empty.s +3 -0
  27. package/go/gen/wasmnest/auth-center/host-auth-center/host-auth-center.wasm.go +49 -0
  28. package/go/gen/wasmnest/auth-center/host-auth-center/host-auth-center.wit.go +225 -0
  29. package/go/gen/wasmnest/clipboard/host-clipboard/abi.go +14 -0
  30. package/go/gen/wasmnest/clipboard/host-clipboard/empty.s +3 -0
  31. package/go/gen/wasmnest/clipboard/host-clipboard/host-clipboard.wasm.go +17 -0
  32. package/go/gen/wasmnest/clipboard/host-clipboard/host-clipboard.wit.go +68 -0
  33. package/go/gen/wasmnest/connection-registry/host-connection-registry/empty.s +3 -0
  34. package/go/gen/wasmnest/connection-registry/host-connection-registry/host-connection-registry.wasm.go +13 -0
  35. package/go/gen/wasmnest/connection-registry/host-connection-registry/host-connection-registry.wit.go +50 -0
  36. package/go/gen/wasmnest/crypto/host-crypto/abi.go +18 -0
  37. package/go/gen/wasmnest/crypto/host-crypto/empty.s +3 -0
  38. package/go/gen/wasmnest/crypto/host-crypto/host-crypto.wasm.go +37 -0
  39. package/go/gen/wasmnest/crypto/host-crypto/host-crypto.wit.go +139 -0
  40. package/go/gen/wasmnest/fs-desktop/host-fs-desktop/abi.go +14 -0
  41. package/go/gen/wasmnest/fs-desktop/host-fs-desktop/empty.s +3 -0
  42. package/go/gen/wasmnest/fs-desktop/host-fs-desktop/host-fs-desktop.wasm.go +21 -0
  43. package/go/gen/wasmnest/fs-desktop/host-fs-desktop/host-fs-desktop.wit.go +62 -0
  44. package/go/gen/wasmnest/http/host-http/abi.go +14 -0
  45. package/go/gen/wasmnest/http/host-http/empty.s +3 -0
  46. package/go/gen/wasmnest/http/host-http/host-http.wasm.go +13 -0
  47. package/go/gen/wasmnest/http/host-http/host-http.wit.go +40 -0
  48. package/go/gen/wasmnest/http-endpoint/host-http-endpoint/empty.s +3 -0
  49. package/go/gen/wasmnest/http-endpoint/host-http-endpoint/host-http-endpoint.wasm.go +17 -0
  50. package/go/gen/wasmnest/http-endpoint/host-http-endpoint/host-http-endpoint.wit.go +69 -0
  51. package/go/gen/wasmnest/mdns/host-mdns/empty.s +3 -0
  52. package/go/gen/wasmnest/mdns/host-mdns/host-mdns.wasm.go +29 -0
  53. package/go/gen/wasmnest/mdns/host-mdns/host-mdns.wit.go +101 -0
  54. package/go/gen/wasmnest/notify/host-notify/empty.s +3 -0
  55. package/go/gen/wasmnest/notify/host-notify/host-notify.wasm.go +13 -0
  56. package/go/gen/wasmnest/notify/host-notify/host-notify.wit.go +64 -0
  57. package/go/gen/wasmnest/peer/host-peer/abi.go +14 -0
  58. package/go/gen/wasmnest/peer/host-peer/empty.s +3 -0
  59. package/go/gen/wasmnest/peer/host-peer/host-peer.wasm.go +85 -0
  60. package/go/gen/wasmnest/peer/host-peer/host-peer.wit.go +357 -0
  61. package/go/gen/wasmnest/platform-desktop/host-platform-desktop/empty.s +3 -0
  62. package/go/gen/wasmnest/platform-desktop/host-platform-desktop/host-platform-desktop.wasm.go +21 -0
  63. package/go/gen/wasmnest/platform-desktop/host-platform-desktop/host-platform-desktop.wit.go +70 -0
  64. package/go/gen/wasmnest/plugin/abi-form/abi-form.exports.go +11 -0
  65. package/go/gen/wasmnest/plugin/abi-form/abi-form.wasm.go +13 -0
  66. package/go/gen/wasmnest/plugin/abi-form/abi-form.wit.go +7 -0
  67. package/go/gen/wasmnest/plugin/abi-form/empty.s +3 -0
  68. package/go/gen/wasmnest/plugin/command/command.exports.go +11 -0
  69. package/go/gen/wasmnest/plugin/command/command.wasm.go +19 -0
  70. package/go/gen/wasmnest/plugin/command/command.wit.go +6 -0
  71. package/go/gen/wasmnest/plugin/command/empty.s +3 -0
  72. package/go/gen/wasmnest/plugin/events/empty.s +3 -0
  73. package/go/gen/wasmnest/plugin/events/events.exports.go +52 -0
  74. package/go/gen/wasmnest/plugin/events/events.wasm.go +74 -0
  75. package/go/gen/wasmnest/plugin/events/events.wit.go +195 -0
  76. package/go/gen/wasmnest/plugin/host-bus/empty.s +3 -0
  77. package/go/gen/wasmnest/plugin/host-bus/host-bus.wasm.go +29 -0
  78. package/go/gen/wasmnest/plugin/host-bus/host-bus.wit.go +94 -0
  79. package/go/gen/wasmnest/plugin/host-config/abi.go +14 -0
  80. package/go/gen/wasmnest/plugin/host-config/empty.s +3 -0
  81. package/go/gen/wasmnest/plugin/host-config/host-config.wasm.go +13 -0
  82. package/go/gen/wasmnest/plugin/host-config/host-config.wit.go +21 -0
  83. package/go/gen/wasmnest/plugin/host-events/empty.s +3 -0
  84. package/go/gen/wasmnest/plugin/host-events/host-events.wasm.go +9 -0
  85. package/go/gen/wasmnest/plugin/host-events/host-events.wit.go +27 -0
  86. package/go/gen/wasmnest/plugin/host-fs/abi.go +14 -0
  87. package/go/gen/wasmnest/plugin/host-fs/empty.s +3 -0
  88. package/go/gen/wasmnest/plugin/host-fs/host-fs.wasm.go +33 -0
  89. package/go/gen/wasmnest/plugin/host-fs/host-fs.wit.go +86 -0
  90. package/go/gen/wasmnest/plugin/host-log/empty.s +3 -0
  91. package/go/gen/wasmnest/plugin/host-log/host-log.wasm.go +25 -0
  92. package/go/gen/wasmnest/plugin/host-log/host-log.wit.go +65 -0
  93. package/go/gen/wasmnest/plugin/host-metrics/empty.s +3 -0
  94. package/go/gen/wasmnest/plugin/host-metrics/host-metrics.wasm.go +13 -0
  95. package/go/gen/wasmnest/plugin/host-metrics/host-metrics.wit.go +34 -0
  96. package/go/gen/wasmnest/plugin/host-platform/empty.s +3 -0
  97. package/go/gen/wasmnest/plugin/host-platform/host-platform.wasm.go +21 -0
  98. package/go/gen/wasmnest/plugin/host-platform/host-platform.wit.go +85 -0
  99. package/go/gen/wasmnest/plugin/host-plugin-database/abi.go +14 -0
  100. package/go/gen/wasmnest/plugin/host-plugin-database/empty.s +3 -0
  101. package/go/gen/wasmnest/plugin/host-plugin-database/host-plugin-database.wasm.go +29 -0
  102. package/go/gen/wasmnest/plugin/host-plugin-database/host-plugin-database.wit.go +70 -0
  103. package/go/gen/wasmnest/plugin/host-storage/abi.go +14 -0
  104. package/go/gen/wasmnest/plugin/host-storage/empty.s +3 -0
  105. package/go/gen/wasmnest/plugin/host-storage/host-storage.wasm.go +21 -0
  106. package/go/gen/wasmnest/plugin/host-storage/host-storage.wit.go +44 -0
  107. package/go/gen/wasmnest/plugin/host-worker/empty.s +3 -0
  108. package/go/gen/wasmnest/plugin/host-worker/host-worker.wasm.go +17 -0
  109. package/go/gen/wasmnest/plugin/host-worker/host-worker.wit.go +50 -0
  110. package/go/gen/wasmnest/plugin/lifecycle/empty.s +3 -0
  111. package/go/gen/wasmnest/plugin/lifecycle/lifecycle.exports.go +32 -0
  112. package/go/gen/wasmnest/plugin/lifecycle/lifecycle.wasm.go +41 -0
  113. package/go/gen/wasmnest/plugin/lifecycle/lifecycle.wit.go +9 -0
  114. package/go/gen/wasmnest/plugin/manifest/empty.s +3 -0
  115. package/go/gen/wasmnest/plugin/manifest/manifest.exports.go +11 -0
  116. package/go/gen/wasmnest/plugin/manifest/manifest.wasm.go +13 -0
  117. package/go/gen/wasmnest/plugin/manifest/manifest.wit.go +6 -0
  118. package/go/gen/wasmnest/plugin/plugin/plugin.wit.go +4 -0
  119. package/go/gen/wasmnest/process/host-process/empty.s +3 -0
  120. package/go/gen/wasmnest/process/host-process/host-process.wasm.go +21 -0
  121. package/go/gen/wasmnest/process/host-process/host-process.wit.go +56 -0
  122. package/go/gen/wasmnest/pty/host-pty/abi.go +14 -0
  123. package/go/gen/wasmnest/pty/host-pty/empty.s +3 -0
  124. package/go/gen/wasmnest/pty/host-pty/host-pty.wasm.go +33 -0
  125. package/go/gen/wasmnest/pty/host-pty/host-pty.wit.go +164 -0
  126. package/go/gen/wasmnest/task/host-task/abi.go +14 -0
  127. package/go/gen/wasmnest/task/host-task/empty.s +3 -0
  128. package/go/gen/wasmnest/task/host-task/host-task.wasm.go +29 -0
  129. package/go/gen/wasmnest/task/host-task/host-task.wit.go +110 -0
  130. package/go/gen/wasmnest/timer/host-timer/empty.s +3 -0
  131. package/go/gen/wasmnest/timer/host-timer/host-timer.wasm.go +13 -0
  132. package/go/gen/wasmnest/timer/host-timer/host-timer.wit.go +25 -0
  133. package/go/gen/wasmnest/ws/host-websocket/empty.s +3 -0
  134. package/go/gen/wasmnest/ws/host-websocket/host-websocket.wasm.go +29 -0
  135. package/go/gen/wasmnest/ws/host-websocket/host-websocket.wit.go +109 -0
  136. package/go/gen/wasmnest/ws-server/host-websocket-server/empty.s +3 -0
  137. package/go/gen/wasmnest/ws-server/host-websocket-server/host-websocket-server.wasm.go +49 -0
  138. package/go/gen/wasmnest/ws-server/host-websocket-server/host-websocket-server.wit.go +220 -0
  139. package/go/go.mod +14 -0
  140. package/go/go.sum +2 -0
  141. package/go/sdk/dispatch.go +49 -0
  142. package/go/sdk/dispatch_test.go +81 -0
  143. package/go/sdk/entry_native.go +13 -0
  144. package/go/sdk/entry_wasip2.go +188 -0
  145. package/go/sdk/host_http_wasip2.go +42 -0
  146. package/go/sdk/host_wasip2.go +251 -0
  147. package/go/sdk/plugin.go +103 -0
  148. package/go/testplugin/index.js +1 -0
  149. package/go/testplugin/main.go +67 -0
  150. package/go/testplugin/plugin.json +24 -0
  151. package/go/tools/assemble-wit.mjs +152 -0
  152. package/go/tools/gen-bindings.mjs +51 -0
  153. package/go/wit/core.wit +273 -0
  154. package/go/wit/deps/api-call/cap-api-call.wit +20 -0
  155. package/go/wit/deps/app/cap-app.wit +54 -0
  156. package/go/wit/deps/auth-center/cap-auth-center.wit +124 -0
  157. package/go/wit/deps/clipboard/clipboard.wit +48 -0
  158. package/go/wit/deps/clocks/monotonic-clock.wit +45 -0
  159. package/go/wit/deps/clocks/wall-clock.wit +42 -0
  160. package/go/wit/deps/clocks/world.wit +6 -0
  161. package/go/wit/deps/connection-registry/cap-connection-registry.wit +40 -0
  162. package/go/wit/deps/crypto/cap-crypto.wit +68 -0
  163. package/go/wit/deps/filesystem/preopens.wit +8 -0
  164. package/go/wit/deps/filesystem/types.wit +634 -0
  165. package/go/wit/deps/filesystem/world.wit +6 -0
  166. package/go/wit/deps/fs-desktop/cap-fs-desktop.wit +29 -0
  167. package/go/wit/deps/http/http.wit +28 -0
  168. package/go/wit/deps/http-endpoint/cap-http.wit +44 -0
  169. package/go/wit/deps/io/error.wit +34 -0
  170. package/go/wit/deps/io/poll.wit +41 -0
  171. package/go/wit/deps/io/streams.wit +262 -0
  172. package/go/wit/deps/io/world.wit +6 -0
  173. package/go/wit/deps/mdns/mdns.wit +45 -0
  174. package/go/wit/deps/notify/notify.wit +51 -0
  175. package/go/wit/deps/peer/peer.wit +126 -0
  176. package/go/wit/deps/platform-desktop/cap-platform-desktop.wit +38 -0
  177. package/go/wit/deps/process/cap-process.wit +25 -0
  178. package/go/wit/deps/pty/pty.wit +80 -0
  179. package/go/wit/deps/random/insecure-seed.wit +25 -0
  180. package/go/wit/deps/random/insecure.wit +22 -0
  181. package/go/wit/deps/random/random.wit +26 -0
  182. package/go/wit/deps/random/world.wit +7 -0
  183. package/go/wit/deps/sockets/instance-network.wit +9 -0
  184. package/go/wit/deps/sockets/ip-name-lookup.wit +51 -0
  185. package/go/wit/deps/sockets/network.wit +145 -0
  186. package/go/wit/deps/sockets/tcp-create-socket.wit +27 -0
  187. package/go/wit/deps/sockets/tcp.wit +353 -0
  188. package/go/wit/deps/sockets/udp-create-socket.wit +27 -0
  189. package/go/wit/deps/sockets/udp.wit +266 -0
  190. package/go/wit/deps/sockets/world.wit +11 -0
  191. package/go/wit/deps/task/cap-task.wit +56 -0
  192. package/go/wit/deps/timer/cap-timer.wit +14 -0
  193. package/go/wit/deps/wasi-cli/command.wit +7 -0
  194. package/go/wit/deps/wasi-cli/environment.wit +18 -0
  195. package/go/wit/deps/wasi-cli/exit.wit +4 -0
  196. package/go/wit/deps/wasi-cli/imports.wit +20 -0
  197. package/go/wit/deps/wasi-cli/run.wit +4 -0
  198. package/go/wit/deps/wasi-cli/stdio.wit +17 -0
  199. package/go/wit/deps/wasi-cli/terminal.wit +49 -0
  200. package/go/wit/deps/ws/ws.wit +50 -0
  201. package/go/wit/deps/ws-server/cap-ws.wit +99 -0
  202. package/go/wit/go-plugin.wit +28 -0
  203. package/go/wit/plugin-face.wit +355 -0
  204. package/go/wit/wasmnest.wit +25 -0
  205. package/package.json +12 -1
  206. package/src/index.ts +8 -0
  207. package/src/types.ts +681 -630
  208. package/src/ui/AppUpdateSection.d.ts +44 -0
  209. package/src/ui/AppUpdateSection.vue +253 -0
  210. package/src/ui/NumberField.d.ts +49 -0
  211. package/src/ui/NumberField.vue +390 -0
  212. package/src/ui/Select.vue +4 -4
  213. package/src/update.ts +123 -0
  214. package/template/README.md +39 -39
  215. package/tools/componentize/Cargo.lock +30 -1
  216. package/tools/componentize/Cargo.toml +3 -0
  217. package/tools/componentize/src/main.rs +197 -94
  218. package/dev-shell/src/mock/agent-hub-commands.ts +0 -1065
  219. package/dev-shell/src/mock/agent-hub.ts +0 -42
@@ -0,0 +1,21 @@
1
+ // Code generated by wit-bindgen-go. DO NOT EDIT.
2
+
3
+ package hostplatformdesktop
4
+
5
+ import (
6
+ "go.bytecodealliance.org/cm"
7
+ )
8
+
9
+ // This file contains wasmimport and wasmexport declarations for "wasmnest:platform-desktop@0.0.1".
10
+
11
+ //go:wasmimport wasmnest:platform-desktop/host-platform-desktop@0.0.1 wsl-distros
12
+ //go:noescape
13
+ func wasmimport_WslDistros(result *cm.Result[string, string, string])
14
+
15
+ //go:wasmimport wasmnest:platform-desktop/host-platform-desktop@0.0.1 local-ipv4-addresses
16
+ //go:noescape
17
+ func wasmimport_LocalIPv4Addresses(result *cm.Result[string, string, string])
18
+
19
+ //go:wasmimport wasmnest:platform-desktop/host-platform-desktop@0.0.1 reveal-in-dir
20
+ //go:noescape
21
+ func wasmimport_RevealInDir(path0 *uint8, path1 uint32, result *cm.Result[string, struct{}, string])
@@ -0,0 +1,70 @@
1
+ // Code generated by wit-bindgen-go. DO NOT EDIT.
2
+
3
+ // Package hostplatformdesktop represents the imported interface "wasmnest:platform-desktop/host-platform-desktop@0.0.1".
4
+ //
5
+ // 桌面端能力域分片(WIT 按包拆分,ADR 0061):一个能力域 = 一个独立包,
6
+ // 版本独立演进——本包 WIT 变更只 bump 本包,不波及未 import 它的应用。
7
+ // 端 `plugin` world 经 `include wasmnest:platform-desktop/cap-platform-desktop@0.0.1;`
8
+ // 并入本接口。
9
+ // 平台能力桌面扩展(v36 自 `host-platform` 拆出,双端交集切片——桌面独有 3 函数;
10
+ // `pick-folders` 已按 2026-10-13 功能级统一迁 core `host-platform`)
11
+ package hostplatformdesktop
12
+
13
+ import (
14
+ "go.bytecodealliance.org/cm"
15
+ )
16
+
17
+ // WslDistros represents the imported function "wsl-distros".
18
+ //
19
+ // WSL 发行版名枚举(v19 函数级追加):`string[]` JSON,顺序即
20
+ // `wsl --list --verbose` 输出顺序。宿主无 WSL(非 Windows / 未安装 /
21
+ // 命令不可用)时**显性报错**而非空数组——空数组会被消费方读成「装了 0 个
22
+ // 发行版」,与「本机没有 WSL」不可区分(会话配置表单据此决定渲染下拉还是
23
+ // 「未检测到 WSL」提示)。平台事实、无业务语义(ADR 0022 裁剪线)。
24
+ //
25
+ // wsl-distros: func() -> result<string, string>
26
+ //
27
+ //go:nosplit
28
+ func WslDistros() (result cm.Result[string, string, string]) {
29
+ wasmimport_WslDistros(&result)
30
+ return
31
+ }
32
+
33
+ // LocalIPv4Addresses represents the imported function "local-ipv4-addresses".
34
+ //
35
+ // 本机可访问的 IPv4 地址枚举(v19 函数级追加):`string[]` JSON,
36
+ // 已排除回环与链路本地(与会话中心设备页原宿主命令 `get_local_ip_addresses`
37
+ // 同口径),顺序即网卡枚举顺序。设备页据此渲染「移动端可访问的 IP」下拉。
38
+ // 平台事实、无业务语义(ADR 0022 裁剪线);地址为空(无可用网卡)时返回
39
+ // **空数组**(与 `wsl-distros` 的显性报错口径不同:此处「没有可用地址」是
40
+ // 合法状态,前端渲染「未找到可用的 IPv4 地址」提示)。
41
+ //
42
+ // local-ipv4-addresses: func() -> result<string, string>
43
+ //
44
+ //go:nosplit
45
+ func LocalIPv4Addresses() (result cm.Result[string, string, string]) {
46
+ wasmimport_LocalIPv4Addresses(&result)
47
+ return
48
+ }
49
+
50
+ // RevealInDir represents the imported function "reveal-in-dir".
51
+ //
52
+ // 在系统文件管理器中定位并选中文件/目录(v22 函数级追加):参数为绝对路径,
53
+ // 路径不存在时**显性报错**(`reveal: path not found: …`)。平台实现:Windows
54
+ // Shell COM(`SHOpenFolderAndSelectItems`,含 `\\?\` verbatim 前缀剥离与
55
+ // `ERROR_FILE_NOT_FOUND` 兜底)/ macOS `open -R` / Linux `xdg-open`(打开所在
56
+ // 目录,无选中语义)。
57
+ //
58
+ // 与 `pick-*` 同口径:定位是**平台交互动作、不读取任何数据**(路径本就由调用方
59
+ // 提供),故**不叠加权限门**(ADR 0022 裁剪线);原先挂在宿主命令
60
+ // `plugin_reveal_in_dir` + `system:open` 权限上的形态是「能力已存在但没有原语」
61
+ // 的遗留形态(宿主命令面有授能力、但插件侧无原语可调)。
62
+ //
63
+ // reveal-in-dir: func(path: string) -> result<_, string>
64
+ //
65
+ //go:nosplit
66
+ func RevealInDir(path string) (result cm.Result[string, struct{}, string]) {
67
+ path0, path1 := cm.LowerString(path)
68
+ wasmimport_RevealInDir((*uint8)(path0), (uint32)(path1), &result)
69
+ return
70
+ }
@@ -0,0 +1,11 @@
1
+ // Code generated by wit-bindgen-go. DO NOT EDIT.
2
+
3
+ package abiform
4
+
5
+ // Exports represents the caller-defined exports from "wasmnest:plugin/abi-form@0.1.0".
6
+ var Exports struct {
7
+ // Form represents the caller-defined, exported function "form".
8
+ //
9
+ // form: func() -> u32
10
+ Form func() (result uint32)
11
+ }
@@ -0,0 +1,13 @@
1
+ // Code generated by wit-bindgen-go. DO NOT EDIT.
2
+
3
+ package abiform
4
+
5
+ // This file contains wasmimport and wasmexport declarations for "wasmnest:plugin@0.1.0".
6
+
7
+ //go:wasmexport wasmnest:plugin/abi-form@0.1.0#form
8
+ //export wasmnest:plugin/abi-form@0.1.0#form
9
+ func wasmexport_Form() (result0 uint32) {
10
+ result := Exports.Form()
11
+ result0 = (uint32)(result)
12
+ return
13
+ }
@@ -0,0 +1,7 @@
1
+ // Code generated by wit-bindgen-go. DO NOT EDIT.
2
+
3
+ // Package abiform represents the exported interface "wasmnest:plugin/abi-form@0.1.0".
4
+ //
5
+ // 产物形态(v36 自 `abi` 拆出,桌面独有):组件(Component Model)形态声明,
6
+ // 宿主按 `form()==1` 识别;`0` 是 core 形态的自研 ABI(已退役)。
7
+ package abiform
@@ -0,0 +1,3 @@
1
+ // This file exists for testing this package without WebAssembly,
2
+ // allowing empty function bodies with a //go:wasmimport directive.
3
+ // See https://pkg.go.dev/cmd/compile for more information.
@@ -0,0 +1,11 @@
1
+ // Code generated by wit-bindgen-go. DO NOT EDIT.
2
+
3
+ package command
4
+
5
+ // Exports represents the caller-defined exports from "wasmnest:plugin/command@0.1.0".
6
+ var Exports struct {
7
+ // Invoke represents the caller-defined, exported function "invoke".
8
+ //
9
+ // invoke: func(name: string, args-json: string) -> string
10
+ Invoke func(name string, argsJSON string) (result string)
11
+ }
@@ -0,0 +1,19 @@
1
+ // Code generated by wit-bindgen-go. DO NOT EDIT.
2
+
3
+ package command
4
+
5
+ import (
6
+ "go.bytecodealliance.org/cm"
7
+ )
8
+
9
+ // This file contains wasmimport and wasmexport declarations for "wasmnest:plugin@0.1.0".
10
+
11
+ //go:wasmexport wasmnest:plugin/command@0.1.0#invoke
12
+ //export wasmnest:plugin/command@0.1.0#invoke
13
+ func wasmexport_Invoke(name0 *uint8, name1 uint32, argsJson0 *uint8, argsJson1 uint32) (result *string) {
14
+ name := cm.LiftString[string]((*uint8)(name0), (uint32)(name1))
15
+ argsJSON := cm.LiftString[string]((*uint8)(argsJson0), (uint32)(argsJson1))
16
+ result_ := Exports.Invoke(name, argsJSON)
17
+ result = &result_
18
+ return
19
+ }
@@ -0,0 +1,6 @@
1
+ // Code generated by wit-bindgen-go. DO NOT EDIT.
2
+
3
+ // Package command represents the exported interface "wasmnest:plugin/command@0.1.0".
4
+ //
5
+ // 命令入口(原 invoke_command,JSON 载荷保留)
6
+ package command
@@ -0,0 +1,3 @@
1
+ // This file exists for testing this package without WebAssembly,
2
+ // allowing empty function bodies with a //go:wasmimport directive.
3
+ // See https://pkg.go.dev/cmd/compile for more information.
@@ -0,0 +1,3 @@
1
+ // This file exists for testing this package without WebAssembly,
2
+ // allowing empty function bodies with a //go:wasmimport directive.
3
+ // See https://pkg.go.dev/cmd/compile for more information.
@@ -0,0 +1,52 @@
1
+ // Code generated by wit-bindgen-go. DO NOT EDIT.
2
+
3
+ package events
4
+
5
+ import (
6
+ "go.bytecodealliance.org/cm"
7
+ )
8
+
9
+ // Exports represents the caller-defined exports from "wasmnest:plugin/events@0.1.0".
10
+ var Exports struct {
11
+ // OnMessage represents the caller-defined, exported function "on-message".
12
+ //
13
+ // on-message: func(topic: string, sender: string, payload-json: string) -> result<_,
14
+ // string>
15
+ OnMessage func(topic string, sender string, payloadJSON string) (result cm.Result[string, struct{}, string])
16
+
17
+ // OnProcessDone represents the caller-defined, exported function "on-process-done".
18
+ //
19
+ // 进程执行完成回调(v8):host-process run 的进程结束时触发
20
+ // (正常退出 / 非零退出 / 超时 kill),payload-json 为
21
+ // `{ run_id, exit_code, timed_out }`
22
+ //
23
+ // on-process-done: func(payload-json: string) -> result<_, string>
24
+ OnProcessDone func(payloadJSON string) (result cm.Result[string, struct{}, string])
25
+
26
+ // OnBusMessage represents the caller-defined, exported function "on-bus-message".
27
+ //
28
+ // 以下 5 函数为移动词汇(并集):桌面宿主不调用,桌面原生插件走默认空实现
29
+ //
30
+ // on-bus-message: func(topic: string, payload-json: string) -> result<_, string>
31
+ OnBusMessage func(topic string, payloadJSON string) (result cm.Result[string, struct{}, string])
32
+
33
+ // OnAuthSuccess represents the caller-defined, exported function "on-auth-success".
34
+ //
35
+ // on-auth-success: func() -> result<_, string>
36
+ OnAuthSuccess func() (result cm.Result[string, struct{}, string])
37
+
38
+ // OnDisconnect represents the caller-defined, exported function "on-disconnect".
39
+ //
40
+ // on-disconnect: func(reason: string) -> result<_, string>
41
+ OnDisconnect func(reason string) (result cm.Result[string, struct{}, string])
42
+
43
+ // OnSessionCreated represents the caller-defined, exported function "on-session-created".
44
+ //
45
+ // on-session-created: func(session-id: string) -> result<_, string>
46
+ OnSessionCreated func(sessionID string) (result cm.Result[string, struct{}, string])
47
+
48
+ // OnSessionStopped represents the caller-defined, exported function "on-session-stopped".
49
+ //
50
+ // on-session-stopped: func(session-id: string) -> result<_, string>
51
+ OnSessionStopped func(sessionID string) (result cm.Result[string, struct{}, string])
52
+ }
@@ -0,0 +1,74 @@
1
+ // Code generated by wit-bindgen-go. DO NOT EDIT.
2
+
3
+ package events
4
+
5
+ import (
6
+ "go.bytecodealliance.org/cm"
7
+ )
8
+
9
+ // This file contains wasmimport and wasmexport declarations for "wasmnest:plugin@0.1.0".
10
+
11
+ //go:wasmexport wasmnest:plugin/events@0.1.0#on-message
12
+ //export wasmnest:plugin/events@0.1.0#on-message
13
+ func wasmexport_OnMessage(topic0 *uint8, topic1 uint32, sender0 *uint8, sender1 uint32, payloadJson0 *uint8, payloadJson1 uint32) (result *cm.Result[string, struct{}, string]) {
14
+ topic := cm.LiftString[string]((*uint8)(topic0), (uint32)(topic1))
15
+ sender := cm.LiftString[string]((*uint8)(sender0), (uint32)(sender1))
16
+ payloadJSON := cm.LiftString[string]((*uint8)(payloadJson0), (uint32)(payloadJson1))
17
+ result_ := Exports.OnMessage(topic, sender, payloadJSON)
18
+ result = &result_
19
+ return
20
+ }
21
+
22
+ //go:wasmexport wasmnest:plugin/events@0.1.0#on-process-done
23
+ //export wasmnest:plugin/events@0.1.0#on-process-done
24
+ func wasmexport_OnProcessDone(payloadJson0 *uint8, payloadJson1 uint32) (result *cm.Result[string, struct{}, string]) {
25
+ payloadJSON := cm.LiftString[string]((*uint8)(payloadJson0), (uint32)(payloadJson1))
26
+ result_ := Exports.OnProcessDone(payloadJSON)
27
+ result = &result_
28
+ return
29
+ }
30
+
31
+ //go:wasmexport wasmnest:plugin/events@0.1.0#on-bus-message
32
+ //export wasmnest:plugin/events@0.1.0#on-bus-message
33
+ func wasmexport_OnBusMessage(topic0 *uint8, topic1 uint32, payloadJson0 *uint8, payloadJson1 uint32) (result *cm.Result[string, struct{}, string]) {
34
+ topic := cm.LiftString[string]((*uint8)(topic0), (uint32)(topic1))
35
+ payloadJSON := cm.LiftString[string]((*uint8)(payloadJson0), (uint32)(payloadJson1))
36
+ result_ := Exports.OnBusMessage(topic, payloadJSON)
37
+ result = &result_
38
+ return
39
+ }
40
+
41
+ //go:wasmexport wasmnest:plugin/events@0.1.0#on-auth-success
42
+ //export wasmnest:plugin/events@0.1.0#on-auth-success
43
+ func wasmexport_OnAuthSuccess() (result *cm.Result[string, struct{}, string]) {
44
+ result_ := Exports.OnAuthSuccess()
45
+ result = &result_
46
+ return
47
+ }
48
+
49
+ //go:wasmexport wasmnest:plugin/events@0.1.0#on-disconnect
50
+ //export wasmnest:plugin/events@0.1.0#on-disconnect
51
+ func wasmexport_OnDisconnect(reason0 *uint8, reason1 uint32) (result *cm.Result[string, struct{}, string]) {
52
+ reason := cm.LiftString[string]((*uint8)(reason0), (uint32)(reason1))
53
+ result_ := Exports.OnDisconnect(reason)
54
+ result = &result_
55
+ return
56
+ }
57
+
58
+ //go:wasmexport wasmnest:plugin/events@0.1.0#on-session-created
59
+ //export wasmnest:plugin/events@0.1.0#on-session-created
60
+ func wasmexport_OnSessionCreated(sessionId0 *uint8, sessionId1 uint32) (result *cm.Result[string, struct{}, string]) {
61
+ sessionID := cm.LiftString[string]((*uint8)(sessionId0), (uint32)(sessionId1))
62
+ result_ := Exports.OnSessionCreated(sessionID)
63
+ result = &result_
64
+ return
65
+ }
66
+
67
+ //go:wasmexport wasmnest:plugin/events@0.1.0#on-session-stopped
68
+ //export wasmnest:plugin/events@0.1.0#on-session-stopped
69
+ func wasmexport_OnSessionStopped(sessionId0 *uint8, sessionId1 uint32) (result *cm.Result[string, struct{}, string]) {
70
+ sessionID := cm.LiftString[string]((*uint8)(sessionId0), (uint32)(sessionId1))
71
+ result_ := Exports.OnSessionStopped(sessionID)
72
+ result = &result_
73
+ return
74
+ }
@@ -0,0 +1,195 @@
1
+ // Code generated by wit-bindgen-go. DO NOT EDIT.
2
+
3
+ // Package events represents the exported interface "wasmnest:plugin/events@0.1.0".
4
+ //
5
+ // ======================================================================
6
+ // 插件面(plugin face)——`wasmnest:plugin` 包的非 core 部分
7
+ //
8
+ // ADR 0061(2026-11-07 WIT 按包拆分)后,`wasmnest:plugin` 只保留两类东西:
9
+ // ① `core.wit`:内核机制 import(storage/events/bus/platform/fs/log/config/
10
+ // plugin-database/metrics/worker)+ 三个必选导出(command/lifecycle/manifest);
11
+ // ② 本文件:双端/端独有的**导出面**(events 等)与 binding-only world。
12
+ // 其余能力域接口各自独立成包,住端生成物 `deps/<pkg>/`。
13
+ //
14
+ // 本包是所有应用的公共轴:它的任何改动(core import 或导出面)仍要求全部应用
15
+ // 重建——这是拆包后的有意边界(spec §9.2)。
16
+ // ======================================================================
17
+ // WasmNest 插件 Component Model 契约
18
+ //
19
+ // 桌面端插件契约——**插件面分片**(共享核心在 `wasm-core/wit/core.wit`,
20
+ // 能力域接口在各自独立包 `deps/`,本文件只承载导出面与 binding-only world;
21
+ // 端 `wit/` 目录由 `scripts/compose-wit.mjs` 拼装生成,本文件是其真源)。
22
+ //
23
+ // ADR 0061 拆包后:`host-fs-desktop` / `host-platform-desktop` / `host-api-call` /
24
+ // `host-timer` / `host-process` / `host-app` / `host-connection-registry` /
25
+ // `host-auth-center` / `host-task` / `host-crypto` 各自成包(源文件见同目录
26
+ // `cap-*.wit`),本文件不再定义它们。
27
+ //
28
+ // 迁移约定(与阶段 B 第 4 点一致):
29
+ // - `serde_json` 载荷保留:结构化参数/结果一律用 `string` 承载 JSON
30
+ // (WIT 的 `string` 到 wasm 侧是 UTF-8 字节,等价于现有 (ptr,len) 传递)
31
+ // - 命令层(`CommandArgs` / `serde_json::Value`)不动,只有传输层换皮
32
+ // - 错误一律 `result<T, string>`,错误内容为宿主侧可读的 UTF-8 消息
33
+ //
34
+ // ## 命名空间约定
35
+ //
36
+ // 宿主能力 import 接口前缀 `host-`,插件导出接口为普通名字:
37
+ // - import:`host-storage` / `host-plugin-database` / ... (对应 host_functions/*)
38
+ // - export:`command` / `lifecycle` / `events` / `manifest` / `abi`
39
+ // (v27 删 `terminal-hooks` 与 `events` 的 `on-session-lifecycle` /
40
+ // `on-input-submitted`:派发源随会话观察面退役,见下方 v27 版本说明)
41
+ //
42
+ // ## ABI 版本协商(阶段 A)
43
+ //
44
+ // `abi` 接口承载原 `__wasmnest_abi_version` 的职责(共享核心只留 `version()` 交集;
45
+ // `form` 形态声明 v36 拆入 `abi-form`,见本文件 interface 定义)。
46
+ // - `version()`:与 `abi::ABI_VERSION`(**当前 v36**)比对,语义不变
47
+ // (逐版权威记账在 SDK `rust/src/abi.rs`,下方保全的版本演进注释与此对应)
48
+ // - `abi-form.form()`:0 = core module(自研 ABI),1 = component。宿主据此区分
49
+ // 产物形态,不 bump ABI 大版本
50
+ // ABI 版本协商(原 __wasmnest_abi_version + 阶段 A 新增 form 形态字段)
51
+ //
52
+ // 版本演进(与 SDK `abi.rs` 的 ABI_VERSION 序列逐条对应,不得漂移):
53
+ // - v10:host-peer 原语化收缩第一阶段(dial-peer-endpoint / close /
54
+ // set-shared-roots + host-mdns / host-platform),纯增量
55
+ // - v11:host-peer 传输控制三原语(pause-transfer / resume-transfer /
56
+ // resume-all-transfers),纯增量
57
+ // - v12:消息总线二进制载荷(host-bus.publish-binary / subscribe-binary)
58
+ // + 可选导出 events-binary(宿主动态探测,旧插件不受影响)
59
+ // - v13:host-mdns v2(advertise / stop-advertise / is-advertising 原语 +
60
+ // 事件定向投递 `mdns:found.<owner>` / `mdns:lost.<owner>`——当时形态,
61
+ // 后改为 `<owner>::mdns:found|lost`),纯增量
62
+ // - v14:host-websocket 基础能力服务(客户端域 connect/send/close/
63
+ // is-connected + 服务端域 register-endpoint/收发/广播/踢出/注销/清单)
64
+ // + 可选导出 events-ws(宿主动态探测),纯增量,v13 插件不受影响
65
+ // - v15:host-auth 密钥托管原语(secret-store 四函数 + 主库 plugin_secrets
66
+ // 持久化),纯增量,v14 插件不受影响
67
+ // - v16:host-pty 插件私有伪终端原语(spawn/write/resize/kill/ring-fetch/
68
+ // is-running 六函数 + `<owner>::pty:exit` 事件),纯增量新接口,
69
+ // v15 及更早插件不受影响。**2026-09-24**:spawn config-json 追加可选字段
70
+ // `hostBroadcastSessionId`(宿主只读订阅声明,字段级追加不 bump——同 v19 惯例;
71
+ // **该字段已于 v28 退役**,见下方 v28 条目)
72
+ // - v17:认证策略导出 auth-policy(verify-device-token,desktop 独有——认证中心
73
+ // 能力,宿主 server 中间件验签后取策略),纯增量新接口,v16 及更早插件不受影响
74
+ // - v18:host-auth 认证记录面(trusted-devices-list / trusted-device-revoke /
75
+ // connection-history-list / auth-setting-set,desktop 独有——会话语义下沉的
76
+ // 宿主侧追加批次),既有 interface 的函数级追加,v17 及更早插件不受影响
77
+ // - v19:host-session 配置面(config-upsert / config-get / config-delete,
78
+ // desktop 独有——会话语义下沉批次之二,权限 `session:config`),既有
79
+ // interface 的函数级追加,v18 及更早插件不受影响。v19 同批再加两函数:
80
+ // `annotate`(会话注解槽写入,权限 `session:write`——内核去业务化:
81
+ // 旧任务字段的 expand 期并行写入面)+ `connections-list`(连接注册表原始
82
+ // 记录清单,无排序无解读,权限 `session:read`——设备派生视图真源)
83
+ // - v20:host-task 宿主并发任务域(execute-batch / submit / status / cancel /
84
+ // list-jobs 五函数,desktop 独有——WASM 插件调度 OS 线程池真并行执行单元
85
+ // 操作计划,权限 `task:run` + 每单元既有域权限门双门) + 可选导出
86
+ // events-task#on-task-event(宿主动态探测,同 events-ws 模式,旧产物零回归),
87
+ // 纯增量新接口,v19 及更早插件不受影响
88
+ // - v21…v26:函数级追加与新增 interface(host-session 收敛、host-platform、
89
+ // host-auth 记录面、host-pty、auth-policy、host-websocket、host-mdns v2、
90
+ // host-crypto 等)——**逐条权威记账在 SDK `rust/src/abi.rs`**,本段不复制
91
+ // (复制即漂移源)
92
+ // - **v27:唯一一次破坏性契约变更**——会话原语域整 interface 退役:
93
+ // ① import 删 `host-session`(12 函数)与 `host-terminal`(`send`);
94
+ // ② export 删 `terminal-hooks` 整 interface 与 `events` 的
95
+ // `on-session-lifecycle` / `on-input-submitted`;
96
+ // ③ 权限位退役 `session:write` / `terminal:observe`。
97
+ // 会话真源在 `com.wasmnest.bedcode` 登记域(P1-b 起),宿主侧只留
98
+ // `host-pty`(引擎)与 `host-connection`(连接清单)。旧产物在**实例化**阶段
99
+ // 即可诊断失败(点明缺失 interface + 重建指引,见宿主
100
+ // `stale_artifact_rebuild_hint`),须按 v27 SDK 重建
101
+ // - **v28(websocket 业务下沉专项,2026-09-25)**:
102
+ // ① `host-websocket` 新增 `connection-context`(已脱敏连接/认证上下文查询,
103
+ // 仅属主可调,权限 `ws:server`);
104
+ // ② 破坏性删除:`host-events.broadcast-sync` 退役(宿主不再持同步产品
105
+ // 载荷与 WS 广播策略,插件事件走 bus/emit)、`host-pty.spawn` 的
106
+ // `hostBroadcastSessionId` 字段退役(PTY 引擎不再知道 session id,插件
107
+ // 经 `ring-fetch` 自持)、宿主 `Message`/SyncPayload 等旧 WS 业务类型退出
108
+ // 生产路径。旧产物(v27 SDK 构建)在**实例化**阶段即可诊断失败
109
+ // (stale_artifact_rebuild_hint 点明 v28 重建)。
110
+ // 随包插件产物同步重建(旧产物不兼容、不迁移、不提供 fallback)。
111
+ // - **v29(HTTP 路由代码注册下沉专项,2026-09-25)**:host-http 新增服务端域
112
+ // `register-endpoint` / `unregister-endpoint`(插件在 activate 期以代码注册自身
113
+ // 路由:内部端点段 + 可选对外 URL 别名 + 方法 + `jwt`/`none` 认证档位;
114
+ // 命名空间由插件名承载,激活期同名拒绝 fail-visible)。函数级追加,旧产物仍可
115
+ // 实例化但不具备注册能力。权威记账在 SDK `rust/src/abi.rs`
116
+ // - **v30(传输编排下沉,2026-09-25)**:host-peer 函数级追加
117
+ // `active-transfers`(会话表投影查询,事件归约首屏兜底)+ `collect-outgoing`
118
+ // (发送源枚举:目录递归 + 批内同名去重,仅元数据)。纯增量,v29 及更早
119
+ // 插件不受影响。权威记账在 SDK `rust/src/abi.rs`
120
+ // - **v31(传输编排下沉,2026-09-25,破坏性)**:host-peer 删
121
+ // `resume-all-transfers`(“全部恢复”编排归插件逐批调 `resume-transfer`)、
122
+ // `send-files` 语义收窄为“一次调用 = 一个会话立即发起”(载荷 `concurrency` 字段
123
+ // 退役,运行期显性报错),旧快照 topic `peer:transfer` / `peer:receive` 退役。
124
+ // 旧产物在**实例化**阶段即被点名拒绝(stale_artifact_rebuild_hint 点明 v31 重建)。
125
+ // 权威记账在 SDK `rust/src/abi.rs`
126
+ // - **v33(认证中心持有入场密钥,2026-09-29,ADR 0033,破坏性)**:`host-auth` 删
127
+ // `device-token-issue` / `device-token-verify`——认证中心自持入场密钥并自签自验,
128
+ // 宿主不再持有设备 JWT 密码学(`utils/auth/jwt.rs` 整个退役)。旧产物(v32 SDK
129
+ // 构建)仍 import 这两函数 → **实例化期**被点名拒绝(stale_artifact_rebuild_hint
130
+ // 点明 v33 重建)。token wire 格式逐字节不变,移动端零改动。**desktop 独有**,
131
+ // 移动端 WIT/ABI/SDK 不跟演不投影(mobile ABI 保持 11)。
132
+ //
133
+ // - **2026-10-13(domain-owned-contracts 票 04,ADR 0052 D2/D3):契约包
134
+ // minor bump `0.1.0 → 0.2.0`(WIT 包 semver,ADR 0051 D4;整数 ABI 已退役,
135
+ // 本文件保留的 vNN 号是历史台账,不再递增)**——功能级交集统一:
136
+ // ① 桌面 `host-events-desktop`(notify)整 interface 退役——`notify` 本体
137
+ // 进双端共享契约 `wasmnest-notify-engine/wit/notify.wit` 的 `host-notify`
138
+ // (签名统一为 `notify(title, body, options-json)`,桌面静默忽略不支持的
139
+ // vibrate/sound)
140
+ // ② 桌面 `host-platform-desktop.pick-folders` 退役——与 core
141
+ // `host-platform.pick-folder` 统一为 core `host-platform.pick-folders`
142
+ // (`string[]` JSON;本端剩 wsl-distros / local-ipv4-addresses / reveal-in-dir
143
+ // 3 条)
144
+ // ③ 移动端 `host-notify` 附加 4 函数改名 `host-notify-mobile`(移动 cap)
145
+ // 旧产物(0.1.0 SDK 构建)的 import 名与 linker 不等 → 实例化期被点名,
146
+ // 须按当前 SDK 全量重建(`stale_artifact_rebuild_hint`,fail-visible)
147
+ //
148
+ // **不 bump 版本号的语义变更(落在 v22 批次内)**:host-bus topic 命名空间。
149
+ // 函数签名零变化,故不动版本号;但**定向事件的 topic 串**由 `<base>.<owner>` 改为
150
+ // `<owner>::<base>`,且跨属主的订阅/伪发布由「无人拦截」改为**宿主显式拒绝**。
151
+ // 旧产物不兼容且不会静默断流:按旧形态订阅会在 activate 期拿到点明新形态的错误,
152
+ // 必须按 v22 SDK(`owned_topic` / `*_event_topic`)重建。宿主独有能力面
153
+ // (host-pty / host-websocket / host-mdns 的定向事件);移动端 host-mdns 仍用旧形态,
154
+ // 双端偏离登记见 ADR 0022「双端偏离」口径。
155
+ //
156
+ // **同样不 bump 的第二例(系统文件选择器权限门,2026-09-27)**:`host-platform` 的
157
+ // `pick-files` / `pick-folder` / `pick-folders` 由「选择即授权、不设门」改为
158
+ // **必须 manifest 单独声明 `fs:pick`**,且选择结果要过 `fs_auth` 授权校验。
159
+ // 判据同 v22 那一例:**WIT 函数签名与 import 面零变化**(`pick-*` 三个 import
160
+ // 一字未动),变的是 manifest 层准入条件——权限门是运行期机制,不是 ABI 形状,
161
+ // 与「插件没声明 `fs:read` 就调 `fs.read` 被门」是同一套机制,不构成需要 bump 的
162
+ // 契约破坏。旧产物(未声明 `fs:pick` 的 v31 SDK 构建)不兼容且**不会静默降级**:
163
+ // 调用点在弹对话框**之前**就拿到点名缺失权限位的 `Err`,按当前 SDK 在 manifest
164
+ // 补声明即可重建(宿主不强制 bump,故第三方插件无需为此重编 wasm)。
165
+ // **双端偏离(2026-10-13 收口,ADR 0049 D7 / ADR 0052 票 04)**:移动端
166
+ // `host-platform` 的 SAF 选择器曾维持「选择即授权、不设门」(移动端系统本身按
167
+ // tree URI 授予访问权,ADR 0018 移动独立契约,故当时不跟演本条);单形态后
168
+ // host-platform 归内核 `core_binding` 单份实现,`fs:pick` 门对双端统一生效,
169
+ // 移动 manifest 已随票 04 补声明该位(audit §E.1 收口)。
170
+ //
171
+ // **第三例(出站授权记录与询问,2026-09-28 授权策略增强)**:`host-http` 的 `fetch`
172
+ // 由「权限位通过即请求」改为「权限位 + 出站授权记录」双门;未记录的新 origin 弹窗询问
173
+ // (新事件 `plugin:network-auth-request` + 新宿主命令 `plugin_network_auth_respond`,
174
+ // 应答沿用 fs 侧的宿主面凭证绑定机制;`allow_once` 按 origin 落 allow 记录、
175
+ // `deny_always` 落 deny 记录)。**WIT 函数签名与 import / return 面零变化**——`fetch`
176
+ // 仍收同一份 request JSON、仍返回同一形状的响应文本,变的是**宿主内部的准入条件**,
177
+ // 与上一例的权限门同型。入站方向 `register-endpoint` 零改动(策略只管出站)。
178
+ // 旧插件不会被静默断流:它若访问新 origin,会拿到显式的授权拒绝 `Err`(错误分类与
179
+ // 文案同 fs 侧授权拒绝),用户在弹窗点一次允许即恢复——不兼容但可自愈,故不 bump。
180
+ // 权威记账在 ADR 0022「授权策略 = 安全闸门」节。
181
+ // **双端偏离**:移动端是自持业务 App,出站授权由其自身 SAF / 网络策略承担,不跟演本条。
182
+ // v36 切片:`form`(桌面独有形态声明)拆入 [`abi-form`],
183
+ // 本接口只剩双端交集 `version`。
184
+ // 事件回调(桌面词汇 + 移动词汇**并集**)
185
+ //
186
+ // 并集理由(2026-10-13,file-transfer 单产物,规格
187
+ // `.scratch/2026-10-13-file-transfer-single-wasm/spec.md`):双端共享 wasm 产物按
188
+ // 桌面 `world plugin` 构建,必须同时导出两端宿主要按名调用的回调——桌面 dispatcher
189
+ // 调 `on-message` / `on-process-done`,移动 dispatcher 调 `on-bus-message` /
190
+ // `on-auth-success` / `on-disconnect` / `on-session-created` / `on-session-stopped`。
191
+ // wit-bindgen 导出视图按名懒查找,一端不认识的函数对该端无感 ⇒ 并集对两端原生插件
192
+ // 均为加法(旧产物少导出函数,旧宿主按名调用不受影响)。
193
+ // 移动侧 5 函数签名逐字照移动 `plugin-face.wit` 的 `interface events`(双端同步维护;
194
+ // 签名漂移有契约锁拦截)。
195
+ package events
@@ -0,0 +1,3 @@
1
+ // This file exists for testing this package without WebAssembly,
2
+ // allowing empty function bodies with a //go:wasmimport directive.
3
+ // See https://pkg.go.dev/cmd/compile for more information.
@@ -0,0 +1,29 @@
1
+ // Code generated by wit-bindgen-go. DO NOT EDIT.
2
+
3
+ package hostbus
4
+
5
+ import (
6
+ "go.bytecodealliance.org/cm"
7
+ )
8
+
9
+ // This file contains wasmimport and wasmexport declarations for "wasmnest:plugin@0.1.0".
10
+
11
+ //go:wasmimport wasmnest:plugin/host-bus@0.1.0 publish
12
+ //go:noescape
13
+ func wasmimport_Publish(topic0 *uint8, topic1 uint32, payloadJson0 *uint8, payloadJson1 uint32, result *cm.Result[string, struct{}, string])
14
+
15
+ //go:wasmimport wasmnest:plugin/host-bus@0.1.0 publish-binary
16
+ //go:noescape
17
+ func wasmimport_PublishBinary(topic0 *uint8, topic1 uint32, payload0 *uint8, payload1 uint32, result *cm.Result[string, struct{}, string])
18
+
19
+ //go:wasmimport wasmnest:plugin/host-bus@0.1.0 subscribe
20
+ //go:noescape
21
+ func wasmimport_Subscribe(topic0 *uint8, topic1 uint32, result *cm.Result[string, struct{}, string])
22
+
23
+ //go:wasmimport wasmnest:plugin/host-bus@0.1.0 subscribe-binary
24
+ //go:noescape
25
+ func wasmimport_SubscribeBinary(topic0 *uint8, topic1 uint32, result *cm.Result[string, struct{}, string])
26
+
27
+ //go:wasmimport wasmnest:plugin/host-bus@0.1.0 unsubscribe
28
+ //go:noescape
29
+ func wasmimport_Unsubscribe(topic0 *uint8, topic1 uint32, result *cm.Result[string, struct{}, string])
@@ -0,0 +1,94 @@
1
+ // Code generated by wit-bindgen-go. DO NOT EDIT.
2
+
3
+ // Package hostbus represents the imported interface "wasmnest:plugin/host-bus@0.1.0".
4
+ //
5
+ // 消息总线(原 bus.rs:bus_publish/subscribe/unsubscribe)
6
+ //
7
+ // ## topic 命名空间(总线是强制边界,不只是约定)
8
+ //
9
+ // - **私有命名空间** `<plugin-id>::<name>`:某插件的收件箱。宿主按属主定向投递
10
+ // 生命周期事件(`<owner>::pty:exit`、`<owner>::ws:*`、`<owner>::mdns:found|lost`)。
11
+ // **只有属主能订阅、只有属主与宿主能发布**——跨命名空间的订阅/伪发布在 Rust 端
12
+ // 显式拒绝(错误透传给 guest,不静默丢弃)。分隔符 `::` 为保留字:插件 id 字符集
13
+ // 是 `[a-z0-9-]` 分段,`:` 不可能出现,故属主判定无歧义且不依赖激活态/安装态。
14
+ // 边界由**串形态**决定(机制 B),而非「解析 owner 段 + 查插件表」(机制 A)——
15
+ // 后者的判定会随属主是否已激活/是否已安装而漏。
16
+ // - **公开 topic**(不含 `::`):插件间广播道(`task:*` / `peer:*` /
17
+ // `wasmnest.api.*`),任何已激活插件可订阅可发布。
18
+ // - **互调回复道** `wasmnest.api.reply.<caller>.<request-id>`:caller 的收件箱但
19
+ // 刻意留在公开道形态(响应者是他人,必须能发布进来)。窃听由「订阅面 host-only」
20
+ // 堵(回复订阅由宿主在 `host-api-call` 内静态注册),抢答由「宿主校验回复 `sender`
21
+ // == api 声明属主」堵(`sender` 由宿主按 Caller state 落章,guest 不可自报)。
22
+ //
23
+ // 载荷格式:
24
+ // - `publish`(JSON 文本,v1 起):结构化载荷,现有订阅方零回归;
25
+ // - `publish-binary`(字节列,v11 起):零 JSON 编解码,可传非 UTF-8
26
+ // 与大载荷(MB 级)。订阅方以 `subscribe-binary` 声明二进制格式偏好,
27
+ // 格式不匹配的投递被宿主拒绝(不进入订阅者队列)并告警
28
+ package hostbus
29
+
30
+ import (
31
+ "go.bytecodealliance.org/cm"
32
+ )
33
+
34
+ // Publish represents the imported function "publish".
35
+ //
36
+ // publish: func(topic: string, payload-json: string) -> result<_, string>
37
+ //
38
+ //go:nosplit
39
+ func Publish(topic string, payloadJSON string) (result cm.Result[string, struct{}, string]) {
40
+ topic0, topic1 := cm.LowerString(topic)
41
+ payloadJson0, payloadJson1 := cm.LowerString(payloadJSON)
42
+ wasmimport_Publish((*uint8)(topic0), (uint32)(topic1), (*uint8)(payloadJson0), (uint32)(payloadJson1), &result)
43
+ return
44
+ }
45
+
46
+ // PublishBinary represents the imported function "publish-binary".
47
+ //
48
+ // 二进制载荷发布(字节列原样透传,零 JSON 编解码,可传非 UTF-8 与大载荷)
49
+ //
50
+ // publish-binary: func(topic: string, payload: list<u8>) -> result<_, string>
51
+ //
52
+ //go:nosplit
53
+ func PublishBinary(topic string, payload cm.List[uint8]) (result cm.Result[string, struct{}, string]) {
54
+ topic0, topic1 := cm.LowerString(topic)
55
+ payload0, payload1 := cm.LowerList(payload)
56
+ wasmimport_PublishBinary((*uint8)(topic0), (uint32)(topic1), (*uint8)(payload0), (uint32)(payload1), &result)
57
+ return
58
+ }
59
+
60
+ // Subscribe represents the imported function "subscribe".
61
+ //
62
+ // subscribe: func(topic: string) -> result<_, string>
63
+ //
64
+ //go:nosplit
65
+ func Subscribe(topic string) (result cm.Result[string, struct{}, string]) {
66
+ topic0, topic1 := cm.LowerString(topic)
67
+ wasmimport_Subscribe((*uint8)(topic0), (uint32)(topic1), &result)
68
+ return
69
+ }
70
+
71
+ // SubscribeBinary represents the imported function "subscribe-binary".
72
+ //
73
+ // 以二进制格式偏好订阅——只接收 publish-binary 投递,
74
+ // JSON 消息对其按格式不匹配拒绝
75
+ //
76
+ // subscribe-binary: func(topic: string) -> result<_, string>
77
+ //
78
+ //go:nosplit
79
+ func SubscribeBinary(topic string) (result cm.Result[string, struct{}, string]) {
80
+ topic0, topic1 := cm.LowerString(topic)
81
+ wasmimport_SubscribeBinary((*uint8)(topic0), (uint32)(topic1), &result)
82
+ return
83
+ }
84
+
85
+ // Unsubscribe represents the imported function "unsubscribe".
86
+ //
87
+ // unsubscribe: func(topic: string) -> result<_, string>
88
+ //
89
+ //go:nosplit
90
+ func Unsubscribe(topic string) (result cm.Result[string, struct{}, string]) {
91
+ topic0, topic1 := cm.LowerString(topic)
92
+ wasmimport_Unsubscribe((*uint8)(topic0), (uint32)(topic1), &result)
93
+ return
94
+ }