feat(story-115): hot-reload project.toml agent config without server restart

- Extend `WatcherEvent` to an enum with `WorkItem` and `ConfigChanged` variants
  so the watcher can distinguish between pipeline-file changes and config changes
- Watch `.story_kit/project.toml` at the project root (ignoring worktree copies)
  and broadcast `WatcherEvent::ConfigChanged` on modification
- Forward `agent_config_changed` WebSocket message to connected clients; skip
  pipeline state refresh for config-only events
- Add `is_config_file()` helper with unit tests covering root vs. worktree paths
- Accept `configVersion` prop in `AgentPanel` and re-fetch the agent roster
  whenever it increments
- Increment `agentConfigVersion` in `Chat` on receipt of `agent_config_changed`
  WS event via new `onAgentConfigChanged` handler in `ChatWebSocket`

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Dave
2026-02-23 22:58:51 +00:00
parent 662df66c13
commit e6339979de
6 changed files with 176 additions and 33 deletions

View File

@@ -69,6 +69,7 @@ export function Chat({ projectPath, onCloseProject }: ChatProps) {
{ id: string; storyId: string; status: string; message: string }[]
>([]);
const reconciliationEventIdRef = useRef(0);
const [agentConfigVersion, setAgentConfigVersion] = useState(0);
const wsRef = useRef<ChatWebSocket | null>(null);
const messagesEndRef = useRef<HTMLDivElement>(null);
@@ -215,6 +216,9 @@ export function Chat({ projectPath, onCloseProject }: ChatProps) {
});
}
},
onAgentConfigChanged: () => {
setAgentConfigVersion((v) => v + 1);
},
});
return () => {
@@ -829,7 +833,7 @@ export function Chat({ projectPath, onCloseProject }: ChatProps) {
}}
>
<LozengeFlyProvider pipeline={pipeline}>
<AgentPanel />
<AgentPanel configVersion={agentConfigVersion} />
<StagePanel title="To Merge" items={pipeline.merge} />
<StagePanel title="QA" items={pipeline.qa} />