pi-extensible-workflows 0.3.2 → 1.0.1
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 +9 -0
- package/dist/src/agent-execution.d.ts +81 -8
- package/dist/src/agent-execution.js +465 -75
- package/dist/src/ambient-workflow-evals.js +14 -33
- package/dist/src/doctor.d.ts +4 -1
- package/dist/src/doctor.js +57 -14
- package/dist/src/index.d.ts +222 -24
- package/dist/src/index.js +1548 -410
- package/dist/src/persistence.d.ts +28 -1
- package/dist/src/persistence.js +126 -9
- package/dist/src/session-inspector.d.ts +13 -1
- package/dist/src/session-inspector.js +22 -4
- package/dist/src/workflow-evals.d.ts +1 -0
- package/dist/src/workflow-evals.js +23 -25
- package/package.json +5 -2
- package/skills/pi-extensible-workflows/SKILL.md +14 -6
- package/src/agent-execution.ts +391 -86
- package/src/ambient-workflow-evals.ts +18 -28
- package/src/doctor.ts +60 -16
- package/src/index.ts +1332 -395
- package/src/persistence.ts +98 -10
- package/src/session-inspector.ts +25 -7
- package/src/workflow-evals.ts +13 -16
package/dist/src/index.d.ts
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import { Type } from "@earendil-works/pi-ai";
|
|
2
2
|
import { copyToClipboard, type ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
3
|
-
import { type AgentActivity, type AgentAttempt, type AgentDefinition, type SessionFactory } from "./agent-execution.js";
|
|
3
|
+
import { type AgentActivity, type AgentAccounting, type AgentAttempt, type AgentBudgetHooks, type AgentDefinition, type AgentSetupHook, type RegisteredAgentSetupHook, type SessionFactory } from "./agent-execution.js";
|
|
4
4
|
import { RunStore } from "./persistence.js";
|
|
5
5
|
import type { AwaitingCheckpoint, PersistedRun, WorktreeReference } from "./persistence.js";
|
|
6
|
-
export declare const RUN_STATES: readonly ["queued", "running", "pausing", "paused", "awaiting_input", "completed", "failed", "stopped", "interrupted"];
|
|
6
|
+
export declare const RUN_STATES: readonly ["queued", "running", "pausing", "paused", "awaiting_input", "completed", "failed", "stopped", "interrupted", "budget_exhausted"];
|
|
7
7
|
export declare const AGENT_STATES: readonly ["queued", "running", "waiting_for_child", "paused", "retrying", "completed", "failed", "cancelled"];
|
|
8
|
-
export declare const
|
|
9
|
-
export
|
|
10
|
-
export declare const
|
|
8
|
+
export declare const WORKFLOW_CALL_KINDS: readonly ["agent", "conversation", "parallel", "pipeline", "checkpoint", "phase", "withWorktree"];
|
|
9
|
+
export type WorkflowCallKind = (typeof WORKFLOW_CALL_KINDS)[number];
|
|
10
|
+
export declare const WORKFLOW_RUN_STARTED_EVENT = "workflow:run-started";
|
|
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", "AGENT_TIMEOUT", "AGENT_FAILED", "RESULT_INVALID", "CANCELLED", "WORKER_UNRESPONSIVE", "WORKTREE_FAILED", "RESUME_INCOMPATIBLE", "BUDGET_EXHAUSTED", "INTERNAL_ERROR"];
|
|
11
21
|
export type RunState = (typeof RUN_STATES)[number];
|
|
12
22
|
export type AgentState = (typeof AGENT_STATES)[number];
|
|
13
23
|
export type WorkflowErrorCode = (typeof ERROR_CODES)[number];
|
|
@@ -17,10 +27,100 @@ export type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
|
17
27
|
export type JsonSchema = {
|
|
18
28
|
[key: string]: JsonValue;
|
|
19
29
|
};
|
|
30
|
+
export type BudgetDimension = "tokens" | "costUsd" | "durationMs" | "agentLaunches";
|
|
31
|
+
export interface BudgetLimits {
|
|
32
|
+
soft?: number;
|
|
33
|
+
hard?: number;
|
|
34
|
+
}
|
|
35
|
+
export type WorkflowBudget = Partial<Record<BudgetDimension, BudgetLimits>>;
|
|
36
|
+
export type WorkflowBudgetPatch = Partial<Record<BudgetDimension, BudgetLimits | {
|
|
37
|
+
soft?: number | null;
|
|
38
|
+
hard?: number | null;
|
|
39
|
+
} | null>>;
|
|
40
|
+
export interface WorkflowBudgetUsage {
|
|
41
|
+
tokens: number;
|
|
42
|
+
costUsd: number;
|
|
43
|
+
durationMs: number;
|
|
44
|
+
agentLaunches: number;
|
|
45
|
+
}
|
|
46
|
+
export type BudgetEventType = "soft_crossed" | "hard_overrun" | "hard_exhausted" | "adjustment_requested" | "adjustment_approved" | "adjustment_rejected";
|
|
47
|
+
export interface BudgetEvent {
|
|
48
|
+
type: BudgetEventType;
|
|
49
|
+
budgetVersion: number;
|
|
50
|
+
dimensions: readonly BudgetDimension[];
|
|
51
|
+
usage: WorkflowBudgetUsage;
|
|
52
|
+
limits: WorkflowBudget;
|
|
53
|
+
at: number;
|
|
54
|
+
proposalId?: string;
|
|
55
|
+
previous?: WorkflowBudget;
|
|
56
|
+
proposed?: WorkflowBudget;
|
|
57
|
+
}
|
|
58
|
+
export interface BudgetApprovalRequest {
|
|
59
|
+
kind: "budget";
|
|
60
|
+
proposalId: string;
|
|
61
|
+
runId: string;
|
|
62
|
+
consumed: WorkflowBudgetUsage;
|
|
63
|
+
previous: WorkflowBudget;
|
|
64
|
+
proposed: WorkflowBudget;
|
|
65
|
+
budgetVersion: number;
|
|
66
|
+
}
|
|
20
67
|
export interface WorkflowErrorShape {
|
|
21
68
|
code: WorkflowErrorCode;
|
|
22
69
|
message: string;
|
|
23
70
|
}
|
|
71
|
+
export interface WorkflowEventBase {
|
|
72
|
+
runId: string;
|
|
73
|
+
sessionId: string;
|
|
74
|
+
workflowName: string;
|
|
75
|
+
cwd: string;
|
|
76
|
+
runDirectory: string;
|
|
77
|
+
timestamp: number;
|
|
78
|
+
}
|
|
79
|
+
export type WorkflowRunStartedEvent = WorkflowEventBase;
|
|
80
|
+
export type WorkflowRunResumedEvent = WorkflowEventBase;
|
|
81
|
+
export interface WorkflowRunStateChangedEvent extends WorkflowEventBase {
|
|
82
|
+
previousState: RunState;
|
|
83
|
+
state: RunState;
|
|
84
|
+
reason?: string;
|
|
85
|
+
errorCode?: WorkflowErrorCode;
|
|
86
|
+
}
|
|
87
|
+
export interface WorkflowRunCompletedEvent extends WorkflowEventBase {
|
|
88
|
+
resultPath: string;
|
|
89
|
+
}
|
|
90
|
+
export interface WorkflowRunFailedEvent extends WorkflowEventBase {
|
|
91
|
+
error: WorkflowErrorShape;
|
|
92
|
+
}
|
|
93
|
+
export interface WorkflowAgentStateChangedEvent extends WorkflowEventBase {
|
|
94
|
+
agentId: string;
|
|
95
|
+
displayLabel: string;
|
|
96
|
+
role?: string;
|
|
97
|
+
structuralPath: readonly string[];
|
|
98
|
+
parentId?: string;
|
|
99
|
+
parentBreadcrumb?: string;
|
|
100
|
+
worktreeOwner?: string;
|
|
101
|
+
previousState?: AgentState;
|
|
102
|
+
state: AgentState;
|
|
103
|
+
attempt: number;
|
|
104
|
+
}
|
|
105
|
+
export interface WorkflowPhaseChangedEvent extends WorkflowEventBase {
|
|
106
|
+
previousPhase?: string;
|
|
107
|
+
phase: string;
|
|
108
|
+
}
|
|
109
|
+
export type WorkflowCheckpointState = "awaiting" | "approved" | "rejected";
|
|
110
|
+
export interface WorkflowCheckpointStateChangedEvent extends WorkflowEventBase {
|
|
111
|
+
name: string;
|
|
112
|
+
state: WorkflowCheckpointState;
|
|
113
|
+
}
|
|
114
|
+
export interface WorkflowBudgetEvent extends WorkflowEventBase {
|
|
115
|
+
type: BudgetEventType;
|
|
116
|
+
budgetVersion: number;
|
|
117
|
+
dimensions: readonly BudgetDimension[];
|
|
118
|
+
usage: WorkflowBudgetUsage;
|
|
119
|
+
limits: WorkflowBudget;
|
|
120
|
+
proposalId?: string;
|
|
121
|
+
previous?: WorkflowBudget;
|
|
122
|
+
proposed?: WorkflowBudget;
|
|
123
|
+
}
|
|
24
124
|
export interface ModelSpec {
|
|
25
125
|
provider: string;
|
|
26
126
|
model: string;
|
|
@@ -32,7 +132,34 @@ export interface WorkflowMetadata {
|
|
|
32
132
|
}
|
|
33
133
|
export interface WorkflowSettings {
|
|
34
134
|
concurrency: number;
|
|
35
|
-
|
|
135
|
+
modelAliases?: Readonly<Record<string, string>>;
|
|
136
|
+
disabledAgentResources?: Readonly<AgentResourceExclusions>;
|
|
137
|
+
}
|
|
138
|
+
export interface AgentResourceExclusions {
|
|
139
|
+
skills: readonly string[];
|
|
140
|
+
extensions: readonly string[];
|
|
141
|
+
}
|
|
142
|
+
export interface AgentResourcePolicy {
|
|
143
|
+
globalSettingsPath: string;
|
|
144
|
+
projectSettingsPath: string;
|
|
145
|
+
projectTrusted: boolean;
|
|
146
|
+
global: AgentResourceExclusions;
|
|
147
|
+
project: AgentResourceExclusions;
|
|
148
|
+
effective: AgentResourceExclusions;
|
|
149
|
+
unmatchedSkills: string[];
|
|
150
|
+
unmatchedExtensions: string[];
|
|
151
|
+
}
|
|
152
|
+
export interface AgentSetupSummary {
|
|
153
|
+
hookNames: readonly string[];
|
|
154
|
+
model: ModelSpec;
|
|
155
|
+
tools: readonly string[];
|
|
156
|
+
cwd: string;
|
|
157
|
+
disabledAgentResources?: {
|
|
158
|
+
skills: readonly string[];
|
|
159
|
+
extensions: readonly string[];
|
|
160
|
+
unmatchedSkills: readonly string[];
|
|
161
|
+
unmatchedExtensions: readonly string[];
|
|
162
|
+
};
|
|
36
163
|
}
|
|
37
164
|
export interface AgentAttemptSummary {
|
|
38
165
|
attempt: number;
|
|
@@ -49,6 +176,13 @@ export interface AgentAttemptSummary {
|
|
|
49
176
|
cacheWrite: number;
|
|
50
177
|
cost: number;
|
|
51
178
|
};
|
|
179
|
+
setup?: AgentSetupSummary;
|
|
180
|
+
}
|
|
181
|
+
export interface WorkflowWorktreeCreatedEvent extends WorkflowEventBase {
|
|
182
|
+
owner: string;
|
|
183
|
+
branch: string;
|
|
184
|
+
path: string;
|
|
185
|
+
base: string;
|
|
52
186
|
}
|
|
53
187
|
export interface AgentRecord {
|
|
54
188
|
id: string;
|
|
@@ -57,8 +191,11 @@ export interface AgentRecord {
|
|
|
57
191
|
path: string;
|
|
58
192
|
state: AgentState;
|
|
59
193
|
parentId?: string;
|
|
194
|
+
structuralPath?: readonly string[];
|
|
60
195
|
parentBreadcrumb?: string;
|
|
196
|
+
worktreeOwner?: string;
|
|
61
197
|
role?: string;
|
|
198
|
+
requestedModel?: string;
|
|
62
199
|
model: ModelSpec;
|
|
63
200
|
tools: readonly string[];
|
|
64
201
|
attempts: number;
|
|
@@ -77,6 +214,10 @@ export interface AgentRecord {
|
|
|
77
214
|
}[];
|
|
78
215
|
activity?: AgentActivity | undefined;
|
|
79
216
|
}
|
|
217
|
+
export interface WorkflowRunEvent {
|
|
218
|
+
type: string;
|
|
219
|
+
message: string;
|
|
220
|
+
}
|
|
80
221
|
export interface RunRecord {
|
|
81
222
|
id: string;
|
|
82
223
|
workflowName: string;
|
|
@@ -86,13 +227,22 @@ export interface RunRecord {
|
|
|
86
227
|
phase?: string;
|
|
87
228
|
agents: readonly AgentRecord[];
|
|
88
229
|
error?: WorkflowErrorShape;
|
|
230
|
+
budget?: WorkflowBudget;
|
|
231
|
+
budgetVersion?: number;
|
|
232
|
+
usage?: WorkflowBudgetUsage;
|
|
233
|
+
budgetEvents?: readonly BudgetEvent[];
|
|
234
|
+
events?: readonly WorkflowRunEvent[];
|
|
89
235
|
}
|
|
236
|
+
export declare const LAUNCH_SNAPSHOT_IDENTITY_VERSION = 3;
|
|
90
237
|
export interface LaunchSnapshot {
|
|
91
238
|
identityVersion?: number;
|
|
92
239
|
script: string;
|
|
93
240
|
args: JsonValue;
|
|
94
241
|
metadata: WorkflowMetadata;
|
|
95
242
|
settings: WorkflowSettings;
|
|
243
|
+
budget?: WorkflowBudget;
|
|
244
|
+
settingsPath?: string;
|
|
245
|
+
modelAliases?: Readonly<Record<string, string>>;
|
|
96
246
|
models: readonly string[];
|
|
97
247
|
tools: readonly string[];
|
|
98
248
|
agentTypes: readonly string[];
|
|
@@ -104,6 +254,10 @@ export interface PreflightCapabilities {
|
|
|
104
254
|
models: ReadonlySet<string>;
|
|
105
255
|
tools: ReadonlySet<string>;
|
|
106
256
|
agentTypes: ReadonlySet<string>;
|
|
257
|
+
modelAliases?: Readonly<Record<string, string>>;
|
|
258
|
+
knownModels?: ReadonlySet<string>;
|
|
259
|
+
settingsPath?: string;
|
|
260
|
+
skipModelAvailability?: boolean;
|
|
107
261
|
}
|
|
108
262
|
export interface PreflightResult {
|
|
109
263
|
metadata: WorkflowMetadata;
|
|
@@ -136,6 +290,7 @@ export interface WorkflowRunContext {
|
|
|
136
290
|
}
|
|
137
291
|
export interface WorkflowFunctionContext extends WorkflowOrchestrationContext {
|
|
138
292
|
run: Readonly<WorkflowRunContext>;
|
|
293
|
+
invoke: (name: string, input: Readonly<Record<string, JsonValue>>) => Promise<JsonValue>;
|
|
139
294
|
}
|
|
140
295
|
export interface WorkflowFunction {
|
|
141
296
|
description: string;
|
|
@@ -153,13 +308,13 @@ export interface WorkflowScriptDefinition {
|
|
|
153
308
|
script: string;
|
|
154
309
|
}
|
|
155
310
|
export interface WorkflowExtension {
|
|
156
|
-
namespace: string;
|
|
157
311
|
version: string;
|
|
158
312
|
headline: string;
|
|
159
313
|
description: string;
|
|
160
314
|
functions?: Readonly<Record<string, WorkflowFunction>>;
|
|
161
315
|
variables?: Readonly<Record<string, WorkflowVariable>>;
|
|
162
316
|
workflows?: Readonly<Record<string, WorkflowScriptDefinition>>;
|
|
317
|
+
agentSetupHooks?: Readonly<Record<string, AgentSetupHook>>;
|
|
163
318
|
}
|
|
164
319
|
export interface WorkflowJournal {
|
|
165
320
|
get(path: string): JsonValue | undefined;
|
|
@@ -173,7 +328,7 @@ export declare function formatWorkflowFailure(error: unknown): string;
|
|
|
173
328
|
export declare class RunLifecycle {
|
|
174
329
|
#private;
|
|
175
330
|
private readonly changed?;
|
|
176
|
-
constructor(state?: RunState, changed?: ((state: RunState) => void | Promise<void>) | undefined);
|
|
331
|
+
constructor(state?: RunState, changed?: ((state: RunState, previousState: RunState, reason?: string) => void | Promise<void>) | undefined);
|
|
177
332
|
get state(): RunState;
|
|
178
333
|
enter(): Promise<void>;
|
|
179
334
|
leave(): Promise<void>;
|
|
@@ -182,10 +337,45 @@ export declare class RunLifecycle {
|
|
|
182
337
|
pause(): Promise<void>;
|
|
183
338
|
resume(): Promise<void>;
|
|
184
339
|
providerPause(): Promise<void>;
|
|
185
|
-
terminal(state: "completed" | "failed" | "stopped" | "interrupted"): Promise<void>;
|
|
340
|
+
terminal(state: "completed" | "failed" | "stopped" | "interrupted" | "budget_exhausted", reason?: string): Promise<void>;
|
|
186
341
|
}
|
|
187
342
|
export declare const DEFAULT_SETTINGS: Readonly<WorkflowSettings>;
|
|
343
|
+
declare function object(value: unknown): value is Record<string, unknown>;
|
|
344
|
+
export { object as isObject };
|
|
345
|
+
export declare function validateBudget(value: unknown): WorkflowBudget | undefined;
|
|
346
|
+
export declare function validateBudgetPatch(value: unknown): WorkflowBudgetPatch;
|
|
347
|
+
export declare class WorkflowBudgetRuntime {
|
|
348
|
+
#private;
|
|
349
|
+
readonly budget: WorkflowBudget | undefined;
|
|
350
|
+
readonly version: number;
|
|
351
|
+
constructor(budget: WorkflowBudget | undefined, version?: number, usage?: Partial<WorkflowBudgetUsage>, events?: readonly BudgetEvent[], options?: {
|
|
352
|
+
now?: () => number;
|
|
353
|
+
onChange?: () => void;
|
|
354
|
+
active?: boolean;
|
|
355
|
+
});
|
|
356
|
+
get usage(): WorkflowBudgetUsage;
|
|
357
|
+
get events(): readonly BudgetEvent[];
|
|
358
|
+
get hardExhausted(): boolean;
|
|
359
|
+
checkAgentLaunch(): void;
|
|
360
|
+
beforeAttempt(): void;
|
|
361
|
+
beforeTurn(): void;
|
|
362
|
+
afterTurn(accounting: AgentAccounting, final: boolean): void;
|
|
363
|
+
instruction(agentId?: string): string | undefined;
|
|
364
|
+
forAgent(agentId: string): AgentBudgetHooks;
|
|
365
|
+
transition(state: RunState): void;
|
|
366
|
+
recordEvent(event: BudgetEvent): void;
|
|
367
|
+
snapshot(): {
|
|
368
|
+
usage: WorkflowBudgetUsage;
|
|
369
|
+
budgetEvents: readonly BudgetEvent[];
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
export declare function mergeBudget(budget: WorkflowBudget | undefined, patch: WorkflowBudgetPatch): WorkflowBudget | undefined;
|
|
373
|
+
export declare function budgetRelaxed(previous: WorkflowBudget | undefined, next: WorkflowBudget | undefined): boolean;
|
|
374
|
+
export declare function exhaustedBudgetDimensions(budget: WorkflowBudget | undefined, usage: WorkflowBudgetUsage): BudgetDimension[];
|
|
375
|
+
export declare function resumeBudgetAllowed(budget: WorkflowBudget | undefined, usage: WorkflowBudgetUsage): boolean;
|
|
188
376
|
export declare function parseModelReference(value: string): ModelSpec;
|
|
377
|
+
export declare function validateModelAliases(value: unknown, settingsPath?: string): Readonly<Record<string, string>>;
|
|
378
|
+
export declare function resolveModelReference(value: string, aliases?: Readonly<Record<string, string>>, knownModels?: ReadonlySet<string>, settingsPath?: string): ModelSpec;
|
|
189
379
|
export interface CheckpointInput {
|
|
190
380
|
name: string;
|
|
191
381
|
prompt: string;
|
|
@@ -193,8 +383,12 @@ export interface CheckpointInput {
|
|
|
193
383
|
}
|
|
194
384
|
export declare function validateCheckpoint(value: unknown): CheckpointInput;
|
|
195
385
|
export declare function workflowSettingsPath(agentDir?: string): string;
|
|
386
|
+
export declare function workflowProjectSettingsPath(cwd: string): string;
|
|
387
|
+
export declare function mergeAgentResourceExclusions(...values: (AgentResourceExclusions | undefined)[]): AgentResourceExclusions;
|
|
196
388
|
export declare function loadSettings(path?: string): Readonly<WorkflowSettings>;
|
|
197
|
-
export declare function
|
|
389
|
+
export declare function resolveAgentResourcePolicy(cwd: string, projectTrusted: boolean, globalSettingsPath?: string): AgentResourcePolicy;
|
|
390
|
+
export declare function saveModelAliases(path?: string, aliases?: Readonly<Record<string, string>>): void;
|
|
391
|
+
export declare function parseRoleMarkdown(content: string, strict?: boolean, rolePath?: string): AgentDefinition;
|
|
198
392
|
export declare function workflowRoleDirectories(agentDir?: string): readonly string[];
|
|
199
393
|
export declare function loadAgentDefinitions(cwd: string, agentDir?: string, projectTrusted?: boolean): Readonly<Record<string, AgentDefinition>>;
|
|
200
394
|
export type StaticWorkflowExecution = "parallel" | "sequential";
|
|
@@ -204,7 +398,7 @@ export interface StaticWorkflowScope {
|
|
|
204
398
|
key: string | null;
|
|
205
399
|
}
|
|
206
400
|
export interface StaticWorkflowCall {
|
|
207
|
-
kind:
|
|
401
|
+
kind: WorkflowCallKind;
|
|
208
402
|
start: number;
|
|
209
403
|
end: number;
|
|
210
404
|
name: string | null;
|
|
@@ -222,7 +416,6 @@ export interface StaticWorkflowCall {
|
|
|
222
416
|
export declare function inspectWorkflowScript(script: string): StaticWorkflowCall[];
|
|
223
417
|
export interface WorkflowCatalogFunction {
|
|
224
418
|
name: string;
|
|
225
|
-
namespace: string;
|
|
226
419
|
version: string;
|
|
227
420
|
headline: string;
|
|
228
421
|
extensionDescription: string;
|
|
@@ -232,7 +425,6 @@ export interface WorkflowCatalogFunction {
|
|
|
232
425
|
}
|
|
233
426
|
export interface WorkflowCatalogVariable {
|
|
234
427
|
name: string;
|
|
235
|
-
namespace: string;
|
|
236
428
|
version: string;
|
|
237
429
|
headline: string;
|
|
238
430
|
extensionDescription: string;
|
|
@@ -241,7 +433,6 @@ export interface WorkflowCatalogVariable {
|
|
|
241
433
|
}
|
|
242
434
|
export interface WorkflowCatalogWorkflow {
|
|
243
435
|
name: string;
|
|
244
|
-
namespace: string;
|
|
245
436
|
version: string;
|
|
246
437
|
headline: string;
|
|
247
438
|
extensionDescription: string;
|
|
@@ -251,6 +442,7 @@ export interface WorkflowCatalog {
|
|
|
251
442
|
functions: readonly WorkflowCatalogFunction[];
|
|
252
443
|
variables: readonly WorkflowCatalogVariable[];
|
|
253
444
|
workflows: readonly WorkflowCatalogWorkflow[];
|
|
445
|
+
modelAliases?: Readonly<Record<string, string>>;
|
|
254
446
|
}
|
|
255
447
|
export declare class WorkflowRegistry {
|
|
256
448
|
#private;
|
|
@@ -261,15 +453,14 @@ export declare class WorkflowRegistry {
|
|
|
261
453
|
workflows(): Readonly<Record<string, WorkflowScriptDefinition>>;
|
|
262
454
|
catalog(): WorkflowCatalog;
|
|
263
455
|
globals(): Readonly<Record<string, {
|
|
264
|
-
namespace: string;
|
|
265
456
|
name: string;
|
|
266
457
|
}>>;
|
|
267
|
-
invokeFunction(
|
|
458
|
+
invokeFunction(name: string, input: unknown, context: Readonly<WorkflowFunctionContext>, path: string, journal: WorkflowJournal): Promise<JsonValue>;
|
|
268
459
|
variables(): readonly {
|
|
269
|
-
namespace: string;
|
|
270
460
|
name: string;
|
|
271
461
|
variable: WorkflowVariable;
|
|
272
462
|
}[];
|
|
463
|
+
agentSetupHooks(): readonly RegisteredAgentSetupHook[];
|
|
273
464
|
}
|
|
274
465
|
export declare function registerWorkflowExtension(extension: WorkflowExtension): void;
|
|
275
466
|
export declare function workflowCatalog(): WorkflowCatalog;
|
|
@@ -291,7 +482,7 @@ export declare const WORKFLOW_TOOL_PARAMETERS: Type.TObject<{
|
|
|
291
482
|
args: Type.TOptional<Type.TUnknown>;
|
|
292
483
|
foreground: Type.TOptional<Type.TBoolean>;
|
|
293
484
|
concurrency: Type.TOptional<Type.TInteger>;
|
|
294
|
-
|
|
485
|
+
budget: Type.TOptional<Type.TUnknown>;
|
|
295
486
|
}>;
|
|
296
487
|
export declare function preflight(script: string, capabilities: PreflightCapabilities, schemas?: readonly unknown[], metadata?: WorkflowMetadata): PreflightResult;
|
|
297
488
|
export interface WorkflowValidationParameters {
|
|
@@ -305,6 +496,9 @@ export interface WorkflowValidationContext {
|
|
|
305
496
|
projectTrusted: boolean;
|
|
306
497
|
availableModels: ReadonlySet<string>;
|
|
307
498
|
rootTools: ReadonlySet<string>;
|
|
499
|
+
modelAliases?: Readonly<Record<string, string>>;
|
|
500
|
+
knownModels?: ReadonlySet<string>;
|
|
501
|
+
settingsPath?: string;
|
|
308
502
|
}
|
|
309
503
|
export interface ValidatedWorkflowLaunch {
|
|
310
504
|
script: string;
|
|
@@ -327,13 +521,16 @@ export interface AgentIdentity {
|
|
|
327
521
|
occurrence: number;
|
|
328
522
|
parentBreadcrumb?: string;
|
|
329
523
|
worktreeOwner?: string;
|
|
524
|
+
conversation?: {
|
|
525
|
+
name: string;
|
|
526
|
+
turn: number;
|
|
527
|
+
};
|
|
330
528
|
}
|
|
331
529
|
export interface WorkflowBridge {
|
|
332
530
|
agent?: (prompt: string, options: Readonly<Record<string, JsonValue>>, signal: AbortSignal, identity: AgentIdentity) => Promise<JsonValue>;
|
|
333
531
|
checkpoint?: (input: Readonly<Record<string, JsonValue>>, signal: AbortSignal) => boolean | Promise<boolean>;
|
|
334
|
-
function?: (
|
|
532
|
+
function?: (name: string, input: Readonly<Record<string, JsonValue>>, path: string, signal: AbortSignal, worktreeOwner?: string, structuralPath?: readonly string[]) => Promise<JsonValue>;
|
|
335
533
|
functions?: Readonly<Record<string, {
|
|
336
|
-
namespace: string;
|
|
337
534
|
name: string;
|
|
338
535
|
}>>;
|
|
339
536
|
variables?: Readonly<Record<string, JsonValue>>;
|
|
@@ -345,18 +542,19 @@ export interface WorkflowExecution {
|
|
|
345
542
|
cancel: () => void;
|
|
346
543
|
}
|
|
347
544
|
export declare function runWorkflow(script: string, args?: JsonValue, bridge?: WorkflowBridge, signal?: AbortSignal): WorkflowExecution;
|
|
348
|
-
export declare function persistActiveAgentAttempt(store: RunStore, id: string, active: Pick<AgentAttempt, "attempt" | "sessionId" | "sessionFile">): Promise<void>;
|
|
545
|
+
export declare function persistActiveAgentAttempt(store: RunStore, id: string, active: Pick<AgentAttempt, "attempt" | "sessionId" | "sessionFile" | "setup">): Promise<void>;
|
|
349
546
|
export declare function persistAgentAttempts(store: RunStore, id: string, attempts: readonly AgentAttempt[]): Promise<void>;
|
|
350
547
|
export declare function formatWorkflowProgress(run: PersistedRun, spinner?: string): string;
|
|
548
|
+
export declare function formatBudgetStatus(run: Pick<PersistedRun, "budget" | "budgetVersion" | "usage" | "budgetEvents">): string[];
|
|
351
549
|
export declare function formatNavigatorDashboard(run: PersistedRun, checkpoints: readonly AwaitingCheckpoint[], worktrees: readonly WorktreeReference[]): string;
|
|
352
550
|
export declare function formatNavigatorRun(loaded: {
|
|
353
551
|
run: PersistedRun;
|
|
354
552
|
snapshot: Readonly<LaunchSnapshot>;
|
|
355
|
-
}, checkpoints: readonly AwaitingCheckpoint[],
|
|
553
|
+
}, checkpoints: readonly AwaitingCheckpoint[], _worktrees: readonly WorktreeReference[]): string;
|
|
356
554
|
export default function workflowExtension(pi: ExtensionAPI, home?: string, clipboard?: typeof copyToClipboard, createSession?: SessionFactory): void;
|
|
357
555
|
export { acquireSessionLease, projectStorageKey, RunStore, runsDirectory, SessionLease, structuralPath } from "./persistence.js";
|
|
358
|
-
export type { AwaitingCheckpoint, CompletedOperation, NativeSessionReference, PersistedOwnershipNode, PersistedRun, WorktreeReference } from "./persistence.js";
|
|
556
|
+
export type { AwaitingCheckpoint, CompletedOperation, ConversationHead, NativeSessionReference, PendingWorkflowDecision, PersistedConversation, PersistedOwnershipNode, PersistedRun, WorktreeReference } from "./persistence.js";
|
|
359
557
|
export { FairAgentScheduler, WorkflowAgentExecutor } from "./agent-execution.js";
|
|
360
|
-
export type { AgentAccounting, AgentAttempt, AgentDefinition, AgentExecutionOptions, AgentExecutionResult, AgentExecutionRoot, AgentProgress, AgentToolCallProgress } from "./agent-execution.js";
|
|
558
|
+
export type { AgentAccounting, AgentAttempt, AgentBudgetHooks, AgentDefinition, AgentExecutionOptions, AgentExecutionResult, AgentExecutionRoot, AgentProgress, AgentSetup, AgentSetupContext, AgentSetupHook, AgentToolCallProgress, RegisteredAgentSetupHook, SessionInput } from "./agent-execution.js";
|
|
361
559
|
export { doctor, doctorExitCode, formatDoctorReport } from "./doctor.js";
|
|
362
560
|
export type { DoctorDiagnostic, DoctorOptions, DoctorPiState, DoctorReport, DoctorRole, DoctorSeverity, DoctorTrust, DoctorWorkflow } from "./doctor.js";
|