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,7 @@
// Step 129 TDD Test: Dependency management UI writeback
#include "DependencyPanel.h"
#include "NotificationSystem.h"
#include "VulnerabilityDatabase.h"
#include <iostream>
#include <filesystem>
#include <fstream>
@@ -31,6 +33,9 @@ int main() {
std::filesystem::remove_all(dir);
std::filesystem::create_directories(dir);
NotificationSystem notifications;
VulnerabilityDatabase vulnDb;
// requirements.txt writeback
{
std::ofstream out(dir / "requirements.txt");
@@ -38,8 +43,7 @@ int main() {
out.close();
DependencyPanelState panel;
std::string log;
refreshDependencies(panel, dir.string(), log);
refreshDependencies(panel, dir.string(), notifications, vulnDb);
expect(panel.deps.size() == 1, "requirements parsed", passed, failed);
DependencySpec dep;
@@ -47,7 +51,7 @@ int main() {
dep.version = "2.0.0";
dep.source = "requirements.txt";
panel.deps.push_back(dep);
bool ok = writeDependenciesForSource("requirements.txt", dir.string(), panel.deps, log);
bool ok = writeDependenciesForSource("requirements.txt", dir.string(), panel.deps, notifications);
expect(ok, "requirements writeback ok", passed, failed);
std::string content = readFile(dir / "requirements.txt");
expect(content.find("numpy==1.26.0") != std::string::npos, "requirements keep numpy", passed, failed);
@@ -62,8 +66,7 @@ int main() {
out.close();
DependencyPanelState panel;
std::string log;
refreshDependencies(panel, dir.string(), log);
refreshDependencies(panel, dir.string(), notifications, vulnDb);
for (auto it = panel.deps.begin(); it != panel.deps.end(); ) {
if (it->name == "react") {
@@ -75,7 +78,7 @@ int main() {
++it;
}
}
bool ok = writeDependenciesForSource("package.json", dir.string(), panel.deps, log);
bool ok = writeDependenciesForSource("package.json", dir.string(), panel.deps, notifications);
expect(ok, "package.json writeback ok", passed, failed);
nlohmann::json j;
@@ -90,10 +93,9 @@ int main() {
// edge case: unsupported writeback
{
std::string log;
std::vector<DependencySpec> deps;
deps.push_back({"Boost", "", "CMakeLists.txt"});
bool ok = writeDependenciesForSource("CMakeLists.txt", dir.string(), deps, log);
bool ok = writeDependenciesForSource("CMakeLists.txt", dir.string(), deps, notifications);
expect(!ok, "unsupported writeback returns false", passed, failed);
}