more-compute 0.1.4__py3-none-any.whl → 0.2.0__py3-none-any.whl

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.
Files changed (55) hide show
  1. frontend/app/globals.css +322 -77
  2. frontend/app/layout.tsx +98 -82
  3. frontend/components/Cell.tsx +234 -95
  4. frontend/components/Notebook.tsx +430 -199
  5. frontend/components/{AddCellButton.tsx → cell/AddCellButton.tsx} +0 -2
  6. frontend/components/cell/MonacoCell.tsx +726 -0
  7. frontend/components/layout/ConnectionBanner.tsx +41 -0
  8. frontend/components/{Sidebar.tsx → layout/Sidebar.tsx} +16 -11
  9. frontend/components/modals/ConfirmModal.tsx +154 -0
  10. frontend/components/modals/SuccessModal.tsx +140 -0
  11. frontend/components/output/MarkdownRenderer.tsx +116 -0
  12. frontend/components/popups/ComputePopup.tsx +674 -365
  13. frontend/components/popups/MetricsPopup.tsx +11 -7
  14. frontend/components/popups/SettingsPopup.tsx +11 -13
  15. frontend/contexts/PodWebSocketContext.tsx +247 -0
  16. frontend/eslint.config.mjs +11 -0
  17. frontend/lib/monaco-themes.ts +160 -0
  18. frontend/lib/settings.ts +128 -26
  19. frontend/lib/themes.json +9973 -0
  20. frontend/lib/websocket-native.ts +19 -8
  21. frontend/lib/websocket.ts +59 -11
  22. frontend/next.config.ts +8 -0
  23. frontend/package-lock.json +1705 -3
  24. frontend/package.json +8 -1
  25. frontend/styling_README.md +18 -0
  26. kernel_run.py +159 -42
  27. more_compute-0.2.0.dist-info/METADATA +126 -0
  28. more_compute-0.2.0.dist-info/RECORD +100 -0
  29. morecompute/__version__.py +1 -1
  30. morecompute/execution/executor.py +31 -20
  31. morecompute/execution/worker.py +68 -7
  32. morecompute/models/__init__.py +31 -0
  33. morecompute/models/api_models.py +197 -0
  34. morecompute/notebook.py +50 -7
  35. morecompute/server.py +574 -94
  36. morecompute/services/data_manager.py +379 -0
  37. morecompute/services/lsp_service.py +335 -0
  38. morecompute/services/pod_manager.py +122 -20
  39. morecompute/services/pod_monitor.py +138 -0
  40. morecompute/services/prime_intellect.py +87 -63
  41. morecompute/utils/config_util.py +59 -0
  42. morecompute/utils/special_commands.py +11 -5
  43. morecompute/utils/zmq_util.py +51 -0
  44. frontend/components/MarkdownRenderer.tsx +0 -84
  45. frontend/components/popups/PythonPopup.tsx +0 -292
  46. more_compute-0.1.4.dist-info/METADATA +0 -173
  47. more_compute-0.1.4.dist-info/RECORD +0 -86
  48. /frontend/components/{CellButton.tsx → cell/CellButton.tsx} +0 -0
  49. /frontend/components/{ErrorModal.tsx → modals/ErrorModal.tsx} +0 -0
  50. /frontend/components/{CellOutput.tsx → output/CellOutput.tsx} +0 -0
  51. /frontend/components/{ErrorDisplay.tsx → output/ErrorDisplay.tsx} +0 -0
  52. {more_compute-0.1.4.dist-info → more_compute-0.2.0.dist-info}/WHEEL +0 -0
  53. {more_compute-0.1.4.dist-info → more_compute-0.2.0.dist-info}/entry_points.txt +0 -0
  54. {more_compute-0.1.4.dist-info → more_compute-0.2.0.dist-info}/licenses/LICENSE +0 -0
  55. {more_compute-0.1.4.dist-info → more_compute-0.2.0.dist-info}/top_level.txt +0 -0
@@ -1,8 +1,8 @@
1
- import { Cell, ExecutionResult } from '@/types/notebook';
1
+ type EventCallback = (data: unknown) => void;
2
2
 
