@axiom-lattice/react-sdk 8.0.0 → 8.1.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 (103) hide show
  1. package/dist/{AgentDetailSideApp-XIHTVZQ6.mjs → AgentDetailSideApp-J64Y7RKT.mjs} +11 -11
  2. package/dist/AgentGovernanceWorkbench-N5DMTNRS.mjs +24 -0
  3. package/dist/{LangfuseDashboard-PYKA7XQ6.mjs → LangfuseDashboard-INSDUIPR.mjs} +2 -2
  4. package/dist/{MessageGraph-PYBCVFGD.mjs → MessageGraph-LEWE7BDE.mjs} +7 -7
  5. package/dist/{ReactChart-TN5VMVHH.mjs → ReactChart-SBFZNQ2L.mjs} +7 -7
  6. package/dist/SkillFlow-U6I2VRDK.mjs +14 -0
  7. package/dist/{TasksSideApp-C6XFEGZ7.mjs → TasksSideApp-GPD7GCPM.mjs} +8 -8
  8. package/dist/ThreadMaintenancePanel-TNWSDFIP.mjs +12 -0
  9. package/dist/{TopologyRuntimeView-R262O6TK.mjs → TopologyRuntimeView-QHOSBVWW.mjs} +8 -8
  10. package/dist/WorkflowAutomationView-5Q4ONV3C.mjs +22 -0
  11. package/dist/{chunk-ATU3HLYK.mjs → chunk-24KHOHEI.mjs} +742 -583
  12. package/dist/chunk-24KHOHEI.mjs.map +1 -0
  13. package/dist/{chunk-QFH5BFAB.mjs → chunk-5N54V24W.mjs} +5 -5
  14. package/dist/{chunk-BS6EXA72.mjs → chunk-5SGLNRLH.mjs} +4 -4
  15. package/dist/{chunk-5OZ7L6I3.mjs → chunk-7PNKDQYG.mjs} +3 -3
  16. package/dist/{chunk-6YTFHBP4.mjs → chunk-CD2UMRM5.mjs} +2 -2
  17. package/dist/{chunk-IGY2PP3H.mjs → chunk-GPB3TMDZ.mjs} +4 -4
  18. package/dist/{chunk-NEXWD46N.mjs → chunk-IK53JBJ6.mjs} +3 -3
  19. package/dist/{chunk-PPOYWDJA.mjs → chunk-LNTNCTWO.mjs} +3 -3
  20. package/dist/{chunk-UJS5NABN.mjs → chunk-OY2LSB3A.mjs} +7 -7
  21. package/dist/{chunk-TAIUUSGV.mjs → chunk-RON4XT5J.mjs} +4 -4
  22. package/dist/{chunk-WXSL425B.mjs → chunk-TLAIIWGR.mjs} +8 -8
  23. package/dist/{chunk-Q2222EXS.mjs → chunk-U22DSLN6.mjs} +10 -10
  24. package/dist/{chunk-XWMOF3KE.mjs → chunk-XAOJDKE7.mjs} +3 -3
  25. package/dist/{chunk-5CG4N4VQ.mjs → chunk-ZKYJP3RO.mjs} +3 -3
  26. package/dist/{embed-page-AgentDetailSideApp-NK6VQBXS.js → embed-page-AgentDetailSideApp-6MHCQZ2W.js} +1 -1
  27. package/dist/{embed-page-AgentGovernanceWorkbench-TKVV2GA6.js → embed-page-AgentGovernanceWorkbench-DZRR5VSK.js} +1 -1
  28. package/dist/{embed-page-LangfuseDashboard-EYK2T2VK.js → embed-page-LangfuseDashboard-JWH5JGLY.js} +1 -1
  29. package/dist/{embed-page-MessageGraph-P73B52OR.js → embed-page-MessageGraph-DJSV5HLH.js} +1 -1
  30. package/dist/{embed-page-ReactChart-LK6DUA4R.js → embed-page-ReactChart-RSR3JSF6.js} +1 -1
  31. package/dist/{embed-page-SkillFlow-54RIT6M2.js → embed-page-SkillFlow-JZGJAG3O.js} +1 -1
  32. package/dist/{embed-page-TasksSideApp-RK64OPAA.js → embed-page-TasksSideApp-4LIXWO44.js} +1 -1
  33. package/dist/{embed-page-ThreadMaintenancePanel-PI3U76W3.js → embed-page-ThreadMaintenancePanel-7CWGP3ZK.js} +1 -1
  34. package/dist/{embed-page-TopologyRuntimeView-X6QPRQE2.js → embed-page-TopologyRuntimeView-AVSCNALN.js} +1 -1
  35. package/dist/{embed-page-WorkflowAutomationView-3PE6YCRK.js → embed-page-WorkflowAutomationView-RFYT2AIZ.js} +1 -1
  36. package/dist/{embed-page-chunk-GYO2ELMI.js → embed-page-chunk-2XFJOQHZ.js} +1 -1
  37. package/dist/{embed-page-chunk-UV6IYDW5.js → embed-page-chunk-7CDMVSAB.js} +1 -1
  38. package/dist/{embed-page-chunk-US46Q3B7.js → embed-page-chunk-EVZKWKMQ.js} +2 -2
  39. package/dist/{embed-page-chunk-KF3HZ4TX.js → embed-page-chunk-IQ75BKOM.js} +1 -1
  40. package/dist/{embed-page-chunk-MEY3NEJZ.js → embed-page-chunk-JGFRDPYZ.js} +1 -1
  41. package/dist/{embed-page-chunk-OKZPPZMF.js → embed-page-chunk-KKUDX33F.js} +1 -1
  42. package/dist/{embed-page-chunk-YWJQVBZV.js → embed-page-chunk-PJJCN6GS.js} +1 -1
  43. package/dist/{embed-page-chunk-767LVAGR.js → embed-page-chunk-QJKFXJNR.js} +1 -1
  44. package/dist/{embed-page-chunk-EB43T3BJ.js → embed-page-chunk-TTFIPBIV.js} +130 -130
  45. package/dist/{embed-page-chunk-BD7DUF2M.js → embed-page-chunk-U5A5D7IS.js} +1 -1
  46. package/dist/embed-page-en-HDSVQ4O6.js +1 -0
  47. package/dist/embed-page-en-TSCGSJAI.js +1 -0
  48. package/dist/embed-page-zh-IR652A6J.js +1 -0
  49. package/dist/embed-page-zh-Q22DIOB3.js +1 -0
  50. package/dist/embed-page.js +1 -1
  51. package/dist/{en-DQDMGSNU.mjs → en-46QZD2TW.mjs} +12 -3
  52. package/dist/en-46QZD2TW.mjs.map +1 -0
  53. package/dist/{en-ANSLFEBD.mjs → en-5PDWSPXV.mjs} +3 -2
  54. package/dist/en-5PDWSPXV.mjs.map +1 -0
  55. package/dist/index.d.mts +13 -3
  56. package/dist/index.d.ts +13 -3
  57. package/dist/index.js +1859 -1680
  58. package/dist/index.js.map +1 -1
  59. package/dist/index.mjs +14 -14
  60. package/dist/web-app.js +26 -6
  61. package/dist/web-app.js.map +1 -1
  62. package/dist/web-app.mjs +2 -2
  63. package/dist/{zh-BKAP45UO.mjs → zh-2SMAXRUF.mjs} +12 -3
  64. package/dist/zh-2SMAXRUF.mjs.map +1 -0
  65. package/dist/{zh-JFU5VIZ6.mjs → zh-6DVLMOZW.mjs} +3 -2
  66. package/dist/zh-6DVLMOZW.mjs.map +1 -0
  67. package/package.json +3 -3
  68. package/dist/AgentGovernanceWorkbench-ZCKD22PH.mjs +0 -24
  69. package/dist/SkillFlow-XIMU6EET.mjs +0 -14
  70. package/dist/ThreadMaintenancePanel-KJYC7ZWN.mjs +0 -12
  71. package/dist/WorkflowAutomationView-2JN3WT7G.mjs +0 -22
  72. package/dist/chunk-ATU3HLYK.mjs.map +0 -1
  73. package/dist/embed-page-en-27OIE2UA.js +0 -1
  74. package/dist/embed-page-en-X6B6RVNL.js +0 -1
  75. package/dist/embed-page-zh-EQ5X2M32.js +0 -1
  76. package/dist/embed-page-zh-FXQGY5HD.js +0 -1
  77. package/dist/en-ANSLFEBD.mjs.map +0 -1
  78. package/dist/en-DQDMGSNU.mjs.map +0 -1
  79. package/dist/zh-BKAP45UO.mjs.map +0 -1
  80. package/dist/zh-JFU5VIZ6.mjs.map +0 -1
  81. /package/dist/{AgentDetailSideApp-XIHTVZQ6.mjs.map → AgentDetailSideApp-J64Y7RKT.mjs.map} +0 -0
  82. /package/dist/{AgentGovernanceWorkbench-ZCKD22PH.mjs.map → AgentGovernanceWorkbench-N5DMTNRS.mjs.map} +0 -0
  83. /package/dist/{LangfuseDashboard-PYKA7XQ6.mjs.map → LangfuseDashboard-INSDUIPR.mjs.map} +0 -0
  84. /package/dist/{MessageGraph-PYBCVFGD.mjs.map → MessageGraph-LEWE7BDE.mjs.map} +0 -0
  85. /package/dist/{ReactChart-TN5VMVHH.mjs.map → ReactChart-SBFZNQ2L.mjs.map} +0 -0
  86. /package/dist/{SkillFlow-XIMU6EET.mjs.map → SkillFlow-U6I2VRDK.mjs.map} +0 -0
  87. /package/dist/{TasksSideApp-C6XFEGZ7.mjs.map → TasksSideApp-GPD7GCPM.mjs.map} +0 -0
  88. /package/dist/{ThreadMaintenancePanel-KJYC7ZWN.mjs.map → ThreadMaintenancePanel-TNWSDFIP.mjs.map} +0 -0
  89. /package/dist/{TopologyRuntimeView-R262O6TK.mjs.map → TopologyRuntimeView-QHOSBVWW.mjs.map} +0 -0
  90. /package/dist/{WorkflowAutomationView-2JN3WT7G.mjs.map → WorkflowAutomationView-5Q4ONV3C.mjs.map} +0 -0
  91. /package/dist/{chunk-QFH5BFAB.mjs.map → chunk-5N54V24W.mjs.map} +0 -0
  92. /package/dist/{chunk-BS6EXA72.mjs.map → chunk-5SGLNRLH.mjs.map} +0 -0
  93. /package/dist/{chunk-5OZ7L6I3.mjs.map → chunk-7PNKDQYG.mjs.map} +0 -0
  94. /package/dist/{chunk-6YTFHBP4.mjs.map → chunk-CD2UMRM5.mjs.map} +0 -0
  95. /package/dist/{chunk-IGY2PP3H.mjs.map → chunk-GPB3TMDZ.mjs.map} +0 -0
  96. /package/dist/{chunk-NEXWD46N.mjs.map → chunk-IK53JBJ6.mjs.map} +0 -0
  97. /package/dist/{chunk-PPOYWDJA.mjs.map → chunk-LNTNCTWO.mjs.map} +0 -0
  98. /package/dist/{chunk-UJS5NABN.mjs.map → chunk-OY2LSB3A.mjs.map} +0 -0
  99. /package/dist/{chunk-TAIUUSGV.mjs.map → chunk-RON4XT5J.mjs.map} +0 -0
  100. /package/dist/{chunk-WXSL425B.mjs.map → chunk-TLAIIWGR.mjs.map} +0 -0
  101. /package/dist/{chunk-Q2222EXS.mjs.map → chunk-U22DSLN6.mjs.map} +0 -0
  102. /package/dist/{chunk-XWMOF3KE.mjs.map → chunk-XAOJDKE7.mjs.map} +0 -0
  103. /package/dist/{chunk-5CG4N4VQ.mjs.map → chunk-ZKYJP3RO.mjs.map} +0 -0
@@ -9,8 +9,8 @@ import { createInstance } from "i18next";
9
9
  var globImport_locales_json = __glob({
10
10
  "./locales/a2a/en.json": () => import("./en-6PKJVZCK.mjs"),
11
11
  "./locales/a2a/zh.json": () => import("./zh-HLNATJQA.mjs"),
12
- "./locales/auth/en.json": () => import("./en-DQDMGSNU.mjs"),
13
- "./locales/auth/zh.json": () => import("./zh-BKAP45UO.mjs"),
12
+ "./locales/auth/en.json": () => import("./en-46QZD2TW.mjs"),
13
+ "./locales/auth/zh.json": () => import("./zh-2SMAXRUF.mjs"),
14
14
  "./locales/capability/en.json": () => import("./en-C2BSYCJG.mjs"),
15
15
  "./locales/capability/zh.json": () => import("./zh-CDVMQIGX.mjs"),
16
16
  "./locales/chat/en.json": () => import("./en-WUCUNC4W.mjs"),
@@ -19,8 +19,8 @@ var globImport_locales_json = __glob({
19
19
  "./locales/chatConfig/zh.json": () => import("./zh-OEBA6UZP.mjs"),
20
20
  "./locales/chatMenu/en.json": () => import("./en-ESIQ3NOX.mjs"),
21
21
  "./locales/chatMenu/zh.json": () => import("./zh-UNARBD76.mjs"),
22
- "./locales/chatWorkspace/en.json": () => import("./en-ANSLFEBD.mjs"),
23
- "./locales/chatWorkspace/zh.json": () => import("./zh-JFU5VIZ6.mjs"),
22
+ "./locales/chatWorkspace/en.json": () => import("./en-5PDWSPXV.mjs"),
23
+ "./locales/chatWorkspace/zh.json": () => import("./zh-6DVLMOZW.mjs"),
24
24
  "./locales/common/en.json": () => import("./en-HROEVNGD.mjs"),
25
25
  "./locales/common/zh.json": () => import("./zh-HX7UV3AR.mjs"),
26
26
  "./locales/cospace/en.json": () => import("./en-R6DYHMBZ.mjs"),
@@ -220,4 +220,4 @@ export {
220
220
  DEFAULT_LOCALE_STORAGE_KEY,
221
221
  readStoredLocale
222
222
  };
223
- //# sourceMappingURL=chunk-QFH5BFAB.mjs.map
223
+ //# sourceMappingURL=chunk-5N54V24W.mjs.map
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  ConversationContext,
3
3
  useChatUIContext
4
- } from "./chunk-XWMOF3KE.mjs";
4
+ } from "./chunk-XAOJDKE7.mjs";
5
5
  import {
6
6
  useClient
7
- } from "./chunk-5CG4N4VQ.mjs";
7
+ } from "./chunk-ZKYJP3RO.mjs";
8
8
  import {
9
9
  useT
10
- } from "./chunk-QFH5BFAB.mjs";
10
+ } from "./chunk-5N54V24W.mjs";
11
11
 
12
12
  // src/components/ThreadMaintenance/ThreadMaintenancePanel.tsx
13
13
  import { useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
@@ -427,4 +427,4 @@ var TextBlock = ({ label, children }) => /* @__PURE__ */ jsxs("div", { children:
427
427
  export {
428
428
  ThreadMaintenancePanel
429
429
  };
430
- //# sourceMappingURL=chunk-BS6EXA72.mjs.map
430
+ //# sourceMappingURL=chunk-5SGLNRLH.mjs.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  useClient
3
- } from "./chunk-5CG4N4VQ.mjs";
3
+ } from "./chunk-ZKYJP3RO.mjs";
4
4
  import {
5
5
  useT
6
- } from "./chunk-QFH5BFAB.mjs";
6
+ } from "./chunk-5N54V24W.mjs";
7
7
 
