@marimo-team/islands 0.26.1-dev20 → 0.26.1-dev25
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-CR9WyiEc.js → ConnectedDataExplorerComponent-jtTaDisw.js} +16 -16
- package/dist/{ErrorBoundary-Cx-CwafE.js → ErrorBoundary-Bs2ehxEI.js} +6 -6
- package/dist/{abnfDiagram-VCTEODGH-DGAbsdXT.js → abnfDiagram-VCTEODGH-cUj3Gnnh.js} +2 -2
- package/dist/{any-language-editor-DzGF1ll-.js → any-language-editor-BHgkY7jY.js} +2 -2
- package/dist/{architectureDiagram-5GKGNRK7-D4DnIo7R.js → architectureDiagram-5GKGNRK7-CIAZgn9d.js} +1 -1
- package/dist/{assertNever-CqwxSD_2.js → assertNever-BHnIohkX.js} +13 -13
- package/dist/{chat-ui-qZdDDrzU.js → chat-ui-DOvIzlMA.js} +46 -46
- package/dist/{check-D9vf6LYF.js → check-LtjuWmNn.js} +1 -1
- package/dist/{chunk-IMKFNOWR-Bc_i6jWx.js → chunk-IMKFNOWR-CB9N3qYR.js} +1 -1
- package/dist/{chunk-SHT3W25Y-CGML5pnF.js → chunk-SHT3W25Y-D9njV7TI.js} +1 -1
- package/dist/{chunk-SVP7TREG-ZpeFKfFT.js → chunk-SVP7TREG-CUCE0BFm.js} +1 -1
- package/dist/{chunk-TICWLB2K-C6cLmcg8.js → chunk-TICWLB2K-iQB6ttkI.js} +1 -1
- package/dist/{classDiagram-ZZMXUADV--q40NTXr.js → classDiagram-ZZMXUADV-BI1VBNIo.js} +2 -2
- package/dist/{classDiagram-v2-VYDZK3BY-Dt_Pp94L.js → classDiagram-v2-VYDZK3BY-BYL3asWh.js} +2 -2
- package/dist/{code-visibility-CVfXV6fG.js → code-visibility-BnMkbydx.js} +19 -19
- package/dist/{common-BXRJCkJO.js → common-CQur5dRA.js} +156 -156
- package/dist/{config-B8JCQMby.js → config-DL9e-OWE.js} +3 -3
- package/dist/{copy-icon-BLig0ZKb.js → copy-icon-rYV2znAe.js} +2 -2
- package/dist/{createReducer-BIUQ3TbG.js → createReducer-BdiSrxHu.js} +5 -5
- package/dist/{cynefinDiagram-5FMLGOSQ-2FtF_-cc.js → cynefinDiagram-5FMLGOSQ-DpGtYvnZ.js} +1 -1
- package/dist/{dagre-GXQ25YYZ-Cymu2SPS.js → dagre-GXQ25YYZ-B5GDC2kN.js} +1 -1
- package/dist/{data-grid-overlay-editor-Mbtx3F9C.js → data-grid-overlay-editor-BXEY35Xl.js} +1 -1
- package/dist/{diagram-S7CK7UJ4-OwDa8kAa.js → diagram-S7CK7UJ4-B2T25t1t.js} +1 -1
- package/dist/{diagram-UQ7AKVKN-CzRDwZwd.js → diagram-UQ7AKVKN-Dy3B5L_z.js} +1 -1
- package/dist/{diagram-VX7I27RA-XRIcgMDs.js → diagram-VX7I27RA-tOptWvNh.js} +1 -1
- package/dist/{diagram-Z3DM3KII-DdRDYAs6.js → diagram-Z3DM3KII-DsgZAokO.js} +1 -1
- package/dist/{dialog-DGh2HNAO.js → dialog-vs6x3On9.js} +19 -19
- package/dist/{dropdown-menu-ChH3oiqI.js → dropdown-menu-DYN2RV5d.js} +193 -193
- package/dist/{ebnfDiagram-PWID7BFC-CZMNMGNP.js → ebnfDiagram-PWID7BFC-CGWECzS1.js} +2 -2
- package/dist/{erDiagram-RLTQ6QDP-ByxHAN4b.js → erDiagram-RLTQ6QDP-CZLi87y3.js} +1 -1
- package/dist/{error-banner-BvRaQnGH.js → error-banner-D-AC7pQx.js} +70 -70
- package/dist/{error-entries-DhI0hGvj.js → error-entries-CncQR572.js} +443 -436
- package/dist/{feedback-button-zx4NcNDn.js → feedback-button-BAOp7zqu.js} +120 -120
- package/dist/{flowDiagram-HODETNUW-BQpzWx5O.js → flowDiagram-HODETNUW-CS86WYbX.js} +2 -2
- package/dist/{formats-BxP8k8Un.js → formats-BUFLQJXY.js} +1 -1
- package/dist/{glide-data-editor-CvezoJKg.js → glide-data-editor-Ce94qTW7.js} +11 -11
- package/dist/{glide-utils-bKdvDwwo.js → glide-utils-CZ-O-CB_.js} +2 -2
- package/dist/{globals-CQuPaxzy.js → globals-Uqg4j5z5.js} +3 -3
- package/dist/{html-to-image-B803aaWE.js → html-to-image-BU7H-AM1.js} +4323 -4318
- package/dist/{infoDiagram-27XIBGKW-C9EWHkak.js → infoDiagram-27XIBGKW-C9JBFfpC.js} +1 -1
- package/dist/{ishikawaDiagram-5VMMS53U-D67SGFvp.js → ishikawaDiagram-5VMMS53U-Eh3iuw2D.js} +1 -1
- package/dist/{kanban-definition-UXKFOSKX-CTMTiazR.js → kanban-definition-UXKFOSKX-DYtuVwYD.js} +1 -1
- package/dist/main.js +401 -400
- package/dist/{mermaid-DE_tvTGF.js → mermaid--k1o49nH.js} +34 -34
- package/dist/{mindmap-definition-YA3MSWOX-LzNgDy8O.js → mindmap-definition-YA3MSWOX-Dn1Cnqys.js} +1 -1
- package/dist/{number-overlay-editor-DxM7vsCk.js → number-overlay-editor-Br_Vp3Ws.js} +1 -1
- package/dist/{pegDiagram-XKGWAZYB-DFMS6feI.js → pegDiagram-XKGWAZYB-DiY7rITR.js} +2 -2
- package/dist/{pencil-CHkdsX07.js → pencil-AWgwbH4D.js} +1 -1
- package/dist/{pieDiagram-E7YTZNPT-C0MSBop-.js → pieDiagram-E7YTZNPT-BL6InbDs.js} +1 -1
- package/dist/{process-output-CnCLfvnL.js → process-output-xJm8T5-E.js} +4 -4
- package/dist/{railroadDiagram-O6MQD6OU-mbdav2pV.js → railroadDiagram-O6MQD6OU-DterenMu.js} +2 -2
- package/dist/{requirementDiagram-BXWQKSXE-C1HNBBO6.js → requirementDiagram-BXWQKSXE-Vb5_9LHC.js} +1 -1
- package/dist/{reveal-component-BefmhjJF.js → reveal-component-B7TgfbYJ.js} +1008 -1008
- package/dist/{select-CvorIE3l.js → select-CKLRKIzB.js} +298 -298
- package/dist/{sequenceDiagram-WJ2MYXX4-D6gBHifq.js → sequenceDiagram-WJ2MYXX4-BWsq8hMt.js} +1 -1
- package/dist/{spec-ayzaXGVq.js → spec-C4uOz0Em.js} +4 -4
- package/dist/{stateDiagram-D77RDMKH-Bx-fTtRZ.js → stateDiagram-D77RDMKH-nfKKy6aQ.js} +2 -2
- package/dist/{stateDiagram-v2-MP3YSRHH-Cec8T2yO.js → stateDiagram-v2-MP3YSRHH-DMUHA_9A.js} +2 -2
- package/dist/{static-state-CqwW3B_X.js → static-state-DZ1nSa6e.js} +9 -9
- package/dist/{swimlanes-42K2YHIH-C2bAgnov.js → swimlanes-42K2YHIH-N4qHIMoc.js} +1 -1
- package/dist/{swimlanesDiagram-VR7AAH4N-CzeG-Mnb.js → swimlanesDiagram-VR7AAH4N-DQpDDjQb.js} +2 -2
- package/dist/{timeline-definition-24CTP7MA-DTJ0Rx8X.js → timeline-definition-24CTP7MA-Od8dY9F5.js} +1 -1
- package/dist/{toast-6V8Og7d5.js → toast-bhZHUEal.js} +187 -187
- package/dist/{tooltip-D0h-ZJ6j.js → tooltip-DSWC_Td_.js} +40 -40
- package/dist/{use-restore-focus-BFvwj2Hj.js → use-restore-focus-ocw7t85i.js} +1371 -1373
- package/dist/{useDateFormatter-D6o9PsWt.js → useDateFormatter-BiDS8uXQ.js} +2 -2
- package/dist/{useDeepCompareMemoize-D-Pbv7dN.js → useDeepCompareMemoize-BsaXfZ8C.js} +1 -1
- package/dist/{useLifecycle-CE0yGTMF.js → useLifecycle-CCV7yZ-v.js} +1 -1
- package/dist/{vega-component-DTf7GHQe.js → vega-component-DpTyTrz3.js} +6 -6
- package/dist/{vennDiagram-4TSXK5OY-lIM3SAjl.js → vennDiagram-4TSXK5OY-Di3T2YMb.js} +1 -1
- package/dist/{wardleyDiagram-VM6X3IG4-Bw_t7uvA.js → wardleyDiagram-VM6X3IG4-CKOF5DTi.js} +1 -1
- package/dist/{xychartDiagram-S5SC5T6Z-BXwkLYKj.js → xychartDiagram-S5SC5T6Z-GYLPWSeb.js} +1 -1
- package/package.json +1 -1
- package/src/__mocks__/executions.ts +27 -5
- package/src/__tests__/branded.ts +4 -0
- package/src/__tests__/notebook-analysis.ts +48 -0
- package/src/components/editor/ai/__tests__/completion-utils.test.ts +28 -61
- package/src/components/editor/cell/__tests__/useRunCells.test.tsx +2 -2
- package/src/components/editor/navigation/__tests__/navigation.test.ts +0 -4
- package/src/components/tracing/tracing-keyboard.test.tsx +4 -3
- package/src/core/cells/__tests__/add-missing-import.test.ts +14 -9
- package/src/core/cells/__tests__/pending-delete-service.test.tsx +4 -11
- package/src/core/cells/__tests__/runs.test.ts +11 -11
- package/src/core/cells/add-missing-import.ts +2 -3
- package/src/core/cells/runs.ts +6 -4
- package/src/core/cells/session.ts +4 -1
- package/src/core/codemirror/code-lens/__tests__/entities.test.ts +7 -11
- package/src/core/codemirror/code-lens/__tests__/extension.test.ts +8 -13
- package/src/core/codemirror/code-lens/__tests__/perf.test.ts +7 -9
- package/src/core/codemirror/copilot/__tests__/getCodes.test.ts +9 -13
- package/src/core/codemirror/go-to-definition/__tests__/utils.test.ts +16 -35
- package/src/core/codemirror/language/embedded/__tests__/embedded-python.test.ts +2 -18
- package/src/core/codemirror/reactive-references/__tests__/extension.test.ts +8 -14
- package/src/core/datasets/__tests__/data-source.test.ts +15 -17
- package/src/core/datasets/data-source-connections.ts +8 -11
- package/src/core/datasets/state.ts +7 -12
- package/src/core/executions/__tests__/atoms.test.ts +2 -2
- package/src/core/executions/__tests__/freshness.test.ts +10 -5
- package/src/core/executions/__tests__/interrupt.test.ts +3 -1
- package/src/core/executions/__tests__/output-lifecycle.test.ts +3 -3
- package/src/core/executions/__tests__/output.test.ts +2 -2
- package/src/core/executions/__tests__/run.test.ts +2 -2
- package/src/core/executions/__tests__/select.test.ts +10 -10
- package/src/core/executions/atoms.ts +2 -1
- package/src/core/executions/freshness.ts +2 -2
- package/src/core/islands/bootstrap.ts +0 -2
- package/src/core/notebook/replica/__tests__/executions.test.ts +13 -9
- package/src/core/notebook/replica/__tests__/replica.test.ts +7 -2
- package/src/core/notebook/replica/replica.ts +11 -2
- package/src/core/notebook/replica/resources/executions.ts +29 -20
- package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +192 -1
- package/src/core/session/useNotebookSession.tsx +37 -37
- package/src/core/storage/__tests__/state.test.ts +6 -9
- package/src/core/storage/state.ts +5 -8
- package/src/core/transports/__tests__/static.test.ts +2 -1
- package/src/core/variables/state.ts +73 -68
- package/src/core/variables/types.ts +2 -2
- package/src/core/wasm/bridge.ts +5 -4
- package/src/core/variables/__tests__/state.test.ts +0 -148
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as e } from "./rolldown-runtime-BPCzCO3I.js";
|
|
2
2
|
import { t } from "./react-Bgs_wQh3.js";
|
|
3
|
-
import { h as n } from "./tooltip-
|
|
4
|
-
import { C as r } from "./select-
|
|
3
|
+
import { h as n } from "./tooltip-DSWC_Td_.js";
|
|
4
|
+
import { C as r } from "./select-CKLRKIzB.js";
|
|
5
5
|
var i = n("chart-pie", [["path", {
|
|
6
6
|
d: "M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",
|
|
7
7
|
key: "pzmjnu"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as e } from "./rolldown-runtime-BPCzCO3I.js";
|
|
2
2
|
import { t } from "./react-Bgs_wQh3.js";
|
|
3
|
-
import {
|
|
3
|
+
import { Lt as n } from "./use-restore-focus-ocw7t85i.js";
|
|
4
4
|
//#region src/utils/semaphore.ts
|
|
5
5
|
var r = class {
|
|
6
6
|
maxPermits;
|
|
@@ -2,7 +2,7 @@ import { a as e } from "./rolldown-runtime-BPCzCO3I.js";
|
|
|
2
2
|
import { h as t, i as n } from "./button-Z2R2272J.js";
|
|
3
3
|
import { t as r } from "./react-Bgs_wQh3.js";
|
|
4
4
|
import { t as i } from "./compiler-runtime-C5KHtL5D.js";
|
|
5
|
-
import { h as a } from "./tooltip-
|
|
5
|
+
import { h as a } from "./tooltip-DSWC_Td_.js";
|
|
6
6
|
import { t as o } from "./jsx-runtime-D8btoEHk.js";
|
|
7
7
|
var s = a("calendar", [
|
|
8
8
|
["path", {
|
|
@@ -2,18 +2,18 @@ import { a as e } from "./rolldown-runtime-BPCzCO3I.js";
|
|
|
2
2
|
import { g as t, h as n, m as r, s as i } from "./button-Z2R2272J.js";
|
|
3
3
|
import { t as a } from "./react-Bgs_wQh3.js";
|
|
4
4
|
import { t as o } from "./compiler-runtime-C5KHtL5D.js";
|
|
5
|
-
import { t as s } from "./tooltip-
|
|
6
|
-
import { l as c, t as l } from "./config-
|
|
5
|
+
import { t as s } from "./tooltip-DSWC_Td_.js";
|
|
6
|
+
import { l as c, t as l } from "./config-DL9e-OWE.js";
|
|
7
7
|
import { t as u } from "./jsx-runtime-D8btoEHk.js";
|
|
8
|
-
import { d } from "./use-restore-focus-
|
|
9
|
-
import { n as f } from "./error-banner-
|
|
8
|
+
import { d } from "./use-restore-focus-ocw7t85i.js";
|
|
9
|
+
import { n as f } from "./error-banner-D-AC7pQx.js";
|
|
10
10
|
import { t as p } from "./debounce-DrhhziJv.js";
|
|
11
11
|
import { t as ee } from "./objects-DCmMvZtn.js";
|
|
12
12
|
import { t as te } from "./useEvent-BoN7U38T.js";
|
|
13
|
-
import { a as ne, i as re, n as ie, t as m } from "./formats-
|
|
13
|
+
import { a as ne, i as re, n as ie, t as m } from "./formats-BUFLQJXY.js";
|
|
14
14
|
import { a as h, t as g } from "./arrays-DoQ-AILx.js";
|
|
15
15
|
import { t as ae } from "./useAsyncData-P5-Oovhq.js";
|
|
16
|
-
import { n as _, t as oe } from "./useDeepCompareMemoize-
|
|
16
|
+
import { n as _, t as oe } from "./useDeepCompareMemoize-BsaXfZ8C.js";
|
|
17
17
|
import { W as se, n as ce } from "./vega-loader.browser-Co9gYE8Z.js";
|
|
18
18
|
import { t as le } from "./react-vega-CGgQEf0O.js";
|
|
19
19
|
import { a as ue, n as de } from "./loader-qPmiRXZd.js";
|
|
@@ -3,7 +3,7 @@ import { t } from "./src-D5uZaZib.js";
|
|
|
3
3
|
import { n } from "./chunk-Y2CYZVJY-DKKS1VyV.js";
|
|
4
4
|
import { $ as r, H as i, K as a, U as o, a as s, b as c, c as l, et as u, f as d, nt as f, tt as p, v as m, w as h, y as g } from "./chunk-DU6HZSFF-4SDIhUTY.js";
|
|
5
5
|
import { t as _ } from "./rough.esm-CtV9AnV1.js";
|
|
6
|
-
import { p as v } from "./mermaid
|
|
6
|
+
import { p as v } from "./mermaid--k1o49nH.js";
|
|
7
7
|
//#region ../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/transparentize.js
|
|
8
8
|
var y = (e, t) => p(e, "a", -t), b = 1e-10;
|
|
9
9
|
function x(e, t) {
|
|
@@ -2,7 +2,7 @@ import { i as e } from "./chunk-75Z2AOVW-76L6My3P.js";
|
|
|
2
2
|
import { n as t } from "./src-D5uZaZib.js";
|
|
3
3
|
import { n } from "./chunk-Y2CYZVJY-DKKS1VyV.js";
|
|
4
4
|
import { D as r, H as i, K as a, U as o, a as s, b as c, c as l, v as u, w as d, x as f, y as p } from "./chunk-DU6HZSFF-4SDIhUTY.js";
|
|
5
|
-
import { p as m } from "./mermaid
|
|
5
|
+
import { p as m } from "./mermaid--k1o49nH.js";
|
|
6
6
|
import { n as h } from "./mermaid-parser.core-DtOnl7m4.js";
|
|
7
7
|
import { t as g } from "./chunk-JWPE2WC7-DJvv1t8U.js";
|
|
8
8
|
//#region ../node_modules/.pnpm/mermaid@11.17.2/node_modules/mermaid/dist/chunks/mermaid.core/wardleyDiagram-VM6X3IG4.mjs
|
|
@@ -9,7 +9,7 @@ import { n as s } from "./chunk-Y2CYZVJY-DKKS1VyV.js";
|
|
|
9
9
|
import { D as c, H as l, K as u, U as d, a as f, b as p, c as m, f as h, v as g, w as _, y as v, z as y } from "./chunk-DU6HZSFF-4SDIhUTY.js";
|
|
10
10
|
import "./chunk-PWAF6VOD-CRu_RGP2.js";
|
|
11
11
|
import { t as b } from "./chunk-GMAD6QVW-BJGF8QZL.js";
|
|
12
|
-
import { p as x } from "./mermaid
|
|
12
|
+
import { p as x } from "./mermaid--k1o49nH.js";
|
|
13
13
|
//#region ../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/band.js
|
|
14
14
|
function S() {
|
|
15
15
|
var e = t().unknown(void 0), r = e.domain, i = e.range, o = 0, s = 1, c, l, u = !1, d = 0, f = 0, p = .5;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
/** Executions as the host would report them, for tests that read cell status. */
|
|
4
4
|
|
|
5
|
-
import { cellId } from "@/__tests__/branded";
|
|
5
|
+
import { cellId, runId } from "@/__tests__/branded";
|
|
6
6
|
import type * as Protocol from "@marimo-team/client/protocol";
|
|
7
7
|
import { atom, type createStore } from "jotai";
|
|
8
8
|
import type { CellExecutionInputs } from "@/core/executions";
|
|
@@ -38,7 +38,10 @@ const READY: Protocol.RuntimeState = { status: "ready" };
|
|
|
38
38
|
const SUCCEEDED: Protocol.ExecutionOutcomeOutput = { kind: "succeeded" };
|
|
39
39
|
|
|
40
40
|
/** An execution, or the output it set, as the stream delivers them. */
|
|
41
|
-
type ExecutionFixture = Protocol.ExecutionOutput & {
|
|
41
|
+
type ExecutionFixture = Protocol.ExecutionOutput & {
|
|
42
|
+
items?: readonly Item[];
|
|
43
|
+
bindings?: readonly Pick<Protocol.Variable, "name" | "type" | "preview">[];
|
|
44
|
+
};
|
|
42
45
|
type Entry = ExecutionFixture | Protocol.Output;
|
|
43
46
|
export type ExecutionEntries = ReadonlyArray<Entry | readonly Entry[]>;
|
|
44
47
|
|
|
@@ -62,7 +65,7 @@ function execution(
|
|
|
62
65
|
sequence += 1;
|
|
63
66
|
return {
|
|
64
67
|
id: `e${sequence}`,
|
|
65
|
-
run_id: "run-1",
|
|
68
|
+
run_id: runId("run-1"),
|
|
66
69
|
runtime_id: "r1",
|
|
67
70
|
caused_by_id: null,
|
|
68
71
|
cell_id: cid === null ? null : cellId(cid),
|
|
@@ -96,7 +99,11 @@ function mirror(entries: ExecutionEntries): Executions {
|
|
|
96
99
|
const { records, outputs } = split(entries);
|
|
97
100
|
const executions = new Map<Protocol.ExecutionId, Execution>();
|
|
98
101
|
const latest = new Map<Protocol.CellId, Protocol.ExecutionId>();
|
|
99
|
-
|
|
102
|
+
const variables = new Map<
|
|
103
|
+
Protocol.CellId,
|
|
104
|
+
Map<Protocol.ItemId, Protocol.Variable>
|
|
105
|
+
>();
|
|
106
|
+
for (const { items = [], bindings = [], ...record } of records) {
|
|
100
107
|
if (record.cell_id !== null) {
|
|
101
108
|
// The host retains one execution per cell on the stream.
|
|
102
109
|
const previous = latest.get(record.cell_id);
|
|
@@ -104,13 +111,27 @@ function mirror(entries: ExecutionEntries): Executions {
|
|
|
104
111
|
executions.delete(previous);
|
|
105
112
|
}
|
|
106
113
|
latest.set(record.cell_id, record.id);
|
|
114
|
+
const bound = new Map<Protocol.ItemId, Protocol.Variable>();
|
|
115
|
+
for (const binding of bindings) {
|
|
116
|
+
const id = `${record.id}:${binding.name}`;
|
|
117
|
+
bound.set(id, {
|
|
118
|
+
...binding,
|
|
119
|
+
id,
|
|
120
|
+
execution_id: record.id,
|
|
121
|
+
revision: { execution_id: record.id, update: 0 },
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
if (bound.size) {
|
|
125
|
+
variables.set(record.cell_id, bound);
|
|
126
|
+
} else {
|
|
127
|
+
variables.delete(record.cell_id);
|
|
128
|
+
}
|
|
107
129
|
}
|
|
108
130
|
executions.set(record.id, {
|
|
109
131
|
record,
|
|
110
132
|
output: outputs.get(record.id) ?? null,
|
|
111
133
|
outputVersion: 0,
|
|
112
134
|
items: new Map(items.map((item) => [item.id, item])),
|
|
113
|
-
variables: new Map(),
|
|
114
135
|
});
|
|
115
136
|
}
|
|
116
137
|
const scratch = [...executions.values()].findLast(
|
|
@@ -118,6 +139,7 @@ function mirror(entries: ExecutionEntries): Executions {
|
|
|
118
139
|
execution.record.cell_id === null && shown(execution) !== null,
|
|
119
140
|
);
|
|
120
141
|
return {
|
|
142
|
+
variables,
|
|
121
143
|
runs: new Map(),
|
|
122
144
|
executions,
|
|
123
145
|
latest,
|
package/src/__tests__/branded.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* everywhere.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
import type { RunId } from "@marimo-team/client/protocol";
|
|
13
14
|
import type { components } from "@marimo-team/marimo-api";
|
|
14
15
|
import type { CellId, UIElementId } from "@/core/cells/ids";
|
|
15
16
|
import type { RequestId } from "@/core/network/DeferredRequestRegistry";
|
|
@@ -18,7 +19,10 @@ import type { VariableName } from "@/core/variables/types";
|
|
|
18
19
|
type WidgetModelId = components["schemas"]["WidgetModelId"];
|
|
19
20
|
type Base64String = components["schemas"]["Base64String"];
|
|
20
21
|
|
|
22
|
+
// SAFETY: The fixture author supplies a valid value for each brand, such as
|
|
23
|
+
// the nonempty ID of the run represented in the fixture.
|
|
21
24
|
export const cellId = (s: string) => s as CellId;
|
|
25
|
+
export const runId = (s: string) => s as RunId;
|
|
22
26
|
export const variableName = (s: string) => s as VariableName;
|
|
23
27
|
export const requestId = (s: string) => s as RequestId;
|
|
24
28
|
export const uiElementId = (s: string) => s as UIElementId;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
import type { CellAnalysis } from "@marimo-team/client/protocol";
|
|
4
|
+
import { atom, type createStore } from "jotai";
|
|
5
|
+
import { cellId } from "@/__tests__/branded";
|
|
6
|
+
import { cell, document } from "@/core/notebook/document/__tests__/fixtures";
|
|
7
|
+
import { createNotebookReplica } from "@/core/notebook/replica";
|
|
8
|
+
import { activeNotebookReplicaAtom } from "@/core/session/active-notebook";
|
|
9
|
+
|
|
10
|
+
export type AnalysisCells = Record<
|
|
11
|
+
string,
|
|
12
|
+
Partial<Pick<CellAnalysis, "defs" | "refs">>
|
|
13
|
+
>;
|
|
14
|
+
|
|
15
|
+
export function setNotebookAnalysis(
|
|
16
|
+
store: ReturnType<typeof createStore>,
|
|
17
|
+
cells: AnalysisCells,
|
|
18
|
+
) {
|
|
19
|
+
const replica =
|
|
20
|
+
store.get(activeNotebookReplicaAtom) ?? createNotebookReplica(store);
|
|
21
|
+
const ids = Object.keys(cells).map(cellId);
|
|
22
|
+
const base = document();
|
|
23
|
+
const analyzedDocument = {
|
|
24
|
+
revision: { ...base.revision, order: ids },
|
|
25
|
+
cells: new Map(ids.map((id) => [id, cell(id, "")])),
|
|
26
|
+
};
|
|
27
|
+
const analysis = {
|
|
28
|
+
notebook_id: analyzedDocument.revision.notebook_id,
|
|
29
|
+
document_etag: analyzedDocument.revision.etag,
|
|
30
|
+
cells: Object.fromEntries(
|
|
31
|
+
Object.entries(cells).map(([id, names]) => [
|
|
32
|
+
id,
|
|
33
|
+
{ defs: [], refs: [], diagnostics: [], ...names },
|
|
34
|
+
]),
|
|
35
|
+
),
|
|
36
|
+
};
|
|
37
|
+
const documentAtom = atom(analyzedDocument);
|
|
38
|
+
store.set(activeNotebookReplicaAtom, {
|
|
39
|
+
...replica,
|
|
40
|
+
analysisAtom: atom({
|
|
41
|
+
freshness: "current" as const,
|
|
42
|
+
analysis,
|
|
43
|
+
document: analyzedDocument,
|
|
44
|
+
}),
|
|
45
|
+
documentAtom,
|
|
46
|
+
shownDocumentAtom: documentAtom,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
import type { Variable } from "@marimo-team/client/protocol";
|
|
3
|
+
import type { FileUIPart, UIMessage } from "ai";
|
|
2
4
|
import {
|
|
3
5
|
afterEach,
|
|
4
6
|
beforeEach,
|
|
@@ -8,16 +10,16 @@ import {
|
|
|
8
10
|
type Mock,
|
|
9
11
|
vi,
|
|
10
12
|
} from "vitest";
|
|
11
|
-
import {
|
|
13
|
+
import { MockExecutions } from "@/__mocks__/executions";
|
|
12
14
|
import * as aiContext from "@/core/ai/context/context";
|
|
13
15
|
import { getCodes } from "@/core/codemirror/copilot/getCodes";
|
|
14
16
|
import { dataSourceConnectionsAtom } from "@/core/datasets/data-source-connections";
|
|
15
17
|
import { DUCKDB_ENGINE } from "@/core/datasets/engines";
|
|
16
18
|
import { datasetsAtom } from "@/core/datasets/state";
|
|
17
19
|
import type { DatasetsState } from "@/core/datasets/types";
|
|
20
|
+
import { document as notebookDocument } from "@/core/notebook/document/__tests__/fixtures";
|
|
21
|
+
import { activeNotebookReplicaAtom } from "@/core/session/active-notebook";
|
|
18
22
|
import { store } from "@/core/state/jotai";
|
|
19
|
-
import { variablesAtom } from "@/core/variables/state";
|
|
20
|
-
import type { FileUIPart, UIMessage } from "ai";
|
|
21
23
|
import {
|
|
22
24
|
getAICompletionBody,
|
|
23
25
|
getAICompletionBodyWithAttachments,
|
|
@@ -31,6 +33,15 @@ vi.mock("@/core/codemirror/copilot/getCodes", () => ({
|
|
|
31
33
|
getCodes: vi.fn(),
|
|
32
34
|
}));
|
|
33
35
|
|
|
36
|
+
function setBindings(bindings: Pick<Variable, "name" | "type" | "preview">[]) {
|
|
37
|
+
MockExecutions.seed(
|
|
38
|
+
store,
|
|
39
|
+
[{ ...MockExecutions.completed("c1"), bindings }],
|
|
40
|
+
null,
|
|
41
|
+
notebookDocument(),
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
34
45
|
describe("getAICompletionBody", () => {
|
|
35
46
|
beforeEach(() => {
|
|
36
47
|
// Reset the Jotai store before each test
|
|
@@ -41,7 +52,7 @@ describe("getAICompletionBody", () => {
|
|
|
41
52
|
latestEngineSelected: DUCKDB_ENGINE,
|
|
42
53
|
connectionsMap: new Map(),
|
|
43
54
|
});
|
|
44
|
-
store.set(
|
|
55
|
+
store.set(activeNotebookReplicaAtom, null);
|
|
45
56
|
(getCodes as Mock).mockReturnValue("// Some other code");
|
|
46
57
|
});
|
|
47
58
|
|
|
@@ -221,23 +232,10 @@ describe("getAICompletionBody", () => {
|
|
|
221
232
|
|
|
222
233
|
it("should return the correct completion body with mentioned variables", () => {
|
|
223
234
|
// Set up test data in the Jotai store
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
dataType: "string",
|
|
229
|
-
declaredBy: [],
|
|
230
|
-
usedBy: [],
|
|
231
|
-
},
|
|
232
|
-
[variableName("var2")]: {
|
|
233
|
-
name: variableName("var2"),
|
|
234
|
-
value: "42",
|
|
235
|
-
dataType: "number",
|
|
236
|
-
declaredBy: [],
|
|
237
|
-
usedBy: [],
|
|
238
|
-
},
|
|
239
|
-
};
|
|
240
|
-
store.set(variablesAtom, testVariables);
|
|
235
|
+
setBindings([
|
|
236
|
+
{ name: "var1", type: "string", preview: "string value" },
|
|
237
|
+
{ name: "var2", type: "number", preview: "42" },
|
|
238
|
+
]);
|
|
241
239
|
|
|
242
240
|
const input = "Use @variable://var1 and @variable://var2 for analysis";
|
|
243
241
|
const result = getAICompletionBody({ input });
|
|
@@ -269,16 +267,7 @@ describe("getAICompletionBody", () => {
|
|
|
269
267
|
];
|
|
270
268
|
store.set(datasetsAtom, { tables: testDatasets } as DatasetsState);
|
|
271
269
|
|
|
272
|
-
|
|
273
|
-
[variableName("var1")]: {
|
|
274
|
-
name: variableName("var1"),
|
|
275
|
-
value: "string value",
|
|
276
|
-
dataType: "string",
|
|
277
|
-
declaredBy: [],
|
|
278
|
-
usedBy: [],
|
|
279
|
-
},
|
|
280
|
-
};
|
|
281
|
-
store.set(variablesAtom, testVariables);
|
|
270
|
+
setBindings([{ name: "var1", type: "string", preview: "string value" }]);
|
|
282
271
|
|
|
283
272
|
const input = "Use @data://dataset1 and @variable://var1 for analysis";
|
|
284
273
|
const result = getAICompletionBody({ input });
|
|
@@ -301,16 +290,9 @@ describe("getAICompletionBody", () => {
|
|
|
301
290
|
|
|
302
291
|
it("should handle non-existent variables", () => {
|
|
303
292
|
// Set up test data in the Jotai store
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
value: "string value",
|
|
308
|
-
dataType: "string",
|
|
309
|
-
declaredBy: [],
|
|
310
|
-
usedBy: [],
|
|
311
|
-
},
|
|
312
|
-
};
|
|
313
|
-
store.set(variablesAtom, testVariables);
|
|
293
|
+
setBindings([
|
|
294
|
+
{ name: "existingVar", type: "string", preview: "string value" },
|
|
295
|
+
]);
|
|
314
296
|
|
|
315
297
|
const input =
|
|
316
298
|
"Use @variable://existingVar and @variable://nonExistentVar for analysis";
|
|
@@ -338,16 +320,9 @@ describe("getAICompletionBody", () => {
|
|
|
338
320
|
];
|
|
339
321
|
store.set(datasetsAtom, { tables: testDatasets } as DatasetsState);
|
|
340
322
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
value: "string value",
|
|
345
|
-
dataType: "string",
|
|
346
|
-
declaredBy: [],
|
|
347
|
-
usedBy: [],
|
|
348
|
-
},
|
|
349
|
-
};
|
|
350
|
-
store.set(variablesAtom, testVariables);
|
|
323
|
+
setBindings([
|
|
324
|
+
{ name: "conflict", type: "string", preview: "string value" },
|
|
325
|
+
]);
|
|
351
326
|
|
|
352
327
|
const input = "Use @data://conflict for analysis";
|
|
353
328
|
const result = getAICompletionBody({ input });
|
|
@@ -375,7 +350,7 @@ describe("resolveChatContext", () => {
|
|
|
375
350
|
latestEngineSelected: DUCKDB_ENGINE,
|
|
376
351
|
connectionsMap: new Map(),
|
|
377
352
|
});
|
|
378
|
-
store.set(
|
|
353
|
+
store.set(activeNotebookReplicaAtom, null);
|
|
379
354
|
});
|
|
380
355
|
|
|
381
356
|
it("returns no context when the input has no @-mentions", async () => {
|
|
@@ -390,15 +365,7 @@ describe("resolveChatContext", () => {
|
|
|
390
365
|
});
|
|
391
366
|
|
|
392
367
|
it("captures resolved @-context into a data part", async () => {
|
|
393
|
-
|
|
394
|
-
[variableName("var1")]: {
|
|
395
|
-
name: variableName("var1"),
|
|
396
|
-
value: "string value",
|
|
397
|
-
dataType: "string",
|
|
398
|
-
declaredBy: [],
|
|
399
|
-
usedBy: [],
|
|
400
|
-
},
|
|
401
|
-
});
|
|
368
|
+
setBindings([{ name: "var1", type: "string", preview: "string value" }]);
|
|
402
369
|
|
|
403
370
|
const result = await resolveChatContext("inspect @variable://var1");
|
|
404
371
|
|
|
@@ -7,7 +7,7 @@ import type { ReactNode } from "react";
|
|
|
7
7
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
8
8
|
import { MockExecutions } from "@/__mocks__/executions";
|
|
9
9
|
import { MockNotebook } from "@/__mocks__/notebook";
|
|
10
|
-
import { cellId } from "@/__tests__/branded";
|
|
10
|
+
import { cellId, runId } from "@/__tests__/branded";
|
|
11
11
|
import { notebookAtom } from "@/core/cells/cells";
|
|
12
12
|
import type { DocumentModel } from "@/core/notebook/document";
|
|
13
13
|
import {
|
|
@@ -37,7 +37,7 @@ const wrapper = ({ children }: { children: ReactNode }) => (
|
|
|
37
37
|
|
|
38
38
|
function accepted(cells: string[]): Protocol.RunOutput {
|
|
39
39
|
return {
|
|
40
|
-
id: "run-1",
|
|
40
|
+
id: runId("run-1"),
|
|
41
41
|
notebook_id: "n1",
|
|
42
42
|
runtime_id: "r1",
|
|
43
43
|
origin: { kind: "cells", cell_ids: cells.map(cellId) },
|
|
@@ -44,8 +44,6 @@ import {
|
|
|
44
44
|
} from "@/core/config/config";
|
|
45
45
|
import { requestClientAtom } from "@/core/network/requests";
|
|
46
46
|
import { store } from "@/core/state/jotai";
|
|
47
|
-
import { variablesAtom } from "@/core/variables/state";
|
|
48
|
-
import type { Variables } from "@/core/variables/types";
|
|
49
47
|
import type { CellActionsDropdownHandle } from "../../cell/cell-actions";
|
|
50
48
|
import {
|
|
51
49
|
useCellEditorNavigationProps,
|
|
@@ -464,8 +462,6 @@ describe("useCellNavigationProps", () => {
|
|
|
464
462
|
});
|
|
465
463
|
|
|
466
464
|
it("should add an import before and a SQL cell after when 'q' is pressed", () => {
|
|
467
|
-
store.set(variablesAtom, {} as Variables);
|
|
468
|
-
|
|
469
465
|
const { result } = renderWithProvider(() =>
|
|
470
466
|
useCellNavigationProps(mockCellId, options),
|
|
471
467
|
);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
|
+
import { runId } from "@/__tests__/branded";
|
|
3
4
|
import { act, fireEvent, render, screen } from "@testing-library/react";
|
|
4
5
|
import { createStore, Provider } from "jotai";
|
|
5
6
|
import { describe, expect, it, vi } from "vitest";
|
|
6
7
|
import { TooltipProvider } from "@/components/ui/tooltip";
|
|
7
|
-
import { type Run,
|
|
8
|
+
import { type Run, runsAtom } from "@/core/cells/runs";
|
|
8
9
|
import { Tracing } from "./tracing";
|
|
9
10
|
|
|
10
11
|
vi.mock("react-vega", () => ({ useVegaEmbed: () => undefined }));
|
|
@@ -14,7 +15,7 @@ vi.mock("@/components/editor/chrome/panels/panel-context", () => ({
|
|
|
14
15
|
}));
|
|
15
16
|
|
|
16
17
|
const run: Run = {
|
|
17
|
-
runId: "run-1"
|
|
18
|
+
runId: runId("run-1"),
|
|
18
19
|
runStartTime: 1_704_067_200,
|
|
19
20
|
cellRuns: new Map(),
|
|
20
21
|
};
|
|
@@ -67,7 +68,7 @@ describe("trace disclosure keyboard focus", () => {
|
|
|
67
68
|
act(() => header.focus());
|
|
68
69
|
const newer: Run = {
|
|
69
70
|
...run,
|
|
70
|
-
runId: "run-2"
|
|
71
|
+
runId: runId("run-2"),
|
|
71
72
|
runStartTime: run.runStartTime + 1,
|
|
72
73
|
};
|
|
73
74
|
act(() => {
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import { createStore } from "jotai";
|
|
4
4
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
5
|
+
import { setNotebookAnalysis } from "@/__tests__/notebook-analysis";
|
|
6
|
+
import { MockExecutions } from "@/__mocks__/executions";
|
|
5
7
|
import { MockNotebook } from "@/__mocks__/notebook";
|
|
6
8
|
import { MockRequestClient } from "@/__mocks__/requests";
|
|
7
9
|
import { cellId } from "@/__tests__/branded";
|
|
8
10
|
import { store } from "@/core/state/jotai";
|
|
9
|
-
import { variablesAtom } from "@/core/variables/state";
|
|
10
|
-
import type { Variables } from "@/core/variables/types";
|
|
11
11
|
import {
|
|
12
12
|
maybeAddAltairImport,
|
|
13
13
|
maybeAddMarimoImport,
|
|
@@ -26,13 +26,12 @@ const Cell2 = cellId("2");
|
|
|
26
26
|
|
|
27
27
|
describe("maybeAddMissingImport", () => {
|
|
28
28
|
beforeEach(() => {
|
|
29
|
-
store.set(variablesAtom, {} as Variables);
|
|
30
29
|
store.set(notebookAtom, MockNotebook.notebookState({ cellData: {} }));
|
|
31
30
|
});
|
|
32
31
|
|
|
33
|
-
it("
|
|
32
|
+
it("skips the import when a cell declares the name", () => {
|
|
34
33
|
const appStore = createStore();
|
|
35
|
-
appStore
|
|
34
|
+
setNotebookAnalysis(appStore, { [Cell1]: { defs: ["mo"] } });
|
|
36
35
|
const onAddImport = vi.fn();
|
|
37
36
|
maybeAddMissingImport({
|
|
38
37
|
moduleName: "marimo",
|
|
@@ -52,7 +51,7 @@ describe("maybeAddMissingImport", () => {
|
|
|
52
51
|
"should not add an import if the import statement already exists in the notebook",
|
|
53
52
|
(code) => {
|
|
54
53
|
const appStore = createStore();
|
|
55
|
-
|
|
54
|
+
|
|
56
55
|
appStore.set(
|
|
57
56
|
notebookAtom,
|
|
58
57
|
MockNotebook.notebookState({
|
|
@@ -72,9 +71,16 @@ describe("maybeAddMissingImport", () => {
|
|
|
72
71
|
},
|
|
73
72
|
);
|
|
74
73
|
|
|
75
|
-
it("
|
|
74
|
+
it("adds a missing import even when the name is still bound in the kernel", () => {
|
|
76
75
|
const appStore = createStore();
|
|
77
|
-
|
|
76
|
+
MockExecutions.seed(appStore, [
|
|
77
|
+
{
|
|
78
|
+
...MockExecutions.completed(Cell1),
|
|
79
|
+
bindings: [{ name: "mo", type: "module", preview: "marimo" }],
|
|
80
|
+
},
|
|
81
|
+
]);
|
|
82
|
+
setNotebookAnalysis(appStore, { [Cell1]: { refs: ["mo"] } });
|
|
83
|
+
|
|
78
84
|
appStore.set(
|
|
79
85
|
notebookAtom,
|
|
80
86
|
MockNotebook.notebookState({
|
|
@@ -96,7 +102,6 @@ describe("maybeAddMissingImport", () => {
|
|
|
96
102
|
it("should not create a new cell if import already exists due to skipIfCodeExists", () => {
|
|
97
103
|
const addImports = [maybeAddMarimoImport, maybeAddAltairImport];
|
|
98
104
|
for (const addImport of addImports) {
|
|
99
|
-
store.set(variablesAtom, {} as Variables);
|
|
100
105
|
store.set(
|
|
101
106
|
notebookAtom,
|
|
102
107
|
MockNotebook.notebookState({
|
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
import { act, renderHook, waitFor } from "@testing-library/react";
|
|
4
4
|
import { createStore, Provider } from "jotai";
|
|
5
5
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
6
|
+
import { setNotebookAnalysis } from "@/__tests__/notebook-analysis";
|
|
6
7
|
import { MockExecutions } from "@/__mocks__/executions";
|
|
7
8
|
import { MockNotebook } from "@/__mocks__/notebook";
|
|
8
|
-
import { variableName } from "@/__tests__/branded";
|
|
9
9
|
import { notebookAtom } from "@/core/cells/cells";
|
|
10
10
|
import { CellId } from "@/core/cells/ids";
|
|
11
|
-
import { variablesAtom } from "@/core/variables/state";
|
|
12
11
|
import {
|
|
13
12
|
usePendingDelete,
|
|
14
13
|
usePendingDeleteService,
|
|
@@ -48,7 +47,6 @@ describe("pending-delete-service", () => {
|
|
|
48
47
|
MockExecutions.seed(store, [MockExecutions.took(cellId, 1)]);
|
|
49
48
|
|
|
50
49
|
store.set(notebookAtom, notebook);
|
|
51
|
-
store.set(variablesAtom, {});
|
|
52
50
|
|
|
53
51
|
const { result } = renderHook(
|
|
54
52
|
() => {
|
|
@@ -82,7 +80,6 @@ describe("pending-delete-service", () => {
|
|
|
82
80
|
MockExecutions.seed(store, [MockExecutions.took(cellId, 100_000)]);
|
|
83
81
|
|
|
84
82
|
store.set(notebookAtom, notebook);
|
|
85
|
-
store.set(variablesAtom, {});
|
|
86
83
|
|
|
87
84
|
const { result: serviceResult } = renderHook(
|
|
88
85
|
() => usePendingDeleteService(),
|
|
@@ -130,12 +127,9 @@ describe("pending-delete-service", () => {
|
|
|
130
127
|
]);
|
|
131
128
|
|
|
132
129
|
store.set(notebookAtom, notebook);
|
|
133
|
-
store
|
|
134
|
-
[
|
|
135
|
-
|
|
136
|
-
declaredBy: [cell1Id],
|
|
137
|
-
usedBy: [cell2Id],
|
|
138
|
-
},
|
|
130
|
+
setNotebookAnalysis(store, {
|
|
131
|
+
[cell1Id]: { defs: ["x"] },
|
|
132
|
+
[cell2Id]: { refs: ["x"] },
|
|
139
133
|
});
|
|
140
134
|
|
|
141
135
|
// cell1 with dependencies
|
|
@@ -171,7 +165,6 @@ describe("pending-delete-service", () => {
|
|
|
171
165
|
]);
|
|
172
166
|
|
|
173
167
|
store.set(notebookAtom, notebook);
|
|
174
|
-
store.set(variablesAtom, {});
|
|
175
168
|
|
|
176
169
|
const { result: serviceResult } = renderHook(
|
|
177
170
|
() => usePendingDeleteService(),
|