Skip to content

Add collaborative markdown document tools#4530

Open
samwillis wants to merge 3 commits into
samwillis/agents-streaming-tool-callsfrom
samwillis/agents-markdown-docs
Open

Add collaborative markdown document tools#4530
samwillis wants to merge 3 commits into
samwillis/agents-streaming-tool-callsfrom
samwillis/agents-markdown-docs

Conversation

@samwillis

@samwillis samwillis commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Stacked on #4555. Adds collaborative markdown documents for Electric Agents. This PR consumes the streaming tool-call hook from #4555, but keeps the markdown document implementation in a separate layer.

What this adds:

  • A document manifest entry for markdown docs with:
    • content MIME: text/markdown
    • transport MIME: application/vnd.electric-agents.markdown-yjs
    • provider: y-durable-streams
    • Y.Text name: markdown
  • Horton/worker markdown tools for creating, reading, replacing, editing, and streaming inserts into markdown docs.
  • Runtime-side document sessions that materialize a wake-local Y.Doc, keep it synced through @durable-streams/y-durable-streams, and append binary Yjs updates to durable streams.
  • Raw Yjs update and awareness stream support on the server; the server creates streams and serves metadata but does not semantically edit document content.
  • CodeMirror/Yjs markdown editor UI with open and split-right actions from timeline and manifest surfaces.
  • Agent and user presence plumbing based on Yjs awareness, with agent cursor placement during streamed insert/replace operations.
  • Worker sharing of markdown document refs so spawned workers can collaborate on the same document.

Architecture notes:

  • The agent runtime owns semantic document edits. Tools mutate the local wake-scoped Y.Doc; the Yjs provider writes updates to the durable stream.
  • The agents server stays deliberately dumb for document contents: it creates/locates streams, proxies durable stream access, and stores the manifest row.
  • Presence follows the same split: clients and agents publish raw Yjs awareness updates; the server does not interpret cursor positions.
  • Basic replace/edit tools remain available for non-streaming edits; streamed insert/replace builds on feat(agents): Add streaming tool call argument support #4555's onArgsDelta hook.

Validation

  • pnpm --filter @electric-ax/agents-runtime typecheck
  • pnpm --filter @electric-ax/agents-server-ui typecheck
  • pnpm --filter @electric-ax/agents typecheck
  • pnpm --filter @electric-ax/agents-server typecheck
  • pnpm --filter @electric-ax/agents-runtime exec vitest run test/markdown-docs-tools.test.ts test/outbound-bridge.test.ts test/pi-adapter.test.ts
  • pnpm --filter @electric-ax/agents-runtime exec vitest run test/runtime-dsl.test.ts
  • pnpm --filter @electric-ax/agents exec vitest run test/spawn-worker-tool.test.ts test/horton-tool-composition.test.ts test/horton-system-prompt.test.ts
  • pnpm --filter @electric-ax/agents-server exec vitest run test/electric-agents-routes.test.ts test/electric-agents-status.test.ts test/electric-agents-manager-write-validation.test.ts
  • pnpm --filter @electric-ax/agents-server-ui exec vitest run src/components/views/MarkdownDocumentView.test.ts src/lib/workspace/workspaceReducer.test.ts
  • pnpm --filter @electric-examples/yjs run typecheck
  • pnpm --filter @electric-ax/agents-mobile run ci:check
  • git diff --check

@netlify

netlify Bot commented Jun 8, 2026

Copy link
Copy Markdown

Deploy Preview for electric-next ready!

Name Link
🔨 Latest commit 271f7f5
🔍 Latest deploy log https://app.netlify.com/projects/electric-next/deploys/6a27194570408500082f11b2
😎 Deploy Preview https://deploy-preview-4530--electric-next.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@samwillis samwillis force-pushed the samwillis/agents-markdown-docs branch from dbd12ec to 828ffa0 Compare June 10, 2026 17:17
@samwillis samwillis changed the base branch from main to samwillis/agents-streaming-tool-calls June 10, 2026 17:18
@samwillis samwillis force-pushed the samwillis/agents-markdown-docs branch from 828ffa0 to 319eba2 Compare June 10, 2026 18:00
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 53.46633% with 933 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.60%. Comparing base (636d716) to head (28be27c).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
packages/agents-runtime/src/tools/markdown-docs.ts 76.32% 224 Missing ⚠️
...r-ui/src/components/views/MarkdownDocumentView.tsx 8.77% 156 Missing ⚠️
packages/agents-runtime/src/markdown-yjs.ts 43.41% 116 Missing ⚠️
...es/agents-runtime/src/markdown-document-session.ts 0.86% 115 Missing ⚠️
...ckages/agents-runtime/src/runtime-server-client.ts 8.19% 112 Missing ⚠️
packages/agents-server/src/markdown-documents.ts 44.15% 43 Missing ⚠️
...agents-server-ui/src/components/EntityTimeline.tsx 0.00% 24 Missing ⚠️
packages/agents-runtime/src/process-wake.ts 8.00% 23 Missing ⚠️
packages/agents-runtime/src/manifest-helpers.ts 12.00% 22 Missing ⚠️
packages/agents-server/src/entity-manager.ts 77.27% 20 Missing ⚠️
... and 8 more
Additional details and impacted files
@@                            Coverage Diff                            @@
##           samwillis/agents-streaming-tool-calls    #4530      +/-   ##
=========================================================================
+ Coverage                                  55.05%   56.60%   +1.55%     
=========================================================================
  Files                                        318      360      +42     
  Lines                                      37016    40834    +3818     
  Branches                                   10547    11241     +694     
=========================================================================
+ Hits                                       20379    23116    +2737     
- Misses                                     16604    17661    +1057     
- Partials                                      33       57      +24     
Flag Coverage Δ
packages/agents 72.03% <82.45%> (+1.50%) ⬆️
packages/agents-mcp 77.54% <ø> (?)
packages/agents-mobile 84.09% <ø> (+12.66%) ⬆️
packages/agents-runtime 79.23% <58.11%> (-1.18%) ⬇️
packages/agents-server 72.87% <61.92%> (-1.12%) ⬇️
packages/agents-server-ui 6.12% <6.60%> (+0.45%) ⬆️
packages/electric-ax 46.42% <ø> (ø)
packages/experimental 87.73% <ø> (?)
packages/react-hooks 86.48% <ø> (?)
packages/start 82.83% <ø> (?)
packages/typescript-client 91.83% <ø> (?)
packages/y-electric 56.05% <ø> (?)
typescript 56.60% <53.46%> (+1.55%) ⬆️
unit-tests 56.60% <53.46%> (+1.55%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Electric Agents Desktop Builds

Build artifacts for commit 28be27c.

Platform Status Artifact
macOS Apple Silicon Passed DMG
macOS Intel Passed DMG
Windows x64 Passed Installer
Linux x64 Passed AppImage / deb

Workflow run

@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Electric Agents Mobile Build

Local mobile checks ran for commit 28be27c.

The EAS Android preview build was skipped because the mobile-eas-build label is not present.
Add the mobile-eas-build label to this PR to produce an installable preview build.

Workflow run

@samwillis samwillis marked this pull request as ready for review June 10, 2026 19:52
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