
import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
import { Disposable } from '../../../../../../base/common/lifecycle.js';
import { IInstantiationService } from '../../../../../../platform/instantiation/common/instantiation.js';
import { ILanguageModelToolsService } from '../languageModelToolsService.service.js';
import { ConfirmationTool, ConfirmationToolData } from './confirmationTool.js';
import { EditTool, EditToolData } from './editFileTool.js';
import { createManageTodoListToolData, ManageTodoListTool } from './manageTodoListTool.js';
import { RunSubagentTool } from './runSubagentTool.js';

let BuiltinToolsContribution = class BuiltinToolsContribution extends Disposable {
    static {
        this.ID = "chat.builtinTools";
    }
    constructor(toolsService, instantiationService) {
        super();
        const editTool = instantiationService.createInstance(EditTool);
        this._register(toolsService.registerTool(EditToolData, editTool));
        const todoToolData = createManageTodoListToolData();
        const manageTodoListTool = this._register(instantiationService.createInstance(ManageTodoListTool));
        this._register(toolsService.registerTool(todoToolData, manageTodoListTool));
        const confirmationTool = instantiationService.createInstance(ConfirmationTool);
        this._register(toolsService.registerTool(ConfirmationToolData, confirmationTool));
        const runSubagentTool = this._register(instantiationService.createInstance(RunSubagentTool));
        let runSubagentRegistration;
        let toolSetRegistration;
        const registerRunSubagentTool = () => {
            runSubagentRegistration?.dispose();
            toolSetRegistration?.dispose();
            toolsService.flushToolUpdates();
            const runSubagentToolData = runSubagentTool.getToolData();
            runSubagentRegistration = toolsService.registerTool(runSubagentToolData, runSubagentTool);
            toolSetRegistration = toolsService.agentToolSet.addTool(runSubagentToolData);
        };
        registerRunSubagentTool();
        this._register(runSubagentTool.onDidUpdateToolData(registerRunSubagentTool));
        this._register({
            dispose: () => {
                runSubagentRegistration?.dispose();
                toolSetRegistration?.dispose();
            }
        });
    }
};
BuiltinToolsContribution = ( __decorate([( __param(0, ILanguageModelToolsService)), ( __param(1, IInstantiationService))], BuiltinToolsContribution));
const InternalFetchWebPageToolId = "vscode_fetchWebPage_internal";

export { BuiltinToolsContribution, InternalFetchWebPageToolId };
