fix: image watcher now uses relative path for subdirectory images

- Added relativePath field to ImageDetectedEvent
- Compute relative path from working directory in image-watcher
- Use relativePath in frontend URL (fixes 'Failed to load image' for subdirs)
- Minor CLAUDE.md improvements

chore: bump version to 0.1461
This commit is contained in:
arkon
2026-01-31 14:32:20 +01:00
parent c7488c4a56
commit b655d2e29e
13 changed files with 278 additions and 18 deletions
+5 -1
View File
@@ -10,7 +10,7 @@
import { EventEmitter } from 'node:events';
import { watch, type FSWatcher } from 'chokidar';
import { basename, extname } from 'node:path';
import { basename, extname, relative } from 'node:path';
import { statSync } from 'node:fs';
import type { ImageDetectedEvent } from './types.js';
@@ -265,10 +265,14 @@ export class ImageWatcher extends EventEmitter {
try {
const stat = statSync(filePath);
const fileName = basename(filePath);
const workingDir = this.sessionDirs.get(sessionId);
// Compute relative path from working directory (for file-raw endpoint)
const relativePath = workingDir ? relative(workingDir, filePath) : fileName;
const event: ImageDetectedEvent = {
sessionId,
filePath,
relativePath,
fileName,
timestamp: Date.now(),
size: stat.size,