Skip to main content

Module forge

Module forge 

Source
Expand description

Oxide Forge — multi-provider AI guest app generation layer.

Turns a user’s natural-language prompt into a compiled guest .wasm module that can be hot-loaded into an Oxide tab. Driven entirely by the native host UI (oxide://forge) — no guest-side API yet.

Pipeline:

  1. ForgeState::start — scaffolds a fresh project under the active Forge output directory, copying forge/templates/base/ and spawning a background task that streams a Claude response into the session’s code buffer.
  2. The UI polls ForgeState::snapshot each frame to render progress.
  3. When streaming completes, the session’s src/lib.rs is written to disk. The UI may then call ForgeState::build, which spawns cargo build --target wasm32-unknown-unknown --release in the session directory and populates either artifact_path or build_log on completion.

API keys for Anthropic, OpenAI, Google Gemini, and xAI can be configured in the oxide://forge settings panel or via environment variables. The system prompt is composed at boot from the oxide-wasm-app Agent Skill under forge/skills/oxide-wasm-app/ (see https://agentskills.io/): its SKILL.md body plus every markdown file it bundles in references/.

Structs§

ForgeChatMessage
One turn in the Forge chat UI (Cursor-style conversation).
ForgeCreationSummary
ForgeSnapshot
Snapshot of a session for the UI to render. Cheap to clone (a few strings).
ForgeState

Enums§

ForgeMessageRole
Role of a message in the Forge chat thread.
ForgePhase
Coarse-grained state machine for a single Forge session, surfaced to the UI.

Constants§

DEFAULT_MODEL
Default model. Override with OXIDE_FORGE_MODEL env var.