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