sketch: add debug handler to dump conversation history as JSON

Add HTTP debug endpoint /debug/conversation-history to dump agent conversation
history as pretty-printed JSON for debugging purposes.

Sometimes, you just want to see what went on.

Co-Authored-By: sketch <hello@sketch.dev>
Change-ID: s6c9e876db9b3aa5ck
diff --git a/loop/mocks.go b/loop/mocks.go
index 7a7b946..b627cc0 100644
--- a/loop/mocks.go
+++ b/loop/mocks.go
@@ -242,3 +242,22 @@
 
 	return retErr
 }
+
+// DebugJSON returns mock conversation data as JSON for debugging purposes
+func (m *MockConvo) DebugJSON() ([]byte, error) {
+	m.recordCall("DebugJSON")
+	exp, ok := m.findMatchingExpectation("DebugJSON")
+	if !ok {
+		// Return a simple mock JSON response if no expectation is set
+		return []byte(`{"mock": "conversation", "calls": {}}`), nil
+	}
+
+	var retErr error
+	m.mu.Lock()
+	defer m.mu.Unlock()
+	if err, ok := exp.result[1].(error); ok {
+		retErr = err
+	}
+
+	return exp.result[0].([]byte), retErr
+}