@llmnative/react 0.1.1 → 1.0.0

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 (181) hide show
  1. package/README.md +387 -364
  2. package/bin/cli.js +117 -98
  3. package/dist/index.css +1 -1
  4. package/dist/index.js +21 -823
  5. package/dist/index.mjs +14246 -9296
  6. package/dist/style.css +1 -0
  7. package/dist/types/src/App.d.ts +72 -14
  8. package/dist/types/src/Config.d.ts +28 -5
  9. package/dist/types/src/Global.d.ts +2 -2
  10. package/dist/types/src/I18n.d.ts +185 -0
  11. package/dist/types/src/Theme.d.ts +153 -81
  12. package/dist/types/src/auth.d.ts +13 -1
  13. package/dist/types/src/components/Component.d.ts +13 -27
  14. package/dist/types/src/components/ErrorBoundary.d.ts +30 -0
  15. package/dist/types/src/components/blocks/Brand.d.ts +4 -4
  16. package/dist/types/src/components/blocks/Breadcrumbs.d.ts +50 -4
  17. package/dist/types/src/components/blocks/Carousel.d.ts +5 -5
  18. package/dist/types/src/components/blocks/Dropdown.d.ts +26 -20
  19. package/dist/types/src/components/blocks/ListCard.d.ts +31 -0
  20. package/dist/types/src/components/blocks/Menu.d.ts +13 -16
  21. package/dist/types/src/components/blocks/Notifications.d.ts +8 -3
  22. package/dist/types/src/components/blocks/ProviderSwitcher.d.ts +63 -0
  23. package/dist/types/src/components/blocks/Search.d.ts +2 -2
  24. package/dist/types/src/components/blocks/SideNav.d.ts +45 -0
  25. package/dist/types/src/components/blocks/ThemeSwitcher.d.ts +24 -0
  26. package/dist/types/src/components/blocks/Toolbar.d.ts +19 -0
  27. package/dist/types/src/components/index.d.ts +27 -6
  28. package/dist/types/src/components/types.d.ts +10 -3
  29. package/dist/types/src/components/ui/Alert.d.ts +16 -4
  30. package/dist/types/src/components/ui/Badge.d.ts +6 -5
  31. package/dist/types/src/components/ui/Buttons.d.ts +13 -12
  32. package/dist/types/src/components/ui/Card.d.ts +8 -7
  33. package/dist/types/src/components/ui/Code.d.ts +1 -1
  34. package/dist/types/src/components/ui/Gallery.d.ts +13 -14
  35. package/dist/types/src/components/ui/GridSystem.d.ts +1 -1
  36. package/dist/types/src/components/ui/Icon.d.ts +3 -1
  37. package/dist/types/src/components/ui/Image.d.ts +1 -1
  38. package/dist/types/src/components/ui/ImageAvatar.d.ts +1 -1
  39. package/dist/types/src/components/ui/Loader.d.ts +1 -1
  40. package/dist/types/src/components/ui/LocaleSwitcher.d.ts +14 -0
  41. package/dist/types/src/components/ui/Modal.d.ts +42 -15
  42. package/dist/types/src/components/ui/Pagination.d.ts +14 -3
  43. package/dist/types/src/components/ui/Percentage.d.ts +5 -5
  44. package/dist/types/src/components/ui/Repeat.d.ts +15 -6
  45. package/dist/types/src/components/ui/Tab.d.ts +29 -2
  46. package/dist/types/src/components/ui/TabDynamic.d.ts +4 -3
  47. package/dist/types/src/components/ui/Table.d.ts +15 -14
  48. package/dist/types/src/components/ui/fields/CodeEditor.d.ts +43 -0
  49. package/dist/types/src/components/ui/fields/ContextMenu.d.ts +38 -0
  50. package/dist/types/src/components/ui/fields/Crop.d.ts +4 -2
  51. package/dist/types/src/components/ui/fields/ImageField.d.ts +31 -0
  52. package/dist/types/src/components/ui/fields/Input.d.ts +43 -14
  53. package/dist/types/src/components/ui/fields/Prompt.d.ts +2 -31
  54. package/dist/types/src/components/ui/fields/RichText.d.ts +86 -0
  55. package/dist/types/src/components/ui/fields/Select.d.ts +13 -10
  56. package/dist/types/src/components/ui/fields/Upload.d.ts +37 -2
  57. package/dist/types/src/components/ui/fields/UploadCSV.d.ts +2 -0
  58. package/dist/types/src/components/ui/useRecordSelection.d.ts +1 -2
  59. package/dist/types/src/components/widgets/Form.d.ts +80 -43
  60. package/dist/types/src/components/widgets/ImageEditor.d.ts +4 -5
  61. package/dist/types/src/components/widgets/MarkdownReader.d.ts +4 -4
  62. package/dist/types/src/components/widgets/Prompt.d.ts +71 -23
  63. package/dist/types/src/components/widgets/TabDynamic.d.ts +4 -3
  64. package/dist/types/src/components/widgets/form-controller.d.ts +42 -0
  65. package/dist/types/src/components/widgets/grid-core/GridCore.d.ts +1 -1
  66. package/dist/types/src/components/widgets/grid-core/GridDB.d.ts +1 -1
  67. package/dist/types/src/components/widgets/grid-core/GridGalleryView.d.ts +1 -1
  68. package/dist/types/src/components/widgets/grid-core/GridTableView.d.ts +1 -1
  69. package/dist/types/src/components/widgets/grid-core/types.d.ts +77 -27
  70. package/dist/types/src/components/widgets/grid-core/useGridActions.d.ts +4 -8
  71. package/dist/types/src/components/widgets/grid-core/useGridColumns.d.ts +2 -2
  72. package/dist/types/src/components/widgets/grid-core/useGridDBRecords.d.ts +1 -2
  73. package/dist/types/src/components/widgets/grid-core/useGridPreparedRecords.d.ts +2 -2
  74. package/dist/types/src/components/widgets/grid-core/useGridSelection.d.ts +4 -5
  75. package/dist/types/src/components/widgets/grid-core/utils.d.ts +11 -3
  76. package/dist/types/src/conf/Prompt.d.ts +1 -1
  77. package/dist/types/src/conf/i18n/ar.d.ts +2 -0
  78. package/dist/types/src/conf/i18n/de.d.ts +2 -0
  79. package/dist/types/src/conf/i18n/en.d.ts +2 -0
  80. package/dist/types/src/conf/i18n/index.d.ts +6 -0
  81. package/dist/types/src/conf/i18n/it.d.ts +2 -0
  82. package/dist/types/src/conf/i18n/ru.d.ts +2 -0
  83. package/dist/types/src/conf/i18n/zh.d.ts +2 -0
  84. package/dist/types/src/constant.d.ts +1 -1
  85. package/dist/types/src/index.d.ts +38 -13
  86. package/dist/types/src/libs/converter.d.ts +4 -4
  87. package/dist/types/src/libs/editorHeight.d.ts +12 -0
  88. package/dist/types/src/libs/fetch.d.ts +4 -4
  89. package/dist/types/src/libs/imageBuilder.d.ts +63 -14
  90. package/dist/types/src/libs/imageVariants.d.ts +35 -0
  91. package/dist/types/src/libs/index.d.ts +1 -4
  92. package/dist/types/src/libs/promptUtils.d.ts +24 -0
  93. package/dist/types/src/libs/sanitizer.d.ts +2 -2
  94. package/dist/types/src/libs/utils.d.ts +9 -10
  95. package/dist/types/src/pages/index.d.ts +0 -2
  96. package/dist/types/src/providers/ProviderConfiguration.d.ts +6 -0
  97. package/dist/types/src/providers/ProviderRegistryContext.d.ts +51 -0
  98. package/dist/types/src/providers/ProviderSession.d.ts +68 -0
  99. package/dist/types/src/providers/ai/AIProvider.d.ts +57 -0
  100. package/dist/types/src/providers/ai/AIProviderContext.d.ts +13 -0
  101. package/dist/types/src/providers/ai/anthropic.d.ts +2 -0
  102. package/dist/types/src/providers/ai/deepseek.d.ts +1 -0
  103. package/dist/types/src/providers/ai/gemini.d.ts +2 -0
  104. package/dist/types/src/providers/ai/glm.d.ts +1 -0
  105. package/dist/types/src/providers/ai/index.d.ts +9 -134
  106. package/dist/types/src/providers/ai/mistral.d.ts +1 -0
  107. package/dist/types/src/providers/ai/openai.d.ts +1 -0
  108. package/dist/types/src/providers/ai/openaiCompatible.d.ts +17 -0
  109. package/dist/types/src/providers/ai/opencode.d.ts +2 -0
  110. package/dist/types/src/providers/ai/openrouter.d.ts +1 -0
  111. package/dist/types/src/providers/ai/shared.d.ts +46 -0
  112. package/dist/types/src/providers/api/ApiProvider.d.ts +43 -0
  113. package/dist/types/src/providers/api/direct.d.ts +14 -0
  114. package/dist/types/src/providers/api/firebase.d.ts +14 -0
  115. package/dist/types/src/providers/api/mock.d.ts +7 -0
  116. package/dist/types/src/providers/api/supabase.d.ts +14 -0
  117. package/dist/types/src/providers/auth/AuthProvider.d.ts +2 -2
  118. package/dist/types/src/providers/auth/firebase/FirebaseAuthProvider.d.ts +26 -0
  119. package/dist/types/src/providers/auth/google/GoogleAuth.d.ts +2 -2
  120. package/dist/types/src/providers/auth/supabase/SupabaseAuthProvider.d.ts +48 -0
  121. package/dist/types/src/providers/credentials/CredentialsProvider.d.ts +3 -0
  122. package/dist/types/src/providers/credentials/CredentialsProviderContext.d.ts +12 -0
  123. package/dist/types/src/providers/credentials/google/GoogleServiceAccountProvider.d.ts +8 -0
  124. package/dist/types/src/providers/data/DataProvider.d.ts +27 -1
  125. package/dist/types/src/providers/data/firebase.d.ts +5 -4
  126. package/dist/types/src/providers/data/firestore.d.ts +38 -0
  127. package/dist/types/src/providers/data/mock.d.ts +8 -1
  128. package/dist/types/src/providers/data/supabase.d.ts +36 -10
  129. package/dist/types/src/providers/firebase-init.d.ts +15 -4
  130. package/dist/types/src/providers/icon/PhosphorIconProvider.d.ts +1 -1
  131. package/dist/types/src/providers/manifest.d.ts +20 -14
  132. package/dist/types/src/providers/proxy/index.d.ts +7 -0
  133. package/dist/types/src/providers/proxy/vite.d.ts +3 -0
  134. package/dist/types/src/providers/scrape/index.d.ts +2 -1
  135. package/dist/types/src/providers/seo/google/keyword.d.ts +6 -1
  136. package/dist/types/src/providers/storage/StorageProvider.d.ts +155 -4
  137. package/dist/types/src/providers/storage/dropbox.d.ts +3 -3
  138. package/dist/types/src/providers/storage/firebase.d.ts +38 -7
  139. package/dist/types/src/providers/storage/supabase.d.ts +47 -7
  140. package/dist/types/src/providers/supabase-init.d.ts +35 -0
  141. package/dist/types/src/types/FormFields.d.ts +4 -2
  142. package/dist/types/src/types/FormSchema.d.ts +29 -0
  143. package/dist/types/themes/tokyo-night-light.d.ts +3 -0
  144. package/dist/types/themes/tokyo-night.d.ts +3 -0
  145. package/dist/types/themes/vscode-dark-plus.d.ts +3 -0
  146. package/dist/types/themes/vscode-light-plus.d.ts +3 -0
  147. package/dist/vite.js +1 -0
  148. package/dist/vite.mjs +54 -0
  149. package/package.json +40 -9
  150. package/scripts/cli/proxy-templates/cloudflare.ts +34 -0
  151. package/scripts/cli/proxy-templates/express.ts +77 -0
  152. package/scripts/cli/proxy-templates/nextjs-app.ts +42 -0
  153. package/scripts/cli/proxy-templates/nextjs-pages.ts +41 -0
  154. package/scripts/cli/proxy-templates/scaffold.json +33 -0
  155. package/scripts/cli/setup-devtools.js +155 -85
  156. package/scripts/cli/setup-project.js +618 -484
  157. package/themes/cyber.ts +469 -405
  158. package/themes/default.ts +469 -405
  159. package/themes/flat.ts +469 -405
  160. package/themes/tokyo-night-light.ts +38 -0
  161. package/themes/tokyo-night.ts +38 -0
  162. package/themes/vscode-dark-plus.ts +29 -0
  163. package/themes/vscode-light-plus.ts +29 -0
  164. package/dist/index.js.map +0 -1
  165. package/dist/index.mjs.map +0 -1
  166. package/dist/types/src/components/FormEnhancer.d.ts +0 -26
  167. package/dist/types/src/components/Template.d.ts +0 -18
  168. package/dist/types/src/components/ui/fields/AssistantAI.d.ts +0 -23
  169. package/dist/types/src/components/ui/fields/Command.d.ts +0 -15
  170. package/dist/types/src/components/ui/fields/ImageUrl.d.ts +0 -7
  171. package/dist/types/src/libs/cache.d.ts +0 -9
  172. package/dist/types/src/libs/database.d.ts +0 -3
  173. package/dist/types/src/libs/log.d.ts +0 -2
  174. package/dist/types/src/libs/seo.d.ts +0 -8
  175. package/dist/types/src/libs/storage.d.ts +0 -2
  176. package/dist/types/src/pages/Blog.d.ts +0 -3
  177. package/dist/types/src/pages/BlogPost.d.ts +0 -16
  178. package/dist/types/src/pages/Helper.d.ts +0 -8
  179. package/dist/types/src/providers/auth/google/apis/auth.d.ts +0 -4
  180. package/dist/types/src/types/Block.d.ts +0 -4
  181. package/dist/types/src/types/Section.d.ts +0 -4
