Add AutoDev Unit: Reversible artifact builder for AI-generated executables #527
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements text-to-artifact paradigm: AI-generated code → standalone executables that contain their own source + generation history. Users can drag artifacts back into AutoDev to restore chat context and iterate.
Architecture
Binary Format:
Core Models (mpp-core):
ArtifactMetadata- Embeds chat history, original prompt, timestampsArtifactPayload- Source files, dependencies (PEP 723/package.json), assetsArtifactBuilder/Extractor- Platform-independent interfacesPep723Parser- Extracts Python inline dependency metadataPlatform Implementations:
UI Components (mpp-ui):
AgentType.ARTIFACT_UNITin routerUsage
Pending
See
docs/ARTIFACT_UNIT.mdfor full specification.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
dl.google.com/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -Xmx8g -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.14.3-bin/cv11ve7ro1n3o1j4so8xd9n66/gradle-8.14.3/lib/gradle-daemon-main-8.14.3.jar(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
This section details on the original issue you should resolve
<issue_title>AutoDev Unit - the Artifact builder</issue_title>
<issue_description>Feature Proposal: AutoDev Unit - The Reversible Artifact Builder
Description
AutoDev Unit is an end-to-end AI artifact construction engine designed to facilitate a paradigm shift: "Text-to-Artifact". It goes beyond traditional code generation by instantly encapsulating AI-generated Python scripts or Web applications into standalone, executable desktop programs (.exe/.app).
The core differentiator is "Reversibility": The generated artifacts are not just final deliverables but also containers for their own source code and generation history. Users can run them like standard native software, or drag them back into the AutoDev Unit to "unpack" the context, restore the chat session, and iterate on the development.
Motivation
Current AI Artifacts (HTML/JS) are confined within browser sandboxes, preventing access to system-level APIs (file system, hardware control, complex local computation). We need a secure method to run AI applications as local processes to unlock the full potential of Python and Shell automation.
End-users often lack the technical capability to configure Python environments or manage pip install requirements. AutoDev Unit aims to provide a "Click-to-Run" zero-configuration experience by utilizing self-bootstrapping runtime environments and automated dependency management (PEP 723).
Traditional code generation is one-way (Generate -> Download -> Context Lost). Once code leaves the AI interface, the user cannot leverage the original prompt context for modifications. AutoDev Unit creates a Closed Loop lifecycle by embedding the generation context into the binary, allowing for seamless "Load-Back" editing.
Proposed Solution
The solution relies on a "Pre-built Runtime Shell" + "Binary Overlay" architecture, avoiding slow compilation times.
Runtime Shell: A pre-compiled, generic host program (based on PyInstaller bootloader or Kotlin Native). It contains no business logic but logic to read its own binary tail.
Overlay Payload: A compressed data block containing:
Source Code (ZIP)
Dependency Manifests (PEP 723)
Context Metadata (Chat history, Prompts, User Intent)
The Assembly Process: Instead of compiling, the engine performs a Binary Append operation, attaching the Payload to the Shell with a "Magic Delimiter." This allows for millisecond-level "building."
The user interface is designed as a dual-pane "Creator Tool":
Left Panel (Context Source):
Chat Interface: Standard LLM interaction for generating logic.
Intent Input: "Create a Hacker News scraper."
Right Panel (Artifact Workbench):
Tab 1: Source Code: Displays generated code with syntax highlighting.
Feature: specific highlighting for PEP 723 metadata blocks (# /// script) to show dependencies.
Tab 2: Run Preview: An in-browser sandbox using Pyodide (WASM).
Interaction: Users click "Run Now" to test logic safely before packaging.
Tab 3: Binary Metadata: A visualizer showing the structure of the file being built (Shell + Payload).
The Build Action:
Button: "Export Artifact (.exe)".
Animation: A modal showing the stages: Loading Shell -> Serializing Context -> Injecting Overlay.
Result: A downloadable executable file.
User Action: Drag & Drop a previously generated app.exe back into the AutoDev Unit UI.
System Action: The tool reads the file tail, locates the Magic Delimiter, and extracts the history.json.
Result: The Chat Interface is restored to the exact state it was in when the app was created, allowing the user to type: "Add a feature to save results to CSV," and generate version 2.0.
Python Path:
Use PEP 723 for inline dependency declaration.
Self-Bootstrapping: The shell detects missing environments and uses tools like uv or pip to set up a temporary runtime.
Windows Optimization: Inject input() halts to prevent console flash-closing; support .pyw for windowless GUI apps.
Web/GUI Path:
Host: Kotlin Compose Multiplatform + CEF (Chromium Embedded Framework).
Custom Scheme Handler: Intercepts app:// requests to serve HTML/JS assets directly from the EXE's binary overlay (memory), ensuring no loose files on the disk.
Alternatives Considered
Concept: Running pyinstaller commands for every user request.
Rejection: Too slow (minutes vs. milliseconds), high server CPU cost, and requires complex environment isolation per user.
Concept: Generating simple batch scripts.
Rejection: Poor cross-platform compatibility (Windows vs. Unix), lack of standardized metadata storage, and high "false positive" rates from antivirus software.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.