mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-04-30 19:06:23 +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:getConfig': async () => {
|
||||
const repo = container.resolve<IAgentScheduleRepo>('agentScheduleRepo');
|
||||
await repo.ensureConfig();
|
||||
return repo.getConfig();
|
||||
try {
|
||||
return await repo.getConfig();
|
||||
} catch {
|
||||
// Return empty config if file doesn't exist
|
||||
return { agents: {} };
|
||||
}
|
||||
},
|
||||
'agent-schedule:getState': async () => {
|
||||
const repo = container.resolve<IAgentScheduleStateRepo>('agentScheduleStateRepo');
|
||||
await repo.ensureState();
|
||||
return repo.getState();
|
||||
try {
|
||||
return await repo.getState();
|
||||
} catch {
|
||||
// Return empty state if file doesn't exist
|
||||
return { agents: {} };
|
||||
}
|
||||
},
|
||||
'agent-schedule:updateAgent': async (_event, args) => {
|
||||
const repo = container.resolve<IAgentScheduleRepo>('agentScheduleRepo');
|
||||
|
|
|
|||
|
|
@ -547,12 +547,17 @@ function App() {
|
|||
const cleanup = window.ipc.on('workspace:didChange', async (event) => {
|
||||
loadDirectory().then(setTree)
|
||||
|
||||
// Reload current file if it was changed externally
|
||||
if (!selectedPath) return
|
||||
|
||||
const changedPath = event.type === 'changed' ? event.path : null
|
||||
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 =
|
||||
changedPath === selectedPath || changedPaths.includes(selectedPath)
|
||||
|
||||
|
|
@ -567,6 +572,7 @@ function App() {
|
|||
}
|
||||
})
|
||||
return cleanup
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [loadDirectory, selectedPath, editorContent])
|
||||
|
||||
// Load file content when selected
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue