@sanity/assist 6.1.9 → 6.1.11

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.
package/README.md CHANGED
@@ -5,6 +5,7 @@
5
5
  - [Table of contents](#table-of-contents)
6
6
  - [About Sanity AI Assist](#about-sanity-ai-assist)
7
7
  - [Installation](#installation)
8
+ - [Build errors about missing icon exports](#build-errors-about-missing-icon-exports)
8
9
  - [Setup](#setup)
9
10
  - [Add the plugin](#add-the-plugin)
10
11
  - [Enabling the AI Assist API](#enabling-the-ai-assist-api)
@@ -57,6 +58,30 @@ npm install @sanity/assist sanity@latest
57
58
 
58
59
  This plugin requires `sanity` version `3.26` or greater.
59
60
 
61
+ ### Build errors about missing icon exports
62
+
63
+ This plugin depends on `@sanity/icons` v5, which [removed the per-icon exports from the package root](https://github.com/sanity-io/icons/releases/tag/v5.0.0): every icon now lives on its own export path. If `sanity build` or `sanity dev` fails with an error like
64
+
65
+ ```
66
+ [MISSING_EXPORT] "CopyIcon" is not exported by "node_modules/@sanity/icons/dist/index.js"
67
+ ```
68
+
69
+ the file referenced by the error still imports icons from the package root — usually the studio's own schema or structure code, or another dependency that has not been updated yet. Update those imports to the per-icon export paths:
70
+
71
+ ```diff
72
+ - import {CopyIcon, ListIcon} from '@sanity/icons'
73
+ + import {CopyIcon} from '@sanity/icons/Copy'
74
+ + import {ListIcon} from '@sanity/icons/List'
75
+ ```
76
+
77
+ Also make sure `@sanity/icons` is declared in the studio's own `package.json` when studio code imports it; which copy an undeclared import resolves to depends on package manager hoisting, and can change when installing or upgrading plugins.
78
+
79
+ If you cannot update the importing code right away (for example when it lives in a third-party package), pin `@sanity/icons` to v4 in the studio's own `package.json` until it catches up — v4 supports both import styles:
80
+
81
+ ```sh
82
+ npm install @sanity/icons@4
83
+ ```
84
+
60
85
  ## Setup
61
86
 
62
87
  > **Note:** AI Assist is available for all projects on the Growth plan and up.
@@ -145,9 +170,7 @@ assist({
145
170
  maxPathDepth: 4,
146
171
  temperature: 0.3,
147
172
  },
148
- translate: {
149
- /* see sections about document and field translation */
150
- },
173
+ translate: {/* see sections about document and field translation */},
151
174
  })
152
175
  ```
153
176
 
package/dist/index.d.ts CHANGED
@@ -472,7 +472,8 @@ declare const assist: import("sanity").Plugin<void | AssistPluginConfig>;
472
472
  declare function SchemaTypeTool(): import("react").JSX.Element;
473
473
  interface AssistOptions {
474
474
  aiAssist?: {
475
- /** Set to true to disable assistance for this field or type */exclude?: boolean;
475
+ /** Set to true to disable assistance for this field or type */
476
+ exclude?: boolean;
476
477
  /**
477
478
  * Set to true to add translation field-action to the field.
478
479
  * Only has an effect in document types configured for document or field level translations.
@@ -573,7 +574,8 @@ declare module 'sanity' {
573
574
  interface ObjectOptions extends AssistOptions {}
574
575
  interface ReferenceBaseOptions {
575
576
  aiAssist?: {
576
- /** Set to true to disable assistance for this field or type */exclude?: boolean;
577
+ /** Set to true to disable assistance for this field or type */
578
+ exclude?: boolean;
577
579
  /**
578
580
  * When set, the reference field will allow instructions to be added to it.
579
581
  * Should be the name of the embeddings-index where assist will look for contextually relevant documents
@@ -586,7 +588,7 @@ declare module 'sanity' {
586
588
  interface TextOptions extends AssistOptions {}
587
589
  interface UrlOptions extends AssistOptions {}
588
590
  interface EmailOptions extends AssistOptions {}
589
- } //# sourceMappingURL=typeDefExtensions.d.ts.map
591
+ }
590
592
  declare const defaultLanguageOutputs: TranslationOutputsFunction;
591
593
  type GetUserInput = (args: {
592
594
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/assistTypes.ts","../src/fieldActions/customFieldActions.tsx","../src/translate/types.ts","../src/types.ts","../src/plugin.tsx","../src/schemas/serialize/SchemTypeTool.tsx","../src/schemas/typeDefExtensions.ts","../src/translate/paths.ts","../src/fieldActions/useUserInput.ts","../src/helpers/typeUtils.ts"],"mappings":";;;;UAEiB,YAAA;;;;AAAjB;;;;;;;;;;;AAiDa;AAGb;;EAlCE,cAAA,IAAkB,O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A;ERkCoC;;;EQ9BpC,KAAA;ER+BM;;;EQ3BN,WAAA;AAAA;AAAA,KAGU,iBAAA;ER4BmB;;;EQxB7B,KAAA,EAAO,WAAW;;APTpB;;EOcE,MAAA;AAAA;;;;;;APXM;AAGR;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6H+B;AAG/B;;;;;;;;;;;;AAG8B;AAE9B;;;;;;;;;;;;;iBO9DgB,YAAA,IAAgB,YAAY;;;;ARrG5C;;;iBSUgB,MAAA,CAAO,UAAA,EAAY,UAAU,EAAE,QAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/assistTypes.ts","../src/fieldActions/customFieldActions.tsx","../src/translate/types.ts","../src/types.ts","../src/plugin.tsx","../src/schemas/serialize/SchemTypeTool.tsx","../src/schemas/typeDefExtensions.ts","../src/translate/paths.ts","../src/fieldActions/useUserInput.ts","../src/helpers/typeUtils.ts"],"mappings":";;;;UAEiB;;;;;;;;;;;;;;;;;;EAkBf,kBAAkB,SAAS,0BAA0B;;;;;;;;;;;;;;;;EAiBrD;;;;;;;;;;;;;EAcA;;UAGe;EACf,MAAM;EACN,iBAAiB;;UAGF;;;;;;;;;;EAUf;;;;;;;;;;;EAYA;;UCvDe;EACf,MAAM;EACN;EACA;;UAGe;;;;;EAKf;;;;;;;;;;;;;;;;;;EAkBA;;;;;EAMA,oBAAoB;;;;;;;EAQpB,wBAAwB;;;;;;EAOxB,2BAA2B;;;;;;;;;;;;;;;;;;;;;;EAuB3B;;;;;;;;;;;;;;;;;;;;;EAsBA,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;EA0BN,YAAY;;;;;;;;;EAUZ,mBAAmB;;KAGT,wBACR,wBACA,yBACA;KAEQ,wBAAwB,KAClC;EAGA,uBAAuB;;KAGb,yBAAyB,KACnC;;;;;EAOA,WAAW;;iBAKG,wBACd,QAAQ,KAAK,iCACZ;iBAOa,4BAA4B;iBAM5B,6BACd,OAAO,KAAK,kCACX;UCxMc;EACf;EACA;;UA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B,oBAAoB;YACpB,wBAAwB;YACxB;IACR,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAmCT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAgCA;QAGM;;;;;;;QAOA;;;;YAIA,sBAAsB;YACtB,sBAAsB;YACtB;IACR;;MAEE;;;;;MAMA;;;YAGM,oBAAoB;YACpB,sBAAsB;YACtB,oBAAoB;YACpB,mBAAmB;YACnB,qBAAqB;;cCUpB,wBAAwB;KCrIzB,gBAAgB;;;;EAI1B;;;;EAIA,QAAQ;MACJ,QAAQ;;;;UAKG;;;;EAIf;;;;EAIA;;;;EAIA;;KAGU;;;;EAIV,OAAO;;;;EAKP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA+Dc,gBAAgB;;;;;;;iBC3FhB,OAAO,YAAY,YAAY"}
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { FormBuilder, FormCallbacksProvider, FormFieldHeaderText, FormInput, MemberFieldError, ObjectInputMember, PatchEvent, PerspectiveProvider, PresenceOverlay, StatusButton, VirtualizerScrollInstanceProvider, createPatchChannel, defineArrayMember, defineField, definePlugin, defineType, fromMutationPatches, getDraftId, getPublishedId, getVersionFromId, getVersionId, insert, isArrayOfObjectsSchemaType, isArraySchemaType, isDocumentSchemaType, isKeySegment, isObjectSchemaType, isRecord, isVersionId, pathToString, set, setIfMissing, stringToPath, typed, unset, useClient, useColorSchemeValue, useCurrentUser, useDocumentPresence, useDocumentStore, useEditState, useFormCallbacks, usePerspective, useSchema, useSyncState, useWorkspaceSchemaId } from "sanity";
2
2
  import { c } from "react/compiler-runtime";
3
3
  import { Autocomplete, Box, Breadcrumbs, Button, Card, Checkbox, Container, Dialog, ErrorBoundary, Flex, Label, Menu, MenuButton, MenuItem, Popover, Radio, Spinner, Stack, Switch, Text, TextArea, ThemeProvider, Tooltip, focusFirstDescendant, rgba, useClickOutside, useGlobalKeyDown, useLayer, useTheme, useToast } from "@sanity/ui";
4
- import { createContext, useCallback, useContext, useEffect, useEffectEvent, useId, useMemo, useReducer, useRef, useState } from "react";
4
+ import { createContext, isValidElement, useCallback, useContext, useEffect, useEffectEvent, useId, useMemo, useReducer, useRef, useState } from "react";
5
5
  import { DocumentInspectorHeader, DocumentPaneProvider, useDocumentPane, usePaneRouter } from "sanity/structure";
6
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
7
  import { addSeconds, formatDistanceToNow, isAfter, minutesToMilliseconds } from "date-fns";
@@ -328,7 +328,7 @@ function isSchemaAssistEnabled(type) {
328
328
  return !type.options?.aiAssist?.exclude;
329
329
  }
330
330
  function isAssistSupported(type) {
331
- return !isSchemaAssistEnabled(type) || isDisabled(type) ? !1 : type.jsonType === "array" ? !type.of.every((t) => isDisabled(t)) : type.jsonType === "object" ? !type.fields.every((field) => isDisabled(field.type)) || isType(type, "image") : !0;
331
+ return !isSchemaAssistEnabled(type) || isDisabled(type) ? !1 : type.jsonType === "array" ? !type.of.every((t) => isDisabled(t)) : type.jsonType !== "object" || !type.fields.every((field) => isDisabled(field.type)) || isType(type, "image");
332
332
  }
333
333
  function isDisabled(type) {
334
334
  return !isSchemaAssistEnabled(type) || isUnsupportedType(type);
@@ -1180,16 +1180,16 @@ const Root = styled.span.withConfig({
1180
1180
  componentId: "sc-6srsjv-2"
1181
1181
  })`background:var(--ai-avatar-disc-color);color:white;width:21px;height:21px;display:flex;align-items:center;justify-content:center;border-radius:10.5px;position:absolute;top:2px;left:2px;`;
1182
1182
  function AssistAvatar(props) {
1183
- let { state = "present" } = props, scheme = useColorSchemeValue();
1183
+ let { state = "present" } = props, scheme = useColorSchemeValue(), style = useMemo(() => scheme === "dark" ? {
1184
+ "--ai-avatar-stroke-color": purple[400].hex,
1185
+ "--ai-avatar-disc-color": purple[600].hex
1186
+ } : {
1187
+ "--ai-avatar-stroke-color": purple[500].hex,
1188
+ "--ai-avatar-disc-color": purple[600].hex
1189
+ }, [scheme]);
1184
1190
  return /* @__PURE__ */ jsxs(Root, {
1185
1191
  "data-state": state,
1186
- style: useMemo(() => scheme === "dark" ? {
1187
- "--ai-avatar-stroke-color": purple[400].hex,
1188
- "--ai-avatar-disc-color": purple[600].hex
1189
- } : {
1190
- "--ai-avatar-stroke-color": purple[500].hex,
1191
- "--ai-avatar-disc-color": purple[600].hex
1192
- }, [scheme]),
1192
+ style,
1193
1193
  children: [/* @__PURE__ */ jsx(Outline, {
1194
1194
  width: "25",
1195
1195
  height: "25",
@@ -1773,7 +1773,7 @@ function FieldAutocomplete(props) {
1773
1773
  let currentField = t1, t2;
1774
1774
  if ($[11] !== fieldRefs || $[12] !== filter) {
1775
1775
  let t3;
1776
- $[14] === filter ? t3 = $[15] : (t3 = (field) => filter ? filter(field) : !0, $[14] = filter, $[15] = t3), t2 = fieldRefs.filter(t3).filter(_temp$8).map(_temp2$4), $[11] = fieldRefs, $[12] = filter, $[13] = t2;
1776
+ $[14] === filter ? t3 = $[15] : (t3 = (field) => !filter || filter(field), $[14] = filter, $[15] = t3), t2 = fieldRefs.filter(t3).filter(_temp$8).map(_temp2$4), $[11] = fieldRefs, $[12] = filter, $[13] = t2;
1777
1777
  } else t2 = $[13];
1778
1778
  let autocompleteOptions = t2, renderOption = _temp3$2, renderValue = _temp4$1, filterOption = _temp5, t3 = currentField ? currentField.icon : SearchIcon, t4 = currentField?.key, t5;
1779
1779
  return $[16] !== autocompleteOptions || $[17] !== id || $[18] !== onSelect || $[19] !== t3 || $[20] !== t4 ? (t5 = /* @__PURE__ */ jsx(Autocomplete, {
@@ -2615,7 +2615,7 @@ const getLanguageParams = (select, document) => {
2615
2615
  let selection = select || {}, selectedValue = {};
2616
2616
  for (let [key, path] of Object.entries(selection)) {
2617
2617
  let value = get(document, path);
2618
- Array.isArray(value) && (value = value.filter((item) => typeof item == "object" ? item?._type !== "reference" || "_ref" in item : !0)), selectedValue[key] = value;
2618
+ Array.isArray(value) && (value = value.filter((item) => typeof item != "object" || item?._type !== "reference" || "_ref" in item)), selectedValue[key] = value;
2619
2619
  }
2620
2620
  return selectedValue;
2621
2621
  }, toFieldLanguagesKeyPrefix = "sanityStudio:assist:field-languages:from:";
@@ -2759,10 +2759,13 @@ function FieldTranslationProvider(props) {
2759
2759
  setFieldLanguageMaps(void 0);
2760
2760
  return;
2761
2761
  }
2762
- let preferred = getPreferredToFieldLanguages(from.id), allToLanguages = languages_0.filter((l) => l.id !== from?.id);
2763
- setToLanguages(allToLanguages.filter((l_0) => !preferred.length || preferred.includes(l_0.id)));
2762
+ let preferred = getPreferredToFieldLanguages(from.id), allToLanguages = languages_0.filter((l) => l.id !== from?.id), filteredToLanguages = allToLanguages.filter((l_0) => !preferred.length || preferred.includes(l_0.id));
2763
+ setToLanguages(filteredToLanguages);
2764
2764
  let fromId = from?.id, allToIds = allToLanguages?.map(_temp$4) ?? [], docMembers = getDocumentMembersFlat(document, documentSchema, config?.maxPathDepth);
2765
- fromId && allToIds?.length ? setFieldLanguageMaps(getFieldLanguageMap(documentSchema, docMembers, fromId, allToIds.filter((toId) => fromId !== toId), config?.translationOutputs ?? defaultLanguageOutputs)) : setFieldLanguageMaps(void 0);
2765
+ if (fromId && allToIds?.length) {
2766
+ let transMap = getFieldLanguageMap(documentSchema, docMembers, fromId, allToIds.filter((toId) => fromId !== toId), config?.translationOutputs ?? defaultLanguageOutputs);
2767
+ setFieldLanguageMaps(transMap);
2768
+ } else setFieldLanguageMaps(void 0);
2766
2769
  }, $[3] = config?.maxPathDepth, $[4] = config?.translationOutputs, $[5] = t3) : t3 = $[5];
2767
2770
  let selectFromLanguage = t3, t4;
2768
2771
  $[6] === fromLanguage ? t4 = $[7] : (t4 = (toggledLang, toLanguages_0, languages_1) => {
@@ -3082,7 +3085,9 @@ function AiAssistanceConfigProvider(props) {
3082
3085
  $[5] !== getInstructStatus || $[6] !== initInstruct ? (t3 = async () => {
3083
3086
  setError(void 0);
3084
3087
  try {
3085
- await initInstruct(), setStatus(await getInstructStatus());
3088
+ await initInstruct();
3089
+ let status_0 = await getInstructStatus();
3090
+ setStatus(status_0);
3086
3091
  } catch (t4) {
3087
3092
  let e_0 = t4;
3088
3093
  console.error("Failed to init ai assistance", e_0), setError(e_0);
@@ -3649,7 +3654,7 @@ const assistFieldActions = {
3649
3654
  translateAction,
3650
3655
  ...customActions,
3651
3656
  assistSupported && manageInstructionsItem
3652
- ].filter((c) => !!c).filter((c) => c.type === "group" ? c.children.length : !0),
3657
+ ].filter((c) => !!c).filter((c) => c.type !== "group" || c.children.length),
3653
3658
  expanded: !1,
3654
3659
  renderAsButton: !0,
3655
3660
  hidden: !assistSupported && !imageCaptionAction && !translateAction && !imageGenAction
@@ -4702,19 +4707,19 @@ const contextDocumentSchema = defineType({
4702
4707
  components: {
4703
4708
  input: InstructionInput,
4704
4709
  preview: (props) => {
4705
- let Icon = props.icon;
4710
+ let IconValue = props.icon, icon = isValidElement(IconValue) ? IconValue : IconValue ? /* @__PURE__ */ jsx(IconValue, {}) : null;
4706
4711
  return /* @__PURE__ */ jsxs(Flex, {
4707
4712
  gap: 3,
4708
4713
  align: "center",
4709
4714
  padding: 2,
4710
4715
  children: [
4711
- Icon && /* @__PURE__ */ jsx(Box, {
4716
+ icon ? /* @__PURE__ */ jsx(Box, {
4712
4717
  flex: "none",
4713
4718
  children: /* @__PURE__ */ jsx(Text, {
4714
4719
  size: 1,
4715
- children: /* @__PURE__ */ jsx(Icon, {})
4720
+ children: icon
4716
4721
  })
4717
- }),
4722
+ }) : null,
4718
4723
  /* @__PURE__ */ jsx(Stack, {
4719
4724
  flex: 1,
4720
4725
  gap: 2,
@@ -4986,7 +4991,7 @@ function isWelcomeEvent(event) {
4986
4991
  /** @internal */
4987
4992
  const listenQuery = (client, query, params = {}, options = {}) => {
4988
4993
  let fetchQuery = typeof query == "string" ? query : query.fetch, listenerQuery = typeof query == "string" ? query : query.listen, fetchOnce$ = fetch(client, fetchQuery, params, options), [welcome$, mutationAndReconnect$] = partition(listen(client, listenerQuery, params, options).pipe(mergeMap((ev, i) => i === 0 && !isWelcomeEvent(ev) ? throwError(/* @__PURE__ */ Error(ev.type === "reconnect" ? "Could not establish EventSource connection" : `Received unexpected type of first event "${ev.type}"`)) : of(ev)), share()), isWelcomeEvent);
4989
- return merge(welcome$.pipe(take(1)), mutationAndReconnect$.pipe(filter((event) => !options.transitions || event.type !== "mutation" ? !0 : options.transitions.includes(event.transition)), switchMap((event) => merge(of(event), of(event).pipe(delay(options.throttleTime || 1e3)))))).pipe(exhaustMapToWithTrailing(fetchOnce$));
4994
+ return merge(welcome$.pipe(take(1)), mutationAndReconnect$.pipe(filter((event) => !options.transitions || event.type !== "mutation" || options.transitions.includes(event.transition)), switchMap((event) => merge(of(event), of(event).pipe(delay(options.throttleTime || 1e3)))))).pipe(exhaustMapToWithTrailing(fetchOnce$));
4990
4995
  }, DEFAULT_PARAMS = {}, DEFAULT_OPTIONS = { apiVersion: "v2022-05-09" };
4991
4996
  function useListeningQuery(query, t0, t1) {
4992
4997
  let $ = c(11), params = t0 === void 0 ? DEFAULT_PARAMS : t0, options = t1 === void 0 ? DEFAULT_OPTIONS : t1, [loading, setLoading] = useState(!0), [error, setError] = useState(!1), [data, setData] = useState(null), subscription = useRef(null), t2;