@graphteon/juricode
Version:
We are forging the future with lines of digital steel
44 lines • 1.59 kB
JavaScript
import OpenHands from './open-hands';
export class TaskService {
async createTask(input) {
const conversation = await OpenHands.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 OpenHands.getUserConversations();
return conversations;
}
async getTask(id) {
const conversation = await OpenHands.getConversation(id);
if (!conversation) {
throw new Error(`Task with ID ${id} not found`);
}
return conversation;
}
async updateTask(id, input) {
const conversation = await OpenHands.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 OpenHands.deleteUserConversation(id);
}
async startTask(id, providers) {
const conversation = await OpenHands.startConversation(id, providers);
if (!conversation) {
throw new Error(`Failed to start task with ID ${id}`);
}
return conversation;
}
async stopTask(id) {
const conversation = await OpenHands.stopConversation(id);
if (!conversation) {
throw new Error(`Failed to stop task with ID ${id}`);
}
return conversation;
}
}
//# sourceMappingURL=task.js.map