UNPKG

@iqai/adk-cli

Version:

CLI tool for creating, running, and testing ADK-TS agents

58 lines 2.89 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; Object.defineProperty(exports, "__esModule", { value: true }); exports.GraphController = void 0; const common_1 = require("@nestjs/common"); const swagger_1 = require("@nestjs/swagger"); const api_dto_1 = require("../dto/api.dto"); const agent_graph_service_1 = require("../providers/agent-graph.service"); let GraphController = class GraphController { graph; constructor(graph) { this.graph = graph; } logger = new common_1.Logger("graph-controller"); async getGraph(id) { try { const agentPath = decodeURIComponent(id); return await this.graph.getGraph(agentPath); } catch (e) { this.logger.error(`Failed to build graph for id='${id}': ${e instanceof Error ? e.message : String(e)}`); // Do not fail the request; return an empty graph so UI can handle gracefully return { nodes: [], edges: [] }; } } }; exports.GraphController = GraphController; __decorate([ (0, common_1.Get)("graph"), (0, swagger_1.ApiOperation)({ summary: "Get agent graph", description: "Returns the agent graph (nodes and edges) for the selected root agent. Tools are always included.", }), (0, swagger_1.ApiParam)({ name: "id", description: "Agent identifier (relative path)" }), (0, swagger_1.ApiOkResponse)({ type: api_dto_1.GraphResponseDto }), __param(0, (0, common_1.Param)("id")), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise) ], GraphController.prototype, "getGraph", null); exports.GraphController = GraphController = __decorate([ (0, swagger_1.ApiTags)("agents"), (0, common_1.Controller)("api/agents/:id"), __param(0, (0, common_1.Inject)(agent_graph_service_1.AgentGraphService)), __metadata("design:paramtypes", [agent_graph_service_1.AgentGraphService]) ], GraphController); //# sourceMappingURL=graph.controller.js.map