Archive the Rust web plugin and add a Go c-shared skeleton with ABI v2 bridge, build script, design doc/ADR, and smoke test so multi-language plugins and full web parity can proceed wave by wave. Co-authored-by: Cursor <cursoragent@cursor.com>
29 lines
671 B
Go
29 lines
671 B
Go
package plugin
|
|
|
|
// HostFns holds callbacks into the Marqdo host (valid after marqdo_plugin_init).
|
|
type HostFns struct {
|
|
Query func(name, argsJSON string) (string, error)
|
|
}
|
|
|
|
var host HostFns
|
|
|
|
// SetHost stores host callbacks from ABI init.
|
|
func SetHost(h HostFns) { host = h }
|
|
|
|
// Shutdown clears plugin global state (HTTP servers, pools, …).
|
|
func Shutdown() {
|
|
host = HostFns{}
|
|
}
|
|
|
|
// Query runs an allowlisted host_query.
|
|
func Query(name, argsJSON string) (string, error) {
|
|
if host.Query == nil {
|
|
return "", errString("host_query not available")
|
|
}
|
|
return host.Query(name, argsJSON)
|
|
}
|
|
|
|
type errString string
|
|
|
|
func (e errString) Error() string { return string(e) }
|