@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,69 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package hosthttpendpoint represents the imported interface "wasmnest:http-endpoint/host-http-endpoint@0.0.1".
|
|
4
|
+
//
|
|
5
|
+
// ======================================================================
|
|
6
|
+
// HTTP 服务端域(桌面扩展分片,自 `host-http` 拆出)
|
|
7
|
+
//
|
|
8
|
+
// 双端功能区分的归属(ADR 0052 D3/D4):出站 `host-http`(1 函数)是双端功能级
|
|
9
|
+
// 交集,契约与实现都归能力域 crate `wasmnest-server-http`(真源
|
|
10
|
+
// `packages/wasmnest-server-http/wit/http.wit`,world `cap-http`);本 interface
|
|
11
|
+
// 只剩桌面独有服务端域(入站路由注册 2 函数,v29 HTTP 路由代码注册下沉专项)。
|
|
12
|
+
// 移动端是自持业务 App,不承载服务端网关与插件入站路由(ADR 0018),不跟演
|
|
13
|
+
// (ADR 0019 双端偏离)。
|
|
14
|
+
//
|
|
15
|
+
// 属主隔离:**全部函数仅属主可调**;注册表按调用方插件
|
|
16
|
+
// 注入 `plugin_id`(插件不能注册他人名下路由);插件停用时宿主自动清空其全部注册
|
|
17
|
+
// 路由(同 host-websocket `purge_for_plugin` 先例)。
|
|
18
|
+
//
|
|
19
|
+
// 权限:`network:http`(与前端面 `http.registerEndpoint` 同权限位)。
|
|
20
|
+
//
|
|
21
|
+
// 桌面端 cap 真源:`compose.json` caps.http-endpoint 指向本文件,
|
|
22
|
+
// 由 `scripts/compose-wit.mjs` 复制为生成物 `rust/wit/cap-http-endpoint.wit`。
|
|
23
|
+
package hosthttpendpoint
|
|
24
|
+
|
|
25
|
+
import (
|
|
26
|
+
"go.bytecodealliance.org/cm"
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
// RegisterEndpoint represents the imported function "register-endpoint".
|
|
30
|
+
//
|
|
31
|
+
// 在宿主 HTTP 服务器注册插件端点。config-json(camelCase):
|
|
32
|
+
// `{ path, host?, methods?, auth? }`
|
|
33
|
+
// - `path`:插件内相对端点段,宿主拼出内部可达路径 `/api/plugin/<plugin-id>/<path>`
|
|
34
|
+
// (命名空间段由宿主注入,插件只提供后缀);
|
|
35
|
+
// - `host`:可选对外 URL 别名(如 `/api/configs`;支持 `{id}` 模板段如
|
|
36
|
+
// `/api/sessions/{id}/stop`——模板捕获值经 `_http_endpoint` 的 `params` 字段
|
|
37
|
+
// 传给插件,宿主不拿捕获值构造路径);
|
|
38
|
+
// - `methods`:host 别名的允许方法(缺省 `["GET"]`);
|
|
39
|
+
// - `auth` = "jwt"(缺省,最严:要求宿主已验签)| "none"(免凭证转发)。
|
|
40
|
+
//
|
|
41
|
+
// 链路加密策略**按应用**决定(应用设置页 → `link_crypto::set_app_policy`),
|
|
42
|
+
// 覆盖该应用全部 HTTP / WS 端点;本注册配置不携带 `encryption` 字段
|
|
43
|
+
// (未知字段 → `Err`,严格解析,绝不静默忽略)。
|
|
44
|
+
//
|
|
45
|
+
// 冲突仲裁(fail-visible):同一 `host+method` 已被其他插件注册 → `Err`(不覆盖
|
|
46
|
+
// 在位者);本插件内部 path 重复注册 → `Err`。成功 → 返回端点句柄 `http-<uuid>`。
|
|
47
|
+
//
|
|
48
|
+
// register-endpoint: func(config-json: string) -> result<string, string>
|
|
49
|
+
//
|
|
50
|
+
//go:nosplit
|
|
51
|
+
func RegisterEndpoint(configJSON string) (result cm.Result[string, string, string]) {
|
|
52
|
+
configJson0, configJson1 := cm.LowerString(configJSON)
|
|
53
|
+
wasmimport_RegisterEndpoint((*uint8)(configJson0), (uint32)(configJson1), &result)
|
|
54
|
+
return
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// UnregisterEndpoint represents the imported function "unregister-endpoint".
|
|
58
|
+
//
|
|
59
|
+
// 注销本插件注册的端点(未知句柄 → `Ok(false)`,他人句柄 → `Err` 属主仲裁);
|
|
60
|
+
// 宿主侧插件停用回收同样会清空其全部注册路由(幂等)。
|
|
61
|
+
//
|
|
62
|
+
// unregister-endpoint: func(endpoint-id: string) -> result<bool, string>
|
|
63
|
+
//
|
|
64
|
+
//go:nosplit
|
|
65
|
+
func UnregisterEndpoint(endpointID string) (result cm.Result[string, bool, string]) {
|
|
66
|
+
endpointId0, endpointId1 := cm.LowerString(endpointID)
|
|
67
|
+
wasmimport_UnregisterEndpoint((*uint8)(endpointId0), (uint32)(endpointId1), &result)
|
|
68
|
+
return
|
|
69
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostmdns
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
// This file contains wasmimport and wasmexport declarations for "wasmnest:mdns@0.0.1".
|
|
10
|
+
|
|
11
|
+
//go:wasmimport wasmnest:mdns/host-mdns@0.0.1 browse
|
|
12
|
+
//go:noescape
|
|
13
|
+
func wasmimport_Browse(serviceType0 *uint8, serviceType1 uint32, result *cm.Result[string, string, string])
|
|
14
|
+
|
|
15
|
+
//go:wasmimport wasmnest:mdns/host-mdns@0.0.1 stop-browse
|
|
16
|
+
//go:noescape
|
|
17
|
+
func wasmimport_StopBrowse(browserId0 *uint8, browserId1 uint32, result *cm.Result[string, bool, string])
|
|
18
|
+
|
|
19
|
+
//go:wasmimport wasmnest:mdns/host-mdns@0.0.1 advertise
|
|
20
|
+
//go:noescape
|
|
21
|
+
func wasmimport_Advertise(configJson0 *uint8, configJson1 uint32, result *cm.Result[string, string, string])
|
|
22
|
+
|
|
23
|
+
//go:wasmimport wasmnest:mdns/host-mdns@0.0.1 stop-advertise
|
|
24
|
+
//go:noescape
|
|
25
|
+
func wasmimport_StopAdvertise(advertiseId0 *uint8, advertiseId1 uint32, result *cm.Result[string, bool, string])
|
|
26
|
+
|
|
27
|
+
//go:wasmimport wasmnest:mdns/host-mdns@0.0.1 is-advertising
|
|
28
|
+
//go:noescape
|
|
29
|
+
func wasmimport_IsAdvertising(advertiseId0 *uint8, advertiseId1 uint32, result *cm.Result[string, bool, string])
|
|
@@ -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])
|