mrmd-editor 0.3.1 → 0.3.3

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.1",
3
+ "version": "0.3.3",
4
4
  "description": "Markdown editor with realtime collaboration - the core editor package",
5
5
  "type": "module",
6
6
  "main": "dist/mrmd.cjs",
@@ -59,7 +59,7 @@
59
59
  "codemirror": "^6.0.1",
60
60
  "codemirror-lang-r": "^0.1.1",
61
61
  "katex": "^0.16.27",
62
- "mrmd-js": "file:../mrmd-js",
62
+ "mrmd-js": "^2.0.0",
63
63
  "y-codemirror.next": "^0.3.5",
64
64
  "y-websocket": "^2.0.0",
65
65
  "yjs": "^13.6.18"
package/src/execution.js CHANGED
@@ -103,6 +103,15 @@ export class ExecutionManager {
103
103
  console.log('[ExecutionManager] Monitor mode enabled, runtimeUrl:', runtimeUrl, 'session:', this._monitorSession);
104
104
  }
105
105
 
106
+ /**
107
+ * Update the default runtime URL (for switching venvs without recreating the editor)
108
+ * @param {string} runtimeUrl - New runtime URL
109
+ */
110
+ setRuntimeUrl(runtimeUrl) {
111
+ this._defaultRuntimeUrl = runtimeUrl;
112
+ console.log('[ExecutionManager] Runtime URL updated:', runtimeUrl);
113
+ }
114
+
106
115
  /**
107
116
  * Disable monitor mode (use direct execution)
108
117
  */
package/src/mrp-client.js CHANGED
@@ -63,6 +63,9 @@ export class MRPClient {
63
63
  this.#defaultSession = options.session || 'default';
64
64
  this.#fallbackLanguages = options.languages || null;
65
65
 
66
+ // Expose runtime URL for ExecutionManager to use in monitor mode routing
67
+ this.runtimeUrl = this.#endpoint;
68
+
66
69
  // Auto-fetch capabilities (fire and forget)
67
70
  if (options.prefetch !== false) {
68
71
  this.#capabilitiesPromise = this.getCapabilities().catch(() => null);
@@ -535,15 +535,23 @@ export async function createStudio(target, options = {}) {
535
535
  initialPath: python?.venv || '~',
536
536
  showHidden: true, // Show hidden folders like .venv
537
537
  onSelect: async (path) => {
538
+ console.log('[ChangeVenv] onSelect called with path:', path, 'for doc:', docName);
538
539
  try {
539
540
  // Create a dedicated runtime for this document with the selected venv
541
+ console.log('[ChangeVenv] Calling createSession...');
540
542
  const sessionInfo = await shellState.createSession(docName, 'dedicated', path);
543
+ console.log('[ChangeVenv] createSession returned:', sessionInfo);
541
544
 
542
545
  // Reconnect the editor to the new runtime
543
546
  if (editor?.connectRuntime && sessionInfo.url) {
544
547
  editor.connectRuntime('python', sessionInfo.url);
545
548
  }
546
549
 
550
+ // IMPORTANT: Update ExecutionManager's runtime URL for monitor mode
551
+ if (editor?.execution?.setRuntimeUrl && sessionInfo.url) {
552
+ editor.execution.setRuntimeUrl(sessionInfo.url);
553
+ }
554
+
547
555
  // Update the legacy python state for status bar display
548
556
  shellState._set('runtimes.python.venv', path);
549
557
  shellState._set('runtimes.python.venvName', path.split('/').pop());