@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,14 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostclipboard
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
"unsafe"
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
// OptionStringShape is used for storage in variant or result types.
|
|
11
|
+
type OptionStringShape struct {
|
|
12
|
+
_ cm.HostLayout
|
|
13
|
+
shape [unsafe.Sizeof(cm.Option[string]{})]byte
|
|
14
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostclipboard
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
// This file contains wasmimport and wasmexport declarations for "wasmnest:clipboard@0.0.1".
|
|
10
|
+
|
|
11
|
+
//go:wasmimport wasmnest:clipboard/host-clipboard@0.0.1 read-text
|
|
12
|
+
//go:noescape
|
|
13
|
+
func wasmimport_ReadText(result *cm.Result[OptionStringShape, cm.Option[string], string])
|
|
14
|
+
|
|
15
|
+
//go:wasmimport wasmnest:clipboard/host-clipboard@0.0.1 write-text
|
|
16
|
+
//go:noescape
|
|
17
|
+
func wasmimport_WriteText(text0 *uint8, text1 uint32, result *cm.Result[string, struct{}, string])
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package hostclipboard represents the imported interface "wasmnest:clipboard/host-clipboard@0.0.1".
|
|
4
|
+
//
|
|
5
|
+
// ======================================================================
|
|
6
|
+
// 剪贴板域共享契约(唯一真源;ADR 0052 D2/D3 · domain-owned-contracts 票 04)
|
|
7
|
+
//
|
|
8
|
+
// 本文件是 `host-clipboard` 的单一事实源:
|
|
9
|
+
// - 双端 `compose.json` 的 caps.clipboard 直接指向本文件(pty 先例推广);
|
|
10
|
+
// - 有实现两端底层机制不同、且都只有几行宿主代码,故本域没有共享引擎,
|
|
11
|
+
// 按 ADR 0052 D2/D4 用**轻量契约房**(`wasmnest-clipboard-engine`)承载;
|
|
12
|
+
// 实现按端住宿主(桌面 / 移动各自 `src-tauri/src/plugin/clipboard.rs`)。
|
|
13
|
+
//
|
|
14
|
+
// ## 功能级口径(票 04 统一)
|
|
15
|
+
//
|
|
16
|
+
// - 桌面与移动共享同一 `host-clipboard` 接口:`read-text` 读系统剪贴板文本、
|
|
17
|
+
// `write-text` 写文本到系统剪贴板;
|
|
18
|
+
// - 读操作返回 `option<string>`(剪贴板为空或含非文本内容时返回 `none`);
|
|
19
|
+
// - 写操作返回空结果(成功即 `ok`,失败经 `err` 传宿主侧可读消息)。
|
|
20
|
+
//
|
|
21
|
+
// ## 权限(各端自持,契约不规定门)
|
|
22
|
+
//
|
|
23
|
+
// - 桌面:`clipboard:read` / `clipboard:write`(fail-closed,未声明即拒——
|
|
24
|
+
// 剪贴板是用户隐私面,跨应用数据泄露风险高);
|
|
25
|
+
// - 移动:同桌面(双端同一口径,与 `host-clipboard` 共享契约对齐)。
|
|
26
|
+
//
|
|
27
|
+
// 门在各端函数实现内(正确性由 Rust 端仲裁),契约面只描述签名。
|
|
28
|
+
// ======================================================================
|
|
29
|
+
// 系统剪贴板读写(功能级交集;实现按端住宿主)
|
|
30
|
+
package hostclipboard
|
|
31
|
+
|
|
32
|
+
import (
|
|
33
|
+
"go.bytecodealliance.org/cm"
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
// ReadText represents the imported function "read-text".
|
|
37
|
+
//
|
|
38
|
+
// 读取系统剪贴板文本内容。
|
|
39
|
+
//
|
|
40
|
+
// 返回 `ok(option<string>)`:剪贴板有文本时返回 `some(text)`,剪贴板为空
|
|
41
|
+
// 或含非文本内容(图片、文件等)时返回 `none`。失败返回 `err(message)`。
|
|
42
|
+
//
|
|
43
|
+
// **权限 `clipboard:read`(manifest 必须单独声明)**:未声明即 `Err`。
|
|
44
|
+
//
|
|
45
|
+
// read-text: func() -> result<option<string>, string>
|
|
46
|
+
//
|
|
47
|
+
//go:nosplit
|
|
48
|
+
func ReadText() (result cm.Result[OptionStringShape, cm.Option[string], string]) {
|
|
49
|
+
wasmimport_ReadText(&result)
|
|
50
|
+
return
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// WriteText represents the imported function "write-text".
|
|
54
|
+
//
|
|
55
|
+
// 写入文本到系统剪贴板。
|
|
56
|
+
//
|
|
57
|
+
// 成功返回 `ok`,失败返回 `err(message)`(如剪贴板被其他进程锁定)。
|
|
58
|
+
//
|
|
59
|
+
// **权限 `clipboard:write`(manifest 必须单独声明)**:未声明即 `Err`。
|
|
60
|
+
//
|
|
61
|
+
// write-text: func(text: string) -> result<_, string>
|
|
62
|
+
//
|
|
63
|
+
//go:nosplit
|
|
64
|
+
func WriteText(text string) (result cm.Result[string, struct{}, string]) {
|
|
65
|
+
text0, text1 := cm.LowerString(text)
|
|
66
|
+
wasmimport_WriteText((*uint8)(text0), (uint32)(text1), &result)
|
|
67
|
+
return
|
|
68
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostconnectionregistry
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
// This file contains wasmimport and wasmexport declarations for "wasmnest:connection-registry@0.0.1".
|
|
10
|
+
|
|
11
|
+
//go:wasmimport wasmnest:connection-registry/host-connection-registry@0.0.1 connections-list
|
|
12
|
+
//go:noescape
|
|
13
|
+
func wasmimport_ConnectionsList(result *cm.Result[string, string, string])
|
package/go/gen/wasmnest/connection-registry/host-connection-registry/host-connection-registry.wit.go
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package hostconnectionregistry represents the imported interface "wasmnest:connection-registry/host-connection-registry@0.0.1".
|
|
4
|
+
//
|
|
5
|
+
// 桌面端能力域分片(WIT 按包拆分,ADR 0061):一个能力域 = 一个独立包,
|
|
6
|
+
// 版本独立演进——本包 WIT 变更只 bump 本包,不波及未 import 它的应用。
|
|
7
|
+
// 端 `plugin` world 经 `include wasmnest:connection-registry/cap-connection-registry@0.0.1;`
|
|
8
|
+
// 并入本接口。
|
|
9
|
+
// 宿主 server 的在册连接清单(自 `host-session.connections-list` 迁出)
|
|
10
|
+
//
|
|
11
|
+
// **为什么单独成 interface**:这份事实的主语是宿主 WS 服务的连接注册表
|
|
12
|
+
// (`WsSessionRegistry`),不是插件自己开的 socket(那是 `host-websocket` 的
|
|
13
|
+
// `ws:client` / `ws:server`),也不是会话(会话真源已在 `com.wasmnest.bedcode`
|
|
14
|
+
// 登记域)。它历史上住进 `host-session` 只是当时顺手——而 `host-session` 整 interface
|
|
15
|
+
// 已在 v27 退役,这份**只有宿主机进程知道、且零会话语义**的事实因此必须
|
|
16
|
+
// 换个家活下来(ADR 0022 v12 裁决 5「迁独立原语」);**迁出后唯一的调用入口就是本
|
|
17
|
+
// interface**(旧别名随 `host-session` 一起删除,不留第二把钥匙)。
|
|
18
|
+
//
|
|
19
|
+
// 权限 `connection:read`(新位,替代原 `session:read`;迁移期两条入口共用
|
|
20
|
+
// 这一判据,`host-session` 侧那一条已随 v27 删除)。
|
|
21
|
+
//
|
|
22
|
+
// **无排序无解读**:返回内核 WS 连接注册表的全部原始条目,按注册表存储序
|
|
23
|
+
// (HashMap 迭代序,不保证稳定),不做过滤(含未认证连接)、不做合并(不关联配对记录)、
|
|
24
|
+
// 不加派生字段(无会话数 / 在线判定——那些是插件侧派生视图的职责)。
|
|
25
|
+
// JSON 数组,元素(原始字段名,camelCase):
|
|
26
|
+
// `{ clientId, deviceName?, fingerprint?, addr, authenticated, connectedAt }`
|
|
27
|
+
// (`clientId` = 注册表键 = 连接地址串;`deviceName` / `fingerprint` 来自 JWT claims,
|
|
28
|
+
// 认证前为 null;`connectedAt` 为 epoch 毫秒)。
|
|
29
|
+
//
|
|
30
|
+
// 注:WIT 中 `list` 是关键字,故函数名沿用 `connections-list`。
|
|
31
|
+
//
|
|
32
|
+
// **为什么叫 registry**:移动分片曾声明同名 `host-connection`,两者函数集**零交集**
|
|
33
|
+
// ——本 interface 是「在册连接清单」角色,移动侧是「主连接目标」角色
|
|
34
|
+
// (`host-connection-target`)。统一契约(并集 world)下同名会撞 duplicate
|
|
35
|
+
// definition,故按角色定名。
|
|
36
|
+
package hostconnectionregistry
|
|
37
|
+
|
|
38
|
+
import (
|
|
39
|
+
"go.bytecodealliance.org/cm"
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
// ConnectionsList represents the imported function "connections-list".
|
|
43
|
+
//
|
|
44
|
+
// connections-list: func() -> result<string, string>
|
|
45
|
+
//
|
|
46
|
+
//go:nosplit
|
|
47
|
+
func ConnectionsList() (result cm.Result[string, string, string]) {
|
|
48
|
+
wasmimport_ConnectionsList(&result)
|
|
49
|
+
return
|
|
50
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostcrypto
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
func lower_OptionListU8(v cm.Option[cm.List[uint8]]) (f0 uint32, f1 *uint8, f2 uint32) {
|
|
10
|
+
some := v.Some()
|
|
11
|
+
if some != nil {
|
|
12
|
+
f0 = 1
|
|
13
|
+
v1, v2 := cm.LowerList(*some)
|
|
14
|
+
f1 = (*uint8)(v1)
|
|
15
|
+
f2 = (uint32)(v2)
|
|
16
|
+
}
|
|
17
|
+
return
|
|
18
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostcrypto
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
// This file contains wasmimport and wasmexport declarations for "wasmnest:crypto@0.0.1".
|
|
10
|
+
|
|
11
|
+
//go:wasmimport wasmnest:crypto/host-crypto@0.0.1 aead-encrypt
|
|
12
|
+
//go:noescape
|
|
13
|
+
func wasmimport_AeadEncrypt(algorithm0 *uint8, algorithm1 uint32, key0 *uint8, key1 uint32, nonce0 *uint8, nonce1 uint32, plaintext0 *uint8, plaintext1 uint32, aad0 uint32, aad1 *uint8, aad2 uint32, result *cm.Result[cm.List[uint8], cm.List[uint8], string])
|
|
14
|
+
|
|
15
|
+
//go:wasmimport wasmnest:crypto/host-crypto@0.0.1 aead-decrypt
|
|
16
|
+
//go:noescape
|
|
17
|
+
func wasmimport_AeadDecrypt(algorithm0 *uint8, algorithm1 uint32, key0 *uint8, key1 uint32, nonce0 *uint8, nonce1 uint32, ciphertext0 *uint8, ciphertext1 uint32, aad0 uint32, aad1 *uint8, aad2 uint32, result *cm.Result[cm.List[uint8], cm.List[uint8], string])
|
|
18
|
+
|
|
19
|
+
//go:wasmimport wasmnest:crypto/host-crypto@0.0.1 aead-generate-key
|
|
20
|
+
//go:noescape
|
|
21
|
+
func wasmimport_AeadGenerateKey(algorithm0 *uint8, algorithm1 uint32, result *cm.Result[cm.List[uint8], cm.List[uint8], string])
|
|
22
|
+
|
|
23
|
+
//go:wasmimport wasmnest:crypto/host-crypto@0.0.1 aead-generate-nonce
|
|
24
|
+
//go:noescape
|
|
25
|
+
func wasmimport_AeadGenerateNonce(algorithm0 *uint8, algorithm1 uint32, result *cm.Result[cm.List[uint8], cm.List[uint8], string])
|
|
26
|
+
|
|
27
|
+
//go:wasmimport wasmnest:crypto/host-crypto@0.0.1 kdf-derive
|
|
28
|
+
//go:noescape
|
|
29
|
+
func wasmimport_KdfDerive(algorithm0 *uint8, algorithm1 uint32, salt0 uint32, salt1 *uint8, salt2 uint32, ikm0 *uint8, ikm1 uint32, info0 *uint8, info1 uint32, length0 uint32, result *cm.Result[cm.List[uint8], cm.List[uint8], string])
|
|
30
|
+
|
|
31
|
+
//go:wasmimport wasmnest:crypto/host-crypto@0.0.1 keyagreement-generate
|
|
32
|
+
//go:noescape
|
|
33
|
+
func wasmimport_KeyagreementGenerate(algorithm0 *uint8, algorithm1 uint32, result *cm.Result[cm.List[uint8], cm.List[uint8], string])
|
|
34
|
+
|
|
35
|
+
//go:wasmimport wasmnest:crypto/host-crypto@0.0.1 keyagreement-shared
|
|
36
|
+
//go:noescape
|
|
37
|
+
func wasmimport_KeyagreementShared(algorithm0 *uint8, algorithm1 uint32, localPrivate0 *uint8, localPrivate1 uint32, peerPublic0 *uint8, peerPublic1 uint32, result *cm.Result[cm.List[uint8], cm.List[uint8], string])
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package hostcrypto represents the imported interface "wasmnest:crypto/host-crypto@0.0.1".
|
|
4
|
+
//
|
|
5
|
+
// 桌面端能力域分片(WIT 按包拆分,ADR 0061):一个能力域 = 一个独立包,
|
|
6
|
+
// 版本独立演进——本包 WIT 变更只 bump 本包,不波及未 import 它的应用。
|
|
7
|
+
// 端 `plugin` world 经 `include wasmnest:crypto/cap-crypto@0.0.1;` 并入本接口。
|
|
8
|
+
// 宿主加密引擎(host-crypto,v26,**desktop 独有,双端偏离**——同 host-pty /
|
|
9
|
+
// host-auth 先例,ADR 0022「双端偏离」节)。
|
|
10
|
+
//
|
|
11
|
+
// 宿主加密引擎(`crypto/`)的按名寻址原语面:插件经算法名调用宿主聚合的
|
|
12
|
+
// 「全局加密方法大全」,引擎只提供**无业务语义的中性算法原语**(ADR 0022
|
|
13
|
+
// 裁剪线)——绝不做认证编排/协商流程/密钥策略,密钥材料一律由调用方传入,
|
|
14
|
+
// 宿主身份密钥(Kd / JWT keystore)不出口(仅内部 filter 链使用)。
|
|
15
|
+
//
|
|
16
|
+
// 算法名白名单在宿主注册表(`crypto/registry`),未知名返回错误(fail-visible);
|
|
17
|
+
// 首版最小子集:aead(aes-256-gcm / chacha20-poly1305)、kdf(hkdf-sha256)、
|
|
18
|
+
// key-exchange(x25519)。rsa / hybrid 按需扩展。
|
|
19
|
+
// 权限三域(风险拆分,对齐 ws:client/ws:server 先例):`crypto:aead` /
|
|
20
|
+
// `crypto:asym` / `crypto:kdf`(各自域入口门禁)。
|
|
21
|
+
package hostcrypto
|
|
22
|
+
|
|
23
|
+
import (
|
|
24
|
+
"go.bytecodealliance.org/cm"
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
// AeadEncrypt represents the imported function "aead-encrypt".
|
|
28
|
+
//
|
|
29
|
+
// AEAD 加密:算法名 + 密钥/nonce/明文/aad(全部字节由调用方提供)
|
|
30
|
+
// name:aes-256-gcm | chacha20-poly1305;key/nonce 长度由算法定(32/12),
|
|
31
|
+
// 超长/不足 → `Err`(长度校验,不做截断)。返回 密文 + 认证标签。
|
|
32
|
+
//
|
|
33
|
+
// aead-encrypt: func(algorithm: string, key: list<u8>, nonce: list<u8>, plaintext:
|
|
34
|
+
// list<u8>, aad: option<list<u8>>) -> result<list<u8>, string>
|
|
35
|
+
//
|
|
36
|
+
//go:nosplit
|
|
37
|
+
func AeadEncrypt(algorithm string, key cm.List[uint8], nonce cm.List[uint8], plaintext cm.List[uint8], aad cm.Option[cm.List[uint8]]) (result cm.Result[cm.List[uint8], cm.List[uint8], string]) {
|
|
38
|
+
algorithm0, algorithm1 := cm.LowerString(algorithm)
|
|
39
|
+
key0, key1 := cm.LowerList(key)
|
|
40
|
+
nonce0, nonce1 := cm.LowerList(nonce)
|
|
41
|
+
plaintext0, plaintext1 := cm.LowerList(plaintext)
|
|
42
|
+
aad0, aad1, aad2 := lower_OptionListU8(aad)
|
|
43
|
+
wasmimport_AeadEncrypt((*uint8)(algorithm0), (uint32)(algorithm1), (*uint8)(key0), (uint32)(key1), (*uint8)(nonce0), (uint32)(nonce1), (*uint8)(plaintext0), (uint32)(plaintext1), (uint32)(aad0), (*uint8)(aad1), (uint32)(aad2), &result)
|
|
44
|
+
return
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// AeadDecrypt represents the imported function "aead-decrypt".
|
|
48
|
+
//
|
|
49
|
+
// AEAD 解密;完整性校验失败返回 `Err`(不可与「不存在」混淆—— AEAD 认证失败
|
|
50
|
+
// 是明显的完整性错误,非存在性)
|
|
51
|
+
//
|
|
52
|
+
// aead-decrypt: func(algorithm: string, key: list<u8>, nonce: list<u8>, ciphertext:
|
|
53
|
+
// list<u8>, aad: option<list<u8>>) -> result<list<u8>, string>
|
|
54
|
+
//
|
|
55
|
+
//go:nosplit
|
|
56
|
+
func AeadDecrypt(algorithm string, key cm.List[uint8], nonce cm.List[uint8], ciphertext cm.List[uint8], aad cm.Option[cm.List[uint8]]) (result cm.Result[cm.List[uint8], cm.List[uint8], string]) {
|
|
57
|
+
algorithm0, algorithm1 := cm.LowerString(algorithm)
|
|
58
|
+
key0, key1 := cm.LowerList(key)
|
|
59
|
+
nonce0, nonce1 := cm.LowerList(nonce)
|
|
60
|
+
ciphertext0, ciphertext1 := cm.LowerList(ciphertext)
|
|
61
|
+
aad0, aad1, aad2 := lower_OptionListU8(aad)
|
|
62
|
+
wasmimport_AeadDecrypt((*uint8)(algorithm0), (uint32)(algorithm1), (*uint8)(key0), (uint32)(key1), (*uint8)(nonce0), (uint32)(nonce1), (*uint8)(ciphertext0), (uint32)(ciphertext1), (uint32)(aad0), (*uint8)(aad1), (uint32)(aad2), &result)
|
|
63
|
+
return
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// AeadGenerateKey represents the imported function "aead-generate-key".
|
|
67
|
+
//
|
|
68
|
+
// 生成指定 AEAD 算法的随机密钥;算法名非法 → `Err`
|
|
69
|
+
//
|
|
70
|
+
// aead-generate-key: func(algorithm: string) -> result<list<u8>, string>
|
|
71
|
+
//
|
|
72
|
+
//go:nosplit
|
|
73
|
+
func AeadGenerateKey(algorithm string) (result cm.Result[cm.List[uint8], cm.List[uint8], string]) {
|
|
74
|
+
algorithm0, algorithm1 := cm.LowerString(algorithm)
|
|
75
|
+
wasmimport_AeadGenerateKey((*uint8)(algorithm0), (uint32)(algorithm1), &result)
|
|
76
|
+
return
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// AeadGenerateNonce represents the imported function "aead-generate-nonce".
|
|
80
|
+
//
|
|
81
|
+
// 生成随机 nonce;算法名非法 → `Err`
|
|
82
|
+
//
|
|
83
|
+
// aead-generate-nonce: func(algorithm: string) -> result<list<u8>, string>
|
|
84
|
+
//
|
|
85
|
+
//go:nosplit
|
|
86
|
+
func AeadGenerateNonce(algorithm string) (result cm.Result[cm.List[uint8], cm.List[uint8], string]) {
|
|
87
|
+
algorithm0, algorithm1 := cm.LowerString(algorithm)
|
|
88
|
+
wasmimport_AeadGenerateNonce((*uint8)(algorithm0), (uint32)(algorithm1), &result)
|
|
89
|
+
return
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// KdfDerive represents the imported function "kdf-derive".
|
|
93
|
+
//
|
|
94
|
+
// KDF 密钥派生(hkdf-sha256):salt(可选)/ ikm / info → 指定长度密钥
|
|
95
|
+
//
|
|
96
|
+
// kdf-derive: func(algorithm: string, salt: option<list<u8>>, ikm: list<u8>, info:
|
|
97
|
+
// list<u8>, length: u32) -> result<list<u8>, string>
|
|
98
|
+
//
|
|
99
|
+
//go:nosplit
|
|
100
|
+
func KdfDerive(algorithm string, salt cm.Option[cm.List[uint8]], ikm cm.List[uint8], info cm.List[uint8], length uint32) (result cm.Result[cm.List[uint8], cm.List[uint8], string]) {
|
|
101
|
+
algorithm0, algorithm1 := cm.LowerString(algorithm)
|
|
102
|
+
salt0, salt1, salt2 := lower_OptionListU8(salt)
|
|
103
|
+
ikm0, ikm1 := cm.LowerList(ikm)
|
|
104
|
+
info0, info1 := cm.LowerList(info)
|
|
105
|
+
length0 := (uint32)(length)
|
|
106
|
+
wasmimport_KdfDerive((*uint8)(algorithm0), (uint32)(algorithm1), (uint32)(salt0), (*uint8)(salt1), (uint32)(salt2), (*uint8)(ikm0), (uint32)(ikm1), (*uint8)(info0), (uint32)(info1), (uint32)(length0), &result)
|
|
107
|
+
return
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// KeyagreementGenerate represents the imported function "keyagreement-generate".
|
|
111
|
+
//
|
|
112
|
+
// 随机密钥交换(x25519)——生成临时密钥对,返回 `private ‖ public`
|
|
113
|
+
// 裸字节(定长:x25519 各 32 字节,前 32 为私钥、后 32 为公钥)。
|
|
114
|
+
// 私钥仅宿主内传、不入日志;定长拼接避免 base64 编解码与长度歧义。
|
|
115
|
+
//
|
|
116
|
+
// keyagreement-generate: func(algorithm: string) -> result<list<u8>, string>
|
|
117
|
+
//
|
|
118
|
+
//go:nosplit
|
|
119
|
+
func KeyagreementGenerate(algorithm string) (result cm.Result[cm.List[uint8], cm.List[uint8], string]) {
|
|
120
|
+
algorithm0, algorithm1 := cm.LowerString(algorithm)
|
|
121
|
+
wasmimport_KeyagreementGenerate((*uint8)(algorithm0), (uint32)(algorithm1), &result)
|
|
122
|
+
return
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// KeyagreementShared represents the imported function "keyagreement-shared".
|
|
126
|
+
//
|
|
127
|
+
// 用本端私钥 + 对端公钥求共享密钥(字节,可直接进 kdf-derive)
|
|
128
|
+
//
|
|
129
|
+
// keyagreement-shared: func(algorithm: string, local-private: list<u8>, peer-public:
|
|
130
|
+
// list<u8>) -> result<list<u8>, string>
|
|
131
|
+
//
|
|
132
|
+
//go:nosplit
|
|
133
|
+
func KeyagreementShared(algorithm string, localPrivate cm.List[uint8], peerPublic cm.List[uint8]) (result cm.Result[cm.List[uint8], cm.List[uint8], string]) {
|
|
134
|
+
algorithm0, algorithm1 := cm.LowerString(algorithm)
|
|
135
|
+
localPrivate0, localPrivate1 := cm.LowerList(localPrivate)
|
|
136
|
+
peerPublic0, peerPublic1 := cm.LowerList(peerPublic)
|
|
137
|
+
wasmimport_KeyagreementShared((*uint8)(algorithm0), (uint32)(algorithm1), (*uint8)(localPrivate0), (uint32)(localPrivate1), (*uint8)(peerPublic0), (uint32)(peerPublic1), &result)
|
|
138
|
+
return
|
|
139
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostfsdesktop
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
"unsafe"
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
// OptionStringShape is used for storage in variant or result types.
|
|
11
|
+
type OptionStringShape struct {
|
|
12
|
+
_ cm.HostLayout
|
|
13
|
+
shape [unsafe.Sizeof(cm.Option[string]{})]byte
|
|
14
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostfsdesktop
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
// This file contains wasmimport and wasmexport declarations for "wasmnest:fs-desktop@0.0.1".
|
|
10
|
+
|
|
11
|
+
//go:wasmimport wasmnest:fs-desktop/host-fs-desktop@0.0.1 read-dir
|
|
12
|
+
//go:noescape
|
|
13
|
+
func wasmimport_ReadDir(path0 *uint8, path1 uint32, result *cm.Result[string, string, string])
|
|
14
|
+
|
|
15
|
+
//go:wasmimport wasmnest:fs-desktop/host-fs-desktop@0.0.1 canonicalize
|
|
16
|
+
//go:noescape
|
|
17
|
+
func wasmimport_Canonicalize(path0 *uint8, path1 uint32, result *cm.Result[OptionStringShape, cm.Option[string], string])
|
|
18
|
+
|
|
19
|
+
//go:wasmimport wasmnest:fs-desktop/host-fs-desktop@0.0.1 stat
|
|
20
|
+
//go:noescape
|
|
21
|
+
func wasmimport_Stat(path0 *uint8, path1 uint32, result *cm.Result[OptionStringShape, cm.Option[string], string])
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package hostfsdesktop represents the imported interface "wasmnest:fs-desktop/host-fs-desktop@0.0.1".
|
|
4
|
+
//
|
|
5
|
+
// 桌面端能力域分片(WIT 按包拆分,ADR 0061):一个能力域 = 一个独立包,
|
|
6
|
+
// 版本独立演进——本包 WIT 变更只 bump 本包,不波及未 import 它的应用。
|
|
7
|
+
// 端 `plugin` world 经 `include wasmnest:fs-desktop/cap-fs-desktop@0.0.1;` 并入本接口。
|
|
8
|
+
// 文件浏览域桌面扩展(v36 自 `host-fs` 拆出,双端交集切片——桌面独有 3 函数;
|
|
9
|
+
// `host-fs` 交集 6 函数已收拢进共享核心 core.wit)。
|
|
10
|
+
// 注:原 `host-events-desktop`(notify)已随 2026-10-13 功能级统一整 interface
|
|
11
|
+
// 退役(notify 本体迁共享域契约 `wasmnest-notify-engine/wit/notify.wit` 的
|
|
12
|
+
// `host-notify`;桌面实现落宿主路径 B 模块 `src-tauri/src/plugin/notify.rs`)。
|
|
13
|
+
package hostfsdesktop
|
|
14
|
+
|
|
15
|
+
import (
|
|
16
|
+
"go.bytecodealliance.org/cm"
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
// ReadDir represents the imported function "read-dir".
|
|
20
|
+
//
|
|
21
|
+
// v19 函数级追加(文件浏览域):目录直读。
|
|
22
|
+
// 返回 JSON 数组 `[{name, nodeType}]`——`nodeType` ∈ `"folder" | "file" |
|
|
23
|
+
// "other"`(宿主 `DirEntry::file_type` 语义:symlink / 特殊条目为 "other",
|
|
24
|
+
// 与宿主 scan_dir 跳过「非目录非文件」条目一致)。权限 `fs:read` + fs_auth。
|
|
25
|
+
//
|
|
26
|
+
// read-dir: func(path: string) -> result<string, string>
|
|
27
|
+
//
|
|
28
|
+
//go:nosplit
|
|
29
|
+
func ReadDir(path string) (result cm.Result[string, string, string]) {
|
|
30
|
+
path0, path1 := cm.LowerString(path)
|
|
31
|
+
wasmimport_ReadDir((*uint8)(path0), (uint32)(path1), &result)
|
|
32
|
+
return
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Canonicalize represents the imported function "canonicalize".
|
|
36
|
+
//
|
|
37
|
+
// v19:canonicalize 绝对路径(symlink 解析后的真实路径);路径不存在返回
|
|
38
|
+
// `ok(none)`(宿主 `Path::canonicalize` 失败即 None,不报错)。
|
|
39
|
+
// 权限 `fs:read` + fs_auth。
|
|
40
|
+
//
|
|
41
|
+
// canonicalize: func(path: string) -> result<option<string>, string>
|
|
42
|
+
//
|
|
43
|
+
//go:nosplit
|
|
44
|
+
func Canonicalize(path string) (result cm.Result[OptionStringShape, cm.Option[string], string]) {
|
|
45
|
+
path0, path1 := cm.LowerString(path)
|
|
46
|
+
wasmimport_Canonicalize((*uint8)(path0), (uint32)(path1), &result)
|
|
47
|
+
return
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Stat represents the imported function "stat".
|
|
51
|
+
//
|
|
52
|
+
// v19:文件元数据 JSON `{size, isFile, isDir}`;路径不存在返回 `ok(none)`。
|
|
53
|
+
// 权限 `fs:read` + fs_auth。
|
|
54
|
+
//
|
|
55
|
+
// stat: func(path: string) -> result<option<string>, string>
|
|
56
|
+
//
|
|
57
|
+
//go:nosplit
|
|
58
|
+
func Stat(path string) (result cm.Result[OptionStringShape, cm.Option[string], string]) {
|
|
59
|
+
path0, path1 := cm.LowerString(path)
|
|
60
|
+
wasmimport_Stat((*uint8)(path0), (uint32)(path1), &result)
|
|
61
|
+
return
|
|
62
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hosthttp
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
"unsafe"
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
// OptionStringShape is used for storage in variant or result types.
|
|
11
|
+
type OptionStringShape struct {
|
|
12
|
+
_ cm.HostLayout
|
|
13
|
+
shape [unsafe.Sizeof(cm.Option[string]{})]byte
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hosthttp
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
// This file contains wasmimport and wasmexport declarations for "wasmnest:http@0.0.1".
|
|
10
|
+
|
|
11
|
+
//go:wasmimport wasmnest:http/host-http@0.0.1 fetch
|
|
12
|
+
//go:noescape
|
|
13
|
+
func wasmimport_Fetch(requestJson0 *uint8, requestJson1 uint32, result *cm.Result[OptionStringShape, cm.Option[string], string])
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package hosthttp represents the imported interface "wasmnest:http/host-http@0.0.1".
|
|
4
|
+
//
|
|
5
|
+
// ======================================================================
|
|
6
|
+
// HTTP 能力域自持契约分片(ADR 0052 D2/D3)
|
|
7
|
+
//
|
|
8
|
+
// 本文件是 `wasmnest-server-http` 持有的**共享契约真源**(world `cap-http`
|
|
9
|
+
// 只 import 出站域 `host-http`):双端 `compose.json` 的 caps.http 直接指向
|
|
10
|
+
// 本文件(pty 先例)——契约与实现同属一处。
|
|
11
|
+
//
|
|
12
|
+
// 服务端域 `host-http-endpoint`(桌面扩展)**不在本文件**:声明真源在桌面
|
|
13
|
+
// `plugin-sdk-desktop/rust/wit-src/cap-http.wit`(world `cap-http-endpoint`),
|
|
14
|
+
// 实现随端扩展归桌面宿主(ADR 0052 D4)。
|
|
15
|
+
//
|
|
16
|
+
// 端生成物由 `scripts/compose-wit.mjs` 拼装(本文件与 core.wit 及其余 cap 分片
|
|
17
|
+
// 同 package 同版本)。分片只换绑定源、不换装配语义:`impl Host` / `HostModule` /
|
|
18
|
+
// `MODULE_*` / `DESC` 与 WIT 契约的函数集逐字一致。
|
|
19
|
+
// ======================================================================
|
|
20
|
+
// HTTP 出站代理(原 http.rs:http_fetch,双端交集 1 函数)
|
|
21
|
+
//
|
|
22
|
+
// 桌面独有服务端域(入站路由注册,v29)拆入 [`host-http-endpoint`]
|
|
23
|
+
// (cap-http 分片,移动端不承载服务端网关、不跟演);本接口只剩双端交集
|
|
24
|
+
// 出站 `fetch`。
|
|
25
|
+
package hosthttp
|
|
26
|
+
|
|
27
|
+
import (
|
|
28
|
+
"go.bytecodealliance.org/cm"
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
// Fetch represents the imported function "fetch".
|
|
32
|
+
//
|
|
33
|
+
// fetch: func(request-json: string) -> result<option<string>, string>
|
|
34
|
+
//
|
|
35
|
+
//go:nosplit
|
|
36
|
+
func Fetch(requestJSON string) (result cm.Result[OptionStringShape, cm.Option[string], string]) {
|
|
37
|
+
requestJson0, requestJson1 := cm.LowerString(requestJSON)
|
|
38
|
+
wasmimport_Fetch((*uint8)(requestJson0), (uint32)(requestJson1), &result)
|
|
39
|
+
return
|
|
40
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hosthttpendpoint
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
// This file contains wasmimport and wasmexport declarations for "wasmnest:http-endpoint@0.0.1".
|
|
10
|
+
|
|
11
|
+
//go:wasmimport wasmnest:http-endpoint/host-http-endpoint@0.0.1 register-endpoint
|
|
12
|
+
//go:noescape
|
|
13
|
+
func wasmimport_RegisterEndpoint(configJson0 *uint8, configJson1 uint32, result *cm.Result[string, string, string])
|
|
14
|
+
|
|
15
|
+
//go:wasmimport wasmnest:http-endpoint/host-http-endpoint@0.0.1 unregister-endpoint
|
|
16
|
+
//go:noescape
|
|
17
|
+
func wasmimport_UnregisterEndpoint(endpointId0 *uint8, endpointId1 uint32, result *cm.Result[string, bool, string])
|