MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / viewOf

Function viewOf

graph-ui/src/agents/agent-view.ts:251–303  ·  view source on GitHub ↗
(
    actor: ActorState,
    letter: string,
    input: AgentsViewInput,
    index: PlacementIndex,
    byId: Map<number, GraphNode>,
)

Source from the content-addressed store, hash-verified

249}
250
251function viewOf(
252 actor: ActorState,
253 letter: string,
254 input: AgentsViewInput,
255 index: PlacementIndex,
256 byId: Map<number, GraphNode>,
257): ActorView {
258 const placement = placeEvent(actor.last, actor.kind, index);
259 const strip = activityStrip(actor.events, input.now, STRIP_SECONDS);
260 const sinceMs = Math.max(0, input.now - actor.lastTs);
261 const idle = sinceMs > IDLE_MS;
262 /*
263 * Der Puls kommt aus der GEZAEHLTEN Zahl der Ereignisse im Fenster, und ein
264 * ruhiger Akteur bekommt gar keinen. Damit ist der Puls selbst eine
265 * Auskunft: er hoert auf, wenn die Arbeit aufhoert. Ein Herzschlag, der im
266 * Leerlauf weiterschlaegt, waere die Behauptung einer Arbeit, die nicht
267 * stattfindet.
268 */
269 const recentEvents = idle ? 0 : eventsInWindow(actor, input.now, PULSE_WINDOW_MS);
270 return {
271 id: actor.id,
272 name: actor.name,
273 you: actor.you,
274 color: agentColor(actor.id),
275 letter,
276 kind: actor.kind,
277 kindLetter: WORK_KIND_LETTERS[actor.kind],
278 placement,
279 node: placement.nodeId === undefined ? undefined : byId.get(placement.nodeId),
280 testedNode: placement.testedNodeId === undefined
281 ? undefined
282 : byId.get(placement.testedNodeId),
283 ghostNodes: placement.ghostIds
284 .map((id) => byId.get(id))
285 .filter((node): node is GraphNode => node !== undefined),
286 last: actor.last,
287 lastTs: actor.lastTs,
288 hereMs: timeAtPlace(actor, input.now),
289 count: actor.count,
290 missed: actor.missed,
291 strip,
292 stripTotal: strip.reduce((sum, value) => sum + value, 0),
293 intent: actor.last.intent ?? '',
294 paths: recentPaths(actor, input.now, input.trailWindowMs),
295 sinceMs,
296 idle,
297 recentEvents,
298 pulse: pulseOf(recentEvents),
299 trail: trailOf(actor, input.now, input.trailWindowMs, index, byId),
300 waves: idle ? [] : currentBursts(burstsOf(actor, index), actor.lastTs),
301 drawn: true,
302 };
303}
304
305/**
306 * Die Sicht bauen.

Callers 1

buildAgentsViewFunction · 0.70

Calls 12

placeEventFunction · 0.90
activityStripFunction · 0.90
eventsInWindowFunction · 0.90
agentColorFunction · 0.90
timeAtPlaceFunction · 0.90
recentPathsFunction · 0.90
pulseOfFunction · 0.90
currentBurstsFunction · 0.90
burstsOfFunction · 0.85
reduceMethod · 0.80
trailOfFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected