@agent-native/toolkit 0.212.0 → 0.213.1

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 (57) hide show
  1. package/dist/app/i18n/catalogs/ar-SA.d.ts.map +1 -1
  2. package/dist/app/i18n/catalogs/ar-SA.js +2 -0
  3. package/dist/app/i18n/catalogs/ar-SA.js.map +1 -1
  4. package/dist/app/i18n/catalogs/de-DE.d.ts.map +1 -1
  5. package/dist/app/i18n/catalogs/de-DE.js +2 -0
  6. package/dist/app/i18n/catalogs/de-DE.js.map +1 -1
  7. package/dist/app/i18n/catalogs/en-US.d.ts +2 -0
  8. package/dist/app/i18n/catalogs/en-US.d.ts.map +1 -1
  9. package/dist/app/i18n/catalogs/en-US.js +2 -0
  10. package/dist/app/i18n/catalogs/en-US.js.map +1 -1
  11. package/dist/app/i18n/catalogs/es-ES.d.ts.map +1 -1
  12. package/dist/app/i18n/catalogs/es-ES.js +2 -0
  13. package/dist/app/i18n/catalogs/es-ES.js.map +1 -1
  14. package/dist/app/i18n/catalogs/fr-FR.d.ts.map +1 -1
  15. package/dist/app/i18n/catalogs/fr-FR.js +2 -0
  16. package/dist/app/i18n/catalogs/fr-FR.js.map +1 -1
  17. package/dist/app/i18n/catalogs/hi-IN.d.ts.map +1 -1
  18. package/dist/app/i18n/catalogs/hi-IN.js +2 -0
  19. package/dist/app/i18n/catalogs/hi-IN.js.map +1 -1
  20. package/dist/app/i18n/catalogs/ja-JP.d.ts.map +1 -1
  21. package/dist/app/i18n/catalogs/ja-JP.js +2 -0
  22. package/dist/app/i18n/catalogs/ja-JP.js.map +1 -1
  23. package/dist/app/i18n/catalogs/ko-KR.d.ts.map +1 -1
  24. package/dist/app/i18n/catalogs/ko-KR.js +2 -0
  25. package/dist/app/i18n/catalogs/ko-KR.js.map +1 -1
  26. package/dist/app/i18n/catalogs/pt-BR.d.ts.map +1 -1
  27. package/dist/app/i18n/catalogs/pt-BR.js +2 -0
  28. package/dist/app/i18n/catalogs/pt-BR.js.map +1 -1
  29. package/dist/app/i18n/catalogs/zh-CN.d.ts.map +1 -1
  30. package/dist/app/i18n/catalogs/zh-CN.js +2 -0
  31. package/dist/app/i18n/catalogs/zh-CN.js.map +1 -1
  32. package/dist/app/i18n/catalogs/zh-TW.d.ts.map +1 -1
  33. package/dist/app/i18n/catalogs/zh-TW.js +2 -0
  34. package/dist/app/i18n/catalogs/zh-TW.js.map +1 -1
  35. package/dist/app/org/AuthenticationSection.d.ts +3 -0
  36. package/dist/app/org/AuthenticationSection.d.ts.map +1 -1
  37. package/dist/app/org/AuthenticationSection.js +9 -3
  38. package/dist/app/org/AuthenticationSection.js.map +1 -1
  39. package/dist/app/org/pages/OrgAuthenticationPage.d.ts.map +1 -1
  40. package/dist/app/org/pages/OrgAuthenticationPage.js +2 -2
  41. package/dist/app/org/pages/OrgAuthenticationPage.js.map +1 -1
  42. package/package.json +3 -3
  43. package/src/app/i18n/catalogs/ar-SA.ts +3 -0
  44. package/src/app/i18n/catalogs/de-DE.ts +4 -0
  45. package/src/app/i18n/catalogs/en-US.ts +3 -0
  46. package/src/app/i18n/catalogs/es-ES.ts +4 -0
  47. package/src/app/i18n/catalogs/fr-FR.ts +4 -0
  48. package/src/app/i18n/catalogs/hi-IN.ts +3 -0
  49. package/src/app/i18n/catalogs/ja-JP.ts +3 -0
  50. package/src/app/i18n/catalogs/ko-KR.ts +3 -0
  51. package/src/app/i18n/catalogs/pt-BR.ts +4 -0
  52. package/src/app/i18n/catalogs/zh-CN.ts +3 -0
  53. package/src/app/i18n/catalogs/zh-TW.ts +3 -0
  54. package/src/app/org/AuthenticationSection.spec.tsx +62 -0
  55. package/src/app/org/AuthenticationSection.tsx +47 -1
  56. package/src/app/org/pages/OrgAuthenticationPage.tsx +4 -0
  57. package/src/app/org/pages/OrgSettingsPages.spec.tsx +3 -0
