pi-extensible-workflows 2.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,62 @@
1
+ import { Type } from "@earendil-works/pi-ai";
2
+ import { copyToClipboard, type ExtensionAPI } from "@earendil-works/pi-coding-agent";
3
+ import { type SessionFactory } from "./agent-execution.js";
4
+ import type { AwaitingCheckpoint, PersistedRun, WorktreeReference } from "./persistence.js";
5
+ import { type LaunchSnapshot, type RunState, type WorkflowFailureDiagnostics } from "./types.js";
6
+ export interface WorkflowProgressStyles {
7
+ accent(text: string): string;
8
+ success(text: string): string;
9
+ error(text: string): string;
10
+ warning(text: string): string;
11
+ muted(text: string): string;
12
+ dim(text: string): string;
13
+ bold(text: string): string;
14
+ }
15
+ export declare function formatWorkflowFailure(error: unknown): string;
16
+ export declare class RunLifecycle {
17
+ #private;
18
+ private readonly changed?;
19
+ constructor(state?: RunState, changed?: ((state: RunState, previousState: RunState, reason?: string) => void | Promise<void>) | undefined);
20
+ get state(): RunState;
21
+ enter(): Promise<void>;
22
+ leave(): Promise<void>;
23
+ enterAwaitingInput(): Promise<void>;
24
+ resolveAwaitingInput(): Promise<void>;
25
+ pause(): Promise<void>;
26
+ resume(): Promise<void>;
27
+ providerPause(): Promise<void>;
28
+ terminal(state: "completed" | "failed" | "stopped" | "interrupted" | "budget_exhausted", reason?: string): Promise<void>;
29
+ }
30
+ export declare function formatWorkflowPreview(args: {
31
+ script?: unknown;
32
+ workflow?: unknown;
33
+ name?: unknown;
34
+ description?: unknown;
35
+ }): string;
36
+ export declare const WORKFLOW_TOOL_LABEL = "Workflow";
37
+ export declare const WORKFLOW_TOOL_DESCRIPTION = "Run a deterministic JavaScript workflow";
38
+ export declare const WORKFLOW_TOOL_PROMPT_SNIPPET = "Run a deterministic, resumable JavaScript workflow that orchestrates subagents. Inline launches require an explicit non-empty name; registered function launches reject name and use workflow as the run name. Runs in the background by default; completion arrives as a follow-up message. Foreground results include the completed run ID. Use workflow_retry with an explicit failed run ID to replay completed structural operations; parentRunId only reuses named worktrees.";
39
+ export declare const WORKFLOW_TOOL_PARAMETERS: Type.TObject<{
40
+ name: Type.TOptional<Type.TString>;
41
+ description: Type.TOptional<Type.TString>;
42
+ script: Type.TOptional<Type.TString>;
43
+ workflow: Type.TOptional<Type.TString>;
44
+ args: Type.TOptional<Type.TUnknown>;
45
+ foreground: Type.TOptional<Type.TBoolean>;
46
+ concurrency: Type.TOptional<Type.TInteger>;
47
+ budget: Type.TOptional<Type.TUnknown>;
48
+ parentRunId: Type.TOptional<Type.TString>;
49
+ }>;
50
+ export declare const WORKFLOW_RETRY_PARAMETERS: Type.TObject<{
51
+ runId: Type.TString;
52
+ }>;
53
+ export declare function formatWorkflowProgress(run: PersistedRun, spinner?: string, styles?: WorkflowProgressStyles): string;
54
+ export declare function truncateWorkflowProgress(text: string, width: number): string[];
55
+ export declare function formatBudgetStatus(run: Pick<PersistedRun, "budget" | "budgetVersion" | "usage" | "budgetEvents">): string[];
56
+ export declare function formatNavigatorDashboard(run: PersistedRun, checkpoints: readonly AwaitingCheckpoint[], worktrees: readonly WorktreeReference[]): string;
57
+ export declare function formatNavigatorRun(loaded: {
58
+ run: PersistedRun;
59
+ snapshot: Readonly<LaunchSnapshot>;
60
+ }, checkpoints: readonly AwaitingCheckpoint[], _worktrees: readonly WorktreeReference[]): string;
61
+ export declare function formatWorkflowFailureDiagnostics(diagnostic: WorkflowFailureDiagnostics): string;
62
+ export default function workflowExtension(pi: ExtensionAPI, home?: string, clipboard?: typeof copyToClipboard, createSession?: SessionFactory, agentDir?: string): void;