notebook agent#2726
Draft
hengxian-jiang wants to merge 10 commits into
Draft
Conversation
Implement notebookAgent.ts with: - NotebookCellCtx and EditOp TypeScript types - serializeNotebookForPrompt: converts notebook cells to prompt-friendly format - frameEdits: wraps edits with sentinel marker for extraction - SENTINEL constant for framing All 5 tests passing: - Cell serialization with id, type, language, source - Output truncation to 2000 chars - Empty notebook handling - Sentinel-framed JSON edits - Empty edits array Register import in deno.json for future use. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds notebook-agent system prompt builder that embeds tool usage instructions for OHDSI/OMOP healthcare analytics notebook editing. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Wires up the notebook coding agent: getNotebookAgentResponse builds an agent with notebook-edit tools + MCP tools and returns the stream/edits sink; the /agent route streams narration via SSE then writes frameEdits. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add vitest.config.ts mirroring jobs app setup, add test:unit script to package.json, and add three devDependencies (vitest, jsdom, @types/jsdom). Verify vitest loads with 'bunx vitest run'. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Create src/agent/types.ts: EditOp union, NotebookCellCtx, AgentRequest, EditSummary types
- Create src/agent/sentinelSplitter.ts: streaming parser for narration/edits split
- Create src/agent/sentinelSplitter.test.ts: 7 vitest tests (all passing)
- Returns { push, flush, getEdits } with sentinel handling across chunk boundaries
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ookHandle - Create applyEdits(handle, edits) that processes EditOp array - add_cell: calls handle.addCell(type, position, language) then updateCellSource - update_cell/delete_cell: checks cell existence, skips silently if missing - Returns EditSummary with added/updated/deleted/skipped counts - 5 vitest tests all passing (add, update, delete, skip, aggregate) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Add serializeCells.ts: maps NotebookData cells to NotebookCellCtx[], flattening code-cell outputs to text blob; markdown cells omit outputs. - Add serializeCells.test.ts: 3 TDD tests (RED → GREEN verified). - Replace CodingAssistant.tsx: posts to /code-suggestion/agent, streams narration via sentinelSplitter, applies edits on completion, shows summary. Props changed from getNotebookContent to getNotebookData + applyEdits. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Change import of NotebookHandle from 'react-notebook' to 'react-notebook/src/index' to match codebase convention and resolve TS2307 import error. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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.
Merge Checklist
Please cross check this list if additions / modifications needs to be done on top of your core changes and tick them off. Reviewer can as well glance through and help the developer if something is missed out.
developbranch)