@melony/runtime
The execution engine for Melony applications.
Overview
The @melony/runtime package handles the execution of actions, manages async generators, and orchestrates human-in-the-loop (HITL) approval flows.
npm install @melony/runtimeFeatures
- Action Definition: Define actions with Zod schemas for type-safe execution.
- Async Generators: Actions can yield multiple events over time (streaming).
- Chaining: Automatically chain actions based on results.
- Approval Flows: Built-in support for pausing execution for user approval.
Defining an Action
import { defineAction } from "@melony/runtime";
import z from "zod";
export const myAction = defineAction({
name: "myAction",
paramsSchema: z.object({
query: z.string(),
}),
execute: async function* (params) {
yield { type: "text", data: { content: "Processing..." } };
// ... logic
yield { type: "text", data: { content: "Done!" } };
},
});