@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 +26 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -22
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
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 */
|
|
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 */
|
|
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
|
-
}
|
|
591
|
+
}
|
|
590
592
|
declare const defaultLanguageOutputs: TranslationOutputsFunction;
|
|
591
593
|
type GetUserInput = (args: {
|
|
592
594
|
/**
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,
|
|
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":"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"}
|
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
|
|
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
|
|
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
|
|
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
|
|
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(
|
|
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
|
|
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()
|
|
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
|
|
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
|
|
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
|
-
|
|
4716
|
+
icon ? /* @__PURE__ */ jsx(Box, {
|
|
4712
4717
|
flex: "none",
|
|
4713
4718
|
children: /* @__PURE__ */ jsx(Text, {
|
|
4714
4719
|
size: 1,
|
|
4715
|
-
children:
|
|
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"
|
|
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;
|