# 20 — Debug Adapter Protocol service Status: PLANNED; no implementation claim Requirements: R-017,R-018,R-019,R-020 Dependencies: 18,19; shared session service with21 and client integrations22/23. ## Ownership and boundaries Proposed Sol protocol adapter: NEW include/vls/debug/dap/, src/debug/dap/, tests/debug/dap/. Astra reviews control-state boundary. Future assignments must verify the then-current baseline and exact disjoint paths; these proposed scopes do not authorize work in another repository. ## Contracts and data flow C++ DAP adapter maps one identified client to the shared debug session service over private bounded IPC. Support initialize/launch/configuration/breakpoints, threads/stack/scopes/variables, continue/next/stepIn/stepOut/pause, disconnect and source retrieval where implemented. Advertise only implemented DAP capabilities and mode-specific operations. ## Implementation sequence 1. Implement DAP framing/envelopes separately from LSP's JSON-RPC semantics; reuse safe byte/JSON primitives but preserve DAP seq/request_seq/event contracts. 2. Map control to the session state machine, serialize conflicting requests and deliver required stopped/continued/terminated/progress events. Attach every response/handle to correct session/stop generation. 3. Expose logical evaluator frames and captured source references; map replay actions to cursor movement, never to unimplemented live reverse execution. 4. Negotiate the versioned read-only custom inspection requests for21. Bind adapter/service channels to inherited descriptors or explicitly verified private local connections; no public TCP endpoint. ## Failure behavior and constraints Invalid state, stale handle, unsupported operation or expired session returns a DAP error rather than deadlock. Cancellation must still terminate the original request appropriately. Disconnect cleanup remains effective after client crash and partial protocol input. ## Acceptance scenarios 1. Replay protocol transcripts covering full live and recorded sessions, malformed frames, out-of-order requests and capability negotiation. 2. Verify request correlation, event ordering, stale references and cancellation/progress terminal behavior. 3. Drive actual Neovim/VS Code adapters; test disconnect during running/stopped/replaying states with process cleanup evidence. ## Verification and integration Proposed NEW CTest label: `dap`. Once implemented, register a nonzero suite and run: ```sh dev cpp-gcc -c ctest --test-dir build/bootstrap -L dap --output-on-failure ``` This future command is not evidence that the label/tests exist now. Before dispatch, bind the fixtures above to actual targets and record prerequisites/side effects. Require fresh independent review of the implemented contract and affected integrations. Version adapters and service protocol together; refuse incompatible clients explicitly. A DAP failure must not corrupt LSP sessions or trace storage; restart only the affected debug connection.