{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/workflow-sdk/index.ts"],"names":[],"mappings":"AAIA,mEAAmE;AACnE,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,MAAM,CAAC,CAE7D;AAED;;;;;;;;;GASG;AACH,wBAAsB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAM7E","sourcesContent":["import { readFile } from \"node:fs/promises\";\n\nconst SDK_URL = new URL(\"./sdk.mjs\", import.meta.url);\n\n/** The single-file workflow SDK prelude (plain ESM JavaScript). */\nexport async function readWorkflowSdkSource(): Promise<string> {\n\treturn readFile(SDK_URL, \"utf8\");\n}\n\n/**\n * Compose a self-contained workflow component entrypoint: the SDK prelude\n * followed by the author's script body. Artifacts accept exactly one\n * entrypoint file, so the SDK is concatenated rather than imported; the\n * artifact digest therefore covers the exact SDK revision the pack ships.\n *\n * The body runs in the same module scope as the prelude and is expected to\n * end with a `runWorkflow(async ({ trigger, args, host }) => { ... })` call;\n * `agent()`, `parallel()`, `pipeline()`, and `log()` are in scope.\n */\nexport async function composeWorkflowEntrypoint(body: string): Promise<string> {\n\tif (!body.includes(\"runWorkflow(\")) {\n\t\tthrow new Error(\"Workflow body must call runWorkflow(handler)\");\n\t}\n\tconst sdk = await readWorkflowSdkSource();\n\treturn [sdk, \"\", \"// ---- workflow body (author code) ----\", body.trim(), \"\"].join(\"\\n\");\n}\n"]}