AI-native Office surfaces for the browser, backed by deterministic native automation.
Edit documents, Markdown, spreadsheets, presentations, and PDFs inside your product.
Keep persistence, identity, collaboration, authorization, and AI in your host application.
Playground · Quick start · Editors · Automation · Architecture · Contributing
A3S Office is an open-source Office engine for product teams that need rich browser editing and agent-ready file automation without adopting an A3S backend. It ships complete editor surfaces, typed host contracts, browser file workflows, and a separate Rust automation plane.
- Embed complete editors through React, Vue 3, Web Components, or the framework-neutral Core API.
- Keep format-native behavior instead of forcing every file through one lowest-common-denominator model.
- Own the product boundary: your application controls content, storage, permissions, collaboration, and model providers.
- Automate deterministically through the native CLI, standard MCP server, or packaged Office Skill.
The images below are committed visual-regression baselines from the real Playground, not conceptual mockups.
- Product-native UI — Complete Office-style surfaces with no required backend, account system, or storage model.
- Accessible responsive shell — Compact sidebars, slide navigation, AI panes, dialogs, menus, and popovers share bounded keyboard navigation, background isolation, topmost Escape handling, and focus restoration. Shared color palettes expand to an eight-column touch layout on phones while preserving spatial arrow-key navigation.
- Editor-scoped zoom — Status controls and Ctrl/Cmd + mouse-wheel gestures share each surface's bounded zoom model without changing the host browser's page scale.
- Predictable state — Controlled content values, typed callbacks, explicit file actions, conflict-aware document edits, and one document typography baseline across editing, preview, and PDF rendering. Word editing and read-only preview retain the same canonical TipTap tree, while browser PDF export captures that same Worker/WASM page layout instead of rebuilding content from compatibility HTML.
- Framework choice — React components, Vue 3 adapters, Custom Elements, and a framework-neutral Core API over the same engine.
- Responsive computation — Lazy editor chunks, cancellable Workers, CSS-compatible font-weight matching, Rust WebAssembly layout and calculation, and PDFium rendering.
- AI without UI scraping — Typed agent ports and host-defined selection actions receive structured context and editing commands.
- Automation outside the browser — The native Rust CLI, standard MCP server, and Office Skill share bounded mutation contracts.
Node.js 20+, Bun 1.3+, and Rust 1.85+ are required.
git clone https://github.com/A3S-Lab/Office.git
cd Office
bun install --frozen-lockfile
bun run playgroundThen open the local URL printed by the development server. For a zero-install tour, use the live Playground.
Note
The @a3s-lab/office package is prepared for npm, but the first public npm
release has not been published yet. Use the Playground or build from source
until the release channel is available.
Once the package release is available, install it with its React peers:
bun add @a3s-lab/office react react-domImport the stylesheet once, give the editor an explicit-height host, and store
the complete value emitted by onChange:
import { useState } from 'react';
import type { DocumentContent } from '@a3s-lab/office/core';
import { DocumentEditor } from '@a3s-lab/office/react';
import '@a3s-lab/office/styles.css';
const initialContent: DocumentContent = {
type: 'document',
html: '<h1>Project brief</h1><p>Start editing here.</p>',
pageSize: 'a4',
pageColor: '#ffffff',
};
export function ProjectBrief() {
const [content, setContent] = useState(initialContent);
return (
<main style={{ height: '100dvh', minHeight: 0 }}>
<DocumentEditor
content={content}
onChange={setContent}
theme="system"
/>
</main>
);
}The editor owns editing, layout, import/export, and browser rendering. The host owns persistence and decides when, where, and how the emitted content is saved.
Give each mounted document a stable artifactId, then pass the matching,
current artifact to downloadArtifactPdf. Export waits for the live pagination
surface and crops the physical pages computed by the editor:
import { useState } from 'react';
import {
createArtifact,
downloadArtifactPdf,
} from '@a3s-lab/office/core';
import { DocumentEditor } from '@a3s-lab/office/react';
export function DocumentWithPdfExport() {
const [artifact, setArtifact] = useState(() =>
createArtifact('blank-document'),
);
if (artifact.content.type !== 'document') return null;
return (
<main style={{ display: 'flex', height: '100dvh', flexDirection: 'column' }}>
<button
type="button"
onClick={() => void downloadArtifactPdf(artifact)}
>
Export PDF
</button>
<section style={{ flex: 1, minHeight: 0 }}>
<DocumentEditor
artifactId={artifact.id}
content={artifact.content}
onChange={(content) =>
setArtifact((current) => ({
...current,
content,
revision: current.revision + 1,
updatedAt: Date.now(),
}))
}
/>
</section>
</main>
);
}The live path preserves automatic page-break decorations, shaped text, table continuations, and page chrome. It currently rasterizes each physical page into the PDF; searchable text and vector output remain future fidelity work.
@a3s-lab/office/react— Lazy React editor components and preload helpers.@a3s-lab/office/vue— Vue 3 adapters withv-model:content.@a3s-lab/office/web-component— Custom Elements for framework-agnostic UI composition.@a3s-lab/office/core— Typed models, templates, import, export, and browser file workflows.@a3s-lab/office/styles.css— Shared editor and interaction-system styles.
Copyable React, Vue, and Web Component examples live in the integration guide.
Each surface keeps a canonical model that matches its file format and user interaction model.
- Document — Pagination, sections, focused page-setup tabs, clean page margins with on-demand header/footer editing, outline navigation, styles, grouped bundled, common system, monospace, imported, and host-provided font choices with live typeface previews, precision table sizing and autofit, viewport-safe comment drafting, focus-preserving comment review and citation drafts, tracked changes, notes, pointer- and Shift+F10-accessible host-defined selection menus, and shared edit/preview/PDF typography and page-chrome placement. Editing, read-only preview, and browser PDF export share one live pagination result. DOCX import/export; PDF export.
- Markdown — GFM source, visual editing, synchronized and resizable split preview, source-native undo/redo with typing coalescing and selection restore, source-aware ribbon formatting and shortcuts, empty-source guidance, task lists, tables, links, images, code, and keyboard-accessible host-defined selection menus across both editing surfaces. Markdown import/export.
- Spreadsheet — Multiple sheets, formulas, dependency-aware recalculation, live selection statistics, an A3S-owned worksheet bar with lifecycle and color controls, safe deletion confirmation, in-place rename validation, a grid-aligned single-row responsive workbook footer that keeps the active worksheet and its actions visible across window and phone-width changes, selection-preserving undo/redo, deterministic Arrow, Enter, Tab, Home, PageUp/PageDown, row, column, and all-cells selection shortcuts, Cmd/Ctrl formatting through root-scoped capture before vendor grid listeners, an editor-owned Cmd/Ctrl+F search bar that finds displayed values, raw values, formulas, and sparse cells without opening browser Find, Shift+F11 creation, Ctrl/Cmd+PageUp/PageDown switching in edit and read-only preview, one shared cell/worksheet context-menu surface with executable shortcut hints, keyboard-operated cells and sheet tabs, direct type-to-edit, permission-resilient multi-cell cut/copy/paste, clear, F2 editing, and focus-safe Escape behavior, direct font-family, vertical-alignment, text-wrap, number/percent, and decimal controls, charts, validation, protection, comments, and print settings. XLSX, XLS, ODS, and CSV import; XLSX and PDF export.
- Presentation — Typed slide scene graph, multi-selection, groups, object transforms, keyboard-accessible table-size insertion, Shift+F10-accessible native slide and object context actions, guides, comments, transitions, editor-scoped formatting and clipboard shortcuts that restore the selected object, a dismissible phone slide navigator, a top-aligned phone canvas with a priority-aware status bar, one-step slideshow from the beginning or current slide, and presenter view. PPTX import/export; PDF export.
- PDF — PDFium rendering, navigation, search, form filling, annotations, annotation color, opacity, compatible stroke-width controls, history, focus-safe page and search drafts, responsive search-result, navigation, and zoom controls, editor-scoped shortcuts, and a keyboard-operated overflow menu that retains secondary annotation tools and appearance settings on phones. PDF open/save.
Document and Markdown accept public TipTap Extensions. Spreadsheet, Presentation, and PDF expose stable host ports rather than their internal command contexts. Editor engines and large runtime assets load only when that surface is requested.
A3S Office is headless at the product boundary, not at the UI boundary. The package includes complete toolbars, ribbons, panes, popovers, and dialogs while leaving product infrastructure to the host.
A3S Office owns: editing models and commands; import, export, layout, and rendering; editor UI and responsive interactions; typed selection and agent ports.
Your host owns: persistence and version history; identity, permissions, and collaboration; the application shell and navigation; AI providers, prompts, policy, and request lifecycle.
Document and Markdown selection menus can be replaced with host-defined typed
actions. Each action receives an immutable selection snapshot, nearby text,
the complete controlled content, and conflict-aware replaceText,
insertBefore, insertAfter, and copyText commands. Markdown snapshots also
identify whether the source or visual surface owns the selection. Async edits
track unrelated visual-editor transactions and fail with stale-selection
instead of changing the wrong text.
The Core API creates typed blank artifacts and performs browser-side import or export without mounting an editor:
import {
createArtifact,
createArtifactBlob,
importOfficeFile,
} from '@a3s-lab/office/core';
const imported = await importOfficeFile(file);
const output = await createArtifactBlob(imported);
const blankDeck = createArtifact('blank-presentation');Use downloadArtifact to start a browser download or
createArtifactBlob when your application owns upload and persistence.
The repository also contains a native Rust engine for deterministic reads, validation, mutation, batch operations, semantic previews, screenshots, and file watching across Office packages.
# Run from the repository root
cargo run -p a3s-office-cli -- validate report.docx --json
cargo run -p a3s-office-cli -- view report.docx outline --json
cargo run -p a3s-office-cli -- set report.docx /body --find Draft --replace Final --json
# Start the standard MCP server
cargo run -p a3s-office-cli -- mcpCLI, MCP, the typed Rust API, and the packaged Office Skill share the same bounded contracts. They inspect and modify files without launching desktop Office or scraping editor UI.
Read the native engine design, the complete CLI reference, or the Playground's automation guide.
The browser plane combines controlled editor surfaces, framework adapters, Workers, Rust WebAssembly, and PDFium. The native plane keeps filesystem and OOXML package concerns in a separate Rust core. Both planes expose typed contracts; neither requires an A3S backend.
For engine ownership, Worker/WASM boundaries, delivery stages, and performance gates, see Browser editor architecture.
A3S Office is pre-1.0. Content models and component props are public, but a minor release may still include breaking model changes. Required migrations will be called out in the changelog.
The project targets predictable browser editing and file preservation, not pixel parity with every Microsoft Office or WPS feature. Unsupported OOXML semantics and fidelity gaps remain explicit compatibility boundaries instead of being silently approximated. Track product depth and release evidence in the editor quality roadmap.
Run focused checks from the repository root:
bun install --frozen-lockfile
bun run format:check
bun run lint
bun run typecheck
bun run test
bun run buildStart the integration Playground with bun run playground. The full pull
request checklist also covers the Rust workspace, browser bundle budget, and
committed visual contracts; see CONTRIBUTING.md.
- Live Playground and integration guide
- Browser editor architecture
- Native Office engine
- CLI reference
- Editor quality roadmap
- Changelog
Contributions are welcome. Read the contribution guide and Code of Conduct before opening a change. Report suspected vulnerabilities through the private process in SECURITY.md, not through a public issue.
A3S Office is available under the MIT License. Bundled PDFium and other third-party assets carry additional notices in THIRD_PARTY_NOTICES.md.