3
3
  export class WebSocketService {
4
4
  private ws: WebSocket | null = null;
5
- private listeners: Map<string, Function[]> = new Map();
5
+ private listeners: Map<string, EventCallback[]> = new Map();
6
6
  private reconnectAttempts = 0;
7
7
  private maxReconnectAttempts = 5;
8
8
  private url: string = '';
@@ -47,7 +47,7 @@ export class WebSocketService {
47
47
  });
48
48
  }
49
49
 
50
- private handleMessage(data: any) {
50
+ private handleMessage(data: { type: string; data: unknown }) {
51
51
  const messageType = data.type;
52
52
  const messageData = data.data;
53
53
 
@@ -96,6 +96,9 @@ export class WebSocketService {
96
96
  window.dispatchEvent(new CustomEvent('mc:packages-updated', { detail: messageData }));
97
97
  } catch {}
98
98
  break;
99
+ case 'notebook_saved':
100
+ this.emit('notebook_saved', messageData);
101
+ break;
99
102
  case 'error':
100
103
  this.emit('error', messageData);
101
104
  break;
@@ -116,14 +119,14 @@ export class WebSocketService {
116
119
  }
117
120
  }
118
121
 
119
- on(event: string, callback: Function) {
122
+ on(event: string, callback: EventCallback) {
120
123
  if (!this.listeners.has(event)) {
121
124
  this.listeners.set(event, []);
122
125
  }
123
126
  this.listeners.get(event)!.push(callback);
124
127
  }
125
128
 
126
- off(event: string, callback: Function) {
129
+ off(event: string, callback: EventCallback) {
127
130
  const callbacks = this.listeners.get(event);
128
131
  if (callbacks) {
129
132
  const index = callbacks.indexOf(callback);
@@ -133,14 +136,14 @@ export class WebSocketService {
133
136
  }
134
137
  }
135
138
 
136
- private emit(event: string, data: any) {
139
+ private emit(event: string, data: unknown) {
137
140
  const callbacks = this.listeners.get(event);
138
141
  if (callbacks) {
139
142
  callbacks.forEach(callback => callback(data));
140
143
  }
141
144
  }
142
145
 
143
- private send(type: string, data: any = {}) {
146
+ private send(type: string, data: Record<string, unknown> = {}) {
144
147
  if (this.ws && this.ws.readyState === WebSocket.OPEN) {
145
148
  this.ws.send(JSON.stringify({ type, data }));
146
149
  } else {
@@ -158,11 +161,12 @@ export class WebSocketService {
158
161
  }
159
162
 
160
163
  // Cell operations
161
- addCell(index: number, cellType: 'code' | 'markdown', source: string = '') {
164
+ addCell(index: number, cellType: 'code' | 'markdown', source: string = '', fullCell?: unknown) {
162
165
  this.send('add_cell', {
163
166
  index,
164
167
  cell_type: cellType,
165
168
  source,
169
+ full_cell: fullCell,
166
170
  });
167
171
  }
168
172
 
@@ -177,6 +181,13 @@ export class WebSocketService {
177
181
  });
178
182
  }
179
183
 
184
+ moveCell(fromIndex: number, toIndex: number) {
185
+ this.send('move_cell', {
186
+ from_index: fromIndex,
187
+ to_index: toIndex,
188
+ });
189
+ }
190
+
180
191
  executeCell(cellIndex: number, source: string) {
181
192
  this.send('execute_cell', {
182
193
  cell_index: cellIndex,
frontend/lib/websocket.ts CHANGED
@@ -1,20 +1,68 @@
1
- import { io, Socket } from 'socket.io-client';
2
- import { Cell, ExecutionResult } from '@/types/notebook';
1
+ type EventCallback = (data?: unknown) => void;
2
+
3
+ interface SocketWrapper {
4
+ on: (event: string, callback: EventCallback) => void;
5
+ emit: (event: string, data?: Record<string, unknown>) => void;
6
+ disconnect: () => void;
7
+ }
3
8
 
4
9
  export class WebSocketService {
5
- private socket: Socket | null = null;
6
- private listeners: Map<string, Function[]> = new Map();
10
+ private socket: SocketWrapper | null = null;
11
+ private listeners: Map<string, EventCallback[]> = new Map();
12
+
13
+ private createSocketWrapper(ws: WebSocket): SocketWrapper {
14
+ const eventHandlers = new Map<string, EventCallback>();
15
+
16
+ ws.onopen = () => {
17
+ const handler = eventHandlers.get('connect');
18
+ if (handler) handler();
19
+ };
20
+
21
+ ws.onerror = (error) => {
22
+ const handler = eventHandlers.get('connect_error');
23
+ if (handler) handler(error);
24
+ };
25
+
26
+ ws.onclose = () => {
27
+ const handler = eventHandlers.get('disconnect');
28
+ if (handler) handler();
29
+ };
30
+
31
+ ws.onmessage = (event) => {
32
+ try {
33
+ const message = JSON.parse(event.data);
34
+ const handler = eventHandlers.get(message.type);
35
+ if (handler) handler(message.data);
36
+ } catch (err) {
37
+ console.error('Failed to parse WebSocket message:', err);
38
+ }
39
+ };
40
+
41
+ return {
42
+ on: (event: string, callback: EventCallback) => {
43
+ eventHandlers.set(event, callback);
44
+ },
45
+ emit: (event: string, data?: Record<string, unknown>) => {
46
+ if (ws.readyState === WebSocket.OPEN) {
47
+ ws.send(JSON.stringify({ type: event, data }));
48
+ }
49
+ },
50
+ disconnect: () => {
51
+ ws.close();
52
+ },
53
+ };
54
+ }
7
55
 
8
56
  connect(url: string = 'ws://localhost:8000'): Promise<void> {
9
57
  return new Promise((resolve, reject) => {
10
58
  // For development, connect directly to the backend WebSocket
11
- const wsUrl = process.env.NODE_ENV === 'production'
12
- ? '/ws'
59
+ const wsUrl = process.env.NODE_ENV === 'production'
60
+ ? '/ws'
13
61
  : 'ws://localhost:8000/ws';
14
-
62
+
15
63
  // Use native WebSocket for FastAPI compatibility
16
64
  const ws = new WebSocket(wsUrl);
17
-
65
+
18
66
  // Wrap WebSocket in Socket.IO-like interface
19
67
  this.socket = this.createSocketWrapper(ws);
20
68
 
@@ -58,14 +106,14 @@ export class WebSocketService {
58
106
  });
59
107
  }
60
108
 
61
- on(event: string, callback: Function) {
109
+ on(event: string, callback: EventCallback) {
62
110
  if (!this.listeners.has(event)) {
63
111
  this.listeners.set(event, []);
64
112
  }
65
113
  this.listeners.get(event)!.push(callback);
66
114
  }
67
115
 
68
- off(event: string, callback: Function) {
116
+ off(event: string, callback: EventCallback) {
69
117
  const callbacks = this.listeners.get(event);
70
118
  if (callbacks) {
71
119
  const index = callbacks.indexOf(callback);
@@ -75,7 +123,7 @@ export class WebSocketService {
75
123
  }
76
124
  }
77
125
 
78
- private emit(event: string, data: any) {
126
+ private emit(event: string, data?: unknown) {
79
127
  const callbacks = this.listeners.get(event);
80
128
  if (callbacks) {
81
129
  callbacks.forEach(callback => callback(data));
frontend/next.config.ts CHANGED
@@ -2,6 +2,14 @@ import type { NextConfig } from "next";
2
2
 
3
3
  const nextConfig: NextConfig = {
4
4
  /* config options here */
5
+ typescript: {
6
+ // Allow production builds to complete even with TypeScript errors
7
+ ignoreBuildErrors: true,
8
+ },
9
+ eslint: {
10
+ // Allow production builds to complete even with ESLint errors
11
+ ignoreDuringBuilds: true,
12
+ },
5
13
  };
6
14
 
7
15
  export default nextConfig;