MCPcopy Create free account
hub / github.com/MemTensor/MemOS / handleTaskUpdate

Method handleTaskUpdate

packages/memos-core/src/viewer/server.ts:1356–1378  ·  view source on GitHub ↗
(req: http.IncomingMessage, res: http.ServerResponse, urlPath: string)

Source from the content-addressed store, hash-verified

1354 }
1355
1356 private handleTaskUpdate(req: http.IncomingMessage, res: http.ServerResponse, urlPath: string): void {
1357 const taskId = urlPath.replace("/api/task/", "");
1358 this.readBody(req, (body) => {
1359 try {
1360 const data = JSON.parse(body);
1361 const task = this.store.getTask(taskId);
1362 if (!task) { res.writeHead(404, { "Content-Type": "application/json" }); res.end(JSON.stringify({ error: "Task not found" })); return; }
1363 const newTitle = data.title ?? task.title;
1364 const newSummary = data.summary ?? task.summary;
1365 this.store.updateTask(taskId, {
1366 title: newTitle,
1367 summary: newSummary,
1368 status: data.status ?? task.status,
1369 endedAt: task.endedAt ?? undefined,
1370 });
1371 this.embedTaskInBackground(taskId, `${newTitle ?? ""}: ${newSummary ?? ""}`);
1372 this.jsonResponse(res, { ok: true, taskId });
1373 } catch (err) {
1374 res.writeHead(400, { "Content-Type": "application/json" });
1375 res.end(JSON.stringify({ error: String(err) }));
1376 }
1377 });
1378 }
1379
1380 private async handleSkillDelete(res: http.ServerResponse, urlPath: string): Promise<void> {
1381 const skillId = urlPath.replace("/api/skill/", "");

Callers 1

handleRequestMethod · 0.95

Calls 7

readBodyMethod · 0.95
embedTaskInBackgroundMethod · 0.95
jsonResponseMethod · 0.95
endMethod · 0.80
parseMethod · 0.45
getTaskMethod · 0.45
updateTaskMethod · 0.45

Tested by

no test coverage detected