mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-01 03:16:29 +02:00
fix auto update for background agents
This commit is contained in:
parent
35805068c0
commit
ac2ce038a6
2 changed files with 21 additions and 7 deletions
|
|
@ -390,13 +390,21 @@ export function setupIpcHandlers() {
|
||||||
// Agent schedule handlers
|
// Agent schedule handlers
|
||||||
'agent-schedule:getConfig': async () => {
|
'agent-schedule:getConfig': async () => {
|
||||||
const repo = container.resolve<IAgentScheduleRepo>('agentScheduleRepo');
|
const repo = container.resolve<IAgentScheduleRepo>('agentScheduleRepo');
|
||||||
await repo.ensureConfig();
|
try {
|
||||||
return repo.getConfig();
|
return await repo.getConfig();
|
||||||
|
} catch {
|
||||||
|
// Return empty config if file doesn't exist
|
||||||
|
return { agents: {} };
|
||||||
|
}
|
||||||
},
|
},
|
||||||
'agent-schedule:getState': async () => {
|
'agent-schedule:getState': async () => {
|
||||||
const repo = container.resolve<IAgentScheduleStateRepo>('agentScheduleStateRepo');
|
const repo = container.resolve<IAgentScheduleStateRepo>('agentScheduleStateRepo');
|
||||||
await repo.ensureState();
|
try {
|
||||||
return repo.getState();
|
return await repo.getState();
|
||||||
|
} catch {
|
||||||
|
// Return empty state if file doesn't exist
|
||||||
|
return { agents: {} };
|
||||||
|
}
|
||||||
},
|
},
|
||||||
'agent-schedule:updateAgent': async (_event, args) => {
|
'agent-schedule:updateAgent': async (_event, args) => {
|
||||||
const repo = container.resolve<IAgentScheduleRepo>('agentScheduleRepo');
|
const repo = container.resolve<IAgentScheduleRepo>('agentScheduleRepo');
|
||||||
|
|
|
||||||
|
|
@ -547,12 +547,17 @@ function App() {
|
||||||
const cleanup = window.ipc.on('workspace:didChange', async (event) => {
|
const cleanup = window.ipc.on('workspace:didChange', async (event) => {
|
||||||
loadDirectory().then(setTree)
|
loadDirectory().then(setTree)
|
||||||
|
|
||||||
// Reload current file if it was changed externally
|
|
||||||
if (!selectedPath) return
|
|
||||||
|
|
||||||
const changedPath = event.type === 'changed' ? event.path : null
|
const changedPath = event.type === 'changed' ? event.path : null
|
||||||
const changedPaths = (event.type === 'bulkChanged' ? event.paths : []) ?? []
|
const changedPaths = (event.type === 'bulkChanged' ? event.paths : []) ?? []
|
||||||
|
|
||||||
|
// Reload background tasks if agent-schedule.json changed
|
||||||
|
if (changedPath === 'config/agent-schedule.json' || changedPaths.includes('config/agent-schedule.json')) {
|
||||||
|
loadBackgroundTasks()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reload current file if it was changed externally
|
||||||
|
if (!selectedPath) return
|
||||||
|
|
||||||
const isCurrentFileChanged =
|
const isCurrentFileChanged =
|
||||||
changedPath === selectedPath || changedPaths.includes(selectedPath)
|
changedPath === selectedPath || changedPaths.includes(selectedPath)
|
||||||
|
|
||||||
|
|
@ -567,6 +572,7 @@ function App() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return cleanup
|
return cleanup
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [loadDirectory, selectedPath, editorContent])
|
}, [loadDirectory, selectedPath, editorContent])
|
||||||
|
|
||||||
// Load file content when selected
|
// Load file content when selected
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue