@iqai/adk-cli
Version:
CLI tool for creating, running, and testing ADK-TS agents
145 lines • 7.45 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.ArtifactsController = void 0;
const common_1 = require("@nestjs/common");
const swagger_1 = require("@nestjs/swagger");
const api_dto_1 = require("../dto/api.dto");
const artifacts_service_1 = require("./artifacts.service");
let ArtifactsController = class ArtifactsController {
artifacts;
constructor(artifacts) {
this.artifacts = artifacts;
}
async listArtifacts(id, sessionId) {
const agentPath = decodeURIComponent(id);
return this.artifacts.listArtifacts(agentPath, sessionId);
}
async getArtifact(id, sessionId, artifactName) {
const agentPath = decodeURIComponent(id);
return this.artifacts.getArtifact(agentPath, sessionId, artifactName);
}
async listArtifactVersions(id, sessionId, artifactName) {
const agentPath = decodeURIComponent(id);
return this.artifacts.listArtifactVersions(agentPath, sessionId, artifactName);
}
async getArtifactVersion(id, sessionId, artifactName, versionId) {
const agentPath = decodeURIComponent(id);
const version = Number.parseInt(versionId, 10);
return this.artifacts.getArtifactVersion(agentPath, sessionId, artifactName, version);
}
async deleteArtifact(id, sessionId, artifactName) {
const agentPath = decodeURIComponent(id);
return this.artifacts.deleteArtifact(agentPath, sessionId, artifactName);
}
};
exports.ArtifactsController = ArtifactsController;
__decorate([
(0, common_1.Get)(),
(0, swagger_1.ApiOperation)({
summary: "List all artifacts for a session",
description: "Returns all artifact filenames for the specified agent session.",
}),
(0, swagger_1.ApiParam)({
name: "id",
description: "URL-encoded absolute agent path or identifier",
}),
(0, swagger_1.ApiParam)({
name: "sessionId",
description: "Session identifier",
}),
(0, swagger_1.ApiOkResponse)({ type: api_dto_1.ArtifactsListResponseDto }),
__param(0, (0, common_1.Param)("id")),
__param(1, (0, common_1.Param)("sessionId")),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, String]),
__metadata("design:returntype", Promise)
], ArtifactsController.prototype, "listArtifacts", null);
__decorate([
(0, common_1.Get)(":artifactName"),
(0, swagger_1.ApiOperation)({
summary: "Get an artifact",
description: "Returns the latest version of the specified artifact.",
}),
(0, swagger_1.ApiParam)({ name: "id", description: "Agent identifier" }),
(0, swagger_1.ApiParam)({ name: "sessionId", description: "Session identifier" }),
(0, swagger_1.ApiParam)({ name: "artifactName", description: "Artifact filename" }),
(0, swagger_1.ApiOkResponse)({ type: api_dto_1.ArtifactResponseDto }),
__param(0, (0, common_1.Param)("id")),
__param(1, (0, common_1.Param)("sessionId")),
__param(2, (0, common_1.Param)("artifactName")),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, String, String]),
__metadata("design:returntype", Promise)
], ArtifactsController.prototype, "getArtifact", null);
__decorate([
(0, common_1.Get)(":artifactName/versions"),
(0, swagger_1.ApiOperation)({
summary: "List artifact versions",
description: "Returns all available versions of the specified artifact.",
}),
(0, swagger_1.ApiParam)({ name: "id", description: "Agent identifier" }),
(0, swagger_1.ApiParam)({ name: "sessionId", description: "Session identifier" }),
(0, swagger_1.ApiParam)({ name: "artifactName", description: "Artifact filename" }),
(0, swagger_1.ApiOkResponse)({ type: api_dto_1.ArtifactVersionsResponseDto }),
__param(0, (0, common_1.Param)("id")),
__param(1, (0, common_1.Param)("sessionId")),
__param(2, (0, common_1.Param)("artifactName")),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, String, String]),
__metadata("design:returntype", Promise)
], ArtifactsController.prototype, "listArtifactVersions", null);
__decorate([
(0, common_1.Get)(":artifactName/versions/:versionId"),
(0, swagger_1.ApiOperation)({
summary: "Get a specific artifact version",
description: "Returns a specific version of the specified artifact.",
}),
(0, swagger_1.ApiParam)({ name: "id", description: "Agent identifier" }),
(0, swagger_1.ApiParam)({ name: "sessionId", description: "Session identifier" }),
(0, swagger_1.ApiParam)({ name: "artifactName", description: "Artifact filename" }),
(0, swagger_1.ApiParam)({ name: "versionId", description: "Version number" }),
(0, swagger_1.ApiOkResponse)({ type: api_dto_1.ArtifactResponseDto }),
__param(0, (0, common_1.Param)("id")),
__param(1, (0, common_1.Param)("sessionId")),
__param(2, (0, common_1.Param)("artifactName")),
__param(3, (0, common_1.Param)("versionId")),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, String, String, String]),
__metadata("design:returntype", Promise)
], ArtifactsController.prototype, "getArtifactVersion", null);
__decorate([
(0, common_1.Delete)(":artifactName"),
(0, swagger_1.ApiOperation)({
summary: "Delete an artifact",
description: "Deletes all versions of the specified artifact.",
}),
(0, swagger_1.ApiParam)({ name: "id", description: "Agent identifier" }),
(0, swagger_1.ApiParam)({ name: "sessionId", description: "Session identifier" }),
(0, swagger_1.ApiParam)({ name: "artifactName", description: "Artifact filename" }),
(0, swagger_1.ApiOkResponse)({ type: api_dto_1.SuccessResponseDto }),
__param(0, (0, common_1.Param)("id")),
__param(1, (0, common_1.Param)("sessionId")),
__param(2, (0, common_1.Param)("artifactName")),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, String, String]),
__metadata("design:returntype", Promise)
], ArtifactsController.prototype, "deleteArtifact", null);
exports.ArtifactsController = ArtifactsController = __decorate([
(0, swagger_1.ApiTags)("artifacts"),
(0, common_1.Controller)("api/agents/:id/sessions/:sessionId/artifacts"),
__param(0, (0, common_1.Inject)(artifacts_service_1.ArtifactsService)),
__metadata("design:paramtypes", [artifacts_service_1.ArtifactsService])
], ArtifactsController);
//# sourceMappingURL=artifacts.controller.js.map