UNPKG

pyb-ts

Version:

PYB-CLI - Minimal AI Agent with multi-model support and CLI interface

47 lines (46 loc) 1.4 kB
import chalk from "chalk"; import { toolUseConfirmGetPrefix } from "./PermissionRequest.js"; import { isUnsafeCompoundCommand } from "@utils/commands"; import { getCwd } from "@utils/state"; import { getTheme } from "@utils/theme"; function toolUseOptions({ toolUseConfirm, command }) { const showDontAskAgainOption = !isUnsafeCompoundCommand(command) && toolUseConfirm.commandPrefix && !toolUseConfirm.commandPrefix.commandInjectionDetected; const prefix = toolUseConfirmGetPrefix(toolUseConfirm); const showDontAskAgainPrefixOption = showDontAskAgainOption && prefix !== null; let dontShowAgainOptions = []; if (showDontAskAgainPrefixOption) { dontShowAgainOptions = [ { label: `Yes, and don't ask again for ${chalk.bold(prefix)} commands in ${chalk.bold(getCwd())}`, value: "yes-dont-ask-again-prefix" } ]; } else if (showDontAskAgainOption) { dontShowAgainOptions = [ { label: `Yes, and don't ask again for ${chalk.bold(command)} commands in ${chalk.bold(getCwd())}`, value: "yes-dont-ask-again-full" } ]; } return [ { label: "Yes", value: "yes" }, ...dontShowAgainOptions, { label: `No, and provide instructions (${chalk.bold.hex(getTheme().warning)("esc")})`, value: "no" } ]; } export { toolUseOptions }; //# sourceMappingURL=toolUseOptions.js.map