@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,13 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package manifest
|
|
4
|
+
|
|
5
|
+
// This file contains wasmimport and wasmexport declarations for "wasmnest:plugin@0.1.0".
|
|
6
|
+
|
|
7
|
+
//go:wasmexport wasmnest:plugin/manifest@0.1.0#get
|
|
8
|
+
//export wasmnest:plugin/manifest@0.1.0#get
|
|
9
|
+
func wasmexport_Get() (result *string) {
|
|
10
|
+
result_ := Exports.Get()
|
|
11
|
+
result = &result_
|
|
12
|
+
return
|
|
13
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostprocess
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
// This file contains wasmimport and wasmexport declarations for "wasmnest:process@0.0.1".
|
|
10
|
+
|
|
11
|
+
//go:wasmimport wasmnest:process/host-process@0.0.1 run
|
|
12
|
+
//go:noescape
|
|
13
|
+
func wasmimport_Run(requestJson0 *uint8, requestJson1 uint32, result *cm.Result[string, string, string])
|
|
14
|
+
|
|
15
|
+
//go:wasmimport wasmnest:process/host-process@0.0.1 kill
|
|
16
|
+
//go:noescape
|
|
17
|
+
func wasmimport_Kill(runId0 *uint8, runId1 uint32, result *cm.Result[string, struct{}, string])
|
|
18
|
+
|
|
19
|
+
//go:wasmimport wasmnest:process/host-process@0.0.1 run-sync
|
|
20
|
+
//go:noescape
|
|
21
|
+
func wasmimport_RunSync(requestJson0 *uint8, requestJson1 uint32, result *cm.Result[string, string, string])
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package hostprocess represents the imported interface "wasmnest:process/host-process@0.0.1".
|
|
4
|
+
//
|
|
5
|
+
// 桌面端能力域分片(WIT 按包拆分,ADR 0061):一个能力域 = 一个独立包,
|
|
6
|
+
// 版本独立演进——本包 WIT 变更只 bump 本包,不波及未 import 它的应用。
|
|
7
|
+
// 端 `plugin` world 经 `include wasmnest:process/cap-process@0.0.1;` 并入本接口。
|
|
8
|
+
// 进程执行(v8:host-process)——调度框架等插件需要执行外部命令/脚本
|
|
9
|
+
//
|
|
10
|
+
// 异步执行:`run` 立即返回 run-id,进程结束后宿主经 `events.on-process-done`
|
|
11
|
+
// 回调插件(携带 exit_code / 超时标记);`kill` 用于超时/取消。
|
|
12
|
+
package hostprocess
|
|
13
|
+
|
|
14
|
+
import (
|
|
15
|
+
"go.bytecodealliance.org/cm"
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
// Run represents the imported function "run".
|
|
19
|
+
//
|
|
20
|
+
// run: func(request-json: string) -> result<string, string>
|
|
21
|
+
//
|
|
22
|
+
//go:nosplit
|
|
23
|
+
func Run(requestJSON string) (result cm.Result[string, string, string]) {
|
|
24
|
+
requestJson0, requestJson1 := cm.LowerString(requestJSON)
|
|
25
|
+
wasmimport_Run((*uint8)(requestJson0), (uint32)(requestJson1), &result)
|
|
26
|
+
return
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Kill represents the imported function "kill".
|
|
30
|
+
//
|
|
31
|
+
// kill: func(run-id: string) -> result<_, string>
|
|
32
|
+
//
|
|
33
|
+
//go:nosplit
|
|
34
|
+
func Kill(runID string) (result cm.Result[string, struct{}, string]) {
|
|
35
|
+
runId0, runId1 := cm.LowerString(runID)
|
|
36
|
+
wasmimport_Kill((*uint8)(runId0), (uint32)(runId1), &result)
|
|
37
|
+
return
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// RunSync represents the imported function "run-sync".
|
|
41
|
+
//
|
|
42
|
+
// v19 函数级追加(工作区 git 域):**同步**执行并捕获输出。
|
|
43
|
+
// request-json 同 `run`(command / args / cwd / env / timeout_ms,无
|
|
44
|
+
// output_path——输出由宿主捕获);返回
|
|
45
|
+
// `{exitCode, stdout, stderr, timedOut}`。同步阻塞等待进程结束,供插件
|
|
46
|
+
// 同步路径(HTTP 端点命令面)使用;`run` 是异步事件模型(run-id +
|
|
47
|
+
// on_process_done 回调),不适配「命令面里同步拿结果」。权限 `process:run`。
|
|
48
|
+
//
|
|
49
|
+
// run-sync: func(request-json: string) -> result<string, string>
|
|
50
|
+
//
|
|
51
|
+
//go:nosplit
|
|
52
|
+
func RunSync(requestJSON string) (result cm.Result[string, string, string]) {
|
|
53
|
+
requestJson0, requestJson1 := cm.LowerString(requestJSON)
|
|
54
|
+
wasmimport_RunSync((*uint8)(requestJson0), (uint32)(requestJson1), &result)
|
|
55
|
+
return
|
|
56
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostpty
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
"unsafe"
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
// OptionRingFetchResultShape is used for storage in variant or result types.
|
|
11
|
+
type OptionRingFetchResultShape struct {
|
|
12
|
+
_ cm.HostLayout
|
|
13
|
+
shape [unsafe.Sizeof(cm.Option[RingFetchResult]{})]byte
|
|
14
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostpty
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
// This file contains wasmimport and wasmexport declarations for "wasmnest:pty@0.0.1".
|
|
10
|
+
|
|
11
|
+
//go:wasmimport wasmnest:pty/host-pty@0.0.1 spawn
|
|
12
|
+
//go:noescape
|
|
13
|
+
func wasmimport_Spawn(configJson0 *uint8, configJson1 uint32, result *cm.Result[string, string, string])
|
|
14
|
+
|
|
15
|
+
//go:wasmimport wasmnest:pty/host-pty@0.0.1 write
|
|
16
|
+
//go:noescape
|
|
17
|
+
func wasmimport_Write(ptyId0 *uint8, ptyId1 uint32, data0 *uint8, data1 uint32, result *cm.Result[string, struct{}, string])
|
|
18
|
+
|
|
19
|
+
//go:wasmimport wasmnest:pty/host-pty@0.0.1 resize
|
|
20
|
+
//go:noescape
|
|
21
|
+
func wasmimport_Resize(ptyId0 *uint8, ptyId1 uint32, cols0 uint32, rows0 uint32, result *cm.Result[string, struct{}, string])
|
|
22
|
+
|
|
23
|
+
//go:wasmimport wasmnest:pty/host-pty@0.0.1 kill
|
|
24
|
+
//go:noescape
|
|
25
|
+
func wasmimport_Kill(ptyId0 *uint8, ptyId1 uint32, result *cm.Result[string, struct{}, string])
|
|
26
|
+
|
|
27
|
+
//go:wasmimport wasmnest:pty/host-pty@0.0.1 ring-fetch
|
|
28
|
+
//go:noescape
|
|
29
|
+
func wasmimport_RingFetch(ptyId0 *uint8, ptyId1 uint32, fromOffset0 uint64, maxBytes0 uint32, result *cm.Result[OptionRingFetchResultShape, cm.Option[RingFetchResult], string])
|
|
30
|
+
|
|
31
|
+
//go:wasmimport wasmnest:pty/host-pty@0.0.1 is-running
|
|
32
|
+
//go:noescape
|
|
33
|
+
func wasmimport_IsRunning(ptyId0 *uint8, ptyId1 uint32, result *cm.Result[string, bool, string])
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package hostpty represents the imported interface "wasmnest:pty/host-pty@0.0.1".
|
|
4
|
+
//
|
|
5
|
+
// ======================================================================
|
|
6
|
+
// 插件私有伪终端(host-pty,v16):裸 PTY 引擎原语,零业务语义(ADR 0022)
|
|
7
|
+
//
|
|
8
|
+
// **与宿主业务会话线的边界(终态,v27 + v28 后)**:本接口是**宿主侧唯一的 PTY 出口**,
|
|
9
|
+
// 而业务会话本身就是一个本接口的句柄(会话 id 由插件自产,登记 / 状态机 / 输入输出编排
|
|
10
|
+
// 全在 `com.wasmnest.bedcode` 私有域)。宿主**不再持有任何会话对象**:内核会话目录
|
|
11
|
+
// `src-tauri/src/session/` 整目录删除,`host-session` 与 `host-terminal` 两个 interface
|
|
12
|
+
// 随 v27 退役,PTY 引擎只有本接口这一张注册表(无 SessionManager、无业务输出总线、
|
|
13
|
+
// 引擎不注入 `WASMNEST_SESSION_ID`)。**v28 起宿主也不再直读任何插件 PTY 的输出环**
|
|
14
|
+
// (`hostBroadcastSessionId` 只读订阅声明已删除,详见下方版本说明)——输出只经属主
|
|
15
|
+
// 插件的 `ring-fetch` 游标拉取。
|
|
16
|
+
//
|
|
17
|
+
// 约定与红线:
|
|
18
|
+
// - **属主隔离**:句柄 `pty-<uuid>` 仅创建者插件可调,他人 → `not owner of pty handle`;
|
|
19
|
+
// 插件停用时宿主回收其全部 PTY(kill + 摘注册表 + 补发 `pty:exit`)
|
|
20
|
+
// - **输出纯拉取**(无 push 回调):宿主为每个 PTY 维护有界环形缓冲,插件按
|
|
21
|
+
// 自己的节奏以游标拉取;慢插件只损失自己的历史(淘汰最旧 + `truncated`),
|
|
22
|
+
// 背压绝不回传到 PTY 读取端
|
|
23
|
+
// - **环的消费者只有属主插件一个**:曾允许 `spawn` 声明 `hostBroadcastSessionId`
|
|
24
|
+
// 把本句柄挂进宿主侧的「会话 id → pty 句柄」只读映射、供宿主 server 直读同进程
|
|
25
|
+
// `PtyRing`。该字段与宿主直读路径均已删除(PTY 引擎不再知道 session id),
|
|
26
|
+
// 输出只能经本接口 `ring-fetch` 拉取
|
|
27
|
+
// - **并发拉取**:游标由调用方自持、拉取本身是纯读(不消费、不推进全局状态);
|
|
28
|
+
// 淘汰由**产出量**驱动(环满即淘汰最旧),读取不释放空间,慢消费者落后于
|
|
29
|
+
// 驻留起点即 `truncated`(环容量需覆盖最慢消费者的滞后)
|
|
30
|
+
// - **生命周期事件**:仅 `<owner>::pty:exit` 一条(host-bus 订阅,属主私有命名空间,
|
|
31
|
+
// 跨属主订阅被宿主拒绝)。payload `{ ptyId, reason, exitCode? }`(camelCase),
|
|
32
|
+
// `reason = "stopped" | "killed" | "error"`。**须在 activate 期订阅**:宿主不缓冲、
|
|
33
|
+
// 不重放,晚订阅期间的丢失靠 `is-running` 快照自愈。事件发出即摘除注册表与环,
|
|
34
|
+
// 插件应先消费完输出(`ring-fetch` 的 `next-offset` 不再前进)再等退出事件
|
|
35
|
+
// - **明确不做**(业务语义归插件层):shell 包装(bash -lic / PowerShell -Command /
|
|
36
|
+
// CMD /K)、WSL 路径转换、危险字符校验、默认 shell 探测、特殊键 API、close/reopen
|
|
37
|
+
//
|
|
38
|
+
// 权限两域(可独立授予/审计):`pty:spawn`(spawn / kill——任意命令执行的高风险面)、
|
|
39
|
+
// `pty:io`(write / resize / ring-fetch / is-running——数据面)。
|
|
40
|
+
package hostpty
|
|
41
|
+
|
|
42
|
+
import (
|
|
43
|
+
"go.bytecodealliance.org/cm"
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
// RingFetchResult represents the record "wasmnest:pty/host-pty@0.0.1#ring-fetch-result".
|
|
47
|
+
//
|
|
48
|
+
// 一次拉取的返回(游标语义见 `ring-fetch`)
|
|
49
|
+
//
|
|
50
|
+
// record ring-fetch-result {
|
|
51
|
+
// data: list<u8>,
|
|
52
|
+
// next-offset: u64,
|
|
53
|
+
// truncated: bool,
|
|
54
|
+
// }
|
|
55
|
+
type RingFetchResult struct {
|
|
56
|
+
_ cm.HostLayout `json:"-"`
|
|
57
|
+
// `[实际起点, next-offset)` 区间的原始字节(未解码,可能是非 UTF-8)
|
|
58
|
+
Data cm.List[uint8] `json:"data"`
|
|
59
|
+
|
|
60
|
+
// 下一次拉取应传的游标
|
|
61
|
+
NextOffset uint64 `json:"next-offset"`
|
|
62
|
+
|
|
63
|
+
// `from-offset` 落后于环驻留起点(中间字节已被淘汰)→ 调用方按 resync 重建上下文
|
|
64
|
+
Truncated bool `json:"truncated"`
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Spawn represents the imported function "spawn".
|
|
68
|
+
//
|
|
69
|
+
// 创建裸 PTY:成功返回句柄 `pty-<uuid>` 并登记属主;失败只回错误且
|
|
70
|
+
// **不发布任何事件**(无句柄可寻址)。
|
|
71
|
+
// config-json(camelCase,纯引擎参数,宿主不做 shell 解析):
|
|
72
|
+
// `{ command, args?, env?, workingDir?, cols?, rows?, ringBytes? }`
|
|
73
|
+
// (参数数组 exec 天然免注入;`env` 为追加进继承环境的键值;尺寸缺省取宿主终端配置
|
|
74
|
+
// `terminal.default_cols` / `default_rows`,与业务线同源;`ringBytes` 是本条 PTY
|
|
75
|
+
// 的输出环容量,缺省取宿主默认,超宿主上限或超出每插件在册条数上限一律 `Err`
|
|
76
|
+
// ——配额类失败可见,不静默降级也不静默淘汰既有句柄)。
|
|
77
|
+
//
|
|
78
|
+
// spawn: func(config-json: string) -> result<string, string>
|
|
79
|
+
//
|
|
80
|
+
//go:nosplit
|
|
81
|
+
func Spawn(configJSON string) (result cm.Result[string, string, string]) {
|
|
82
|
+
configJson0, configJson1 := cm.LowerString(configJSON)
|
|
83
|
+
wasmimport_Spawn((*uint8)(configJson0), (uint32)(configJson1), &result)
|
|
84
|
+
return
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Write represents the imported function "write".
|
|
88
|
+
//
|
|
89
|
+
// 写入输入字节(分块语义宿主内建;超单次上限 → Err)
|
|
90
|
+
//
|
|
91
|
+
// write: func(pty-id: string, data: list<u8>) -> result<_, string>
|
|
92
|
+
//
|
|
93
|
+
//go:nosplit
|
|
94
|
+
func Write(ptyID string, data cm.List[uint8]) (result cm.Result[string, struct{}, string]) {
|
|
95
|
+
ptyId0, ptyId1 := cm.LowerString(ptyID)
|
|
96
|
+
data0, data1 := cm.LowerList(data)
|
|
97
|
+
wasmimport_Write((*uint8)(ptyId0), (uint32)(ptyId1), (*uint8)(data0), (uint32)(data1), &result)
|
|
98
|
+
return
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Resize represents the imported function "resize".
|
|
102
|
+
//
|
|
103
|
+
// 调整终端尺寸(TUI 程序全屏刷新依赖)
|
|
104
|
+
//
|
|
105
|
+
// resize: func(pty-id: string, cols: u16, rows: u16) -> result<_, string>
|
|
106
|
+
//
|
|
107
|
+
//go:nosplit
|
|
108
|
+
func Resize(ptyID string, cols uint16, rows uint16) (result cm.Result[string, struct{}, string]) {
|
|
109
|
+
ptyId0, ptyId1 := cm.LowerString(ptyID)
|
|
110
|
+
cols0 := (uint32)(cols)
|
|
111
|
+
rows0 := (uint32)(rows)
|
|
112
|
+
wasmimport_Resize((*uint8)(ptyId0), (uint32)(ptyId1), (uint32)(cols0), (uint32)(rows0), &result)
|
|
113
|
+
return
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Kill represents the imported function "kill".
|
|
117
|
+
//
|
|
118
|
+
// 终止并销毁(优雅 Ctrl-C → 兜底强杀);随后发布 `<owner>::pty:exit`(reason=killed)
|
|
119
|
+
//
|
|
120
|
+
// kill: func(pty-id: string) -> result<_, string>
|
|
121
|
+
//
|
|
122
|
+
//go:nosplit
|
|
123
|
+
func Kill(ptyID string) (result cm.Result[string, struct{}, string]) {
|
|
124
|
+
ptyId0, ptyId1 := cm.LowerString(ptyID)
|
|
125
|
+
wasmimport_Kill((*uint8)(ptyId0), (uint32)(ptyId1), &result)
|
|
126
|
+
return
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// RingFetch represents the imported function "ring-fetch".
|
|
130
|
+
//
|
|
131
|
+
// 按游标拉取输出历史
|
|
132
|
+
// - `Ok(None)`:游标已追平产出端,无新字节
|
|
133
|
+
// - `Ok(Some)`:自游标起的字节(单次不超 `max-bytes`),`next-offset` 续拉不重复
|
|
134
|
+
// - `truncated = true`:`from-offset` 落后于环驻留起点,返回的是现存最早段
|
|
135
|
+
// - `Err`:句柄不存在 / 非属主 / 权限缺失
|
|
136
|
+
//
|
|
137
|
+
// **并发拉取**:游标由调用方自持、互不干扰(`from-offset` 只描述本次拉取的窗口,
|
|
138
|
+
// 拉取不消费不改变全局偏移);淘汰按产出量全局计,任一读取都不为他人保留历史,
|
|
139
|
+
// 落后于驻留起点即 `truncated`。(消费者只有属主插件自己。)
|
|
140
|
+
//
|
|
141
|
+
// ring-fetch: func(pty-id: string, from-offset: u64, max-bytes: u32) -> result<option<ring-fetch-result>,
|
|
142
|
+
// string>
|
|
143
|
+
//
|
|
144
|
+
//go:nosplit
|
|
145
|
+
func RingFetch(ptyID string, fromOffset uint64, maxBytes uint32) (result cm.Result[OptionRingFetchResultShape, cm.Option[RingFetchResult], string]) {
|
|
146
|
+
ptyId0, ptyId1 := cm.LowerString(ptyID)
|
|
147
|
+
fromOffset0 := (uint64)(fromOffset)
|
|
148
|
+
maxBytes0 := (uint32)(maxBytes)
|
|
149
|
+
wasmimport_RingFetch((*uint8)(ptyId0), (uint32)(ptyId1), (uint64)(fromOffset0), (uint32)(maxBytes0), &result)
|
|
150
|
+
return
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// IsRunning represents the imported function "is-running".
|
|
154
|
+
//
|
|
155
|
+
// 进程是否仍在运行(丢失 `pty:exit` 事件后的自愈快照查询)
|
|
156
|
+
//
|
|
157
|
+
// is-running: func(pty-id: string) -> result<bool, string>
|
|
158
|
+
//
|
|
159
|
+
//go:nosplit
|
|
160
|
+
func IsRunning(ptyID string) (result cm.Result[string, bool, string]) {
|
|
161
|
+
ptyId0, ptyId1 := cm.LowerString(ptyID)
|
|
162
|
+
wasmimport_IsRunning((*uint8)(ptyId0), (uint32)(ptyId1), &result)
|
|
163
|
+
return
|
|
164
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hosttask
|
|
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 hosttask
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
// This file contains wasmimport and wasmexport declarations for "wasmnest:task@0.0.1".
|
|
10
|
+
|
|
11
|
+
//go:wasmimport wasmnest:task/host-task@0.0.1 execute-batch
|
|
12
|
+
//go:noescape
|
|
13
|
+
func wasmimport_ExecuteBatch(planJson0 *uint8, planJson1 uint32, result *cm.Result[string, string, string])
|
|
14
|
+
|
|
15
|
+
//go:wasmimport wasmnest:task/host-task@0.0.1 submit
|
|
16
|
+
//go:noescape
|
|
17
|
+
func wasmimport_Submit(planJson0 *uint8, planJson1 uint32, result *cm.Result[string, string, string])
|
|
18
|
+
|
|
19
|
+
//go:wasmimport wasmnest:task/host-task@0.0.1 status
|
|
20
|
+
//go:noescape
|
|
21
|
+
func wasmimport_Status(jobId0 *uint8, jobId1 uint32, result *cm.Result[OptionStringShape, cm.Option[string], string])
|
|
22
|
+
|
|
23
|
+
//go:wasmimport wasmnest:task/host-task@0.0.1 cancel
|
|
24
|
+
//go:noescape
|
|
25
|
+
func wasmimport_Cancel(jobId0 *uint8, jobId1 uint32, result *cm.Result[string, bool, string])
|
|
26
|
+
|
|
27
|
+
//go:wasmimport wasmnest:task/host-task@0.0.1 list-jobs
|
|
28
|
+
//go:noescape
|
|
29
|
+
func wasmimport_ListJobs(result *cm.Result[string, string, string])
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package hosttask represents the imported interface "wasmnest:task/host-task@0.0.1".
|
|
4
|
+
//
|
|
5
|
+
// 桌面端能力域分片(WIT 按包拆分,ADR 0061):一个能力域 = 一个独立包,
|
|
6
|
+
// 版本独立演进——本包 WIT 变更只 bump 本包,不波及未 import 它的应用。
|
|
7
|
+
// 端 `plugin` world 经 `include wasmnest:task/cap-task@0.0.1;` 并入本接口。
|
|
8
|
+
// 宿主并发任务域(v20,**desktop 独有,双端偏离**——同 host-pty / host-auth 先例,
|
|
9
|
+
// ADR 0022「双端偏离」节:桌面独有接口不要求移动端跟演;当前 desktop ABI v31、
|
|
10
|
+
// mobile 11;移动端要接同类能力时再补该端 interface 并对齐计数)。
|
|
11
|
+
//
|
|
12
|
+
// 问题域:WASM 插件(wasm32-wasip3 组件)无法创建 OS 线程;其全部宿主调用在
|
|
13
|
+
// 当前 ABI 下同步阻塞——插件要并发做 50 个 `fs.stat` / 并行跑 3 条 `git diff`,
|
|
14
|
+
// 只能串行排队,每个调用都占用 Store 执行线程。本接口让插件把「单元操作计划」
|
|
15
|
+
// 提交给宿主:由宿主专用 OS 线程池真并行执行既有宿主原语(零业务语义,
|
|
16
|
+
// ADR 0022 裁剪线——宿主不做任何编排解释;fail-collect 不 fail-fast,单元独立
|
|
17
|
+
// 成败,结果按 units 原顺序返回,`id` 由插件指定用于关联,编排判断归插件)。
|
|
18
|
+
//
|
|
19
|
+
// 两档 API 共享同一单元模型与执行器:
|
|
20
|
+
// - `execute-batch`(同步档):扇出 → join → 一次性返回全部单元结果。阻塞 Store
|
|
21
|
+
// 至全部单元终态(或超时)——同 `run-sync` 的阻塞语义,仅限快操作(数十
|
|
22
|
+
// 百毫秒级);长任务一律 `submit`。
|
|
23
|
+
// - `submit`(异步档):登记后立即返回句柄 `task-<uuid>`,宿主线线程池执行,
|
|
24
|
+
// 进度/终态经可选导出 `events-task#on-task-event` 回调;`cancel` 协作式取消。
|
|
25
|
+
//
|
|
26
|
+
// 属主隔离:句柄 `task-<uuid>` 仅创建者插件可调(沿 pty- / wsc- 先例);
|
|
27
|
+
// 插件停用时宿主回收其全部任务(cancel 全部在册任务、清注册表、清回调队列)。
|
|
28
|
+
// 事件丢失自愈:`status` / `list-jobs` 是权威快照(回调是尽力投递)。
|
|
29
|
+
package hosttask
|
|
30
|
+
|
|
31
|
+
import (
|
|
32
|
+
"go.bytecodealliance.org/cm"
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
// ExecuteBatch represents the imported function "execute-batch".
|
|
36
|
+
//
|
|
37
|
+
// 同步批:并发执行 plan 全部单元并 join。
|
|
38
|
+
// plan-json(camelCase):
|
|
39
|
+
// `{ units: [{ id, kind, params }], maxConcurrency?, jobTimeoutMs?, progress? }`
|
|
40
|
+
// - `units[].params` = 对应宿主原语既有请求 JSON **原样内嵌**(如
|
|
41
|
+
// `process.run-sync` 的 params 就是 run-sync 的 request-json),宿主零新 DTO
|
|
42
|
+
// 映射,语义单点在既有实现;
|
|
43
|
+
// - `maxConcurrency` ≤ 全局池线程数,缺省 = 池满即排队;
|
|
44
|
+
// - `jobTimeoutMs` 缺省取常量;超时 → cancelled + 已完成单元结果保留。
|
|
45
|
+
// 返回 `{ jobId, results: [{ id, ok, value?|error?, durationMs }], cancelled }`
|
|
46
|
+
// (camelCase;`value` = 单元原语的原返回 JSON 字符串)。
|
|
47
|
+
// 阻塞 Store 至全部单元终态(或超时)——同 `run-sync` 的阻塞语义,仅限快操作。
|
|
48
|
+
//
|
|
49
|
+
// execute-batch: func(plan-json: string) -> result<string, string>
|
|
50
|
+
//
|
|
51
|
+
//go:nosplit
|
|
52
|
+
func ExecuteBatch(planJSON string) (result cm.Result[string, string, string]) {
|
|
53
|
+
planJson0, planJson1 := cm.LowerString(planJSON)
|
|
54
|
+
wasmimport_ExecuteBatch((*uint8)(planJson0), (uint32)(planJson1), &result)
|
|
55
|
+
return
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Submit represents the imported function "submit".
|
|
59
|
+
//
|
|
60
|
+
// 异步任务:登记后立即返回句柄 `task-<uuid>`;进度/终态经 events-task 回调。
|
|
61
|
+
// plan 同 `execute-batch`,返回 `task-<uuid>` 字符串。
|
|
62
|
+
//
|
|
63
|
+
// submit: func(plan-json: string) -> result<string, string>
|
|
64
|
+
//
|
|
65
|
+
//go:nosplit
|
|
66
|
+
func Submit(planJSON string) (result cm.Result[string, string, string]) {
|
|
67
|
+
planJson0, planJson1 := cm.LowerString(planJSON)
|
|
68
|
+
wasmimport_Submit((*uint8)(planJson0), (uint32)(planJson1), &result)
|
|
69
|
+
return
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Status represents the imported function "status".
|
|
73
|
+
//
|
|
74
|
+
// 任务状态自愈快照(事件丢失后查询):state / 计数器 / 终态 results(有界保留)。
|
|
75
|
+
// `Ok(None)` = job-id 不存在或非属主(不存在与无权限对调用方不可区分,防枚举)。
|
|
76
|
+
//
|
|
77
|
+
// status: func(job-id: string) -> result<option<string>, string>
|
|
78
|
+
//
|
|
79
|
+
//go:nosplit
|
|
80
|
+
func Status(jobID string) (result cm.Result[OptionStringShape, cm.Option[string], string]) {
|
|
81
|
+
jobId0, jobId1 := cm.LowerString(jobID)
|
|
82
|
+
wasmimport_Status((*uint8)(jobId0), (uint32)(jobId1), &result)
|
|
83
|
+
return
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Cancel represents the imported function "cancel".
|
|
87
|
+
//
|
|
88
|
+
// 取消(协作式:正在执行的单元跑完或超时,未开始单元 skipped);幂等,
|
|
89
|
+
// 返回是否命中(`Ok(false)` = 任务不存在 / 非属主 / 已终态)。
|
|
90
|
+
//
|
|
91
|
+
// cancel: func(job-id: string) -> result<bool, string>
|
|
92
|
+
//
|
|
93
|
+
//go:nosplit
|
|
94
|
+
func Cancel(jobID string) (result cm.Result[string, bool, string]) {
|
|
95
|
+
jobId0, jobId1 := cm.LowerString(jobID)
|
|
96
|
+
wasmimport_Cancel((*uint8)(jobId0), (uint32)(jobId1), &result)
|
|
97
|
+
return
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// ListJobs represents the imported function "list-jobs".
|
|
101
|
+
//
|
|
102
|
+
// 本插件在册任务清单(自愈快照):`[ { jobId, state, doneUnits?, failedUnits?, createdAt } ]`
|
|
103
|
+
//
|
|
104
|
+
// list-jobs: func() -> result<string, string>
|
|
105
|
+
//
|
|
106
|
+
//go:nosplit
|
|
107
|
+
func ListJobs() (result cm.Result[string, string, string]) {
|
|
108
|
+
wasmimport_ListJobs(&result)
|
|
109
|
+
return
|
|
110
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hosttimer
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
// This file contains wasmimport and wasmexport declarations for "wasmnest:timer@0.0.1".
|
|
10
|
+
|
|
11
|
+
//go:wasmimport wasmnest:timer/host-timer@0.0.1 register
|
|
12
|
+
//go:noescape
|
|
13
|
+
func wasmimport_Register(intervalSecs0 uint64, command0 *uint8, command1 uint32, result *cm.Result[string, struct{}, string])
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package hosttimer represents the imported interface "wasmnest:timer/host-timer@0.0.1".
|
|
4
|
+
//
|
|
5
|
+
// 桌面端能力域分片(WIT 按包拆分,ADR 0061):一个能力域 = 一个独立包,
|
|
6
|
+
// 版本独立演进——本包 WIT 变更只 bump 本包,不波及未 import 它的应用。
|
|
7
|
+
// 端 `plugin` world 经 `include wasmnest:timer/cap-timer@0.0.1;` 并入本接口。
|
|
8
|
+
// 宿主周期定时器(原 timer.rs:timer_register,ABI v6)
|
|
9
|
+
package hosttimer
|
|
10
|
+
|
|
11
|
+
import (
|
|
12
|
+
"go.bytecodealliance.org/cm"
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
// Register represents the imported function "register".
|
|
16
|
+
//
|
|
17
|
+
// register: func(interval-secs: u64, command: string) -> result<_, string>
|
|
18
|
+
//
|
|
19
|
+
//go:nosplit
|
|
20
|
+
func Register(intervalSecs uint64, command string) (result cm.Result[string, struct{}, string]) {
|
|
21
|
+
intervalSecs0 := (uint64)(intervalSecs)
|
|
22
|
+
command0, command1 := cm.LowerString(command)
|
|
23
|
+
wasmimport_Register((uint64)(intervalSecs0), (*uint8)(command0), (uint32)(command1), &result)
|
|
24
|
+
return
|
|
25
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostwebsocket
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
// This file contains wasmimport and wasmexport declarations for "wasmnest:ws@0.0.1".
|
|
10
|
+
|
|
11
|
+
//go:wasmimport wasmnest:ws/host-websocket@0.0.1 connect
|
|
12
|
+
//go:noescape
|
|
13
|
+
func wasmimport_Connect(configJson0 *uint8, configJson1 uint32, result *cm.Result[string, string, string])
|
|
14
|
+
|
|
15
|
+
//go:wasmimport wasmnest:ws/host-websocket@0.0.1 send-text
|
|
16
|
+
//go:noescape
|
|
17
|
+
func wasmimport_SendText(handle0 *uint8, handle1 uint32, text0 *uint8, text1 uint32, result *cm.Result[string, struct{}, string])
|
|
18
|
+
|
|
19
|
+
//go:wasmimport wasmnest:ws/host-websocket@0.0.1 send-binary
|
|
20
|
+
//go:noescape
|
|
21
|
+
func wasmimport_SendBinary(handle0 *uint8, handle1 uint32, payload0 *uint8, payload1 uint32, result *cm.Result[string, struct{}, string])
|
|
22
|
+
|
|
23
|
+
//go:wasmimport wasmnest:ws/host-websocket@0.0.1 close
|
|
24
|
+
//go:noescape
|
|
25
|
+
func wasmimport_Close(handle0 *uint8, handle1 uint32, closeJson0 *uint8, closeJson1 uint32, result *cm.Result[string, bool, string])
|
|
26
|
+
|
|
27
|
+
//go:wasmimport wasmnest:ws/host-websocket@0.0.1 is-connected
|
|
28
|
+
//go:noescape
|
|
29
|
+
func wasmimport_IsConnected(handle0 *uint8, handle1 uint32, result *cm.Result[string, bool, string])
|