8
8
  // src/hooks/useApi.ts
9
9
  import { useState, useCallback } from "react";
@@ -387,4 +387,4 @@ export {
387
387
  CreateSkillModal,
388
388
  CreateSkillModal_default
389
389
  };
390
- //# sourceMappingURL=chunk-5OZ7L6I3.mjs.map
390
+ //# sourceMappingURL=chunk-7PNKDQYG.mjs.map
@@ -3,7 +3,7 @@ import {
3
3
  LatticeLocaleProvider,
4
4
  LocaleBridgeContext,
5
5
  readStoredLocale
6
- } from "./chunk-QFH5BFAB.mjs";
6
+ } from "./chunk-5N54V24W.mjs";
7
7
 
8
8
  // src/i18n/LocaleLayerIfAbsent.tsx
9
9
  import { useContext, useMemo } from "react";
@@ -40,4 +40,4 @@ function LocaleLayerIfAbsent({
40
40
  export {
41
41
  LocaleLayerIfAbsent
42
42
  };
43
- //# sourceMappingURL=chunk-6YTFHBP4.mjs.map
43
+ //# sourceMappingURL=chunk-CD2UMRM5.mjs.map
@@ -3,13 +3,13 @@ import {
3
3
  Chating,
4
4
  InitialMessageSubmitter,
5
5
  ProjectSelector
6
- } from "./chunk-ATU3HLYK.mjs";
6
+ } from "./chunk-24KHOHEI.mjs";
7
7
  import {
8
8
  useClient
9
- } from "./chunk-5CG4N4VQ.mjs";
9
+ } from "./chunk-ZKYJP3RO.mjs";
10
10
  import {
11
11
  useT
12
- } from "./chunk-QFH5BFAB.mjs";
12
+ } from "./chunk-5N54V24W.mjs";
13
13
 
14
14
  // src/components/Chat/CopilotPanel.tsx
15
15
  import { useMemo } from "react";
@@ -205,4 +205,4 @@ export {
205
205
  TrainingContextCard,
206
206
  CopilotPanel
207
207
  };
208
- //# sourceMappingURL=chunk-IGY2PP3H.mjs.map
208
+ //# sourceMappingURL=chunk-GPB3TMDZ.mjs.map
@@ -13,10 +13,10 @@ import {
13
13
  } from "./chunk-XC6TB6PI.mjs";
14
14
  import {
15
15
  MDResponse
16
- } from "./chunk-ATU3HLYK.mjs";
16
+ } from "./chunk-24KHOHEI.mjs";
17
17
  import {
18
18
  useT
19
- } from "./chunk-QFH5BFAB.mjs";
19
+ } from "./chunk-5N54V24W.mjs";
20
20
 
21
21
  // src/components/Chat/WorkflowNode.tsx
22
22
  import { Tag, Typography, Tooltip, Popover } from "antd";
@@ -1087,4 +1087,4 @@ export {
1087
1087
  WorkflowCanvas_default,
1088
1088
  expandWorkflow
1089
1089
  };
1090
- //# sourceMappingURL=chunk-NEXWD46N.mjs.map
1090
+ //# sourceMappingURL=chunk-IK53JBJ6.mjs.map
@@ -4,10 +4,10 @@ import {
4
4
  TaskActionsButton,
5
5
  isHiddenStatus,
6
6
  taskOrigin
7
- } from "./chunk-ATU3HLYK.mjs";
7
+ } from "./chunk-24KHOHEI.mjs";
8
8
  import {
9
9
  useT
10
- } from "./chunk-QFH5BFAB.mjs";
10
+ } from "./chunk-5N54V24W.mjs";
11
11
 
12
12
  // src/components/Tasks/TaskOutlineList.tsx
13
13
  import {
@@ -491,4 +491,4 @@ var TaskOutlineList = ({
491
491
  export {
492
492
  TaskOutlineList
493
493
  };
494
- //# sourceMappingURL=chunk-PPOYWDJA.mjs.map
494
+ //# sourceMappingURL=chunk-LNTNCTWO.mjs.map
@@ -1,27 +1,27 @@
1
1
  import {
2
2
  CopilotPanel,
3
3
  TrainingContextCard
4
- } from "./chunk-IGY2PP3H.mjs";
4
+ } from "./chunk-GPB3TMDZ.mjs";
5
5
  import {
6
6
  WorkflowCanvas_default,
7
7
  expandWorkflow
8
- } from "./chunk-NEXWD46N.mjs";
8
+ } from "./chunk-IK53JBJ6.mjs";
9
9
  import {
10
10
  ReactFlowProvider
11
11
  } from "./chunk-XC6TB6PI.mjs";
12
12
  import {
13
13
  MDResponse,
14
14
  ProjectScopeProvider
15
- } from "./chunk-ATU3HLYK.mjs";
15
+ } from "./chunk-24KHOHEI.mjs";
16
16
  import {
17
17
  useWorkspaceContext
18
- } from "./chunk-XWMOF3KE.mjs";
18
+ } from "./chunk-XAOJDKE7.mjs";
19
19
  import {
20
20
  useApi
21
- } from "./chunk-5OZ7L6I3.mjs";
21
+ } from "./chunk-7PNKDQYG.mjs";
22
22
  import {
23
23
  useT
24
- } from "./chunk-QFH5BFAB.mjs";
24
+ } from "./chunk-5N54V24W.mjs";
25
25
 
26
26
  // src/components/Chat/WorkflowAutomationView.tsx
27
27
  import { useEffect as useEffect2, useState as useState2, useCallback, useMemo as useMemo2, useRef } from "react";
@@ -1298,4 +1298,4 @@ export {
1298
1298
  WorkflowAutomationView,
1299
1299
  WorkflowAutomationView_default
1300
1300
  };
1301
- //# sourceMappingURL=chunk-UJS5NABN.mjs.map
1301
+ //# sourceMappingURL=chunk-OY2LSB3A.mjs.map
@@ -12,14 +12,14 @@ import {
12
12
  import {
13
13
  CreateSkillModal_default,
14
14
  useApi
15
- } from "./chunk-5OZ7L6I3.mjs";
15
+ } from "./chunk-7PNKDQYG.mjs";
16
16
  import {
17
17
  useClient,
18
18
  useLatticeChatShellContext
19
- } from "./chunk-5CG4N4VQ.mjs";
19
+ } from "./chunk-ZKYJP3RO.mjs";
20
20
  import {
21
21
  useT
22
- } from "./chunk-QFH5BFAB.mjs";
22
+ } from "./chunk-5N54V24W.mjs";
23
23
 
24
24
  // src/components/Chat/SkillFlow.tsx
25
25
  import { useMemo as useMemo2, useEffect as useEffect2, useState as useState2 } from "react";
@@ -1174,4 +1174,4 @@ export {
1174
1174
  SkillNode_default,
1175
1175
  SkillFlow_default
1176
1176
  };
1177
- //# sourceMappingURL=chunk-TAIUUSGV.mjs.map
1177
+ //# sourceMappingURL=chunk-RON4XT5J.mjs.map
@@ -10,10 +10,10 @@ import {
10
10
  shortHash,
11
11
  startLearningRound,
12
12
  statusHex
13
- } from "./chunk-Q2222EXS.mjs";
13
+ } from "./chunk-U22DSLN6.mjs";
14
14
  import {
15
15
  TrainingContextCard
16
- } from "./chunk-IGY2PP3H.mjs";
16
+ } from "./chunk-GPB3TMDZ.mjs";
17
17
  import {
18
18
  Background,
19
19
  Controls,
@@ -29,19 +29,19 @@ import {
29
29
  FilterSelect,
30
30
  ProjectScopeProvider_default,
31
31
  useSideAppOpener
32
- } from "./chunk-ATU3HLYK.mjs";
32
+ } from "./chunk-24KHOHEI.mjs";
33
33
  import {
34
34
  useWorkspaceContext
35
- } from "./chunk-XWMOF3KE.mjs";
35
+ } from "./chunk-XAOJDKE7.mjs";
36
36
  import {
37
37
  useApi
38
- } from "./chunk-5OZ7L6I3.mjs";
38
+ } from "./chunk-7PNKDQYG.mjs";
39
39
  import {
40
40
  useClient
41
- } from "./chunk-5CG4N4VQ.mjs";
41
+ } from "./chunk-ZKYJP3RO.mjs";
42
42
  import {
43
43
  useT
44
- } from "./chunk-QFH5BFAB.mjs";
44
+ } from "./chunk-5N54V24W.mjs";
45
45
 
46
46
  // src/components/Governance/AgentGovernanceWorkbench.tsx
47
47
  import React6, { useCallback as useCallback3, useEffect as useEffect4, useState as useState5 } from "react";
@@ -1759,4 +1759,4 @@ export {
1759
1759
  CreateAssistantModal_default,
1760
1760
  AgentGovernanceWorkbench
1761
1761
  };
1762
- //# sourceMappingURL=chunk-WXSL425B.mjs.map
1762
+ //# sourceMappingURL=chunk-TLAIIWGR.mjs.map
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  TaskOutlineList
3
- } from "./chunk-PPOYWDJA.mjs";
3
+ } from "./chunk-LNTNCTWO.mjs";
4
4
  import {
5
5
  EChart
6
6
  } from "./chunk-J37GWFPA.mjs";
7
7
  import {
8
8
  CopilotPanel,
9
9
  TrainingContextCard
10
- } from "./chunk-IGY2PP3H.mjs";
10
+ } from "./chunk-GPB3TMDZ.mjs";
11
11
  import {
12
12
  WorkflowCanvas_default,
13
13
  expandWorkflow
14
- } from "./chunk-NEXWD46N.mjs";
14
+ } from "./chunk-IK53JBJ6.mjs";
15
15
  import {
16
16
  WorkflowGraphBase,
17
17
  applyDagreLayout
@@ -60,7 +60,7 @@ import {
60
60
  useOpenTaskChat,
61
61
  useTaskCommands,
62
62
  useWorkbenchNavStyles
63
- } from "./chunk-ATU3HLYK.mjs";
63
+ } from "./chunk-24KHOHEI.mjs";
64
64
  import {
65
65
  AssistantContext,
66
66
  ConversationContextProvider,
@@ -68,10 +68,10 @@ import {
68
68
  useChatUIContext,
69
69
  useConversationContext,
70
70
  useWorkspaceContext
71
- } from "./chunk-XWMOF3KE.mjs";
71
+ } from "./chunk-XAOJDKE7.mjs";
72
72
  import {
73
73
  useApi
74
- } from "./chunk-5OZ7L6I3.mjs";
74
+ } from "./chunk-7PNKDQYG.mjs";
75
75
  import {
76
76
  AxiomLatticeProvider,
77
77
  LatticeChatShellContextProvider,
@@ -79,19 +79,19 @@ import {
79
79
  useAuth,
80
80
  useClient,
81
81
  useLatticeChatShellContext
82
- } from "./chunk-5CG4N4VQ.mjs";
82
+ } from "./chunk-ZKYJP3RO.mjs";
83
83
  import {
84
84
  AgentWebAppRuntimeClient,
85
85
  AgentWebAppRuntimeClientError
86
86
  } from "./chunk-DTZPCOY2.mjs";
87
87
  import {
88
88
  LocaleLayerIfAbsent
89
- } from "./chunk-6YTFHBP4.mjs";
89
+ } from "./chunk-CD2UMRM5.mjs";
90
90
  import {
91
91
  DEFAULT_LOCALE_STORAGE_KEY,
92
92
  readStoredLocale,
93
93
  useT
94
- } from "./chunk-QFH5BFAB.mjs";
94
+ } from "./chunk-5N54V24W.mjs";
95
95
 
96
96
  // src/components/Governance/agentMeta.ts
97
97
  var TYPE_LABEL = {
@@ -8869,4 +8869,4 @@ export {
8869
8869
  AgentConfigGraph,
8870
8870
  AgentDetailView
8871
8871
  };
8872
- //# sourceMappingURL=chunk-Q2222EXS.mjs.map
8872
+ //# sourceMappingURL=chunk-U22DSLN6.mjs.map
@@ -3,10 +3,10 @@ import {
3
3
  useAuth,
4
4
  useClient,
5
5
  useLatticeChatShellContext
6
- } from "./chunk-5CG4N4VQ.mjs";
6
+ } from "./chunk-ZKYJP3RO.mjs";
7
7
  import {
8
8
  useT
9
- } from "./chunk-QFH5BFAB.mjs";
9
+ } from "./chunk-5N54V24W.mjs";
10
10
 
11
11
  // src/components/Chat/AssistantContext.tsx
12
12
  import {
@@ -2806,4 +2806,4 @@ export {
2806
2806
  ChatUIContextProvider,
2807
2807
  useChatUIContext
2808
2808
  };
2809
- //# sourceMappingURL=chunk-XWMOF3KE.mjs.map
2809
+ //# sourceMappingURL=chunk-XAOJDKE7.mjs.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  LocaleLayerIfAbsent
3
- } from "./chunk-6YTFHBP4.mjs";
3
+ } from "./chunk-CD2UMRM5.mjs";
4
4
  import {
5
5
  DEFAULT_LOCALE_STORAGE_KEY,
6
6
  useT
7
- } from "./chunk-QFH5BFAB.mjs";
7
+ } from "./chunk-5N54V24W.mjs";
8
8
 
9
9
  // src/utils/authStorage.ts
