@marimo-team/islands 0.25.3-dev446 → 0.25.3-dev453

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 (88) hide show
  1. package/dist/{ErrorBoundary-CBvdOZsh.js → ErrorBoundary-CIYMOu2p.js} +1 -1
  2. package/dist/assets/__vite-browser-external-D2z_TiUO.js +1 -0
  3. package/dist/assets/{worker-BUqfWMtI.js → worker-DLJ9P24O.js} +2 -2
  4. package/dist/{chat-ui-9oyUBL6M.js → chat-ui-DEHpKH2l.js} +17 -19
  5. package/dist/{code-visibility-BVsBD2bm.js → code-visibility-BQE60zOk.js} +7 -7
  6. package/dist/{common-Cz5kXzjw.js → common-DfUux6zJ.js} +4902 -4893
  7. package/dist/{data-grid-overlay-editor-B-PHwg_F.js → data-grid-overlay-editor-B9zW4oN1.js} +1 -1
  8. package/dist/{error-entries-CWdDf7iZ.js → error-entries-BG7ifiDg.js} +1368 -996
  9. package/dist/{feedback-button-DKfgWMh1.js → feedback-button-BEUh4iQQ.js} +129 -129
  10. package/dist/{glide-data-editor-BMrcgCud.js → glide-data-editor-CbdIXPTZ.js} +3 -3
  11. package/dist/{globals-vjja83iL.js → globals-BkxG-Y8L.js} +1 -1
  12. package/dist/{html-to-image-CexRSGAZ.js → html-to-image-9HLBGrIx.js} +4115 -4103
  13. package/dist/main.js +6562 -6671
  14. package/dist/{number-overlay-editor-CQvIdVeX.js → number-overlay-editor-BFzdth50.js} +1 -1
  15. package/dist/{process-output-hcyVRJCC.js → process-output-B8HPq5iZ.js} +2 -2
  16. package/dist/{reveal-component-DF7VRfN2.js → reveal-component-DK_-9fAX.js} +166 -167
  17. package/package.json +1 -1
  18. package/src/__mocks__/executions.ts +7 -4
  19. package/src/__mocks__/notebook.ts +20 -4
  20. package/src/components/editor/cell/DeleteButton.tsx +2 -2
  21. package/src/components/editor/cell/StopButton.tsx +2 -2
  22. package/src/components/editor/cell/useRunCells.ts +0 -3
  23. package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +1 -1
  24. package/src/components/editor/notebook-cell.tsx +4 -35
  25. package/src/components/editor/output/ansi-reduce.ts +124 -61
  26. package/src/components/editor/output/console/ConsoleOutput.tsx +7 -25
  27. package/src/components/editor/output/console/__tests__/ConsoleOutput.test.tsx +15 -44
  28. package/src/components/editor/renderers/cells-renderer.tsx +2 -5
  29. package/src/components/editor/renderers/grid-layout/__tests__/grid-layout.test.tsx +1 -1
  30. package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +3 -6
  31. package/src/components/editor/stdin-blocking-alert.tsx +14 -18
  32. package/src/components/scratchpad/scratchpad.test.tsx +1 -1
  33. package/src/components/scratchpad/scratchpad.tsx +5 -6
  34. package/src/components/slides/__tests__/cell-output-block.test.tsx +2 -2
  35. package/src/components/slides/__tests__/slide-cell-view.test.tsx +2 -2
  36. package/src/components/tracing/tracing-spec.ts +11 -1
  37. package/src/components/tracing/tracing.tsx +4 -0
  38. package/src/core/ai/context/providers/__tests__/cell-output.test.ts +10 -20
  39. package/src/core/ai/context/providers/__tests__/error.test.ts +5 -27
  40. package/src/core/ai/context/providers/cell-output.ts +4 -12
  41. package/src/core/cells/__tests__/cell.test.ts +1 -169
  42. package/src/core/cells/__tests__/cells.test.ts +32 -709
  43. package/src/core/cells/__tests__/clear-outputs.test.ts +21 -14
  44. package/src/core/cells/__tests__/collapseConsoleOutputs.test.ts +71 -2
  45. package/src/core/cells/__tests__/logs.test.ts +18 -29
  46. package/src/core/cells/__tests__/runs.test.ts +128 -431
  47. package/src/core/cells/__tests__/session.test.ts +9 -9
  48. package/src/core/cells/actions.ts +29 -7
  49. package/src/core/cells/cell.ts +1 -96
  50. package/src/core/cells/cells.ts +147 -117
  51. package/src/core/cells/collapseConsoleOutputs.tsx +71 -40
  52. package/src/core/cells/command-console.ts +46 -0
  53. package/src/core/cells/execution-console.ts +230 -0
  54. package/src/core/cells/focus.ts +9 -29
  55. package/src/core/cells/logs.ts +10 -2
  56. package/src/core/cells/runs.ts +62 -118
  57. package/src/core/cells/session.ts +2 -2
  58. package/src/core/cells/types.ts +30 -23
  59. package/src/core/cells/useAnswerPrompt.ts +29 -0
  60. package/src/core/errors/error-entries.ts +3 -4
  61. package/src/core/executions/__tests__/atoms.test.ts +6 -20
  62. package/src/core/executions/__tests__/input.test.ts +3 -3
  63. package/src/core/executions/__tests__/output-lifecycle.test.ts +2 -8
  64. package/src/core/executions/atoms.ts +2 -21
  65. package/src/core/executions/index.ts +2 -1
  66. package/src/core/executions/input.ts +4 -3
  67. package/src/core/executions/output.ts +3 -3
  68. package/src/core/islands/__tests__/bridge.test.ts +59 -0
  69. package/src/core/islands/bootstrap.ts +29 -12
  70. package/src/core/islands/bridge.ts +67 -13
  71. package/src/core/kernel/handlers.ts +2 -21
  72. package/src/core/kernel/messages.ts +0 -1
  73. package/src/core/network/types.ts +0 -1
  74. package/src/core/notebook/document/__tests__/codemirror.test.ts +1 -0
  75. package/src/core/notebook/replica/__tests__/executions.test.ts +1 -0
  76. package/src/core/notebook/replica/__tests__/replica.test.ts +113 -0
  77. package/src/core/notebook/replica/replica.ts +106 -12
  78. package/src/core/notebook/replica/resources/executions.ts +57 -4
  79. package/src/core/session/__tests__/backend.test.ts +2 -4
  80. package/src/core/session/__tests__/useNotebookReplica.hook.test.tsx +1 -0
  81. package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +601 -35
  82. package/src/core/session/useNotebookReplica.ts +20 -6
  83. package/src/core/session/useNotebookSession.tsx +63 -33
  84. package/src/core/static/virtual-file-tracker.ts +26 -8
  85. package/src/stories/layout/vertical/one-column.stories.tsx +18 -12
  86. package/dist/assets/__vite-browser-external-CpRgw4M_.js +0 -1
  87. package/src/components/editor/alerts/stdin-blocking-alert.tsx +0 -68
  88. package/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap +0 -703
