@marimo-team/islands 0.25.3-dev5 → 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.
Files changed (220) hide show
  1. package/dist/{ConnectedDataExplorerComponent-CNMliVzw.js → ConnectedDataExplorerComponent-Da5OoEUL.js} +14 -14
  2. package/dist/{ErrorBoundary-BiZWOrv4.js → ErrorBoundary-CbxCC2kk.js} +8 -8
  3. package/dist/{abnfDiagram-VCTEODGH-D-Ez91gV.js → abnfDiagram-VCTEODGH-Bz3mrprX.js} +2 -2
  4. package/dist/any-language-editor-k2B8YI3Y.js +75 -0
  5. package/dist/{architectureDiagram-5GKGNRK7-CTpcNtO8.js → architectureDiagram-5GKGNRK7-Cs5ujb9K.js} +1 -1
  6. package/dist/{arrays-CN1djC4k.js → arrays-R6JsImiT.js} +8 -0
  7. package/dist/{button-CvjkwdSk.js → button-BxB3RDjN.js} +1 -1
  8. package/dist/{capabilities-CQ5IjhzL.js → capabilities-BgR0osfN.js} +2 -2
  9. package/dist/{chat-ui-0lKdOoQ3.js → chat-ui-C1Gjgokv.js} +1103 -1103
  10. package/dist/{check-EDwSwP89.js → check-P35dc2dH.js} +1 -1
  11. package/dist/{chunk-IMKFNOWR-DGxi-zeo.js → chunk-IMKFNOWR-CcTSaxZt.js} +1 -1
  12. package/dist/{chunk-SHT3W25Y-CV9J3rAB.js → chunk-SHT3W25Y-DcJcjOaO.js} +1 -1
  13. package/dist/{chunk-SVP7TREG-BL-9Fqgg.js → chunk-SVP7TREG-BVtDTjaF.js} +1 -1
  14. package/dist/{chunk-TICWLB2K-Cu_XMjDM.js → chunk-TICWLB2K-BkDFkh8q.js} +1 -1
  15. package/dist/{chunk-YOKDWASO-DPZk8vhS.js → chunk-YOKDWASO-DKplTrBY.js} +20 -20
  16. package/dist/{classDiagram-ZZMXUADV-BXXV13Hq.js → classDiagram-ZZMXUADV-CfAt7HT5.js} +2 -2
  17. package/dist/{classDiagram-v2-VYDZK3BY-B7FXJ1Cp.js → classDiagram-v2-VYDZK3BY-CGEjNYa2.js} +2 -2
  18. package/dist/{code-visibility-CW5_8ZOI.js → code-visibility-DoZ9lxzx.js} +6 -6
  19. package/dist/{common-mzWw4FdI.js → common-D1PacyXO.js} +3112 -3015
  20. package/dist/{copy-icon-Ft7t9bqz.js → copy-icon-CPoxUG7G.js} +3 -3
  21. package/dist/{cynefinDiagram-5FMLGOSQ-CH96rwba.js → cynefinDiagram-5FMLGOSQ-BW6NmfJi.js} +1 -1
  22. package/dist/{dagre-GXQ25YYZ-BD3PmpFY.js → dagre-GXQ25YYZ-CWg3CTuF.js} +1 -1
  23. package/dist/{data-grid-overlay-editor-CJmehSdc.js → data-grid-overlay-editor-B50UpkXd.js} +5 -5
  24. package/dist/{data-grid-types-BH_r7g7l.js → data-grid-types-0PJ-9N5n.js} +1 -1
  25. package/dist/{diagram-S7CK7UJ4-BsSJJldB.js → diagram-S7CK7UJ4-BPxtoS-z.js} +1 -1
  26. package/dist/{diagram-UQ7AKVKN-muQtNZc4.js → diagram-UQ7AKVKN-DA-vJdFL.js} +1 -1
  27. package/dist/{diagram-VX7I27RA-CdhuZAqR.js → diagram-VX7I27RA-D6bkR84S.js} +1 -1
  28. package/dist/{diagram-Z3DM3KII-BD8mXjOj.js → diagram-Z3DM3KII-m60g4cAT.js} +1 -1
  29. package/dist/{dialog-CEBFZNyc.js → dialog-C1PcpCqX.js} +3 -3
  30. package/dist/{dist-DpBpA_n1.js → dist-Lm-D-Vr6.js} +3 -3
  31. package/dist/{dropdown-menu-CP_qCYHC.js → dropdown-menu-MG5hiCIa.js} +76 -76
  32. package/dist/{ebnfDiagram-PWID7BFC-BIN1sweE.js → ebnfDiagram-PWID7BFC-CK99sho2.js} +2 -2
  33. package/dist/{erDiagram-RLTQ6QDP-Ctp5cfoN.js → erDiagram-RLTQ6QDP-Bryq0tdE.js} +1 -1
  34. package/dist/{error-banner-D-WCIiMt.js → error-banner-Sl2FlSJ4.js} +2 -2
  35. package/dist/{error-entries-DSvFWT_M.js → error-entries-CMNtA8NK.js} +959 -959
  36. package/dist/{feedback-button-BcT1FBud.js → feedback-button-DqPqwryB.js} +29 -29
  37. package/dist/{flowDiagram-HODETNUW-3EfLrlFb.js → flowDiagram-HODETNUW-D-3aRpfS.js} +2 -2
  38. package/dist/{formats-CeOmU1MU.js → formats-6pLWWrY2.js} +3 -3
  39. package/dist/{ganttDiagram-EL5Y4UJY-BQT16JSc.js → ganttDiagram-EL5Y4UJY-Dh_4cBJZ.js} +2 -2
  40. package/dist/{glide-data-editor-XckatD0j.js → glide-data-editor-BxMhUd3K.js} +370 -368
  41. package/dist/{glide-utils-DJyqh0EM.js → glide-utils-Bt8_pBa2.js} +16 -16
  42. package/dist/{globals-jRrLCkrP.js → globals-DTJa_doJ.js} +3 -3
  43. package/dist/{highlighted-body-KPVGNVTW-zwjq21tf.js → highlighted-body-KPVGNVTW-3Ziwfz-V.js} +2 -2
  44. package/dist/{html-to-image-B8s5SgGm.js → html-to-image-By72ALyI.js} +29 -29
  45. package/dist/{infoDiagram-27XIBGKW-DipQoHxl.js → infoDiagram-27XIBGKW-s1C1kgfU.js} +1 -1
  46. package/dist/{ishikawaDiagram-5VMMS53U-DgFMjSGz.js → ishikawaDiagram-5VMMS53U-CCsRgolY.js} +1 -1
  47. package/dist/{kanban-definition-UXKFOSKX-w1ACVjgl.js → kanban-definition-UXKFOSKX-BrmxDlcc.js} +1 -1
  48. package/dist/{label-BDKF3Afc.js → label-BRnUC0NX.js} +2 -2
  49. package/dist/{linear-Cnaq3Tfb.js → linear-DWERh7eI.js} +121 -73
  50. package/dist/{loader-BQOfjTIJ.js → loader-Bm8cy3e8.js} +12 -12
  51. package/dist/main.js +2358 -2221
  52. package/dist/{mermaid-CHo49Yv-.js → mermaid-DKI0869I.js} +38 -38
  53. package/dist/mermaid-HWGCJPDP-Du3-HPQA.js +2 -0
  54. package/dist/{mindmap-definition-YA3MSWOX-CrT0KSfX.js → mindmap-definition-YA3MSWOX-641xJysF.js} +1 -1
  55. package/dist/{number-overlay-editor-pZx8dUDV.js → number-overlay-editor-Z_H6x5b-.js} +3 -3
  56. package/dist/{objects-CzUgoMIF.js → objects-DCmMvZtn.js} +1 -3
  57. package/dist/{once-BtE-wKRL.js → once-eG8Vmvjd.js} +1 -1
  58. package/dist/{pegDiagram-XKGWAZYB-BqvywNJA.js → pegDiagram-XKGWAZYB-keVUAUeS.js} +2 -2
  59. package/dist/{pieDiagram-E7YTZNPT-BfxJ_XCc.js → pieDiagram-E7YTZNPT-DHktXPO_.js} +1 -1
  60. package/dist/precisionRound-DhAzeRcm.js +49 -0
  61. package/dist/{process-output-CKRXyszb.js → process-output-D-OMW5sV.js} +4 -4
  62. package/dist/{quadrantDiagram-AXDQQJYC-Ccw0xMjN.js → quadrantDiagram-AXDQQJYC-Blrm7V7_.js} +1 -1
  63. package/dist/{railroadDiagram-O6MQD6OU-8vFLVTPu.js → railroadDiagram-O6MQD6OU-BVEF4OV_.js} +2 -2
  64. package/dist/{react-vega-BED0DjiB.js → react-vega-C4T9Rb_w.js} +12284 -12270
  65. package/dist/{requirementDiagram-BXWQKSXE-a_MxGvxe.js → requirementDiagram-BXWQKSXE-CWo-UAKV.js} +1 -1
  66. package/dist/{reveal-component-79ez8-D5.js → reveal-component-tAB5K3QE.js} +10 -10
  67. package/dist/{select-BButFi-d.js → select-B0LRDH0g.js} +4 -4
  68. package/dist/{sequenceDiagram-WJ2MYXX4-CXFMnxGh.js → sequenceDiagram-WJ2MYXX4-CHQvLnq4.js} +1 -1
  69. package/dist/{spec-BwarBpUJ.js → spec-C-LRKGtT.js} +4 -4
  70. package/dist/{stateDiagram-D77RDMKH-DQeA_CwI.js → stateDiagram-D77RDMKH-BOJZgbUJ.js} +2 -2
  71. package/dist/{stateDiagram-v2-MP3YSRHH-BxxQucm1.js → stateDiagram-v2-MP3YSRHH-C53XXdYH.js} +2 -2
  72. package/dist/style.css +1 -1
  73. package/dist/{swimlanes-42K2YHIH-Do6L-cYg.js → swimlanes-42K2YHIH-D2o1gOtw.js} +1 -1
  74. package/dist/{swimlanesDiagram-VR7AAH4N-DUzPvSVU.js → swimlanesDiagram-VR7AAH4N-BHFzN1Wk.js} +2 -2
  75. package/dist/{swiper-component-DKntyn8p.js → swiper-component-DfhRvAFi.js} +2 -2
  76. package/dist/{time-BieKwdYS.js → time-BaMbJs4z.js} +18 -18
  77. package/dist/{timeline-definition-24CTP7MA-D3c46WM5.js → timeline-definition-24CTP7MA-rv7QUa46.js} +1 -1
  78. package/dist/{toDate-vIXljnsr.js → toDate-CjPuEPou.js} +21 -20
  79. package/dist/{toast-B9UMEi8u.js → toast-CFWpihJU.js} +4 -4
  80. package/dist/{tooltip-BO1REbqs.js → tooltip-CKO1pHJo.js} +2 -2
  81. package/dist/{use-restore-focus-BEM7sFWl.js → use-restore-focus-DBCITLeF.js} +1 -1
  82. package/dist/{useAsyncData-Deh5kszT.js → useAsyncData-ChgNtdmE.js} +15 -14
  83. package/dist/{useDateFormatter-D8XruNGG.js → useDateFormatter-c_yJtkAe.js} +2 -2
  84. package/dist/{useDeepCompareMemoize-DXwzRINI.js → useDeepCompareMemoize-Bet7kSsI.js} +1 -1
  85. package/dist/{useIframeCapabilities-DBETvvPl.js → useIframeCapabilities-BkdeVdXC.js} +1 -1
  86. package/dist/{useLifecycle-j7D9uD1o.js → useLifecycle-VVmz_24o.js} +3 -3
  87. package/dist/{useTheme-CRnjkku0.js → useTheme-DympCsQg.js} +5 -5
  88. package/dist/{vega-component-DTG6zxaY.js → vega-component-DnfQeoyt.js} +147 -147
  89. package/dist/{vega-embed-container-BNHE18G9.js → vega-embed-container--LYZqguO.js} +2 -2
  90. package/dist/{vega-loader.browser-DNST6uVf.js → vega-loader.browser-B9Pz0EGP.js} +298 -507
  91. package/dist/{vennDiagram-4TSXK5OY-BSZD8JcZ.js → vennDiagram-4TSXK5OY-D36Zk7t-.js} +1 -1
  92. package/dist/{wardleyDiagram-VM6X3IG4-48cUWkfA.js → wardleyDiagram-VM6X3IG4-BLBolvyQ.js} +1 -1
  93. package/dist/{xychartDiagram-S5SC5T6Z-CswYgYeu.js → xychartDiagram-S5SC5T6Z-CfH57l0v.js} +2 -2
  94. package/package.json +4 -4
  95. package/src/__tests__/fixtures/{pair-preview.ts → pair-config.ts} +3 -2
  96. package/src/__tests__/host-imports.test.ts +1 -0
  97. package/src/__tests__/mount.test.ts +8 -8
  98. package/src/components/app-config/ai-config.tsx +5 -1
  99. package/src/components/chat/__tests__/message-queue.test.tsx +17 -0
  100. package/src/components/chat/chat-panel.tsx +3 -7
  101. package/src/components/chat/chat-utils.ts +4 -8
  102. package/src/components/data-table/__tests__/context-menu-interaction.test.tsx +130 -0
  103. package/src/components/data-table/__tests__/date-popover.test.tsx +72 -0
  104. package/src/components/data-table/__tests__/export-actions.test.tsx +417 -6
  105. package/src/components/data-table/column-visibility-dropdown.tsx +8 -13
  106. package/src/components/data-table/columns.tsx +2 -1
  107. package/src/components/data-table/context-menu.tsx +36 -20
  108. package/src/components/data-table/date-popover.tsx +6 -4
  109. package/src/components/data-table/export-actions.tsx +263 -161
  110. package/src/components/data-table/row-viewer-panel/row-viewer.tsx +2 -2
  111. package/src/components/data-table/schemas.ts +14 -36
  112. package/src/components/editor/Output.tsx +5 -1
  113. package/src/components/editor/__tests__/dynamic-favicon.test.tsx +111 -18
  114. package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +80 -252
  115. package/src/components/editor/actions/__tests__/pair-with-agent-modal.test.tsx +186 -34
  116. package/src/components/editor/actions/pair-with-agent-commands.ts +42 -51
  117. package/src/components/editor/actions/pair-with-agent-modal.tsx +96 -36
  118. package/src/components/editor/ai/add-cell-with-ai.tsx +3 -3
  119. package/src/components/editor/cell/CreateCellButton.tsx +8 -10
  120. package/src/components/editor/cell/code/__tests__/language-toggle.test.tsx +54 -0
  121. package/src/components/editor/cell/code/cell-editor.tsx +1 -1
  122. package/src/components/editor/cell/code/language-toggle.tsx +8 -7
  123. package/src/components/editor/chrome/wrapper/__tests__/attachment-status.test.tsx +277 -78
  124. package/src/components/editor/chrome/wrapper/footer-items/attachment-status.tsx +196 -41
  125. package/src/components/editor/connections/components.tsx +1 -1
  126. package/src/components/editor/controls/__tests__/command-palette.test.tsx +53 -0
  127. package/src/components/editor/controls/command-palette.tsx +22 -10
  128. package/src/components/editor/dynamic-favicon.tsx +21 -40
  129. package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +139 -36
  130. package/src/components/editor/errors/send-error-report-button.tsx +10 -7
  131. package/src/components/editor/file-tree/file-viewer.tsx +4 -2
  132. package/src/components/editor/output/MarimoTracebackOutput.tsx +28 -22
  133. package/src/components/editor/output/console/ConsoleOutput.tsx +8 -18
  134. package/src/components/pages/home-page.tsx +4 -4
  135. package/src/components/slides/slide-cell-view.tsx +1 -1
  136. package/src/components/tracing/tracing.tsx +2 -2
  137. package/src/core/attachments/__tests__/toast.test.tsx +58 -0
  138. package/src/core/attachments/state.ts +5 -8
  139. package/src/core/attachments/toast.ts +15 -0
  140. package/src/core/cells/__tests__/error-report.test.ts +53 -3
  141. package/src/core/cells/__tests__/notebook-outline.test.ts +113 -0
  142. package/src/core/cells/__tests__/session.test.ts +18 -3
  143. package/src/core/cells/cells.ts +2 -1
  144. package/src/core/cells/error-report.ts +14 -6
  145. package/src/core/cells/pending-delete-service.ts +2 -6
  146. package/src/core/cells/session.ts +19 -1
  147. package/src/core/config/pair.ts +5 -3
  148. package/src/core/datasets/__tests__/data-source-discovery.test.ts +4 -4
  149. package/src/core/datasets/data-source-discovery.ts +4 -6
  150. package/src/core/edit-app.tsx +2 -2
  151. package/src/core/host/AGENTS.md +11 -2
  152. package/src/core/host/__tests__/attachments.test.ts +56 -0
  153. package/src/core/host/__tests__/document.test.ts +126 -0
  154. package/src/core/host/__tests__/events.test.ts +49 -0
  155. package/src/core/host/__tests__/fixtures.ts +41 -0
  156. package/src/core/host/__tests__/notebook-client.test.ts +496 -0
  157. package/src/core/host/connection.ts +81 -0
  158. package/src/core/host/events.ts +68 -0
  159. package/src/core/host/notebook-client.ts +316 -0
  160. package/src/core/host/resources/attachments.ts +19 -0
  161. package/src/core/host/resources/document.ts +101 -0
  162. package/src/core/hotkeys/actions.ts +2 -4
  163. package/src/core/islands/__tests__/bootstrap.test.ts +0 -26
  164. package/src/core/islands/bootstrap.ts +0 -1
  165. package/src/core/network/connection.ts +4 -2
  166. package/src/core/run-app.tsx +2 -2
  167. package/src/core/runtime/__tests__/runtime.test.ts +5 -12
  168. package/src/core/runtime/runtime.ts +5 -5
  169. package/src/core/static/files.ts +2 -0
  170. package/src/core/websocket/__tests__/{useMarimoKernelConnection.test.ts → connection-state.test.ts} +15 -17
  171. package/src/core/websocket/__tests__/{useWebSocket.test.ts → createConnectionTransport.test.ts} +1 -1
  172. package/src/core/websocket/__tests__/useNotebookClient.hook.test.tsx +149 -0
  173. package/src/core/websocket/__tests__/{useMarimoKernelConnection.hook.test.tsx → useNotebookSession.hook.test.tsx} +168 -253
  174. package/src/core/websocket/connection-state.ts +70 -0
  175. package/src/core/websocket/state.ts +7 -0
  176. package/src/core/websocket/transports/__tests__/sse.test.ts +18 -4
  177. package/src/core/websocket/transports/create.ts +31 -0
  178. package/src/core/websocket/transports/sse.ts +14 -2
  179. package/src/core/websocket/transports/transport.ts +12 -23
  180. package/src/core/websocket/types.ts +9 -39
  181. package/src/core/websocket/useNotebookClient.ts +78 -0
  182. package/src/core/websocket/{useMarimoKernelConnection.tsx → useNotebookSession.tsx} +53 -233
  183. package/src/hooks/__tests__/useAsyncData.test.tsx +148 -0
  184. package/src/hooks/useAsyncData.ts +3 -3
  185. package/src/hooks/useDataSourceDiscovery.ts +6 -4
  186. package/src/hooks/useElapsedTime.ts +3 -3
  187. package/src/hooks/useInputHistory.ts +4 -7
  188. package/src/hooks/useResizeObserver.ts +4 -7
  189. package/src/mount.tsx +3 -3
  190. package/src/plugins/core/registerReactComponent.tsx +1 -1
  191. package/src/plugins/impl/DropdownPlugin.tsx +2 -6
  192. package/src/plugins/impl/FormPlugin.tsx +1 -1
  193. package/src/plugins/impl/__tests__/DataTablePlugin.test.tsx +84 -0
  194. package/src/plugins/impl/anywidget/__tests__/registry.test.ts +2 -0
  195. package/src/plugins/impl/anywidget/__tests__/widget-binding.test.ts +241 -2
  196. package/src/plugins/impl/anywidget/runtime.ts +21 -9
  197. package/src/plugins/impl/anywidget/widget-binding.ts +160 -82
  198. package/src/plugins/impl/code/any-language-editor.tsx +2 -2
  199. package/src/plugins/impl/data-editor/glide-data-editor.tsx +8 -5
  200. package/src/plugins/impl/data-editor/glide-utils.ts +3 -1
  201. package/src/plugins/impl/mpl-interactive/MplInteractivePlugin.tsx +5 -3
  202. package/src/plugins/impl/panel/PanelPlugin.tsx +15 -16
  203. package/src/plugins/impl/panel/__tests__/utils.test.ts +39 -1
  204. package/src/plugins/impl/panel/utils.ts +17 -0
  205. package/src/plugins/impl/vega/make-selectable.ts +3 -6
  206. package/src/stories/__tests__/editor-story.test.tsx +33 -0
  207. package/src/stories/editor.stories.tsx +24 -17
  208. package/src/utils/__tests__/arrays.test.ts +35 -0
  209. package/src/utils/__tests__/numbers.test.ts +48 -1
  210. package/src/utils/__tests__/objects.test.ts +21 -0
  211. package/src/utils/arrays.ts +10 -0
  212. package/src/utils/numbers.ts +28 -17
  213. package/src/utils/objects.ts +3 -7
  214. package/src/utils/once.ts +19 -19
  215. package/dist/any-language-editor-DZ_YTVus.js +0 -76
  216. package/dist/mermaid-HWGCJPDP-ByCsZnYF.js +0 -2
  217. package/dist/precisionRound-DMIVQrt2.js +0 -97
  218. package/src/core/host/__tests__/protocol.test.ts +0 -214
  219. package/src/core/host/protocol.ts +0 -1943
  220. package/src/core/websocket/useWebSocket.tsx +0 -88