@@ -1,36 +1,62 @@
1
1
  import './globals.css';
2
- export { default as App } from './App';
2
+ export { default as App, AppProvider } from './App';
3
3
  export { useMenu } from './App';
4
- export type { AppProps, AppProvidersConfig } from './App';
5
- export type { ServicesConfig, SupabaseProviderConfig, GoogleProviderConfig, MockProviderConfig, DataDriverName, StorageDriverName, AuthDriverName, EmailDriverName, } from './providers/manifest';
4
+ export type { AppProps, AppProviderProps, AppProvidersConfig, MenuConfig } from './App';
5
+ export type { AIConfig } from './Config';
6
+ export type { ServicesConfig, SupabaseProviderConfig, GoogleProviderConfig, MockProviderConfig, DataDriverName, StorageDriverName, AuthDriverName, EmailDriverName, AIDriverName, } from './providers/manifest';
7
+ export type { ProxyConfig } from './Config';
6
8
  export { Head, HeadProvider, DEFAULT_DOCUMENT_HEAD, DEFAULT_HEAD_APP_NAME, DEFAULT_LANGUAGE_HEAD, useAssetsHead, useDocumentHead, useHead, useHeadLinks, useLanguageHead, usePaginationHead, usePwaHead, useSchemaOrgHead, useSocialHead, } from './Head';
