@trailstep/core 0.1.1 → 0.2.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 +11 -0
- package/dist/index.d.ts +713 -177
- package/dist/index.js +6434 -2719
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,94 @@ interface AgentModelTarget {
|
|
|
14
14
|
readonly model: string;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
interface TrailStepProviderRegistration {
|
|
18
|
+
readonly source: TrailStepProviderSource;
|
|
19
|
+
readonly manifest: TrailStepProviderManifest;
|
|
20
|
+
}
|
|
21
|
+
type TrailStepProviderSource = {
|
|
22
|
+
readonly type: "local-manifest";
|
|
23
|
+
readonly path: string;
|
|
24
|
+
} | {
|
|
25
|
+
readonly type: "legacy-custom-provider";
|
|
26
|
+
} | {
|
|
27
|
+
readonly type: "npm" | "github" | "local-package";
|
|
28
|
+
readonly packageName: string;
|
|
29
|
+
readonly spec: string;
|
|
30
|
+
readonly resolvedVersion?: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* ESM package contract for provider packages: export `trailstepProvider` from
|
|
34
|
+
* the package root. Keep hook functions outside `manifest` so the manifest is
|
|
35
|
+
* serializable and safe to persist.
|
|
36
|
+
*/
|
|
37
|
+
interface TrailStepProviderPackageDefinition {
|
|
38
|
+
readonly manifest: TrailStepProviderManifest;
|
|
39
|
+
readonly hooks?: Record<string, unknown>;
|
|
40
|
+
}
|
|
41
|
+
interface TrailStepProviderManifest {
|
|
42
|
+
readonly schemaVersion: 1;
|
|
43
|
+
readonly id: string;
|
|
44
|
+
readonly displayName: string;
|
|
45
|
+
readonly working: TrailStepProviderWorkingManifest;
|
|
46
|
+
readonly interactive: TrailStepProviderInteractiveManifest;
|
|
47
|
+
readonly model: TrailStepProviderModelManifest;
|
|
48
|
+
readonly thinking: TrailStepProviderThinkingManifest;
|
|
49
|
+
readonly env?: TrailStepProviderEnvironmentManifest;
|
|
50
|
+
readonly hooks?: Record<string, unknown>;
|
|
51
|
+
}
|
|
52
|
+
type TrailStepProviderPromptFileReferenceStyle = "at-prefixed-argument";
|
|
53
|
+
interface TrailStepProviderPromptManifest {
|
|
54
|
+
readonly kind: "prompt-file";
|
|
55
|
+
readonly reference?: TrailStepProviderPromptFileReferenceStyle;
|
|
56
|
+
}
|
|
57
|
+
type TrailStepProviderOutputStyle = "provider-output-file" | "stdout-json-envelope" | "stdout-jsonl-transcript";
|
|
58
|
+
interface TrailStepProviderOutputParsingManifest {
|
|
59
|
+
readonly resultField?: string;
|
|
60
|
+
}
|
|
61
|
+
interface TrailStepProviderOutputManifest {
|
|
62
|
+
readonly style: TrailStepProviderOutputStyle;
|
|
63
|
+
readonly parsing?: TrailStepProviderOutputParsingManifest;
|
|
64
|
+
}
|
|
65
|
+
interface TrailStepProviderWorkingManifest {
|
|
66
|
+
readonly supported: boolean;
|
|
67
|
+
readonly command?: string;
|
|
68
|
+
readonly args?: readonly string[];
|
|
69
|
+
readonly prompt?: TrailStepProviderPromptManifest;
|
|
70
|
+
readonly output?: TrailStepProviderOutputManifest;
|
|
71
|
+
}
|
|
72
|
+
interface TrailStepProviderInteractiveManifest {
|
|
73
|
+
readonly supported: boolean;
|
|
74
|
+
readonly reason?: string;
|
|
75
|
+
readonly command?: string;
|
|
76
|
+
readonly args?: readonly string[];
|
|
77
|
+
readonly requiresSystemPromptFile?: boolean;
|
|
78
|
+
readonly systemPromptFileFlag?: string;
|
|
79
|
+
readonly modelFlag?: string;
|
|
80
|
+
readonly permissionBypassFlag?: string;
|
|
81
|
+
}
|
|
82
|
+
interface TrailStepProviderEnvironmentManifest {
|
|
83
|
+
readonly required?: readonly string[];
|
|
84
|
+
readonly optional?: readonly string[];
|
|
85
|
+
}
|
|
86
|
+
interface TrailStepProviderModelDiscoveryManifest {
|
|
87
|
+
readonly command: string;
|
|
88
|
+
readonly args: readonly string[];
|
|
89
|
+
readonly outputParser: string;
|
|
90
|
+
}
|
|
91
|
+
interface TrailStepProviderModelManifest {
|
|
92
|
+
readonly supported: boolean;
|
|
93
|
+
readonly reason?: string;
|
|
94
|
+
readonly flag?: string;
|
|
95
|
+
readonly discovery?: TrailStepProviderModelDiscoveryManifest;
|
|
96
|
+
}
|
|
97
|
+
interface TrailStepProviderThinkingManifest {
|
|
98
|
+
readonly supported: boolean;
|
|
99
|
+
readonly reason?: string;
|
|
100
|
+
readonly flag?: string;
|
|
101
|
+
readonly levels?: readonly WorkflowAgentThinking[];
|
|
102
|
+
}
|
|
103
|
+
declare function parseTrailStepProviderManifest(path: string, value: unknown, diagnostics: string[]): TrailStepProviderManifest | undefined;
|
|
104
|
+
|
|
17
105
|
interface RetryPolicy {
|
|
18
106
|
readonly maxAttempts: number;
|
|
19
107
|
}
|
|
@@ -64,11 +152,7 @@ interface TrailStepCustomProviderConfig {
|
|
|
64
152
|
readonly env?: Readonly<Record<string, string>>;
|
|
65
153
|
}
|
|
66
154
|
interface TrailStepAgentTarget {
|
|
67
|
-
/**
|
|
68
|
-
* Either a key declared in the top-level `customProviders` object, or a
|
|
69
|
-
* built-in provider registry id (e.g. `"claude"`). The registry is checked
|
|
70
|
-
* first; `customProviders` is the fallback/escape hatch.
|
|
71
|
-
*/
|
|
155
|
+
/** Either a key declared in top-level `providers` or `customProviders`. */
|
|
72
156
|
readonly provider: string;
|
|
73
157
|
readonly model?: string;
|
|
74
158
|
readonly thinking?: WorkflowAgentThinking;
|
|
@@ -86,11 +170,28 @@ interface TrailStepWorkflowConfig {
|
|
|
86
170
|
readonly agents?: TrailStepAgentMappings;
|
|
87
171
|
readonly settings?: TrailStepSettings;
|
|
88
172
|
}
|
|
173
|
+
interface TrailStepStorageLifecycleRetentionConfig {
|
|
174
|
+
/** Duration string such as "7d"; false disables compression for the matching scope. */
|
|
175
|
+
readonly compressAfter?: string | false;
|
|
176
|
+
/** Duration string such as "30d"; false disables deletion for the matching scope. */
|
|
177
|
+
readonly deleteAfter?: string | false;
|
|
178
|
+
}
|
|
179
|
+
interface TrailStepStorageLifecycleConfig extends TrailStepStorageLifecycleRetentionConfig {
|
|
180
|
+
readonly enabled?: boolean;
|
|
181
|
+
readonly runOn?: readonly ("run" | "open" | "runs")[];
|
|
182
|
+
readonly throttle?: string | false;
|
|
183
|
+
readonly workflows?: Readonly<Record<string, TrailStepStorageLifecycleRetentionConfig>>;
|
|
184
|
+
}
|
|
185
|
+
interface TrailStepStorageConfig {
|
|
186
|
+
readonly lifecycle?: TrailStepStorageLifecycleConfig;
|
|
187
|
+
}
|
|
89
188
|
interface TrailStepConfig {
|
|
90
189
|
readonly version: 1;
|
|
91
190
|
readonly customProviders: Readonly<Record<string, TrailStepCustomProviderConfig>>;
|
|
191
|
+
readonly providers?: Readonly<Record<string, TrailStepProviderRegistration>>;
|
|
92
192
|
readonly agents: TrailStepAgentMappings;
|
|
93
193
|
readonly settings?: TrailStepSettings;
|
|
194
|
+
readonly storage?: TrailStepStorageConfig;
|
|
94
195
|
readonly workflows?: Readonly<Record<string, TrailStepWorkflowConfig>>;
|
|
95
196
|
}
|
|
96
197
|
interface ResolveAgentTargetsOptions {
|
|
@@ -100,10 +201,6 @@ interface ResolveAgentTargetsOptions {
|
|
|
100
201
|
readonly roleSize: string;
|
|
101
202
|
}
|
|
102
203
|
|
|
103
|
-
declare function parseTrailStepConfig(value: unknown): TrailStepConfig;
|
|
104
|
-
|
|
105
|
-
declare function resolveAgentTargets(options: ResolveAgentTargetsOptions): readonly TrailStepAgentTarget[];
|
|
106
|
-
|
|
107
204
|
type PlainObject = Record<string, unknown>;
|
|
108
205
|
interface ValidationDiagnostic {
|
|
109
206
|
readonly path: string;
|
|
@@ -120,67 +217,6 @@ type ShapePrimitive = "string" | "number" | "boolean";
|
|
|
120
217
|
type ShapeObject = Readonly<Record<string, ShapePrimitive>>;
|
|
121
218
|
type ShapeInput<T extends PlainObject = PlainObject> = Schema<T> | ShapeObject;
|
|
122
219
|
|
|
123
|
-
/**
|
|
124
|
-
* A captured document artifact. `Document` doubles as its own
|
|
125
|
-
* `Schema<Document>`: `validate`/`diagnostics`/`assert`/`jsonSchema`/
|
|
126
|
-
* `captureMode` are static members, so passing the class itself as
|
|
127
|
-
* `.prompt(source, { output: Document })` gives both the TypeScript output
|
|
128
|
-
* type and the runtime validator from one symbol -- no separate schema
|
|
129
|
-
* constant to import or keep in sync.
|
|
130
|
-
*/
|
|
131
|
-
declare class Document {
|
|
132
|
-
readonly content: string;
|
|
133
|
-
readonly path: string;
|
|
134
|
-
[key: string]: unknown;
|
|
135
|
-
static readonly captureMode: "raw-text";
|
|
136
|
-
static readonly jsonSchema: Record<string, unknown>;
|
|
137
|
-
static validate(value: unknown): value is Document;
|
|
138
|
-
static diagnostics(value: unknown): readonly ValidationDiagnostic[];
|
|
139
|
-
/**
|
|
140
|
-
* Deliberately duck-types instead of checking `instanceof Document`: on
|
|
141
|
-
* resume, a completed step's recorded output is replayed from
|
|
142
|
-
* `events.jsonl` via `JSON.parse`, producing a plain deserialized object —
|
|
143
|
-
* never a live `Document` instance — before `assert` is called on it. An
|
|
144
|
-
* `instanceof` check would fail every such replay. `assert` reconstructs a
|
|
145
|
-
* genuine `Document` from any content/path-shaped value, so every
|
|
146
|
-
* consumer downstream — a live capture or a replayed value alike — always
|
|
147
|
-
* receives a real `Document` instance with working prototype methods.
|
|
148
|
-
*/
|
|
149
|
-
static assert(value: unknown, label?: string): Document;
|
|
150
|
-
constructor(content: string, path: string);
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Captures `content` as a durable document artifact for the currently
|
|
154
|
-
* executing step. Must be called from within a step's `.do()` callback —
|
|
155
|
-
* it reads the step-scoped ambient context (`RunContext.currentStep`, set
|
|
156
|
-
* by `withStepContext` for the duration of the step) to determine both the
|
|
157
|
-
* directory to write into and this call's 1-based index within the step, so
|
|
158
|
-
* that a step calling `document(...)` more than once gets
|
|
159
|
-
* `document-1.md`, `document-2.md`, etc.
|
|
160
|
-
*/
|
|
161
|
-
declare function document(content: string): Promise<Document>;
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Synchronously reads each named file relative to `dir` and returns its
|
|
165
|
-
* trimmed content keyed the same way, so a step's `prompt.ts` can load all
|
|
166
|
-
* of its shared markdown fragments in one call:
|
|
167
|
-
* `loadFragments(import.meta.dirname, { methodology: "../shared/methodology.md" })`.
|
|
168
|
-
*/
|
|
169
|
-
declare function loadFragments<TKey extends string>(dir: string, files: Record<TKey, string>): Record<TKey, string>;
|
|
170
|
-
/**
|
|
171
|
-
* Renders `body` as a `## title` markdown section, or `undefined` when
|
|
172
|
-
* `body` is falsy -- so a conditional section can be inlined directly as a
|
|
173
|
-
* `promptSections(...)` argument instead of built up separately.
|
|
174
|
-
*/
|
|
175
|
-
declare function section(title: string, body: string | false | null | undefined): string | undefined;
|
|
176
|
-
/**
|
|
177
|
-
* Joins prompt fragments and `section(...)` results with a blank line
|
|
178
|
-
* between each, dropping any falsy (conditionally-omitted) part.
|
|
179
|
-
*/
|
|
180
|
-
declare function promptSections(...parts: ReadonlyArray<string | false | null | undefined>): string;
|
|
181
|
-
/** Renders `items` as a markdown bullet list, one `- item` per line. */
|
|
182
|
-
declare function list(items: readonly string[]): string;
|
|
183
|
-
|
|
184
220
|
interface AgentStepRequestConfig<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject> {
|
|
185
221
|
readonly kind?: "agent";
|
|
186
222
|
readonly id: string;
|
|
@@ -233,14 +269,37 @@ declare class TrailStepFailureError extends Error {
|
|
|
233
269
|
constructor(failure: Failure);
|
|
234
270
|
}
|
|
235
271
|
|
|
236
|
-
|
|
272
|
+
interface RunContextState {
|
|
273
|
+
get<T = unknown>(key: string): Promise<T | undefined>;
|
|
274
|
+
getPersisted<T = unknown>(key: string): Promise<T | undefined>;
|
|
275
|
+
hydratePersisted(): Promise<void>;
|
|
276
|
+
set(key: string, value: unknown, options?: {
|
|
277
|
+
readonly persist?: boolean;
|
|
278
|
+
}): Promise<void>;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/** A local text file to load a prompt's content from, resolved relative to the workflow/project `cwd` at dispatch time. */
|
|
237
282
|
interface PromptTemplateSource {
|
|
238
283
|
readonly kind: "promptTemplate";
|
|
239
284
|
readonly path: string;
|
|
240
285
|
}
|
|
286
|
+
interface StepCwdContext<TInput extends PlainObject = PlainObject> {
|
|
287
|
+
readonly input: TInput;
|
|
288
|
+
readonly state: RunContextState;
|
|
289
|
+
readonly workflow: {
|
|
290
|
+
readonly id: string;
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
type StepCwdCallback<TInput extends PlainObject = PlainObject> = {
|
|
294
|
+
bivarianceHack(context: StepCwdContext<TInput>): unknown | Promise<unknown>;
|
|
295
|
+
}["bivarianceHack"];
|
|
296
|
+
type StepCwdInput<TInput extends PlainObject = PlainObject> = string | StepCwdCallback<TInput>;
|
|
241
297
|
/** The object passed to `step(...)`. Always relevant, regardless of whether `.prompt(...)` is called. */
|
|
242
298
|
interface StepConfig {
|
|
243
299
|
readonly id: string;
|
|
300
|
+
readonly title?: string;
|
|
301
|
+
readonly description?: string;
|
|
302
|
+
readonly cwd?: StepCwdInput;
|
|
244
303
|
readonly retry?: RetryPolicyInput;
|
|
245
304
|
readonly timeout?: TimeoutPolicyInput;
|
|
246
305
|
}
|
|
@@ -263,31 +322,130 @@ interface SubPromptOptions<TOutput extends PlainObject = PlainObject> {
|
|
|
263
322
|
readonly adapter?: AgentAdapterSelection<PlainObject, TOutput>;
|
|
264
323
|
readonly maxSubPrompts?: number;
|
|
265
324
|
}
|
|
266
|
-
|
|
325
|
+
type StepDisplayLevel = "info" | "warning" | "error" | "debug";
|
|
326
|
+
interface StepDisplayObject {
|
|
327
|
+
readonly message: string;
|
|
328
|
+
readonly level?: StepDisplayLevel;
|
|
329
|
+
readonly data?: unknown;
|
|
330
|
+
}
|
|
331
|
+
type StepDisplayValue = string | StepDisplayObject;
|
|
332
|
+
interface StepDisplayContext<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject> {
|
|
333
|
+
readonly input: TInput;
|
|
334
|
+
readonly output: TOutput;
|
|
335
|
+
}
|
|
336
|
+
type StepDisplayCallback<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject> = {
|
|
337
|
+
bivarianceHack(context: StepDisplayContext<TInput, TOutput>): StepDisplayValue | Promise<StepDisplayValue>;
|
|
338
|
+
}["bivarianceHack"];
|
|
339
|
+
type StepDisplayContent<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject> = StepDisplayValue | StepDisplayCallback<TInput, TOutput>;
|
|
340
|
+
/** Ordered phase for durable progress display events. */
|
|
341
|
+
interface DisplayPhase<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject> {
|
|
342
|
+
readonly kind: "display";
|
|
343
|
+
readonly content?: StepDisplayContent<TInput, TOutput>;
|
|
344
|
+
readonly options?: PlainObject;
|
|
345
|
+
}
|
|
346
|
+
interface WaitDefinition<TWaitOutput extends PlainObject = PlainObject> {
|
|
347
|
+
readonly id: string;
|
|
348
|
+
readonly kind: "input";
|
|
349
|
+
readonly message: string;
|
|
350
|
+
readonly output: ShapeInput<TWaitOutput>;
|
|
351
|
+
}
|
|
352
|
+
interface WaitOptions<TWaitOutput extends PlainObject = PlainObject> {
|
|
353
|
+
readonly output: ShapeInput<TWaitOutput>;
|
|
354
|
+
}
|
|
355
|
+
interface WaitPendingInput {
|
|
356
|
+
readonly id: string;
|
|
357
|
+
readonly message: string;
|
|
358
|
+
readonly retryAfterSeconds?: number;
|
|
359
|
+
}
|
|
360
|
+
interface WaitPendingResult {
|
|
361
|
+
readonly status: "pending";
|
|
362
|
+
readonly id: string;
|
|
363
|
+
readonly message: string;
|
|
364
|
+
readonly retryAfterSeconds?: number;
|
|
365
|
+
}
|
|
366
|
+
interface WaitDoneResult<TWaitOutput extends PlainObject = PlainObject> {
|
|
367
|
+
readonly status: "done";
|
|
368
|
+
readonly output: TWaitOutput;
|
|
369
|
+
}
|
|
370
|
+
type WaitCheckResult<TWaitOutput extends PlainObject = PlainObject> = WaitDoneResult<TWaitOutput> | WaitPendingResult;
|
|
371
|
+
interface CheckWaitHelpers<TWaitOutput extends PlainObject = PlainObject> {
|
|
372
|
+
done(output: TWaitOutput): WaitDoneResult<TWaitOutput>;
|
|
373
|
+
pending(input: WaitPendingInput): WaitPendingResult;
|
|
374
|
+
}
|
|
375
|
+
interface StepWaitContext<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject> {
|
|
376
|
+
readonly input: TInput;
|
|
377
|
+
readonly output: TOutput;
|
|
378
|
+
readonly waits: Readonly<Record<string, PlainObject>>;
|
|
379
|
+
}
|
|
380
|
+
interface CheckWaitContext<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject, TWaitOutput extends PlainObject = PlainObject> extends StepWaitContext<TInput, TOutput> {
|
|
381
|
+
readonly wait: CheckWaitHelpers<TWaitOutput>;
|
|
382
|
+
}
|
|
383
|
+
type WaitCallback<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject, TWaitOutput extends PlainObject = PlainObject> = {
|
|
384
|
+
bivarianceHack(context: StepWaitContext<TInput, TOutput>): WaitDefinition<TWaitOutput> | Promise<WaitDefinition<TWaitOutput>>;
|
|
385
|
+
}["bivarianceHack"];
|
|
386
|
+
type CheckWaitCallback<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject, TWaitOutput extends PlainObject = PlainObject> = {
|
|
387
|
+
bivarianceHack(context: CheckWaitContext<TInput, TOutput, TWaitOutput>): WaitCheckResult<TWaitOutput> | Promise<WaitCheckResult<TWaitOutput>>;
|
|
388
|
+
}["bivarianceHack"];
|
|
389
|
+
type WaitInput<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject, TWaitOutput extends PlainObject = PlainObject> = WaitDefinition<TWaitOutput> | WaitCallback<TInput, TOutput, TWaitOutput>;
|
|
390
|
+
/** Ordered durable pause phase for human/external input/check waits. */
|
|
391
|
+
interface WaitPhase<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject> {
|
|
392
|
+
readonly kind: "wait";
|
|
393
|
+
readonly wait: WaitInput<TInput, TOutput> | CheckWaitCallback<TInput, TOutput>;
|
|
394
|
+
readonly options?: WaitOptions;
|
|
395
|
+
}
|
|
396
|
+
interface PromptPhase<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject> extends PromptOptions<TOutput> {
|
|
397
|
+
readonly kind: "prompt";
|
|
398
|
+
readonly prompt: AgentPrompt<TInput> | PromptTemplateSource;
|
|
399
|
+
}
|
|
400
|
+
type StepContinuationOutput<TOutput extends PlainObject = PlainObject> = TOutput & {
|
|
401
|
+
readonly output: TOutput;
|
|
402
|
+
readonly waits: Readonly<Record<string, PlainObject>>;
|
|
403
|
+
};
|
|
404
|
+
type StepContinuation<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject> = {
|
|
405
|
+
bivarianceHack(output: TOutput, input: TInput): ContinuationResult | Promise<ContinuationResult>;
|
|
406
|
+
}["bivarianceHack"];
|
|
407
|
+
type StepContextContinuation<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject> = {
|
|
408
|
+
bivarianceHack(output: StepContinuationOutput<TOutput>, input: TInput): ContinuationResult | Promise<ContinuationResult>;
|
|
409
|
+
}["bivarianceHack"];
|
|
410
|
+
interface DoPhase<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject> {
|
|
411
|
+
readonly kind: "do";
|
|
412
|
+
readonly onOutput: StepContinuation<TInput, TOutput>;
|
|
413
|
+
}
|
|
414
|
+
type StepPhase<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject> = DisplayPhase<TInput, TOutput> | WaitPhase<TInput, TOutput> | PromptPhase<TInput, TOutput> | DoPhase<TInput, TOutput>;
|
|
415
|
+
/** The runtime shape stored in `StepNode.config` -- `StepConfig` plus the resolved `input`. Legacy prompt fields are retained for compatibility; ordered `StepNode.phases` is the canonical execution model. */
|
|
267
416
|
interface ContinuationStepConfig<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject> {
|
|
268
417
|
readonly id: string;
|
|
418
|
+
readonly title?: string;
|
|
419
|
+
readonly description?: string;
|
|
269
420
|
readonly input: TInput;
|
|
421
|
+
/** @deprecated Prefer the ordered prompt phase in `StepNode.phases`. */
|
|
270
422
|
readonly output?: ShapeInput<TOutput>;
|
|
423
|
+
/** @deprecated Prefer the ordered prompt phase in `StepNode.phases`. */
|
|
271
424
|
readonly prompt?: AgentPrompt<TInput> | PromptTemplateSource;
|
|
425
|
+
/** @deprecated Prefer the ordered prompt phase in `StepNode.phases`. */
|
|
272
426
|
readonly agent?: string;
|
|
427
|
+
/** @deprecated Prefer the ordered prompt phase in `StepNode.phases`. */
|
|
273
428
|
readonly mode?: "working" | "interactive";
|
|
429
|
+
/** @deprecated Prefer the ordered prompt phase in `StepNode.phases`. */
|
|
274
430
|
readonly adapter?: AgentAdapterSelection<TInput, TOutput>;
|
|
431
|
+
/** @deprecated Prefer the ordered prompt phase in `StepNode.phases`. */
|
|
275
432
|
readonly maxSubPrompts?: number;
|
|
433
|
+
readonly cwd?: StepCwdInput<TInput>;
|
|
276
434
|
readonly retry?: RetryPolicyInput;
|
|
277
435
|
readonly timeout?: TimeoutPolicyInput;
|
|
278
436
|
}
|
|
279
|
-
type StepContinuation<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject> = {
|
|
280
|
-
bivarianceHack(output: TOutput, input: TInput): ContinuationResult | Promise<ContinuationResult>;
|
|
281
|
-
}["bivarianceHack"];
|
|
282
437
|
type StepErrorContinuation = {
|
|
283
438
|
bivarianceHack(error: Failure): ContinuationResult;
|
|
284
439
|
}["bivarianceHack"];
|
|
285
440
|
interface StepNode<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject> {
|
|
286
441
|
readonly kind: "step";
|
|
287
442
|
readonly config: ContinuationStepConfig<TInput, TOutput>;
|
|
288
|
-
/**
|
|
443
|
+
/** Ordered phase pipeline. This is the canonical runtime representation for authored nodes. Optional only so legacy StepNode-shaped objects can still be translated at runtime. */
|
|
444
|
+
readonly phases?: readonly StepPhase<TInput, TOutput>[];
|
|
445
|
+
/** @deprecated Prefer the `do` phase in `StepNode.phases`. Retained for compatibility with existing callers. */
|
|
289
446
|
readonly onOutput: StepContinuation<TInput, TOutput>;
|
|
290
447
|
readonly onError?: StepErrorContinuation;
|
|
448
|
+
readonly options?: StepInvocationOptions;
|
|
291
449
|
}
|
|
292
450
|
/**
|
|
293
451
|
* Returned by `step(...).prompt(...)?.do(...)`: a reusable step definition,
|
|
@@ -296,69 +454,83 @@ interface StepNode<TInput extends PlainObject = PlainObject, TOutput extends Pla
|
|
|
296
454
|
* calling it. When `TInput` has no required keys (e.g. a step that ignores
|
|
297
455
|
* its input), the call is `stepA()` -- the input argument is optional.
|
|
298
456
|
*/
|
|
299
|
-
|
|
457
|
+
interface StepInvocationOptions extends Partial<Omit<StepConfig, "id">> {
|
|
458
|
+
readonly branchId?: string;
|
|
459
|
+
}
|
|
460
|
+
type StepFactory<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject> = ({} extends TInput ? (input?: TInput, options?: StepInvocationOptions) => StepNode<TInput, TOutput> : (input: TInput, options?: StepInvocationOptions) => StepNode<TInput, TOutput>) & {
|
|
300
461
|
catch(onError: StepErrorContinuation): StepFactory<TInput, TOutput>;
|
|
301
462
|
};
|
|
302
463
|
type SubPromptFactory<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject> = {} extends TInput ? (input?: TInput) => Promise<TOutput> : (input: TInput) => Promise<TOutput>;
|
|
464
|
+
interface TerminalMessageOptions {
|
|
465
|
+
readonly message?: string;
|
|
466
|
+
}
|
|
303
467
|
interface DoneNode<TOutput extends PlainObject = PlainObject> {
|
|
304
468
|
readonly kind: "done";
|
|
305
469
|
readonly output: TOutput;
|
|
470
|
+
readonly message?: string;
|
|
306
471
|
}
|
|
307
472
|
/** Terminates the workflow as a failure without dispatching a step -- no step.* events, just workflow.failed. */
|
|
308
473
|
interface FailNode {
|
|
309
474
|
readonly kind: "fail";
|
|
310
475
|
readonly failure: Failure;
|
|
476
|
+
readonly message?: string;
|
|
311
477
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
readonly
|
|
333
|
-
readonly
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
declare function subPrompt<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject>(source: AgentPrompt<TInput> | PromptTemplateSource, options: SubPromptOptions<TOutput>): SubPromptFactory<TInput, TOutput>;
|
|
478
|
+
interface WorkflowInvocationOptions {
|
|
479
|
+
readonly branchId?: string;
|
|
480
|
+
}
|
|
481
|
+
type PostContinuation<TOutput extends PlainObject = PlainObject> = {
|
|
482
|
+
bivarianceHack(output: TOutput): ContinuationResult | Promise<ContinuationResult>;
|
|
483
|
+
}["bivarianceHack"];
|
|
484
|
+
interface WorkflowInvocationNode<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject> {
|
|
485
|
+
readonly kind: "workflowInvocation";
|
|
486
|
+
readonly workflow: Workflow<TInput, TOutput>;
|
|
487
|
+
readonly input: TInput;
|
|
488
|
+
readonly options?: WorkflowInvocationOptions;
|
|
489
|
+
post(continuation: PostContinuation<TOutput>): WorkflowInvocationNode<TInput, TOutput>;
|
|
490
|
+
readonly postContinuation?: PostContinuation<TOutput>;
|
|
491
|
+
}
|
|
492
|
+
interface AbsoluteDoneNode<TOutput extends PlainObject = PlainObject> {
|
|
493
|
+
readonly kind: "absoluteDone";
|
|
494
|
+
readonly output: TOutput;
|
|
495
|
+
readonly message?: string;
|
|
496
|
+
}
|
|
497
|
+
interface AbsoluteFailNode {
|
|
498
|
+
readonly kind: "absoluteFail";
|
|
499
|
+
readonly failure: Failure;
|
|
500
|
+
readonly message?: string;
|
|
501
|
+
}
|
|
502
|
+
interface RunnableWorkflowInvocationNode {
|
|
503
|
+
readonly kind: "workflowInvocation";
|
|
504
|
+
readonly workflow: unknown;
|
|
505
|
+
readonly input: PlainObject;
|
|
506
|
+
readonly options?: unknown;
|
|
507
|
+
readonly postContinuation?: PostContinuation;
|
|
508
|
+
}
|
|
509
|
+
type RunnableContinuationNode = StepNode<PlainObject, PlainObject> | RunnableWorkflowInvocationNode;
|
|
510
|
+
type ContinuationArray = readonly RunnableContinuationNode[];
|
|
511
|
+
type ParallelFailurePolicy = "fail-fast" | "all-settled";
|
|
512
|
+
interface ParallelOptions {
|
|
513
|
+
readonly concurrency?: number;
|
|
514
|
+
readonly failurePolicy?: ParallelFailurePolicy;
|
|
515
|
+
}
|
|
516
|
+
interface ParallelNode<TOutput extends PlainObject = PlainObject> {
|
|
517
|
+
readonly kind: "parallel";
|
|
518
|
+
readonly nodes: ContinuationArray;
|
|
519
|
+
readonly options?: ParallelOptions;
|
|
520
|
+
post(continuation: PostContinuation<TOutput>): ParallelNode<TOutput>;
|
|
521
|
+
readonly postContinuation?: PostContinuation<TOutput>;
|
|
522
|
+
}
|
|
523
|
+
type ContinuationResult<TOutput extends PlainObject = PlainObject> = StepNode<PlainObject, PlainObject> | DoneNode<TOutput> | FailNode | RunnableWorkflowInvocationNode | AbsoluteDoneNode<TOutput> | AbsoluteFailNode | ContinuationArray | ParallelNode<TOutput>;
|
|
359
524
|
|
|
525
|
+
interface WorkflowSkillOptions {
|
|
526
|
+
readonly description?: string;
|
|
527
|
+
readonly instructions?: string;
|
|
528
|
+
readonly markdown?: string;
|
|
529
|
+
}
|
|
360
530
|
interface Workflow<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject> {
|
|
361
531
|
readonly id: string;
|
|
532
|
+
readonly description?: string;
|
|
533
|
+
readonly skill?: string | WorkflowSkillOptions;
|
|
362
534
|
readonly input?: Schema<TInput>;
|
|
363
535
|
readonly output?: Schema<TOutput>;
|
|
364
536
|
readonly inputShape?: ShapeInput<TInput>;
|
|
@@ -368,43 +540,26 @@ interface Workflow<TInput extends PlainObject = PlainObject, TOutput extends Pla
|
|
|
368
540
|
readonly timeout?: TimeoutPolicyInput;
|
|
369
541
|
readonly start: (input: TInput) => ContinuationResult<TOutput>;
|
|
370
542
|
}
|
|
543
|
+
type WorkflowBuilderOptions<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject> = Workflow<TInput, TOutput>;
|
|
544
|
+
type DefinedWorkflow<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject> = Workflow<TInput, TOutput> & ((input: TInput, options?: WorkflowInvocationOptions) => WorkflowInvocationNode<TInput, TOutput>);
|
|
371
545
|
|
|
372
|
-
|
|
373
|
-
interface
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
readonly package: DeprecationTargetPackage;
|
|
378
|
-
/** The exact named export identifier, e.g. "step". Matched literally against import statement
|
|
379
|
-
* text by the scanner. */
|
|
380
|
-
readonly symbol: string;
|
|
381
|
-
/** Semver version at/after which this symbol is considered deprecated (still works, warns). */
|
|
382
|
-
readonly deprecatedSince: string;
|
|
383
|
-
/** Semver version at/after which this symbol is actually removed (no longer works). Omit if the
|
|
384
|
-
* symbol is deprecated but has no planned removal. */
|
|
385
|
-
readonly removedIn?: string;
|
|
386
|
-
/** Human-readable explanation, shown verbatim in doctor/update output. */
|
|
387
|
-
readonly message: string;
|
|
388
|
-
/** Optional suggested replacement API, shown as "Suggested replacement: <this>." */
|
|
389
|
-
readonly replacement?: string;
|
|
390
|
-
}
|
|
391
|
-
type DeprecationManifest = readonly DeprecationEntry[];
|
|
392
|
-
interface DeprecationStatus extends DeprecationEntry {
|
|
393
|
-
readonly severity: "warning" | "blocking";
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
declare const deprecationManifest: DeprecationManifest;
|
|
397
|
-
interface FindDeprecationsAsOfQuery {
|
|
398
|
-
readonly package: DeprecationTargetPackage;
|
|
399
|
-
readonly version: string;
|
|
546
|
+
declare const CANCELLATION_MARKER_FILE = "cancel.json";
|
|
547
|
+
interface CancellationMarker {
|
|
548
|
+
readonly requestedAt?: string;
|
|
549
|
+
readonly reason?: string;
|
|
550
|
+
readonly source?: string;
|
|
400
551
|
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
552
|
+
declare function cancellationMarkerPath(runDir: string): string;
|
|
553
|
+
declare function readCancellationMarker(runDir: string): Promise<CancellationMarker | undefined>;
|
|
554
|
+
declare function writeCancellationMarker(options: {
|
|
555
|
+
readonly runDir: string;
|
|
556
|
+
readonly reason?: string;
|
|
557
|
+
readonly source?: string;
|
|
558
|
+
readonly requestedAt?: Date;
|
|
559
|
+
}): Promise<{
|
|
560
|
+
readonly marker: CancellationMarker;
|
|
561
|
+
readonly alreadyExisted: boolean;
|
|
562
|
+
}>;
|
|
408
563
|
|
|
409
564
|
type TrailStepConfigInput = TrailStepConfig | Readonly<Record<string, unknown>>;
|
|
410
565
|
interface InteractiveProcessRequest {
|
|
@@ -425,7 +580,7 @@ interface WorkingAgentProcessRequest {
|
|
|
425
580
|
readonly args: readonly string[];
|
|
426
581
|
readonly cwd: string;
|
|
427
582
|
readonly shell: false;
|
|
428
|
-
readonly stdio: "inherit";
|
|
583
|
+
readonly stdio: "inherit" | "pipe";
|
|
429
584
|
readonly promptFile: string;
|
|
430
585
|
readonly outputFile: string;
|
|
431
586
|
readonly model?: string;
|
|
@@ -433,6 +588,7 @@ interface WorkingAgentProcessRequest {
|
|
|
433
588
|
}
|
|
434
589
|
interface WorkingAgentProcessResult {
|
|
435
590
|
readonly exitCode: number;
|
|
591
|
+
readonly stdout?: string;
|
|
436
592
|
}
|
|
437
593
|
type WorkingAgentProcessRunner = (request: WorkingAgentProcessRequest) => WorkingAgentProcessResult | Promise<WorkingAgentProcessResult>;
|
|
438
594
|
interface Event<TPayload extends PlainObject = PlainObject> {
|
|
@@ -440,11 +596,22 @@ interface Event<TPayload extends PlainObject = PlainObject> {
|
|
|
440
596
|
readonly runId: string;
|
|
441
597
|
readonly workflowId: string;
|
|
442
598
|
readonly stepId?: string;
|
|
443
|
-
readonly type: "workflow.started" | "workflow.resumed" | "workflow.retryStarted" | "workflow.failed" | "step.started" | "step.completed" | "step.failed" | "subPrompt.started" | "subPrompt.completed" | "subPrompt.failed" | "interactive.sessionStarted" | "interactive.sessionCompleted" | "agent.toolCall" | "workflow.completed";
|
|
599
|
+
readonly type: "workflow.started" | "workflow.resumed" | "workflow.retryStarted" | "workflow.cancelRequested" | "workflow.failed" | "workflow.cancelled" | "step.started" | "step.completed" | "step.failed" | "step.cancelled" | "step.display" | "step.progress" | "step.warning" | "step.artifact" | "wait.started" | "wait.satisfied" | "wait.failed" | "subPrompt.started" | "subPrompt.completed" | "subPrompt.failed" | "interactive.sessionStarted" | "interactive.sessionCompleted" | "agent.toolCall" | "workflow.completed";
|
|
444
600
|
readonly timestamp: string;
|
|
445
601
|
readonly schemaVersion: "v0";
|
|
446
602
|
readonly payload: TPayload;
|
|
447
603
|
}
|
|
604
|
+
interface WaitResultDetails {
|
|
605
|
+
readonly stepId: string;
|
|
606
|
+
readonly waitId: string;
|
|
607
|
+
readonly kind?: "input" | "check";
|
|
608
|
+
readonly message: string;
|
|
609
|
+
readonly retryAfterSeconds?: number;
|
|
610
|
+
readonly artifactPaths: {
|
|
611
|
+
readonly requestFile: string;
|
|
612
|
+
readonly answerFile: string;
|
|
613
|
+
};
|
|
614
|
+
}
|
|
448
615
|
type Result<TOutput extends PlainObject = PlainObject> = {
|
|
449
616
|
readonly status: "success";
|
|
450
617
|
readonly runId: string;
|
|
@@ -457,9 +624,30 @@ type Result<TOutput extends PlainObject = PlainObject> = {
|
|
|
457
624
|
readonly runDir: string;
|
|
458
625
|
readonly failure: Failure;
|
|
459
626
|
readonly events: readonly Event[];
|
|
460
|
-
}
|
|
627
|
+
} | ({
|
|
628
|
+
readonly status: "waiting";
|
|
629
|
+
readonly runId: string;
|
|
630
|
+
readonly runDir: string;
|
|
631
|
+
readonly wait: WaitResultDetails;
|
|
632
|
+
readonly events: readonly Event[];
|
|
633
|
+
} & {
|
|
634
|
+
/** Type-only compatibility for existing non-success branches; waiting results do not carry a runtime failure. */
|
|
635
|
+
readonly failure: never;
|
|
636
|
+
}) | ({
|
|
637
|
+
readonly status: "cancelled";
|
|
638
|
+
readonly runId: string;
|
|
639
|
+
readonly runDir: string;
|
|
640
|
+
readonly cancellation: CancellationMarker;
|
|
641
|
+
readonly events: readonly Event[];
|
|
642
|
+
} & {
|
|
643
|
+
/** Type-only compatibility for existing non-success branches; cancelled results do not carry a runtime failure. */
|
|
644
|
+
readonly failure: never;
|
|
645
|
+
});
|
|
461
646
|
interface RunWorkflowBaseOptions<TInput extends PlainObject, TOutput extends PlainObject> {
|
|
462
647
|
readonly workflow: Workflow<TInput, TOutput>;
|
|
648
|
+
/** Root used for workflow/config-relative resolution and default artifact storage. Defaults to `cwd` for backward compatibility, then `process.cwd()`. */
|
|
649
|
+
readonly projectCwd?: string;
|
|
650
|
+
/** Default execution cwd for steps and agent processes. Defaults to `projectCwd`. */
|
|
463
651
|
readonly cwd?: string;
|
|
464
652
|
readonly runsRoot?: string;
|
|
465
653
|
readonly eventSink?: (event: Event) => void | Promise<void>;
|
|
@@ -469,12 +657,27 @@ interface RunWorkflowBaseOptions<TInput extends PlainObject, TOutput extends Pla
|
|
|
469
657
|
/** Injectable stdout-capturing runner for built-in registry provider adapters (e.g. Claude). Test-only seam. */
|
|
470
658
|
readonly providerWorkingRunner?: ProviderWorkingRunner;
|
|
471
659
|
readonly maxSteps?: number;
|
|
660
|
+
readonly scheduler?: {
|
|
661
|
+
readonly workers?: number;
|
|
662
|
+
};
|
|
472
663
|
}
|
|
664
|
+
type RunWorkflowTrackRetryOptions = {
|
|
665
|
+
readonly mode: "failed-only";
|
|
666
|
+
} | {
|
|
667
|
+
readonly mode: "branch";
|
|
668
|
+
readonly branchId: string;
|
|
669
|
+
};
|
|
670
|
+
type RunWorkflowRetryOptions = {
|
|
671
|
+
readonly runDir: string;
|
|
672
|
+
readonly kind: "manual" | "automatic";
|
|
673
|
+
readonly track?: RunWorkflowTrackRetryOptions;
|
|
674
|
+
};
|
|
473
675
|
type RunWorkflowOptions<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject> = RunWorkflowBaseOptions<TInput, TOutput> & ({
|
|
474
676
|
readonly input: TInput;
|
|
475
677
|
readonly runName: string;
|
|
476
678
|
readonly resume?: undefined;
|
|
477
679
|
readonly retry?: undefined;
|
|
680
|
+
readonly continue?: undefined;
|
|
478
681
|
} | {
|
|
479
682
|
readonly resume: {
|
|
480
683
|
readonly runDir: string;
|
|
@@ -482,14 +685,21 @@ type RunWorkflowOptions<TInput extends PlainObject = PlainObject, TOutput extend
|
|
|
482
685
|
readonly input?: undefined;
|
|
483
686
|
readonly runName?: undefined;
|
|
484
687
|
readonly retry?: undefined;
|
|
688
|
+
readonly continue?: undefined;
|
|
485
689
|
} | {
|
|
486
|
-
readonly retry:
|
|
690
|
+
readonly retry: RunWorkflowRetryOptions;
|
|
691
|
+
readonly input?: undefined;
|
|
692
|
+
readonly runName?: undefined;
|
|
693
|
+
readonly resume?: undefined;
|
|
694
|
+
readonly continue?: undefined;
|
|
695
|
+
} | {
|
|
696
|
+
readonly continue: {
|
|
487
697
|
readonly runDir: string;
|
|
488
|
-
readonly kind: "manual" | "automatic";
|
|
489
698
|
};
|
|
490
699
|
readonly input?: undefined;
|
|
491
700
|
readonly runName?: undefined;
|
|
492
701
|
readonly resume?: undefined;
|
|
702
|
+
readonly retry?: undefined;
|
|
493
703
|
});
|
|
494
704
|
|
|
495
705
|
/**
|
|
@@ -581,6 +791,13 @@ interface ProviderWorkingInvocationSpec {
|
|
|
581
791
|
readonly output: ProviderOutputSpec;
|
|
582
792
|
readonly repair?: ProviderWorkingRepairInvocationSpec;
|
|
583
793
|
}
|
|
794
|
+
type ManagedSessionPromptInjectionMode = "hidden-system-prompt-file" | "visible-prompt-file" | "visible-inline-prompt";
|
|
795
|
+
type ProviderManagedSessionPromptDelivery = {
|
|
796
|
+
readonly delivery: "hidden-system-prompt-file";
|
|
797
|
+
} | {
|
|
798
|
+
readonly delivery: "visible-prompt";
|
|
799
|
+
readonly mode: "visible-prompt-file" | "visible-inline-prompt";
|
|
800
|
+
};
|
|
584
801
|
type ProviderInteractiveInvocationSpec = {
|
|
585
802
|
readonly supported: true;
|
|
586
803
|
readonly command: string;
|
|
@@ -588,6 +805,13 @@ type ProviderInteractiveInvocationSpec = {
|
|
|
588
805
|
readonly systemPromptFileFlag?: string;
|
|
589
806
|
readonly modelFlag?: string;
|
|
590
807
|
readonly permissionBypassFlag?: string;
|
|
808
|
+
/**
|
|
809
|
+
* Declares how TrailStep-managed standalone sessions should deliver their
|
|
810
|
+
* managed-session prompt. Hidden/system delivery is only claimed when the
|
|
811
|
+
* provider adapter has a dedicated system-prompt mechanism; otherwise the
|
|
812
|
+
* managed prompt is intentionally passed as visible user input.
|
|
813
|
+
*/
|
|
814
|
+
readonly managedSessionPrompt: ProviderManagedSessionPromptDelivery;
|
|
591
815
|
} | {
|
|
592
816
|
readonly supported: false;
|
|
593
817
|
readonly reason?: string;
|
|
@@ -610,6 +834,7 @@ interface ProviderInteractiveRequest {
|
|
|
610
834
|
readonly systemPromptFile?: string;
|
|
611
835
|
readonly cwd: string;
|
|
612
836
|
readonly model?: string;
|
|
837
|
+
readonly thinking?: WorkflowAgentThinking;
|
|
613
838
|
/** Undefined means bypass (per-tool confirmation is skipped by default). */
|
|
614
839
|
readonly permissionMode?: "bypass" | "prompt";
|
|
615
840
|
readonly env?: Readonly<Record<string, string>>;
|
|
@@ -659,25 +884,238 @@ interface ProviderAdapter {
|
|
|
659
884
|
runInteractive(request: ProviderInteractiveRequest, runner?: InteractiveProcessRunner): Promise<InteractiveProcessResult>;
|
|
660
885
|
}
|
|
661
886
|
|
|
887
|
+
interface LaunchInteractiveAgentTargetOptions {
|
|
888
|
+
readonly config: TrailStepConfig;
|
|
889
|
+
readonly target: TrailStepAgentTarget;
|
|
890
|
+
readonly prompt: string;
|
|
891
|
+
readonly promptFile: string;
|
|
892
|
+
readonly cwd: string;
|
|
893
|
+
readonly runner?: InteractiveProcessRunner;
|
|
894
|
+
readonly signal?: AbortSignal;
|
|
895
|
+
}
|
|
896
|
+
type LaunchInteractiveAgentTargetResult = InteractiveProcessResult & {
|
|
897
|
+
readonly promptInjectionMode: ManagedSessionPromptInjectionMode;
|
|
898
|
+
};
|
|
899
|
+
declare function launchInteractiveAgentTarget(options: LaunchInteractiveAgentTargetOptions): Promise<LaunchInteractiveAgentTargetResult>;
|
|
900
|
+
|
|
901
|
+
type ParsedTrailStepConfig = TrailStepConfig & {
|
|
902
|
+
readonly providers: NonNullable<TrailStepConfig["providers"]>;
|
|
903
|
+
};
|
|
904
|
+
declare function parseTrailStepConfig(value: unknown): ParsedTrailStepConfig;
|
|
905
|
+
|
|
906
|
+
declare function resolveAgentTargets(options: ResolveAgentTargetsOptions): readonly TrailStepAgentTarget[];
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* A captured document artifact. `Document` doubles as its own
|
|
910
|
+
* `Schema<Document>`: `validate`/`diagnostics`/`assert`/`jsonSchema`/
|
|
911
|
+
* `captureMode` are static members, so passing the class itself as
|
|
912
|
+
* `.prompt(source, { output: Document })` gives both the TypeScript output
|
|
913
|
+
* type and the runtime validator from one symbol -- no separate schema
|
|
914
|
+
* constant to import or keep in sync.
|
|
915
|
+
*/
|
|
916
|
+
declare class Document {
|
|
917
|
+
readonly content: string;
|
|
918
|
+
readonly path: string;
|
|
919
|
+
[key: string]: unknown;
|
|
920
|
+
static readonly captureMode: "raw-text";
|
|
921
|
+
static readonly jsonSchema: Record<string, unknown>;
|
|
922
|
+
static validate(value: unknown): value is Document;
|
|
923
|
+
static diagnostics(value: unknown): readonly ValidationDiagnostic[];
|
|
924
|
+
/**
|
|
925
|
+
* Deliberately duck-types instead of checking `instanceof Document`: on
|
|
926
|
+
* resume, a completed step's recorded output is replayed from
|
|
927
|
+
* `events.jsonl` via `JSON.parse`, producing a plain deserialized object —
|
|
928
|
+
* never a live `Document` instance — before `assert` is called on it. An
|
|
929
|
+
* `instanceof` check would fail every such replay. `assert` reconstructs a
|
|
930
|
+
* genuine `Document` from any content/path-shaped value, so every
|
|
931
|
+
* consumer downstream — a live capture or a replayed value alike — always
|
|
932
|
+
* receives a real `Document` instance with working prototype methods.
|
|
933
|
+
*/
|
|
934
|
+
static assert(value: unknown, label?: string): Document;
|
|
935
|
+
constructor(content: string, path: string);
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* Captures `content` as a durable document artifact for the currently
|
|
939
|
+
* executing step. Must be called from within a step's `.do()` callback —
|
|
940
|
+
* it reads the step-scoped ambient context (`RunContext.currentStep`, set
|
|
941
|
+
* by `withStepContext` for the duration of the step) to determine both the
|
|
942
|
+
* directory to write into and this call's 1-based index within the step, so
|
|
943
|
+
* that a step calling `document(...)` more than once gets
|
|
944
|
+
* `document-1.md`, `document-2.md`, etc.
|
|
945
|
+
*/
|
|
946
|
+
declare function document(content: string): Promise<Document>;
|
|
947
|
+
|
|
948
|
+
/** Ambient handle onto the active run's track-scoped durable key-value store. */
|
|
949
|
+
declare const globalState: {
|
|
950
|
+
get<T = unknown>(key: string): Promise<T | undefined>;
|
|
951
|
+
set(key: string, value: unknown): Promise<void>;
|
|
952
|
+
update<T = unknown>(key: string, updater: (current: T | undefined) => T | Promise<T>): Promise<T>;
|
|
953
|
+
};
|
|
954
|
+
|
|
955
|
+
interface NotifyArtifact {
|
|
956
|
+
readonly path: string;
|
|
957
|
+
readonly mediaType?: string;
|
|
958
|
+
readonly data?: PlainObject;
|
|
959
|
+
}
|
|
960
|
+
interface NotifyApi {
|
|
961
|
+
progress(message: string, data?: PlainObject): Promise<void>;
|
|
962
|
+
warning(message: string, data?: PlainObject): Promise<void>;
|
|
963
|
+
artifact(name: string, artifact: NotifyArtifact): Promise<void>;
|
|
964
|
+
}
|
|
965
|
+
declare const notify: NotifyApi;
|
|
966
|
+
|
|
967
|
+
/**
|
|
968
|
+
* Synchronously reads each named file relative to `dir` and returns its
|
|
969
|
+
* trimmed content keyed the same way, so a step's `prompt.ts` can load all
|
|
970
|
+
* of its shared markdown fragments in one call:
|
|
971
|
+
* `loadFragments(import.meta.dirname, { methodology: "../shared/methodology.md" })`.
|
|
972
|
+
*/
|
|
973
|
+
declare function loadFragments<TKey extends string>(dir: string, files: Record<TKey, string>): Record<TKey, string>;
|
|
974
|
+
/**
|
|
975
|
+
* Renders `body` as a `## title` markdown section, or `undefined` when
|
|
976
|
+
* `body` is falsy -- so a conditional section can be inlined directly as a
|
|
977
|
+
* `promptSections(...)` argument instead of built up separately.
|
|
978
|
+
*/
|
|
979
|
+
declare function section(title: string, body: string | false | null | undefined): string | undefined;
|
|
980
|
+
/**
|
|
981
|
+
* Joins prompt fragments and `section(...)` results with a blank line
|
|
982
|
+
* between each, dropping any falsy (conditionally-omitted) part.
|
|
983
|
+
*/
|
|
984
|
+
declare function promptSections(...parts: ReadonlyArray<string | false | null | undefined>): string;
|
|
985
|
+
/** Renders `items` as a markdown bullet list, one `- item` per line. */
|
|
986
|
+
declare function list(items: readonly string[]): string;
|
|
987
|
+
|
|
988
|
+
/** Loads a step's prompt from a local text file, resolved relative to the workflow/project `cwd` at dispatch time. */
|
|
989
|
+
declare function promptTemplate(path: string): PromptTemplateSource;
|
|
990
|
+
|
|
991
|
+
type JsonSchemaObject = JSONSchemaType<PlainObject> | Record<string, unknown>;
|
|
992
|
+
declare function normalizeShape<T extends PlainObject>(shapeInput: ShapeInput<T>): Schema<T>;
|
|
993
|
+
declare function shape<T extends PlainObject>(shapeObject: ShapeObject): Schema<T>;
|
|
994
|
+
declare function jsonSchema<T extends PlainObject>(schema: JsonSchemaObject): Schema<T>;
|
|
995
|
+
|
|
996
|
+
/**
|
|
997
|
+
* Ambient handle onto the active run's identity and durable key-value store.
|
|
998
|
+
* Backed by AsyncLocalStorage, set once per run by `runWorkflow`; step
|
|
999
|
+
* continuations import this directly rather than receiving it as an argument.
|
|
1000
|
+
*/
|
|
1001
|
+
declare const state: {
|
|
1002
|
+
get<T = unknown>(key: string): Promise<T | undefined>;
|
|
1003
|
+
getPersisted<T = unknown>(key: string): Promise<T | undefined>;
|
|
1004
|
+
set(key: string, value: unknown): Promise<void>;
|
|
1005
|
+
readonly id: string;
|
|
1006
|
+
readonly name: string;
|
|
1007
|
+
readonly path: string;
|
|
1008
|
+
readonly cwd: string | undefined;
|
|
1009
|
+
readonly executionCwd: string | undefined;
|
|
1010
|
+
readonly isReplayingCompletedStep: boolean;
|
|
1011
|
+
readonly projectCwd: string | undefined;
|
|
1012
|
+
};
|
|
1013
|
+
|
|
1014
|
+
/**
|
|
1015
|
+
* The only step-authoring primitive. `.prompt(...)` is optional; when present,
|
|
1016
|
+
* the step dispatches to an agent and `.do(...)` receives its structured
|
|
1017
|
+
* output. When absent, nothing is dispatched -- `.do(...)` receives the
|
|
1018
|
+
* step's input directly and is responsible for the work and the continuation
|
|
1019
|
+
* in one function. Either way, `.do(...)` produces a reusable `StepFactory`
|
|
1020
|
+
* -- call it with a live input value (`stepA(input)`) to get a `StepNode`.
|
|
1021
|
+
* When the inferred input type has no required keys, the argument is
|
|
1022
|
+
* optional (`stepA()`) and defaults to `{}`.
|
|
1023
|
+
*/
|
|
1024
|
+
interface StepBuilder {
|
|
1025
|
+
display(content?: StepDisplayContent<PlainObject, PlainObject>, options?: PlainObject): StepBuilder;
|
|
1026
|
+
wait(wait: WaitInput<PlainObject, PlainObject>): StepBuilder;
|
|
1027
|
+
wait<TWaitOutput extends PlainObject = PlainObject>(wait: CheckWaitCallback<PlainObject, PlainObject, TWaitOutput>, options: WaitOptions<TWaitOutput>): StepBuilder;
|
|
1028
|
+
prompt<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject>(source: AgentPrompt<TInput> | PromptTemplateSource, options?: PromptOptions<TOutput>): PromptedStepBuilder<TInput, TOutput>;
|
|
1029
|
+
do<TInput extends PlainObject = PlainObject>(onOutput: StepContextContinuation<TInput, TInput>): FluentStepFactory<TInput, TInput>;
|
|
1030
|
+
do<TInput extends PlainObject = PlainObject>(onOutput: StepContinuation<TInput, TInput>): FluentStepFactory<TInput, TInput>;
|
|
1031
|
+
}
|
|
1032
|
+
interface PromptedStepBuilder<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject> {
|
|
1033
|
+
display(content?: StepDisplayContent<TInput, TOutput>, options?: PlainObject): PromptedStepBuilder<TInput, TOutput>;
|
|
1034
|
+
wait(wait: WaitInput<TInput, TOutput>): PromptedStepBuilder<TInput, TOutput>;
|
|
1035
|
+
wait<TWaitOutput extends PlainObject = PlainObject>(wait: CheckWaitCallback<TInput, TOutput, TWaitOutput>, options: WaitOptions<TWaitOutput>): PromptedStepBuilder<TInput, TOutput>;
|
|
1036
|
+
do(onOutput: StepContextContinuation<TInput, TOutput>): FluentStepFactory<TInput, TOutput>;
|
|
1037
|
+
do(onOutput: StepContinuation<TInput, TOutput>): FluentStepFactory<TInput, TOutput>;
|
|
1038
|
+
}
|
|
1039
|
+
type FluentStepFactory<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject> = StepFactory<TInput, TOutput> & {
|
|
1040
|
+
catch(onError: StepErrorContinuation): FluentStepFactory<TInput, TOutput>;
|
|
1041
|
+
display(content?: StepDisplayContent<TInput, TOutput>, options?: PlainObject): FluentStepFactory<TInput, TOutput>;
|
|
1042
|
+
wait(wait: WaitInput<TInput, TOutput>): FluentStepFactory<TInput, TOutput>;
|
|
1043
|
+
wait<TWaitOutput extends PlainObject = PlainObject>(wait: CheckWaitCallback<TInput, TOutput, TWaitOutput>, options: WaitOptions<TWaitOutput>): FluentStepFactory<TInput, TOutput>;
|
|
1044
|
+
};
|
|
1045
|
+
declare function step(config: StepConfig): StepBuilder;
|
|
1046
|
+
declare function done<TOutput extends PlainObject = PlainObject>(output?: TOutput, options?: TerminalMessageOptions): DoneNode<TOutput>;
|
|
1047
|
+
declare function fail(failure: Failure, options?: TerminalMessageOptions): FailNode;
|
|
1048
|
+
declare function absoluteDone<TOutput extends PlainObject = PlainObject>(output?: TOutput, options?: TerminalMessageOptions): AbsoluteDoneNode<TOutput>;
|
|
1049
|
+
declare function absoluteFail(failure: Failure, options?: TerminalMessageOptions): AbsoluteFailNode;
|
|
1050
|
+
declare function parallel<TOutput extends PlainObject = PlainObject>(nodes: ContinuationArray, options?: ParallelOptions): ParallelNode<TOutput>;
|
|
1051
|
+
declare function isStepNode(value: unknown): value is StepNode;
|
|
1052
|
+
declare function isDoneNode(value: unknown): value is DoneNode;
|
|
1053
|
+
declare function isFailNode(value: unknown): value is FailNode;
|
|
1054
|
+
declare function isWorkflowInvocationNode(value: unknown): value is WorkflowInvocationNode;
|
|
1055
|
+
declare function isParallelNode(value: unknown): value is ParallelNode;
|
|
1056
|
+
declare function isAbsoluteDoneNode(value: unknown): value is AbsoluteDoneNode;
|
|
1057
|
+
declare function isAbsoluteFailNode(value: unknown): value is AbsoluteFailNode;
|
|
1058
|
+
|
|
1059
|
+
declare function subPrompt<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject>(source: AgentPrompt<TInput> | PromptTemplateSource, options: SubPromptOptions<TOutput>): SubPromptFactory<TInput, TOutput>;
|
|
1060
|
+
|
|
1061
|
+
declare function defineWorkflow<TInput extends PlainObject = PlainObject, TOutput extends PlainObject = PlainObject>(options: WorkflowBuilderOptions<TInput, TOutput>): DefinedWorkflow<TInput, TOutput>;
|
|
1062
|
+
|
|
1063
|
+
type DeepReadonly<T> = T extends (...args: never[]) => unknown ? T : T extends readonly (infer U)[] ? readonly DeepReadonly<U>[] : T extends object ? {
|
|
1064
|
+
readonly [K in keyof T]: DeepReadonly<T[K]>;
|
|
1065
|
+
} : T;
|
|
1066
|
+
interface WorkflowInputApi<TInput extends PlainObject = PlainObject> {
|
|
1067
|
+
input(): Promise<DeepReadonly<TInput>>;
|
|
1068
|
+
input<TOverrideInput extends PlainObject>(): Promise<DeepReadonly<TOverrideInput>>;
|
|
1069
|
+
inputValue<TKey extends keyof TInput & string>(key: TKey): Promise<DeepReadonly<TInput[TKey]>>;
|
|
1070
|
+
inputValue<TOverrideInput extends PlainObject, TKey extends keyof TOverrideInput & string>(key: TKey): Promise<DeepReadonly<TOverrideInput[TKey]>>;
|
|
1071
|
+
withInput<TTypedInput extends PlainObject>(): WorkflowInputApi<TTypedInput>;
|
|
1072
|
+
}
|
|
1073
|
+
declare const workflow: WorkflowInputApi;
|
|
1074
|
+
|
|
1075
|
+
type DeprecationTargetPackage = "@trailstep/core" | "@trailstep/authoring";
|
|
1076
|
+
interface DeprecationEntry {
|
|
1077
|
+
/** Which published package exports this symbol. A symbol re-exported by both (like `step`,
|
|
1078
|
+
* which authoring re-exports from core) needs one entry per package it's importable from, since a
|
|
1079
|
+
* workflow author might import it from either. */
|
|
1080
|
+
readonly package: DeprecationTargetPackage;
|
|
1081
|
+
/** The exact named export identifier, e.g. "step". Matched literally against import statement
|
|
1082
|
+
* text by the scanner. */
|
|
1083
|
+
readonly symbol: string;
|
|
1084
|
+
/** Semver version at/after which this symbol is considered deprecated (still works, warns). */
|
|
1085
|
+
readonly deprecatedSince: string;
|
|
1086
|
+
/** Semver version at/after which this symbol is actually removed (no longer works). Omit if the
|
|
1087
|
+
* symbol is deprecated but has no planned removal. */
|
|
1088
|
+
readonly removedIn?: string;
|
|
1089
|
+
/** Human-readable explanation, shown verbatim in doctor/update output. */
|
|
1090
|
+
readonly message: string;
|
|
1091
|
+
/** Optional suggested replacement API, shown as "Suggested replacement: <this>." */
|
|
1092
|
+
readonly replacement?: string;
|
|
1093
|
+
}
|
|
1094
|
+
type DeprecationManifest = readonly DeprecationEntry[];
|
|
1095
|
+
interface DeprecationStatus extends DeprecationEntry {
|
|
1096
|
+
readonly severity: "warning" | "blocking";
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
declare const deprecationManifest: DeprecationManifest;
|
|
1100
|
+
interface FindDeprecationsAsOfQuery {
|
|
1101
|
+
readonly package: DeprecationTargetPackage;
|
|
1102
|
+
readonly version: string;
|
|
1103
|
+
}
|
|
662
1104
|
/**
|
|
663
|
-
*
|
|
664
|
-
*
|
|
665
|
-
*
|
|
666
|
-
*
|
|
667
|
-
* This is the full four-provider set. Unlike Claude/Codex/Pi, `gemini`'s
|
|
668
|
-
* adapter is structurally verified only (an injected fake stdout-capturing
|
|
669
|
-
* runner in `agent.test.ts`/`gemini.test.ts`) — the real `gemini` CLI is not
|
|
670
|
-
* installed in this environment, so its argv/envelope shape has not been
|
|
671
|
-
* confirmed against a live process.
|
|
1105
|
+
* Returns every manifest entry for query.package whose deprecatedSince is at or before
|
|
1106
|
+
* query.version, tagged with a severity. Calling this once with version set to a target
|
|
1107
|
+
* version naturally captures every entry between the installed version and the target, no matter
|
|
1108
|
+
* how many majors are being skipped in one update.
|
|
672
1109
|
*/
|
|
673
|
-
declare
|
|
674
|
-
type ProviderRegistryKey = keyof typeof providerRegistry;
|
|
1110
|
+
declare function findDeprecationsAsOf(manifest: DeprecationManifest, query: FindDeprecationsAsOfQuery): readonly DeprecationStatus[];
|
|
675
1111
|
|
|
676
1112
|
type RunState = Record<string, unknown>;
|
|
677
1113
|
declare function defaultRunsRoot(cwd: string): string;
|
|
678
1114
|
declare function readRunEvents(runDir: string): Promise<Event[]>;
|
|
679
1115
|
declare function readRunState(runDir: string): Promise<RunState>;
|
|
680
1116
|
declare function writeRunState(runDir: string, state: RunState): Promise<void>;
|
|
1117
|
+
declare function readGlobalState(runDir: string): Promise<RunState>;
|
|
1118
|
+
declare function writeGlobalState(runDir: string, state: RunState): Promise<void>;
|
|
681
1119
|
|
|
682
1120
|
interface LatestUnresolvedFailure {
|
|
683
1121
|
readonly event: Event;
|
|
@@ -691,7 +1129,34 @@ declare function selectLatestUnresolvedFailure(events: readonly Event[]): Latest
|
|
|
691
1129
|
|
|
692
1130
|
declare function runWorkflow<TInput extends PlainObject, TOutput extends PlainObject>(options: RunWorkflowOptions<TInput, TOutput>): Promise<Result<TOutput>>;
|
|
693
1131
|
|
|
694
|
-
|
|
1132
|
+
interface TrackSummary {
|
|
1133
|
+
readonly runId: string;
|
|
1134
|
+
readonly status: string;
|
|
1135
|
+
readonly workers?: number;
|
|
1136
|
+
readonly failurePolicy?: string;
|
|
1137
|
+
readonly rootBranchId?: string;
|
|
1138
|
+
readonly terminalBranchId?: string;
|
|
1139
|
+
readonly terminalKind?: string;
|
|
1140
|
+
readonly terminalOutput?: unknown;
|
|
1141
|
+
readonly failure?: unknown;
|
|
1142
|
+
readonly splitOccurred?: boolean;
|
|
1143
|
+
readonly branches: readonly BranchSummary[];
|
|
1144
|
+
}
|
|
1145
|
+
interface BranchSummary {
|
|
1146
|
+
readonly branchId: string;
|
|
1147
|
+
readonly requestedBranchId?: string;
|
|
1148
|
+
readonly parentBranchId?: string;
|
|
1149
|
+
readonly status?: string;
|
|
1150
|
+
readonly workflowId?: string;
|
|
1151
|
+
readonly latestStepIndex?: number;
|
|
1152
|
+
readonly latestStepId?: string;
|
|
1153
|
+
readonly latestMessage?: string;
|
|
1154
|
+
readonly wait?: unknown;
|
|
1155
|
+
readonly failure?: unknown;
|
|
1156
|
+
readonly output?: unknown;
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
type RunSummaryStatus = "active" | "completed" | "failed" | "cancelled" | "archived" | "unknown";
|
|
695
1160
|
interface RunSummary {
|
|
696
1161
|
readonly runId: string;
|
|
697
1162
|
readonly runDir: string;
|
|
@@ -699,6 +1164,8 @@ interface RunSummary {
|
|
|
699
1164
|
readonly workflowId?: string;
|
|
700
1165
|
readonly lastTimestamp?: string;
|
|
701
1166
|
readonly latestFailure?: LatestUnresolvedFailure;
|
|
1167
|
+
readonly track?: TrackSummary;
|
|
1168
|
+
readonly trackWarning?: string;
|
|
702
1169
|
readonly warning?: string;
|
|
703
1170
|
}
|
|
704
1171
|
declare function listRunSummaries(options: {
|
|
@@ -710,4 +1177,73 @@ declare function selectRecentFailedRunSummaries(summaries: readonly RunSummary[]
|
|
|
710
1177
|
}): RunSummary[];
|
|
711
1178
|
declare function newestFirst(left: RunSummary, right: RunSummary): number;
|
|
712
1179
|
|
|
713
|
-
|
|
1180
|
+
interface StorageLifecyclePolicy {
|
|
1181
|
+
readonly enabled?: boolean;
|
|
1182
|
+
readonly archiveAfterDays?: number | false;
|
|
1183
|
+
readonly deleteAfterDays?: number | false;
|
|
1184
|
+
readonly workflows?: Readonly<Record<string, {
|
|
1185
|
+
readonly archiveAfterDays?: number | false;
|
|
1186
|
+
readonly deleteAfterDays?: number | false;
|
|
1187
|
+
}>>;
|
|
1188
|
+
}
|
|
1189
|
+
interface StorageLifecycleAction {
|
|
1190
|
+
readonly action: "archive" | "delete-hot" | "delete-archive";
|
|
1191
|
+
readonly runId: string;
|
|
1192
|
+
readonly reason: string;
|
|
1193
|
+
readonly path: string;
|
|
1194
|
+
}
|
|
1195
|
+
interface StorageLifecycleStatus {
|
|
1196
|
+
readonly runsRoot: string;
|
|
1197
|
+
readonly enabled: boolean;
|
|
1198
|
+
readonly hotRuns: number;
|
|
1199
|
+
readonly archivedRuns: number;
|
|
1200
|
+
readonly pinnedRuns: readonly string[];
|
|
1201
|
+
}
|
|
1202
|
+
declare function storageArchiveDir(runsRoot: string): string;
|
|
1203
|
+
declare function storagePinPath(runDir: string): string;
|
|
1204
|
+
declare function readStorageLifecycleStatus(options: {
|
|
1205
|
+
readonly cwd: string;
|
|
1206
|
+
readonly runsRoot?: string;
|
|
1207
|
+
readonly policy?: StorageLifecyclePolicy;
|
|
1208
|
+
}): Promise<StorageLifecycleStatus>;
|
|
1209
|
+
declare function planStorageLifecycle(options: {
|
|
1210
|
+
readonly cwd: string;
|
|
1211
|
+
readonly runsRoot?: string;
|
|
1212
|
+
readonly policy?: StorageLifecyclePolicy;
|
|
1213
|
+
readonly now?: Date;
|
|
1214
|
+
}): Promise<StorageLifecycleAction[]>;
|
|
1215
|
+
declare function applyStorageLifecycle(options: {
|
|
1216
|
+
readonly cwd: string;
|
|
1217
|
+
readonly runsRoot?: string;
|
|
1218
|
+
readonly policy?: StorageLifecyclePolicy;
|
|
1219
|
+
readonly now?: Date;
|
|
1220
|
+
readonly dryRun?: boolean;
|
|
1221
|
+
}): Promise<StorageLifecycleAction[]>;
|
|
1222
|
+
declare function archiveRun(options: {
|
|
1223
|
+
readonly runsRoot: string;
|
|
1224
|
+
readonly runId: string;
|
|
1225
|
+
readonly now?: Date;
|
|
1226
|
+
}): Promise<void>;
|
|
1227
|
+
declare function restoreArchivedRun(options: {
|
|
1228
|
+
readonly runsRoot: string;
|
|
1229
|
+
readonly runId: string;
|
|
1230
|
+
}): Promise<void>;
|
|
1231
|
+
declare function pinRun(options: {
|
|
1232
|
+
readonly runsRoot: string;
|
|
1233
|
+
readonly runId: string;
|
|
1234
|
+
}): Promise<void>;
|
|
1235
|
+
declare function unpinRun(options: {
|
|
1236
|
+
readonly runsRoot: string;
|
|
1237
|
+
readonly runId: string;
|
|
1238
|
+
}): Promise<void>;
|
|
1239
|
+
declare function deleteRun(options: {
|
|
1240
|
+
readonly runsRoot: string;
|
|
1241
|
+
readonly runId: string;
|
|
1242
|
+
}): Promise<void>;
|
|
1243
|
+
declare function deleteArchivedRun(options: {
|
|
1244
|
+
readonly runsRoot: string;
|
|
1245
|
+
readonly runId: string;
|
|
1246
|
+
}): Promise<void>;
|
|
1247
|
+
declare function parseStorageLifecycleDurationDays(value: string): number | undefined;
|
|
1248
|
+
|
|
1249
|
+
export { type AbsoluteDoneNode, type AbsoluteFailNode, type AgentAdapter, type AgentAdapterObject, type AgentAdapterRequest, type AgentAdapterSelection, type AgentMessage, type AgentModelTarget, type AgentPrompt, type AgentTool, type BranchSummary, CANCELLATION_MARKER_FILE, type CancellationMarker, type CheckWaitCallback, type CheckWaitContext, type CheckWaitHelpers, type ContinuationArray, type ContinuationResult, type ContinuationStepConfig, type DeepReadonly, type DefinedWorkflow, type DeprecationEntry, type DeprecationManifest, type DeprecationStatus, type DeprecationTargetPackage, type DisplayPhase, type DoPhase, Document, type DoneNode, type Event, type FailNode, type Failure, type FindDeprecationsAsOfQuery, type InteractiveProcessRequest, type InteractiveProcessResult, type InteractiveProcessRunner, type JsonSchemaObject, type LatestUnresolvedFailure, type LaunchInteractiveAgentTargetOptions, type LaunchInteractiveAgentTargetResult, type ManagedSessionPromptInjectionMode, type NotifyApi, type NotifyArtifact, type ParallelNode, type PlainObject, type PostContinuation, type PromptOptions, type PromptPhase, type PromptTemplateSource, type ProviderAdapter, type ProviderInteractiveInvocationSpec, type ProviderInteractiveRequest, type ProviderManagedSessionPromptDelivery, type ProviderModelDiscoveryOutputParser, type ProviderModelDiscoverySpec, type ProviderModelOverrideSupport, type ProviderOutputParsingMetadata, type ProviderOutputSpec, type ProviderOutputStyle, type ProviderPromptFileReferenceStyle, type ProviderPromptInputSpec, type ProviderSpec, type ProviderThinkingOverrideSupport, type ProviderWorkingInvocationSpec, type ProviderWorkingProcessRequest, type ProviderWorkingProcessResult, type ProviderWorkingRepairInvocationSpec, type ProviderWorkingRequest, type ProviderWorkingRunner, type ResolveAgentTargetsOptions, type ResolveRetryPolicyOptions, type ResolveTimeoutPolicyOptions, type Result, type RetryPolicy, type RetryPolicyInput, type RunSummary, type RunSummaryStatus, type RunWorkflowOptions, type RunWorkflowRetryOptions, type RunWorkflowTrackRetryOptions, type RunnableContinuationNode, type Schema, type ShapeInput, type ShapeObject, type ShapePrimitive, type StepConfig, type StepContextContinuation, type StepContinuation, type StepContinuationOutput, type StepCwdCallback, type StepCwdContext, type StepCwdInput, type StepDisplayCallback, type StepDisplayContent, type StepDisplayContext, type StepDisplayLevel, type StepDisplayObject, type StepDisplayValue, type StepErrorContinuation, type StepFactory, type StepInvocationOptions, type StepNode, type StepPhase, type StepWaitContext, type StorageLifecycleAction, type StorageLifecyclePolicy, type StorageLifecycleStatus, type SubPromptFactory, type SubPromptOptions, type TerminalMessageOptions, type TimeoutPolicy, type TimeoutPolicyInput, type TrackSummary, type TrailStepAgentMappings, type TrailStepAgentTarget, type TrailStepConfig, type TrailStepCustomProviderConfig, type TrailStepCustomProviderModelOverrideSupport, type TrailStepCustomProviderThinkingOverrideSupport, TrailStepFailureError, type TrailStepProviderEnvironmentManifest, type TrailStepProviderInteractiveManifest, type TrailStepProviderManifest, type TrailStepProviderModelDiscoveryManifest, type TrailStepProviderModelManifest, type TrailStepProviderOutputManifest, type TrailStepProviderOutputParsingManifest, type TrailStepProviderOutputStyle, type TrailStepProviderPackageDefinition, type TrailStepProviderPromptFileReferenceStyle, type TrailStepProviderPromptManifest, type TrailStepProviderRegistration, type TrailStepProviderSource, type TrailStepProviderThinkingManifest, type TrailStepProviderWorkingManifest, type TrailStepSettings, type TrailStepWorkflowConfig, type WaitCallback, type WaitCheckResult, type WaitDefinition, type WaitDoneResult, type WaitInput, type WaitOptions, type WaitPendingInput, type WaitPendingResult, type WaitPhase, type WaitResultDetails, type Workflow, type WorkflowAgentRole, type WorkflowAgentSize, type WorkflowAgentThinking, type WorkflowBuilderOptions, type WorkflowInputApi, type WorkflowInvocationNode, type WorkflowInvocationOptions, type WorkflowSkillOptions, type WorkingAgentProcessRequest, type WorkingAgentProcessResult, type WorkingAgentProcessRunner, absoluteDone, absoluteFail, applyStorageLifecycle, archiveRun, cancellationMarkerPath, defaultRunsRoot, defineWorkflow, deleteArchivedRun, deleteRun, deprecationManifest, document, done, fail, findDeprecationsAsOf, globalState, isAbsoluteDoneNode, isAbsoluteFailNode, isDoneNode, isFailNode, isParallelNode, isStepNode, isWorkflowInvocationNode, jsonSchema, launchInteractiveAgentTarget, list, listRunSummaries, loadFragments, newestFirst, normalizeShape, notify, parallel, parseStorageLifecycleDurationDays, parseTrailStepConfig, parseTrailStepProviderManifest, pinRun, planStorageLifecycle, promptSections, promptTemplate, readCancellationMarker, readGlobalState, readRunEvents, readRunState, readStorageLifecycleStatus, resolveAgentTargets, resolveRetryPolicy, resolveTimeoutPolicy, restoreArchivedRun, runWorkflow, section, selectLatestUnresolvedFailure, selectRecentFailedRunSummaries, shape, state, step, storageArchiveDir, storagePinPath, subPrompt, unpinRun, validateRetryPolicy, validateTimeoutPolicy, workflow, writeCancellationMarker, writeGlobalState, writeRunState };
|