@ezychat/web 0.1.48 → 0.1.50

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,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;
@@ -20,13 +20,14 @@ export declare function useAiMember(): import("@tanstack/react-query").UseQueryR
20
20
  } | null;
21
21
  settings: {
22
22
  displayName: string;
23
- mode: "api" | "chatgpt";
23
+ mode: "api" | "chatgpt" | "claude";
24
24
  enabled: boolean;
25
25
  model: string;
26
26
  instructions: string;
27
27
  handoffRules?: string | undefined;
28
28
  };
29
29
  hasApiKey: boolean;
30
+ hasClaudeApiKey: boolean;
30
31
  connection: {
31
32
  state: "unavailable" | "connected" | "error" | "expired" | "signed_out" | "signing_in";
32
33
  loginUrl: string | null;
@@ -175,13 +176,14 @@ export declare function useAiMemberAction(): import("@tanstack/react-query").Use
175
176
  } | null;
176
177
  settings: {
177
178
  displayName: string;
178
- mode: "api" | "chatgpt";
179
+ mode: "api" | "chatgpt" | "claude";
179
180
  enabled: boolean;
180
181
  model: string;
181
182
  instructions: string;
182
183
  handoffRules?: string | undefined;
183
184
  };
184
185
  hasApiKey: boolean;
186
+ hasClaudeApiKey: boolean;
185
187
  connection: {
186
188
  state: "unavailable" | "connected" | "error" | "expired" | "signed_out" | "signing_in";
187
189
  loginUrl: string | null;
@@ -256,7 +258,7 @@ export declare function useAiAgent(agentId: number | null): import("@tanstack/re
256
258
  };
257
259
  settings: {
258
260
  displayName: string;
259
- mode: "api" | "chatgpt";
261
+ mode: "api" | "chatgpt" | "claude";
260
262
  enabled: boolean;
261
263
  model: string;
262
264
  instructions: string;
@@ -343,7 +345,7 @@ export declare function useAiAgentAction(agentId: number | null): import("@tanst
343
345
  };
344
346
  settings: {
345
347
  displayName: string;
346
- mode: "api" | "chatgpt";
348
+ mode: "api" | "chatgpt" | "claude";
347
349
  enabled: boolean;
348
350
  model: string;
349
351
  instructions: string;
@@ -1458,6 +1458,10 @@ export declare const enResources: {
1458
1458
  modelsLive: string;
1459
1459
  modelsFallback: string;
1460
1460
  modeApi: string;
1461
+ modeClaude: string;
1462
+ modeChatgptHint: string;
1463
+ modeApiHint: string;
1464
+ modeClaudeHint: string;
1461
1465
  modeChatgpt: string;
1462
1466
  pasteLabel: string;
1463
1467
  pasteHint: string;
@@ -1569,6 +1573,8 @@ export declare const enResources: {
1569
1573
  removeConfirm: string;
1570
1574
  saved: string;
1571
1575
  privacy: string;
1576
+ claudeCloudOff: string;
1577
+ privacyClaude: string;
1572
1578
  errors: {
1573
1579
  disk_space: string;
1574
1580
  network: string;
@@ -1717,13 +1723,42 @@ export declare const enResources: {
1717
1723
  useChatgpt: string;
1718
1724
  keyLabel: string;
1719
1725
  keyHint: string;
1726
+ keyPlaceholder: string;
1720
1727
  testKey: string;
1721
1728
  keyFailedFallback: string;
1722
1729
  keyInvalid: string;
1723
1730
  keyUnreachable: string;
1724
1731
  keyRateLimited: string;
1725
1732
  keyForbidden: string;
1733
+ claudeKey: string;
1726
1734
  saveAnyway: string;
1735
+ keyRejected: string;
1736
+ };
1737
+ claude: {
1738
+ keyLabel: string;
1739
+ keyHint: string;
1740
+ keyPlaceholder: string;
1741
+ keySaved: string;
1742
+ keyMissing: string;
1743
+ getKey: string;
1744
+ model: string;
1745
+ modelHint: string;
1746
+ models: {
1747
+ sonnet: string;
1748
+ opus: string;
1749
+ haiku: string;
1750
+ };
1751
+ voiceNote: string;
1752
+ keyRequired: string;
1753
+ keyInvalid: string;
1754
+ keyUnreachable: string;
1755
+ keyRateLimited: string;
1756
+ keyForbidden: string;
1757
+ openAiKey: string;
1758
+ connected: string;
1759
+ useClaude: string;
1760
+ keyNoCredit: string;
1761
+ keyRejected: string;
1727
1762
  };
1728
1763
  agents: {
1729
1764
  add: string;
@@ -1791,6 +1826,11 @@ export declare const enResources: {
1791
1826
  noFreeInbox: string;
1792
1827
  addInbox: string;
1793
1828
  createNext: string;
1829
+ typeTitle: string;
1830
+ typeHint: string;
1831
+ typeChange: string;
1832
+ typeEditRole: string;
1833
+ typeOwnTexts: string;
1794
1834
  };
1795
1835
  presets: {
1796
1836
  sales: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ezychat/web",
3
- "version": "0.1.48",
3
+ "version": "0.1.50",
4
4
  "type": "module",
5
5
  "description": "EzyChat core: the team inbox web app (React) as a library, with createInboxApp and its extension API.",
6
6
  "license": "MIT",
@@ -40,7 +40,7 @@
40
40
  "build:lib": "node ../../scripts/build-web-lib.mjs"
41
41
  },
42
42
  "dependencies": {
43
- "@ezychat/shared": "0.1.48",
43
+ "@ezychat/shared": "0.1.50",
44
44
  "@fontsource-variable/inter": "^5.3.0",
45
45
  "@tanstack/react-query": "^5.104.4",
46
46
  "@types/react": "^19.3.0",