7
9
  export type { HeadController, AssetsHeadState, DocumentBaseHead, DocumentHeadState, DocumentHttpEquivMeta, HeadFontAsset, HeadLinkDescriptor, HeadLinksState, HeadMetaAttributes, HeadProviderProps, HeadScriptAsset, HeadStyleAsset, LanguageAlternateLink, LanguageHeadState, OpenGraphHeadState, PageMetadataState, PaginationHeadState, PwaIconLink, PwaHeadState, SchemaOrgHeadState, SchemaOrgJson, SocialHeadState, TwitterHeadState, } from './Head';
8
10
  export { useTheme, useThemeController, BUILT_IN_THEMES, BUILT_IN_THEME_IDS } from './Theme';
9
- export type { AppThemeProviderConfig, BuiltInThemeId, CardTheme, ColorScale, GalleryTheme, MenuTheme, ModalTheme, TableTheme, Theme, ThemeConfig, ThemeController, ThemeMode, ThemeDefinition, ThemePresetConfig, } from './Theme';
11
+ export { I18nProvider, useI18n, interpolate, defineLocaleMessages, createTranslations, } from './I18n';
12
+ export type { I18nDict, I18nConfig, I18nController, I18nTranslations, I18nLocale } from './I18n';
13
+ export * as locales from './conf/i18n';
14
+ export type { AppThemeProviderConfig, BuiltInThemeId, CardTheme, ColorScale, GalleryTheme, ListCardTheme, MenuTheme, ModalTheme, ProviderSwitcherTheme, ToolbarTheme, TableTheme, Theme, ThemeConfig, ThemeController, ThemeMode, ThemeDefinition, ThemePresetConfig, } from './Theme';
10
15
  export { AuthButton, useAccessToken, getAccessToken } from './auth';
11
16
  export { useGlobalVars, getGlobalVars, setGlobalVars, removeGlobalVars } from './Global';
12
- export type { DataProviderAdapter, RecordProps, RecordArray, DatabaseOptions, DBConfig, ReadOptions, WhereClause, OrderClause, Condition } from './providers/data/DataProvider';
17
+ export type { DataProviderAdapter, FieldValue, RecordProps, RecordArray, DatabaseOptions, DBConfig, ReadOptions, WhereClause, OrderClause, Condition } from './providers/data/DataProvider';
13
18
  export type { OrderConfig, OrderDirection } from './libs/order';
14
19
  export { Order } from './libs/order';
20
+ export { PromptUtils } from './libs/promptUtils';
21
+ export type { PromptCommand, PromptAction, PromptStatusItem, PromptRunStats } from './components/widgets/Prompt';
15
22
  export type { TableHeaderProp, TableReorderHandler, TableReorderMeta, TableSelectionChangeHandler, TableSelectionState } from './components/ui/Table';
16
- export type { GallerySelectionChangeHandler, GallerySelectionState } from './components/ui/Gallery';
17
- export type { GridAction, GridActions, GridAfterActionArgs, GridAfterActionHandler, GridArrayProps, GridColumn, GridCoreProps, GridDBPath, GridDBQuery, GridDBProps, GridFooterContext, GridFormContext, GridGalleryViewProps, GridHeaderContext, GridLayout, GridMutationDeleteArgs, GridMutationDeleteHandler, GridMutationSaveArgs, GridMutationSaveHandler, GridReorderHandler, GridReorderMeta, GridRecordKey, GridProps, GridSelectionChangeHandler, GridSelectionMode, GridSelectionState, GridSticky, GridTableViewProps, } from './components/widgets/Grid';
23
+ export type { GalleryRecord, GallerySelectionChangeHandler, GallerySelectionState } from './components/ui/Gallery';
24
+ export type { GridAction, GridActions, GridAfterActionArgs, GridAfterActionHandler, GridArrayProps, GridColumn, GridCoreProps, GridDBPath, GridDBQuery, GridDBProps, GridFooterContext, GridFormContext, GridGalleryViewProps, GridHeaderContext, GridLayout, GridMutationDeleteArgs, GridMutationDeleteHandler, GridMutationSaveArgs, GridMutationSaveHandler, GridReorderHandler, GridReorderMeta, GridRecordKey, GridProps, GridSelectionChangeHandler, GridSelectionMode, GridSelectionState, GridSticky, GridTableViewProps, GridCellContext, } from './components/widgets/Grid';
18
25
  export type { ProviderConfigurable, ProviderConfigurationState } from './providers/ProviderConfiguration';
19
26
  export { getProviderConfigurationState } from './providers/ProviderConfiguration';
