diff --git a/src/tools/feedback.ts b/src/tools/feedback.ts index a76e2a5c..93cefc03 100644 --- a/src/tools/feedback.ts +++ b/src/tools/feedback.ts @@ -9,7 +9,7 @@ import { BaseTask } from '../task' /** * Actions the user can take in the feedback selection prompt. */ -const UserActions = { +export const UserActions = { Accept: 'accept', Edit: 'edit', Decline: 'decline', @@ -17,7 +17,7 @@ const UserActions = { Exit: 'exit' } as const -type UserActions = (typeof UserActions)[keyof typeof UserActions] +export type UserActions = (typeof UserActions)[keyof typeof UserActions] /** * Messages to display to the user for each action. @@ -37,7 +37,7 @@ async function askUser( message: string, choices: UserActions[] ): Promise { - return await select({ + return select({ message, choices: choices.map((choice) => ({ name: UserActionMessages[choice], @@ -62,7 +62,7 @@ export class HumanFeedbackSingle extends BaseTask< ZodTypeAny, ZodTypeAny > { - private choiceSchema: T + protected choiceSchema: T constructor(choiceSchema: T) { super() @@ -77,7 +77,7 @@ export class HumanFeedbackSingle extends BaseTask< return FeedbackSingleOutputSchema(this.choiceSchema) } - private actionHandlers = { + protected actionHandlers = { [UserActions.Accept]: ( input: types.ParsedData ) => ({ result: input, accepted: true }), @@ -146,7 +146,7 @@ export class HumanFeedbackSelect extends BaseTask< ZodTypeAny, ZodTypeAny > { - private choiceSchema: T + protected choiceSchema: T constructor(choiceSchema: T) { super() @@ -161,7 +161,7 @@ export class HumanFeedbackSelect extends BaseTask< return FeedbackSelectOutputSchema(this.choiceSchema) } - private actionHandlers = { + protected actionHandlers = { [UserActions.Accept]: ( input: types.ParsedData ) => ({ results: input, accepted: true }),