mrmd-editor 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mrmd-editor",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Markdown editor with realtime collaboration - the core editor package",
5
5
  "type": "module",
6
6
  "main": "dist/mrmd.cjs",
@@ -594,8 +594,46 @@ export async function createStudio(target, options = {}) {
594
594
  },
595
595
 
596
596
  async onRestartRuntime(language) {
597
- // TODO: Implement runtime restart via orchestrator
598
- console.log('Restart runtime:', language);
597
+ console.log('[RestartRuntime] Starting restart for:', language);
598
+
599
+ const docName = shellState.get('currentDoc');
600
+ if (!docName) {
601
+ console.warn('[RestartRuntime] No current document');
602
+ return;
603
+ }
604
+
605
+ try {
606
+ // Get current session info to preserve venv
607
+ const python = shellState.get('runtimes.python') || {};
608
+ const currentVenv = python.venv;
609
+ console.log('[RestartRuntime] Current venv:', currentVenv);
610
+
611
+ // Destroy existing session (kills the daemon)
612
+ console.log('[RestartRuntime] Destroying session for:', docName);
613
+ await orchestratorClient.destroySession(docName);
614
+
615
+ // Small delay to ensure cleanup
616
+ await new Promise(r => setTimeout(r, 500));
617
+
618
+ // Create new session with same venv
619
+ console.log('[RestartRuntime] Creating new session with venv:', currentVenv);
620
+ const sessionInfo = await shellState.createSession(docName, 'dedicated', currentVenv);
621
+ console.log('[RestartRuntime] New session created:', sessionInfo);
622
+
623
+ // Reconnect editor to new runtime
624
+ if (editor?.connectRuntime && sessionInfo.url) {
625
+ editor.connectRuntime('python', sessionInfo.url);
626
+ }
627
+
628
+ // Update execution manager
629
+ if (editor?.execution?.setRuntimeUrl) {
630
+ editor.execution.setRuntimeUrl(sessionInfo.url);
631
+ }
632
+
633
+ emit('runtimeRestarted', { language, session: sessionInfo });
634
+ } catch (error) {
635
+ console.error('[RestartRuntime] Error:', error);
636
+ }
599
637
  },
600
638
 
601
639
  async onNewFile() {