@marimo-team/islands 0.25.3-dev308 → 0.25.3-dev310
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/{ConnectedDataExplorerComponent-DJnSxHJB.js → ConnectedDataExplorerComponent-DieU6L4x.js} +1 -1
- package/dist/{ErrorBoundary-flfhLFje.js → ErrorBoundary-DjoeT4kv.js} +1 -1
- package/dist/{abnfDiagram-VCTEODGH-CR0U5hup.js → abnfDiagram-VCTEODGH-LOVrjbdp.js} +2 -2
- package/dist/{any-language-editor-C5dsTpeB.js → any-language-editor-DMC2JE9_.js} +1 -1
- package/dist/{architectureDiagram-5GKGNRK7-Bc_fbI1Q.js → architectureDiagram-5GKGNRK7-RZsm312h.js} +1 -1
- package/dist/assets/__vite-browser-external-BSp9tJ_k.js +1 -0
- package/dist/assets/worker-BdfPA0g5.js +171 -0
- package/dist/{chat-ui-C4iLRzY0.js → chat-ui-DkuxGEDp.js} +418 -418
- package/dist/{chunk-IMKFNOWR-y9z5oeAY.js → chunk-IMKFNOWR-B6agbLjo.js} +1 -1
- package/dist/{chunk-SHT3W25Y-Tu-V-e_v.js → chunk-SHT3W25Y-CfULafYG.js} +1 -1
- package/dist/{chunk-SVP7TREG-CJFxs5R_.js → chunk-SVP7TREG-DEOpPMJp.js} +1 -1
- package/dist/{chunk-TICWLB2K-zkTP7ya7.js → chunk-TICWLB2K-DaH-gkX5.js} +1 -1
- package/dist/{classDiagram-ZZMXUADV-DxJAZI0N.js → classDiagram-ZZMXUADV-C0CyiWQ7.js} +2 -2
- package/dist/{classDiagram-v2-VYDZK3BY-TmHo2BpS.js → classDiagram-v2-VYDZK3BY-xfIc9e2Y.js} +2 -2
- package/dist/{code-visibility-BDs_r7jH.js → code-visibility-CduMVVFS.js} +32 -32
- package/dist/{common-CMTsL35V.js → common-CMcEcucH.js} +919 -919
- package/dist/{config-BG2qKzDg.js → config-BVYA1P0C.js} +103 -76
- package/dist/{cynefinDiagram-5FMLGOSQ-Eb40hmhD.js → cynefinDiagram-5FMLGOSQ-DwGYhKu0.js} +1 -1
- package/dist/{dagre-GXQ25YYZ-_paaVwit.js → dagre-GXQ25YYZ-DfMaWJOV.js} +1 -1
- package/dist/{data-grid-overlay-editor-es6V6qf-.js → data-grid-overlay-editor-BYrIVut3.js} +1 -1
- package/dist/{diagram-S7CK7UJ4-BtKJm1_4.js → diagram-S7CK7UJ4-Bw_L87GZ.js} +1 -1
- package/dist/{diagram-UQ7AKVKN-DQbxhEMd.js → diagram-UQ7AKVKN-nsrs3Fbz.js} +1 -1
- package/dist/{diagram-VX7I27RA-DITDIfGC.js → diagram-VX7I27RA-7ST9lEqP.js} +1 -1
- package/dist/{diagram-Z3DM3KII-Ct9_zo6F.js → diagram-Z3DM3KII-BnGte-HX.js} +1 -1
- package/dist/{ebnfDiagram-PWID7BFC-6cOntwfv.js → ebnfDiagram-PWID7BFC-zaKyJ1YL.js} +2 -2
- package/dist/{erDiagram-RLTQ6QDP-CJiOER41.js → erDiagram-RLTQ6QDP-Cx7g95FZ.js} +1 -1
- package/dist/{error-banner-DGOrmBk5.js → error-banner-DkQNU4bn.js} +128 -128
- package/dist/{error-entries-BWmleiL0.js → error-entries-istW7Xbs.js} +589 -544
- package/dist/{feedback-button-D4eVjeNs.js → feedback-button-Zvm26aOQ.js} +107 -106
- package/dist/{flowDiagram-HODETNUW-1lPBEUuW.js → flowDiagram-HODETNUW-C7nIqaHP.js} +2 -2
- package/dist/{formats-qhBmYb0l.js → formats-CMa7L3E8.js} +1 -1
- package/dist/{glide-data-editor-ahfaPdFW.js → glide-data-editor-BE-GgVp4.js} +3 -3
- package/dist/{globals-m8oswz--.js → globals-Dbru-WLP.js} +1 -1
- package/dist/{html-to-image-B8hE6HIH.js → html-to-image-pPbR2cDx.js} +4512 -4464
- package/dist/{infoDiagram-27XIBGKW-C6K4tri5.js → infoDiagram-27XIBGKW-BTM_NXsn.js} +1 -1
- package/dist/{ishikawaDiagram-5VMMS53U-DwcwgRNH.js → ishikawaDiagram-5VMMS53U-K0FZrlvv.js} +1 -1
- package/dist/{kanban-definition-UXKFOSKX-E489OMdc.js → kanban-definition-UXKFOSKX-ftznOyrz.js} +1 -1
- package/dist/main.js +6595 -6186
- package/dist/{mermaid-DMPMkVqY.js → mermaid-CNgH43ED.js} +33 -33
- package/dist/{mindmap-definition-YA3MSWOX-DWHjasOp.js → mindmap-definition-YA3MSWOX-CmzbxKfM.js} +1 -1
- package/dist/{number-overlay-editor-C6klKzEr.js → number-overlay-editor-qvlPZ-l-.js} +1 -1
- package/dist/{pegDiagram-XKGWAZYB-COjcPOZT.js → pegDiagram-XKGWAZYB-DfTAWfGE.js} +2 -2
- package/dist/{pieDiagram-E7YTZNPT-BHAVZ38h.js → pieDiagram-E7YTZNPT-_kGQstZj.js} +1 -1
- package/dist/{process-output-DZDL_j1a.js → process-output-BySO1nIs.js} +3 -3
- package/dist/{railroadDiagram-O6MQD6OU-94ThFyKX.js → railroadDiagram-O6MQD6OU-D41WmIff.js} +2 -2
- package/dist/{requirementDiagram-BXWQKSXE-CpF-Fxbb.js → requirementDiagram-BXWQKSXE-Bh53ZI3I.js} +1 -1
- package/dist/{reveal-component-DwnxPyVz.js → reveal-component-DQaegdcW.js} +4 -4
- package/dist/{sequenceDiagram-WJ2MYXX4-CvANK2x7.js → sequenceDiagram-WJ2MYXX4-DBX27dNm.js} +1 -1
- package/dist/{stateDiagram-D77RDMKH-WHuJ4mJL.js → stateDiagram-D77RDMKH-CSYz2IZi.js} +2 -2
- package/dist/{stateDiagram-v2-MP3YSRHH-DbO7lwYq.js → stateDiagram-v2-MP3YSRHH-DVLvtOqn.js} +2 -2
- package/dist/{swimlanes-42K2YHIH-CS2s29Vo.js → swimlanes-42K2YHIH-D59N0ktA.js} +1 -1
- package/dist/{swimlanesDiagram-VR7AAH4N-CXaA1vQg.js → swimlanesDiagram-VR7AAH4N-CRgpmVSW.js} +2 -2
- package/dist/{timeline-definition-24CTP7MA-B-SQMg5h.js → timeline-definition-24CTP7MA-C_xIIZDM.js} +1 -1
- package/dist/toDate-5qPtZ6HL.js +94 -0
- package/dist/{vega-component-DwqGfN3_.js → vega-component-Bly2lDhz.js} +10 -10
- package/dist/{vennDiagram-4TSXK5OY-etEFgvaG.js → vennDiagram-4TSXK5OY-DlOf0Mjs.js} +1 -1
- package/dist/{wardleyDiagram-VM6X3IG4-BEQN7g62.js → wardleyDiagram-VM6X3IG4-zD_2guVe.js} +1 -1
- package/dist/{xychartDiagram-S5SC5T6Z-D8-e5Z0R.js → xychartDiagram-S5SC5T6Z-CA0Dy1ZM.js} +1 -1
- package/package.json +1 -1
- package/src/__mocks__/executions.ts +35 -13
- package/src/__mocks__/requests.ts +0 -1
- package/src/components/editor/cell/__tests__/useRunCells.test.tsx +86 -101
- package/src/components/editor/cell/useRunCells.ts +38 -65
- package/src/components/editor/notebook-cell.tsx +32 -20
- package/src/components/editor/output/ansi-reduce.ts +7 -0
- package/src/core/ai/__tests__/staged-cells.test.ts +1 -1
- package/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap +2 -0
- package/src/core/cells/__tests__/cells.test.ts +0 -14
- package/src/core/cells/__tests__/collapseConsoleOutputs.test.ts +15 -0
- package/src/core/cells/__tests__/utils.test.ts +1 -1
- package/src/core/cells/add-missing-import.ts +2 -5
- package/src/core/cells/cell.ts +1 -0
- package/src/core/cells/cells.ts +1 -2
- package/src/core/executions/__tests__/atoms.test.ts +227 -43
- package/src/core/executions/__tests__/hooks.test.tsx +1 -2
- package/src/core/executions/__tests__/input.test.ts +86 -0
- package/src/core/executions/__tests__/run.test.ts +390 -0
- package/src/core/executions/__tests__/select.test.ts +105 -30
- package/src/core/executions/atoms.ts +186 -71
- package/src/core/executions/index.ts +7 -6
- package/src/core/executions/input.ts +55 -0
- package/src/core/executions/run.ts +120 -0
- package/src/core/executions/select.ts +59 -24
- package/src/core/islands/__tests__/bridge.test.ts +35 -54
- package/src/core/islands/bootstrap.ts +5 -1
- package/src/core/islands/bridge.ts +16 -28
- package/src/core/islands/components/IslandControls.tsx +15 -7
- package/src/core/islands/components/__tests__/IslandControls.test.tsx +36 -53
- package/src/core/islands/worker/worker.tsx +45 -19
- package/src/core/network/__tests__/requests-lazy.test.ts +14 -24
- package/src/core/network/__tests__/requests-toasting.test.tsx +7 -7
- package/src/core/network/requests-lazy.ts +2 -3
- package/src/core/network/requests-network.ts +0 -9
- package/src/core/network/requests-static.ts +0 -1
- package/src/core/network/requests-toasting.tsx +0 -1
- package/src/core/network/types.ts +0 -2
- package/src/core/notebook/replica/__tests__/fixtures.ts +17 -1
- package/src/core/notebook/replica/backend.ts +3 -1
- package/src/core/runtime/__tests__/runtime.test.ts +36 -0
- package/src/core/runtime/config.ts +36 -1
- package/src/core/runtime/runtime.ts +21 -1
- package/src/core/transports/static.ts +4 -3
- package/src/core/wasm/bridge.ts +0 -17
- package/dist/assets/__vite-browser-external-DzTYIHH_.js +0 -1
- package/dist/assets/worker-BH08I2Il.js +0 -171
- package/dist/static-state-Dtocd9UO.js +0 -68
|
@@ -51,7 +51,6 @@ const ACTIONS: Record<keyof AllRequests, Action> = {
|
|
|
51
51
|
sendComponentValues: "startConnection",
|
|
52
52
|
sendModelValue: "startConnection",
|
|
53
53
|
sendInstantiate: "startConnectionWithoutKernel",
|
|
54
|
-
sendRun: "startConnection",
|
|
55
54
|
sendRunScratchpad: "startConnection",
|
|
56
55
|
saveAppConfig: "startConnection",
|
|
57
56
|
discoverDataSources: "startConnection",
|
|
@@ -192,7 +191,7 @@ export function createLazyRequests(
|
|
|
192
191
|
case "waitForConnectionOpen":
|
|
193
192
|
// Wait for connection but don't start it
|
|
194
193
|
await waitForConnectionOpen();
|
|
195
|
-
await waitForRuntimeRunning();
|
|
194
|
+
await waitForRuntimeRunning(store);
|
|
196
195
|
return request(...args);
|
|
197
196
|
|
|
198
197
|
case "startConnectionWithoutKernel":
|
|
@@ -201,7 +200,7 @@ export function createLazyRequests(
|
|
|
201
200
|
await initOnce(runtimeManager);
|
|
202
201
|
await waitForConnectionOpen();
|
|
203
202
|
if (action === "startConnection") {
|
|
204
|
-
await waitForRuntimeRunning();
|
|
203
|
+
await waitForRuntimeRunning(store);
|
|
205
204
|
}
|
|
206
205
|
return request(...args);
|
|
207
206
|
|
|
@@ -106,15 +106,6 @@ export function createNetworkRequests(): EditRequests & RunRequests {
|
|
|
106
106
|
.POST("/api/kernel/shutdown")
|
|
107
107
|
.then(handleResponseReturnNull);
|
|
108
108
|
},
|
|
109
|
-
sendRun: async (request) => {
|
|
110
|
-
await waitForConnectionOpen();
|
|
111
|
-
return getClient()
|
|
112
|
-
.POST("/api/kernel/run", {
|
|
113
|
-
body: request,
|
|
114
|
-
params: getParams(),
|
|
115
|
-
})
|
|
116
|
-
.then(handleResponseReturnNull);
|
|
117
|
-
},
|
|
118
109
|
sendRunScratchpad: async (request) => {
|
|
119
110
|
await waitForConnectionOpen();
|
|
120
111
|
return getClient()
|
|
@@ -40,7 +40,6 @@ export function createStaticRequests(): EditRequests & RunRequests {
|
|
|
40
40
|
return null;
|
|
41
41
|
},
|
|
42
42
|
sendRestart: throwNotInEditMode,
|
|
43
|
-
sendRun: throwNotInEditMode,
|
|
44
43
|
sendRunScratchpad: throwNotInEditMode,
|
|
45
44
|
sendRename: throwNotInEditMode,
|
|
46
45
|
saveLayout: throwNotInEditMode,
|
|
@@ -21,7 +21,6 @@ export function createErrorToastingRequests(
|
|
|
21
21
|
sendInstantiate: "Failed to instantiate",
|
|
22
22
|
sendFunctionRequest: "Failed to send function request",
|
|
23
23
|
sendRestart: "Failed to restart",
|
|
24
|
-
sendRun: "Failed to run",
|
|
25
24
|
sendRunScratchpad: "Failed to run scratchpad",
|
|
26
25
|
sendRename: "Failed to rename",
|
|
27
26
|
saveLayout: "", // The save reports it
|
|
@@ -91,7 +91,6 @@ export type SetBreakpointsRequest = schemas["SetBreakpointsRequest"];
|
|
|
91
91
|
export type ReadCodeResponse = schemas["ReadCodeResponse"];
|
|
92
92
|
export type RecentFilesResponse = schemas["RecentFilesResponse"];
|
|
93
93
|
export type RenameNotebookRequest = schemas["RenameNotebookRequest"];
|
|
94
|
-
export type ExecuteCellsRequest = schemas["ExecuteCellsRequest"];
|
|
95
94
|
export type ExecuteScratchpadRequest = schemas["ExecuteScratchpadRequest"];
|
|
96
95
|
export type SaveAppConfigurationRequest =
|
|
97
96
|
schemas["SaveAppConfigurationRequest"];
|
|
@@ -165,7 +164,6 @@ export interface EditRequests {
|
|
|
165
164
|
saveLayout: (request: SaveLayoutRequest) => Promise<null>;
|
|
166
165
|
sendCopy: (request: CopyNotebookRequest) => Promise<null>;
|
|
167
166
|
sendStdin: (request: StdinRequest) => Promise<null>;
|
|
168
|
-
sendRun: (request: ExecuteCellsRequest) => Promise<null>;
|
|
169
167
|
sendRunScratchpad: (request: ExecuteScratchpadRequest) => Promise<null>;
|
|
170
168
|
sendInterrupt: () => Promise<null>;
|
|
171
169
|
sendShutdown: () => Promise<null>;
|
|
@@ -20,16 +20,30 @@ export type FakeSave = (
|
|
|
20
20
|
...args: Parameters<Commands["save"]>
|
|
21
21
|
) => ReturnType<Commands["save"]>;
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
export type FakeRun = (
|
|
24
|
+
notebookId: Protocol.NotebookId,
|
|
25
|
+
...args: Parameters<Commands["run"]>
|
|
26
|
+
) => ReturnType<Commands["run"]>;
|
|
27
|
+
|
|
28
|
+
export type FakeInput = (
|
|
29
|
+
notebookId: Protocol.NotebookId,
|
|
30
|
+
...args: Parameters<Commands["input"]>
|
|
31
|
+
) => ReturnType<Commands["input"]>;
|
|
32
|
+
|
|
33
|
+
/** A backend over `transport` whose commands go to the given fakes. */
|
|
24
34
|
export function fakeBackend({
|
|
25
35
|
transport = async () => undefined,
|
|
26
36
|
edit = vi.fn<FakeEdit>(),
|
|
27
37
|
save = vi.fn<FakeSave>(),
|
|
38
|
+
run = vi.fn<FakeRun>(),
|
|
39
|
+
input = vi.fn<FakeInput>(),
|
|
28
40
|
checkHealth,
|
|
29
41
|
}: {
|
|
30
42
|
transport?: NotebookTransport;
|
|
31
43
|
edit?: FakeEdit;
|
|
32
44
|
save?: FakeSave;
|
|
45
|
+
run?: FakeRun;
|
|
46
|
+
input?: FakeInput;
|
|
33
47
|
checkHealth?: () => Promise<boolean>;
|
|
34
48
|
} = {}): NotebookBackend {
|
|
35
49
|
return {
|
|
@@ -37,6 +51,8 @@ export function fakeBackend({
|
|
|
37
51
|
notebook: (notebookId) => ({
|
|
38
52
|
edit: (...args) => edit(notebookId, ...args),
|
|
39
53
|
save: (...args) => save(notebookId, ...args),
|
|
54
|
+
run: (...args) => run(notebookId, ...args),
|
|
55
|
+
input: (...args) => input(notebookId, ...args),
|
|
40
56
|
}),
|
|
41
57
|
checkHealth,
|
|
42
58
|
};
|
|
@@ -13,7 +13,9 @@ export interface NotebookBackend {
|
|
|
13
13
|
*
|
|
14
14
|
* Method presence is not permission. The notebook advertises its operations.
|
|
15
15
|
*/
|
|
16
|
-
notebook(
|
|
16
|
+
notebook(
|
|
17
|
+
id: NotebookId,
|
|
18
|
+
): Pick<NotebookClient, "edit" | "save" | "run" | "input">;
|
|
17
19
|
/** Whether the host is reachable before an explicit reconnect. Absent means always. */
|
|
18
20
|
checkHealth?(): Promise<boolean>;
|
|
19
21
|
}
|
|
@@ -509,6 +509,42 @@ describe("RuntimeManager", () => {
|
|
|
509
509
|
});
|
|
510
510
|
});
|
|
511
511
|
|
|
512
|
+
describe("start", () => {
|
|
513
|
+
it("starts once and lets later callers join the same attempt", async () => {
|
|
514
|
+
const runtime = new RuntimeManager(mockConfig, true);
|
|
515
|
+
const healthySpy = vi
|
|
516
|
+
.spyOn(runtime, "reconcileFromHealth")
|
|
517
|
+
.mockResolvedValue(true);
|
|
518
|
+
|
|
519
|
+
await Promise.all([runtime.start(), runtime.start()]);
|
|
520
|
+
|
|
521
|
+
expect(healthySpy).toHaveBeenCalledTimes(1);
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
it("tries again after an attempt gave up", async () => {
|
|
525
|
+
const runtime = new RuntimeManager(mockConfig, true);
|
|
526
|
+
const healthySpy = vi
|
|
527
|
+
.spyOn(runtime, "reconcileFromHealth")
|
|
528
|
+
.mockResolvedValue(false);
|
|
529
|
+
vi.spyOn(runtime, "init").mockImplementation(async () => {
|
|
530
|
+
await runtime.reconcileFromHealth();
|
|
531
|
+
throw new Error("Failed to connect after 25 retries");
|
|
532
|
+
});
|
|
533
|
+
|
|
534
|
+
await expect(runtime.start()).rejects.toThrow("Failed to connect");
|
|
535
|
+
healthySpy.mockResolvedValue(true);
|
|
536
|
+
vi.spyOn(runtime, "init").mockImplementation(async () => {
|
|
537
|
+
await runtime.reconcileFromHealth();
|
|
538
|
+
await runtime.waitForHealthy().catch(() => undefined);
|
|
539
|
+
});
|
|
540
|
+
|
|
541
|
+
// The second attempt is a new one, not the old failure replayed.
|
|
542
|
+
vi.spyOn(runtime, "waitForHealthy").mockResolvedValue(undefined);
|
|
543
|
+
await expect(runtime.start()).resolves.toBeUndefined();
|
|
544
|
+
expect(healthySpy).toHaveBeenCalledTimes(2);
|
|
545
|
+
});
|
|
546
|
+
});
|
|
547
|
+
|
|
512
548
|
describe("headers", () => {
|
|
513
549
|
it("should return headers with auth token", () => {
|
|
514
550
|
const runtime = new RuntimeManager(mockConfig);
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
import { atom, useAtom, useAtomValue } from "jotai";
|
|
3
3
|
import useEvent from "react-use-event-hook";
|
|
4
|
+
import { prettyError } from "@/utils/errors";
|
|
4
5
|
import { Logger } from "@/utils/Logger";
|
|
5
6
|
import { connectionAtom } from "../network/connection";
|
|
7
|
+
import { ConnectionClosedReason } from "../notebook/replica";
|
|
6
8
|
import { store } from "../state/jotai";
|
|
7
9
|
import { isAppNotStarted } from "../session/connection-utils";
|
|
8
10
|
import { ConnectionState } from "../session/types";
|
|
@@ -37,7 +39,7 @@ export function useConnectToRuntime(): () => Promise<void> {
|
|
|
37
39
|
return useEvent(async () => {
|
|
38
40
|
if (isAppNotStarted(connection.state)) {
|
|
39
41
|
setConnection({ state: ConnectionState.CONNECTING });
|
|
40
|
-
await runtimeManager.
|
|
42
|
+
await runtimeManager.start();
|
|
41
43
|
} else {
|
|
42
44
|
Logger.log("Runtime already started or starting...");
|
|
43
45
|
}
|
|
@@ -51,6 +53,39 @@ export function getRuntimeManager(): RuntimeManager {
|
|
|
51
53
|
return store.get(runtimeManagerAtom);
|
|
52
54
|
}
|
|
53
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Start a lazy runtime the first time something needs it.
|
|
58
|
+
*
|
|
59
|
+
* The connection can already read as connecting before anyone has asked
|
|
60
|
+
* for the runtime, because the notebook stream waits for the runtime's
|
|
61
|
+
* health and the editor mirrors that wait. So whether the runtime has
|
|
62
|
+
* been asked to start is the runtime's own business, and this only keeps
|
|
63
|
+
* the connection state honest around the attempt. A start that gives up
|
|
64
|
+
* closes the connection with the reason, which leaves the user a way to
|
|
65
|
+
* reconnect instead of a connection that looks like it is still coming up.
|
|
66
|
+
*/
|
|
67
|
+
export async function startRuntimeIfLazy(): Promise<void> {
|
|
68
|
+
const runtimeManager = getRuntimeManager();
|
|
69
|
+
if (runtimeManager.isServerless || !runtimeManager.isLazy) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (isAppNotStarted(store.get(connectionAtom).state)) {
|
|
73
|
+
store.set(connectionAtom, { state: ConnectionState.CONNECTING });
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
await runtimeManager.start();
|
|
77
|
+
} catch (error) {
|
|
78
|
+
if (store.get(connectionAtom).state === ConnectionState.CONNECTING) {
|
|
79
|
+
store.set(connectionAtom, {
|
|
80
|
+
state: ConnectionState.CLOSED,
|
|
81
|
+
code: ConnectionClosedReason.KERNEL_STARTUP_ERROR,
|
|
82
|
+
reason: prettyError(error),
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
throw error;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
54
89
|
export function asRemoteURL(path: string): URL {
|
|
55
90
|
if (path.startsWith("http")) {
|
|
56
91
|
return new URL(path);
|
|
@@ -14,6 +14,7 @@ const knownQueryParams = new Set(Object.values(KnownQueryParams));
|
|
|
14
14
|
|
|
15
15
|
export class RuntimeManager {
|
|
16
16
|
private initialHealthyCheck = new Deferred<void>();
|
|
17
|
+
private starting: Promise<void> | undefined;
|
|
17
18
|
private config: RuntimeConfig;
|
|
18
19
|
private lazy: boolean;
|
|
19
20
|
|
|
@@ -47,7 +48,7 @@ export class RuntimeManager {
|
|
|
47
48
|
return this.httpURL.origin === window.location.origin;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
public get isServerless(): boolean {
|
|
51
52
|
return isWasm() || isIslands() || isStaticNotebook();
|
|
52
53
|
}
|
|
53
54
|
|
|
@@ -345,6 +346,25 @@ export class RuntimeManager {
|
|
|
345
346
|
return this.initialHealthyCheck.promise;
|
|
346
347
|
}
|
|
347
348
|
|
|
349
|
+
/**
|
|
350
|
+
* Start the runtime once and wait until it is healthy.
|
|
351
|
+
*
|
|
352
|
+
* A run, the connect button, and the notebook stream can each ask for
|
|
353
|
+
* the runtime, so the first call starts it and later calls join that
|
|
354
|
+
* attempt. An attempt that gave up is forgotten, so the next call tries
|
|
355
|
+
* again instead of failing on the old result.
|
|
356
|
+
*/
|
|
357
|
+
public start(): Promise<void> {
|
|
358
|
+
this.starting ??= this.init()
|
|
359
|
+
.then(() => this.waitForHealthy())
|
|
360
|
+
.catch((error: unknown) => {
|
|
361
|
+
this.starting = undefined;
|
|
362
|
+
this.initialHealthyCheck = new Deferred<void>();
|
|
363
|
+
throw error;
|
|
364
|
+
});
|
|
365
|
+
return this.starting;
|
|
366
|
+
}
|
|
367
|
+
|
|
348
368
|
public headers(): KnownHeaders {
|
|
349
369
|
const headers: KnownHeaders = {
|
|
350
370
|
"Marimo-Session-Id": getSessionId(),
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
/** A backend that serves a document snapshot without a host. */
|
|
4
4
|
|
|
5
|
-
import type { NotebookClient } from "@marimo-team/client";
|
|
6
5
|
import type * as Protocol from "@marimo-team/client/protocol";
|
|
7
6
|
import type { NotebookBackend } from "../notebook/replica";
|
|
8
7
|
|
|
@@ -151,10 +150,10 @@ export function createStaticNotebookBackend(
|
|
|
151
150
|
}
|
|
152
151
|
}),
|
|
153
152
|
notebook: () => {
|
|
154
|
-
const unsupported
|
|
153
|
+
const unsupported = async (options?: { signal?: AbortSignal }) => {
|
|
155
154
|
options?.signal?.throwIfAborted();
|
|
156
155
|
return {
|
|
157
|
-
ok: false,
|
|
156
|
+
ok: false as const,
|
|
158
157
|
status: 501,
|
|
159
158
|
problem: {
|
|
160
159
|
type: "tag:marimo.io,2026:host/unsupported-operation",
|
|
@@ -167,6 +166,8 @@ export function createStaticNotebookBackend(
|
|
|
167
166
|
return {
|
|
168
167
|
edit: (_changes, options) => unsupported(options),
|
|
169
168
|
save: unsupported,
|
|
169
|
+
run: unsupported,
|
|
170
|
+
input: (_inputId, _reply, options) => unsupported(options),
|
|
170
171
|
};
|
|
171
172
|
},
|
|
172
173
|
};
|
package/src/core/wasm/bridge.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { createRPCRequestHandler } from "rpc-anywhere";
|
|
|
5
5
|
import { toast } from "@/components/ui/use-toast";
|
|
6
6
|
import { userConfigAtom } from "@/core/config/config";
|
|
7
7
|
import { serializeBlob } from "@/utils/blob";
|
|
8
|
-
import { Arrays } from "@/utils/arrays";
|
|
9
8
|
import { Deferred } from "@/utils/Deferred";
|
|
10
9
|
import { throwNotImplemented } from "@/utils/functions";
|
|
11
10
|
import { Logger } from "@/utils/Logger";
|
|
@@ -341,22 +340,6 @@ export class PyodideBridge implements RunRequests, EditRequests {
|
|
|
341
340
|
throwNotImplemented();
|
|
342
341
|
};
|
|
343
342
|
|
|
344
|
-
public sendRun: EditRequests["sendRun"] = async (request) => {
|
|
345
|
-
await this.rpc.proxy.request.loadPackages(request.codes.join("\n"));
|
|
346
|
-
|
|
347
|
-
await this.putControlRequest({
|
|
348
|
-
type: "execute-cells",
|
|
349
|
-
request: request.request,
|
|
350
|
-
executionRequests: Arrays.zip(request.cellIds, request.codes).map(
|
|
351
|
-
([cellId, code]) => ({
|
|
352
|
-
type: "execute-cell",
|
|
353
|
-
cellId,
|
|
354
|
-
code,
|
|
355
|
-
}),
|
|
356
|
-
),
|
|
357
|
-
});
|
|
358
|
-
return null;
|
|
359
|
-
};
|
|
360
343
|
public sendRunScratchpad: EditRequests["sendRunScratchpad"] = async (
|
|
361
344
|
request,
|
|
362
345
|
) => {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./worker-BH08I2Il.js";var t=/* @__PURE__ */ e(((e,t)=>{t.exports={}}));export default t();
|