@marimo-team/islands 0.25.3-dev447 → 0.25.3-dev455
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-DVbdKroW.js → ErrorBoundary-EIKYL5I7.js} +1 -1
- package/dist/assets/__vite-browser-external-D2z_TiUO.js +1 -0
- package/dist/assets/{worker-BUqfWMtI.js → worker-DLJ9P24O.js} +2 -2
- package/dist/{chat-ui-9oyUBL6M.js → chat-ui-DEHpKH2l.js} +17 -19
- package/dist/{code-visibility-DmsDqWUx.js → code-visibility-y-sxdqzm.js} +7 -7
- package/dist/{common-BDo_Jwoz.js → common-CN0Vi2sf.js} +4902 -4893
- package/dist/{data-grid-overlay-editor-CpHB_knU.js → data-grid-overlay-editor-DS87hE3v.js} +1 -1
- package/dist/{error-entries-CWdDf7iZ.js → error-entries-BG7ifiDg.js} +1368 -996
- package/dist/{feedback-button-B_Wmi4to.js → feedback-button-BLEwyTRA.js} +129 -129
- package/dist/{glide-data-editor-CMiIW5WP.js → glide-data-editor-Bmv61gX_.js} +3 -3
- package/dist/{globals-DaC3pk9F.js → globals-CIXjTv9d.js} +1 -1
- package/dist/{html-to-image-CexRSGAZ.js → html-to-image-9HLBGrIx.js} +4115 -4103
- package/dist/main.js +6562 -6671
- package/dist/{number-overlay-editor-Dd4cOJ5I.js → number-overlay-editor-TNyxrFMM.js} +1 -1
- package/dist/{process-output-hcyVRJCC.js → process-output-B8HPq5iZ.js} +2 -2
- package/dist/{reveal-component-CTmvBdvu.js → reveal-component-Ds7he0Dj.js} +166 -167
- package/package.json +1 -1
- package/src/__mocks__/executions.ts +7 -4
- package/src/__mocks__/notebook.ts +20 -4
- package/src/components/editor/cell/DeleteButton.tsx +2 -2
- package/src/components/editor/cell/StopButton.tsx +2 -2
- package/src/components/editor/cell/useRunCells.ts +0 -3
- package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +1 -1
- package/src/components/editor/notebook-cell.tsx +4 -35
- package/src/components/editor/output/ansi-reduce.ts +124 -61
- package/src/components/editor/output/console/ConsoleOutput.tsx +7 -25
- package/src/components/editor/output/console/__tests__/ConsoleOutput.test.tsx +15 -44
- package/src/components/editor/renderers/cells-renderer.tsx +2 -5
- package/src/components/editor/renderers/grid-layout/__tests__/grid-layout.test.tsx +1 -1
- package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +3 -6
- package/src/components/editor/stdin-blocking-alert.tsx +14 -18
- package/src/components/scratchpad/scratchpad.test.tsx +1 -1
- package/src/components/scratchpad/scratchpad.tsx +5 -6
- package/src/components/slides/__tests__/cell-output-block.test.tsx +2 -2
- package/src/components/slides/__tests__/slide-cell-view.test.tsx +2 -2
- package/src/components/tracing/tracing-spec.ts +11 -1
- package/src/components/tracing/tracing.tsx +4 -0
- package/src/core/ai/context/providers/__tests__/cell-output.test.ts +10 -20
- package/src/core/ai/context/providers/__tests__/error.test.ts +5 -27
- package/src/core/ai/context/providers/cell-output.ts +4 -12
- package/src/core/cells/__tests__/cell.test.ts +1 -169
- package/src/core/cells/__tests__/cells.test.ts +32 -709
- package/src/core/cells/__tests__/clear-outputs.test.ts +21 -14
- package/src/core/cells/__tests__/collapseConsoleOutputs.test.ts +71 -2
- package/src/core/cells/__tests__/logs.test.ts +18 -29
- package/src/core/cells/__tests__/runs.test.ts +128 -431
- package/src/core/cells/__tests__/session.test.ts +9 -9
- package/src/core/cells/actions.ts +29 -7
- package/src/core/cells/cell.ts +1 -96
- package/src/core/cells/cells.ts +147 -117
- package/src/core/cells/collapseConsoleOutputs.tsx +71 -40
- package/src/core/cells/command-console.ts +46 -0
- package/src/core/cells/execution-console.ts +230 -0
- package/src/core/cells/focus.ts +9 -29
- package/src/core/cells/logs.ts +10 -2
- package/src/core/cells/runs.ts +62 -118
- package/src/core/cells/session.ts +2 -2
- package/src/core/cells/types.ts +30 -23
- package/src/core/cells/useAnswerPrompt.ts +29 -0
- package/src/core/errors/error-entries.ts +3 -4
- package/src/core/executions/__tests__/atoms.test.ts +6 -20
- package/src/core/executions/__tests__/input.test.ts +3 -3
- package/src/core/executions/__tests__/output-lifecycle.test.ts +2 -8
- package/src/core/executions/atoms.ts +2 -21
- package/src/core/executions/index.ts +2 -1
- package/src/core/executions/input.ts +4 -3
- package/src/core/executions/output.ts +3 -3
- package/src/core/islands/__tests__/bridge.test.ts +59 -0
- package/src/core/islands/bootstrap.ts +29 -12
- package/src/core/islands/bridge.ts +67 -13
- package/src/core/kernel/handlers.ts +2 -21
- package/src/core/kernel/messages.ts +0 -1
- package/src/core/network/types.ts +0 -1
- package/src/core/notebook/document/__tests__/codemirror.test.ts +1 -0
- package/src/core/notebook/replica/__tests__/executions.test.ts +1 -0
- package/src/core/notebook/replica/__tests__/replica.test.ts +113 -0
- package/src/core/notebook/replica/replica.ts +106 -12
- package/src/core/notebook/replica/resources/executions.ts +57 -4
- package/src/core/session/__tests__/backend.test.ts +2 -4
- package/src/core/session/__tests__/useNotebookReplica.hook.test.tsx +1 -0
- package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +601 -35
- package/src/core/session/useNotebookReplica.ts +20 -6
- package/src/core/session/useNotebookSession.tsx +63 -33
- package/src/core/static/virtual-file-tracker.ts +26 -8
- package/src/stories/layout/vertical/one-column.stories.tsx +18 -12
- package/dist/assets/__vite-browser-external-CpRgw4M_.js +0 -1
- package/src/components/editor/alerts/stdin-blocking-alert.tsx +0 -68
- package/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap +0 -703
|
@@ -43,8 +43,6 @@ describe("ConsoleOutput integration", () => {
|
|
|
43
43
|
cellName: "test_cell",
|
|
44
44
|
consoleOutputs: [] as WithResponse<OutputMessage>[],
|
|
45
45
|
stale: false,
|
|
46
|
-
interrupted: false,
|
|
47
|
-
debuggerActive: false,
|
|
48
46
|
onSubmitDebugger: () => {
|
|
49
47
|
// noop
|
|
50
48
|
},
|
|
@@ -75,16 +73,15 @@ describe("ConsoleOutput pdb history", () => {
|
|
|
75
73
|
cellName: "test_cell",
|
|
76
74
|
consoleOutputs: [] as WithResponse<OutputMessage>[],
|
|
77
75
|
stale: false,
|
|
78
|
-
interrupted: false,
|
|
79
|
-
debuggerActive: false,
|
|
80
76
|
onSubmitDebugger: vi.fn(),
|
|
81
77
|
};
|
|
82
78
|
|
|
83
79
|
const stdinPrompt = (
|
|
84
80
|
data: string,
|
|
85
|
-
response?: string,
|
|
81
|
+
response?: string | null,
|
|
86
82
|
): WithResponse<OutputMessage> => ({
|
|
87
83
|
channel: "stdin" as const,
|
|
84
|
+
input_id: "prompt-1",
|
|
88
85
|
mimetype: "text/plain",
|
|
89
86
|
data,
|
|
90
87
|
timestamp: 0,
|
|
@@ -140,7 +137,7 @@ describe("ConsoleOutput pdb history", () => {
|
|
|
140
137
|
fireEvent.change(input, { target: { value: "next" } });
|
|
141
138
|
fireEvent.keyDown(input, { key: "Enter" });
|
|
142
139
|
|
|
143
|
-
expect(onSubmitDebugger).toHaveBeenCalledWith("next",
|
|
140
|
+
expect(onSubmitDebugger).toHaveBeenCalledWith("next", "prompt-1");
|
|
144
141
|
|
|
145
142
|
// Simulate server response: old stdin gets a response, new stdin prompt appears
|
|
146
143
|
const outputs2: WithResponse<OutputMessage>[] = [
|
|
@@ -172,6 +169,7 @@ describe("ConsoleOutput pdb history", () => {
|
|
|
172
169
|
it("submits passwords without making them available to input history", () => {
|
|
173
170
|
const passwordPrompt: WithResponse<OutputMessage> = {
|
|
174
171
|
...stdinPrompt("Password: "),
|
|
172
|
+
input_id: "password-1",
|
|
175
173
|
mimetype: "text/password",
|
|
176
174
|
};
|
|
177
175
|
const onSubmitDebugger = vi.fn();
|
|
@@ -209,7 +207,7 @@ describe("ConsoleOutput pdb history", () => {
|
|
|
209
207
|
fireEvent.keyDown(input, { key: "Enter" });
|
|
210
208
|
expect(onSubmitDebugger).toHaveBeenLastCalledWith(
|
|
211
209
|
"getpass-regression-secret",
|
|
212
|
-
|
|
210
|
+
passwordPrompt.input_id,
|
|
213
211
|
);
|
|
214
212
|
expect(input).toHaveValue("");
|
|
215
213
|
|
|
@@ -251,7 +249,7 @@ describe("ConsoleOutput pdb history", () => {
|
|
|
251
249
|
input.value = "marimo";
|
|
252
250
|
fireEvent.keyDown(input, { key: "Enter" });
|
|
253
251
|
|
|
254
|
-
expect(onSubmitDebugger).toHaveBeenCalledWith("marimo",
|
|
252
|
+
expect(onSubmitDebugger).toHaveBeenCalledWith("marimo", "prompt-1");
|
|
255
253
|
});
|
|
256
254
|
|
|
257
255
|
it("should submit an empty string when Enter is pressed with no input", () => {
|
|
@@ -272,7 +270,7 @@ describe("ConsoleOutput pdb history", () => {
|
|
|
272
270
|
const input = screen.getByTestId("console-input");
|
|
273
271
|
fireEvent.keyDown(input, { key: "Enter" });
|
|
274
272
|
|
|
275
|
-
expect(onSubmitDebugger).toHaveBeenCalledWith("",
|
|
273
|
+
expect(onSubmitDebugger).toHaveBeenCalledWith("", "prompt-1");
|
|
276
274
|
});
|
|
277
275
|
|
|
278
276
|
it("should not record empty submissions in input history", () => {
|
|
@@ -421,43 +419,18 @@ describe("ConsoleOutput pdb history", () => {
|
|
|
421
419
|
expect(input).toHaveValue("");
|
|
422
420
|
});
|
|
423
421
|
|
|
424
|
-
it(
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
stdinPrompt("Press Enter to continue: ", ""),
|
|
430
|
-
];
|
|
431
|
-
|
|
432
|
-
const { rerender } = renderWithProvider(
|
|
422
|
+
it.each([
|
|
423
|
+
[null, false],
|
|
424
|
+
["", true],
|
|
425
|
+
] as const)("renders a closed prompt with response %s", (response, empty) => {
|
|
426
|
+
renderWithProvider(
|
|
433
427
|
<ConsoleOutput
|
|
434
428
|
{...defaultProps}
|
|
435
|
-
consoleOutputs={
|
|
436
|
-
interrupted={true}
|
|
429
|
+
consoleOutputs={[stdinPrompt("Press Enter to continue: ", response)]}
|
|
437
430
|
/>,
|
|
438
431
|
);
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
expect(screen.queryByLabelText("stdin response")).not.toBeInTheDocument();
|
|
442
|
-
|
|
443
|
-
// Same outputs, but the cell isn't interrupted -- this is a real
|
|
444
|
-
// bare-Enter submission, so we should render the (empty) placeholder.
|
|
445
|
-
rerender(
|
|
446
|
-
<Provider store={store}>
|
|
447
|
-
<DocumentProvider model={model}>
|
|
448
|
-
<TooltipProvider>
|
|
449
|
-
<ConsoleOutput
|
|
450
|
-
{...defaultProps}
|
|
451
|
-
consoleOutputs={interruptedOutputs}
|
|
452
|
-
interrupted={false}
|
|
453
|
-
/>
|
|
454
|
-
</TooltipProvider>
|
|
455
|
-
</DocumentProvider>
|
|
456
|
-
</Provider>,
|
|
457
|
-
);
|
|
458
|
-
|
|
459
|
-
expect(screen.getByLabelText("stdin response")).toBeInTheDocument();
|
|
460
|
-
expect(screen.getByText("(empty)")).toBeInTheDocument();
|
|
432
|
+
expect(screen.queryByTestId("console-input")).not.toBeInTheDocument();
|
|
433
|
+
expect(screen.queryByText("(empty)") !== null).toBe(empty);
|
|
461
434
|
});
|
|
462
435
|
});
|
|
463
436
|
|
|
@@ -486,8 +459,6 @@ describe("ConsoleOutput debounced clearing", () => {
|
|
|
486
459
|
cellName: "test_cell",
|
|
487
460
|
consoleOutputs: [] as WithResponse<OutputMessage>[],
|
|
488
461
|
stale: false,
|
|
489
|
-
interrupted: false,
|
|
490
|
-
debuggerActive: false,
|
|
491
462
|
onSubmitDebugger: vi.fn(),
|
|
492
463
|
};
|
|
493
464
|
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
import { useAtomValue } from "jotai";
|
|
4
4
|
import type React from "react";
|
|
5
5
|
import { memo, type PropsWithChildren } from "react";
|
|
6
|
-
import {
|
|
6
|
+
import { renderedNotebookCellsAtom } from "@/core/cells/cells";
|
|
7
7
|
import type { AppConfig } from "@/core/config/config-schema";
|
|
8
|
-
import { cellOutputsAtom } from "@/core/executions";
|
|
9
8
|
import { resolveLayoutData } from "@/core/layout/layout";
|
|
10
9
|
import {
|
|
11
10
|
resolveLayoutType,
|
|
@@ -70,10 +69,8 @@ interface PluginCellRendererProps extends PropsWithChildren<Props> {
|
|
|
70
69
|
export const PluginCellRenderer = (props: PluginCellRendererProps) => {
|
|
71
70
|
const { appConfig, mode, plugin } = props;
|
|
72
71
|
const layoutState = useLayoutState();
|
|
73
|
-
const notebook = useNotebook();
|
|
74
|
-
const outputs = useAtomValue(cellOutputsAtom);
|
|
75
72
|
const { setCurrentLayoutData } = useLayoutActions();
|
|
76
|
-
const cells =
|
|
73
|
+
const cells = useAtomValue(renderedNotebookCellsAtom);
|
|
77
74
|
const layout = resolveLayoutData({ state: layoutState, plugin, cells });
|
|
78
75
|
|
|
79
76
|
const Renderer = plugin.Component;
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
} from "@/components/ui/dropdown-menu";
|
|
28
28
|
import { outputIsLoading, outputIsStale } from "@/core/cells/cell";
|
|
29
29
|
import type { CellId } from "@/core/cells/ids";
|
|
30
|
-
import type {
|
|
30
|
+
import type { CellRuntimeView, RuntimeCell } from "@/core/cells/types";
|
|
31
31
|
import { getReadonlyCodeDisplay } from "@/core/cells/readonly-code-display";
|
|
32
32
|
import { MarkdownLanguageAdapter } from "@/core/codemirror/language/languages/markdown";
|
|
33
33
|
import { useResolvedMarimoConfig } from "@/core/config/config";
|
|
@@ -300,7 +300,7 @@ const ActionButtons: React.FC<{
|
|
|
300
300
|
);
|
|
301
301
|
};
|
|
302
302
|
|
|
303
|
-
interface VerticalCellProps extends Pick<
|
|
303
|
+
interface VerticalCellProps extends Pick<CellRuntimeView, "consoleOutputs"> {
|
|
304
304
|
cellOutputArea: "above" | "below";
|
|
305
305
|
cellId: CellId;
|
|
306
306
|
config: CellConfig;
|
|
@@ -329,7 +329,6 @@ const VerticalCell = memo(
|
|
|
329
329
|
const output = useCellOutput(cellId);
|
|
330
330
|
const { execution, freshness } = useCellPresentation(cellId);
|
|
331
331
|
const errored = execution.outcome === "error";
|
|
332
|
-
const interrupted = execution.outcome === "interrupted";
|
|
333
332
|
const stopped = execution.outcome === "skipped";
|
|
334
333
|
|
|
335
334
|
const outputStale = outputIsStale(execution, freshness, false);
|
|
@@ -391,11 +390,9 @@ const VerticalCell = memo(
|
|
|
391
390
|
<ConsoleOutput
|
|
392
391
|
consoleOutputs={consoleOutputs}
|
|
393
392
|
stale={outputStale}
|
|
394
|
-
interrupted={interrupted}
|
|
395
393
|
cellName={name}
|
|
396
394
|
onSubmitDebugger={() => null}
|
|
397
395
|
cellId={cellId}
|
|
398
|
-
debuggerActive={false}
|
|
399
396
|
/>
|
|
400
397
|
</div>
|
|
401
398
|
);
|
|
@@ -405,7 +402,7 @@ const VerticalCell = memo(
|
|
|
405
402
|
// instead of hiding them
|
|
406
403
|
const hidden = shouldHidePublishedCell({
|
|
407
404
|
errored,
|
|
408
|
-
interrupted,
|
|
405
|
+
interrupted: execution.outcome === "interrupted",
|
|
409
406
|
stopped,
|
|
410
407
|
output,
|
|
411
408
|
showErrorTracebacks,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
3
|
import { atom, useAtomValue } from "jotai";
|
|
4
|
-
import {
|
|
5
|
-
import { cellExecutionInputsAtom, cellExecutionView } from "@/core/executions";
|
|
4
|
+
import { activeNotebookReplicaAtom } from "@/core/session/active-notebook";
|
|
6
5
|
import { Banner } from "@/plugins/impl/common/error-banner";
|
|
7
6
|
import { pendingPdbInputAtom } from "@/core/codemirror/cells/debugger-state";
|
|
8
7
|
import { kioskModeAtom } from "@/core/mode";
|
|
@@ -11,28 +10,25 @@ import { Button } from "../ui/button";
|
|
|
11
10
|
import { Kbd } from "../ui/kbd";
|
|
12
11
|
import { DelayMount } from "../utils/delay-mount";
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
const hasBlockingStdinAtom = atom((get) => {
|
|
16
|
-
const notebook = get(notebookAtom);
|
|
17
|
-
const executions = get(cellExecutionInputsAtom);
|
|
13
|
+
export const hasBlockingStdinAtom = atom((get) => {
|
|
18
14
|
if (!get(kioskModeAtom) && get(pendingPdbInputAtom) !== null) {
|
|
19
15
|
return true;
|
|
20
16
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
|
|
17
|
+
const replica = get(activeNotebookReplicaAtom);
|
|
18
|
+
if (replica === null) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
for (const { record, items } of get(
|
|
22
|
+
replica.executionsAtom,
|
|
23
|
+
).executions.values()) {
|
|
24
|
+
if (record.status === "running") {
|
|
25
|
+
for (const item of items.values()) {
|
|
26
|
+
if (item.kind === "input" && item.status === "pending") {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
32
29
|
}
|
|
33
30
|
}
|
|
34
31
|
}
|
|
35
|
-
|
|
36
32
|
return false;
|
|
37
33
|
});
|
|
38
34
|
|
|
@@ -19,7 +19,7 @@ const state = vi.hoisted(() => ({
|
|
|
19
19
|
}));
|
|
20
20
|
|
|
21
21
|
vi.mock("@/core/cells/cells", () => ({
|
|
22
|
-
|
|
22
|
+
useCellRuntime: () => ({ consoleOutputs: [] }),
|
|
23
23
|
}));
|
|
24
24
|
vi.mock("@/core/cells/actions", () => ({
|
|
25
25
|
useCellActions: () => ({ createCell: vi.fn() }),
|
|
@@ -13,7 +13,7 @@ import type React from "react";
|
|
|
13
13
|
import { Suspense, useMemo, useRef, useState } from "react";
|
|
14
14
|
import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
|
|
15
15
|
import useEvent from "react-use-event-hook";
|
|
16
|
-
import {
|
|
16
|
+
import { useCellRuntime } from "@/core/cells/cells";
|
|
17
17
|
import { useCellActions } from "@/core/cells/actions";
|
|
18
18
|
import { useLastFocusedCellId } from "@/core/cells/focus";
|
|
19
19
|
import { HTMLCellId, SCRATCH_CELL_ID } from "@/core/cells/ids";
|
|
@@ -33,6 +33,7 @@ import type { CellConfig } from "@/core/network/types";
|
|
|
33
33
|
import { LazyAnyLanguageCodeMirror } from "@/plugins/impl/code/LazyAnyLanguageCodeMirror";
|
|
34
34
|
import { useTheme } from "@/theme/useTheme";
|
|
35
35
|
import { cn } from "@/utils/cn";
|
|
36
|
+
import { useAnswerPrompt } from "@/core/cells/useAnswerPrompt";
|
|
36
37
|
import { Functions } from "@/utils/functions";
|
|
37
38
|
import { CellEditor } from "../editor/cell/code/cell-editor";
|
|
38
39
|
import {
|
|
@@ -59,7 +60,6 @@ const scratchpadCellConfig: CellConfig = {
|
|
|
59
60
|
};
|
|
60
61
|
|
|
61
62
|
export const ScratchPad: React.FC = () => {
|
|
62
|
-
const notebookState = useNotebook();
|
|
63
63
|
const [userConfig] = useResolvedMarimoConfig();
|
|
64
64
|
const { theme } = useTheme();
|
|
65
65
|
const ref = useRef<EditorView | null>(null);
|
|
@@ -70,12 +70,13 @@ export const ScratchPad: React.FC = () => {
|
|
|
70
70
|
const section = usePanelSection();
|
|
71
71
|
|
|
72
72
|
const cellId = SCRATCH_CELL_ID;
|
|
73
|
-
const cellRuntime =
|
|
73
|
+
const cellRuntime = useCellRuntime(cellId);
|
|
74
74
|
const output = useScratchOutput();
|
|
75
75
|
const status = scratchStatus(
|
|
76
76
|
useAtomValue(cellExecutionInputsAtom).executions,
|
|
77
77
|
);
|
|
78
78
|
const consoleOutputs = cellRuntime?.consoleOutputs;
|
|
79
|
+
const answerPrompt = useAnswerPrompt(cellId);
|
|
79
80
|
const [code, setCode] = useAtom(scratchpadCodeAtom);
|
|
80
81
|
const codeListener = useMemo(
|
|
81
82
|
() => [
|
|
@@ -307,11 +308,9 @@ export const ScratchPad: React.FC = () => {
|
|
|
307
308
|
consoleOutputs={consoleOutputs}
|
|
308
309
|
className="overflow-auto"
|
|
309
310
|
stale={false}
|
|
310
|
-
interrupted={false}
|
|
311
311
|
cellName={DEFAULT_CELL_NAME}
|
|
312
|
-
onSubmitDebugger={
|
|
312
|
+
onSubmitDebugger={answerPrompt}
|
|
313
313
|
cellId={cellId}
|
|
314
|
-
debuggerActive={false}
|
|
315
314
|
/>
|
|
316
315
|
</div>
|
|
317
316
|
</div>
|
|
@@ -5,7 +5,7 @@ import { describe, expect, it } from "vitest";
|
|
|
5
5
|
import { cellId } from "@/__tests__/branded";
|
|
6
6
|
import { TooltipProvider } from "@/components/ui/tooltip";
|
|
7
7
|
import { CellOutputId } from "@/core/cells/ids";
|
|
8
|
-
import { createCell
|
|
8
|
+
import { createCell } from "@/core/cells/types";
|
|
9
9
|
import { CellOutputBlock } from "../reveal-component";
|
|
10
10
|
|
|
11
11
|
describe("CellOutputBlock", () => {
|
|
@@ -13,7 +13,7 @@ describe("CellOutputBlock", () => {
|
|
|
13
13
|
const id = cellId("test");
|
|
14
14
|
const cell = {
|
|
15
15
|
...createCell({ id, name: "title" }),
|
|
16
|
-
|
|
16
|
+
consoleOutputs: [],
|
|
17
17
|
output: {
|
|
18
18
|
channel: "output" as const,
|
|
19
19
|
mimetype: "text/plain" as const,
|
|
@@ -5,7 +5,7 @@ import { beforeAll, describe, expect, it } from "vitest";
|
|
|
5
5
|
import { SetupMocks } from "@/__mocks__/common";
|
|
6
6
|
import { cellId } from "@/__tests__/branded";
|
|
7
7
|
import { TooltipProvider } from "@/components/ui/tooltip";
|
|
8
|
-
import { createCell
|
|
8
|
+
import { createCell } from "@/core/cells/types";
|
|
9
9
|
import { SlideCellReadOnlyView } from "../slide-cell-view";
|
|
10
10
|
|
|
11
11
|
beforeAll(() => {
|
|
@@ -17,7 +17,7 @@ describe("SlideCellReadOnlyView", () => {
|
|
|
17
17
|
const id = cellId("test");
|
|
18
18
|
const cell = {
|
|
19
19
|
...createCell({ id, name: "title", code: "x = 1" }),
|
|
20
|
-
|
|
20
|
+
consoleOutputs: [],
|
|
21
21
|
output: null,
|
|
22
22
|
};
|
|
23
23
|
|
|
@@ -96,7 +96,17 @@ export function createGanttBaseSpec(
|
|
|
96
96
|
},
|
|
97
97
|
color: {
|
|
98
98
|
field: statusField,
|
|
99
|
-
scale: {
|
|
99
|
+
scale: {
|
|
100
|
+
domain: [
|
|
101
|
+
"success",
|
|
102
|
+
"error",
|
|
103
|
+
"queued",
|
|
104
|
+
"running",
|
|
105
|
+
"skipped",
|
|
106
|
+
"interrupted",
|
|
107
|
+
],
|
|
108
|
+
range: ["#37BE5F", "red", "grey", "steelblue", "grey", "darkorange"],
|
|
109
|
+
},
|
|
100
110
|
legend: null,
|
|
101
111
|
},
|
|
102
112
|
},
|
|
@@ -7,7 +7,9 @@ import {
|
|
|
7
7
|
ChevronRight,
|
|
8
8
|
CircleCheck,
|
|
9
9
|
CircleEllipsis,
|
|
10
|
+
CircleMinus,
|
|
10
11
|
CirclePlayIcon,
|
|
12
|
+
CircleStop,
|
|
11
13
|
CircleX,
|
|
12
14
|
} from "lucide-react";
|
|
13
15
|
import React, { type JSX, Suspense, useEffect, useRef, useState } from "react";
|
|
@@ -353,6 +355,8 @@ const StatusIcons: Record<CellRun["status"], JSX.Element> = {
|
|
|
353
355
|
success: <CircleCheck color="green" size={14} />,
|
|
354
356
|
running: <CirclePlayIcon color="var(--blue-10)" size={14} />,
|
|
355
357
|
error: <CircleX color="red" size={14} />,
|
|
358
|
+
skipped: <CircleMinus color="grey" size={14} />,
|
|
359
|
+
interrupted: <CircleStop color="var(--amber-10)" size={14} />,
|
|
356
360
|
queued: <CircleEllipsis color="grey" size={14} />,
|
|
357
361
|
};
|
|
358
362
|
|
|
@@ -441,11 +441,11 @@ describe("Cell output utility functions", () => {
|
|
|
441
441
|
mimetype: "text/plain",
|
|
442
442
|
data: "42",
|
|
443
443
|
} as OutputMessage,
|
|
444
|
-
|
|
444
|
+
embeddedConsole: [],
|
|
445
445
|
},
|
|
446
446
|
cell2: {
|
|
447
447
|
output: null,
|
|
448
|
-
|
|
448
|
+
embeddedConsole: [
|
|
449
449
|
{
|
|
450
450
|
mimetype: "text/plain",
|
|
451
451
|
data: "console log message",
|
|
@@ -515,9 +515,7 @@ describe("Cell output utility functions", () => {
|
|
|
515
515
|
cellId("cell2"),
|
|
516
516
|
mockNotebook,
|
|
517
517
|
outputOf(mockNotebook, "cell2"),
|
|
518
|
-
|
|
519
|
-
includeConsoleOutput: true,
|
|
520
|
-
},
|
|
518
|
+
mockNotebook.cellRuntime[cellId("cell2")].embeddedConsole,
|
|
521
519
|
);
|
|
522
520
|
|
|
523
521
|
expect(result.consoleOutputs).toBeDefined();
|
|
@@ -530,7 +528,7 @@ describe("Cell output utility functions", () => {
|
|
|
530
528
|
it("should filter out empty console outputs", () => {
|
|
531
529
|
const cell2Runtime = mockNotebook.cellRuntime[cellId("cell2")];
|
|
532
530
|
if (cell2Runtime) {
|
|
533
|
-
|
|
531
|
+
cell2Runtime.embeddedConsole = [
|
|
534
532
|
{
|
|
535
533
|
mimetype: "text/plain",
|
|
536
534
|
data: "valid output",
|
|
@@ -546,9 +544,7 @@ describe("Cell output utility functions", () => {
|
|
|
546
544
|
cellId("cell2"),
|
|
547
545
|
mockNotebook,
|
|
548
546
|
outputOf(mockNotebook, "cell2"),
|
|
549
|
-
|
|
550
|
-
includeConsoleOutput: true,
|
|
551
|
-
},
|
|
547
|
+
mockNotebook.cellRuntime[cellId("cell2")].embeddedConsole,
|
|
552
548
|
);
|
|
553
549
|
|
|
554
550
|
expect(result.consoleOutputs).toHaveLength(1);
|
|
@@ -558,7 +554,7 @@ describe("Cell output utility functions", () => {
|
|
|
558
554
|
it("should handle cells with both cell output and console outputs", () => {
|
|
559
555
|
const cell1Runtime = mockNotebook.cellRuntime[cellId("cell1")];
|
|
560
556
|
if (cell1Runtime) {
|
|
561
|
-
|
|
557
|
+
cell1Runtime.embeddedConsole = [
|
|
562
558
|
{
|
|
563
559
|
mimetype: "text/plain",
|
|
564
560
|
data: "debug message",
|
|
@@ -570,9 +566,7 @@ describe("Cell output utility functions", () => {
|
|
|
570
566
|
cellId("cell1"),
|
|
571
567
|
mockNotebook,
|
|
572
568
|
outputOf(mockNotebook, "cell1"),
|
|
573
|
-
|
|
574
|
-
includeConsoleOutput: true,
|
|
575
|
-
},
|
|
569
|
+
mockNotebook.cellRuntime[cellId("cell1")].embeddedConsole,
|
|
576
570
|
);
|
|
577
571
|
|
|
578
572
|
expect(result.cellOutput).toBeDefined();
|
|
@@ -588,9 +582,7 @@ describe("Cell output utility functions", () => {
|
|
|
588
582
|
cellId("cell1"),
|
|
589
583
|
mockNotebook,
|
|
590
584
|
outputOf(mockNotebook, "cell1"),
|
|
591
|
-
|
|
592
|
-
includeConsoleOutput: true,
|
|
593
|
-
},
|
|
585
|
+
mockNotebook.cellRuntime[cellId("cell1")].embeddedConsole,
|
|
594
586
|
);
|
|
595
587
|
|
|
596
588
|
expect(result.consoleOutputs).toEqual([]);
|
|
@@ -619,7 +611,7 @@ describe("Cell output utility functions", () => {
|
|
|
619
611
|
it("should handle media outputs in console outputs", () => {
|
|
620
612
|
const cell2Runtime = mockNotebook.cellRuntime[cellId("cell2")];
|
|
621
613
|
if (cell2Runtime) {
|
|
622
|
-
|
|
614
|
+
cell2Runtime.embeddedConsole = [
|
|
623
615
|
{
|
|
624
616
|
mimetype: "image/png",
|
|
625
617
|
data: "https://example.com/image.png",
|
|
@@ -631,9 +623,7 @@ describe("Cell output utility functions", () => {
|
|
|
631
623
|
cellId("cell2"),
|
|
632
624
|
mockNotebook,
|
|
633
625
|
outputOf(mockNotebook, "cell2"),
|
|
634
|
-
|
|
635
|
-
includeConsoleOutput: true,
|
|
636
|
-
},
|
|
626
|
+
mockNotebook.cellRuntime[cellId("cell2")].embeddedConsole,
|
|
637
627
|
);
|
|
638
628
|
|
|
639
629
|
expect(result.consoleOutputs).toHaveLength(1);
|
|
@@ -5,7 +5,6 @@ import type * as Protocol from "@marimo-team/client/protocol";
|
|
|
5
5
|
import { createStore } from "jotai";
|
|
6
6
|
import { beforeEach, describe, expect, it } from "vitest";
|
|
7
7
|
import { MockNotebook } from "@/__mocks__/notebook";
|
|
8
|
-
import { notebookAtom } from "@/core/cells/cells";
|
|
9
8
|
import { type CellId, CellId as CellIdClass } from "@/core/cells/ids";
|
|
10
9
|
import { ErrorContextProvider } from "../error";
|
|
11
10
|
|
|
@@ -279,26 +278,16 @@ describe("ErrorContextProvider", () => {
|
|
|
279
278
|
|
|
280
279
|
it("includes console tracebacks for marimo error outputs", () => {
|
|
281
280
|
const cellId = CellIdClass.create();
|
|
282
|
-
|
|
281
|
+
createMockNotebookWithErrors([
|
|
283
282
|
{
|
|
284
283
|
cellId,
|
|
285
284
|
cellName: "Cell 1",
|
|
285
|
+
consoleTraceback:
|
|
286
|
+
'<pre>ValueError: boom\n File "notebook.py", line 1</pre>',
|
|
286
287
|
code: "raise ValueError('boom')",
|
|
287
288
|
error: { kind: "exception", name: "ValueError", message: "boom" },
|
|
288
289
|
},
|
|
289
290
|
]);
|
|
290
|
-
notebookState.cellRuntime[cellId] = {
|
|
291
|
-
...notebookState.cellRuntime[cellId],
|
|
292
|
-
consoleOutputs: [
|
|
293
|
-
{
|
|
294
|
-
channel: "stderr",
|
|
295
|
-
data: '<pre>ValueError: boom\n File "notebook.py", line 1</pre>',
|
|
296
|
-
mimetype: "application/vnd.marimo+traceback",
|
|
297
|
-
timestamp: Date.now(),
|
|
298
|
-
},
|
|
299
|
-
],
|
|
300
|
-
};
|
|
301
|
-
store.set(notebookAtom, notebookState);
|
|
302
291
|
|
|
303
292
|
const items = provider.getItems();
|
|
304
293
|
const context = provider.formatContext(items[1]);
|
|
@@ -310,10 +299,11 @@ describe("ErrorContextProvider", () => {
|
|
|
310
299
|
|
|
311
300
|
it("does not duplicate console traceback when error already has one", () => {
|
|
312
301
|
const cellId = CellIdClass.create();
|
|
313
|
-
|
|
302
|
+
createMockNotebookWithErrors([
|
|
314
303
|
{
|
|
315
304
|
cellId,
|
|
316
305
|
cellName: "Cell 1",
|
|
306
|
+
consoleTraceback: "<pre>console line 1</pre>",
|
|
317
307
|
code: "raise ValueError('boom')",
|
|
318
308
|
error: {
|
|
319
309
|
kind: "exception",
|
|
@@ -326,18 +316,6 @@ describe("ErrorContextProvider", () => {
|
|
|
326
316
|
},
|
|
327
317
|
},
|
|
328
318
|
]);
|
|
329
|
-
notebookState.cellRuntime[cellId] = {
|
|
330
|
-
...notebookState.cellRuntime[cellId],
|
|
331
|
-
consoleOutputs: [
|
|
332
|
-
{
|
|
333
|
-
channel: "stderr",
|
|
334
|
-
data: "<pre>console line 1</pre>",
|
|
335
|
-
mimetype: "application/vnd.marimo+traceback",
|
|
336
|
-
timestamp: Date.now(),
|
|
337
|
-
},
|
|
338
|
-
],
|
|
339
|
-
};
|
|
340
|
-
store.set(notebookAtom, notebookState);
|
|
341
319
|
|
|
342
320
|
const items = provider.getItems();
|
|
343
321
|
if (items[1].data.type !== "cell-error") {
|
|
@@ -356,23 +356,15 @@ export function getCellContextData(
|
|
|
356
356
|
cellId: CellId,
|
|
357
357
|
notebook: NotebookState,
|
|
358
358
|
output: CellOutput | null,
|
|
359
|
-
|
|
360
|
-
includeConsoleOutput: boolean;
|
|
361
|
-
},
|
|
359
|
+
rows?: readonly OutputMessage[],
|
|
362
360
|
): CellOutputData {
|
|
363
|
-
const { includeConsoleOutput = false } = opts || {};
|
|
364
|
-
const cellRuntime = notebook.cellRuntime[cellId];
|
|
365
|
-
|
|
366
361
|
const cellData = notebook.cellData[cellId];
|
|
367
362
|
const cellIndex = notebook.cellIds.indexOf(cellId);
|
|
368
363
|
const cellName = displayCellName(cellData.name, cellIndex);
|
|
369
364
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
.map((output) => getBaseOutput(output))
|
|
374
|
-
.filter((output) => output !== null);
|
|
375
|
-
}
|
|
365
|
+
const consoleOutputs = rows
|
|
366
|
+
?.map(getBaseOutput)
|
|
367
|
+
.filter((output) => output !== null);
|
|
376
368
|
|
|
377
369
|
let cellOutput: BaseOutput | undefined;
|
|
378
370
|
if (output !== null && !isOutputEmpty(output)) {
|