-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathplugin-api.wit
More file actions
38 lines (32 loc) · 1018 Bytes
/
plugin-api.wit
File metadata and controls
38 lines (32 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
interface plugin {
use transport.{plugin-response};
name: func() -> string;
man: func() -> string;
run: func(payload: string) -> result<plugin-response>;
}
/// Provided by the host, accessible by plugins
interface http-client {
record http-header {
name: string,
value: string,
}
record http-response {
status: u16,
ok: bool,
headers: list<http-header>,
body: string,
}
get: func(url: string, headers: list<http-header>) -> result<http-response, string>;
}
interface host-state-plugin {
get-repl-var: func(key: string) -> option<string>;
}
world plugin-api {
// The wasip2 target of TinyGo assumes that the component is targeting wasi:cli/command@0.2.0 world (part of wasi:cli),
// so it needs to include the imports from that world.
// It's only included for the versions of the wit files destined for TinyGo.
// include wasi:cli/imports@0.2.0; // SPECIFIC TinyGo - DO NOT CHANGE THIS LINE
import http-client;
import host-state-plugin;
export plugin;
}