Sending pre-defined prompts to Junie

Hi!

We are working on various types of integrations of our plugin with Junie, and one of the features we are exploring is sending pre-defined prompts to Junie.

Ideally, what we’d like to have is to

  • define a set of common prompts for our tools,
  • bind them to various feasible IDE features like (intention) actions, line markers, etc.
  • and upon users invoking those features, the pre-defined prompts would either be populated into Junie’s prompt field, or could even be submitted right away in a specific mode (Auto, Code, Ask).

I’ve done a bit of digging and experimenting, and at first glance com.intellij.ml.llm.matterhorn.junie.shared.tasks.TaskService#startseems like a candidate (have no idea if it is a good one or not, and I haven’t found any other candidate).

However, upon invoking it from our plugin’s code, it yields the following exception:

com.intellij.diagnostic.PluginException: Class com.intellij.ml.llm.matterhorn.junie.core.shared.tasks.TaskChainId must not be requested from main classloader of org.jetbrains.junie plugin. Matches content module (packagePrefix=com.intellij.ml.llm.matterhorn., moduleName=matterhorn.core.main). [Plugin: ...]
	at com.intellij.ide.plugins.cl.PluginClassLoader.tryLoadingClass(PluginClassLoader.kt:205)
	at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.kt:154)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
	at our.plugin.actions.SomeAction.actionPerformed(SendPromptToJunieAction.kt:37)
	at com.intellij.openapi.actionSystem.impl.ActionButton.actionPerformed(ActionButton.java:243)

Is there a way to achieve a feature like this external to Junie, when depending on Junie or any of its modules?

If it is, could anyone please direct me to corresponding parts of the Junie codebase, and advise what and how should be invoked, what module(s) of it should we specify as dependencies, etc.?

Thanks!

1 Like

Thanks for reaching out — and sorry about the frustration here.

At the moment, we can’t approve or support any third-party usage of AI Assistant or Junie APIs (including depending on Junie or its internal modules). Junie is currently undergoing significant restructuring, and its APIs are subject to frequent breaking changes. In addition, there are still open questions around performance, security, quota accounting and safe execution when Junie is triggered automatically or externally by another plugin.

Because of this, we’re not able to approve external plugins to build on top of Junie or AI Assistant internals right now.

We are tracking demand for this capability, and if this is something you’d like to see supported in the future, please upvote and follow this issue in YouTrack: https://youtrack.jetbrains.com/issue/LLM-2340/Allow-third-party-plugins-to-call-external-API-for-AI-Assistant

Thanks for your understanding, and we appreciate your interest in extending the platform.

Thank you, that is really useful info!

I’ll check out the issue you linked and upvote it.