Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/PixelAgentsViewProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export class PixelAgentsViewProvider implements vscode.WebviewViewProvider {
// Ensure project scan runs even with no restored agents (to adopt external terminals)
const projectDir = getProjectDirPath();
const workspaceRoot = vscode.workspace.workspaceFolders?.[0]?.uri.fsPath;
console.log(`[Extension] platform: ${process.platform}, arch: ${process.arch}`);
console.log('[Extension] workspaceRoot:', workspaceRoot);
console.log('[Extension] projectDir:', projectDir);
if (projectDir) {
Expand Down
5 changes: 3 additions & 2 deletions src/assetLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,12 @@ export async function loadFurnitureAssets(workspaceRoot: string): Promise<Loaded
for (const asset of catalog) {
try {
// Ensure file path includes 'assets/' prefix if not already present
let filePath = asset.file;
// Normalize to forward slashes for consistent comparison (catalog uses POSIX paths)
let filePath = asset.file.split(path.win32.sep).join(path.posix.sep);
if (!filePath.startsWith('assets/')) {
filePath = `assets/${filePath}`;
}
const assetPath = path.join(workspaceRoot, filePath);
const assetPath = path.join(workspaceRoot, ...filePath.split('/'));

if (!fs.existsSync(assetPath)) {
console.warn(` ⚠️ Asset file not found: ${asset.file}`);
Expand Down
12 changes: 11 additions & 1 deletion src/fileWatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,21 @@ export function startFileWatching(
permissionTimers: Map<number, ReturnType<typeof setTimeout>>,
webview: vscode.Webview | undefined,
): void {
// Primary: fs.watch (unreliable on macOS — may miss events)
// Primary: fs.watch (unreliable on macOS — may miss events; may hit inotify limits on Linux)
try {
const watcher = fs.watch(filePath, () => {
readNewLines(agentId, agents, waitingTimers, permissionTimers, webview);
});
watcher.on('error', (err) => {
console.log(
`[Pixel Agents] fs.watch error for agent ${agentId}: ${err.message}` +
(process.platform === 'linux'
? ' (if ENOSPC, try increasing fs.inotify.max_user_watches)'
: ''),
);
watcher.close();
fileWatchers.delete(agentId);
});
fileWatchers.set(agentId, watcher);
} catch (e) {
console.log(`[Pixel Agents] fs.watch failed for agent ${agentId}: ${e}`);
Expand Down
5 changes: 3 additions & 2 deletions src/layoutPersistence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,9 @@ export function watchLayoutFile(
fsWatcher = fs.watch(filePath, () => {
checkForChange();
});
fsWatcher.on('error', () => {
// fs.watch can be unreliable — polling backup handles it
fsWatcher.on('error', (err) => {
// fs.watch can be unreliable on macOS (kqueue) and may hit inotify limits on Linux
console.log(`[Pixel Agents] Layout fs.watch error: ${err.message}`);
fsWatcher?.close();
fsWatcher = null;
});
Expand Down