@marimo-team/islands 0.25.3-dev48 → 0.25.3-dev51
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-COS3f8io.js → ConnectedDataExplorerComponent-Da5OoEUL.js} +9 -9
- package/dist/{ErrorBoundary-DHfwqB0K.js → ErrorBoundary-CbxCC2kk.js} +8 -8
- package/dist/{abnfDiagram-VCTEODGH-DQ4bKxYa.js → abnfDiagram-VCTEODGH-Bz3mrprX.js} +2 -2
- package/dist/{any-language-editor-DQItQSua.js → any-language-editor-k2B8YI3Y.js} +2 -2
- package/dist/{architectureDiagram-5GKGNRK7-BA7-SI7Q.js → architectureDiagram-5GKGNRK7-Cs5ujb9K.js} +1 -1
- package/dist/{chat-ui-DlUp75HS.js → chat-ui-C1Gjgokv.js} +44 -44
- package/dist/{check-C209OH-W.js → check-P35dc2dH.js} +1 -1
- package/dist/{chunk-IMKFNOWR-DPY3kqOV.js → chunk-IMKFNOWR-CcTSaxZt.js} +1 -1
- package/dist/{chunk-SHT3W25Y-C14Ikodf.js → chunk-SHT3W25Y-DcJcjOaO.js} +1 -1
- package/dist/{chunk-SVP7TREG-BKu0HO4I.js → chunk-SVP7TREG-BVtDTjaF.js} +1 -1
- package/dist/{chunk-TICWLB2K-iJDDWGtE.js → chunk-TICWLB2K-BkDFkh8q.js} +1 -1
- package/dist/{classDiagram-ZZMXUADV-HuJXQI0F.js → classDiagram-ZZMXUADV-CfAt7HT5.js} +2 -2
- package/dist/{classDiagram-v2-VYDZK3BY-CpmmpTbC.js → classDiagram-v2-VYDZK3BY-CGEjNYa2.js} +2 -2
- package/dist/{code-visibility-5llx6KCK.js → code-visibility-DoZ9lxzx.js} +5 -5
- package/dist/{common-DBC1NAar.js → common-D1PacyXO.js} +75 -75
- package/dist/{copy-icon-L-mFk59e.js → copy-icon-CPoxUG7G.js} +2 -2
- package/dist/{cynefinDiagram-5FMLGOSQ-uh0puAW2.js → cynefinDiagram-5FMLGOSQ-BW6NmfJi.js} +1 -1
- package/dist/{dagre-GXQ25YYZ-4LBeAAMz.js → dagre-GXQ25YYZ-CWg3CTuF.js} +1 -1
- package/dist/{data-grid-overlay-editor-D01HzlXg.js → data-grid-overlay-editor-B50UpkXd.js} +1 -1
- package/dist/{diagram-S7CK7UJ4-BXPmZ2sX.js → diagram-S7CK7UJ4-BPxtoS-z.js} +1 -1
- package/dist/{diagram-UQ7AKVKN--Xz9UNpC.js → diagram-UQ7AKVKN-DA-vJdFL.js} +1 -1
- package/dist/{diagram-VX7I27RA-rt8VIRNT.js → diagram-VX7I27RA-D6bkR84S.js} +1 -1
- package/dist/{diagram-Z3DM3KII-Cs1GqfDD.js → diagram-Z3DM3KII-m60g4cAT.js} +1 -1
- package/dist/{dialog-CDbPtWUD.js → dialog-C1PcpCqX.js} +24 -24
- package/dist/{dropdown-menu-ugNoZmKx.js → dropdown-menu-MG5hiCIa.js} +793 -793
- package/dist/{ebnfDiagram-PWID7BFC-CgTsgbmZ.js → ebnfDiagram-PWID7BFC-CK99sho2.js} +2 -2
- package/dist/{erDiagram-RLTQ6QDP-CFoADGzT.js → erDiagram-RLTQ6QDP-Bryq0tdE.js} +1 -1
- package/dist/{error-banner-DMIrHA-R.js → error-banner-Sl2FlSJ4.js} +16 -16
- package/dist/{error-entries-D3ouOLDe.js → error-entries-CMNtA8NK.js} +25 -25
- package/dist/{feedback-button-gTC25Y-p.js → feedback-button-DqPqwryB.js} +8 -8
- package/dist/{flowDiagram-HODETNUW-BM2lvKuH.js → flowDiagram-HODETNUW-D-3aRpfS.js} +2 -2
- package/dist/{formats-C24TvExI.js → formats-6pLWWrY2.js} +1 -1
- package/dist/{glide-data-editor-BXXphavz.js → glide-data-editor-BxMhUd3K.js} +10 -10
- package/dist/{glide-utils-Q2ZsuA3h.js → glide-utils-Bt8_pBa2.js} +2 -2
- package/dist/{globals-BcxqBRmX.js → globals-DTJa_doJ.js} +3 -3
- package/dist/{html-to-image-VZvb968z.js → html-to-image-By72ALyI.js} +44 -44
- package/dist/{infoDiagram-27XIBGKW-Crwjiywp.js → infoDiagram-27XIBGKW-s1C1kgfU.js} +1 -1
- package/dist/{ishikawaDiagram-5VMMS53U-D4US2ShV.js → ishikawaDiagram-5VMMS53U-CCsRgolY.js} +1 -1
- package/dist/{kanban-definition-UXKFOSKX-Bk097CUX.js → kanban-definition-UXKFOSKX-BrmxDlcc.js} +1 -1
- package/dist/{label-CuEjBqYP.js → label-BRnUC0NX.js} +1 -1
- package/dist/main.js +614 -614
- package/dist/{mermaid-6EkeBlhr.js → mermaid-DKI0869I.js} +35 -35
- package/dist/{mindmap-definition-YA3MSWOX-DmORzfXQ.js → mindmap-definition-YA3MSWOX-641xJysF.js} +1 -1
- package/dist/{number-overlay-editor-CaspWg5p.js → number-overlay-editor-Z_H6x5b-.js} +1 -1
- package/dist/{pegDiagram-XKGWAZYB-DT5TL02S.js → pegDiagram-XKGWAZYB-keVUAUeS.js} +2 -2
- package/dist/{pieDiagram-E7YTZNPT-B1NwGcuH.js → pieDiagram-E7YTZNPT-DHktXPO_.js} +1 -1
- package/dist/{process-output-CCPgTShO.js → process-output-D-OMW5sV.js} +4 -4
- package/dist/{railroadDiagram-O6MQD6OU-BxoycdEu.js → railroadDiagram-O6MQD6OU-BVEF4OV_.js} +2 -2
- package/dist/{requirementDiagram-BXWQKSXE-DHq_eRrm.js → requirementDiagram-BXWQKSXE-CWo-UAKV.js} +1 -1
- package/dist/{reveal-component-CWk_paD2.js → reveal-component-tAB5K3QE.js} +9 -9
- package/dist/{select-D2iqeJYk.js → select-B0LRDH0g.js} +199 -199
- package/dist/{sequenceDiagram-WJ2MYXX4-Ba11BAOu.js → sequenceDiagram-WJ2MYXX4-CHQvLnq4.js} +1 -1
- package/dist/{spec-BCCcvWPS.js → spec-C-LRKGtT.js} +4 -4
- package/dist/{stateDiagram-D77RDMKH-OHQbvkbP.js → stateDiagram-D77RDMKH-BOJZgbUJ.js} +2 -2
- package/dist/{stateDiagram-v2-MP3YSRHH-BlIquvFJ.js → stateDiagram-v2-MP3YSRHH-C53XXdYH.js} +2 -2
- package/dist/{swimlanes-42K2YHIH-DSlitS4s.js → swimlanes-42K2YHIH-D2o1gOtw.js} +1 -1
- package/dist/{swimlanesDiagram-VR7AAH4N-ClwuzFNO.js → swimlanesDiagram-VR7AAH4N-BHFzN1Wk.js} +2 -2
- package/dist/{timeline-definition-24CTP7MA-hAzc5VkT.js → timeline-definition-24CTP7MA-rv7QUa46.js} +1 -1
- package/dist/toDate-CjPuEPou.js +705 -0
- package/dist/{toast-DxVfYlCp.js → toast-CFWpihJU.js} +221 -221
- package/dist/{tooltip-BCntm-jf.js → tooltip-CKO1pHJo.js} +51 -51
- package/dist/{use-restore-focus-BhXhsNLV.js → use-restore-focus-DBCITLeF.js} +1 -1
- package/dist/{useAsyncData-BbuzBAUp.js → useAsyncData-ChgNtdmE.js} +1 -1
- package/dist/{useDateFormatter-6AHbIR-J.js → useDateFormatter-c_yJtkAe.js} +2 -2
- package/dist/{useDeepCompareMemoize-da5A3c-Y.js → useDeepCompareMemoize-Bet7kSsI.js} +1 -1
- package/dist/{useLifecycle-C3nT1kwI.js → useLifecycle-VVmz_24o.js} +2 -2
- package/dist/{useTheme-BC8Lof0B.js → useTheme-DympCsQg.js} +83 -83
- package/dist/{vega-component-CF9IzE2r.js → vega-component-DnfQeoyt.js} +7 -7
- package/dist/{vennDiagram-4TSXK5OY-CINKaJgr.js → vennDiagram-4TSXK5OY-D36Zk7t-.js} +1 -1
- package/dist/{wardleyDiagram-VM6X3IG4-KG2tlXg_.js → wardleyDiagram-VM6X3IG4-BLBolvyQ.js} +1 -1
- package/dist/{xychartDiagram-S5SC5T6Z-XIH5cwgI.js → xychartDiagram-S5SC5T6Z-CfH57l0v.js} +1 -1
- package/package.json +1 -1
- package/src/__tests__/mount.test.ts +0 -20
- package/src/components/editor/chrome/wrapper/__tests__/attachment-status.test.tsx +2 -2
- package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +2 -2
- package/src/core/host/__tests__/notebook-client.test.ts +66 -3
- package/src/core/host/events.ts +1 -10
- package/src/core/host/notebook-client.ts +11 -18
- package/src/core/runtime/__tests__/runtime.test.ts +2 -53
- package/src/core/runtime/runtime.ts +1 -14
- package/src/core/runtime/types.ts +0 -2
- package/src/core/websocket/__tests__/useNotebookClient.hook.test.tsx +2 -23
- package/src/core/websocket/__tests__/useNotebookSession.hook.test.tsx +17 -25
- package/src/core/websocket/transports/__tests__/sse.test.ts +17 -0
- package/src/core/websocket/transports/sse.ts +14 -2
- package/src/core/websocket/useNotebookClient.ts +1 -11
- package/src/core/websocket/useNotebookSession.tsx +1 -6
- package/src/mount.tsx +0 -4
- package/dist/toDate-C0jaysq2.js +0 -1184
package/dist/toDate-C0jaysq2.js
DELETED
|
@@ -1,1184 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./rolldown-runtime-Cb76FRpK.js";
|
|
2
|
-
import { g as t } from "./button-BxB3RDjN.js";
|
|
3
|
-
import { t as n } from "./compiler-runtime-CldRdSsv.js";
|
|
4
|
-
import { h as r } from "./tooltip-BCntm-jf.js";
|
|
5
|
-
import { B as i, C as a, D as o, I as s, L as c, P as l, k as u, l as d, q as f, w as p, x as m, y as h, z as g } from "./use-restore-focus-BhXhsNLV.js";
|
|
6
|
-
import { C as _, E as v, _ as y, a as b, b as x } from "./useTheme-BC8Lof0B.js";
|
|
7
|
-
import { t as S } from "./invariant-DLmrl-hA.js";
|
|
8
|
-
var C = r("circle-question-mark", [
|
|
9
|
-
["circle", {
|
|
10
|
-
cx: "12",
|
|
11
|
-
cy: "12",
|
|
12
|
-
r: "10",
|
|
13
|
-
key: "1mglay"
|
|
14
|
-
}],
|
|
15
|
-
["path", {
|
|
16
|
-
d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",
|
|
17
|
-
key: "1u773s"
|
|
18
|
-
}],
|
|
19
|
-
["path", {
|
|
20
|
-
d: "M12 17h.01",
|
|
21
|
-
key: "p32p05"
|
|
22
|
-
}]
|
|
23
|
-
]);
|
|
24
|
-
//#endregion
|
|
25
|
-
//#region ../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/iso.js
|
|
26
|
-
function w(e) {
|
|
27
|
-
return f(d, e);
|
|
28
|
-
}
|
|
29
|
-
//#endregion
|
|
30
|
-
//#region src/utils/assertExists.ts
|
|
31
|
-
var T = n();
|
|
32
|
-
function E(e, t) {
|
|
33
|
-
if (e == null) throw Error(t || `Expected value but got ${e}`);
|
|
34
|
-
}
|
|
35
|
-
//#endregion
|
|
36
|
-
//#region src/core/wasm/utils.ts
|
|
37
|
-
function D() {
|
|
38
|
-
return typeof document < "u" && document.querySelector("marimo-wasm") !== null;
|
|
39
|
-
}
|
|
40
|
-
//#endregion
|
|
41
|
-
//#region src/utils/Deferred.ts
|
|
42
|
-
var O = class {
|
|
43
|
-
promise;
|
|
44
|
-
resolve;
|
|
45
|
-
reject;
|
|
46
|
-
status = "pending";
|
|
47
|
-
value = void 0;
|
|
48
|
-
constructor() {
|
|
49
|
-
this.promise = new Promise((e, t) => {
|
|
50
|
-
this.reject = (e) => {
|
|
51
|
-
this.status = "rejected", t(e);
|
|
52
|
-
}, this.resolve = (t) => {
|
|
53
|
-
this.status = "resolved", k(t) || (this.value = t), e(t);
|
|
54
|
-
};
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
function k(e) {
|
|
59
|
-
return typeof e == "object" && !!e && "then" in e && typeof e.then == "function";
|
|
60
|
-
}
|
|
61
|
-
//#endregion
|
|
62
|
-
//#region src/core/mode.ts
|
|
63
|
-
function A() {
|
|
64
|
-
let e = y.get(M);
|
|
65
|
-
return E(e, "internal-error: initial mode not found"), S(e !== "present", "internal-error: initial mode cannot be 'present'"), e;
|
|
66
|
-
}
|
|
67
|
-
var j = v({
|
|
68
|
-
mode: x() ? "read" : "not-set",
|
|
69
|
-
cellAnchor: null
|
|
70
|
-
}), M = v(void 0);
|
|
71
|
-
function ee() {
|
|
72
|
-
let e = y.get(M);
|
|
73
|
-
return e !== "home" && e !== "gallery";
|
|
74
|
-
}
|
|
75
|
-
var N = v(!1);
|
|
76
|
-
function te() {
|
|
77
|
-
let e = (0, T.c)(1), { mode: t } = _(j), n = _(N), r;
|
|
78
|
-
return e[0] === Symbol.for("react.memo_cache_sentinel") ? (r = new URLSearchParams(window.location.search).get(b.kiosk), e[0] = r) : r = e[0], t !== "read" && !n && r !== "true";
|
|
79
|
-
}
|
|
80
|
-
//#endregion
|
|
81
|
-
//#region ../packages/client/dist/protocol.js
|
|
82
|
-
var P = c().min(1).describe("Identifies a project. Unique within the host and unchanged while the project exists."), F = c().min(1).describe("Identifies a notebook. Unique within the host and unchanged while the notebook exists."), I = c().min(1).describe("Identifies a runtime. Unique within the host; every start and restart creates a new id."), ne = c().min(1).describe("Identifies an attachment. Unique within the host."), L = c().min(1).describe("Identifies a run independently of the request's `Idempotency-Key`. Events carry the key in `request_id`."), R = c().min(1).describe("Identifies an execution. Unique within the host."), z = c().min(1).describe("Identifies a console, display, or variable item. Unique within the host; sending an item again with the same id replaces it."), B = c().min(1).describe("Identifies a cell within its notebook. Stable while the host serves the notebook; whether it survives a reload of the store depends on the format. `setup` is the setup cell."), re = l({
|
|
83
|
-
pid: o().min(1).describe("The process id."),
|
|
84
|
-
started_at: w({ offset: !0 }).describe("When the process started.")
|
|
85
|
-
}).describe("The process that wrote a record. A client checks that a process\nwith this `pid` that started at `started_at` still exists. If it\ndoes not, the record is stale and may be removed.\n");
|
|
86
|
-
l({
|
|
87
|
-
version: u(1).describe("The version of this record's format. This document describes version 1."),
|
|
88
|
-
process: re,
|
|
89
|
-
name: c().describe("A label for the host to show people, such as `VS Code` or `marimo`. Two hosts can share a name; the filename is the identity."),
|
|
90
|
-
url: c().describe("Where the host's API is. The scheme is `http`, and the host part is `127.0.0.1` or `[::1]`, written exactly that way."),
|
|
91
|
-
token: c().min(1).describe("The secret a client sends to prove it read the record.")
|
|
92
|
-
}).describe("A host record is the file a host writes so that clients can find\nit. A host writes `<marimo-state-dir>/hosts-v1/<id>.json` once its API\nis serving at `url`, where `<id>` is an identifier the host makes\nup each time it starts. The record does not change while the host\nruns, and the host removes it when it stops.\n\nA client reads `version` before anything else and skips any record\nit cannot parse or whose version it does not support. It also\nchecks that the file and its directory belong to the current user\nand cannot be read by others, and that `url` points at this\nmachine.\n"), h([
|
|
93
|
-
"host",
|
|
94
|
-
"project",
|
|
95
|
-
"notebook",
|
|
96
|
-
"document",
|
|
97
|
-
"analysis",
|
|
98
|
-
"cell",
|
|
99
|
-
"runtime",
|
|
100
|
-
"attachment",
|
|
101
|
-
"run",
|
|
102
|
-
"execution",
|
|
103
|
-
"console",
|
|
104
|
-
"display",
|
|
105
|
-
"variable",
|
|
106
|
-
"custom"
|
|
107
|
-
]).describe("The kinds a stream carries, and the values `types` accepts. The\ncatalog stream carries host, project, notebook, runtime, and\nattachment. A notebook's stream carries notebook, document,\nanalysis, cell, runtime, attachment, run, execution, console,\ndisplay, variable, and custom. Custom events describe occurrences\nrather than object state.\n");
|
|
108
|
-
var ie = l({
|
|
109
|
-
type: c().min(1).describe("A namespaced event type under a namespace the producer controls, such as `marimo.pair.agent-message`. Clients ignore types they do not recognize while retaining the stream cursor."),
|
|
110
|
-
data: i().describe("Any JSON value, including null. The producer defines its schema and consumers of the type validate it.")
|
|
111
|
-
}).describe("A notebook occurrence with a producer-defined payload. It is replayed\nwhile event history is retained, but is never included in snapshots\nand does not belong to a run. The notebook is identified by the stream.\n"), ae = l({ operations: a(c()).describe("The operations this host implements, such as `runtime.start`. Whether a client may call one on a given project or notebook is that object's `operations`. Clients accept names they do not recognize.") }).describe("What the host can do. There is exactly one host object, and it is\nthe first object in a snapshot when the filter includes `host`.\nA resumed stream only sends it if its operations changed since\nthe cursor. The host sends it again if its operations change.\n"), oe = h([
|
|
112
|
-
"indexing",
|
|
113
|
-
"indexed",
|
|
114
|
-
"partial"
|
|
115
|
-
]).describe("How far a host has gotten finding the notebooks in a project.\nWhile it is `indexing`, more notebooks are coming. Once it is\n`indexed`, the host believes it has found every notebook under the\nroot. A `partial` project is one the host stopped scanning on\npurpose, or one with something it could not read.\n"), se = l({
|
|
116
|
-
id: P,
|
|
117
|
-
name: c().describe("A label to show people, usually the name of the root directory."),
|
|
118
|
-
root: c().nullable().describe("The absolute path of the project's directory, written the way the host's operating system writes paths. Null when the project has no directory."),
|
|
119
|
-
status: oe,
|
|
120
|
-
message: c().nullable().describe("Why the host stopped scanning. Null unless `status` is `partial`."),
|
|
121
|
-
operations: a(c()).describe("Operations this client may call on the project, today `notebook.create`. A subset of `host.operations`, narrowed by permission and never by state. The host sends the project again when it changes.")
|
|
122
|
-
}).describe("A project is a group of notebooks that the host presents together, usually a directory."), ce = l({
|
|
123
|
-
id: F,
|
|
124
|
-
project_id: P,
|
|
125
|
-
path: c().nullable().describe("The file's path relative to the project root, written the way the host's operating system writes paths. Null when the notebook has no file, such as one not yet saved, or one deleted while a runtime still refers to it."),
|
|
126
|
-
name: c().describe("A label to show people. Derived from the filename when the host has nothing better."),
|
|
127
|
-
operations: a(c()).describe("Operations this client may call on the notebook, such as `notebook.edit` or `runtime.start`. A subset of `host.operations`, narrowed by permission and never by state; whether a runtime is attached shows in the `runtime` object, and preconditions still apply when an operation is called. The host sends the notebook again when it changes."),
|
|
128
|
-
updated_at: w({ offset: !0 }).nullable().describe("When the file was last modified, as of the host's last look at it. Null when the host does not know.")
|
|
129
|
-
}).describe("A notebook is a document and its results as the host knows them,\nusually backed by a file. Its kernel, when it has one, is a\nseparate object, the runtime. A host sends at most one `notebook`\nevent per second for the same notebook, since `updated_at`\nchanges on every save.\n"), le = h([
|
|
130
|
-
"starting",
|
|
131
|
-
"running",
|
|
132
|
-
"terminating",
|
|
133
|
-
"failed"
|
|
134
|
-
]).describe("Where a runtime is in its life. A `starting` runtime is bringing\nits kernel up. A `running` runtime accepts work. A `terminating`\nruntime is shutting its kernel down. A `failed` runtime could not\nstart, or its kernel exited unexpectedly. A runtime that has\nended is removed rather than given a status.\n"), ue = l({
|
|
135
|
-
id: I,
|
|
136
|
-
notebook_id: F,
|
|
137
|
-
status: le,
|
|
138
|
-
message: c().nullable().describe("A note about the current status, such as progress while `starting` or the reason when `failed`. Null otherwise."),
|
|
139
|
-
marimo_version: c().nullable().describe("The version of marimo running the kernel. Null until the host knows it."),
|
|
140
|
-
started_at: w({ offset: !0 }).describe("When this runtime started.")
|
|
141
|
-
}).describe("A runtime is a kernel attached to one notebook, and a notebook has\nat most one. It ends when a client or the host stops it or its\nprocess exits, and the host then sends `runtime.removed`. Every start and restart creates\na new runtime with a new id. Results carry their producer's runtime\nid so clients can tell which are live.\n"), de = /* @__PURE__ */ RegExp("^[!-~]+$"), fe = /* @__PURE__ */ RegExp("^[a-z0-9-]+$"), pe = l({
|
|
142
|
-
id: ne,
|
|
143
|
-
notebook_id: F,
|
|
144
|
-
identity: c().min(1).max(128).regex(de).optional().describe("The opaque client identity supplied by `Marimo-Attachment-Identity`.\nOmitted when none was supplied. Consumers can group attachments\nwith the same identity within a host. It does not identify an\nindividual connection or change its lifetime.\n"),
|
|
145
|
-
kind: c().regex(fe).describe("What kind of thing is attached, supplied by `Marimo-Attachment-Kind`, such as `browser`, `editor`, or `agent`. Defaults to `client` when the header is omitted. Clients accept kinds they do not recognize."),
|
|
146
|
-
name: c().max(256).nullable().describe("A label to show people, supplied by `Marimo-Attachment-Name`, such as the browser or editor's name. Null when the header is omitted or empty."),
|
|
147
|
-
since: w({ offset: !0 }).describe("When it attached.")
|
|
148
|
-
}).describe("An attachment is a consumer connected to a notebook, such as a\nbrowser tab, an editor, or an agent. Opening the notebook's stream\ncreates one. It is removed when that connection closes, and not\nwhen the notebook's runtime stops or restarts. Each stream has its\nown attachment, even when several share a client identity.\n"), V = h([
|
|
149
|
-
"queued",
|
|
150
|
-
"running",
|
|
151
|
-
"completed"
|
|
152
|
-
]).describe("Where a run or execution is in its lifecycle. An execution is\n`queued` until it starts, `running` while code executes, and\n`completed` once it has ended. How it ended is its `outcome`.\n"), me = h([
|
|
153
|
-
"succeeded",
|
|
154
|
-
"failed",
|
|
155
|
-
"interrupted"
|
|
156
|
-
]).describe("How a run ended. `succeeded` means its work settled without an\nexecution error or interruption. `failed` means an execution\nfailed or the host could not finish the cycle. `interrupted`\nmeans the cycle was cut short by interruption, even if an earlier\nexecution failed. Execution outcomes retain their individual results.\n"), he = l({
|
|
157
|
-
id: L,
|
|
158
|
-
notebook_id: F,
|
|
159
|
-
caused_by: g([R, m()]).describe("The execution that caused this runtime-scheduled run. This records provenance, not membership in that execution's run, and does not extend the earlier run's lifetime. Null for a client request or when the runtime does not know the source."),
|
|
160
|
-
status: V.describe("Queued until the first execution starts, running until the cycle has settled or been terminated, and completed once all member executions are terminal and no more can be scheduled in this run. A run can complete with no executions."),
|
|
161
|
-
outcome: g([me, m()]).describe("Null until completed, then final. Published with the terminal status and completed_at. An execution failure does not complete a run while other work remains. Interruption must have taken effect, not merely been requested."),
|
|
162
|
-
started_at: w({ offset: !0 }).nullable().describe("When the first execution started. Null if none has started."),
|
|
163
|
-
completed_at: w({ offset: !0 }).nullable().describe("When the run ended. Null until the run is `completed`.")
|
|
164
|
-
}).describe("One bounded cycle of notebook work initiated by an action. It\nincludes synchronous callbacks and reactive work owned and awaited\nby the runtime's scheduler. Context inherited by an independent task\nrecords provenance, not ownership of the cycle. The host completes it\nonly after all member executions have ended and scheduling for the\ncycle has finished. It never reopens or acquires new executions.\nIndependently triggered later work starts another run, even when\nits cause belongs to an earlier run. Every consumer attached to\nthe notebook sees it.\n\nRetention is up to the host and independent of replay history.\nHosts SHOULD retain ephemeral results briefly after completion to\nallow reconnection. Runs, executions, and items each have removal\nevents; a cell result may outlive its run.\n"), H = l({
|
|
165
|
-
mimetype: c().describe("The format of `data`, such as `text/html` or `image/png`."),
|
|
166
|
-
data: c().describe("The rendered value. JSON mimetypes are encoded as text; binary mimetypes are base64. Never a URL only the runtime can serve.")
|
|
167
|
-
}).describe("A rendered value."), U = l({
|
|
168
|
-
execution: R.describe("The execution whose evaluation produced the value. Usually the variable's `execution_id`, and earlier when the runtime carried the value forward."),
|
|
169
|
-
update: o().min(0).describe("How many times the value has been updated since it was produced. Zero at binding.")
|
|
170
|
-
}).describe("A variable's value at a point in time. Two revisions are equal\nwhen `execution` and `update` are equal. Clients compare\nrevisions for equality.\n"), ge = l({
|
|
171
|
-
id: z,
|
|
172
|
-
execution_id: R.describe("The execution that bound the name."),
|
|
173
|
-
name: c().describe("The name in the namespace."),
|
|
174
|
-
revision: U,
|
|
175
|
-
type: c().nullable().describe("The runtime's label for the value's type. A host may leave it null."),
|
|
176
|
-
preview: c().nullable().describe("A short rendering of the value. A host may leave it null.")
|
|
177
|
-
}).describe("A name a cell's execution bound in the notebook's namespace, with\nthe revision of its value. The execution binds it as it ends, and\nthe item is removed with the execution. An update, as when a\nstate setter runs or a client sets a value, advances the revision\nwithout binding again, and the producer sends the item again with\nthe same id. Hosts publish a cell execution's variables before its\n`completed` status, and remove a cell's previous execution and\nits items before publishing the next one. A scratch execution's\nnames live only while it runs, so it publishes no variables.\n"), W = l({
|
|
178
|
-
line: o().min(0).describe("Zero-based line within the code."),
|
|
179
|
-
character: o().min(0).describe("Zero-based offset in the line, in UTF-16 code units.")
|
|
180
|
-
}).describe("A position within code, using LSP coordinates."), G = l({
|
|
181
|
-
start: W,
|
|
182
|
-
end: W.describe("Exclusive end. Equal to start when only a point is known.")
|
|
183
|
-
}).describe("A span within code."), _e = l({
|
|
184
|
-
cell_id: B,
|
|
185
|
-
range: g([G, m()]).describe("Where in that cell, when known."),
|
|
186
|
-
message: c().describe("What that cell contributes, such as `reads x from C`.")
|
|
187
|
-
}).describe("A cell involved in an error, possibly the one carrying it."), K = l({
|
|
188
|
-
kind: c().describe("The producer's identifier, scoped by source. Open; this protocol defines `exception`, `interrupted`, and `internal` for executions, and reserves `multiple-definitions` and `cycle-dependencies` for analysis, because every host schedules them the same way. Clients show unrecognized kinds as plain errors."),
|
|
189
|
-
message: c().describe("A description of the error to show people."),
|
|
190
|
-
source: c().nullable().describe("Who produced it, such as `marimo` or a SQL analyzer. Scopes kind."),
|
|
191
|
-
severity: h([
|
|
192
|
-
"error",
|
|
193
|
-
"warning",
|
|
194
|
-
"information",
|
|
195
|
-
"hint"
|
|
196
|
-
]).describe("Error unless the producer says otherwise. Only error affects scheduling."),
|
|
197
|
-
range: g([G, m()]).describe("Where in the code, when known."),
|
|
198
|
-
name: c().nullable().describe("The exception class, such as `ZeroDivisionError`. Set when kind is exception, null otherwise."),
|
|
199
|
-
traceback: g([H, m()]).describe("The traceback as rendered by the runtime, plain text or HTML by its mimetype. Null when unavailable or not shown."),
|
|
200
|
-
related: a(_e).describe("Every involved cell, including this one, in canonical order. Each copy of a cross-cell error carries the same list; clients deduplicate on kind and related cell ids. Empty when the error involves this code alone.")
|
|
201
|
-
}).describe("A problem shaped like an LSP diagnostic. Further members are\nkind-specific, as in Problem Details, and a client ignores\nmembers it does not know.\n"), ve = l({
|
|
202
|
-
kind: h(["value"]),
|
|
203
|
-
display: g([H, m()]).describe("The value as last rendered. Replaced as it grows. Null when the code produced no value.")
|
|
204
|
-
}), ye = l({
|
|
205
|
-
kind: h(["error"]),
|
|
206
|
-
error: K
|
|
207
|
-
}), be = l({ kind: h(["interrupted"]) }), xe = g([
|
|
208
|
-
ve,
|
|
209
|
-
ye,
|
|
210
|
-
be
|
|
211
|
-
]).describe("How an execution ended, tagged on `kind`. A `value` carries the\nexecution's value as last rendered; while the execution is\nrunning it is the value so far, and it is final once the\nexecution is `completed`. An `error` carries the error that ended it.\nAn `interrupted` execution was cancelled before or during execution. Other\nkinds are defined by later versions of this protocol.\n"), q = c().describe("An identifier derived from content, so that every host, kernel,\nand store computes the same value for the same state. It is the\nfirst 16 hexadecimal characters, in lower case, of SHA-256 over\nthe UTF-8 encoding of a canonical text. Each etag says what its\ntext is; a text made of several values is those values joined by\nnewlines. Clients do not compute etags. They read them from the\nstream and from responses, and send them back as preconditions.\n"), Se = l({
|
|
212
|
-
id: R,
|
|
213
|
-
run_id: g([L, m()]).describe("The run that owns this execution. Every live execution belongs to exactly one run. May name a run the host has dropped. Null only for a restored result whose run is unknown."),
|
|
214
|
-
runtime_id: g([I, m()]).describe("The runtime that produced this execution. Live when it equals the current runtime's id. Null when the producer is unknown."),
|
|
215
|
-
caused_by: g([R, m()]).describe("The execution in the same run that caused this one. Null for executions requested directly."),
|
|
216
|
-
cell_id: g([B, m()]).describe("The cell this execution belongs to. Null for scratch code, a cell outside the document."),
|
|
217
|
-
code: c().nullable().describe("The submitted code for an execution with no cell. Null for a cell's execution; its source is available through the cell when the host exposes it."),
|
|
218
|
-
code_hash: q.describe("The `code_hash` of the code that was evaluated, computed as a cell's is."),
|
|
219
|
-
depends_on: s(c(), g([U, m()])).describe("The variables the execution used, by name, each at the revision the runtime holds its result valid against. Null for a name no retained cell execution had bound. Empty while queued, stamped as the execution ends, and final from then on."),
|
|
220
|
-
status: V,
|
|
221
|
-
outcome: g([xe, m()]).describe("How the execution ended. Null while queued; while running, a value carries the display so far; final once completed."),
|
|
222
|
-
started_at: w({ offset: !0 }).nullable().describe("When the code started executing. Null while queued and for an execution that never ran."),
|
|
223
|
-
completed_at: w({ offset: !0 }).nullable().describe("When the execution ended. Null until it is completed.")
|
|
224
|
-
}).describe("One cell evaluated within a run, or scratch code evaluated once.\nIt moves through `queued`, `running`, and `completed`, and ends with\none outcome. Side effects belong to the execution whose context\nproduced them; items can arrive after the execution is completed\nwhile it remains retained.\n"), Ce = l({
|
|
225
|
-
id: z,
|
|
226
|
-
execution_id: R,
|
|
227
|
-
seq: o().min(0).describe("Position among the execution's items, increasing in the order they were produced."),
|
|
228
|
-
name: h(["stdout", "stderr"]).describe("Which stream the text went to."),
|
|
229
|
-
text: c().describe("The text, exactly as written.")
|
|
230
|
-
}).describe("Text an execution wrote to stdout or stderr. Items are ordinary\nobjects: a producer replaces one by sending it again with the\nsame id, and items are removed with their execution.\n"), we = l({
|
|
231
|
-
id: z,
|
|
232
|
-
execution_id: R,
|
|
233
|
-
seq: o().min(0).describe("Position among the execution's items, increasing in the order they were produced."),
|
|
234
|
-
mimetype: c().describe("The format of `data`, such as `image/png`."),
|
|
235
|
-
data: c().describe("The rendered value. JSON mimetypes are encoded as text; binary mimetypes are base64. Never a URL only the runtime can serve.")
|
|
236
|
-
}).describe("A value an execution showed as a side effect, such as a figure\nfrom `plt.show()`. A producer replaces one by sending it again\nwith the same id, which is how a progress bar updates in place.\n"), Te = l({
|
|
237
|
-
column: o().nullable().describe("The column the cell sits in, for multi-column layouts. Null in a single column."),
|
|
238
|
-
disabled: p().describe("Whether the cell is kept from running."),
|
|
239
|
-
hide_code: p().describe("Whether clients hide the code by default. This is a presentation preference; source availability is represented by `Cell.code`."),
|
|
240
|
-
expand_output: p().describe("Whether clients show the full output rather than a scrolled box.")
|
|
241
|
-
}).describe("How a cell is laid out and whether it runs. Every field is always present, so a cell's etag is well defined."), Ee = l({
|
|
242
|
-
defs: a(c()).describe("Names this cell defines."),
|
|
243
|
-
refs: a(c()).describe("Names this cell reads from other cells."),
|
|
244
|
-
errors: a(K).describe("Diagnostics about the code. Only an `error` affects scheduling. `multiple-definitions` lists the definers in `related`, each `range` at its definition; `cycle-dependencies` lists the cycle. Both are reported on every cell involved, differing only in `range`. Every other kind belongs to the analyzer named in `source`.")
|
|
245
|
-
}).describe("What a cell's text implies: the names it defines and reads, which\nare the edges of the dependency graph, and the errors found in the\ntext alone or across the set of cells. A pure function of the\ncode, so two producers compute the same values.\n"), De = l({
|
|
246
|
-
notebook_id: F.describe("The notebook this analysis belongs to."),
|
|
247
|
-
document_etag: q.describe("The document revision this analysis describes. Equal to the document's `etag` while the analysis is current."),
|
|
248
|
-
cells: s(c(), Ee).describe("Every cell of that revision, by id.")
|
|
249
|
-
}).describe("What a document's cells imply, computed together over one\nrevision of the document so that cross-cell errors agree. One\nper notebook, and removed with it. It follows the document it\ndescribes, and `document_etag` says which revision that is.\n"), J = l({
|
|
250
|
-
id: B,
|
|
251
|
-
notebook_id: F,
|
|
252
|
-
code: c().nullable().describe("The cell's source code, with newline line endings, or null when the host does not expose source to this client. An empty string is an empty cell. A host normalizes other line endings when it loads a file. Source availability does not grant editing permission; see the notebook's operations."),
|
|
253
|
-
name: c().describe("The cell's name. `_` for an anonymous cell; otherwise a Python identifier, unique within the notebook."),
|
|
254
|
-
config: Te,
|
|
255
|
-
etag: q.describe("Identifies code, name, and config together, and is the precondition for editing the cell. Its text is `code_hash`, `name`, and the config values `column`, `disabled`, `hide_code`, and `expand_output` in that order, each written as a JSON scalar such as `null`, `0`, or `true`."),
|
|
256
|
-
code_hash: q.describe("Identifies the code alone. Its text is the actual source, even when `code` is null. Withholding source does not change this hash, the cell or document etags, or their versions. Unchanged by renaming the cell or editing its config. Compare with an execution's `code_hash` to tell whether a result came from the current code without needing the source."),
|
|
257
|
-
version: o().min(1).describe("The document version at which the cell was created or last changed.")
|
|
258
|
-
}).describe("A unit of code and configuration in the document. A cell event\nfires when its code, name, or config changes. Markdown and SQL\ncells are code that calls `mo.md` or `mo.sql`; a client chooses\nthe editor to show.\n"), Y = l({
|
|
259
|
-
notebook_id: F.describe("The notebook this document belongs to."),
|
|
260
|
-
order: a(B).describe("Cell ids in display order. A permutation of the notebook's cells, each appearing exactly once."),
|
|
261
|
-
app_config: s(c(), i()).describe("Notebook-level settings, the keyword arguments to `marimo.App` such as `width` and `app_title`. Informational for now; no change sets it over this protocol."),
|
|
262
|
-
etag: q.describe("Identifies the document as currently applied. Its text is `order_etag`, `app_config_etag`, and every cell's `etag` in order, so it changes when any of them does."),
|
|
263
|
-
saved_etag: g([q, m()]).describe("Identifies the document as last written to the host's store, computed the same way over that state. Equal to `etag` when every accepted change has been persisted. Null when nothing has been persisted, which is the case for a scratch copy."),
|
|
264
|
-
order_etag: q.describe("Identifies the order alone. Its text is the cell IDs in order as a JSON array, with no whitespace and strings carrying only the escapes JSON requires. Editing a cell does not change it."),
|
|
265
|
-
app_config_etag: q.describe("Identifies the app config alone. Its text is the app config as canonical JSON, with keys sorted by code point, no whitespace, and strings carrying only the escapes JSON requires."),
|
|
266
|
-
version: o().min(1).describe("Counts changes to the cells, the order, or the app config. A save does not advance it. Comparable only within one notebook while it is in the catalog.")
|
|
267
|
-
}).describe("The document as a whole, without its cells, which are their own\nobjects: the cell order and app config. One per notebook,\nand removed with it. The order and the app\nconfig carry their own etags, so an edit to one does not conflict\nwith an edit to the other, or with edits to cells.\n"), Oe = l({
|
|
268
|
-
request_id: c().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),
|
|
269
|
-
time: w({ offset: !0 }).optional().describe("When the host made this change. Present on live and replayed events; omitted on snapshots."),
|
|
270
|
-
host: ae
|
|
271
|
-
}).describe("The data of a `host` event. The host object, plus which request caused the event and when."), ke = l({
|
|
272
|
-
event: h(["host"]),
|
|
273
|
-
id: c().min(1).optional().describe("The resume cursor. Omitted on snapshot and reset events."),
|
|
274
|
-
data: Oe
|
|
275
|
-
}).describe("A `host` event from a host stream."), Ae = l({
|
|
276
|
-
request_id: c().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),
|
|
277
|
-
time: w({ offset: !0 }).optional().describe("When the host made this change. Present on live and replayed events; omitted on snapshots."),
|
|
278
|
-
project: se
|
|
279
|
-
}).describe("The data of a `project` event. The project as it now is."), je = l({
|
|
280
|
-
event: h(["project"]),
|
|
281
|
-
id: c().min(1).optional().describe("The resume cursor. Omitted on snapshot and reset events."),
|
|
282
|
-
data: Ae
|
|
283
|
-
}).describe("A `project` event from a host stream."), Me = l({
|
|
284
|
-
request_id: c().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),
|
|
285
|
-
time: w({ offset: !0 }).optional().describe("When the host made this change. Present on live and replayed events; omitted on snapshots."),
|
|
286
|
-
notebook: ce
|
|
287
|
-
}).describe("The data of a `notebook` event. The notebook as it now is."), Ne = l({
|
|
288
|
-
event: h(["notebook"]),
|
|
289
|
-
id: c().min(1).optional().describe("The resume cursor. Omitted on snapshot and reset events."),
|
|
290
|
-
data: Me
|
|
291
|
-
}).describe("A `notebook` event from a host stream."), Pe = l({
|
|
292
|
-
request_id: c().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),
|
|
293
|
-
time: w({ offset: !0 }).optional().describe("When the host made this change. Present on live and replayed events; omitted on snapshots."),
|
|
294
|
-
document: Y
|
|
295
|
-
}).describe("The data of a `document` event. The document as it now is."), Fe = l({
|
|
296
|
-
event: h(["document"]),
|
|
297
|
-
id: c().min(1).optional().describe("The resume cursor. Omitted on snapshot and reset events."),
|
|
298
|
-
data: Pe
|
|
299
|
-
}).describe("A `document` event from a host stream."), Ie = l({
|
|
300
|
-
request_id: c().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),
|
|
301
|
-
time: w({ offset: !0 }).optional().describe("When the host made this change. Present on live and replayed events; omitted on snapshots."),
|
|
302
|
-
analysis: De
|
|
303
|
-
}).describe("The data of an `analysis` event. The analysis as it now is."), Le = l({
|
|
304
|
-
event: h(["analysis"]),
|
|
305
|
-
id: c().min(1).optional().describe("The resume cursor. Omitted on snapshot and reset events."),
|
|
306
|
-
data: Ie
|
|
307
|
-
}).describe("A `analysis` event from a host stream."), Re = l({
|
|
308
|
-
request_id: c().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),
|
|
309
|
-
time: w({ offset: !0 }).optional().describe("When the host made this change. Present on live and replayed events; omitted on snapshots."),
|
|
310
|
-
cell: J
|
|
311
|
-
}).describe("The data of a `cell` event. The cell as it now is."), ze = l({
|
|
312
|
-
event: h(["cell"]),
|
|
313
|
-
id: c().min(1).optional().describe("The resume cursor. Omitted on snapshot and reset events."),
|
|
314
|
-
data: Re
|
|
315
|
-
}).describe("A `cell` event from a host stream."), Be = l({
|
|
316
|
-
request_id: c().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),
|
|
317
|
-
time: w({ offset: !0 }).optional().describe("When the host made this change. Present on live and replayed events; omitted on snapshots."),
|
|
318
|
-
runtime: ue
|
|
319
|
-
}).describe("The data of a `runtime` event. The runtime as it now is."), Ve = l({
|
|
320
|
-
event: h(["runtime"]),
|
|
321
|
-
id: c().min(1).optional().describe("The resume cursor. Omitted on snapshot and reset events."),
|
|
322
|
-
data: Be
|
|
323
|
-
}).describe("A `runtime` event from a host stream."), He = l({
|
|
324
|
-
request_id: c().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),
|
|
325
|
-
time: w({ offset: !0 }).optional().describe("When the host made this change. Present on live and replayed events; omitted on snapshots."),
|
|
326
|
-
attachment: pe
|
|
327
|
-
}).describe("The data of an `attachment` event. The attachment as it now is."), Ue = l({
|
|
328
|
-
event: h(["attachment"]),
|
|
329
|
-
id: c().min(1).optional().describe("The resume cursor. Omitted on snapshot and reset events."),
|
|
330
|
-
data: He
|
|
331
|
-
}).describe("A `attachment` event from a host stream."), We = l({
|
|
332
|
-
request_id: c().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),
|
|
333
|
-
time: w({ offset: !0 }).optional().describe("When the host made this change. Present on live and replayed events; omitted on snapshots."),
|
|
334
|
-
run: he
|
|
335
|
-
}).describe("The data of a `run` event. The run as it now is."), Ge = l({
|
|
336
|
-
event: h(["run"]),
|
|
337
|
-
id: c().min(1).optional().describe("The resume cursor. Omitted on snapshot and reset events."),
|
|
338
|
-
data: We
|
|
339
|
-
}).describe("A `run` event from a host stream."), Ke = l({
|
|
340
|
-
request_id: c().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),
|
|
341
|
-
time: w({ offset: !0 }).optional().describe("When the host made this change. Present on live and replayed events; omitted on snapshots."),
|
|
342
|
-
execution: Se
|
|
343
|
-
}).describe("The data of an `execution` event. The execution as it now is."), qe = l({
|
|
344
|
-
event: h(["execution"]),
|
|
345
|
-
id: c().min(1).optional().describe("The resume cursor. Omitted on snapshot and reset events."),
|
|
346
|
-
data: Ke
|
|
347
|
-
}).describe("A `execution` event from a host stream."), Je = l({
|
|
348
|
-
request_id: c().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),
|
|
349
|
-
time: w({ offset: !0 }).optional().describe("When the host made this change. Present on live and replayed events; omitted on snapshots."),
|
|
350
|
-
console: Ce
|
|
351
|
-
}).describe("The data of a `console` event. The item as it now is."), Ye = l({
|
|
352
|
-
event: h(["console"]),
|
|
353
|
-
id: c().min(1).optional().describe("The resume cursor. Omitted on snapshot and reset events."),
|
|
354
|
-
data: Je
|
|
355
|
-
}).describe("A `console` event from a host stream."), Xe = l({
|
|
356
|
-
request_id: c().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),
|
|
357
|
-
time: w({ offset: !0 }).optional().describe("When the host made this change. Present on live and replayed events; omitted on snapshots."),
|
|
358
|
-
display: we
|
|
359
|
-
}).describe("The data of a `display` event. The item as it now is."), Ze = l({
|
|
360
|
-
event: h(["display"]),
|
|
361
|
-
id: c().min(1).optional().describe("The resume cursor. Omitted on snapshot and reset events."),
|
|
362
|
-
data: Xe
|
|
363
|
-
}).describe("A `display` event from a host stream."), Qe = l({
|
|
364
|
-
request_id: c().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),
|
|
365
|
-
time: w({ offset: !0 }).optional().describe("When the host made this change. Present on live and replayed events; omitted on snapshots."),
|
|
366
|
-
variable: ge
|
|
367
|
-
}).describe("The data of a `variable` event. The item as it now is."), $e = l({
|
|
368
|
-
event: h(["variable"]),
|
|
369
|
-
id: c().min(1).optional().describe("The resume cursor. Omitted on snapshot and reset events."),
|
|
370
|
-
data: Qe
|
|
371
|
-
}).describe("A `variable` event from a host stream."), et = l({
|
|
372
|
-
custom: ie,
|
|
373
|
-
request_id: c().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),
|
|
374
|
-
time: w({ offset: !0 }).describe("When the host emitted this event. Preserved on replay.")
|
|
375
|
-
}).describe("The data of a `custom` event. This envelope is standardized; the custom type and payload are defined by their producer."), tt = l({
|
|
376
|
-
event: h(["custom"]),
|
|
377
|
-
id: c().min(1).optional().describe("The resume cursor. Omitted on snapshot and reset events."),
|
|
378
|
-
data: et
|
|
379
|
-
}).describe("A `custom` event from a host stream."), X = l({
|
|
380
|
-
request_id: c().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),
|
|
381
|
-
time: w({ offset: !0 }).optional().describe("When the host made this change. Present on live and replayed events; omitted on snapshots."),
|
|
382
|
-
id: c().describe("The id of the object that was removed.")
|
|
383
|
-
}).describe("The data of a `project.removed`, `notebook.removed`,\n`cell.removed`, `runtime.removed`, `attachment.removed`,\n`run.removed`, `execution.removed`, `console.removed`,\n`display.removed`, or `variable.removed` event. The client deletes the object with this\nid; the event name says which kind it is. Removing a notebook\nremoves its document and cells with it, without events of their\nown; the document never has one.\n"), nt = l({
|
|
384
|
-
event: h(["project.removed"]),
|
|
385
|
-
id: c().min(1).optional().describe("The resume cursor. Omitted on snapshot and reset events."),
|
|
386
|
-
data: X
|
|
387
|
-
}).describe("A `project.removed` event from a host stream."), rt = l({
|
|
388
|
-
event: h(["notebook.removed"]),
|
|
389
|
-
id: c().min(1).optional().describe("The resume cursor. Omitted on snapshot and reset events."),
|
|
390
|
-
data: X
|
|
391
|
-
}).describe("A `notebook.removed` event from a host stream."), it = l({
|
|
392
|
-
event: h(["cell.removed"]),
|
|
393
|
-
id: c().min(1).optional().describe("The resume cursor. Omitted on snapshot and reset events."),
|
|
394
|
-
data: X
|
|
395
|
-
}).describe("A `cell.removed` event from a host stream."), at = l({
|
|
396
|
-
event: h(["runtime.removed"]),
|
|
397
|
-
id: c().min(1).optional().describe("The resume cursor. Omitted on snapshot and reset events."),
|
|
398
|
-
data: X
|
|
399
|
-
}).describe("A `runtime.removed` event from a host stream."), ot = l({
|
|
400
|
-
event: h(["attachment.removed"]),
|
|
401
|
-
id: c().min(1).optional().describe("The resume cursor. Omitted on snapshot and reset events."),
|
|
402
|
-
data: X
|
|
403
|
-
}).describe("A `attachment.removed` event from a host stream."), st = l({
|
|
404
|
-
event: h(["run.removed"]),
|
|
405
|
-
id: c().min(1).optional().describe("The resume cursor. Omitted on snapshot and reset events."),
|
|
406
|
-
data: X
|
|
407
|
-
}).describe("A `run.removed` event from a host stream."), ct = l({
|
|
408
|
-
event: h(["execution.removed"]),
|
|
409
|
-
id: c().min(1).optional().describe("The resume cursor. Omitted on snapshot and reset events."),
|
|
410
|
-
data: X
|
|
411
|
-
}).describe("A `execution.removed` event from a host stream."), lt = l({
|
|
412
|
-
event: h(["console.removed"]),
|
|
413
|
-
id: c().min(1).optional().describe("The resume cursor. Omitted on snapshot and reset events."),
|
|
414
|
-
data: X
|
|
415
|
-
}).describe("A `console.removed` event from a host stream."), ut = l({
|
|
416
|
-
event: h(["display.removed"]),
|
|
417
|
-
id: c().min(1).optional().describe("The resume cursor. Omitted on snapshot and reset events."),
|
|
418
|
-
data: X
|
|
419
|
-
}).describe("A `display.removed` event from a host stream."), dt = l({
|
|
420
|
-
event: h(["variable.removed"]),
|
|
421
|
-
id: c().min(1).optional().describe("The resume cursor. Omitted on snapshot and reset events."),
|
|
422
|
-
data: X
|
|
423
|
-
}).describe("A `variable.removed` event from a host stream."), ft = l({
|
|
424
|
-
event: h(["reset"]),
|
|
425
|
-
id: c().min(1).optional().describe("The resume cursor. Omitted on snapshot and reset events."),
|
|
426
|
-
data: l({})
|
|
427
|
-
}).describe("A `reset` event from a host stream."), pt = l({
|
|
428
|
-
event: h(["ready"]),
|
|
429
|
-
id: c().min(1).describe("The resume cursor. Omitted on snapshot and reset events."),
|
|
430
|
-
data: l({})
|
|
431
|
-
}).describe("A `ready` event from a host stream."), mt = g([
|
|
432
|
-
ke,
|
|
433
|
-
je,
|
|
434
|
-
Ne,
|
|
435
|
-
Fe,
|
|
436
|
-
Le,
|
|
437
|
-
ze,
|
|
438
|
-
Ve,
|
|
439
|
-
Ue,
|
|
440
|
-
Ge,
|
|
441
|
-
qe,
|
|
442
|
-
Ye,
|
|
443
|
-
Ze,
|
|
444
|
-
$e,
|
|
445
|
-
tt,
|
|
446
|
-
nt,
|
|
447
|
-
rt,
|
|
448
|
-
it,
|
|
449
|
-
at,
|
|
450
|
-
ot,
|
|
451
|
-
st,
|
|
452
|
-
ct,
|
|
453
|
-
lt,
|
|
454
|
-
ut,
|
|
455
|
-
dt,
|
|
456
|
-
ft,
|
|
457
|
-
pt
|
|
458
|
-
]).describe("A record, removal, or control message from a host stream.\nThe data is decoded JSON. Snapshot records and reset events omit\nthe cursor; ready and live events carry it. Unknown event names\nbelong to later versions or host extensions.\n"), ht = l({
|
|
459
|
-
id: c().describe("Identifies this answer."),
|
|
460
|
-
label: c().describe("Text to show a person.")
|
|
461
|
-
}).describe("One possible answer to a decision."), gt = l({
|
|
462
|
-
id: c().describe("Identifies the question when the client answers it."),
|
|
463
|
-
prompt: c().describe("The question, worded for a person."),
|
|
464
|
-
options: a(ht).describe("The possible answers.")
|
|
465
|
-
}).describe("A question the host needs answered before it can carry out a\nrequest. The client answers by repeating the request with\n`decisions` in the body, mapping this `id` to the `id` of an\noption.\n"), _t = l({
|
|
466
|
-
change: o().min(0).describe("The index of the stale change in the request's `changes`, or of the stale cell in a run's `cells`. `0` for a save with a stale `If-Match`."),
|
|
467
|
-
cell: g([J, m()]).describe("The cell the change named, as it now is. Null when the document does not have it, or when the change named the order."),
|
|
468
|
-
document: Y
|
|
469
|
-
}).describe("The first stale change of an edit or run, and the state the host holds.");
|
|
470
|
-
l({
|
|
471
|
-
type: c().describe("What kind of problem this is, as a URI. The kinds this\nprotocol defines all start with `tag:marimo.io,2026:host/` and\nend with one of `invalid-request` (400), `unauthorized` (401),\n`forbidden` (403), `not-found` (404), `method-not-allowed`\n(405), `not-acceptable` (406), `conflict` (409), `no-runtime`\n(409), `decision-required` (409), `internal` (500), or\n`unsupported-operation` (501). A client that sees a kind it\ndoes not recognize falls back to `status`.\n"),
|
|
472
|
-
title: c().describe("A short, human-readable name for the kind of problem."),
|
|
473
|
-
status: o().min(400).max(599).describe("The HTTP status code of the response."),
|
|
474
|
-
detail: c().optional().describe("A human-readable explanation of what went wrong this time."),
|
|
475
|
-
decisions: a(gt).optional().describe("The choices the client has to make before the host can carry out the request. Only present for `decision-required`."),
|
|
476
|
-
edit: _t.optional().describe("Which change was stale and what the host holds instead. Only present for a `conflict` answering an edit, a save, or a run of cells.")
|
|
477
|
-
}).describe("An error. Every error response has this one shape, following RFC\n9457, and is served as `application/problem+json`. `status`\nrepeats the HTTP status, and `type` says more precisely what went\nwrong. `decisions` appears only when `type` is\n`tag:marimo.io,2026:host/decision-required`. A client ignores\nmembers it does not recognize. An error never contains a token.\n"), l({
|
|
478
|
-
project_id: P,
|
|
479
|
-
path: c().optional().describe("Where to put the file, relative to the project root and written the way the host's operating system writes paths."),
|
|
480
|
-
name: c().optional().describe("A label to show people. In a project with a root it defaults to the filename.")
|
|
481
|
-
}).describe("The notebook's own fields, minus what the host assigns. A project with a root requires `path`; one without requires `name`."), l({
|
|
482
|
-
path: c().optional().describe("The new location, relative to the project root and written the way the host's operating system writes paths."),
|
|
483
|
-
name: c().optional().describe("The new label to show people.")
|
|
484
|
-
}).describe("The fields to change. At least one is present."), l({ url: c().describe("The URL the host used to show the notebook. It never contains the host's token.") }), l({ decisions: s(c(), c()).optional().describe("Answers to the questions in a `decision-required` problem.\nEach key is a decision's `id` and each value is the `id` of\nthe chosen option. A client that already knows its choices can\nsend them the first time.\n") });
|
|
485
|
-
var vt = l({
|
|
486
|
-
column: o().nullish().default(null),
|
|
487
|
-
disabled: p().default(!1),
|
|
488
|
-
hide_code: p().default(!1),
|
|
489
|
-
expand_output: p().default(!1)
|
|
490
|
-
}).describe("A cell's settings as a client writes them. A field left out takes its default."), yt = l({
|
|
491
|
-
id: B.describe("The cell's id. A client chooses the id of a cell it creates."),
|
|
492
|
-
code: c().describe("The cell's source code."),
|
|
493
|
-
name: c().default("_").describe("The cell's name. `_` for an anonymous cell."),
|
|
494
|
-
config: vt.optional()
|
|
495
|
-
}).describe("A cell as a client writes it. Code must be a string, even when the host withholds source in cell records. Null is not an edit or a request to preserve existing source. The host derives the etags and the analysis."), bt = l({
|
|
496
|
-
kind: h(["put_cell"]),
|
|
497
|
-
base_etag: c().nullable().describe("The cell's etag as last read, `*` to skip the check, or null to create the cell. Null when the cell exists, or an etag when it does not, is a `conflict`."),
|
|
498
|
-
cell: yt,
|
|
499
|
-
after: B.optional().describe("The cell a created cell goes after. Ignored for an existing cell."),
|
|
500
|
-
before: B.optional().describe("The cell a created cell goes before. Ignored for an existing cell. With neither `after` nor `before`, a created cell goes at the end.")
|
|
501
|
-
}).describe("Replaces a whole cell, or creates one."), xt = l({
|
|
502
|
-
kind: h(["delete_cell"]),
|
|
503
|
-
id: B.describe("The cell to remove."),
|
|
504
|
-
base_etag: c().describe("The cell's etag as last read, or `*`.")
|
|
505
|
-
}).describe("Removes a cell."), St = l({
|
|
506
|
-
kind: h(["set_order"]),
|
|
507
|
-
base_etag: c().describe("The document's `order_etag` as last read, or `*`."),
|
|
508
|
-
order: a(B).describe("Every cell id exactly once, in the new order, counting cells this edit creates and leaving out cells it deletes.")
|
|
509
|
-
}).describe("Replaces the cell order."), Ct = g([
|
|
510
|
-
bt,
|
|
511
|
-
xt,
|
|
512
|
-
St
|
|
513
|
-
]).describe("One change to the document, tagged on `kind`.");
|
|
514
|
-
l({ changes: a(Ct).describe("The changes, applied in order as one unit.") });
|
|
515
|
-
var wt = l({
|
|
516
|
-
etag: q,
|
|
517
|
-
code_hash: q,
|
|
518
|
-
version: o().min(1).describe("The cell's version after the edit.")
|
|
519
|
-
}).describe("A cell's etags and version after an edit.");
|
|
520
|
-
l({
|
|
521
|
-
document: Y,
|
|
522
|
-
cells: s(c(), g([wt, m()])).describe("The version of each cell the request created or changed, by id, and null for each cell it deleted.")
|
|
523
|
-
}).describe("The document as an edit or save left it, or at a later revision, and the cells it touched."), l({ decisions: s(c(), c()).optional().describe("Answers to the questions in a `decision-required` problem, as for `runtime.start`.") }).describe("What a save needs from the client, which is nothing until the host asks a question. `{}` is the usual body.");
|
|
524
|
-
var Tt = l({
|
|
525
|
-
id: B,
|
|
526
|
-
code_hash: q.optional().describe("The cell's `code_hash` as last read. A cell whose code differs is a `conflict`. Absent, the cell runs as it is.")
|
|
527
|
-
});
|
|
528
|
-
l({
|
|
529
|
-
code: c().optional().describe("Python code to run as scratch code."),
|
|
530
|
-
cells: a(Tt).min(1).optional().describe("Cells of the document to run, in no particular order. The runtime's execution configuration determines whether dependent cells run too.")
|
|
531
|
-
}).describe("What to run, exactly one of `code` and `cells`.");
|
|
532
|
-
//#endregion
|
|
533
|
-
//#region src/core/host/events.ts
|
|
534
|
-
var Et = [
|
|
535
|
-
"notebook",
|
|
536
|
-
"document",
|
|
537
|
-
"cell",
|
|
538
|
-
"attachment",
|
|
539
|
-
"marimo"
|
|
540
|
-
];
|
|
541
|
-
l({
|
|
542
|
-
event: c().min(1),
|
|
543
|
-
data: i(),
|
|
544
|
-
id: c().min(1).optional()
|
|
545
|
-
}), new Set(mt.options.flatMap((e) => e.shape.event.options)), l({
|
|
546
|
-
event: u("marimo"),
|
|
547
|
-
id: c().min(1).optional(),
|
|
548
|
-
data: l({ marimo: i() })
|
|
549
|
-
}), l({ data: i() });
|
|
550
|
-
//#endregion
|
|
551
|
-
//#region ../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/_u64.js
|
|
552
|
-
var Dt = /* @__PURE__ */ e(((e) => {
|
|
553
|
-
Object.defineProperty(e, "__esModule", { value: !0 }), e.toBig = e.shrSL = e.shrSH = e.rotrSL = e.rotrSH = e.rotrBL = e.rotrBH = e.rotr32L = e.rotr32H = e.rotlSL = e.rotlSH = e.rotlBL = e.rotlBH = e.add5L = e.add5H = e.add4L = e.add4H = e.add3L = e.add3H = void 0, e.add = v, e.fromBig = r, e.split = i;
|
|
554
|
-
var t = /* @__PURE__ */ BigInt(2 ** 32 - 1), n = /* @__PURE__ */ BigInt(32);
|
|
555
|
-
function r(e, r = !1) {
|
|
556
|
-
return r ? {
|
|
557
|
-
h: Number(e & t),
|
|
558
|
-
l: Number(e >> n & t)
|
|
559
|
-
} : {
|
|
560
|
-
h: Number(e >> n & t) | 0,
|
|
561
|
-
l: Number(e & t) | 0
|
|
562
|
-
};
|
|
563
|
-
}
|
|
564
|
-
function i(e, t = !1) {
|
|
565
|
-
let n = e.length, i = new Uint32Array(n), a = new Uint32Array(n);
|
|
566
|
-
for (let o = 0; o < n; o++) {
|
|
567
|
-
let { h: n, l: s } = r(e[o], t);
|
|
568
|
-
[i[o], a[o]] = [n, s];
|
|
569
|
-
}
|
|
570
|
-
return [i, a];
|
|
571
|
-
}
|
|
572
|
-
var a = (e, t) => BigInt(e >>> 0) << n | BigInt(t >>> 0);
|
|
573
|
-
e.toBig = a;
|
|
574
|
-
var o = (e, t, n) => e >>> n;
|
|
575
|
-
e.shrSH = o;
|
|
576
|
-
var s = (e, t, n) => e << 32 - n | t >>> n;
|
|
577
|
-
e.shrSL = s;
|
|
578
|
-
var c = (e, t, n) => e >>> n | t << 32 - n;
|
|
579
|
-
e.rotrSH = c;
|
|
580
|
-
var l = (e, t, n) => e << 32 - n | t >>> n;
|
|
581
|
-
e.rotrSL = l;
|
|
582
|
-
var u = (e, t, n) => e << 64 - n | t >>> n - 32;
|
|
583
|
-
e.rotrBH = u;
|
|
584
|
-
var d = (e, t, n) => e >>> n - 32 | t << 64 - n;
|
|
585
|
-
e.rotrBL = d;
|
|
586
|
-
var f = (e, t) => t;
|
|
587
|
-
e.rotr32H = f;
|
|
588
|
-
var p = (e, t) => e;
|
|
589
|
-
e.rotr32L = p;
|
|
590
|
-
var m = (e, t, n) => e << n | t >>> 32 - n;
|
|
591
|
-
e.rotlSH = m;
|
|
592
|
-
var h = (e, t, n) => t << n | e >>> 32 - n;
|
|
593
|
-
e.rotlSL = h;
|
|
594
|
-
var g = (e, t, n) => t << n - 32 | e >>> 64 - n;
|
|
595
|
-
e.rotlBH = g;
|
|
596
|
-
var _ = (e, t, n) => e << n - 32 | t >>> 64 - n;
|
|
597
|
-
e.rotlBL = _;
|
|
598
|
-
function v(e, t, n, r) {
|
|
599
|
-
let i = (t >>> 0) + (r >>> 0);
|
|
600
|
-
return {
|
|
601
|
-
h: e + n + (i / 2 ** 32 | 0) | 0,
|
|
602
|
-
l: i | 0
|
|
603
|
-
};
|
|
604
|
-
}
|
|
605
|
-
var y = (e, t, n) => (e >>> 0) + (t >>> 0) + (n >>> 0);
|
|
606
|
-
e.add3L = y;
|
|
607
|
-
var b = (e, t, n, r) => t + n + r + (e / 2 ** 32 | 0) | 0;
|
|
608
|
-
e.add3H = b;
|
|
609
|
-
var x = (e, t, n, r) => (e >>> 0) + (t >>> 0) + (n >>> 0) + (r >>> 0);
|
|
610
|
-
e.add4L = x;
|
|
611
|
-
var S = (e, t, n, r, i) => t + n + r + i + (e / 2 ** 32 | 0) | 0;
|
|
612
|
-
e.add4H = S;
|
|
613
|
-
var C = (e, t, n, r, i) => (e >>> 0) + (t >>> 0) + (n >>> 0) + (r >>> 0) + (i >>> 0);
|
|
614
|
-
e.add5L = C;
|
|
615
|
-
var w = (e, t, n, r, i, a) => t + n + r + i + a + (e / 2 ** 32 | 0) | 0;
|
|
616
|
-
e.add5H = w, e.default = {
|
|
617
|
-
fromBig: r,
|
|
618
|
-
split: i,
|
|
619
|
-
toBig: a,
|
|
620
|
-
shrSH: o,
|
|
621
|
-
shrSL: s,
|
|
622
|
-
rotrSH: c,
|
|
623
|
-
rotrSL: l,
|
|
624
|
-
rotrBH: u,
|
|
625
|
-
rotrBL: d,
|
|
626
|
-
rotr32H: f,
|
|
627
|
-
rotr32L: p,
|
|
628
|
-
rotlSH: m,
|
|
629
|
-
rotlSL: h,
|
|
630
|
-
rotlBH: g,
|
|
631
|
-
rotlBL: _,
|
|
632
|
-
add: v,
|
|
633
|
-
add3L: y,
|
|
634
|
-
add3H: b,
|
|
635
|
-
add4L: x,
|
|
636
|
-
add4H: S,
|
|
637
|
-
add5H: w,
|
|
638
|
-
add5L: C
|
|
639
|
-
};
|
|
640
|
-
})), Ot = /* @__PURE__ */ e(((e) => {
|
|
641
|
-
Object.defineProperty(e, "__esModule", { value: !0 }), e.crypto = void 0, e.crypto = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
|
|
642
|
-
})), kt = /* @__PURE__ */ e(((e) => {
|
|
643
|
-
Object.defineProperty(e, "__esModule", { value: !0 }), e.wrapXOFConstructorWithOpts = e.wrapConstructorWithOpts = e.wrapConstructor = e.Hash = e.nextTick = e.swap32IfBE = e.byteSwapIfBE = e.swap8IfBE = e.isLE = void 0, e.isBytes = n, e.anumber = r, e.abytes = i, e.ahash = a, e.aexists = o, e.aoutput = s, e.u8 = c, e.u32 = l, e.clean = u, e.createView = d, e.rotr = f, e.rotl = p, e.byteSwap = m, e.byteSwap32 = h, e.bytesToHex = v, e.hexToBytes = x, e.asyncLoop = S, e.utf8ToBytes = C, e.bytesToUtf8 = w, e.toBytes = T, e.kdfInputToBytes = E, e.concatBytes = D, e.checkOpts = O, e.createHasher = k, e.createOptHasher = A, e.createXOFer = j, e.randomBytes = M;
|
|
644
|
-
var t = Ot();
|
|
645
|
-
function n(e) {
|
|
646
|
-
return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
|
|
647
|
-
}
|
|
648
|
-
function r(e) {
|
|
649
|
-
if (!Number.isSafeInteger(e) || e < 0) throw Error("positive integer expected, got " + e);
|
|
650
|
-
}
|
|
651
|
-
function i(e, ...t) {
|
|
652
|
-
if (!n(e)) throw Error("Uint8Array expected");
|
|
653
|
-
if (t.length > 0 && !t.includes(e.length)) throw Error("Uint8Array expected of length " + t + ", got length=" + e.length);
|
|
654
|
-
}
|
|
655
|
-
function a(e) {
|
|
656
|
-
if (typeof e != "function" || typeof e.create != "function") throw Error("Hash should be wrapped by utils.createHasher");
|
|
657
|
-
r(e.outputLen), r(e.blockLen);
|
|
658
|
-
}
|
|
659
|
-
function o(e, t = !0) {
|
|
660
|
-
if (e.destroyed) throw Error("Hash instance has been destroyed");
|
|
661
|
-
if (t && e.finished) throw Error("Hash#digest() has already been called");
|
|
662
|
-
}
|
|
663
|
-
function s(e, t) {
|
|
664
|
-
i(e);
|
|
665
|
-
let n = t.outputLen;
|
|
666
|
-
if (e.length < n) throw Error("digestInto() expects output buffer of length at least " + n);
|
|
667
|
-
}
|
|
668
|
-
function c(e) {
|
|
669
|
-
return new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
|
|
670
|
-
}
|
|
671
|
-
function l(e) {
|
|
672
|
-
return new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4));
|
|
673
|
-
}
|
|
674
|
-
function u(...e) {
|
|
675
|
-
for (let t = 0; t < e.length; t++) e[t].fill(0);
|
|
676
|
-
}
|
|
677
|
-
function d(e) {
|
|
678
|
-
return new DataView(e.buffer, e.byteOffset, e.byteLength);
|
|
679
|
-
}
|
|
680
|
-
function f(e, t) {
|
|
681
|
-
return e << 32 - t | e >>> t;
|
|
682
|
-
}
|
|
683
|
-
function p(e, t) {
|
|
684
|
-
return e << t | e >>> 32 - t >>> 0;
|
|
685
|
-
}
|
|
686
|
-
e.isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
687
|
-
function m(e) {
|
|
688
|
-
return e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
|
|
689
|
-
}
|
|
690
|
-
e.swap8IfBE = e.isLE ? (e) => e : (e) => m(e), e.byteSwapIfBE = e.swap8IfBE;
|
|
691
|
-
function h(e) {
|
|
692
|
-
for (let t = 0; t < e.length; t++) e[t] = m(e[t]);
|
|
693
|
-
return e;
|
|
694
|
-
}
|
|
695
|
-
e.swap32IfBE = e.isLE ? (e) => e : h;
|
|
696
|
-
var g = typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", _ = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
|
|
697
|
-
function v(e) {
|
|
698
|
-
if (i(e), g) return e.toHex();
|
|
699
|
-
let t = "";
|
|
700
|
-
for (let n = 0; n < e.length; n++) t += _[e[n]];
|
|
701
|
-
return t;
|
|
702
|
-
}
|
|
703
|
-
var y = {
|
|
704
|
-
_0: 48,
|
|
705
|
-
_9: 57,
|
|
706
|
-
A: 65,
|
|
707
|
-
F: 70,
|
|
708
|
-
a: 97,
|
|
709
|
-
f: 102
|
|
710
|
-
};
|
|
711
|
-
function b(e) {
|
|
712
|
-
if (e >= y._0 && e <= y._9) return e - y._0;
|
|
713
|
-
if (e >= y.A && e <= y.F) return e - (y.A - 10);
|
|
714
|
-
if (e >= y.a && e <= y.f) return e - (y.a - 10);
|
|
715
|
-
}
|
|
716
|
-
function x(e) {
|
|
717
|
-
if (typeof e != "string") throw Error("hex string expected, got " + typeof e);
|
|
718
|
-
if (g) return Uint8Array.fromHex(e);
|
|
719
|
-
let t = e.length, n = t / 2;
|
|
720
|
-
if (t % 2) throw Error("hex string expected, got unpadded hex of length " + t);
|
|
721
|
-
let r = new Uint8Array(n);
|
|
722
|
-
for (let t = 0, i = 0; t < n; t++, i += 2) {
|
|
723
|
-
let n = b(e.charCodeAt(i)), a = b(e.charCodeAt(i + 1));
|
|
724
|
-
if (n === void 0 || a === void 0) {
|
|
725
|
-
let t = e[i] + e[i + 1];
|
|
726
|
-
throw Error("hex string expected, got non-hex character \"" + t + "\" at index " + i);
|
|
727
|
-
}
|
|
728
|
-
r[t] = n * 16 + a;
|
|
729
|
-
}
|
|
730
|
-
return r;
|
|
731
|
-
}
|
|
732
|
-
e.nextTick = async () => {};
|
|
733
|
-
async function S(t, n, r) {
|
|
734
|
-
let i = Date.now();
|
|
735
|
-
for (let a = 0; a < t; a++) {
|
|
736
|
-
r(a);
|
|
737
|
-
let t = Date.now() - i;
|
|
738
|
-
t >= 0 && t < n || (await (0, e.nextTick)(), i += t);
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
function C(e) {
|
|
742
|
-
if (typeof e != "string") throw Error("string expected");
|
|
743
|
-
return new Uint8Array(new TextEncoder().encode(e));
|
|
744
|
-
}
|
|
745
|
-
function w(e) {
|
|
746
|
-
return new TextDecoder().decode(e);
|
|
747
|
-
}
|
|
748
|
-
function T(e) {
|
|
749
|
-
return typeof e == "string" && (e = C(e)), i(e), e;
|
|
750
|
-
}
|
|
751
|
-
function E(e) {
|
|
752
|
-
return typeof e == "string" && (e = C(e)), i(e), e;
|
|
753
|
-
}
|
|
754
|
-
function D(...e) {
|
|
755
|
-
let t = 0;
|
|
756
|
-
for (let n = 0; n < e.length; n++) {
|
|
757
|
-
let r = e[n];
|
|
758
|
-
i(r), t += r.length;
|
|
759
|
-
}
|
|
760
|
-
let n = new Uint8Array(t);
|
|
761
|
-
for (let t = 0, r = 0; t < e.length; t++) {
|
|
762
|
-
let i = e[t];
|
|
763
|
-
n.set(i, r), r += i.length;
|
|
764
|
-
}
|
|
765
|
-
return n;
|
|
766
|
-
}
|
|
767
|
-
function O(e, t) {
|
|
768
|
-
if (t !== void 0 && {}.toString.call(t) !== "[object Object]") throw Error("options should be object or undefined");
|
|
769
|
-
return Object.assign(e, t);
|
|
770
|
-
}
|
|
771
|
-
e.Hash = class {};
|
|
772
|
-
function k(e) {
|
|
773
|
-
let t = (t) => e().update(T(t)).digest(), n = e();
|
|
774
|
-
return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = () => e(), t;
|
|
775
|
-
}
|
|
776
|
-
function A(e) {
|
|
777
|
-
let t = (t, n) => e(n).update(T(t)).digest(), n = e({});
|
|
778
|
-
return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = (t) => e(t), t;
|
|
779
|
-
}
|
|
780
|
-
function j(e) {
|
|
781
|
-
let t = (t, n) => e(n).update(T(t)).digest(), n = e({});
|
|
782
|
-
return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = (t) => e(t), t;
|
|
783
|
-
}
|
|
784
|
-
e.wrapConstructor = k, e.wrapConstructorWithOpts = A, e.wrapXOFConstructorWithOpts = j;
|
|
785
|
-
function M(e = 32) {
|
|
786
|
-
if (t.crypto && typeof t.crypto.getRandomValues == "function") return t.crypto.getRandomValues(new Uint8Array(e));
|
|
787
|
-
if (t.crypto && typeof t.crypto.randomBytes == "function") return Uint8Array.from(t.crypto.randomBytes(e));
|
|
788
|
-
throw Error("crypto.getRandomValues must be defined");
|
|
789
|
-
}
|
|
790
|
-
})), At = /* @__PURE__ */ e(((e) => {
|
|
791
|
-
Object.defineProperty(e, "__esModule", { value: !0 }), e.shake256 = e.shake128 = e.keccak_512 = e.keccak_384 = e.keccak_256 = e.keccak_224 = e.sha3_512 = e.sha3_384 = e.sha3_256 = e.sha3_224 = e.Keccak = void 0, e.keccakP = _;
|
|
792
|
-
var t = Dt(), n = kt(), r = BigInt(0), i = BigInt(1), a = BigInt(2), o = BigInt(7), s = BigInt(256), c = BigInt(113), l = [], u = [], d = [];
|
|
793
|
-
for (let e = 0, t = i, n = 1, f = 0; e < 24; e++) {
|
|
794
|
-
[n, f] = [f, (2 * n + 3 * f) % 5], l.push(2 * (5 * f + n)), u.push((e + 1) * (e + 2) / 2 % 64);
|
|
795
|
-
let p = r;
|
|
796
|
-
for (let e = 0; e < 7; e++) t = (t << i ^ (t >> o) * c) % s, t & a && (p ^= i << (i << /* @__PURE__ */ BigInt(e)) - i);
|
|
797
|
-
d.push(p);
|
|
798
|
-
}
|
|
799
|
-
var f = (0, t.split)(d, !0), p = f[0], m = f[1], h = (e, n, r) => r > 32 ? (0, t.rotlBH)(e, n, r) : (0, t.rotlSH)(e, n, r), g = (e, n, r) => r > 32 ? (0, t.rotlBL)(e, n, r) : (0, t.rotlSL)(e, n, r);
|
|
800
|
-
function _(e, t = 24) {
|
|
801
|
-
let r = /* @__PURE__ */ new Uint32Array(10);
|
|
802
|
-
for (let n = 24 - t; n < 24; n++) {
|
|
803
|
-
for (let t = 0; t < 10; t++) r[t] = e[t] ^ e[t + 10] ^ e[t + 20] ^ e[t + 30] ^ e[t + 40];
|
|
804
|
-
for (let t = 0; t < 10; t += 2) {
|
|
805
|
-
let n = (t + 8) % 10, i = (t + 2) % 10, a = r[i], o = r[i + 1], s = h(a, o, 1) ^ r[n], c = g(a, o, 1) ^ r[n + 1];
|
|
806
|
-
for (let n = 0; n < 50; n += 10) e[t + n] ^= s, e[t + n + 1] ^= c;
|
|
807
|
-
}
|
|
808
|
-
let t = e[2], i = e[3];
|
|
809
|
-
for (let n = 0; n < 24; n++) {
|
|
810
|
-
let r = u[n], a = h(t, i, r), o = g(t, i, r), s = l[n];
|
|
811
|
-
t = e[s], i = e[s + 1], e[s] = a, e[s + 1] = o;
|
|
812
|
-
}
|
|
813
|
-
for (let t = 0; t < 50; t += 10) {
|
|
814
|
-
for (let n = 0; n < 10; n++) r[n] = e[t + n];
|
|
815
|
-
for (let n = 0; n < 10; n++) e[t + n] ^= ~r[(n + 2) % 10] & r[(n + 4) % 10];
|
|
816
|
-
}
|
|
817
|
-
e[0] ^= p[n], e[1] ^= m[n];
|
|
818
|
-
}
|
|
819
|
-
(0, n.clean)(r);
|
|
820
|
-
}
|
|
821
|
-
var v = class e extends n.Hash {
|
|
822
|
-
constructor(e, t, r, i = !1, a = 24) {
|
|
823
|
-
if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = e, this.suffix = t, this.outputLen = r, this.enableXOF = i, this.rounds = a, (0, n.anumber)(r), !(0 < e && e < 200)) throw Error("only keccak-f1600 function is supported");
|
|
824
|
-
this.state = /* @__PURE__ */ new Uint8Array(200), this.state32 = (0, n.u32)(this.state);
|
|
825
|
-
}
|
|
826
|
-
clone() {
|
|
827
|
-
return this._cloneInto();
|
|
828
|
-
}
|
|
829
|
-
keccak() {
|
|
830
|
-
(0, n.swap32IfBE)(this.state32), _(this.state32, this.rounds), (0, n.swap32IfBE)(this.state32), this.posOut = 0, this.pos = 0;
|
|
831
|
-
}
|
|
832
|
-
update(e) {
|
|
833
|
-
(0, n.aexists)(this), e = (0, n.toBytes)(e), (0, n.abytes)(e);
|
|
834
|
-
let { blockLen: t, state: r } = this, i = e.length;
|
|
835
|
-
for (let n = 0; n < i;) {
|
|
836
|
-
let a = Math.min(t - this.pos, i - n);
|
|
837
|
-
for (let t = 0; t < a; t++) r[this.pos++] ^= e[n++];
|
|
838
|
-
this.pos === t && this.keccak();
|
|
839
|
-
}
|
|
840
|
-
return this;
|
|
841
|
-
}
|
|
842
|
-
finish() {
|
|
843
|
-
if (this.finished) return;
|
|
844
|
-
this.finished = !0;
|
|
845
|
-
let { state: e, suffix: t, pos: n, blockLen: r } = this;
|
|
846
|
-
e[n] ^= t, t & 128 && n === r - 1 && this.keccak(), e[r - 1] ^= 128, this.keccak();
|
|
847
|
-
}
|
|
848
|
-
writeInto(e) {
|
|
849
|
-
(0, n.aexists)(this, !1), (0, n.abytes)(e), this.finish();
|
|
850
|
-
let t = this.state, { blockLen: r } = this;
|
|
851
|
-
for (let n = 0, i = e.length; n < i;) {
|
|
852
|
-
this.posOut >= r && this.keccak();
|
|
853
|
-
let a = Math.min(r - this.posOut, i - n);
|
|
854
|
-
e.set(t.subarray(this.posOut, this.posOut + a), n), this.posOut += a, n += a;
|
|
855
|
-
}
|
|
856
|
-
return e;
|
|
857
|
-
}
|
|
858
|
-
xofInto(e) {
|
|
859
|
-
if (!this.enableXOF) throw Error("XOF is not possible for this instance");
|
|
860
|
-
return this.writeInto(e);
|
|
861
|
-
}
|
|
862
|
-
xof(e) {
|
|
863
|
-
return (0, n.anumber)(e), this.xofInto(new Uint8Array(e));
|
|
864
|
-
}
|
|
865
|
-
digestInto(e) {
|
|
866
|
-
if ((0, n.aoutput)(e, this), this.finished) throw Error("digest() was already called");
|
|
867
|
-
return this.writeInto(e), this.destroy(), e;
|
|
868
|
-
}
|
|
869
|
-
digest() {
|
|
870
|
-
return this.digestInto(new Uint8Array(this.outputLen));
|
|
871
|
-
}
|
|
872
|
-
destroy() {
|
|
873
|
-
this.destroyed = !0, (0, n.clean)(this.state);
|
|
874
|
-
}
|
|
875
|
-
_cloneInto(t) {
|
|
876
|
-
let { blockLen: n, suffix: r, outputLen: i, rounds: a, enableXOF: o } = this;
|
|
877
|
-
return t ||= new e(n, r, i, o, a), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = a, t.suffix = r, t.outputLen = i, t.enableXOF = o, t.destroyed = this.destroyed, t;
|
|
878
|
-
}
|
|
879
|
-
};
|
|
880
|
-
e.Keccak = v;
|
|
881
|
-
var y = (e, t, r) => (0, n.createHasher)(() => new v(t, e, r));
|
|
882
|
-
e.sha3_224 = y(6, 144, 28), e.sha3_256 = y(6, 136, 32), e.sha3_384 = y(6, 104, 48), e.sha3_512 = y(6, 72, 64), e.keccak_224 = y(1, 144, 28), e.keccak_256 = y(1, 136, 32), e.keccak_384 = y(1, 104, 48), e.keccak_512 = y(1, 72, 64);
|
|
883
|
-
var b = (e, t, r) => (0, n.createXOFer)((n = {}) => new v(t, e, n.dkLen === void 0 ? r : n.dkLen, !0));
|
|
884
|
-
e.shake128 = b(31, 168, 16), e.shake256 = b(31, 136, 32);
|
|
885
|
-
})), jt = /* @__PURE__ */ e(((e, t) => {
|
|
886
|
-
var { sha3_512: n } = At(), r = 24, i = 32, a = (e = 4, t = Math.random) => {
|
|
887
|
-
let n = "";
|
|
888
|
-
for (; n.length < e;) n += Math.floor(t() * 36).toString(36);
|
|
889
|
-
return n;
|
|
890
|
-
};
|
|
891
|
-
function o(e) {
|
|
892
|
-
let t = 0n;
|
|
893
|
-
for (let n of e.values()) {
|
|
894
|
-
let e = BigInt(n);
|
|
895
|
-
t = (t << 8n) + e;
|
|
896
|
-
}
|
|
897
|
-
return t;
|
|
898
|
-
}
|
|
899
|
-
var s = (e = "") => o(n(e)).toString(36).slice(1), c = Array.from({ length: 26 }, (e, t) => String.fromCharCode(t + 97)), l = (e) => c[Math.floor(e() * c.length)], u = ({ globalObj: e = typeof global < "u" ? global : typeof window < "u" ? window : {}, random: t = Math.random } = {}) => {
|
|
900
|
-
let n = Object.keys(e).toString();
|
|
901
|
-
return s(n.length ? n + a(i, t) : a(i, t)).substring(0, i);
|
|
902
|
-
}, d = (e) => () => e++, f = 476782367, p = ({ random: e = Math.random, counter: t = d(Math.floor(e() * f)), length: n = r, fingerprint: i = u({ random: e }) } = {}) => function() {
|
|
903
|
-
let r = l(e), o = Date.now().toString(36), c = t().toString(36);
|
|
904
|
-
return `${r + s(`${o + a(n, e) + c + i}`).substring(1, n)}`;
|
|
905
|
-
}, m = p(), h = (e, { minLength: t = 2, maxLength: n = i } = {}) => {
|
|
906
|
-
let r = e.length, a = /^[0-9a-z]+$/;
|
|
907
|
-
try {
|
|
908
|
-
if (typeof e == "string" && r >= t && r <= n && a.test(e)) return !0;
|
|
909
|
-
} finally {}
|
|
910
|
-
return !1;
|
|
911
|
-
};
|
|
912
|
-
t.exports.getConstants = () => ({
|
|
913
|
-
defaultLength: r,
|
|
914
|
-
bigLength: i
|
|
915
|
-
}), t.exports.init = p, t.exports.createId = m, t.exports.bufToBigInt = o, t.exports.createCounter = d, t.exports.createFingerprint = u, t.exports.isCuid = h;
|
|
916
|
-
})), Z = /* @__PURE__ */ e(((e, t) => {
|
|
917
|
-
var { createId: n, init: r, getConstants: i, isCuid: a } = jt();
|
|
918
|
-
t.exports.createId = n, t.exports.init = r, t.exports.getConstants = i, t.exports.isCuid = a;
|
|
919
|
-
})), Mt = Z();
|
|
920
|
-
function Q(e) {
|
|
921
|
-
let t = new URL(window.location.href);
|
|
922
|
-
e(t.searchParams), window.history.replaceState({}, "", t.toString());
|
|
923
|
-
}
|
|
924
|
-
var Nt = /^(https?:\/\/\S+)$/;
|
|
925
|
-
function Pt(e) {
|
|
926
|
-
return typeof e == "string" && Nt.test(e);
|
|
927
|
-
}
|
|
928
|
-
function Ft({ href: e, queryParams: t, keys: n }) {
|
|
929
|
-
let r = typeof t == "string" ? new URLSearchParams(t) : t;
|
|
930
|
-
if (r.size === 0 || e.startsWith("http://") || e.startsWith("https://")) return e;
|
|
931
|
-
let i = e.startsWith("#"), a = i && e.includes("?");
|
|
932
|
-
if (i && !a) {
|
|
933
|
-
let t = n ? [...r.entries()].filter(([e]) => n.includes(e)) : [...r.entries()], i = new URLSearchParams();
|
|
934
|
-
for (let [e, n] of t) i.set(e, n);
|
|
935
|
-
let a = i.toString();
|
|
936
|
-
return a ? `/?${a}${e}` : e;
|
|
937
|
-
}
|
|
938
|
-
let o = e, s = "", c = new URLSearchParams(), l = +!!i, u = e.indexOf("#", l);
|
|
939
|
-
u !== -1 && (s = e.slice(u), o = e.slice(0, u));
|
|
940
|
-
let d = o.indexOf("?");
|
|
941
|
-
d !== -1 && (c = new URLSearchParams(o.slice(d + 1)), o = o.slice(0, d));
|
|
942
|
-
let f = new URLSearchParams(c), p = n ? [...r.entries()].filter(([e]) => n.includes(e)) : [...r.entries()];
|
|
943
|
-
for (let [e, t] of p) f.set(e, t);
|
|
944
|
-
let m = f.toString();
|
|
945
|
-
return m ? `${o}?${m}${s}` : e;
|
|
946
|
-
}
|
|
947
|
-
//#endregion
|
|
948
|
-
//#region src/core/kernel/session.ts
|
|
949
|
-
var It = v(null), Lt = (0, Mt.init)({ length: 6 });
|
|
950
|
-
function Rt() {
|
|
951
|
-
return `s_${Lt()}`;
|
|
952
|
-
}
|
|
953
|
-
function zt(e) {
|
|
954
|
-
return e ? /^s_[\da-z]{6}$/.test(e) : !1;
|
|
955
|
-
}
|
|
956
|
-
var $ = null;
|
|
957
|
-
function Bt() {
|
|
958
|
-
let e = y.get(M) === "edit", n = new URL(window.location.href).searchParams.get(b.sessionId), r = zt(n) ? n : null;
|
|
959
|
-
return Q((t) => {
|
|
960
|
-
if (!e) {
|
|
961
|
-
t.delete(b.sessionId), t.delete(b.kiosk);
|
|
962
|
-
return;
|
|
963
|
-
}
|
|
964
|
-
t.has(b.kiosk) || t.delete(b.sessionId);
|
|
965
|
-
}), r === null ? (t.debug("Starting a new session", { sessionId: n }), Rt()) : e ? (t.debug("Connecting to existing session", { sessionId: r }), r) : (t.debug("Ignoring session_id from URL outside the editor", { sessionId: r }), Rt());
|
|
966
|
-
}
|
|
967
|
-
function Vt() {
|
|
968
|
-
return $ === null && ($ = Bt()), $;
|
|
969
|
-
}
|
|
970
|
-
//#endregion
|
|
971
|
-
//#region src/core/static/static-state.ts
|
|
972
|
-
function Ht(e) {
|
|
973
|
-
if (typeof e != "object" || !e || Array.isArray(e)) return !1;
|
|
974
|
-
for (let t of Object.values(e)) if (typeof t != "string") return !1;
|
|
975
|
-
return !0;
|
|
976
|
-
}
|
|
977
|
-
function Ut(e) {
|
|
978
|
-
if (typeof e != "object" || !e || Array.isArray(e)) return !1;
|
|
979
|
-
let t = e;
|
|
980
|
-
return !(!Ht(t.files) || t.modelNotifications !== void 0 && !Array.isArray(t.modelNotifications));
|
|
981
|
-
}
|
|
982
|
-
function Wt() {
|
|
983
|
-
let e = typeof window > "u" ? void 0 : window.__MARIMO_STATIC__;
|
|
984
|
-
return Ut(e) ? e : void 0;
|
|
985
|
-
}
|
|
986
|
-
function Gt() {
|
|
987
|
-
return Wt() !== void 0;
|
|
988
|
-
}
|
|
989
|
-
function Kt() {
|
|
990
|
-
let e = Wt();
|
|
991
|
-
return S(e !== void 0, "Not a static notebook"), e.files;
|
|
992
|
-
}
|
|
993
|
-
//#endregion
|
|
994
|
-
//#region src/core/runtime/runtime.ts
|
|
995
|
-
var qt = new Set(Object.values(b)), Jt = class {
|
|
996
|
-
initialHealthyCheck = new O();
|
|
997
|
-
config;
|
|
998
|
-
lazy;
|
|
999
|
-
constructor(e, t = !1) {
|
|
1000
|
-
this.config = e, this.lazy = t;
|
|
1001
|
-
try {
|
|
1002
|
-
new URL(this.config.url);
|
|
1003
|
-
} catch (e) {
|
|
1004
|
-
throw Error(`Invalid runtime URL: ${this.config.url}. ${e instanceof Error ? e.message : "Unknown error"}`, { cause: e });
|
|
1005
|
-
}
|
|
1006
|
-
this.lazy || this.init();
|
|
1007
|
-
}
|
|
1008
|
-
get isLazy() {
|
|
1009
|
-
return this.lazy;
|
|
1010
|
-
}
|
|
1011
|
-
get httpURL() {
|
|
1012
|
-
return new URL(this.config.url);
|
|
1013
|
-
}
|
|
1014
|
-
get isSameOrigin() {
|
|
1015
|
-
return this.httpURL.origin === window.location.origin;
|
|
1016
|
-
}
|
|
1017
|
-
get isServerless() {
|
|
1018
|
-
return D() || x() || Gt();
|
|
1019
|
-
}
|
|
1020
|
-
formatHttpURL({ path: e = "", searchParams: t, restrictToKnownQueryParams: n = !0 }) {
|
|
1021
|
-
let r = this.httpURL, i = new URLSearchParams(window.location.search);
|
|
1022
|
-
if (t) for (let [e, n] of t.entries()) r.searchParams.set(e, n);
|
|
1023
|
-
for (let [e, t] of i.entries()) n && !qt.has(e) || r.searchParams.set(e, t);
|
|
1024
|
-
return r.pathname = `${r.pathname.replace(/\/$/, "")}/${e.replace(/^\//, "")}`, r.hash = "", r;
|
|
1025
|
-
}
|
|
1026
|
-
appendCrossOriginAuth(e) {
|
|
1027
|
-
return !this.isSameOrigin && this.config.authToken && e.searchParams.set(b.accessToken, this.config.authToken), e;
|
|
1028
|
-
}
|
|
1029
|
-
formatNavigableHttpURL(e, t) {
|
|
1030
|
-
let n = this.formatHttpURL({
|
|
1031
|
-
path: e,
|
|
1032
|
-
searchParams: t
|
|
1033
|
-
});
|
|
1034
|
-
return n.searchParams.delete(b.accessToken), this.appendCrossOriginAuth(n);
|
|
1035
|
-
}
|
|
1036
|
-
formatWsURL(e, t) {
|
|
1037
|
-
let n = this.formatHttpURL({
|
|
1038
|
-
path: e,
|
|
1039
|
-
searchParams: t,
|
|
1040
|
-
restrictToKnownQueryParams: !1
|
|
1041
|
-
});
|
|
1042
|
-
return Yt(this.appendCrossOriginAuth(n).toString());
|
|
1043
|
-
}
|
|
1044
|
-
getSessionSearchParams(e) {
|
|
1045
|
-
let t = new URL(this.config.url), n = new URLSearchParams(t.search);
|
|
1046
|
-
return new URLSearchParams(window.location.search).forEach((e, t) => {
|
|
1047
|
-
n.has(t) || n.set(t, e);
|
|
1048
|
-
}), n.set(b.sessionId, e), n;
|
|
1049
|
-
}
|
|
1050
|
-
getWsURL(e) {
|
|
1051
|
-
let t = this.getSessionSearchParams(e), n = this.config.notebookId, r = n ? `/api/marimo/v1/notebooks/${encodeURIComponent(n)}/events/ws` : "/ws", i = this.formatWsURL(r, t);
|
|
1052
|
-
return n && i.searchParams.set("types", Et.join(",")), i;
|
|
1053
|
-
}
|
|
1054
|
-
getSseURL(e) {
|
|
1055
|
-
let t = this.formatHttpURL({
|
|
1056
|
-
path: "/sse",
|
|
1057
|
-
searchParams: this.getSessionSearchParams(e),
|
|
1058
|
-
restrictToKnownQueryParams: !1
|
|
1059
|
-
});
|
|
1060
|
-
return t.searchParams.delete(b.accessToken), t;
|
|
1061
|
-
}
|
|
1062
|
-
getWsSyncURL(e) {
|
|
1063
|
-
return this.formatWsURL("/ws_sync", this.getSessionSearchParams(e));
|
|
1064
|
-
}
|
|
1065
|
-
getTerminalWsURL(e) {
|
|
1066
|
-
let t = this.formatWsURL("/terminal/ws");
|
|
1067
|
-
return e && (t.searchParams.set("rows", String(e.rows)), t.searchParams.set("cols", String(e.cols))), t;
|
|
1068
|
-
}
|
|
1069
|
-
getLSPURL(e) {
|
|
1070
|
-
if (e === "copilot") {
|
|
1071
|
-
let t = this.formatWsURL(`/lsp/${e}`), n = t.searchParams.get(b.accessToken);
|
|
1072
|
-
return t.search = "", n && t.searchParams.set(b.accessToken, n), t;
|
|
1073
|
-
}
|
|
1074
|
-
return this.formatWsURL(`/lsp/${e}`);
|
|
1075
|
-
}
|
|
1076
|
-
getAiURL(e) {
|
|
1077
|
-
return this.formatHttpURL({ path: `/api/ai/${e}` });
|
|
1078
|
-
}
|
|
1079
|
-
healthURL() {
|
|
1080
|
-
return this.formatHttpURL({ path: "/health" });
|
|
1081
|
-
}
|
|
1082
|
-
async fetchHealth() {
|
|
1083
|
-
try {
|
|
1084
|
-
return await fetch(this.healthURL().toString());
|
|
1085
|
-
} catch (e) {
|
|
1086
|
-
return t.error(`Failed to check health: ${e instanceof Error ? e.message : "Unknown error"}`, { cause: e }), null;
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1089
|
-
async reconcileFromHealth() {
|
|
1090
|
-
if (this.isServerless) return !0;
|
|
1091
|
-
let e = await this.fetchHealth();
|
|
1092
|
-
if (!e) return !1;
|
|
1093
|
-
if (e.redirected) {
|
|
1094
|
-
t.debug(`Runtime redirected to ${e.url}`);
|
|
1095
|
-
let n = new URL(e.url);
|
|
1096
|
-
n.pathname = n.pathname.replace(/\/health$/, ""), this.config.url = n.toString();
|
|
1097
|
-
}
|
|
1098
|
-
return e.ok && this.setDOMBaseUri(this.config.url), e.ok;
|
|
1099
|
-
}
|
|
1100
|
-
async probeHealth() {
|
|
1101
|
-
return this.isServerless ? !0 : (await this.fetchHealth())?.ok ?? !1;
|
|
1102
|
-
}
|
|
1103
|
-
setDOMBaseUri(e) {
|
|
1104
|
-
e = e.split("?", 1)[0], e.endsWith("/") || (e += "/");
|
|
1105
|
-
let t = document.querySelector("base");
|
|
1106
|
-
t ? t.setAttribute("href", e) : (t = document.createElement("base"), t.setAttribute("href", e), document.head.append(t));
|
|
1107
|
-
}
|
|
1108
|
-
async init(e) {
|
|
1109
|
-
t.debug("Initializing runtime...");
|
|
1110
|
-
let n = 0;
|
|
1111
|
-
for (; !await this.reconcileFromHealth();) {
|
|
1112
|
-
if (n >= 25) {
|
|
1113
|
-
t.error("Failed to connect after 25 retries"), this.initialHealthyCheck.reject(/* @__PURE__ */ Error("Failed to connect after 25 retries"));
|
|
1114
|
-
return;
|
|
1115
|
-
}
|
|
1116
|
-
if (!e?.disableRetryDelay) {
|
|
1117
|
-
let e = Math.min(100 * 1.2 ** n, 2e3);
|
|
1118
|
-
await new Promise((t) => setTimeout(t, e));
|
|
1119
|
-
}
|
|
1120
|
-
n++;
|
|
1121
|
-
}
|
|
1122
|
-
t.debug("Runtime is healthy"), this.initialHealthyCheck.resolve();
|
|
1123
|
-
}
|
|
1124
|
-
async waitForHealthy() {
|
|
1125
|
-
return this.initialHealthyCheck.promise;
|
|
1126
|
-
}
|
|
1127
|
-
headers() {
|
|
1128
|
-
let e = {
|
|
1129
|
-
"Marimo-Session-Id": Vt(),
|
|
1130
|
-
"Marimo-Server-Token": this.config.serverToken ?? "",
|
|
1131
|
-
"x-runtime-url": this.httpURL.toString()
|
|
1132
|
-
};
|
|
1133
|
-
return this.config.authToken && (e.Authorization = `Bearer ${this.config.authToken}`), e;
|
|
1134
|
-
}
|
|
1135
|
-
sessionHeaders() {
|
|
1136
|
-
return { "Marimo-Session-Id": Vt() };
|
|
1137
|
-
}
|
|
1138
|
-
};
|
|
1139
|
-
function Yt(e) {
|
|
1140
|
-
if (!e.startsWith("http")) {
|
|
1141
|
-
t.warn(`URL must start with http: ${e}`);
|
|
1142
|
-
let n = new URL(e);
|
|
1143
|
-
return n.protocol = "ws", n;
|
|
1144
|
-
}
|
|
1145
|
-
return new URL(e.replace(/^http/, "ws"));
|
|
1146
|
-
}
|
|
1147
|
-
//#endregion
|
|
1148
|
-
//#region src/core/runtime/config.ts
|
|
1149
|
-
function Xt() {
|
|
1150
|
-
let e = new URL(document.baseURI);
|
|
1151
|
-
return e.search = "", e.hash = "", e.toString();
|
|
1152
|
-
}
|
|
1153
|
-
var Zt = {
|
|
1154
|
-
lazy: !0,
|
|
1155
|
-
url: Xt()
|
|
1156
|
-
}, Qt = v(Zt), $t = v((e) => {
|
|
1157
|
-
let t = e(Qt);
|
|
1158
|
-
return new Jt(t, t.lazy);
|
|
1159
|
-
});
|
|
1160
|
-
function en() {
|
|
1161
|
-
return y.get($t);
|
|
1162
|
-
}
|
|
1163
|
-
function tn(e) {
|
|
1164
|
-
if (e.startsWith("http")) return new URL(e);
|
|
1165
|
-
let t = en().httpURL.toString();
|
|
1166
|
-
return t.startsWith("blob:") && (t = t.replace("blob:", "")), new URL(e, t);
|
|
1167
|
-
}
|
|
1168
|
-
//#endregion
|
|
1169
|
-
//#region ../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/constants.js
|
|
1170
|
-
var nn = 365.2425, rn = 6048e5, an = 864e5, on = 86400;
|
|
1171
|
-
on * 7, on * nn / 12 * 3;
|
|
1172
|
-
var sn = Symbol.for("constructDateFrom");
|
|
1173
|
-
//#endregion
|
|
1174
|
-
//#region ../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/constructFrom.js
|
|
1175
|
-
function cn(e, t) {
|
|
1176
|
-
return typeof e == "function" ? e(t) : e && typeof e == "object" && sn in e ? e[sn](t) : e instanceof Date ? new e.constructor(t) : new Date(t);
|
|
1177
|
-
}
|
|
1178
|
-
//#endregion
|
|
1179
|
-
//#region ../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/toDate.js
|
|
1180
|
-
function ln(e, t) {
|
|
1181
|
-
return cn(t || e, e);
|
|
1182
|
-
}
|
|
1183
|
-
//#endregion
|
|
1184
|
-
export { C, E as S, N as _, tn as a, O as b, Gt as c, Pt as d, Q as f, ee as g, M as h, rn as i, It as l, A as m, cn as n, en as o, Z as p, an as r, Kt as s, ln as t, Ft as u, te as v, D as x, j as y };
|