Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 24, 2025

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:

[Runtime Shell] → [@@AI_DATA@@] → [ZIP Payload] → [JSON Metadata] → [Footer(offsets+checksums)]

Core Models (mpp-core):

  • ArtifactMetadata - Embeds chat history, original prompt, timestamps
  • ArtifactPayload - Source files, dependencies (PEP 723/package.json), assets
  • ArtifactBuilder/Extractor - Platform-independent interfaces
  • Pep723Parser - Extracts Python inline dependency metadata

Platform Implementations:

  • JVM: Full builder/extractor with ZIP compression, SHA-256 verification
  • JS/WASM/Android/iOS: Time utilities (expect/actual pattern)

UI Components (mpp-ui):

  • Dual-pane: Chat interface (left) + Artifact workbench (right)
  • Workbench tabs: Source Code viewer, Run Preview (placeholder), Binary Metadata visualizer
  • Integrated as AgentType.ARTIFACT_UNIT in router

Usage

// Build artifact
val payload = ArtifactPayload(
    metadata = ArtifactMetadata(
        id = "artifact-${timestamp}",
        type = ArtifactType.PYTHON_SCRIPT,
        chatHistory = listOf(/* full conversation */),
        originalPrompt = "Create HN scraper"
    ),
    sourceFiles = mapOf("main.py" to pythonCode),
    dependencies = Pep723Parser.parse(pythonCode)
)

val builder = JvmArtifactBuilder()
val result = builder.build(payload, "runtime-shell.exe")

// Extract for iteration
val extractor = JvmArtifactExtractor()
val extracted = extractor.extractFromFile("artifact.exe")
// → Restore chat context from extracted.payload.metadata.chatHistory

Pending

  • Runtime shell templates (PyInstaller for Python, CEF for Web)
  • Pyodide integration for in-browser preview
  • LLM integration in chat pane
  • Drag-drop import UI workflow

See docs/ARTIFACT_UNIT.md for 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
    • Triggering command: /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

  1. Breaking the Browser Sandbox

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.

  1. Solving "Dependency Hell"

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).

  1. Closing the "Generation Loop"

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.

  1. Architectural Core

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."

  1. UI/UX Design & Interaction Flow

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.

  1. The "Reversible" Workflow (Load-Back)

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.

  1. Technical Implementation Paths

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

  1. JIT Compilation (PyInstaller on Server)

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.

  1. Pure Shell Scripts (.bat/.sh)

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.

  1. Electron / Tauri...

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@coderabbitai
Copy link

coderabbitai bot commented Dec 24, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI changed the title [WIP] Add AutoDev Unit for reversible artifact building Add AutoDev Unit: Reversible artifact builder for AI-generated executables Dec 24, 2025
Copilot AI requested a review from phodal December 24, 2025 09:17
@phodal phodal closed this Dec 24, 2025
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.

AutoDev Unit - the Artifact builder

2 participants