@marimo-team/islands 0.23.9-dev33 → 0.23.9-dev36

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 (41) hide show
  1. package/dist/{ConnectedDataExplorerComponent-MJy-Ll40.js → ConnectedDataExplorerComponent-BQBH2XAd.js} +4 -4
  2. package/dist/assets/__vite-browser-external-TaZstNaH.js +1 -0
  3. package/dist/assets/{worker-BoAkAmaG.js → worker-CZaLU0G8.js} +2 -2
  4. package/dist/{chat-ui-CpX2YcGy.js → chat-ui-IyGT4sju.js} +6 -6
  5. package/dist/{code-visibility-Buv2v2Zt.js → code-visibility-DP2xSfeW.js} +525 -410
  6. package/dist/{formats-BIKFEOlR.js → formats-B7_JC7Ba.js} +1 -1
  7. package/dist/{glide-data-editor-DjQd6fKp.js → glide-data-editor-BmM4MCbn.js} +2 -2
  8. package/dist/{html-to-image-QL7QveRm.js → html-to-image-CGbhD84m.js} +5 -5
  9. package/dist/{input-Dh0iMVFM.js → input-Ld3tUgdF.js} +1 -1
  10. package/dist/main.js +18 -18
  11. package/dist/{mermaid-CAibas-0.js → mermaid-BrUZ2PpQ.js} +2 -2
  12. package/dist/{process-output-C657UH7t.js → process-output-B8Cqiywi.js} +1 -1
  13. package/dist/{reveal-component-BAHoXFCZ.js → reveal-component-B7RA3HR2.js} +5 -5
  14. package/dist/{spec-BKuFJIDz.js → spec-nqxKYdNH.js} +1 -1
  15. package/dist/{toDate-BeKbrOvs.js → toDate-DLCQY32Y.js} +1 -1
  16. package/dist/{useAsyncData-yp6n17kh.js → useAsyncData-3f5sSgzf.js} +1 -1
  17. package/dist/{useDeepCompareMemoize-DJvAHUIC.js → useDeepCompareMemoize-Cu37j2QD.js} +1 -1
  18. package/dist/{useLifecycle-CsYXf0Ln.js → useLifecycle-DVkMZA_I.js} +1 -1
  19. package/dist/{useTheme-CK_R9Mn8.js → useTheme-DNcgchnA.js} +11 -2
  20. package/dist/{vega-component-ikfBfkZO.js → vega-component-7odw1pLZ.js} +5 -5
  21. package/package.json +1 -1
  22. package/src/components/app-config/ai-config.tsx +74 -15
  23. package/src/components/chat/chat-panel.tsx +2 -2
  24. package/src/components/data-table/__tests__/header-items.test.tsx +220 -10
  25. package/src/components/data-table/column-header.tsx +17 -12
  26. package/src/components/data-table/header-items.tsx +40 -16
  27. package/src/components/editor/actions/useCellActionButton.tsx +3 -3
  28. package/src/components/editor/cell/code/cell-editor.tsx +7 -4
  29. package/src/components/editor/chrome/types.ts +13 -6
  30. package/src/components/editor/chrome/wrapper/app-chrome.tsx +6 -4
  31. package/src/components/editor/chrome/wrapper/footer-items/ai-status.tsx +10 -1
  32. package/src/components/editor/chrome/wrapper/sidebar.tsx +7 -5
  33. package/src/components/editor/errors/auto-fix.tsx +3 -3
  34. package/src/components/editor/navigation/__tests__/navigation.test.ts +15 -0
  35. package/src/components/editor/navigation/navigation.ts +5 -0
  36. package/src/components/editor/output/MarimoTracebackOutput.tsx +4 -3
  37. package/src/components/editor/renderers/cell-array.tsx +27 -24
  38. package/src/core/config/__tests__/config-schema.test.ts +2 -0
  39. package/src/core/config/config-schema.ts +1 -0
  40. package/src/core/config/config.ts +16 -0
  41. package/dist/assets/__vite-browser-external-BBEFRPue.js +0 -1
@@ -24,6 +24,7 @@ import { usePendingDeleteService } from "@/core/cells/pending-delete-service";
24
24
  import { scrollCellIntoView } from "@/core/cells/scrollCellIntoView";
25
25
  import {
26
26
  hotkeysAtom,
27
+ isAiFeatureEnabled,
27
28
  keymapPresetAtom,
28
29
  userConfigAtom,
29
30
  } from "@/core/config/config";
