MCPcopy
hub / github.com/coder/mux / buildAgentTaskIndex

Method buildAgentTaskIndex

src/node/services/taskService.ts:6486–6505  ·  view source on GitHub ↗
(config: ReturnType<Config["loadConfigOrDefault"]>)

Source from the content-addressed store, hash-verified

6484 }
6485
6486 private buildAgentTaskIndex(config: ReturnType<Config["loadConfigOrDefault"]>): AgentTaskIndex {
6487 const byId = new Map<string, AgentTaskWorkspaceEntry>();
6488 const childrenByParent = new Map<string, string[]>();
6489 const parentById = new Map<string, string>();
6490
6491 for (const task of this.listAgentTaskWorkspaces(config)) {
6492 const taskId = task.id!;
6493 byId.set(taskId, task);
6494
6495 const parent = task.parentWorkspaceId;
6496 if (!parent) continue;
6497
6498 parentById.set(taskId, parent);
6499 const list = childrenByParent.get(parent) ?? [];
6500 list.push(taskId);
6501 childrenByParent.set(parent, list);
6502 }
6503
6504 return { byId, childrenByParent, parentById };
6505 }
6506
6507 private hasArchivedAncestor(
6508 index: AgentTaskIndex,

Calls 4

setMethod · 0.80
getMethod · 0.65
pushMethod · 0.65

Tested by

no test coverage detected