@marimo-team/islands 0.23.9-dev4 → 0.23.9-dev41

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 (97) hide show
  1. package/dist/{ConnectedDataExplorerComponent-OzrfMM5L.js → ConnectedDataExplorerComponent-CyV83R2m.js} +4 -4
  2. package/dist/assets/__vite-browser-external-Ci2ZQfXU.js +1 -0
  3. package/dist/assets/{worker-CpBbwbQo.js → worker-ip3AI_sN.js} +2 -2
  4. package/dist/{chat-ui-BDI3FMI8.js → chat-ui-ChD4VvCo.js} +3060 -3033
  5. package/dist/{code-visibility-VZebNmSs.js → code-visibility-s3OWNKLN.js} +1634 -1314
  6. package/dist/{formats-DQ5qjo_Q.js → formats-DHxc-FdY.js} +1 -1
  7. package/dist/{glide-data-editor-DqRY9naW.js → glide-data-editor-BOmK9ETQ.js} +2 -2
  8. package/dist/{html-to-image-CiSinpSR.js → html-to-image-BHv7CEU_.js} +2145 -2153
  9. package/dist/{input-CZD2z6X2.js → input-_2sjvfne.js} +1 -1
  10. package/dist/main.js +1522 -1556
  11. package/dist/{mermaid-IU93XzmY.js → mermaid-lXOw5Py9.js} +2 -2
  12. package/dist/{process-output-5qJjMRKh.js → process-output-BvySRgli.js} +33 -25
  13. package/dist/{reveal-component-DZtPMEoM.js → reveal-component-DCO6zm_5.js} +17 -17
  14. package/dist/{spec-a6DaqW__.js → spec-B96zNUEA.js} +1 -1
  15. package/dist/style.css +1 -1
  16. package/dist/{toDate-ZVVIBmdk.js → toDate-x-WRDCH7.js} +1 -1
  17. package/dist/{useAsyncData-C008zUPi.js → useAsyncData-iRgKDT5s.js} +1 -1
  18. package/dist/{useDeepCompareMemoize-BrA3_n61.js → useDeepCompareMemoize-CkQ57VS2.js} +1 -1
  19. package/dist/{useLifecycle-BNaoJ5a4.js → useLifecycle-BBO9PIph.js} +1 -1
  20. package/dist/{useTheme-7O0YWlE5.js → useTheme-DHIrRQOe.js} +34 -21
  21. package/dist/{vega-component-DJNmOdUj.js → vega-component-Dq-SH463.js} +5 -5
  22. package/package.json +1 -1
  23. package/src/components/ai/__tests__/ai-utils.test.ts +43 -38
  24. package/src/components/ai/ai-model-dropdown.tsx +2 -2
  25. package/src/components/app-config/ai-config.tsx +147 -16
  26. package/src/components/app-config/user-config-form.tsx +37 -1
  27. package/src/components/chat/__tests__/chat-utils.test.ts +269 -0
  28. package/src/components/chat/chat-panel.tsx +38 -5
  29. package/src/components/chat/chat-utils.ts +14 -58
  30. package/src/components/data-table/TableBottomBar.tsx +27 -6
  31. package/src/components/data-table/TableTopBar.tsx +7 -1
  32. package/src/components/data-table/__tests__/TableBottomBar.test.tsx +73 -0
  33. package/src/components/data-table/__tests__/column-explorer.test.tsx +128 -0
  34. package/src/components/data-table/__tests__/data-table.test.tsx +52 -1
  35. package/src/components/data-table/__tests__/header-items.test.tsx +257 -1
  36. package/src/components/data-table/__tests__/useColumnVisibility.test.ts +42 -0
  37. package/src/components/data-table/column-explorer-panel/column-explorer.tsx +98 -26
  38. package/src/components/data-table/column-header.tsx +19 -12
  39. package/src/components/data-table/columns.tsx +3 -4
  40. package/src/components/data-table/data-table.tsx +37 -0
  41. package/src/components/data-table/export-actions.tsx +36 -18
  42. package/src/components/data-table/header-items.tsx +58 -17
  43. package/src/components/data-table/hooks/use-column-visibility.ts +56 -0
  44. package/src/components/data-table/pagination.tsx +16 -3
  45. package/src/components/data-table/schemas.ts +2 -2
  46. package/src/components/data-table/table-explorer-panel/table-explorer-panel.tsx +16 -6
  47. package/src/components/databases/display.tsx +2 -0
  48. package/src/components/datasources/__tests__/utils.test.ts +82 -0
  49. package/src/components/datasources/utils.ts +16 -15
  50. package/src/components/editor/actions/pair-with-agent-modal.tsx +1 -0
  51. package/src/components/editor/actions/useCellActionButton.tsx +3 -3
  52. package/src/components/editor/actions/useNotebookActions.tsx +5 -2
  53. package/src/components/editor/cell/code/cell-editor.tsx +7 -4
  54. package/src/components/editor/chrome/types.ts +13 -6
  55. package/src/components/editor/chrome/wrapper/app-chrome.tsx +6 -4
  56. package/src/components/editor/chrome/wrapper/footer-items/ai-status.tsx +10 -1
  57. package/src/components/editor/chrome/wrapper/sidebar.tsx +7 -5
  58. package/src/components/editor/errors/auto-fix.tsx +3 -3
  59. package/src/components/editor/errors/mangled-local-chip.tsx +50 -0
  60. package/src/components/editor/navigation/__tests__/navigation.test.ts +15 -0
  61. package/src/components/editor/navigation/navigation.ts +5 -0
  62. package/src/components/editor/output/MarimoErrorOutput.tsx +110 -27
  63. package/src/components/editor/output/MarimoTracebackOutput.tsx +55 -37
  64. package/src/components/editor/renderers/cell-array.tsx +27 -24
  65. package/src/components/editor/renderers/slides-layout/slides-layout.tsx +1 -1
  66. package/src/components/slides/reveal-component.tsx +3 -3
  67. package/src/components/slides/slide-form.tsx +11 -3
  68. package/src/components/static-html/static-banner.tsx +28 -22
  69. package/src/core/ai/__tests__/model-registry.test.ts +72 -60
  70. package/src/core/ai/model-registry.ts +33 -28
  71. package/src/core/cells/__tests__/actions.test.ts +48 -0
  72. package/src/core/cells/actions.ts +5 -6
  73. package/src/core/codemirror/__tests__/setup.test.ts +29 -0
  74. package/src/core/codemirror/cells/traceback-decorations.ts +1 -1
  75. package/src/core/codemirror/cm.ts +3 -2
  76. package/src/core/codemirror/completion/hints.ts +4 -1
  77. package/src/core/codemirror/format.ts +1 -0
  78. package/src/core/codemirror/keymaps/vim.ts +63 -0
  79. package/src/core/codemirror/language/languages/sql/sql.ts +1 -0
  80. package/src/core/codemirror/language/languages/sql/utils.ts +2 -0
  81. package/src/core/config/__tests__/config-schema.test.ts +4 -0
  82. package/src/core/config/config-schema.ts +4 -0
  83. package/src/core/config/config.ts +16 -0
  84. package/src/css/app/Cell.css +0 -1
  85. package/src/plugins/impl/DataTablePlugin.tsx +94 -33
  86. package/src/plugins/impl/__tests__/DataTablePlugin.test.tsx +1 -0
  87. package/src/plugins/impl/chat/ChatPlugin.tsx +7 -1
  88. package/src/plugins/impl/chat/__tests__/chat-ui.test.ts +278 -0
  89. package/src/plugins/impl/chat/chat-ui.tsx +106 -59
  90. package/src/plugins/impl/chat/types.ts +5 -0
  91. package/src/plugins/impl/data-frames/DataFramePlugin.tsx +8 -6
  92. package/src/stories/dataframe.stories.tsx +1 -0
  93. package/src/utils/__tests__/json-parser.test.ts +1 -69
  94. package/src/utils/__tests__/local-variables.test.ts +132 -0
  95. package/src/utils/json/json-parser.ts +0 -30
  96. package/src/utils/local-variables.ts +67 -0
  97. package/dist/assets/__vite-browser-external-CAdMKBac.js +0 -1
