fix: export and mark methods as protected

Philipp Burckhardt 2023-06-04 23:58:21 -04:00
rodzic 1a283ef573
commit e69aed20a4
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: A2C3BCA4F31D1DDD
1 zmienionych plików z 7 dodań i 7 usunięć

Wyświetl plik

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