gentiq 0.8.3 → 0.10.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 (45) hide show
  1. package/dist/{checkbox-hWwU3a5K.js → checkbox-BuMyz6YI.js} +1722 -1753
  2. package/dist/gentiq-admin.es.js +4479 -3091
  3. package/dist/gentiq-index.es.js +1975 -1381
  4. package/dist/gentiq.css +1 -1
  5. package/dist/src/App.d.ts +1 -1
  6. package/dist/src/ComponentsContext.d.ts +1 -1
  7. package/dist/src/Part.d.ts +2 -1
  8. package/dist/src/admin/components/ErrorBanner.d.ts +7 -0
  9. package/dist/src/admin/components/I18nPreview.d.ts +6 -0
  10. package/dist/src/admin/components/ModalCloseButton.d.ts +7 -0
  11. package/dist/src/admin/components/SectionHeader.d.ts +8 -0
  12. package/dist/src/admin/lib/api.d.ts +192 -22
  13. package/dist/src/admin/pages/settings/ChatSection.d.ts +12 -0
  14. package/dist/src/admin/pages/settings/FieldModeGrid.d.ts +14 -0
  15. package/dist/src/admin/pages/settings/GeneralSection.d.ts +11 -0
  16. package/dist/src/admin/pages/settings/JobsSection.d.ts +1 -0
  17. package/dist/src/admin/pages/settings/SettingsToggleCard.d.ts +10 -0
  18. package/dist/src/admin/pages/settings/TranslationEditor.d.ts +9 -0
  19. package/dist/src/admin/pages/settings/types.d.ts +12 -0
  20. package/dist/src/admin/pages/users/UserBulkBalanceModal.d.ts +11 -0
  21. package/dist/src/admin/pages/users/UserFormModal.d.ts +13 -0
  22. package/dist/src/admin/pages/users/UserRechargeModal.d.ts +10 -0
  23. package/dist/src/admin/pages/users/UserUsageDialog.d.ts +9 -0
  24. package/dist/src/admin/pages/users/UsersTable.d.ts +21 -0
  25. package/dist/src/components/PromptInputArea.d.ts +1 -1
  26. package/dist/src/components/ai-elements/Conversation.d.ts +10 -0
  27. package/dist/src/hooks/useGentiqAdmin.d.ts +39 -12
  28. package/dist/src/hooks/useGentiqChat.d.ts +3 -2
  29. package/dist/src/index.d.ts +4 -3
  30. package/dist/src/lib/GentiqApiContext.d.ts +12 -0
  31. package/dist/src/lib/api.d.ts +37 -17
  32. package/dist/src/lib/errors.d.ts +6 -5
  33. package/dist/src/lib/messageParts.d.ts +40 -0
  34. package/dist/src/locales/en.json.d.ts +520 -456
  35. package/dist/src/locales/fa.json.d.ts +519 -455
  36. package/dist/src/parts/FilePart.d.ts +1 -1
  37. package/dist/src/parts/ToolPart.d.ts +1 -1
  38. package/dist/src/types.d.ts +188 -14
  39. package/package.json +5 -5
  40. package/dist/src/components/ai-elements/Branch.d.ts +0 -20
  41. package/dist/src/components/ai-elements/Image.d.ts +0 -6
  42. package/dist/src/components/ai-elements/InlineCitation.d.ts +0 -38
  43. package/dist/src/components/ai-elements/Task.d.ts +0 -14
  44. package/dist/src/components/ai-elements/WebPreview.d.ts +0 -34
  45. package/dist/src/components/ui/carousel.d.ts +0 -19
package/dist/src/App.d.ts CHANGED
@@ -12,4 +12,4 @@ export interface ChatUIProps {
12
12
  disclaimer?: ChatProps['disclaimer'];
13
13
  welcome?: import('./types').WelcomeScreenConfig;
14
14
  }