@@ -24,7 +24,7 @@ import { maybeAddMarimoImport } from "@/core/cells/add-missing-import";
24
24
  import { SETUP_CELL_ID } from "@/core/cells/ids";
25
25
  import { LanguageAdapters } from "@/core/codemirror/language/LanguageAdapters";
26
26
  import { MARKDOWN_INITIAL_HIDE_CODE } from "@/core/codemirror/language/languages/markdown";
27
- import { aiEnabledAtom } from "@/core/config/config";
27
+ import { aiEnabledAtom, aiFeaturesEnabledAtom } from "@/core/config/config";
28
28
  import { canInteractWithAppAtom } from "@/core/network/connection";
29
29
  import { useBoolean } from "@/hooks/useBoolean";
30
30
  import { cn } from "@/utils/cn";
@@ -261,6 +261,7 @@ const AddCellButtons: React.FC<{
261
261
  const { createNewCell } = useCellActions();
262
262
  const [isAiButtonOpen, isAiButtonOpenActions] = useBoolean(false);
263
263
  const aiEnabled = useAtomValue(aiEnabledAtom);
264
+ const aiFeaturesEnabled = useAtomValue(aiFeaturesEnabledAtom);
264
265
  const canInteractWithApp = useAtomValue(canInteractWithAppAtom);
265
266
  const { handleClick } = useOpenSettingsToTab();
266
267
 
@@ -270,7 +271,7 @@ const AddCellButtons: React.FC<{
270
271
  );
271
272
 
272
273
  const renderBody = () => {
273
- if (isAiButtonOpen) {
274
+ if (aiEnabled && isAiButtonOpen) {
274
275
  return <AddCellWithAI onClose={isAiButtonOpenActions.toggle} />;
275
276
  }
276
277
 
@@ -328,30 +329,32 @@ const AddCellButtons: React.FC<{
328
329
  <DatabaseIcon className="mr-2 size-4 shrink-0" />
329
330
  SQL
330
331
  </Button>
331
- <Tooltip
332
- content={
333
- aiEnabled ? null : (
334
- <span>AI provider not found or Edit model not selected</span>
335
- )
336
- }
337
- delayDuration={100}
338
- asChild={false}
339
- >
340
- <Button
341
- className={buttonClass}
342
- variant="text"
343
- size="sm"
344
- disabled={!canInteractWithApp}
345
- onClick={
346
- aiEnabled
347
- ? isAiButtonOpenActions.toggle
348
- : () => handleClick("ai", "ai-providers")
332
+ {aiEnabled && (
333
+ <Tooltip
334
+ content={
335
+ aiFeaturesEnabled ? null : (
336
+ <span>AI provider not found or Edit model not selected</span>
337
+ )
349
338
  }
339
+ delayDuration={100}
340
+ asChild={false}
350
341
  >
351
- <SparklesIcon className="mr-2 size-4 shrink-0" />
352
- Generate with AI
353
- </Button>
354
- </Tooltip>
342
+ <Button
343
+ className={buttonClass}
344
+ variant="text"
345
+ size="sm"
346
+ disabled={!canInteractWithApp}
347
+ onClick={
348
+ aiFeaturesEnabled
349
+ ? isAiButtonOpenActions.toggle
350
+ : () => handleClick("ai", "ai-providers")
351
+ }
352
+ >
353
+ <SparklesIcon className="mr-2 size-4 shrink-0" />
354
+ Generate with AI
355
+ </Button>
356
+ </Tooltip>
357
+ )}
355
358
  </>
356
359
  );
357
360
  };
@@ -55,7 +55,7 @@ export const SlidesLayoutRenderer: React.FC<Props> = ({
55
55
  setLayout={setLayout}
56
56
  activeIndex={resolvedIndex}
57
57
  onSlideChange={handleSlideChange}
58
- configWidth={300}
58
+ configWidth={280}
59
59
  mode={isReading ? "read" : mode}
60
60
  isEditable={!isReading}
61
61
  />
@@ -231,7 +231,7 @@ const RevealSlidesComponent = ({
231
231
  activeIndex,
232
232
  onSlideChange,
233
233
  mode,
234
- configWidth = 300, // px
234
+ configWidth, // px
235
235
  isEditable = false,
236
236
  }: {
237
237
  cellsWithOutput: RuntimeCell[];
@@ -240,7 +240,7 @@ const RevealSlidesComponent = ({
240
240
  activeIndex?: number;
241
241
  onSlideChange?: (index: number) => void;
242
242
  mode: AppMode;
243
- configWidth?: number;
243
+ configWidth: number;
244
244
  isEditable?: boolean;
245
245
  }) => {
246
246
  const containerRef = useRef<HTMLDivElement>(null);
@@ -439,7 +439,7 @@ const RevealSlidesComponent = ({
439
439
  <div className="group relative" style={{ width, height }}>
440
440
  <Deck
441
441
  deckRef={deckRef}
442
- className="aspect-video w-full overflow-hidden border rounded bg-background mo-slides-theme prose-slides"
442
+ className="aspect-video w-full overflow-hidden border rounded bg-background mo-slides-theme prose-slides focus:outline-none focus-visible:outline-none"
443
443
  config={revealConfig}
444
444
  onReady={handleDeckReady}
445
445
  onSlideChange={handleSlideChange}
@@ -26,15 +26,23 @@ import type {
26
26
  SlidesLayout,
27
27
  SlideType,
28
28
  } from "../editor/renderers/slides-layout/types";
29
- import { useState } from "react";
29
+ import { useAtom } from "jotai";
30
+ import { atomWithStorage } from "jotai/utils";
30
31
  import { Tooltip } from "../ui/tooltip";
31
32
  import { Button } from "../ui/button";
32
33
  import { Kbd } from "../ui/kbd";
33
34
  import type { RuntimeCell } from "@/core/cells/types";
35
+ import { jotaiJsonStorage } from "@/utils/storage/jotai";
34
36
 
35
37
  export const DEFAULT_SLIDE_TYPE: SlideType = "slide";
36
38
  export const DEFAULT_DECK_TRANSITION: DeckTransition = "slide";
37
39
  const COLLAPSED_CONFIG_WIDTH = 36;
40
+ const slideConfigOpenAtom = atomWithStorage<boolean>(
41
+ "marimo:slides:config-open",
42
+ true,
43
+ jotaiJsonStorage,
44
+ { getOnInit: true },
45
+ );
38
46
 
39
47
  export interface SlideTypeOption {
40
48
  value: SlideType;
@@ -322,7 +330,7 @@ export const SlideSidebar = ({
322
330
  setLayout: (layout: SlidesLayout) => void;
323
331
  activeConfigCell?: RuntimeCell;
324
332
  }) => {
325
- const [isConfigOpen, setIsConfigOpen] = useState(false);
333
+ const [isConfigOpen, setIsConfigOpen] = useAtom(slideConfigOpenAtom);
326
334
 
327
335
  return (
328
336
  <aside
@@ -350,7 +358,7 @@ export const SlideSidebar = ({
350
358
  variant="ghost"
351
359
  size="icon"
352
360
  className="h-7 w-7 text-muted-foreground hover:text-foreground"
353
- onClick={() => setIsConfigOpen(!isConfigOpen)}
361
+ onClick={() => setIsConfigOpen((open) => !open)}
354
362
  aria-expanded={isConfigOpen}
355
363
  aria-controls="slide-config-panel"
356
364
  >
@@ -6,6 +6,7 @@ import { useAtomValue } from "jotai";
6
6
  import { CopyIcon, DownloadIcon } from "lucide-react";
7
7
  import type React from "react";
8
8
  import { Constants } from "@/core/constants";
9
+ import { useResolvedMarimoConfig } from "@/core/config/config";
9
10
  import { codeAtom } from "@/core/saving/file-state";
10
11
  import { useFilename } from "@/core/saving/filename";
11
12
  import { isStaticNotebook } from "@/core/static/static-state";
@@ -66,6 +67,9 @@ const StaticBannerDialog = ({ code }: { code: string }) => {
66
67
  filename = filename.slice(lastSlash + 1);
67
68
  }
68
69
 
70
+ const [resolvedConfig] = useResolvedMarimoConfig();
71
+ const molabEnabled = resolvedConfig.sharing?.molab !== false;
72
+
69
73
  const href = window.location.href;
70
74
  const molabLink = createShareableLink({
71
75
  code,
@@ -118,28 +122,30 @@ const StaticBannerDialog = ({ code }: { code: string }) => {
118
122
  </div>
119
123
  )}
120
124
 
121
- <div className="pt-3 border-t flex gap-2 items-center">
122
- <Button
123
- asChild={true}
124
- variant="outline"
125
- size="xs"
126
- className="shrink-0"
127
- >
128
- <a href={molabLink} target="_blank" rel="noopener noreferrer">
129
- <MarimoPlusIcon
130
- size={12}
131
- strokeWidth={1.5}
132
- className="mr-1.5 mt-px text-(--grass-11)"
133
- />
134
- Open in molab
135
- </a>
136
- </Button>
137
- <p className="text-sm text-(--sky-12)">
138
- Run this notebook in{" "}
139
- <span className="font-semibold">molab</span>, marimo's
140
- cloud-hosted notebook platform.
141
- </p>
142
- </div>
125
+ {molabEnabled && (
126
+ <div className="pt-3 border-t flex gap-2 items-center">
127
+ <Button
128
+ asChild={true}
129
+ variant="outline"
130
+ size="xs"
131
+ className="shrink-0"
132
+ >
133
+ <a href={molabLink} target="_blank" rel="noopener noreferrer">
134
+ <MarimoPlusIcon
135
+ size={12}
136
+ strokeWidth={1.5}
137
+ className="mr-1.5 mt-px text-(--grass-11)"
138
+ />
139
+ Open in molab
140
+ </a>
141
+ </Button>
142
+ <p className="text-sm text-(--sky-12)">
143
+ Run this notebook in{" "}
144
+ <span className="font-semibold">molab</span>, marimo's
145
+ cloud-hosted notebook platform.
146
+ </p>
147
+ </div>
148
+ )}
143
149
  </DialogDescription>
144
150
  </DialogHeader>
145
151
  <div className="flex gap-3 pt-2">
@@ -1,46 +1,52 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
  import { beforeEach, describe, expect, it, vi } from "vitest";
3
3
 
4
- // Mock the models.json import
5
4
  vi.mock("@marimo-team/llm-info/models.json", () => {
6
- const models: AiModel[] = [
7
- {
8
- name: "GPT-4",
9
- model: "gpt-4",
10
- description: "OpenAI GPT-4 model",
11
- providers: ["openai"],
12
- roles: ["chat", "edit"],
13
- thinking: false,
14
- },
15
- {
16
- name: "Claude 3",
17
- model: "claude-3-sonnet",
18
- description: "Anthropic Claude 3 Sonnet",
19
- providers: ["anthropic"],
20
- roles: ["chat", "edit"],
21
- thinking: false,
22
- },
23
- {
24
- name: "Gemini Pro",
25
- model: "gemini-pro",
26
- description: "Google Gemini Pro model",
27
- providers: ["google"],
28
- roles: ["chat", "edit"],
29
- thinking: false,
30
- },
31
- {
32
- name: "Multi Provider Model",
33
- model: "multi-model",
34
- description: "Model available on multiple providers",
35
- providers: ["openai", "anthropic"],
36
- roles: ["chat", "edit"],
37
- thinking: false,
38
- },
39
- ];
40
-
41
- return {
42
- models: models,
5
+ const make = (
6
+ overrides: Partial<AiModel> & Pick<AiModel, "name" | "model">,
7
+ ): AiModel => ({
8
+ description: "",
9
+ roles: ["chat", "edit"],
10
+ capabilities: [],
11
+ input_types: [],
12
+ output_types: [],
13
+ release_date: "1970-01-01",
14
+ ...overrides,
15
+ });
16
+
17
+ const multiModel = make({
18
+ name: "Multi Provider Model",
19
+ model: "multi-model",
20
+ description: "Model available on multiple providers",
21
+ });
22
+
23
+ const models: Record<string, AiModel[]> = {
24
+ openai: [
25
+ make({
26
+ name: "GPT-4",
27
+ model: "gpt-4",
28
+ description: "OpenAI GPT-4 model",
29
+ }),
30
+ multiModel,
31
+ ],
32
+ anthropic: [
33
+ make({
34
+ name: "Claude 3",
35
+ model: "claude-3-sonnet",
36
+ description: "Anthropic Claude 3 Sonnet",
37
+ }),
38
+ multiModel,
39
+ ],
40
+ google: [
41
+ make({
42
+ name: "Gemini Pro",
43
+ model: "gemini-pro",
44
+ description: "Google Gemini Pro model",
45
+ }),
46
+ ],
43
47
  };
48
+
49
+ return { models };
44
50
  });
45
51
 
46
52
  import type { AiModel } from "@marimo-team/llm-info";
@@ -107,14 +113,15 @@ describe("AiModelRegistry", () => {
107
113
  });
108
114
 
109
115
  const ids = [...registry.getModelsMap().keys()];
110
- // Include custom and all default ones.
116
+ // Include custom and all default ones; iteration follows provider
117
+ // sections in the source data (openai → anthropic → google).
111
118
  expect(ids).toEqual([
112
119
  "openai/custom-gpt",
113
120
  "openai/gpt-4",
114
- "anthropic/claude-3-sonnet",
115
- "google/gemini-pro",
116
121
  "openai/multi-model",
122
+ "anthropic/claude-3-sonnet",
117
123
  "anthropic/multi-model",
124
+ "google/gemini-pro",
118
125
  ]);
119
126
  });
120
127
  });
@@ -125,9 +132,9 @@ describe("AiModelRegistry", () => {
125
132
  const openaiModels = registry.getModelsByProvider("openai");
126
133
 
127
134
  expect(openaiModels).toHaveLength(2); // gpt-4 and multi-model
128
- expect(
129
- openaiModels.every((model) => model.providers.includes("openai")),
130
- ).toBe(true);
135
+ expect(openaiModels.every((model) => model.provider === "openai")).toBe(
136
+ true,
137
+ );
131
138
  });
132
139
 
133
140
  it("should return empty array for provider with no models", () => {
@@ -147,9 +154,9 @@ describe("AiModelRegistry", () => {
147
154
  expect(customModel?.name).toBe("custom-gpt");
148
155
  expect(customModel?.model).toBe("custom-gpt");
149
156
  expect(customModel?.description).toBe("Custom model");
150
- expect(customModel?.providers).toEqual(["openai"]);
157
+ expect(customModel?.provider).toBe("openai");
151
158
  expect(customModel?.roles).toEqual([]);
152
- expect(customModel?.thinking).toBe(false);
159
+ expect(customModel?.capabilities).toEqual([]);
153
160
  });
154
161
 
155
162
  it("should filter models based on displayed models", () => {
@@ -309,7 +316,10 @@ describe("AiModelRegistry", () => {
309
316
 
310
317
  expect(multiModelInOpenai).toBeDefined();
311
318
  expect(multiModelInAnthropic).toBeDefined();
312
- expect(multiModelInOpenai).toEqual(multiModelInAnthropic);
319
+ // Same model id, but each entry belongs to its own provider.
320
+ expect(multiModelInOpenai?.provider).toBe("openai");
321
+ expect(multiModelInAnthropic?.provider).toBe("anthropic");
322
+ expect(multiModelInOpenai?.name).toBe(multiModelInAnthropic?.name);
313
323
  });
314
324
 
315
325
  it("should handle displayed models filter with non-existent models", () => {
@@ -339,20 +349,20 @@ describe("AiModelRegistry", () => {
339
349
  expect(model).toHaveProperty("name");
340
350
  expect(model).toHaveProperty("model");
341
351
  expect(model).toHaveProperty("description");
342
- expect(model).toHaveProperty("providers");
352
+ expect(model).toHaveProperty("provider");
343
353
  expect(model).toHaveProperty("roles");
344
- expect(model).toHaveProperty("thinking");
354
+ expect(model).toHaveProperty("capabilities");
345
355
  expect(model).toHaveProperty("custom");
346
356
 
347
357
  expect(typeof model.name).toBe("string");
348
358
  expect(typeof model.model).toBe("string");
349
359
  expect(typeof model.description).toBe("string");
350
- expect(Array.isArray(model.providers)).toBe(true);
360
+ expect(typeof model.provider).toBe("string");
351
361
  expect(Array.isArray(model.roles)).toBe(true);
352
- expect(typeof model.thinking).toBe("boolean");
362
+ expect(Array.isArray(model.capabilities)).toBe(true);
353
363
  expect(typeof model.custom).toBe("boolean");
354
364
 
355
- expect(model.providers).toContain(provider);
365
+ expect(model.provider).toBe(provider);
356
366
  }
357
367
  }
358
368
  });
@@ -367,31 +377,33 @@ describe("AiModelRegistry", () => {
367
377
 
368
378
  expect(customModel).toMatchInlineSnapshot(`
369
379
  {
380
+ "capabilities": [],
370
381
  "custom": true,
371
382
  "description": "Custom model",
383
+ "input_types": [],
372
384
  "model": "custom-gpt",
373
385
  "name": "custom-gpt",
374
- "providers": [
375
- "openai",
376
- ],
386
+ "output_types": [],
387
+ "provider": "openai",
388
+ "release_date": "1970-01-01",
377
389
  "roles": [],
378
- "thinking": false,
379
390
  }
380
391
  `);
381
392
  expect(defaultModel).toMatchInlineSnapshot(`
382
393
  {
394
+ "capabilities": [],
383
395
  "custom": false,
384
396
  "description": "OpenAI GPT-4 model",
397
+ "input_types": [],
385
398
  "model": "gpt-4",
386
399
  "name": "GPT-4",
387
- "providers": [
388
- "openai",
389
- ],
400
+ "output_types": [],
401
+ "provider": "openai",
402
+ "release_date": "1970-01-01",
390
403
  "roles": [
391
404
  "chat",
392
405
  "edit",
393
406
  ],
394
- "thinking": false,
395
407
  }
396
408
  `);
397
409
  });
@@ -1,12 +1,8 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
 
3
- import type {
4
- AiModel as AiModelType,
5
- AiProvider,
6
- Role,
7
- } from "@marimo-team/llm-info";
8
- import { models } from "@marimo-team/llm-info/models.json";
9
- import { providers } from "@marimo-team/llm-info/providers.json";
3
+ import type { AiModel as AiModelType, AiProvider } from "@marimo-team/llm-info";
4
+ import { models as modelsJson } from "@marimo-team/llm-info/models.json";
5
+ import { providers as providersJson } from "@marimo-team/llm-info/providers.json";
10
6
  import { Logger } from "@/utils/Logger";
11
7
  import { MultiMap } from "@/utils/multi-map";
12
8
  import { once } from "@/utils/once";
@@ -14,13 +10,19 @@ import type { ProviderId } from "./ids/ids";
14
10
  import { AiModelId, type QualifiedModelId, type ShortModelId } from "./ids/ids";
15
11
 
16
12
  export interface AiModel extends AiModelType {
17
- roles: Role[];
18
13
  model: ShortModelId;
19
- providers: ProviderId[];
14
+ /** The provider this entry belongs to. */
15
+ provider: ProviderId;
20
16
  /** Whether this is a custom model. */
21
17
  custom: boolean;
22
18
  }
23
19
 
20
+ // JSON shape matches the `AiModel` schema (Zod-validated at codegen time).
21
+ const models = modelsJson as unknown as Partial<
22
+ Record<ProviderId, AiModelType[]>
23
+ >;
24
+ const providers = providersJson as unknown as readonly AiProvider[];
25
+
24
26
  interface KnownModelMaps {
25
27
  /** Map of qualified model ID to model info */
26
28
  modelMap: ReadonlyMap<QualifiedModelId, AiModel>;
@@ -32,24 +34,25 @@ export const getKnownModelMaps = once((): KnownModelMaps => {
32
34
  const modelMap = new Map<QualifiedModelId, AiModel>();
33
35
  const defaultModelByProvider = new Map<ProviderId, QualifiedModelId>();
34
36
 
35
- for (const model of models) {
36
- const modelId = model.model as ShortModelId;
37
- const modelInfo: AiModel = {
38
- ...model,
39
- model: model.model as ShortModelId,
40
- roles: model.roles.map((role) => role as Role),
41
- providers: model.providers as ProviderId[],
42
- custom: false,
43
- };
44
-
45
- const supportsChatOrEdit =
46
- modelInfo.roles.includes("chat") || modelInfo.roles.includes("edit");
37
+ for (const [providerKey, providerModels] of Object.entries(models)) {
38
+ if (!providerModels) {
39
+ continue;
40
+ }
41
+ const provider = providerKey as ProviderId;
42
+ for (const raw of providerModels) {
43
+ const modelId = raw.model as ShortModelId;
44
+ const modelInfo: AiModel = {
45
+ ...raw,
46
+ model: modelId,
47
+ provider,
48
+ custom: false,
49
+ };
47
50
 
48
- for (const provider of modelInfo.providers) {
49
51
  const qualifiedModelId: QualifiedModelId = `${provider}/${modelId}`;
50
52
  modelMap.set(qualifiedModelId, modelInfo);
51
53
 
52
- // Track first model per provider that supports chat or edit
54
+ const supportsChatOrEdit =
55
+ modelInfo.roles.includes("chat") || modelInfo.roles.includes("edit");
53
56
  if (supportsChatOrEdit && !defaultModelByProvider.has(provider)) {
54
57
  defaultModelByProvider.set(provider, qualifiedModelId);
55
58
  }
@@ -67,9 +70,8 @@ const getProviderMap = once(
67
70
  const providerMap = new Map<ProviderId, AiProvider>();
68
71
  const providerToOrderIdx = new Map<ProviderId, number>();
69
72
  providers.forEach((provider, idx) => {
70
- const providerId = provider.id as ProviderId;
71
- providerMap.set(providerId, provider);
72
- providerToOrderIdx.set(providerId, idx);
73
+ providerMap.set(provider.id, provider);
74
+ providerToOrderIdx.set(provider.id, idx);
73
75
  });
74
76
  return { providerMap, providerToOrderIdx };
75
77
  },
@@ -158,9 +160,12 @@ export class AiModelRegistry {
158
160
  name: modelId.shortModelId,
159
161
  model: modelId.shortModelId,
160
162
  description: "Custom model",
161
- providers: [modelId.providerId],
163
+ provider: modelId.providerId,
162
164
  roles: [],
163
- thinking: false,
165
+ capabilities: [],
166
+ input_types: [],
167
+ output_types: [],
168
+ release_date: "1970-01-01",
164
169
  custom: true,
165
170
  };
166
171
  customModelsMap.set(model, modelInfo);
@@ -0,0 +1,48 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ import { beforeEach, describe, expect, it, vi } from "vitest";
4
+ import { MockNotebook } from "@/__mocks__/notebook";
5
+ import { scrollAndHighlightCell } from "@/components/editor/links/cell-link";
6
+ import { notebookAtom } from "@/core/cells/cells";
7
+ import type { CellId } from "@/core/cells/ids";
8
+ import { createCellRuntimeState } from "@/core/cells/types";
9
+ import { store } from "@/core/state/jotai";
10
+ import { notebookScrollToRunning } from "../actions";
11
+
12
+ vi.mock("@/components/editor/links/cell-link", () => ({
13
+ scrollAndHighlightCell: vi.fn(),
14
+ }));
15
+
16
+ describe("notebookScrollToRunning", () => {
17
+ beforeEach(() => {
18
+ vi.clearAllMocks();
19
+ store.set(notebookAtom, MockNotebook.notebookState({ cellData: {} }));
20
+ });
21
+
22
+ it("scrolls to the first running cell in notebook order", () => {
23
+ const runtimeOnlyCellId = "runtime-only" as CellId;
24
+ const idleCellId = "idle-cell" as CellId;
25
+ const runningCellId = "running-cell" as CellId;
26
+
27
+ const notebook = MockNotebook.notebookState({
28
+ cellData: {
29
+ [idleCellId]: {},
30
+ [runningCellId]: {},
31
+ },
32
+ cellRuntime: {
33
+ [idleCellId]: { status: "idle" },
34
+ [runningCellId]: { status: "running" },
35
+ },
36
+ });
37
+ notebook.cellRuntime = {
38
+ [runtimeOnlyCellId]: createCellRuntimeState({ status: "running" }),
39
+ ...notebook.cellRuntime,
40
+ };
41
+ store.set(notebookAtom, notebook);
42
+
43
+ notebookScrollToRunning();
44
+
45
+ expect(scrollAndHighlightCell).toHaveBeenCalledOnce();
46
+ expect(scrollAndHighlightCell).toHaveBeenCalledWith(runningCellId, "focus");
47
+ });
48
+ });
@@ -1,7 +1,6 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
 
3
3
  import { scrollAndHighlightCell } from "@/components/editor/links/cell-link";
4
- import { Objects } from "@/utils/objects";
5
4
  import { store } from "../state/jotai";
6
5
  import { notebookAtom } from "./cells";
7
6
 
@@ -10,12 +9,12 @@ import { notebookAtom } from "./cells";
10
9
  */
11
10
  export function notebookScrollToRunning() {
12
11
  // find cell that is currently in "running" state
13
- const { cellRuntime } = store.get(notebookAtom);
14
- const cell = Objects.entries(cellRuntime).find(
15
- ([cellid, runtimestate]) => runtimestate.status === "running",
12
+ const { cellIds, cellRuntime } = store.get(notebookAtom);
13
+ const cellId = cellIds.inOrderIds.find(
14
+ (id) => cellRuntime[id]?.status === "running",
16
15
  );
17
- if (!cell) {
16
+ if (!cellId) {
18
17
  return;
19
18
  }
20
- scrollAndHighlightCell(cell[0], "focus");
19
+ scrollAndHighlightCell(cellId, "focus");
21
20
  }
@@ -134,6 +134,35 @@ describe("snapshot all duplicate keymaps", () => {
134
134
  });
135
135
  });
136
136
 
137
+ test("auto_close_pairs: false removes closeBrackets keymaps", () => {
138
+ const withAutoClose = EditorState.create({
139
+ extensions: setup(),
140
+ });
141
+ const withoutAutoClose = EditorState.create({
142
+ extensions: setup({
143
+ completionConfig: {
144
+ ...getOpts().completionConfig,
145
+ auto_close_pairs: false,
146
+ },
147
+ }),
148
+ });
149
+
150
+ const keysWith = withAutoClose.facet(keymap).flat();
151
+ const keysWithout = withoutAutoClose.facet(keymap).flat();
152
+
153
+ // closeBracketsKeymap contributes Backspace and Enter handlers
154
+ expect(keysWith.length).toBeGreaterThan(keysWithout.length);
155
+
156
+ const hasBracketPairHandler = (state: EditorState) =>
157
+ state
158
+ .facet(keymap)
159
+ .flat()
160
+ .some((k) => k.run?.name === "deleteBracketPair");
161
+
162
+ expect(hasBracketPairHandler(withAutoClose)).toBe(true);
163
+ expect(hasBracketPairHandler(withoutAutoClose)).toBe(false);
164
+ });
165
+
137
166
  test("placeholder adds another extension", () => {
138
167
  const opts = getOpts();
139
168
  const withAI = new PythonLanguageAdapter()