@sanity/assist 1.2.14 → 1.2.15-lang.10

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 (334) hide show
  1. package/README.md +546 -24
  2. package/dist/index.cjs.mjs +1 -0
  3. package/dist/index.d.ts +253 -11
  4. package/dist/index.esm.js +2367 -393
  5. package/dist/index.esm.js.map +1 -1
  6. package/dist/index.js +2361 -386
  7. package/dist/index.js.map +1 -1
  8. package/package.json +15 -14
  9. package/src/_lib/form/DocumentForm.tsx +3 -2
  10. package/src/_lib/form/constants.ts +1 -0
  11. package/src/assistDocument/AssistDocumentInput.tsx +24 -4
  12. package/src/assistDocument/RequestRunInstructionProvider.tsx +37 -21
  13. package/src/assistDocument/components/instruction/InstructionInput.tsx +5 -4
  14. package/src/assistDocument/components/instruction/InstructionOutputField.tsx +45 -0
  15. package/src/assistDocument/components/instruction/InstructionOutputInput.tsx +205 -0
  16. package/src/assistDocument/hooks/useStudioAssistDocument.ts +5 -32
  17. package/src/assistFormComponents/AssistField.tsx +11 -5
  18. package/src/assistFormComponents/AssistFormBlock.tsx +2 -3
  19. package/src/assistFormComponents/validation/listItem.tsx +2 -2
  20. package/src/assistInspector/AssistInspector.tsx +6 -0
  21. package/src/assistInspector/FieldAutocomplete.tsx +1 -0
  22. package/src/assistInspector/InstructionTaskHistoryButton.tsx +2 -3
  23. package/src/assistInspector/helpers.ts +9 -11
  24. package/src/assistLayout/AssistLayout.tsx +9 -9
  25. package/src/components/ImageContext.tsx +19 -9
  26. package/src/components/SafeValueInput.tsx +4 -1
  27. package/src/coverage/.tmp/coverage-0.json +1 -0
  28. package/src/coverage/base.css +224 -0
  29. package/src/coverage/block-navigation.js +87 -0
  30. package/src/coverage/clover.xml +8613 -0
  31. package/src/coverage/coverage-final.json +107 -0
  32. package/src/coverage/favicon.png +0 -0
  33. package/src/coverage/index.html +461 -0
  34. package/src/coverage/lcov-report/base.css +224 -0
  35. package/src/coverage/lcov-report/block-navigation.js +87 -0
  36. package/src/coverage/lcov-report/favicon.png +0 -0
  37. package/src/coverage/lcov-report/index.html +461 -0
  38. package/src/coverage/lcov-report/prettify.css +1 -0
  39. package/src/coverage/lcov-report/prettify.js +2 -0
  40. package/src/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  41. package/src/coverage/lcov-report/sorter.js +196 -0
  42. package/src/coverage/lcov-report/src/_lib/connector/ConnectFromRegion.tsx.html +157 -0
  43. package/src/coverage/lcov-report/src/_lib/connector/ConnectToRegion.tsx.html +151 -0
  44. package/src/coverage/lcov-report/src/_lib/connector/ConnectorRegion.tsx.html +154 -0
  45. package/src/coverage/lcov-report/src/_lib/connector/ConnectorsProvider.tsx.html +142 -0
  46. package/src/coverage/lcov-report/src/_lib/connector/ConnectorsStore.ts.html +451 -0
  47. package/src/coverage/lcov-report/src/_lib/connector/ConnectorsStoreContext.ts.html +97 -0
  48. package/src/coverage/lcov-report/src/_lib/connector/helpers.ts.html +100 -0
  49. package/src/coverage/lcov-report/src/_lib/connector/index.html +281 -0
  50. package/src/coverage/lcov-report/src/_lib/connector/index.ts.html +112 -0
  51. package/src/coverage/lcov-report/src/_lib/connector/mapConnectorToLine.ts.html +334 -0
  52. package/src/coverage/lcov-report/src/_lib/connector/types.ts.html +253 -0
  53. package/src/coverage/lcov-report/src/_lib/connector/useConnectorsStore.ts.html +124 -0
  54. package/src/coverage/lcov-report/src/_lib/connector/useRegionRects.ts.html +508 -0
  55. package/src/coverage/lcov-report/src/_lib/fixedListenQuery.ts.html +388 -0
  56. package/src/coverage/lcov-report/src/_lib/form/DocumentForm.tsx.html +676 -0
  57. package/src/coverage/lcov-report/src/_lib/form/helpers.ts.html +178 -0
  58. package/src/coverage/lcov-report/src/_lib/form/index.html +146 -0
  59. package/src/coverage/lcov-report/src/_lib/form/index.ts.html +88 -0
  60. package/src/coverage/lcov-report/src/_lib/index.html +161 -0
  61. package/src/coverage/lcov-report/src/_lib/randomKey.ts.html +172 -0
  62. package/src/coverage/lcov-report/src/_lib/useListeningQuery.ts.html +268 -0
  63. package/src/coverage/lcov-report/src/_lib/usePrevious.ts.html +112 -0
  64. package/src/coverage/lcov-report/src/assistConnectors/AssistConnectorsOverlay.tsx.html +481 -0
  65. package/src/coverage/lcov-report/src/assistConnectors/ConnectorPath.tsx.html +271 -0
  66. package/src/coverage/lcov-report/src/assistConnectors/draw/arrowPath.ts.html +112 -0
  67. package/src/coverage/lcov-report/src/assistConnectors/draw/connectorPath.ts.html +511 -0
  68. package/src/coverage/lcov-report/src/assistConnectors/draw/index.html +131 -0
  69. package/src/coverage/lcov-report/src/assistConnectors/index.html +146 -0
  70. package/src/coverage/lcov-report/src/assistConnectors/index.ts.html +88 -0
  71. package/src/coverage/lcov-report/src/assistDocument/AssistDocumentContext.tsx.html +178 -0
  72. package/src/coverage/lcov-report/src/assistDocument/AssistDocumentContextProvider.tsx.html +136 -0
  73. package/src/coverage/lcov-report/src/assistDocument/AssistDocumentInput.tsx.html +280 -0
  74. package/src/coverage/lcov-report/src/assistDocument/RequestRunInstructionProvider.tsx.html +283 -0
  75. package/src/coverage/lcov-report/src/assistDocument/components/AssistDocumentForm.tsx.html +775 -0
  76. package/src/coverage/lcov-report/src/assistDocument/components/FieldRefPreview.tsx.html +166 -0
  77. package/src/coverage/lcov-report/src/assistDocument/components/InstructionsArrayField.tsx.html +109 -0
  78. package/src/coverage/lcov-report/src/assistDocument/components/InstructionsArrayInput.tsx.html +163 -0
  79. package/src/coverage/lcov-report/src/assistDocument/components/SelectedFieldContext.tsx.html +115 -0
  80. package/src/coverage/lcov-report/src/assistDocument/components/generic/HiddenFieldTitle.tsx.html +100 -0
  81. package/src/coverage/lcov-report/src/assistDocument/components/generic/index.html +116 -0
  82. package/src/coverage/lcov-report/src/assistDocument/components/helpers.ts.html +148 -0
  83. package/src/coverage/lcov-report/src/assistDocument/components/index.html +191 -0
  84. package/src/coverage/lcov-report/src/assistDocument/components/instruction/BackToInstructionsLink.tsx.html +178 -0
  85. package/src/coverage/lcov-report/src/assistDocument/components/instruction/FieldRefInput.tsx.html +244 -0
  86. package/src/coverage/lcov-report/src/assistDocument/components/instruction/InstructionInput.tsx.html +349 -0
  87. package/src/coverage/lcov-report/src/assistDocument/components/instruction/InstructionOutputField.tsx.html +220 -0
  88. package/src/coverage/lcov-report/src/assistDocument/components/instruction/InstructionOutputInput.tsx.html +700 -0
  89. package/src/coverage/lcov-report/src/assistDocument/components/instruction/PromptInput.tsx.html +241 -0
  90. package/src/coverage/lcov-report/src/assistDocument/components/instruction/appearance/IconInput.tsx.html +223 -0
  91. package/src/coverage/lcov-report/src/assistDocument/components/instruction/appearance/InstructionVisibility.tsx.html +196 -0
  92. package/src/coverage/lcov-report/src/assistDocument/components/instruction/appearance/index.html +131 -0
  93. package/src/coverage/lcov-report/src/assistDocument/components/instruction/index.html +191 -0
  94. package/src/coverage/lcov-report/src/assistDocument/hooks/index.html +161 -0
  95. package/src/coverage/lcov-report/src/assistDocument/hooks/useAssistDocumentContextValue.tsx.html +289 -0
  96. package/src/coverage/lcov-report/src/assistDocument/hooks/useDocumentState.ts.html +103 -0
  97. package/src/coverage/lcov-report/src/assistDocument/hooks/useInstructionToaster.tsx.html +307 -0
  98. package/src/coverage/lcov-report/src/assistDocument/hooks/useStudioAssistDocument.ts.html +379 -0
  99. package/src/coverage/lcov-report/src/assistDocument/index.html +176 -0
  100. package/src/coverage/lcov-report/src/assistDocument/index.ts.html +88 -0
  101. package/src/coverage/lcov-report/src/assistFormComponents/AssistField.tsx.html +301 -0
  102. package/src/coverage/lcov-report/src/assistFormComponents/AssistFormBlock.tsx.html +175 -0
  103. package/src/coverage/lcov-report/src/assistFormComponents/AssistInlineFormBlock.tsx.html +124 -0
  104. package/src/coverage/lcov-report/src/assistFormComponents/AssistItem.tsx.html +145 -0
  105. package/src/coverage/lcov-report/src/assistFormComponents/index.html +161 -0
  106. package/src/coverage/lcov-report/src/assistFormComponents/validation/index.html +131 -0
  107. package/src/coverage/lcov-report/src/assistFormComponents/validation/listItem.tsx.html +274 -0
  108. package/src/coverage/lcov-report/src/assistFormComponents/validation/validationList.tsx.html +352 -0
  109. package/src/coverage/lcov-report/src/assistInspector/AssistInspector.tsx.html +1318 -0
  110. package/src/coverage/lcov-report/src/assistInspector/FieldAutocomplete.tsx.html +505 -0
  111. package/src/coverage/lcov-report/src/assistInspector/InstructionTaskHistoryButton.tsx.html +865 -0
  112. package/src/coverage/lcov-report/src/assistInspector/constants.ts.html +88 -0
  113. package/src/coverage/lcov-report/src/assistInspector/helpers.ts.html +724 -0
  114. package/src/coverage/lcov-report/src/assistInspector/index.html +191 -0
  115. package/src/coverage/lcov-report/src/assistInspector/index.ts.html +163 -0
  116. package/src/coverage/lcov-report/src/assistLayout/AiAssistanceConfigContext.tsx.html +331 -0
  117. package/src/coverage/lcov-report/src/assistLayout/AssistLayout.tsx.html +199 -0
  118. package/src/coverage/lcov-report/src/assistLayout/RunInstructionProvider.tsx.html +751 -0
  119. package/src/coverage/lcov-report/src/assistLayout/index.html +146 -0
  120. package/src/coverage/lcov-report/src/components/AssistFeatureBadge.tsx.html +112 -0
  121. package/src/coverage/lcov-report/src/components/FadeInContent.tsx.html +205 -0
  122. package/src/coverage/lcov-report/src/components/HideReferenceChangedBannerInput.tsx.html +160 -0
  123. package/src/coverage/lcov-report/src/components/ImageContext.tsx.html +229 -0
  124. package/src/coverage/lcov-report/src/components/SafeValueInput.tsx.html +313 -0
  125. package/src/coverage/lcov-report/src/components/TimeAgo.tsx.html +139 -0
  126. package/src/coverage/lcov-report/src/components/index.html +191 -0
  127. package/src/coverage/lcov-report/src/constants.ts.html +145 -0
  128. package/src/coverage/lcov-report/src/fieldActions/PrivateIcon.tsx.html +145 -0
  129. package/src/coverage/lcov-report/src/fieldActions/assistFieldActions.tsx.html +907 -0
  130. package/src/coverage/lcov-report/src/fieldActions/generateCaptionActions.tsx.html +259 -0
  131. package/src/coverage/lcov-report/src/fieldActions/generateImageActions.tsx.html +256 -0
  132. package/src/coverage/lcov-report/src/fieldActions/index.html +161 -0
  133. package/src/coverage/lcov-report/src/helpers/assistSupported.ts.html +226 -0
  134. package/src/coverage/lcov-report/src/helpers/conditionalMembers.ts.html +466 -0
  135. package/src/coverage/lcov-report/src/helpers/ids.ts.html +142 -0
  136. package/src/coverage/lcov-report/src/helpers/index.html +191 -0
  137. package/src/coverage/lcov-report/src/helpers/misc.ts.html +133 -0
  138. package/src/coverage/lcov-report/src/helpers/typeUtils.ts.html +208 -0
  139. package/src/coverage/lcov-report/src/helpers/useAssistSupported.ts.html +106 -0
  140. package/src/coverage/lcov-report/src/index.html +176 -0
  141. package/src/coverage/lcov-report/src/index.ts.html +112 -0
  142. package/src/coverage/lcov-report/src/onboarding/FieldActionsOnboarding.tsx.html +286 -0
  143. package/src/coverage/lcov-report/src/onboarding/FirstAssistedPathProvider.tsx.html +172 -0
  144. package/src/coverage/lcov-report/src/onboarding/InspectorOnboarding.tsx.html +223 -0
  145. package/src/coverage/lcov-report/src/onboarding/index.html +161 -0
  146. package/src/coverage/lcov-report/src/onboarding/onboardingStore.ts.html +184 -0
  147. package/src/coverage/lcov-report/src/plugin.tsx.html +427 -0
  148. package/src/coverage/lcov-report/src/presence/AiFieldPresence.tsx.html +163 -0
  149. package/src/coverage/lcov-report/src/presence/AssistAvatar.tsx.html +373 -0
  150. package/src/coverage/lcov-report/src/presence/AssistDocumentPresence.tsx.html +259 -0
  151. package/src/coverage/lcov-report/src/presence/index.html +161 -0
  152. package/src/coverage/lcov-report/src/presence/useAssistPresence.ts.html +268 -0
  153. package/src/coverage/lcov-report/src/schemas/assistDocumentSchema.tsx.html +1552 -0
  154. package/src/coverage/lcov-report/src/schemas/contextDocumentSchema.tsx.html +253 -0
  155. package/src/coverage/lcov-report/src/schemas/index.html +176 -0
  156. package/src/coverage/lcov-report/src/schemas/index.ts.html +277 -0
  157. package/src/coverage/lcov-report/src/schemas/serialize/SchemTypeTool.tsx.html +391 -0
  158. package/src/coverage/lcov-report/src/schemas/serialize/index.html +146 -0
  159. package/src/coverage/lcov-report/src/schemas/serialize/schemaUtils.ts.html +196 -0
  160. package/src/coverage/lcov-report/src/schemas/serialize/serializeSchema.ts.html +754 -0
  161. package/src/coverage/lcov-report/src/schemas/serializedSchemaTypeSchema.ts.html +262 -0
  162. package/src/coverage/lcov-report/src/schemas/typeDefExtensions.ts.html +397 -0
  163. package/src/coverage/lcov-report/src/translate/FieldTranslationProvider.tsx.html +1003 -0
  164. package/src/coverage/lcov-report/src/translate/getLanguageParams.ts.html +163 -0
  165. package/src/coverage/lcov-report/src/translate/index.html +191 -0
  166. package/src/coverage/lcov-report/src/translate/languageStore.ts.html +139 -0
  167. package/src/coverage/lcov-report/src/translate/paths.ts.html +577 -0
  168. package/src/coverage/lcov-report/src/translate/translateActions.tsx.html +637 -0
  169. package/src/coverage/lcov-report/src/translate/types.ts.html +565 -0
  170. package/src/coverage/lcov-report/src/types.ts.html +649 -0
  171. package/src/coverage/lcov-report/src/useApiClient.ts.html +1015 -0
  172. package/src/coverage/lcov.info +9519 -0
  173. package/src/coverage/prettify.css +1 -0
  174. package/src/coverage/prettify.js +2 -0
  175. package/src/coverage/sort-arrow-sprite.png +0 -0
  176. package/src/coverage/sorter.js +196 -0
  177. package/src/coverage/src/_lib/connector/ConnectFromRegion.tsx.html +157 -0
  178. package/src/coverage/src/_lib/connector/ConnectToRegion.tsx.html +151 -0
  179. package/src/coverage/src/_lib/connector/ConnectorRegion.tsx.html +154 -0
  180. package/src/coverage/src/_lib/connector/ConnectorsProvider.tsx.html +142 -0
  181. package/src/coverage/src/_lib/connector/ConnectorsStore.ts.html +451 -0
  182. package/src/coverage/src/_lib/connector/ConnectorsStoreContext.ts.html +97 -0
  183. package/src/coverage/src/_lib/connector/helpers.ts.html +100 -0
  184. package/src/coverage/src/_lib/connector/index.html +281 -0
  185. package/src/coverage/src/_lib/connector/index.ts.html +112 -0
  186. package/src/coverage/src/_lib/connector/mapConnectorToLine.ts.html +334 -0
  187. package/src/coverage/src/_lib/connector/types.ts.html +253 -0
  188. package/src/coverage/src/_lib/connector/useConnectorsStore.ts.html +124 -0
  189. package/src/coverage/src/_lib/connector/useRegionRects.ts.html +508 -0
  190. package/src/coverage/src/_lib/fixedListenQuery.ts.html +388 -0
  191. package/src/coverage/src/_lib/form/DocumentForm.tsx.html +676 -0
  192. package/src/coverage/src/_lib/form/helpers.ts.html +178 -0
  193. package/src/coverage/src/_lib/form/index.html +146 -0
  194. package/src/coverage/src/_lib/form/index.ts.html +88 -0
  195. package/src/coverage/src/_lib/index.html +161 -0
  196. package/src/coverage/src/_lib/randomKey.ts.html +172 -0
  197. package/src/coverage/src/_lib/useListeningQuery.ts.html +268 -0
  198. package/src/coverage/src/_lib/usePrevious.ts.html +112 -0
  199. package/src/coverage/src/assistConnectors/AssistConnectorsOverlay.tsx.html +481 -0
  200. package/src/coverage/src/assistConnectors/ConnectorPath.tsx.html +271 -0
  201. package/src/coverage/src/assistConnectors/draw/arrowPath.ts.html +112 -0
  202. package/src/coverage/src/assistConnectors/draw/connectorPath.ts.html +511 -0
  203. package/src/coverage/src/assistConnectors/draw/index.html +131 -0
  204. package/src/coverage/src/assistConnectors/index.html +146 -0
  205. package/src/coverage/src/assistConnectors/index.ts.html +88 -0
  206. package/src/coverage/src/assistDocument/AssistDocumentContext.tsx.html +178 -0
  207. package/src/coverage/src/assistDocument/AssistDocumentContextProvider.tsx.html +136 -0
  208. package/src/coverage/src/assistDocument/AssistDocumentInput.tsx.html +280 -0
  209. package/src/coverage/src/assistDocument/RequestRunInstructionProvider.tsx.html +283 -0
  210. package/src/coverage/src/assistDocument/components/AssistDocumentForm.tsx.html +775 -0
  211. package/src/coverage/src/assistDocument/components/FieldRefPreview.tsx.html +166 -0
  212. package/src/coverage/src/assistDocument/components/InstructionsArrayField.tsx.html +109 -0
  213. package/src/coverage/src/assistDocument/components/InstructionsArrayInput.tsx.html +163 -0
  214. package/src/coverage/src/assistDocument/components/SelectedFieldContext.tsx.html +115 -0
  215. package/src/coverage/src/assistDocument/components/generic/HiddenFieldTitle.tsx.html +100 -0
  216. package/src/coverage/src/assistDocument/components/generic/index.html +116 -0
  217. package/src/coverage/src/assistDocument/components/helpers.ts.html +148 -0
  218. package/src/coverage/src/assistDocument/components/index.html +191 -0
  219. package/src/coverage/src/assistDocument/components/instruction/BackToInstructionsLink.tsx.html +178 -0
  220. package/src/coverage/src/assistDocument/components/instruction/FieldRefInput.tsx.html +244 -0
  221. package/src/coverage/src/assistDocument/components/instruction/InstructionInput.tsx.html +349 -0
  222. package/src/coverage/src/assistDocument/components/instruction/InstructionOutputField.tsx.html +220 -0
  223. package/src/coverage/src/assistDocument/components/instruction/InstructionOutputInput.tsx.html +700 -0
  224. package/src/coverage/src/assistDocument/components/instruction/PromptInput.tsx.html +241 -0
  225. package/src/coverage/src/assistDocument/components/instruction/appearance/IconInput.tsx.html +223 -0
  226. package/src/coverage/src/assistDocument/components/instruction/appearance/InstructionVisibility.tsx.html +196 -0
  227. package/src/coverage/src/assistDocument/components/instruction/appearance/index.html +131 -0
  228. package/src/coverage/src/assistDocument/components/instruction/index.html +191 -0
  229. package/src/coverage/src/assistDocument/hooks/index.html +161 -0
  230. package/src/coverage/src/assistDocument/hooks/useAssistDocumentContextValue.tsx.html +289 -0
  231. package/src/coverage/src/assistDocument/hooks/useDocumentState.ts.html +103 -0
  232. package/src/coverage/src/assistDocument/hooks/useInstructionToaster.tsx.html +307 -0
  233. package/src/coverage/src/assistDocument/hooks/useStudioAssistDocument.ts.html +379 -0
  234. package/src/coverage/src/assistDocument/index.html +176 -0
  235. package/src/coverage/src/assistDocument/index.ts.html +88 -0
  236. package/src/coverage/src/assistFormComponents/AssistField.tsx.html +301 -0
  237. package/src/coverage/src/assistFormComponents/AssistFormBlock.tsx.html +175 -0
  238. package/src/coverage/src/assistFormComponents/AssistInlineFormBlock.tsx.html +124 -0
  239. package/src/coverage/src/assistFormComponents/AssistItem.tsx.html +145 -0
  240. package/src/coverage/src/assistFormComponents/index.html +161 -0
  241. package/src/coverage/src/assistFormComponents/validation/index.html +131 -0
  242. package/src/coverage/src/assistFormComponents/validation/listItem.tsx.html +274 -0
  243. package/src/coverage/src/assistFormComponents/validation/validationList.tsx.html +352 -0
  244. package/src/coverage/src/assistInspector/AssistInspector.tsx.html +1318 -0
  245. package/src/coverage/src/assistInspector/FieldAutocomplete.tsx.html +505 -0
  246. package/src/coverage/src/assistInspector/InstructionTaskHistoryButton.tsx.html +865 -0
  247. package/src/coverage/src/assistInspector/constants.ts.html +88 -0
  248. package/src/coverage/src/assistInspector/helpers.ts.html +724 -0
  249. package/src/coverage/src/assistInspector/index.html +191 -0
  250. package/src/coverage/src/assistInspector/index.ts.html +163 -0
  251. package/src/coverage/src/assistLayout/AiAssistanceConfigContext.tsx.html +331 -0
  252. package/src/coverage/src/assistLayout/AssistLayout.tsx.html +199 -0
  253. package/src/coverage/src/assistLayout/RunInstructionProvider.tsx.html +751 -0
  254. package/src/coverage/src/assistLayout/index.html +146 -0
  255. package/src/coverage/src/components/AssistFeatureBadge.tsx.html +112 -0
  256. package/src/coverage/src/components/FadeInContent.tsx.html +205 -0
  257. package/src/coverage/src/components/HideReferenceChangedBannerInput.tsx.html +160 -0
  258. package/src/coverage/src/components/ImageContext.tsx.html +229 -0
  259. package/src/coverage/src/components/SafeValueInput.tsx.html +313 -0
  260. package/src/coverage/src/components/TimeAgo.tsx.html +139 -0
  261. package/src/coverage/src/components/index.html +191 -0
  262. package/src/coverage/src/constants.ts.html +145 -0
  263. package/src/coverage/src/fieldActions/PrivateIcon.tsx.html +145 -0
  264. package/src/coverage/src/fieldActions/assistFieldActions.tsx.html +907 -0
  265. package/src/coverage/src/fieldActions/generateCaptionActions.tsx.html +259 -0
  266. package/src/coverage/src/fieldActions/generateImageActions.tsx.html +256 -0
  267. package/src/coverage/src/fieldActions/index.html +161 -0
  268. package/src/coverage/src/helpers/assistSupported.ts.html +226 -0
  269. package/src/coverage/src/helpers/conditionalMembers.ts.html +466 -0
  270. package/src/coverage/src/helpers/ids.ts.html +142 -0
  271. package/src/coverage/src/helpers/index.html +191 -0
  272. package/src/coverage/src/helpers/misc.ts.html +133 -0
  273. package/src/coverage/src/helpers/typeUtils.ts.html +208 -0
  274. package/src/coverage/src/helpers/useAssistSupported.ts.html +106 -0
  275. package/src/coverage/src/index.html +176 -0
  276. package/src/coverage/src/index.ts.html +112 -0
  277. package/src/coverage/src/onboarding/FieldActionsOnboarding.tsx.html +286 -0
  278. package/src/coverage/src/onboarding/FirstAssistedPathProvider.tsx.html +172 -0
  279. package/src/coverage/src/onboarding/InspectorOnboarding.tsx.html +223 -0
  280. package/src/coverage/src/onboarding/index.html +161 -0
  281. package/src/coverage/src/onboarding/onboardingStore.ts.html +184 -0
  282. package/src/coverage/src/plugin.tsx.html +427 -0
  283. package/src/coverage/src/presence/AiFieldPresence.tsx.html +163 -0
  284. package/src/coverage/src/presence/AssistAvatar.tsx.html +373 -0
  285. package/src/coverage/src/presence/AssistDocumentPresence.tsx.html +259 -0
  286. package/src/coverage/src/presence/index.html +161 -0
  287. package/src/coverage/src/presence/useAssistPresence.ts.html +268 -0
  288. package/src/coverage/src/schemas/assistDocumentSchema.tsx.html +1552 -0
  289. package/src/coverage/src/schemas/contextDocumentSchema.tsx.html +253 -0
  290. package/src/coverage/src/schemas/index.html +176 -0
  291. package/src/coverage/src/schemas/index.ts.html +277 -0
  292. package/src/coverage/src/schemas/serialize/SchemTypeTool.tsx.html +391 -0
  293. package/src/coverage/src/schemas/serialize/index.html +146 -0
  294. package/src/coverage/src/schemas/serialize/schemaUtils.ts.html +196 -0
  295. package/src/coverage/src/schemas/serialize/serializeSchema.ts.html +754 -0
  296. package/src/coverage/src/schemas/serializedSchemaTypeSchema.ts.html +262 -0
  297. package/src/coverage/src/schemas/typeDefExtensions.ts.html +397 -0
  298. package/src/coverage/src/translate/FieldTranslationProvider.tsx.html +1003 -0
  299. package/src/coverage/src/translate/getLanguageParams.ts.html +163 -0
  300. package/src/coverage/src/translate/index.html +191 -0
  301. package/src/coverage/src/translate/languageStore.ts.html +139 -0
  302. package/src/coverage/src/translate/paths.ts.html +577 -0
  303. package/src/coverage/src/translate/translateActions.tsx.html +637 -0
  304. package/src/coverage/src/translate/types.ts.html +565 -0
  305. package/src/coverage/src/types.ts.html +649 -0
  306. package/src/coverage/src/useApiClient.ts.html +1015 -0
  307. package/src/fieldActions/assistFieldActions.tsx +42 -13
  308. package/src/fieldActions/generateCaptionActions.tsx +2 -2
  309. package/src/fieldActions/generateImageActions.tsx +57 -0
  310. package/src/helpers/assistSupported.ts +10 -16
  311. package/src/helpers/conditionalMembers.test.ts +200 -0
  312. package/src/helpers/conditionalMembers.ts +127 -0
  313. package/src/helpers/typeUtils.ts +19 -5
  314. package/src/index.ts +3 -0
  315. package/src/node_modules/.vitest/deps/_metadata.json +8 -0
  316. package/src/node_modules/.vitest/deps/package.json +3 -0
  317. package/src/node_modules/.vitest/results.json +1 -0
  318. package/src/plugin.tsx +14 -5
  319. package/src/presence/AssistAvatar.tsx +1 -1
  320. package/src/schemas/assistDocumentSchema.tsx +40 -1
  321. package/src/schemas/serialize/serializeSchema.test.ts +239 -8
  322. package/src/schemas/serialize/serializeSchema.ts +77 -10
  323. package/src/schemas/typeDefExtensions.ts +89 -5
  324. package/src/translate/FieldTranslationProvider.tsx +306 -0
  325. package/src/translate/getLanguageParams.ts +26 -0
  326. package/src/translate/languageStore.ts +18 -0
  327. package/src/translate/paths.test.ts +133 -0
  328. package/src/translate/paths.ts +175 -0
  329. package/src/translate/translateActions.tsx +186 -0
  330. package/src/translate/types.ts +160 -0
  331. package/src/types.ts +33 -12
  332. package/src/useApiClient.ts +130 -2
  333. package/src/assistLayout/AlphaMigration.tsx +0 -310
  334. package/src/legacy-types.ts +0 -72
