handleWorkflowsRun (workflows.ts)

ClawRecipes · automation

Handles workflow run lifecycle: tick, approval, and execution.

import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
import { approveWorkflowRun, enqueueWorkflowRun, pollWorkflowApprovals, resumeWorkflowRun, runWorkflowRunnerOnce, runWorkflowRunnerTick, runWorkflowWorkerTick } from '../lib/workflows/workflow-runner';
import { cleanupQueues } from '../lib/workflows/workflow-queue';
import { resolveTeamDir } from '../lib/workspace';

export async function handleWorkflowsRun(api: OpenClawPluginApi, opts: {
  teamId: string;
  workflowFile: string;
}) {
  if (!opts.teamId) throw new Error('--team-id is required');
  if (!opts.workflowFile) throw new Error('--workflow-file is required');
  return enqueueWorkflowRun(api, {
    teamId: opts.teamId,
    workflowFile: opts.workflowFile,
    trigger: { kind: 'manual', at: new Date().toISOString() },
  }

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key