fix: [#63] Add Jupyter notebook (.ipynb) support to edit tool#387
Open
nandanosql wants to merge 1 commit into
Open
fix: [#63] Add Jupyter notebook (.ipynb) support to edit tool#387nandanosql wants to merge 1 commit into
nandanosql wants to merge 1 commit into
Conversation
Add ability to view and edit Jupyter notebooks in the TextEditorTool: - _view(): detects .ipynb files and displays cells with type headers and source content instead of raw JSON - str_replace: applies replacements on concatenated cell sources with cell marker comments (# %% Cell N), then reconstructs the notebook JSON preserving structure - Helper methods: _read_notebook, _write_notebook, _notebook_cells_to_text, _notebook_to_source_text, _apply_str_replace_to_notebook, _reconstruct_notebook_from_text - Updated tool description to mention notebook support
|
|
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.
Fixes #63
Problem
The edit/view tools cannot handle
.ipynb(Jupyter notebook) files. When the agent tries to view or edit a notebook, it either shows raw JSON or fails because the file contains complex structured data.Solution
Added special handling for
.ipynbfiles inTextEditorTool:View command
.ipynbfiles and parses the JSON notebook formatstr_replace command
# %% Cell N (type))Changes
jsonimport_is_notebook(),_read_notebook(),_write_notebook()helpers_notebook_cells_to_text()for view rendering_notebook_to_source_text()for str_replace editing_apply_str_replace_to_notebook()and_reconstruct_notebook_from_text()_view()to detect and render notebooks_str_replace_handler()to handle notebooks