@@ -1,15 +1,7 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
  import { describe, expect, it } from "vitest";
3
3
  import type { CellExecutionView, CellFreshness } from "@/core/executions";
4
- import type { CellMessage, OutputMessage } from "@/core/kernel/messages";
5
- import type { Seconds } from "@/utils/time";
6
- import {
7
- consoleOutputIsStale,
8
- outputIsLoading,
9
- outputIsStale,
10
- transitionCell,
11
- } from "../cell";
12
- import { createCellRuntimeState } from "../types";
4
+ import { consoleOutputIsStale, outputIsLoading, outputIsStale } from "../cell";
13
5
 
14
6
  const CURRENT: CellFreshness = { sourceChanged: false, inputsChanged: false };
15
7
  const EDITED: CellFreshness = { sourceChanged: true, inputsChanged: false };
@@ -113,163 +105,3 @@ describe("consoleOutputIsStale", () => {
113
105
  ).toBe(false);
114
106
  });
115
107
  });
116
-
117
- describe("transitionCell serialization", () => {
118
- function cellMessage(serialization?: string | null): CellMessage {
119
- return {
120
- cell_id: "cell-1",
121
- ...(serialization === undefined ? {} : { serialization }),
122
- } as CellMessage;
123
- }
124
-
125
- it("leaves the hint unchanged when serialization is omitted", () => {
126
- const cell = createCellRuntimeState({ serialization: "Valid" });
127
- expect(transitionCell(cell, cellMessage()).serialization).toBe("Valid");
128
- });
129
-
130
- it("clears the hint when serialization is null", () => {
131
- const cell = createCellRuntimeState({ serialization: "Valid" });
132
- expect(transitionCell(cell, cellMessage(null)).serialization).toBeNull();
133
- });
134
-
135
- it("sets the hint when serialization is a string", () => {
136
- const cell = createCellRuntimeState();
137
- expect(transitionCell(cell, cellMessage("Valid")).serialization).toBe(
138
- "Valid",
139
- );
140
- });
141
- });
142
-
143
- describe("transitionCell console output ids", () => {
144
- const output = (
145
- data: string,
146
- channel: OutputMessage["channel"] = "stdout",
147
- ): OutputMessage => ({
148
- channel,
149
- mimetype: "text/plain",
150
- data,
151
- timestamp: 0,
152
- });
153
-
154
- it("assigns increasing ids to appended outputs", () => {
155
- let cell = createCellRuntimeState();
156
- cell = transitionCell(cell, { console: output("a") } as CellMessage);
157
- cell = transitionCell(cell, {
158
- console: output("b", "stderr"),
159
- } as CellMessage);
160
- expect(cell.consoleOutputs.map((o) => o.id)).toEqual([1, 2]);
161
- });
162
-
163
- it("continues from the surviving maximum after a collapse", () => {
164
- let cell = createCellRuntimeState();
165
- cell = transitionCell(cell, { console: output("a") } as CellMessage);
166
- cell = transitionCell(cell, { console: output("b") } as CellMessage);
167
- expect(cell.consoleOutputs.map((o) => o.id)).toEqual([1]);
168
- cell = transitionCell(cell, {
169
- console: output("c", "stderr"),
170
- } as CellMessage);
171
- expect(cell.consoleOutputs.map((o) => o.id)).toEqual([1, 2]);
172
- });
173
-
174
- it("assigns ids when the kernel replaces the whole console", () => {
175
- const cell = transitionCell(createCellRuntimeState(), {
176
- console: [output("a"), output("b", "stderr")],
177
- } as CellMessage);
178
- expect(cell.consoleOutputs.map((o) => o.id)).toEqual([1, 2]);
179
- });
180
- });
181
-
182
- describe("transitionCell stdin resolution", () => {
183
- describe.each([
184
- {
185
- name: "interrupted",
186
- message: {
187
- output: {
188
- channel: "marimo-error",
189
- mimetype: "application/vnd.marimo+error",
190
- data: [{ type: "interruption" }],
191
- timestamp: 1,
192
- },
193
- } as CellMessage,
194
- },
195
- {
196
- name: "idle",
197
- message: { status: "idle" } as CellMessage,
198
- },
199
- ])("when $name", ({ message }) => {
200
- it.each(["text/plain", "text/password"] as const)(
201
- "preserves a processed %s prompt",
202
- (mimetype) => {
203
- const prompt: OutputMessage = {
204
- channel: "stdin",
205
- mimetype,
206
- data: "Enter a value: ",
207
- timestamp: 0,
208
- };
209
- const waiting = transitionCell(createCellRuntimeState(), {
210
- console: prompt,
211
- } as CellMessage);
212
- const resolved = transitionCell(waiting, message);
213
-
214
- expect(resolved.consoleOutputs[0]).toMatchObject({
215
- ...prompt,
216
- response: "",
217
- });
218
- },
219
- );
220
-
221
- it.each(["text/plain", "text/password"] as const)(
222
- "preserves an existing %s response",
223
- (mimetype) => {
224
- const prompt = {
225
- channel: "stdin" as const,
226
- mimetype,
227
- data: "Enter a value: ",
228
- timestamp: 0,
229
- response: "submitted value",
230
- };
231
- const answered = createCellRuntimeState({
232
- consoleOutputs: [prompt],
233
- });
234
- const resolved = transitionCell(answered, message);
235
-
236
- expect(resolved.consoleOutputs).toEqual([prompt]);
237
- },
238
- );
239
- });
240
-
241
- function stdinOutput(): OutputMessage {
242
- return {
243
- channel: "stdin",
244
- mimetype: "text/plain",
245
- data: "(Pdb) ",
246
- timestamp: Date.now() as Seconds,
247
- } as OutputMessage;
248
- }
249
-
250
- it("resolves a dangling pdb prompt when the cell goes idle", () => {
251
- // A paused-pdb cell shows an unanswered stdin prompt (the debugger box);
252
- // once it finishes (e.g. after quitting with `q`), the box is removed.
253
- const cell = createCellRuntimeState({
254
- debuggerActive: true,
255
- consoleOutputs: [stdinOutput()],
256
- });
257
- const next = transitionCell(cell, {
258
- cell_id: "cell-1",
259
- status: "idle",
260
- } as CellMessage);
261
- expect(next.debuggerActive).toBe(false);
262
- expect(next.consoleOutputs[0].response).toBe("");
263
- });
264
-
265
- it("leaves an unanswered prompt interactive while still running", () => {
266
- const cell = createCellRuntimeState({
267
- consoleOutputs: [stdinOutput()],
268
- });
269
- const next = transitionCell(cell, {
270
- cell_id: "cell-1",
271
- status: null,
272
- } as CellMessage);
273
- expect(next.consoleOutputs[0].response).toBeUndefined();
274
- });
275
- });