Build Rider and graph bridge slice

This commit is contained in:
Meta Vens 2026-05-04 16:18:14 +01:00
commit afdfa230c7
25 changed files with 1421 additions and 28 deletions

View file

@ -0,0 +1,46 @@
# Epiphany Rider Plugin MVP
This is the first Rider-side bridge surface for Epiphany.
It is deliberately small:
- show an Epiphany tool window inside Rider
- call `tools/epiphany_rider_bridge.py status`
- send current editor file/selection context through
`tools/epiphany_rider_bridge.py context`
- write operator-safe artifacts under `.epiphany-gui/rider`
The plugin does not talk to worker transcripts, raw results, or agent internals.
Rider is the code view and context organ; Epiphany remains the coordinator and
source of durable state.
## Build
The project uses the IntelliJ Platform Gradle Plugin. This machine currently
does not have `gradle` on PATH, so the scaffold is source-ready but not yet
locally build-verified.
```powershell
cd E:\Projects\EpiphanyAgent\integrations\rider
gradle buildPlugin
```
## Runtime Contract
The plugin shells out to the local bridge script instead of owning protocol
logic:
```powershell
python E:\Projects\EpiphanyAgent\tools\epiphany_rider_bridge.py status --project-root <repo>
python E:\Projects\EpiphanyAgent\tools\epiphany_rider_bridge.py context --project-root <repo> --file <file> --selection-start <line> --selection-end <line>
```
Set these environment variables if needed:
- `EPIPHANY_REPO_ROOT`
- `EPIPHANY_PYTHON`
- `EPIPHANY_RIDER_ARTIFACT_ROOT`
The first dogfood use can also skip the plugin and use the bridge script
directly. The point is the receipt shape, not making Rider perform authority
the Epiphany coordinator owns.

View file

@ -0,0 +1,33 @@
plugins {
id("org.jetbrains.kotlin.jvm") version "2.0.21"
id("org.jetbrains.intellij.platform") version "2.14.0"
}
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
dependencies {
intellijPlatform {
rider("2026.1")
}
}
kotlin {
jvmToolchain(21)
}
intellijPlatform {
pluginConfiguration {
id = "dev.epiphany.rider"
name = "Epiphany"
version = "0.1.0"
ideaVersion {
sinceBuild = "261"
}
}
}

View file

@ -0,0 +1,15 @@
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
}
}
rootProject.name = "epiphany-rider"

View file

@ -0,0 +1,69 @@
package dev.epiphany.rider
import com.intellij.openapi.project.Project
import java.io.File
import java.nio.charset.StandardCharsets
import java.util.concurrent.TimeUnit
class EpiphanyBridgeClient(private val project: Project) {
private val projectRoot: File = File(project.basePath ?: ".").absoluteFile
private val epiphanyRoot: File = findEpiphanyRoot()
fun status(): String {
return runBridge(listOf("status", "--project-root", projectRoot.absolutePath))
}
fun captureContext(filePath: String, startLine: Int?, endLine: Int?): String {
val args = mutableListOf(
"context",
"--project-root",
projectRoot.absolutePath,
"--file",
filePath,
)
if (startLine != null) {
args.add("--selection-start")
args.add(startLine.toString())
}
if (endLine != null) {
args.add("--selection-end")
args.add(endLine.toString())
}
return runBridge(args)
}
private fun runBridge(args: List<String>): String {
val script = File(epiphanyRoot, "tools/epiphany_rider_bridge.py")
val artifactRoot = System.getenv("EPIPHANY_RIDER_ARTIFACT_ROOT")
?: File(epiphanyRoot, ".epiphany-gui/rider").absolutePath
val command = mutableListOf(pythonPath(), script.absolutePath)
command.addAll(args)
command.add("--artifact-root")
command.add(artifactRoot)
val process = ProcessBuilder(command)
.directory(epiphanyRoot)
.redirectErrorStream(true)
.start()
val output = process.inputStream.readBytes().toString(StandardCharsets.UTF_8)
process.waitFor(30, TimeUnit.SECONDS)
return output.ifBlank { "Epiphany bridge returned no output." }
}
private fun pythonPath(): String {
return System.getenv("EPIPHANY_PYTHON")
?: "C:\\Users\\Meta\\.cache\\codex-runtimes\\codex-primary-runtime\\dependencies\\python\\python.exe"
}
private fun findEpiphanyRoot(): File {
System.getenv("EPIPHANY_REPO_ROOT")?.let { return File(it).absoluteFile }
var cursor: File? = projectRoot
while (cursor != null) {
if (File(cursor, "tools/epiphany_rider_bridge.py").exists()) {
return cursor
}
cursor = cursor.parentFile
}
return File("E:\\Projects\\EpiphanyAgent")
}
}