@@ -1,1943 +0,0 @@
1
- /* Copyright 2026 Marimo. All rights reserved. */
2
- // Generated from protocols/host/openapi.yaml. Do not edit.
3
- // Regenerate with: pnpm --dir frontend codegen
4
-
5
- import * as zod from "zod";
6
-
7
- export const ProjectId = zod
8
- .string()
9
- .min(1)
10
- .describe(
11
- "Identifies a project. Unique within the host and unchanged while the project exists.",
12
- );
13
-
14
- export type ProjectId = zod.input<typeof ProjectId>;
15
- export type ProjectIdOutput = zod.output<typeof ProjectId>;
16
-
17
- export const NotebookId = zod
18
- .string()
19
- .min(1)
20
- .describe(
21
- "Identifies a notebook. Unique within the host and unchanged while the notebook exists.",
22
- );
23
-
24
- export type NotebookId = zod.input<typeof NotebookId>;
25
- export type NotebookIdOutput = zod.output<typeof NotebookId>;
26
-
27
- export const RuntimeId = zod
28
- .string()
29
- .min(1)
30
- .describe(
31
- "Identifies a runtime. Unique within the host; every start and restart creates a new id.",
32
- );
33
-
34
- export type RuntimeId = zod.input<typeof RuntimeId>;
35
- export type RuntimeIdOutput = zod.output<typeof RuntimeId>;
36
-
37
- export const AttachmentId = zod
38
- .string()
39
- .min(1)
40
- .describe("Identifies an attachment. Unique within the host.");
41
-
42
- export type AttachmentId = zod.input<typeof AttachmentId>;
43
- export type AttachmentIdOutput = zod.output<typeof AttachmentId>;
44
-
45
- export const RunId = zod
46
- .string()
47
- .min(1)
48
- .describe(
49
- "Identifies a run independently of the request's `Idempotency-Key`. Events carry the key in `request_id`.",
50
- );
51
-
52
- export type RunId = zod.input<typeof RunId>;
53
- export type RunIdOutput = zod.output<typeof RunId>;
54
-
55
- export const ExecutionId = zod
56
- .string()
57
- .min(1)
58
- .describe("Identifies an execution. Unique within the host.");
59
-
60
- export type ExecutionId = zod.input<typeof ExecutionId>;
61
- export type ExecutionIdOutput = zod.output<typeof ExecutionId>;
62
-
63
- export const ItemId = zod
64
- .string()
65
- .min(1)
66
- .describe(
67
- "Identifies a console, display, or variable item. Unique within the host; sending an item again with the same id replaces it.",
68
- );
69
-
70
- export type ItemId = zod.input<typeof ItemId>;
71
- export type ItemIdOutput = zod.output<typeof ItemId>;
72
-
73
- export const CellId = zod
74
- .string()
75
- .min(1)
76
- .describe(
77
- "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.",
78
- );
79
-
80
- export type CellId = zod.input<typeof CellId>;
81
- export type CellIdOutput = zod.output<typeof CellId>;
82
-
83
- export const Process = zod
84
- .object({
85
- pid: zod.int().min(1).describe("The process id."),
86
- started_at: zod.iso
87
- .datetime({ offset: true })
88
- .describe("When the process started."),
89
- })
90
- .describe(
91
- "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",
92
- );
93
-
94
- export type Process = zod.input<typeof Process>;
95
- export type ProcessOutput = zod.output<typeof Process>;
96
-
97
- export const HostRecord = zod
98
- .object({
99
- version: zod
100
- .literal(1)
101
- .describe(
102
- "The version of this record's format. This document describes version 1.",
103
- ),
104
- process: Process,
105
- name: zod
106
- .string()
107
- .describe(
108
- "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.",
109
- ),
110
- url: zod
111
- .string()
112
- .describe(
113
- "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.",
114
- ),
115
- token: zod
116
- .string()
117
- .min(1)
118
- .describe("The secret a client sends to prove it read the record."),
119
- })
120
- .describe(
121
- "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",
122
- );
123
-
124
- export type HostRecord = zod.input<typeof HostRecord>;
125
- export type HostRecordOutput = zod.output<typeof HostRecord>;
126
-
127
- export const ObjectType = zod
128
- .enum([
129
- "host",
130
- "project",
131
- "notebook",
132
- "document",
133
- "analysis",
134
- "cell",
135
- "runtime",
136
- "attachment",
137
- "run",
138
- "execution",
139
- "console",
140
- "display",
141
- "variable",
142
- "custom",
143
- ])
144
- .describe(
145
- "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",
146
- );
147
-
148
- export type ObjectType = zod.input<typeof ObjectType>;
149
- export type ObjectTypeOutput = zod.output<typeof ObjectType>;
150
-
151
- export const Custom = zod
152
- .object({
153
- type: zod
154
- .string()
155
- .min(1)
156
- .describe(
157
- "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.",
158
- ),
159
- data: zod
160
- .unknown()
161
- .describe(
162
- "Any JSON value, including null. The producer defines its schema and consumers of the type validate it.",
163
- ),
164
- })
165
- .describe(
166
- "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",
167
- );
168
-
169
- export type Custom = zod.input<typeof Custom>;
170
- export type CustomOutput = zod.output<typeof Custom>;
171
-
172
- export const Host = zod
173
- .object({
174
- operations: zod
175
- .array(zod.string())
176
- .describe(
177
- "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.",
178
- ),
179
- })
180
- .describe(
181
- "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",
182
- );
183
-
184
- export type Host = zod.input<typeof Host>;
185
- export type HostOutput = zod.output<typeof Host>;
186
-
187
- export const ProjectStatus = zod
188
- .enum(["indexing", "indexed", "partial"])
189
- .describe(
190
- "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",
191
- );
192
-
193
- export type ProjectStatus = zod.input<typeof ProjectStatus>;
194
- export type ProjectStatusOutput = zod.output<typeof ProjectStatus>;
195
-
196
- export const Project = zod
197
- .object({
198
- id: ProjectId,
199
- name: zod
200
- .string()
201
- .describe(
202
- "A label to show people, usually the name of the root directory.",
203
- ),
204
- root: zod
205
- .string()
206
- .nullable()
207
- .describe(
208
- "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.",
209
- ),
210
- status: ProjectStatus,
211
- message: zod
212
- .string()
213
- .nullable()
214
- .describe(
215
- "Why the host stopped scanning. Null unless `status` is `partial`.",
216
- ),
217
- operations: zod
218
- .array(zod.string())
219
- .describe(
220
- "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.",
221
- ),
222
- })
223
- .describe(
224
- "A project is a group of notebooks that the host presents together, usually a directory.",
225
- );
226
-
227
- export type Project = zod.input<typeof Project>;
228
- export type ProjectOutput = zod.output<typeof Project>;
229
-
230
- export const Notebook = zod
231
- .object({
232
- id: NotebookId,
233
- project_id: ProjectId,
234
- path: zod
235
- .string()
236
- .nullable()
237
- .describe(
238
- "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.",
239
- ),
240
- name: zod
241
- .string()
242
- .describe(
243
- "A label to show people. Derived from the filename when the host has nothing better.",
244
- ),
245
- operations: zod
246
- .array(zod.string())
247
- .describe(
248
- "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.",
249
- ),
250
- updated_at: zod.iso
251
- .datetime({ offset: true })
252
- .nullable()
253
- .describe(
254
- "When the file was last modified, as of the host's last look at it. Null when the host does not know.",
255
- ),
256
- })
257
- .describe(
258
- "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",
259
- );
260
-
261
- export type Notebook = zod.input<typeof Notebook>;
262
- export type NotebookOutput = zod.output<typeof Notebook>;
263
-
264
- export const RuntimeStatus = zod
265
- .enum(["starting", "running", "terminating", "failed"])
266
- .describe(
267
- "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",
268
- );
269
-
270
- export type RuntimeStatus = zod.input<typeof RuntimeStatus>;
271
- export type RuntimeStatusOutput = zod.output<typeof RuntimeStatus>;
272
-
273
- export const Runtime = zod
274
- .object({
275
- id: RuntimeId,
276
- notebook_id: NotebookId,
277
- status: RuntimeStatus,
278
- message: zod
279
- .string()
280
- .nullable()
281
- .describe(
282
- "A note about the current status, such as progress while `starting` or the reason when `failed`. Null otherwise.",
283
- ),
284
- marimo_version: zod
285
- .string()
286
- .nullable()
287
- .describe(
288
- "The version of marimo running the kernel. Null until the host knows it.",
289
- ),
290
- started_at: zod.iso
291
- .datetime({ offset: true })
292
- .describe("When this runtime started."),
293
- })
294
- .describe(
295
- "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",
296
- );
297
-
298
- export type Runtime = zod.input<typeof Runtime>;
299
- export type RuntimeOutput = zod.output<typeof Runtime>;
300
-
301
- export const attachmentIdentityMax = 128;
302
-
303
- export const attachmentIdentityRegExp = new RegExp("^[!-~]+$");
304
- export const attachmentKindRegExp = new RegExp("^[a-z0-9-]+$");
305
- export const attachmentNameMax = 256;
306
-
307
- export const Attachment = zod
308
- .object({
309
- id: AttachmentId,
310
- notebook_id: NotebookId,
311
- identity: zod
312
- .string()
313
- .min(1)
314
- .max(attachmentIdentityMax)
315
- .regex(attachmentIdentityRegExp)
316
- .optional()
317
- .describe(
318
- "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",
319
- ),
320
- kind: zod
321
- .string()
322
- .regex(attachmentKindRegExp)
323
- .describe(
324
- "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.",
325
- ),
326
- name: zod
327
- .string()
328
- .max(attachmentNameMax)
329
- .nullable()
330
- .describe(
331
- "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.",
332
- ),
333
- since: zod.iso.datetime({ offset: true }).describe("When it attached."),
334
- })
335
- .describe(
336
- "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",
337
- );
338
-
339
- export type Attachment = zod.input<typeof Attachment>;
340
- export type AttachmentOutput = zod.output<typeof Attachment>;
341
-
342
- export const Lifecycle = zod
343
- .enum(["queued", "running", "completed"])
344
- .describe(
345
- "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",
346
- );
347
-
348
- export type Lifecycle = zod.input<typeof Lifecycle>;
349
- export type LifecycleOutput = zod.output<typeof Lifecycle>;
350
-
351
- export const RunOutcome = zod
352
- .enum(["succeeded", "failed", "interrupted"])
353
- .describe(
354
- "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",
355
- );
356
-
357
- export type RunOutcome = zod.input<typeof RunOutcome>;
358
- export type RunOutcomeOutput = zod.output<typeof RunOutcome>;
359
-
360
- export const Run = zod
361
- .object({
362
- id: RunId,
363
- notebook_id: NotebookId,
364
- caused_by: zod
365
- .union([ExecutionId, zod.null()])
366
- .describe(
367
- "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.",
368
- ),
369
- status: Lifecycle.describe(
370
- "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.",
371
- ),
372
- outcome: zod
373
- .union([RunOutcome, zod.null()])
374
- .describe(
375
- "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.",
376
- ),
377
- started_at: zod.iso
378
- .datetime({ offset: true })
379
- .nullable()
380
- .describe("When the first execution started. Null if none has started."),
381
- completed_at: zod.iso
382
- .datetime({ offset: true })
383
- .nullable()
384
- .describe("When the run ended. Null until the run is `completed`."),
385
- })
386
- .describe(
387
- "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",
388
- );
389
-
390
- export type Run = zod.input<typeof Run>;
391
- export type RunOutput = zod.output<typeof Run>;
392
-
393
- export const DisplayData = zod
394
- .object({
395
- mimetype: zod
396
- .string()
397
- .describe("The format of `data`, such as `text/html` or `image/png`."),
398
- data: zod
399
- .string()
400
- .describe(
401
- "The rendered value. JSON mimetypes are encoded as text; binary mimetypes are base64. Never a URL only the runtime can serve.",
402
- ),
403
- })
404
- .describe("A rendered value.");
405
-
406
- export type DisplayData = zod.input<typeof DisplayData>;
407
- export type DisplayDataOutput = zod.output<typeof DisplayData>;
408
-
409
- export const revisionUpdateMin = 0;
410
-
411
- export const Revision = zod
412
- .object({
413
- execution: ExecutionId.describe(
414
- "The execution whose evaluation produced the value. Usually the variable's `execution_id`, and earlier when the runtime carried the value forward.",
415
- ),
416
- update: zod
417
- .int()
418
- .min(revisionUpdateMin)
419
- .describe(
420
- "How many times the value has been updated since it was produced. Zero at binding.",
421
- ),
422
- })
423
- .describe(
424
- "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",
425
- );
426
-
427
- export type Revision = zod.input<typeof Revision>;
428
- export type RevisionOutput = zod.output<typeof Revision>;
429
-
430
- export const Variable = zod
431
- .object({
432
- id: ItemId,
433
- execution_id: ExecutionId.describe("The execution that bound the name."),
434
- name: zod.string().describe("The name in the namespace."),
435
- revision: Revision,
436
- type: zod
437
- .string()
438
- .nullable()
439
- .describe(
440
- "The runtime's label for the value's type. A host may leave it null.",
441
- ),
442
- preview: zod
443
- .string()
444
- .nullable()
445
- .describe("A short rendering of the value. A host may leave it null."),
446
- })
447
- .describe(
448
- "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",
449
- );
450
-
451
- export type Variable = zod.input<typeof Variable>;
452
- export type VariableOutput = zod.output<typeof Variable>;
453
-
454
- export const positionLineMin = 0;
455
-
456
- export const positionCharacterMin = 0;
457
-
458
- export const Position = zod
459
- .object({
460
- line: zod
461
- .int()
462
- .min(positionLineMin)
463
- .describe("Zero-based line within the code."),
464
- character: zod
465
- .int()
466
- .min(positionCharacterMin)
467
- .describe("Zero-based offset in the line, in UTF-16 code units."),
468
- })
469
- .describe("A position within code, using LSP coordinates.");
470
-
471
- export type Position = zod.input<typeof Position>;
472
- export type PositionOutput = zod.output<typeof Position>;
473
-
474
- export const Range = zod
475
- .object({
476
- start: Position,
477
- end: Position.describe(
478
- "Exclusive end. Equal to start when only a point is known.",
479
- ),
480
- })
481
- .describe("A span within code.");
482
-
483
- export type Range = zod.input<typeof Range>;
484
- export type RangeOutput = zod.output<typeof Range>;
485
-
486
- export const Related = zod
487
- .object({
488
- cell_id: CellId,
489
- range: zod
490
- .union([Range, zod.null()])
491
- .describe("Where in that cell, when known."),
492
- message: zod
493
- .string()
494
- .describe("What that cell contributes, such as `reads x from C`."),
495
- })
496
- .describe("A cell involved in an error, possibly the one carrying it.");
497
-
498
- export type Related = zod.input<typeof Related>;
499
- export type RelatedOutput = zod.output<typeof Related>;
500
-
501
- export const Error = zod
502
- .object({
503
- kind: zod
504
- .string()
505
- .describe(
506
- "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.",
507
- ),
508
- message: zod
509
- .string()
510
- .describe("A description of the error to show people."),
511
- source: zod
512
- .string()
513
- .nullable()
514
- .describe(
515
- "Who produced it, such as `marimo` or a SQL analyzer. Scopes kind.",
516
- ),
517
- severity: zod
518
- .enum(["error", "warning", "information", "hint"])
519
- .describe(
520
- "Error unless the producer says otherwise. Only error affects scheduling.",
521
- ),
522
- range: zod
523
- .union([Range, zod.null()])
524
- .describe("Where in the code, when known."),
525
- name: zod
526
- .string()
527
- .nullable()
528
- .describe(
529
- "The exception class, such as `ZeroDivisionError`. Set when kind is exception, null otherwise.",
530
- ),
531
- traceback: zod
532
- .union([DisplayData, zod.null()])
533
- .describe(
534
- "The traceback as rendered by the runtime, plain text or HTML by its mimetype. Null when unavailable or not shown.",
535
- ),
536
- related: zod
537
- .array(Related)
538
- .describe(
539
- "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.",
540
- ),
541
- })
542
- .describe(
543
- "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",
544
- );
545
-
546
- export type Error = zod.input<typeof Error>;
547
- export type ErrorOutput = zod.output<typeof Error>;
548
-
549
- export const ValueOutcome = zod.object({
550
- kind: zod.enum(["value"]),
551
- display: zod
552
- .union([DisplayData, zod.null()])
553
- .describe(
554
- "The value as last rendered. Replaced as it grows. Null when the code produced no value.",
555
- ),
556
- });
557
-
558
- export type ValueOutcome = zod.input<typeof ValueOutcome>;
559
- export type ValueOutcomeOutput = zod.output<typeof ValueOutcome>;
560
-
561
- export const ErrorOutcome = zod.object({
562
- kind: zod.enum(["error"]),
563
- error: Error,
564
- });
565
-
566
- export type ErrorOutcome = zod.input<typeof ErrorOutcome>;
567
- export type ErrorOutcomeOutput = zod.output<typeof ErrorOutcome>;
568
-
569
- export const InterruptedOutcome = zod.object({
570
- kind: zod.enum(["interrupted"]),
571
- });
572
-
573
- export type InterruptedOutcome = zod.input<typeof InterruptedOutcome>;
574
- export type InterruptedOutcomeOutput = zod.output<typeof InterruptedOutcome>;
575
-
576
- export const Outcome = zod
577
- .union([ValueOutcome, ErrorOutcome, InterruptedOutcome])
578
- .describe(
579
- "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",
580
- );
581
-
582
- export type Outcome = zod.input<typeof Outcome>;
583
- export type OutcomeOutput = zod.output<typeof Outcome>;
584
-
585
- export const Etag = zod
586
- .string()
587
- .describe(
588
- "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",
589
- );
590
-
591
- export type Etag = zod.input<typeof Etag>;
592
- export type EtagOutput = zod.output<typeof Etag>;
593
-
594
- export const Execution = zod
595
- .object({
596
- id: ExecutionId,
597
- run_id: zod
598
- .union([RunId, zod.null()])
599
- .describe(
600
- "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.",
601
- ),
602
- runtime_id: zod
603
- .union([RuntimeId, zod.null()])
604
- .describe(
605
- "The runtime that produced this execution. Live when it equals the current runtime's id. Null when the producer is unknown.",
606
- ),
607
- caused_by: zod
608
- .union([ExecutionId, zod.null()])
609
- .describe(
610
- "The execution in the same run that caused this one. Null for executions requested directly.",
611
- ),
612
- cell_id: zod
613
- .union([CellId, zod.null()])
614
- .describe(
615
- "The cell this execution belongs to. Null for scratch code, a cell outside the document.",
616
- ),
617
- code: zod
618
- .string()
619
- .nullable()
620
- .describe(
621
- "The submitted code for an execution with no cell. Null for a cell's execution, since the cell holds its code.",
622
- ),
623
- code_hash: Etag.describe(
624
- "The `code_hash` of the code that was evaluated, computed as a cell's is.",
625
- ),
626
- depends_on: zod
627
- .record(zod.string(), zod.union([Revision, zod.null()]))
628
- .describe(
629
- "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.",
630
- ),
631
- status: Lifecycle,
632
- outcome: zod
633
- .union([Outcome, zod.null()])
634
- .describe(
635
- "How the execution ended. Null while queued; while running, a value carries the display so far; final once completed.",
636
- ),
637
- started_at: zod.iso
638
- .datetime({ offset: true })
639
- .nullable()
640
- .describe(
641
- "When the code started executing. Null while queued and for an execution that never ran.",
642
- ),
643
- completed_at: zod.iso
644
- .datetime({ offset: true })
645
- .nullable()
646
- .describe("When the execution ended. Null until it is completed."),
647
- })
648
- .describe(
649
- "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",
650
- );
651
-
652
- export type Execution = zod.input<typeof Execution>;
653
- export type ExecutionOutput = zod.output<typeof Execution>;
654
-
655
- export const consoleSeqMin = 0;
656
-
657
- export const Console = zod
658
- .object({
659
- id: ItemId,
660
- execution_id: ExecutionId,
661
- seq: zod
662
- .int()
663
- .min(consoleSeqMin)
664
- .describe(
665
- "Position among the execution's items, increasing in the order they were produced.",
666
- ),
667
- name: zod
668
- .enum(["stdout", "stderr"])
669
- .describe("Which stream the text went to."),
670
- text: zod.string().describe("The text, exactly as written."),
671
- })
672
- .describe(
673
- "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",
674
- );
675
-
676
- export type Console = zod.input<typeof Console>;
677
- export type ConsoleOutput = zod.output<typeof Console>;
678
-
679
- export const displaySeqMin = 0;
680
-
681
- export const Display = zod
682
- .object({
683
- id: ItemId,
684
- execution_id: ExecutionId,
685
- seq: zod
686
- .int()
687
- .min(displaySeqMin)
688
- .describe(
689
- "Position among the execution's items, increasing in the order they were produced.",
690
- ),
691
- mimetype: zod
692
- .string()
693
- .describe("The format of `data`, such as `image/png`."),
694
- data: zod
695
- .string()
696
- .describe(
697
- "The rendered value. JSON mimetypes are encoded as text; binary mimetypes are base64. Never a URL only the runtime can serve.",
698
- ),
699
- })
700
- .describe(
701
- "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",
702
- );
703
-
704
- export type Display = zod.input<typeof Display>;
705
- export type DisplayOutput = zod.output<typeof Display>;
706
-
707
- export const CellConfig = zod
708
- .object({
709
- column: zod
710
- .int()
711
- .nullable()
712
- .describe(
713
- "The column the cell sits in, for multi-column layouts. Null in a single column.",
714
- ),
715
- disabled: zod.boolean().describe("Whether the cell is kept from running."),
716
- hide_code: zod
717
- .boolean()
718
- .describe("Whether clients hide the code by default."),
719
- expand_output: zod
720
- .boolean()
721
- .describe(
722
- "Whether clients show the full output rather than a scrolled box.",
723
- ),
724
- })
725
- .describe(
726
- "How a cell is laid out and whether it runs. Every field is always present, so a cell's etag is well defined.",
727
- );
728
-
729
- export type CellConfig = zod.input<typeof CellConfig>;
730
- export type CellConfigOutput = zod.output<typeof CellConfig>;
731
-
732
- export const CellAnalysis = zod
733
- .object({
734
- defs: zod.array(zod.string()).describe("Names this cell defines."),
735
- refs: zod
736
- .array(zod.string())
737
- .describe("Names this cell reads from other cells."),
738
- errors: zod
739
- .array(Error)
740
- .describe(
741
- "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`.",
742
- ),
743
- })
744
- .describe(
745
- "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",
746
- );
747
-
748
- export type CellAnalysis = zod.input<typeof CellAnalysis>;
749
- export type CellAnalysisOutput = zod.output<typeof CellAnalysis>;
750
-
751
- export const Analysis = zod
752
- .object({
753
- notebook_id: NotebookId.describe("The notebook this analysis belongs to."),
754
- document_etag: Etag.describe(
755
- "The document revision this analysis describes. Equal to the document's `etag` while the analysis is current.",
756
- ),
757
- cells: zod
758
- .record(zod.string(), CellAnalysis)
759
- .describe("Every cell of that revision, by id."),
760
- })
761
- .describe(
762
- "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",
763
- );
764
-
765
- export type Analysis = zod.input<typeof Analysis>;
766
- export type AnalysisOutput = zod.output<typeof Analysis>;
767
-
768
- export const Cell = zod
769
- .object({
770
- id: CellId,
771
- notebook_id: NotebookId,
772
- code: zod
773
- .string()
774
- .describe(
775
- "The cell's source code, with newline line endings. A host normalizes other line endings when it loads a file.",
776
- ),
777
- name: zod
778
- .string()
779
- .describe(
780
- "The cell's name. `_` for an anonymous cell; otherwise a Python identifier, unique within the notebook.",
781
- ),
782
- config: CellConfig,
783
- etag: Etag.describe(
784
- "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`.",
785
- ),
786
- code_hash: Etag.describe(
787
- "Identifies the code alone. Its text is `code`. 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.",
788
- ),
789
- version: zod
790
- .int()
791
- .min(1)
792
- .describe(
793
- "The document version at which the cell was created or last changed.",
794
- ),
795
- })
796
- .describe(
797
- "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",
798
- );
799
-
800
- export type Cell = zod.input<typeof Cell>;
801
- export type CellOutput = zod.output<typeof Cell>;
802
-
803
- export const Document = zod
804
- .object({
805
- notebook_id: NotebookId.describe("The notebook this document belongs to."),
806
- order: zod
807
- .array(CellId)
808
- .describe(
809
- "Cell ids in display order. A permutation of the notebook's cells, each appearing exactly once.",
810
- ),
811
- app_config: zod
812
- .record(zod.string(), zod.unknown())
813
- .describe(
814
- "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.",
815
- ),
816
- etag: Etag.describe(
817
- "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.",
818
- ),
819
- saved_etag: zod
820
- .union([Etag, zod.null()])
821
- .describe(
822
- "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.",
823
- ),
824
- order_etag: Etag.describe(
825
- "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.",
826
- ),
827
- app_config_etag: Etag.describe(
828
- "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.",
829
- ),
830
- version: zod
831
- .int()
832
- .min(1)
833
- .describe(
834
- "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.",
835
- ),
836
- })
837
- .describe(
838
- "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",
839
- );
840
-
841
- export type Document = zod.input<typeof Document>;
842
- export type DocumentOutput = zod.output<typeof Document>;
843
-
844
- export const HostMessage = zod
845
- .object({
846
- request_id: zod
847
- .string()
848
- .optional()
849
- .describe(
850
- "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.",
851
- ),
852
- time: zod.iso
853
- .datetime({ offset: true })
854
- .optional()
855
- .describe(
856
- "When the host made this change. Present on live and replayed events; omitted on snapshots.",
857
- ),
858
- host: Host,
859
- })
860
- .describe(
861
- "The data of a `host` event. The host object, plus which request caused the event and when.",
862
- );
863
-
864
- export type HostMessage = zod.input<typeof HostMessage>;
865
- export type HostMessageOutput = zod.output<typeof HostMessage>;
866
-
867
- export const HostEvent = zod
868
- .object({
869
- event: zod.enum(["host"]),
870
- id: zod
871
- .string()
872
- .min(1)
873
- .optional()
874
- .describe("The resume cursor. Omitted on snapshot and reset events."),
875
- data: HostMessage,
876
- })
877
- .describe("A `host` event from a host stream.");
878
-
879
- export type HostEvent = zod.input<typeof HostEvent>;
880
- export type HostEventOutput = zod.output<typeof HostEvent>;
881
-
882
- export const ProjectMessage = zod
883
- .object({
884
- request_id: zod
885
- .string()
886
- .optional()
887
- .describe(
888
- "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.",
889
- ),
890
- time: zod.iso
891
- .datetime({ offset: true })
892
- .optional()
893
- .describe(
894
- "When the host made this change. Present on live and replayed events; omitted on snapshots.",
895
- ),
896
- project: Project,
897
- })
898
- .describe("The data of a `project` event. The project as it now is.");
899
-
900
- export type ProjectMessage = zod.input<typeof ProjectMessage>;
901
- export type ProjectMessageOutput = zod.output<typeof ProjectMessage>;
902
-
903
- export const ProjectEvent = zod
904
- .object({
905
- event: zod.enum(["project"]),
906
- id: zod
907
- .string()
908
- .min(1)
909
- .optional()
910
- .describe("The resume cursor. Omitted on snapshot and reset events."),
911
- data: ProjectMessage,
912
- })
913
- .describe("A `project` event from a host stream.");
914
-
915
- export type ProjectEvent = zod.input<typeof ProjectEvent>;
916
- export type ProjectEventOutput = zod.output<typeof ProjectEvent>;
917
-
918
- export const NotebookMessage = zod
919
- .object({
920
- request_id: zod
921
- .string()
922
- .optional()
923
- .describe(
924
- "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.",
925
- ),
926
- time: zod.iso
927
- .datetime({ offset: true })
928
- .optional()
929
- .describe(
930
- "When the host made this change. Present on live and replayed events; omitted on snapshots.",
931
- ),
932
- notebook: Notebook,
933
- })
934
- .describe("The data of a `notebook` event. The notebook as it now is.");
935
-
936
- export type NotebookMessage = zod.input<typeof NotebookMessage>;
937
- export type NotebookMessageOutput = zod.output<typeof NotebookMessage>;
938
-
939
- export const NotebookEvent = zod
940
- .object({
941
- event: zod.enum(["notebook"]),
942
- id: zod
943
- .string()
944
- .min(1)
945
- .optional()
946
- .describe("The resume cursor. Omitted on snapshot and reset events."),
947
- data: NotebookMessage,
948
- })
949
- .describe("A `notebook` event from a host stream.");
950
-
951
- export type NotebookEvent = zod.input<typeof NotebookEvent>;
952
- export type NotebookEventOutput = zod.output<typeof NotebookEvent>;
953
-
954
- export const DocumentMessage = zod
955
- .object({
956
- request_id: zod
957
- .string()
958
- .optional()
959
- .describe(
960
- "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.",
961
- ),
962
- time: zod.iso
963
- .datetime({ offset: true })
964
- .optional()
965
- .describe(
966
- "When the host made this change. Present on live and replayed events; omitted on snapshots.",
967
- ),
968
- document: Document,
969
- })
970
- .describe("The data of a `document` event. The document as it now is.");
971
-
972
- export type DocumentMessage = zod.input<typeof DocumentMessage>;
973
- export type DocumentMessageOutput = zod.output<typeof DocumentMessage>;
974
-
975
- export const DocumentEvent = zod
976
- .object({
977
- event: zod.enum(["document"]),
978
- id: zod
979
- .string()
980
- .min(1)
981
- .optional()
982
- .describe("The resume cursor. Omitted on snapshot and reset events."),
983
- data: DocumentMessage,
984
- })
985
- .describe("A `document` event from a host stream.");
986
-
987
- export type DocumentEvent = zod.input<typeof DocumentEvent>;
988
- export type DocumentEventOutput = zod.output<typeof DocumentEvent>;
989
-
990
- export const AnalysisMessage = zod
991
- .object({
992
- request_id: zod
993
- .string()
994
- .optional()
995
- .describe(
996
- "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.",
997
- ),
998
- time: zod.iso
999
- .datetime({ offset: true })
1000
- .optional()
1001
- .describe(
1002
- "When the host made this change. Present on live and replayed events; omitted on snapshots.",
1003
- ),
1004
- analysis: Analysis,
1005
- })
1006
- .describe("The data of an `analysis` event. The analysis as it now is.");
1007
-
1008
- export type AnalysisMessage = zod.input<typeof AnalysisMessage>;
1009
- export type AnalysisMessageOutput = zod.output<typeof AnalysisMessage>;
1010
-
1011
- export const AnalysisEvent = zod
1012
- .object({
1013
- event: zod.enum(["analysis"]),
1014
- id: zod
1015
- .string()
1016
- .min(1)
1017
- .optional()
1018
- .describe("The resume cursor. Omitted on snapshot and reset events."),
1019
- data: AnalysisMessage,
1020
- })
1021
- .describe("A `analysis` event from a host stream.");
1022
-
1023
- export type AnalysisEvent = zod.input<typeof AnalysisEvent>;
1024
- export type AnalysisEventOutput = zod.output<typeof AnalysisEvent>;
1025
-
1026
- export const CellMessage = zod
1027
- .object({
1028
- request_id: zod
1029
- .string()
1030
- .optional()
1031
- .describe(
1032
- "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.",
1033
- ),
1034
- time: zod.iso
1035
- .datetime({ offset: true })
1036
- .optional()
1037
- .describe(
1038
- "When the host made this change. Present on live and replayed events; omitted on snapshots.",
1039
- ),
1040
- cell: Cell,
1041
- })
1042
- .describe("The data of a `cell` event. The cell as it now is.");
1043
-
1044
- export type CellMessage = zod.input<typeof CellMessage>;
1045
- export type CellMessageOutput = zod.output<typeof CellMessage>;
1046
-
1047
- export const CellEvent = zod
1048
- .object({
1049
- event: zod.enum(["cell"]),
1050
- id: zod
1051
- .string()
1052
- .min(1)
1053
- .optional()
1054
- .describe("The resume cursor. Omitted on snapshot and reset events."),
1055
- data: CellMessage,
1056
- })
1057
- .describe("A `cell` event from a host stream.");
1058
-
1059
- export type CellEvent = zod.input<typeof CellEvent>;
1060
- export type CellEventOutput = zod.output<typeof CellEvent>;
1061
-
1062
- export const RuntimeMessage = zod
1063
- .object({
1064
- request_id: zod
1065
- .string()
1066
- .optional()
1067
- .describe(
1068
- "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.",
1069
- ),
1070
- time: zod.iso
1071
- .datetime({ offset: true })
1072
- .optional()
1073
- .describe(
1074
- "When the host made this change. Present on live and replayed events; omitted on snapshots.",
1075
- ),
1076
- runtime: Runtime,
1077
- })
1078
- .describe("The data of a `runtime` event. The runtime as it now is.");
1079
-
1080
- export type RuntimeMessage = zod.input<typeof RuntimeMessage>;
1081
- export type RuntimeMessageOutput = zod.output<typeof RuntimeMessage>;
1082
-
1083
- export const RuntimeEvent = zod
1084
- .object({
1085
- event: zod.enum(["runtime"]),
1086
- id: zod
1087
- .string()
1088
- .min(1)
1089
- .optional()
1090
- .describe("The resume cursor. Omitted on snapshot and reset events."),
1091
- data: RuntimeMessage,
1092
- })
1093
- .describe("A `runtime` event from a host stream.");
1094
-
1095
- export type RuntimeEvent = zod.input<typeof RuntimeEvent>;
1096
- export type RuntimeEventOutput = zod.output<typeof RuntimeEvent>;
1097
-
1098
- export const AttachmentMessage = zod
1099
- .object({
1100
- request_id: zod
1101
- .string()
1102
- .optional()
1103
- .describe(
1104
- "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.",
1105
- ),
1106
- time: zod.iso
1107
- .datetime({ offset: true })
1108
- .optional()
1109
- .describe(
1110
- "When the host made this change. Present on live and replayed events; omitted on snapshots.",
1111
- ),
1112
- attachment: Attachment,
1113
- })
1114
- .describe("The data of an `attachment` event. The attachment as it now is.");
1115
-
1116
- export type AttachmentMessage = zod.input<typeof AttachmentMessage>;
1117
- export type AttachmentMessageOutput = zod.output<typeof AttachmentMessage>;
1118
-
1119
- export const AttachmentEvent = zod
1120
- .object({
1121
- event: zod.enum(["attachment"]),
1122
- id: zod
1123
- .string()
1124
- .min(1)
1125
- .optional()
1126
- .describe("The resume cursor. Omitted on snapshot and reset events."),
1127
- data: AttachmentMessage,
1128
- })
1129
- .describe("A `attachment` event from a host stream.");
1130
-
1131
- export type AttachmentEvent = zod.input<typeof AttachmentEvent>;
1132
- export type AttachmentEventOutput = zod.output<typeof AttachmentEvent>;
1133
-
1134
- export const RunMessage = zod
1135
- .object({
1136
- request_id: zod
1137
- .string()
1138
- .optional()
1139
- .describe(
1140
- "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.",
1141
- ),
1142
- time: zod.iso
1143
- .datetime({ offset: true })
1144
- .optional()
1145
- .describe(
1146
- "When the host made this change. Present on live and replayed events; omitted on snapshots.",
1147
- ),
1148
- run: Run,
1149
- })
1150
- .describe("The data of a `run` event. The run as it now is.");
1151
-
1152
- export type RunMessage = zod.input<typeof RunMessage>;
1153
- export type RunMessageOutput = zod.output<typeof RunMessage>;
1154
-
1155
- export const RunEvent = zod
1156
- .object({
1157
- event: zod.enum(["run"]),
1158
- id: zod
1159
- .string()
1160
- .min(1)
1161
- .optional()
1162
- .describe("The resume cursor. Omitted on snapshot and reset events."),
1163
- data: RunMessage,
1164
- })
1165
- .describe("A `run` event from a host stream.");
1166
-
1167
- export type RunEvent = zod.input<typeof RunEvent>;
1168
- export type RunEventOutput = zod.output<typeof RunEvent>;
1169
-
1170
- export const ExecutionMessage = zod
1171
- .object({
1172
- request_id: zod
1173
- .string()
1174
- .optional()
1175
- .describe(
1176
- "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.",
1177
- ),
1178
- time: zod.iso
1179
- .datetime({ offset: true })
1180
- .optional()
1181
- .describe(
1182
- "When the host made this change. Present on live and replayed events; omitted on snapshots.",
1183
- ),
1184
- execution: Execution,
1185
- })
1186
- .describe("The data of an `execution` event. The execution as it now is.");
1187
-
1188
- export type ExecutionMessage = zod.input<typeof ExecutionMessage>;
1189
- export type ExecutionMessageOutput = zod.output<typeof ExecutionMessage>;
1190
-
1191
- export const ExecutionEvent = zod
1192
- .object({
1193
- event: zod.enum(["execution"]),
1194
- id: zod
1195
- .string()
1196
- .min(1)
1197
- .optional()
1198
- .describe("The resume cursor. Omitted on snapshot and reset events."),
1199
- data: ExecutionMessage,
1200
- })
1201
- .describe("A `execution` event from a host stream.");
1202
-
1203
- export type ExecutionEvent = zod.input<typeof ExecutionEvent>;
1204
- export type ExecutionEventOutput = zod.output<typeof ExecutionEvent>;
1205
-
1206
- export const ConsoleMessage = zod
1207
- .object({
1208
- request_id: zod
1209
- .string()
1210
- .optional()
1211
- .describe(
1212
- "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.",
1213
- ),
1214
- time: zod.iso
1215
- .datetime({ offset: true })
1216
- .optional()
1217
- .describe(
1218
- "When the host made this change. Present on live and replayed events; omitted on snapshots.",
1219
- ),
1220
- console: Console,
1221
- })
1222
- .describe("The data of a `console` event. The item as it now is.");
1223
-
1224
- export type ConsoleMessage = zod.input<typeof ConsoleMessage>;
1225
- export type ConsoleMessageOutput = zod.output<typeof ConsoleMessage>;
1226
-
1227
- export const ConsoleEvent = zod
1228
- .object({
1229
- event: zod.enum(["console"]),
1230
- id: zod
1231
- .string()
1232
- .min(1)
1233
- .optional()
1234
- .describe("The resume cursor. Omitted on snapshot and reset events."),
1235
- data: ConsoleMessage,
1236
- })
1237
- .describe("A `console` event from a host stream.");
1238
-
1239
- export type ConsoleEvent = zod.input<typeof ConsoleEvent>;
1240
- export type ConsoleEventOutput = zod.output<typeof ConsoleEvent>;
1241
-
1242
- export const DisplayMessage = zod
1243
- .object({
1244
- request_id: zod
1245
- .string()
1246
- .optional()
1247
- .describe(
1248
- "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.",
1249
- ),
1250
- time: zod.iso
1251
- .datetime({ offset: true })
1252
- .optional()
1253
- .describe(
1254
- "When the host made this change. Present on live and replayed events; omitted on snapshots.",
1255
- ),
1256
- display: Display,
1257
- })
1258
- .describe("The data of a `display` event. The item as it now is.");
1259
-
1260
- export type DisplayMessage = zod.input<typeof DisplayMessage>;
1261
- export type DisplayMessageOutput = zod.output<typeof DisplayMessage>;
1262
-
1263
- export const DisplayEvent = zod
1264
- .object({
1265
- event: zod.enum(["display"]),
1266
- id: zod
1267
- .string()
1268
- .min(1)
1269
- .optional()
1270
- .describe("The resume cursor. Omitted on snapshot and reset events."),
1271
- data: DisplayMessage,
1272
- })
1273
- .describe("A `display` event from a host stream.");
1274
-
1275
- export type DisplayEvent = zod.input<typeof DisplayEvent>;
1276
- export type DisplayEventOutput = zod.output<typeof DisplayEvent>;
1277
-
1278
- export const VariableMessage = zod
1279
- .object({
1280
- request_id: zod
1281
- .string()
1282
- .optional()
1283
- .describe(
1284
- "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.",
1285
- ),
1286
- time: zod.iso
1287
- .datetime({ offset: true })
1288
- .optional()
1289
- .describe(
1290
- "When the host made this change. Present on live and replayed events; omitted on snapshots.",
1291
- ),
1292
- variable: Variable,
1293
- })
1294
- .describe("The data of a `variable` event. The item as it now is.");
1295
-
1296
- export type VariableMessage = zod.input<typeof VariableMessage>;
1297
- export type VariableMessageOutput = zod.output<typeof VariableMessage>;
1298
-
1299
- export const VariableEvent = zod
1300
- .object({
1301
- event: zod.enum(["variable"]),
1302
- id: zod
1303
- .string()
1304
- .min(1)
1305
- .optional()
1306
- .describe("The resume cursor. Omitted on snapshot and reset events."),
1307
- data: VariableMessage,
1308
- })
1309
- .describe("A `variable` event from a host stream.");
1310
-
1311
- export type VariableEvent = zod.input<typeof VariableEvent>;
1312
- export type VariableEventOutput = zod.output<typeof VariableEvent>;
1313
-
1314
- export const CustomMessage = zod
1315
- .object({
1316
- custom: Custom,
1317
- request_id: zod
1318
- .string()
1319
- .optional()
1320
- .describe(
1321
- "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.",
1322
- ),
1323
- time: zod.iso
1324
- .datetime({ offset: true })
1325
- .describe("When the host emitted this event. Preserved on replay."),
1326
- })
1327
- .describe(
1328
- "The data of a `custom` event. This envelope is standardized; the custom type and payload are defined by their producer.",
1329
- );
1330
-
1331
- export type CustomMessage = zod.input<typeof CustomMessage>;
1332
- export type CustomMessageOutput = zod.output<typeof CustomMessage>;
1333
-
1334
- export const CustomEvent = zod
1335
- .object({
1336
- event: zod.enum(["custom"]),
1337
- id: zod
1338
- .string()
1339
- .min(1)
1340
- .optional()
1341
- .describe("The resume cursor. Omitted on snapshot and reset events."),
1342
- data: CustomMessage,
1343
- })
1344
- .describe("A `custom` event from a host stream.");
1345
-
1346
- export type CustomEvent = zod.input<typeof CustomEvent>;
1347
- export type CustomEventOutput = zod.output<typeof CustomEvent>;
1348
-
1349
- export const RemovedMessage = zod
1350
- .object({
1351
- request_id: zod
1352
- .string()
1353
- .optional()
1354
- .describe(
1355
- "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.",
1356
- ),
1357
- time: zod.iso
1358
- .datetime({ offset: true })
1359
- .optional()
1360
- .describe(
1361
- "When the host made this change. Present on live and replayed events; omitted on snapshots.",
1362
- ),
1363
- id: zod.string().describe("The id of the object that was removed."),
1364
- })
1365
- .describe(
1366
- "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",
1367
- );
1368
-
1369
- export type RemovedMessage = zod.input<typeof RemovedMessage>;
1370
- export type RemovedMessageOutput = zod.output<typeof RemovedMessage>;
1371
-
1372
- export const ProjectRemovedEvent = zod
1373
- .object({
1374
- event: zod.enum(["project.removed"]),
1375
- id: zod
1376
- .string()
1377
- .min(1)
1378
- .optional()
1379
- .describe("The resume cursor. Omitted on snapshot and reset events."),
1380
- data: RemovedMessage,
1381
- })
1382
- .describe("A `project.removed` event from a host stream.");
1383
-
1384
- export type ProjectRemovedEvent = zod.input<typeof ProjectRemovedEvent>;
1385
- export type ProjectRemovedEventOutput = zod.output<typeof ProjectRemovedEvent>;
1386
-
1387
- export const NotebookRemovedEvent = zod
1388
- .object({
1389
- event: zod.enum(["notebook.removed"]),
1390
- id: zod
1391
- .string()
1392
- .min(1)
1393
- .optional()
1394
- .describe("The resume cursor. Omitted on snapshot and reset events."),
1395
- data: RemovedMessage,
1396
- })
1397
- .describe("A `notebook.removed` event from a host stream.");
1398
-
1399
- export type NotebookRemovedEvent = zod.input<typeof NotebookRemovedEvent>;
1400
- export type NotebookRemovedEventOutput = zod.output<
1401
- typeof NotebookRemovedEvent
1402
- >;
1403
-
1404
- export const CellRemovedEvent = zod
1405
- .object({
1406
- event: zod.enum(["cell.removed"]),
1407
- id: zod
1408
- .string()
1409
- .min(1)
1410
- .optional()
1411
- .describe("The resume cursor. Omitted on snapshot and reset events."),
1412
- data: RemovedMessage,
1413
- })
1414
- .describe("A `cell.removed` event from a host stream.");
1415
-
1416
- export type CellRemovedEvent = zod.input<typeof CellRemovedEvent>;
1417
- export type CellRemovedEventOutput = zod.output<typeof CellRemovedEvent>;
1418
-
1419
- export const RuntimeRemovedEvent = zod
1420
- .object({
1421
- event: zod.enum(["runtime.removed"]),
1422
- id: zod
1423
- .string()
1424
- .min(1)
1425
- .optional()
1426
- .describe("The resume cursor. Omitted on snapshot and reset events."),
1427
- data: RemovedMessage,
1428
- })
1429
- .describe("A `runtime.removed` event from a host stream.");
1430
-
1431
- export type RuntimeRemovedEvent = zod.input<typeof RuntimeRemovedEvent>;
1432
- export type RuntimeRemovedEventOutput = zod.output<typeof RuntimeRemovedEvent>;
1433
-
1434
- export const AttachmentRemovedEvent = zod
1435
- .object({
1436
- event: zod.enum(["attachment.removed"]),
1437
- id: zod
1438
- .string()
1439
- .min(1)
1440
- .optional()
1441
- .describe("The resume cursor. Omitted on snapshot and reset events."),
1442
- data: RemovedMessage,
1443
- })
1444
- .describe("A `attachment.removed` event from a host stream.");
1445
-
1446
- export type AttachmentRemovedEvent = zod.input<typeof AttachmentRemovedEvent>;
1447
- export type AttachmentRemovedEventOutput = zod.output<
1448
- typeof AttachmentRemovedEvent
1449
- >;
1450
-
1451
- export const RunRemovedEvent = zod
1452
- .object({
1453
- event: zod.enum(["run.removed"]),
1454
- id: zod
1455
- .string()
1456
- .min(1)
1457
- .optional()
1458
- .describe("The resume cursor. Omitted on snapshot and reset events."),
1459
- data: RemovedMessage,
1460
- })
1461
- .describe("A `run.removed` event from a host stream.");
1462
-
1463
- export type RunRemovedEvent = zod.input<typeof RunRemovedEvent>;
1464
- export type RunRemovedEventOutput = zod.output<typeof RunRemovedEvent>;
1465
-
1466
- export const ExecutionRemovedEvent = zod
1467
- .object({
1468
- event: zod.enum(["execution.removed"]),
1469
- id: zod
1470
- .string()
1471
- .min(1)
1472
- .optional()
1473
- .describe("The resume cursor. Omitted on snapshot and reset events."),
1474
- data: RemovedMessage,
1475
- })
1476
- .describe("A `execution.removed` event from a host stream.");
1477
-
1478
- export type ExecutionRemovedEvent = zod.input<typeof ExecutionRemovedEvent>;
1479
- export type ExecutionRemovedEventOutput = zod.output<
1480
- typeof ExecutionRemovedEvent
1481
- >;
1482
-
1483
- export const ConsoleRemovedEvent = zod
1484
- .object({
1485
- event: zod.enum(["console.removed"]),
1486
- id: zod
1487
- .string()
1488
- .min(1)
1489
- .optional()
1490
- .describe("The resume cursor. Omitted on snapshot and reset events."),
1491
- data: RemovedMessage,
1492
- })
1493
- .describe("A `console.removed` event from a host stream.");
1494
-
1495
- export type ConsoleRemovedEvent = zod.input<typeof ConsoleRemovedEvent>;
1496
- export type ConsoleRemovedEventOutput = zod.output<typeof ConsoleRemovedEvent>;
1497
-
1498
- export const DisplayRemovedEvent = zod
1499
- .object({
1500
- event: zod.enum(["display.removed"]),
1501
- id: zod
1502
- .string()
1503
- .min(1)
1504
- .optional()
1505
- .describe("The resume cursor. Omitted on snapshot and reset events."),
1506
- data: RemovedMessage,
1507
- })
1508
- .describe("A `display.removed` event from a host stream.");
1509
-
1510
- export type DisplayRemovedEvent = zod.input<typeof DisplayRemovedEvent>;
1511
- export type DisplayRemovedEventOutput = zod.output<typeof DisplayRemovedEvent>;
1512
-
1513
- export const VariableRemovedEvent = zod
1514
- .object({
1515
- event: zod.enum(["variable.removed"]),
1516
- id: zod
1517
- .string()
1518
- .min(1)
1519
- .optional()
1520
- .describe("The resume cursor. Omitted on snapshot and reset events."),
1521
- data: RemovedMessage,
1522
- })
1523
- .describe("A `variable.removed` event from a host stream.");
1524
-
1525
- export type VariableRemovedEvent = zod.input<typeof VariableRemovedEvent>;
1526
- export type VariableRemovedEventOutput = zod.output<
1527
- typeof VariableRemovedEvent
1528
- >;
1529
-
1530
- export const ResetEvent = zod
1531
- .object({
1532
- event: zod.enum(["reset"]),
1533
- id: zod
1534
- .string()
1535
- .min(1)
1536
- .optional()
1537
- .describe("The resume cursor. Omitted on snapshot and reset events."),
1538
- data: zod.object({}),
1539
- })
1540
- .describe("A `reset` event from a host stream.");
1541
-
1542
- export type ResetEvent = zod.input<typeof ResetEvent>;
1543
- export type ResetEventOutput = zod.output<typeof ResetEvent>;
1544
-
1545
- export const ReadyEvent = zod
1546
- .object({
1547
- event: zod.enum(["ready"]),
1548
- id: zod
1549
- .string()
1550
- .min(1)
1551
- .describe("The resume cursor. Omitted on snapshot and reset events."),
1552
- data: zod.object({}),
1553
- })
1554
- .describe("A `ready` event from a host stream.");
1555
-
1556
- export type ReadyEvent = zod.input<typeof ReadyEvent>;
1557
- export type ReadyEventOutput = zod.output<typeof ReadyEvent>;
1558
-
1559
- export const MarimoNotification = zod.unknown();
1560
-
1561
- export type MarimoNotification = zod.input<typeof MarimoNotification>;
1562
- export type MarimoNotificationOutput = zod.output<typeof MarimoNotification>;
1563
-
1564
- export const MarimoEvent = zod
1565
- .object({
1566
- event: zod.enum(["marimo"]),
1567
- id: zod.string().min(1).optional(),
1568
- data: zod.object({
1569
- marimo: MarimoNotification,
1570
- }),
1571
- })
1572
- .describe("A native marimo message carried by a host stream.");
1573
-
1574
- export type MarimoEvent = zod.input<typeof MarimoEvent>;
1575
- export type MarimoEventOutput = zod.output<typeof MarimoEvent>;
1576
-
1577
- export const Event = zod
1578
- .union([
1579
- HostEvent,
1580
- ProjectEvent,
1581
- NotebookEvent,
1582
- DocumentEvent,
1583
- AnalysisEvent,
1584
- CellEvent,
1585
- RuntimeEvent,
1586
- AttachmentEvent,
1587
- RunEvent,
1588
- ExecutionEvent,
1589
- ConsoleEvent,
1590
- DisplayEvent,
1591
- VariableEvent,
1592
- CustomEvent,
1593
- ProjectRemovedEvent,
1594
- NotebookRemovedEvent,
1595
- CellRemovedEvent,
1596
- RuntimeRemovedEvent,
1597
- AttachmentRemovedEvent,
1598
- RunRemovedEvent,
1599
- ExecutionRemovedEvent,
1600
- ConsoleRemovedEvent,
1601
- DisplayRemovedEvent,
1602
- VariableRemovedEvent,
1603
- ResetEvent,
1604
- ReadyEvent,
1605
- MarimoEvent,
1606
- ])
1607
- .describe(
1608
- "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",
1609
- );
1610
-
1611
- export type Event = zod.input<typeof Event>;
1612
- export type EventOutput = zod.output<typeof Event>;
1613
-
1614
- export const DecisionOption = zod
1615
- .object({
1616
- id: zod.string().describe("Identifies this answer."),
1617
- label: zod.string().describe("Text to show a person."),
1618
- })
1619
- .describe("One possible answer to a decision.");
1620
-
1621
- export type DecisionOption = zod.input<typeof DecisionOption>;
1622
- export type DecisionOptionOutput = zod.output<typeof DecisionOption>;
1623
-
1624
- export const Decision = zod
1625
- .object({
1626
- id: zod
1627
- .string()
1628
- .describe("Identifies the question when the client answers it."),
1629
- prompt: zod.string().describe("The question, worded for a person."),
1630
- options: zod.array(DecisionOption).describe("The possible answers."),
1631
- })
1632
- .describe(
1633
- "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",
1634
- );
1635
-
1636
- export type Decision = zod.input<typeof Decision>;
1637
- export type DecisionOutput = zod.output<typeof Decision>;
1638
-
1639
- export const editConflictChangeMin = 0;
1640
-
1641
- export const EditConflict = zod
1642
- .object({
1643
- change: zod
1644
- .int()
1645
- .min(editConflictChangeMin)
1646
- .describe(
1647
- "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`.",
1648
- ),
1649
- cell: zod
1650
- .union([Cell, zod.null()])
1651
- .describe(
1652
- "The cell the change named, as it now is. Null when the document does not have it, or when the change named the order.",
1653
- ),
1654
- document: Document,
1655
- })
1656
- .describe(
1657
- "The first stale change of an edit or run, and the state the host holds.",
1658
- );
1659
-
1660
- export type EditConflict = zod.input<typeof EditConflict>;
1661
- export type EditConflictOutput = zod.output<typeof EditConflict>;
1662
-
1663
- export const problemStatusMin = 400;
1664
- export const problemStatusMax = 599;
1665
-
1666
- export const Problem = zod
1667
- .object({
1668
- type: zod
1669
- .string()
1670
- .describe(
1671
- "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",
1672
- ),
1673
- title: zod
1674
- .string()
1675
- .describe("A short, human-readable name for the kind of problem."),
1676
- status: zod
1677
- .int()
1678
- .min(problemStatusMin)
1679
- .max(problemStatusMax)
1680
- .describe("The HTTP status code of the response."),
1681
- detail: zod
1682
- .string()
1683
- .optional()
1684
- .describe("A human-readable explanation of what went wrong this time."),
1685
- decisions: zod
1686
- .array(Decision)
1687
- .optional()
1688
- .describe(
1689
- "The choices the client has to make before the host can carry out the request. Only present for `decision-required`.",
1690
- ),
1691
- edit: EditConflict.optional().describe(
1692
- "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.",
1693
- ),
1694
- })
1695
- .describe(
1696
- "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",
1697
- );
1698
-
1699
- export type Problem = zod.input<typeof Problem>;
1700
- export type ProblemOutput = zod.output<typeof Problem>;
1701
-
1702
- export const CreateNotebookRequest = zod
1703
- .object({
1704
- project_id: ProjectId,
1705
- path: zod
1706
- .string()
1707
- .optional()
1708
- .describe(
1709
- "Where to put the file, relative to the project root and written the way the host's operating system writes paths.",
1710
- ),
1711
- name: zod
1712
- .string()
1713
- .optional()
1714
- .describe(
1715
- "A label to show people. In a project with a root it defaults to the filename.",
1716
- ),
1717
- })
1718
- .describe(
1719
- "The notebook's own fields, minus what the host assigns. A project with a root requires `path`; one without requires `name`.",
1720
- );
1721
-
1722
- export type CreateNotebookRequest = zod.input<typeof CreateNotebookRequest>;
1723
- export type CreateNotebookRequestOutput = zod.output<
1724
- typeof CreateNotebookRequest
1725
- >;
1726
-
1727
- export const UpdateNotebookRequest = zod
1728
- .object({
1729
- path: zod
1730
- .string()
1731
- .optional()
1732
- .describe(
1733
- "The new location, relative to the project root and written the way the host's operating system writes paths.",
1734
- ),
1735
- name: zod.string().optional().describe("The new label to show people."),
1736
- })
1737
- .describe("The fields to change. At least one is present.");
1738
-
1739
- export type UpdateNotebookRequest = zod.input<typeof UpdateNotebookRequest>;
1740
- export type UpdateNotebookRequestOutput = zod.output<
1741
- typeof UpdateNotebookRequest
1742
- >;
1743
-
1744
- export const OpenNotebookResponse = zod.object({
1745
- url: zod
1746
- .string()
1747
- .describe(
1748
- "The URL the host used to show the notebook. It never contains the host's token.",
1749
- ),
1750
- });
1751
-
1752
- export type OpenNotebookResponse = zod.input<typeof OpenNotebookResponse>;
1753
- export type OpenNotebookResponseOutput = zod.output<
1754
- typeof OpenNotebookResponse
1755
- >;
1756
-
1757
- export const StartRuntimeRequest = zod.object({
1758
- decisions: zod
1759
- .record(zod.string(), zod.string())
1760
- .optional()
1761
- .describe(
1762
- "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",
1763
- ),
1764
- });
1765
-
1766
- export type StartRuntimeRequest = zod.input<typeof StartRuntimeRequest>;
1767
- export type StartRuntimeRequestOutput = zod.output<typeof StartRuntimeRequest>;
1768
-
1769
- export const cellConfigInputColumnDefault = null;
1770
- export const cellConfigInputDisabledDefault = false;
1771
- export const cellConfigInputHideCodeDefault = false;
1772
- export const cellConfigInputExpandOutputDefault = false;
1773
-
1774
- export const CellConfigInput = zod
1775
- .object({
1776
- column: zod.int().nullish().default(cellConfigInputColumnDefault),
1777
- disabled: zod.boolean().default(cellConfigInputDisabledDefault),
1778
- hide_code: zod.boolean().default(cellConfigInputHideCodeDefault),
1779
- expand_output: zod.boolean().default(cellConfigInputExpandOutputDefault),
1780
- })
1781
- .describe(
1782
- "A cell's settings as a client writes them. A field left out takes its default.",
1783
- );
1784
-
1785
- export type CellConfigInput = zod.input<typeof CellConfigInput>;
1786
- export type CellConfigInputOutput = zod.output<typeof CellConfigInput>;
1787
-
1788
- export const cellInputNameDefault = `_`;
1789
-
1790
- export const CellInput = zod
1791
- .object({
1792
- id: CellId.describe(
1793
- "The cell's id. A client chooses the id of a cell it creates.",
1794
- ),
1795
- code: zod.string().describe("The cell's source code."),
1796
- name: zod
1797
- .string()
1798
- .default(cellInputNameDefault)
1799
- .describe("The cell's name. `_` for an anonymous cell."),
1800
- config: CellConfigInput.optional(),
1801
- })
1802
- .describe(
1803
- "A cell as a client writes it. The host derives the etags and the analysis.",
1804
- );
1805
-
1806
- export type CellInput = zod.input<typeof CellInput>;
1807
- export type CellInputOutput = zod.output<typeof CellInput>;
1808
-
1809
- export const PutCell = zod
1810
- .object({
1811
- kind: zod.enum(["put_cell"]),
1812
- base_etag: zod
1813
- .string()
1814
- .nullable()
1815
- .describe(
1816
- "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`.",
1817
- ),
1818
- cell: CellInput,
1819
- after: CellId.optional().describe(
1820
- "The cell a created cell goes after. Ignored for an existing cell.",
1821
- ),
1822
- before: CellId.optional().describe(
1823
- "The cell a created cell goes before. Ignored for an existing cell. With neither `after` nor `before`, a created cell goes at the end.",
1824
- ),
1825
- })
1826
- .describe("Replaces a whole cell, or creates one.");
1827
-
1828
- export type PutCell = zod.input<typeof PutCell>;
1829
- export type PutCellOutput = zod.output<typeof PutCell>;
1830
-
1831
- export const DeleteCell = zod
1832
- .object({
1833
- kind: zod.enum(["delete_cell"]),
1834
- id: CellId.describe("The cell to remove."),
1835
- base_etag: zod.string().describe("The cell's etag as last read, or `*`."),
1836
- })
1837
- .describe("Removes a cell.");
1838
-
1839
- export type DeleteCell = zod.input<typeof DeleteCell>;
1840
- export type DeleteCellOutput = zod.output<typeof DeleteCell>;
1841
-
1842
- export const SetOrder = zod
1843
- .object({
1844
- kind: zod.enum(["set_order"]),
1845
- base_etag: zod
1846
- .string()
1847
- .describe("The document's `order_etag` as last read, or `*`."),
1848
- order: zod
1849
- .array(CellId)
1850
- .describe(
1851
- "Every cell id exactly once, in the new order, counting cells this edit creates and leaving out cells it deletes.",
1852
- ),
1853
- })
1854
- .describe("Replaces the cell order.");
1855
-
1856
- export type SetOrder = zod.input<typeof SetOrder>;
1857
- export type SetOrderOutput = zod.output<typeof SetOrder>;
1858
-
1859
- export const Change = zod
1860
- .union([PutCell, DeleteCell, SetOrder])
1861
- .describe("One change to the document, tagged on `kind`.");
1862
-
1863
- export type Change = zod.input<typeof Change>;
1864
- export type ChangeOutput = zod.output<typeof Change>;
1865
-
1866
- export const EditRequest = zod.object({
1867
- changes: zod
1868
- .array(Change)
1869
- .describe("The changes, applied in order as one unit."),
1870
- });
1871
-
1872
- export type EditRequest = zod.input<typeof EditRequest>;
1873
- export type EditRequestOutput = zod.output<typeof EditRequest>;
1874
-
1875
- export const CellVersion = zod
1876
- .object({
1877
- etag: Etag,
1878
- code_hash: Etag,
1879
- version: zod.int().min(1).describe("The cell's version after the edit."),
1880
- })
1881
- .describe("A cell's etags and version after an edit.");
1882
-
1883
- export type CellVersion = zod.input<typeof CellVersion>;
1884
- export type CellVersionOutput = zod.output<typeof CellVersion>;
1885
-
1886
- export const EditResponse = zod
1887
- .object({
1888
- document: Document,
1889
- cells: zod
1890
- .record(zod.string(), zod.union([CellVersion, zod.null()]))
1891
- .describe(
1892
- "The version of each cell the request created or changed, by id, and null for each cell it deleted.",
1893
- ),
1894
- })
1895
- .describe("The document after an edit or a save, and the cells it touched.");
1896
-
1897
- export type EditResponse = zod.input<typeof EditResponse>;
1898
- export type EditResponseOutput = zod.output<typeof EditResponse>;
1899
-
1900
- export const SaveRequest = zod
1901
- .object({
1902
- decisions: zod
1903
- .record(zod.string(), zod.string())
1904
- .optional()
1905
- .describe(
1906
- "Answers to the questions in a `decision-required` problem, as for `runtime.start`.",
1907
- ),
1908
- })
1909
- .describe(
1910
- "What a save needs from the client, which is nothing until the host asks a question. `{}` is the usual body.",
1911
- );
1912
-
1913
- export type SaveRequest = zod.input<typeof SaveRequest>;
1914
- export type SaveRequestOutput = zod.output<typeof SaveRequest>;
1915
-
1916
- export const RequestedCell = zod.object({
1917
- id: CellId,
1918
- code_hash: Etag.optional().describe(
1919
- "The cell's `code_hash` as last read. A cell whose code differs is a `conflict`. Absent, the cell runs as it is.",
1920
- ),
1921
- });
1922
-
1923
- export type RequestedCell = zod.input<typeof RequestedCell>;
1924
- export type RequestedCellOutput = zod.output<typeof RequestedCell>;
1925
-
1926
- export const RunRequest = zod
1927
- .object({
1928
- code: zod
1929
- .string()
1930
- .optional()
1931
- .describe("Python code to run as scratch code."),
1932
- cells: zod
1933
- .array(RequestedCell)
1934
- .min(1)
1935
- .optional()
1936
- .describe(
1937
- "Cells of the document to run, in no particular order. The runtime's execution configuration determines whether dependent cells run too.",
1938
- ),
1939
- })
1940
- .describe("What to run, exactly one of `code` and `cells`.");
1941
-
1942
- export type RunRequest = zod.input<typeof RunRequest>;
1943
- export type RunRequestOutput = zod.output<typeof RunRequest>;