@@ -195,6 +196,7 @@ export function useCellNavigationProps(
195
196
  const pendingDeleteService = usePendingDeleteService();
196
197
  const deleteCells = useDeleteManyCellsCallback();
197
198
  const userConfig = useAtomValue(userConfigAtom);
199
+ const aiFeaturesEnabled = isAiFeatureEnabled(userConfig);
198
200
 
199
201
  // Wrap selection actions to clear pending cells on any selection change
200
202
  const selectionActions = {
@@ -496,6 +498,9 @@ export function useCellNavigationProps(
496
498
  return true;
497
499
  }),
498
500
  "cell.aiCompletion": (cellId) => {
501
+ if (!aiFeaturesEnabled) {
502
+ return false;
503
+ }
499
504
  let closed = false;
500
505
  setAiCompletionCell((v) => {
501
506
  // Toggle close
@@ -25,7 +25,7 @@ import { getCellEditorView } from "@/core/cells/cells";
25
25
  import type { CellId } from "@/core/cells/ids";
26
26
  import { SCRATCH_CELL_ID } from "@/core/cells/ids";
27
27
  import { insertDebuggerAtLine } from "@/core/codemirror/editing/debugging";
28
- import { aiEnabledAtom } from "@/core/config/config";
28
+ import { aiFeaturesEnabledAtom } from "@/core/config/config";
29
29
  import { getRequestClient } from "@/core/network/requests";
30
30
  import { isStaticNotebook } from "@/core/static/static-state";
31
31
  import { isWasm } from "@/core/wasm/utils";
@@ -70,7 +70,7 @@ export const MarimoTracebackOutput = ({
70
70
  });
71
71
 
72
72
  const lastTracebackLine = lastLine(traceback);
73
- const aiEnabled = useAtomValue(aiEnabledAtom);
73
+ const aiFeaturesEnabled = useAtomValue(aiFeaturesEnabledAtom);
74
74
 
75
75
  // Get last traceback info
76
76
  const tracebackInfo = extractAllTracebackInfo(traceback)?.at(0);
@@ -83,7 +83,8 @@ export const MarimoTracebackOutput = ({
83
83
  !isStaticNotebook() &&
84
84
  cellId !== SCRATCH_CELL_ID;
85
85
 
86
- const showAIFix = onRefactorWithAI && aiEnabled && !isStaticNotebook();
86
+ const showAIFix =
87
+ onRefactorWithAI && aiFeaturesEnabled && !isStaticNotebook();
87
88
 
88
89
  const showSearch = !isStaticNotebook();
89
90
 
@@ -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
  };
@@ -46,6 +46,7 @@ test("default UserConfig - empty", () => {
46
46
  {
47
47
  "ai": {
48
48
  "custom_providers": {},
49
+ "enabled": true,
49
50
  "inline_tooltip": false,
50
51
  "mode": "manual",
51
52
  "models": {
@@ -118,6 +119,7 @@ test("default UserConfig - one level", () => {
118
119
  {
119
120
  "ai": {
120
121
  "custom_providers": {},
122
+ "enabled": true,
121
123
  "inline_tooltip": false,
122
124
  "mode": "manual",
123
125
  "models": {
@@ -158,6 +158,7 @@ export const UserConfigSchema = z
158
158
  .prefault({}),
159
159
  ai: z
160
160
  .looseObject({
161
+ enabled: z.boolean().prefault(true),
161
162
  rules: z.string().prefault(""),
162
163
  max_tokens: z.number().int().positive().nullable().optional(),
163
164
  mode: z.enum(COPILOT_MODES).prefault("manual"),
@@ -78,6 +78,14 @@ export const aiEnabledAtom = atom<boolean>((get) => {
78
78
  return isAiEnabled(get(resolvedMarimoConfigAtom));
79
79
  });
80
80
 
81
+ export const aiModelConfiguredAtom = atom<boolean>((get) => {
82
+ return isAiModelConfigured(get(resolvedMarimoConfigAtom));
83
+ });
84
+
85
+ export const aiFeaturesEnabledAtom = atom<boolean>((get) => {
86
+ return isAiFeatureEnabled(get(resolvedMarimoConfigAtom));
87
+ });
88
+
81
89
  export const editorFontSizeAtom = atom<number>((get) => {
82
90
  return get(resolvedMarimoConfigAtom).display.code_editor_font_size;
83
91
  });
@@ -87,6 +95,10 @@ export const localeAtom = atom<string | null | undefined>((get) => {
87
95
  });
88
96
 
89
97
  export function isAiEnabled(config: UserConfig) {
98
+ return config.ai?.enabled !== false;
99
+ }
100
+
101
+ export function isAiModelConfigured(config: UserConfig) {
90
102
  return (
91
103
  Boolean(config.ai?.models?.chat_model) ||
92
104
  Boolean(config.ai?.models?.edit_model) ||
@@ -94,6 +106,10 @@ export function isAiEnabled(config: UserConfig) {
94
106
  );
95
107
  }
96
108
 
109
+ export function isAiFeatureEnabled(config: UserConfig) {
110
+ return isAiEnabled(config) && isAiModelConfigured(config);
111
+ }
112
+
97
113
  /**
98
114
  * Atom for storing the app config.
99
115
  */
@@ -1 +0,0 @@
1
- import{t as e}from"./worker-BoAkAmaG.js";var t=e(((e,t)=>{t.exports={}}));export default t();