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

Method serveSharingTaskList

packages/memos-core/src/viewer/server.ts:2333–2348  ·  view source on GitHub ↗
(res: http.ServerResponse, url: URL)

Source from the content-addressed store, hash-verified

2331 }
2332
2333 private async serveSharingTaskList(res: http.ServerResponse, url: URL): Promise<void> {
2334 if (!this.ctx) return this.jsonResponse(res, { tasks: [], error: "sharing_unavailable" });
2335 try {
2336 const limit = Number(url.searchParams.get("limit") || 40);
2337 const hub = this.resolveHubConnection();
2338 let data: any;
2339 if (hub) {
2340 data = await hubRequestJson(hub.hubUrl, hub.userToken, `/api/v1/hub/tasks?limit=${limit}`);
2341 } else {
2342 data = await hubListTasks(this.store, this.ctx, { limit });
2343 }
2344 this.jsonResponse(res, { tasks: Array.isArray(data?.tasks) ? data.tasks : [] });
2345 } catch (err) {
2346 this.jsonResponse(res, { tasks: [], error: String(err) });
2347 }
2348 }
2349
2350 private async serveSharingSkillList(res: http.ServerResponse, url: URL): Promise<void> {
2351 if (!this.ctx) return this.jsonResponse(res, { skills: [], error: "sharing_unavailable" });

Callers 1

handleRequestMethod · 0.95

Calls 5

jsonResponseMethod · 0.95
resolveHubConnectionMethod · 0.95
hubRequestJsonFunction · 0.90
hubListTasksFunction · 0.90
getMethod · 0.65

Tested by

no test coverage detected