27
+ export type { ProviderAdapterMap, ProviderService, SetProviderFn, ProviderRegistrySnapshot } from './providers/ProviderRegistryContext';
28
+ export { useSetProvider, useProvider } from './providers/ProviderRegistryContext';
29
+ export type { ProviderSessionCredential, ProviderSessionAssignment, ProviderSessionResponse, ProviderSessionFactory, SwitchProviderSessionFn, ProviderSessionSwitchOptions, ProviderSessionSwitchResult } from './providers/ProviderSession';
30
+ export { useProviderSession, registerProviderSessionFactory } from './providers/ProviderSession';
31
+ export type { ApiProviderAdapter, ApiProviderRequest } from './providers/api/ApiProvider';
32
+ export { useApiProvider } from './providers/api/ApiProvider';
33
+ export type { DirectApiProviderConfig } from './providers/api/direct';
34
+ export { DirectApiProviderAdapter } from './providers/api/direct';
35
+ export { MockApiProviderAdapter } from './providers/api/mock';
36
+ export type { FirebaseApiProviderConfig } from './providers/api/firebase';
37
+ export { FirebaseApiProviderAdapter } from './providers/api/firebase';
38
+ export type { SupabaseApiProviderConfig } from './providers/api/supabase';
39
+ export { SupabaseApiProviderAdapter } from './providers/api/supabase';
20
40
  export type { MotionEffect, MotionReference, MotionRegistry, MotionStyle, MotionTransition, ReducedMotionMode, ResolvedMotionEffect } from './motion';
21
41
  export { createMotionTransition, resolveMotionEffect, useEnterMotion, useMotionEffect, useMotionState, usePressMotion } from './motion';
22
42
  export { FirebaseDataProvider } from './providers/data/firebase';
43
+ export { FirestoreDataProvider } from './providers/data/firestore';
23
44
  export { SupabaseDataProvider } from './providers/data/supabase';
24
45
  export { MockDataProvider } from './providers/data/mock';
25
46
  export { useDataProvider, DataProvider } from './providers/data/DataProviderContext';
26
- export type { StorageProviderAdapter } from './providers/storage/StorageProvider';
47
+ export type { StorageProviderAdapter, UploadOptions, StorageOptions, DeleteOptions, MoveOptions, ListOptions, StorageFileInfo, UploadHandle } from './providers/storage/StorageProvider';
27
48
  export { FirebaseStorageProvider } from './providers/storage/firebase';
28
49
  export { SupabaseStorageProvider } from './providers/storage/supabase';
29
50
  export { useStorageProvider, StorageProvider } from './providers/storage/StorageProviderContext';
30
51
  export type { AuthProviderAdapter, AuthIntent, AuthSignInOptions, UserProfile } from './providers/auth/AuthProvider';
31
52
  export { useAuthProvider, AuthProvider } from './providers/auth/AuthProviderContext';
32
53
  export { GoogleAuthProvider } from './providers/auth/google/GoogleAuthProvider';
54
+ export { FirebaseAuthProvider } from './providers/auth/firebase/FirebaseAuthProvider';
55
+ export { SupabaseAuthProvider } from './providers/auth/supabase/SupabaseAuthProvider';
33
56
  export { DropboxAuthProvider } from './providers/auth/dropbox/DropboxAuthProvider';
57
+ export type { CredentialsAdapter } from './providers/credentials/CredentialsProvider';
58
+ export { useCredentialsProvider } from './providers/credentials/CredentialsProviderContext';
59
+ export { GoogleServiceAccountProvider } from './providers/credentials/google/GoogleServiceAccountProvider';
34
60
  export type { EmailProviderAdapter, EmailSendParams } from './providers/email/EmailProvider';
35
61
  export type { IconProviderAdapter, IconComponentProps } from './providers/icon/IconProvider';
36
62
  export { LucideIconProvider } from './providers/icon/LucideIconProvider';
@@ -40,16 +66,15 @@ export { IconProvider, useIconProvider, useIconController } from './providers/ic
40
66
  export type { AppIconProviderConfig, IconController } from './providers/icon/IconProviderContext';
41
67
  export { useEmailProvider, EmailProvider } from './providers/email/EmailProviderContext';
42
68
  export { GmailEmailProvider } from './providers/email/google/GmailEmailProvider';
43
- export type { AIFetchConfig } from './providers/ai';
44
- export { getAIProviderConfigurationState } from './providers/ai';
69
+ export type { AIRequestOptions, AIAttachment, AIProviderAdapter, AIKeyValidationResult, AIModelDescriptor, AIProviderCapabilities, AIModelCatalog } from './providers/ai';
70
+ export { createAIProviderRegistry, getAIModelCatalog, formatAIModelRef, parseAIModelRef } from './providers/ai';
71
+ export { useAIProvider, useAIProviderRegistry, AIProvider } from './providers/ai/AIProviderContext';
72
+ export { proxyFetch, useProxy, configureProxy, isProxyEnabled } from './providers/proxy';
45
73
  export { googleGetAccessToken } from './providers/auth/google/GoogleAuth';
46
74
  export { sendEmail } from './providers/email/google/email';
47
75
  export { getKeywordIdeas } from './providers/seo/google/keyword';
48
76
  export { getGoogleTrendsData, getGoogleTrendsRelated } from './providers/seo/google/trend';
49
- export { default as db } from './providers/data/firebase';
50
- export { default as storage } from './providers/storage/firebase';
51
77
  export { dropBox, useDropBoxConnect, DropBoxConnectButton } from './providers/storage/dropbox';
52
- export { AI } from './providers/ai';
53
78
  export { default as scrape } from './providers/scrape';
54
79
  export * from './components';
55
80
  export * from './libs';
@@ -10,9 +10,9 @@ interface ConverterCore {
10
10
  subStringCount: (str: string, subStr: string) => number;
11
11
  }
12
12
  interface Converter extends ConverterCore {
13
- parse: (values: Record<string, any>, pattern: string, target?: {
13
+ parse: (values: Record<string, unknown>, pattern: string, target?: {
14
14
  key: string;
15
- value: any;
15
+ value: Record<string, unknown>;
16
16
  hideEmpty: boolean;
17
17
  }) => string;
18
18
  truncate: (str: string, length?: number) => string;
@@ -21,8 +21,8 @@ interface Converter extends ConverterCore {
21
21
  padLeft: (str: string, length: number, char?: string, regex?: RegExp) => string;
22
22
  padRight: (str: string, length: number, char?: string, regex?: RegExp) => string;
23
23
  toQueryString: (params: Record<string, string>, startWith?: string, fill?: string) => string;
24
- fillObject: <T>(obj: Record<string, T>, value?: any) => Record<string, any>;
25
- [key: string]: ConverterCore[keyof ConverterCore] | any;
24
+ fillObject: (obj: Record<string, unknown>, value?: unknown) => Record<string, unknown>;
25
+ [key: string]: unknown;
26
26
  }
27
27
  export declare const converter: Converter;
28
28
  export {};
@@ -0,0 +1,12 @@
1
+ export interface EditorHeightOptions {
2
+ minHeight?: number;
3
+ maxHeight?: number;
4
+ paddingOffset?: number;
5
+ }
6
+ export interface EditorHeightResult {
7
+ adjustedMinHeight: number;
8
+ wrapperStyle: React.CSSProperties;
9
+ resolvedMinHeight: number;
10
+ resolvedMaxHeight: number | undefined;
11
+ }
12
+ export declare function useEditorHeight({ minHeight, maxHeight, paddingOffset }: EditorHeightOptions): EditorHeightResult;
@@ -1,9 +1,9 @@
1
1
  interface FetchOptions {
2
2
  method?: "GET" | "POST" | "PUT" | "DELETE" | "HEAD" | "PATCH";
3
3
  headers?: Record<string, string>;
4
- body?: Record<string, any> | string;
4
+ body?: Record<string, unknown> | string;
5
5
  }
6
- export declare function fetchRest(url: string, options?: FetchOptions | null): Promise<any>;
7
- export declare function fetchJson(url: string, options?: FetchOptions | null): Promise<any>;
8
- export declare function fetchWithRetry(url: string, options?: RequestInit, maxRetries?: number, statusNoRetry?: number[]): Promise<any | Response>;
6
+ export declare function fetchRest(url: string, options?: FetchOptions | null, fetchFn?: typeof fetch): Promise<any>;
7
+ export declare function fetchJson(url: string, options?: FetchOptions | null, fetchFn?: typeof fetch): Promise<any>;
8
+ export declare function fetchWithRetry(url: string, options?: RequestInit, maxRetries?: number, statusNoRetry?: number[], fetchFn?: typeof fetch): Promise<any | Response>;
9
9
  export {};
@@ -1,18 +1,22 @@
1
1
  /**
2
- * imageBuilder pure utility for generating SEO/performance-optimised <img> tags
3
- * with srcset support. Does NOT resize images; assumes variant files already exist.
2
+ * imageBuilder - pure utility for generating SEO/performance-optimised <img> tags
3
+ * with srcset support.
4
4
  *
5
- * Two srcset modes:
6
- * density fixed-size images (logos, avatars): 1x / 2x / 3x descriptors
7
- * naming: image.jpg → image@2x.jpg, image@3x.jpg
8
- * width responsive/fluid images (hero, content): width descriptors + sizes
9
- * naming: image.jpg → image-400w.jpg, image-800w.jpg
5
+ * Three srcset modes:
6
+ * density - fixed-size images (logos, avatars): 1x / 2x / 3x descriptors
7
+ * naming: image.jpg → image@2x.jpg, image@3x.jpg
8
+ * width - responsive/fluid images (hero, content): width descriptors + sizes
9
+ * naming: image.jpg → image-400w.jpg, image-800w.jpg ...
10
+ * explicit - variants already in hand (data URIs or uploaded URLs); no naming assumptions
11
+ *
12
+ * resizeVariants() generates width-based variants client-side via canvas (browser only).
13
+ * Pair it with explicit mode to go from a single src to a full srcset without a server.
10
14
  */
11
15
  export type ImgFit = 'cover' | 'contain' | 'fill' | 'scale-down' | 'none';
12
16
  export interface ImageBuilderConfig {
13
17
  /** URL, relative path, or data URI of the source image (used as src and as the 1x/base variant in srcset). */
14
18
  src: string;
15
- /** Alt text required for SEO and accessibility. */
19
+ /** Alt text - required for SEO and accessibility. */
16
20
  alt: string;
17
21
  title?: string;
18
22
  /** Intrinsic display width in px. Prevents CLS (Core Web Vitals). */
@@ -23,7 +27,7 @@ export interface ImageBuilderConfig {
23
27
  position?: string;
24
28
  /**
25
29
  * loading="lazy" for below-the-fold images.
26
- * Do NOT use on LCP images use priority=true instead.
30
+ * Do NOT use on LCP images - use priority=true instead.
27
31
  * Default: 'lazy'.
28
32
  */
29
33
  loading?: 'lazy' | 'eager';
@@ -32,7 +36,7 @@ export interface ImageBuilderConfig {
32
36
  * Sets fetchpriority="high" and loading="eager". Overrides `loading`.
33
37
  */
34
38
  priority?: boolean;
35
- /** Default: 'async' frees the main thread from image decoding. */
39
+ /** Default: 'async' - frees the main thread from image decoding. */
36
40
  decoding?: 'async' | 'sync' | 'auto';
37
41
  className?: string;
38
42
  crossorigin?: 'anonymous' | 'use-credentials';
@@ -61,13 +65,37 @@ export interface SrcsetWidthConfig {
61
65
  */
62
66
  suffix?: (width: number) => string;
63
67
  /**
64
- * CSS sizes attribute tells the browser how wide the image renders at each breakpoint.
68
+ * CSS sizes attribute - tells the browser how wide the image renders at each breakpoint.
65
69
  * Required for width-mode srcset to work correctly.
66
70
  * Example: '(max-width: 640px) 100vw, (max-width: 1024px) 50vw, 33vw'
67
71
  */
68
72
  sizes?: string;
69
73
  }
70
- export type SrcsetConfig = SrcsetDensityConfig | SrcsetWidthConfig;
74
+ /**
75
+ * Explicit srcset: variants are already in hand (uploaded URLs or data URIs).
76
+ * No naming conventions assumed — each entry carries its own src.
77
+ * Use together with resizeVariants() for fully client-side srcset generation.
78
+ */
79
+ export interface SrcsetExplicitConfig {
80
+ mode: 'explicit';
81
+ /**
82
+ * Each variant must carry either a `width` (w descriptor) or a `density` (x descriptor).
83
+ * Mix of both in the same srcset is invalid per spec — pick one.
84
+ */
85
+ variants: Array<{
86
+ src: string;
87
+ width: number;
88
+ } | {
89
+ src: string;
90
+ density: number;
91
+ }>;
92
+ /**
93
+ * CSS sizes attribute. Only meaningful when variants use width descriptors.
94
+ * Example: '(max-width: 640px) 100vw, 800px'
95
+ */
96
+ sizes?: string;
97
+ }
98
+ export type SrcsetConfig = SrcsetDensityConfig | SrcsetWidthConfig | SrcsetExplicitConfig;
71
99
  /** JSON-serialisable representation of all <img> attributes. */
72
100
  export interface ImageParams {
73
101
  src: string;
@@ -88,14 +116,13 @@ export interface ImageParams {
88
116
  export interface UseImageResult {
89
117
  /** Generates the <img> HTML string with all SEO/performance attributes. */
90
118
  toHtml: (srcset?: SrcsetConfig) => string;
91
- /** Generates a JSON string of all img attributes for CMS, SSR or metadata. */
119
+ /** Generates a JSON string of all img attributes - for CMS, SSR or metadata. */
92
120
  toJson: (srcset?: SrcsetConfig) => string;
93
121
  /** Returns the raw ImageParams object for custom serialisation. */
94
122
  params: (srcset?: SrcsetConfig) => ImageParams;
95
123
  }
96
124
  /**
97
125
  * Returns toHtml / toJson / params helpers bound to the given image config.
98
- * Does NOT resize images — assumes variant files already exist on the server.
99
126
  *
100
127
  * @example
101
128
  * const img = useImage({ src: 'hero.jpg', alt: 'Hero', width: 800, height: 450, priority: true })
@@ -106,7 +133,29 @@ export interface UseImageResult {
106
133
  * // Fixed-size HTML with density srcset (files: hero.jpg, hero@2x.jpg, hero@3x.jpg)
107
134
  * img.toHtml({ mode: 'density', densities: [1, 2, 3] })
108
135
  *
136
+ * // Explicit srcset from resizeVariants() or uploaded URLs — no naming assumptions
137
+ * const variants = await resizeVariants('photo.jpg', [400, 800])
138
+ * img.toHtml({ mode: 'explicit', variants, sizes: '(max-width: 640px) 100vw, 800px' })
139
+ *
109
140
  * // JSON params for CMS or SSR
110
141
  * img.toJson({ mode: 'width', widths: [400, 800, 1200], sizes: '100vw' })
111
142
  */
112
143
  export declare function useImage(config: ImageBuilderConfig): UseImageResult;
144
+ /**
145
+ * Resizes a source image to multiple widths proportionally using canvas (browser only).
146
+ * Widths larger than the natural image width are skipped — the original is used as the
147
+ * largest variant instead, avoiding pointless upscaling.
148
+ *
149
+ * Returns an array of { src: dataURI, width } ready to pass as `variants` in explicit mode.
150
+ * After uploading each variant to storage, swap the data URIs for the resulting URLs.
151
+ *
152
+ * @example
153
+ * const variants = await resizeVariants(file, [400, 800, 1200])
154
+ * // upload variants to storage if needed, then:
155
+ * useImage({ src: variants.at(-1)!.src, alt: 'Photo' })
156
+ * .toHtml({ mode: 'explicit', variants, sizes: '(max-width: 640px) 100vw, 800px' })
157
+ */
158
+ export declare function resizeVariants(src: string, widths: number[]): Promise<Array<{
159
+ src: string;
160
+ width: number;
161
+ }>>;
@@ -0,0 +1,35 @@
1
+ import type { StorageProviderAdapter } from '../providers/storage/StorageProvider';
2
+ export interface ImageVariant {
3
+ width: number;
4
+ /** Canvas-generated data URI — safe to pass to storage.upload(). */
5
+ dataUri: string;
6
+ /** Blob URL — comma-safe for srcset strings (data URIs contain commas). */
7
+ localUrl: string;
8
+ }
9
+ /**
10
+ * Resize an image to each requested width, returning blob URLs (no original).
11
+ * Widths ≥ natural image width are silently skipped (no upscaling).
12
+ * Also returns naturalWidth so the caller can add the original to srcset.
13
+ */
14
+ export declare function resizeToVariants(src: string, widths: number[]): Promise<{
15
+ variants: ImageVariant[];
16
+ naturalWidth: number;
17
+ }>;
18
+ /**
19
+ * Upload pre-generated variants to storage, replacing local URLs with remote ones.
20
+ * Each variant is stored as `<uploadPath>/<baseName>_<width>w.<ext>`.
21
+ * Falls back to the variant's local blob URL if upload fails.
22
+ */
23
+ export declare function uploadVariants(variants: ImageVariant[], storage: StorageProviderAdapter, uploadPath: string, fileName: string): Promise<Array<{
24
+ url: string;
25
+ width: number;
26
+ }>>;
27
+ /** Build a width-based srcset string from `{url, width}` entries. */
28
+ export declare function buildSrcset(entries: Array<{
29
+ url: string;
30
+ width: number;
31
+ }>): string;
32
+ /** Extract the filename from a URL path, data URI, or blob URL. */
33
+ export declare function fileNameFromUrl(url: string): string;
34
+ /** Derive a human-readable alt text from a filename (strips extension, replaces separators). */
35
+ export declare function altFromFileName(fileName: string): string;
@@ -1,8 +1,5 @@
1
- export { default as db } from './database';
2
- export { default as storage } from './storage';
3
1
  export { default as path } from './path';
4
- export { default as log } from './log';
5
- export { default as seo } from './seo';
2
+ export * from './editorHeight';
6
3
  export * from './converter';
7
4
  export * from './sanitizer';
8
5
  export * from './email';
@@ -0,0 +1,24 @@
1
+ import { type AIAttachment } from '../providers/ai/AIProvider';
2
+ export declare const PromptUtils: {
3
+ /**
4
+ * Rough token count: ~4 chars per token (heuristic, no tiktoken needed).
5
+ */
6
+ countTokens(text: string): number;
7
+ /**
8
+ * Returns the known context window for the model, or null if unknown.
9
+ */
10
+ modelContextWindow(modelRef: string): number | null;
11
+ /**
12
+ * Percentage of the model's context window used by `tokens`.
13
+ * Returns 0 if the model context window is unknown.
14
+ */
15
+ contextPercent(tokens: number, modelRef: string): number;
16
+ /**
17
+ * Estimated cost in USD. Returns NaN if pricing is unavailable for the model.
18
+ */
19
+ estimateCost(tokensIn: number, tokensOut: number, modelRef: string): number;
20
+ /**
21
+ * Convert a browser File into the transport-ready attachment shape used by AI providers.
22
+ */
23
+ fileToAttachment(file: File): Promise<AIAttachment>;
24
+ };
@@ -28,8 +28,8 @@ export declare class Sanitizer {
28
28
  private config;
29
29
  private matches;
30
30
  constructor(config?: SanitizerConfig, matches?: SanitizerMatch[]);
31
- apply(ruleName: keyof SanitizerConfig, value: any, autoCast?: boolean): any;
32
- applyMatches<T extends Record<string, any>>(obj: T, autoCast?: boolean): T;
31
+ apply(ruleName: keyof SanitizerConfig, value: unknown, autoCast?: boolean): unknown;
32
+ applyMatches<T extends Record<string, unknown>>(obj: T, autoCast?: boolean): T;
33
33
  getOptions(): Record<string, string>[];
34
34
  addRule(name: keyof SanitizerConfig, rule: SanitizerRule): void;
35
35
  addMatch(pattern: string, use: keyof SanitizerConfig): void;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { RecordProps } from '../providers/data/DataProvider';
3
- export declare const decodeJWT: (token: string) => any;
3
+ export declare const decodeJWT: (token: string) => unknown;
4
4
  export declare const copyToClipboard: (text: string) => void;
5
5
  export declare const trimPath: (path?: string) => string;
6
6
  export declare const normalizePath: (path?: string) => string;
@@ -8,7 +8,6 @@ export declare const trimSlash: (path?: string | number | boolean) => string;
8
8
  export declare const normalizeKey: (key?: string | number | boolean) => string;
9
9
  export declare const dirname: (path: string) => string;
10
10
  export declare function sleep(ms: number): Promise<void>;
11
- export declare function proxy(url: string, format?: string): string;
12
11
  export declare function generateUniqueId(name?: null): string;
13
12
  export declare function eventClosest(e: Event, tagName: string): HTMLElement | null;
14
13
  export declare const substrCount: (str: string, sub: string) => number;
@@ -24,23 +23,23 @@ export declare const crc32: (str: string) => number;
24
23
  export declare const ucfirst: (str?: string) => string;
25
24
  export declare const loadScripts: (scriptData: Array<{
26
25
  src: string;
27
- [key: string]: any;
26
+ [key: string]: unknown;
28
27
  }>) => void;
29
28
  export declare const intersectObjects: (obj1: {
30
- [key: string]: any;
29
+ [key: string]: unknown;
31
30
  }, obj2: {
32
- [key: string]: any;
31
+ [key: string]: unknown;
33
32
  }) => {
34
- [key: string]: any;
33
+ [key: string]: unknown;
35
34
  };
36
35
  export declare const replaceVariables: (pattern: string, metaObject: {
37
36
  [key: string]: string | undefined;
38
37
  }) => string;
39
38
  export declare const arrayUnique: <T>(array: T[], key?: keyof T) => T[];
40
- export declare const isEmpty: (data: any) => boolean;
39
+ export declare const isEmpty: (data: unknown) => boolean;
41
40
  export declare function safeClone<T>(obj: T): T;
42
41
  export declare function base64Encode(input: string | Buffer | ArrayBuffer): string;
43
- export declare function arraysEqual(a: any[], b: any[]): boolean;
42
+ export declare function arraysEqual(a: unknown[], b: unknown[]): boolean;
44
43
  export declare function sanitizeKey(str: string): string;
45
44
  /**
46
45
  * Checks if the event target or any of its parent elements is an interactive element
@@ -52,6 +51,6 @@ export declare function isInteractiveElement(e: Event | React.MouseEvent, exclud
52
51
  export declare const render2Base64: (arrayBuffer: ArrayBuffer) => string;
53
52
  export declare const base64ToBlob: (base64: string, type: string) => Blob | undefined;
54
53
  export declare const base64ToUrl: (base64: string, type: string) => string | undefined;
55
- export declare const getRecordValue: (record?: RecordProps, name?: string) => any;
54
+ export declare const getRecordValue: (record?: RecordProps, name?: string) => unknown;
56
55
  export declare const cleanRecord: (record: RecordProps | undefined) => RecordProps;
57
- export declare const smartTypeCast: (value: any) => string | number | boolean | null | undefined;
56
+ export declare const smartTypeCast: (value: unknown) => string | number | boolean | null | undefined;
@@ -1,3 +1 @@
1
1
  export { default as PageUsers } from './Users';
2
- export { default as PageHelper } from './Helper';
3
- export { default as PageBlog } from './Blog';
@@ -6,6 +6,12 @@ export interface ProviderConfigurationState {
6
6
  export interface ProviderConfigurable {
7
7
  isConfigured?(): boolean;
8
8
  getConfigurationState?(): ProviderConfigurationState;
9
+ /**
10
+ * Optional teardown hook. Called by setProvider() before an adapter is replaced
11
+ * in the registry — e.g. unsubscribe realtime listeners, sign out, close connections.
12
+ * Never called on unmount; only on explicit replacement.
13
+ */
14
+ dispose?(): Promise<void> | void;
9
15
  }
10
16
  export declare const getMissingKeys: (config: Record<string, unknown> | undefined, keys: string[], prefix?: string) => string[];
11
17
  export declare const createConfigurationState: (provider: string, missingKeys: string[]) => ProviderConfigurationState;
@@ -0,0 +1,51 @@
1
+ import React from 'react';
2
+ import type { DataProviderAdapter } from './data/DataProvider';
3
+ import type { StorageProviderAdapter } from './storage/StorageProvider';
4
+ import type { AuthProviderAdapter } from './auth/AuthProvider';
5
+ import type { EmailProviderAdapter } from './email/EmailProvider';
6
+ import type { AIProviderAdapter } from './ai/AIProvider';
7
+ import type { CredentialsAdapter } from './credentials/CredentialsProvider';
8
+ export type ProviderAdapterMap = {
9
+ data: DataProviderAdapter;
10
+ storage: StorageProviderAdapter;
11
+ auth: AuthProviderAdapter;
12
+ email: EmailProviderAdapter;
13
+ ai: AIProviderAdapter;
14
+ credentials: CredentialsAdapter;
15
+ };
16
+ /** The 6 categories the framework ships out of the box. Any other string is a valid category too — see customCategories on <App>. */
17
+ export type ProviderService = keyof ProviderAdapterMap;
18
+ export type ProviderRegistrySnapshot = Record<string, {
19
+ registry: Record<string, unknown>;
20
+ defaultKey: string;
21
+ }>;
22
+ /**
23
+ * Replaces a single named adapter in a provider registry at runtime, in ANY
24
+ * category — one of the 6 built-in ones (typed) or an arbitrary custom one a
25
+ * vertical registered (string). Calls the previous adapter's dispose() (if
26
+ * defined) before swapping it in, then propagates the new registry to every
27
+ * useXProvider()/useProvider() consumer. If `category` didn't exist yet, it's
28
+ * created — categories can be registered after bootstrap, not only via <App providers>.
29
+ */
30
+ export type SetProviderFn = {
31
+ <S extends ProviderService>(category: S, key: string, adapter: ProviderAdapterMap[S]): Promise<void>;
32
+ (category: string, key: string, adapter: unknown): Promise<void>;
33
+ };
34
+ type ProviderRegistryContextValue = {
35
+ registries: ProviderRegistrySnapshot;
36
+ setProvider: SetProviderFn;
37
+ };
38
+ declare const ProviderRegistryContext: React.Context<ProviderRegistryContextValue | null>;
39
+ export declare const ProviderRegistryProvider: ({ registries, setProvider, children, }: ProviderRegistryContextValue & {
40
+ children: React.ReactNode;
41
+ }) => React.JSX.Element;
42
+ /** Imperatively swap a provider adapter at runtime (e.g. reconnect data/storage to a different backend). */
43
+ export declare const useSetProvider: () => SetProviderFn;
44
+ /**
45
+ * Generic read access to any provider category — built-in or custom. Prefer the
46
+ * typed useDataProvider()/useStorageProvider()/... for the 6 built-ins; reach for
47
+ * this when consuming a category the framework doesn't know about (registered via
48
+ * providers.customCategories or a runtime setProvider() call).
49
+ */
50
+ export declare const useProvider: <T = unknown>(category: string, key?: string) => T;
51
+ export default ProviderRegistryContext;
@@ -0,0 +1,68 @@
1
+ import type { SetProviderFn } from './ProviderRegistryContext';
2
+ /**
3
+ * Generic multi-backend session switch — no domain vocabulary (tenant, workspace, ...).
4
+ * Given an endpoint that returns which backend project to connect to (per category —
5
+ * data, storage, or any custom category a vertical registered) and a scoped credential
6
+ * for it, resolves the right adapter and swaps it in via setProvider().
7
+ *
8
+ * A vertical app (e.g. a CMS with tenants) wraps this in its own thin, named provider
9
+ * (e.g. TenantProvider, mounted via <App contextProviders>) that knows what a "session"
10
+ * means for that app — this hook only knows how to connect to a backend and get out
11
+ * of the way.
12
+ */
13
+ export type ProviderSessionCredential = {
14
+ type: string;
15
+ } & Record<string, unknown>;
16
+ export type ProviderSessionAssignment = {
17
+ /**
18
+ * Matched against the factory registry below — 'firebase'/'supabase'/'mock' are
19
+ * built in, a vertical can register more with registerProviderSessionFactory().
20
+ * An assignment whose (category, type) has no registered factory is discarded,
21
+ * not an error — a session response can describe categories/types this particular
22
+ * app build doesn't know about without breaking the switch for the ones it does.
23
+ */
24
+ type: string;
25
+ /** Client-safe config for this provider's project — never a secret. */
26
+ publicConfig: Record<string, unknown>;
27
+ /** Scoped, short-lived credential resolved server-side. Absent = anonymous/public access. */
28
+ credential?: ProviderSessionCredential;
29
+ };
30
+ /** category (data, storage, or any custom one) → assignment. Open-ended on purpose. */
31
+ export type ProviderSessionResponse = {
32
+ providers: Record<string, ProviderSessionAssignment>;
33
+ };
34
+ export type ProviderSessionFactory = (assignment: ProviderSessionAssignment) => unknown | Promise<unknown>;
35
+ /**
36
+ * Registers how to turn a ProviderSessionAssignment into a live adapter for a given
37
+ * (category, type) pair. Callable anytime — at module load, or later once a feature
38
+ * that needs it is loaded — not only at <App> bootstrap.
39
+ */
40
+ export declare const registerProviderSessionFactory: (category: string, type: string, factory: ProviderSessionFactory) => void;
41
+ export type ProviderSessionSwitchOptions = {
42
+ fetchOptions?: RequestInit;
43
+ /**
44
+ * Inspect or transform the raw response before it's applied — e.g. inject an extra
45
+ * category, filter one out, forward it to an audit log. Whatever this returns
46
+ * (defaults to the untouched response) is what actually gets applied.
47
+ */
48
+ onResponse?: (response: ProviderSessionResponse) => ProviderSessionResponse | Promise<ProviderSessionResponse>;
49
+ };
50
+ /** Which (category, type) pairs were actually applied vs had no matching factory. */
51
+ export type ProviderSessionSwitchResult = {
52
+ applied: string[];
53
+ skipped: {
54
+ category: string;
55
+ type: string;
56
+ }[];
57
+ };
58
+ /**
59
+ * Either a URL to fetch (real backend) or a resolver function that produces the same
60
+ * response shape directly (e.g. a mock backend, or any non-HTTP source). Everything
61
+ * downstream of "here's the response body" is identical either way — only the transport
62
+ * differs, so swapping a mock resolver for a real endpoint later touches no other code.
63
+ */
64
+ export type SwitchProviderSessionFn = (source: string | (() => Promise<ProviderSessionResponse>), options?: ProviderSessionSwitchOptions) => Promise<ProviderSessionSwitchResult>;
65
+ export declare const useProviderSession: () => {
66
+ switchSession: SwitchProviderSessionFn;
67
+ setProvider: SetProviderFn;
68
+ };
@@ -0,0 +1,57 @@
1
+ import type { PromptVariables } from '../../conf/Prompt';
2
+ import type { ProviderConfigurable } from '../ProviderConfiguration';
3
+ export interface AIModelDescriptor {
4
+ id: string;
5
+ provider: string;
6
+ model: string;
7
+ label: string;
8
+ deprecated?: boolean;
9
+ }
10
+ export interface AIProviderCapabilities {
11
+ models: AIModelDescriptor[];
12
+ supportsTemperature?: boolean;
13
+ supportsVision?: boolean;
14
+ supportsDocuments?: boolean;
15
+ }
16
+ export interface AIAttachment {
17
+ mimeType: string;
18
+ base64: string;
19
+ name?: string;
20
+ }
21
+ export interface AIRequestOptions {
22
+ language?: string;
23
+ voice?: string;
24
+ style?: string;
25
+ role?: string;
26
+ model?: string;
27
+ temperature?: number;
28
+ attachments?: AIAttachment[];
29
+ }
30
+ export interface AICompleteRequest extends AIRequestOptions {
31
+ prompt: string;
32
+ data?: PromptVariables;
33
+ }
34
+ export interface AIKeyValidationResult {
35
+ valid: boolean;
36
+ /** Human-readable error from the provider API (e.g. "Incorrect API key provided"). */
37
+ error?: string;
38
+ /** URL to the provider's API key management page, for showing in UI. */
39
+ dashboardUrl?: string;
40
+ }
41
+ export interface AIProviderAdapter extends ProviderConfigurable {
42
+ id: string;
43
+ label: string;
44
+ defaultModel: string;
45
+ /** URL to the provider's API key management page. */
46
+ dashboardUrl?: string;
47
+ getCapabilities(forceRefresh?: boolean): Promise<AIProviderCapabilities>;
48
+ complete(request: AICompleteRequest): Promise<string | null>;
49
+ /** Makes a live API call to verify the key is accepted. Never uses cache. */
50
+ validateApiKey(): Promise<AIKeyValidationResult>;
51
+ }
52
+ export interface AIModelRef {
53
+ provider: string;
54
+ model: string;
55
+ }
56
+ export declare const formatAIModelRef: (provider: string, model: string) => string;
57
+ export declare const parseAIModelRef: (value?: string | null) => AIModelRef | null;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import type { AIProviderAdapter } from './AIProvider';
3
+ type AIProviderContextValue = {
4
+ registry: Record<string, AIProviderAdapter>;
5
+ defaultKey: string;
6
+ };
7
+ declare const AIProviderContext: React.Context<AIProviderContextValue | null>;
8
+ export declare const AIProvider: ({ registry, defaultKey, children, }: AIProviderContextValue & {
9
+ children: React.ReactNode;
10
+ }) => React.JSX.Element;
11
+ export declare const useAIProvider: (name?: string) => AIProviderAdapter | null;
12
+ export declare const useAIProviderRegistry: () => AIProviderContextValue | null;
13
+ export default AIProviderContext;
@@ -0,0 +1,2 @@
1
+ import type { AIProviderDefinition } from './shared';
2
+ export declare const ANTHROPIC_PROVIDER_DEFINITION: AIProviderDefinition;
@@ -0,0 +1 @@
1
+ export declare const DEEPSEEK_PROVIDER_DEFINITION: import("./shared").AIProviderDefinition;