feat(backend): add application DTO layer for sandbox views - #171
Draft
Simpleyyt wants to merge 5 commits into
Draft
feat(backend): add application DTO layer for sandbox views#171Simpleyyt wants to merge 5 commits into
Simpleyyt wants to merge 5 commits into
Conversation
Introduce application/dto for shell and file view use-case outputs, interfaces/mappers to convert DTOs to API schemas, and remove the Application -> Interfaces dependency in AgentService. Co-authored-by: Simpleyyt <simpleyyt@gmail.com>
Replace manual field extraction with Pydantic model_validate so nested console records are coerced automatically, ignore extra keys, and raise a clear error on empty sandbox payloads. Co-authored-by: Simpleyyt <simpleyyt@gmail.com>
Replace from_tool_data(Mapping[str, Any]) with from_result() that takes the strongly-typed domain ShellViewResult / FileReadResult. The dict-> model boundary now lives in the domain models (sandbox ACL); DTOs only project domain value objects, removing the stringly-typed dict signature. Co-authored-by: Simpleyyt <simpleyyt@gmail.com>
Cover domain wire->DTO->API mapper chain and mocked shell_view/file_view use cases including sandbox failure handling. Co-authored-by: Simpleyyt <simpleyyt@gmail.com>
Exercise the full wire->domain->DTO->API chain against a running dev stack (backend :8000, sandbox :8080). Mark with pytest integration. Co-authored-by: Simpleyyt <simpleyyt@gmail.com>
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
Adds an Application DTO layer and fixes the dependency violation where
AgentServicereturnedinterfaces/schemastypes directly.Changes
application/dto/sandbox.py—ShellViewDto,FileViewDto,ConsoleRecordDtowithfrom_tool_data()factories for sandboxToolResultpayloadsinterfaces/mappers/sandbox_mapper.py— maps Application DTOs → API*ResponseschemasAgentService—shell_view/file_viewnow return DTOs (nointerfacesimports)session_routes.py— uses mapper before returningAPIResponseDependency flow (after)
Follow-ups (not in this PR)
FileInfoResponse.from_file_infoservice-locator logic into a mapperapplication/errorsdomain exception mapping