@iqai/adk-cli
Version:
CLI tool for creating, running, and testing ADK-TS agents
83 lines • 3.82 kB
JavaScript
;
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.MessagingController = void 0;
const common_1 = require("@nestjs/common");
const swagger_1 = require("@nestjs/swagger");
const api_dto_1 = require("../dto/api.dto");
const messaging_service_1 = require("./messaging.service");
let MessagingController = class MessagingController {
messaging;
constructor(messaging) {
this.messaging = messaging;
}
async getAgentMessages(id) {
const agentPath = decodeURIComponent(id);
return this.messaging.getMessages(agentPath);
}
async postAgentMessage(id, body) {
const agentPath = decodeURIComponent(id);
return this.messaging.postMessage(agentPath, body);
}
};
exports.MessagingController = MessagingController;
__decorate([
(0, common_1.Get)("messages"),
(0, swagger_1.ApiOperation)({
summary: "Get message history",
description: "Returns ordered chat transcript for the agent, including user and assistant messages.",
}),
(0, swagger_1.ApiParam)({ name: "id", description: "Agent identifier" }),
(0, swagger_1.ApiOkResponse)({ type: api_dto_1.MessagesResponseDto }),
__param(0, (0, common_1.Param)("id")),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", Promise)
], MessagingController.prototype, "getAgentMessages", null);
__decorate([
(0, common_1.Post)("message"),
(0, swagger_1.ApiOperation)({
summary: "Send a message to the agent",
description: "Adds a user message (with optional base64 attachments) and returns the assistant response.",
}),
(0, swagger_1.ApiParam)({ name: "id", description: "Agent identifier" }),
(0, swagger_1.ApiBody)({
description: "Message payload",
schema: {
example: {
message: "Hello agent!",
attachments: [
{
name: "notes.txt",
mimeType: "text/plain",
data: "YmFzZTY0IGRhdGE=",
},
],
},
},
}),
(0, swagger_1.ApiOkResponse)({ type: api_dto_1.MessageResponseDto }),
__param(0, (0, common_1.Param)("id")),
__param(1, (0, common_1.Body)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, Object]),
__metadata("design:returntype", Promise)
], MessagingController.prototype, "postAgentMessage", null);
exports.MessagingController = MessagingController = __decorate([
(0, swagger_1.ApiTags)("messaging"),
(0, common_1.Controller)("api/agents/:id"),
__param(0, (0, common_1.Inject)(messaging_service_1.MessagingService)),
__metadata("design:paramtypes", [messaging_service_1.MessagingService])
], MessagingController);
//# sourceMappingURL=messaging.controller.js.map