@ezychat/web 0.1.47 → 0.1.49

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.
@@ -1,11 +1,16 @@
1
+ import type { TFunction } from 'i18next';
1
2
  import { type AiDocument } from '@ezychat/shared';
3
+ /** An AI agent API error in the admin's language (`ai.agents.errors.*`); others as usual. */
4
+ export declare function agentErrorMessage(error: unknown, t: TFunction<'admin'>): string;
2
5
  /**
3
- * Business context as a list of items (uploaded files and text content), like a project
4
- * knowledge panel: search, multi-select delete, and Add ▾ (upload or text). Items belong to the
5
- * AI member, so `ensureMember` saves a draft member first when there is none yet.
6
+ * The Business context of ONE agent as a list of items (uploaded files and text content), like a
7
+ * project knowledge panel: search, the Internal filter, multi-select delete, and Add ▾ (upload or
8
+ * text). An Internal item helps the agent decide and is never told to customers.
6
9
  */
7
- export declare function AiContextPanel({ documents, ensureMember, disabled, }: {
10
+ export declare function AiContextPanel({ agentId, documents, disabled, }: {
11
+ agentId: number;
8
12
  documents: AiDocument[];
9
- ensureMember: () => Promise<boolean>;
10
13
  disabled?: boolean;
11
14
  }): import("react").JSX.Element;
15
+ /** "Internal" badge: used to decide, never told to customers. */
16
+ export declare function InternalBadge(): import("react").JSX.Element;
@@ -1,13 +1,17 @@
1
- import { type AiEditField } from '@ezychat/shared';
1
+ import { type AiAgentPreset, type AiEditField } from '@ezychat/shared';
2
2
  /**
3
3
  * Edit with AI: the admin describes a change to one box, reviews the suggested rewrite as a line
4
4
  * diff and applies it to the page's draft. Applying never saves; the page's Save does.
5
5
  */
6
- export declare function AiEditDialog({ field, current, open, onOpenChange, onApply, }: {
6
+ export declare function AiEditDialog({ field, current, open, onOpenChange, onApply, agentId, preset, }: {
7
7
  field: AiEditField;
8
8
  /** The box's current (possibly unsaved) text. */
9
9
  current: string;
10
10
  open: boolean;
11
11
  onOpenChange: (open: boolean) => void;
12
12
  onApply: (text: string) => void;
13
+ /** The agent whose Business context informs the rewrite (none: the inbox-1 agent). */
14
+ agentId?: number;
15
+ /** The agent's preset, so a FAQ agent is not pushed toward sales. */
16
+ preset?: AiAgentPreset;
13
17
  }): import("react").JSX.Element;
@@ -1 +1,7 @@
1
+ /**
2
+ * Members ▸ AI agent: `/admin/members/ai/:agentId` edits one agent; `/admin/members/ai/new?preset=`
3
+ * creates one. Name, starting point, Business context (with Internal items), Try it, the role and
4
+ * hand-over rules, the fixed safety rules, and in an edition with several inboxes the inbox and
5
+ * Delete.
6
+ */
1
7
  export declare function AiMemberPage(): import("react").JSX.Element;
@@ -1,21 +1,35 @@
1
1
  import type { TFunction } from 'i18next';
2
- import { type AiKeyTestError, type AiMemberStatus } from '@ezychat/shared';
3
- /** Checks an OpenAI API key with one small request; the server never stores or logs it. */
4
- export declare function useTestApiKey(): import("@tanstack/react-query").UseMutationResult<{
2
+ import { type AiKeyTestError, type AiMemberStatus, type AiSettings } from '@ezychat/shared';
3
+ /** The connection modes that use an API key: `api` = OpenAI, `claude` = Anthropic. */
4
+ export type KeyMode = Exclude<AiSettings['mode'], 'chatgpt'>;
5
+ /** Where an admin creates a Claude key (the desktop shell opens it in the OS browser). */
6
+ export declare const ANTHROPIC_CONSOLE_URL = "https://console.anthropic.com/settings/keys";
7
+ /** A failed check: the server's verdict, or `other_vendor` (found from the prefix, never sent). */
8
+ export type KeyTestError = AiKeyTestError | 'other_vendor';
9
+ export type KeyTestResult = {
5
10
  ok: boolean;
6
- error: "rate_limited" | "forbidden" | "invalid_key" | "unreachable" | null;
7
- }, Error, string, unknown>;
11
+ error: KeyTestError | null;
12
+ };
8
13
  /**
9
- * Only a key OpenAI rejected outright (401) is refused. Any other failed test may be a key that still
10
- * answers customers (no Models permission, a region block, a passing limit), so it can be saved anyway.
14
+ * Checks an OpenAI or Claude API key with one small request; the server never stores or logs it.
15
+ * A key of the other vendor is caught from its prefix and never sent.
11
16
  */
12
- export declare function keyTestBlocks(error: AiKeyTestError | null | undefined): boolean;
13
- /** The message for a failed key test (`ok: false`). */
14
- export declare function keyTestMessage(t: TFunction<'admin'>, error: AiKeyTestError | null | undefined): string;
17
+ export declare function useTestApiKey(): import("@tanstack/react-query").UseMutationResult<KeyTestResult, Error, {
18
+ apiKey: string;
19
+ mode?: KeyMode;
20
+ }, unknown>;
15
21
  /**
16
- * One compact "connect the AI" block, used by the setup wizard and the Sales Agent page.
17
- * Sign in with ChatGPT first (recommended); an OpenAI API key is the secondary option and is
18
- * tested before it is saved.
22
+ * Only a key the service rejected outright (401), or a key of the other vendor, is refused. Any
23
+ * other failed test may be a key that still answers customers (no Models permission, a region block,
24
+ * a passing limit), so it can be saved anyway.
25
+ */
26
+ export declare function keyTestBlocks(error: KeyTestError | null | undefined): boolean;
27
+ /** The message for a failed key test (`ok: false`), naming the vendor of `mode`. */
28
+ export declare function keyTestMessage(t: TFunction<'admin'>, error: KeyTestError | null | undefined, mode?: KeyMode): string;
29
+ /**
30
+ * One compact "connect the AI" block, used by the setup wizard and the agent page.
31
+ * Sign in with ChatGPT first (recommended); an OpenAI or a Claude API key are the other options,
32
+ * each tested before it is saved.
19
33
  */
20
34
  export declare function AiQuickConnect({ status }: {
21
35
  status: AiMemberStatus;
@@ -1,8 +1,13 @@
1
1
  import type { AiKnowledgeDraft } from './ai-status';
2
2
  /**
3
3
  * Asks the AI a test question with the page's current (possibly unsaved) name and instructions;
4
- * the server answers from the saved Business context items.
4
+ * the server answers from the saved Business context items of `agentId` (none: the inbox-1 agent).
5
+ * `ready` false: the AI connection does not work yet, so asking is off.
5
6
  */
6
- export declare function AiTryIt({ draft }: {
7
+ export declare function AiTryIt({ draft, agentId, ready, onAnswered, }: {
7
8
  draft: AiKnowledgeDraft;
9
+ agentId?: number;
10
+ ready?: boolean;
11
+ /** Called after the model answered a test question (the agent page's Next steps). */
12
+ onAnswered?: () => void;
8
13
  }): import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { type LucideIcon } from 'lucide-react';
2
+ import type { AiAgentPreset } from '@ezychat/shared';
3
+ /** The icon of each agent preset (picker, badges). */
4
+ export declare const PRESET_ICON: Record<AiAgentPreset, LucideIcon>;
5
+ /** "Sales agent", "FAQ agent", "Custom agent". */
6
+ export declare function PresetBadge({ preset }: Readonly<{
7
+ preset: AiAgentPreset;
8
+ }>): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { AiMemberStatus } from '@ezychat/shared';
2
+ /**
3
+ * Where "set up the AI agent" links go: the only agent's page, a new agent while there is none, or
4
+ * Members (which lists every agent) when there are several.
5
+ */
6
+ export declare function aiAgentsPath(status: Pick<AiMemberStatus, 'agents'>): string;
@@ -1,4 +1,5 @@
1
- import type { AiDocument, AiMemberStatus, AiSettings } from '@ezychat/shared';
1
+ import type { TFunction } from 'i18next';
2
+ import { type AiAgentPreset, type AiDocument, type AiMemberStatus, type AiSettings } from '@ezychat/shared';
2
3
  /** Only the official ChatGPT sign-in hosts may be opened from the app. */
3
4
  export declare function officialLoginUrl(raw: string | null): string | null;
4
5
  /** The saved connection can answer customers right now. */
@@ -10,3 +11,16 @@ export type AiKnowledgeDraft = Pick<AiSettings, 'displayName' | 'instructions'>
10
11
  export declare function hasKnowledge(documents: readonly AiDocument[]): boolean;
11
12
  export type AiPill = 'off' | 'on' | 'needsConnection' | 'needsKnowledge';
12
13
  export declare function memberPill(status: AiMemberStatus): AiPill;
14
+ export type PresetTexts = {
15
+ instructions: string;
16
+ handoffRules: string;
17
+ };
18
+ type PresetField = keyof PresetTexts;
19
+ /** A preset's starting texts in the admin's language (`ai.defaults.<preset>.*`); Custom is blank. */
20
+ export declare function presetDefaults(preset: AiAgentPreset, t: TFunction<'admin'>): PresetTexts;
21
+ /**
22
+ * True when `text` is an unedited starting text of any preset: the English one the server keeps,
23
+ * or the copy in any language whose catalog is loaded. A blank text is never a default.
24
+ */
25
+ export declare function isPresetDefault(text: string, field: PresetField): boolean;
26
+ export {};
@@ -1,4 +1,6 @@
1
- import { type AiMemberBody, type AiConnectionBody, type AiContextPatchBody, type AiContextTextBody, type AiEditBody } from '@ezychat/shared';
1
+ import { type QueryClient } from '@tanstack/react-query';
2
+ import { z } from 'zod';
3
+ import { type AiAgentBody, type AiMemberBody, type AiConnectionBody, type AiContextPatchBody, type AiContextTextBody, type AiEditBody } from '@ezychat/shared';
2
4
  export declare const aiMemberKey: readonly ["ai-member"];
3
5
  export declare function useAiMember(): import("@tanstack/react-query").UseQueryResult<{
4
6
  member: {
@@ -12,17 +14,20 @@ export declare function useAiMember(): import("@tanstack/react-query").UseQueryR
12
14
  locale: "en" | "ms" | "zh-CN" | null;
13
15
  kind?: "human" | "ai" | undefined;
14
16
  aiRole?: "sales" | undefined;
17
+ aiAgentId?: number | undefined;
18
+ aiDeleted?: boolean | undefined;
15
19
  inboxIds?: number[] | undefined;
16
20
  } | null;
17
21
  settings: {
18
22
  displayName: string;
19
- mode: "api" | "chatgpt";
23
+ mode: "api" | "chatgpt" | "claude";
20
24
  enabled: boolean;
21
25
  model: string;
22
26
  instructions: string;
23
27
  handoffRules?: string | undefined;
24
28
  };
25
29
  hasApiKey: boolean;
30
+ hasClaudeApiKey: boolean;
26
31
  connection: {
27
32
  state: "unavailable" | "connected" | "error" | "expired" | "signed_out" | "signing_in";
28
33
  loginUrl: string | null;
@@ -37,7 +42,18 @@ export declare function useAiMember(): import("@tanstack/react-query").UseQueryR
37
42
  characters: number;
38
43
  createdAt: number;
39
44
  updatedAt: number;
45
+ internal: boolean;
40
46
  }[];
47
+ agents: {
48
+ id: number;
49
+ userId: number;
50
+ displayName: string;
51
+ enabled: boolean;
52
+ preset: "sales" | "custom" | "faq";
53
+ inboxId: number | null;
54
+ documentCount: number;
55
+ }[];
56
+ maxAgents: number;
41
57
  }, Error>;
42
58
  /** One Business context item with its text (full for text items, a preview for files). */
43
59
  export declare function useAiDocument(id: number | null): import("@tanstack/react-query").UseQueryResult<{
@@ -48,6 +64,7 @@ export declare function useAiDocument(id: number | null): import("@tanstack/reac
48
64
  characters: number;
49
65
  createdAt: number;
50
66
  updatedAt: number;
67
+ internal: boolean;
51
68
  text: string;
52
69
  truncated: boolean;
53
70
  }, Error>;
@@ -65,14 +82,17 @@ export declare function useAiTest(): import("@tanstack/react-query").UseMutation
65
82
  reply: string | null;
66
83
  error: string | null;
67
84
  }, Error, void, unknown>;
68
- /** Try it: answers from the page's current knowledge; never touches chats or WhatsApp. */
85
+ /**
86
+ * Try it: answers from the page's current knowledge; never touches chats or WhatsApp. With
87
+ * `agentId` the answer uses that agent's saved items (and its path); without, the inbox-1 agent.
88
+ */
69
89
  export declare function useAiTry(): import("@tanstack/react-query").UseMutationResult<{
70
90
  ok: boolean;
71
91
  reply: string | null;
72
92
  action: "answer" | "ask_resolution" | "resolve" | "handoff" | "no_reply" | null;
73
93
  model: string | null;
74
94
  error: string | null;
75
- handoffReason?: "asked_for_human" | "missing_facts" | "sensitive" | "needs_action" | "business_rule" | "unsupported_message" | "ai_unavailable" | "lookup_failed" | null | undefined;
95
+ handoffReason?: "asked_for_human" | "missing_facts" | "sensitive" | "needs_action" | "business_rule" | "unsupported_message" | "ai_unavailable" | "lookup_failed" | "confidential_leak" | null | undefined;
76
96
  lookups?: {
77
97
  title: string;
78
98
  sourceLabel: string;
@@ -88,10 +108,13 @@ export declare function useAiTry(): import("@tanstack/react-query").UseMutationR
88
108
  instructions: string;
89
109
  handoffRules?: string | undefined;
90
110
  };
111
+ agentId?: number | undefined;
91
112
  }, unknown>;
92
- /** Edit with AI: a suggested rewrite of one box; nothing is saved (the page's Save does that). */
93
- /** Edit with AI. Pass a signal so closing the popup stops the (paid) model call. */
94
- export declare function useAiEdit(): import("@tanstack/react-query").UseMutationResult<{
113
+ /**
114
+ * Edit with AI: a suggested rewrite of one box; nothing is saved (the page's Save does that).
115
+ * Pass a signal so closing the popup stops the (paid) model call. `agentId`: whose items inform it.
116
+ */
117
+ export declare function useAiEdit(agentId?: number): import("@tanstack/react-query").UseMutationResult<{
95
118
  ok: boolean;
96
119
  text: string | null;
97
120
  error: string | null;
@@ -147,17 +170,20 @@ export declare function useAiMemberAction(): import("@tanstack/react-query").Use
147
170
  locale: "en" | "ms" | "zh-CN" | null;
148
171
  kind?: "human" | "ai" | undefined;
149
172
  aiRole?: "sales" | undefined;
173
+ aiAgentId?: number | undefined;
174
+ aiDeleted?: boolean | undefined;
150
175
  inboxIds?: number[] | undefined;
151
176
  } | null;
152
177
  settings: {
153
178
  displayName: string;
154
- mode: "api" | "chatgpt";
179
+ mode: "api" | "chatgpt" | "claude";
155
180
  enabled: boolean;
156
181
  model: string;
157
182
  instructions: string;
158
183
  handoffRules?: string | undefined;
159
184
  };
160
185
  hasApiKey: boolean;
186
+ hasClaudeApiKey: boolean;
161
187
  connection: {
162
188
  state: "unavailable" | "connected" | "error" | "expired" | "signed_out" | "signing_in";
163
189
  loginUrl: string | null;
@@ -172,5 +198,167 @@ export declare function useAiMemberAction(): import("@tanstack/react-query").Use
172
198
  characters: number;
173
199
  createdAt: number;
174
200
  updatedAt: number;
201
+ internal: boolean;
202
+ }[];
203
+ agents: {
204
+ id: number;
205
+ userId: number;
206
+ displayName: string;
207
+ enabled: boolean;
208
+ preset: "sales" | "custom" | "faq";
209
+ inboxId: number | null;
210
+ documentCount: number;
175
211
  }[];
212
+ maxAgents: number;
176
213
  }, Error, AiMemberAction, unknown>;
214
+ /** `GET /api/ai/agents` and `DELETE /api/ai/agents/:agentId`: every agent and the edition limit. */
215
+ export declare const AiAgentList: z.ZodObject<{
216
+ agents: z.ZodArray<z.ZodObject<{
217
+ id: z.ZodNumber;
218
+ userId: z.ZodNumber;
219
+ displayName: z.ZodString;
220
+ enabled: z.ZodBoolean;
221
+ preset: z.ZodEnum<{
222
+ sales: "sales";
223
+ custom: "custom";
224
+ faq: "faq";
225
+ }>;
226
+ inboxId: z.ZodNullable<z.ZodNumber>;
227
+ documentCount: z.ZodNumber;
228
+ }, z.core.$strip>>;
229
+ maxAgents: z.ZodNumber;
230
+ }, z.core.$strip>;
231
+ export type AiAgentList = z.infer<typeof AiAgentList>;
232
+ export declare const aiAgentsKey: readonly ["ai-agents"];
233
+ export declare const aiAgentKey: (agentId: number) => readonly ["ai-agent", number];
234
+ /** One item with its text, under its agent (the agent is part of the key and of the path). */
235
+ export declare const aiAgentDocumentKey: (agentId: number, id: number) => readonly ["ai-document", number, number];
236
+ export declare function useAiAgents(): import("@tanstack/react-query").UseQueryResult<{
237
+ agents: {
238
+ id: number;
239
+ userId: number;
240
+ displayName: string;
241
+ enabled: boolean;
242
+ preset: "sales" | "custom" | "faq";
243
+ inboxId: number | null;
244
+ documentCount: number;
245
+ }[];
246
+ maxAgents: number;
247
+ }, Error>;
248
+ /** One agent with its settings and items; `null` (a new agent) reads nothing. */
249
+ export declare function useAiAgent(agentId: number | null): import("@tanstack/react-query").UseQueryResult<{
250
+ agent: {
251
+ id: number;
252
+ userId: number;
253
+ displayName: string;
254
+ enabled: boolean;
255
+ preset: "sales" | "custom" | "faq";
256
+ inboxId: number | null;
257
+ documentCount: number;
258
+ };
259
+ settings: {
260
+ displayName: string;
261
+ mode: "api" | "chatgpt" | "claude";
262
+ enabled: boolean;
263
+ model: string;
264
+ instructions: string;
265
+ handoffRules?: string | undefined;
266
+ };
267
+ documents: {
268
+ id: number;
269
+ name: string;
270
+ kind: "text" | "file";
271
+ size: number;
272
+ characters: number;
273
+ createdAt: number;
274
+ updatedAt: number;
275
+ internal: boolean;
276
+ }[];
277
+ }, Error>;
278
+ /** One Business context item of an agent with its text (full for text, a preview for files). */
279
+ export declare function useAiAgentDocument(agentId: number, id: number | null): import("@tanstack/react-query").UseQueryResult<{
280
+ id: number;
281
+ name: string;
282
+ kind: "text" | "file";
283
+ size: number;
284
+ characters: number;
285
+ createdAt: number;
286
+ updatedAt: number;
287
+ internal: boolean;
288
+ text: string;
289
+ truncated: boolean;
290
+ }, Error>;
291
+ export type AiAgentAction = {
292
+ kind: 'create';
293
+ body: AiAgentBody;
294
+ } | {
295
+ kind: 'save';
296
+ body: AiAgentBody;
297
+ } | {
298
+ kind: 'delete';
299
+ } | {
300
+ kind: 'upload';
301
+ file: File;
302
+ internal?: boolean;
303
+ } | {
304
+ kind: 'addText';
305
+ body: AiContextTextBody;
306
+ } | {
307
+ kind: 'updateText';
308
+ id: number;
309
+ body: AiContextPatchBody;
310
+ } | {
311
+ kind: 'remove';
312
+ id: number;
313
+ } | {
314
+ kind: 'removeMany';
315
+ ids: number[];
316
+ }
317
+ /** Binds the agent to an inbox (Admin → Inboxes' route); null frees the inbox it answers now. */
318
+ | {
319
+ kind: 'setInbox';
320
+ inboxId: number | null;
321
+ };
322
+ /** Everything that shows agents: the list, every agent, the old AI member view, members, inboxes. */
323
+ export declare function refreshAgents(qc: QueryClient): void;
324
+ /** Changes one agent (or creates one with `agentId` null) and its Business context items. */
325
+ export declare function useAiAgentAction(agentId: number | null): import("@tanstack/react-query").UseMutationResult<{
326
+ agents: {
327
+ id: number;
328
+ userId: number;
329
+ displayName: string;
330
+ enabled: boolean;
331
+ preset: "sales" | "custom" | "faq";
332
+ inboxId: number | null;
333
+ documentCount: number;
334
+ }[];
335
+ maxAgents: number;
336
+ } | {
337
+ agent: {
338
+ id: number;
339
+ userId: number;
340
+ displayName: string;
341
+ enabled: boolean;
342
+ preset: "sales" | "custom" | "faq";
343
+ inboxId: number | null;
344
+ documentCount: number;
345
+ };
346
+ settings: {
347
+ displayName: string;
348
+ mode: "api" | "chatgpt" | "claude";
349
+ enabled: boolean;
350
+ model: string;
351
+ instructions: string;
352
+ handoffRules?: string | undefined;
353
+ };
354
+ documents: {
355
+ id: number;
356
+ name: string;
357
+ kind: "text" | "file";
358
+ size: number;
359
+ characters: number;
360
+ createdAt: number;
361
+ updatedAt: number;
362
+ internal: boolean;
363
+ }[];
364
+ }, Error, AiAgentAction, unknown>;
@@ -16,10 +16,12 @@ export declare function useCreateInbox(): import("@tanstack/react-query").UseMut
16
16
  lastError: string | null;
17
17
  };
18
18
  removed: boolean;
19
+ aiAgentId: number | null;
19
20
  memberIds?: number[] | undefined;
20
21
  }, Error, {
21
22
  name: string;
22
23
  memberIds?: number[] | undefined;
24
+ aiAgentId?: number | null | undefined;
23
25
  }, unknown>;
24
26
  export declare function useUpdateInbox(): import("@tanstack/react-query").UseMutationResult<{
25
27
  id: number;
@@ -37,6 +39,7 @@ export declare function useUpdateInbox(): import("@tanstack/react-query").UseMut
37
39
  lastError: string | null;
38
40
  };
39
41
  removed: boolean;
42
+ aiAgentId: number | null;
40
43
  memberIds?: number[] | undefined;
41
44
  }, Error, {
42
45
  id: number;
@@ -61,5 +64,7 @@ export declare function useSetUserInboxes(userId: number): import("@tanstack/rea
61
64
  locale: "en" | "ms" | "zh-CN" | null;
62
65
  kind?: "human" | "ai" | undefined;
63
66
  aiRole?: "sales" | undefined;
67
+ aiAgentId?: number | undefined;
68
+ aiDeleted?: boolean | undefined;
64
69
  inboxIds?: number[] | undefined;
65
70
  }, Error, number[], unknown>;
@@ -68,6 +68,8 @@ export declare function useMe(): import("@tanstack/react-query").UseQueryResult<
68
68
  locale: "en" | "ms" | "zh-CN" | null;
69
69
  kind?: "human" | "ai" | undefined;
70
70
  aiRole?: "sales" | undefined;
71
+ aiAgentId?: number | undefined;
72
+ aiDeleted?: boolean | undefined;
71
73
  inboxIds?: number[] | undefined;
72
74
  } | null, Error>;
73
75
  export declare function useSetupStatus(): import("@tanstack/react-query").UseQueryResult<{
@@ -90,6 +92,8 @@ export declare function useLogin(): import("@tanstack/react-query").UseMutationR
90
92
  locale: "en" | "ms" | "zh-CN" | null;
91
93
  kind?: "human" | "ai" | undefined;
92
94
  aiRole?: "sales" | undefined;
95
+ aiAgentId?: number | undefined;
96
+ aiDeleted?: boolean | undefined;
93
97
  inboxIds?: number[] | undefined;
94
98
  } | null, Error, {
95
99
  username: string;
@@ -113,6 +117,8 @@ export declare function useSetMyLocale(): import("@tanstack/react-query").UseMut
113
117
  locale: "en" | "ms" | "zh-CN" | null;
114
118
  kind?: "human" | "ai" | undefined;
115
119
  aiRole?: "sales" | undefined;
120
+ aiAgentId?: number | undefined;
121
+ aiDeleted?: boolean | undefined;
116
122
  inboxIds?: number[] | undefined;
117
123
  }, Error, "en" | "ms" | "zh-CN" | null, unknown>;
118
124
  export declare function useChangePassword(): import("@tanstack/react-query").UseMutationResult<unknown, Error, {
@@ -460,6 +466,8 @@ export declare function useUsers(opts?: {
460
466
  locale: "en" | "ms" | "zh-CN" | null;
461
467
  kind?: "human" | "ai" | undefined;
462
468
  aiRole?: "sales" | undefined;
469
+ aiAgentId?: number | undefined;
470
+ aiDeleted?: boolean | undefined;
463
471
  inboxIds?: number[] | undefined;
464
472
  }[], Error>;
465
473
  /** Public team-member fields every logged-in user may see (`GET /api/users/directory`). */
@@ -479,6 +487,8 @@ export declare function useUserDirectory(opts?: {
479
487
  inboxIds: "all" | number[];
480
488
  kind?: "human" | "ai" | undefined;
481
489
  aiRole?: "sales" | undefined;
490
+ aiAgentId?: number | undefined;
491
+ aiDeleted?: boolean | undefined;
482
492
  }[], Error>;
483
493
  export declare function useCreateUser(): import("@tanstack/react-query").UseMutationResult<{
484
494
  id: number;
@@ -491,6 +501,8 @@ export declare function useCreateUser(): import("@tanstack/react-query").UseMuta
491
501
  locale: "en" | "ms" | "zh-CN" | null;
492
502
  kind?: "human" | "ai" | undefined;
493
503
  aiRole?: "sales" | undefined;
504
+ aiAgentId?: number | undefined;
505
+ aiDeleted?: boolean | undefined;
494
506
  inboxIds?: number[] | undefined;
495
507
  }, Error, {
496
508
  username: string;
@@ -509,6 +521,8 @@ export declare function usePatchUser(): import("@tanstack/react-query").UseMutat
509
521
  locale: "en" | "ms" | "zh-CN" | null;
510
522
  kind?: "human" | "ai" | undefined;
511
523
  aiRole?: "sales" | undefined;
524
+ aiAgentId?: number | undefined;
525
+ aiDeleted?: boolean | undefined;
512
526
  inboxIds?: number[] | undefined;
513
527
  }, Error, {
514
528
  id: number;
@@ -555,6 +569,7 @@ export declare function useInboxes(opts?: {
555
569
  lastError: string | null;
556
570
  };
557
571
  removed: boolean;
572
+ aiAgentId: number | null;
558
573
  memberIds?: number[] | undefined;
559
574
  }[];
560
575
  maxInboxes: number;
@@ -0,0 +1,18 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { AiAgentPreset } from '@ezychat/shared';
3
+ /** The AI agent whose page an extension section (`agentSections`) is rendered on. */
4
+ export interface AgentSectionInfo {
5
+ agentId: number;
6
+ displayName: string;
7
+ preset: AiAgentPreset;
8
+ }
9
+ /** Wraps the extension sections of one agent page (core use only). */
10
+ export declare function AgentSectionProvider({ value, children, }: {
11
+ value: AgentSectionInfo;
12
+ children: ReactNode;
13
+ }): import("react").JSX.Element;
14
+ /**
15
+ * Inside an `agentSections` element: the agent whose page shows it (id, saved name and preset).
16
+ * Null anywhere else.
17
+ */
18
+ export declare function useAgentSection(): AgentSectionInfo | null;
@@ -2,3 +2,4 @@ export * from './types';
2
2
  export { WebExtensionsProvider, useWebExtensions } from './context';
3
3
  export { registerExtensionCatalogs, useExtensionTranslation, type ExtensionTranslate, } from './i18n';
4
4
  export { ExtensionBoundary, extensionRoutes } from './routes';
5
+ export { AgentSectionProvider, useAgentSection, type AgentSectionInfo } from './agent-section';