(absolutePath: string)
| 253 | |
| 254 | // Check if file is the plan file for the current session |
| 255 | function isSessionPlanFile(absolutePath: string): boolean { |
| 256 | // Check if path is a plan file for this session (main or agent-specific) |
| 257 | // Main plan file: {plansDir}/{planSlug}.md |
| 258 | // Agent plan file: {plansDir}/{planSlug}-agent-{agentId}.md |
| 259 | const expectedPrefix = join(getPlansDirectory(), getPlanSlug()) |
| 260 | // SECURITY: Normalize to prevent path traversal bypasses via .. segments |
| 261 | const normalizedPath = normalize(absolutePath) |
| 262 | return ( |
| 263 | normalizedPath.startsWith(expectedPrefix) && normalizedPath.endsWith('.md') |
| 264 | ) |
| 265 | } |
| 266 | |
| 267 | /** |
| 268 | * Returns the session memory directory path for the current session with trailing separator. |
no test coverage detected