package/src/plugin.tsx CHANGED
@@ -15,12 +15,11 @@ import {createAssistDocumentPresence} from './presence/AssistDocumentPresence'
15
15
  import {isSchemaAssistEnabled} from './helpers/assistSupported'
16
16
  import {isImage} from './helpers/typeUtils'
17
17
  import {ImageContextProvider} from './components/ImageContext'
18
+ import {TranslationConfig} from './translate/types'
19
+ import {assistDocumentTypeName} from './types'
18
20
 
19
21
  export interface AssistPluginConfig {
20
- /**
21
- * Set this to false to disable model migration from the alpha version of this plugin
22
- */
23
- alphaMigration?: boolean
22
+ translate?: TranslationConfig
24
23
 
25
24
  /**
26
25
  * @internal
@@ -36,16 +35,23 @@ export const assist = definePlugin<AssistPluginConfig | void>((config) => {
36
35
  schema: {
37
36
  types: schemaTypes,
38
37
  },
38
+ i18n: {
39
+ bundles: [{}],
40
+ },
39
41
 
40
42
  document: {
41
43
  inspectors: (prev, context) => {
42
- const docSchema = context.schema.get(context.documentType)
44
+ const documentType = context.documentType
45
+ const docSchema = context.schema.get(documentType)
43
46
  if (docSchema && isSchemaAssistEnabled(docSchema)) {
44
47
  return [...prev, assistInspector]
45
48
  }
46
49
  return prev
47
50
  },
48
51
  unstable_fieldActions: (prev, {documentType, schema}) => {
52
+ if (documentType === assistDocumentTypeName) {
53
+ return []
54
+ }
49
55
  const docSchema = schema.get(documentType)
50
56
  if (docSchema && isSchemaAssistEnabled(docSchema)) {
51
57
  return [...prev, assistFieldActions]
@@ -53,6 +59,9 @@ export const assist = definePlugin<AssistPluginConfig | void>((config) => {
53
59
  return prev
54
60
  },
55
61
  unstable_languageFilter: (prev, {documentId, schema, schemaType}) => {
62
+ if (schemaType === assistDocumentTypeName) {
63
+ return []
64
+ }
56
65
  const docSchema = schema.get(schemaType)
57
66
  if (docSchema && isObjectSchemaType(docSchema) && isSchemaAssistEnabled(docSchema)) {
58
67
  return [...prev, createAssistDocumentPresence(documentId, docSchema)]
@@ -88,7 +88,7 @@ export function AssistAvatar(props: {state?: 'present' | 'active'}) {
88
88
  </Outline>
89
89
  <IconDisc>
90
90
  <Text as="span" size={0} style={{color: 'inherit'}}>
91
- <SparklesIcon />
91
+ <SparklesIcon style={{color: 'inherit'}} />
92
92
  </Text>
93
93
  </IconDisc>
94
94
  </Root>
@@ -18,6 +18,8 @@ import {
18
18
  instructionContextTypeName,
19
19
  instructionTaskTypeName,
20
20
  instructionTypeName,
21
+ outputFieldTypeName,
22
+ outputTypeTypeName,
21
23
  promptTypeName,
22
24
  userInputTypeName,
23
25
  } from '../types'
@@ -37,11 +39,13 @@ import {PromptInput} from '../assistDocument/components/instruction/PromptInput'
37
39
  import {instructionGuideUrl} from '../constants'
38
40
  import {InstructionsArrayField} from '../assistDocument/components/InstructionsArrayField'
39
41
  import {getFieldRefsWithDocument} from '../assistInspector/helpers'
42
+ import {InstructionOutputField} from '../assistDocument/components/instruction/InstructionOutputField'
43
+ import {InstructionOutputInput} from '../assistDocument/components/instruction/InstructionOutputInput'
40
44
 
41
45
  export const fieldReference = defineType({
42
46
  type: 'object',
43
47
  name: fieldReferenceTypeName,
44
- title: 'Document field',
48
+ title: 'Field',
45
49
  icon: ThListIcon,
46
50
 
47
51
  fields: [
@@ -329,6 +333,41 @@ export const instruction = defineType({
329
333
  return context.currentUser?.id ?? ''
330
334
  },
331
335
  }),
336
+ defineField({
337
+ type: 'array',
338
+ name: 'output',
339
+ title: 'Output filter',
340
+ components: {
341
+ input: InstructionOutputInput,
342
+ field: InstructionOutputField,
343
+ },
344
+ of: [
345
+ defineArrayMember({
346
+ type: 'object' as const,
347
+ name: outputFieldTypeName,
348
+ title: 'Output field',
349
+ fields: [
350
+ {
351
+ type: 'string',
352
+ name: 'path',
353
+ title: 'Path',
354
+ },
355
+ ],
356
+ }),
357
+ defineArrayMember({
358
+ type: 'object' as const,
359
+ name: outputTypeTypeName,
360
+ title: 'Output type',
361
+ fields: [
362
+ {
363
+ type: 'string',
364
+ name: 'type',
365
+ title: 'Type',
366
+ },
367
+ ],
368
+ }),
369
+ ],
370
+ }),
332
371
  ],
333
372
  })
334
373
 
@@ -32,7 +32,7 @@ describe('serializeSchema', () => {
32
32
  name: 'article',
33
33
  fields: [{type: 'string', name: 'title'}],
34
34
  options: {
35
- aiWritingAssistance: {
35
+ aiAssist: {
36
36
  exclude: true,
37
37
  },
38
38
  },
@@ -123,7 +123,7 @@ describe('serializeSchema', () => {
123
123
  })
124
124
 
125
125
  test('should not serialize excluded fields or types or types with every member excluded', () => {
126
- const options: AssistOptions = {aiWritingAssistance: {exclude: true}}
126
+ const options: AssistOptions = {aiAssist: {exclude: true}}
127
127
 
128
128
  const schema = Schema.compile({
129
129
  name: 'test',
@@ -138,14 +138,14 @@ describe('serializeSchema', () => {
138
138
  name: 'excludedObject',
139
139
  // all fields excluded should exclude field
140
140
  fields: [{type: 'string', name: 'title', options}],
141
- options: {aiWritingAssistance: {exclude: true}},
141
+ options: {aiAssist: {exclude: true}},
142
142
  }),
143
143
  defineField({
144
144
  type: 'array',
145
145
  name: 'excludedArray',
146
146
  // all items excluded should exclude field
147
147
  of: [{type: 'object', name: 'remove', options}, {type: 'excluded'}],
148
- options: {aiWritingAssistance: {exclude: true}},
148
+ options: {aiAssist: {exclude: true}},
149
149
  }),
150
150
  //image without extra fields should be excluded
151
151
  defineField({type: 'image', name: 'image'}),
@@ -169,7 +169,7 @@ describe('serializeSchema', () => {
169
169
  type: 'object',
170
170
  name: 'excluded',
171
171
  fields: [{type: 'string', name: 'title', options}],
172
- options: {aiWritingAssistance: {exclude: true}},
172
+ options: {aiAssist: {exclude: true}},
173
173
  }),
174
174
  ...mockStudioTypes,
175
175
  ],
@@ -484,7 +484,7 @@ describe('serializeSchema', () => {
484
484
  ])
485
485
  })
486
486
 
487
- test('should exclude truthy hidden and readonly', () => {
487
+ test('should annotate truthy readonly', () => {
488
488
  const schema = Schema.compile({
489
489
  name: 'test',
490
490
  types: [
@@ -492,7 +492,7 @@ describe('serializeSchema', () => {
492
492
  type: 'document',
493
493
  name: 'article',
494
494
  fields: [
495
- {type: 'string', name: 'title', hidden: () => true},
495
+ {type: 'string', name: 'title', readOnly: () => true},
496
496
  {type: 'some', name: 'some'},
497
497
  ],
498
498
  },
@@ -507,6 +507,237 @@ describe('serializeSchema', () => {
507
507
 
508
508
  const serializedTypes = serializeSchema(schema, {leanFormat: true})
509
509
 
510
- expect(serializedTypes).toEqual([])
510
+ expect(serializedTypes).toEqual([
511
+ {
512
+ name: 'article',
513
+ title: 'Article',
514
+ type: 'document',
515
+ fields: [
516
+ {name: 'title', readOnly: 'function', title: 'Title', type: 'string'},
517
+ {name: 'some', readOnly: true, title: 'Some', type: 'some'},
518
+ ],
519
+ },
520
+ {
521
+ name: 'some',
522
+ readOnly: true,
523
+ title: 'Some',
524
+ type: 'object',
525
+ fields: [{name: 'title', title: 'Title', type: 'string'}],
526
+ },
527
+ ])
528
+ })
529
+
530
+ test('should annotate truthy hidden', () => {
531
+ const schema = Schema.compile({
532
+ name: 'test',
533
+ types: [
534
+ {
535
+ type: 'document',
536
+ name: 'article',
537
+ fields: [
538
+ {type: 'string', name: 'title', hidden: true},
539
+ {type: 'some', name: 'some'},
540
+ ],
541
+ },
542
+ defineType({
543
+ type: 'object',
544
+ name: 'some',
545
+ hidden: () => true,
546
+ fields: [{type: 'string', name: 'title'}],
547
+ }),
548
+ ],
549
+ })
550
+
551
+ const serializedTypes = serializeSchema(schema, {leanFormat: true})
552
+
553
+ expect(serializedTypes).toEqual([
554
+ {
555
+ name: 'article',
556
+ title: 'Article',
557
+ type: 'document',
558
+ fields: [
559
+ {hidden: true, name: 'title', title: 'Title', type: 'string'},
560
+ {hidden: 'function', name: 'some', title: 'Some', type: 'some'},
561
+ ],
562
+ },
563
+ {
564
+ hidden: 'function',
565
+ name: 'some',
566
+ title: 'Some',
567
+ type: 'object',
568
+ fields: [{name: 'title', title: 'Title', type: 'string'}],
569
+ },
570
+ ])
571
+ })
572
+
573
+ test('should serialize annotations', () => {
574
+ const schema = Schema.compile({
575
+ name: 'test',
576
+ types: [
577
+ defineType({
578
+ type: 'object',
579
+ name: 'annotation',
580
+ fields: [defineField({type: 'string', name: 'fact', title: 'Fact'})],
581
+ }),
582
+ defineType({
583
+ name: 'blockAlias',
584
+ type: 'block',
585
+ marks: {annotations: [{type: 'annotation'}]},
586
+ }),
587
+ defineType({
588
+ type: 'document',
589
+ name: 'article',
590
+ fields: [
591
+ {
592
+ type: 'array',
593
+ name: 'inlinePte',
594
+ of: [
595
+ defineArrayMember({
596
+ type: 'block',
597
+ marks: {
598
+ annotations: [
599
+ defineArrayMember({
600
+ type: 'object',
601
+ name: 'inline-annotation',
602
+ fields: [defineField({type: 'string', name: 'fact', title: 'Fact'})],
603
+ }),
604
+ ],
605
+ },
606
+ }),
607
+ ],
608
+ },
609
+ {type: 'array', name: 'pte', of: [{type: 'blockAlias'}]},
610
+ ],
611
+ }),
612
+ ],
613
+ })
614
+
615
+ const serializedTypes = serializeSchema(schema, {leanFormat: true})
616
+
617
+ expect(serializedTypes).toEqual([
618
+ {
619
+ name: 'annotation',
620
+ title: 'Annotation',
621
+ type: 'object',
622
+ fields: [{name: 'fact', title: 'Fact', type: 'string'}],
623
+ },
624
+ {
625
+ name: 'article',
626
+ title: 'Article',
627
+ type: 'document',
628
+ fields: [
629
+ {
630
+ name: 'inlinePte',
631
+ title: 'Inline Pte',
632
+ type: 'array',
633
+ of: [
634
+ {
635
+ name: 'block',
636
+ title: 'Block',
637
+ type: 'block',
638
+ inlineOf: [],
639
+ annotations: [
640
+ {
641
+ name: 'inline-annotation',
642
+ title: 'Inline Annotation',
643
+ type: 'object',
644
+ fields: [{name: 'fact', title: 'Fact', type: 'string'}],
645
+ },
646
+ ],
647
+ },
648
+ ],
649
+ },
650
+ {
651
+ name: 'pte',
652
+ of: [{name: 'blockAlias', title: 'Block', type: 'blockAlias'}],
653
+ title: 'Pte',
654
+ type: 'array',
655
+ },
656
+ ],
657
+ },
658
+ {
659
+ name: 'blockAlias',
660
+ title: 'Block',
661
+ type: 'block',
662
+ annotations: [{name: 'annotation', title: 'Annotation', type: 'annotation'}],
663
+ inlineOf: [],
664
+ },
665
+ ])
666
+ })
667
+
668
+ test('should serialize inline block types', () => {
669
+ const schema = Schema.compile({
670
+ name: 'test',
671
+ types: [
672
+ defineType({
673
+ type: 'object',
674
+ name: 'inline-block',
675
+ fields: [
676
+ defineField({type: 'string', name: 'fact', title: 'Fact'}),
677
+ defineField({type: 'blockAlias', name: 'recurse', title: 'Recursive'}),
678
+ ],
679
+ }),
680
+ defineType({
681
+ name: 'blockAlias',
682
+ type: 'block',
683
+ of: [{type: 'inline-block'}],
684
+ }),
685
+ defineType({
686
+ type: 'document',
687
+ name: 'article',
688
+ fields: [{type: 'array', name: 'pte', of: [{type: 'blockAlias'}]}],
689
+ }),
690
+ ],
691
+ })
692
+
693
+ const serializedTypes = serializeSchema(schema, {leanFormat: true})
694
+
695
+ expect(serializedTypes).toEqual([
696
+ {
697
+ name: 'article',
698
+ title: 'Article',
699
+ type: 'document',
700
+ fields: [
701
+ {
702
+ name: 'pte',
703
+ of: [
704
+ {
705
+ name: 'blockAlias',
706
+ title: 'Block',
707
+ type: 'blockAlias',
708
+ },
709
+ ],
710
+ title: 'Pte',
711
+ type: 'array',
712
+ },
713
+ ],
714
+ },
715
+ {
716
+ name: 'blockAlias',
717
+ title: 'Block',
718
+ type: 'block',
719
+ annotations: [],
720
+ inlineOf: [
721
+ {
722
+ name: 'inline-block',
723
+ title: 'Inline Block',
724
+ type: 'inline-block',
725
+ },
726
+ ],
727
+ },
728
+ {
729
+ name: 'inline-block',
730
+ title: 'Inline Block',
731
+ type: 'object',
732
+ fields: [
733
+ {name: 'fact', title: 'Fact', type: 'string'},
734
+ {
735
+ name: 'recurse',
736
+ title: 'Recursive',
737
+ type: 'blockAlias',
738
+ },
739
+ ],
740
+ },
741
+ ])
511
742
  })
512
743
  })
@@ -1,21 +1,24 @@
1
1
  import {
2
2
  ArraySchemaType,
3
3
  ImageOptions,
4
+ isArraySchemaType,
4
5
  ObjectSchemaType,
6
+ ReferenceOptions,
5
7
  ReferenceSchemaType,
6
8
  Schema,
7
9
  SchemaType,
8
10
  typed,
9
11
  } from 'sanity'
10
12
  import {
13
+ assistSchemaIdPrefix,
11
14
  assistSerializedFieldTypeName,
12
15
  assistSerializedTypeName,
13
16
  SerializedSchemaMember,
14
17
  SerializedSchemaType,
15
- assistSchemaIdPrefix,
16
18
  } from '../../types'
17
19
  import {hiddenTypes} from './schemaUtils'
18
20
  import {isAssistSupported} from '../../helpers/assistSupported'
21
+ import {isType} from '../../helpers/typeUtils'
19
22
 
20
23
  interface Options {
21
24
  leanFormat?: boolean
@@ -31,7 +34,6 @@ export function serializeSchema(schema: Schema, options?: Options): SerializedSc
31
34
  .filter((t): t is SchemaType => !!t)
32
35
  // because a field can override exclude at the type level, we have to also serialize excluded types
33
36
  // so don't do this: .filter((t) => isAssistSupported(t))
34
- .filter((t) => !t.hidden && !t.readOnly)
35
37
  .map((t) => getSchemaStub(t, schema, options))
36
38
  .filter((t) => {
37
39
  if ('to' in t && t.to && !t.to.length) {
@@ -78,13 +80,12 @@ function getBaseFields(
78
80
  typeName: string,
79
81
  options: Options | undefined
80
82
  ) {
81
- const imagePromptField = (type.options as ImageOptions)?.imagePromptField
83
+ const schemaOptions: SerializedSchemaType['options'] = removeUndef({
84
+ imagePromptField: (type.options as ImageOptions)?.aiAssist?.imageInstructionField,
85
+ embeddingsIndex: (type.options as ReferenceOptions)?.aiAssist?.embeddingsIndex,
86
+ })
82
87
  return removeUndef({
83
- options: imagePromptField
84
- ? {
85
- imagePromptField: imagePromptField,
86
- }
87
- : undefined,
88
+ options: Object.keys(schemaOptions).length ? schemaOptions : undefined,
88
89
  values: Array.isArray(type?.options?.list)
89
90
  ? type?.options?.list.map((v: string | {value: string; title: string}) =>
90
91
  typeof v === 'string' ? v : v.value ?? `${v.title}`
@@ -99,6 +100,22 @@ function getBaseFields(
99
100
  'fields' in type && inlineTypes.includes(typeName)
100
101
  ? serializeFields(schema, type, options)
101
102
  : undefined,
103
+ annotations:
104
+ typeName === 'block' && 'fields' in type
105
+ ? serializeAnnotations(type, schema, options)
106
+ : undefined,
107
+ inlineOf:
108
+ typeName === 'block' && 'fields' in type
109
+ ? serializeInlineOf(type, schema, options)
110
+ : undefined,
111
+ hidden:
112
+ typeof type.hidden === 'function' ? ('function' as const) : type.hidden ? true : undefined,
113
+ readOnly:
114
+ typeof type.readOnly === 'function'
115
+ ? ('function' as const)
116
+ : type.readOnly
117
+ ? true
118
+ : undefined,
102
119
  })
103
120
  }
104
121
 
@@ -107,10 +124,27 @@ function serializeFields(
107
124
  schemaType: ObjectSchemaType,
108
125
  options: Options | undefined
109
126
  ) {
110
- return schemaType.fields
127
+ const fields = schemaType.fieldsets
128
+ ? schemaType.fieldsets.flatMap((fs) =>
129
+ fs.single
130
+ ? fs.field
131
+ : fs.fields.map((f) => ({
132
+ ...f,
133
+ type: {
134
+ ...f.type,
135
+ // if fieldset is (conditionally) hidden, the field must be considered the same way
136
+ // ie, if the field does not show up in conditionalMembers, it is hidden
137
+ // regardless of weather or not it is the field function or the fieldset function that hides it
138
+ hidden:
139
+ typeof fs.hidden === 'function' ? fs.hidden : fs.hidden ? true : f.type.hidden,
140
+ },
141
+ }))
142
+ )
143
+ : schemaType.fields
144
+
145
+ return fields
111
146
  .filter((f) => !['sanity.imageHotspot', 'sanity.imageCrop'].includes(f.type?.name ?? ''))
112
147
  .filter((f) => isAssistSupported(f.type))
113
- .filter((f) => !f.type.hidden && !f.type.readOnly)
114
148
  .map((field) => serializeMember(schema, field.type, field.name, options))
115
149
  }
116
150
 
@@ -131,6 +165,39 @@ function serializeMember(
131
165
  })
132
166
  }
133
167
 
168
+ function serializeInlineOf(
169
+ blockSchemaType: ObjectSchemaType,
170
+ schema: Schema,
171
+ options: Options | undefined
172
+ ): SerializedSchemaMember[] | undefined {
173
+ const childrenField = blockSchemaType.fields.find((f) => f.name === 'children')
174
+ const childrenType = childrenField?.type
175
+ if (!childrenType || !isArraySchemaType(childrenType)) {
176
+ return undefined
177
+ }
178
+ return arrayOf(
179
+ {
180
+ ...childrenType,
181
+ of: childrenType.of.filter((t) => !isType(t, 'span')),
182
+ },
183
+ schema,
184
+ options
185
+ )
186
+ }
187
+
188
+ function serializeAnnotations(
189
+ blockSchemaType: ObjectSchemaType,
190
+ schema: Schema,
191
+ options: Options | undefined
192
+ ): SerializedSchemaMember[] | undefined {
193
+ const markDefs = blockSchemaType.fields.find((f) => f.name === 'markDefs')
194
+ const marksType = markDefs?.type
195
+ if (!marksType || !isArraySchemaType(marksType)) {
196
+ return undefined
197
+ }
198
+ return arrayOf(marksType, schema, options)
199
+ }
200
+
134
201
  function arrayOf(
135
202
  arrayType: ArraySchemaType,
136
203
  schema: Schema,
@@ -1,8 +1,14 @@
1
1
  /* eslint-disable no-unused-vars */
2
2
  export interface AssistOptions {
3
- aiWritingAssistance?: {
3
+ aiAssist?: {
4
4
  /** Set to true to disable assistance for this field or type */
5
5
  exclude?: boolean
6
+
7
+ /**
8
+ * Set to true to add translation field-action to the field.
9
+ * Only has an effect in document types configured for document or field level translations.
10
+ */
11
+ translateAction?: boolean
6
12
  }
7
13
  }
8
14
 
@@ -16,13 +22,91 @@ declare module 'sanity' {
16
22
  interface DocumentOptions extends AssistOptions {}
17
23
  interface FileOptions extends AssistOptions {}
18
24
  interface GeopointOptions extends AssistOptions {}
19
- interface ImageOptions extends AssistOptions {
20
- imagePromptField?: string
21
- captionField?: string
25
+ interface ImageOptions {
26
+ aiAssist?: AssistOptions['aiAssist'] & {
27
+ /**
28
+ * When set, an image will be created whenever the `imageInstructionField` is written to by
29
+ * an AI Assist instruction.
30
+ *
31
+ * The value output by AI Assist will be use as an image prompt for an generative image AI.
32
+ *
33
+ * This means that instructions directly for the field or instructions that visit the field when running,
34
+ * will result in the image being changed.
35
+ *
36
+ * `imageInstructionField` must be a child-path relative to the image field, ie:
37
+ * * field
38
+ * * path.to.field
39
+ *
40
+ * ### Example
41
+ * ```ts
42
+ * defineType({
43
+ * type: 'image',
44
+ * name: 'articleImage',
45
+ * fields: [
46
+ * defineField({
47
+ * type: 'text',
48
+ * name: 'imagePrompt',
49
+ * title: 'Image prompt',
50
+ * rows: 2,
51
+ * }),
52
+ * ],
53
+ * options: {
54
+ * aiAssist: {
55
+ * imageInstructionField: 'imagePrompt',
56
+ * }
57
+ * },
58
+ * })
59
+ * ```
60
+ */
61
+ imageInstructionField?: string
62
+
63
+ /**
64
+ * When set, an image description will be automatically created for the image.
65
+ *
66
+ * `imageDescriptionField` must be a child-path relative to the image field, ie:
67
+ * * field
68
+ * * path.to.field
69
+ *
70
+ * Whenever the image asset for the field is changed in the Studio,
71
+ * an image description is generated and set into the `imageDescriptionField`.
72
+ *
73
+ * ### Example
74
+ * ```ts
75
+ * defineType({
76
+ * type: 'image',
77
+ * name: 'articleImage',
78
+ * fields: [
79
+ * defineField({
80
+ * type: 'string',
81
+ * name: 'altText',
82
+ * title: 'Alt text',
83
+ * }),
84
+ * ],
85
+ * options: {
86
+ * aiAssist: {
87
+ * imageDescriptionField: 'altText',
88
+ * }
89
+ * },
90
+ * })
91
+ * ```
92
+ */
93
+ imageDescriptionField?: string
94
+ }
22
95
  }
23
96
  interface NumberOptions extends AssistOptions {}
24
97
  interface ObjectOptions extends AssistOptions {}
25
- interface ReferenceBaseOptions extends AssistOptions {}
98
+ interface ReferenceBaseOptions {
99
+ aiAssist?: {
100
+ /** Set to true to disable assistance for this field or type */
101
+ exclude?: boolean
102
+
103
+ /**
104
+ * When set, the reference field will allow instructions to be added to it.
105
+ * Should be the name of the embeddings-index where assist will look for contextually relevant documents
106
+ * */
107
+ embeddingsIndex?: string
108
+ }
109
+ }
26
110
  interface SlugOptions extends AssistOptions {}
27
111
  interface StringOptions extends AssistOptions {}
28
112
  interface TextOptions extends AssistOptions {}