Skip to content

notebook agent#2726

Draft
hengxian-jiang wants to merge 10 commits into
developfrom
hengxian-jiang/poc_notebook_agent
Draft

notebook agent#2726
hengxian-jiang wants to merge 10 commits into
developfrom
hengxian-jiang/poc_notebook_agent

Conversation

@hengxian-jiang

Copy link
Copy Markdown
Collaborator

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.

  • Automated Tests (Jasmine integration tests, Unit tests, and/or Performance tests)
  • Updated Manual tests / Demo Config
  • Documentation (Application guide, Admin guide, Markdown, Readme and/or Wiki)
  • Verified that local development environment is working with latest changes (integrated with latest develop branch)
  • following best practices in code review doc

hengxian-jiang and others added 10 commits June 17, 2026 14:23
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant