@graphteon/juricode
Version:
We are forging the future with lines of digital steel
51 lines • 1.97 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TaskService = void 0;
const open_hands_1 = __importDefault(require("./open-hands"));
class TaskService {
async createTask(input) {
const conversation = await open_hands_1.default.createConversation(input.repository, input.git_provider, input.initial_user_msg, input.image_urls, input.replay_json, input.selected_branch);
return conversation;
}
async getTasks() {
const conversations = await open_hands_1.default.getUserConversations();
return conversations;
}
async getTask(id) {
const conversation = await open_hands_1.default.getConversation(id);
if (!conversation) {
throw new Error(`Task with ID ${id} not found`);
}
return conversation;
}
async updateTask(id, input) {
const conversation = await open_hands_1.default.getConversation(id);
if (!conversation) {
throw new Error(`Task with ID ${id} not found`);
}
console.warn('Task update functionality is limited in the current API');
return conversation;
}
async deleteTask(id) {
await open_hands_1.default.deleteUserConversation(id);
}
async startTask(id, providers) {
const conversation = await open_hands_1.default.startConversation(id, providers);
if (!conversation) {
throw new Error(`Failed to start task with ID ${id}`);
}
return conversation;
}
async stopTask(id) {
const conversation = await open_hands_1.default.stopConversation(id);
if (!conversation) {
throw new Error(`Failed to stop task with ID ${id}`);
}
return conversation;
}
}
exports.TaskService = TaskService;
//# sourceMappingURL=task.js.map