10
10
  var AUTH_KEYS = [
@@ -1136,4 +1136,4 @@ export {
1136
1136
  LatticeChatShellContextProvider,
1137
1137
  useLatticeChatShellContext
1138
1138
  };
1139
- //# sourceMappingURL=chunk-5CG4N4VQ.mjs.map
1139
+ //# sourceMappingURL=chunk-ZKYJP3RO.mjs.map
@@ -1 +1 @@
1
- import{k as L}from"./embed-page-chunk-UV6IYDW5.js";import"./embed-page-chunk-BD7DUF2M.js";import"./embed-page-chunk-OKZPPZMF.js";import"./embed-page-chunk-GYO2ELMI.js";import"./embed-page-chunk-3VNL5M2Q.js";import"./embed-page-chunk-TSZQWEXD.js";import"./embed-page-chunk-D7YTSCUO.js";import"./embed-page-chunk-S4XZPBRM.js";import"./embed-page-chunk-KF3HZ4TX.js";import{T as E,h as P}from"./embed-page-chunk-EB43T3BJ.js";import"./embed-page-chunk-MEY3NEJZ.js";import{a as F}from"./embed-page-chunk-YWJQVBZV.js";import"./embed-page-chunk-767LVAGR.js";import"./embed-page-chunk-A5GIM22E.js";import{k as T}from"./embed-page-chunk-US46Q3B7.js";import{a as C}from"./embed-page-chunk-QV7QAJ4N.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-AICFKU43.js";import"./embed-page-chunk-WXMPVIXV.js";import{Ja as I,La as c,W as p,_ as m,za as b}from"./embed-page-chunk-T2HKN7ZS.js";import{a as N}from"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-QOWM3LMZ.js";import"./embed-page-chunk-EUOOO2LS.js";import"./embed-page-chunk-5JDQ456X.js";import{f as u}from"./embed-page-chunk-QBTAJ2YI.js";var n=u(N());var t=u(C()),O={component_key:"workspace_assistants",data:{}},$=d=>{let i=d;if(typeof d=="string")try{i=JSON.parse(d)}catch{return{}}return i!==null&&typeof i=="object"&&!Array.isArray(i)?i:{}},W=({data:d})=>{let{assistantId:i,initialTab:R}=d??{},{get:f,put:y,del:A}=F(),e=T(),v=P(),[g,w]=(0,n.useState)(null),[B,h]=(0,n.useState)([]),[_,S]=(0,n.useState)(!1),[j,k]=(0,n.useState)(null),l=(0,n.useCallback)(()=>{v({...O,message:e("governance.detail.listCardMessage")})},[v,e]),o=(0,n.useCallback)(async()=>{S(!0),k(null);try{let s=(await f("/api/assistants")).data?.records??[];h(s),w(s.find(r=>r.id===i)??null)}catch{k(e("governance.detail.loadFailed"))}finally{S(!1)}},[f,i,e]);(0,n.useEffect)(()=>{i&&o()},[o,i]);let x=(0,n.useCallback)(async(a,s)=>{let r=$(a.graphDefinition),D;try{D=await y(`/api/assistants/${a.id}`,{name:s.name!==void 0?s.name:a.name,description:s.description!==void 0?s.description:a.description,graphDefinition:{...r,...s}})}catch(G){throw c.error(e("governance.detail.saveFailed")),G}if(!D.success)throw c.error(e("governance.detail.saveFailed")),new Error("Failed to save agent");c.success(e("common.saved")),await o()},[y,o,e]),z=(0,n.useCallback)(a=>{w(s=>s&&s.id===a.id?a:s),h(s=>s.map(r=>r.id===a.id?a:r))},[]),U=(0,n.useCallback)(async a=>{if(!(await A(`/api/assistants/${a}`)).success)throw new Error("Failed to delete agent");c.success(e("governance.detail.deleted")),l()},[A,l,e]);return i?g?(0,t.jsx)("div",{style:{height:"100%",overflow:"auto"},children:(0,t.jsx)(E,{children:(0,t.jsx)(L,{assistant:g,allAssistants:B,onBack:l,onDeleted:U,onSave:x,onAssistantUpdated:z,onAgentListInvalidated:()=>void o(),initialTab:R})},g.id)}):_?(0,t.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:(0,t.jsx)(I,{})}):j?(0,t.jsx)("div",{style:{padding:24},children:(0,t.jsx)(p,{type:"error",showIcon:!0,message:e("governance.detail.loadFailed"),"data-testid":"detail-error",action:(0,t.jsxs)(b,{children:[(0,t.jsx)(m,{size:"small",onClick:()=>void o(),children:e("common.retry")}),(0,t.jsx)(m,{size:"small",type:"primary",onClick:l,children:e("governance.detail.backToList")})]})})}):(0,t.jsx)("div",{style:{padding:24},children:(0,t.jsx)(p,{type:"warning",showIcon:!0,message:e("governance.detail.notFound"),"data-testid":"detail-not-found",action:(0,t.jsx)(m,{size:"small",type:"primary",onClick:l,children:e("governance.detail.backToList")})})}):(0,t.jsx)("div",{style:{padding:24},children:(0,t.jsx)(p,{type:"warning",showIcon:!0,message:e("governance.detail.missingId"),"data-testid":"detail-missing-id"})})};export{W as AgentDetailSideApp};
1
+ import{k as L}from"./embed-page-chunk-7CDMVSAB.js";import"./embed-page-chunk-U5A5D7IS.js";import"./embed-page-chunk-KKUDX33F.js";import"./embed-page-chunk-2XFJOQHZ.js";import"./embed-page-chunk-3VNL5M2Q.js";import"./embed-page-chunk-TSZQWEXD.js";import"./embed-page-chunk-D7YTSCUO.js";import"./embed-page-chunk-S4XZPBRM.js";import"./embed-page-chunk-IQ75BKOM.js";import{T as E,h as P}from"./embed-page-chunk-TTFIPBIV.js";import"./embed-page-chunk-JGFRDPYZ.js";import{a as F}from"./embed-page-chunk-PJJCN6GS.js";import"./embed-page-chunk-QJKFXJNR.js";import"./embed-page-chunk-A5GIM22E.js";import{k as T}from"./embed-page-chunk-EVZKWKMQ.js";import{a as C}from"./embed-page-chunk-QV7QAJ4N.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-AICFKU43.js";import"./embed-page-chunk-WXMPVIXV.js";import{Ja as I,La as c,W as p,_ as m,za as b}from"./embed-page-chunk-T2HKN7ZS.js";import{a as N}from"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-QOWM3LMZ.js";import"./embed-page-chunk-EUOOO2LS.js";import"./embed-page-chunk-5JDQ456X.js";import{f as u}from"./embed-page-chunk-QBTAJ2YI.js";var n=u(N());var t=u(C()),O={component_key:"workspace_assistants",data:{}},$=d=>{let i=d;if(typeof d=="string")try{i=JSON.parse(d)}catch{return{}}return i!==null&&typeof i=="object"&&!Array.isArray(i)?i:{}},W=({data:d})=>{let{assistantId:i,initialTab:R}=d??{},{get:f,put:y,del:A}=F(),e=T(),v=P(),[g,w]=(0,n.useState)(null),[B,h]=(0,n.useState)([]),[_,S]=(0,n.useState)(!1),[j,k]=(0,n.useState)(null),l=(0,n.useCallback)(()=>{v({...O,message:e("governance.detail.listCardMessage")})},[v,e]),o=(0,n.useCallback)(async()=>{S(!0),k(null);try{let s=(await f("/api/assistants")).data?.records??[];h(s),w(s.find(r=>r.id===i)??null)}catch{k(e("governance.detail.loadFailed"))}finally{S(!1)}},[f,i,e]);(0,n.useEffect)(()=>{i&&o()},[o,i]);let x=(0,n.useCallback)(async(a,s)=>{let r=$(a.graphDefinition),D;try{D=await y(`/api/assistants/${a.id}`,{name:s.name!==void 0?s.name:a.name,description:s.description!==void 0?s.description:a.description,graphDefinition:{...r,...s}})}catch(G){throw c.error(e("governance.detail.saveFailed")),G}if(!D.success)throw c.error(e("governance.detail.saveFailed")),new Error("Failed to save agent");c.success(e("common.saved")),await o()},[y,o,e]),z=(0,n.useCallback)(a=>{w(s=>s&&s.id===a.id?a:s),h(s=>s.map(r=>r.id===a.id?a:r))},[]),U=(0,n.useCallback)(async a=>{if(!(await A(`/api/assistants/${a}`)).success)throw new Error("Failed to delete agent");c.success(e("governance.detail.deleted")),l()},[A,l,e]);return i?g?(0,t.jsx)("div",{style:{height:"100%",overflow:"auto"},children:(0,t.jsx)(E,{children:(0,t.jsx)(L,{assistant:g,allAssistants:B,onBack:l,onDeleted:U,onSave:x,onAssistantUpdated:z,onAgentListInvalidated:()=>void o(),initialTab:R})},g.id)}):_?(0,t.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:(0,t.jsx)(I,{})}):j?(0,t.jsx)("div",{style:{padding:24},children:(0,t.jsx)(p,{type:"error",showIcon:!0,message:e("governance.detail.loadFailed"),"data-testid":"detail-error",action:(0,t.jsxs)(b,{children:[(0,t.jsx)(m,{size:"small",onClick:()=>void o(),children:e("common.retry")}),(0,t.jsx)(m,{size:"small",type:"primary",onClick:l,children:e("governance.detail.backToList")})]})})}):(0,t.jsx)("div",{style:{padding:24},children:(0,t.jsx)(p,{type:"warning",showIcon:!0,message:e("governance.detail.notFound"),"data-testid":"detail-not-found",action:(0,t.jsx)(m,{size:"small",type:"primary",onClick:l,children:e("governance.detail.backToList")})})}):(0,t.jsx)("div",{style:{padding:24},children:(0,t.jsx)(p,{type:"warning",showIcon:!0,message:e("governance.detail.missingId"),"data-testid":"detail-missing-id"})})};export{W as AgentDetailSideApp};
@@ -1 +1 @@
1
- import{a as Ie,b as Re,c as vt,d as xt,e as wt,f as Tt,g as It,h as St,i as Ft,j as Pt,k as Rt}from"./embed-page-chunk-UV6IYDW5.js";import{a as _e}from"./embed-page-chunk-BD7DUF2M.js";import"./embed-page-chunk-OKZPPZMF.js";import"./embed-page-chunk-GYO2ELMI.js";import"./embed-page-chunk-3VNL5M2Q.js";import{b as Oe,e as Ve,f as ft,g as yt,h as ht,i as Ct,l as At,m as bt}from"./embed-page-chunk-TSZQWEXD.js";import"./embed-page-chunk-D7YTSCUO.js";import{a as ct,b as dt,c as gt,d as pt,e as mt}from"./embed-page-chunk-SV2BM3WO.js";import"./embed-page-chunk-S4XZPBRM.js";import"./embed-page-chunk-KF3HZ4TX.js";import{T as kt,e as lt,h as ut,r as Ne}from"./embed-page-chunk-EB43T3BJ.js";import{i as rt}from"./embed-page-chunk-MEY3NEJZ.js";import{a as me}from"./embed-page-chunk-YWJQVBZV.js";import{o as Ze}from"./embed-page-chunk-767LVAGR.js";import{Ha as st,M as tt,Q as nt,Z as at,j as Te,ka as ot,qa as it,y as et}from"./embed-page-chunk-A5GIM22E.js";import{k as z}from"./embed-page-chunk-US46Q3B7.js";import{a as E}from"./embed-page-chunk-QV7QAJ4N.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-AICFKU43.js";import{Ka as Xe,Q as Je,g as Ye,na as Pe,za as Qe}from"./embed-page-chunk-WXMPVIXV.js";import{Da as R,Ia as V,Ka as Le,La as w,Ma as pe,Sa as $e,Za as we,_ as W,_a as We,bb as X,fa as xe,ha as je,na as Fe,ua as Be,va as Ue,xa as qe,za as He}from"./embed-page-chunk-T2HKN7ZS.js";import{a as ge}from"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-QOWM3LMZ.js";import"./embed-page-chunk-EUOOO2LS.js";import"./embed-page-chunk-5JDQ456X.js";import{f as I}from"./embed-page-chunk-QBTAJ2YI.js";var h=I(ge());var te=I(ge());var Z=I(ge());var Dt=I(ge());var se=I(E()),Mt=60,Et=72,Ge=(0,Dt.memo)(({data:i})=>{let l=Ie(i.type),f=Math.min(12+Math.sqrt(i.subAgentCount)*10,48);return(0,se.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:[(0,se.jsx)(Ve,{type:"target",position:Oe.Top,style:{left:"50%",top:"50%",transform:"translate(-50%, -50%)",background:"transparent",border:"none",width:0,height:0},isConnectable:!1}),(0,se.jsx)("div",{title:i.label,style:{width:f,height:f,borderRadius:"50%",background:Re(l.color),display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:Math.max(10,f*.4),fontWeight:600,cursor:"pointer",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},children:i.label.charAt(0).toUpperCase()}),(0,se.jsx)("div",{style:{fontSize:11,maxWidth:120,textAlign:"center",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:4},children:i.label}),(0,se.jsx)(Ve,{type:"source",position:Oe.Top,style:{left:"50%",top:"50%",transform:"translate(-50%, -50%)",background:"transparent",border:"none",width:0,height:0},isConnectable:!1})]})});Ge.displayName="AgentGraphNode";var ee=I(E()),en=({assistants:i,onNodeClick:l})=>{let[f,c,u]=ht([]),[o,e,C]=Ct([]),[r,m]=(0,Z.useState)(null),S=(0,Z.useMemo)(()=>({agent:Ge}),[]),M=(0,Z.useMemo)(()=>wt(i),[i]);(0,Z.useEffect)(()=>{let v=M.nodes.map(g=>({id:g.id})),P=M.edges.map(g=>({source:g.source,target:g.target})),D=new Map(M.nodes.map(g=>[g.id,g])),$=pt(v).force("link",gt(P).id(g=>g.id).distance(80)).force("charge",mt().strength(-220)).force("center",ct(0,0)).force("collide",dt(45)).stop();for(let g=0;g<300;g++)$.tick();let j=v.map(g=>({id:g.id,type:"agent",data:D.get(g.id),position:{x:g.x-Mt/2,y:g.y-Et/2}})),a=M.edges.map(g=>({id:`e${g.source}-${g.target}`,source:g.source,target:g.target,style:{stroke:"#1677ff",strokeWidth:2},type:"straight"}));c(j),e(a)},[M,c,e]);let H=(0,Z.useMemo)(()=>r===null?f:f.map(v=>{let P=v.id===r||o.some(D=>D.source===r&&D.target===v.id||D.target===r&&D.source===v.id);return{...v,style:{opacity:P?1:.2,transition:"opacity 0.2s ease"}}}),[f,o,r]),d=(0,Z.useMemo)(()=>r===null?o.map(v=>({...v,style:{stroke:"#1677ff",strokeWidth:1.5,opacity:.25,transition:"opacity 0.2s ease"}})):o.map(v=>{let P=v.source===r||v.target===r;return{...v,style:{stroke:"#1677ff",strokeWidth:P?2.5:1,opacity:P?1:.04,transition:"opacity 0.2s ease"}}}),[o,r]);return(0,ee.jsx)("div",{style:{width:"100%",height:"100%",background:"#fafafa",position:"relative"},children:(0,ee.jsxs)(yt,{nodes:H,edges:d,onNodesChange:u,onEdgesChange:C,onNodeMouseEnter:(v,P)=>m(P.id),onNodeMouseLeave:()=>m(null),onNodeClick:(v,P)=>l?.(String(P.id)),nodeTypes:S,fitView:!0,fitViewOptions:{padding:.25},children:[(0,ee.jsx)(At,{color:"#eee",gap:20}),(0,ee.jsx)(bt,{})]})})},Kt=i=>(0,ee.jsx)(ft,{children:(0,ee.jsx)(en,{...i})});var T=I(E()),tn=[{key:"all",labelKey:"governance.list.tab.all"},{key:"capability",labelKey:"governance.list.tab.capability"},{key:"orchestrator",labelKey:"governance.list.tab.orchestrator"},{key:"workflow",labelKey:"governance.list.tab.workflow"}],Bt=({items:i,assistants:l=[],loading:f,onItemClick:c,onOpenPlayground:u,onOpenEval:o,onCreate:e,onDelete:C})=>{let r=z(),[m,S]=(0,te.useState)("all"),[M,H]=(0,te.useState)(null),[d,v]=(0,te.useState)(null),P=(0,te.useMemo)(()=>{let a=new Set;return i.forEach(g=>g.tags.forEach(U=>a.add(U))),Array.from(a).map(g=>({value:g,label:g}))},[i]),D=(0,te.useMemo)(()=>i.filter(a=>!(m!=="all"&&a.type!==m||M&&!a.tags.includes(M)||d&&a.status!==d)),[i,m,M,d]),$=[{key:"edit",icon:it,label:r("common.edit"),onClick:a=>c(a.id)},{key:"playground",icon:et,label:r("governance.list.action.playground"),onClick:a=>u(a.id)},{key:"eval",icon:nt,label:r("governance.list.action.eval"),onClick:a=>o(a.id)}];C&&$.push({key:"delete",icon:st,label:r("common.delete"),danger:!0,onClick:a=>C(a.id)});let j=(0,te.useMemo)(()=>[{mode:"graph",icon:ot,label:r("governance.list.viewMode.graph"),render:()=>(0,T.jsx)(Kt,{assistants:l,onNodeClick:c})}],[l,c,r]);return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("span",{"data-testid":"agent-list-state","data-loading":String(f),"data-count":D.length,hidden:!0,"aria-hidden":"true"}),(0,T.jsx)(lt,{title:r("governance.list.title"),itemName:"common.item.agent",items:D,loading:f,keyExtractor:a=>a.id,tabs:tn.map(a=>({key:a.key,label:r(a.labelKey)})),activeTab:m,onTabChange:a=>S(a),headerLeft:(0,T.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[(0,T.jsx)(Ne,{value:M,onChange:H,options:P,placeholder:r("governance.list.filter.domain"),allLabel:r("governance.list.filter.allDomains")}),(0,T.jsx)(Ne,{value:d,onChange:v,options:[{value:"enabled",label:r("governance.list.status.enabled")},{value:"draft",label:r("governance.list.status.draft")},{value:"disabled",label:r("governance.list.status.disabled")}],placeholder:r("governance.list.filter.status"),allLabel:r("governance.list.filter.allStatuses")})]}),renderIcon:a=>{let g=Re(Ie(a.type).color);return(0,T.jsx)("div",{title:r("governance.list.typeIconTitle",{type:a.type}),style:{width:32,height:32,borderRadius:8,background:`${g}1A`,color:g,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:(0,T.jsx)(Te,{size:18})})},renderPrimary:a=>(0,T.jsx)("span",{"data-testid":"agent-name","data-agent-id":a.id,children:a.name}),renderSecondary:a=>a.description||void 0,renderDetails:a=>(0,T.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,T.jsxs)("div",{style:{display:"flex",gap:4,flexWrap:"wrap",alignItems:"center"},children:[a.tags.map(g=>(0,T.jsx)(we,{color:"magenta",style:{margin:0,borderRadius:10,border:"none"},children:g},g)),(0,T.jsx)(we,{color:Ie(a.type).color,style:{margin:0,borderRadius:10,border:"none"},children:a.type})]}),(0,T.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[(0,T.jsx)(je,{title:r("governance.list.statusTooltip",{status:a.status}),children:(0,T.jsx)("span",{style:{width:8,height:8,borderRadius:"50%",background:vt(a.status),display:"inline-block",cursor:"help"}})}),(0,T.jsx)("span",{style:{fontSize:12,color:"#8c8c8c"},children:a.version})]})]}),itemActions:$,actionsStyle:"icon",actionsPosition:"hover",onItemClick:a=>c(a.id),createLabel:r("governance.list.create"),onCreateClick:e,viewModeExtensions:j,emptyIcon:(0,T.jsx)(Te,{size:48,style:{opacity:.5}}),emptyTitle:r("governance.list.emptyTitle"),emptyDescription:r("governance.list.emptyDescription")})]})};var A=I(ge());var re=I(ge());var ue=I(E()),{Text:nn}=X,Lt=({onSelect:i,value:l,placeholder:f})=>{let c=z(),u=f??c("chatConfig.parentAgent.selectPlaceholder"),[o,e]=(0,re.useState)([]),[C,r]=(0,re.useState)(!1),{get:m}=me(),S=(0,re.useCallback)(async()=>{r(!0);try{let d=await m("/api/assistants");d.success&&e(d.data?.records||[])}catch(d){console.error("Failed to fetch assistants:",d)}finally{r(!1)}},[m]);return(0,re.useEffect)(()=>{S()},[S]),(0,ue.jsx)(xe,{showSearch:!0,allowClear:!0,value:l,placeholder:u,loading:C,onChange:d=>{if(!d){i(null);return}let v=o.find(P=>P.id===d);i(v||null)},onDropdownVisibleChange:d=>{d&&S()},optionFilterProp:"label",style:{width:"100%"},options:o.map(d=>({value:d.id,label:d.name||d.id,description:d.description})),optionRender:d=>(0,ue.jsxs)("div",{children:[(0,ue.jsx)("div",{children:d.label}),d.data.description&&(0,ue.jsx)(nn,{type:"secondary",style:{fontSize:12},children:d.data.description})]})})};var L=I(E()),{Text:Nt}=X,Ot=({subAgentKeys:i,decisions:l,onChange:f})=>{let{token:c}=We.useToken(),u=z(),o=(C,r)=>{let m=l.map(S=>S.originalKey===C?{...S,clone:r,cloneKey:r?`${C}_clone`:void 0}:S);f(m)},e=(C,r)=>{let m=l.map(S=>S.originalKey===C?{...S,cloneKey:r}:S);f(m)};return i.length===0?null:(0,L.jsxs)("div",{children:[(0,L.jsx)(Nt,{type:"secondary",style:{display:"block",marginBottom:8},children:u("chatConfig.subAgentInherit.hint")}),(0,L.jsx)(Le,{size:"small",bordered:!0,dataSource:l,style:{borderRadius:c.borderRadius},renderItem:C=>(0,L.jsxs)(Le.Item,{style:{display:"flex",flexDirection:"column",alignItems:"stretch",gap:8,padding:"8px 16px"},children:[(0,L.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,L.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[C.clone?(0,L.jsx)(Pe,{style:{color:c.colorPrimary}}):(0,L.jsx)(Qe,{style:{color:c.colorTextSecondary}}),(0,L.jsx)(Nt,{style:{fontFamily:"monospace"},children:C.originalKey})]}),(0,L.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,L.jsx)(we,{color:C.clone?"blue":"default",children:C.clone?u("chatConfig.subAgentInherit.clone"):u("chatConfig.subAgentInherit.reuse")}),(0,L.jsx)($e,{size:"small",checked:C.clone,onChange:r=>o(C.originalKey,r)})]})]}),C.clone&&(0,L.jsx)(V,{size:"small",placeholder:u("chatConfig.subAgentInherit.cloneKeyPlaceholder"),value:C.cloneKey,onChange:r=>e(C.originalKey,r.target.value),style:{fontFamily:"monospace",fontSize:12},addonBefore:u("chatConfig.keyValue.key")})]})})]})};function Vt(i,l){return i.mode!=="local"||i.templateKey||typeof i.executable=="string"&&i.executable.trim().length>0?null:l?l("chat.config.executableRequired"):"Choose a template or enter a custom executable"}var n=I(E()),{TextArea:_t}=V,{Text:ne}=X,Gt="/.well-known/agent-card.json",an=[{value:"http://",label:"http://"},{value:"https://",label:"https://"}],on={react:"chatConfig.createAssistant.typeDesc.react",deep_agent:"chatConfig.createAssistant.typeDesc.deepAgent",processing:"chatConfig.createAssistant.typeDesc.processing",a2a_remote:"chatConfig.createAssistant.typeDesc.a2aRemote"};function zt(i,l,f="https://"){let c=String(i??"").trim();if(!c)return"";let u=l==="http://"||l==="https://"?l:f,e=(/^https?:\/\//i.test(c)?c:`${u}${c.replace(/^\/+/,"")}`).replace(/\/+$/,"");return e.endsWith(Gt)?e:`${e}${Gt}`}function sn(i){try{return new URL(i).port||void 0}catch{return}}function rn(i){return i.some(l=>l==="--port"||l==="-p"||/^--port=/.test(l)||/^-p=/.test(l))}function jt(i,l){let f=[...i.args],c=sn(l);return c&&!rn(f)&&f.push("--port",c),{...i,args:f,...i.env?{env:{...i.env}}:{}}}var Ut=({open:i,onCancel:l,onSuccess:f,initialMode:c,initialValues:u})=>{let[o]=R.useForm(),e=z(),[C,r]=(0,A.useState)(!1),[m,S]=(0,A.useState)("learn"),[M,H]=(0,A.useState)(""),[d,v]=(0,A.useState)(null),[P,D]=(0,A.useState)([]),$=R.useWatch("type",o)||"react",j=$==="a2a_remote",[a,g]=(0,A.useState)("remote"),[U,fe]=(0,A.useState)(void 0),[le,ye]=(0,A.useState)([]),[Se,ce]=(0,A.useState)(!1),ae=(0,A.useRef)(0),[oe,ie]=(0,A.useState)(!1),[De,Y]=(0,A.useState)(!1),{get:N,post:J,put:he}=me(),Me=Ze("agent-architect"),{workspaceId:Ce,trainingProjects:Q,loading:de}=rt(),[Ee,Ae]=(0,A.useState)(null),Ke=JSON.stringify(u??null),K=Q.find(t=>t.id===Ee)??Q[0]??null,[be,ke]=(0,A.useState)([]),p=(0,A.useCallback)(()=>{v(null),D([])},[]),b=(0,A.useCallback)(()=>{o.resetFields(),p(),S("learn"),H(""),ke([]),Ae(null),g("remote"),fe(void 0),ye([]),Y(!1),ie(!1)},[o,p]);(0,A.useEffect)(()=>{if(i){b(),S(c??"learn");let t=u?.a2aMode;(t==="remote"||t==="local")&&g(t),o.setFieldsValue({type:"react",agentCardProtocol:"https://",a2aMode:"remote",timeout:3e5,...u})}},[i,o,c,Ke,b]),(0,A.useEffect)(()=>{let t=++ae.current,s=!0;return i&&j?(o.setFieldValue("prompt",""),a==="local"?(ce(!0),N("/api/local-a2a/templates").then(k=>{s&&t===ae.current&&k?.data?.records&&ye(k.data.records)}).catch(()=>{s&&t===ae.current&&ye([])}).finally(()=>{s&&t===ae.current&&ce(!1)})):ce(!1)):ce(!1),()=>{s=!1,ae.current+=1}},[o,j,a,N,i]);let x=le.find(t=>t.key===U),q=(0,A.useCallback)(()=>{let t=Vt({mode:a,templateKey:U,executable:o.getFieldValue("commandExecutable")},e);return t?(Y(!0),o.setFields([{name:"commandExecutable",errors:[t]}]),w.warning(t),!1):!0},[a,U,o,e]);(0,A.useEffect)(()=>{x&&o.setFieldsValue({agentCardProtocol:"http://"})},[o,x]);let ve=(0,A.useCallback)(async()=>{if(!q())return;let t=zt(o.getFieldValue("agentCardUrl"),o.getFieldValue("agentCardProtocol"),a==="local"?"http://":"https://");if(!t){w.warning(e("chatConfig.createAssistant.a2aUrlWarning"));return}ie(!0);try{let s={agentCardUrl:t,apiKey:o.getFieldValue("apiKey")};if(a==="local"){let y=x;if(y)s.localRuntime={label:o.getFieldValue("name")||void 0,agentCardUrl:t,command:jt(y.command,t)};else{let B=o.getFieldValue("commandArgs")||"",G=B?B.split(/\s+/).filter(Boolean):[],F=String(o.getFieldValue(["command","cwd"])||"").trim();s.localRuntime={label:o.getFieldValue("name")||void 0,agentCardUrl:t,command:{executable:String(o.getFieldValue("commandExecutable")||"").trim(),args:G,...F?{cwd:F}:{}}}}}let k=await J("/api/a2a/test-connection",s);if(k.data?.reachable){let y=k.data.agentCard;w.success(e("chatConfig.createAssistant.connectedTo",{name:k.data.agentName||t}))}else w.error(k.data?.error||e("chatConfig.createAssistant.connectionFailed"))}catch{w.error(e("chatConfig.createAssistant.connectionTestFailed"))}finally{ie(!1)}},[o,J,a,x,q,e]),$t=(0,A.useCallback)(t=>{if(v(t),!t){o.resetFields(["key","name","description","type","prompt"]),D([]);return}let s=typeof t.graphDefinition=="object"&&t.graphDefinition!==null?t.graphDefinition:{},k=s.key||t.id,y=t.name||s.name||"";o.setFieldsValue({key:`${k}_ext`,name:y?`${y} (Extended)`:"",description:t.description||s.description||"",type:s.type||"react",prompt:s.prompt||""});let B=s.subAgents||[];D(B.map(G=>({originalKey:G,clone:!1})))},[o]),Wt=async(t,s)=>{let k=await N(`/api/assistants/${t}`);if(!k.success)throw new Error(e("chatConfig.createAssistant.cloneFetchFailed",{key:t}));let y=k.data,B=typeof y.graphDefinition=="object"?y.graphDefinition:{},G={id:s,name:`${y.name} (Clone)`,description:y.description||"",graphDefinition:{...B,key:s,name:`${y.name} (Clone)`}},F=await J("/api/assistants",G);if(!F.success)throw new Error(F.message||e("chatConfig.createAssistant.cloneFailed",{key:t}));return F.data},Zt=t=>{let s={id:t.key,name:t.name,description:t.description||"",graphDefinition:{key:t.key,name:t.name,description:t.description||"",type:t.type,prompt:t.prompt||"",tools:[],skills:[],subAgents:t.type==="deep_agent"||t.type==="processing"?[]:void 0,middleware:[]}};if(t.type==="a2a_remote"&&(s.graphDefinition.agentCardUrl=zt(t.agentCardUrl,t.agentCardProtocol,(t.a2aMode||a)==="local"?"http://":"https://"),t.apiKey&&(s.graphDefinition.apiKey=t.apiKey),t.timeout&&(s.graphDefinition.timeout=t.timeout),(t.a2aMode||a)==="local")){let k=x;if(k)s.graphDefinition.localRuntime={label:t.name||void 0,agentCardUrl:s.graphDefinition.agentCardUrl,command:jt(k.command,s.graphDefinition.agentCardUrl)};else{let y=t.commandArgs||"",B=y?y.split(/\s+/).filter(Boolean):[],G=String(t.command?.cwd||"").trim();s.graphDefinition.localRuntime={label:t.name||void 0,agentCardUrl:s.graphDefinition.agentCardUrl,command:{executable:String(t.commandExecutable||"").trim(),args:B,...G?{cwd:G}:{}}}}}return s},Yt=async(t,s)=>{if(!d)throw new Error(e("chatConfig.createAssistant.noParentAgent"));let k=P.filter(F=>F.clone);for(let F of k){if(!F.cloneKey||!F.cloneKey.trim())throw new Error(e("chatConfig.createAssistant.cloneKeyRequired",{key:F.originalKey}));if(!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(F.cloneKey))throw new Error(e("chatConfig.createAssistant.cloneKeyInvalid",{key:F.cloneKey,originalKey:F.originalKey}))}let y=[];for(let F of P)if(F.clone){let Xt=await Wt(F.originalKey,F.cloneKey);s.push(Xt),y.push(F.cloneKey)}else y.push(F.originalKey);let B=typeof d.graphDefinition=="object"?d.graphDefinition:{},G={key:t.key,name:t.name,description:t.description||"",extendsAgent:d.id,type:t.type||B.type};return t.prompt&&t.prompt!==B.prompt&&(G.prompt=t.prompt),(y.length>0||B.subAgents&&B.subAgents.length>0)&&(G.subAgents=y),{id:t.key,name:t.name,description:t.description||"",graphDefinition:G}},Jt=async()=>{if(m==="learn"){let t=M.trim();if(!t){w.error(e("chatConfig.createAssistant.trainingGoalRequired"));return}if(!K){w.error(e("chatConfig.createAssistant.noTrainingProject"));return}r(!0);try{let s=`agent-${It(t+Date.now())}`,k=await J("/api/assistants",{id:s,name:s,graphDefinition:{key:s,name:s,description:"",type:"react",prompt:"To be trained",metadata:{trainingProjectId:K.id,learningPlaceholder:"true",architectureStatus:"undecided"}}});if(!k.data)throw new Error(e("chatConfig.createAssistant.agentCreateFailed"));let{roundTaskId:y}=await Ft({goal:t,targetAgentId:s,workspaceId:Ce??void 0,projectId:K.id,existingThreadId:St(Me.tenantId,s),files:be,post:J,put:he});w.success(e("chatConfig.createAssistant.agentCreated")),H(""),ke([]),S("learn"),f?.(k.data,{initialMessage:Pt({goal:t,roundTaskId:y,targetAgentId:s,targetMode:"placeholder",files:be,projectId:K.id,workspaceId:K.workspaceId??Ce??void 0}),projectId:K.id,initialMessageCustomRunConfig:{execution:{taskId:y}}}),l()}catch(s){w.error(s instanceof Error?s.message:e("chatConfig.createAssistant.agentCreateFailed"))}finally{r(!1)}return}try{if(m==="scratch"&&j&&!q())return;let t=await o.validateFields();r(!0);let s=[],k=m==="scratch"?Zt(t):await Yt(t,s),y=await J("/api/assistants",k);if(y.success){w.success(m==="extend"?e("chatConfig.createAssistant.createdByExtending",{name:d?.name??""}):e("chatConfig.createAssistant.created")),b();for(let B of s)f?.(B);f?.(y.data),l()}else w.error(y.message||e("chatConfig.createAssistant.createFailed"))}catch(t){if(t?.errorFields){let s={key:e("chatConfig.createAssistant.field.key"),name:e("chatConfig.createAssistant.field.name"),description:e("chatConfig.createAssistant.field.description"),prompt:e("chatConfig.createAssistant.field.systemPrompt")},k=t.errorFields.map(y=>s[String((y.name??[])[0])]??String((y.name??[])[0])).filter(Boolean);w.warning(k.length>0?e("chatConfig.createAssistant.requiredFields",{fields:[...new Set(k)].join(", ")}):e("chatConfig.createAssistant.requiredFieldsGeneric"));return}w.error(t.message||e("chatConfig.createAssistant.createError"))}finally{r(!1)}},ze=d?.graphDefinition?.subAgents||[],Qt=m==="extend"&&d&&ze.length>0;return(0,n.jsxs)(pe,{title:e("chatConfig.createAssistant.title"),open:i,onCancel:()=>{b(),l()},footer:[(0,n.jsx)(W,{onClick:()=>{b(),l()},children:e("common.cancel")},"cancel"),(0,n.jsx)(W,{type:"primary",icon:m==="extend"?(0,n.jsx)(Pe,{}):m==="learn"?(0,n.jsx)(Je,{}):(0,n.jsx)(Xe,{}),loading:C,disabled:m==="learn"&&(de||!K),onClick:Jt,children:e(m==="extend"?"chatConfig.createAssistant.createExtend":m==="learn"?"chatConfig.createAssistant.startLearning":"common.create")},"submit")],width:760,children:[m==="extend"&&(0,n.jsxs)("div",{style:{marginBottom:20},children:[(0,n.jsx)(ne,{type:"secondary",style:{display:"block",marginBottom:8},children:e("chatConfig.createAssistant.parentAgent")}),(0,n.jsx)(Lt,{value:d?.id,onSelect:$t}),d&&(0,n.jsx)(ne,{type:"secondary",style:{display:"block",marginTop:4,fontSize:12},children:e("chatConfig.createAssistant.inheritHint")})]}),m==="extend"&&d&&(0,n.jsx)(Be,{style:{margin:"12px 0"}}),m==="learn"&&(0,n.jsxs)("div",{children:[(0,n.jsx)(ne,{style:{display:"block",marginBottom:8},children:e("chatConfig.createAssistant.learnHint")}),(0,n.jsx)(V.TextArea,{rows:3,value:M,onChange:t=>H(t.target.value),placeholder:e("chatConfig.createAssistant.learnGoalPlaceholder")}),K&&(0,n.jsxs)("div",{style:{marginTop:12},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,marginBottom:8},children:[(0,n.jsx)(ne,{type:"secondary",children:e("chatConfig.createAssistant.referenceFiles")}),(0,n.jsx)(_e,{project:K,projects:Q,value:K?.id??null,onChange:Ae,loading:de})]}),(0,n.jsx)(Tt,{projectId:K.id,value:be,onChange:ke}),(0,n.jsx)(ne,{type:"secondary",style:{display:"block",marginTop:6,fontSize:12},children:e("chatConfig.createAssistant.referenceFilesHint")})]}),!K&&!de&&(0,n.jsx)("div",{style:{marginTop:12},children:(0,n.jsx)(_e,{project:K,projects:Q,value:null,onChange:Ae,loading:de})})]}),m!=="learn"&&(0,n.jsxs)(R,{form:o,layout:"vertical",autoComplete:"off",initialValues:{type:"react",agentCardProtocol:"https://",a2aMode:"remote"},children:[(0,n.jsx)(R.Item,{name:"key",label:e("chatConfig.createAssistant.field.key"),rules:[{required:!0,message:e("chatConfig.createAssistant.validation.keyRequired")},{pattern:/^[a-zA-Z][a-zA-Z0-9_-]*$/,message:e("chatConfig.createAssistant.validation.keyPattern")}],style:{marginBottom:16},children:(0,n.jsx)(V,{placeholder:e("chatConfig.createAssistant.keyPlaceholder")})}),(0,n.jsx)(R.Item,{name:"name",label:e("chatConfig.createAssistant.field.name"),rules:[{required:!0,message:e("chatConfig.createAssistant.validation.nameRequired")}],style:{marginBottom:16},children:(0,n.jsx)(V,{placeholder:e("chatConfig.createAssistant.namePlaceholder")})}),(0,n.jsx)(R.Item,{name:"description",label:e("chatConfig.createAssistant.field.description"),rules:[{required:!0,message:e("chatConfig.createAssistant.validation.descriptionRequired")}],style:{marginBottom:16},children:(0,n.jsx)(_t,{placeholder:e("chatConfig.createAssistant.descriptionPlaceholder"),autoSize:{minRows:2,maxRows:4}})}),(0,n.jsx)(R.Item,{name:"type",label:e("chatConfig.createAssistant.field.agentType"),rules:[{required:!0}],style:{marginBottom:16},children:(0,n.jsx)(Ue,{options:[{value:"react",label:e("chatConfig.agentType.executor")},{value:"deep_agent",label:e("chatConfig.agentType.orchestrator")},{value:"processing",label:e("chatConfig.agentType.workflow")},{value:"a2a_remote",label:e("chatConfig.agentType.a2aRemote")}],block:!0})}),(0,n.jsx)(ne,{type:"secondary",style:{fontSize:12,display:"block",marginTop:-12,marginBottom:16,lineHeight:1.5},children:e(on[$]??"chatConfig.createAssistant.typeDesc.react")}),j&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(R.Item,{label:e("chatConfig.createAssistant.field.connectionMode"),style:{marginBottom:16},children:(0,n.jsxs)(Fe.Group,{value:a,onChange:t=>{let s=t.target.value;g(s),o.setFieldValue("a2aMode",s),s==="local"&&o.setFieldValue("agentCardProtocol","http://"),fe(void 0)},optionType:"button",buttonStyle:"solid",children:[(0,n.jsx)(Fe.Button,{value:"remote",children:e("chatConfig.createAssistant.mode.remoteUrl")}),(0,n.jsx)(Fe.Button,{value:"local",children:e("chatConfig.createAssistant.mode.localManaged")})]})}),(0,n.jsx)(R.Item,{name:"a2aMode",noStyle:!0,hidden:!0,children:(0,n.jsx)(V,{})}),a==="local"&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(R.Item,{label:e("chatConfig.createAssistant.field.template"),style:{marginBottom:16},children:(0,n.jsx)(xe,{placeholder:e("chatConfig.createAssistant.templatePlaceholder"),allowClear:!0,loading:Se,value:U,onChange:t=>{fe(t),t&&Y(!1)},options:le.map(t=>({value:t.key,label:t.name||t.key})),notFoundContent:Se?void 0:(0,n.jsx)(ne,{type:"secondary",style:{padding:8,display:"block"},children:e("chatConfig.createAssistant.noTemplates")})})}),!U&&(0,n.jsx)(n.Fragment,{children:De?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(R.Item,{name:"commandExecutable",label:e("chatConfig.createAssistant.field.executable"),rules:[{required:!0,whitespace:!0,message:e("chatConfig.createAssistant.validation.executableRequired")}],style:{marginBottom:16},children:(0,n.jsx)(V,{placeholder:e("chatConfig.createAssistant.executablePlaceholder")})}),(0,n.jsx)(R.Item,{name:"commandArgs",label:e("chatConfig.createAssistant.field.arguments"),style:{marginBottom:16},children:(0,n.jsx)(V,{placeholder:e("chatConfig.createAssistant.argumentsPlaceholder")})}),(0,n.jsx)(R.Item,{name:["command","cwd"],label:e("chatConfig.createAssistant.field.workingDirectory"),style:{marginBottom:16},children:(0,n.jsx)(V,{placeholder:e("chatConfig.createAssistant.workingDirectoryPlaceholder")})}),(0,n.jsx)(W,{type:"link",onClick:()=>{Y(!1),o.setFieldsValue({commandExecutable:"",commandArgs:"",command:{cwd:void 0}})},style:{padding:0,marginBottom:16,display:"block"},children:e("chatConfig.createAssistant.hideCustomCommand")})]}):(0,n.jsx)(W,{type:"link",onClick:()=>Y(!0),style:{padding:0,marginBottom:16,display:"block"},children:e("chatConfig.createAssistant.customCommand")})})]}),(0,n.jsx)(R.Item,{label:e("chatConfig.createAssistant.field.agentCardUrl"),required:!0,style:{marginBottom:16},children:(0,n.jsxs)(He.Compact,{style:{width:"100%"},children:[(0,n.jsx)(R.Item,{name:"agentCardProtocol",noStyle:!0,children:(0,n.jsx)(xe,{style:{width:100},options:an})}),(0,n.jsx)(R.Item,{name:"agentCardUrl",noStyle:!0,rules:[{required:!0,message:e("chatConfig.createAssistant.validation.urlRequired")}],children:(0,n.jsx)(V,{placeholder:a==="local"?"localhost:4301":"host:port or full URL"})}),(0,n.jsx)(W,{icon:(0,n.jsx)(Ye,{}),onClick:ve,loading:oe,children:e("chatConfig.connection.action.test")})]})}),a==="remote"&&(0,n.jsx)(R.Item,{name:"apiKey",label:e("chatConfig.createAssistant.field.apiKeyOptional"),style:{marginBottom:16},children:(0,n.jsx)(V.Password,{placeholder:e("chatConfig.createAssistant.apiKeyPlaceholder")})}),(0,n.jsx)(R.Item,{name:"timeout",label:e("chatConfig.createAssistant.field.timeout"),style:{marginBottom:16},initialValue:3e5,children:(0,n.jsx)(qe,{min:1e3,max:36e5,style:{width:"100%"},placeholder:"300000"})})]}),!j&&(0,n.jsx)(R.Item,{name:"prompt",label:e(m==="extend"&&d?"chatConfig.createAssistant.field.systemPromptInherit":"chatConfig.createAssistant.field.systemPrompt"),rules:m==="scratch"?[{required:!0,message:e("chatConfig.createAssistant.validation.systemPromptRequired")}]:[],children:(0,n.jsx)(_t,{placeholder:e(m==="extend"&&d?"chatConfig.createAssistant.systemPromptInheritPlaceholder":"chatConfig.createAssistant.systemPromptPlaceholder"),autoSize:{minRows:4,maxRows:8},style:{fontFamily:"monospace",fontSize:13,lineHeight:1.6}})})]}),Qt&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Be,{style:{margin:"12px 0"}}),(0,n.jsx)(ne,{strong:!0,style:{display:"block",marginBottom:8},children:e("chatConfig.createAssistant.subAgents")}),(0,n.jsx)(Ot,{subAgentKeys:ze,decisions:P,onChange:D})]})]})};var O=I(E()),{Paragraph:ln,Text:qt}=X,cn=[{key:"manual",icon:Te,titleKey:"governance.creation.manual.title",descriptionKey:"governance.creation.manual.description"},{key:"external",icon:tt,titleKey:"governance.creation.external.title",descriptionKey:"governance.creation.external.description"},{key:"learn",icon:at,titleKey:"governance.creation.learn.title",descriptionKey:"governance.creation.learn.description"}],Ht=({open:i,onCancel:l,onSelectMethod:f,focusTriggerAfterClose:c=!0})=>{let u=z();return(0,O.jsx)(pe,{title:u("governance.creation.title"),open:i,onCancel:l,footer:null,width:560,centered:!0,destroyOnHidden:!0,focusTriggerAfterClose:c,children:(0,O.jsxs)("div",{style:{padding:"8px 4px 4px"},children:[(0,O.jsx)(ln,{style:{color:"#595959",fontSize:15,margin:"8px 0 24px"},children:u("governance.creation.subtitle")}),(0,O.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:12},children:cn.map(o=>{let e=o.icon,C=u(o.titleKey);return(0,O.jsxs)(W,{type:"default",onClick:()=>f(o.key),"aria-label":C,style:{display:"flex",flexDirection:"row",alignItems:"center",gap:16,width:"100%",minHeight:88,height:"auto",padding:16,borderRadius:16,textAlign:"left",whiteSpace:"normal"},children:[(0,O.jsx)("div",{style:{width:40,height:40,borderRadius:12,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:"#6366f1",background:"#eeeeff"},children:(0,O.jsx)(e,{size:19})}),(0,O.jsxs)("div",{style:{minWidth:0},children:[(0,O.jsx)(qt,{strong:!0,style:{display:"block",fontSize:15,marginBottom:3},children:C}),(0,O.jsx)(qt,{style:{color:"#737373",lineHeight:1.5},children:u(o.descriptionKey)})]})]},o.key)})}),(0,O.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,flexWrap:"wrap",marginTop:24},children:(0,O.jsx)(W,{onClick:l,children:u("governance.creation.notNow")})})]})})};var _=I(E()),dn=i=>{let l=i;if(typeof i=="string")try{l=JSON.parse(i)}catch{return{}}return l!==null&&typeof l=="object"&&!Array.isArray(l)?l:{}},ka=()=>{let{get:i,del:l,put:f}=me(),c=z(),[u,o]=(0,h.useState)([]),[e,C]=(0,h.useState)(!1),[r,m]=(0,h.useState)(null),[S,M]=(0,h.useState)("graph"),[H,d]=(0,h.useState)(null),[v,P]=(0,h.useState)(null),[D,$]=(0,h.useState)(null),[j,a]=(0,h.useState)(!1),[g,U]=(0,h.useState)(!0),[fe,le]=(0,h.useState)(!1),[ye,Se]=(0,h.useState)("learn"),[ce,ae]=(0,h.useState)({}),[oe,ie]=(0,h.useState)(null),[De,Y]=(0,h.useState)(!1),N=(0,h.useCallback)(async()=>{C(!0);try{let p=await i("/api/assistants");p.success&&p.data?.records&&o(p.data.records)}catch{w.error(c("governance.workbench.loadFailed"))}finally{C(!1)}},[i,c]);(0,h.useEffect)(()=>{N()},[N]);let J=h.default.useMemo(()=>xt(u),[u]),he=u.find(p=>p.id===r)??null,Me=(0,h.useCallback)((p,b="graph")=>{m(p),M(b),d(null),$(null)},[]),Ce=ut(),Q=(0,h.useCallback)((p,b)=>{let x=u.find(q=>q.id===p)?.name??c("governance.workbench.agentFallback");Ce({component_key:"agent_detail_side_app",data:{assistantId:p,initialTab:b},message:x})},[u,Ce,c]),de=(0,h.useCallback)(()=>{U(!0),a(!0)},[]),Ee=(0,h.useCallback)(p=>{let x={manual:{mode:"scratch",values:{}},external:{mode:"scratch",values:{type:"a2a_remote"}},learn:{mode:"learn",values:{}}}[p];Se(x.mode),ae(x.values),U(!1),a(!1),le(!0)},[]),Ae=(0,h.useCallback)(async(p,b)=>{let x=dn(p.graphDefinition),q;try{q=await f(`/api/assistants/${p.id}`,{name:b.name!==void 0?b.name:p.name,description:b.description!==void 0?b.description:p.description,graphDefinition:{...x,...b}})}catch(ve){throw w.error(c("governance.detail.saveFailed")),ve}if(!q.success)throw w.error(c("governance.detail.saveFailed")),new Error("Failed to save agent");w.success(c("common.saved")),N()},[f,N,c]),Ke=(0,h.useCallback)(p=>{o(b=>b.map(x=>x.id===p.id?p:x))},[]),K=(0,h.useCallback)(p=>{ie(p)},[]),be=(0,h.useCallback)(async()=>{if(oe){Y(!0);try{(await l(`/api/assistants/${oe}`)).success?(w.success(c("governance.detail.deleted")),o(b=>b.filter(x=>x.id!==oe)),N(),ie(null)):w.error(c("governance.detail.deleteFailed"))}catch{w.error(c("governance.detail.deleteFailed"))}finally{Y(!1)}}},[oe,l,N,c]),ke=(0,h.useCallback)(async p=>{if(!(await l(`/api/assistants/${p}`)).success)throw new Error("Failed to delete agent");w.success(c("governance.detail.deleted")),o(x=>x.filter(q=>q.id!==p)),N()},[l,N,c]);return(0,_.jsxs)("div",{style:{height:"100%",background:"#fafafa",overflow:"hidden"},children:[he?(0,_.jsx)(kt,{defaultProjectId:D??void 0,children:(0,_.jsx)(Rt,{assistant:he,allAssistants:u,onBack:()=>m(null),onDeleted:ke,onSave:Ae,onAssistantUpdated:Ke,onAgentListInvalidated:N,initialTab:S,initialMessage:H,initialMessageCustomRunConfig:v,initialProjectId:D})},he.id):(0,_.jsx)(_.Fragment,{children:(0,_.jsx)(Bt,{items:J,assistants:u,loading:e,onItemClick:p=>Q(p,"graph"),onOpenPlayground:p=>Q(p,"playground"),onOpenEval:p=>Q(p,"eval"),onCreate:de,onDelete:K})}),(0,_.jsx)(Ht,{open:j,onCancel:()=>{U(!0),a(!1)},onSelectMethod:Ee,focusTriggerAfterClose:g}),(0,_.jsx)(Ut,{open:fe,initialMode:ye,initialValues:ce,onCancel:()=>le(!1),onSuccess:(p,b)=>{le(!1),o(x=>x.some(ve=>ve.id===p.id)?x:[p,...x]),Me(p.id,"graph"),d(b?.initialMessage??null),P(b?.initialMessageCustomRunConfig??null),$(b?.projectId??null),N()}}),(0,_.jsx)(pe,{title:c("governance.deleteAgent"),open:oe!==null,onCancel:()=>ie(null),onOk:be,okText:c("common.delete"),okButtonProps:{danger:!0,loading:De},cancelText:c("common.cancel"),children:(0,_.jsx)("p",{children:c("governance.delete.irreversible")})})]})};export{ka as AgentGovernanceWorkbench};
1
+ import{a as Ie,b as Re,c as vt,d as xt,e as wt,f as Tt,g as It,h as St,i as Ft,j as Pt,k as Rt}from"./embed-page-chunk-7CDMVSAB.js";import{a as _e}from"./embed-page-chunk-U5A5D7IS.js";import"./embed-page-chunk-KKUDX33F.js";import"./embed-page-chunk-2XFJOQHZ.js";import"./embed-page-chunk-3VNL5M2Q.js";import{b as Oe,e as Ve,f as ft,g as yt,h as ht,i as Ct,l as At,m as bt}from"./embed-page-chunk-TSZQWEXD.js";import"./embed-page-chunk-D7YTSCUO.js";import{a as ct,b as dt,c as gt,d as pt,e as mt}from"./embed-page-chunk-SV2BM3WO.js";import"./embed-page-chunk-S4XZPBRM.js";import"./embed-page-chunk-IQ75BKOM.js";import{T as kt,e as lt,h as ut,r as Ne}from"./embed-page-chunk-TTFIPBIV.js";import{i as rt}from"./embed-page-chunk-JGFRDPYZ.js";import{a as me}from"./embed-page-chunk-PJJCN6GS.js";import{o as Ze}from"./embed-page-chunk-QJKFXJNR.js";import{Ha as st,M as tt,Q as nt,Z as at,j as Te,ka as ot,qa as it,y as et}from"./embed-page-chunk-A5GIM22E.js";import{k as z}from"./embed-page-chunk-EVZKWKMQ.js";import{a as E}from"./embed-page-chunk-QV7QAJ4N.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-AICFKU43.js";import{Ka as Xe,Q as Je,g as Ye,na as Pe,za as Qe}from"./embed-page-chunk-WXMPVIXV.js";import{Da as R,Ia as V,Ka as Le,La as w,Ma as pe,Sa as $e,Za as we,_ as W,_a as We,bb as X,fa as xe,ha as je,na as Fe,ua as Be,va as Ue,xa as qe,za as He}from"./embed-page-chunk-T2HKN7ZS.js";import{a as ge}from"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-QOWM3LMZ.js";import"./embed-page-chunk-EUOOO2LS.js";import"./embed-page-chunk-5JDQ456X.js";import{f as I}from"./embed-page-chunk-QBTAJ2YI.js";var h=I(ge());var te=I(ge());var Z=I(ge());var Dt=I(ge());var se=I(E()),Mt=60,Et=72,Ge=(0,Dt.memo)(({data:i})=>{let l=Ie(i.type),f=Math.min(12+Math.sqrt(i.subAgentCount)*10,48);return(0,se.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:[(0,se.jsx)(Ve,{type:"target",position:Oe.Top,style:{left:"50%",top:"50%",transform:"translate(-50%, -50%)",background:"transparent",border:"none",width:0,height:0},isConnectable:!1}),(0,se.jsx)("div",{title:i.label,style:{width:f,height:f,borderRadius:"50%",background:Re(l.color),display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:Math.max(10,f*.4),fontWeight:600,cursor:"pointer",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},children:i.label.charAt(0).toUpperCase()}),(0,se.jsx)("div",{style:{fontSize:11,maxWidth:120,textAlign:"center",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:4},children:i.label}),(0,se.jsx)(Ve,{type:"source",position:Oe.Top,style:{left:"50%",top:"50%",transform:"translate(-50%, -50%)",background:"transparent",border:"none",width:0,height:0},isConnectable:!1})]})});Ge.displayName="AgentGraphNode";var ee=I(E()),en=({assistants:i,onNodeClick:l})=>{let[f,c,u]=ht([]),[o,e,C]=Ct([]),[r,m]=(0,Z.useState)(null),S=(0,Z.useMemo)(()=>({agent:Ge}),[]),M=(0,Z.useMemo)(()=>wt(i),[i]);(0,Z.useEffect)(()=>{let v=M.nodes.map(g=>({id:g.id})),P=M.edges.map(g=>({source:g.source,target:g.target})),D=new Map(M.nodes.map(g=>[g.id,g])),$=pt(v).force("link",gt(P).id(g=>g.id).distance(80)).force("charge",mt().strength(-220)).force("center",ct(0,0)).force("collide",dt(45)).stop();for(let g=0;g<300;g++)$.tick();let j=v.map(g=>({id:g.id,type:"agent",data:D.get(g.id),position:{x:g.x-Mt/2,y:g.y-Et/2}})),a=M.edges.map(g=>({id:`e${g.source}-${g.target}`,source:g.source,target:g.target,style:{stroke:"#1677ff",strokeWidth:2},type:"straight"}));c(j),e(a)},[M,c,e]);let H=(0,Z.useMemo)(()=>r===null?f:f.map(v=>{let P=v.id===r||o.some(D=>D.source===r&&D.target===v.id||D.target===r&&D.source===v.id);return{...v,style:{opacity:P?1:.2,transition:"opacity 0.2s ease"}}}),[f,o,r]),d=(0,Z.useMemo)(()=>r===null?o.map(v=>({...v,style:{stroke:"#1677ff",strokeWidth:1.5,opacity:.25,transition:"opacity 0.2s ease"}})):o.map(v=>{let P=v.source===r||v.target===r;return{...v,style:{stroke:"#1677ff",strokeWidth:P?2.5:1,opacity:P?1:.04,transition:"opacity 0.2s ease"}}}),[o,r]);return(0,ee.jsx)("div",{style:{width:"100%",height:"100%",background:"#fafafa",position:"relative"},children:(0,ee.jsxs)(yt,{nodes:H,edges:d,onNodesChange:u,onEdgesChange:C,onNodeMouseEnter:(v,P)=>m(P.id),onNodeMouseLeave:()=>m(null),onNodeClick:(v,P)=>l?.(String(P.id)),nodeTypes:S,fitView:!0,fitViewOptions:{padding:.25},children:[(0,ee.jsx)(At,{color:"#eee",gap:20}),(0,ee.jsx)(bt,{})]})})},Kt=i=>(0,ee.jsx)(ft,{children:(0,ee.jsx)(en,{...i})});var T=I(E()),tn=[{key:"all",labelKey:"governance.list.tab.all"},{key:"capability",labelKey:"governance.list.tab.capability"},{key:"orchestrator",labelKey:"governance.list.tab.orchestrator"},{key:"workflow",labelKey:"governance.list.tab.workflow"}],Bt=({items:i,assistants:l=[],loading:f,onItemClick:c,onOpenPlayground:u,onOpenEval:o,onCreate:e,onDelete:C})=>{let r=z(),[m,S]=(0,te.useState)("all"),[M,H]=(0,te.useState)(null),[d,v]=(0,te.useState)(null),P=(0,te.useMemo)(()=>{let a=new Set;return i.forEach(g=>g.tags.forEach(U=>a.add(U))),Array.from(a).map(g=>({value:g,label:g}))},[i]),D=(0,te.useMemo)(()=>i.filter(a=>!(m!=="all"&&a.type!==m||M&&!a.tags.includes(M)||d&&a.status!==d)),[i,m,M,d]),$=[{key:"edit",icon:it,label:r("common.edit"),onClick:a=>c(a.id)},{key:"playground",icon:et,label:r("governance.list.action.playground"),onClick:a=>u(a.id)},{key:"eval",icon:nt,label:r("governance.list.action.eval"),onClick:a=>o(a.id)}];C&&$.push({key:"delete",icon:st,label:r("common.delete"),danger:!0,onClick:a=>C(a.id)});let j=(0,te.useMemo)(()=>[{mode:"graph",icon:ot,label:r("governance.list.viewMode.graph"),render:()=>(0,T.jsx)(Kt,{assistants:l,onNodeClick:c})}],[l,c,r]);return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("span",{"data-testid":"agent-list-state","data-loading":String(f),"data-count":D.length,hidden:!0,"aria-hidden":"true"}),(0,T.jsx)(lt,{title:r("governance.list.title"),itemName:"common.item.agent",items:D,loading:f,keyExtractor:a=>a.id,tabs:tn.map(a=>({key:a.key,label:r(a.labelKey)})),activeTab:m,onTabChange:a=>S(a),headerLeft:(0,T.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[(0,T.jsx)(Ne,{value:M,onChange:H,options:P,placeholder:r("governance.list.filter.domain"),allLabel:r("governance.list.filter.allDomains")}),(0,T.jsx)(Ne,{value:d,onChange:v,options:[{value:"enabled",label:r("governance.list.status.enabled")},{value:"draft",label:r("governance.list.status.draft")},{value:"disabled",label:r("governance.list.status.disabled")}],placeholder:r("governance.list.filter.status"),allLabel:r("governance.list.filter.allStatuses")})]}),renderIcon:a=>{let g=Re(Ie(a.type).color);return(0,T.jsx)("div",{title:r("governance.list.typeIconTitle",{type:a.type}),style:{width:32,height:32,borderRadius:8,background:`${g}1A`,color:g,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:(0,T.jsx)(Te,{size:18})})},renderPrimary:a=>(0,T.jsx)("span",{"data-testid":"agent-name","data-agent-id":a.id,children:a.name}),renderSecondary:a=>a.description||void 0,renderDetails:a=>(0,T.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,T.jsxs)("div",{style:{display:"flex",gap:4,flexWrap:"wrap",alignItems:"center"},children:[a.tags.map(g=>(0,T.jsx)(we,{color:"magenta",style:{margin:0,borderRadius:10,border:"none"},children:g},g)),(0,T.jsx)(we,{color:Ie(a.type).color,style:{margin:0,borderRadius:10,border:"none"},children:a.type})]}),(0,T.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[(0,T.jsx)(je,{title:r("governance.list.statusTooltip",{status:a.status}),children:(0,T.jsx)("span",{style:{width:8,height:8,borderRadius:"50%",background:vt(a.status),display:"inline-block",cursor:"help"}})}),(0,T.jsx)("span",{style:{fontSize:12,color:"#8c8c8c"},children:a.version})]})]}),itemActions:$,actionsStyle:"icon",actionsPosition:"hover",onItemClick:a=>c(a.id),createLabel:r("governance.list.create"),onCreateClick:e,viewModeExtensions:j,emptyIcon:(0,T.jsx)(Te,{size:48,style:{opacity:.5}}),emptyTitle:r("governance.list.emptyTitle"),emptyDescription:r("governance.list.emptyDescription")})]})};var A=I(ge());var re=I(ge());var ue=I(E()),{Text:nn}=X,Lt=({onSelect:i,value:l,placeholder:f})=>{let c=z(),u=f??c("chatConfig.parentAgent.selectPlaceholder"),[o,e]=(0,re.useState)([]),[C,r]=(0,re.useState)(!1),{get:m}=me(),S=(0,re.useCallback)(async()=>{r(!0);try{let d=await m("/api/assistants");d.success&&e(d.data?.records||[])}catch(d){console.error("Failed to fetch assistants:",d)}finally{r(!1)}},[m]);return(0,re.useEffect)(()=>{S()},[S]),(0,ue.jsx)(xe,{showSearch:!0,allowClear:!0,value:l,placeholder:u,loading:C,onChange:d=>{if(!d){i(null);return}let v=o.find(P=>P.id===d);i(v||null)},onDropdownVisibleChange:d=>{d&&S()},optionFilterProp:"label",style:{width:"100%"},options:o.map(d=>({value:d.id,label:d.name||d.id,description:d.description})),optionRender:d=>(0,ue.jsxs)("div",{children:[(0,ue.jsx)("div",{children:d.label}),d.data.description&&(0,ue.jsx)(nn,{type:"secondary",style:{fontSize:12},children:d.data.description})]})})};var L=I(E()),{Text:Nt}=X,Ot=({subAgentKeys:i,decisions:l,onChange:f})=>{let{token:c}=We.useToken(),u=z(),o=(C,r)=>{let m=l.map(S=>S.originalKey===C?{...S,clone:r,cloneKey:r?`${C}_clone`:void 0}:S);f(m)},e=(C,r)=>{let m=l.map(S=>S.originalKey===C?{...S,cloneKey:r}:S);f(m)};return i.length===0?null:(0,L.jsxs)("div",{children:[(0,L.jsx)(Nt,{type:"secondary",style:{display:"block",marginBottom:8},children:u("chatConfig.subAgentInherit.hint")}),(0,L.jsx)(Le,{size:"small",bordered:!0,dataSource:l,style:{borderRadius:c.borderRadius},renderItem:C=>(0,L.jsxs)(Le.Item,{style:{display:"flex",flexDirection:"column",alignItems:"stretch",gap:8,padding:"8px 16px"},children:[(0,L.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,L.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[C.clone?(0,L.jsx)(Pe,{style:{color:c.colorPrimary}}):(0,L.jsx)(Qe,{style:{color:c.colorTextSecondary}}),(0,L.jsx)(Nt,{style:{fontFamily:"monospace"},children:C.originalKey})]}),(0,L.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,L.jsx)(we,{color:C.clone?"blue":"default",children:C.clone?u("chatConfig.subAgentInherit.clone"):u("chatConfig.subAgentInherit.reuse")}),(0,L.jsx)($e,{size:"small",checked:C.clone,onChange:r=>o(C.originalKey,r)})]})]}),C.clone&&(0,L.jsx)(V,{size:"small",placeholder:u("chatConfig.subAgentInherit.cloneKeyPlaceholder"),value:C.cloneKey,onChange:r=>e(C.originalKey,r.target.value),style:{fontFamily:"monospace",fontSize:12},addonBefore:u("chatConfig.keyValue.key")})]})})]})};function Vt(i,l){return i.mode!=="local"||i.templateKey||typeof i.executable=="string"&&i.executable.trim().length>0?null:l?l("chat.config.executableRequired"):"Choose a template or enter a custom executable"}var n=I(E()),{TextArea:_t}=V,{Text:ne}=X,Gt="/.well-known/agent-card.json",an=[{value:"http://",label:"http://"},{value:"https://",label:"https://"}],on={react:"chatConfig.createAssistant.typeDesc.react",deep_agent:"chatConfig.createAssistant.typeDesc.deepAgent",processing:"chatConfig.createAssistant.typeDesc.processing",a2a_remote:"chatConfig.createAssistant.typeDesc.a2aRemote"};function zt(i,l,f="https://"){let c=String(i??"").trim();if(!c)return"";let u=l==="http://"||l==="https://"?l:f,e=(/^https?:\/\//i.test(c)?c:`${u}${c.replace(/^\/+/,"")}`).replace(/\/+$/,"");return e.endsWith(Gt)?e:`${e}${Gt}`}function sn(i){try{return new URL(i).port||void 0}catch{return}}function rn(i){return i.some(l=>l==="--port"||l==="-p"||/^--port=/.test(l)||/^-p=/.test(l))}function jt(i,l){let f=[...i.args],c=sn(l);return c&&!rn(f)&&f.push("--port",c),{...i,args:f,...i.env?{env:{...i.env}}:{}}}var Ut=({open:i,onCancel:l,onSuccess:f,initialMode:c,initialValues:u})=>{let[o]=R.useForm(),e=z(),[C,r]=(0,A.useState)(!1),[m,S]=(0,A.useState)("learn"),[M,H]=(0,A.useState)(""),[d,v]=(0,A.useState)(null),[P,D]=(0,A.useState)([]),$=R.useWatch("type",o)||"react",j=$==="a2a_remote",[a,g]=(0,A.useState)("remote"),[U,fe]=(0,A.useState)(void 0),[le,ye]=(0,A.useState)([]),[Se,ce]=(0,A.useState)(!1),ae=(0,A.useRef)(0),[oe,ie]=(0,A.useState)(!1),[De,Y]=(0,A.useState)(!1),{get:N,post:J,put:he}=me(),Me=Ze("agent-architect"),{workspaceId:Ce,trainingProjects:Q,loading:de}=rt(),[Ee,Ae]=(0,A.useState)(null),Ke=JSON.stringify(u??null),K=Q.find(t=>t.id===Ee)??Q[0]??null,[be,ke]=(0,A.useState)([]),p=(0,A.useCallback)(()=>{v(null),D([])},[]),b=(0,A.useCallback)(()=>{o.resetFields(),p(),S("learn"),H(""),ke([]),Ae(null),g("remote"),fe(void 0),ye([]),Y(!1),ie(!1)},[o,p]);(0,A.useEffect)(()=>{if(i){b(),S(c??"learn");let t=u?.a2aMode;(t==="remote"||t==="local")&&g(t),o.setFieldsValue({type:"react",agentCardProtocol:"https://",a2aMode:"remote",timeout:3e5,...u})}},[i,o,c,Ke,b]),(0,A.useEffect)(()=>{let t=++ae.current,s=!0;return i&&j?(o.setFieldValue("prompt",""),a==="local"?(ce(!0),N("/api/local-a2a/templates").then(k=>{s&&t===ae.current&&k?.data?.records&&ye(k.data.records)}).catch(()=>{s&&t===ae.current&&ye([])}).finally(()=>{s&&t===ae.current&&ce(!1)})):ce(!1)):ce(!1),()=>{s=!1,ae.current+=1}},[o,j,a,N,i]);let x=le.find(t=>t.key===U),q=(0,A.useCallback)(()=>{let t=Vt({mode:a,templateKey:U,executable:o.getFieldValue("commandExecutable")},e);return t?(Y(!0),o.setFields([{name:"commandExecutable",errors:[t]}]),w.warning(t),!1):!0},[a,U,o,e]);(0,A.useEffect)(()=>{x&&o.setFieldsValue({agentCardProtocol:"http://"})},[o,x]);let ve=(0,A.useCallback)(async()=>{if(!q())return;let t=zt(o.getFieldValue("agentCardUrl"),o.getFieldValue("agentCardProtocol"),a==="local"?"http://":"https://");if(!t){w.warning(e("chatConfig.createAssistant.a2aUrlWarning"));return}ie(!0);try{let s={agentCardUrl:t,apiKey:o.getFieldValue("apiKey")};if(a==="local"){let y=x;if(y)s.localRuntime={label:o.getFieldValue("name")||void 0,agentCardUrl:t,command:jt(y.command,t)};else{let B=o.getFieldValue("commandArgs")||"",G=B?B.split(/\s+/).filter(Boolean):[],F=String(o.getFieldValue(["command","cwd"])||"").trim();s.localRuntime={label:o.getFieldValue("name")||void 0,agentCardUrl:t,command:{executable:String(o.getFieldValue("commandExecutable")||"").trim(),args:G,...F?{cwd:F}:{}}}}}let k=await J("/api/a2a/test-connection",s);if(k.data?.reachable){let y=k.data.agentCard;w.success(e("chatConfig.createAssistant.connectedTo",{name:k.data.agentName||t}))}else w.error(k.data?.error||e("chatConfig.createAssistant.connectionFailed"))}catch{w.error(e("chatConfig.createAssistant.connectionTestFailed"))}finally{ie(!1)}},[o,J,a,x,q,e]),$t=(0,A.useCallback)(t=>{if(v(t),!t){o.resetFields(["key","name","description","type","prompt"]),D([]);return}let s=typeof t.graphDefinition=="object"&&t.graphDefinition!==null?t.graphDefinition:{},k=s.key||t.id,y=t.name||s.name||"";o.setFieldsValue({key:`${k}_ext`,name:y?`${y} (Extended)`:"",description:t.description||s.description||"",type:s.type||"react",prompt:s.prompt||""});let B=s.subAgents||[];D(B.map(G=>({originalKey:G,clone:!1})))},[o]),Wt=async(t,s)=>{let k=await N(`/api/assistants/${t}`);if(!k.success)throw new Error(e("chatConfig.createAssistant.cloneFetchFailed",{key:t}));let y=k.data,B=typeof y.graphDefinition=="object"?y.graphDefinition:{},G={id:s,name:`${y.name} (Clone)`,description:y.description||"",graphDefinition:{...B,key:s,name:`${y.name} (Clone)`}},F=await J("/api/assistants",G);if(!F.success)throw new Error(F.message||e("chatConfig.createAssistant.cloneFailed",{key:t}));return F.data},Zt=t=>{let s={id:t.key,name:t.name,description:t.description||"",graphDefinition:{key:t.key,name:t.name,description:t.description||"",type:t.type,prompt:t.prompt||"",tools:[],skills:[],subAgents:t.type==="deep_agent"||t.type==="processing"?[]:void 0,middleware:[]}};if(t.type==="a2a_remote"&&(s.graphDefinition.agentCardUrl=zt(t.agentCardUrl,t.agentCardProtocol,(t.a2aMode||a)==="local"?"http://":"https://"),t.apiKey&&(s.graphDefinition.apiKey=t.apiKey),t.timeout&&(s.graphDefinition.timeout=t.timeout),(t.a2aMode||a)==="local")){let k=x;if(k)s.graphDefinition.localRuntime={label:t.name||void 0,agentCardUrl:s.graphDefinition.agentCardUrl,command:jt(k.command,s.graphDefinition.agentCardUrl)};else{let y=t.commandArgs||"",B=y?y.split(/\s+/).filter(Boolean):[],G=String(t.command?.cwd||"").trim();s.graphDefinition.localRuntime={label:t.name||void 0,agentCardUrl:s.graphDefinition.agentCardUrl,command:{executable:String(t.commandExecutable||"").trim(),args:B,...G?{cwd:G}:{}}}}}return s},Yt=async(t,s)=>{if(!d)throw new Error(e("chatConfig.createAssistant.noParentAgent"));let k=P.filter(F=>F.clone);for(let F of k){if(!F.cloneKey||!F.cloneKey.trim())throw new Error(e("chatConfig.createAssistant.cloneKeyRequired",{key:F.originalKey}));if(!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(F.cloneKey))throw new Error(e("chatConfig.createAssistant.cloneKeyInvalid",{key:F.cloneKey,originalKey:F.originalKey}))}let y=[];for(let F of P)if(F.clone){let Xt=await Wt(F.originalKey,F.cloneKey);s.push(Xt),y.push(F.cloneKey)}else y.push(F.originalKey);let B=typeof d.graphDefinition=="object"?d.graphDefinition:{},G={key:t.key,name:t.name,description:t.description||"",extendsAgent:d.id,type:t.type||B.type};return t.prompt&&t.prompt!==B.prompt&&(G.prompt=t.prompt),(y.length>0||B.subAgents&&B.subAgents.length>0)&&(G.subAgents=y),{id:t.key,name:t.name,description:t.description||"",graphDefinition:G}},Jt=async()=>{if(m==="learn"){let t=M.trim();if(!t){w.error(e("chatConfig.createAssistant.trainingGoalRequired"));return}if(!K){w.error(e("chatConfig.createAssistant.noTrainingProject"));return}r(!0);try{let s=`agent-${It(t+Date.now())}`,k=await J("/api/assistants",{id:s,name:s,graphDefinition:{key:s,name:s,description:"",type:"react",prompt:"To be trained",metadata:{trainingProjectId:K.id,learningPlaceholder:"true",architectureStatus:"undecided"}}});if(!k.data)throw new Error(e("chatConfig.createAssistant.agentCreateFailed"));let{roundTaskId:y}=await Ft({goal:t,targetAgentId:s,workspaceId:Ce??void 0,projectId:K.id,existingThreadId:St(Me.tenantId,s),files:be,post:J,put:he});w.success(e("chatConfig.createAssistant.agentCreated")),H(""),ke([]),S("learn"),f?.(k.data,{initialMessage:Pt({goal:t,roundTaskId:y,targetAgentId:s,targetMode:"placeholder",files:be,projectId:K.id,workspaceId:K.workspaceId??Ce??void 0}),projectId:K.id,initialMessageCustomRunConfig:{execution:{taskId:y}}}),l()}catch(s){w.error(s instanceof Error?s.message:e("chatConfig.createAssistant.agentCreateFailed"))}finally{r(!1)}return}try{if(m==="scratch"&&j&&!q())return;let t=await o.validateFields();r(!0);let s=[],k=m==="scratch"?Zt(t):await Yt(t,s),y=await J("/api/assistants",k);if(y.success){w.success(m==="extend"?e("chatConfig.createAssistant.createdByExtending",{name:d?.name??""}):e("chatConfig.createAssistant.created")),b();for(let B of s)f?.(B);f?.(y.data),l()}else w.error(y.message||e("chatConfig.createAssistant.createFailed"))}catch(t){if(t?.errorFields){let s={key:e("chatConfig.createAssistant.field.key"),name:e("chatConfig.createAssistant.field.name"),description:e("chatConfig.createAssistant.field.description"),prompt:e("chatConfig.createAssistant.field.systemPrompt")},k=t.errorFields.map(y=>s[String((y.name??[])[0])]??String((y.name??[])[0])).filter(Boolean);w.warning(k.length>0?e("chatConfig.createAssistant.requiredFields",{fields:[...new Set(k)].join(", ")}):e("chatConfig.createAssistant.requiredFieldsGeneric"));return}w.error(t.message||e("chatConfig.createAssistant.createError"))}finally{r(!1)}},ze=d?.graphDefinition?.subAgents||[],Qt=m==="extend"&&d&&ze.length>0;return(0,n.jsxs)(pe,{title:e("chatConfig.createAssistant.title"),open:i,onCancel:()=>{b(),l()},footer:[(0,n.jsx)(W,{onClick:()=>{b(),l()},children:e("common.cancel")},"cancel"),(0,n.jsx)(W,{type:"primary",icon:m==="extend"?(0,n.jsx)(Pe,{}):m==="learn"?(0,n.jsx)(Je,{}):(0,n.jsx)(Xe,{}),loading:C,disabled:m==="learn"&&(de||!K),onClick:Jt,children:e(m==="extend"?"chatConfig.createAssistant.createExtend":m==="learn"?"chatConfig.createAssistant.startLearning":"common.create")},"submit")],width:760,children:[m==="extend"&&(0,n.jsxs)("div",{style:{marginBottom:20},children:[(0,n.jsx)(ne,{type:"secondary",style:{display:"block",marginBottom:8},children:e("chatConfig.createAssistant.parentAgent")}),(0,n.jsx)(Lt,{value:d?.id,onSelect:$t}),d&&(0,n.jsx)(ne,{type:"secondary",style:{display:"block",marginTop:4,fontSize:12},children:e("chatConfig.createAssistant.inheritHint")})]}),m==="extend"&&d&&(0,n.jsx)(Be,{style:{margin:"12px 0"}}),m==="learn"&&(0,n.jsxs)("div",{children:[(0,n.jsx)(ne,{style:{display:"block",marginBottom:8},children:e("chatConfig.createAssistant.learnHint")}),(0,n.jsx)(V.TextArea,{rows:3,value:M,onChange:t=>H(t.target.value),placeholder:e("chatConfig.createAssistant.learnGoalPlaceholder")}),K&&(0,n.jsxs)("div",{style:{marginTop:12},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,marginBottom:8},children:[(0,n.jsx)(ne,{type:"secondary",children:e("chatConfig.createAssistant.referenceFiles")}),(0,n.jsx)(_e,{project:K,projects:Q,value:K?.id??null,onChange:Ae,loading:de})]}),(0,n.jsx)(Tt,{projectId:K.id,value:be,onChange:ke}),(0,n.jsx)(ne,{type:"secondary",style:{display:"block",marginTop:6,fontSize:12},children:e("chatConfig.createAssistant.referenceFilesHint")})]}),!K&&!de&&(0,n.jsx)("div",{style:{marginTop:12},children:(0,n.jsx)(_e,{project:K,projects:Q,value:null,onChange:Ae,loading:de})})]}),m!=="learn"&&(0,n.jsxs)(R,{form:o,layout:"vertical",autoComplete:"off",initialValues:{type:"react",agentCardProtocol:"https://",a2aMode:"remote"},children:[(0,n.jsx)(R.Item,{name:"key",label:e("chatConfig.createAssistant.field.key"),rules:[{required:!0,message:e("chatConfig.createAssistant.validation.keyRequired")},{pattern:/^[a-zA-Z][a-zA-Z0-9_-]*$/,message:e("chatConfig.createAssistant.validation.keyPattern")}],style:{marginBottom:16},children:(0,n.jsx)(V,{placeholder:e("chatConfig.createAssistant.keyPlaceholder")})}),(0,n.jsx)(R.Item,{name:"name",label:e("chatConfig.createAssistant.field.name"),rules:[{required:!0,message:e("chatConfig.createAssistant.validation.nameRequired")}],style:{marginBottom:16},children:(0,n.jsx)(V,{placeholder:e("chatConfig.createAssistant.namePlaceholder")})}),(0,n.jsx)(R.Item,{name:"description",label:e("chatConfig.createAssistant.field.description"),rules:[{required:!0,message:e("chatConfig.createAssistant.validation.descriptionRequired")}],style:{marginBottom:16},children:(0,n.jsx)(_t,{placeholder:e("chatConfig.createAssistant.descriptionPlaceholder"),autoSize:{minRows:2,maxRows:4}})}),(0,n.jsx)(R.Item,{name:"type",label:e("chatConfig.createAssistant.field.agentType"),rules:[{required:!0}],style:{marginBottom:16},children:(0,n.jsx)(Ue,{options:[{value:"react",label:e("chatConfig.agentType.executor")},{value:"deep_agent",label:e("chatConfig.agentType.orchestrator")},{value:"processing",label:e("chatConfig.agentType.workflow")},{value:"a2a_remote",label:e("chatConfig.agentType.a2aRemote")}],block:!0})}),(0,n.jsx)(ne,{type:"secondary",style:{fontSize:12,display:"block",marginTop:-12,marginBottom:16,lineHeight:1.5},children:e(on[$]??"chatConfig.createAssistant.typeDesc.react")}),j&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(R.Item,{label:e("chatConfig.createAssistant.field.connectionMode"),style:{marginBottom:16},children:(0,n.jsxs)(Fe.Group,{value:a,onChange:t=>{let s=t.target.value;g(s),o.setFieldValue("a2aMode",s),s==="local"&&o.setFieldValue("agentCardProtocol","http://"),fe(void 0)},optionType:"button",buttonStyle:"solid",children:[(0,n.jsx)(Fe.Button,{value:"remote",children:e("chatConfig.createAssistant.mode.remoteUrl")}),(0,n.jsx)(Fe.Button,{value:"local",children:e("chatConfig.createAssistant.mode.localManaged")})]})}),(0,n.jsx)(R.Item,{name:"a2aMode",noStyle:!0,hidden:!0,children:(0,n.jsx)(V,{})}),a==="local"&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(R.Item,{label:e("chatConfig.createAssistant.field.template"),style:{marginBottom:16},children:(0,n.jsx)(xe,{placeholder:e("chatConfig.createAssistant.templatePlaceholder"),allowClear:!0,loading:Se,value:U,onChange:t=>{fe(t),t&&Y(!1)},options:le.map(t=>({value:t.key,label:t.name||t.key})),notFoundContent:Se?void 0:(0,n.jsx)(ne,{type:"secondary",style:{padding:8,display:"block"},children:e("chatConfig.createAssistant.noTemplates")})})}),!U&&(0,n.jsx)(n.Fragment,{children:De?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(R.Item,{name:"commandExecutable",label:e("chatConfig.createAssistant.field.executable"),rules:[{required:!0,whitespace:!0,message:e("chatConfig.createAssistant.validation.executableRequired")}],style:{marginBottom:16},children:(0,n.jsx)(V,{placeholder:e("chatConfig.createAssistant.executablePlaceholder")})}),(0,n.jsx)(R.Item,{name:"commandArgs",label:e("chatConfig.createAssistant.field.arguments"),style:{marginBottom:16},children:(0,n.jsx)(V,{placeholder:e("chatConfig.createAssistant.argumentsPlaceholder")})}),(0,n.jsx)(R.Item,{name:["command","cwd"],label:e("chatConfig.createAssistant.field.workingDirectory"),style:{marginBottom:16},children:(0,n.jsx)(V,{placeholder:e("chatConfig.createAssistant.workingDirectoryPlaceholder")})}),(0,n.jsx)(W,{type:"link",onClick:()=>{Y(!1),o.setFieldsValue({commandExecutable:"",commandArgs:"",command:{cwd:void 0}})},style:{padding:0,marginBottom:16,display:"block"},children:e("chatConfig.createAssistant.hideCustomCommand")})]}):(0,n.jsx)(W,{type:"link",onClick:()=>Y(!0),style:{padding:0,marginBottom:16,display:"block"},children:e("chatConfig.createAssistant.customCommand")})})]}),(0,n.jsx)(R.Item,{label:e("chatConfig.createAssistant.field.agentCardUrl"),required:!0,style:{marginBottom:16},children:(0,n.jsxs)(He.Compact,{style:{width:"100%"},children:[(0,n.jsx)(R.Item,{name:"agentCardProtocol",noStyle:!0,children:(0,n.jsx)(xe,{style:{width:100},options:an})}),(0,n.jsx)(R.Item,{name:"agentCardUrl",noStyle:!0,rules:[{required:!0,message:e("chatConfig.createAssistant.validation.urlRequired")}],children:(0,n.jsx)(V,{placeholder:a==="local"?"localhost:4301":"host:port or full URL"})}),(0,n.jsx)(W,{icon:(0,n.jsx)(Ye,{}),onClick:ve,loading:oe,children:e("chatConfig.connection.action.test")})]})}),a==="remote"&&(0,n.jsx)(R.Item,{name:"apiKey",label:e("chatConfig.createAssistant.field.apiKeyOptional"),style:{marginBottom:16},children:(0,n.jsx)(V.Password,{placeholder:e("chatConfig.createAssistant.apiKeyPlaceholder")})}),(0,n.jsx)(R.Item,{name:"timeout",label:e("chatConfig.createAssistant.field.timeout"),style:{marginBottom:16},initialValue:3e5,children:(0,n.jsx)(qe,{min:1e3,max:36e5,style:{width:"100%"},placeholder:"300000"})})]}),!j&&(0,n.jsx)(R.Item,{name:"prompt",label:e(m==="extend"&&d?"chatConfig.createAssistant.field.systemPromptInherit":"chatConfig.createAssistant.field.systemPrompt"),rules:m==="scratch"?[{required:!0,message:e("chatConfig.createAssistant.validation.systemPromptRequired")}]:[],children:(0,n.jsx)(_t,{placeholder:e(m==="extend"&&d?"chatConfig.createAssistant.systemPromptInheritPlaceholder":"chatConfig.createAssistant.systemPromptPlaceholder"),autoSize:{minRows:4,maxRows:8},style:{fontFamily:"monospace",fontSize:13,lineHeight:1.6}})})]}),Qt&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Be,{style:{margin:"12px 0"}}),(0,n.jsx)(ne,{strong:!0,style:{display:"block",marginBottom:8},children:e("chatConfig.createAssistant.subAgents")}),(0,n.jsx)(Ot,{subAgentKeys:ze,decisions:P,onChange:D})]})]})};var O=I(E()),{Paragraph:ln,Text:qt}=X,cn=[{key:"manual",icon:Te,titleKey:"governance.creation.manual.title",descriptionKey:"governance.creation.manual.description"},{key:"external",icon:tt,titleKey:"governance.creation.external.title",descriptionKey:"governance.creation.external.description"},{key:"learn",icon:at,titleKey:"governance.creation.learn.title",descriptionKey:"governance.creation.learn.description"}],Ht=({open:i,onCancel:l,onSelectMethod:f,focusTriggerAfterClose:c=!0})=>{let u=z();return(0,O.jsx)(pe,{title:u("governance.creation.title"),open:i,onCancel:l,footer:null,width:560,centered:!0,destroyOnHidden:!0,focusTriggerAfterClose:c,children:(0,O.jsxs)("div",{style:{padding:"8px 4px 4px"},children:[(0,O.jsx)(ln,{style:{color:"#595959",fontSize:15,margin:"8px 0 24px"},children:u("governance.creation.subtitle")}),(0,O.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:12},children:cn.map(o=>{let e=o.icon,C=u(o.titleKey);return(0,O.jsxs)(W,{type:"default",onClick:()=>f(o.key),"aria-label":C,style:{display:"flex",flexDirection:"row",alignItems:"center",gap:16,width:"100%",minHeight:88,height:"auto",padding:16,borderRadius:16,textAlign:"left",whiteSpace:"normal"},children:[(0,O.jsx)("div",{style:{width:40,height:40,borderRadius:12,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:"#6366f1",background:"#eeeeff"},children:(0,O.jsx)(e,{size:19})}),(0,O.jsxs)("div",{style:{minWidth:0},children:[(0,O.jsx)(qt,{strong:!0,style:{display:"block",fontSize:15,marginBottom:3},children:C}),(0,O.jsx)(qt,{style:{color:"#737373",lineHeight:1.5},children:u(o.descriptionKey)})]})]},o.key)})}),(0,O.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,flexWrap:"wrap",marginTop:24},children:(0,O.jsx)(W,{onClick:l,children:u("governance.creation.notNow")})})]})})};var _=I(E()),dn=i=>{let l=i;if(typeof i=="string")try{l=JSON.parse(i)}catch{return{}}return l!==null&&typeof l=="object"&&!Array.isArray(l)?l:{}},ka=()=>{let{get:i,del:l,put:f}=me(),c=z(),[u,o]=(0,h.useState)([]),[e,C]=(0,h.useState)(!1),[r,m]=(0,h.useState)(null),[S,M]=(0,h.useState)("graph"),[H,d]=(0,h.useState)(null),[v,P]=(0,h.useState)(null),[D,$]=(0,h.useState)(null),[j,a]=(0,h.useState)(!1),[g,U]=(0,h.useState)(!0),[fe,le]=(0,h.useState)(!1),[ye,Se]=(0,h.useState)("learn"),[ce,ae]=(0,h.useState)({}),[oe,ie]=(0,h.useState)(null),[De,Y]=(0,h.useState)(!1),N=(0,h.useCallback)(async()=>{C(!0);try{let p=await i("/api/assistants");p.success&&p.data?.records&&o(p.data.records)}catch{w.error(c("governance.workbench.loadFailed"))}finally{C(!1)}},[i,c]);(0,h.useEffect)(()=>{N()},[N]);let J=h.default.useMemo(()=>xt(u),[u]),he=u.find(p=>p.id===r)??null,Me=(0,h.useCallback)((p,b="graph")=>{m(p),M(b),d(null),$(null)},[]),Ce=ut(),Q=(0,h.useCallback)((p,b)=>{let x=u.find(q=>q.id===p)?.name??c("governance.workbench.agentFallback");Ce({component_key:"agent_detail_side_app",data:{assistantId:p,initialTab:b},message:x})},[u,Ce,c]),de=(0,h.useCallback)(()=>{U(!0),a(!0)},[]),Ee=(0,h.useCallback)(p=>{let x={manual:{mode:"scratch",values:{}},external:{mode:"scratch",values:{type:"a2a_remote"}},learn:{mode:"learn",values:{}}}[p];Se(x.mode),ae(x.values),U(!1),a(!1),le(!0)},[]),Ae=(0,h.useCallback)(async(p,b)=>{let x=dn(p.graphDefinition),q;try{q=await f(`/api/assistants/${p.id}`,{name:b.name!==void 0?b.name:p.name,description:b.description!==void 0?b.description:p.description,graphDefinition:{...x,...b}})}catch(ve){throw w.error(c("governance.detail.saveFailed")),ve}if(!q.success)throw w.error(c("governance.detail.saveFailed")),new Error("Failed to save agent");w.success(c("common.saved")),N()},[f,N,c]),Ke=(0,h.useCallback)(p=>{o(b=>b.map(x=>x.id===p.id?p:x))},[]),K=(0,h.useCallback)(p=>{ie(p)},[]),be=(0,h.useCallback)(async()=>{if(oe){Y(!0);try{(await l(`/api/assistants/${oe}`)).success?(w.success(c("governance.detail.deleted")),o(b=>b.filter(x=>x.id!==oe)),N(),ie(null)):w.error(c("governance.detail.deleteFailed"))}catch{w.error(c("governance.detail.deleteFailed"))}finally{Y(!1)}}},[oe,l,N,c]),ke=(0,h.useCallback)(async p=>{if(!(await l(`/api/assistants/${p}`)).success)throw new Error("Failed to delete agent");w.success(c("governance.detail.deleted")),o(x=>x.filter(q=>q.id!==p)),N()},[l,N,c]);return(0,_.jsxs)("div",{style:{height:"100%",background:"#fafafa",overflow:"hidden"},children:[he?(0,_.jsx)(kt,{defaultProjectId:D??void 0,children:(0,_.jsx)(Rt,{assistant:he,allAssistants:u,onBack:()=>m(null),onDeleted:ke,onSave:Ae,onAssistantUpdated:Ke,onAgentListInvalidated:N,initialTab:S,initialMessage:H,initialMessageCustomRunConfig:v,initialProjectId:D})},he.id):(0,_.jsx)(_.Fragment,{children:(0,_.jsx)(Bt,{items:J,assistants:u,loading:e,onItemClick:p=>Q(p,"graph"),onOpenPlayground:p=>Q(p,"playground"),onOpenEval:p=>Q(p,"eval"),onCreate:de,onDelete:K})}),(0,_.jsx)(Ht,{open:j,onCancel:()=>{U(!0),a(!1)},onSelectMethod:Ee,focusTriggerAfterClose:g}),(0,_.jsx)(Ut,{open:fe,initialMode:ye,initialValues:ce,onCancel:()=>le(!1),onSuccess:(p,b)=>{le(!1),o(x=>x.some(ve=>ve.id===p.id)?x:[p,...x]),Me(p.id,"graph"),d(b?.initialMessage??null),P(b?.initialMessageCustomRunConfig??null),$(b?.projectId??null),N()}}),(0,_.jsx)(pe,{title:c("governance.deleteAgent"),open:oe!==null,onCancel:()=>ie(null),onOk:be,okText:c("common.delete"),okButtonProps:{danger:!0,loading:De},cancelText:c("common.cancel"),children:(0,_.jsx)("p",{children:c("governance.delete.irreversible")})})]})};export{ka as AgentGovernanceWorkbench};