@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.
- package/README.md +24 -4
- package/README_en.md +1 -1
- package/bin/cli.js +5 -5
- package/bin/manifest-gen.js +4 -0
- package/bin/manifest-validate.js +68 -6
- package/bin/permission-vocabulary.json +2 -2
- package/dev-shell/README.md +6 -5
- package/dev-shell/src/loader.ts +0 -5
- package/dev-shell/src/mock/commands.ts +1 -1
- package/dev-shell/src/mock/domain-context.ts +1 -1
- package/dev-shell/src/shell/types.ts +21 -32
- package/dev-shell/src/styles/shell.css +208 -2
- package/dev-shell/src/styles/style.css +72 -26
- package/dist/index.d.ts +44 -3
- package/dist/index.js +69 -1
- package/dist/types.d.ts +52 -5
- 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 +12 -1
- package/src/index.ts +8 -0
- package/src/types.ts +681 -630
- package/src/ui/AppUpdateSection.d.ts +44 -0
- package/src/ui/AppUpdateSection.vue +253 -0
- package/src/ui/NumberField.d.ts +49 -0
- package/src/ui/NumberField.vue +390 -0
- package/src/ui/Select.vue +4 -4
- package/src/update.ts +123 -0
- package/template/README.md +39 -39
- package/tools/componentize/Cargo.lock +30 -1
- package/tools/componentize/Cargo.toml +3 -0
- package/tools/componentize/src/main.rs +197 -94
- package/dev-shell/src/mock/agent-hub-commands.ts +0 -1065
- package/dev-shell/src/mock/agent-hub.ts +0 -42
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package hostmdns represents the imported interface "wasmnest:mdns/host-mdns@0.0.1".
|
|
4
|
+
//
|
|
5
|
+
// ======================================================================
|
|
6
|
+
// mDNS 能力域自持契约分片(ADR 0052 D2/D3)
|
|
7
|
+
//
|
|
8
|
+
// 本文件是 `wasmnest-discovery-engine` 持有的**共享契约真源**(world `cap-mdns`
|
|
9
|
+
// 只 import 浏览/广播域 `host-mdns`):双端 `compose.json` 的 caps.mdns 直接指向
|
|
10
|
+
// 本文件(pty 先例)——契约与实现同属一处,端组合不再经 core.wit 间接消费。
|
|
11
|
+
//
|
|
12
|
+
// 端生成物由 `scripts/compose-wit.mjs` 拼装(本文件与 core.wit 及其余 cap 分片
|
|
13
|
+
// 同 package 同版本)。分片只换绑定源、不换装配语义:`impl Host` / `HostModule` /
|
|
14
|
+
// `MODULE_*` / `DESC` 与 WIT 契约的函数集逐字一致。
|
|
15
|
+
// ======================================================================
|
|
16
|
+
// mDNS 浏览纯能力(ADR 0022 v2):browse-only,发现/离开事件原样透传
|
|
17
|
+
//
|
|
18
|
+
// 发现/离开经消息总线**属主私有 topic** 推送(host-bus 订阅):
|
|
19
|
+
// `<owner>::mdns:found` / `<owner>::mdns:lost`(构造用 SDK `mdns_event_topic`,
|
|
20
|
+
// 跨属主订阅被宿主拒绝),
|
|
21
|
+
// payload 原样透传:`{ instanceName, addresses: string[], port, txtRecords:
|
|
22
|
+
// Record<string,string> }`,宿主不做任何加工。设备列表(去重/TTL 过期/展示名
|
|
23
|
+
// 解读)是发现事件的派生视图,由消费插件自建缓存。
|
|
24
|
+
//
|
|
25
|
+
// 自我广播(register/advertise)不进本接口:「本机是谁」与宿主 TLS 监听器
|
|
26
|
+
// 同生共死,留在 peer-net 启动流程自动完成;无插件激活时主机照样可被发现。
|
|
27
|
+
package hostmdns
|
|
28
|
+
|
|
29
|
+
import (
|
|
30
|
+
"go.bytecodealliance.org/cm"
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
// Browse represents the imported function "browse".
|
|
34
|
+
//
|
|
35
|
+
// 浏览某服务类型,返回 browser 句柄;重复浏览同一类型允许(各自独立生命周期)。
|
|
36
|
+
// 事件定向投递到 `<plugin-id>::mdns:found` / `<plugin-id>::mdns:lost`(宿主实现)
|
|
37
|
+
//
|
|
38
|
+
// browse: func(service-type: string) -> result<string, string>
|
|
39
|
+
//
|
|
40
|
+
//go:nosplit
|
|
41
|
+
func Browse(serviceType string) (result cm.Result[string, string, string]) {
|
|
42
|
+
serviceType0, serviceType1 := cm.LowerString(serviceType)
|
|
43
|
+
wasmimport_Browse((*uint8)(serviceType0), (uint32)(serviceType1), &result)
|
|
44
|
+
return
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// StopBrowse represents the imported function "stop-browse".
|
|
48
|
+
//
|
|
49
|
+
// 停止浏览并回收句柄(返回是否存在该句柄);仅属主可停(跨插件拒绝);
|
|
50
|
+
// 插件停用时宿主自动回收其全部句柄
|
|
51
|
+
//
|
|
52
|
+
// stop-browse: func(browser-id: string) -> result<bool, string>
|
|
53
|
+
//
|
|
54
|
+
//go:nosplit
|
|
55
|
+
func StopBrowse(browserID string) (result cm.Result[string, bool, string]) {
|
|
56
|
+
browserId0, browserId1 := cm.LowerString(browserID)
|
|
57
|
+
wasmimport_StopBrowse((*uint8)(browserId0), (uint32)(browserId1), &result)
|
|
58
|
+
return
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Advertise represents the imported function "advertise".
|
|
62
|
+
//
|
|
63
|
+
// 广播某服务类型(v2 新增):返回 advertise 句柄。
|
|
64
|
+
// config-json 为纯引擎参数(服务类型 / 实例名 / 端口 / TXT 键值),
|
|
65
|
+
// 宿主零业务拼装;实例名省略时宿主按 `{plugin}-{短指纹}` 默认。
|
|
66
|
+
//
|
|
67
|
+
// advertise: func(config-json: string) -> result<string, string>
|
|
68
|
+
//
|
|
69
|
+
//go:nosplit
|
|
70
|
+
func Advertise(configJSON string) (result cm.Result[string, string, string]) {
|
|
71
|
+
configJson0, configJson1 := cm.LowerString(configJSON)
|
|
72
|
+
wasmimport_Advertise((*uint8)(configJson0), (uint32)(configJson1), &result)
|
|
73
|
+
return
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// StopAdvertise represents the imported function "stop-advertise".
|
|
77
|
+
//
|
|
78
|
+
// 停止广播并回收句柄(返回是否存在该句柄);仅属主可停;
|
|
79
|
+
// 插件停用时宿主自动回收其全部广播句柄。
|
|
80
|
+
//
|
|
81
|
+
// stop-advertise: func(advertise-id: string) -> result<bool, string>
|
|
82
|
+
//
|
|
83
|
+
//go:nosplit
|
|
84
|
+
func StopAdvertise(advertiseID string) (result cm.Result[string, bool, string]) {
|
|
85
|
+
advertiseId0, advertiseId1 := cm.LowerString(advertiseID)
|
|
86
|
+
wasmimport_StopAdvertise((*uint8)(advertiseId0), (uint32)(advertiseId1), &result)
|
|
87
|
+
return
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// IsAdvertising represents the imported function "is-advertising".
|
|
91
|
+
//
|
|
92
|
+
// 查询广播状态(返回是否存在该句柄);仅属主可查。
|
|
93
|
+
//
|
|
94
|
+
// is-advertising: func(advertise-id: string) -> result<bool, string>
|
|
95
|
+
//
|
|
96
|
+
//go:nosplit
|
|
97
|
+
func IsAdvertising(advertiseID string) (result cm.Result[string, bool, string]) {
|
|
98
|
+
advertiseId0, advertiseId1 := cm.LowerString(advertiseID)
|
|
99
|
+
wasmimport_IsAdvertising((*uint8)(advertiseId0), (uint32)(advertiseId1), &result)
|
|
100
|
+
return
|
|
101
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostnotify
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
// This file contains wasmimport and wasmexport declarations for "wasmnest:notify@0.0.1".
|
|
10
|
+
|
|
11
|
+
//go:wasmimport wasmnest:notify/host-notify@0.0.1 notify
|
|
12
|
+
//go:noescape
|
|
13
|
+
func wasmimport_Notify(title0 *uint8, title1 uint32, body0 *uint8, body1 uint32, optionsJson0 *uint8, optionsJson1 uint32, result *cm.Result[string, struct{}, string])
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package hostnotify represents the imported interface "wasmnest:notify/host-notify@0.0.1".
|
|
4
|
+
//
|
|
5
|
+
// ======================================================================
|
|
6
|
+
// 通知域共享契约(唯一真源;ADR 0052 D2/D3 · domain-owned-contracts 票 04)
|
|
7
|
+
//
|
|
8
|
+
// 本文件是 `host-notify` 的单一事实源:
|
|
9
|
+
// - 双端 `compose.json` 的 caps.notify 直接指向本文件(pty 先例推广);
|
|
10
|
+
// - 有实现两端投递机制不同、且都只有几行宿主代码,故本域没有共享引擎,
|
|
11
|
+
// 按 ADR 0052 D2/D4 用**轻量契约房**(`packages/wasmnest-notify-engine`)承载;
|
|
12
|
+
// 实现按端住宿主(桌面 / 移动各自 `src-tauri/src/plugin/notify.rs`)。
|
|
13
|
+
//
|
|
14
|
+
// ## 功能级口径(票 04 统一)
|
|
15
|
+
//
|
|
16
|
+
// - 原桌面 `host-events-desktop.notify(title, body)` 与原移动
|
|
17
|
+
// `host-notify.notify(title, body, options-json)` 合并为本接口的单一签名;
|
|
18
|
+
// 桌面 `host-events-desktop` 整 interface 退役。
|
|
19
|
+
// - 移动附加的权限查询 / 请求、即时震动、提示音 4 函数不是交集(桌面无
|
|
20
|
+
// 对应平台概念),改名 `host-notify-mobile` 留移动端独立包(`cap-notify-mobile.wit`,ADR 0061)。
|
|
21
|
+
//
|
|
22
|
+
// ## options-json 契约
|
|
23
|
+
//
|
|
24
|
+
// `{ "vibrate"?: bool, "sound"?: bool }`(camelCase;字段可省,缺省均为 `true`,
|
|
25
|
+
// 与移动端 v18 起的既有行为一致)。**严格解析**:非法 JSON / 字段类型错误 →
|
|
26
|
+
// `Err`(禁静默降级成默认值)。
|
|
27
|
+
//
|
|
28
|
+
// **平台不支持的选项静默忽略**(桌面无震动 / 提示音通道;移动全部支持):
|
|
29
|
+
// 报错会让「只想发通知」的桌面调用点无谓失败,而选项是装饰性诉求;
|
|
30
|
+
// 调用方按同一份代码跨端调用,不需要按端裁剪 options。
|
|
31
|
+
//
|
|
32
|
+
// ## 权限(各端自持,契约不规定门)
|
|
33
|
+
//
|
|
34
|
+
// - 桌面:**无权限门**(弹提示是插件常规能力,与退役前 `plugin_notify` /
|
|
35
|
+
// `host-events-desktop.notify` 口径逐字一致);
|
|
36
|
+
// - 移动:`notify`(fail-closed,未声明即拒——通知 / 震动 / 声音是用户打扰面)。
|
|
37
|
+
//
|
|
38
|
+
// 门在各端函数实现内(正确性由 Rust 端仲裁),契约面只描述签名。
|
|
39
|
+
// ======================================================================
|
|
40
|
+
// 系统通知(功能级交集;实现按端住宿主)
|
|
41
|
+
package hostnotify
|
|
42
|
+
|
|
43
|
+
import (
|
|
44
|
+
"go.bytecodealliance.org/cm"
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
// Notify represents the imported function "notify".
|
|
48
|
+
//
|
|
49
|
+
// 发送系统通知(文案由插件 i18n 构建、原样透传,宿主不做文案加工)。
|
|
50
|
+
//
|
|
51
|
+
// options-json(camelCase,字段可省):`{ vibrate?: bool, sound?: bool }`,
|
|
52
|
+
// 缺省均 true;非法 JSON / 字段类型错误 → Err(严格解析)。
|
|
53
|
+
// 平台不支持的选项**静默忽略**(桌面无震动 / 提示音通道)。
|
|
54
|
+
//
|
|
55
|
+
// notify: func(title: string, body: string, options-json: string) -> result<_, string>
|
|
56
|
+
//
|
|
57
|
+
//go:nosplit
|
|
58
|
+
func Notify(title string, body string, optionsJSON string) (result cm.Result[string, struct{}, string]) {
|
|
59
|
+
title0, title1 := cm.LowerString(title)
|
|
60
|
+
body0, body1 := cm.LowerString(body)
|
|
61
|
+
optionsJson0, optionsJson1 := cm.LowerString(optionsJSON)
|
|
62
|
+
wasmimport_Notify((*uint8)(title0), (uint32)(title1), (*uint8)(body0), (uint32)(body1), (*uint8)(optionsJson0), (uint32)(optionsJson1), &result)
|
|
63
|
+
return
|
|
64
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostpeer
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
func lower_PeerNodeConfig(v PeerNodeConfig) (f0 *uint8, f1 uint32, f2 *uint8, f3 uint32, f4 uint32) {
|
|
10
|
+
f0, f1 = cm.LowerString(v.DataDir)
|
|
11
|
+
f2, f3 = cm.LowerString(v.DeviceName)
|
|
12
|
+
f4 = (uint32)(v.ListenPort)
|
|
13
|
+
return
|
|
14
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostpeer
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
// This file contains wasmimport and wasmexport declarations for "wasmnest:peer@0.0.1".
|
|
10
|
+
|
|
11
|
+
//go:wasmimport wasmnest:peer/host-peer@0.0.1 dial-peer
|
|
12
|
+
//go:noescape
|
|
13
|
+
func wasmimport_DialPeer(endpointJson0 *uint8, endpointJson1 uint32, result *cm.Result[string, string, string])
|
|
14
|
+
|
|
15
|
+
//go:wasmimport wasmnest:peer/host-peer@0.0.1 close
|
|
16
|
+
//go:noescape
|
|
17
|
+
func wasmimport_Close(handle0 *uint8, handle1 uint32, result *cm.Result[string, bool, string])
|
|
18
|
+
|
|
19
|
+
//go:wasmimport wasmnest:peer/host-peer@0.0.1 respond-consent
|
|
20
|
+
//go:noescape
|
|
21
|
+
func wasmimport_RespondConsent(requestId0 *uint8, requestId1 uint32, accepted0 uint32, result *cm.Result[string, bool, string])
|
|
22
|
+
|
|
23
|
+
//go:wasmimport wasmnest:peer/host-peer@0.0.1 list-trusted
|
|
24
|
+
//go:noescape
|
|
25
|
+
func wasmimport_ListTrusted(result *cm.Result[string, string, string])
|
|
26
|
+
|
|
27
|
+
//go:wasmimport wasmnest:peer/host-peer@0.0.1 revoke-trusted
|
|
28
|
+
//go:noescape
|
|
29
|
+
func wasmimport_RevokeTrusted(nodeId0 *uint8, nodeId1 uint32, result *cm.Result[string, bool, string])
|
|
30
|
+
|
|
31
|
+
//go:wasmimport wasmnest:peer/host-peer@0.0.1 send-files
|
|
32
|
+
//go:noescape
|
|
33
|
+
func wasmimport_SendFiles(sessionHandle0 *uint8, sessionHandle1 uint32, pathsJson0 *uint8, pathsJson1 uint32, result *cm.Result[string, string, string])
|
|
34
|
+
|
|
35
|
+
//go:wasmimport wasmnest:peer/host-peer@0.0.1 respond-transfer
|
|
36
|
+
//go:noescape
|
|
37
|
+
func wasmimport_RespondTransfer(batchId0 *uint8, batchId1 uint32, accept0 uint32, result *cm.Result[string, struct{}, string])
|
|
38
|
+
|
|
39
|
+
//go:wasmimport wasmnest:peer/host-peer@0.0.1 set-receive-policy
|
|
40
|
+
//go:noescape
|
|
41
|
+
func wasmimport_SetReceivePolicy(mode0 *uint8, mode1 uint32, timeoutSecs0 uint64, result *cm.Result[string, struct{}, string])
|
|
42
|
+
|
|
43
|
+
//go:wasmimport wasmnest:peer/host-peer@0.0.1 pause-transfer
|
|
44
|
+
//go:noescape
|
|
45
|
+
func wasmimport_PauseTransfer(batchId0 *uint8, batchId1 uint32, result *cm.Result[string, struct{}, string])
|
|
46
|
+
|
|
47
|
+
//go:wasmimport wasmnest:peer/host-peer@0.0.1 resume-transfer
|
|
48
|
+
//go:noescape
|
|
49
|
+
func wasmimport_ResumeTransfer(batchId0 *uint8, batchId1 uint32, result *cm.Result[string, struct{}, string])
|
|
50
|
+
|
|
51
|
+
//go:wasmimport wasmnest:peer/host-peer@0.0.1 set-shared-roots
|
|
52
|
+
//go:noescape
|
|
53
|
+
func wasmimport_SetSharedRoots(dirsJson0 *uint8, dirsJson1 uint32, result *cm.Result[string, struct{}, string])
|
|
54
|
+
|
|
55
|
+
//go:wasmimport wasmnest:peer/host-peer@0.0.1 list-shared-roots
|
|
56
|
+
//go:noescape
|
|
57
|
+
func wasmimport_ListSharedRoots(sessionHandle0 *uint8, sessionHandle1 uint32, result *cm.Result[string, string, string])
|
|
58
|
+
|
|
59
|
+
//go:wasmimport wasmnest:peer/host-peer@0.0.1 browse-directory
|
|
60
|
+
//go:noescape
|
|
61
|
+
func wasmimport_BrowseDirectory(sessionHandle0 *uint8, sessionHandle1 uint32, dirId0 *uint8, dirId1 uint32, relPath0 *uint8, relPath1 uint32, result *cm.Result[string, string, string])
|
|
62
|
+
|
|
63
|
+
//go:wasmimport wasmnest:peer/host-peer@0.0.1 pull-files
|
|
64
|
+
//go:noescape
|
|
65
|
+
func wasmimport_PullFiles(sessionHandle0 *uint8, sessionHandle1 uint32, dirId0 *uint8, dirId1 uint32, filesJson0 *uint8, filesJson1 uint32, result *cm.Result[string, uint32, string])
|
|
66
|
+
|
|
67
|
+
//go:wasmimport wasmnest:peer/host-peer@0.0.1 set-download-dir
|
|
68
|
+
//go:noescape
|
|
69
|
+
func wasmimport_SetDownloadDir(path0 *uint8, path1 uint32, result *cm.Result[string, struct{}, string])
|
|
70
|
+
|
|
71
|
+
//go:wasmimport wasmnest:peer/host-peer@0.0.1 start-node
|
|
72
|
+
//go:noescape
|
|
73
|
+
func wasmimport_StartNode(config0 *uint8, config1 uint32, config2 *uint8, config3 uint32, config4 uint32, result *cm.Result[string, bool, string])
|
|
74
|
+
|
|
75
|
+
//go:wasmimport wasmnest:peer/host-peer@0.0.1 stop-node
|
|
76
|
+
//go:noescape
|
|
77
|
+
func wasmimport_StopNode(result *cm.Result[string, bool, string])
|
|
78
|
+
|
|
79
|
+
//go:wasmimport wasmnest:peer/host-peer@0.0.1 active-transfers
|
|
80
|
+
//go:noescape
|
|
81
|
+
func wasmimport_ActiveTransfers(result *cm.Result[string, string, string])
|
|
82
|
+
|
|
83
|
+
//go:wasmimport wasmnest:peer/host-peer@0.0.1 collect-outgoing
|
|
84
|
+
//go:noescape
|
|
85
|
+
func wasmimport_CollectOutgoing(pathsJson0 *uint8, pathsJson1 uint32, result *cm.Result[string, string, string])
|
|
@@ -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
|
+
}
|