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