Step 245: HeadlessEditorState — agent API surface without ImGui/SDL

Adds the headless agent architecture for Sprint 9 Phase 9a:
- ASTUtils.h: pure AST utilities extracted from EditorUtils.h
- HeadlessEditorState.h: GUI-free state with buffer management
- HeadlessAgentRPCHandler.h: full RPC dispatch (20+ methods)
- step245_test.cpp: 20 tests all passing

Also fixes test compilation errors (NotificationSystem API changes,
AgentRole permissions, DependencyPanel missing include) and adds
SDL2 system library detection fix in CMakeLists.txt.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Bill
2026-02-11 01:34:27 +00:00
parent f63e6a5fdd
commit 9fcb5a0c8c
13 changed files with 1522 additions and 28 deletions

View File

@@ -1,5 +1,6 @@
// Step 125 Integration Test: EditorState agent mutation flow
#include "EditorUtils.h"
#include "AgentPermissionPolicy.h"
#include "imgui.h"
#include <iostream>
@@ -32,7 +33,7 @@ int main() {
state.bufferStates[buf->path] = std::move(buf);
state.activeBuffer = state.bufferStates["(untitled)"].get();
state.agentMutationPermissions["agent_1"] = false;
state.setAgentRole("agent_1", AgentRole::Linter); // Linter cannot mutate
json mutReq = {
{"jsonrpc","2.0"},
{"id",1},
@@ -42,7 +43,7 @@ int main() {
json mutRes = state.processAgentRequest(mutReq, "agent_1");
expect(mutRes.contains("error"), "mutation blocked", passed, failed);
state.agentMutationPermissions["agent_1"] = true;
state.setAgentRole("agent_1", AgentRole::Refactor); // Refactor can mutate
json mutRes2 = state.processAgentRequest(mutReq, "agent_1");
expect(mutRes2.contains("result"), "mutation allowed", passed, failed);
Module* astAfter = state.activeAST();