@marimo-team/frontend 0.23.9-dev46 → 0.23.9-dev47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/assets/{CellStatus-B0Fz0F4Y.js → CellStatus-BLWR83i_.js} +1 -1
  2. package/dist/assets/{JsonOutput-B2v_Stn9.js → JsonOutput-BJaeXQim.js} +1 -1
  3. package/dist/assets/{MarimoErrorOutput-DWt3lI06.js → MarimoErrorOutput-B0h5OVW9.js} +1 -1
  4. package/dist/assets/{RenderHTML-CP7UDK5X.js → RenderHTML-ChwPJgPd.js} +1 -1
  5. package/dist/assets/{RunButton-BIFIZ7Iv.js → RunButton-NDsrcmxR.js} +1 -1
  6. package/dist/assets/{add-cell-with-ai-CAC7vFzu.js → add-cell-with-ai-FxJitVGs.js} +1 -1
  7. package/dist/assets/{add-connection-dialog-C6y-WHQz.js → add-connection-dialog-EgkKupsZ.js} +1 -1
  8. package/dist/assets/{agent-panel-CztVh0_v.js → agent-panel-BSt1fSQZ.js} +1 -1
  9. package/dist/assets/{ai-model-dropdown-BToySVta.js → ai-model-dropdown-DxAk02Lc.js} +1 -1
  10. package/dist/assets/{app-config-button-BjRm2yh5.js → app-config-button-BcOcIm9W.js} +1 -1
  11. package/dist/assets/{cell-editor-BCFCsP_w.js → cell-editor-C5CDtKML.js} +1 -1
  12. package/dist/assets/{cell-link-CW22jH60.js → cell-link-B1pHtGWp.js} +1 -1
  13. package/dist/assets/{cells-CFd8A4_A.js → cells-BsaJrRWi.js} +1 -1
  14. package/dist/assets/{chat-display-BnWhAO8B.js → chat-display-ccjE30z9.js} +1 -1
  15. package/dist/assets/{chat-panel-DXiPy2pt.js → chat-panel-CtvtP3kb.js} +1 -1
  16. package/dist/assets/{chat-ui-CHaOV403.js → chat-ui-DV8CD_s1.js} +1 -1
  17. package/dist/assets/{column-preview-CCTTw4tm.js → column-preview-BPismotx.js} +1 -1
  18. package/dist/assets/{command-palette-B-Gmv6bI.js → command-palette-Cdy8eCpi.js} +1 -1
  19. package/dist/assets/{common-C1B2sLXd.js → common-6n8M1qiK.js} +1 -1
  20. package/dist/assets/{components-BYC1jwIq.js → components-BzBUxUz0.js} +1 -1
  21. package/dist/assets/{components-D_5hgeFU.js → components-CK-WtvAJ.js} +1 -1
  22. package/dist/assets/config-ClMcu_sV.js +1 -0
  23. package/dist/assets/{datasource-DiYrzHFG.js → datasource-DjDpJnbt.js} +1 -1
  24. package/dist/assets/{dependency-graph-panel-BIsy_CIT.js → dependency-graph-panel-BNaXAcZr.js} +1 -1
  25. package/dist/assets/{documentation-panel-B2yxm9NW.js → documentation-panel-5jUKZR-l.js} +1 -1
  26. package/dist/assets/{download-BaGnGHOq.js → download-DT8gf0PL.js} +1 -1
  27. package/dist/assets/edit-page-B7KTvcRN.js +9 -0
  28. package/dist/assets/{error-panel-Btthwogx.js → error-panel-DHcg_ER5.js} +1 -1
  29. package/dist/assets/{file-explorer-panel-BwlHcepA.js → file-explorer-panel-CbOdvGyZ.js} +1 -1
  30. package/dist/assets/{file-icons-CIKQdTpO.js → file-icons-BiMOJy0r.js} +1 -1
  31. package/dist/assets/{floating-outline-CEy7C9R6.js → floating-outline-BN9sAcQ0.js} +1 -1
  32. package/dist/assets/{focus-DjmSWsDI.js → focus-q38vUCl-.js} +1 -1
  33. package/dist/assets/{form-PMq9H-I_.js → form-BtBTvVVd.js} +1 -1
  34. package/dist/assets/{globals-FM_XB1In.js → globals-7JnRMGd4.js} +1 -1
  35. package/dist/assets/{home-page-CNWhDe7y.js → home-page-lXjPDNM0.js} +1 -1
  36. package/dist/assets/{hooks-Cj0_VSui.js → hooks-DP41kAWj.js} +1 -1
  37. package/dist/assets/{html-to-image-CJxTFjQz.js → html-to-image-BWL3Ct4n.js} +1 -1
  38. package/dist/assets/index-BIw7BKLH.css +2 -0
  39. package/dist/assets/{index-gYS1m_ap.js → index-awsLWRjZ.js} +4 -4
  40. package/dist/assets/{kiosk-mode-CtlXE_Xv.js → kiosk-mode-BqvqWsFx.js} +1 -1
  41. package/dist/assets/{layout-B15A69L1.js → layout-DXDnDtNw.js} +3 -3
  42. package/dist/assets/{logs-panel-DFXVtdbp.js → logs-panel-BNoBKY1q.js} +1 -1
  43. package/dist/assets/{markdown-renderer-B1eFOa7V.js → markdown-renderer-CU5Lbyax.js} +1 -1
  44. package/dist/assets/{name-cell-input-DdwASAQy.js → name-cell-input-BNc3X9qF.js} +1 -1
  45. package/dist/assets/{outline-panel-CCgZPS64.js → outline-panel-De2gw3Ro.js} +1 -1
  46. package/dist/assets/{packages-panel-j1RhwwPL.js → packages-panel-C8maQt0Q.js} +1 -1
  47. package/dist/assets/{pair-with-agent-modal-D8eOWIWE.js → pair-with-agent-modal-1tufe5MP.js} +1 -1
  48. package/dist/assets/panels-BKv_j2lC.js +1 -0
  49. package/dist/assets/{process-output-DaNYZ78d.js → process-output-B2oklQi4.js} +1 -1
  50. package/dist/assets/{radio-group-PmOgsvro.js → radio-group-DlVSuZ_1.js} +1 -1
  51. package/dist/assets/{readonly-python-code-A3C9oCts.js → readonly-python-code-D3_kHsDx.js} +1 -1
  52. package/dist/assets/{reveal-component-BUEHXSjS.js → reveal-component-C50CTy8h.js} +1 -1
  53. package/dist/assets/{run-page-B9bMWajI.js → run-page-DeOIw0On.js} +1 -1
  54. package/dist/assets/{scratchpad-panel-BCWZfK4f.js → scratchpad-panel-DWbD_QB3.js} +1 -1
  55. package/dist/assets/{session-panel-D8BxQC75.js → session-panel-BHgL-7KC.js} +1 -1
  56. package/dist/assets/{snippets-panel-DlmVBDpu.js → snippets-panel-FY_Ezibl.js} +1 -1
  57. package/dist/assets/{state-CAn3OpIa.js → state-BTTshiKq.js} +1 -1
  58. package/dist/assets/{state-CEiXUajw.js → state-D-2KaAHK.js} +1 -1
  59. package/dist/assets/{switch-35WUzMpb.js → switch-BiU_sAcn.js} +1 -1
  60. package/dist/assets/{terminal-CSFhp6UG.js → terminal-BYGihNNp.js} +1 -1
  61. package/dist/assets/{textarea-DQ0XiNGe.js → textarea-DwltG8V6.js} +1 -1
  62. package/dist/assets/{tracing-panel-DhP3ygQA.js → tracing-panel-bN0O3PuU.js} +2 -2
  63. package/dist/assets/{tracing-BV9mu9dM.js → tracing-zLH-qWb2.js} +1 -1
  64. package/dist/assets/{useBoolean-_e4hdH_M.js → useBoolean-Bp18o6XG.js} +1 -1
  65. package/dist/assets/{useCellActionButton-CXkISThQ.js → useCellActionButton-h5LjhtEx.js} +1 -1
  66. package/dist/assets/{useDeleteCell-CH_1gU2V.js → useDeleteCell-BBPIhnQj.js} +1 -1
  67. package/dist/assets/{useDependencyPanelTab-CLNYiwom.js → useDependencyPanelTab-BSkmlMqr.js} +1 -1
  68. package/dist/assets/{useNotebookActions-gBMzsDzE.js → useNotebookActions-B32eCmtG.js} +1 -1
  69. package/dist/assets/{useRunCells-DQDFDt2R.js → useRunCells-BiCBGyeW.js} +1 -1
  70. package/dist/assets/{useSplitCell-Cle-KXDv.js → useSplitCell-uogO-7ac.js} +1 -1
  71. package/dist/assets/{vega-component-BTe5wXGH.js → vega-component-COOhhZ3h.js} +1 -1
  72. package/dist/index.html +27 -27
  73. package/package.json +1 -1
  74. package/src/components/editor/Disconnected.tsx +1 -60
  75. package/src/components/editor/__tests__/viewer-banner.test.tsx +89 -0
  76. package/src/components/editor/header/__tests__/status.test.tsx +0 -15
  77. package/src/components/editor/header/app-header.tsx +1 -4
  78. package/src/components/editor/header/status.tsx +4 -13
  79. package/src/components/editor/viewer-banner.tsx +82 -0
  80. package/src/core/edit-app.tsx +3 -0
  81. package/src/core/islands/bootstrap.ts +2 -0
  82. package/src/core/kernel/__tests__/handlers.test.ts +5 -0
  83. package/src/core/websocket/__tests__/useMarimoKernelConnection.test.ts +0 -13
  84. package/src/core/websocket/types.ts +0 -6
  85. package/src/core/websocket/useMarimoKernelConnection.tsx +3 -12
  86. package/dist/assets/config-DdDKNgb1.js +0 -1
  87. package/dist/assets/edit-page-DxrKx70k.js +0 -9
  88. package/dist/assets/index-DAfPvCnw.css +0 -2
  89. package/dist/assets/panels-CHMV9kca.js +0 -1
