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 144 TDD Test: Emacs keybinding deep integration
#include "EmacsKeybinding.h"
#include "NotificationSystem.h"
#include <iostream>
static void expect(bool cond, const std::string& name, int& passed, int& failed) {
@@ -18,29 +19,29 @@ int main() {
MockEmacsConnection mock;
EmacsKeybindingState state;
std::string log;
NotificationSystem notifications;
bool prefixOk = emacsHandleKeySequence(state, mock, "C-x", log);
bool prefixOk = emacsHandleKeySequence(state, mock, "C-x", notifications);
expect(prefixOk, "prefix handled", passed, failed);
expect(state.prefix == "C-x", "prefix stored", passed, failed);
bool seqOk = emacsHandleKeySequence(state, mock, "C-s", log);
bool seqOk = emacsHandleKeySequence(state, mock, "C-s", notifications);
expect(seqOk, "sequence handled", passed, failed);
expect(state.prefix.empty(), "prefix cleared", passed, failed);
expect(state.lastCommand == "save-buffer", "command resolved", passed, failed);
expect(mock.getLastSentCommand().find("call-interactively") != std::string::npos,
"call-interactively sent", passed, failed);
bool mxOk = emacsHandleKeySequence(state, mock, "M-x", log);
bool mxOk = emacsHandleKeySequence(state, mock, "M-x", notifications);
expect(mxOk, "M-x handled", passed, failed);
expect(state.minibufferActive, "minibuffer active", passed, failed);
std::snprintf(state.minibufferBuf, sizeof(state.minibufferBuf), "find-file");
bool mbOk = emacsExecuteMinibuffer(state, mock, log);
bool mbOk = emacsExecuteMinibuffer(state, mock, notifications);
expect(mbOk, "minibuffer command executed", passed, failed);
expect(!state.minibufferActive, "minibuffer cleared", passed, failed);
updateEmacsModeLine(state, mock, 2.0, log);
updateEmacsModeLine(state, mock, 2.0, notifications);
expect(!state.modeLine.empty(), "mode line updated", passed, failed);
std::cout << "\n=== Step 144 Results: " << passed << " passed, "