@binblink/wasmnest-plugin-sdk-desktop 0.0.0-stage → 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.
- package/README.md +307 -2
- package/README_en.md +284 -0
- package/bin/cli.js +602 -0
- package/bin/manifest-gen.js +458 -0
- package/bin/manifest-validate.js +494 -0
- package/bin/permission-vocabulary.json +5 -0
- package/bin/plugin-watch.js +331 -0
- package/bin/wasm-hash.js +124 -0
- package/dev-shell/README.md +122 -0
- package/dev-shell/index.html +12 -0
- package/dev-shell/package.json +28 -0
- package/dev-shell/pnpm-workspace.yaml +9 -0
- package/dev-shell/postcss.config.js +6 -0
- package/dev-shell/src/App.vue +90 -0
- package/dev-shell/src/components/LogPanel.vue +90 -0
- package/dev-shell/src/loader.ts +104 -0
- package/dev-shell/src/locale.ts +29 -0
- package/dev-shell/src/locales.ts +50 -0
- package/dev-shell/src/main.ts +46 -0
- package/dev-shell/src/mock/app-env.ts +102 -0
- package/dev-shell/src/mock/commands.ts +54 -0
- package/dev-shell/src/mock/domain-context.ts +46 -0
- package/dev-shell/src/mock/events.ts +16 -0
- package/dev-shell/src/mock/file-transfer.ts +512 -0
- package/dev-shell/src/mock/tauri-ipc.ts +109 -0
- package/dev-shell/src/registry.ts +90 -0
- package/dev-shell/src/shell/components/AppMountSlot.vue +241 -0
- package/dev-shell/src/shell/components/ShellIcon.vue +141 -0
- package/dev-shell/src/shell/components/ShellStatusBar.vue +87 -0
- package/dev-shell/src/shell/components/ShellToolbar.vue +287 -0
- package/dev-shell/src/shell/mount/appSession.ts +45 -0
- package/dev-shell/src/shell/mount/devAppMount.ts +80 -0
- package/dev-shell/src/shell/types.ts +121 -0
- package/dev-shell/src/styles/dev.css +27 -0
- package/dev-shell/src/styles/shell.css +752 -0
- package/dev-shell/src/styles/style.css +1178 -0
- package/dev-shell/src/theme.ts +140 -0
- package/dev-shell/src/vite-env.d.ts +24 -0
- package/dev-shell/tailwind.config.js +98 -0
- package/dev-shell/vite.config.ts +174 -0
- package/dist/index.d.ts +150 -0
- package/dist/index.js +238 -0
- package/dist/types.d.ts +632 -0
- package/dist/types.js +0 -0
- package/dist/vite-plugin.d.ts +25 -0
- package/dist/vite-plugin.js +80 -0
- package/go/.gitignore +5 -0
- package/go/README.md +80 -0
- package/go/gen/wasmnest/api-call/host-api-call/empty.s +3 -0
- package/go/gen/wasmnest/api-call/host-api-call/host-api-call.wasm.go +13 -0
- package/go/gen/wasmnest/api-call/host-api-call/host-api-call.wit.go +34 -0
- package/go/gen/wasmnest/app/host-app/empty.s +3 -0
- package/go/gen/wasmnest/app/host-app/host-app.wasm.go +29 -0
- package/go/gen/wasmnest/app/host-app/host-app.wit.go +108 -0
- package/go/gen/wasmnest/auth-center/host-auth-center/abi.go +14 -0
- package/go/gen/wasmnest/auth-center/host-auth-center/empty.s +3 -0
- package/go/gen/wasmnest/auth-center/host-auth-center/host-auth-center.wasm.go +49 -0
- package/go/gen/wasmnest/auth-center/host-auth-center/host-auth-center.wit.go +225 -0
- package/go/gen/wasmnest/clipboard/host-clipboard/abi.go +14 -0
- package/go/gen/wasmnest/clipboard/host-clipboard/empty.s +3 -0
- package/go/gen/wasmnest/clipboard/host-clipboard/host-clipboard.wasm.go +17 -0
- package/go/gen/wasmnest/clipboard/host-clipboard/host-clipboard.wit.go +68 -0
- package/go/gen/wasmnest/connection-registry/host-connection-registry/empty.s +3 -0
- package/go/gen/wasmnest/connection-registry/host-connection-registry/host-connection-registry.wasm.go +13 -0
- package/go/gen/wasmnest/connection-registry/host-connection-registry/host-connection-registry.wit.go +50 -0
- package/go/gen/wasmnest/crypto/host-crypto/abi.go +18 -0
- package/go/gen/wasmnest/crypto/host-crypto/empty.s +3 -0
- package/go/gen/wasmnest/crypto/host-crypto/host-crypto.wasm.go +37 -0
- package/go/gen/wasmnest/crypto/host-crypto/host-crypto.wit.go +139 -0
- package/go/gen/wasmnest/fs-desktop/host-fs-desktop/abi.go +14 -0
- package/go/gen/wasmnest/fs-desktop/host-fs-desktop/empty.s +3 -0
- package/go/gen/wasmnest/fs-desktop/host-fs-desktop/host-fs-desktop.wasm.go +21 -0
- package/go/gen/wasmnest/fs-desktop/host-fs-desktop/host-fs-desktop.wit.go +62 -0
- package/go/gen/wasmnest/http/host-http/abi.go +14 -0
- package/go/gen/wasmnest/http/host-http/empty.s +3 -0
- package/go/gen/wasmnest/http/host-http/host-http.wasm.go +13 -0
- package/go/gen/wasmnest/http/host-http/host-http.wit.go +40 -0
- package/go/gen/wasmnest/http-endpoint/host-http-endpoint/empty.s +3 -0
- package/go/gen/wasmnest/http-endpoint/host-http-endpoint/host-http-endpoint.wasm.go +17 -0
- package/go/gen/wasmnest/http-endpoint/host-http-endpoint/host-http-endpoint.wit.go +69 -0
- package/go/gen/wasmnest/mdns/host-mdns/empty.s +3 -0
- package/go/gen/wasmnest/mdns/host-mdns/host-mdns.wasm.go +29 -0
- package/go/gen/wasmnest/mdns/host-mdns/host-mdns.wit.go +101 -0
- package/go/gen/wasmnest/notify/host-notify/empty.s +3 -0
- package/go/gen/wasmnest/notify/host-notify/host-notify.wasm.go +13 -0
- package/go/gen/wasmnest/notify/host-notify/host-notify.wit.go +64 -0
- package/go/gen/wasmnest/peer/host-peer/abi.go +14 -0
- package/go/gen/wasmnest/peer/host-peer/empty.s +3 -0
- package/go/gen/wasmnest/peer/host-peer/host-peer.wasm.go +85 -0
- package/go/gen/wasmnest/peer/host-peer/host-peer.wit.go +357 -0
- package/go/gen/wasmnest/platform-desktop/host-platform-desktop/empty.s +3 -0
- package/go/gen/wasmnest/platform-desktop/host-platform-desktop/host-platform-desktop.wasm.go +21 -0
- package/go/gen/wasmnest/platform-desktop/host-platform-desktop/host-platform-desktop.wit.go +70 -0
- package/go/gen/wasmnest/plugin/abi-form/abi-form.exports.go +11 -0
- package/go/gen/wasmnest/plugin/abi-form/abi-form.wasm.go +13 -0
- package/go/gen/wasmnest/plugin/abi-form/abi-form.wit.go +7 -0
- package/go/gen/wasmnest/plugin/abi-form/empty.s +3 -0
- package/go/gen/wasmnest/plugin/command/command.exports.go +11 -0
- package/go/gen/wasmnest/plugin/command/command.wasm.go +19 -0
- package/go/gen/wasmnest/plugin/command/command.wit.go +6 -0
- package/go/gen/wasmnest/plugin/command/empty.s +3 -0
- package/go/gen/wasmnest/plugin/events/empty.s +3 -0
- package/go/gen/wasmnest/plugin/events/events.exports.go +52 -0
- package/go/gen/wasmnest/plugin/events/events.wasm.go +74 -0
- package/go/gen/wasmnest/plugin/events/events.wit.go +195 -0
- package/go/gen/wasmnest/plugin/host-bus/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-bus/host-bus.wasm.go +29 -0
- package/go/gen/wasmnest/plugin/host-bus/host-bus.wit.go +94 -0
- package/go/gen/wasmnest/plugin/host-config/abi.go +14 -0
- package/go/gen/wasmnest/plugin/host-config/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-config/host-config.wasm.go +13 -0
- package/go/gen/wasmnest/plugin/host-config/host-config.wit.go +21 -0
- package/go/gen/wasmnest/plugin/host-events/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-events/host-events.wasm.go +9 -0
- package/go/gen/wasmnest/plugin/host-events/host-events.wit.go +27 -0
- package/go/gen/wasmnest/plugin/host-fs/abi.go +14 -0
- package/go/gen/wasmnest/plugin/host-fs/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-fs/host-fs.wasm.go +33 -0
- package/go/gen/wasmnest/plugin/host-fs/host-fs.wit.go +86 -0
- package/go/gen/wasmnest/plugin/host-log/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-log/host-log.wasm.go +25 -0
- package/go/gen/wasmnest/plugin/host-log/host-log.wit.go +65 -0
- package/go/gen/wasmnest/plugin/host-metrics/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-metrics/host-metrics.wasm.go +13 -0
- package/go/gen/wasmnest/plugin/host-metrics/host-metrics.wit.go +34 -0
- package/go/gen/wasmnest/plugin/host-platform/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-platform/host-platform.wasm.go +21 -0
- package/go/gen/wasmnest/plugin/host-platform/host-platform.wit.go +85 -0
- package/go/gen/wasmnest/plugin/host-plugin-database/abi.go +14 -0
- package/go/gen/wasmnest/plugin/host-plugin-database/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-plugin-database/host-plugin-database.wasm.go +29 -0
- package/go/gen/wasmnest/plugin/host-plugin-database/host-plugin-database.wit.go +70 -0
- package/go/gen/wasmnest/plugin/host-storage/abi.go +14 -0
- package/go/gen/wasmnest/plugin/host-storage/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-storage/host-storage.wasm.go +21 -0
- package/go/gen/wasmnest/plugin/host-storage/host-storage.wit.go +44 -0
- package/go/gen/wasmnest/plugin/host-worker/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-worker/host-worker.wasm.go +17 -0
- package/go/gen/wasmnest/plugin/host-worker/host-worker.wit.go +50 -0
- package/go/gen/wasmnest/plugin/lifecycle/empty.s +3 -0
- package/go/gen/wasmnest/plugin/lifecycle/lifecycle.exports.go +32 -0
- package/go/gen/wasmnest/plugin/lifecycle/lifecycle.wasm.go +41 -0
- package/go/gen/wasmnest/plugin/lifecycle/lifecycle.wit.go +9 -0
- package/go/gen/wasmnest/plugin/manifest/empty.s +3 -0
- package/go/gen/wasmnest/plugin/manifest/manifest.exports.go +11 -0
- package/go/gen/wasmnest/plugin/manifest/manifest.wasm.go +13 -0
- package/go/gen/wasmnest/plugin/manifest/manifest.wit.go +6 -0
- package/go/gen/wasmnest/plugin/plugin/plugin.wit.go +4 -0
- package/go/gen/wasmnest/process/host-process/empty.s +3 -0
- package/go/gen/wasmnest/process/host-process/host-process.wasm.go +21 -0
- package/go/gen/wasmnest/process/host-process/host-process.wit.go +56 -0
- package/go/gen/wasmnest/pty/host-pty/abi.go +14 -0
- package/go/gen/wasmnest/pty/host-pty/empty.s +3 -0
- package/go/gen/wasmnest/pty/host-pty/host-pty.wasm.go +33 -0
- package/go/gen/wasmnest/pty/host-pty/host-pty.wit.go +164 -0
- package/go/gen/wasmnest/task/host-task/abi.go +14 -0
- package/go/gen/wasmnest/task/host-task/empty.s +3 -0
- package/go/gen/wasmnest/task/host-task/host-task.wasm.go +29 -0
- package/go/gen/wasmnest/task/host-task/host-task.wit.go +110 -0
- package/go/gen/wasmnest/timer/host-timer/empty.s +3 -0
- package/go/gen/wasmnest/timer/host-timer/host-timer.wasm.go +13 -0
- package/go/gen/wasmnest/timer/host-timer/host-timer.wit.go +25 -0
- package/go/gen/wasmnest/ws/host-websocket/empty.s +3 -0
- package/go/gen/wasmnest/ws/host-websocket/host-websocket.wasm.go +29 -0
- package/go/gen/wasmnest/ws/host-websocket/host-websocket.wit.go +109 -0
- package/go/gen/wasmnest/ws-server/host-websocket-server/empty.s +3 -0
- package/go/gen/wasmnest/ws-server/host-websocket-server/host-websocket-server.wasm.go +49 -0
- package/go/gen/wasmnest/ws-server/host-websocket-server/host-websocket-server.wit.go +220 -0
- package/go/go.mod +14 -0
- package/go/go.sum +2 -0
- package/go/sdk/dispatch.go +49 -0
- package/go/sdk/dispatch_test.go +81 -0
- package/go/sdk/entry_native.go +13 -0
- package/go/sdk/entry_wasip2.go +188 -0
- package/go/sdk/host_http_wasip2.go +42 -0
- package/go/sdk/host_wasip2.go +251 -0
- package/go/sdk/plugin.go +103 -0
- package/go/testplugin/index.js +1 -0
- package/go/testplugin/main.go +67 -0
- package/go/testplugin/plugin.json +24 -0
- package/go/tools/assemble-wit.mjs +152 -0
- package/go/tools/gen-bindings.mjs +51 -0
- package/go/wit/core.wit +273 -0
- package/go/wit/deps/api-call/cap-api-call.wit +20 -0
- package/go/wit/deps/app/cap-app.wit +54 -0
- package/go/wit/deps/auth-center/cap-auth-center.wit +124 -0
- package/go/wit/deps/clipboard/clipboard.wit +48 -0
- package/go/wit/deps/clocks/monotonic-clock.wit +45 -0
- package/go/wit/deps/clocks/wall-clock.wit +42 -0
- package/go/wit/deps/clocks/world.wit +6 -0
- package/go/wit/deps/connection-registry/cap-connection-registry.wit +40 -0
- package/go/wit/deps/crypto/cap-crypto.wit +68 -0
- package/go/wit/deps/filesystem/preopens.wit +8 -0
- package/go/wit/deps/filesystem/types.wit +634 -0
- package/go/wit/deps/filesystem/world.wit +6 -0
- package/go/wit/deps/fs-desktop/cap-fs-desktop.wit +29 -0
- package/go/wit/deps/http/http.wit +28 -0
- package/go/wit/deps/http-endpoint/cap-http.wit +44 -0
- package/go/wit/deps/io/error.wit +34 -0
- package/go/wit/deps/io/poll.wit +41 -0
- package/go/wit/deps/io/streams.wit +262 -0
- package/go/wit/deps/io/world.wit +6 -0
- package/go/wit/deps/mdns/mdns.wit +45 -0
- package/go/wit/deps/notify/notify.wit +51 -0
- package/go/wit/deps/peer/peer.wit +126 -0
- package/go/wit/deps/platform-desktop/cap-platform-desktop.wit +38 -0
- package/go/wit/deps/process/cap-process.wit +25 -0
- package/go/wit/deps/pty/pty.wit +80 -0
- package/go/wit/deps/random/insecure-seed.wit +25 -0
- package/go/wit/deps/random/insecure.wit +22 -0
- package/go/wit/deps/random/random.wit +26 -0
- package/go/wit/deps/random/world.wit +7 -0
- package/go/wit/deps/sockets/instance-network.wit +9 -0
- package/go/wit/deps/sockets/ip-name-lookup.wit +51 -0
- package/go/wit/deps/sockets/network.wit +145 -0
- package/go/wit/deps/sockets/tcp-create-socket.wit +27 -0
- package/go/wit/deps/sockets/tcp.wit +353 -0
- package/go/wit/deps/sockets/udp-create-socket.wit +27 -0
- package/go/wit/deps/sockets/udp.wit +266 -0
- package/go/wit/deps/sockets/world.wit +11 -0
- package/go/wit/deps/task/cap-task.wit +56 -0
- package/go/wit/deps/timer/cap-timer.wit +14 -0
- package/go/wit/deps/wasi-cli/command.wit +7 -0
- package/go/wit/deps/wasi-cli/environment.wit +18 -0
- package/go/wit/deps/wasi-cli/exit.wit +4 -0
- package/go/wit/deps/wasi-cli/imports.wit +20 -0
- package/go/wit/deps/wasi-cli/run.wit +4 -0
- package/go/wit/deps/wasi-cli/stdio.wit +17 -0
- package/go/wit/deps/wasi-cli/terminal.wit +49 -0
- package/go/wit/deps/ws/ws.wit +50 -0
- package/go/wit/deps/ws-server/cap-ws.wit +99 -0
- package/go/wit/go-plugin.wit +28 -0
- package/go/wit/plugin-face.wit +355 -0
- package/go/wit/wasmnest.wit +25 -0
- package/package.json +100 -3
- package/src/config.ts +49 -0
- package/src/global-dialog.ts +169 -0
- package/src/index.ts +88 -0
- package/src/runtime.ts +54 -0
- package/src/types.ts +681 -0
- package/src/ui/AppUpdateSection.d.ts +44 -0
- package/src/ui/AppUpdateSection.vue +253 -0
- package/src/ui/MarkdownEditor.vue +520 -0
- package/src/ui/NumberField.d.ts +49 -0
- package/src/ui/NumberField.vue +390 -0
- package/src/ui/PluginGlobalDialog.vue +401 -0
- package/src/ui/Select.d.ts +36 -0
- package/src/ui/Select.vue +220 -0
- package/src/ui/TerminalInputRail.vue +184 -0
- package/src/ui/apply-select-position.ts +65 -0
- package/src/ui/markdown-editor-syntax.ts +234 -0
- package/src/ui/markdown-editor.d.ts +36 -0
- package/src/ui/plugin-global-dialog.d.ts +12 -0
- package/src/ui/select-position.ts +79 -0
- package/src/ui/terminal-input-rail.d.ts +30 -0
- package/src/ui/zoom-compensation.d.ts +9 -0
- package/src/ui/zoom-compensation.ts +52 -0
- package/src/update.ts +123 -0
- package/src/vite-plugin.ts +124 -0
- package/template/README.md +39 -0
- package/template/package.json +23 -0
- package/template/plugin.json +14 -0
- package/template/rust/Cargo.toml +21 -0
- package/template/rust/src/lib.rs +39 -0
- package/template/src/env.d.ts +24 -0
- package/template/src/index.ts +37 -0
- package/template/tsconfig.json +17 -0
- package/template/vite.config.ts +21 -0
- package/tools/componentize/Cargo.lock +299 -0
- package/tools/componentize/Cargo.toml +18 -0
- package/tools/componentize/src/main.rs +197 -0
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package hostpeer represents the imported interface "wasmnest:peer/host-peer@0.0.1".
|
|
4
|
+
//
|
|
5
|
+
// ======================================================================
|
|
6
|
+
// 对等网络能力域自持契约分片(ADR 0052 D2/D3)
|
|
7
|
+
//
|
|
8
|
+
// 本文件是 `wasmnest-server-peer-net` 持有的**共享契约真源**(world `cap-peer`
|
|
9
|
+
// 只 import `host-peer`):双端 `compose.json` 的 caps.peer 直接指向本文件
|
|
10
|
+
// (pty 先例)——契约与实现同属一处,端组合不再经 core.wit 间接消费。
|
|
11
|
+
//
|
|
12
|
+
// 端生成物由 `scripts/compose-wit.mjs` 拼装(本文件与 core.wit 及其余 cap 分片
|
|
13
|
+
// 同 package 同版本)。分片只换绑定源、不换装配语义:`impl Host` / `HostModule` /
|
|
14
|
+
// `MODULE_*` / `DESC` 与 WIT 契约的函数集逐字一致。
|
|
15
|
+
// ======================================================================
|
|
16
|
+
// 对等网络基础能力:宿主只提供能力原语,
|
|
17
|
+
// file-transfer 插件是首个上层消费者
|
|
18
|
+
//
|
|
19
|
+
// 发现/信任/拨号/收发/浏览的引擎全部在宿主 peer-net 层;本接口只是
|
|
20
|
+
// 命令面的 WASM 投影。DTO 一律 JSON 字符串承载(camelCase,与 Tauri
|
|
21
|
+
// 命令返回形状一致)。事件经消息总线 `peer:*` topic 推送(host-bus 订阅):
|
|
22
|
+
// - `peer:devices` 发现缓存全量列表变化
|
|
23
|
+
// - `peer:connection` 节点连上/断开
|
|
24
|
+
// - `peer:consent` 首次连接确认请求
|
|
25
|
+
// - `peer:transfer-event` / `peer:receive-event` 引擎原始事件流(唯一回流——
|
|
26
|
+
// 旧快照 topic `peer:transfer` / `peer:receive` 已退役,任务状态真源在
|
|
27
|
+
// 插件事件归约状态机)
|
|
28
|
+
package hostpeer
|
|
29
|
+
|
|
30
|
+
import (
|
|
31
|
+
"go.bytecodealliance.org/cm"
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
// PeerNodeConfig represents the record "wasmnest:peer/host-peer@0.0.1#peer-node-config".
|
|
35
|
+
//
|
|
36
|
+
// per-app 节点启动配置(`start-node` 参数)
|
|
37
|
+
//
|
|
38
|
+
// 每个 app 声明自己的身份与网络参数,宿主按 app 维度隔离节点实例。
|
|
39
|
+
// `listen-port = 0` 表示由 OS 分配(防火墙友好场景应显式指定固定端口)。
|
|
40
|
+
//
|
|
41
|
+
// record peer-node-config {
|
|
42
|
+
// data-dir: string,
|
|
43
|
+
// device-name: string,
|
|
44
|
+
// listen-port: u16,
|
|
45
|
+
// }
|
|
46
|
+
type PeerNodeConfig struct {
|
|
47
|
+
_ cm.HostLayout `json:"-"`
|
|
48
|
+
// 节点数据目录(存放 identity keypair、known peers 等持久状态)
|
|
49
|
+
DataDir string `json:"data-dir"`
|
|
50
|
+
|
|
51
|
+
// 人类可读的设备名(广播给对端发现用)
|
|
52
|
+
DeviceName string `json:"device-name"`
|
|
53
|
+
|
|
54
|
+
// TCP 监听端口(0 = OS 自动分配)
|
|
55
|
+
ListenPort uint16 `json:"listen-port"`
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// DialPeer represents the imported function "dial-peer".
|
|
59
|
+
//
|
|
60
|
+
// 按 endpoint 拨号连接(ADR 0022 v2 终态,原 dial-peer-endpoint 转正):
|
|
61
|
+
// endpoint = `{ nodeId, addr, port }`(camelCase JSON,插件从自身设备缓存/
|
|
62
|
+
// mdns 事件解析后显式传入;宿主不内藏 node-id → 地址解析表)。握手期
|
|
63
|
+
// 「证书指纹 ↔ nodeId 绑定 + 信任检查」语义不变。成功返回 session 句柄
|
|
64
|
+
// (`sess-<uuid>`,后续按句柄寻址);denied/unreachable 以错误上抛
|
|
65
|
+
//
|
|
66
|
+
// dial-peer: func(endpoint-json: string) -> result<string, string>
|
|
67
|
+
//
|
|
68
|
+
//go:nosplit
|
|
69
|
+
func DialPeer(endpointJSON string) (result cm.Result[string, string, string]) {
|
|
70
|
+
endpointJson0, endpointJson1 := cm.LowerString(endpointJSON)
|
|
71
|
+
wasmimport_DialPeer((*uint8)(endpointJson0), (uint32)(endpointJson1), &result)
|
|
72
|
+
return
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Close represents the imported function "close".
|
|
76
|
+
//
|
|
77
|
+
// 统一资源关闭(ADR 0022 v2):session 句柄 = 断开连接;传输句柄 = 取消传输
|
|
78
|
+
// (先发送批取消、后接收批取消——pending 接收批被关闭即拒绝,闸门 fail-safe
|
|
79
|
+
// 的自然结果)。返回是否命中并关闭了任意资源
|
|
80
|
+
//
|
|
81
|
+
// close: func(handle: string) -> result<bool, string>
|
|
82
|
+
//
|
|
83
|
+
//go:nosplit
|
|
84
|
+
func Close(handle string) (result cm.Result[string, bool, string]) {
|
|
85
|
+
handle0, handle1 := cm.LowerString(handle)
|
|
86
|
+
wasmimport_Close((*uint8)(handle0), (uint32)(handle1), &result)
|
|
87
|
+
return
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// RespondConsent represents the imported function "respond-consent".
|
|
91
|
+
//
|
|
92
|
+
// 首次连接确认应答(返回是否命中了待确认项)
|
|
93
|
+
//
|
|
94
|
+
// respond-consent: func(request-id: string, accepted: bool) -> result<bool, string>
|
|
95
|
+
//
|
|
96
|
+
//go:nosplit
|
|
97
|
+
func RespondConsent(requestID string, accepted bool) (result cm.Result[string, bool, string]) {
|
|
98
|
+
requestId0, requestId1 := cm.LowerString(requestID)
|
|
99
|
+
accepted0 := (uint32)(cm.BoolToU32(accepted))
|
|
100
|
+
wasmimport_RespondConsent((*uint8)(requestId0), (uint32)(requestId1), (uint32)(accepted0), &result)
|
|
101
|
+
return
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// ListTrusted represents the imported function "list-trusted".
|
|
105
|
+
//
|
|
106
|
+
// 可信对端列表 → TrustedPeerDto JSON 数组
|
|
107
|
+
//
|
|
108
|
+
// list-trusted: func() -> result<string, string>
|
|
109
|
+
//
|
|
110
|
+
//go:nosplit
|
|
111
|
+
func ListTrusted() (result cm.Result[string, string, string]) {
|
|
112
|
+
wasmimport_ListTrusted(&result)
|
|
113
|
+
return
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// RevokeTrusted represents the imported function "revoke-trusted".
|
|
117
|
+
//
|
|
118
|
+
// 撤销对指定节点的信任(返回是否删除了条目)
|
|
119
|
+
//
|
|
120
|
+
// revoke-trusted: func(node-id: string) -> result<bool, string>
|
|
121
|
+
//
|
|
122
|
+
//go:nosplit
|
|
123
|
+
func RevokeTrusted(nodeID string) (result cm.Result[string, bool, string]) {
|
|
124
|
+
nodeId0, nodeId1 := cm.LowerString(nodeID)
|
|
125
|
+
wasmimport_RevokeTrusted((*uint8)(nodeId0), (uint32)(nodeId1), &result)
|
|
126
|
+
return
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// SendFiles represents the imported function "send-files".
|
|
130
|
+
//
|
|
131
|
+
// 向单个对端发送一批文件(目录递归展开、同名去重由宿主完成;
|
|
132
|
+
// 扇出 = 对多个对端各调一次,各批相互独立)→ 传输句柄(batch-id 字符串)
|
|
133
|
+
//
|
|
134
|
+
// 一次调用 = 一个会话立即发起,无宿主并发闸门排队——发送方向并发节流由
|
|
135
|
+
// 调用方在调用前自控(插件侧并发闸门)。paths 元素双形态:纯 string 或
|
|
136
|
+
// `{ path, encrypt? }` 对象(任一元素 encrypt=true → 本批强制加密);
|
|
137
|
+
// 旧产物载荷携带的 `concurrency` 并发脉冲字段已退役,出现即**显性报错**
|
|
138
|
+
// (fail-visible:旧产物按当前 SDK 重建)。连接已断时以句柄记忆的
|
|
139
|
+
// endpoint 自动重拨(信任检查照走引擎握手)
|
|
140
|
+
//
|
|
141
|
+
// send-files: func(session-handle: string, paths-json: string) -> result<string,
|
|
142
|
+
// string>
|
|
143
|
+
//
|
|
144
|
+
//go:nosplit
|
|
145
|
+
func SendFiles(sessionHandle string, pathsJSON string) (result cm.Result[string, string, string]) {
|
|
146
|
+
sessionHandle0, sessionHandle1 := cm.LowerString(sessionHandle)
|
|
147
|
+
pathsJson0, pathsJson1 := cm.LowerString(pathsJSON)
|
|
148
|
+
wasmimport_SendFiles((*uint8)(sessionHandle0), (uint32)(sessionHandle1), (*uint8)(pathsJson0), (uint32)(pathsJson1), &result)
|
|
149
|
+
return
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// RespondTransfer represents the imported function "respond-transfer".
|
|
153
|
+
//
|
|
154
|
+
// 接收批应答:accept=false 或超时视为拒绝
|
|
155
|
+
//
|
|
156
|
+
// respond-transfer: func(batch-id: string, accept: bool) -> result<_, string>
|
|
157
|
+
//
|
|
158
|
+
//go:nosplit
|
|
159
|
+
func RespondTransfer(batchID string, accept bool) (result cm.Result[string, struct{}, string]) {
|
|
160
|
+
batchId0, batchId1 := cm.LowerString(batchID)
|
|
161
|
+
accept0 := (uint32)(cm.BoolToU32(accept))
|
|
162
|
+
wasmimport_RespondTransfer((*uint8)(batchId0), (uint32)(batchId1), (uint32)(accept0), &result)
|
|
163
|
+
return
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// SetReceivePolicy represents the imported function "set-receive-policy".
|
|
167
|
+
//
|
|
168
|
+
// 设置接收策略(引擎安全闸门配置原语,ADR 0022 v3):mode = "ask" |
|
|
169
|
+
// "always_accept" | "always_deny";产品真源在插件侧,经本原语推送宿主闸门
|
|
170
|
+
//
|
|
171
|
+
// set-receive-policy: func(mode: string, timeout-secs: u64) -> result<_, string>
|
|
172
|
+
//
|
|
173
|
+
//go:nosplit
|
|
174
|
+
func SetReceivePolicy(mode string, timeoutSecs uint64) (result cm.Result[string, struct{}, string]) {
|
|
175
|
+
mode0, mode1 := cm.LowerString(mode)
|
|
176
|
+
timeoutSecs0 := (uint64)(timeoutSecs)
|
|
177
|
+
wasmimport_SetReceivePolicy((*uint8)(mode0), (uint32)(mode1), (uint64)(timeoutSecs0), &result)
|
|
178
|
+
return
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// PauseTransfer represents the imported function "pause-transfer".
|
|
182
|
+
//
|
|
183
|
+
// 显式暂停进行中的发送批(batch-id 寻址):会话数据面门控(wire Pause 帧
|
|
184
|
+
// + 供方停推流,连接保持),任务保留(含已传字节)不落历史;本端发起的
|
|
185
|
+
// 活跃会话查句柄表、serve 供流批查 handler 注册表。无命中返回错误
|
|
186
|
+
//
|
|
187
|
+
// pause-transfer: func(batch-id: string) -> result<_, string>
|
|
188
|
+
//
|
|
189
|
+
//go:nosplit
|
|
190
|
+
func PauseTransfer(batchID string) (result cm.Result[string, struct{}, string]) {
|
|
191
|
+
batchId0, batchId1 := cm.LowerString(batchID)
|
|
192
|
+
wasmimport_PauseTransfer((*uint8)(batchId0), (uint32)(batchId1), &result)
|
|
193
|
+
return
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// ResumeTransfer represents the imported function "resume-transfer".
|
|
197
|
+
//
|
|
198
|
+
// 恢复暂停的发送批(batch-id 寻址):活跃会话写 Resume 帧续流;会话已
|
|
199
|
+
// 中断的以句柄表记忆的源清单重新拨号续传(断点真源在接收端落盘侧)。
|
|
200
|
+
// 无命中返回错误
|
|
201
|
+
//
|
|
202
|
+
// resume-transfer: func(batch-id: string) -> result<_, string>
|
|
203
|
+
//
|
|
204
|
+
//go:nosplit
|
|
205
|
+
func ResumeTransfer(batchID string) (result cm.Result[string, struct{}, string]) {
|
|
206
|
+
batchId0, batchId1 := cm.LowerString(batchID)
|
|
207
|
+
wasmimport_ResumeTransfer((*uint8)(batchId0), (uint32)(batchId1), &result)
|
|
208
|
+
return
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// SetSharedRoots represents the imported function "set-shared-roots".
|
|
212
|
+
//
|
|
213
|
+
// 批量恢复暂停的发送批:**本接口不提供**——「全部」编排归插件自己
|
|
214
|
+
// 完成(遍历暂停批逐个调 [`resume-transfer`],并发节流由插件侧闸门
|
|
215
|
+
// 自控),宿主句柄表不做批量调度。该批量函数已删除:旧产物 import
|
|
216
|
+
// 它在实例化期因缺失 interface 显性失败(按当前 SDK 重建)
|
|
217
|
+
// 全量幂等替换本插件声明的共享根清单(ADR 0022 v2):
|
|
218
|
+
// 条目 `[{ id, name, path }]`(camelCase JSON;移动端 SAF 树以
|
|
219
|
+
// `safTreeUri` 字段替代 `path`)。注册表 CRUD 真源在插件侧,本函数
|
|
220
|
+
// 只同步暴露面镜像;任一条目非法整批拒绝
|
|
221
|
+
//
|
|
222
|
+
// set-shared-roots: func(dirs-json: string) -> result<_, string>
|
|
223
|
+
//
|
|
224
|
+
//go:nosplit
|
|
225
|
+
func SetSharedRoots(dirsJSON string) (result cm.Result[string, struct{}, string]) {
|
|
226
|
+
dirsJson0, dirsJson1 := cm.LowerString(dirsJSON)
|
|
227
|
+
wasmimport_SetSharedRoots((*uint8)(dirsJson0), (uint32)(dirsJson1), &result)
|
|
228
|
+
return
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// ListSharedRoots represents the imported function "list-shared-roots".
|
|
232
|
+
//
|
|
233
|
+
// 浏览对端共享根清单 → PeerSharedRootDto JSON 数组(仅 session 句柄寻址;
|
|
234
|
+
// 连接已断时以句柄记忆的 endpoint 自动重拨)
|
|
235
|
+
//
|
|
236
|
+
// list-shared-roots: func(session-handle: string) -> result<string, string>
|
|
237
|
+
//
|
|
238
|
+
//go:nosplit
|
|
239
|
+
func ListSharedRoots(sessionHandle string) (result cm.Result[string, string, string]) {
|
|
240
|
+
sessionHandle0, sessionHandle1 := cm.LowerString(sessionHandle)
|
|
241
|
+
wasmimport_ListSharedRoots((*uint8)(sessionHandle0), (uint32)(sessionHandle1), &result)
|
|
242
|
+
return
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// BrowseDirectory represents the imported function "browse-directory".
|
|
246
|
+
//
|
|
247
|
+
// 目录下钻 → RemoteBrowseDto JSON(仅 session 句柄寻址;重拨语义同上)
|
|
248
|
+
//
|
|
249
|
+
// browse-directory: func(session-handle: string, dir-id: string, rel-path: string)
|
|
250
|
+
// -> result<string, string>
|
|
251
|
+
//
|
|
252
|
+
//go:nosplit
|
|
253
|
+
func BrowseDirectory(sessionHandle string, dirID string, relPath string) (result cm.Result[string, string, string]) {
|
|
254
|
+
sessionHandle0, sessionHandle1 := cm.LowerString(sessionHandle)
|
|
255
|
+
dirId0, dirId1 := cm.LowerString(dirID)
|
|
256
|
+
relPath0, relPath1 := cm.LowerString(relPath)
|
|
257
|
+
wasmimport_BrowseDirectory((*uint8)(sessionHandle0), (uint32)(sessionHandle1), (*uint8)(dirId0), (uint32)(dirId1), (*uint8)(relPath0), (uint32)(relPath1), &result)
|
|
258
|
+
return
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// PullFiles represents the imported function "pull-files".
|
|
262
|
+
//
|
|
263
|
+
// 拉取对端文件(files = RemotePullFileDto JSON 数组)→ 入队文件数
|
|
264
|
+
// (仅 session 句柄寻址;重拨语义同上)。逐文件会话立即发起、无宿主
|
|
265
|
+
// 并发信号量——并发节流由调用方分批调用自控;每个拉取会话发起时经
|
|
266
|
+
// `peer:receive-event` 直推 `pull-started` 引擎事实事件
|
|
267
|
+
// (batchId/nodeId/files/totalSize/tsMs),任务行由插件事件归约自建
|
|
268
|
+
//
|
|
269
|
+
// pull-files: func(session-handle: string, dir-id: string, files-json: string) ->
|
|
270
|
+
// result<u32, string>
|
|
271
|
+
//
|
|
272
|
+
//go:nosplit
|
|
273
|
+
func PullFiles(sessionHandle string, dirID string, filesJSON string) (result cm.Result[string, uint32, string]) {
|
|
274
|
+
sessionHandle0, sessionHandle1 := cm.LowerString(sessionHandle)
|
|
275
|
+
dirId0, dirId1 := cm.LowerString(dirID)
|
|
276
|
+
filesJson0, filesJson1 := cm.LowerString(filesJSON)
|
|
277
|
+
wasmimport_PullFiles((*uint8)(sessionHandle0), (uint32)(sessionHandle1), (*uint8)(dirId0), (uint32)(dirId1), (*uint8)(filesJson0), (uint32)(filesJson1), &result)
|
|
278
|
+
return
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// SetDownloadDir represents the imported function "set-download-dir".
|
|
282
|
+
//
|
|
283
|
+
// 设置接收落点目录(空串 = 恢复默认 Downloads\WasmNest\;引擎落盘配置原语,
|
|
284
|
+
// ADR 0022 v3)
|
|
285
|
+
//
|
|
286
|
+
// set-download-dir: func(path: string) -> result<_, string>
|
|
287
|
+
//
|
|
288
|
+
//go:nosplit
|
|
289
|
+
func SetDownloadDir(path string) (result cm.Result[string, struct{}, string]) {
|
|
290
|
+
path0, path1 := cm.LowerString(path)
|
|
291
|
+
wasmimport_SetDownloadDir((*uint8)(path0), (uint32)(path1), &result)
|
|
292
|
+
return
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// StartNode represents the imported function "start-node".
|
|
296
|
+
//
|
|
297
|
+
// 按需启动本机 peer 节点(引擎级生命周期原语):app 声明自己的身份与
|
|
298
|
+
// 网络参数(`peer-node-config`),宿主按 app 维度隔离节点实例。
|
|
299
|
+
// 幂等——该 config 对应的节点已在跑时返回 false(未改变状态)。
|
|
300
|
+
//
|
|
301
|
+
// 属主语义:把节点从「未跑」带到「跑」的那次调用,其调用方成为节点属主;
|
|
302
|
+
// 已被别的插件起着的节点**不可被本调用接管**(报错,且文案不回带他方身份)。
|
|
303
|
+
// 谁起谁停:内核不再按硬编码插件 id 猜测节点归属
|
|
304
|
+
// (旧 `peer_net::FILE_TRANSFER_PLUGIN_ID` 与激活外壳随之退役)。
|
|
305
|
+
//
|
|
306
|
+
// start-node: func(config: peer-node-config) -> result<bool, string>
|
|
307
|
+
//
|
|
308
|
+
//go:nosplit
|
|
309
|
+
func StartNode(config PeerNodeConfig) (result cm.Result[string, bool, string]) {
|
|
310
|
+
config0, config1, config2, config3, config4 := lower_PeerNodeConfig(config)
|
|
311
|
+
wasmimport_StartNode((*uint8)(config0), (uint32)(config1), (*uint8)(config2), (uint32)(config3), (uint32)(config4), &result)
|
|
312
|
+
return
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// StopNode represents the imported function "stop-node".
|
|
316
|
+
//
|
|
317
|
+
// 让本机节点下线(幂等;节点未跑为 no-op):停广播 / 关监听 / 排水连接与
|
|
318
|
+
// 入站记账。仅节点属主可关停——非属主报错,文案不回带属主身份
|
|
319
|
+
//
|
|
320
|
+
// stop-node: func() -> result<bool, string>
|
|
321
|
+
//
|
|
322
|
+
//go:nosplit
|
|
323
|
+
func StopNode() (result cm.Result[string, bool, string]) {
|
|
324
|
+
wasmimport_StopNode(&result)
|
|
325
|
+
return
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// ActiveTransfers represents the imported function "active-transfers".
|
|
329
|
+
//
|
|
330
|
+
// 活跃传输批清单(实现 = 会话句柄表投影,接口形状不变):`[{ batchId, direction, status, totalBytes, transferredBytes,
|
|
331
|
+
// rateBps, updatedAtMs }]`(camelCase JSON 数组)。仅引擎会话事实——不含
|
|
332
|
+
// peerName / 文件清单 / 原因码等业务字段(展示名与业务视图由插件自持);
|
|
333
|
+
// 供插件事件归约状态机首屏重建(激活晚于事件时的兜底查询)
|
|
334
|
+
//
|
|
335
|
+
// active-transfers: func() -> result<string, string>
|
|
336
|
+
//
|
|
337
|
+
//go:nosplit
|
|
338
|
+
func ActiveTransfers() (result cm.Result[string, string, string]) {
|
|
339
|
+
wasmimport_ActiveTransfers(&result)
|
|
340
|
+
return
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// CollectOutgoing represents the imported function "collect-outgoing".
|
|
344
|
+
//
|
|
345
|
+
// 收集发送源:paths = string[] JSON,目录递归展开 + 批内同名去重
|
|
346
|
+
// (「名称 (2).ext」编号——批内 remote 路径唯一性属 wire 协议正确性)
|
|
347
|
+
// → `[{ path, size }]` JSON(path 为相对落位形状,size 为字节)。
|
|
348
|
+
// 仅读元数据不读内容;路径应来自 host-platform pick-* 用户选择(选择即授权)
|
|
349
|
+
//
|
|
350
|
+
// collect-outgoing: func(paths-json: string) -> result<string, string>
|
|
351
|
+
//
|
|
352
|
+
//go:nosplit
|
|
353
|
+
func CollectOutgoing(pathsJSON string) (result cm.Result[string, string, string]) {
|
|
354
|
+
pathsJson0, pathsJson1 := cm.LowerString(pathsJSON)
|
|
355
|
+
wasmimport_CollectOutgoing((*uint8)(pathsJson0), (uint32)(pathsJson1), &result)
|
|
356
|
+
return
|
|
357
|
+
}
|
|
@@ -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,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,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
|
+
}
|