pi-extensible-workflows 2.0.0 → 3.1.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.
- package/README.md +18 -11
- package/dist/src/agent-execution.d.ts +4 -94
- package/dist/src/agent-execution.js +34 -208
- package/dist/src/budget.d.ts +38 -0
- package/dist/src/budget.js +160 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +60 -8
- package/dist/src/doctor-cleanup.d.ts +41 -0
- package/dist/src/doctor-cleanup.js +597 -0
- package/dist/src/doctor.d.ts +7 -2
- package/dist/src/doctor.js +127 -22
- package/dist/src/execution.d.ts +17 -0
- package/dist/src/execution.js +630 -0
- package/dist/src/host.d.ts +101 -0
- package/dist/src/host.js +3084 -0
- package/dist/src/index.d.ts +13 -634
- package/dist/src/index.js +10 -4432
- package/dist/src/persistence.d.ts +9 -19
- package/dist/src/persistence.js +175 -61
- package/dist/src/registry.d.ts +43 -0
- package/dist/src/registry.js +279 -0
- package/dist/src/session-inspector.js +5 -3
- package/dist/src/types.d.ts +692 -0
- package/dist/src/types.js +27 -0
- package/dist/src/utils.d.ts +32 -0
- package/dist/src/utils.js +168 -0
- package/dist/src/validation.d.ts +28 -0
- package/dist/src/validation.js +832 -0
- package/package.json +3 -2
- package/skills/pi-extensible-workflows/SKILL.md +69 -34
- package/src/agent-execution.ts +37 -189
- package/src/budget.ts +75 -0
- package/src/cli.ts +47 -7
- package/src/doctor-cleanup.ts +337 -0
- package/src/doctor.ts +117 -24
- package/src/execution.ts +540 -0
- package/src/host.ts +2598 -0
- package/src/index.ts +14 -3856
- package/src/persistence.ts +122 -37
- package/src/registry.ts +240 -0
- package/src/session-inspector.ts +5 -3
- package/src/types.ts +158 -0
- package/src/utils.ts +142 -0
- package/src/validation.ts +688 -0
|
@@ -0,0 +1,101 @@
|
|
|
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 AgentRecord, 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 type WorkflowPhaseState = "not started" | "running" | "completed" | "failed" | "cancelled" | "interrupted" | "budget_exhausted";
|
|
54
|
+
export interface WorkflowPhaseAgentCounts {
|
|
55
|
+
total: number;
|
|
56
|
+
completed: number;
|
|
57
|
+
running: number;
|
|
58
|
+
failed: number;
|
|
59
|
+
cancelled: number;
|
|
60
|
+
pending: number;
|
|
61
|
+
}
|
|
62
|
+
export interface WorkflowPhaseView {
|
|
63
|
+
id: string;
|
|
64
|
+
name: string;
|
|
65
|
+
occurrence: number;
|
|
66
|
+
state: WorkflowPhaseState;
|
|
67
|
+
status: WorkflowPhaseState;
|
|
68
|
+
observed: boolean;
|
|
69
|
+
afterAgent?: number;
|
|
70
|
+
agents: readonly AgentRecord[];
|
|
71
|
+
counts: WorkflowPhaseAgentCounts;
|
|
72
|
+
}
|
|
73
|
+
export interface WorkflowPhaseModel {
|
|
74
|
+
declaredPhases: readonly string[];
|
|
75
|
+
phases: readonly WorkflowPhaseView[];
|
|
76
|
+
currentPhaseIndex?: number;
|
|
77
|
+
currentPhaseId?: string;
|
|
78
|
+
counts: Readonly<Partial<Record<WorkflowPhaseState, number>>>;
|
|
79
|
+
unassignedAgents?: readonly AgentRecord[];
|
|
80
|
+
}
|
|
81
|
+
type WorkflowPhaseSource = readonly string[] | Pick<LaunchSnapshot, "phases"> | undefined;
|
|
82
|
+
export declare function buildWorkflowPhaseModel(run: Pick<PersistedRun, "state" | "phase" | "phaseHistory" | "agents">, source?: WorkflowPhaseSource): WorkflowPhaseModel;
|
|
83
|
+
export interface WorkflowPhaseSelection {
|
|
84
|
+
phaseId?: string | undefined;
|
|
85
|
+
agentId?: string | undefined;
|
|
86
|
+
}
|
|
87
|
+
export declare function preserveWorkflowPhaseSelection(model: WorkflowPhaseModel, selection: WorkflowPhaseSelection): WorkflowPhaseSelection;
|
|
88
|
+
export declare function formatWorkflowProgress(run: PersistedRun, spinner?: string, styles?: WorkflowProgressStyles): string;
|
|
89
|
+
export declare function truncateWorkflowProgress(text: string, width: number): string[];
|
|
90
|
+
export declare function formatBudgetStatus(run: Pick<PersistedRun, "budget" | "budgetVersion" | "usage" | "budgetEvents">): string[];
|
|
91
|
+
export declare function agentBreadcrumbParts(agent: AgentRecord, byId: Map<string, AgentRecord>, includeStructuralPath?: boolean): string[];
|
|
92
|
+
export declare function agentBreadcrumb(agent: AgentRecord, byId: Map<string, AgentRecord>, includeStructuralPath?: boolean): string;
|
|
93
|
+
export declare function formatNavigatorDashboard(run: PersistedRun, checkpoints: readonly AwaitingCheckpoint[], worktrees: readonly WorktreeReference[]): string;
|
|
94
|
+
export declare function formatNavigatorRun(loaded: {
|
|
95
|
+
run: PersistedRun;
|
|
96
|
+
snapshot: Readonly<LaunchSnapshot>;
|
|
97
|
+
}, checkpoints: readonly AwaitingCheckpoint[], _worktrees: readonly WorktreeReference[]): string;
|
|
98
|
+
export declare function formatWorkflowPhaseDashboard(run: PersistedRun, snapshot: Readonly<LaunchSnapshot>, width: number, selection?: WorkflowPhaseSelection, styles?: WorkflowProgressStyles): string[];
|
|
99
|
+
export declare function formatWorkflowFailureDiagnostics(diagnostic: WorkflowFailureDiagnostics): string;
|
|
100
|
+
export default function workflowExtension(pi: ExtensionAPI, home?: string, clipboard?: typeof copyToClipboard, createSession?: SessionFactory, agentDir?: string): void;
|
|
101
|
+
export {};
|