@marimo-team/islands 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 (105) hide show
  1. package/dist/{ConnectedDataExplorerComponent-CNSxdKyJ.js → ConnectedDataExplorerComponent-CNMliVzw.js} +1 -1
  2. package/dist/{ErrorBoundary-HusVNio-.js → ErrorBoundary-BsqSMK9Y.js} +1 -1
  3. package/dist/{abnfDiagram-VCTEODGH-DQDjNXt3.js → abnfDiagram-VCTEODGH-D-Ez91gV.js} +2 -2
  4. package/dist/{any-language-editor-B9REGlD9.js → any-language-editor-DZ_YTVus.js} +1 -1
  5. package/dist/{architectureDiagram-5GKGNRK7-Nmls7Wxn.js → architectureDiagram-5GKGNRK7-CTpcNtO8.js} +1 -1
  6. package/dist/{chat-ui-BDpymeoe.js → chat-ui-0lKdOoQ3.js} +436 -437
  7. package/dist/{chunk-IMKFNOWR-CoIFEo-1.js → chunk-IMKFNOWR-DGxi-zeo.js} +1 -1
  8. package/dist/{chunk-SHT3W25Y-lHiGx3ZC.js → chunk-SHT3W25Y-CV9J3rAB.js} +1 -1
  9. package/dist/{chunk-SVP7TREG-BvsHIrY_.js → chunk-SVP7TREG-BL-9Fqgg.js} +1 -1
  10. package/dist/{chunk-TICWLB2K-BC8YIm_n.js → chunk-TICWLB2K-Cu_XMjDM.js} +1 -1
  11. package/dist/{classDiagram-ZZMXUADV-Bt98lkkv.js → classDiagram-ZZMXUADV-BXXV13Hq.js} +2 -2
  12. package/dist/{classDiagram-v2-VYDZK3BY-D9bfbcC3.js → classDiagram-v2-VYDZK3BY-B7FXJ1Cp.js} +2 -2
  13. package/dist/{code-visibility-4aW5326K.js → code-visibility-CXQvUXHT.js} +14 -14
  14. package/dist/{common-Cjo7bjRK.js → common-CuD-CAC-.js} +6704 -6409
  15. package/dist/{cynefinDiagram-5FMLGOSQ-CgWra7wt.js → cynefinDiagram-5FMLGOSQ-CH96rwba.js} +1 -1
  16. package/dist/{dagre-GXQ25YYZ-CFZ8-35c.js → dagre-GXQ25YYZ-BD3PmpFY.js} +1 -1
  17. package/dist/{data-grid-overlay-editor-CvdQXfSk.js → data-grid-overlay-editor-DgeyYmC1.js} +1 -1
  18. package/dist/{diagram-S7CK7UJ4-lCNQrW7d.js → diagram-S7CK7UJ4-BsSJJldB.js} +1 -1
  19. package/dist/{diagram-UQ7AKVKN-CQPQ6pP_.js → diagram-UQ7AKVKN-muQtNZc4.js} +1 -1
  20. package/dist/{diagram-VX7I27RA-Cf3b0llz.js → diagram-VX7I27RA-CdhuZAqR.js} +1 -1
  21. package/dist/{diagram-Z3DM3KII-Bt4QLrpn.js → diagram-Z3DM3KII-BD8mXjOj.js} +1 -1
  22. package/dist/{ebnfDiagram-PWID7BFC-D3NAyPFY.js → ebnfDiagram-PWID7BFC-BIN1sweE.js} +2 -2
  23. package/dist/{erDiagram-RLTQ6QDP-Tlu09_Nm.js → erDiagram-RLTQ6QDP-Ctp5cfoN.js} +1 -1
  24. package/dist/{error-banner-Da600cwz.js → error-banner-D-WCIiMt.js} +10 -5
  25. package/dist/{cells-C8iCYvLU.js → error-entries-DSvFWT_M.js} +2262 -2206
  26. package/dist/{feedback-button-ZuLnINhC.js → feedback-button-DZMj9PF3.js} +115 -116
  27. package/dist/{flowDiagram-HODETNUW-CAYbpJmV.js → flowDiagram-HODETNUW-3EfLrlFb.js} +2 -2
  28. package/dist/{formats-BGh2thRc.js → formats-CeOmU1MU.js} +1 -1
  29. package/dist/{glide-data-editor-qM9FSJA9.js → glide-data-editor-g_L8FLAC.js} +3 -3
  30. package/dist/{globals-Ci7B9t6C.js → globals-CYGlmBXb.js} +1 -1
  31. package/dist/{html-to-image-CZY1pIZH.js → html-to-image-B8s5SgGm.js} +23 -23
  32. package/dist/{infoDiagram-27XIBGKW-XrDxhr0x.js → infoDiagram-27XIBGKW-DipQoHxl.js} +1 -1
  33. package/dist/{ishikawaDiagram-5VMMS53U-CD1muzov.js → ishikawaDiagram-5VMMS53U-DgFMjSGz.js} +1 -1
  34. package/dist/{kanban-definition-UXKFOSKX-Dg9W142_.js → kanban-definition-UXKFOSKX-w1ACVjgl.js} +1 -1
  35. package/dist/main.js +164 -163
  36. package/dist/{mermaid-CiAXjLpA.js → mermaid-CHo49Yv-.js} +33 -33
  37. package/dist/{mindmap-definition-YA3MSWOX-DgCidgYJ.js → mindmap-definition-YA3MSWOX-CrT0KSfX.js} +1 -1
  38. package/dist/{number-overlay-editor-DunDxAzh.js → number-overlay-editor-9VRv-pdj.js} +1 -1
  39. package/dist/{pegDiagram-XKGWAZYB-coOYYKB6.js → pegDiagram-XKGWAZYB-BqvywNJA.js} +2 -2
  40. package/dist/{pieDiagram-E7YTZNPT-BnXTc3bj.js → pieDiagram-E7YTZNPT-BfxJ_XCc.js} +1 -1
  41. package/dist/{process-output-e4jj9Ijt.js → process-output-CKRXyszb.js} +3 -3
  42. package/dist/{railroadDiagram-O6MQD6OU-B28-u83n.js → railroadDiagram-O6MQD6OU-8vFLVTPu.js} +2 -2
  43. package/dist/{requirementDiagram-BXWQKSXE-CdYCTMu0.js → requirementDiagram-BXWQKSXE-a_MxGvxe.js} +1 -1
  44. package/dist/{reveal-component-A7HedxmE.js → reveal-component-C87mv9Mn.js} +4 -4
  45. package/dist/{sequenceDiagram-WJ2MYXX4-CM3aRAe_.js → sequenceDiagram-WJ2MYXX4-CXFMnxGh.js} +1 -1
  46. package/dist/{stateDiagram-D77RDMKH-DOZUMVj8.js → stateDiagram-D77RDMKH-DQeA_CwI.js} +2 -2
  47. package/dist/{stateDiagram-v2-MP3YSRHH-CISYxma6.js → stateDiagram-v2-MP3YSRHH-BxxQucm1.js} +2 -2
  48. package/dist/style.css +1 -1
  49. package/dist/{swimlanes-42K2YHIH-BkSppxp8.js → swimlanes-42K2YHIH-Do6L-cYg.js} +1 -1
  50. package/dist/{swimlanesDiagram-VR7AAH4N-c8G5pGxC.js → swimlanesDiagram-VR7AAH4N-DUzPvSVU.js} +2 -2
  51. package/dist/{timeline-definition-24CTP7MA-CaMQayqK.js → timeline-definition-24CTP7MA-D3c46WM5.js} +1 -1
  52. package/dist/{toDate-BNJf01u1.js → toDate-vIXljnsr.js} +39 -38
  53. package/dist/{vega-component-DG29TAB7.js → vega-component-DTG6zxaY.js} +3 -3
  54. package/dist/{vennDiagram-4TSXK5OY-CF8pfaK3.js → vennDiagram-4TSXK5OY-BSZD8JcZ.js} +1 -1
  55. package/dist/{wardleyDiagram-VM6X3IG4-dGPu39d-.js → wardleyDiagram-VM6X3IG4-48cUWkfA.js} +1 -1
  56. package/dist/{xychartDiagram-S5SC5T6Z-CP6-9q56.js → xychartDiagram-S5SC5T6Z-CswYgYeu.js} +1 -1
  57. package/package.json +5 -2
  58. package/src/__tests__/fixtures/{pair-preview.ts → pair-config.ts} +3 -2
  59. package/src/__tests__/host-imports.test.ts +100 -0
  60. package/src/__tests__/mount.test.ts +8 -8
  61. package/src/components/data-table/__tests__/context-menu.test.ts +176 -0
  62. package/src/components/data-table/__tests__/date-filter-inputs.test.tsx +24 -1
  63. package/src/components/data-table/__tests__/export-actions.test.tsx +329 -6
  64. package/src/components/data-table/context-menu.tsx +125 -26
  65. package/src/components/data-table/date-filter-inputs.tsx +15 -42
  66. package/src/components/data-table/export-actions.tsx +192 -116
  67. package/src/components/data-table/schemas.ts +14 -36
  68. package/src/components/data-table/utils.ts +18 -0
  69. package/src/components/editor/Output.tsx +9 -2
  70. package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +80 -252
  71. package/src/components/editor/actions/__tests__/pair-with-agent-modal.test.tsx +186 -34
  72. package/src/components/editor/actions/pair-with-agent-commands.ts +42 -51
  73. package/src/components/editor/actions/pair-with-agent-modal.tsx +96 -36
  74. package/src/components/editor/chrome/panels/error-panel.tsx +1 -0
  75. package/src/components/editor/chrome/wrapper/__tests__/attachment-status.test.tsx +372 -0
  76. package/src/components/editor/chrome/wrapper/footer-item.tsx +32 -24
  77. package/src/components/editor/chrome/wrapper/footer-items/attachment-status.tsx +237 -0
  78. package/src/components/editor/chrome/wrapper/footer.tsx +2 -0
  79. package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +548 -0
  80. package/src/components/editor/errors/send-error-report-button.tsx +69 -0
  81. package/src/components/editor/output/MarimoErrorOutput.tsx +21 -5
  82. package/src/components/editor/output/MarimoTracebackOutput.tsx +35 -20
  83. package/src/components/editor/output/__tests__/ansi-reduce.test.ts +18 -0
  84. package/src/components/editor/output/ansi-reduce.ts +6 -0
  85. package/src/core/attachments/__tests__/toast.test.tsx +58 -0
  86. package/src/core/attachments/state.ts +21 -0
  87. package/src/core/attachments/toast.ts +15 -0
  88. package/src/core/cells/__tests__/cells.test.ts +52 -0
  89. package/src/core/cells/__tests__/error-report.test.ts +139 -0
  90. package/src/core/cells/__tests__/session.test.ts +50 -1
  91. package/src/core/cells/error-report.ts +63 -0
  92. package/src/core/cells/session.ts +28 -1
  93. package/src/core/config/pair.ts +5 -3
  94. package/src/core/host/AGENTS.md +6 -0
  95. package/src/core/host/__tests__/protocol.test.ts +214 -0
  96. package/src/core/host/protocol.ts +1943 -0
  97. package/src/core/islands/__tests__/bootstrap.test.ts +26 -0
  98. package/src/core/islands/bootstrap.ts +1 -0
  99. package/src/core/websocket/__tests__/useMarimoKernelConnection.hook.test.tsx +193 -0
  100. package/src/core/websocket/useMarimoKernelConnection.tsx +9 -0
  101. package/src/mount.tsx +3 -3
  102. package/src/plugins/impl/__tests__/DataTablePlugin.test.tsx +84 -0
  103. package/src/utils/__tests__/dates.test.ts +116 -0
  104. package/src/utils/dates.ts +94 -0
  105. package/dist/error-entries-CzoYkIQZ.js +0 -56
@@ -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
+ });