feat(app): Agent Debug Log NDJSON export (#21) - #422
Merged
Conversation
Give AI agents (Cursor DEBUG MODE / XcodeBazelMCP agent_debug tools) a single aggregated log they can pull from the simulator, so they can reason over network, crash, console, stderr, lifecycle, and EventBus events without scraping scattered sources. - AgentDebugLog: singleton writing NDJSON lines to `Documents/agent-debug.ndjson` (or `AGENT_DEBUG_LOG_PATH` when set). Mirrors Network/Console history on enable, then streams live events. - AgentDebugLogViewController: exposes log path, pull commands, NDJSON schema, and a toggle for the `agentDebugLog` beta feature. - EventBusSubscriber: switch listeners to a UUID-keyed dictionary and add `subscribe` returning a token + `unsubscribe(_:)` so the log can detach cleanly on disable (was append-only, leaked listeners). - Register `.agentDebugLog` under DebugSwiftBetaFeature, wire it into FeatureHandling.enable/disable, the App action menu, and the Example app; update FeatureBaseTests.allCases. Co-authored-by: oh-my-pi <https://omp.sh>
DebugSwift: Coverage: 14.79
Example.app: Coverage: 13.72
ExampleTests.xctest: Coverage: 97.49
Generated by 🚫 Danger Swift against 5541106 |
Drop comments that restate the next line of code (section headers echoing the heading string, "Singleton." on an empty init, verbose multi-line docs collapsed to one-liners). Keeps MARKs, the `// Singleton.` that silences the no_empty_block lint rule, and the `/// Source kind` doc. No behavior change. Build + AgentDebugLogTests (12/12) pass. Co-authored-by: oh-my-pi <https://omp.sh>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Gives AI agents (Cursor DEBUG MODE / XcodeBazelMCP
agent_debugtools) a single aggregated NDJSON log they can pull from the simulator, so they can reason over network, crash, console, stderr, lifecycle, and EventBus events without scraping scattered sources.AgentDebugLog— singleton that writes NDJSON lines toDocuments/agent-debug.ndjson(or$AGENT_DEBUG_LOG_PATHwhen set). Onenable()it mirrors existing Network + Console history, then streams live Network, Console, Stderr, Lifecycle, Crash, and EventBus events. Schema/protocol matchesDebugSwift/skillsswift-agent-debug-log.AgentDebugLogViewController— new screen under App that surfaces the log path, pull commands, NDJSON schema, and a toggle for the underlying beta feature.EventBusSubscriber— listeners move from an append-only array to aUUID-keyed dictionary;subscribenow returns a token andunsubscribe(_:)removes by token. Lets the log detach cleanly ondisable()and prevents listener leaks..agentDebugLogunderDebugSwiftBetaFeature, wires it intoFeatureHandling.enable/disable, adds it to the App action menu, enables it in the Example app, and updatesFeatureBaseTests.allCases.Implements #21. Follows the convention from prior feature PRs (#404–#412).
Type of change
Test plan
Manual test steps
Agent Debug Logappears under the App section.Documents/agent-debug.ndjsonstarts populating with network/console/event lines.AgentDebugLogTests— covers path resolution (AGENT_DEBUG_LOG_PATHoverride + Documents fallback), NDJSON line schema, enable/disable mirroring, EventBus subscription teardown, and session ID stability.Screenshots / recordings (if applicable)
Checklist