import { ExtensionContext, ExtensionAPI } from '@mariozechner/pi-coding-agent'; type WorkflowerSetupOptions = { /** URL or file path for the calling package extension module. */ packageUrl?: string; }; type WorkflowThinkingLevel = "off" | "minimal" | "low" | "medium" | "high" | "xhigh"; type WorkflowModelProvider = "amazon-bedrock" | "anthropic" | "google" | "google-vertex" | "openai" | "azure-openai-responses" | "openai-codex" | "github-copilot" | "openrouter" | "vercel-ai-gateway" | "xai" | "groq" | "cerebras" | "deepseek" | "zai" | "mistral" | "minimax" | "moonshotai" | "huggingface" | "fireworks" | "opencode" | "kimi-coding" | "cloudflare-workers-ai" | "cloudflare-ai-gateway" | (string & {}); /** * Workflow model reference in Pi's canonical provider/model-id format. * * Use Pi's `/models` command to discover configured model ids, then prefix the * selected model id with its provider, e.g. `openai-codex/gpt-5.3-codex-spark`. */ type WorkflowModelReference = `${WorkflowModelProvider}/${string}`; /** Ordered model candidates. Item 0 is preferred; later items are fallbacks. */ type WorkflowModelFallbacks = readonly [WorkflowModelReference, ...WorkflowModelReference[]]; /** Level names for model resolution */ type WorkflowModelLevel = "tiny" | "small" | "medium" | "large" | "xl"; /** A model setting can be a level name, a model reference, or an array of model references */ type WorkflowModelSetting = WorkflowModelLevel | WorkflowModelReference | WorkflowModelFallbacks; type WorkflowStepModel = WorkflowModelSetting; type WorkflowRuntimeDefaults = { model?: WorkflowModelReference | WorkflowModelLevel; thinkingLevel?: WorkflowThinkingLevel; }; type WorkflowStep = { id: string; command: string; outputs?: string[]; clearOnNext?: boolean; autoNext?: boolean; /** * Preferred model for this step, or ordered fallback candidates. * Step candidates are tried before workflow-level candidates and captured defaults. * * If no candidate can be selected, Workflower leaves Pi on the current/default * model and still starts the step. */ model?: WorkflowModelSetting; thinkingLevel?: WorkflowThinkingLevel; }; type WorkflowDefinition = { id: string; /** Whether Workflower should register /wf: for user invocation. Defaults to true. */ userInvocable?: boolean; /** Whether workflower_handoff may start this workflow. Defaults to true. */ modelInvocable?: boolean; /** Default model candidates for steps that do not specify their own model. */ model?: WorkflowModelSetting; /** Default thinking level for steps that do not specify their own thinking level. */ thinkingLevel?: WorkflowThinkingLevel; /** Default autoNext for steps that do not specify their own autoNext. Defaults to false. */ autoNext?: boolean; clearOnStart?: boolean; clearOnCompletion?: boolean; cleanupOnCompletion?: boolean; pollen?: string | string[]; acceptPollen?: boolean; steps: WorkflowStep[]; }; type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue; }; type GardenStateProducer = { workflowId: string; stepId?: string; stepIndex: number; gardenName: string; gardenPath: string; flowerName?: string; flowerPath: string; }; type GardenStateEntry = { value: JsonValue; updatedAt: string; producer?: GardenStateProducer; }; type GardenStateListItem = GardenStateEntry & { key: string; }; type GardenStateFailure = { ok: false; message: string; }; type GardenStateGetSuccess = { ok: true; key: string; found: boolean; entry?: GardenStateEntry; }; type GardenStateSetSuccess = { ok: true; key: string; entry: GardenStateEntry; message: string; }; type GardenStateListSuccess = { ok: true; values: Record; keys: string[]; }; type GardenStateGetResult = GardenStateGetSuccess | GardenStateFailure; type GardenStateSetResult = GardenStateSetSuccess | GardenStateFailure; type GardenStateListResult = GardenStateListSuccess | GardenStateFailure; type WorkflowNotificationLevel = "info" | "warning" | "error"; type WorkflowNotificationUi = { notify(message: string, level?: WorkflowNotificationLevel): void; setStatus?(key: string, text: string | undefined): void; }; type RuntimeSettingsContext = Pick & Partial>; type WorkflowCommandContext = { cwd: string; ui: WorkflowNotificationUi; sessionManager: { getSessionId(): string; getSessionFile(): string | undefined; getLeafId?(): string | null | undefined; }; }; type WorkflowHandoffSource = { workflowId: string; flowerPath: string; stepIndex: number; }; type WorkflowHandoffSuccess = { ok: true; message: string; workflowId: string; gardenName: string; gardenPath: string; activeFlowerName: string; activeFlowerPath: string; workdir: string; incomingPollen: string[]; source: WorkflowHandoffSource; }; type WorkflowHandoffFailure = { ok: false; message: string; }; type WorkflowHandoffUseCaseResult = WorkflowHandoffSuccess | WorkflowHandoffFailure; type WorkflowerRuntimeContext = WorkflowCommandContext & RuntimeSettingsContext; type WorkflowerRuntimeOptions = { sendUserMessage?: (prompt: string) => Promise | void; }; type WorkflowerRuntime = { state: { get(key: string): Promise; getValue(key: string): Promise; set(key: string, value: JsonValue): Promise; list(): Promise; }; handoff(workflowId: string): Promise; }; declare function createWorkflowerRuntime(pi: ExtensionAPI, ctx: WorkflowerRuntimeContext, options?: WorkflowerRuntimeOptions): WorkflowerRuntime; declare function registerWorkflows(workflows: readonly WorkflowDefinition[]): void; type WorkflowerCommandResult = { kind: "prompt"; content: string; } | { kind: "none"; }; type WorkflowerCommandContext = { workflowId: string; workflowName: string; stepId: string; stepName?: string; gardenName: string; cwd: string; signal?: AbortSignal; }; type WorkflowerCommandDefinition = { name: string; description?: string; handler: (args: string, ctx: WorkflowerCommandContext) => Promise | WorkflowerCommandResult; }; declare function registerWorkflowerCommand(command: WorkflowerCommandDefinition): void; declare function setupWorkflower(pi: ExtensionAPI, options?: WorkflowerSetupOptions): void; export { type GardenStateEntry, type GardenStateGetResult, type GardenStateListItem, type GardenStateListResult, type GardenStateSetResult, type JsonValue, type WorkflowDefinition, type WorkflowHandoffUseCaseResult, type WorkflowModelFallbacks, type WorkflowModelLevel, type WorkflowModelProvider, type WorkflowModelReference, type WorkflowModelSetting, type WorkflowRuntimeDefaults, type WorkflowStep, type WorkflowStepModel, type WorkflowThinkingLevel, type WorkflowerCommandContext, type WorkflowerCommandDefinition, type WorkflowerCommandResult, type WorkflowerRuntime, type WorkflowerRuntimeContext, type WorkflowerRuntimeOptions, type WorkflowerSetupOptions, createWorkflowerRuntime, setupWorkflower as default, registerWorkflowerCommand, registerWorkflows, setupWorkflower };