@marimo-team/frontend 0.25.2 → 0.25.3-dev10

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 (132) hide show
  1. package/dist/assets/{CellStatus-BP2mavAq.js → CellStatus-nZpuDkm7.js} +1 -1
  2. package/dist/assets/{ErrorBoundary-Gl5nCA8C.js → ErrorBoundary-B4n9EnHB.js} +2 -2
  3. package/dist/assets/JsonOutput-BxB0NL8w.js +11 -0
  4. package/dist/assets/MarimoErrorOutput-BTy4MOzX.js +10 -0
  5. package/dist/assets/{RenderHTML-BbOqmHy3.js → RenderHTML-9bMgbYmo.js} +1 -1
  6. package/dist/assets/{RunButton-CK3LhnP5.js → RunButton-CFQUNN5c.js} +1 -1
  7. package/dist/assets/{add-cell-with-ai-8UBC0xwR.js → add-cell-with-ai-f_MnLCwI.js} +9 -9
  8. package/dist/assets/{add-connection-dialog-DXQnd6eB.js → add-connection-dialog-CoE_PhuD.js} +1 -1
  9. package/dist/assets/{agent-panel-D7kMZLG-.js → agent-panel-BWZz24jK.js} +5 -5
  10. package/dist/assets/ai-model-dropdown-zm-2fXzf.js +13 -0
  11. package/dist/assets/{app-config-button-BKEG4x9u.js → app-config-button-BhU0ulYs.js} +1 -1
  12. package/dist/assets/{blob-D5nfNHOo.js → blob-iOBwGaP9.js} +1 -1
  13. package/dist/assets/{cell-editor-ADVfycpN.js → cell-editor-CAj1UKxx.js} +9 -9
  14. package/dist/assets/{cell-link-LSth_8hT.js → cell-link-1CynTVGQ.js} +1 -1
  15. package/dist/assets/{cells-BRkCaSsh.js → cells-rA_jsZCj.js} +1 -1
  16. package/dist/assets/{chat-display-Dnagy4Nv.js → chat-display-BmEPmhDP.js} +1 -1
  17. package/dist/assets/{chat-panel-DQ6HkWEF.js → chat-panel-Ce2Xh7dM.js} +2 -2
  18. package/dist/assets/{chat-ui-Df8Vcj6n.js → chat-ui-DTy98rP3.js} +1 -1
  19. package/dist/assets/{column-preview-Cm2D6vyX.js → column-preview-DU6dT80y.js} +1 -1
  20. package/dist/assets/{command-palette-DTSQ7gOC.js → command-palette-BMqFKXVr.js} +1 -1
  21. package/dist/assets/{common-Cu6CDbuw.js → common-lisZ0l6a.js} +1 -1
  22. package/dist/assets/{components-CGw16R_N.js → components-Dvd1GnD6.js} +1 -1
  23. package/dist/assets/config-DJLAC21v.js +1 -0
  24. package/dist/assets/{datasource-Cq6x_5ML.js → datasource-Dr1xNKUn.js} +1 -1
  25. package/dist/assets/{dates-BbFQ2oE4.js → dates-CfmdTL6B.js} +1 -1
  26. package/dist/assets/{dependency-graph-panel--Kgtktcw.js → dependency-graph-panel-B0uP-_id.js} +1 -1
  27. package/dist/assets/{documentation-panel-BHmbeznw.js → documentation-panel-DVl_ebWy.js} +1 -1
  28. package/dist/assets/{download-DCJXy66H.js → download-Bx55LMki.js} +1 -1
  29. package/dist/assets/edit-page-DlfCLUaq.js +9 -0
  30. package/dist/assets/{error-entries-Dk3VZ-OK.js → error-entries-DOWpdGvI.js} +1 -1
  31. package/dist/assets/{error-panel-BPRYmC5J.js → error-panel-DpbNKSLs.js} +1 -1
  32. package/dist/assets/{feedback-button-Bik2-e33.js → feedback-button-B99ThNJW.js} +1 -1
  33. package/dist/assets/feedback-button-DlqZkJwz.js +1 -0
  34. package/dist/assets/{file-explorer-panel-BEEK5lcl.js → file-explorer-panel-Bo9eN3rW.js} +1 -1
  35. package/dist/assets/{file-name-input-Cdc-TVqO.js → file-name-input-ChnBsDE_.js} +1 -1
  36. package/dist/assets/{floating-outline-XD9FAV-f.js → floating-outline-MYqQW4Vp.js} +1 -1
  37. package/dist/assets/{gallery-page-Dm6mGwBi.js → gallery-page-DSL0J4md.js} +1 -1
  38. package/dist/assets/{glide-data-editor-J9CAb70d.js → glide-data-editor-B1MWlKeM.js} +1 -1
  39. package/dist/assets/{home-page-DMHnsRxm.js → home-page-KrhQ55Vg.js} +1 -1
  40. package/dist/assets/{hooks-93IwHd2u.js → hooks-BIogTGCr.js} +1 -1
  41. package/dist/assets/index-6b4mf8Ai.css +2 -0
  42. package/dist/assets/{index-s-M1OXjs.js → index-B3fcrmuf.js} +8 -7
  43. package/dist/assets/{layout-DmcNEu3P.js → layout-DOpdUwym.js} +3 -3
  44. package/dist/assets/{logs-panel-ABM16htT.js → logs-panel-y0XnfulJ.js} +1 -1
  45. package/dist/assets/{markdown-renderer-BG3sp2rs.js → markdown-renderer-Q5AhbRU3.js} +1 -1
  46. package/dist/assets/{name-cell-input-BgEBmqyL.js → name-cell-input-BNOnF6-0.js} +1 -1
  47. package/dist/assets/{outline-panel-DCXQ3_F6.js → outline-panel-Be7stWwv.js} +1 -1
  48. package/dist/assets/{packages-panel-BMGOmZkR.js → packages-panel-ClxOAEGy.js} +1 -1
  49. package/dist/assets/{panel-accordion-state-C1sdPp0m.js → panel-accordion-state-GeMEdCPw.js} +1 -1
  50. package/dist/assets/panels-DfCmzLtT.js +4 -0
  51. package/dist/assets/{process-output-D0KGq04R.js → process-output-DNFKMODr.js} +1 -1
  52. package/dist/assets/{readonly-code-display-Do50PHI8.js → readonly-code-display-YULOXf4h.js} +1 -1
  53. package/dist/assets/{readonly-python-code-DCSMIsTX.js → readonly-python-code-CadgXgRu.js} +1 -1
  54. package/dist/assets/{reveal-component-ltaepAqw.js → reveal-component-BVAR7ayZ.js} +1 -1
  55. package/dist/assets/{run-page-DF3c5cDk.js → run-page-Cxu1yV8Q.js} +1 -1
  56. package/dist/assets/{runtime-details-state-CSPobEdR.js → runtime-details-state-DuChzsA6.js} +1 -1
  57. package/dist/assets/{scratchpad-panel-Dwd6W5PE.js → scratchpad-panel-By-ybhjg.js} +1 -1
  58. package/dist/assets/session-panel-BmW6PH4z.js +1 -0
  59. package/dist/assets/{snippets-panel-Bh1oTw4m.js → snippets-panel-CQ1dn3lA.js} +1 -1
  60. package/dist/assets/{state-XsPO8hNi.js → state-Bfh_2SLl.js} +1 -1
  61. package/dist/assets/state-z3dlofZB.js +3 -0
  62. package/dist/assets/{tracing-Di6pUmX8.js → tracing-BARlJ_Dk.js} +1 -1
  63. package/dist/assets/{tracing-panel-PeRXHD8_.js → tracing-panel-dgnr2fIN.js} +2 -2
  64. package/dist/assets/{tree-actions-GM5E_bUs.js → tree-actions-DAd80MbP.js} +1 -1
  65. package/dist/assets/{useAddCell-GR7eEQrT.js → useAddCell-DGstJK0S.js} +1 -1
  66. package/dist/assets/{useCellActionButton-B-9eG5z_.js → useCellActionButton-DY9RlJTb.js} +1 -1
  67. package/dist/assets/{useDeleteCell-2_bMClHd.js → useDeleteCell-DFBGlSQk.js} +1 -1
  68. package/dist/assets/{useDependencyPanelTab-k3C3M18S.js → useDependencyPanelTab-DydxsE5d.js} +1 -1
  69. package/dist/assets/{useNotebookActions-NHN6A-cN.js → useNotebookActions-DfvB7RD_.js} +1 -1
  70. package/dist/assets/{useRunCells-B2vUhREg.js → useRunCells-BFjFX3hz.js} +1 -1
  71. package/dist/assets/{useSplitCell-DEb03htp.js → useSplitCell-Tqv5pPtL.js} +1 -1
  72. package/dist/index.html +24 -25
  73. package/package.json +5 -2
  74. package/src/__tests__/fixtures/{pair-preview.ts → pair-config.ts} +3 -2
  75. package/src/__tests__/host-imports.test.ts +100 -0
  76. package/src/__tests__/mount.test.ts +8 -8
  77. package/src/components/data-table/__tests__/context-menu.test.ts +176 -0
  78. package/src/components/data-table/__tests__/date-filter-inputs.test.tsx +24 -1
  79. package/src/components/data-table/__tests__/export-actions.test.tsx +329 -6
  80. package/src/components/data-table/context-menu.tsx +125 -26
  81. package/src/components/data-table/date-filter-inputs.tsx +15 -42
  82. package/src/components/data-table/export-actions.tsx +192 -116
  83. package/src/components/data-table/schemas.ts +14 -36
  84. package/src/components/data-table/utils.ts +18 -0
  85. package/src/components/editor/Output.tsx +9 -2
  86. package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +80 -252
  87. package/src/components/editor/actions/__tests__/pair-with-agent-modal.test.tsx +186 -34
  88. package/src/components/editor/actions/pair-with-agent-commands.ts +42 -51
  89. package/src/components/editor/actions/pair-with-agent-modal.tsx +96 -36
  90. package/src/components/editor/chrome/panels/error-panel.tsx +1 -0
  91. package/src/components/editor/chrome/wrapper/__tests__/attachment-status.test.tsx +372 -0
  92. package/src/components/editor/chrome/wrapper/footer-item.tsx +32 -24
  93. package/src/components/editor/chrome/wrapper/footer-items/attachment-status.tsx +237 -0
  94. package/src/components/editor/chrome/wrapper/footer.tsx +2 -0
  95. package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +548 -0
  96. package/src/components/editor/errors/send-error-report-button.tsx +69 -0
  97. package/src/components/editor/output/MarimoErrorOutput.tsx +21 -5
  98. package/src/components/editor/output/MarimoTracebackOutput.tsx +35 -20
  99. package/src/components/editor/output/__tests__/ansi-reduce.test.ts +18 -0
  100. package/src/components/editor/output/ansi-reduce.ts +6 -0
  101. package/src/core/attachments/__tests__/toast.test.tsx +58 -0
  102. package/src/core/attachments/state.ts +21 -0
  103. package/src/core/attachments/toast.ts +15 -0
  104. package/src/core/cells/__tests__/cells.test.ts +52 -0
  105. package/src/core/cells/__tests__/error-report.test.ts +139 -0
  106. package/src/core/cells/__tests__/session.test.ts +50 -1
  107. package/src/core/cells/error-report.ts +63 -0
  108. package/src/core/cells/session.ts +28 -1
  109. package/src/core/config/pair.ts +5 -3
  110. package/src/core/host/AGENTS.md +6 -0
  111. package/src/core/host/__tests__/protocol.test.ts +214 -0
  112. package/src/core/host/protocol.ts +1943 -0
  113. package/src/core/islands/__tests__/bootstrap.test.ts +26 -0
  114. package/src/core/islands/bootstrap.ts +1 -0
  115. package/src/core/websocket/__tests__/useMarimoKernelConnection.hook.test.tsx +193 -0
  116. package/src/core/websocket/useMarimoKernelConnection.tsx +9 -0
  117. package/src/mount.tsx +3 -3
  118. package/src/plugins/impl/__tests__/DataTablePlugin.test.tsx +84 -0
  119. package/src/utils/__tests__/dates.test.ts +116 -0
  120. package/src/utils/dates.ts +94 -0
  121. package/dist/assets/JsonOutput-D6HIIsCb.js +0 -11
  122. package/dist/assets/MarimoErrorOutput-D60XkCny.js +0 -6
  123. package/dist/assets/ai-model-dropdown-B0z6-zhp.js +0 -5
  124. package/dist/assets/api-BeC_VSGv.js +0 -1
  125. package/dist/assets/config-BOKzA3tF.js +0 -1
  126. package/dist/assets/edit-page-ChcSgpke.js +0 -9
  127. package/dist/assets/feedback-button-B2gKC5cn.js +0 -1
  128. package/dist/assets/index-Bcdzex-3.css +0 -2
  129. package/dist/assets/pair-CaQyK6En.js +0 -1
  130. package/dist/assets/panels-CxVG8-v2.js +0 -4
  131. package/dist/assets/session-panel-VdDhEBa-.js +0 -1
  132. package/dist/assets/state-_Qai_QyX.js +0 -3
