Public declaration syntax from forge-ts/packages/forge-generate/src/step.ts Original source SHA-256: ca69fdc92362404ebcac07a01890379a9d78e5bcbbf44ba25ceccdec6a229ded Function bodies and constant values are omitted. This is not the complete implementation. Source line 45 export type StopCondition = | { readonly type: 'max_steps'; readonly maxSteps: number } | { readonly type: 'max_tokens'; readonly maxTokens: number } | { readonly type: 'text_match'; readonly pattern: string } | { readonly type: 'custom'; readonly predicate: (result: GenerateResult) => boolean }; Source line 57 export function maxSteps(maxSteps: number): StopCondition; Source line 67 export function maxTokens(maxTokens: number): StopCondition; Source line 77 export function textMatch(pattern: string): StopCondition; Source line 88 export function customStop(predicate: (result: GenerateResult) => boolean): StopCondition; Source line 98 export type StopReason = | { readonly type: 'model_stopped' } | { readonly type: 'step_limit_reached'; readonly steps: number; readonly limit: number } | { readonly type: 'token_limit_reached'; readonly totalTokens: number; readonly limit: number } | { readonly type: 'text_match_found'; readonly pattern: string } | { readonly type: 'custom_condition' }; Source line 111 export function formatStopReason(reason: StopReason): string; Source line 139 export interface StepResult { /** The ordered sequence of generation results, one per step. */ readonly steps: readonly GenerateResult[]; /** Cumulative token usage across all steps. */ readonly totalUsage: Usage; /** Why multi-step generation stopped. */ readonly stopReason: StopReason; } Source line 154 export function finalText(result: StepResult): string; Source line 167 export function stepCount(result: StepResult): number; Source line 177 export function completedNaturally(result: StepResult): boolean; Source line 213 export async function generateSteps( model: LanguageModel, initialMessages: readonly ModelMessage[], tools: readonly ToolDefinition[], options: GenerateOptions, stop: StopCondition ): Promise;