From 49a82de49c406ed2611007ece30571a91fbf16ae Mon Sep 17 00:00:00 2001 From: Hitesh Jain Date: Mon, 30 Mar 2026 16:03:20 +0530 Subject: [PATCH] Activity Contracts for Workflow Orchestrator --- core/activity-contracts/activity/activity.go | 27 ++++++++++++++++++++ core/activity-contracts/go.mod | 3 +++ 2 files changed, 30 insertions(+) create mode 100644 core/activity-contracts/activity/activity.go create mode 100644 core/activity-contracts/go.mod diff --git a/core/activity-contracts/activity/activity.go b/core/activity-contracts/activity/activity.go new file mode 100644 index 00000000..70517676 --- /dev/null +++ b/core/activity-contracts/activity/activity.go @@ -0,0 +1,27 @@ +package activity + +import "context" + +// GlobalActivityOutputs maps each action name to a list of its result maps. +// {"noop.log": [{"logged": "hello"}, {"logged": "world"}], "noop.echo": [...]} +type GlobalActivityOutputs map[string][]map[string]interface{} + +// ActivityInput is the generic input passed to all activities. +type ActivityInput struct { + Action string `json:"action"` + Params map[string]interface{} `json:"params"` + StepName string `json:"step_name"` + WorkflowExecutionId string `json:"workflow_execution_id"` + Async bool `json:"async"` + PluginVersion string `json:"plugin_version"` + StepId string `json:"step_id,omitempty"` +} + +// ActivityOutput is the generic output returned by all activities. +type ActivityOutput struct { + Result map[string]interface{} `json:"result,omitempty"` + Error string `json:"error,omitempty"` +} + +// ActivityFunc is the function signature that every registered activity must implement. +type ActivityFunc func(ctx context.Context, globalOutputs GlobalActivityOutputs, input ActivityInput) (ActivityOutput, error) diff --git a/core/activity-contracts/go.mod b/core/activity-contracts/go.mod new file mode 100644 index 00000000..7ce73862 --- /dev/null +++ b/core/activity-contracts/go.mod @@ -0,0 +1,3 @@ +module github.com/Meesho/BharatMLStack/core/activity-contracts + +go 1.25.6