(
actor: ActorState,
now: number,
windowMs: number,
limit = 6,
)
| 369 | * nicht darin. |
| 370 | */ |
| 371 | export function recentPaths( |
| 372 | actor: ActorState, |
| 373 | now: number, |
| 374 | windowMs: number, |
| 375 | limit = 6, |
| 376 | ): string[] { |
| 377 | const out: string[] = []; |
| 378 | for (let i = actor.events.length - 1; i >= 0; i -= 1) { |
| 379 | const event = actor.events[i] as AgentEvent; |
| 380 | if (windowMs > 0 && now - event.ts > windowMs) { |
| 381 | break; |
| 382 | } |
| 383 | if (event.path.length === 0 || out.includes(event.path)) { |
| 384 | continue; |
| 385 | } |
| 386 | out.push(event.path); |
| 387 | if (out.length >= limit) { |
| 388 | break; |
| 389 | } |
| 390 | } |
| 391 | return out; |
| 392 | } |
no test coverage detected