Skip to content

feat: Add code execution tool support - #1077

Merged
ehayes2000 merged 11 commits into
mainfrom
code-exe
Jan 21, 2026
Merged

ehayes2000 merged 11 commits into
mainfrom
code-exe

Conversation

@ehayes2000

Copy link
Copy Markdown
Contributor

Summary

  • Add Anthropic code execution tool support in the Rust backend
  • Create UI components for displaying code execution results (BashCodeExecution, TextEditorCodeExecution)
  • Regenerate tool schemas to include code execution capabilities

Test plan

  • Verify code execution tool responses render correctly in the UI
  • Test bash and text editor execution result display
  • Confirm no regressions in existing tool handling

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Jan 20, 2026 •

Copy link
Copy Markdown

@claude

claude Bot commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

ehayes2000 and others added 11 commits January 21, 2026 10:20
Add support for Anthropic's bash and text editor code execution tools:
- Add BashCodeExecutionToolCall and TextEditorCodeExecutionToolCall types
- Add response types with operation-specific variants (view, create, str_replace)
- Handle code execution content blocks in streaming responses
- Register code execution tools for schema generation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update generated schemas and TypeScript types to include:
- bash_code_execution tool call and response types
- text_editor_code_execution tool with view/create/str_replace variants
- Result types with stdout, stderr, return_code, diff lines, etc.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add frontend components for displaying code execution results:
- BashCodeExecution: shows truncated command preview, expandable output
- TextEditorCodeExecution: shows file operations with expandable diffs
- CodeFence component for collapsible code blocks with caret toggle
- Register handlers in tool handler map

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The generate-dcs-tools.ts script was not properly handling JSON Schema
patterns where $ref has sibling properties (like discriminator fields).
json-schema-to-typescript ignores the $ref content when siblings exist.

- Add preprocessSchemaForRefs() to convert $ref + siblings into allOf
- Add deduplicateTypes() to remove duplicate nested type definitions
- Regenerate tool schemas and types with correct fields
- Update TextEditorCodeExecution.tsx to use new type structure

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
… Rust

- Add document_cognition_service_tools_schema binary to generate AI tools
  JSON schema directly from Rust types
- Update generate-dcs-types.ts to run the binary and regenerate tools.json
  before generating TypeScript types
- This ensures tools.json stays in sync with Rust type definitions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ehayes2000
ehayes2000 merged commit 1478212 into main Jan 21, 2026
39 checks passed
@ehayes2000
ehayes2000 deleted the code-exe branch January 21, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants