@marimo-team/islands 0.23.9-dev24 → 0.23.9-dev26

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 (26) hide show
  1. package/dist/{ConnectedDataExplorerComponent-DSyAzzpW.js → ConnectedDataExplorerComponent-MJy-Ll40.js} +4 -4
  2. package/dist/assets/__vite-browser-external-BBEFRPue.js +1 -0
  3. package/dist/assets/{worker-CgL6N0XX.js → worker-BoAkAmaG.js} +2 -2
  4. package/dist/{chat-ui-BW28GQUq.js → chat-ui-CpX2YcGy.js} +6 -6
  5. package/dist/{code-visibility-CQ87ezFN.js → code-visibility-B7_w2yFC.js} +8 -8
  6. package/dist/{formats-BiH6HX1V.js → formats-BIKFEOlR.js} +1 -1
  7. package/dist/{glide-data-editor-Ck-MRdns.js → glide-data-editor-DjQd6fKp.js} +2 -2
  8. package/dist/{html-to-image-Bi7maU1p.js → html-to-image-QL7QveRm.js} +5 -5
  9. package/dist/{input-BwcGY_X1.js → input-Dh0iMVFM.js} +1 -1
  10. package/dist/main.js +18 -18
  11. package/dist/{mermaid-YK4c8MNC.js → mermaid-CAibas-0.js} +2 -2
  12. package/dist/{process-output-BimQ_hG4.js → process-output-C657UH7t.js} +1 -1
  13. package/dist/{reveal-component-B94BnmI7.js → reveal-component-CcS9xMNP.js} +5 -5
  14. package/dist/{spec-CyLiCjSf.js → spec-BKuFJIDz.js} +1 -1
  15. package/dist/style.css +1 -1
  16. package/dist/{toDate-DNWCUEQp.js → toDate-BeKbrOvs.js} +1 -1
  17. package/dist/{useAsyncData-xWFWzCee.js → useAsyncData-yp6n17kh.js} +1 -1
  18. package/dist/{useDeepCompareMemoize-DSChED4g.js → useDeepCompareMemoize-DJvAHUIC.js} +1 -1
  19. package/dist/{useLifecycle-B81PFEja.js → useLifecycle-CsYXf0Ln.js} +1 -1
  20. package/dist/{useTheme-EmVyK9N9.js → useTheme-CK_R9Mn8.js} +1 -0
  21. package/dist/{vega-component-BCunE3-9.js → vega-component-ikfBfkZO.js} +5 -5
  22. package/package.json +1 -1
  23. package/src/components/app-config/ai-config.tsx +72 -0
  24. package/src/components/app-config/user-config-form.tsx +1 -1
  25. package/src/core/config/config-schema.ts +1 -0
  26. package/dist/assets/__vite-browser-external-Ddfz4Fpd.js +0 -1
@@ -6,7 +6,7 @@ import { _ as Logger } from "./button-C5K9fIPF.js";
6
6
  import { t as require_compiler_runtime } from "./compiler-runtime-CEbnTgxf.js";
7
7
  import { u as createLucideIcon } from "./dist-C1BYNeCR.js";
8
8
  import { r as KnownQueryParams } from "./constants-T20xxyNf.js";
9
- import { b as atom, d as store, m as isIslands, p as waitFor } from "./useTheme-EmVyK9N9.js";
9
+ import { b as atom, d as store, m as isIslands, p as waitFor } from "./useTheme-CK_R9Mn8.js";
10
10
  import { t as invariant } from "./invariant-wRzNXIsJ.js";
11
11
  var CircleQuestionMark = createLucideIcon("circle-question-mark", [
12
12
  ["circle", {
@@ -1,7 +1,7 @@
1
1
  import { s as __toESM } from "./chunk-BNovOVIE.js";
2
2
  import { t as require_react } from "./react-DA-nE2FX.js";
3
3
  import { t as require_compiler_runtime } from "./compiler-runtime-CEbnTgxf.js";
4
- import { T as useEvent_default } from "./useTheme-EmVyK9N9.js";
4
+ import { T as useEvent_default } from "./useTheme-CK_R9Mn8.js";
5
5
  import { t as invariant } from "./invariant-wRzNXIsJ.js";
6
6
  var import_compiler_runtime = require_compiler_runtime(), import_react = /* @__PURE__ */ __toESM(require_react(), 1), Result = {
7
7
  error(e, s) {
@@ -1,6 +1,6 @@
1
1
  import { s as __toESM } from "./chunk-BNovOVIE.js";
2
2
  import { t as require_react } from "./react-DA-nE2FX.js";
3
- import { w as dequal } from "./useTheme-EmVyK9N9.js";
3
+ import { w as dequal } from "./useTheme-CK_R9Mn8.js";
4
4
  var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
5
5
  function useDeepCompareMemoize(e) {
6
6
  let i = import_react.useRef(e);
@@ -4,7 +4,7 @@ import { t as require_react } from "./react-DA-nE2FX.js";
4
4
  import { t as require_compiler_runtime } from "./compiler-runtime-CEbnTgxf.js";
5
5
  import { u as createLucideIcon } from "./dist-C1BYNeCR.js";
6
6
  import { t as require_jsx_runtime } from "./jsx-runtime-DebpN0FN.js";
7
- import { b as atom, v as useSetAtom } from "./useTheme-EmVyK9N9.js";
7
+ import { b as atom, v as useSetAtom } from "./useTheme-CK_R9Mn8.js";
8
8
  var Calendar = createLucideIcon("calendar", [
9
9
  ["path", {
10
10
  d: "M8 2v4",
@@ -607,6 +607,7 @@ const UserConfigSchema = looseObject({
607
607
  package_management: looseObject({ manager: _enum(PackageManagerNames).prefault("pip") }).prefault({}),
608
608
  ai: looseObject({
609
609
  rules: string().prefault(""),
610
+ max_tokens: number().int().positive().nullable().optional(),
610
611
  mode: _enum(COPILOT_MODES).prefault("manual"),
611
612
  inline_tooltip: boolean().prefault(false),
612
613
  open_ai: AiConfigSchema.optional(),
@@ -2,23 +2,23 @@ import { s as __toESM } from "./chunk-BNovOVIE.js";
2
2
  import { _ as Logger, c as Objects, g as cn, h as Events } from "./button-C5K9fIPF.js";
3
3
  import { t as require_react } from "./react-DA-nE2FX.js";
4
4
  import { t as require_compiler_runtime } from "./compiler-runtime-CEbnTgxf.js";
5
- import { c as asRemoteURL, v as CircleQuestionMark } from "./toDate-DNWCUEQp.js";
5
+ import { c as asRemoteURL, v as CircleQuestionMark } from "./toDate-BeKbrOvs.js";
6
6
  import "./react-dom-BTJzcVJ9.js";
7
7
  import { t as require_jsx_runtime } from "./jsx-runtime-DebpN0FN.js";
8
8
  import "./zod-CoBiJ5v4.js";
9
9
  import { n as ErrorBanner } from "./error-banner-5bz0L9hS.js";
10
10
  import { t as Tooltip } from "./tooltip-C5FYOpQc.js";
11
11
  import { i as debounce_default } from "./constants-T20xxyNf.js";
12
- import { T as useEvent_default, n as useTheme } from "./useTheme-EmVyK9N9.js";
12
+ import { T as useEvent_default, n as useTheme } from "./useTheme-CK_R9Mn8.js";
13
13
  import { s as uniq } from "./arrays-sEtDRoG4.js";
14
- import { a as isValid, i as AlertTitle, n as Alert, t as arrow } from "./formats-BiH6HX1V.js";
14
+ import { a as isValid, i as AlertTitle, n as Alert, t as arrow } from "./formats-BIKFEOlR.js";
15
15
  import { n as formats } from "./vega-loader.browser-CZ-J8Py3.js";
16
16
  import { a as getContainerWidth, n as vegaLoadData, s as tooltipHandler } from "./loader-BWLPpjKK.js";
17
17
  import { t as j } from "./react-vega-B0sAlDTL.js";
18
18
  import "./defaultLocale-u-3osm0P.js";
19
19
  import "./defaultLocale-BoHTsDG6.js";
20
- import { t as useAsyncData } from "./useAsyncData-xWFWzCee.js";
21
- import { t as useDeepCompareMemoize } from "./useDeepCompareMemoize-DSChED4g.js";
20
+ import { t as useAsyncData } from "./useAsyncData-yp6n17kh.js";
21
+ import { t as useDeepCompareMemoize } from "./useDeepCompareMemoize-DJvAHUIC.js";
22
22
  import { t as Semaphore } from "./semaphore-CNDGTzkX.js";
23
23
  var import_compiler_runtime = require_compiler_runtime(), import_react = /* @__PURE__ */ __toESM(require_react(), 1);
24
24
  function fixRelativeUrl(e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.23.9-dev24",
3
+ "version": "0.23.9-dev26",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -1253,6 +1253,13 @@ export const AiAssistConfig: React.FC<AiConfigProps> = ({
1253
1253
  config,
1254
1254
  onSubmit,
1255
1255
  }) => {
1256
+ // Tracked locally rather than derived from the field value so that clearing
1257
+ // the input (a transient empty value, which commits `null`) does not disable
1258
+ // the input mid-edit and force the user to re-tick the Override checkbox.
1259
+ const [maxTokensEnabled, setMaxTokensEnabled] = useState(
1260
+ config.ai?.max_tokens != null,
1261
+ );
1262
+
1256
1263
  return (
1257
1264
  <SettingGroup>
1258
1265
  <SettingSubtitle>AI Assistant</SettingSubtitle>
@@ -1279,6 +1286,71 @@ export const AiAssistConfig: React.FC<AiConfigProps> = ({
1279
1286
  )}
1280
1287
  />
1281
1288
 
1289
+ <FormField
1290
+ control={form.control}
1291
+ name="ai.max_tokens"
1292
+ render={({ field }) => {
1293
+ return (
1294
+ <div className="flex flex-col gap-y-1">
1295
+ <div className="flex items-center gap-x-2">
1296
+ <FormItem className={formItemClasses}>
1297
+ <FormLabel className="font-normal">
1298
+ Max output tokens
1299
+ </FormLabel>
1300
+ <FormControl>
1301
+ <Input
1302
+ data-testid="ai-max-tokens-input"
1303
+ type="number"
1304
+ min={1}
1305
+ disabled={!maxTokensEnabled}
1306
+ className="w-28 h-6"
1307
+ value={field.value ?? (maxTokensEnabled ? "" : 32768)}
1308
+ onChange={(e) => {
1309
+ const n = Number.parseInt(e.target.value, 10);
1310
+ field.onChange(Number.isFinite(n) && n > 0 ? n : null);
1311
+ }}
1312
+ />
1313
+ </FormControl>
1314
+ </FormItem>
1315
+ <FormItem className={formItemClasses}>
1316
+ <Checkbox
1317
+ data-testid="ai-max-tokens-checkbox"
1318
+ checked={maxTokensEnabled}
1319
+ onCheckedChange={(checked) => {
1320
+ const isChecked = checked === true;
1321
+ setMaxTokensEnabled(isChecked);
1322
+ // null signals delete to the server; cast because
1323
+ // UserConfig (OpenAPI-derived) types max_tokens as
1324
+ // `number | undefined`, but zod accepts `null`.
1325
+ const next = (
1326
+ isChecked ? (field.value ?? 32768) : null
1327
+ ) as number | undefined;
1328
+ // shouldDirty: true forces RHF to keep this in
1329
+ // dirtyFields even when `next` happens to equal the
1330
+ // form's defaultValue (e.g. untick → tick when disk
1331
+ // started with 32768). Otherwise getDirtyValues
1332
+ // would skip it and the save body would be empty.
1333
+ form.setValue("ai.max_tokens", next, {
1334
+ shouldDirty: true,
1335
+ shouldTouch: true,
1336
+ });
1337
+ onSubmit(form.getValues());
1338
+ }}
1339
+ />
1340
+ <FormLabel className="font-normal">Override</FormLabel>
1341
+ </FormItem>
1342
+ </div>
1343
+
1344
+ <FormDescription>
1345
+ Each provider sets its own max output tokens (Anthropic uses a
1346
+ recommended default). Adjust to control costs or enable more
1347
+ output.
1348
+ </FormDescription>
1349
+ </div>
1350
+ );
1351
+ }}
1352
+ />
1353
+
1282
1354
  <FormErrorsBanner />
1283
1355
  <ModelSelector
1284
1356
  label="Chat Model"
@@ -1355,7 +1355,7 @@ export const UserConfigForm: React.FC = () => {
1355
1355
  <Form {...form}>
1356
1356
  <form
1357
1357
  ref={formElement}
1358
- onChange={form.handleSubmit(onSubmit)}
1358
+ onChange={form.handleSubmit((values) => onSubmit(values))}
1359
1359
  className="flex text-pretty overflow-hidden"
1360
1360
  >
1361
1361
  <Tabs
@@ -159,6 +159,7 @@ export const UserConfigSchema = z
159
159
  ai: z
160
160
  .looseObject({
161
161
  rules: z.string().prefault(""),
162
+ max_tokens: z.number().int().positive().nullable().optional(),
162
163
  mode: z.enum(COPILOT_MODES).prefault("manual"),
163
164
  inline_tooltip: z.boolean().prefault(false),
164
165
  open_ai: AiConfigSchema.optional(),
@@ -1 +0,0 @@
1
- import{t as e}from"./worker-CgL6N0XX.js";var t=e(((e,t)=>{t.exports={}}));export default t();