View file

@ -0,0 +1,34 @@
package dev.epiphany.rider
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
import com.intellij.openapi.ui.Messages
class EpiphanyCaptureContextAction : AnAction() {
override fun actionPerformed(event: AnActionEvent) {
val project = event.project ?: return
val editor = event.getData(CommonDataKeys.EDITOR)
val file = event.getData(CommonDataKeys.VIRTUAL_FILE)
if (file == null) {
Messages.showWarningDialog(project, "No file is selected.", "Epiphany")
return
}
val document = editor?.document
val selection = editor?.selectionModel
val startLine = if (document != null && selection?.hasSelection() == true) {
document.getLineNumber(selection.selectionStart) + 1
} else {
null
}
val endLine = if (document != null && selection?.hasSelection() == true) {
document.getLineNumber(selection.selectionEnd) + 1
} else {
null
}
val output = EpiphanyBridgeClient(project).captureContext(file.path, startLine, endLine)
Messages.showInfoMessage(project, output.take(1200), "Epiphany Context Captured")
}
}

View file

@ -0,0 +1,33 @@
package dev.epiphany.rider
import com.intellij.openapi.project.Project
import com.intellij.openapi.wm.ToolWindow
import com.intellij.openapi.wm.ToolWindowFactory
import com.intellij.ui.content.ContentFactory
import java.awt.BorderLayout
import javax.swing.JButton
import javax.swing.JPanel
import javax.swing.JScrollPane
import javax.swing.JTextArea
class EpiphanyToolWindowFactory : ToolWindowFactory {
override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
val output = JTextArea()
output.isEditable = false
output.lineWrap = true
output.wrapStyleWord = true
output.text = "Epiphany Rider bridge is ready. Click Refresh to capture a source-context status receipt."
val refresh = JButton("Refresh")
refresh.addActionListener {
output.text = EpiphanyBridgeClient(project).status()
}
val panel = JPanel(BorderLayout(8, 8))
panel.add(refresh, BorderLayout.NORTH)
panel.add(JScrollPane(output), BorderLayout.CENTER)
val content = ContentFactory.getInstance().createContent(panel, "", false)
toolWindow.contentManager.addContent(content)
}
}

View file

@ -0,0 +1,25 @@
<idea-plugin>
<id>dev.epiphany.rider</id>
<name>Epiphany</name>
<vendor>GameCult</vendor>
<depends>com.intellij.modules.platform</depends>
<extensions defaultExtensionNs="com.intellij">
<toolWindow
id="Epiphany"
anchor="right"
factoryClass="dev.epiphany.rider.EpiphanyToolWindowFactory" />
</extensions>
<actions>
<action
id="Epiphany.CaptureContext"
class="dev.epiphany.rider.EpiphanyCaptureContextAction"
text="Send Context to Epiphany"
description="Write the current Rider file and selection as an Epiphany source-context artifact.">
<add-to-group group-id="EditorPopupMenu" anchor="last" />
<keyboard-shortcut keymap="$default" first-keystroke="ctrl alt E" />
</action>
</actions>
</idea-plugin>