@marimo-team/islands 0.25.3-dev458 → 0.25.3-dev460
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-CwkGSYmm.js → ErrorBoundary-D2YXxE_x.js} +1 -1
- package/dist/{chat-ui-6d75EmD5.js → chat-ui-wWHUzOrx.js} +3 -3
- package/dist/{code-visibility-Xv_t4WwT.js → code-visibility-BPWgfZVa.js} +2 -2
- package/dist/{common-BlMwQJMs.js → common-_2RH91nQ.js} +3 -3
- package/dist/{data-grid-overlay-editor-Bd8kunYq.js → data-grid-overlay-editor-yh1wqygW.js} +1 -1
- package/dist/{error-entries-Y2oBe6wK.js → error-entries-3nytC8-z.js} +527 -504
- package/dist/{feedback-button-nET4jF-9.js → feedback-button-Ctc_u2JY.js} +3 -3
- package/dist/{glide-data-editor-DzQRP0yA.js → glide-data-editor-DJikF-sp.js} +3 -3
- package/dist/{globals-IFL15lCt.js → globals-D8_0qvIC.js} +1 -1
- package/dist/{html-to-image-BMB3OKAk.js → html-to-image-C3Nb90uM.js} +1 -1
- package/dist/main.js +8493 -8478
- package/dist/{number-overlay-editor-BtYxGlC3.js → number-overlay-editor-BUXorcPD.js} +1 -1
- package/dist/{process-output-lVSjjNuD.js → process-output-BiLaCBoX.js} +2 -2
- package/dist/{reveal-component-BtbTYMke.js → reveal-component-B54ZJYk8.js} +2 -2
- package/package.json +1 -1
- package/src/__mocks__/executions.ts +54 -52
- package/src/components/editor/__tests__/output-persistence.test.tsx +1 -1
- package/src/components/editor/cell/__tests__/useRunCells.test.tsx +5 -8
- package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +7 -5
- package/src/components/editor/stdin-blocking-alert.tsx +1 -1
- package/src/core/cells/__tests__/clear-outputs.test.ts +8 -9
- package/src/core/cells/__tests__/runs.test.ts +18 -18
- package/src/core/cells/__tests__/session.test.ts +13 -11
- package/src/core/cells/execution-console.ts +6 -8
- package/src/core/cells/runs.ts +10 -10
- package/src/core/cells/session.ts +7 -5
- package/src/core/cells/utils.ts +1 -1
- package/src/core/errors/__tests__/error-entries.test.ts +1 -1
- package/src/core/executions/__tests__/atoms.test.ts +12 -5
- package/src/core/executions/__tests__/freshness.test.ts +53 -37
- package/src/core/executions/__tests__/hooks.test.tsx +8 -9
- package/src/core/executions/__tests__/interrupt.test.ts +12 -5
- package/src/core/executions/__tests__/output-lifecycle.test.ts +39 -38
- package/src/core/executions/__tests__/output.test.ts +62 -72
- package/src/core/executions/__tests__/run.test.ts +1 -4
- package/src/core/executions/__tests__/select.test.ts +44 -30
- package/src/core/executions/atoms.ts +2 -1
- package/src/core/executions/freshness.ts +7 -5
- package/src/core/executions/output.ts +8 -6
- package/src/core/executions/select.ts +23 -18
- package/src/core/islands/__tests__/bridge.test.ts +2 -10
- package/src/core/notebook/replica/__tests__/executions.test.ts +20 -11
- package/src/core/notebook/replica/__tests__/results.test.ts +42 -33
- package/src/core/notebook/replica/execution-state.ts +35 -0
- package/src/core/notebook/replica/index.ts +6 -0
- package/src/core/notebook/replica/replica.ts +1 -1
- package/src/core/notebook/replica/resources/executions.ts +9 -8
- package/src/core/notebook/replica/resources/results.ts +6 -5
- package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +20 -22
- package/src/core/session/useNotebookSession.tsx +11 -4
- package/src/core/static/virtual-file-tracker.ts +3 -2
- package/src/core/transports/__tests__/static.test.ts +13 -8
- package/src/core/wasm/__tests__/bridge.test.ts +7 -16
- package/src/core/wasm/bridge.ts +6 -5
- package/src/stories/cell.stories.tsx +24 -19
|
@@ -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 { a as n } from "./glide-data-editor-
|
|
3
|
+
import { a as n } from "./glide-data-editor-DJikF-sp.js";
|
|
4
4
|
//#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.17.21_marked@15.0.12_react-dom@19.3.1_57c124ac5a994dbbf13fd11838cf9ba9/node_modules/@glideapps/glide-data-grid/dist/esm/internal/data-grid-overlay-editor/private/number-overlay-editor-style.js
|
|
5
5
|
var r = /* @__PURE__ */ e(t()), i = /*#__PURE__*/ n("div")({
|
|
6
6
|
name: "NumberOverlayEditorStyle",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as e } from "./html-to-image-
|
|
1
|
+
import { T as e } from "./html-to-image-C3Nb90uM.js";
|
|
2
2
|
import { h as t } from "./tooltip-CiJ919pg.js";
|
|
3
|
-
import { Tt as n, wt as r } from "./error-entries-
|
|
3
|
+
import { Tt as n, wt as r } from "./error-entries-3nytC8-z.js";
|
|
4
4
|
import { r as i } from "./assertNever-DOTNJ2Y4.js";
|
|
5
5
|
var a = t("file", [["path", {
|
|
6
6
|
d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
|
|
@@ -3,14 +3,14 @@ import { g as t, h as n, i as r, m as i, t as a } from "./button-qQhINE7z.js";
|
|
|
3
3
|
import { t as o } from "./react-Bgs_wQh3.js";
|
|
4
4
|
import { t as s } from "./compiler-runtime-C5KHtL5D.js";
|
|
5
5
|
import { h as c, t as l } from "./tooltip-CiJ919pg.js";
|
|
6
|
-
import { Cn as u, En as d, Sn as f, dn as p, et as m, f as h, i as g, l as _, n as v, nt as y, r as b, t as x, tt as S, u as C } from "./common-
|
|
6
|
+
import { Cn as u, En as d, Sn as f, dn as p, et as m, f as h, i as g, l as _, n as v, nt as y, r as b, t as x, tt as S, u as C } from "./common-_2RH91nQ.js";
|
|
7
7
|
import { M as w } from "./select-PQHWLm64.js";
|
|
8
8
|
import { X as T } from "./dropdown-menu-B12Nf3Zf.js";
|
|
9
9
|
import { t as E } from "./jsx-runtime-D8btoEHk.js";
|
|
10
10
|
import { Rt as D, Vt as O, f as k, i as ee } from "./use-restore-focus-BLj45Ibw.js";
|
|
11
11
|
import { t as A } from "./useEvent-BoN7U38T.js";
|
|
12
12
|
import { o as te } from "./static-state-CWXd6dYX.js";
|
|
13
|
-
import { n as ne, t as re } from "./code-visibility-
|
|
13
|
+
import { n as ne, t as re } from "./code-visibility-BPWgfZVa.js";
|
|
14
14
|
/* empty css */
|
|
15
15
|
var j = c("sticky-note", [["path", {
|
|
16
16
|
d: "M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",
|
package/package.json
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
type Results,
|
|
18
18
|
type Result,
|
|
19
19
|
} from "@/core/notebook/replica";
|
|
20
|
+
import { shownOutcome } from "@/core/notebook/replica";
|
|
20
21
|
import { activeNotebookReplicaAtom } from "@/core/session/active-notebook";
|
|
21
22
|
|
|
22
23
|
type Store = ReturnType<typeof createStore>;
|
|
@@ -32,9 +33,11 @@ const T1 = "2026-10-01T09:20:12.500Z";
|
|
|
32
33
|
|
|
33
34
|
let sequence = 0;
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
const NO_VALUE: Protocol.ValueOutcome = { kind: "value", display: null };
|
|
37
|
+
|
|
38
|
+
function execution(
|
|
39
|
+
cellId: string | null,
|
|
40
|
+
state: Protocol.ExecutionState,
|
|
38
41
|
): Protocol.Execution {
|
|
39
42
|
sequence += 1;
|
|
40
43
|
return {
|
|
@@ -44,13 +47,21 @@ function completed(
|
|
|
44
47
|
caused_by: null,
|
|
45
48
|
cell_id: cellId,
|
|
46
49
|
code_fingerprint: "0f71456db2ea83f4",
|
|
47
|
-
|
|
50
|
+
state,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function completed(
|
|
55
|
+
cellId: string | null,
|
|
56
|
+
outcome: Protocol.Outcome = NO_VALUE,
|
|
57
|
+
): Protocol.Execution {
|
|
58
|
+
return execution(cellId, {
|
|
48
59
|
status: "completed",
|
|
49
|
-
outcome: { kind: "value", display: null },
|
|
50
60
|
started_at: T0,
|
|
51
61
|
completed_at: T1,
|
|
52
|
-
|
|
53
|
-
|
|
62
|
+
outcome,
|
|
63
|
+
depends_on: {},
|
|
64
|
+
});
|
|
54
65
|
}
|
|
55
66
|
|
|
56
67
|
type ExecutionFixture = Protocol.Execution & { items?: readonly Item[] };
|
|
@@ -75,7 +86,7 @@ function mirror(records: readonly ExecutionFixture[]): Executions {
|
|
|
75
86
|
});
|
|
76
87
|
}
|
|
77
88
|
const scratch = records.findLast(
|
|
78
|
-
(record) => record.cell_id === null && record
|
|
89
|
+
(record) => record.cell_id === null && shownOutcome(record) !== null,
|
|
79
90
|
);
|
|
80
91
|
return {
|
|
81
92
|
runs: new Map(),
|
|
@@ -94,7 +105,7 @@ function results(records: readonly Protocol.Execution[]): Results {
|
|
|
94
105
|
if (!results.has(record.cell_id)) {
|
|
95
106
|
results.set(record.cell_id, null);
|
|
96
107
|
}
|
|
97
|
-
if (record.status === "completed") {
|
|
108
|
+
if (record.state.status === "completed") {
|
|
98
109
|
results.set(record.cell_id, { record, outputVersion: 0 });
|
|
99
110
|
}
|
|
100
111
|
}
|
|
@@ -105,49 +116,47 @@ function results(records: readonly Protocol.Execution[]): Results {
|
|
|
105
116
|
export const MockExecutions = {
|
|
106
117
|
T0,
|
|
107
118
|
T1,
|
|
119
|
+
execution,
|
|
108
120
|
completed,
|
|
109
121
|
|
|
110
122
|
/** A completed execution that took `elapsedMs`. */
|
|
111
123
|
took(cellId: string, elapsedMs: number): Protocol.Execution {
|
|
112
|
-
return
|
|
124
|
+
return execution(cellId, {
|
|
125
|
+
status: "completed",
|
|
126
|
+
started_at: T0,
|
|
113
127
|
completed_at: new Date(Date.parse(T0) + elapsedMs).toISOString(),
|
|
128
|
+
outcome: NO_VALUE,
|
|
129
|
+
depends_on: {},
|
|
114
130
|
});
|
|
115
131
|
},
|
|
116
132
|
|
|
117
133
|
/** A completed execution that showed `display`. */
|
|
118
134
|
shown(
|
|
119
|
-
cellId: string,
|
|
135
|
+
cellId: string | null,
|
|
120
136
|
display: Protocol.DisplayData,
|
|
121
|
-
|
|
137
|
+
fields: Partial<Omit<Protocol.Execution, "id" | "state">> = {},
|
|
122
138
|
): Protocol.Execution {
|
|
123
|
-
return completed(cellId, {
|
|
124
|
-
outcome: { kind: "value", display },
|
|
125
|
-
...overrides,
|
|
126
|
-
});
|
|
139
|
+
return { ...completed(cellId, { kind: "value", display }), ...fields };
|
|
127
140
|
},
|
|
128
141
|
|
|
129
142
|
/** A completed execution that ended in `error`, a ValueError by default. */
|
|
130
143
|
failed(
|
|
131
144
|
cellId: string,
|
|
132
145
|
error: Partial<Protocol.Error> = {},
|
|
133
|
-
overrides: Partial<Protocol.Execution> = {},
|
|
134
146
|
): Protocol.Execution {
|
|
135
147
|
return completed(cellId, {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
...error,
|
|
148
|
-
},
|
|
148
|
+
kind: "error",
|
|
149
|
+
error: {
|
|
150
|
+
kind: "exception",
|
|
151
|
+
message: "boom",
|
|
152
|
+
name: "ValueError",
|
|
153
|
+
traceback: null,
|
|
154
|
+
source: "marimo",
|
|
155
|
+
severity: "error",
|
|
156
|
+
range: null,
|
|
157
|
+
related: [],
|
|
158
|
+
...error,
|
|
149
159
|
},
|
|
150
|
-
...overrides,
|
|
151
160
|
});
|
|
152
161
|
},
|
|
153
162
|
|
|
@@ -155,36 +164,29 @@ export const MockExecutions = {
|
|
|
155
164
|
return MockExecutions.failed(cellId);
|
|
156
165
|
},
|
|
157
166
|
|
|
158
|
-
interrupted(cellId: string): Protocol.Execution {
|
|
159
|
-
return completed(cellId, {
|
|
167
|
+
interrupted(cellId: string | null): Protocol.Execution {
|
|
168
|
+
return completed(cellId, { kind: "interrupted" });
|
|
160
169
|
},
|
|
161
170
|
|
|
162
171
|
skipped(cellId: string): Protocol.Execution {
|
|
163
172
|
return completed(cellId, {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
related: [],
|
|
169
|
-
},
|
|
173
|
+
kind: "skipped",
|
|
174
|
+
reason: "ancestor-stopped",
|
|
175
|
+
message: "",
|
|
176
|
+
related: [],
|
|
170
177
|
});
|
|
171
178
|
},
|
|
172
179
|
|
|
173
|
-
running
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
});
|
|
180
|
+
/** A running execution that has shown `value` so far. */
|
|
181
|
+
running(
|
|
182
|
+
cellId: string | null,
|
|
183
|
+
value: Protocol.ValueOutcome | null = null,
|
|
184
|
+
): Protocol.Execution {
|
|
185
|
+
return execution(cellId, { status: "running", started_at: T0, value });
|
|
179
186
|
},
|
|
180
187
|
|
|
181
|
-
queued(cellId: string): Protocol.Execution {
|
|
182
|
-
return
|
|
183
|
-
status: "queued",
|
|
184
|
-
outcome: null,
|
|
185
|
-
started_at: null,
|
|
186
|
-
completed_at: null,
|
|
187
|
-
});
|
|
188
|
+
queued(cellId: string | null): Protocol.Execution {
|
|
189
|
+
return execution(cellId, { status: "queued" });
|
|
188
190
|
},
|
|
189
191
|
|
|
190
192
|
notebook(id: Protocol.NotebookId = "n1"): Protocol.Notebook {
|
|
@@ -184,7 +184,7 @@ describe("output persistence across mode changes", () => {
|
|
|
184
184
|
// The host holds newer source than the cell last ran with
|
|
185
185
|
MockExecutions.seed(
|
|
186
186
|
store,
|
|
187
|
-
[MockExecutions.shown(cid, PERSIST,
|
|
187
|
+
[{ ...MockExecutions.shown(cid, PERSIST), code_fingerprint: "ran" }],
|
|
188
188
|
null,
|
|
189
189
|
withCells(
|
|
190
190
|
documentOf(),
|
|
@@ -41,10 +41,7 @@ function accepted(cells: Protocol.CellId[]): Protocol.Run {
|
|
|
41
41
|
notebook_id: "n1",
|
|
42
42
|
runtime_id: "r1",
|
|
43
43
|
origin: { kind: "cells", cell_ids: cells },
|
|
44
|
-
status: "queued",
|
|
45
|
-
outcome: null,
|
|
46
|
-
started_at: null,
|
|
47
|
-
completed_at: null,
|
|
44
|
+
state: { status: "queued" },
|
|
48
45
|
};
|
|
49
46
|
}
|
|
50
47
|
|
|
@@ -85,8 +82,8 @@ describe("useRunStaleCells", () => {
|
|
|
85
82
|
|
|
86
83
|
it("syncs pending edits before choosing the stale cells", async () => {
|
|
87
84
|
const { replica, document } = seed([
|
|
88
|
-
MockExecutions.completed(C1,
|
|
89
|
-
MockExecutions.completed(C2,
|
|
85
|
+
{ ...MockExecutions.completed(C1), code_fingerprint: "c1-hash" },
|
|
86
|
+
{ ...MockExecutions.completed(C2), code_fingerprint: "c2-hash" },
|
|
90
87
|
]);
|
|
91
88
|
store.set(
|
|
92
89
|
notebookAtom,
|
|
@@ -113,7 +110,7 @@ describe("useRunStaleCells", () => {
|
|
|
113
110
|
});
|
|
114
111
|
|
|
115
112
|
it("does nothing when the notebook changed while the flush was pending", async () => {
|
|
116
|
-
seed([MockExecutions.completed(C1,
|
|
113
|
+
seed([{ ...MockExecutions.completed(C1), code_fingerprint: "stale" }]);
|
|
117
114
|
store.set(
|
|
118
115
|
notebookAtom,
|
|
119
116
|
MockNotebook.notebookState({ cellData: { [C1]: { code: "x = 1" } } }),
|
|
@@ -131,7 +128,7 @@ describe("useRunStaleCells", () => {
|
|
|
131
128
|
});
|
|
132
129
|
|
|
133
130
|
it("runs nothing while edits cannot reach the host", async () => {
|
|
134
|
-
seed([MockExecutions.completed(C1,
|
|
131
|
+
seed([{ ...MockExecutions.completed(C1), code_fingerprint: "stale" }]);
|
|
135
132
|
store.set(
|
|
136
133
|
notebookAtom,
|
|
137
134
|
MockNotebook.notebookState({ cellData: { [C1]: { code: "x = 1" } } }),
|
|
@@ -436,11 +436,13 @@ describe("SendErrorReportButton", () => {
|
|
|
436
436
|
const replica = MockExecutions.seed(
|
|
437
437
|
store,
|
|
438
438
|
[
|
|
439
|
-
|
|
440
|
-
CELL_ID,
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
439
|
+
{
|
|
440
|
+
...MockExecutions.failed(CELL_ID, {
|
|
441
|
+
name: "NameError",
|
|
442
|
+
message: MESSAGE,
|
|
443
|
+
}),
|
|
444
|
+
code_fingerprint: "ran",
|
|
445
|
+
},
|
|
444
446
|
],
|
|
445
447
|
null,
|
|
446
448
|
confirmed("ran"),
|
|
@@ -21,7 +21,7 @@ export const hasBlockingStdinAtom = atom((get) => {
|
|
|
21
21
|
for (const { record, items } of get(
|
|
22
22
|
replica.executionsAtom,
|
|
23
23
|
).executions.values()) {
|
|
24
|
-
if (record.status === "running") {
|
|
24
|
+
if (record.state.status === "running") {
|
|
25
25
|
for (const item of items.values()) {
|
|
26
26
|
if (item.kind === "input" && item.status === "pending") {
|
|
27
27
|
return true;
|
|
@@ -94,11 +94,10 @@ describe("clearing a running cell", () => {
|
|
|
94
94
|
notebookAtom,
|
|
95
95
|
MockNotebook.notebookState({ cellData: { [A]: {} } }),
|
|
96
96
|
);
|
|
97
|
-
const running = MockExecutions.
|
|
98
|
-
|
|
99
|
-
{ mimetype: "text/plain", data: "so far" },
|
|
100
|
-
|
|
101
|
-
);
|
|
97
|
+
const running = MockExecutions.running(A, {
|
|
98
|
+
kind: "value",
|
|
99
|
+
display: { mimetype: "text/plain", data: "so far" },
|
|
100
|
+
});
|
|
102
101
|
const replica = MockExecutions.seed(store, [running], null, DOCUMENT);
|
|
103
102
|
store.set(clearCellOutputAtom, { cellId: A });
|
|
104
103
|
expect(store.get(cellOutputAtom(A))).toBeNull();
|
|
@@ -111,11 +110,11 @@ describe("clearing a running cell", () => {
|
|
|
111
110
|
id: "more",
|
|
112
111
|
data: {
|
|
113
112
|
execution: {
|
|
114
|
-
...running,
|
|
115
|
-
outcome: {
|
|
113
|
+
...MockExecutions.running(A, {
|
|
116
114
|
kind: "value",
|
|
117
115
|
display: { mimetype: "text/plain", data: "more" },
|
|
118
|
-
},
|
|
116
|
+
}),
|
|
117
|
+
id: running.id,
|
|
119
118
|
},
|
|
120
119
|
},
|
|
121
120
|
},
|
|
@@ -130,7 +129,7 @@ describe("clearing a running cell", () => {
|
|
|
130
129
|
{
|
|
131
130
|
event: "execution",
|
|
132
131
|
id: "again",
|
|
133
|
-
data: { execution: { ...running
|
|
132
|
+
data: { execution: { ...running } },
|
|
134
133
|
},
|
|
135
134
|
{ phase: "live" },
|
|
136
135
|
),
|
|
@@ -20,11 +20,7 @@ const queued = {
|
|
|
20
20
|
caused_by: null,
|
|
21
21
|
cell_id: "cell",
|
|
22
22
|
code_fingerprint: "fp",
|
|
23
|
-
|
|
24
|
-
status: "queued",
|
|
25
|
-
outcome: null,
|
|
26
|
-
started_at: null,
|
|
27
|
-
completed_at: null,
|
|
23
|
+
state: { status: "queued" },
|
|
28
24
|
} satisfies Execution;
|
|
29
25
|
|
|
30
26
|
function observe(
|
|
@@ -42,19 +38,19 @@ describe("execution traces", () => {
|
|
|
42
38
|
it("derives the same trace from live transitions and a retained completion", () => {
|
|
43
39
|
const started_at = "1970-01-01T00:01:40Z";
|
|
44
40
|
const completed = {
|
|
41
|
+
depends_on: {},
|
|
45
42
|
started_at,
|
|
46
43
|
completed_at: "1970-01-01T00:01:42Z",
|
|
47
44
|
status: "completed",
|
|
48
45
|
outcome: { kind: "interrupted" },
|
|
49
|
-
} satisfies
|
|
46
|
+
} satisfies Execution["state"];
|
|
50
47
|
const runId = "r1" as RunId;
|
|
51
48
|
const running = observe(observe(initialState()), {
|
|
52
|
-
started_at,
|
|
53
|
-
status: "running",
|
|
49
|
+
state: { started_at, status: "running", value: null },
|
|
54
50
|
});
|
|
55
51
|
for (const state of [
|
|
56
|
-
observe(running, completed),
|
|
57
|
-
observe(initialState(), completed),
|
|
52
|
+
observe(running, { state: completed }),
|
|
53
|
+
observe(initialState(), { state: completed }),
|
|
58
54
|
]) {
|
|
59
55
|
expect(state.runMap.get(runId)?.cellRuns.get(cellId("cell"))).toEqual({
|
|
60
56
|
cellId: "cell",
|
|
@@ -67,8 +63,7 @@ describe("execution traces", () => {
|
|
|
67
63
|
}
|
|
68
64
|
expect(
|
|
69
65
|
observe(running, {
|
|
70
|
-
...completed,
|
|
71
|
-
outcome: { kind: "value", display: null },
|
|
66
|
+
state: { ...completed, outcome: { kind: "value", display: null } },
|
|
72
67
|
})
|
|
73
68
|
.runMap.get(runId)
|
|
74
69
|
?.cellRuns.get(cellId("cell"))?.status,
|
|
@@ -79,12 +74,17 @@ describe("execution traces", () => {
|
|
|
79
74
|
"shows %s as skipped",
|
|
80
75
|
(reason) => {
|
|
81
76
|
const state = observe(initialState(), {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
77
|
+
state: {
|
|
78
|
+
status: "completed",
|
|
79
|
+
started_at: null,
|
|
80
|
+
completed_at: null,
|
|
81
|
+
depends_on: {},
|
|
82
|
+
outcome: {
|
|
83
|
+
kind: "skipped",
|
|
84
|
+
reason,
|
|
85
|
+
related: [],
|
|
86
|
+
message: "Did not run",
|
|
87
|
+
},
|
|
88
88
|
},
|
|
89
89
|
});
|
|
90
90
|
expect(
|
|
@@ -108,11 +108,13 @@ describe("readExport", () => {
|
|
|
108
108
|
expect.objectContaining({
|
|
109
109
|
cell_id: "c1",
|
|
110
110
|
code_fingerprint: "hash-1",
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
111
|
+
state: expect.objectContaining({
|
|
112
|
+
status: "completed",
|
|
113
|
+
outcome: {
|
|
114
|
+
kind: "value",
|
|
115
|
+
display: { mimetype: "text/html", data: "<b>1</b>" },
|
|
116
|
+
},
|
|
117
|
+
}),
|
|
116
118
|
}),
|
|
117
119
|
]);
|
|
118
120
|
});
|
|
@@ -162,7 +164,7 @@ describe("readExport", () => {
|
|
|
162
164
|
});
|
|
163
165
|
invariant(result.snapshot, "no snapshot");
|
|
164
166
|
expect(result.snapshot.results?.map((r) => r.cell_id)).toEqual(["c1"]);
|
|
165
|
-
expect(result.snapshot.results?.[0]?.
|
|
167
|
+
expect(result.snapshot.results?.[0]?.state).toHaveProperty("outcome", {
|
|
166
168
|
kind: "error",
|
|
167
169
|
error: expect.objectContaining({
|
|
168
170
|
kind: "exception",
|
|
@@ -313,7 +315,7 @@ describe("readExport", () => {
|
|
|
313
315
|
appConfig: {},
|
|
314
316
|
});
|
|
315
317
|
|
|
316
|
-
expect(result.snapshot?.results[0]?.
|
|
318
|
+
expect(result.snapshot?.results[0]?.state).toHaveProperty("outcome", {
|
|
317
319
|
kind: "error",
|
|
318
320
|
error: expect.objectContaining({
|
|
319
321
|
kind: "exception",
|
|
@@ -383,7 +385,7 @@ describe("readExport", () => {
|
|
|
383
385
|
appConfig: {},
|
|
384
386
|
});
|
|
385
387
|
|
|
386
|
-
expect(result.snapshot?.results[0]?.
|
|
388
|
+
expect(result.snapshot?.results[0]?.state).toHaveProperty("outcome", {
|
|
387
389
|
kind: "value",
|
|
388
390
|
display: { mimetype: "text/plain", data: "Hello World" },
|
|
389
391
|
});
|
|
@@ -747,7 +749,7 @@ describe("readExport", () => {
|
|
|
747
749
|
appConfig: {},
|
|
748
750
|
});
|
|
749
751
|
|
|
750
|
-
expect(result.snapshot?.results[0]?.
|
|
752
|
+
expect(result.snapshot?.results[0]?.state).toHaveProperty("outcome", {
|
|
751
753
|
kind: "value",
|
|
752
754
|
display: { mimetype: "text/plain", data: "First" },
|
|
753
755
|
});
|
|
@@ -771,7 +773,7 @@ describe("readExport", () => {
|
|
|
771
773
|
appConfig: {},
|
|
772
774
|
});
|
|
773
775
|
|
|
774
|
-
expect(result.snapshot?.results[0]?.
|
|
776
|
+
expect(result.snapshot?.results[0]?.state).toHaveProperty("outcome", {
|
|
775
777
|
kind: "value",
|
|
776
778
|
display: { mimetype: "text/plain", data: "Plain text" },
|
|
777
779
|
});
|
|
@@ -794,7 +796,7 @@ describe("readExport", () => {
|
|
|
794
796
|
appConfig: {},
|
|
795
797
|
});
|
|
796
798
|
|
|
797
|
-
expect(result.snapshot?.results[0]?.
|
|
799
|
+
expect(result.snapshot?.results[0]?.state).toHaveProperty("outcome", {
|
|
798
800
|
kind: "value",
|
|
799
801
|
display: null,
|
|
800
802
|
});
|
|
@@ -5,6 +5,7 @@ import type { Getter } from "jotai";
|
|
|
5
5
|
import type { ReducerCellActions } from "./cells";
|
|
6
6
|
import {
|
|
7
7
|
itemsInOrder,
|
|
8
|
+
startedAt,
|
|
8
9
|
type NotebookReplica,
|
|
9
10
|
type Execution as ReplicaExecution,
|
|
10
11
|
type Item,
|
|
@@ -79,7 +80,7 @@ export function consoleObservers(
|
|
|
79
80
|
onExecution(record, changed) {
|
|
80
81
|
VirtualFileTracker.INSTANCE.trackExecution(record);
|
|
81
82
|
if (changed) {
|
|
82
|
-
if (record.status === "running") {
|
|
83
|
+
if (record.state.status === "running") {
|
|
83
84
|
actions.startCellConsole({
|
|
84
85
|
cellId: (record.cell_id ?? SCRATCH_CELL_ID) as CellId,
|
|
85
86
|
});
|
|
@@ -89,10 +90,8 @@ export function consoleObservers(
|
|
|
89
90
|
},
|
|
90
91
|
onItem(record, item, live) {
|
|
91
92
|
const cellId = (record.cell_id ?? SCRATCH_CELL_ID) as CellId;
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
record.started_at ? Date.parse(record.started_at) / 1000 : 0,
|
|
95
|
-
);
|
|
93
|
+
const start = startedAt(record);
|
|
94
|
+
const output = consoleEntry(item, start ? Date.parse(start) / 1000 : 0);
|
|
96
95
|
if (output.channel === "media") {
|
|
97
96
|
VirtualFileTracker.INSTANCE.track({ cell_id: cellId, output });
|
|
98
97
|
}
|
|
@@ -146,9 +145,8 @@ export function consoleView(
|
|
|
146
145
|
const record = execution?.record;
|
|
147
146
|
const cleared = local.clearedConsole;
|
|
148
147
|
const hidden = local.clearedConsoleInputs;
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
: 0;
|
|
148
|
+
const start = record && startedAt(record);
|
|
149
|
+
const fallback = start ? Date.parse(start) / 1000 : 0;
|
|
152
150
|
const project = (item: Item) => {
|
|
153
151
|
if (
|
|
154
152
|
cleared &&
|
package/src/core/cells/runs.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { createReducerAndAtoms } from "@/utils/createReducer";
|
|
3
3
|
import type { TypedString } from "@/utils/typed";
|
|
4
4
|
import type { Execution } from "@marimo-team/client/protocol";
|
|
5
|
+
import { completedAt, startedAt } from "@/core/notebook/replica";
|
|
5
6
|
import type { CellId } from "./ids";
|
|
6
7
|
export type RunId = TypedString<"RunId">;
|
|
7
8
|
|
|
@@ -42,11 +43,11 @@ export const MAX_RUNS = 50;
|
|
|
42
43
|
export const MAX_CODE_LENGTH = 200;
|
|
43
44
|
|
|
44
45
|
function traceStatus(record: Execution): CellRun["status"] {
|
|
45
|
-
if (record.status !== "completed") {
|
|
46
|
-
return record.status;
|
|
46
|
+
if (record.state.status !== "completed") {
|
|
47
|
+
return record.state.status;
|
|
47
48
|
}
|
|
48
|
-
const outcome = record.outcome
|
|
49
|
-
return outcome === "value" ? "success" :
|
|
49
|
+
const outcome = record.state.outcome.kind;
|
|
50
|
+
return outcome === "value" ? "success" : outcome;
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
const {
|
|
@@ -75,14 +76,13 @@ const {
|
|
|
75
76
|
const cellRuns = new Map(previous?.cellRuns);
|
|
76
77
|
const prior = cellRuns.get(cellId);
|
|
77
78
|
const sameExecution = prior?.executionId === record.id ? prior : undefined;
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
: Date.parse(record.completed_at) / 1000;
|
|
79
|
+
const end = completedAt(record);
|
|
80
|
+
const start = startedAt(record);
|
|
81
|
+
const ended = end === null ? undefined : Date.parse(end) / 1000;
|
|
82
82
|
const startTime =
|
|
83
|
-
|
|
83
|
+
start === null
|
|
84
84
|
? (sameExecution?.startTime ?? ended ?? receivedAt)
|
|
85
|
-
: Date.parse(
|
|
85
|
+
: Date.parse(start) / 1000;
|
|
86
86
|
cellRuns.set(cellId, {
|
|
87
87
|
cellId,
|
|
88
88
|
executionId: record.id,
|
|
@@ -258,11 +258,13 @@ function resultRecord(
|
|
|
258
258
|
caused_by: null,
|
|
259
259
|
cell_id: cell.id,
|
|
260
260
|
code_fingerprint: cell.code_fingerprint,
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
261
|
+
state: {
|
|
262
|
+
status: "completed",
|
|
263
|
+
started_at: null,
|
|
264
|
+
completed_at: null,
|
|
265
|
+
outcome,
|
|
266
|
+
depends_on: {},
|
|
267
|
+
},
|
|
266
268
|
};
|
|
267
269
|
}
|
|
268
270
|
|
package/src/core/cells/utils.ts
CHANGED
|
@@ -171,7 +171,7 @@ function inFlight(executions: Executions, cellId: CellId): boolean {
|
|
|
171
171
|
latest === undefined
|
|
172
172
|
? undefined
|
|
173
173
|
: executions.executions.get(latest)?.record;
|
|
174
|
-
return record !== undefined && record.status !== "completed";
|
|
174
|
+
return record !== undefined && record.state.status !== "completed";
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
/**
|
|
@@ -28,7 +28,7 @@ type Store = ReturnType<typeof createStore>;
|
|
|
28
28
|
|
|
29
29
|
function run(
|
|
30
30
|
cells: Protocol.CellId[],
|
|
31
|
-
status: Protocol.
|
|
31
|
+
status: Protocol.RunState["status"] = "queued",
|
|
32
32
|
id = "run-1",
|
|
33
33
|
): Protocol.Run {
|
|
34
34
|
return {
|
|
@@ -36,10 +36,17 @@ function run(
|
|
|
36
36
|
notebook_id: "n1",
|
|
37
37
|
runtime_id: "r1",
|
|
38
38
|
origin: { kind: "cells", cell_ids: cells },
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
state:
|
|
40
|
+
status === "completed"
|
|
41
|
+
? {
|
|
42
|
+
status,
|
|
43
|
+
started_at: null,
|
|
44
|
+
completed_at: "2026-10-01T09:20:02Z",
|
|
45
|
+
outcome: "succeeded",
|
|
46
|
+
}
|
|
47
|
+
: status === "running"
|
|
48
|
+
? { status, started_at: "2026-10-01T09:20:01Z" }
|
|
49
|
+
: { status },
|
|
43
50
|
};
|
|
44
51
|
}
|
|
45
52
|
|