Defines the host<->guest wire contract for the .so -> wazero migration as a repo-local buf module (abi/proto/v1, generated Go in abi/v1): - manifest.proto: PluginManifest mirroring every static field of plugin.PluginRegistration (abi_version, deps, block/template registrations, admin pages, settings schema, theme presets, fonts, master pages, AI actions, RBAC method roles, CSS manifest, icon packs, directory extensions, job types, RAG fetcher types, settings panel, hook flags, core service bindings) - invoke.proto: bn_invoke envelope, Hook catalog (RENDER_BLOCK, RENDER_TEMPLATE, HANDLE_HTTP, JOB, LOAD, UNLOAD, RAG_FETCH, MEDIA_HOOK, DESCRIBE), AbiError, and job/lifecycle/rag/media/describe payloads - render.proto: RenderBlock/RenderTemplate payloads + RenderContext enumerating every ctx value from blocks/context.go (incl. BlockContext 1:1) - http.proto: buffered HttpRequest/HttpResponse for HANDLE_HTTP - db.proto: guest sql-driver messages (DbValue oneof over pgx-mappable types, query/exec/tx with host-side tx handles, SQLSTATE-carrying DbError) - capability.proto: HostCall envelope + one request/response pair per CoreServices interface method (content, settings+update, gating, crypto, menus, datasources, users, subscriptions, media.deposit, email.send, ai.text_call, ai.tools.register, bridge, jobs.submit, embeddings, rag, reviews, badges.refresh) The abi/ buf module is deliberately separate from the repo-root config: proto/ is the shared block/proto submodule (service API contracts); the ABI is SDK-internal and versions in lockstep with the guest shim. New `make abi` target runs buf lint + generate. docs/wasm-abi.md documents the ptr+len calling convention (bn_alloc, bn_invoke, packed u64), hook catalog, error semantics, abi_version evolution rules, and the full registration/ CoreServices coverage tables. Verified: `cd abi && buf lint` exit 0; `go build ./...` exit 0. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
297 lines
8.9 KiB
Go
297 lines
8.9 KiB
Go
// http.proto — buffered HTTP request/response payloads for the HANDLE_HTTP
|
|
// hook (WO-WZ-001).
|
|
//
|
|
// v1 buffers full bodies: no streaming, SSE, or WebSockets inside plugins
|
|
// (per the wasm migration design spec §5). The guest runs its real
|
|
// chi/connect mux internally and answers one HttpRequest with one
|
|
// HttpResponse.
|
|
|
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
|
// versions:
|
|
// protoc-gen-go v1.36.11
|
|
// protoc (unknown)
|
|
// source: v1/http.proto
|
|
|
|
package abiv1
|
|
|
|
import (
|
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
|
reflect "reflect"
|
|
sync "sync"
|
|
unsafe "unsafe"
|
|
)
|
|
|
|
const (
|
|
// Verify that this generated code is sufficiently up-to-date.
|
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
|
)
|
|
|
|
// HttpRequest is a fully buffered HTTP request forwarded to the guest mux.
|
|
type HttpRequest struct {
|
|
state protoimpl.MessageState `protogen:"open.v1"`
|
|
Method string `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"`
|
|
// Request path (no scheme/host/query).
|
|
Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
|
|
// Raw query string (without the leading '?').
|
|
RawQuery string `protobuf:"bytes,3,opt,name=raw_query,json=rawQuery,proto3" json:"raw_query,omitempty"`
|
|
// Canonical header name → values.
|
|
Headers map[string]*HeaderValues `protobuf:"bytes,4,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
|
Body []byte `protobuf:"bytes,5,opt,name=body,proto3" json:"body,omitempty"`
|
|
unknownFields protoimpl.UnknownFields
|
|
sizeCache protoimpl.SizeCache
|
|
}
|
|
|
|
func (x *HttpRequest) Reset() {
|
|
*x = HttpRequest{}
|
|
mi := &file_v1_http_proto_msgTypes[0]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *HttpRequest) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*HttpRequest) ProtoMessage() {}
|
|
|
|
func (x *HttpRequest) ProtoReflect() protoreflect.Message {
|
|
mi := &file_v1_http_proto_msgTypes[0]
|
|
if x != nil {
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
if ms.LoadMessageInfo() == nil {
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
return ms
|
|
}
|
|
return mi.MessageOf(x)
|
|
}
|
|
|
|
// Deprecated: Use HttpRequest.ProtoReflect.Descriptor instead.
|
|
func (*HttpRequest) Descriptor() ([]byte, []int) {
|
|
return file_v1_http_proto_rawDescGZIP(), []int{0}
|
|
}
|
|
|
|
func (x *HttpRequest) GetMethod() string {
|
|
if x != nil {
|
|
return x.Method
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *HttpRequest) GetPath() string {
|
|
if x != nil {
|
|
return x.Path
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *HttpRequest) GetRawQuery() string {
|
|
if x != nil {
|
|
return x.RawQuery
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *HttpRequest) GetHeaders() map[string]*HeaderValues {
|
|
if x != nil {
|
|
return x.Headers
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *HttpRequest) GetBody() []byte {
|
|
if x != nil {
|
|
return x.Body
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// HeaderValues holds the values of one multi-valued HTTP header.
|
|
type HeaderValues struct {
|
|
state protoimpl.MessageState `protogen:"open.v1"`
|
|
Values []string `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"`
|
|
unknownFields protoimpl.UnknownFields
|
|
sizeCache protoimpl.SizeCache
|
|
}
|
|
|
|
func (x *HeaderValues) Reset() {
|
|
*x = HeaderValues{}
|
|
mi := &file_v1_http_proto_msgTypes[1]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *HeaderValues) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*HeaderValues) ProtoMessage() {}
|
|
|
|
func (x *HeaderValues) ProtoReflect() protoreflect.Message {
|
|
mi := &file_v1_http_proto_msgTypes[1]
|
|
if x != nil {
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
if ms.LoadMessageInfo() == nil {
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
return ms
|
|
}
|
|
return mi.MessageOf(x)
|
|
}
|
|
|
|
// Deprecated: Use HeaderValues.ProtoReflect.Descriptor instead.
|
|
func (*HeaderValues) Descriptor() ([]byte, []int) {
|
|
return file_v1_http_proto_rawDescGZIP(), []int{1}
|
|
}
|
|
|
|
func (x *HeaderValues) GetValues() []string {
|
|
if x != nil {
|
|
return x.Values
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// HttpResponse is the guest's fully buffered response.
|
|
type HttpResponse struct {
|
|
state protoimpl.MessageState `protogen:"open.v1"`
|
|
Status int32 `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"`
|
|
Headers map[string]*HeaderValues `protobuf:"bytes,2,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
|
Body []byte `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"`
|
|
unknownFields protoimpl.UnknownFields
|
|
sizeCache protoimpl.SizeCache
|
|
}
|
|
|
|
func (x *HttpResponse) Reset() {
|
|
*x = HttpResponse{}
|
|
mi := &file_v1_http_proto_msgTypes[2]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *HttpResponse) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*HttpResponse) ProtoMessage() {}
|
|
|
|
func (x *HttpResponse) ProtoReflect() protoreflect.Message {
|
|
mi := &file_v1_http_proto_msgTypes[2]
|
|
if x != nil {
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
if ms.LoadMessageInfo() == nil {
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
return ms
|
|
}
|
|
return mi.MessageOf(x)
|
|
}
|
|
|
|
// Deprecated: Use HttpResponse.ProtoReflect.Descriptor instead.
|
|
func (*HttpResponse) Descriptor() ([]byte, []int) {
|
|
return file_v1_http_proto_rawDescGZIP(), []int{2}
|
|
}
|
|
|
|
func (x *HttpResponse) GetStatus() int32 {
|
|
if x != nil {
|
|
return x.Status
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (x *HttpResponse) GetHeaders() map[string]*HeaderValues {
|
|
if x != nil {
|
|
return x.Headers
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *HttpResponse) GetBody() []byte {
|
|
if x != nil {
|
|
return x.Body
|
|
}
|
|
return nil
|
|
}
|
|
|
|
var File_v1_http_proto protoreflect.FileDescriptor
|
|
|
|
const file_v1_http_proto_rawDesc = "" +
|
|
"\n" +
|
|
"\rv1/http.proto\x12\x06abi.v1\"\xf8\x01\n" +
|
|
"\vHttpRequest\x12\x16\n" +
|
|
"\x06method\x18\x01 \x01(\tR\x06method\x12\x12\n" +
|
|
"\x04path\x18\x02 \x01(\tR\x04path\x12\x1b\n" +
|
|
"\traw_query\x18\x03 \x01(\tR\brawQuery\x12:\n" +
|
|
"\aheaders\x18\x04 \x03(\v2 .abi.v1.HttpRequest.HeadersEntryR\aheaders\x12\x12\n" +
|
|
"\x04body\x18\x05 \x01(\fR\x04body\x1aP\n" +
|
|
"\fHeadersEntry\x12\x10\n" +
|
|
"\x03key\x18\x01 \x01(\tR\x03key\x12*\n" +
|
|
"\x05value\x18\x02 \x01(\v2\x14.abi.v1.HeaderValuesR\x05value:\x028\x01\"&\n" +
|
|
"\fHeaderValues\x12\x16\n" +
|
|
"\x06values\x18\x01 \x03(\tR\x06values\"\xc9\x01\n" +
|
|
"\fHttpResponse\x12\x16\n" +
|
|
"\x06status\x18\x01 \x01(\x05R\x06status\x12;\n" +
|
|
"\aheaders\x18\x02 \x03(\v2!.abi.v1.HttpResponse.HeadersEntryR\aheaders\x12\x12\n" +
|
|
"\x04body\x18\x03 \x01(\fR\x04body\x1aP\n" +
|
|
"\fHeadersEntry\x12\x10\n" +
|
|
"\x03key\x18\x01 \x01(\tR\x03key\x12*\n" +
|
|
"\x05value\x18\x02 \x01(\v2\x14.abi.v1.HeaderValuesR\x05value:\x028\x01B0Z.git.dev.alexdunmow.com/block/core/abi/v1;abiv1b\x06proto3"
|
|
|
|
var (
|
|
file_v1_http_proto_rawDescOnce sync.Once
|
|
file_v1_http_proto_rawDescData []byte
|
|
)
|
|
|
|
func file_v1_http_proto_rawDescGZIP() []byte {
|
|
file_v1_http_proto_rawDescOnce.Do(func() {
|
|
file_v1_http_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_v1_http_proto_rawDesc), len(file_v1_http_proto_rawDesc)))
|
|
})
|
|
return file_v1_http_proto_rawDescData
|
|
}
|
|
|
|
var file_v1_http_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
|
|
var file_v1_http_proto_goTypes = []any{
|
|
(*HttpRequest)(nil), // 0: abi.v1.HttpRequest
|
|
(*HeaderValues)(nil), // 1: abi.v1.HeaderValues
|
|
(*HttpResponse)(nil), // 2: abi.v1.HttpResponse
|
|
nil, // 3: abi.v1.HttpRequest.HeadersEntry
|
|
nil, // 4: abi.v1.HttpResponse.HeadersEntry
|
|
}
|
|
var file_v1_http_proto_depIdxs = []int32{
|
|
3, // 0: abi.v1.HttpRequest.headers:type_name -> abi.v1.HttpRequest.HeadersEntry
|
|
4, // 1: abi.v1.HttpResponse.headers:type_name -> abi.v1.HttpResponse.HeadersEntry
|
|
1, // 2: abi.v1.HttpRequest.HeadersEntry.value:type_name -> abi.v1.HeaderValues
|
|
1, // 3: abi.v1.HttpResponse.HeadersEntry.value:type_name -> abi.v1.HeaderValues
|
|
4, // [4:4] is the sub-list for method output_type
|
|
4, // [4:4] is the sub-list for method input_type
|
|
4, // [4:4] is the sub-list for extension type_name
|
|
4, // [4:4] is the sub-list for extension extendee
|
|
0, // [0:4] is the sub-list for field type_name
|
|
}
|
|
|
|
func init() { file_v1_http_proto_init() }
|
|
func file_v1_http_proto_init() {
|
|
if File_v1_http_proto != nil {
|
|
return
|
|
}
|
|
type x struct{}
|
|
out := protoimpl.TypeBuilder{
|
|
File: protoimpl.DescBuilder{
|
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_http_proto_rawDesc), len(file_v1_http_proto_rawDesc)),
|
|
NumEnums: 0,
|
|
NumMessages: 5,
|
|
NumExtensions: 0,
|
|
NumServices: 0,
|
|
},
|
|
GoTypes: file_v1_http_proto_goTypes,
|
|
DependencyIndexes: file_v1_http_proto_depIdxs,
|
|
MessageInfos: file_v1_http_proto_msgTypes,
|
|
}.Build()
|
|
File_v1_http_proto = out.File
|
|
file_v1_http_proto_goTypes = nil
|
|
file_v1_http_proto_depIdxs = nil
|
|
}
|