UNPKG

capsule-ai-cli

Version:

The AI Model Orchestrator - Intelligent multi-model workflows with device-locked licensing

29 lines 1.07 kB
import { BashTool } from './bash.js'; import { bashConfirmationService } from '../../services/bash-confirmation.js'; import { stateService } from '../../services/state.js'; export class BashWithConfirmationTool extends BashTool { ui = { showProgress: true, collapsible: true, dangerous: false }; async run(params, context) { const { command, cwd } = params; const currentMode = stateService.getMode(); if (currentMode === 'auto') { return super.run(params, context); } const workingDir = cwd || context.workingDirectory || process.cwd(); const isDangerous = bashConfirmationService.isDangerousCommand(command); const approved = await bashConfirmationService.confirmBash({ command, workingDirectory: workingDir, isDangerous }); if (!approved) { throw new Error('Command cancelled by user'); } return super.run(params, context); } } //# sourceMappingURL=bash-with-confirmation.js.map