How arcsin1/oh-my-ppt works
Purpose and Entry Points
Oh My PPT is a local-first Electron desktop application for AI-assisted creation, editing, import, presentation, and export of HTML-backed slide decks. It supports editable PPTX import/export, document-driven generation, AI image generation, templates, styles, animations, and local session assets. Electron bootstraps from src/main/index.ts; the React renderer begins at src/renderer/src/main.tsx and routes through src/renderer/src/App.tsx; the constrained renderer-to-main API is exposed by src/preload/index.ts.
Desktop Process and IPC Boundary
The main process owns windows, lifecycle, menus/tray, persistent files, model credentials, and privileged operations. The renderer must request those capabilities through IPC rather than accessing local resources directly. IPC composition and runtime session/event contracts live in src/main/ipc/index.ts, src/main/ipc/runtime/event-contract.ts, and src/renderer/src/lib/ipc.ts. This is the principal security and process-isolation boundary.
Session-Centered Presentation Domain
A session is the durable unit for a deck, its pages, masters, local assets, metadata, and revisions. Main-process services mutate pages, merge content, manage masters, build page HTML, and save/import sessions; renderer stores project the active session and editing state. Core paths: src/main/session/page-management-service.ts, src/main/session/master-service.ts, src/renderer/src/store/sessionDetailStore.ts. SQLite/Drizzle persistence and schema evolution are centered in src/main/db/database.ts, src/main/db/schema.ts, and src/main/db/patch/index.ts; Git-backed history is implemented by src/main/history/git-history-service.ts.
HTML Presentation Representation and Editor
Pages are serialized HTML with a presentation contract, design contract, resource policy, fonts, and asset references. This representation is the shared boundary between AI generation, visual editing, preview, export, and persistence. Key implementation paths are src/main/presentation/html/page-contract.ts, src/main/presentation/html/page-writer-core.ts, and src/main/presentation/design-contract.ts. The renderer’s editing workspace and iframe-based preview are anchored by src/renderer/src/components/session-detail/preview/PreviewStage.tsx, src/renderer/src/components/preview/PreviewIframe.tsx, and src/renderer/src/pages/session-detail.tsx.
AI Runtime, Planning, and Generation Jobs
AI work is mediated by an agent runtime: model resolution, prompt composition, tool-backed agents, event bus, job coordination, and resource locking. Its public runtime begins at src/main/agent-runtime/index.ts; concurrency/control primitives are in src/main/agent-runtime/job/coordinator.ts and src/main/agent-runtime/lock/resource-lock.ts. Generation converts a user topic, documents, style/template choices, and slide settings into an outline/plan, then runs deck/page flows and finalization: src/main/generation/deck-flow.ts, src/main/generation/agent-runner.ts, src/main/generation/finalization.ts. Conversational “thinking” is a staged planning subsystem in src/main/thinking/thinking-agent.ts, src/main/thinking/stage-manager.ts, and src/main/thinking/source-plan.ts.
Model, Image, Style, and Skill Inputs
Text models are provider-configured and include OpenAI-compatible endpoints such as local Ollama; image generation is separately configured and dispatched to provider adapters. Relevant boundaries: src/main/agent-runtime/model/resolve.ts, src/main/agent-runtime/provider/image/index.ts, and src/main/agent-runtime/provider/image/providers/openai-chat-completions.ts. Built-in style packages and agent skills are packaged resources, initialized into runtime catalogs, and shape prompting/design constraints: resources/styles/manifest.json, src/main/styles/style-runtime.ts, and src/main/product-skills/initializer.ts.
Import, Export, and Runtime Packaging
I/O converts external documents and PPTX into the session/HTML model, and renders HTML pages to editable PPTX, PDF/PNG, MP4, thumbnails, or portable slide packages. PPTX import is isolated under src/main/io/pptx-import/index.ts; HTML-to-PPTX rendering/export under src/main/io/html-pptx/renderer.ts; video export under src/main/io/html-video/exporter.ts. Browser-side slide behavior and animation resources ship locally in resources/index-runtime.js, resources/ppt-runtime.js, and resources/anime.v4.js. Electron Vite builds the app, while electron-builder.yml defines distributable desktop packaging.
Main entry points: index.ts IPC composition · page-management-service.ts Session services · page-contract.ts HTML page contract · sessionDetailStore.ts Active session store
Components 21
Desktop boundary
Electron process separation and IPC.
- Electron main · Owns privileged desktop lifecycle and local capabilities.
src/main/index.ts - Preload API · Constrained renderer-to-main API.
src/preload/index.ts - IPC composition · Registers privileged request handlers and runtime events.
src/main/ipc/index.ts - React renderer
src/renderer/src/main.tsx - Application routes
src/renderer/src/App.tsx
Session and presentation
Durable deck model and HTML editing representation.
- Session services · Mutates pages, content, assets, masters, and session files.
src/main/session/page-management-service.ts - Master management · Maintains deck master layouts.
src/main/session/master-service.ts - Active session store · Holds active session and editing state.
src/renderer/src/store/sessionDetailStore.ts - HTML page contract · Serialized page format shared by generation, editing, preview, export, and persistence.
src/main/presentation/html/page-contract.ts - Page HTML writer · Builds contract-compliant slide HTML.
src/main/presentation/html/page-writer-core.ts - Preview workspace · Interactive editing stage and iframe slide preview.
src/renderer/src/components/session-detail/preview/PreviewStage.tsx - SQLite session database · Drizzle-backed session metadata and schema storage.
src/main/db/database.ts - Git revision history
src/main/history/git-history-service.ts
AI generation
Runtime-managed planning and deck generation.
- Agent runtime · Resolves models, tools, events, jobs, and resource locks.
src/main/agent-runtime/index.ts - Deck generation flow · Runs outline, page/deck generation, and finalization.
src/main/generation/deck-flow.ts - Thinking planner · Stages conversational source and slide planning.
src/main/thinking/thinking-agent.ts - Style runtime · Loads packaged styles into generation constraints.
src/main/styles/style-runtime.ts
Import, export and packaging
External format conversion and bundled runtime assets.
- PPTX import · Converts editable PPTX into the session HTML model.
src/main/io/pptx-import/index.ts - HTML-to-PPTX export · Renders HTML slides as editable PPTX.
src/main/io/html-pptx/renderer.ts - Video export · Renders slide output to MP4.
src/main/io/html-video/exporter.ts - Bundled slide runtime · Local slide behavior and animation resources.
resources/index-runtime.js
Connections 24
- Electron main → Preload API: loads
- Preload API → IPC composition: invokes · Renderer requests privileged operations through this boundary.
- React renderer → Application routes: boots
- Application routes → Active session store: uses
- Active session store → IPC composition: requests session operations
- IPC composition → Session services: dispatches
- Session services → Master management: manages
- Session services → Page HTML writer: writes pages
- Page HTML writer → HTML page contract: conforms to
- Session services → SQLite session database: persists metadata
- Session services → Git revision history: records revisions
- Active session store → Preview workspace: drives editing
- Preview workspace → HTML page contract: edits and previews
- IPC composition → Agent runtime: starts jobs
- Agent runtime → Thinking planner: runs planning
- Agent runtime → Deck generation flow: coordinates
- Style runtime → Deck generation flow: constrains design
- Deck generation flow → Page HTML writer: creates slide HTML
- IPC composition → PPTX import: dispatches import
- PPTX import → Session services: creates session content
- IPC composition → HTML-to-PPTX export: dispatches export
- HTML page contract → HTML-to-PPTX export: renders from
- HTML page contract → Video export: renders from
- Preview workspace → Bundled slide runtime: loads locally