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
package/dist/src/index.d.ts
CHANGED
|
@@ -1,637 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export declare const WORKFLOW_RUN_RESUMED_EVENT = "workflow:run-resumed";
|
|
12
|
-
export declare const WORKFLOW_RUN_STATE_CHANGED_EVENT = "workflow:run-state-changed";
|
|
13
|
-
export declare const WORKFLOW_RUN_COMPLETED_EVENT = "workflow:run-completed";
|
|
14
|
-
export declare const WORKFLOW_RUN_FAILED_EVENT = "workflow:run-failed";
|
|
15
|
-
export declare const WORKFLOW_AGENT_STATE_CHANGED_EVENT = "workflow:agent-state-changed";
|
|
16
|
-
export declare const WORKFLOW_PHASE_CHANGED_EVENT = "workflow:phase-changed";
|
|
17
|
-
export declare const WORKFLOW_CHECKPOINT_STATE_CHANGED_EVENT = "workflow:checkpoint-state-changed";
|
|
18
|
-
export declare const WORKFLOW_BUDGET_EVENT = "workflow:budget-event";
|
|
19
|
-
export declare const WORKFLOW_WORKTREE_CREATED_EVENT = "workflow:worktree-created";
|
|
20
|
-
export declare const ERROR_CODES: readonly ["CONFIG_ERROR", "INVALID_SETTINGS", "INVALID_SYNTAX", "INVALID_METADATA", "DUPLICATE_NAME", "INVALID_SCHEMA", "UNKNOWN_MODEL", "UNKNOWN_TOOL", "UNKNOWN_AGENT_TYPE", "RUN_OWNED", "REGISTRY_FROZEN", "GLOBAL_COLLISION", "MISSING_WORKFLOW", "RPC_LIMIT_EXCEEDED", "SHELL_FAILED", "AGENT_TIMEOUT", "AGENT_FAILED", "RESULT_INVALID", "CANCELLED", "WORKER_UNRESPONSIVE", "WORKTREE_FAILED", "RESUME_INCOMPATIBLE", "BUDGET_EXHAUSTED", "INTERNAL_ERROR"];
|
|
21
|
-
export type RunState = (typeof RUN_STATES)[number];
|
|
22
|
-
export type AgentState = (typeof AGENT_STATES)[number];
|
|
23
|
-
export type WorkflowErrorCode = (typeof ERROR_CODES)[number];
|
|
24
|
-
export type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
25
|
-
[key: string]: JsonValue;
|
|
26
|
-
};
|
|
27
|
-
export type JsonSchema = {
|
|
28
|
-
[key: string]: JsonValue;
|
|
29
|
-
};
|
|
30
|
-
export interface ShellOptions {
|
|
31
|
-
timeoutMs?: number;
|
|
32
|
-
env?: Record<string, string>;
|
|
33
|
-
}
|
|
34
|
-
export interface ShellResult {
|
|
35
|
-
exitCode: number | null;
|
|
36
|
-
stdout: string;
|
|
37
|
-
stderr: string;
|
|
38
|
-
}
|
|
39
|
-
export type BudgetDimension = "tokens" | "costUsd" | "durationMs" | "agentLaunches";
|
|
40
|
-
export interface BudgetLimits {
|
|
41
|
-
soft?: number;
|
|
42
|
-
hard?: number;
|
|
43
|
-
}
|
|
44
|
-
export type WorkflowBudget = Partial<Record<BudgetDimension, BudgetLimits>>;
|
|
45
|
-
export type WorkflowBudgetPatch = Partial<Record<BudgetDimension, BudgetLimits | {
|
|
46
|
-
soft?: number | null;
|
|
47
|
-
hard?: number | null;
|
|
48
|
-
} | null>>;
|
|
49
|
-
export interface WorkflowBudgetUsage {
|
|
50
|
-
tokens: number;
|
|
51
|
-
costUsd: number;
|
|
52
|
-
durationMs: number;
|
|
53
|
-
agentLaunches: number;
|
|
54
|
-
}
|
|
55
|
-
export type BudgetEventType = "soft_crossed" | "hard_overrun" | "hard_exhausted" | "adjustment_requested" | "adjustment_approved" | "adjustment_rejected";
|
|
56
|
-
export interface BudgetEvent {
|
|
57
|
-
type: BudgetEventType;
|
|
58
|
-
budgetVersion: number;
|
|
59
|
-
dimensions: readonly BudgetDimension[];
|
|
60
|
-
usage: WorkflowBudgetUsage;
|
|
61
|
-
limits: WorkflowBudget;
|
|
62
|
-
at: number;
|
|
63
|
-
proposalId?: string;
|
|
64
|
-
previous?: WorkflowBudget;
|
|
65
|
-
proposed?: WorkflowBudget;
|
|
66
|
-
}
|
|
67
|
-
export interface BudgetApprovalRequest {
|
|
68
|
-
kind: "budget";
|
|
69
|
-
proposalId: string;
|
|
70
|
-
runId: string;
|
|
71
|
-
consumed: WorkflowBudgetUsage;
|
|
72
|
-
previous: WorkflowBudget;
|
|
73
|
-
proposed: WorkflowBudget;
|
|
74
|
-
budgetVersion: number;
|
|
75
|
-
}
|
|
76
|
-
export interface WorkflowErrorShape {
|
|
77
|
-
code: WorkflowErrorCode;
|
|
78
|
-
message: string;
|
|
79
|
-
}
|
|
80
|
-
export interface WorkflowEventBase {
|
|
81
|
-
runId: string;
|
|
82
|
-
sessionId: string;
|
|
83
|
-
workflowName: string;
|
|
84
|
-
cwd: string;
|
|
85
|
-
runDirectory: string;
|
|
86
|
-
timestamp: number;
|
|
87
|
-
}
|
|
88
|
-
export type WorkflowRunStartedEvent = WorkflowEventBase;
|
|
89
|
-
export type WorkflowRunResumedEvent = WorkflowEventBase;
|
|
90
|
-
export interface WorkflowRunStateChangedEvent extends WorkflowEventBase {
|
|
91
|
-
previousState: RunState;
|
|
92
|
-
state: RunState;
|
|
93
|
-
reason?: string;
|
|
94
|
-
errorCode?: WorkflowErrorCode;
|
|
95
|
-
}
|
|
96
|
-
export interface WorkflowRunCompletedEvent extends WorkflowEventBase {
|
|
97
|
-
resultPath: string;
|
|
98
|
-
}
|
|
99
|
-
export interface WorkflowRunFailedEvent extends WorkflowEventBase {
|
|
100
|
-
error: WorkflowErrorShape;
|
|
101
|
-
}
|
|
102
|
-
export interface WorkflowAgentStateChangedEvent extends WorkflowEventBase {
|
|
103
|
-
agentId: string;
|
|
104
|
-
displayLabel: string;
|
|
105
|
-
role?: string;
|
|
106
|
-
structuralPath: readonly string[];
|
|
107
|
-
parentId?: string;
|
|
108
|
-
parentBreadcrumb?: string;
|
|
109
|
-
worktreeOwner?: string;
|
|
110
|
-
previousState?: AgentState;
|
|
111
|
-
state: AgentState;
|
|
112
|
-
attempt: number;
|
|
113
|
-
}
|
|
114
|
-
export interface WorkflowPhaseChangedEvent extends WorkflowEventBase {
|
|
115
|
-
previousPhase?: string;
|
|
116
|
-
phase: string;
|
|
117
|
-
}
|
|
118
|
-
export type WorkflowCheckpointState = "awaiting" | "approved" | "rejected";
|
|
119
|
-
export interface WorkflowCheckpointStateChangedEvent extends WorkflowEventBase {
|
|
120
|
-
name: string;
|
|
121
|
-
state: WorkflowCheckpointState;
|
|
122
|
-
}
|
|
123
|
-
export interface WorkflowBudgetEvent extends WorkflowEventBase {
|
|
124
|
-
type: BudgetEventType;
|
|
125
|
-
budgetVersion: number;
|
|
126
|
-
dimensions: readonly BudgetDimension[];
|
|
127
|
-
usage: WorkflowBudgetUsage;
|
|
128
|
-
limits: WorkflowBudget;
|
|
129
|
-
proposalId?: string;
|
|
130
|
-
previous?: WorkflowBudget;
|
|
131
|
-
proposed?: WorkflowBudget;
|
|
132
|
-
}
|
|
133
|
-
export interface ModelSpec {
|
|
134
|
-
provider: string;
|
|
135
|
-
model: string;
|
|
136
|
-
thinking?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
137
|
-
}
|
|
138
|
-
export interface WorkflowMetadata {
|
|
139
|
-
name: string;
|
|
140
|
-
description?: string;
|
|
141
|
-
}
|
|
142
|
-
export interface WorkflowSettings {
|
|
143
|
-
concurrency: number;
|
|
144
|
-
modelAliases?: Readonly<Record<string, string>>;
|
|
145
|
-
disabledAgentResources?: Readonly<AgentResourceExclusions>;
|
|
146
|
-
}
|
|
147
|
-
export interface AgentResourceExclusions {
|
|
148
|
-
skills: readonly string[];
|
|
149
|
-
extensions: readonly string[];
|
|
150
|
-
}
|
|
151
|
-
export interface AgentResourcePolicy {
|
|
152
|
-
globalSettingsPath: string;
|
|
153
|
-
projectSettingsPath: string;
|
|
154
|
-
projectTrusted: boolean;
|
|
155
|
-
global: AgentResourceExclusions;
|
|
156
|
-
project: AgentResourceExclusions;
|
|
157
|
-
effective: AgentResourceExclusions;
|
|
158
|
-
unmatchedSkills: string[];
|
|
159
|
-
unmatchedExtensions: string[];
|
|
160
|
-
}
|
|
161
|
-
export interface AgentSetupSummary {
|
|
162
|
-
hookNames: readonly string[];
|
|
163
|
-
model: ModelSpec;
|
|
164
|
-
tools: readonly string[];
|
|
165
|
-
cwd: string;
|
|
166
|
-
disabledAgentResources?: {
|
|
167
|
-
skills: readonly string[];
|
|
168
|
-
extensions: readonly string[];
|
|
169
|
-
unmatchedSkills: readonly string[];
|
|
170
|
-
unmatchedExtensions: readonly string[];
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
export interface AgentAttemptSummary {
|
|
174
|
-
attempt: number;
|
|
175
|
-
sessionId: string;
|
|
176
|
-
sessionFile: string;
|
|
177
|
-
error?: {
|
|
178
|
-
code: string;
|
|
179
|
-
message: string;
|
|
180
|
-
};
|
|
181
|
-
accounting: {
|
|
182
|
-
input: number;
|
|
183
|
-
output: number;
|
|
184
|
-
cacheRead: number;
|
|
185
|
-
cacheWrite: number;
|
|
186
|
-
cost: number;
|
|
187
|
-
};
|
|
188
|
-
setup?: AgentSetupSummary;
|
|
189
|
-
}
|
|
190
|
-
export interface WorkflowWorktreeCreatedEvent extends WorkflowEventBase {
|
|
191
|
-
owner: string;
|
|
192
|
-
branch: string;
|
|
193
|
-
path: string;
|
|
194
|
-
base: string;
|
|
195
|
-
}
|
|
196
|
-
export interface WorkflowWorktreeReference {
|
|
197
|
-
readonly path: string;
|
|
198
|
-
readonly branch: string;
|
|
199
|
-
}
|
|
200
|
-
export interface AgentRecord {
|
|
201
|
-
id: string;
|
|
202
|
-
name: string;
|
|
203
|
-
label?: string;
|
|
204
|
-
path: string;
|
|
205
|
-
state: AgentState;
|
|
206
|
-
parentId?: string;
|
|
207
|
-
structuralPath?: readonly string[];
|
|
208
|
-
parentBreadcrumb?: string;
|
|
209
|
-
worktreeOwner?: string;
|
|
210
|
-
role?: string;
|
|
211
|
-
requestedModel?: string;
|
|
212
|
-
model: ModelSpec;
|
|
213
|
-
tools: readonly string[];
|
|
214
|
-
attempts: number;
|
|
215
|
-
attemptDetails?: readonly AgentAttemptSummary[];
|
|
216
|
-
accounting?: {
|
|
217
|
-
input: number;
|
|
218
|
-
output: number;
|
|
219
|
-
cacheRead: number;
|
|
220
|
-
cacheWrite: number;
|
|
221
|
-
cost: number;
|
|
222
|
-
};
|
|
223
|
-
toolCalls?: readonly {
|
|
224
|
-
id: string;
|
|
225
|
-
name: string;
|
|
226
|
-
state: "running" | "completed" | "failed";
|
|
227
|
-
}[];
|
|
228
|
-
activity?: AgentActivity | undefined;
|
|
229
|
-
}
|
|
230
|
-
export interface WorkflowRunEvent {
|
|
231
|
-
type: string;
|
|
232
|
-
message: string;
|
|
233
|
-
}
|
|
234
|
-
export interface RunRecord {
|
|
235
|
-
id: string;
|
|
236
|
-
workflowName: string;
|
|
237
|
-
cwd: string;
|
|
238
|
-
sessionId: string;
|
|
239
|
-
state: RunState;
|
|
240
|
-
parentRunId?: string;
|
|
241
|
-
phase?: string;
|
|
242
|
-
agents: readonly AgentRecord[];
|
|
243
|
-
error?: WorkflowErrorShape;
|
|
244
|
-
budget?: WorkflowBudget;
|
|
245
|
-
budgetVersion?: number;
|
|
246
|
-
usage?: WorkflowBudgetUsage;
|
|
247
|
-
budgetEvents?: readonly BudgetEvent[];
|
|
248
|
-
events?: readonly WorkflowRunEvent[];
|
|
249
|
-
}
|
|
250
|
-
export declare const LAUNCH_SNAPSHOT_IDENTITY_VERSION = 4;
|
|
251
|
-
export interface LaunchSnapshot {
|
|
252
|
-
identityVersion?: number;
|
|
253
|
-
launchKind?: "inline" | "function";
|
|
254
|
-
functionName?: string;
|
|
255
|
-
script: string;
|
|
256
|
-
args: JsonValue;
|
|
257
|
-
metadata: WorkflowMetadata;
|
|
258
|
-
settings: WorkflowSettings;
|
|
259
|
-
budget?: WorkflowBudget;
|
|
260
|
-
settingsPath?: string;
|
|
261
|
-
modelAliases?: Readonly<Record<string, string>>;
|
|
262
|
-
models: readonly string[];
|
|
263
|
-
tools: readonly string[];
|
|
264
|
-
agentTypes: readonly string[];
|
|
265
|
-
roles?: Readonly<Record<string, AgentDefinition>>;
|
|
266
|
-
projectRoles?: readonly string[];
|
|
267
|
-
schemas: readonly JsonSchema[];
|
|
268
|
-
}
|
|
269
|
-
export interface PreflightCapabilities {
|
|
270
|
-
models: ReadonlySet<string>;
|
|
271
|
-
tools: ReadonlySet<string>;
|
|
272
|
-
agentTypes: ReadonlySet<string>;
|
|
273
|
-
modelAliases?: Readonly<Record<string, string>>;
|
|
274
|
-
knownModels?: ReadonlySet<string>;
|
|
275
|
-
settingsPath?: string;
|
|
276
|
-
skipModelAvailability?: boolean;
|
|
277
|
-
}
|
|
278
|
-
export interface PreflightResult {
|
|
279
|
-
metadata: WorkflowMetadata;
|
|
280
|
-
referenced: {
|
|
281
|
-
phases: readonly string[];
|
|
282
|
-
models: readonly string[];
|
|
283
|
-
tools: readonly string[];
|
|
284
|
-
agentTypes: readonly string[];
|
|
285
|
-
};
|
|
286
|
-
schemas: readonly JsonSchema[];
|
|
287
|
-
dynamicAgentRoles: boolean;
|
|
288
|
-
}
|
|
289
|
-
export interface WorkflowOrchestrationContext {
|
|
290
|
-
agent: (...args: readonly unknown[]) => Promise<JsonValue>;
|
|
291
|
-
shell: (command: string, options?: ShellOptions) => Promise<ShellResult>;
|
|
292
|
-
prompt: (template: string, values: Readonly<Record<string, JsonValue>>) => string;
|
|
293
|
-
parallel: (...args: readonly unknown[]) => Promise<JsonValue>;
|
|
294
|
-
pipeline: (...args: readonly unknown[]) => Promise<JsonValue>;
|
|
295
|
-
withWorktree: {
|
|
296
|
-
(callback: WorkflowWorktreeCallback): Promise<JsonValue>;
|
|
297
|
-
(name: string, callback: WorkflowWorktreeCallback): Promise<JsonValue>;
|
|
298
|
-
};
|
|
299
|
-
checkpoint: (...args: readonly unknown[]) => Promise<boolean>;
|
|
300
|
-
phase: (name: string) => void;
|
|
301
|
-
log: (message: string) => void;
|
|
302
|
-
}
|
|
303
|
-
export interface WorkflowRunContext {
|
|
304
|
-
cwd: string;
|
|
305
|
-
sessionId: string;
|
|
306
|
-
runId: string;
|
|
307
|
-
workflow: Readonly<WorkflowMetadata>;
|
|
308
|
-
args: JsonValue;
|
|
309
|
-
signal: AbortSignal;
|
|
310
|
-
}
|
|
311
|
-
export interface WorkflowFunctionContext extends WorkflowOrchestrationContext {
|
|
312
|
-
run: Readonly<WorkflowRunContext>;
|
|
313
|
-
invoke: (name: string, input: Readonly<Record<string, JsonValue>>) => Promise<JsonValue>;
|
|
314
|
-
}
|
|
315
|
-
export type WorkflowWorktreeCallback = (reference: Readonly<WorkflowWorktreeReference>) => JsonValue | Promise<JsonValue>;
|
|
316
|
-
export interface WorkflowFunction {
|
|
317
|
-
description: string;
|
|
318
|
-
input: JsonSchema;
|
|
319
|
-
output: JsonSchema;
|
|
320
|
-
run: (input: Readonly<Record<string, JsonValue>>, context: Readonly<WorkflowFunctionContext>) => Promise<JsonValue> | JsonValue;
|
|
321
|
-
}
|
|
322
|
-
export interface WorkflowVariable {
|
|
323
|
-
description: string;
|
|
324
|
-
schema: JsonSchema;
|
|
325
|
-
resolve: (run: Readonly<WorkflowRunContext>) => Promise<JsonValue> | JsonValue;
|
|
326
|
-
}
|
|
327
|
-
export interface WorkflowExtension {
|
|
328
|
-
version: string;
|
|
329
|
-
headline: string;
|
|
330
|
-
description: string;
|
|
331
|
-
functions?: Readonly<Record<string, WorkflowFunction>>;
|
|
332
|
-
variables?: Readonly<Record<string, WorkflowVariable>>;
|
|
333
|
-
agentSetupHooks?: Readonly<Record<string, AgentSetupHook>>;
|
|
334
|
-
}
|
|
335
|
-
export interface WorkflowJournal {
|
|
336
|
-
get(path: string): JsonValue | undefined;
|
|
337
|
-
put(path: string, value: JsonValue): void;
|
|
338
|
-
}
|
|
339
|
-
export declare class WorkflowError extends Error {
|
|
340
|
-
readonly code: WorkflowErrorCode;
|
|
341
|
-
constructor(code: WorkflowErrorCode, message: string);
|
|
342
|
-
}
|
|
343
|
-
export interface WorkflowFailureAgent {
|
|
344
|
-
id: string;
|
|
345
|
-
label?: string;
|
|
346
|
-
role?: string;
|
|
347
|
-
structuralPath: readonly string[];
|
|
348
|
-
attempt: number;
|
|
349
|
-
sessionId?: string;
|
|
350
|
-
sessionFile?: string;
|
|
351
|
-
}
|
|
352
|
-
export interface WorkflowSiblingAgent {
|
|
353
|
-
id: string;
|
|
354
|
-
label?: string;
|
|
355
|
-
role?: string;
|
|
356
|
-
structuralPath: readonly string[];
|
|
357
|
-
}
|
|
358
|
-
export interface WorkflowFailureDiagnostics {
|
|
359
|
-
runId: string;
|
|
360
|
-
workflowName: string;
|
|
361
|
-
state: RunState;
|
|
362
|
-
failedAt: string | null;
|
|
363
|
-
error: WorkflowErrorShape;
|
|
364
|
-
failedAgent?: WorkflowFailureAgent;
|
|
365
|
-
completedSiblingAgents?: readonly WorkflowSiblingAgent[];
|
|
366
|
-
completedSiblingPaths: readonly (readonly string[])[];
|
|
367
|
-
artifacts: {
|
|
368
|
-
runDirectory: string;
|
|
369
|
-
statePath: string;
|
|
370
|
-
journalPath: string;
|
|
371
|
-
};
|
|
372
|
-
}
|
|
373
|
-
export declare function formatWorkflowFailure(error: unknown): string;
|
|
374
|
-
export declare class RunLifecycle {
|
|
375
|
-
#private;
|
|
376
|
-
private readonly changed?;
|
|
377
|
-
constructor(state?: RunState, changed?: ((state: RunState, previousState: RunState, reason?: string) => void | Promise<void>) | undefined);
|
|
378
|
-
get state(): RunState;
|
|
379
|
-
enter(): Promise<void>;
|
|
380
|
-
leave(): Promise<void>;
|
|
381
|
-
enterAwaitingInput(): Promise<void>;
|
|
382
|
-
resolveAwaitingInput(): Promise<void>;
|
|
383
|
-
pause(): Promise<void>;
|
|
384
|
-
resume(): Promise<void>;
|
|
385
|
-
providerPause(): Promise<void>;
|
|
386
|
-
terminal(state: "completed" | "failed" | "stopped" | "interrupted" | "budget_exhausted", reason?: string): Promise<void>;
|
|
387
|
-
}
|
|
388
|
-
export declare const DEFAULT_SETTINGS: Readonly<WorkflowSettings>;
|
|
389
|
-
declare function object(value: unknown): value is Record<string, unknown>;
|
|
390
|
-
export { object as isObject };
|
|
391
|
-
export declare function validateBudget(value: unknown): WorkflowBudget | undefined;
|
|
392
|
-
export declare function validateBudgetPatch(value: unknown): WorkflowBudgetPatch;
|
|
393
|
-
export declare class WorkflowBudgetRuntime {
|
|
394
|
-
#private;
|
|
395
|
-
readonly budget: WorkflowBudget | undefined;
|
|
396
|
-
readonly version: number;
|
|
397
|
-
constructor(budget: WorkflowBudget | undefined, version?: number, usage?: Partial<WorkflowBudgetUsage>, events?: readonly BudgetEvent[], options?: {
|
|
398
|
-
now?: () => number;
|
|
399
|
-
onChange?: () => void;
|
|
400
|
-
active?: boolean;
|
|
401
|
-
});
|
|
402
|
-
get usage(): WorkflowBudgetUsage;
|
|
403
|
-
get events(): readonly BudgetEvent[];
|
|
404
|
-
get hardExhausted(): boolean;
|
|
405
|
-
checkAgentLaunch(): void;
|
|
406
|
-
beforeAttempt(): void;
|
|
407
|
-
beforeTurn(): void;
|
|
408
|
-
afterTurn(accounting: AgentAccounting, final: boolean): void;
|
|
409
|
-
instruction(agentId?: string): string | undefined;
|
|
410
|
-
forAgent(agentId: string): AgentBudgetHooks;
|
|
411
|
-
transition(state: RunState): void;
|
|
412
|
-
recordEvent(event: BudgetEvent): void;
|
|
413
|
-
snapshot(): {
|
|
414
|
-
usage: WorkflowBudgetUsage;
|
|
415
|
-
budgetEvents: readonly BudgetEvent[];
|
|
416
|
-
};
|
|
417
|
-
}
|
|
418
|
-
export declare function mergeBudget(budget: WorkflowBudget | undefined, patch: WorkflowBudgetPatch): WorkflowBudget | undefined;
|
|
419
|
-
export declare function budgetRelaxed(previous: WorkflowBudget | undefined, next: WorkflowBudget | undefined): boolean;
|
|
420
|
-
export declare function exhaustedBudgetDimensions(budget: WorkflowBudget | undefined, usage: WorkflowBudgetUsage): BudgetDimension[];
|
|
421
|
-
export declare function resumeBudgetAllowed(budget: WorkflowBudget | undefined, usage: WorkflowBudgetUsage): boolean;
|
|
422
|
-
export declare function parseModelReference(value: string): ModelSpec;
|
|
423
|
-
export declare function validateModelAliases(value: unknown, settingsPath?: string): Readonly<Record<string, string>>;
|
|
424
|
-
export declare function resolveModelReference(value: string, aliases?: Readonly<Record<string, string>>, knownModels?: ReadonlySet<string>, settingsPath?: string): ModelSpec;
|
|
425
|
-
export interface CheckpointInput {
|
|
426
|
-
name: string;
|
|
427
|
-
prompt: string;
|
|
428
|
-
context: JsonValue;
|
|
429
|
-
}
|
|
430
|
-
export declare function validateCheckpoint(value: unknown): CheckpointInput;
|
|
431
|
-
export declare function workflowSettingsPath(agentDir?: string): string;
|
|
432
|
-
export declare function workflowProjectSettingsPath(cwd: string): string;
|
|
433
|
-
export declare function mergeAgentResourceExclusions(...values: (AgentResourceExclusions | undefined)[]): AgentResourceExclusions;
|
|
434
|
-
export declare function loadSettings(path?: string): Readonly<WorkflowSettings>;
|
|
435
|
-
export declare function resolveAgentResourcePolicy(cwd: string, projectTrusted: boolean, globalSettingsPath?: string): AgentResourcePolicy;
|
|
436
|
-
export declare function saveModelAliases(path?: string, aliases?: Readonly<Record<string, string>>): void;
|
|
437
|
-
export declare function parseRoleMarkdown(content: string, strict?: boolean, rolePath?: string): AgentDefinition;
|
|
438
|
-
export declare function workflowRoleDirectories(agentDir?: string): readonly string[];
|
|
439
|
-
export declare function loadAgentDefinitions(cwd: string, agentDir?: string, projectTrusted?: boolean): Readonly<Record<string, AgentDefinition>>;
|
|
440
|
-
export type StaticWorkflowExecution = "parallel" | "sequential";
|
|
441
|
-
export interface StaticWorkflowScope {
|
|
442
|
-
kind: "parallel" | "pipeline";
|
|
443
|
-
name: string | null;
|
|
444
|
-
key: string | null;
|
|
445
|
-
}
|
|
446
|
-
export interface StaticWorkflowCall {
|
|
447
|
-
kind: WorkflowCallKind;
|
|
448
|
-
start: number;
|
|
449
|
-
end: number;
|
|
450
|
-
name: string | null;
|
|
451
|
-
prompt: string | null;
|
|
452
|
-
model: string | null;
|
|
453
|
-
label?: string | null;
|
|
454
|
-
role: string | null;
|
|
455
|
-
retries?: number | null;
|
|
456
|
-
outputSchema?: JsonSchema | null;
|
|
457
|
-
options?: Readonly<Record<string, JsonValue>> | null;
|
|
458
|
-
optionKeys?: readonly string[];
|
|
459
|
-
execution?: StaticWorkflowExecution;
|
|
460
|
-
structure?: readonly StaticWorkflowScope[];
|
|
461
|
-
}
|
|
462
|
-
export declare function inspectWorkflowScript(script: string): StaticWorkflowCall[];
|
|
463
|
-
export interface WorkflowCatalogFunction {
|
|
464
|
-
name: string;
|
|
465
|
-
version: string;
|
|
466
|
-
headline: string;
|
|
467
|
-
extensionDescription: string;
|
|
468
|
-
description: string;
|
|
469
|
-
input: JsonSchema;
|
|
470
|
-
output: JsonSchema;
|
|
471
|
-
}
|
|
472
|
-
export interface WorkflowCatalogVariable {
|
|
473
|
-
name: string;
|
|
474
|
-
version: string;
|
|
475
|
-
headline: string;
|
|
476
|
-
extensionDescription: string;
|
|
477
|
-
description: string;
|
|
478
|
-
schema: JsonSchema;
|
|
479
|
-
}
|
|
480
|
-
export interface WorkflowCatalog {
|
|
481
|
-
functions: readonly WorkflowCatalogFunction[];
|
|
482
|
-
variables: readonly WorkflowCatalogVariable[];
|
|
483
|
-
modelAliases?: Readonly<Record<string, string>>;
|
|
484
|
-
}
|
|
485
|
-
export interface WorkflowCatalogIndexFunction {
|
|
486
|
-
name: string;
|
|
487
|
-
description: string;
|
|
488
|
-
input: JsonSchema;
|
|
489
|
-
}
|
|
490
|
-
export interface WorkflowCatalogIndexVariable {
|
|
491
|
-
name: string;
|
|
492
|
-
description: string;
|
|
493
|
-
schema: JsonSchema;
|
|
494
|
-
}
|
|
495
|
-
export interface WorkflowCatalogIndex {
|
|
496
|
-
functions: readonly WorkflowCatalogIndexFunction[];
|
|
497
|
-
variables: readonly WorkflowCatalogIndexVariable[];
|
|
498
|
-
modelAliases?: Readonly<Record<string, string>>;
|
|
499
|
-
}
|
|
500
|
-
export interface WorkflowCatalogError {
|
|
501
|
-
error: {
|
|
502
|
-
code: "NOT_FOUND";
|
|
503
|
-
name: string;
|
|
504
|
-
message: string;
|
|
505
|
-
};
|
|
506
|
-
}
|
|
507
|
-
export declare class WorkflowRegistry {
|
|
508
|
-
#private;
|
|
509
|
-
get frozen(): boolean;
|
|
510
|
-
freeze(): void;
|
|
511
|
-
register(extension: WorkflowExtension): void;
|
|
512
|
-
function(name: string): WorkflowFunction;
|
|
513
|
-
functions(): Readonly<Record<string, WorkflowFunction>>;
|
|
514
|
-
catalog(): WorkflowCatalog;
|
|
515
|
-
catalogIndex(): WorkflowCatalogIndex;
|
|
516
|
-
catalogDetail(name: string): WorkflowCatalogFunction | WorkflowCatalogVariable | WorkflowCatalogError;
|
|
517
|
-
globals(): Readonly<Record<string, {
|
|
518
|
-
name: string;
|
|
519
|
-
}>>;
|
|
520
|
-
invokeFunction(name: string, input: unknown, context: Readonly<WorkflowFunctionContext>, path: string, journal: WorkflowJournal): Promise<JsonValue>;
|
|
521
|
-
variables(): readonly {
|
|
522
|
-
name: string;
|
|
523
|
-
variable: WorkflowVariable;
|
|
524
|
-
}[];
|
|
525
|
-
agentSetupHooks(): readonly RegisteredAgentSetupHook[];
|
|
526
|
-
}
|
|
527
|
-
export declare function registerWorkflowExtension(extension: WorkflowExtension): void;
|
|
528
|
-
export declare function workflowCatalog(): WorkflowCatalog;
|
|
529
|
-
export declare function workflowCatalogIndex(): WorkflowCatalogIndex;
|
|
530
|
-
export declare function workflowCatalogDetail(name: string): WorkflowCatalogFunction | WorkflowCatalogVariable | WorkflowCatalogError;
|
|
531
|
-
export declare function registeredWorkflowFunctions(): Readonly<Record<string, WorkflowFunction>>;
|
|
532
|
-
export declare function formatWorkflowPreview(args: {
|
|
533
|
-
script?: unknown;
|
|
534
|
-
workflow?: unknown;
|
|
535
|
-
name?: unknown;
|
|
536
|
-
description?: unknown;
|
|
537
|
-
}): string;
|
|
538
|
-
export declare const WORKFLOW_TOOL_LABEL = "Workflow";
|
|
539
|
-
export declare const WORKFLOW_TOOL_DESCRIPTION = "Run a deterministic JavaScript workflow";
|
|
540
|
-
export declare const WORKFLOW_TOOL_PROMPT_SNIPPET = "Run a deterministic, resumable JavaScript workflow that orchestrates subagents. Inline scripts require a name; registered functions use their function name. Runs in the background by default; completion arrives as a follow-up message. Foreground results include the completed run ID, and parentRunId reuses matching named worktrees from a terminal run.";
|
|
541
|
-
export declare const WORKFLOW_TOOL_PARAMETERS: Type.TObject<{
|
|
542
|
-
name: Type.TOptional<Type.TString>;
|
|
543
|
-
description: Type.TOptional<Type.TString>;
|
|
544
|
-
script: Type.TOptional<Type.TString>;
|
|
545
|
-
workflow: Type.TOptional<Type.TString>;
|
|
546
|
-
args: Type.TOptional<Type.TUnknown>;
|
|
547
|
-
foreground: Type.TOptional<Type.TBoolean>;
|
|
548
|
-
concurrency: Type.TOptional<Type.TInteger>;
|
|
549
|
-
budget: Type.TOptional<Type.TUnknown>;
|
|
550
|
-
parentRunId: Type.TOptional<Type.TString>;
|
|
551
|
-
}>;
|
|
552
|
-
export declare function preflight(script: string, capabilities: PreflightCapabilities, schemas?: readonly unknown[], metadata?: WorkflowMetadata): PreflightResult;
|
|
553
|
-
export interface WorkflowValidationParameters {
|
|
554
|
-
name?: string;
|
|
555
|
-
description?: string;
|
|
556
|
-
script?: string;
|
|
557
|
-
workflow?: string;
|
|
558
|
-
args?: unknown;
|
|
559
|
-
}
|
|
560
|
-
export interface WorkflowValidationContext {
|
|
561
|
-
cwd: string;
|
|
562
|
-
projectTrusted: boolean;
|
|
563
|
-
availableModels: ReadonlySet<string>;
|
|
564
|
-
rootTools: ReadonlySet<string>;
|
|
565
|
-
modelAliases?: Readonly<Record<string, string>>;
|
|
566
|
-
knownModels?: ReadonlySet<string>;
|
|
567
|
-
settingsPath?: string;
|
|
568
|
-
agentDir?: string;
|
|
569
|
-
}
|
|
570
|
-
export interface ValidatedWorkflowLaunch {
|
|
571
|
-
script: string;
|
|
572
|
-
checked: PreflightResult;
|
|
573
|
-
agentDefinitions: Readonly<Record<string, AgentDefinition>>;
|
|
574
|
-
projectAgentDefinitions: Readonly<Record<string, AgentDefinition>>;
|
|
575
|
-
roleNames: readonly string[];
|
|
576
|
-
functionName?: string;
|
|
577
|
-
}
|
|
578
|
-
export declare function validateWorkflowLaunch(params: WorkflowValidationParameters, context: WorkflowValidationContext): ValidatedWorkflowLaunch;
|
|
579
|
-
type LaunchSnapshotInput = Omit<LaunchSnapshot, "identityVersion"> & {
|
|
580
|
-
identityVersion?: number;
|
|
581
|
-
};
|
|
582
|
-
export declare function createLaunchSnapshot(input: LaunchSnapshotInput): Readonly<LaunchSnapshot>;
|
|
583
|
-
export declare function loadLaunchSnapshot(input: LaunchSnapshot): Readonly<LaunchSnapshot>;
|
|
584
|
-
export declare const RPC_LIMIT_BYTES: number;
|
|
585
|
-
export declare const HEARTBEAT_TIMEOUT_MS = 5000;
|
|
586
|
-
export interface AgentIdentity {
|
|
587
|
-
structuralPath: readonly string[];
|
|
588
|
-
callSite: string;
|
|
589
|
-
occurrence: number;
|
|
590
|
-
parentBreadcrumb?: string;
|
|
591
|
-
worktreeOwner?: string;
|
|
592
|
-
conversation?: {
|
|
593
|
-
name: string;
|
|
594
|
-
turn: number;
|
|
595
|
-
};
|
|
596
|
-
}
|
|
597
|
-
export interface ShellIdentity {
|
|
598
|
-
structuralPath: readonly string[];
|
|
599
|
-
callSite: string;
|
|
600
|
-
occurrence: number;
|
|
601
|
-
worktreeOwner?: string;
|
|
602
|
-
}
|
|
603
|
-
export interface WorkflowBridge {
|
|
604
|
-
agent?: (prompt: string, options: Readonly<Record<string, JsonValue>>, signal: AbortSignal, identity: AgentIdentity) => Promise<JsonValue>;
|
|
605
|
-
shell?: (command: string, options: ShellOptions, signal: AbortSignal, identity: ShellIdentity) => Promise<ShellResult>;
|
|
606
|
-
checkpoint?: (input: Readonly<Record<string, JsonValue>>, signal: AbortSignal) => boolean | Promise<boolean>;
|
|
607
|
-
function?: (name: string, input: Readonly<Record<string, JsonValue>>, path: string, signal: AbortSignal, worktreeOwner?: string, structuralPath?: readonly string[]) => Promise<JsonValue>;
|
|
608
|
-
worktree?: (owner: string, signal: AbortSignal) => Promise<Readonly<WorkflowWorktreeReference>>;
|
|
609
|
-
functions?: Readonly<Record<string, {
|
|
610
|
-
name: string;
|
|
611
|
-
}>>;
|
|
612
|
-
variables?: Readonly<Record<string, JsonValue>>;
|
|
613
|
-
phase?: (name: string) => void | Promise<void>;
|
|
614
|
-
log?: (message: string) => void | Promise<void>;
|
|
615
|
-
}
|
|
616
|
-
export interface WorkflowExecution {
|
|
617
|
-
result: Promise<JsonValue>;
|
|
618
|
-
cancel: () => void;
|
|
619
|
-
}
|
|
620
|
-
export declare function runWorkflow(script: string, args?: JsonValue, bridge?: WorkflowBridge, signal?: AbortSignal): WorkflowExecution;
|
|
621
|
-
export declare function persistActiveAgentAttempt(store: RunStore, id: string, active: Pick<AgentAttempt, "attempt" | "sessionId" | "sessionFile" | "setup">): Promise<void>;
|
|
622
|
-
export declare function persistAgentAttempts(store: RunStore, id: string, attempts: readonly AgentAttempt[]): Promise<void>;
|
|
623
|
-
export declare function formatWorkflowProgress(run: PersistedRun, spinner?: string): string;
|
|
624
|
-
export declare function formatBudgetStatus(run: Pick<PersistedRun, "budget" | "budgetVersion" | "usage" | "budgetEvents">): string[];
|
|
625
|
-
export declare function formatNavigatorDashboard(run: PersistedRun, checkpoints: readonly AwaitingCheckpoint[], worktrees: readonly WorktreeReference[]): string;
|
|
626
|
-
export declare function formatNavigatorRun(loaded: {
|
|
627
|
-
run: PersistedRun;
|
|
628
|
-
snapshot: Readonly<LaunchSnapshot>;
|
|
629
|
-
}, checkpoints: readonly AwaitingCheckpoint[], _worktrees: readonly WorktreeReference[]): string;
|
|
630
|
-
export declare function formatWorkflowFailureDiagnostics(diagnostic: WorkflowFailureDiagnostics): string;
|
|
631
|
-
export default function workflowExtension(pi: ExtensionAPI, home?: string, clipboard?: typeof copyToClipboard, createSession?: SessionFactory, agentDir?: string): void;
|
|
632
|
-
export { acquireSessionLease, projectStorageKey, RunStore, runsDirectory, SessionLease, structuralPath } from "./persistence.js";
|
|
633
|
-
export type { AwaitingCheckpoint, CompletedOperation, ConversationHead, NativeSessionReference, PendingWorkflowDecision, PersistedConversation, PersistedOwnershipNode, PersistedRun, WorktreeReference } from "./persistence.js";
|
|
1
|
+
export * from "./types.js";
|
|
2
|
+
export * from "./utils.js";
|
|
3
|
+
export * from "./budget.js";
|
|
4
|
+
export * from "./validation.js";
|
|
5
|
+
export * from "./registry.js";
|
|
6
|
+
export * from "./execution.js";
|
|
7
|
+
export * from "./host.js";
|
|
8
|
+
export { default } from "./host.js";
|
|
9
|
+
export { acquireSessionLease, hasLiveSessionLease, projectSessionsDirectory, projectStorageKey, RunStore, runsDirectory, SessionLease, structuralPath } from "./persistence.js";
|
|
10
|
+
export type { AwaitingCheckpoint, CompletedOperation, NativeSessionReference, PendingWorkflowDecision, PersistedOwnershipNode, PersistedRun, WorktreeReference } from "./persistence.js";
|
|
634
11
|
export { FairAgentScheduler, WorkflowAgentExecutor } from "./agent-execution.js";
|
|
635
|
-
export type {
|
|
12
|
+
export type { AgentAttempt, AgentBudgetHooks, AgentExecutionOptions, AgentExecutionResult, AgentExecutionRoot, AgentProgress, AgentProviderFailure, AgentProviderRecovery, AgentToolCallProgress, AgentSetup, AgentSetupContext, AgentSetupHook, NativeSession, RegisteredAgentSetupHook, SessionFactory, SessionInput } from "./agent-execution.js";
|
|
636
13
|
export { doctor, doctorExitCode, formatDoctorReport } from "./doctor.js";
|
|
637
14
|
export type { DoctorDiagnostic, DoctorFunction, DoctorOptions, DoctorPiState, DoctorReport, DoctorRole, DoctorSeverity, DoctorTrust } from "./doctor.js";
|
|
15
|
+
export { doctorCleanup, doctorCleanupExitCode, formatDoctorCleanupReport } from "./doctor-cleanup.js";
|
|
16
|
+
export type { CleanupFailure, CleanupRunResult, CleanupSessionReport, DoctorCleanupOptions, DoctorCleanupReport } from "./doctor-cleanup.js";
|