@@ -0,0 +1,6 @@
1
+ # Host core
2
+
3
+ Production code may import host modules, `jotai/vanilla`, `zod`, and
4
+ `@/utils/Logger`. Enforced by `marimo/host-imports`. Tests are exempt.
5
+
6
+ Define interfaces here and inject application behavior through adapters.
@@ -0,0 +1,214 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ import NodeFs from "node:fs";
4
+ import NodeUrl from "node:url";
5
+ import { describe, expect, expectTypeOf, it } from "vitest";
6
+ import * as Protocol from "../protocol";
7
+
8
+ const fixtures = new NodeUrl.URL(
9
+ "../../../../../protocols/host/fixtures/",
10
+ import.meta.url,
11
+ );
12
+
13
+ function readFixture(name: string): unknown {
14
+ return JSON.parse(
15
+ NodeFs.readFileSync(new NodeUrl.URL(name, fixtures), "utf8"),
16
+ );
17
+ }
18
+
19
+ const records = {
20
+ "record.json": Protocol.HostRecord,
21
+ "cell.json": Protocol.Cell,
22
+ "analysis.json": Protocol.Analysis,
23
+ "diagnostic.json": Protocol.Error,
24
+ "edit.json": Protocol.EditRequest,
25
+ "edit-conflict-request.json": Protocol.EditRequest,
26
+ "edit-response.json": Protocol.EditResponse,
27
+ "execution-restored.json": Protocol.Execution,
28
+ "run-cells-request.json": Protocol.RunRequest,
29
+ };
30
+
31
+ describe("host protocol fixtures", () => {
32
+ it.each(Object.entries(records))("parses %s unchanged", (name, schema) => {
33
+ const input = readFixture(name);
34
+ const original = structuredClone(input);
35
+ expect(schema.parse(input)).toEqual(original);
36
+ expect(input).toEqual(original);
37
+ });
38
+
39
+ it.each(NodeFs.readdirSync(new NodeUrl.URL("problems/", fixtures)))(
40
+ "parses problem %s",
41
+ (name) => {
42
+ const input = readFixture(`problems/${name}`);
43
+ expect(Protocol.Problem.parse(input)).toEqual(input);
44
+ },
45
+ );
46
+
47
+ it.each(NodeFs.readdirSync(fixtures).filter((name) => name.endsWith(".sse")))(
48
+ "parses events in %s unchanged",
49
+ (name) => {
50
+ const stream = NodeFs.readFileSync(
51
+ new NodeUrl.URL(name, fixtures),
52
+ "utf8",
53
+ );
54
+ let count = 0;
55
+ for (const frame of stream.split(/\r?\n\r?\n/)) {
56
+ const event = /^event: (.+)$/m.exec(frame)?.[1];
57
+ if (!event && !/^data:/m.test(frame)) {
58
+ continue;
59
+ }
60
+ const data = frame
61
+ .split(/\r?\n/)
62
+ .filter((line) => line.startsWith("data:"))
63
+ .map((line) => line.slice(5).trimStart())
64
+ .join("\n");
65
+ const id = /^id: (.+)$/m.exec(frame)?.[1];
66
+ const payload: unknown = JSON.parse(data);
67
+ const input = { event, data: payload, ...(id ? { id } : {}) };
68
+ const original = structuredClone(input);
69
+ expect(Protocol.Event.parse(input)).toEqual(original);
70
+ expect(input).toEqual(original);
71
+ count += 1;
72
+ }
73
+ expect(count).toBeGreaterThan(0);
74
+ },
75
+ );
76
+ });
77
+
78
+ describe("host protocol bindings", () => {
79
+ it("preserves native marimo payloads without interpreting them", () => {
80
+ expectTypeOf<Protocol.MarimoEvent["data"]["marimo"]>().toBeUnknown();
81
+ const input = {
82
+ event: "marimo",
83
+ id: "42",
84
+ data: {
85
+ marimo: {
86
+ future_payload: { value: Number.NaN },
87
+ },
88
+ },
89
+ };
90
+ expect(Protocol.Event.parse(input)).toEqual(input);
91
+ });
92
+
93
+ it("accepts additive fields and preserves arbitrary notebook settings", () => {
94
+ const cell = Protocol.Cell.parse(readFixture("cell.json"));
95
+ const input = {
96
+ ...cell,
97
+ future: { enabled: true },
98
+ config: { ...cell.config, future: 42 },
99
+ };
100
+ const original = structuredClone(input);
101
+ expect(Protocol.Cell.parse(input)).toEqual(cell);
102
+ expect(input).toEqual(original);
103
+
104
+ const { document } = Protocol.EditResponse.parse(
105
+ readFixture("edit-response.json"),
106
+ );
107
+ const configured = {
108
+ ...document,
109
+ app_config: { extension: { values: [1, null, false] } },
110
+ };
111
+ expect(Protocol.Document.parse(configured)).toEqual(configured);
112
+ });
113
+
114
+ it("applies the defaults declared for cell inputs", () => {
115
+ expect(
116
+ Protocol.CellInput.parse({ id: "c3", code: "x = 1", config: {} }),
117
+ ).toEqual({
118
+ id: "c3",
119
+ code: "x = 1",
120
+ name: "_",
121
+ config: {
122
+ column: null,
123
+ disabled: false,
124
+ hide_code: false,
125
+ expand_output: false,
126
+ },
127
+ });
128
+ });
129
+
130
+ it.each(["run_id", "runtime_id", "caused_by"] as const)(
131
+ "requires the nullable execution field %s",
132
+ (field) => {
133
+ const execution = Protocol.Execution.parse(
134
+ readFixture("execution-restored.json"),
135
+ );
136
+ const missing = Object.fromEntries(
137
+ Object.entries(execution).filter(([key]) => key !== field),
138
+ );
139
+ expect(Protocol.Execution.safeParse(missing).success).toBe(false);
140
+ expect(
141
+ Protocol.Execution.safeParse({ ...execution, [field]: null }).success,
142
+ ).toBe(true);
143
+ },
144
+ );
145
+
146
+ it("preserves snapshot metadata omissions and validates live timestamps", () => {
147
+ const cell = Protocol.Cell.parse(readFixture("cell.json"));
148
+ expect(Protocol.CellMessage.parse({ cell })).toEqual({ cell });
149
+ const message = { cell, time: "2026-01-01T12:00:00+05:30" };
150
+ expect(Protocol.CellMessage.parse(message)).toEqual(message);
151
+ for (const time of [
152
+ null,
153
+ "yesterday",
154
+ "2026-02-30T12:00:00Z",
155
+ "2026-01-01T12:00:00",
156
+ ]) {
157
+ expect(Protocol.CellMessage.safeParse({ cell, time }).success).toBe(
158
+ false,
159
+ );
160
+ }
161
+ });
162
+
163
+ it("rejects invalid cell fields without coercing their values", () => {
164
+ const cell = Protocol.Cell.parse(readFixture("cell.json"));
165
+ for (const patch of [
166
+ { id: "" },
167
+ { code: 42 },
168
+ { etag: 42 },
169
+ { version: "2" },
170
+ { version: 0 },
171
+ { version: 1.5 },
172
+ { config: { ...cell.config, disabled: "false" } },
173
+ ]) {
174
+ expect(Protocol.Cell.safeParse({ ...cell, ...patch }).success).toBe(
175
+ false,
176
+ );
177
+ }
178
+ const result = Protocol.Cell.safeParse({ ...cell, code: 42 });
179
+ expect(result.success).toBe(false);
180
+ if (result.success) {
181
+ throw new Error("Expected an invalid cell");
182
+ }
183
+ expect(result.error.issues).toEqual([
184
+ expect.objectContaining({ path: ["code"], code: "invalid_type" }),
185
+ ]);
186
+ });
187
+
188
+ it("requires the fields of the selected change kind", () => {
189
+ const change = { kind: "delete_cell", id: "c3", base_etag: "*" };
190
+ expect(Protocol.Change.parse(change)).toEqual(change);
191
+ expect(
192
+ Protocol.Change.safeParse({ kind: "delete_cell", id: "c3" }).success,
193
+ ).toBe(false);
194
+ expect(
195
+ Protocol.Change.safeParse({ ...change, kind: "unknown" }).success,
196
+ ).toBe(false);
197
+ });
198
+
199
+ it("requires custom payloads while allowing any JSON value", () => {
200
+ for (const data of [
201
+ null,
202
+ false,
203
+ 42,
204
+ "text",
205
+ { nested: [1, null, false] },
206
+ ]) {
207
+ const custom = { type: "example.event", data };
208
+ expect(Protocol.Custom.parse(custom)).toEqual(custom);
209
+ }
210
+ expect(Protocol.Custom.safeParse({ type: "example.event" }).success).toBe(
211
+ false,
212
+ );
213
+ });
214
+ });