diff --git a/pkg/workflows/sdk/builder.go b/pkg/workflows/sdk/builder.go index efefb681b..2e7f55324 100644 --- a/pkg/workflows/sdk/builder.go +++ b/pkg/workflows/sdk/builder.go @@ -12,13 +12,30 @@ import ( // WorkflowSpecFactory is used to build WorkflowSpecs. type WorkflowSpecFactory struct { - spec *WorkflowSpec - names map[string]bool - duplicateNames map[string]bool - emptyNames bool - badCapTypes []string - errors []error - fns map[string]func(runtime Runtime, request capabilities.CapabilityRequest) (capabilities.CapabilityResponse, error) + spec *WorkflowSpec + names map[string]bool + duplicateNames map[string]bool + emptyNames bool + badCapTypes []string + errors []error + fns map[string]func(runtime Runtime, request capabilities.CapabilityRequest) (capabilities.CapabilityResponse, error) + runFnsPerTrigger map[string]func(runtime RuntimeV2, triggerEvent capabilities.TriggerEvent) error +} + +// One Run() function per registered trigger +func AddRunFunctionForTrigger[TriggerConfig any, TriggerOutputs any](w *WorkflowSpecFactory, triggerRef string, triggerCfg TriggerConfig, fn func(runtime RuntimeV2, triggerOutputs TriggerOutputs) error) { + w.runFnsPerTrigger[triggerRef] = func(runtime RuntimeV2, triggerEvent capabilities.TriggerEvent) error { + var triggerOutputs TriggerOutputs + err := triggerEvent.Outputs.UnwrapTo(&triggerOutputs) + if err != nil { + return err + } + return fn(runtime, triggerOutputs) + } +} + +func (w *WorkflowSpecFactory) GetRunFn(triggerRef string) func(runtime RuntimeV2, triggerEvent capabilities.TriggerEvent) error { + return w.runFnsPerTrigger[triggerRef] } func (w *WorkflowSpecFactory) GetFn(name string) func(sdk Runtime, request capabilities.CapabilityRequest) (capabilities.CapabilityResponse, error) { @@ -136,10 +153,11 @@ func NewWorkflowSpecFactory() *WorkflowSpecFactory { Consensus: make([]StepDefinition, 0), Targets: make([]StepDefinition, 0), }, - names: map[string]bool{}, - duplicateNames: map[string]bool{}, - errors: []error{}, - emptyNames: false, + names: map[string]bool{}, + duplicateNames: map[string]bool{}, + errors: []error{}, + emptyNames: false, + runFnsPerTrigger: map[string]func(runtime RuntimeV2, triggerEvent capabilities.TriggerEvent) error{}, } } diff --git a/pkg/workflows/sdk/runtime.go b/pkg/workflows/sdk/runtime.go index 9c431161e..7a7dae478 100644 --- a/pkg/workflows/sdk/runtime.go +++ b/pkg/workflows/sdk/runtime.go @@ -44,3 +44,13 @@ type FetchResponse struct { Headers map[string]any `json:"headers,omitempty"` // HTTP headers Body []byte `json:"body,omitempty"` // HTTP response body } + +type RuntimeV2 interface { + CallCapabilities(calls ...CapabilityCallPromise) error +} + +// weakly-typed, for the runtime to fulfill +type CapabilityCallPromise interface { + CallInfo() (ref string, capId string, request capabilities.CapabilityRequest) + Fulfill(response capabilities.CapabilityResponse, err error) +} diff --git a/pkg/workflows/wasm/host/test/nodag/main.go b/pkg/workflows/wasm/host/test/nodag/main.go new file mode 100644 index 000000000..777af0655 --- /dev/null +++ b/pkg/workflows/wasm/host/test/nodag/main.go @@ -0,0 +1,55 @@ +//go:build wasip1 + +package main + +import ( + "github.com/smartcontractkit/chainlink-common/pkg/capabilities/cli/cmd/testdata/fixtures/capabilities/basicaction" + "github.com/smartcontractkit/chainlink-common/pkg/capabilities/cli/cmd/testdata/fixtures/capabilities/basictarget" + "github.com/smartcontractkit/chainlink-common/pkg/capabilities/cli/cmd/testdata/fixtures/capabilities/basictrigger" + "github.com/smartcontractkit/chainlink-common/pkg/workflows/sdk" + "github.com/smartcontractkit/chainlink-common/pkg/workflows/wasm" +) + +func InitWorkflow(config []byte) *sdk.WorkflowSpecFactory { + workflow := sdk.NewWorkflowSpecFactory() + // add triggers + triggerCfg := basictrigger.TriggerConfig{Name: "trigger", Number: 100} + _ = triggerCfg.New(workflow) // TODO: let AddRunFunctionForTrigger() add this to workflow spec + sdk.AddRunFunctionForTrigger(workflow, "trigger", triggerCfg, RunWorkflow) + return workflow +} + +func RunWorkflow(runtime sdk.RuntimeV2, triggerOutputs basictrigger.TriggerOutputs) error { + // two action calls "futures" + actionCall1, _ := wasm.NewCapabilityCall[basicaction.ActionInputs, basicaction.ActionConfig, basicaction.ActionOutputs]( + "ref_action1", "basicaction@1.0.0", basicaction.ActionInputs{}, basicaction.ActionConfig{}, + ) + actionCall2, _ := wasm.NewCapabilityCall[basicaction.ActionInputs, basicaction.ActionConfig, basicaction.ActionOutputs]( + "ref_action2", "basicaction@1.0.0", basicaction.ActionInputs{}, basicaction.ActionConfig{}, + ) + + // blocking "await" on multiple calls at once + err := runtime.CallCapabilities(actionCall1, actionCall2) + if err != nil { + return err + } + + // some compute before calling a target + actionOutputs1, _ := actionCall1.Result() + actionOutputs2, _ := actionCall2.Result() + if len(actionOutputs1.AdaptedThing) <= len(actionOutputs2.AdaptedThing) { + // a single target call + inputStr := "abcd" + targetCall, _ := wasm.NewCapabilityCall[basictarget.TargetInputs, basictarget.TargetConfig, any]( + "ref_target1", "basictarget@1.0.0", basictarget.TargetInputs{CoolInput: &inputStr}, basictarget.TargetConfig{}, + ) + return runtime.CallCapabilities(targetCall) + } + return nil +} + +func main() { + runner := wasm.NewRunnerV2() + workflow := InitWorkflow(runner.Config()) + runner.Run(workflow) +} diff --git a/pkg/workflows/wasm/host/wasm_v2_test.go b/pkg/workflows/wasm/host/wasm_v2_test.go new file mode 100644 index 000000000..7732f9096 --- /dev/null +++ b/pkg/workflows/wasm/host/wasm_v2_test.go @@ -0,0 +1,123 @@ +package host + +import ( + _ "embed" + "testing" + + "github.com/google/uuid" + "github.com/stretchr/testify/require" + + "github.com/smartcontractkit/chainlink-common/pkg/capabilities" + "github.com/smartcontractkit/chainlink-common/pkg/capabilities/pb" + "github.com/smartcontractkit/chainlink-common/pkg/logger" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" + "github.com/smartcontractkit/chainlink-common/pkg/values" + wasmpb "github.com/smartcontractkit/chainlink-common/pkg/workflows/wasm/pb" +) + +const ( + nodagBinaryLocation = "test/nodag/testmodule.wasm" + nodagBinaryCmd = "test/nodag" +) + +func Test_V2_Run(t *testing.T) { + t.Parallel() + ctx := tests.Context(t) + mc := &ModuleConfig{ + Logger: logger.Test(t), + IsUncompressed: true, + } + capResponsesSoFar := map[string]*pb.CapabilityResponse{} + triggerRef := "trigger" + binary := createTestBinary(nodagBinaryCmd, nodagBinaryLocation, true, t) + + // (1) Engine calls GetWorkflowSpec() first. + spec, err := GetWorkflowSpec(ctx, mc, binary, []byte("")) + require.NoError(t, err) + + // (2) Engine expects only triggers to be included in the returned spec. Trigger subscriptions are performed. + // + // [trigger] + // | + // (promise) + require.Len(t, spec.Triggers, 1) + require.Equal(t, triggerRef, spec.Triggers[0].Ref) + require.Len(t, spec.Actions, 0) + require.Len(t, spec.Consensus, 0) + require.Len(t, spec.Targets, 0) + + m, err := NewModule(mc, binary) + require.NoError(t, err) + m.Start() + + // (3) When a TriggerEvent occurs, Engine calls Run() with that Event. + triggerEvent := &pb.TriggerEvent{ + TriggerType: "my_trigger@1.0.0", + Outputs: values.ProtoMap(values.EmptyMap()), + } + + req := newRunRequest(triggerRef, triggerEvent, capResponsesSoFar) + resp, err := m.Run(ctx, req) + require.NoError(t, err) + runResp := resp.GetRunResponse() + require.NotNil(t, runResp) + + // (4) In the first response, the Workflow requests two action capability calls. + // + // [trigger] + // | + // [compute1] + // / \ + // [action1] [action2] + // \ / + // (promise) + require.Len(t, runResp.RefToCapCall, 2) + require.Contains(t, runResp.RefToCapCall, "ref_action1") + require.Contains(t, runResp.RefToCapCall, "ref_action2") + + // (5) Engine now makes capability calls and when they are ready, it invokes Run() again with both responses. + capResponsesSoFar["ref_action1"] = pb.CapabilityResponseToProto(capabilities.CapabilityResponse{Value: &values.Map{}}) + capResponsesSoFar["ref_action2"] = pb.CapabilityResponseToProto(capabilities.CapabilityResponse{Value: &values.Map{}}) + req = newRunRequest(triggerRef, triggerEvent, capResponsesSoFar) + resp, err = m.Run(ctx, req) + require.NoError(t, err) + runResp = resp.GetRunResponse() + require.NotNil(t, runResp) + + // (6) Workflow now requests a target capability call. + // + // [trigger] + // | + // [compute1] + // / \ + // [action1] [action2] + // \ / + // [compute2] + // | + // [target1] + // | + // (promise) + require.Len(t, runResp.RefToCapCall, 1) + require.Contains(t, runResp.RefToCapCall, "ref_target1") + + // (7) After calling the target, Engine makes one last Run() call and expects the workflow to complete without errors. + capResponsesSoFar["ref_target1"] = pb.CapabilityResponseToProto(capabilities.CapabilityResponse{Value: &values.Map{}}) + req = newRunRequest(triggerRef, triggerEvent, capResponsesSoFar) + resp, err = m.Run(ctx, req) + require.NoError(t, err) + runResp = resp.GetRunResponse() + require.Nil(t, runResp) +} + +func newRunRequest(triggerRef string, triggerEvent *pb.TriggerEvent, capResponsesSoFar map[string]*pb.CapabilityResponse) *wasmpb.Request { + return &wasmpb.Request{ + Id: uuid.New().String(), + Message: &wasmpb.Request_RunRequest{ + RunRequest: &wasmpb.RunRequest{ + TriggerRef: triggerRef, + TriggerEvent: triggerEvent, + RefToResponse: capResponsesSoFar, + }, + }, + } +} diff --git a/pkg/workflows/wasm/pb/wasm.pb.go b/pkg/workflows/wasm/pb/wasm.pb.go index d8d21aefb..0b327562f 100644 --- a/pkg/workflows/wasm/pb/wasm.pb.go +++ b/pkg/workflows/wasm/pb/wasm.pb.go @@ -125,6 +125,69 @@ func (x *ComputeRequest) GetRuntimeConfig() *RuntimeConfig { return nil } +type RunRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TriggerRef string `protobuf:"bytes,1,opt,name=triggerRef,proto3" json:"triggerRef,omitempty"` + TriggerEvent *pb.TriggerEvent `protobuf:"bytes,2,opt,name=triggerEvent,proto3" json:"triggerEvent,omitempty"` + RefToResponse map[string]*pb.CapabilityResponse `protobuf:"bytes,3,rep,name=refToResponse,proto3" json:"refToResponse,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *RunRequest) Reset() { + *x = RunRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RunRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunRequest) ProtoMessage() {} + +func (x *RunRequest) ProtoReflect() protoreflect.Message { + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunRequest.ProtoReflect.Descriptor instead. +func (*RunRequest) Descriptor() ([]byte, []int) { + return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{2} +} + +func (x *RunRequest) GetTriggerRef() string { + if x != nil { + return x.TriggerRef + } + return "" +} + +func (x *RunRequest) GetTriggerEvent() *pb.TriggerEvent { + if x != nil { + return x.TriggerEvent + } + return nil +} + +func (x *RunRequest) GetRefToResponse() map[string]*pb.CapabilityResponse { + if x != nil { + return x.RefToResponse + } + return nil +} + type Request struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -136,13 +199,14 @@ type Request struct { // // *Request_ComputeRequest // *Request_SpecRequest + // *Request_RunRequest Message isRequest_Message `protobuf_oneof:"message"` } func (x *Request) Reset() { *x = Request{} if protoimpl.UnsafeEnabled { - mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[2] + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -155,7 +219,7 @@ func (x *Request) String() string { func (*Request) ProtoMessage() {} func (x *Request) ProtoReflect() protoreflect.Message { - mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[2] + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -168,7 +232,7 @@ func (x *Request) ProtoReflect() protoreflect.Message { // Deprecated: Use Request.ProtoReflect.Descriptor instead. func (*Request) Descriptor() ([]byte, []int) { - return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{2} + return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{3} } func (x *Request) GetId() string { @@ -206,6 +270,13 @@ func (x *Request) GetSpecRequest() *emptypb.Empty { return nil } +func (x *Request) GetRunRequest() *RunRequest { + if x, ok := x.GetMessage().(*Request_RunRequest); ok { + return x.RunRequest + } + return nil +} + type isRequest_Message interface { isRequest_Message() } @@ -218,10 +289,16 @@ type Request_SpecRequest struct { SpecRequest *emptypb.Empty `protobuf:"bytes,4,opt,name=specRequest,proto3,oneof"` } +type Request_RunRequest struct { + RunRequest *RunRequest `protobuf:"bytes,5,opt,name=runRequest,proto3,oneof"` +} + func (*Request_ComputeRequest) isRequest_Message() {} func (*Request_SpecRequest) isRequest_Message() {} +func (*Request_RunRequest) isRequest_Message() {} + type ComputeResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -233,7 +310,7 @@ type ComputeResponse struct { func (x *ComputeResponse) Reset() { *x = ComputeResponse{} if protoimpl.UnsafeEnabled { - mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[3] + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -246,7 +323,7 @@ func (x *ComputeResponse) String() string { func (*ComputeResponse) ProtoMessage() {} func (x *ComputeResponse) ProtoReflect() protoreflect.Message { - mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[3] + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -259,7 +336,7 @@ func (x *ComputeResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ComputeResponse.ProtoReflect.Descriptor instead. func (*ComputeResponse) Descriptor() ([]byte, []int) { - return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{3} + return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{4} } func (x *ComputeResponse) GetResponse() *pb.CapabilityResponse { @@ -281,7 +358,7 @@ type StepInputs struct { func (x *StepInputs) Reset() { *x = StepInputs{} if protoimpl.UnsafeEnabled { - mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[4] + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -294,7 +371,7 @@ func (x *StepInputs) String() string { func (*StepInputs) ProtoMessage() {} func (x *StepInputs) ProtoReflect() protoreflect.Message { - mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[4] + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -307,7 +384,7 @@ func (x *StepInputs) ProtoReflect() protoreflect.Message { // Deprecated: Use StepInputs.ProtoReflect.Descriptor instead. func (*StepInputs) Descriptor() ([]byte, []int) { - return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{4} + return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{5} } func (x *StepInputs) GetOutputRef() string { @@ -339,7 +416,7 @@ type StepDefinition struct { func (x *StepDefinition) Reset() { *x = StepDefinition{} if protoimpl.UnsafeEnabled { - mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[5] + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -352,7 +429,7 @@ func (x *StepDefinition) String() string { func (*StepDefinition) ProtoMessage() {} func (x *StepDefinition) ProtoReflect() protoreflect.Message { - mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[5] + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -365,7 +442,7 @@ func (x *StepDefinition) ProtoReflect() protoreflect.Message { // Deprecated: Use StepDefinition.ProtoReflect.Descriptor instead. func (*StepDefinition) Descriptor() ([]byte, []int) { - return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{5} + return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{6} } func (x *StepDefinition) GetId() string { @@ -414,12 +491,13 @@ type WorkflowSpec struct { Actions []*StepDefinition `protobuf:"bytes,4,rep,name=actions,proto3" json:"actions,omitempty"` Consensus []*StepDefinition `protobuf:"bytes,5,rep,name=consensus,proto3" json:"consensus,omitempty"` Targets []*StepDefinition `protobuf:"bytes,6,rep,name=targets,proto3" json:"targets,omitempty"` + IsDynamic bool `protobuf:"varint,7,opt,name=isDynamic,proto3" json:"isDynamic,omitempty"` // aka "no-DAG" } func (x *WorkflowSpec) Reset() { *x = WorkflowSpec{} if protoimpl.UnsafeEnabled { - mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[6] + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -432,7 +510,7 @@ func (x *WorkflowSpec) String() string { func (*WorkflowSpec) ProtoMessage() {} func (x *WorkflowSpec) ProtoReflect() protoreflect.Message { - mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[6] + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -445,7 +523,7 @@ func (x *WorkflowSpec) ProtoReflect() protoreflect.Message { // Deprecated: Use WorkflowSpec.ProtoReflect.Descriptor instead. func (*WorkflowSpec) Descriptor() ([]byte, []int) { - return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{6} + return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{7} } func (x *WorkflowSpec) GetName() string { @@ -490,6 +568,13 @@ func (x *WorkflowSpec) GetTargets() []*StepDefinition { return nil } +func (x *WorkflowSpec) GetIsDynamic() bool { + if x != nil { + return x.IsDynamic + } + return false +} + type Response struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -501,13 +586,14 @@ type Response struct { // // *Response_ComputeResponse // *Response_SpecResponse + // *Response_RunResponse Message isResponse_Message `protobuf_oneof:"message"` } func (x *Response) Reset() { *x = Response{} if protoimpl.UnsafeEnabled { - mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[7] + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -520,7 +606,7 @@ func (x *Response) String() string { func (*Response) ProtoMessage() {} func (x *Response) ProtoReflect() protoreflect.Message { - mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[7] + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -533,7 +619,7 @@ func (x *Response) ProtoReflect() protoreflect.Message { // Deprecated: Use Response.ProtoReflect.Descriptor instead. func (*Response) Descriptor() ([]byte, []int) { - return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{7} + return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{8} } func (x *Response) GetId() string { @@ -571,6 +657,13 @@ func (x *Response) GetSpecResponse() *WorkflowSpec { return nil } +func (x *Response) GetRunResponse() *RunResponse { + if x, ok := x.GetMessage().(*Response_RunResponse); ok { + return x.RunResponse + } + return nil +} + type isResponse_Message interface { isResponse_Message() } @@ -583,10 +676,118 @@ type Response_SpecResponse struct { SpecResponse *WorkflowSpec `protobuf:"bytes,4,opt,name=specResponse,proto3,oneof"` } +type Response_RunResponse struct { + RunResponse *RunResponse `protobuf:"bytes,5,opt,name=runResponse,proto3,oneof"` +} + func (*Response_ComputeResponse) isResponse_Message() {} func (*Response_SpecResponse) isResponse_Message() {} +func (*Response_RunResponse) isResponse_Message() {} + +type RunResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RefToCapCall map[string]*CapabilityCall `protobuf:"bytes,1,rep,name=refToCapCall,proto3" json:"refToCapCall,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *RunResponse) Reset() { + *x = RunResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RunResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunResponse) ProtoMessage() {} + +func (x *RunResponse) ProtoReflect() protoreflect.Message { + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunResponse.ProtoReflect.Descriptor instead. +func (*RunResponse) Descriptor() ([]byte, []int) { + return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{9} +} + +func (x *RunResponse) GetRefToCapCall() map[string]*CapabilityCall { + if x != nil { + return x.RefToCapCall + } + return nil +} + +type CapabilityCall struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CapabilityId string `protobuf:"bytes,1,opt,name=capabilityId,proto3" json:"capabilityId,omitempty"` + Request *pb.CapabilityRequest `protobuf:"bytes,2,opt,name=request,proto3" json:"request,omitempty"` +} + +func (x *CapabilityCall) Reset() { + *x = CapabilityCall{} + if protoimpl.UnsafeEnabled { + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CapabilityCall) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CapabilityCall) ProtoMessage() {} + +func (x *CapabilityCall) ProtoReflect() protoreflect.Message { + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CapabilityCall.ProtoReflect.Descriptor instead. +func (*CapabilityCall) Descriptor() ([]byte, []int) { + return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{10} +} + +func (x *CapabilityCall) GetCapabilityId() string { + if x != nil { + return x.CapabilityId + } + return "" +} + +func (x *CapabilityCall) GetRequest() *pb.CapabilityRequest { + if x != nil { + return x.Request + } + return nil +} + // NOTE: This message was added because it is needed to be used as part of the request and for metrics. type FetchRequestMetadata struct { state protoimpl.MessageState @@ -603,7 +804,7 @@ type FetchRequestMetadata struct { func (x *FetchRequestMetadata) Reset() { *x = FetchRequestMetadata{} if protoimpl.UnsafeEnabled { - mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[8] + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -616,7 +817,7 @@ func (x *FetchRequestMetadata) String() string { func (*FetchRequestMetadata) ProtoMessage() {} func (x *FetchRequestMetadata) ProtoReflect() protoreflect.Message { - mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[8] + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -629,7 +830,7 @@ func (x *FetchRequestMetadata) ProtoReflect() protoreflect.Message { // Deprecated: Use FetchRequestMetadata.ProtoReflect.Descriptor instead. func (*FetchRequestMetadata) Descriptor() ([]byte, []int) { - return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{8} + return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{11} } func (x *FetchRequestMetadata) GetWorkflowId() string { @@ -684,7 +885,7 @@ type FetchRequest struct { func (x *FetchRequest) Reset() { *x = FetchRequest{} if protoimpl.UnsafeEnabled { - mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[9] + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -697,7 +898,7 @@ func (x *FetchRequest) String() string { func (*FetchRequest) ProtoMessage() {} func (x *FetchRequest) ProtoReflect() protoreflect.Message { - mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[9] + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -710,7 +911,7 @@ func (x *FetchRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use FetchRequest.ProtoReflect.Descriptor instead. func (*FetchRequest) Descriptor() ([]byte, []int) { - return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{9} + return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{12} } func (x *FetchRequest) GetUrl() string { @@ -778,7 +979,7 @@ type FetchResponse struct { func (x *FetchResponse) Reset() { *x = FetchResponse{} if protoimpl.UnsafeEnabled { - mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[10] + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -791,7 +992,7 @@ func (x *FetchResponse) String() string { func (*FetchResponse) ProtoMessage() {} func (x *FetchResponse) ProtoReflect() protoreflect.Message { - mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[10] + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -804,7 +1005,7 @@ func (x *FetchResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use FetchResponse.ProtoReflect.Descriptor instead. func (*FetchResponse) Descriptor() ([]byte, []int) { - return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{10} + return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{13} } func (x *FetchResponse) GetExecutionError() bool { @@ -855,7 +1056,7 @@ type EmitMessageRequest struct { func (x *EmitMessageRequest) Reset() { *x = EmitMessageRequest{} if protoimpl.UnsafeEnabled { - mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[11] + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -868,7 +1069,7 @@ func (x *EmitMessageRequest) String() string { func (*EmitMessageRequest) ProtoMessage() {} func (x *EmitMessageRequest) ProtoReflect() protoreflect.Message { - mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[11] + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -881,7 +1082,7 @@ func (x *EmitMessageRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use EmitMessageRequest.ProtoReflect.Descriptor instead. func (*EmitMessageRequest) Descriptor() ([]byte, []int) { - return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{11} + return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{14} } func (x *EmitMessageRequest) GetMessage() string { @@ -916,7 +1117,7 @@ type Error struct { func (x *Error) Reset() { *x = Error{} if protoimpl.UnsafeEnabled { - mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[12] + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -929,7 +1130,7 @@ func (x *Error) String() string { func (*Error) ProtoMessage() {} func (x *Error) ProtoReflect() protoreflect.Message { - mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[12] + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -942,7 +1143,7 @@ func (x *Error) ProtoReflect() protoreflect.Message { // Deprecated: Use Error.ProtoReflect.Descriptor instead. func (*Error) Descriptor() ([]byte, []int) { - return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{12} + return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{15} } func (x *Error) GetMessage() string { @@ -963,7 +1164,7 @@ type EmitMessageResponse struct { func (x *EmitMessageResponse) Reset() { *x = EmitMessageResponse{} if protoimpl.UnsafeEnabled { - mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[13] + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -976,7 +1177,7 @@ func (x *EmitMessageResponse) String() string { func (*EmitMessageResponse) ProtoMessage() {} func (x *EmitMessageResponse) ProtoReflect() protoreflect.Message { - mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[13] + mi := &file_workflows_wasm_pb_wasm_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -989,7 +1190,7 @@ func (x *EmitMessageResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use EmitMessageResponse.ProtoReflect.Descriptor instead. func (*EmitMessageResponse) Descriptor() ([]byte, []int) { - return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{13} + return file_workflows_wasm_pb_wasm_proto_rawDescGZIP(), []int{16} } func (x *EmitMessageResponse) GetError() *Error { @@ -1023,17 +1224,38 @@ var file_workflows_wasm_pb_wasm_proto_rawDesc = []byte{ 0x74, 0x69, 0x6d, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0d, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x22, 0xb7, 0x01, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, - 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x3d, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x70, 0x75, - 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x13, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3a, 0x0a, 0x0b, 0x73, 0x70, 0x65, 0x63, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x70, 0x65, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x66, 0x69, 0x67, 0x22, 0x9a, 0x02, 0x0a, 0x0a, 0x52, 0x75, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x66, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, + 0x65, 0x66, 0x12, 0x3e, 0x0a, 0x0c, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x63, 0x61, 0x70, 0x61, 0x62, + 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x2e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x52, 0x0c, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x0d, 0x72, 0x65, 0x66, 0x54, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x73, 0x64, 0x6b, 0x2e, + 0x52, 0x75, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x66, 0x54, 0x6f, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0d, 0x72, + 0x65, 0x66, 0x54, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x62, 0x0a, 0x12, + 0x52, 0x65, 0x66, 0x54, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x36, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, + 0x65, 0x73, 0x2e, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, + 0x22, 0xea, 0x01, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x12, 0x3d, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73, + 0x64, 0x6b, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x48, 0x00, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x3a, 0x0a, 0x0b, 0x73, 0x70, 0x65, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, + 0x48, 0x00, 0x52, 0x0b, 0x73, 0x70, 0x65, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x31, 0x0a, 0x0a, 0x72, 0x75, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x52, 0x75, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x0a, 0x72, 0x75, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x4f, 0x0a, 0x0f, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, @@ -1055,7 +1277,7 @@ var file_workflows_wasm_pb_wasm_proto_rawDesc = []byte{ 0x0b, 0x2e, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2e, 0x4d, 0x61, 0x70, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x26, 0x0a, 0x0e, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x61, - 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x22, 0xfa, 0x01, 0x0a, + 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x22, 0x98, 0x02, 0x0a, 0x0c, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x53, 0x70, 0x65, 0x63, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, @@ -1071,76 +1293,99 @@ var file_workflows_wasm_pb_wasm_proto_rawDesc = []byte{ 0x09, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x12, 0x2d, 0x0a, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x53, 0x74, 0x65, 0x70, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x22, 0xb8, 0x01, 0x0a, 0x08, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x72, 0x72, 0x4d, 0x73, 0x67, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x65, 0x72, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x40, - 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x43, 0x6f, - 0x6d, 0x70, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, - 0x0f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x37, 0x0a, 0x0c, 0x73, 0x70, 0x65, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x57, 0x6f, 0x72, - 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x53, 0x70, 0x65, 0x63, 0x48, 0x00, 0x52, 0x0c, 0x73, 0x70, 0x65, - 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x22, 0xe4, 0x01, 0x0a, 0x14, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1e, 0x0a, - 0x0a, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0a, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x49, 0x64, 0x12, 0x22, 0x0a, - 0x0c, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0c, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x4e, 0x61, 0x6d, - 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x4f, 0x77, 0x6e, - 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, - 0x6f, 0x77, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x30, 0x0a, 0x13, 0x77, 0x6f, 0x72, 0x6b, 0x66, - 0x6c, 0x6f, 0x77, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x45, 0x78, - 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x30, 0x0a, 0x13, 0x64, 0x65, 0x63, - 0x6f, 0x64, 0x65, 0x64, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x4e, 0x61, 0x6d, 0x65, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x64, 0x65, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x57, - 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xd8, 0x01, 0x0a, 0x0c, - 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, - 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x16, - 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x25, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x2e, 0x4d, 0x61, 0x70, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x12, 0x0a, - 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x62, 0x6f, 0x64, - 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x4d, 0x73, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x4d, 0x73, 0x12, - 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, - 0x35, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x07, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0xb6, 0x01, 0x0a, 0x0d, 0x46, 0x65, 0x74, 0x63, 0x68, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x65, 0x78, 0x65, 0x63, - 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x0e, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, - 0x12, 0x22, 0x0a, 0x0c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, - 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x43, 0x6f, 0x64, 0x65, 0x12, 0x25, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2e, 0x4d, - 0x61, 0x70, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x62, - 0x6f, 0x64, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x22, - 0x71, 0x0a, 0x12, 0x45, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, - 0x23, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0b, 0x2e, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2e, 0x4d, 0x61, 0x70, 0x52, 0x06, 0x6c, 0x61, - 0x62, 0x65, 0x6c, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, - 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x49, 0x64, 0x22, 0x21, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x37, 0x0a, 0x13, 0x45, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x05, - 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x73, 0x64, - 0x6b, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x42, 0x43, - 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x6d, 0x61, - 0x72, 0x74, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x6b, 0x69, 0x74, 0x2f, 0x63, 0x68, - 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, - 0x6b, 0x67, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x2f, 0x73, 0x64, 0x6b, - 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x73, 0x44, + 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, + 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x22, 0xee, 0x01, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x72, 0x72, 0x4d, 0x73, 0x67, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x65, 0x72, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x40, 0x0a, 0x0f, + 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x43, 0x6f, 0x6d, 0x70, + 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x0f, 0x63, + 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, + 0x0a, 0x0c, 0x73, 0x70, 0x65, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, + 0x6c, 0x6f, 0x77, 0x53, 0x70, 0x65, 0x63, 0x48, 0x00, 0x52, 0x0c, 0x73, 0x70, 0x65, 0x63, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x0b, 0x72, 0x75, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x73, + 0x64, 0x6b, 0x2e, 0x52, 0x75, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, + 0x52, 0x0b, 0x72, 0x75, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x09, 0x0a, + 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xab, 0x01, 0x0a, 0x0b, 0x52, 0x75, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x0c, 0x72, 0x65, 0x66, 0x54, + 0x6f, 0x43, 0x61, 0x70, 0x43, 0x61, 0x6c, 0x6c, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, + 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x52, 0x75, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x2e, 0x52, 0x65, 0x66, 0x54, 0x6f, 0x43, 0x61, 0x70, 0x43, 0x61, 0x6c, 0x6c, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x52, 0x0c, 0x72, 0x65, 0x66, 0x54, 0x6f, 0x43, 0x61, 0x70, 0x43, 0x61, 0x6c, 0x6c, + 0x1a, 0x54, 0x0a, 0x11, 0x52, 0x65, 0x66, 0x54, 0x6f, 0x43, 0x61, 0x70, 0x43, 0x61, 0x6c, 0x6c, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x29, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x43, 0x61, 0x70, + 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x6f, 0x0a, 0x0e, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, + 0x6c, 0x69, 0x74, 0x79, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x70, 0x61, + 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, + 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x49, 0x64, 0x12, 0x39, 0x0a, 0x07, + 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, + 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x2e, 0x43, 0x61, 0x70, + 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x07, + 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xe4, 0x01, 0x0a, 0x14, 0x46, 0x65, 0x74, 0x63, + 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x12, 0x1e, 0x0a, 0x0a, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x49, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x49, 0x64, + 0x12, 0x22, 0x0a, 0x0c, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x4e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, + 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x77, 0x6f, 0x72, + 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x30, 0x0a, 0x13, 0x77, 0x6f, + 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x49, + 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, + 0x77, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x30, 0x0a, 0x13, + 0x64, 0x65, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x4e, + 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x64, 0x65, 0x63, 0x6f, 0x64, + 0x65, 0x64, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xd8, + 0x01, 0x0a, 0x0c, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, + 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x25, 0x0a, 0x07, 0x68, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x2e, 0x4d, 0x61, 0x70, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, + 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, + 0x62, 0x6f, 0x64, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x4d, + 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, + 0x4d, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, + 0x69, 0x64, 0x12, 0x35, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x46, 0x65, 0x74, 0x63, 0x68, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, + 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0xb6, 0x01, 0x0a, 0x0d, 0x46, 0x65, + 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x65, + 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x0e, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x72, + 0x72, 0x6f, 0x72, 0x12, 0x22, 0x0a, 0x0c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x25, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x2e, 0x4d, 0x61, 0x70, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x12, + 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x22, 0x71, 0x0a, 0x12, 0x45, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x12, 0x23, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2e, 0x4d, 0x61, 0x70, 0x52, + 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x49, 0x64, 0x22, 0x21, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x18, + 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x37, 0x0a, 0x13, 0x45, 0x6d, 0x69, 0x74, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x20, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, + 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, + 0x72, 0x42, 0x43, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x73, 0x6d, 0x61, 0x72, 0x74, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x6b, 0x69, 0x74, + 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x2f, + 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1155,52 +1400,66 @@ func file_workflows_wasm_pb_wasm_proto_rawDescGZIP() []byte { return file_workflows_wasm_pb_wasm_proto_rawDescData } -var file_workflows_wasm_pb_wasm_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_workflows_wasm_pb_wasm_proto_msgTypes = make([]protoimpl.MessageInfo, 19) var file_workflows_wasm_pb_wasm_proto_goTypes = []interface{}{ (*RuntimeConfig)(nil), // 0: sdk.RuntimeConfig (*ComputeRequest)(nil), // 1: sdk.ComputeRequest - (*Request)(nil), // 2: sdk.Request - (*ComputeResponse)(nil), // 3: sdk.ComputeResponse - (*StepInputs)(nil), // 4: sdk.StepInputs - (*StepDefinition)(nil), // 5: sdk.StepDefinition - (*WorkflowSpec)(nil), // 6: sdk.WorkflowSpec - (*Response)(nil), // 7: sdk.Response - (*FetchRequestMetadata)(nil), // 8: sdk.FetchRequestMetadata - (*FetchRequest)(nil), // 9: sdk.FetchRequest - (*FetchResponse)(nil), // 10: sdk.FetchResponse - (*EmitMessageRequest)(nil), // 11: sdk.EmitMessageRequest - (*Error)(nil), // 12: sdk.Error - (*EmitMessageResponse)(nil), // 13: sdk.EmitMessageResponse - (*pb.CapabilityRequest)(nil), // 14: capabilities.CapabilityRequest - (*emptypb.Empty)(nil), // 15: google.protobuf.Empty - (*pb.CapabilityResponse)(nil), // 16: capabilities.CapabilityResponse - (*pb1.Map)(nil), // 17: values.Map + (*RunRequest)(nil), // 2: sdk.RunRequest + (*Request)(nil), // 3: sdk.Request + (*ComputeResponse)(nil), // 4: sdk.ComputeResponse + (*StepInputs)(nil), // 5: sdk.StepInputs + (*StepDefinition)(nil), // 6: sdk.StepDefinition + (*WorkflowSpec)(nil), // 7: sdk.WorkflowSpec + (*Response)(nil), // 8: sdk.Response + (*RunResponse)(nil), // 9: sdk.RunResponse + (*CapabilityCall)(nil), // 10: sdk.CapabilityCall + (*FetchRequestMetadata)(nil), // 11: sdk.FetchRequestMetadata + (*FetchRequest)(nil), // 12: sdk.FetchRequest + (*FetchResponse)(nil), // 13: sdk.FetchResponse + (*EmitMessageRequest)(nil), // 14: sdk.EmitMessageRequest + (*Error)(nil), // 15: sdk.Error + (*EmitMessageResponse)(nil), // 16: sdk.EmitMessageResponse + nil, // 17: sdk.RunRequest.RefToResponseEntry + nil, // 18: sdk.RunResponse.RefToCapCallEntry + (*pb.CapabilityRequest)(nil), // 19: capabilities.CapabilityRequest + (*pb.TriggerEvent)(nil), // 20: capabilities.TriggerEvent + (*emptypb.Empty)(nil), // 21: google.protobuf.Empty + (*pb.CapabilityResponse)(nil), // 22: capabilities.CapabilityResponse + (*pb1.Map)(nil), // 23: values.Map } var file_workflows_wasm_pb_wasm_proto_depIdxs = []int32{ - 14, // 0: sdk.ComputeRequest.request:type_name -> capabilities.CapabilityRequest + 19, // 0: sdk.ComputeRequest.request:type_name -> capabilities.CapabilityRequest 0, // 1: sdk.ComputeRequest.runtimeConfig:type_name -> sdk.RuntimeConfig - 1, // 2: sdk.Request.computeRequest:type_name -> sdk.ComputeRequest - 15, // 3: sdk.Request.specRequest:type_name -> google.protobuf.Empty - 16, // 4: sdk.ComputeResponse.response:type_name -> capabilities.CapabilityResponse - 17, // 5: sdk.StepInputs.mapping:type_name -> values.Map - 4, // 6: sdk.StepDefinition.inputs:type_name -> sdk.StepInputs - 17, // 7: sdk.StepDefinition.config:type_name -> values.Map - 5, // 8: sdk.WorkflowSpec.triggers:type_name -> sdk.StepDefinition - 5, // 9: sdk.WorkflowSpec.actions:type_name -> sdk.StepDefinition - 5, // 10: sdk.WorkflowSpec.consensus:type_name -> sdk.StepDefinition - 5, // 11: sdk.WorkflowSpec.targets:type_name -> sdk.StepDefinition - 3, // 12: sdk.Response.computeResponse:type_name -> sdk.ComputeResponse - 6, // 13: sdk.Response.specResponse:type_name -> sdk.WorkflowSpec - 17, // 14: sdk.FetchRequest.headers:type_name -> values.Map - 8, // 15: sdk.FetchRequest.metadata:type_name -> sdk.FetchRequestMetadata - 17, // 16: sdk.FetchResponse.headers:type_name -> values.Map - 17, // 17: sdk.EmitMessageRequest.labels:type_name -> values.Map - 12, // 18: sdk.EmitMessageResponse.error:type_name -> sdk.Error - 19, // [19:19] is the sub-list for method output_type - 19, // [19:19] is the sub-list for method input_type - 19, // [19:19] is the sub-list for extension type_name - 19, // [19:19] is the sub-list for extension extendee - 0, // [0:19] is the sub-list for field type_name + 20, // 2: sdk.RunRequest.triggerEvent:type_name -> capabilities.TriggerEvent + 17, // 3: sdk.RunRequest.refToResponse:type_name -> sdk.RunRequest.RefToResponseEntry + 1, // 4: sdk.Request.computeRequest:type_name -> sdk.ComputeRequest + 21, // 5: sdk.Request.specRequest:type_name -> google.protobuf.Empty + 2, // 6: sdk.Request.runRequest:type_name -> sdk.RunRequest + 22, // 7: sdk.ComputeResponse.response:type_name -> capabilities.CapabilityResponse + 23, // 8: sdk.StepInputs.mapping:type_name -> values.Map + 5, // 9: sdk.StepDefinition.inputs:type_name -> sdk.StepInputs + 23, // 10: sdk.StepDefinition.config:type_name -> values.Map + 6, // 11: sdk.WorkflowSpec.triggers:type_name -> sdk.StepDefinition + 6, // 12: sdk.WorkflowSpec.actions:type_name -> sdk.StepDefinition + 6, // 13: sdk.WorkflowSpec.consensus:type_name -> sdk.StepDefinition + 6, // 14: sdk.WorkflowSpec.targets:type_name -> sdk.StepDefinition + 4, // 15: sdk.Response.computeResponse:type_name -> sdk.ComputeResponse + 7, // 16: sdk.Response.specResponse:type_name -> sdk.WorkflowSpec + 9, // 17: sdk.Response.runResponse:type_name -> sdk.RunResponse + 18, // 18: sdk.RunResponse.refToCapCall:type_name -> sdk.RunResponse.RefToCapCallEntry + 19, // 19: sdk.CapabilityCall.request:type_name -> capabilities.CapabilityRequest + 23, // 20: sdk.FetchRequest.headers:type_name -> values.Map + 11, // 21: sdk.FetchRequest.metadata:type_name -> sdk.FetchRequestMetadata + 23, // 22: sdk.FetchResponse.headers:type_name -> values.Map + 23, // 23: sdk.EmitMessageRequest.labels:type_name -> values.Map + 15, // 24: sdk.EmitMessageResponse.error:type_name -> sdk.Error + 22, // 25: sdk.RunRequest.RefToResponseEntry.value:type_name -> capabilities.CapabilityResponse + 10, // 26: sdk.RunResponse.RefToCapCallEntry.value:type_name -> sdk.CapabilityCall + 27, // [27:27] is the sub-list for method output_type + 27, // [27:27] is the sub-list for method input_type + 27, // [27:27] is the sub-list for extension type_name + 27, // [27:27] is the sub-list for extension extendee + 0, // [0:27] is the sub-list for field type_name } func init() { file_workflows_wasm_pb_wasm_proto_init() } @@ -1234,7 +1493,7 @@ func file_workflows_wasm_pb_wasm_proto_init() { } } file_workflows_wasm_pb_wasm_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Request); i { + switch v := v.(*RunRequest); i { case 0: return &v.state case 1: @@ -1246,7 +1505,7 @@ func file_workflows_wasm_pb_wasm_proto_init() { } } file_workflows_wasm_pb_wasm_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ComputeResponse); i { + switch v := v.(*Request); i { case 0: return &v.state case 1: @@ -1258,7 +1517,7 @@ func file_workflows_wasm_pb_wasm_proto_init() { } } file_workflows_wasm_pb_wasm_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StepInputs); i { + switch v := v.(*ComputeResponse); i { case 0: return &v.state case 1: @@ -1270,7 +1529,7 @@ func file_workflows_wasm_pb_wasm_proto_init() { } } file_workflows_wasm_pb_wasm_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StepDefinition); i { + switch v := v.(*StepInputs); i { case 0: return &v.state case 1: @@ -1282,7 +1541,7 @@ func file_workflows_wasm_pb_wasm_proto_init() { } } file_workflows_wasm_pb_wasm_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WorkflowSpec); i { + switch v := v.(*StepDefinition); i { case 0: return &v.state case 1: @@ -1294,7 +1553,7 @@ func file_workflows_wasm_pb_wasm_proto_init() { } } file_workflows_wasm_pb_wasm_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Response); i { + switch v := v.(*WorkflowSpec); i { case 0: return &v.state case 1: @@ -1306,7 +1565,7 @@ func file_workflows_wasm_pb_wasm_proto_init() { } } file_workflows_wasm_pb_wasm_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FetchRequestMetadata); i { + switch v := v.(*Response); i { case 0: return &v.state case 1: @@ -1318,7 +1577,7 @@ func file_workflows_wasm_pb_wasm_proto_init() { } } file_workflows_wasm_pb_wasm_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FetchRequest); i { + switch v := v.(*RunResponse); i { case 0: return &v.state case 1: @@ -1330,7 +1589,7 @@ func file_workflows_wasm_pb_wasm_proto_init() { } } file_workflows_wasm_pb_wasm_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FetchResponse); i { + switch v := v.(*CapabilityCall); i { case 0: return &v.state case 1: @@ -1342,7 +1601,7 @@ func file_workflows_wasm_pb_wasm_proto_init() { } } file_workflows_wasm_pb_wasm_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EmitMessageRequest); i { + switch v := v.(*FetchRequestMetadata); i { case 0: return &v.state case 1: @@ -1354,7 +1613,7 @@ func file_workflows_wasm_pb_wasm_proto_init() { } } file_workflows_wasm_pb_wasm_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Error); i { + switch v := v.(*FetchRequest); i { case 0: return &v.state case 1: @@ -1366,6 +1625,42 @@ func file_workflows_wasm_pb_wasm_proto_init() { } } file_workflows_wasm_pb_wasm_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FetchResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_workflows_wasm_pb_wasm_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EmitMessageRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_workflows_wasm_pb_wasm_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Error); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_workflows_wasm_pb_wasm_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EmitMessageResponse); i { case 0: return &v.state @@ -1378,13 +1673,15 @@ func file_workflows_wasm_pb_wasm_proto_init() { } } } - file_workflows_wasm_pb_wasm_proto_msgTypes[2].OneofWrappers = []interface{}{ + file_workflows_wasm_pb_wasm_proto_msgTypes[3].OneofWrappers = []interface{}{ (*Request_ComputeRequest)(nil), (*Request_SpecRequest)(nil), + (*Request_RunRequest)(nil), } - file_workflows_wasm_pb_wasm_proto_msgTypes[7].OneofWrappers = []interface{}{ + file_workflows_wasm_pb_wasm_proto_msgTypes[8].OneofWrappers = []interface{}{ (*Response_ComputeResponse)(nil), (*Response_SpecResponse)(nil), + (*Response_RunResponse)(nil), } type x struct{} out := protoimpl.TypeBuilder{ @@ -1392,7 +1689,7 @@ func file_workflows_wasm_pb_wasm_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_workflows_wasm_pb_wasm_proto_rawDesc, NumEnums: 0, - NumMessages: 14, + NumMessages: 19, NumExtensions: 0, NumServices: 0, }, diff --git a/pkg/workflows/wasm/pb/wasm.proto b/pkg/workflows/wasm/pb/wasm.proto index e347602b8..81dfb5f13 100644 --- a/pkg/workflows/wasm/pb/wasm.proto +++ b/pkg/workflows/wasm/pb/wasm.proto @@ -15,6 +15,12 @@ message ComputeRequest { RuntimeConfig runtimeConfig = 2; } +message RunRequest { + string triggerRef = 1; + capabilities.TriggerEvent triggerEvent = 2; + map refToResponse = 3; +} + message Request { string id = 1; bytes config = 2; @@ -22,6 +28,7 @@ message Request { oneof message { ComputeRequest computeRequest = 3; google.protobuf.Empty specRequest = 4; + RunRequest runRequest = 5; } } @@ -47,6 +54,7 @@ message WorkflowSpec { repeated StepDefinition actions = 4; repeated StepDefinition consensus = 5; repeated StepDefinition targets = 6; + bool isDynamic = 7; // aka "no-DAG" } message Response { @@ -56,9 +64,19 @@ message Response { oneof message { ComputeResponse computeResponse = 3; WorkflowSpec specResponse = 4; + RunResponse runResponse = 5; } } +message RunResponse { + map refToCapCall = 1; +} + +message CapabilityCall { + string capabilityId = 1; + capabilities.CapabilityRequest request = 2; +} + // NOTE: This message was added because it is needed to be used as part of the request and for metrics. message FetchRequestMetadata { string workflowId = 1; diff --git a/pkg/workflows/wasm/runner_v2.go b/pkg/workflows/wasm/runner_v2.go new file mode 100644 index 000000000..960c7513b --- /dev/null +++ b/pkg/workflows/wasm/runner_v2.go @@ -0,0 +1,196 @@ +package wasm + +import ( + "encoding/base64" + "errors" + "fmt" + + "google.golang.org/protobuf/proto" + + "github.com/smartcontractkit/chainlink-common/pkg/capabilities" + "github.com/smartcontractkit/chainlink-common/pkg/capabilities/pb" + "github.com/smartcontractkit/chainlink-common/pkg/values" + "github.com/smartcontractkit/chainlink-common/pkg/workflows/sdk" + wasmpb "github.com/smartcontractkit/chainlink-common/pkg/workflows/wasm/pb" +) + +type RunnerV2 struct { + sendResponse func(payload *wasmpb.Response) + runtimeFactory func(sdkConfig *RuntimeConfig, refToResponse map[string]capabilities.CapabilityResponse, hostReqID string) *RuntimeV2 + args []string + req *wasmpb.Request +} + +var _ sdk.Runner = (*RunnerV2)(nil) + +func (r *RunnerV2) Run(factory *sdk.WorkflowSpecFactory) { + if r.req == nil { + success := r.cacheRequest() + if !success { + return + } + } + + req := r.req + + // We set this up *after* parsing the request, so that we can guarantee + // that we'll have access to the request object. + defer func() { + if err := recover(); err != nil { + asErr, ok := err.(error) + if ok { + r.sendResponse(errorResponse(r.req.Id, asErr)) + } else { + r.sendResponse(errorResponse(r.req.Id, fmt.Errorf("caught panic: %+v", err))) + } + } + }() + + resp := &wasmpb.Response{ + Id: req.Id, + } + + switch { + case req.GetSpecRequest() != nil: + rsp, innerErr := r.handleSpecRequest(factory, req.Id) + if innerErr != nil { + resp.ErrMsg = innerErr.Error() + } else { + resp = rsp + } + case req.GetRunRequest() != nil: + rsp, innerErr := r.handleRunRequest(factory, req.Id, req.GetRunRequest()) + if innerErr != nil { + resp.ErrMsg = innerErr.Error() + } else { + resp = rsp // should happen only when workflow is done processing (i.e. no more capability calls) + } + default: + resp.ErrMsg = "invalid request: message must be SpecRequest or RunRequest" + } + + r.sendResponse(resp) +} + +func (r *RunnerV2) Config() []byte { + if r.req == nil { + success := r.cacheRequest() + if !success { + return nil + } + } + + return r.req.Config +} + +func (r *RunnerV2) ExitWithError(err error) { + if r.req == nil { + success := r.cacheRequest() + if !success { + return + } + } + + r.sendResponse(errorResponse(r.req.Id, err)) + return +} + +func (r *RunnerV2) cacheRequest() bool { + if r.req == nil { + req, err := r.parseRequest() + if err != nil { + r.sendResponse(errorResponse(unknownID, err)) + return false + } + + r.req = req + } + return true +} + +func (r *RunnerV2) parseRequest() (*wasmpb.Request, error) { + // We expect exactly 2 args, i.e. `wasm `, + // where is a base64 encoded protobuf message. + if len(r.args) != 2 { + return nil, errors.New("invalid request: request must contain a payload") + } + + request := r.args[1] + if request == "" { + return nil, errors.New("invalid request: request cannot be empty") + } + + b, err := base64.StdEncoding.DecodeString(request) + if err != nil { + return nil, fmt.Errorf("invalid request: could not decode request into bytes") + } + + req := &wasmpb.Request{} + err = proto.Unmarshal(b, req) + if err != nil { + return nil, fmt.Errorf("invalid request: could not unmarshal proto: %w", err) + } + return req, err +} + +func (r *RunnerV2) handleSpecRequest(factory *sdk.WorkflowSpecFactory, id string) (*wasmpb.Response, error) { + spec, err := factory.Spec() + if err != nil { + return nil, fmt.Errorf("error getting spec from factory: %w", err) + } + + specpb, err := wasmpb.WorkflowSpecToProto(&spec) + if err != nil { + return nil, fmt.Errorf("failed to translate workflow spec to proto: %w", err) + } + + return &wasmpb.Response{ + Id: id, + Message: &wasmpb.Response_SpecResponse{ + SpecResponse: specpb, + }, + }, nil +} + +func (r *RunnerV2) handleRunRequest(factory *sdk.WorkflowSpecFactory, id string, runReq *wasmpb.RunRequest) (*wasmpb.Response, error) { + // Extract config from the request + drc := defaultRuntimeConfig(id, nil) + + refToResponse := map[string]capabilities.CapabilityResponse{} + for ref, resp := range runReq.RefToResponse { + unmarshalled, err := pb.CapabilityResponseFromProto(resp) + if err != nil { + return nil, fmt.Errorf("error unmarshalling capability response: %w", err) + } + refToResponse[ref] = unmarshalled + } + + if runReq.TriggerEvent == nil { + return nil, errors.New("missing trigger event") + } + + var event capabilities.TriggerEvent + event.TriggerType = runReq.TriggerEvent.TriggerType + event.ID = runReq.TriggerEvent.Id + outputs, err := values.FromMapValueProto(runReq.TriggerEvent.Outputs) + if err != nil { + return nil, fmt.Errorf("could not unmarshal event payload: %w", err) + } + event.Outputs = outputs + + // execute workflow + runtime := r.runtimeFactory(drc, refToResponse, r.req.Id) + runFn := factory.GetRunFn(runReq.TriggerRef) + if runFn == nil { + return nil, fmt.Errorf("could not find run function for ref %s", runReq.TriggerRef) + } + err = runFn(runtime, event) + if err != nil { + return nil, fmt.Errorf("error executing workflow: %w", err) + } + + // successful execution termination + return &wasmpb.Response{ + Id: id, + }, nil +} diff --git a/pkg/workflows/wasm/runner_wasip1.go b/pkg/workflows/wasm/runner_wasip1.go index 4c772a93a..c380d4aed 100644 --- a/pkg/workflows/wasm/runner_wasip1.go +++ b/pkg/workflows/wasm/runner_wasip1.go @@ -6,6 +6,7 @@ import ( "google.golang.org/protobuf/proto" + "github.com/smartcontractkit/chainlink-common/pkg/capabilities" "github.com/smartcontractkit/chainlink-common/pkg/logger" wasmpb "github.com/smartcontractkit/chainlink-common/pkg/workflows/wasm/pb" ) @@ -42,6 +43,20 @@ func NewRunner() *Runner { } } +func NewRunnerV2() *RunnerV2 { + return &RunnerV2{ + sendResponse: sendResponseFn, + runtimeFactory: func(sdkConfig *RuntimeConfig, refToResponse map[string]capabilities.CapabilityResponse, hostReqID string) *RuntimeV2 { + return &RuntimeV2{ + sendResponseFn: sendResponseFn, + refToResponse: refToResponse, + hostRequestID: hostReqID, + } + }, + args: os.Args, + } +} + // sendResponseFn implements sendResponse for import into WASM. func sendResponseFn(response *wasmpb.Response) { pb, err := proto.Marshal(response) diff --git a/pkg/workflows/wasm/runtime_v2.go b/pkg/workflows/wasm/runtime_v2.go new file mode 100644 index 000000000..1ffd35bd7 --- /dev/null +++ b/pkg/workflows/wasm/runtime_v2.go @@ -0,0 +1,110 @@ +package wasm + +import ( + "fmt" + "sync" + + "github.com/smartcontractkit/chainlink-common/pkg/capabilities" + "github.com/smartcontractkit/chainlink-common/pkg/capabilities/pb" + "github.com/smartcontractkit/chainlink-common/pkg/values" + "github.com/smartcontractkit/chainlink-common/pkg/workflows/sdk" + wasmpb "github.com/smartcontractkit/chainlink-common/pkg/workflows/wasm/pb" +) + +type RuntimeV2 struct { + sendResponseFn func(payload *wasmpb.Response) + refToResponse map[string]capabilities.CapabilityResponse + hostRequestID string +} + +var _ sdk.RuntimeV2 = (*RuntimeV2)(nil) + +func (r *RuntimeV2) CallCapabilities(calls ...sdk.CapabilityCallPromise) error { + missingRequests := make(map[string]*pb.CapabilityRequest) + for _, call := range calls { + ref, _, request := call.CallInfo() + if response, ok := r.refToResponse[ref]; ok { + call.Fulfill(response, nil) + } else { + missingRequests[ref] = pb.CapabilityRequestToProto(request) + } + } + if len(missingRequests) == 0 { + // all already fulfilled + return nil + } + if len(missingRequests) != len(calls) { + // only all-or-nothing + return fmt.Errorf("partially missing responses") + } + // send back a response with all pending capability calls and terminate execution + capCallsProtos := map[string]*wasmpb.CapabilityCall{} + for _, call := range calls { + ref, capId, request := call.CallInfo() + capCallsProtos[ref] = &wasmpb.CapabilityCall{ + CapabilityId: capId, + Request: pb.CapabilityRequestToProto(request), + } + } + // this will never return + r.sendResponseFn(&wasmpb.Response{ + Id: r.hostRequestID, + Message: &wasmpb.Response_RunResponse{ + RunResponse: &wasmpb.RunResponse{ + RefToCapCall: capCallsProtos, + }, + }, + }) + return fmt.Errorf("should never reach here") +} + +type CapCall[Outputs any] struct { + ref string + capId string + capRequest capabilities.CapabilityRequest + outputs Outputs + err error + fulfilled bool + mu sync.Mutex +} + +func (c *CapCall[Outputs]) CallInfo() (ref string, capId string, request capabilities.CapabilityRequest) { + return c.ref, c.capId, c.capRequest +} + +func (c *CapCall[Outputs]) Fulfill(response capabilities.CapabilityResponse, err error) { + c.mu.Lock() + defer c.mu.Unlock() + c.err = response.Value.UnwrapTo(&c.outputs) +} + +func (c *CapCall[Outputs]) Result() (Outputs, error) { + c.mu.Lock() + defer c.mu.Unlock() + if !c.fulfilled { + return c.outputs, fmt.Errorf("not yet fulfilled") + } + return c.outputs, c.err +} + +// TODO: maybe we could generate those for every capability individually? +func NewCapabilityCall[Inputs any, Config any, Outputs any](ref string, capId string, inputs Inputs, config Config) (*CapCall[Outputs], error) { + inputsVal, err := values.CreateMapFromStruct(inputs) + if err != nil { + return nil, err + } + configVal, err := values.CreateMapFromStruct(config) + if err != nil { + return nil, err + } + + return &CapCall[Outputs]{ + ref: ref, + capId: capId, + capRequest: capabilities.CapabilityRequest{ + // TODO: Metadata? + Inputs: inputsVal, + Config: configVal, + }, + }, nil +}