@marimo-team/islands 0.25.1-dev26 → 0.25.1-dev28
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/dist/{ErrorBoundary-pWWhtr0s.js → ErrorBoundary-CE6-1WC1.js} +1 -1
- package/dist/{code-visibility-Ba_KMLhg.js → code-visibility--u2Q2Zfx.js} +1 -1
- package/dist/{common-Cqwp2VSj.js → common-hHL7iKzA.js} +1 -1
- package/dist/{data-grid-overlay-editor-CpH8-A59.js → data-grid-overlay-editor-v7VZO5up.js} +1 -1
- package/dist/{feedback-button-CJxD9fy8.js → feedback-button-C3Ya1IXo.js} +2 -2
- package/dist/{glide-data-editor-cm-NQofk.js → glide-data-editor-BKOLh2Tv.js} +3 -3
- package/dist/{globals-BquX8N9R.js → globals-DOJr_y24.js} +1 -1
- package/dist/main.js +6 -6
- package/dist/{number-overlay-editor-3AkAzj7F.js → number-overlay-editor-DkEFJYK7.js} +1 -1
- package/dist/{reveal-component-rC5k5pu3.js → reveal-component-rbEv9ppg.js} +2 -2
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/__mocks__/common.ts +3 -3
- package/src/__tests__/CellStatus.test.tsx +1 -1
- package/src/__tests__/setup.ts +7 -7
- package/src/components/app-config/ai-config.tsx +2 -0
- package/src/components/chat/chat-panel.tsx +19 -8
- package/src/components/data-table/column-summary/chart-spec-model.tsx +4 -4
- package/src/components/dependency-graph/elements.ts +2 -2
- package/src/components/editor/actions/__tests__/pair-with-agent.test.tsx +107 -0
- package/src/components/editor/actions/pair-with-agent.tsx +119 -0
- package/src/components/editor/actions/useNotebookActions.tsx +2 -1
- package/src/components/editor/ai/add-cell-with-ai.tsx +2 -0
- package/src/components/editor/ai/staged-cell-submission.ts +2 -2
- package/src/components/editor/ai/transport/chat-transport.tsx +1 -1
- package/src/components/editor/connections/database/as-code.ts +44 -44
- package/src/components/editor/connections/storage/as-code.ts +3 -3
- package/src/components/editor/file-tree/requesting-tree.tsx +16 -13
- package/src/components/editor/navigation/clipboard.ts +2 -2
- package/src/components/editor/output/ansi-reduce.ts +13 -13
- package/src/components/slides/__tests__/minimap-actions.test.tsx +7 -7
- package/src/components/slides/__tests__/minimap.test.ts +12 -12
- package/src/components/slides/__tests__/slide-scroll-hint.test.tsx +8 -8
- package/src/core/ai/context/__tests__/registry.test.ts +31 -28
- package/src/core/ai/context/providers/cell-output.ts +8 -8
- package/src/core/ai/context/providers/datasource.ts +10 -7
- package/src/core/ai/context/providers/error.ts +7 -7
- package/src/core/ai/context/providers/file.ts +8 -8
- package/src/core/ai/context/providers/tables.ts +7 -7
- package/src/core/ai/context/providers/variable.ts +7 -7
- package/src/core/ai/context/registry.ts +18 -18
- package/src/core/ai/ids/ids.ts +5 -5
- package/src/core/ai/model-registry.ts +12 -9
- package/src/core/ai/staged-cells.ts +6 -6
- package/src/core/ai/tools/base.ts +6 -6
- package/src/core/ai/tools/edit-notebook-tool.ts +6 -6
- package/src/core/ai/tools/registry.ts +4 -4
- package/src/core/ai/tools/run-cells-tool.ts +7 -7
- package/src/core/ai/tools/sample-tool.ts +6 -6
- package/src/core/codemirror/cells/debugger-decorations.ts +13 -7
- package/src/core/codemirror/cells/line-timing-decorations.ts +9 -9
- package/src/core/codemirror/cells/traceback-decorations.ts +7 -4
- package/src/core/codemirror/code-lens/extension.ts +13 -13
- package/src/core/codemirror/copilot/__tests__/language-server.test.ts +6 -6
- package/src/core/codemirror/copilot/__tests__/transport.test.ts +12 -12
- package/src/core/codemirror/copilot/language-server.ts +13 -13
- package/src/core/codemirror/copilot/transport.ts +1 -1
- package/src/core/codemirror/find-replace/search-highlight.ts +5 -5
- package/src/core/codemirror/go-to-definition/underline.ts +3 -3
- package/src/core/codemirror/keymaps/vim.ts +3 -3
- package/src/core/codemirror/language/languages/markdown.ts +8 -8
- package/src/core/codemirror/language/languages/python.ts +7 -7
- package/src/core/codemirror/language/languages/sql/completion-builder.ts +5 -5
- package/src/core/codemirror/language/languages/sql/completion-store.ts +4 -4
- package/src/core/codemirror/language/languages/sql/sql.ts +21 -21
- package/src/core/codemirror/lsp/__tests__/transports.test.ts +10 -10
- package/src/core/codemirror/lsp/federated-lsp.ts +29 -27
- package/src/core/codemirror/lsp/notebook-lsp.ts +21 -21
- package/src/core/codemirror/misc/__tests__/dnd.test.ts +10 -10
- package/src/core/codemirror/misc/__tests__/paste.test.ts +7 -4
- package/src/core/codemirror/reactive-references/extension.ts +3 -3
- package/src/core/codemirror/rtc/loro/awareness.ts +12 -12
- package/src/core/codemirror/rtc/loro/sync.ts +5 -5
- package/src/core/codemirror/vim/cursor-visibility.ts +3 -3
- package/src/core/dom/ui-element.ts +5 -5
- package/src/core/dom/uiregistry.ts +10 -10
- package/src/core/hotkeys/hotkeys.ts +9 -9
- package/src/core/islands/__tests__/bridge.test.ts +4 -4
- package/src/core/islands/__tests__/test-utils.tsx +4 -4
- package/src/core/islands/bridge.ts +85 -82
- package/src/core/islands/components/web-components.tsx +7 -7
- package/src/core/islands/worker/__tests__/controller.test.ts +1 -1
- package/src/core/islands/worker/controller.ts +6 -3
- package/src/core/islands/worker-factory.ts +2 -2
- package/src/core/kernel/RuntimeState.ts +4 -4
- package/src/core/lsp/__tests__/transport.test.ts +19 -19
- package/src/core/lsp/transport.ts +5 -5
- package/src/core/network/CachingRequestRegistry.ts +2 -2
- package/src/core/network/DeferredRequestRegistry.ts +4 -4
- package/src/core/runtime/runtime.ts +25 -20
- package/src/core/static/virtual-file-tracker.ts +5 -5
- package/src/core/wasm/__tests__/bridge.test.ts +2 -2
- package/src/core/wasm/bridge.ts +130 -126
- package/src/core/wasm/router.ts +5 -5
- package/src/core/wasm/store.ts +4 -4
- package/src/core/wasm/worker/bootstrap.ts +8 -5
- package/src/core/wasm/worker/message-buffer.ts +3 -3
- package/src/core/websocket/transports/__tests__/ws.test.ts +8 -8
- package/src/core/websocket/transports/basic.ts +15 -8
- package/src/core/websocket/transports/sse.ts +7 -7
- package/src/core/websocket/transports/transport.ts +3 -3
- package/src/core/websocket/transports/ws.ts +9 -7
- package/src/hooks/__tests__/useOverflowDetection.test.tsx +5 -5
- package/src/hooks/__tests__/useResizeObserver.test.tsx +12 -12
- package/src/plugins/core/registerReactComponent.tsx +5 -5
- package/src/plugins/core/sidebar-element.tsx +2 -2
- package/src/plugins/impl/ButtonPlugin.tsx +3 -3
- package/src/plugins/impl/CheckboxPlugin.tsx +3 -3
- package/src/plugins/impl/CodeEditorPlugin.tsx +3 -3
- package/src/plugins/impl/DatePickerPlugin.tsx +3 -3
- package/src/plugins/impl/DateRangePlugin.tsx +3 -3
- package/src/plugins/impl/DateTimePickerPlugin.tsx +3 -3
- package/src/plugins/impl/DictPlugin.tsx +3 -3
- package/src/plugins/impl/DropdownPlugin.tsx +3 -3
- package/src/plugins/impl/FileUploadPlugin.tsx +3 -3
- package/src/plugins/impl/MatrixPlugin.tsx +4 -4
- package/src/plugins/impl/MicrophonePlugin.tsx +3 -3
- package/src/plugins/impl/MultiselectPlugin.tsx +3 -3
- package/src/plugins/impl/NumberPlugin.tsx +3 -3
- package/src/plugins/impl/RadioPlugin.tsx +3 -3
- package/src/plugins/impl/RangeSliderPlugin.tsx +3 -3
- package/src/plugins/impl/RefreshPlugin.tsx +3 -3
- package/src/plugins/impl/SliderPlugin.tsx +3 -3
- package/src/plugins/impl/SwitchPlugin.tsx +3 -3
- package/src/plugins/impl/TabsPlugin.tsx +3 -3
- package/src/plugins/impl/TextAreaPlugin.tsx +3 -3
- package/src/plugins/impl/TextInputPlugin.tsx +3 -3
- package/src/plugins/impl/__tests__/MatrixPlugin.test.tsx +2 -2
- package/src/plugins/impl/anywidget/model.ts +10 -10
- package/src/plugins/impl/anywidget/registry.ts +12 -9
- package/src/plugins/impl/anywidget/runtime.ts +11 -9
- package/src/plugins/impl/anywidget/widget-binding.ts +6 -6
- package/src/plugins/impl/matplotlib/MatplotlibPlugin.tsx +3 -3
- package/src/plugins/impl/matplotlib/__tests__/matplotlib-renderer.test.ts +2 -2
- package/src/plugins/impl/matplotlib/matplotlib-renderer.ts +2 -2
- package/src/plugins/impl/mpl-interactive/mpl-websocket-shim.ts +10 -10
- package/src/plugins/impl/panel/utils.ts +5 -5
- package/src/plugins/impl/plotly/PlotlyPlugin.tsx +3 -3
- package/src/plugins/impl/vega/VegaPlugin.tsx +3 -3
- package/src/plugins/impl/vega/__tests__/use-vega-container-remeasure.test.ts +7 -7
- package/src/plugins/layout/AccordionPlugin.tsx +3 -3
- package/src/plugins/layout/CalloutPlugin.tsx +3 -3
- package/src/plugins/layout/ImageComparisonPlugin.tsx +5 -3
- package/src/plugins/layout/JsonOutputPlugin.tsx +3 -3
- package/src/plugins/layout/MimeRenderPlugin.tsx +3 -3
- package/src/plugins/layout/NavigationMenuPlugin.tsx +3 -3
- package/src/plugins/layout/OutlinePlugin.tsx +3 -3
- package/src/plugins/layout/ProgressPlugin.tsx +3 -3
- package/src/plugins/layout/RoutesPlugin.tsx +3 -3
- package/src/plugins/layout/StatPlugin.tsx +3 -3
- package/src/plugins/layout/TexPlugin.tsx +3 -3
- package/src/plugins/layout/carousel/CarouselPlugin.tsx +4 -4
- package/src/plugins/layout/mermaid/MermaidPlugin.tsx +3 -3
- package/src/utils/Deferred.ts +6 -6
- package/src/utils/async-capture-tracker.ts +10 -7
- package/src/utils/errors.ts +5 -5
- package/src/utils/id-tree.tsx +83 -80
- package/src/utils/lru.ts +1 -1
- package/src/utils/multi-map.ts +14 -12
- package/src/utils/paths.ts +6 -6
- package/src/utils/pluralize.ts +3 -3
- package/src/utils/progress.ts +6 -6
- package/src/utils/python-poet/poet.ts +14 -14
- package/src/utils/routes.ts +4 -2
- package/src/utils/semaphore.ts +6 -6
- package/src/utils/storage/storage.ts +6 -6
- package/src/utils/storage/typed.ts +16 -12
- package/src/utils/time.ts +9 -9
- package/src/utils/timed-cache.ts +4 -4
- package/src/utils/tracer.ts +9 -6
|
@@ -72,7 +72,7 @@ export class IslandsPyodideBridge implements RunRequests, EditRequests {
|
|
|
72
72
|
|
|
73
73
|
public initialized = new Deferred<void>();
|
|
74
74
|
|
|
75
|
-
constructor(config: IslandsBridgeConfig = {}) {
|
|
75
|
+
public constructor(config: IslandsBridgeConfig = {}) {
|
|
76
76
|
this.store = config.store || defaultStore;
|
|
77
77
|
this.root = config.root || document;
|
|
78
78
|
|
|
@@ -120,7 +120,7 @@ export class IslandsPyodideBridge implements RunRequests, EditRequests {
|
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
async initializeApps(): Promise<void> {
|
|
123
|
+
public async initializeApps(): Promise<void> {
|
|
124
124
|
await this.enqueueAppTransition(async () => {
|
|
125
125
|
await this.workerReady.promise;
|
|
126
126
|
await this.startApps();
|
|
@@ -211,7 +211,7 @@ export class IslandsPyodideBridge implements RunRequests, EditRequests {
|
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
async stopSession(appId?: string): Promise<void> {
|
|
214
|
+
public async stopSession(appId?: string): Promise<void> {
|
|
215
215
|
await this.enqueueAppTransition(async () => {
|
|
216
216
|
const session = this.session;
|
|
217
217
|
if (session?.code === undefined || (appId && session.appId !== appId)) {
|
|
@@ -238,7 +238,7 @@ export class IslandsPyodideBridge implements RunRequests, EditRequests {
|
|
|
238
238
|
/**
|
|
239
239
|
* Starts a new Python session for an app
|
|
240
240
|
*/
|
|
241
|
-
async startSession(opts: {
|
|
241
|
+
public async startSession(opts: {
|
|
242
242
|
code: string;
|
|
243
243
|
appId: string;
|
|
244
244
|
sessionGeneration: number;
|
|
@@ -249,7 +249,9 @@ export class IslandsPyodideBridge implements RunRequests, EditRequests {
|
|
|
249
249
|
/**
|
|
250
250
|
* Sets up a consumer for kernel messages
|
|
251
251
|
*/
|
|
252
|
-
consumeMessages(
|
|
252
|
+
public consumeMessages(
|
|
253
|
+
consumer: (message: IslandsKernelMessage) => void,
|
|
254
|
+
): void {
|
|
253
255
|
this.messageConsumer = consumer;
|
|
254
256
|
this.rpc.proxy.send.consumerReady({});
|
|
255
257
|
}
|
|
@@ -258,7 +260,7 @@ export class IslandsPyodideBridge implements RunRequests, EditRequests {
|
|
|
258
260
|
// RunRequests Implementation
|
|
259
261
|
// ============================================================================
|
|
260
262
|
|
|
261
|
-
sendComponentValues: RunRequests["sendComponentValues"] = async (
|
|
263
|
+
public sendComponentValues: RunRequests["sendComponentValues"] = async (
|
|
262
264
|
request,
|
|
263
265
|
): Promise<null> => {
|
|
264
266
|
await this.putControlRequest({
|
|
@@ -269,11 +271,12 @@ export class IslandsPyodideBridge implements RunRequests, EditRequests {
|
|
|
269
271
|
return null;
|
|
270
272
|
};
|
|
271
273
|
|
|
272
|
-
sendInstantiate: RunRequests["sendInstantiate"] =
|
|
273
|
-
|
|
274
|
-
|
|
274
|
+
public sendInstantiate: RunRequests["sendInstantiate"] =
|
|
275
|
+
async (): Promise<null> => {
|
|
276
|
+
return null;
|
|
277
|
+
};
|
|
275
278
|
|
|
276
|
-
sendFunctionRequest: RunRequests["sendFunctionRequest"] = async (
|
|
279
|
+
public sendFunctionRequest: RunRequests["sendFunctionRequest"] = async (
|
|
277
280
|
request,
|
|
278
281
|
): Promise<null> => {
|
|
279
282
|
await this.putControlRequest({
|
|
@@ -283,7 +286,7 @@ export class IslandsPyodideBridge implements RunRequests, EditRequests {
|
|
|
283
286
|
return null;
|
|
284
287
|
};
|
|
285
288
|
|
|
286
|
-
sendModelValue: RunRequests["sendModelValue"] = async (request) => {
|
|
289
|
+
public sendModelValue: RunRequests["sendModelValue"] = async (request) => {
|
|
287
290
|
await this.putControlRequest({
|
|
288
291
|
type: "model",
|
|
289
292
|
...request,
|
|
@@ -295,7 +298,7 @@ export class IslandsPyodideBridge implements RunRequests, EditRequests {
|
|
|
295
298
|
// EditRequests Implementation
|
|
296
299
|
// ============================================================================
|
|
297
300
|
|
|
298
|
-
sendRun: EditRequests["sendRun"] = async (request): Promise<null> => {
|
|
301
|
+
public sendRun: EditRequests["sendRun"] = async (request): Promise<null> => {
|
|
299
302
|
const session = await this.getActiveSession();
|
|
300
303
|
await this.rpc.proxy.request.loadPackages({
|
|
301
304
|
appId: session.appId,
|
|
@@ -316,75 +319,75 @@ export class IslandsPyodideBridge implements RunRequests, EditRequests {
|
|
|
316
319
|
// Not Implemented (Read-Only Mode)
|
|
317
320
|
// ============================================================================
|
|
318
321
|
|
|
319
|
-
getUsageStats = throwNotImplemented;
|
|
320
|
-
getEnvironmentInfo = throwNotImplemented;
|
|
321
|
-
sendRename = throwNotImplemented;
|
|
322
|
-
sendSave = throwNotImplemented;
|
|
323
|
-
sendCopy = throwNotImplemented;
|
|
324
|
-
sendRunScratchpad = throwNotImplemented;
|
|
325
|
-
sendStdin = throwNotImplemented;
|
|
326
|
-
sendInterrupt = throwNotImplemented;
|
|
327
|
-
sendShutdown = throwNotImplemented;
|
|
328
|
-
sendFormat = throwNotImplemented;
|
|
329
|
-
sendDeleteCell = throwNotImplemented;
|
|
330
|
-
sendInstallMissingPackages = throwNotImplemented;
|
|
331
|
-
sendCodeCompletionRequest = throwNotImplemented;
|
|
332
|
-
saveUserConfig = throwNotImplemented;
|
|
333
|
-
saveAppConfig = throwNotImplemented;
|
|
334
|
-
saveCellConfig = throwNotImplemented;
|
|
335
|
-
sendRestart = throwNotImplemented;
|
|
336
|
-
sendDocumentTransaction = throwNotImplemented;
|
|
337
|
-
readCode = throwNotImplemented;
|
|
338
|
-
readSnippets = throwNotImplemented;
|
|
339
|
-
previewDatasetColumn = throwNotImplemented;
|
|
340
|
-
previewSQLTable = throwNotImplemented;
|
|
341
|
-
previewSQLTableList = throwNotImplemented;
|
|
342
|
-
previewSQLSchemaList = throwNotImplemented;
|
|
343
|
-
previewDataSourceConnection = throwNotImplemented;
|
|
344
|
-
discoverDataSources = throwNotImplemented;
|
|
345
|
-
validateSQL = throwNotImplemented;
|
|
346
|
-
openFile = throwNotImplemented;
|
|
347
|
-
getFileRoots = throwNotImplemented;
|
|
348
|
-
sendListFiles = throwNotImplemented;
|
|
349
|
-
sendSearchFiles = throwNotImplemented;
|
|
350
|
-
sendPdb = throwNotImplemented;
|
|
351
|
-
sendSetBreakpoints = throwNotImplemented;
|
|
352
|
-
sendCreateFileOrFolder = throwNotImplemented;
|
|
353
|
-
sendDeleteFileOrFolder = throwNotImplemented;
|
|
354
|
-
sendCopyFileOrFolder = throwNotImplemented;
|
|
355
|
-
sendRenameFileOrFolder = throwNotImplemented;
|
|
356
|
-
sendUpdateFile = throwNotImplemented;
|
|
357
|
-
sendFileDetails = throwNotImplemented;
|
|
358
|
-
openTutorial = throwNotImplemented;
|
|
359
|
-
getExportAvailability = throwNotImplemented;
|
|
360
|
-
installExportRequirements = throwNotImplemented;
|
|
361
|
-
exportAsHTML = throwNotImplemented;
|
|
362
|
-
exportAsIPYNB = throwNotImplemented;
|
|
363
|
-
exportAsMarkdown = throwNotImplemented;
|
|
364
|
-
exportAsScript = throwNotImplemented;
|
|
365
|
-
exportAsPDF = throwNotImplemented;
|
|
366
|
-
autoExportAsHTML = throwNotImplemented;
|
|
367
|
-
autoExportAsMarkdown = throwNotImplemented;
|
|
368
|
-
autoExportAsIPYNB = throwNotImplemented;
|
|
369
|
-
updateCellOutputs = throwNotImplemented;
|
|
370
|
-
addPackage = throwNotImplemented;
|
|
371
|
-
removePackage = throwNotImplemented;
|
|
372
|
-
getPackageList = throwNotImplemented;
|
|
373
|
-
getSandbox = throwNotImplemented;
|
|
374
|
-
updateManifest = throwNotImplemented;
|
|
375
|
-
syncSandbox = throwNotImplemented;
|
|
376
|
-
getDependencyTree = throwNotImplemented;
|
|
377
|
-
getRecentFiles = throwNotImplemented;
|
|
378
|
-
getWorkspaceFiles = throwNotImplemented;
|
|
379
|
-
getRunningNotebooks = throwNotImplemented;
|
|
380
|
-
shutdownSession = throwNotImplemented;
|
|
381
|
-
listSecretKeys = throwNotImplemented;
|
|
382
|
-
writeSecret = throwNotImplemented;
|
|
383
|
-
invokeAiTool = throwNotImplemented;
|
|
384
|
-
clearCache = throwNotImplemented;
|
|
385
|
-
getCacheInfo = throwNotImplemented;
|
|
386
|
-
listStorageEntries = throwNotImplemented;
|
|
387
|
-
downloadStorage = throwNotImplemented;
|
|
322
|
+
public getUsageStats = throwNotImplemented;
|
|
323
|
+
public getEnvironmentInfo = throwNotImplemented;
|
|
324
|
+
public sendRename = throwNotImplemented;
|
|
325
|
+
public sendSave = throwNotImplemented;
|
|
326
|
+
public sendCopy = throwNotImplemented;
|
|
327
|
+
public sendRunScratchpad = throwNotImplemented;
|
|
328
|
+
public sendStdin = throwNotImplemented;
|
|
329
|
+
public sendInterrupt = throwNotImplemented;
|
|
330
|
+
public sendShutdown = throwNotImplemented;
|
|
331
|
+
public sendFormat = throwNotImplemented;
|
|
332
|
+
public sendDeleteCell = throwNotImplemented;
|
|
333
|
+
public sendInstallMissingPackages = throwNotImplemented;
|
|
334
|
+
public sendCodeCompletionRequest = throwNotImplemented;
|
|
335
|
+
public saveUserConfig = throwNotImplemented;
|
|
336
|
+
public saveAppConfig = throwNotImplemented;
|
|
337
|
+
public saveCellConfig = throwNotImplemented;
|
|
338
|
+
public sendRestart = throwNotImplemented;
|
|
339
|
+
public sendDocumentTransaction = throwNotImplemented;
|
|
340
|
+
public readCode = throwNotImplemented;
|
|
341
|
+
public readSnippets = throwNotImplemented;
|
|
342
|
+
public previewDatasetColumn = throwNotImplemented;
|
|
343
|
+
public previewSQLTable = throwNotImplemented;
|
|
344
|
+
public previewSQLTableList = throwNotImplemented;
|
|
345
|
+
public previewSQLSchemaList = throwNotImplemented;
|
|
346
|
+
public previewDataSourceConnection = throwNotImplemented;
|
|
347
|
+
public discoverDataSources = throwNotImplemented;
|
|
348
|
+
public validateSQL = throwNotImplemented;
|
|
349
|
+
public openFile = throwNotImplemented;
|
|
350
|
+
public getFileRoots = throwNotImplemented;
|
|
351
|
+
public sendListFiles = throwNotImplemented;
|
|
352
|
+
public sendSearchFiles = throwNotImplemented;
|
|
353
|
+
public sendPdb = throwNotImplemented;
|
|
354
|
+
public sendSetBreakpoints = throwNotImplemented;
|
|
355
|
+
public sendCreateFileOrFolder = throwNotImplemented;
|
|
356
|
+
public sendDeleteFileOrFolder = throwNotImplemented;
|
|
357
|
+
public sendCopyFileOrFolder = throwNotImplemented;
|
|
358
|
+
public sendRenameFileOrFolder = throwNotImplemented;
|
|
359
|
+
public sendUpdateFile = throwNotImplemented;
|
|
360
|
+
public sendFileDetails = throwNotImplemented;
|
|
361
|
+
public openTutorial = throwNotImplemented;
|
|
362
|
+
public getExportAvailability = throwNotImplemented;
|
|
363
|
+
public installExportRequirements = throwNotImplemented;
|
|
364
|
+
public exportAsHTML = throwNotImplemented;
|
|
365
|
+
public exportAsIPYNB = throwNotImplemented;
|
|
366
|
+
public exportAsMarkdown = throwNotImplemented;
|
|
367
|
+
public exportAsScript = throwNotImplemented;
|
|
368
|
+
public exportAsPDF = throwNotImplemented;
|
|
369
|
+
public autoExportAsHTML = throwNotImplemented;
|
|
370
|
+
public autoExportAsMarkdown = throwNotImplemented;
|
|
371
|
+
public autoExportAsIPYNB = throwNotImplemented;
|
|
372
|
+
public updateCellOutputs = throwNotImplemented;
|
|
373
|
+
public addPackage = throwNotImplemented;
|
|
374
|
+
public removePackage = throwNotImplemented;
|
|
375
|
+
public getPackageList = throwNotImplemented;
|
|
376
|
+
public getSandbox = throwNotImplemented;
|
|
377
|
+
public updateManifest = throwNotImplemented;
|
|
378
|
+
public syncSandbox = throwNotImplemented;
|
|
379
|
+
public getDependencyTree = throwNotImplemented;
|
|
380
|
+
public getRecentFiles = throwNotImplemented;
|
|
381
|
+
public getWorkspaceFiles = throwNotImplemented;
|
|
382
|
+
public getRunningNotebooks = throwNotImplemented;
|
|
383
|
+
public shutdownSession = throwNotImplemented;
|
|
384
|
+
public listSecretKeys = throwNotImplemented;
|
|
385
|
+
public writeSecret = throwNotImplemented;
|
|
386
|
+
public invokeAiTool = throwNotImplemented;
|
|
387
|
+
public clearCache = throwNotImplemented;
|
|
388
|
+
public getCacheInfo = throwNotImplemented;
|
|
389
|
+
public listStorageEntries = throwNotImplemented;
|
|
390
|
+
public downloadStorage = throwNotImplemented;
|
|
388
391
|
|
|
389
392
|
// The kernel uses msgspec to parse control requests, which requires a 'type'
|
|
390
393
|
// field for discriminated union deserialization.
|
|
@@ -412,7 +415,7 @@ export class IslandsPyodideBridge implements RunRequests, EditRequests {
|
|
|
412
415
|
/**
|
|
413
416
|
* Cleans up resources (for testing)
|
|
414
417
|
*/
|
|
415
|
-
destroy(): void {
|
|
418
|
+
public destroy(): void {
|
|
416
419
|
// Future: terminate worker if we own it
|
|
417
420
|
}
|
|
418
421
|
}
|
|
@@ -51,7 +51,7 @@ export class MarimoIslandElement extends HTMLElement {
|
|
|
51
51
|
public static readonly editorTagName = ISLAND_TAG_NAMES.CODE_EDITOR;
|
|
52
52
|
public static readonly styleNamespace = ISLAND_CSS_CLASSES.NAMESPACE;
|
|
53
53
|
|
|
54
|
-
constructor() {
|
|
54
|
+
public constructor() {
|
|
55
55
|
super();
|
|
56
56
|
this.classList.add(MarimoIslandElement.styleNamespace);
|
|
57
57
|
}
|
|
@@ -59,7 +59,7 @@ export class MarimoIslandElement extends HTMLElement {
|
|
|
59
59
|
/**
|
|
60
60
|
* Gets the app ID from the element's data attribute
|
|
61
61
|
*/
|
|
62
|
-
get appId(): string {
|
|
62
|
+
public get appId(): string {
|
|
63
63
|
const appId = this.getAttribute(ISLAND_DATA_ATTRIBUTES.APP_ID);
|
|
64
64
|
invariant(appId, "Missing data-app-id attribute");
|
|
65
65
|
return appId;
|
|
@@ -68,7 +68,7 @@ export class MarimoIslandElement extends HTMLElement {
|
|
|
68
68
|
/**
|
|
69
69
|
* Whether this island is reactive (has code sent to Python for execution)
|
|
70
70
|
*/
|
|
71
|
-
get isReactive(): boolean {
|
|
71
|
+
public get isReactive(): boolean {
|
|
72
72
|
return this.getAttribute(ISLAND_DATA_ATTRIBUTES.REACTIVE) === "true";
|
|
73
73
|
}
|
|
74
74
|
|
|
@@ -76,7 +76,7 @@ export class MarimoIslandElement extends HTMLElement {
|
|
|
76
76
|
* Gets the cell ID by looking up the cell index in the notebook state.
|
|
77
77
|
* Returns undefined for non-reactive islands (they have no corresponding cell).
|
|
78
78
|
*/
|
|
79
|
-
get cellId(): CellId | undefined {
|
|
79
|
+
public get cellId(): CellId | undefined {
|
|
80
80
|
if (!this.isReactive) {
|
|
81
81
|
return undefined;
|
|
82
82
|
}
|
|
@@ -95,7 +95,7 @@ export class MarimoIslandElement extends HTMLElement {
|
|
|
95
95
|
/**
|
|
96
96
|
* Gets the code for this island cell
|
|
97
97
|
*/
|
|
98
|
-
get code(): string {
|
|
98
|
+
public get code(): string {
|
|
99
99
|
return extractIslandCodeFromEmbed(this);
|
|
100
100
|
}
|
|
101
101
|
|
|
@@ -115,7 +115,7 @@ export class MarimoIslandElement extends HTMLElement {
|
|
|
115
115
|
* which can happen inside a React render cycle. Rendering
|
|
116
116
|
* synchronously from there causes "unmount during render" warnings.
|
|
117
117
|
*/
|
|
118
|
-
connectedCallback(): void {
|
|
118
|
+
public connectedCallback(): void {
|
|
119
119
|
const connectionGeneration = ++this.connectionGeneration;
|
|
120
120
|
this.addEventListener(
|
|
121
121
|
ISLAND_SOURCE_CHANGED_EVENT,
|
|
@@ -296,7 +296,7 @@ export class MarimoIslandElement extends HTMLElement {
|
|
|
296
296
|
/**
|
|
297
297
|
* Cleanup when element is removed from DOM
|
|
298
298
|
*/
|
|
299
|
-
disconnectedCallback(): void {
|
|
299
|
+
public disconnectedCallback(): void {
|
|
300
300
|
this.removeEventListener(
|
|
301
301
|
ISLAND_SOURCE_CHANGED_EVENT,
|
|
302
302
|
this.handleSourceChanged,
|
|
@@ -5,7 +5,7 @@ import { describe, expect, it, vi } from "vitest";
|
|
|
5
5
|
import { ReadonlyWasmController } from "../controller";
|
|
6
6
|
|
|
7
7
|
class TestController extends ReadonlyWasmController {
|
|
8
|
-
setPyodide(pyodide: PyodideInterface) {
|
|
8
|
+
public setPyodide(pyodide: PyodideInterface) {
|
|
9
9
|
this.pyodide = pyodide;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
@@ -9,7 +9,7 @@ import type { JsonString } from "@/utils/json/base64";
|
|
|
9
9
|
import { Logger } from "../../../utils/Logger";
|
|
10
10
|
|
|
11
11
|
export class ReadonlyWasmController extends DefaultWasmController {
|
|
12
|
-
override async bootstrap(opts: {
|
|
12
|
+
public override async bootstrap(opts: {
|
|
13
13
|
version: string;
|
|
14
14
|
pyodideVersion: string;
|
|
15
15
|
}): Promise<PyodideInterface> {
|
|
@@ -17,7 +17,10 @@ export class ReadonlyWasmController extends DefaultWasmController {
|
|
|
17
17
|
return pyodide;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
override async mountFilesystem(opts: {
|
|
20
|
+
public override async mountFilesystem(opts: {
|
|
21
|
+
code: string;
|
|
22
|
+
filename: string;
|
|
23
|
+
}) {
|
|
21
24
|
const { code, filename } = opts;
|
|
22
25
|
// Write file
|
|
23
26
|
try {
|
|
@@ -34,7 +37,7 @@ export class ReadonlyWasmController extends DefaultWasmController {
|
|
|
34
37
|
return { code, filename };
|
|
35
38
|
}
|
|
36
39
|
|
|
37
|
-
override async startSession(opts: {
|
|
40
|
+
public override async startSession(opts: {
|
|
38
41
|
code: string;
|
|
39
42
|
filename: string | null;
|
|
40
43
|
onMessage: (message: JsonString<NotificationPayload>) => void;
|
|
@@ -39,7 +39,7 @@ export class DefaultWorkerFactory implements WorkerFactory {
|
|
|
39
39
|
private readonly url: string;
|
|
40
40
|
private readonly name: string;
|
|
41
41
|
|
|
42
|
-
constructor(config: DefaultWorkerFactoryConfig = {}) {
|
|
42
|
+
public constructor(config: DefaultWorkerFactoryConfig = {}) {
|
|
43
43
|
this.url = config.workerUrl || this.getDefaultWorkerUrl();
|
|
44
44
|
this.name = config.workerName || getMarimoVersion();
|
|
45
45
|
}
|
|
@@ -47,7 +47,7 @@ export class DefaultWorkerFactory implements WorkerFactory {
|
|
|
47
47
|
/**
|
|
48
48
|
* Creates a new Pyodide worker
|
|
49
49
|
*/
|
|
50
|
-
create(): Worker {
|
|
50
|
+
public create(): Worker {
|
|
51
51
|
return createModuleWorker(new URL(this.url, import.meta.url), {
|
|
52
52
|
name: this.name,
|
|
53
53
|
});
|
|
@@ -17,7 +17,7 @@ export class RuntimeState {
|
|
|
17
17
|
/**
|
|
18
18
|
* Shared instance of RuntimeState since this must be a singleton.
|
|
19
19
|
*/
|
|
20
|
-
static get INSTANCE(): RuntimeState {
|
|
20
|
+
public static get INSTANCE(): RuntimeState {
|
|
21
21
|
const KEY = "_marimo_private_RuntimeState";
|
|
22
22
|
if (!window[KEY]) {
|
|
23
23
|
window[KEY] = new RuntimeState(UI_ELEMENT_REGISTRY);
|
|
@@ -31,7 +31,7 @@ export class RuntimeState {
|
|
|
31
31
|
private _sendComponentValues: RunRequests["sendComponentValues"] | undefined;
|
|
32
32
|
private uiElementRegistry: UIElementRegistry;
|
|
33
33
|
|
|
34
|
-
constructor(uiElementRegistry: UIElementRegistry) {
|
|
34
|
+
public constructor(uiElementRegistry: UIElementRegistry) {
|
|
35
35
|
this.uiElementRegistry = uiElementRegistry;
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -45,7 +45,7 @@ export class RuntimeState {
|
|
|
45
45
|
/**
|
|
46
46
|
* Start listening for events from UIElements
|
|
47
47
|
*/
|
|
48
|
-
start(sendComponentValues: RunRequests["sendComponentValues"]) {
|
|
48
|
+
public start(sendComponentValues: RunRequests["sendComponentValues"]) {
|
|
49
49
|
if (this.hasStarted) {
|
|
50
50
|
Logger.warn("RuntimeState already started");
|
|
51
51
|
return;
|
|
@@ -61,7 +61,7 @@ export class RuntimeState {
|
|
|
61
61
|
/**
|
|
62
62
|
* Stop listening for events from UIElements
|
|
63
63
|
*/
|
|
64
|
-
stop() {
|
|
64
|
+
public stop() {
|
|
65
65
|
if (!this.hasStarted) {
|
|
66
66
|
Logger.warn("RuntimeState already stopped");
|
|
67
67
|
return;
|
|
@@ -10,28 +10,28 @@ vi.mock("@/utils/Logger", () => ({
|
|
|
10
10
|
}));
|
|
11
11
|
|
|
12
12
|
class FakeWebSocket {
|
|
13
|
-
static readonly CONNECTING = 0;
|
|
14
|
-
static readonly OPEN = 1;
|
|
15
|
-
static readonly CLOSING = 2;
|
|
16
|
-
static readonly CLOSED = 3;
|
|
17
|
-
static readonly instances: FakeWebSocket[] = [];
|
|
18
|
-
|
|
19
|
-
readonly sent: string[] = [];
|
|
20
|
-
readonly url: string;
|
|
21
|
-
readonly protocols: string | string[] | undefined;
|
|
22
|
-
readyState = FakeWebSocket.CONNECTING;
|
|
13
|
+
public static readonly CONNECTING = 0;
|
|
14
|
+
public static readonly OPEN = 1;
|
|
15
|
+
public static readonly CLOSING = 2;
|
|
16
|
+
public static readonly CLOSED = 3;
|
|
17
|
+
public static readonly instances: FakeWebSocket[] = [];
|
|
18
|
+
|
|
19
|
+
public readonly sent: string[] = [];
|
|
20
|
+
public readonly url: string;
|
|
21
|
+
public readonly protocols: string | string[] | undefined;
|
|
22
|
+
public readyState = FakeWebSocket.CONNECTING;
|
|
23
23
|
private readonly listeners = new Map<
|
|
24
24
|
string,
|
|
25
25
|
Set<(event: { data?: unknown }) => void>
|
|
26
26
|
>();
|
|
27
27
|
|
|
28
|
-
constructor(url: string, protocols?: string | string[]) {
|
|
28
|
+
public constructor(url: string, protocols?: string | string[]) {
|
|
29
29
|
this.url = url;
|
|
30
30
|
this.protocols = protocols;
|
|
31
31
|
FakeWebSocket.instances.push(this);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
addEventListener(
|
|
34
|
+
public addEventListener(
|
|
35
35
|
type: string,
|
|
36
36
|
listener: (event: { data?: unknown }) => void,
|
|
37
37
|
) {
|
|
@@ -40,34 +40,34 @@ class FakeWebSocket {
|
|
|
40
40
|
this.listeners.set(type, listeners);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
send(frame: string) {
|
|
43
|
+
public send(frame: string) {
|
|
44
44
|
this.sent.push(frame);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
close() {
|
|
47
|
+
public close() {
|
|
48
48
|
this.readyState = FakeWebSocket.CLOSED;
|
|
49
49
|
this.emit("close", {});
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
open() {
|
|
52
|
+
public open() {
|
|
53
53
|
this.readyState = FakeWebSocket.OPEN;
|
|
54
54
|
this.emit("open", {});
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
fail() {
|
|
57
|
+
public fail() {
|
|
58
58
|
this.emit("error", {});
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
disconnect() {
|
|
61
|
+
public disconnect() {
|
|
62
62
|
this.readyState = FakeWebSocket.CLOSED;
|
|
63
63
|
this.emit("close", {});
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
receive(message: JSONRPCMessage) {
|
|
66
|
+
public receive(message: JSONRPCMessage) {
|
|
67
67
|
this.emit("message", { data: JSON.stringify(message) });
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
messages(): JSONRPCMessage[] {
|
|
70
|
+
public messages(): JSONRPCMessage[] {
|
|
71
71
|
return this.sent.map((frame) => {
|
|
72
72
|
const message: unknown = JSON.parse(frame);
|
|
73
73
|
if (!isJSONRPCMessage(message)) {
|
|
@@ -100,7 +100,7 @@ export class ReconnectingWebSocketTransport implements Transport {
|
|
|
100
100
|
|
|
101
101
|
public onReconnect: (() => Promise<void>) | undefined;
|
|
102
102
|
|
|
103
|
-
constructor(options: ReconnectingWebSocketTransportOptions) {
|
|
103
|
+
public constructor(options: ReconnectingWebSocketTransportOptions) {
|
|
104
104
|
this.options = {
|
|
105
105
|
...options,
|
|
106
106
|
retries: options.retries ?? 1,
|
|
@@ -109,7 +109,7 @@ export class ReconnectingWebSocketTransport implements Transport {
|
|
|
109
109
|
this.onReconnect = options.onReconnect;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
async connect(): Promise<void> {
|
|
112
|
+
public async connect(): Promise<void> {
|
|
113
113
|
if (this.isClosed) {
|
|
114
114
|
throw new Error("Transport is closed");
|
|
115
115
|
}
|
|
@@ -136,7 +136,7 @@ export class ReconnectingWebSocketTransport implements Transport {
|
|
|
136
136
|
return this.isClosed || generation !== this.connectionGeneration;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
send(message: JSONRPCMessage): void {
|
|
139
|
+
public send(message: JSONRPCMessage): void {
|
|
140
140
|
if (this.isClosed) {
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
@@ -162,14 +162,14 @@ export class ReconnectingWebSocketTransport implements Transport {
|
|
|
162
162
|
this.reconnect();
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
onMessage(handler: (message: JSONRPCMessage) => void): () => void {
|
|
165
|
+
public onMessage(handler: (message: JSONRPCMessage) => void): () => void {
|
|
166
166
|
this.messageHandlers.add(handler);
|
|
167
167
|
return () => {
|
|
168
168
|
this.messageHandlers.delete(handler);
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
close(): void {
|
|
172
|
+
public close(): void {
|
|
173
173
|
if (this.isClosed) {
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
@@ -22,7 +22,7 @@ export class CachingRequestRegistry<REQ, RES> {
|
|
|
22
22
|
private toKey: ToKey<REQ>;
|
|
23
23
|
private cache: LRUCache<string, Promise<RES>>;
|
|
24
24
|
|
|
25
|
-
static jsonStringifySortKeys<T>(): ToKey<T> {
|
|
25
|
+
public static jsonStringifySortKeys<T>(): ToKey<T> {
|
|
26
26
|
return (o: T) => {
|
|
27
27
|
if (typeof o !== "object" || o === null) {
|
|
28
28
|
return String(o);
|
|
@@ -31,7 +31,7 @@ export class CachingRequestRegistry<REQ, RES> {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
constructor(
|
|
34
|
+
public constructor(
|
|
35
35
|
delegate: DeferredRequestRegistry<REQ, RES>,
|
|
36
36
|
options: CachingOptions<REQ> = {},
|
|
37
37
|
) {
|
|
@@ -27,7 +27,7 @@ export class DeferredRequestRegistry<REQ, RES> {
|
|
|
27
27
|
resolveExistingRequests?: () => RES;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
constructor(
|
|
30
|
+
public constructor(
|
|
31
31
|
operation: string,
|
|
32
32
|
makeRequest: (id: RequestId, req: REQ) => Promise<void>,
|
|
33
33
|
opts: {
|
|
@@ -42,7 +42,7 @@ export class DeferredRequestRegistry<REQ, RES> {
|
|
|
42
42
|
this.opts = opts;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
async request(opts: REQ): Promise<RES> {
|
|
45
|
+
public async request(opts: REQ): Promise<RES> {
|
|
46
46
|
if (this.opts.resolveExistingRequests) {
|
|
47
47
|
const result = this.opts.resolveExistingRequests();
|
|
48
48
|
for (const deferred of this.requests.values()) {
|
|
@@ -63,7 +63,7 @@ export class DeferredRequestRegistry<REQ, RES> {
|
|
|
63
63
|
return deferred.promise;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
resolve(requestId: RequestId, response: RES) {
|
|
66
|
+
public resolve(requestId: RequestId, response: RES) {
|
|
67
67
|
const entry = this.requests.get(requestId);
|
|
68
68
|
if (entry === undefined) {
|
|
69
69
|
return;
|
|
@@ -73,7 +73,7 @@ export class DeferredRequestRegistry<REQ, RES> {
|
|
|
73
73
|
this.requests.delete(requestId);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
reject(requestId: RequestId, error: Error) {
|
|
76
|
+
public reject(requestId: RequestId, error: Error) {
|
|
77
77
|
const entry = this.requests.get(requestId);
|
|
78
78
|
if (entry === undefined) {
|
|
79
79
|
return;
|