@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,25 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostlog
|
|
4
|
+
|
|
5
|
+
// This file contains wasmimport and wasmexport declarations for "wasmnest:plugin@0.1.0".
|
|
6
|
+
|
|
7
|
+
//go:wasmimport wasmnest:plugin/host-log@0.1.0 info
|
|
8
|
+
//go:noescape
|
|
9
|
+
func wasmimport_Info(message0 *uint8, message1 uint32)
|
|
10
|
+
|
|
11
|
+
//go:wasmimport wasmnest:plugin/host-log@0.1.0 debug
|
|
12
|
+
//go:noescape
|
|
13
|
+
func wasmimport_Debug(message0 *uint8, message1 uint32)
|
|
14
|
+
|
|
15
|
+
//go:wasmimport wasmnest:plugin/host-log@0.1.0 warn
|
|
16
|
+
//go:noescape
|
|
17
|
+
func wasmimport_Warn(message0 *uint8, message1 uint32)
|
|
18
|
+
|
|
19
|
+
//go:wasmimport wasmnest:plugin/host-log@0.1.0 error
|
|
20
|
+
//go:noescape
|
|
21
|
+
func wasmimport_Error(message0 *uint8, message1 uint32)
|
|
22
|
+
|
|
23
|
+
//go:wasmimport wasmnest:plugin/host-log@0.1.0 mark-plugin-error
|
|
24
|
+
//go:noescape
|
|
25
|
+
func wasmimport_MarkPluginError(error0 *uint8, error1 uint32)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package hostlog represents the imported interface "wasmnest:plugin/host-log@0.1.0".
|
|
4
|
+
//
|
|
5
|
+
// 宿主日志与插件状态上报(原 log.rs + status.rs)
|
|
6
|
+
package hostlog
|
|
7
|
+
|
|
8
|
+
import (
|
|
9
|
+
"go.bytecodealliance.org/cm"
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
// Info represents the imported function "info".
|
|
13
|
+
//
|
|
14
|
+
// info: func(message: string)
|
|
15
|
+
//
|
|
16
|
+
//go:nosplit
|
|
17
|
+
func Info(message string) {
|
|
18
|
+
message0, message1 := cm.LowerString(message)
|
|
19
|
+
wasmimport_Info((*uint8)(message0), (uint32)(message1))
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Debug represents the imported function "debug".
|
|
24
|
+
//
|
|
25
|
+
// debug: func(message: string)
|
|
26
|
+
//
|
|
27
|
+
//go:nosplit
|
|
28
|
+
func Debug(message string) {
|
|
29
|
+
message0, message1 := cm.LowerString(message)
|
|
30
|
+
wasmimport_Debug((*uint8)(message0), (uint32)(message1))
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Warn represents the imported function "warn".
|
|
35
|
+
//
|
|
36
|
+
// warn: func(message: string)
|
|
37
|
+
//
|
|
38
|
+
//go:nosplit
|
|
39
|
+
func Warn(message string) {
|
|
40
|
+
message0, message1 := cm.LowerString(message)
|
|
41
|
+
wasmimport_Warn((*uint8)(message0), (uint32)(message1))
|
|
42
|
+
return
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Error represents the imported function "error".
|
|
46
|
+
//
|
|
47
|
+
// error: func(message: string)
|
|
48
|
+
//
|
|
49
|
+
//go:nosplit
|
|
50
|
+
func Error(message string) {
|
|
51
|
+
message0, message1 := cm.LowerString(message)
|
|
52
|
+
wasmimport_Error((*uint8)(message0), (uint32)(message1))
|
|
53
|
+
return
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// MarkPluginError represents the imported function "mark-plugin-error".
|
|
57
|
+
//
|
|
58
|
+
// mark-plugin-error: func(error: string)
|
|
59
|
+
//
|
|
60
|
+
//go:nosplit
|
|
61
|
+
func MarkPluginError(error_ string) {
|
|
62
|
+
error0, error1 := cm.LowerString(error_)
|
|
63
|
+
wasmimport_MarkPluginError((*uint8)(error0), (uint32)(error1))
|
|
64
|
+
return
|
|
65
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostmetrics
|
|
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-metrics@0.1.0 snapshot
|
|
12
|
+
//go:noescape
|
|
13
|
+
func wasmimport_Snapshot(result *cm.Result[string, string, string])
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package hostmetrics represents the imported interface "wasmnest:plugin/host-metrics@0.1.0".
|
|
4
|
+
//
|
|
5
|
+
// 运行监控(core-monitor):只读运行时指标快照
|
|
6
|
+
//
|
|
7
|
+
// **权限 `metrics:read`(manifest 必须单独声明)**:未声明即 `Err`。
|
|
8
|
+
// 返回 JSON 字符串,形状与内核 `MetricsRegistry::snapshot()` 逐字一致:
|
|
9
|
+
// `{ "plugins": { "<plugin_id>": {...} }, "<source>": {...} }`——每插件段含
|
|
10
|
+
// 内存 current/peak、调用次数/在飞数、燃料总量、耗时 total/max/直方图、
|
|
11
|
+
// trap 原因分布、生命周期计数与最近时间、授权决策、总线背压、配额上限。
|
|
12
|
+
//
|
|
13
|
+
// 语义边界:
|
|
14
|
+
// - **只读**:不重置任何计数器,不影响被观测插件;
|
|
15
|
+
// - **无业务内容**:只有数值计数与 plugin_id / 枚举键,不含会话文本、文件内容、
|
|
16
|
+
// 凭据或任何应用数据;
|
|
17
|
+
// - **全局可见**:授权一次即可读**所有已加载插件**的聚合指标(监控用途所需),
|
|
18
|
+
// 因此可据此推断其他应用的活跃度(侧信道)——权限描述已写明;
|
|
19
|
+
// - 快照源未装配(无头 / 测试上下文)时 `Err`(fail-visible,不返回空对象冒充)。
|
|
20
|
+
package hostmetrics
|
|
21
|
+
|
|
22
|
+
import (
|
|
23
|
+
"go.bytecodealliance.org/cm"
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
// Snapshot represents the imported function "snapshot".
|
|
27
|
+
//
|
|
28
|
+
// snapshot: func() -> result<string, string>
|
|
29
|
+
//
|
|
30
|
+
//go:nosplit
|
|
31
|
+
func Snapshot() (result cm.Result[string, string, string]) {
|
|
32
|
+
wasmimport_Snapshot(&result)
|
|
33
|
+
return
|
|
34
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostplatform
|
|
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-platform@0.1.0 pick-files
|
|
12
|
+
//go:noescape
|
|
13
|
+
func wasmimport_PickFiles(result *cm.Result[string, string, string])
|
|
14
|
+
|
|
15
|
+
//go:wasmimport wasmnest:plugin/host-platform@0.1.0 pick-folders
|
|
16
|
+
//go:noescape
|
|
17
|
+
func wasmimport_PickFolders(result *cm.Result[string, string, string])
|
|
18
|
+
|
|
19
|
+
//go:wasmimport wasmnest:plugin/host-platform@0.1.0 platform
|
|
20
|
+
//go:noescape
|
|
21
|
+
func wasmimport_Platform(result *string)
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package hostplatform represents the imported interface "wasmnest:plugin/host-platform@0.1.0".
|
|
4
|
+
//
|
|
5
|
+
// 通用平台能力域(ADR 0022 v2):系统对话框/授权等与领域无关的平台交互
|
|
6
|
+
//
|
|
7
|
+
// 双端交集切片:桌面独有 `wsl-distros` / `local-ipv4-addresses` /
|
|
8
|
+
// `reveal-in-dir` 拆入 [`host-platform-desktop`](cap-desktop 分片),
|
|
9
|
+
// 本接口承载双端交集的 `pick-files` / `pick-folders`,外加双端全等的
|
|
10
|
+
// `platform`(宿主平台标识探测)。
|
|
11
|
+
//
|
|
12
|
+
// **目录选择已按功能级统一**(2026-10-13,ADR 0052 D3):原 `pick-folder`
|
|
13
|
+
// (单目录字符串,双端)与桌面 `host-platform-desktop.pick-folders`
|
|
14
|
+
// (多目录 JSON)是同一功能的两种形状 → 统一为本接口的 `pick-folders`
|
|
15
|
+
// (`string[]` JSON;移动 SAF 目录树选择器为单选语义,返回 0/1 项)。
|
|
16
|
+
package hostplatform
|
|
17
|
+
|
|
18
|
+
import (
|
|
19
|
+
"go.bytecodealliance.org/cm"
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
// PickFiles represents the imported function "pick-files".
|
|
23
|
+
//
|
|
24
|
+
// 系统多文件选择器 → string[] JSON(用户取消为空数组)。
|
|
25
|
+
//
|
|
26
|
+
// **权限 `fs:pick`(manifest 必须单独声明)**:未声明即 `Err`,且**不弹对话框**
|
|
27
|
+
// ——「能调起选择器」与「能读写任意路径」是两种权力,合成一位会让只想让用户
|
|
28
|
+
// 挑一个文件的插件被动获得全盘读取面(权限位判据见 SDK `PERMISSION_FS_PICK`)。
|
|
29
|
+
//
|
|
30
|
+
// **浏览面不设限、结果面设门**:系统原生对话框(Windows IFileDialog /
|
|
31
|
+
// Linux xdg-desktop-portal)允许用户浏览**任意**位置——浏览由用户在系统
|
|
32
|
+
// 对话框里驱动,宿主不读任何数据;选择结束后宿主才对**选中的路径**做
|
|
33
|
+
// `fs_auth` 授权校验(见下)。
|
|
34
|
+
//
|
|
35
|
+
// **选择后的授权校验**(本原语契约的另一半,缺一不可):
|
|
36
|
+
// - 选中路径命中**已授权目录**前缀(或第一方归属目录)→ 静默放行,不再弹框;
|
|
37
|
+
// - 存在未授权路径 → 就未授权部分弹**一次**授权框(多路径合并一次询问);
|
|
38
|
+
// - 用户拒绝 / 超时 / 无弹窗通道(无头上下文)→ `Err`,**不回传任何路径**
|
|
39
|
+
// (fail-visible:不得把「弹了框被拒」降级成空数组)。
|
|
40
|
+
// 「记住」按**所在目录**落账(文件 → 父目录,目录 → 自身),使同目录下的
|
|
41
|
+
// 后续选择免弹。
|
|
42
|
+
//
|
|
43
|
+
// 授权只交付「可访问用户亲手选中的路径」这一层;实际读 / 写仍分别要
|
|
44
|
+
// `fs:read` / `fs:write`(`pick-*` 不隐含读写位)。
|
|
45
|
+
//
|
|
46
|
+
// pick-files: func() -> result<string, string>
|
|
47
|
+
//
|
|
48
|
+
//go:nosplit
|
|
49
|
+
func PickFiles() (result cm.Result[string, string, string]) {
|
|
50
|
+
wasmimport_PickFiles(&result)
|
|
51
|
+
return
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// PickFolders represents the imported function "pick-folders".
|
|
55
|
+
//
|
|
56
|
+
// 系统文件夹选择器(多选)→ string[] JSON;用户取消返回空数组。
|
|
57
|
+
// 权限 `fs:pick` + 选择后授权校验(授权落账到所选目录本身),口径同
|
|
58
|
+
// `pick-files`。移动端为 SAF 目录树选择器(单选语义),返回 0/1 个
|
|
59
|
+
// 树 URI。
|
|
60
|
+
//
|
|
61
|
+
// pick-folders: func() -> result<string, string>
|
|
62
|
+
//
|
|
63
|
+
//go:nosplit
|
|
64
|
+
func PickFolders() (result cm.Result[string, string, string]) {
|
|
65
|
+
wasmimport_PickFolders(&result)
|
|
66
|
+
return
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Platform represents the imported function "platform".
|
|
70
|
+
//
|
|
71
|
+
// 宿主平台标识探测(双端全等;**无权限门**——平台事实不是能力,ADR 0022 裁剪线)。
|
|
72
|
+
//
|
|
73
|
+
// 取值由各端宿主定义(当前约定:桌面 `desktop` / 移动 `mobile`);guest 用于
|
|
74
|
+
// 运行期平台分支——双端共享 wasm 产物(如 file-transfer 单产物,规格
|
|
75
|
+
// `.scratch/2026-10-13-file-transfer-single-wasm/spec.md`)据此在同一 trait
|
|
76
|
+
// 的双实现间选择,无需双份产物。空/未知取值时 guest 侧按 fail-visible
|
|
77
|
+
// 处理(显性报错,不猜默认平台——猜错会把桌面分支静默跑在移动宿主上)。
|
|
78
|
+
//
|
|
79
|
+
// platform: func() -> string
|
|
80
|
+
//
|
|
81
|
+
//go:nosplit
|
|
82
|
+
func Platform() (result string) {
|
|
83
|
+
wasmimport_Platform(&result)
|
|
84
|
+
return
|
|
85
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostplugindatabase
|
|
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,29 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostplugindatabase
|
|
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-plugin-database@0.1.0 execute
|
|
12
|
+
//go:noescape
|
|
13
|
+
func wasmimport_Execute(sql0 *uint8, sql1 uint32, result *cm.Result[string, uint32, string])
|
|
14
|
+
|
|
15
|
+
//go:wasmimport wasmnest:plugin/host-plugin-database@0.1.0 query
|
|
16
|
+
//go:noescape
|
|
17
|
+
func wasmimport_Query(sql0 *uint8, sql1 uint32, result *cm.Result[OptionStringShape, cm.Option[string], string])
|
|
18
|
+
|
|
19
|
+
//go:wasmimport wasmnest:plugin/host-plugin-database@0.1.0 execute-params
|
|
20
|
+
//go:noescape
|
|
21
|
+
func wasmimport_ExecuteParams(sql0 *uint8, sql1 uint32, paramsJson0 *uint8, paramsJson1 uint32, result *cm.Result[string, uint32, string])
|
|
22
|
+
|
|
23
|
+
//go:wasmimport wasmnest:plugin/host-plugin-database@0.1.0 query-params
|
|
24
|
+
//go:noescape
|
|
25
|
+
func wasmimport_QueryParams(sql0 *uint8, sql1 uint32, paramsJson0 *uint8, paramsJson1 uint32, result *cm.Result[OptionStringShape, cm.Option[string], string])
|
|
26
|
+
|
|
27
|
+
//go:wasmimport wasmnest:plugin/host-plugin-database@0.1.0 execute-batch
|
|
28
|
+
//go:noescape
|
|
29
|
+
func wasmimport_ExecuteBatch(sqlsJson0 *uint8, sqlsJson1 uint32, result *cm.Result[string, uint32, string])
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package hostplugindatabase represents the imported interface "wasmnest:plugin/host-plugin-database@0.1.0".
|
|
4
|
+
//
|
|
5
|
+
// 插件独立数据库(原 database.rs:plugin_db_*)
|
|
6
|
+
package hostplugindatabase
|
|
7
|
+
|
|
8
|
+
import (
|
|
9
|
+
"go.bytecodealliance.org/cm"
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
// Execute represents the imported function "execute".
|
|
13
|
+
//
|
|
14
|
+
// execute: func(sql: string) -> result<u32, string>
|
|
15
|
+
//
|
|
16
|
+
//go:nosplit
|
|
17
|
+
func Execute(sql string) (result cm.Result[string, uint32, string]) {
|
|
18
|
+
sql0, sql1 := cm.LowerString(sql)
|
|
19
|
+
wasmimport_Execute((*uint8)(sql0), (uint32)(sql1), &result)
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Query represents the imported function "query".
|
|
24
|
+
//
|
|
25
|
+
// query: func(sql: string) -> result<option<string>, string>
|
|
26
|
+
//
|
|
27
|
+
//go:nosplit
|
|
28
|
+
func Query(sql string) (result cm.Result[OptionStringShape, cm.Option[string], string]) {
|
|
29
|
+
sql0, sql1 := cm.LowerString(sql)
|
|
30
|
+
wasmimport_Query((*uint8)(sql0), (uint32)(sql1), &result)
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// ExecuteParams represents the imported function "execute-params".
|
|
35
|
+
//
|
|
36
|
+
// execute-params: func(sql: string, params-json: string) -> result<u32, string>
|
|
37
|
+
//
|
|
38
|
+
//go:nosplit
|
|
39
|
+
func ExecuteParams(sql string, paramsJSON string) (result cm.Result[string, uint32, string]) {
|
|
40
|
+
sql0, sql1 := cm.LowerString(sql)
|
|
41
|
+
paramsJson0, paramsJson1 := cm.LowerString(paramsJSON)
|
|
42
|
+
wasmimport_ExecuteParams((*uint8)(sql0), (uint32)(sql1), (*uint8)(paramsJson0), (uint32)(paramsJson1), &result)
|
|
43
|
+
return
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// QueryParams represents the imported function "query-params".
|
|
47
|
+
//
|
|
48
|
+
// query-params: func(sql: string, params-json: string) -> result<option<string>,
|
|
49
|
+
// string>
|
|
50
|
+
//
|
|
51
|
+
//go:nosplit
|
|
52
|
+
func QueryParams(sql string, paramsJSON string) (result cm.Result[OptionStringShape, cm.Option[string], string]) {
|
|
53
|
+
sql0, sql1 := cm.LowerString(sql)
|
|
54
|
+
paramsJson0, paramsJson1 := cm.LowerString(paramsJSON)
|
|
55
|
+
wasmimport_QueryParams((*uint8)(sql0), (uint32)(sql1), (*uint8)(paramsJson0), (uint32)(paramsJson1), &result)
|
|
56
|
+
return
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// ExecuteBatch represents the imported function "execute-batch".
|
|
60
|
+
//
|
|
61
|
+
// 事务内顺序执行多语句(sqls-json 为 SQL 字符串数组),返回受影响行数合计
|
|
62
|
+
//
|
|
63
|
+
// execute-batch: func(sqls-json: string) -> result<u32, string>
|
|
64
|
+
//
|
|
65
|
+
//go:nosplit
|
|
66
|
+
func ExecuteBatch(sqlsJSON string) (result cm.Result[string, uint32, string]) {
|
|
67
|
+
sqlsJson0, sqlsJson1 := cm.LowerString(sqlsJSON)
|
|
68
|
+
wasmimport_ExecuteBatch((*uint8)(sqlsJson0), (uint32)(sqlsJson1), &result)
|
|
69
|
+
return
|
|
70
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hoststorage
|
|
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 hoststorage
|
|
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-storage@0.1.0 get
|
|
12
|
+
//go:noescape
|
|
13
|
+
func wasmimport_Get(key0 *uint8, key1 uint32, result *cm.Result[OptionStringShape, cm.Option[string], string])
|
|
14
|
+
|
|
15
|
+
//go:wasmimport wasmnest:plugin/host-storage@0.1.0 set
|
|
16
|
+
//go:noescape
|
|
17
|
+
func wasmimport_Set(key0 *uint8, key1 uint32, value0 *uint8, value1 uint32, result *cm.Result[string, struct{}, string])
|
|
18
|
+
|
|
19
|
+
//go:wasmimport wasmnest:plugin/host-storage@0.1.0 delete
|
|
20
|
+
//go:noescape
|
|
21
|
+
func wasmimport_Delete(key0 *uint8, key1 uint32, result *cm.Result[string, struct{}, string])
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package hoststorage represents the imported interface "wasmnest:plugin/host-storage@0.1.0".
|
|
4
|
+
//
|
|
5
|
+
// 插件 KV 存储(原 storage.rs:storage_get/set/delete)
|
|
6
|
+
package hoststorage
|
|
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
|
+
}
|
|
22
|
+
|
|
23
|
+
// Set represents the imported function "set".
|
|
24
|
+
//
|
|
25
|
+
// set: func(key: string, value: string) -> result<_, string>
|
|
26
|
+
//
|
|
27
|
+
//go:nosplit
|
|
28
|
+
func Set(key string, value string) (result cm.Result[string, struct{}, string]) {
|
|
29
|
+
key0, key1 := cm.LowerString(key)
|
|
30
|
+
value0, value1 := cm.LowerString(value)
|
|
31
|
+
wasmimport_Set((*uint8)(key0), (uint32)(key1), (*uint8)(value0), (uint32)(value1), &result)
|
|
32
|
+
return
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Delete represents the imported function "delete".
|
|
36
|
+
//
|
|
37
|
+
// delete: func(key: string) -> result<_, string>
|
|
38
|
+
//
|
|
39
|
+
//go:nosplit
|
|
40
|
+
func Delete(key string) (result cm.Result[string, struct{}, string]) {
|
|
41
|
+
key0, key1 := cm.LowerString(key)
|
|
42
|
+
wasmimport_Delete((*uint8)(key0), (uint32)(key1), &result)
|
|
43
|
+
return
|
|
44
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostworker
|
|
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-worker@0.1.0 submit
|
|
12
|
+
//go:noescape
|
|
13
|
+
func wasmimport_Submit(worker0 *uint8, worker1 uint32, input0 *uint8, input1 uint32, result *cm.Result[string, string, string])
|
|
14
|
+
|
|
15
|
+
//go:wasmimport wasmnest:plugin/host-worker@0.1.0 cancel
|
|
16
|
+
//go:noescape
|
|
17
|
+
func wasmimport_Cancel(jobId0 *uint8, jobId1 uint32, result *cm.Result[string, struct{}, string])
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package hostworker represents the imported interface "wasmnest:plugin/host-worker@0.1.0".
|
|
4
|
+
//
|
|
5
|
+
// worker 调度(主插件经宿主中介调用内嵌 worker 子资源,ADR 0059)
|
|
6
|
+
//
|
|
7
|
+
// **权限 `worker:run`(manifest 必须单独声明)**:未声明即 `Err`——「占用宿主
|
|
8
|
+
// 并行资源」的准入门(一线程一 worker,per-plugin 并发 4 / 全局 8),与
|
|
9
|
+
// `task:run` 同款判据(并发能力与数据访问解耦授权)。
|
|
10
|
+
//
|
|
11
|
+
// worker 本体是声明插件的**私属**子资源:插件包 `worker/` 目录 + manifest
|
|
12
|
+
// `workers` 块声明(`[{name, file, wasmHash?, resourceOverrides?}]`),world
|
|
13
|
+
// 本体在 `wit/worker.wit`(零宿主 import,仅 WASI 内建)。每次运行 = 全新
|
|
14
|
+
// Store,零共享状态;worker 间通信只能走主插件编排。
|
|
15
|
+
//
|
|
16
|
+
// - `submit` 受理语义:同步校验(worker 名不存在 / 输入超限 / 队列满)→ `Err`;
|
|
17
|
+
// 受理成功返回 job id(1 submit = 1 run,fan-out = 连发 N 个 submit)。
|
|
18
|
+
// 运行期失败(实例化 / trap / 燃料耗尽)→ [`events-worker`] 终态事件。
|
|
19
|
+
// - `cancel` 语义 = 标记取消(非强杀):燃料自然终结、结果丢弃,不承诺强杀
|
|
20
|
+
// (与 task 审计票 09 裁决同立场)。
|
|
21
|
+
// - 传参 JSON string(输入 / 输出上限 1 MiB,真源 server-base constants);
|
|
22
|
+
// 超大输入显性报错,文件路径留给 preopen 阶段。
|
|
23
|
+
package hostworker
|
|
24
|
+
|
|
25
|
+
import (
|
|
26
|
+
"go.bytecodealliance.org/cm"
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
// Submit represents the imported function "submit".
|
|
30
|
+
//
|
|
31
|
+
// submit: func(worker: string, input: string) -> result<string, string>
|
|
32
|
+
//
|
|
33
|
+
//go:nosplit
|
|
34
|
+
func Submit(worker string, input string) (result cm.Result[string, string, string]) {
|
|
35
|
+
worker0, worker1 := cm.LowerString(worker)
|
|
36
|
+
input0, input1 := cm.LowerString(input)
|
|
37
|
+
wasmimport_Submit((*uint8)(worker0), (uint32)(worker1), (*uint8)(input0), (uint32)(input1), &result)
|
|
38
|
+
return
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Cancel represents the imported function "cancel".
|
|
42
|
+
//
|
|
43
|
+
// cancel: func(job-id: string) -> result<_, string>
|
|
44
|
+
//
|
|
45
|
+
//go:nosplit
|
|
46
|
+
func Cancel(jobID string) (result cm.Result[string, struct{}, string]) {
|
|
47
|
+
jobId0, jobId1 := cm.LowerString(jobID)
|
|
48
|
+
wasmimport_Cancel((*uint8)(jobId0), (uint32)(jobId1), &result)
|
|
49
|
+
return
|
|
50
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package lifecycle
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
// Exports represents the caller-defined exports from "wasmnest:plugin/lifecycle@0.1.0".
|
|
10
|
+
var Exports struct {
|
|
11
|
+
// Activate represents the caller-defined, exported function "activate".
|
|
12
|
+
//
|
|
13
|
+
// activate: func() -> result<_, string>
|
|
14
|
+
Activate func() (result cm.Result[string, struct{}, string])
|
|
15
|
+
|
|
16
|
+
// Deactivate represents the caller-defined, exported function "deactivate".
|
|
17
|
+
//
|
|
18
|
+
// deactivate: func() -> result<_, string>
|
|
19
|
+
Deactivate func() (result cm.Result[string, struct{}, string])
|
|
20
|
+
|
|
21
|
+
// OnStartup represents the caller-defined, exported function "on-startup".
|
|
22
|
+
//
|
|
23
|
+
// on-startup: func() -> result<_, string>
|
|
24
|
+
OnStartup func() (result cm.Result[string, struct{}, string])
|
|
25
|
+
|
|
26
|
+
// OnShutdown represents the caller-defined, exported function "on-shutdown".
|
|
27
|
+
//
|
|
28
|
+
// 补全:携带启动初始化结果
|
|
29
|
+
//
|
|
30
|
+
// on-shutdown: func() -> result<_, string>
|
|
31
|
+
OnShutdown func() (result cm.Result[string, struct{}, string])
|
|
32
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package lifecycle
|
|
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/lifecycle@0.1.0#activate
|
|
12
|
+
//export wasmnest:plugin/lifecycle@0.1.0#activate
|
|
13
|
+
func wasmexport_Activate() (result *cm.Result[string, struct{}, string]) {
|
|
14
|
+
result_ := Exports.Activate()
|
|
15
|
+
result = &result_
|
|
16
|
+
return
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//go:wasmexport wasmnest:plugin/lifecycle@0.1.0#deactivate
|
|
20
|
+
//export wasmnest:plugin/lifecycle@0.1.0#deactivate
|
|
21
|
+
func wasmexport_Deactivate() (result *cm.Result[string, struct{}, string]) {
|
|
22
|
+
result_ := Exports.Deactivate()
|
|
23
|
+
result = &result_
|
|
24
|
+
return
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//go:wasmexport wasmnest:plugin/lifecycle@0.1.0#on-startup
|
|
28
|
+
//export wasmnest:plugin/lifecycle@0.1.0#on-startup
|
|
29
|
+
func wasmexport_OnStartup() (result *cm.Result[string, struct{}, string]) {
|
|
30
|
+
result_ := Exports.OnStartup()
|
|
31
|
+
result = &result_
|
|
32
|
+
return
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//go:wasmexport wasmnest:plugin/lifecycle@0.1.0#on-shutdown
|
|
36
|
+
//export wasmnest:plugin/lifecycle@0.1.0#on-shutdown
|
|
37
|
+
func wasmexport_OnShutdown() (result *cm.Result[string, struct{}, string]) {
|
|
38
|
+
result_ := Exports.OnShutdown()
|
|
39
|
+
result = &result_
|
|
40
|
+
return
|
|
41
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package lifecycle represents the exported interface "wasmnest:plugin/lifecycle@0.1.0".
|
|
4
|
+
//
|
|
5
|
+
// 生命周期(原 activate/deactivate/on_startup/on_shutdown)
|
|
6
|
+
//
|
|
7
|
+
// 四个导出均携带结果(v8):启动初始化/清理的成败由导出返回值如实上抛,
|
|
8
|
+
// 宿主据此区分 Activated / Degraded,不再依赖「调用没抛错」推断成功
|
|
9
|
+
package lifecycle
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package manifest
|
|
4
|
+
|
|
5
|
+
// Exports represents the caller-defined exports from "wasmnest:plugin/manifest@0.1.0".
|
|
6
|
+
var Exports struct {
|
|
7
|
+
// Get represents the caller-defined, exported function "get".
|
|
8
|
+
//
|
|
9
|
+
// get: func() -> string
|
|
10
|
+
Get func() (result string)
|
|
11
|
+
}
|