15
- export default function ChatUI({ sidebar, header, components, classNames, disclaimer, welcome }: ChatUIProps): import("react/jsx-runtime").JSX.Element;
15
+ export default function ChatUI({ sidebar, header, components, classNames, disclaimer, welcome, }: ChatUIProps): import("react/jsx-runtime").JSX.Element;
@@ -38,5 +38,5 @@ interface ComponentsProviderProps {
38
38
  * Merges caller-supplied overrides with the framework defaults and makes the
39
39
  * result available to all descendant components via `useComponents()`.
40
40
  */
41
- export declare function ComponentsProvider({ components, history, welcome, threadActions, composer, theme, disclaimer, app, i18n, settings, children }: ComponentsProviderProps): import("react/jsx-runtime").JSX.Element;
41
+ export declare function ComponentsProvider({ components, history, welcome, threadActions, composer, theme, disclaimer, app, i18n, settings, children, }: ComponentsProviderProps): import("react/jsx-runtime").JSX.Element;
42
42
  export {};
@@ -1,5 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { UIDataTypes, UIMessagePart, UITools, UIMessage } from 'ai';
3
+ import { MessagePart } from './lib/messageParts';
3
4
  export interface PartProps {
4
5
  part: UIMessagePart<UIDataTypes, UITools>;
5
6
  message: UIMessage;
@@ -11,7 +12,7 @@ export interface PartProps {
11
12
  isFinished?: boolean;
12
13
  readonly?: boolean;
13
14
  /** Escape-hatch: return a ReactNode to fully replace rendering for this part. */
14
- renderMessagePart?: (part: any, message: any) => ReactNode;
15
+ renderMessagePart?: (part: MessagePart, message: UIMessage) => ReactNode;
15
16
  chat?: any;
16
17
  }
17
18
  export declare function Part(props: PartProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,7 @@
1
+ interface ErrorBannerProps {
2
+ message: string;
3
+ onDismiss: () => void;
4
+ }
5
+ /** Dismissible inline error banner shared across admin pages. */
6
+ export declare function ErrorBanner({ message, onDismiss }: ErrorBannerProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,6 @@
1
+ interface I18nPreviewProps {
2
+ value: string;
3
+ }
4
+ /** Shows the resolved translation for a value that looks like an i18n key. */
5
+ export declare function I18nPreview({ value }: I18nPreviewProps): import("react/jsx-runtime").JSX.Element | null;
6
+ export {};
@@ -0,0 +1,7 @@
1
+ interface ModalCloseButtonProps {
2
+ onClick: () => void;
3
+ label?: string;
4
+ }
5
+ /** The "×" button used in the header of hand-rolled admin modals. */
6
+ export declare function ModalCloseButton({ onClick, label }: ModalCloseButtonProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,8 @@
1
+ import { LucideIcon } from 'lucide-react';
2
+ interface SectionHeaderProps {
3
+ title: string;
4
+ icon: LucideIcon;
5
+ }
6
+ /** Centered divider + label used to separate sections on the settings page. */
7
+ export declare function SectionHeader({ title, icon: Icon }: SectionHeaderProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -1,3 +1,4 @@
1
+ import { AppSettings } from '../../types';
1
2
  export interface AdminLoginResponse {
2
3
  token: string;
3
4
  admin_id: string;
@@ -22,11 +23,14 @@ export interface RechargePolicy extends RechargePolicyInput {
22
23
  next_recharge_at?: string | null;
23
24
  last_recharged_at?: string | null;
24
25
  }
26
+ /** Admin list/analytics traffic filter: real humans, external API service accounts, or both. */
27
+ export type AdminSourceFilter = 'human' | 'service' | 'all';
25
28
  export interface User {
26
29
  id: string;
27
- phone: string;
30
+ phone?: string | null;
28
31
  name: string;
29
- surname: string;
32
+ /** Service (API) accounts have no surname; only a single service name in `name`. */
33
+ surname?: string | null;
30
34
  token?: string;
31
35
  metadata?: Record<string, any>;
32
36
  balance?: {
@@ -36,6 +40,8 @@ export interface User {
36
40
  request_limit: number;
37
41
  };
38
42
  recharge_policy?: RechargePolicy | null;
43
+ /** 'service' marks an external API consumer; defaults to 'human'. */
44
+ type?: 'human' | 'service';
39
45
  }
40
46
  export interface UserUsageSummary {
41
47
  input_tokens: number;
@@ -50,8 +56,8 @@ export interface UserUsageSummary {
50
56
  export interface UserBulkBalanceFilters {
51
57
  query?: string;
52
58
  user_ids?: string[];
53
- metadata_equals?: Record<string, any>;
54
- metadata_in?: Record<string, any[]>;
59
+ metadata_equals?: Record<string, unknown>;
60
+ metadata_in?: Record<string, unknown[]>;
55
61
  }
56
62
  export interface UserBulkBalanceUpdate {
57
63
  operation: 'set' | 'add' | 'full_charge';
@@ -79,14 +85,19 @@ export interface Thread {
79
85
  title?: string;
80
86
  created_at: string;
81
87
  updated_at: string;
88
+ metadata?: {
89
+ /** Caller-supplied end-user reference for API traffic. */
90
+ external_user_id?: string;
91
+ [key: string]: any;
92
+ };
82
93
  feedback_info?: {
83
94
  like: number;
84
95
  dislike: number;
85
96
  };
86
97
  user_info?: {
87
98
  name?: string;
88
- surname?: string;
89
- phone?: string;
99
+ surname?: string | null;
100
+ phone?: string | null;
90
101
  metadata?: Record<string, any>;
91
102
  };
92
103
  }
@@ -94,7 +105,7 @@ export interface ThreadItem {
94
105
  id: string;
95
106
  thread_id: string;
96
107
  role: string;
97
- content: any;
108
+ content: unknown;
98
109
  feedback?: string;
99
110
  created_at: string;
100
111
  }
@@ -105,12 +116,149 @@ export interface Job {
105
116
  user_id: string | null;
106
117
  created_at: string;
107
118
  updated_at: string;
108
- metadata: any;
119
+ metadata: unknown;
109
120
  progress: number;
110
121
  message: string | null;
111
- result: any;
122
+ result: unknown;
112
123
  error: string | null;
113
124
  }
125
+ /** Danger level a registered maintenance job declares. */
126
+ export type JobDanger = 'safe' | 'caution' | 'destructive';
127
+ /** One admin-supplied input declared by a registered job. */
128
+ export interface JobParamSpec {
129
+ name: string;
130
+ type: 'str' | 'int' | 'float' | 'bool' | 'text';
131
+ required: boolean;
132
+ default: unknown;
133
+ label?: string | null;
134
+ help?: string | null;
135
+ choices?: string[] | null;
136
+ }
137
+ /** A maintenance job the backend has registered as runnable from the admin panel. */
138
+ export interface JobDefinition {
139
+ id: string;
140
+ name: string;
141
+ description?: string | null;
142
+ danger: JobDanger;
143
+ params: JobParamSpec[];
144
+ supports_dry_run: boolean;
145
+ timeout_seconds?: number | null;
146
+ }
147
+ export type JobRunStatus = 'queued' | 'processing' | 'completed' | 'failed' | 'cancelled';
148
+ /** A single execution of a maintenance job (registered or raw Python). */
149
+ export interface JobRun {
150
+ id: string;
151
+ job_id: string | null;
152
+ name: string;
153
+ kind: 'registered' | 'raw';
154
+ danger: JobDanger;
155
+ status: JobRunStatus;
156
+ params: Record<string, unknown>;
157
+ dry_run: boolean;
158
+ code?: string | null;
159
+ output?: string;
160
+ output_truncated?: boolean;
161
+ result?: Record<string, unknown> | null;
162
+ error?: string | null;
163
+ triggered_by_id?: string | null;
164
+ triggered_by_username?: string | null;
165
+ created_at: string;
166
+ updated_at: string;
167
+ finished_at?: string | null;
168
+ }
169
+ /** Generic `{ status, message }` acknowledgement returned by mutating endpoints. */
170
+ export interface AdminStatusResponse {
171
+ status: string;
172
+ message: string;
173
+ }
174
+ /** Response from creating a user. */
175
+ export interface UserCreateResponse {
176
+ status: string;
177
+ user: {
178
+ id: string;
179
+ phone?: string | null;
180
+ name: string;
181
+ surname?: string | null;
182
+ token: string;
183
+ created_at: string;
184
+ recharge_policy?: RechargePolicy | null;
185
+ type?: 'human' | 'service';
186
+ };
187
+ }
188
+ /** A user's balance as returned after a balance mutation. */
189
+ export interface AdminUserBalance {
190
+ tokens: number;
191
+ requests: number;
192
+ token_limit: number;
193
+ request_limit: number;
194
+ updated_at: string;
195
+ }
196
+ /** Response from updating a user's balance. */
197
+ export interface UserBalanceUpdateResponse {
198
+ status: string;
199
+ message: string;
200
+ balance: AdminUserBalance;
201
+ }
202
+ /** Response from refreshing a user's auth token. */
203
+ export interface UserTokenRefreshResponse {
204
+ status: string;
205
+ message: string;
206
+ user: {
207
+ id: string;
208
+ phone: string;
209
+ name: string;
210
+ surname: string;
211
+ token: string;
212
+ balance?: AdminUserBalance | null;
213
+ metadata: Record<string, any>;
214
+ };
215
+ }
216
+ export interface AnalyticsTrendItem {
217
+ date: string;
218
+ count: number;
219
+ }
220
+ export interface AnalyticsTokenTrendItem {
221
+ date: string;
222
+ input_tokens: number;
223
+ output_tokens: number;
224
+ requests: number;
225
+ cost_microunits: number;
226
+ unpriced_requests: number;
227
+ }
228
+ export interface AnalyticsFeedbackSentimentItem {
229
+ sentiment: string;
230
+ count: number;
231
+ }
232
+ export interface AnalyticsActiveUser {
233
+ user_id: string;
234
+ name: string;
235
+ thread_count: number;
236
+ }
237
+ /** Response from the analytics endpoint. */
238
+ export interface AdminAnalytics {
239
+ overview: {
240
+ total_users: number;
241
+ total_threads: number;
242
+ total_messages: number;
243
+ total_input_tokens: number;
244
+ total_output_tokens: number;
245
+ total_cost_microunits: number;
246
+ unpriced_requests: number;
247
+ currency: string;
248
+ };
249
+ trends: {
250
+ users: AnalyticsTrendItem[];
251
+ threads: AnalyticsTrendItem[];
252
+ messages: AnalyticsTrendItem[];
253
+ token_usage: AnalyticsTokenTrendItem[];
254
+ };
255
+ distributions: {
256
+ feedback_sentiment: AnalyticsFeedbackSentimentItem[];
257
+ };
258
+ active_users: AnalyticsActiveUser[];
259
+ }
260
+ /** Request body accepted by the settings update endpoint (all fields optional). */
261
+ export type AppSettingsUpdateInput = Partial<Omit<AppSettings, 'updated_at'>>;
114
262
  export declare class AdminAPI {
115
263
  private token;
116
264
  constructor();
@@ -130,12 +278,12 @@ export declare class AdminAPI {
130
278
  name?: string;
131
279
  password?: string;
132
280
  permissions?: string[];
133
- }): Promise<any>;
134
- deleteAdmin(adminId: string): Promise<any>;
281
+ }): Promise<AdminStatusResponse>;
282
+ deleteAdmin(adminId: string): Promise<AdminStatusResponse>;
135
283
  listPermissions(): Promise<{
136
284
  permissions: string[];
137
285
  }>;
138
- listThreads(skip?: number, limit?: number, query?: string, feedback?: string): Promise<{
286
+ listThreads(skip?: number, limit?: number, query?: string, feedback?: string, source?: AdminSourceFilter): Promise<{
139
287
  threads: Thread[];
140
288
  count: number;
141
289
  }>;
@@ -149,11 +297,11 @@ export declare class AdminAPI {
149
297
  share_id: string;
150
298
  url: string;
151
299
  }>;
152
- listUsers(skip?: number, limit?: number, query?: string, sortBy?: 'phone' | 'name' | 'surname', sortOrder?: 'asc' | 'desc'): Promise<{
300
+ listUsers(skip?: number, limit?: number, query?: string, sortBy?: 'phone' | 'name' | 'surname', sortOrder?: 'asc' | 'desc', source?: AdminSourceFilter): Promise<{
153
301
  users: User[];
154
302
  count: number;
155
303
  }>;
156
- createUser(phone: string, name: string, surname: string, tokens?: number, requests?: number, token_limit?: number, request_limit?: number, metadata?: Record<string, any>, recharge_policy?: RechargePolicyInput): Promise<any>;
304
+ createUser(phone: string | null, name: string, surname: string | null, tokens?: number, requests?: number, token_limit?: number, request_limit?: number, metadata?: Record<string, any>, recharge_policy?: RechargePolicyInput, type?: 'human' | 'service'): Promise<UserCreateResponse>;
157
305
  updateUser(userId: string, data: {
158
306
  phone?: string;
159
307
  name?: string;
@@ -164,8 +312,8 @@ export declare class AdminAPI {
164
312
  status: string;
165
313
  user: User;
166
314
  }>;
167
- deleteUser(userId: string): Promise<any>;
168
- updateUserBalance(userId: string, tokens: number, requests: number, token_limit?: number, request_limit?: number): Promise<any>;
315
+ deleteUser(userId: string): Promise<AdminStatusResponse>;
316
+ updateUserBalance(userId: string, tokens: number, requests: number, token_limit?: number, request_limit?: number): Promise<UserBalanceUpdateResponse>;
169
317
  bulkUpdateUserBalance(data: UserBulkBalanceUpdate): Promise<{
170
318
  status: string;
171
319
  matched: number;
@@ -176,17 +324,39 @@ export declare class AdminAPI {
176
324
  matched: number;
177
325
  updated: number;
178
326
  }>;
179
- refreshUserToken(userId: string): Promise<any>;
327
+ refreshUserToken(userId: string): Promise<UserTokenRefreshResponse>;
180
328
  getUserUsageSummary(userId: string): Promise<UserUsageSummary>;
181
- getAnalytics(days?: number): Promise<any>;
329
+ getAnalytics(days?: number, source?: AdminSourceFilter): Promise<AdminAnalytics>;
182
330
  listJobs(limit?: number, type?: string): Promise<{
183
331
  jobs: Job[];
184
332
  count: number;
185
333
  }>;
186
- cancelJob(jobId: string): Promise<any>;
187
- getSettings(): Promise<any>;
188
- updateSettings(data: any): Promise<any>;
189
- resetSettings(): Promise<any>;
334
+ cancelJob(jobId: string): Promise<AdminStatusResponse>;
335
+ listRegisteredJobs(): Promise<{
336
+ jobs: JobDefinition[];
337
+ }>;
338
+ runRegisteredJob(jobId: string, body: {
339
+ params?: Record<string, unknown>;
340
+ dry_run?: boolean;
341
+ confirm?: string;
342
+ }): Promise<JobRun>;
343
+ runRawJob(body: {
344
+ code: string;
345
+ confirm_phrase: string;
346
+ }): Promise<JobRun>;
347
+ listJobRuns(params?: {
348
+ limit?: number;
349
+ kind?: string;
350
+ status?: string;
351
+ }): Promise<{
352
+ runs: JobRun[];
353
+ count: number;
354
+ }>;
355
+ getJobRun(runId: string): Promise<JobRun>;
356
+ cancelJobRun(runId: string): Promise<AdminStatusResponse>;
357
+ getSettings(): Promise<AppSettings>;
358
+ updateSettings(data: AppSettingsUpdateInput): Promise<AppSettings>;
359
+ resetSettings(): Promise<AdminStatusResponse>;
190
360
  getAttachmentBlob(objectName: string): Promise<Blob>;
191
361
  }
192
362
  export declare const adminAPI: AdminAPI;
@@ -0,0 +1,12 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ import { UserMetadataField } from '../../../types';
3
+ import { AdminSettingsState } from './types';
4
+ interface ChatSectionProps {
5
+ settings: AdminSettingsState;
6
+ setSettings: Dispatch<SetStateAction<AdminSettingsState>>;
7
+ userMetadataFields: UserMetadataField[];
8
+ isRtl: boolean;
9
+ }
10
+ /** Chat experience settings: greetings, feature toggles, and settings-tab field modes. */
11
+ export declare function ChatSection({ settings, setSettings, userMetadataFields, isRtl, }: ChatSectionProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,14 @@
1
+ import { SettingsFieldMode } from '../../../types';
2
+ interface FieldModeGridProps {
3
+ title: string;
4
+ fields: {
5
+ id: string;
6
+ label: string;
7
+ }[];
8
+ values: Record<string, SettingsFieldMode>;
9
+ onChange: (id: string, mode: SettingsFieldMode) => void;
10
+ columns?: 2 | 4;
11
+ }
12
+ /** A titled grid of per-field visibility/mode selects (editable / faded / hidden). */
13
+ export declare function FieldModeGrid({ title, fields, values, onChange, columns, }: FieldModeGridProps): import("react/jsx-runtime").JSX.Element;
14
+ export {};
@@ -0,0 +1,11 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ import { AdminSettingsState } from './types';
3
+ interface GeneralSectionProps {
4
+ settings: AdminSettingsState;
5
+ setSettings: Dispatch<SetStateAction<AdminSettingsState>>;
6
+ accentValue: string;
7
+ accentIsValid: boolean;
8
+ }
9
+ /** App-name, language and appearance (theme + accent) settings. */
10
+ export declare function GeneralSection({ settings, setSettings, accentValue, accentIsValid, }: GeneralSectionProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1 @@
1
+ export declare function JobsSection(): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,10 @@
1
+ interface SettingsToggleCardProps {
2
+ title: string;
3
+ help: string;
4
+ checked: boolean;
5
+ onCheckedChange: (checked: boolean) => void;
6
+ className?: string;
7
+ }
8
+ /** A bordered card pairing a labeled description with a toggle switch. */
9
+ export declare function SettingsToggleCard({ title, help, checked, onCheckedChange, className, }: SettingsToggleCardProps): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,9 @@
1
+ /** Nested i18n bundle the translation editor reads/writes: lang → namespace → key → value. */
2
+ export type TranslationStore = Record<string, Record<string, Record<string, string>>>;
3
+ interface TranslationEditorProps {
4
+ translations: TranslationStore;
5
+ onChange: (next: TranslationStore) => void;
6
+ }
7
+ /** JSON editor for the per-language / per-namespace i18n bundles. */
8
+ export declare function TranslationEditor({ translations, onChange }: TranslationEditorProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,12 @@
1
+ import { AppSettings, SettingsFieldMode } from '../../../types';
2
+ import { TranslationStore } from './TranslationEditor';
3
+ /**
4
+ * Local editor state — the backend {@link AppSettings} with the loosely-typed
5
+ * `translations` and per-section field maps narrowed to the shapes the settings page edits.
6
+ */
7
+ export type AdminSettingsState = Omit<AppSettings, 'translations' | 'settings_general_fields' | 'settings_profile_fields' | 'settings_account_fields'> & {
8
+ translations: TranslationStore;
9
+ settings_general_fields: Record<string, SettingsFieldMode>;
10
+ settings_profile_fields: Record<string, SettingsFieldMode>;
11
+ settings_account_fields: Record<string, SettingsFieldMode>;
12
+ };
@@ -0,0 +1,11 @@
1
+ import { UserMetadataField } from '../../../types';
2
+ interface UserBulkBalanceModalProps {
3
+ searchQuery: string;
4
+ userMetadataFields: UserMetadataField[];
5
+ onClose: () => void;
6
+ onApplied: () => void;
7
+ onError: (message: string) => void;
8
+ }
9
+ /** Modal to apply balance and/or renewal-policy changes to many users at once. */
10
+ export declare function UserBulkBalanceModal({ searchQuery, userMetadataFields, onClose, onApplied, onError, }: UserBulkBalanceModalProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,13 @@
1
+ import { User } from '../../lib/api';
2
+ import { AppSettings, UserMetadataField } from '../../../types';
3
+ interface UserFormModalProps {
4
+ editingUser: User | null;
5
+ appSettings: AppSettings | null;
6
+ userMetadataFields: UserMetadataField[];
7
+ onClose: () => void;
8
+ onSaved: () => void;
9
+ onError: (message: string) => void;
10
+ }
11
+ /** Add / edit a single user, including initial balance, auto-recharge and metadata. */
12
+ export declare function UserFormModal({ editingUser, appSettings, userMetadataFields, onClose, onSaved, onError, }: UserFormModalProps): import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,10 @@
1
+ import { User } from '../../lib/api';
2
+ interface UserRechargeModalProps {
3
+ user: User;
4
+ onClose: () => void;
5
+ onSaved: () => void;
6
+ onError: (message: string) => void;
7
+ }
8
+ /** Modal to top up / set the token & request balance of a single user. */
9
+ export declare function UserRechargeModal({ user, onClose, onSaved, onError }: UserRechargeModalProps): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,9 @@
1
+ import { User } from '../../lib/api';
2
+ interface UserUsageDialogProps {
3
+ user: User | null;
4
+ onClose: () => void;
5
+ onError: (message: string) => void;
6
+ }
7
+ /** Loads and displays a user's aggregate usage summary in a dialog. */
8
+ export declare function UserUsageDialog({ user, onClose, onError }: UserUsageDialogProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,21 @@
1
+ import { User } from '../../lib/api';
2
+ import { UserMetadataField } from '../../../types';
3
+ export type SortField = 'phone' | 'name' | 'surname';
4
+ export type SortOrder = 'asc' | 'desc';
5
+ interface UsersTableProps {
6
+ users: User[];
7
+ loading: boolean;
8
+ totalCount: number;
9
+ userMetadataFields: UserMetadataField[];
10
+ sortBy: SortField;
11
+ sortOrder: SortOrder;
12
+ onSort: (field: SortField) => void;
13
+ onLoadMore: () => void;
14
+ onUsage: (user: User) => void;
15
+ onEdit: (user: User) => void;
16
+ onRecharge: (user: User) => void;
17
+ onCopyToken: (user: User) => void;
18
+ onDelete: (userId: string) => void;
19
+ }
20
+ export declare function UsersTable({ users, loading, totalCount, userMetadataFields, sortBy, sortOrder, onSort, onLoadMore, onUsage, onEdit, onRecharge, onCopyToken, onDelete, }: UsersTableProps): import("react/jsx-runtime").JSX.Element;
21
+ export {};
@@ -8,5 +8,5 @@ interface PromptInputAreaProps {
8
8
  conversationId?: string;
9
9
  className?: string;
10
10
  }
11
- export declare function PromptInputArea({ onSend, status, isLastMessageFinished, stop, isErrorVisible, conversationId, className }: PromptInputAreaProps): import("react/jsx-runtime").JSX.Element;
11
+ export declare function PromptInputArea({ onSend, status, isLastMessageFinished, stop, isErrorVisible, conversationId, className, }: PromptInputAreaProps): import("react/jsx-runtime").JSX.Element;
12
12
  export {};
@@ -5,5 +5,15 @@ export type ConversationProps = ComponentProps<typeof StickToBottom>;
5
5
  export declare const Conversation: ({ className, ...props }: ConversationProps) => import("react/jsx-runtime").JSX.Element;
6
6
  export type ConversationContentProps = ComponentProps<typeof StickToBottom.Content>;
7
7
  export declare const ConversationContent: ({ className, ...props }: ConversationContentProps) => import("react/jsx-runtime").JSX.Element;
8
+ /**
9
+ * Forces a scroll to the bottom the moment the user submits a message, even if
10
+ * they had scrolled up. Must render inside <Conversation> to read the
11
+ * stick-to-bottom context. `use-stick-to-bottom` only auto-sticks while the
12
+ * viewport is already at the bottom, so a fresh send from a scrolled-up
13
+ * position needs this nudge.
14
+ */
15
+ export declare const ConversationScrollOnSubmit: ({ status }: {
16
+ status: string;
17
+ }) => null;
8
18
  export type ConversationScrollButtonProps = ComponentProps<typeof Button>;
9
19
  export declare const ConversationScrollButton: ({ className, ...props }: ConversationScrollButtonProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,14 +1,16 @@
1
- export declare function useAdminUsers(skip?: number, limit?: number, query?: string): import('@tanstack/react-query').UseQueryResult<{
1
+ import { AdminSourceFilter } from '../admin/lib/api';
2
+ export declare function useAdminUsers(skip?: number, limit?: number, query?: string, sortBy?: 'phone' | 'name' | 'surname', sortOrder?: 'asc' | 'desc', source?: AdminSourceFilter): import('@tanstack/react-query').UseQueryResult<{
2
3
  users: import('../admin/lib/api').User[];
3
4
  count: number;
4
5
  }, Error>;
5
6
  export declare function useAdminUsersMutations(): {
6
- createUser: import('@tanstack/react-query').UseMutationResult<any, Error, {
7
- phone: string;
7
+ createUser: import('@tanstack/react-query').UseMutationResult<import('../admin/lib/api').UserCreateResponse, Error, {
8
+ phone: string | null;
8
9
  name: string;
9
- surname: string;
10
+ surname: string | null;
10
11
  tokens?: number;
11
12
  requests?: number;
13
+ type?: "human" | "service";
12
14
  }, unknown>;
13
15
  updateUser: import('@tanstack/react-query').UseMutationResult<{
14
16
  status: string;
@@ -21,15 +23,15 @@ export declare function useAdminUsersMutations(): {
21
23
  surname?: string;
22
24
  };
23
25
  }, unknown>;
24
- deleteUser: import('@tanstack/react-query').UseMutationResult<any, Error, string, unknown>;
25
- updateBalance: import('@tanstack/react-query').UseMutationResult<any, Error, {
26
+ deleteUser: import('@tanstack/react-query').UseMutationResult<import('../admin/lib/api').AdminStatusResponse, Error, string, unknown>;
27
+ updateBalance: import('@tanstack/react-query').UseMutationResult<import('../admin/lib/api').UserBalanceUpdateResponse, Error, {
26
28
  userId: string;
27
29
  tokens: number;
28
30
  requests: number;
29
31
  }, unknown>;
30
- refreshToken: import('@tanstack/react-query').UseMutationResult<any, Error, string, unknown>;
32
+ refreshToken: import('@tanstack/react-query').UseMutationResult<import('../admin/lib/api').UserTokenRefreshResponse, Error, string, unknown>;
31
33
  };
32
- export declare function useAdminAnalytics(days?: number): import('@tanstack/react-query').UseQueryResult<any, Error>;
34
+ export declare function useAdminAnalytics(days?: number, source?: AdminSourceFilter): import('@tanstack/react-query').UseQueryResult<import('../admin/lib/api').AdminAnalytics, Error>;
33
35
  export declare function useAdminAdmins(): import('@tanstack/react-query').UseQueryResult<{
34
36
  admins: import('../admin/lib/api').Admin[];
35
37
  }, Error>;
@@ -40,7 +42,7 @@ export declare function useAdminAdminsMutations(): {
40
42
  name: string;
41
43
  permissions: string[];
42
44
  }, unknown>;
43
- updateAdmin: import('@tanstack/react-query').UseMutationResult<any, Error, {
45
+ updateAdmin: import('@tanstack/react-query').UseMutationResult<import('../admin/lib/api').AdminStatusResponse, Error, {
44
46
  adminId: string;
45
47
  data: {
46
48
  name?: string;
@@ -48,9 +50,9 @@ export declare function useAdminAdminsMutations(): {
48
50
  permissions?: string[];
49
51
  };
50
52
  }, unknown>;
51
- deleteAdmin: import('@tanstack/react-query').UseMutationResult<any, Error, string, unknown>;
53
+ deleteAdmin: import('@tanstack/react-query').UseMutationResult<import('../admin/lib/api').AdminStatusResponse, Error, string, unknown>;
52
54
  };
53
- export declare function useAdminThreads(skip?: number, limit?: number, query?: string, feedback?: string): import('@tanstack/react-query').UseQueryResult<{
55
+ export declare function useAdminThreads(skip?: number, limit?: number, query?: string, feedback?: string, source?: AdminSourceFilter): import('@tanstack/react-query').UseQueryResult<{
54
56
  threads: import('../admin/lib/api').Thread[];
55
57
  count: number;
56
58
  }, Error>;
@@ -64,7 +66,32 @@ export declare function useAdminJobs(limit?: number, type?: string): import('@ta
64
66
  count: number;
65
67
  }, Error>;
66
68
  export declare function useAdminJobsMutations(): {
67
- cancelJob: import('@tanstack/react-query').UseMutationResult<any, Error, string, unknown>;
69
+ cancelJob: import('@tanstack/react-query').UseMutationResult<import('../admin/lib/api').AdminStatusResponse, Error, string, unknown>;
70
+ };
71
+ export declare function useRegisteredJobs(enabled?: boolean): import('@tanstack/react-query').UseQueryResult<{
72
+ jobs: import('../admin/lib/api').JobDefinition[];
73
+ }, Error>;
74
+ export declare function useJobRuns(filters?: {
75
+ limit?: number;
76
+ kind?: string;
77
+ status?: string;
78
+ }, enabled?: boolean): import('@tanstack/react-query').UseQueryResult<{
79
+ runs: import('../admin/lib/api').JobRun[];
80
+ count: number;
81
+ }, Error>;
82
+ export declare function useJobRun(runId: string | null, poll?: boolean): import('@tanstack/react-query').UseQueryResult<import('../admin/lib/api').JobRun, Error>;
83
+ export declare function useJobMutations(): {
84
+ runRegisteredJob: import('@tanstack/react-query').UseMutationResult<import('../admin/lib/api').JobRun, Error, {
85
+ jobId: string;
86
+ params?: Record<string, unknown>;
87
+ dry_run?: boolean;
88
+ confirm?: string;
89
+ }, unknown>;
90
+ runRawJob: import('@tanstack/react-query').UseMutationResult<import('../admin/lib/api').JobRun, Error, {
91
+ code: string;
92
+ confirm_phrase: string;
93
+ }, unknown>;
94
+ cancelJobRun: import('@tanstack/react-query').UseMutationResult<import('../admin/lib/api').AdminStatusResponse, Error, string, unknown>;
68
95
  };
69
96
  export declare function useAdminAuth(): {
70
97
  login: (username: string, password: string) => Promise<import('../admin/lib/api').AdminLoginResponse>;