Created
May 27, 2025 23:16
-
-
Save ileasile/132b5dab66f5a12db30ddd0c4c618e5e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells" : [ { | |
"cell_type" : "code", | |
"metadata" : { | |
"collapsed" : true, | |
"ExecuteTime" : { | |
"end_time" : "2025-05-27T23:07:46.315173Z", | |
"start_time" : "2025-05-27T23:07:38.743622Z" | |
} | |
}, | |
"source" : [ "USE {\n", " // repositories(\"https://packages.jetbrains.team/maven/p/kds/kotlin-ds-maven\")\n", " dependencies(\"org.jetbrains.kotlinx:kotlin-jupyter-intellij-platform:0.0.2-4-SNAPSHOT\")\n", "}" ], | |
"id" : "828904d87e21fa7f", | |
"outputs" : [ ], | |
"execution_count" : 1 | |
}, { | |
"metadata" : { | |
"ExecuteTime" : { | |
"end_time" : "2025-05-27T23:07:46.335963Z", | |
"start_time" : "2025-05-27T23:07:46.319041Z" | |
} | |
}, | |
"cell_type" : "code", | |
"source" : [ "import org.jetbrains.kotlinx.jupyter.intellij.utils.getIntelliJPlatformPath\n", "\n", "getIntelliJPlatformPath()" ], | |
"id" : "501ce1150d4919fc", | |
"outputs" : [ { | |
"data" : { | |
"text/plain" : [ "/Users/Ilya.Muradyan/Applications/IntelliJ IDEA Ultimate.app/Contents" ] | |
}, | |
"execution_count" : 2, | |
"metadata" : { }, | |
"output_type" : "execute_result" | |
} ], | |
"execution_count" : 2 | |
}, { | |
"metadata" : { | |
"ExecuteTime" : { | |
"end_time" : "2025-05-27T23:07:46.356422Z", | |
"start_time" : "2025-05-27T23:07:46.340345Z" | |
} | |
}, | |
"cell_type" : "code", | |
"source" : "notebook.workingDir", | |
"id" : "b98987f8f27ab345", | |
"outputs" : [ { | |
"data" : { | |
"text/plain" : [ "/Users/Ilya.Muradyan/IdeaProjects/notebooks1/intellij-sdk" ] | |
}, | |
"execution_count" : 3, | |
"metadata" : { }, | |
"output_type" : "execute_result" | |
} ], | |
"execution_count" : 3 | |
}, { | |
"metadata" : { | |
"ExecuteTime" : { | |
"end_time" : "2025-05-27T23:07:46.373952Z", | |
"start_time" : "2025-05-27T23:07:46.359737Z" | |
} | |
}, | |
"cell_type" : "code", | |
"source" : "val LLM_PLUGIN_ID = \"com.intellij.ml.llm\"", | |
"id" : "2702614726ba482a", | |
"outputs" : [ ], | |
"execution_count" : 4 | |
}, { | |
"metadata" : { | |
"ExecuteTime" : { | |
"end_time" : "2025-05-27T23:07:46.403513Z", | |
"start_time" : "2025-05-27T23:07:46.375741Z" | |
} | |
}, | |
"cell_type" : "code", | |
"source" : [ "import com.intellij.ide.plugins.PluginManagerCore\n", "import com.intellij.openapi.extensions.PluginId\n", "import com.intellij.ide.plugins.PluginModuleDescriptor\n", "import com.intellij.ide.plugins.PluginMainDescriptor\n", "\n", "val llmPlugin = PluginManagerCore.getPluginSet().findEnabledPlugin(PluginId.findId(LLM_PLUGIN_ID)!!) as PluginMainDescriptor" ], | |
"id" : "3bd0010e5da07461", | |
"outputs" : [ ], | |
"execution_count" : 5 | |
}, { | |
"metadata" : { | |
"ExecuteTime" : { | |
"end_time" : "2025-05-27T23:07:49.145779Z", | |
"start_time" : "2025-05-27T23:07:46.404865Z" | |
} | |
}, | |
"cell_type" : "code", | |
"source" : [ "import com.intellij.ide.plugins.PluginManager\n", "import com.intellij.openapi.extensions.PluginId\n", "import com.intellij.openapi.project.ProjectManager\n", "import java.nio.file.Files\n", "import java.nio.file.Path\n", "import kotlin.io.path.extension\n", "import kotlin.io.path.pathString\n", "\n", "internal fun Path.collectJars() = Files.walk(this).filter { it.extension == \"jar\" }\n", "\n", "val project = requireNotNull(currentProject())\n", "val jars = llmPlugin.pluginPath.collectJars()\n", "\n", "USE {\n", " dependencies {\n", " jars.forEach {\n", " implementation(it.pathString)\n", " }\n", " }\n", "}" ], | |
"id" : "ee6680bf4ed66cb8", | |
"outputs" : [ ], | |
"execution_count" : 6 | |
}, { | |
"metadata" : { | |
"ExecuteTime" : { | |
"end_time" : "2025-05-27T23:04:55.694756Z", | |
"start_time" : "2025-05-27T23:04:55.624851Z" | |
} | |
}, | |
"cell_type" : "code", | |
"source" : [ "import com.intellij.ide.plugins.PluginMainDescriptor\n", "import com.intellij.ide.plugins.contentModules\n", "import org.jetbrains.kotlinx.jupyter.util.ModifiableParentsClassLoader\n", "\n", "fun Notebook.addAllPluginClassLoaders(descriptor: PluginMainDescriptor) {\n", " // TODO: We should add only CLs of \"leaf\" modules - those not serving as a parent for other modules\n", " val classloaders = descriptor.contentModules.map { it.classLoader }.toSet()\n", " val base = intermediateClassLoader as ModifiableParentsClassLoader\n", " for (cl in classloaders) {\n", " base.addParent(cl)\n", " }\n", "}" ], | |
"id" : "34d2048434bc559d", | |
"outputs" : [ ], | |
"execution_count" : 8 | |
}, { | |
"metadata" : { | |
"ExecuteTime" : { | |
"end_time" : "2025-05-27T23:05:03.487524Z", | |
"start_time" : "2025-05-27T23:05:03.442113Z" | |
} | |
}, | |
"cell_type" : "code", | |
"source" : "// notebook.addAllPluginClassLoaders(llmPlugin)", | |
"id" : "79d780cbbfbf6654", | |
"outputs" : [ ], | |
"execution_count" : 9 | |
}, { | |
"metadata" : { | |
"ExecuteTime" : { | |
"end_time" : "2025-05-27T23:07:57.671289Z", | |
"start_time" : "2025-05-27T23:07:57.578724Z" | |
} | |
}, | |
"cell_type" : "code", | |
"source" : [ "import org.jetbrains.kotlinx.jupyter.util.ModifiableParentsClassLoader\n", "\n", "val llmAgentsCl = llmPlugin.content.modules.first { it.name.contains(\"agents\") }.descriptor.classLoader\n", "(notebook.intermediateClassLoader as ModifiableParentsClassLoader).addParent(llmAgentsCl)" ], | |
"id" : "362d9fb04fad6bcc", | |
"outputs" : [ ], | |
"execution_count" : 7 | |
}, { | |
"metadata" : { | |
"ExecuteTime" : { | |
"end_time" : "2025-05-27T23:08:03.690005Z", | |
"start_time" : "2025-05-27T23:08:03.658912Z" | |
} | |
}, | |
"cell_type" : "code", | |
"source" : [ "import com.intellij.openapi.application.ApplicationManager\n", "import com.intellij.ml.llm.agents.ChatAgent\n", "\n", "ApplicationManager.getApplication().extensionArea.getExtensionPoint<ChatAgent>(\"com.intellij.ml.llm.agents.chatAgent\").extensions" ], | |
"id" : "36b95b4650a96f3e", | |
"outputs" : [ { | |
"data" : { | |
"text/plain" : [ "[com.intellij.ml.llm.agents.wrench.WrenchChatAgent@799a53d4]" ] | |
}, | |
"execution_count" : 8, | |
"metadata" : { }, | |
"output_type" : "execute_result" | |
} ], | |
"execution_count" : 8 | |
}, { | |
"metadata" : { }, | |
"cell_type" : "code", | |
"outputs" : [ ], | |
"execution_count" : null, | |
"source" : "", | |
"id" : "7ad8865d9b308a2b" | |
} ], | |
"metadata" : { | |
"kernelspec" : { | |
"display_name" : "Kotlin", | |
"language" : "kotlin", | |
"name" : "kotlin" | |
}, | |
"language_info" : { | |
"name" : "kotlin", | |
"version" : "1.9.23", | |
"mimetype" : "text/x-kotlin", | |
"file_extension" : ".kt", | |
"pygments_lexer" : "kotlin", | |
"codemirror_mode" : "text/x-kotlin", | |
"nbconvert_exporter" : "" | |
}, | |
"ktnbPluginMetadata" : { | |
"sessionRunMode" : "IDE_PROCESS" | |
} | |
}, | |
"nbformat" : 4, | |
"nbformat_minor" : 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment