@smart-cloud/ai-kit-ui 1.4.12 → 1.4.14

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 (42) hide show
  1. package/dist/ShadowBoundary.d.ts +29 -0
  2. package/dist/ai-chatbot/AiChatbot.d.ts +15 -0
  3. package/dist/ai-chatbot/attachmentStorage.d.ts +19 -0
  4. package/dist/ai-chatbot/index.d.ts +1 -0
  5. package/dist/ai-feature/AiFeature.d.ts +28 -0
  6. package/dist/ai-feature/AiFeatureBorder.d.ts +5 -0
  7. package/dist/ai-feature/ProofreadDiff.d.ts +13 -0
  8. package/dist/ai-feature/index.d.ts +2 -0
  9. package/dist/ai-feature/utils.d.ts +1 -0
  10. package/dist/doc-search/DocSearch.d.ts +18 -0
  11. package/dist/doc-search/index.d.ts +1 -0
  12. package/dist/i18n/ar.d.ts +1 -0
  13. package/dist/i18n/de.d.ts +1 -0
  14. package/dist/i18n/en.d.ts +1 -0
  15. package/dist/i18n/es.d.ts +1 -0
  16. package/dist/i18n/fr.d.ts +1 -0
  17. package/dist/i18n/he.d.ts +1 -0
  18. package/dist/i18n/hi.d.ts +1 -0
  19. package/dist/i18n/hu.d.ts +1 -0
  20. package/dist/i18n/id.d.ts +1 -0
  21. package/dist/i18n/index.d.ts +1 -0
  22. package/dist/i18n/it.d.ts +1 -0
  23. package/dist/i18n/ja.d.ts +1 -0
  24. package/dist/i18n/ko.d.ts +1 -0
  25. package/dist/i18n/nb.d.ts +1 -0
  26. package/dist/i18n/nl.d.ts +1 -0
  27. package/dist/i18n/pl.d.ts +1 -0
  28. package/dist/i18n/pt.d.ts +1 -0
  29. package/dist/i18n/ru.d.ts +1 -0
  30. package/dist/i18n/sv.d.ts +1 -0
  31. package/dist/i18n/th.d.ts +1 -0
  32. package/dist/i18n/tr.d.ts +1 -0
  33. package/dist/i18n/ua.d.ts +1 -0
  34. package/dist/i18n/zh.d.ts +1 -0
  35. package/dist/index.d.ts +6 -112
  36. package/dist/poweredBy.d.ts +4 -0
  37. package/dist/useAiRun.d.ts +38 -0
  38. package/dist/withAiKitShell.d.ts +7 -0
  39. package/package.json +28 -26
  40. package/tsconfig.types.json +13 -0
  41. package/tsup.config.ts +1 -1
  42. package/dist/index.d.cts +0 -112
@@ -0,0 +1,29 @@
1
+ import { SetStateAction } from "react";
2
+ export type ShadowBoundaryMode = "local" | "overlay";
3
+ export type ShadowBoundaryProps = {
4
+ /** Stylesheets to inject into the shadow root (as <link rel="stylesheet">). */
5
+ stylesheets: string[];
6
+ /** ID of the element inside the shadow root used as the portal target. */
7
+ rootElementId: string;
8
+ /** Variation of the shadow boundary behavior. */
9
+ variation?: "default" | "modal";
10
+ /**
11
+ * Where to create the shadow root:
12
+ * - "local": attach shadow to this component's host element (keeps layout positioning).
13
+ * - "overlay": attach shadow to a singleton element in top (or self) document (always on top).
14
+ */
15
+ mode?: ShadowBoundaryMode;
16
+ /**
17
+ * For mode="overlay": host id in the top (or self) document.
18
+ * Same id everywhere => singleton overlay host.
19
+ */
20
+ overlayRootId?: string;
21
+ setHost: React.Dispatch<SetStateAction<HTMLElement | null>>;
22
+ children: (api: {
23
+ /** Portal target element inside the shadow root. */
24
+ rootElement: HTMLDivElement;
25
+ /** Shadow root instance. */
26
+ shadowRoot: ShadowRoot;
27
+ }) => React.ReactNode;
28
+ };
29
+ export declare function ShadowBoundary({ stylesheets, children, rootElementId, mode, overlayRootId, setHost, }: ShadowBoundaryProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import { type AiChatbotLabels, type HistoryStorageMode } from "@smart-cloud/ai-kit-core";
2
+ import React from "react";
3
+ export declare const DEFAULT_CHATBOT_LABELS: Required<AiChatbotLabels>;
4
+ export declare const AiChatbot: React.FC<import("@smart-cloud/ai-kit-core").AiWorkerProps & {
5
+ context?: import("@smart-cloud/ai-kit-core").ContextKind;
6
+ placeholder?: string;
7
+ maxImages?: number;
8
+ maxImageBytes?: number;
9
+ previewMode?: boolean;
10
+ historyStorage?: HistoryStorageMode;
11
+ emptyHistoryAfterDays?: number;
12
+ labels?: AiChatbotLabels;
13
+ openButtonIconLayout?: import("@smart-cloud/ai-kit-core").OpenButtonIconLayout;
14
+ openButtonPosition?: import("@smart-cloud/ai-kit-core").OpenButtonPosition;
15
+ } & Partial<import("@smart-cloud/ai-kit-core").AiWorkerProps>>;
@@ -0,0 +1,19 @@
1
+ export type StoredAttachment = {
2
+ id: string;
3
+ name: string;
4
+ type: string;
5
+ size: number;
6
+ blob: Blob;
7
+ createdAt: number;
8
+ };
9
+ export declare function persistAttachmentBlob(id: string, blob: Blob, meta: {
10
+ name: string;
11
+ type: string;
12
+ size: number;
13
+ }): Promise<string | null>;
14
+ export declare function loadAttachmentBlob(id: string): Promise<StoredAttachment | null>;
15
+ export declare function deleteAttachmentBlob(id: string): Promise<void>;
16
+ export declare function clearAllAttachments(): Promise<void>;
17
+ export declare function cleanupDanglingAttachments(validIds: Set<string>): Promise<void>;
18
+ export declare function getAllAttachments(): Promise<StoredAttachment[]>;
19
+ export declare function enforceStorageQuota(): Promise<void>;
@@ -0,0 +1 @@
1
+ export { AiChatbot, DEFAULT_CHATBOT_LABELS } from "./AiChatbot";
@@ -0,0 +1,28 @@
1
+ import { type AiModePreference } from "@smart-cloud/ai-kit-core";
2
+ import { FC } from "react";
3
+ export declare const AiFeature: FC<import("@smart-cloud/ai-kit-core").AiWorkerProps & {
4
+ mode: import("@smart-cloud/ai-kit-core").AiFeatureMode;
5
+ context?: import("@smart-cloud/ai-kit-core").ContextKind;
6
+ modeOverride?: AiModePreference;
7
+ autoRun?: boolean;
8
+ onDeviceTimeout?: number;
9
+ editable?: boolean;
10
+ acceptButtonTitle?: string;
11
+ showRegenerateOnBackendButton?: boolean;
12
+ optionsDisplay?: "collapse" | "horizontal" | "vertical";
13
+ default?: import("@smart-cloud/ai-kit-core").AiFeatureOptions & {
14
+ getText?: Promise<string> | (() => Promise<string>);
15
+ image?: Blob;
16
+ };
17
+ allowOverride?: {
18
+ text?: boolean;
19
+ instructions?: boolean;
20
+ tone?: boolean;
21
+ length?: boolean;
22
+ type?: boolean;
23
+ outputLanguage?: boolean;
24
+ outputFormat?: boolean;
25
+ };
26
+ onAccept?: (result: unknown) => void;
27
+ onOptionsChanged?: (options: import("@smart-cloud/ai-kit-core").AiFeatureOptions) => void;
28
+ } & Partial<import("@smart-cloud/ai-kit-core").AiWorkerProps>>;
@@ -0,0 +1,5 @@
1
+ export declare function AiFeatureBorder({ enabled, working, variation, children, }: React.PropsWithChildren<{
2
+ enabled?: boolean;
3
+ working?: boolean;
4
+ variation?: string;
5
+ }>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ export type Correction = {
2
+ startIndex: number;
3
+ endIndex: number;
4
+ correction?: string;
5
+ replacement?: string;
6
+ explanation?: string;
7
+ type?: string;
8
+ };
9
+ export type ProofreadDiffProps = {
10
+ original: string;
11
+ corrections: Correction[];
12
+ };
13
+ export declare function ProofreadDiff({ original, corrections }: ProofreadDiffProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { AiFeature } from "./AiFeature";
2
+ export { markdownToHtml } from "./utils";
@@ -0,0 +1 @@
1
+ export declare const markdownToHtml: (markdown: string) => Promise<string>;
@@ -0,0 +1,18 @@
1
+ import { type ContextKind } from "@smart-cloud/ai-kit-core";
2
+ import { FC } from "react";
3
+ export declare const DocSearch: FC<import("@smart-cloud/ai-kit-core").AiWorkerProps & {
4
+ context?: ContextKind;
5
+ autoRun?: boolean;
6
+ title?: string;
7
+ getSearchText?: () => string;
8
+ searchButtonIcon?: string;
9
+ showSearchButtonTitle?: boolean;
10
+ showSearchButtonIcon?: boolean;
11
+ showSources?: boolean;
12
+ topK?: number;
13
+ snippetMaxChars?: number;
14
+ onClickDoc?: (doc: import("@smart-cloud/ai-kit-core").RetrievedDoc) => void;
15
+ enableUserFilters?: boolean;
16
+ availableCategories?: Record<string, string[]>;
17
+ availableTags?: string[];
18
+ } & Partial<import("@smart-cloud/ai-kit-core").AiWorkerProps>>;
@@ -0,0 +1 @@
1
+ export { DocSearch } from "./DocSearch";
@@ -0,0 +1 @@
1
+ export declare const arDict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const deDict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const enDict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const esDict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const frDict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const heDict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const hiDict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const huDict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const idDict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const translations: Record<string, Record<string, string>>;
@@ -0,0 +1 @@
1
+ export declare const itDict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const jaDict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const koDict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const nbDict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const nlDict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const plDict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const ptDict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const ruDict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const svDict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const thDict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const trDict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const uaDict: Record<string, string>;
@@ -0,0 +1 @@
1
+ export declare const zhDict: Record<string, string>;
package/dist/index.d.ts CHANGED
@@ -1,112 +1,6 @@
1
- import * as _smart_cloud_ai_kit_core from '@smart-cloud/ai-kit-core';
2
- import { AiModePreference, HistoryStorageMode, AiChatbotLabels, ContextKind, AiKitStatusEvent, AiKitLanguageCode, AiWorkerProps } from '@smart-cloud/ai-kit-core';
3
- import * as React from 'react';
4
- import React__default, { FC, ComponentType } from 'react';
5
-
6
- declare const AiFeature: FC<_smart_cloud_ai_kit_core.AiWorkerProps & {
7
- mode: _smart_cloud_ai_kit_core.AiFeatureMode;
8
- context?: _smart_cloud_ai_kit_core.ContextKind;
9
- modeOverride?: AiModePreference;
10
- autoRun?: boolean;
11
- onDeviceTimeout?: number;
12
- editable?: boolean;
13
- acceptButtonTitle?: string;
14
- showRegenerateOnBackendButton?: boolean;
15
- optionsDisplay?: "collapse" | "horizontal" | "vertical";
16
- default?: _smart_cloud_ai_kit_core.AiFeatureOptions & {
17
- getText?: Promise<string> | (() => Promise<string>);
18
- image?: Blob;
19
- };
20
- allowOverride?: {
21
- text?: boolean;
22
- instructions?: boolean;
23
- tone?: boolean;
24
- length?: boolean;
25
- type?: boolean;
26
- outputLanguage?: boolean;
27
- outputFormat?: boolean;
28
- };
29
- onAccept?: (result: unknown) => void;
30
- onOptionsChanged?: (options: _smart_cloud_ai_kit_core.AiFeatureOptions) => void;
31
- } & Partial<_smart_cloud_ai_kit_core.AiWorkerProps>>;
32
-
33
- declare const markdownToHtml: (markdown: string) => Promise<string>;
34
-
35
- declare const DEFAULT_CHATBOT_LABELS: Required<AiChatbotLabels>;
36
- declare const AiChatbot: React__default.FC<_smart_cloud_ai_kit_core.AiWorkerProps & {
37
- context?: _smart_cloud_ai_kit_core.ContextKind;
38
- placeholder?: string;
39
- maxImages?: number;
40
- maxImageBytes?: number;
41
- previewMode?: boolean;
42
- historyStorage?: HistoryStorageMode;
43
- emptyHistoryAfterDays?: number;
44
- labels?: AiChatbotLabels;
45
- openButtonIconLayout?: _smart_cloud_ai_kit_core.OpenButtonIconLayout;
46
- openButtonPosition?: _smart_cloud_ai_kit_core.OpenButtonPosition;
47
- } & Partial<_smart_cloud_ai_kit_core.AiWorkerProps>>;
48
-
49
- declare const DocSearch: FC<_smart_cloud_ai_kit_core.AiWorkerProps & {
50
- context?: ContextKind;
51
- autoRun?: boolean;
52
- title?: string;
53
- getSearchText?: () => string;
54
- searchButtonIcon?: string;
55
- showSearchButtonTitle?: boolean;
56
- showSearchButtonIcon?: boolean;
57
- showSources?: boolean;
58
- topK?: number;
59
- snippetMaxChars?: number;
60
- onClickDoc?: (doc: _smart_cloud_ai_kit_core.RetrievedDoc) => void;
61
- enableUserFilters?: boolean;
62
- availableCategories?: Record<string, string[]>;
63
- availableTags?: string[];
64
- } & Partial<_smart_cloud_ai_kit_core.AiWorkerProps>>;
65
-
66
- type AiRunState<T> = {
67
- busy: boolean;
68
- error: string | null;
69
- statusEvent: AiKitStatusEvent | null;
70
- result: T | null;
71
- isCancelled: boolean;
72
- /** Last known execution source (best-effort). */
73
- lastSource: "on-device" | "backend" | null;
74
- };
75
- type AiFeatureFunction<T> = (args: {
76
- signal: AbortSignal;
77
- onStatus: (e: AiKitStatusEvent) => void;
78
- }) => Promise<T>;
79
- type UseAiRunResult<T> = AiRunState<T> & {
80
- run: (func: AiFeatureFunction<T>) => Promise<T | null>;
81
- cancel: () => void;
82
- reset: () => void;
83
- /** Current AbortSignal, if a run is in-flight. */
84
- signal: AbortSignal | null;
85
- };
86
- /**
87
- * Returns true if backend routing is configured in the current AiKit settings.
88
- *
89
- * This is intentionally conservative: it only checks *configuration*, not reachability.
90
- */
91
- declare function isBackendConfigured(): Promise<boolean>;
92
- declare function readDefaultOutputLanguage(): AiKitLanguageCode;
93
- /**
94
- * Removes a single surrounding Markdown code fence.
95
- *
96
- * Handles common model outputs like:
97
- * ```json
98
- * {"a":1}
99
- * ```
100
- */
101
- declare function stripCodeFence(text: string): string;
102
- declare function useAiRun<T>(): UseAiRunResult<T>;
103
-
104
- type AiKitShellInjectedProps = {
105
- language?: string;
106
- rootElement: HTMLElement;
107
- };
108
- declare function withAiKitShell<P extends object>(RootComponent: ComponentType<P & AiKitShellInjectedProps>, propOverrides?: Partial<AiWorkerProps>): React.FC<P & Partial<AiWorkerProps>>;
109
-
110
- declare const translations: Record<string, Record<string, string>>;
111
-
112
- export { AiChatbot, AiFeature, type AiFeatureFunction, type AiRunState, DEFAULT_CHATBOT_LABELS, DocSearch, type UseAiRunResult, isBackendConfigured, markdownToHtml, readDefaultOutputLanguage, stripCodeFence, translations, useAiRun, withAiKitShell };
1
+ export * from "./ai-feature";
2
+ export * from "./ai-chatbot";
3
+ export * from "./doc-search";
4
+ export * from "./useAiRun";
5
+ export { withAiKitShell } from "./withAiKitShell";
6
+ export { translations } from "./i18n";
@@ -0,0 +1,4 @@
1
+ import { FC } from "react";
2
+ export declare const PoweredBy: FC<{
3
+ variation?: "default" | "modal";
4
+ }>;
@@ -0,0 +1,38 @@
1
+ import { AiKitLanguageCode, type AiKitStatusEvent } from "@smart-cloud/ai-kit-core";
2
+ export type AiRunState<T> = {
3
+ busy: boolean;
4
+ error: string | null;
5
+ statusEvent: AiKitStatusEvent | null;
6
+ result: T | null;
7
+ isCancelled: boolean;
8
+ /** Last known execution source (best-effort). */
9
+ lastSource: "on-device" | "backend" | null;
10
+ };
11
+ export type AiFeatureFunction<T> = (args: {
12
+ signal: AbortSignal;
13
+ onStatus: (e: AiKitStatusEvent) => void;
14
+ }) => Promise<T>;
15
+ export type UseAiRunResult<T> = AiRunState<T> & {
16
+ run: (func: AiFeatureFunction<T>) => Promise<T | null>;
17
+ cancel: () => void;
18
+ reset: () => void;
19
+ /** Current AbortSignal, if a run is in-flight. */
20
+ signal: AbortSignal | null;
21
+ };
22
+ /**
23
+ * Returns true if backend routing is configured in the current AiKit settings.
24
+ *
25
+ * This is intentionally conservative: it only checks *configuration*, not reachability.
26
+ */
27
+ export declare function isBackendConfigured(): Promise<boolean>;
28
+ export declare function readDefaultOutputLanguage(): AiKitLanguageCode;
29
+ /**
30
+ * Removes a single surrounding Markdown code fence.
31
+ *
32
+ * Handles common model outputs like:
33
+ * ```json
34
+ * {"a":1}
35
+ * ```
36
+ */
37
+ export declare function stripCodeFence(text: string): string;
38
+ export declare function useAiRun<T>(): UseAiRunResult<T>;
@@ -0,0 +1,7 @@
1
+ import { AiWorkerProps } from "@smart-cloud/ai-kit-core";
2
+ import { type ComponentType } from "react";
3
+ export type AiKitShellInjectedProps = {
4
+ language?: string;
5
+ rootElement: HTMLElement;
6
+ };
7
+ export declare function withAiKitShell<P extends object>(RootComponent: ComponentType<P & AiKitShellInjectedProps>, propOverrides?: Partial<AiWorkerProps>): import("react").FC<P & Partial<AiWorkerProps>>;
package/package.json CHANGED
@@ -1,16 +1,18 @@
1
1
  {
2
2
  "name": "@smart-cloud/ai-kit-ui",
3
- "version": "1.4.12",
3
+ "version": "1.4.14",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
8
  "license": "ISC",
9
9
  "scripts": {
10
- "build": "tsup --minify",
10
+ "build": "yarn build:js && yarn build:types",
11
+ "build:js": "tsup --minify",
12
+ "build:types": "tsc -p tsconfig.types.json",
11
13
  "lint": "eslint 'src/**/*.{ts,tsx}' --report-unused-disable-directives --max-warnings 0",
12
14
  "test": "echo \"Error: no test specified\" && exit 1",
13
- "publish": "WPSUITE_PREMIUM=true tsup --minify && npm publish --access=public"
15
+ "publish": "WPSUITE_PREMIUM=true yarn build && npm publish --access=public"
14
16
  },
15
17
  "publishConfig": {
16
18
  "registry": "https://registry.npmjs.org/",
@@ -19,16 +21,16 @@
19
21
  "dependencies": {
20
22
  "@emotion/cache": "^11.14.0",
21
23
  "@emotion/react": "^11.14.0",
22
- "@mantine/colors-generator": "^8.3.16",
23
- "@smart-cloud/ai-kit-core": "^1.4.7",
24
- "@smart-cloud/wpsuite-core": "^2.2.10",
25
- "@tabler/icons-react": "^3.40.0",
24
+ "@mantine/colors-generator": "^8.3.18",
25
+ "@smart-cloud/ai-kit-core": "^1.4.9",
26
+ "@smart-cloud/wpsuite-core": "^2.2.11",
27
+ "@tabler/icons-react": "^3.41.1",
26
28
  "chroma-js": "^3.2.0",
27
- "country-flag-icons": "^1.6.15",
29
+ "country-flag-icons": "^1.6.16",
28
30
  "react-markdown": "^10.1.0",
29
31
  "rehype-parse": "^9.0.1",
30
32
  "rehype-raw": "^7.0.0",
31
- "rehype-remark": "^10.0.0",
33
+ "rehype-remark": "^10.0.1",
32
34
  "rehype-sanitize": "^6.0.0",
33
35
  "rehype-stringify": "^10.0.1",
34
36
  "remark-gfm": "^4.0.1",
@@ -38,36 +40,36 @@
38
40
  "unified": "^11.0.5"
39
41
  },
40
42
  "peerDependencies": {
41
- "@mantine/core": "^8.3.16",
42
- "@mantine/hooks": "^8.3.16",
43
- "@mantine/modals": "^8.3.16",
44
- "@wordpress/data": "^10.41.0",
45
- "aws-amplify": "^6.16.3",
43
+ "@mantine/core": "^8.3.18",
44
+ "@mantine/hooks": "^8.3.18",
45
+ "@mantine/modals": "^8.3.18",
46
+ "@wordpress/data": "^10.44.0",
47
+ "aws-amplify": "^6.16.4",
46
48
  "react": "^18.3.1",
47
49
  "react-dom": "^18.3.1"
48
50
  },
49
51
  "devDependencies": {
50
52
  "@eslint/js": "^10.0.1",
51
- "@mantine/core": "^8.3.16",
52
- "@mantine/hooks": "^8.3.16",
53
- "@mantine/modals": "^8.3.16",
54
- "@types/dom-chromium-ai": "^0.0.15",
53
+ "@mantine/core": "^8.3.18",
54
+ "@mantine/hooks": "^8.3.18",
55
+ "@mantine/modals": "^8.3.18",
56
+ "@types/dom-chromium-ai": "^0.0.16",
55
57
  "@types/jquery": "^4.0.0",
56
58
  "@types/react": "^18.3.23",
57
59
  "@types/react-dom": "^18.3.7",
58
- "@typescript-eslint/eslint-plugin": "^8.57.0",
59
- "@typescript-eslint/parser": "^8.57.0",
60
- "@wordpress/data": "^10.41.0",
60
+ "@typescript-eslint/eslint-plugin": "^8.58.2",
61
+ "@typescript-eslint/parser": "^8.58.2",
62
+ "@wordpress/data": "^10.44.0",
61
63
  "ajv": "^8.18.0",
62
- "aws-amplify": "^6.16.3",
63
- "eslint": "^10.0.3",
64
- "globals": "^17.4.0",
64
+ "aws-amplify": "^6.16.4",
65
+ "eslint": "^10.2.1",
66
+ "globals": "^17.5.0",
65
67
  "jquery": "^4.0.0",
66
68
  "react": "^18.3.1",
67
69
  "react-dom": "^18.3.1",
68
70
  "tsup": "^8.5.1",
69
- "typescript": "^5.9.3",
70
- "typescript-eslint": "^8.57.0"
71
+ "typescript": "^6.0.3",
72
+ "typescript-eslint": "^8.58.2"
71
73
  },
72
74
  "exports": {
73
75
  ".": {
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "noEmit": false,
5
+ "declaration": true,
6
+ "emitDeclarationOnly": true,
7
+ "declarationMap": false,
8
+ "rootDir": "src",
9
+ "outDir": "dist"
10
+ },
11
+ "include": ["src"],
12
+ "exclude": ["dist", "build", "node_modules", "tsup.config.ts"]
13
+ }
package/tsup.config.ts CHANGED
@@ -7,7 +7,7 @@ export default defineConfig({
7
7
 
8
8
  entry: ["src/index.tsx"],
9
9
  format: ["cjs", "esm"],
10
- dts: true,
10
+ dts: false,
11
11
  splitting: false,
12
12
  sourcemap: false,
13
13
  clean: true,
package/dist/index.d.cts DELETED
@@ -1,112 +0,0 @@
1
- import * as _smart_cloud_ai_kit_core from '@smart-cloud/ai-kit-core';
2
- import { AiModePreference, HistoryStorageMode, AiChatbotLabels, ContextKind, AiKitStatusEvent, AiKitLanguageCode, AiWorkerProps } from '@smart-cloud/ai-kit-core';
3
- import * as React from 'react';
4
- import React__default, { FC, ComponentType } from 'react';
5
-
6
- declare const AiFeature: FC<_smart_cloud_ai_kit_core.AiWorkerProps & {
7
- mode: _smart_cloud_ai_kit_core.AiFeatureMode;
8
- context?: _smart_cloud_ai_kit_core.ContextKind;
9
- modeOverride?: AiModePreference;
10
- autoRun?: boolean;
11
- onDeviceTimeout?: number;
12
- editable?: boolean;
13
- acceptButtonTitle?: string;
14
- showRegenerateOnBackendButton?: boolean;
15
- optionsDisplay?: "collapse" | "horizontal" | "vertical";
16
- default?: _smart_cloud_ai_kit_core.AiFeatureOptions & {
17
- getText?: Promise<string> | (() => Promise<string>);
18
- image?: Blob;
19
- };
20
- allowOverride?: {
21
- text?: boolean;
22
- instructions?: boolean;
23
- tone?: boolean;
24
- length?: boolean;
25
- type?: boolean;
26
- outputLanguage?: boolean;
27
- outputFormat?: boolean;
28
- };
29
- onAccept?: (result: unknown) => void;
30
- onOptionsChanged?: (options: _smart_cloud_ai_kit_core.AiFeatureOptions) => void;
31
- } & Partial<_smart_cloud_ai_kit_core.AiWorkerProps>>;
32
-
33
- declare const markdownToHtml: (markdown: string) => Promise<string>;
34
-
35
- declare const DEFAULT_CHATBOT_LABELS: Required<AiChatbotLabels>;
36
- declare const AiChatbot: React__default.FC<_smart_cloud_ai_kit_core.AiWorkerProps & {
37
- context?: _smart_cloud_ai_kit_core.ContextKind;
38
- placeholder?: string;
39
- maxImages?: number;
40
- maxImageBytes?: number;
41
- previewMode?: boolean;
42
- historyStorage?: HistoryStorageMode;
43
- emptyHistoryAfterDays?: number;
44
- labels?: AiChatbotLabels;
45
- openButtonIconLayout?: _smart_cloud_ai_kit_core.OpenButtonIconLayout;
46
- openButtonPosition?: _smart_cloud_ai_kit_core.OpenButtonPosition;
47
- } & Partial<_smart_cloud_ai_kit_core.AiWorkerProps>>;
48
-
49
- declare const DocSearch: FC<_smart_cloud_ai_kit_core.AiWorkerProps & {
50
- context?: ContextKind;
51
- autoRun?: boolean;
52
- title?: string;
53
- getSearchText?: () => string;
54
- searchButtonIcon?: string;
55
- showSearchButtonTitle?: boolean;
56
- showSearchButtonIcon?: boolean;
57
- showSources?: boolean;
58
- topK?: number;
59
- snippetMaxChars?: number;
60
- onClickDoc?: (doc: _smart_cloud_ai_kit_core.RetrievedDoc) => void;
61
- enableUserFilters?: boolean;
62
- availableCategories?: Record<string, string[]>;
63
- availableTags?: string[];
64
- } & Partial<_smart_cloud_ai_kit_core.AiWorkerProps>>;
65
-
66
- type AiRunState<T> = {
67
- busy: boolean;
68
- error: string | null;
69
- statusEvent: AiKitStatusEvent | null;
70
- result: T | null;
71
- isCancelled: boolean;
72
- /** Last known execution source (best-effort). */
73
- lastSource: "on-device" | "backend" | null;
74
- };
75
- type AiFeatureFunction<T> = (args: {
76
- signal: AbortSignal;
77
- onStatus: (e: AiKitStatusEvent) => void;
78
- }) => Promise<T>;
79
- type UseAiRunResult<T> = AiRunState<T> & {
80
- run: (func: AiFeatureFunction<T>) => Promise<T | null>;
81
- cancel: () => void;
82
- reset: () => void;
83
- /** Current AbortSignal, if a run is in-flight. */
84
- signal: AbortSignal | null;
85
- };
86
- /**
87
- * Returns true if backend routing is configured in the current AiKit settings.
88
- *
89
- * This is intentionally conservative: it only checks *configuration*, not reachability.
90
- */
91
- declare function isBackendConfigured(): Promise<boolean>;
92
- declare function readDefaultOutputLanguage(): AiKitLanguageCode;
93
- /**
94
- * Removes a single surrounding Markdown code fence.
95
- *
96
- * Handles common model outputs like:
97
- * ```json
98
- * {"a":1}
99
- * ```
100
- */
101
- declare function stripCodeFence(text: string): string;
102
- declare function useAiRun<T>(): UseAiRunResult<T>;
103
-
104
- type AiKitShellInjectedProps = {
105
- language?: string;
106
- rootElement: HTMLElement;
107
- };
108
- declare function withAiKitShell<P extends object>(RootComponent: ComponentType<P & AiKitShellInjectedProps>, propOverrides?: Partial<AiWorkerProps>): React.FC<P & Partial<AiWorkerProps>>;
109
-
110
- declare const translations: Record<string, Record<string, string>>;
111
-
112
- export { AiChatbot, AiFeature, type AiFeatureFunction, type AiRunState, DEFAULT_CHATBOT_LABELS, DocSearch, type UseAiRunResult, isBackendConfigured, markdownToHtml, readDefaultOutputLanguage, stripCodeFence, translations, useAiRun, withAiKitShell };