return {
id = "echo_emitter",
namespace = "builtin",
subscriptions = {"Echo"},
on_request = function(request)
if request.operation == "echo" then
local message = request.payload
if type(message) == "table" then
message = message.message or message.content or ""
end
if type(message) ~= "string" then
message = tostring(message)
end
orcs.output("Echo: " .. message)
return { success = true, data = { echoed = message } }
end
return { success = false, error = "unknown operation: " .. request.operation }
end,
on_signal = function(signal)
if signal.kind == "Veto" then
orcs.output_with_level("Received veto, aborting...", "warn")
return "Abort"
end
return "Ignored"
end,
init = function()
orcs.log("info", "echo_emitter component initialized")
end,
shutdown = function()
orcs.log("info", "echo_emitter component shutdown")
end,
}