@@ -14,7 +14,6 @@ export type WebSocketState =
14
14
 
15
15
  export const WebSocketClosedReason = {
16
16
  KERNEL_DISCONNECTED: "KERNEL_DISCONNECTED",
17
- ALREADY_RUNNING: "ALREADY_RUNNING",
18
17
  MALFORMED_QUERY: "MALFORMED_QUERY",
19
18
  KERNEL_STARTUP_ERROR: "KERNEL_STARTUP_ERROR",
20
19
  } as const;
@@ -30,11 +29,6 @@ export type ConnectionStatus =
30
29
  * Human-readable reason for closing the connection.
31
30
  */
32
31
  reason: string;
33
- /**
34
- * Whether the current session can be taken over by another session,
35
- * since we only allow single-user editing.
36
- */
37
- canTakeover?: boolean;
38
32
  }
39
33
  | {
40
34
  state:
@@ -82,7 +82,6 @@ const SUPPORTS_LAZY_KERNELS = true;
82
82
  // (marimo/_server/api/endpoints/ws_endpoint.py and ws/*.py). Keep in sync with
83
83
  // the backend literals.
84
84
  export type CloseReason =
85
- | "MARIMO_ALREADY_CONNECTED"
86
85
  | "MARIMO_WRONG_KERNEL_ID"
87
86
  | "MARIMO_NO_FILE_KEY"
88
87
  | "MARIMO_NO_SESSION_ID"
@@ -99,17 +98,6 @@ export type CloseDecision =
99
98
 
100
99
  export function classifyCloseEvent(event: { reason?: string }): CloseDecision {
101
100
  switch (event.reason as CloseReason | undefined) {
102
- case "MARIMO_ALREADY_CONNECTED":
103
- return {
104
- kind: "terminal",
105
- status: {
106
- state: WebSocketState.CLOSED,
107
- code: WebSocketClosedReason.ALREADY_RUNNING,
108
- reason: "another browser tab is already connected to the kernel",
109
- canTakeover: true,
110
- },
111
- closeTransport: true,
112
- };
113
101
  case TRANSPORT_EXHAUSTED_REASON:
114
102
  return {
115
103
  kind: "gave-up",
@@ -421,6 +409,9 @@ export function useMarimoKernelConnection(opts: {
421
409
  case "notebook-document-transaction":
422
410
  handleDocumentTransaction(msg.data.transaction);
423
411
  return;
412
+ case "consumer-capabilities":
413
+ setKioskMode(!msg.data.consumer_capabilities.edit);
414
+ return;
424
415
  default:
425
416
  logNever(msg.data);
426
417
  }
@@ -1 +0,0 @@
1
- var S=Object.defineProperty;var g=(t,e,r)=>e in t?S(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var m=(t,e,r)=>g(t,typeof e!="symbol"?e+"":e,r);import{i as O,l as y,n as C,o as A,p as i,u as I}from"./useEvent-D91BmmQi.js";import{t as P}from"./compiler-runtime-B3qBwwSJ.js";import{_ as c}from"./useEventListener-DvoEXWke.js";import{t as _}from"./invariant-BUdrueMv.js";import{t as D}from"./utils-CvI-39U6.js";import{r as h}from"./constants-DMpttj8Q.js";import{t as k}from"./Deferred-CP7vq682.js";import{t as R}from"./session-0B5NBztP.js";function L(){return typeof document<"u"&&document.querySelector("marimo-wasm")!==null}const a={NOT_STARTED:"NOT_STARTED",CONNECTING:"CONNECTING",OPEN:"OPEN",CLOSING:"CLOSING",CLOSED:"CLOSED"},b={KERNEL_DISCONNECTED:"KERNEL_DISCONNECTED",ALREADY_RUNNING:"ALREADY_RUNNING",MALFORMED_QUERY:"MALFORMED_QUERY",KERNEL_STARTUP_ERROR:"KERNEL_STARTUP_ERROR"},o=i({state:a.NOT_STARTED});function v(){return A(o,t=>t.state===a.OPEN)}const H=i(t=>t(o).state===a.CONNECTING);i(t=>t(o).state===a.OPEN);const G=i(t=>{let e=t(o);return e.state===a.OPEN||e.state===a.NOT_STARTED}),W=i(t=>t(o).state===a.CLOSED),M=i(t=>t(o).state===a.NOT_STARTED);function $(t){return t===a.CLOSED}function z(t){return t===a.CONNECTING}function F(t){return t===a.OPEN}function j(t){return t===a.CLOSING}function N(t){return t===a.NOT_STARTED}function K(t){return t===a.CLOSED||t===a.CLOSING||t===a.CONNECTING}function B(t){switch(t){case a.CLOSED:return"App disconnected";case a.CONNECTING:return"Connecting to a runtime ...";case a.CLOSING:return"App disconnecting...";case a.OPEN:return"";case a.NOT_STARTED:return"Click to connect to a runtime";default:return""}}function Q(t){if(typeof t!="object"||!t||Array.isArray(t))return!1;for(let e of Object.values(t))if(typeof e!="string")return!1;return!0}function Y(t){if(typeof t!="object"||!t||Array.isArray(t))return!1;let e=t;return!(!Q(e.files)||e.modelNotifications!==void 0&&!Array.isArray(e.modelNotifications))}function f(){let t=typeof window>"u"?void 0:window.__MARIMO_STATIC__;return Y(t)?t:void 0}function p(){return f()!==void 0}function x(){let t=f();return _(t!==void 0,"Not a static notebook"),t.files}function q(){var t;return(t=f())==null?void 0:t.modelNotifications}var V=class{constructor(t,e=!1){m(this,"initialHealthyCheck",new k);this.config=t,this.lazy=e;try{new URL(this.config.url)}catch(r){throw Error(`Invalid runtime URL: ${this.config.url}. ${r instanceof Error?r.message:"Unknown error"}`,{cause:r})}this.lazy||this.init()}get isLazy(){return this.lazy}get httpURL(){return new URL(this.config.url)}get isSameOrigin(){return this.httpURL.origin===window.location.origin}get isServerless(){return L()||D()||p()}formatHttpURL({path:t="",searchParams:e,restrictToKnownQueryParams:r=!0}){let n=this.httpURL,s=new URLSearchParams(window.location.search);if(e)for(let[u,l]of e.entries())n.searchParams.set(u,l);for(let[u,l]of s.entries())r&&!Object.values(h).includes(u)||n.searchParams.set(u,l);return n.pathname=`${n.pathname.replace(/\/$/,"")}/${t.replace(/^\//,"")}`,n.hash="",n}formatWsURL(t,e){let r=this.formatHttpURL({path:t,searchParams:e,restrictToKnownQueryParams:!1});return!this.isSameOrigin&&this.config.authToken&&r.searchParams.set(h.accessToken,this.config.authToken),J(r.toString())}getWsURL(t){let e=new URL(this.config.url),r=new URLSearchParams(e.search);return new URLSearchParams(window.location.search).forEach((n,s)=>{r.has(s)||r.set(s,n)}),r.set(h.sessionId,t),this.formatWsURL("/ws",r)}getWsSyncURL(t){let e=new URL(this.config.url),r=new URLSearchParams(e.search);return new URLSearchParams(window.location.search).forEach((n,s)=>{r.has(s)||r.set(s,n)}),r.set(h.sessionId,t),this.formatWsURL("/ws_sync",r)}getTerminalWsURL(){return this.formatWsURL("/terminal/ws")}getLSPURL(t){if(t==="copilot"){let e=this.formatWsURL(`/lsp/${t}`),r=e.searchParams.get(h.accessToken);return e.search="",r&&e.searchParams.set(h.accessToken,r),e}return this.formatWsURL(`/lsp/${t}`)}getAiURL(t){return this.formatHttpURL({path:`/api/ai/${t}`})}healthURL(){return this.formatHttpURL({path:"/health"})}async fetchHealth(){try{return await fetch(this.healthURL().toString())}catch(t){return c.error(`Failed to check health: ${t instanceof Error?t.message:"Unknown error"}`,{cause:t}),null}}async reconcileFromHealth(){if(this.isServerless)return!0;let t=await this.fetchHealth();if(!t)return!1;if(t.redirected){c.debug(`Runtime redirected to ${t.url}`);let e=new URL(t.url);e.pathname=e.pathname.replace(/\/health$/,""),this.config.url=e.toString()}return t.ok&&this.setDOMBaseUri(this.config.url),t.ok}async probeHealth(){var t;return this.isServerless?!0:((t=await this.fetchHealth())==null?void 0:t.ok)??!1}setDOMBaseUri(t){t=t.split("?",1)[0],t.endsWith("/")||(t+="/");let e=document.querySelector("base");e?e.setAttribute("href",t):(e=document.createElement("base"),e.setAttribute("href",t),document.head.append(e))}async init(t){c.debug("Initializing runtime...");let e=0;for(;!await this.reconcileFromHealth();){if(e>=25){c.error("Failed to connect after 25 retries"),this.initialHealthyCheck.reject(Error("Failed to connect after 25 retries"));return}if(!(t!=null&&t.disableRetryDelay)){let r=Math.min(100*1.2**e,2e3);await new Promise(n=>setTimeout(n,r))}e++}c.debug("Runtime is healthy"),this.initialHealthyCheck.resolve()}async waitForHealthy(){return this.initialHealthyCheck.promise}headers(){let t={"Marimo-Session-Id":R(),"Marimo-Server-Token":this.config.serverToken??"","x-runtime-url":this.httpURL.toString()};return this.config.authToken&&(t.Authorization=`Bearer ${this.config.authToken}`),t}sessionHeaders(){return{"Marimo-Session-Id":R()}}};function J(t){if(!t.startsWith("http")){c.warn(`URL must start with http: ${t}`);let e=new URL(t);return e.protocol="ws",e}return new URL(t.replace(/^http/,"ws"))}var X=P();function Z(){let t=new URL(document.baseURI);return t.search="",t.hash="",t.toString()}const E={lazy:!0,url:Z()},w=i(E);var T=i(t=>{let e=t(w);return new V(e,e.lazy)});function U(){return I(T)}function tt(){let t=(0,X.c)(4),e=U(),[r,n]=y(o),s;return t[0]!==r.state||t[1]!==e||t[2]!==n?(s=async()=>{N(r.state)?(n({state:a.CONNECTING}),await e.init()):c.log("Runtime already started or starting...")},t[0]=r.state,t[1]=e,t[2]=n,t[3]=s):s=t[3],C(s)}function d(){return O.get(T)}function et(t){if(t.startsWith("http"))return new URL(t);let e=d().httpURL.toString();return e.startsWith("blob:")&&(e=e.replace("blob:","")),new URL(t,e)}export{b as C,v as S,L as T,G as _,tt as a,H as b,x as c,$ as d,j as f,N as g,K as h,w as i,p as l,z as m,et as n,U as o,F as p,d as r,q as s,E as t,B as u,o as v,a as w,M as x,W as y};