@@ -2145,6 +2145,10 @@ const messages: ToolkitAgentChatTranslation = {
2145
2145
  "Definido. Permite que os apps deste espaço de trabalho verifiquem uns aos outros.",
2146
2146
  "settingsOrg.auth.sharedSecretNotSet":
2147
2147
  "Não definido. Permite que os apps deste espaço de trabalho verifiquem uns aos outros.",
2148
+ "settingsOrg.auth.memberDelegation":
2149
+ "Delegação de identidade de membros da organização",
2150
+ "settingsOrg.auth.memberDelegationHelp":
2151
+ "Apps conectados que tenham este segredo compartilhado da organização podem declarar a identidade de qualquer membro atual ao chamar este app. Este app verifica a lista de membros em tempo real e limita o acesso delegado à organização às permissões do nível de membro.",
2148
2152
  "settingsOrg.auth.secretNotSetValue": "Não definido",
2149
2153
  "settingsOrg.auth.manage": "Gerenciar",
2150
2154
  "settingsOrg.auth.reveal": "Mostrar",
@@ -1885,6 +1885,9 @@ const messages: ToolkitAgentChatTranslation = {
1885
1885
  "settingsOrg.auth.sharedSecret": "共享密钥",
1886
1886
  "settingsOrg.auth.sharedSecretSet": "已设置。让此工作区中的应用相互验证。",
1887
1887
  "settingsOrg.auth.sharedSecretNotSet": "未设置。让此工作区中的应用相互验证。",
1888
+ "settingsOrg.auth.memberDelegation": "组织成员身份委派",
1889
+ "settingsOrg.auth.memberDelegationHelp":
1890
+ "持有此组织共享密钥的已连接应用在调用此应用时,可以声明为任意一名当前成员。此应用会检查实时成员名单,并将受委派的组织访问权限限制为成员级权限。",
1888
1891
  "settingsOrg.auth.secretNotSetValue": "未设置",
1889
1892
  "settingsOrg.auth.manage": "管理",
1890
1893
  "settingsOrg.auth.reveal": "显示",
@@ -1894,6 +1894,9 @@ const messages: ToolkitAgentChatTranslation = {
1894
1894
  "已設定。讓此工作區中的應用程式互相驗證。",
1895
1895
  "settingsOrg.auth.sharedSecretNotSet":
1896
1896
  "未設定。讓此工作區中的應用程式互相驗證。",
1897
+ "settingsOrg.auth.memberDelegation": "組織成員身分委派",
1898
+ "settingsOrg.auth.memberDelegationHelp":
1899
+ "持有此組織共用密鑰的已連結應用程式在呼叫此應用程式時,可以聲稱是任何一位現任成員。此應用程式會檢查即時成員名單,並將受委派的組織存取權限制為成員層級的權限。",
1897
1900
  "settingsOrg.auth.secretNotSetValue": "未設定",
1898
1901
  "settingsOrg.auth.manage": "管理",
1899
1902
  "settingsOrg.auth.reveal": "顯示",
@@ -0,0 +1,62 @@
1
+ // @vitest-environment happy-dom
2
+
3
+ import React, { act } from "react";
4
+ import { createRoot, type Root } from "react-dom/client";
5
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
6
+
7
+ const mocks = vi.hoisted(() => ({
8
+ setDelegation: { error: null, isPending: false, mutate: vi.fn() },
9
+ }));
10
+
11
+ vi.mock("@agent-native/core/client/org", () => ({
12
+ useSetA2AMemberDelegation: () => mocks.setDelegation,
13
+ }));
14
+
15
+ vi.mock("@agent-native/core/client/i18n", () => ({
16
+ useT: () => (key: string) => key,
17
+ }));
18
+
19
+ import { TooltipProvider } from "@agent-native/toolkit/ui/tooltip";
20
+
21
+ import { A2AMemberDelegationSection } from "./AuthenticationSection.js";
22
+
23
+ describe("A2AMemberDelegationSection", () => {
24
+ let container: HTMLDivElement;
25
+ let root: Root;
26
+
27
+ beforeEach(() => {
28
+ vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
29
+ container = document.createElement("div");
30
+ document.body.appendChild(container);
31
+ root = createRoot(container);
32
+ vi.clearAllMocks();
33
+ });
34
+
35
+ afterEach(() => {
36
+ act(() => root.unmount());
37
+ container.remove();
38
+ vi.unstubAllGlobals();
39
+ });
40
+
41
+ it("shows the owner-controlled setting and sends the selected value", () => {
42
+ act(() => {
43
+ root.render(
44
+ <TooltipProvider>
45
+ <A2AMemberDelegationSection enabled={false} />
46
+ </TooltipProvider>,
47
+ );
48
+ });
49
+
50
+ const toggle = container.querySelector('[role="switch"]');
51
+ expect(toggle?.getAttribute("aria-label")).toBe(
52
+ "agentChat.settingsOrg.auth.memberDelegation",
53
+ );
54
+ expect(toggle?.getAttribute("aria-checked")).toBe("false");
55
+
56
+ act(() =>
57
+ toggle?.dispatchEvent(new MouseEvent("click", { bubbles: true })),
58
+ );
59
+
60
+ expect(mocks.setDelegation.mutate).toHaveBeenCalledWith(true);
61
+ });
62
+ });
@@ -4,6 +4,7 @@ import {
4
4
  useSetOrgDomain,
5
5
  useRevealA2ASecret,
6
6
  useSetA2ASecret,
7
+ useSetA2AMemberDelegation,
7
8
  useSyncA2ASecret,
8
9
  type SyncA2ASecretResult,
9
10
  } from "@agent-native/core/client/org";
@@ -18,6 +19,7 @@ import {
18
19
  PopoverTrigger,
19
20
  } from "@agent-native/toolkit/ui/popover";
20
21
  import { Spinner } from "@agent-native/toolkit/ui/spinner";
22
+ import { Switch } from "@agent-native/toolkit/ui/switch";
21
23
  import {
22
24
  Tooltip,
23
25
  TooltipContent,
@@ -34,6 +36,7 @@ import {
34
36
  IconEye,
35
37
  IconEyeOff,
36
38
  IconCloudUpload,
39
+ IconInfoCircle,
37
40
  } from "@tabler/icons-react";
38
41
  import { useState } from "react";
39
42
 
@@ -505,6 +508,44 @@ export function A2ASecretSection({ isSet }: { isSet: boolean }) {
505
508
  );
506
509
  }
507
510
 
511
+ export function A2AMemberDelegationSection({ enabled }: { enabled: boolean }) {
512
+ const t = useT();
513
+ const setDelegation = useSetA2AMemberDelegation();
514
+
515
+ return (
516
+ <SettingsRow
517
+ id="a2a-member-delegation"
518
+ label={
519
+ <Tooltip>
520
+ <TooltipTrigger asChild>
521
+ <span className="inline-flex items-center gap-1" tabIndex={0}>
522
+ {t("agentChat.settingsOrg.auth.memberDelegation")}
523
+ <IconInfoCircle
524
+ aria-hidden="true"
525
+ className="size-4 text-muted-foreground"
526
+ />
527
+ </span>
528
+ </TooltipTrigger>
529
+ <TooltipContent>
530
+ {t("agentChat.settingsOrg.auth.memberDelegationHelp")}
531
+ </TooltipContent>
532
+ </Tooltip>
533
+ }
534
+ control={
535
+ <div className="flex items-center justify-end gap-3">
536
+ <ErrorText error={setDelegation.error} />
537
+ <Switch
538
+ checked={enabled}
539
+ onCheckedChange={(value) => setDelegation.mutate(value)}
540
+ disabled={setDelegation.isPending}
541
+ aria-label={t("agentChat.settingsOrg.auth.memberDelegation")}
542
+ />
543
+ </div>
544
+ }
545
+ />
546
+ );
547
+ }
548
+
508
549
  /**
509
550
  * Sign-in policy, SSO, SCIM, and domain auto-join for owners and admins, plus
510
551
  * the cross-app secret for owners. Renders nothing for members.
@@ -528,7 +569,12 @@ export function AuthenticationSection({ title }: { title?: string }) {
528
569
  requiredAuthProvider={org.requiredAuthProvider}
529
570
  />
530
571
  {org.role === "owner" && (
531
- <A2ASecretSection isSet={Boolean(org.a2aSecretSet)} />
572
+ <>
573
+ <A2ASecretSection isSet={Boolean(org.a2aSecretSet)} />
574
+ <A2AMemberDelegationSection
575
+ enabled={Boolean(org.a2aMemberDelegationEnabled)}
576
+ />
577
+ </>
532
578
  )}
533
579
  </SettingsGroup>
534
580
  </SectionTooltipProvider>
@@ -19,6 +19,7 @@ import { useState } from "react";
19
19
 
20
20
  import { SettingsGroup, SettingsRow } from "../../settings/SettingsRow.js";
21
21
  import {
22
+ A2AMemberDelegationSection,
22
23
  A2ASecretSection,
23
24
  DomainSettingsSection,
24
25
  } from "../AuthenticationSection.js";
@@ -204,6 +205,9 @@ function OrgAuthenticationContent({ org }: { org: OrgInfo }) {
204
205
  title={t("agentChat.settingsOrg.auth.betweenApps")}
205
206
  >
206
207
  <A2ASecretSection isSet={Boolean(org.a2aSecretSet)} />
208
+ <A2AMemberDelegationSection
209
+ enabled={Boolean(org.a2aMemberDelegationEnabled)}
210
+ />
207
211
  </SettingsGroup>
208
212
  )}
209
213
  </div>
@@ -88,6 +88,7 @@ vi.mock("../OrgIdentitySettings.js", () => ({
88
88
  vi.mock("../AuthenticationSection.js", () => ({
89
89
  DomainSettingsSection: () => <div id="email-domain" />,
90
90
  A2ASecretSection: () => <div id="cross-app-authentication" />,
91
+ A2AMemberDelegationSection: () => <div id="member-delegation" />,
91
92
  }));
92
93
 
93
94
  vi.mock("../OrgGeneralSection.js", () => ({
@@ -194,6 +195,7 @@ describe("Organization settings pages", () => {
194
195
  expect(methods?.textContent).toContain("Email and password, and Google.");
195
196
  expect(container.querySelector("#email-domain")).not.toBeNull();
196
197
  expect(container.querySelector("#cross-app-authentication")).toBeNull();
198
+ expect(container.querySelector("#member-delegation")).toBeNull();
197
199
  });
198
200
 
199
201
  it("shows the owner the shared secret", () => {
@@ -203,6 +205,7 @@ describe("Organization settings pages", () => {
203
205
  expect(
204
206
  container.querySelector("#cross-app-authentication"),
205
207
  ).not.toBeNull();
208
+ expect(container.querySelector("#member-delegation")).not.toBeNull();
206
209
  });
207
210
 
208
211
  it("lists each method and the variables that turn it on", () => {