UNPKG

donobu

Version:

Create browser automations with an LLM agent and replay them as Playwright scripts.

42 lines 1.6 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FlowsToolCallsApi = void 0; const ToolCallNotFoundException_1 = require("../exceptions/ToolCallNotFoundException"); const JsonUtils_1 = require("../utils/JsonUtils"); class FlowsToolCallsApi { constructor(donobuFlowsManager) { this.donobuFlowsManager = donobuFlowsManager; } /** * Get all tool calls for a specific flow */ async getToolCalls(req, res) { const flowId = req.params.flowId; const toolCalls = await this.donobuFlowsManager.getToolCalls(flowId); res.json(toolCalls); } /** * Get a specific tool call for a flow */ async getToolCall(req, res) { const flowId = req.params.flowId; const toolCallId = req.params.toolCallId; const toolCalls = await this.donobuFlowsManager.getToolCalls(flowId); const response = toolCalls.find((call) => call.id === toolCallId); if (!response) { throw new ToolCallNotFoundException_1.ToolCallNotFoundException(toolCallId); } res.json(response); } /** * Propose a new tool call for a flow */ async postToolCalls(req, res) { const flowId = req.params.flowId; const clientProposedToolCall = req.body; await this.donobuFlowsManager.proposeToolCall(flowId, clientProposedToolCall.name, JsonUtils_1.JsonUtils.objectToJson(clientProposedToolCall.parameters)); res.sendStatus(200); } } exports.FlowsToolCallsApi = FlowsToolCallsApi; //# sourceMappingURL=FlowsToolCallsApi.js.map