@solidxai/core-ui 0.1.20 → 0.1.21-beta.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 (180) hide show
  1. package/dist/components/common/FileReaderExt.d.ts.map +1 -1
  2. package/dist/components/common/FileReaderExt.js +22 -11
  3. package/dist/components/common/FileReaderExt.js.map +1 -1
  4. package/dist/components/common/FileReaderExt.tsx +27 -14
  5. package/dist/components/common/SocialMediaLogin.d.ts.map +1 -1
  6. package/dist/components/common/SocialMediaLogin.js +1 -1
  7. package/dist/components/common/SocialMediaLogin.js.map +1 -1
  8. package/dist/components/common/SocialMediaLogin.tsx +50 -19
  9. package/dist/components/common/solid-export.css +75 -0
  10. package/dist/components/core/common/SolidGenericImport/SolidImport.module.css +71 -0
  11. package/dist/components/core/form/SolidFormView.d.ts.map +1 -1
  12. package/dist/components/core/form/SolidFormView.js +14 -0
  13. package/dist/components/core/form/SolidFormView.js.map +1 -1
  14. package/dist/components/core/form/SolidFormView.tsx +13 -0
  15. package/dist/components/core/form/fields/SolidMediaMultipleField.js +3 -3
  16. package/dist/components/core/form/fields/SolidMediaMultipleField.js.map +1 -1
  17. package/dist/components/core/form/fields/SolidMediaMultipleField.tsx +3 -3
  18. package/dist/components/core/form/fields/SolidMediaSingleField.js +2 -2
  19. package/dist/components/core/form/fields/SolidMediaSingleField.js.map +1 -1
  20. package/dist/components/core/form/fields/SolidMediaSingleField.tsx +2 -2
  21. package/dist/components/core/list/columns/SolidMediaMultipleColumn.js +2 -2
  22. package/dist/components/core/list/columns/SolidMediaMultipleColumn.js.map +1 -1
  23. package/dist/components/core/list/columns/SolidMediaMultipleColumn.tsx +4 -4
  24. package/dist/components/core/list/columns/SolidMediaSingleColumn.js +1 -1
  25. package/dist/components/core/list/columns/SolidMediaSingleColumn.js.map +1 -1
  26. package/dist/components/core/list/columns/SolidMediaSingleColumn.tsx +3 -3
  27. package/dist/components/core/solid-agent/SolidAgentChat.d.ts +3 -1
  28. package/dist/components/core/solid-agent/SolidAgentChat.d.ts.map +1 -1
  29. package/dist/components/core/solid-agent/SolidAgentChat.js +150 -22
  30. package/dist/components/core/solid-agent/SolidAgentChat.js.map +1 -1
  31. package/dist/components/core/solid-agent/SolidAgentChat.tsx +76 -15
  32. package/dist/components/core/solid-agent/SolidAgentEmbedded.d.ts +2 -0
  33. package/dist/components/core/solid-agent/SolidAgentEmbedded.d.ts.map +1 -1
  34. package/dist/components/core/solid-agent/SolidAgentEmbedded.js +4 -4
  35. package/dist/components/core/solid-agent/SolidAgentEmbedded.js.map +1 -1
  36. package/dist/components/core/solid-agent/SolidAgentEmbedded.tsx +7 -1
  37. package/dist/components/core/solid-agent/SolidAgentHost.d.ts.map +1 -1
  38. package/dist/components/core/solid-agent/SolidAgentHost.js +79 -1
  39. package/dist/components/core/solid-agent/SolidAgentHost.js.map +1 -1
  40. package/dist/components/core/solid-agent/SolidAgentHost.tsx +69 -2
  41. package/dist/components/core/solid-agent/agentEvents.d.ts.map +1 -1
  42. package/dist/components/core/solid-agent/agentEvents.js +1 -3
  43. package/dist/components/core/solid-agent/agentEvents.js.map +1 -1
  44. package/dist/components/core/solid-agent/agentEvents.ts +5 -3
  45. package/dist/components/core/solid-agent/client/agentPublicEvents.d.ts +88 -0
  46. package/dist/components/core/solid-agent/client/agentPublicEvents.d.ts.map +1 -0
  47. package/dist/components/core/solid-agent/client/agentPublicEvents.js +26 -0
  48. package/dist/components/core/solid-agent/client/agentPublicEvents.js.map +1 -0
  49. package/dist/components/core/solid-agent/client/agentPublicEvents.ts +66 -0
  50. package/dist/components/core/solid-agent/client/agentRuntime.d.ts +18 -3
  51. package/dist/components/core/solid-agent/client/agentRuntime.d.ts.map +1 -1
  52. package/dist/components/core/solid-agent/client/agentRuntime.js +173 -31
  53. package/dist/components/core/solid-agent/client/agentRuntime.js.map +1 -1
  54. package/dist/components/core/solid-agent/client/agentRuntime.ts +126 -16
  55. package/dist/components/core/solid-agent/client/agentSocket.d.ts +3 -0
  56. package/dist/components/core/solid-agent/client/agentSocket.d.ts.map +1 -1
  57. package/dist/components/core/solid-agent/client/agentSocket.js +19 -1
  58. package/dist/components/core/solid-agent/client/agentSocket.js.map +1 -1
  59. package/dist/components/core/solid-agent/client/agentSocket.ts +11 -1
  60. package/dist/components/core/solid-agent/client/beforeUserMessageSend.d.ts +9 -0
  61. package/dist/components/core/solid-agent/client/beforeUserMessageSend.d.ts.map +1 -0
  62. package/dist/components/core/solid-agent/client/beforeUserMessageSend.js +53 -0
  63. package/dist/components/core/solid-agent/client/beforeUserMessageSend.js.map +1 -0
  64. package/dist/components/core/solid-agent/client/beforeUserMessageSend.ts +26 -0
  65. package/dist/components/core/solid-agent/embed/AgentEmbeddingPanel.d.ts.map +1 -1
  66. package/dist/components/core/solid-agent/embed/AgentEmbeddingPanel.js +4 -3
  67. package/dist/components/core/solid-agent/embed/AgentEmbeddingPanel.js.map +1 -1
  68. package/dist/components/core/solid-agent/embed/AgentEmbeddingPanel.tsx +4 -2
  69. package/dist/components/core/solid-agent/embed/agentEmbedProtocol.d.ts +29 -0
  70. package/dist/components/core/solid-agent/embed/agentEmbedProtocol.d.ts.map +1 -1
  71. package/dist/components/core/solid-agent/embed/agentEmbedProtocol.js +45 -2
  72. package/dist/components/core/solid-agent/embed/agentEmbedProtocol.js.map +1 -1
  73. package/dist/components/core/solid-agent/embed/agentEmbedProtocol.ts +49 -2
  74. package/dist/components/core/solid-agent/embed/agentEmbedSamples.d.ts +1 -0
  75. package/dist/components/core/solid-agent/embed/agentEmbedSamples.d.ts.map +1 -1
  76. package/dist/components/core/solid-agent/embed/agentEmbedSamples.js +2 -1
  77. package/dist/components/core/solid-agent/embed/agentEmbedSamples.js.map +1 -1
  78. package/dist/components/core/solid-agent/embed/agentEmbedSamples.ts +15 -1
  79. package/dist/components/core/solid-agent/types.d.ts +13 -0
  80. package/dist/components/core/solid-agent/types.d.ts.map +1 -1
  81. package/dist/components/core/solid-agent/types.js.map +1 -1
  82. package/dist/components/core/solid-agent/types.ts +8 -0
  83. package/dist/components/core/solid-agent/useAgentChat.d.ts +1 -1
  84. package/dist/components/core/solid-agent/useAgentChat.d.ts.map +1 -1
  85. package/dist/components/core/solid-agent/useAgentChat.js +7 -4
  86. package/dist/components/core/solid-agent/useAgentChat.js.map +1 -1
  87. package/dist/components/core/solid-agent/useAgentChat.ts +9 -5
  88. package/dist/components/core/solid-agent/widgets/DefaultUserMessageChatWidget.d.ts.map +1 -1
  89. package/dist/components/core/solid-agent/widgets/DefaultUserMessageChatWidget.js +12 -4
  90. package/dist/components/core/solid-agent/widgets/DefaultUserMessageChatWidget.js.map +1 -1
  91. package/dist/components/core/solid-agent/widgets/DefaultUserMessageChatWidget.tsx +18 -0
  92. package/dist/components/core/solid-agent/widgets/SolidNavigationIntentChatWidget.d.ts +4 -0
  93. package/dist/components/core/solid-agent/widgets/SolidNavigationIntentChatWidget.d.ts.map +1 -0
  94. package/dist/components/core/solid-agent/widgets/SolidNavigationIntentChatWidget.js +30 -0
  95. package/dist/components/core/solid-agent/widgets/SolidNavigationIntentChatWidget.js.map +1 -0
  96. package/dist/components/core/solid-agent/widgets/SolidNavigationIntentChatWidget.tsx +41 -0
  97. package/dist/components/core/solid-agent/widgets/solidChatWidgets.module.css +39 -0
  98. package/dist/components/shad-cn-ui/SolidCodeEditor.d.ts +2 -1
  99. package/dist/components/shad-cn-ui/SolidCodeEditor.d.ts.map +1 -1
  100. package/dist/components/shad-cn-ui/SolidCodeEditor.js +3 -2
  101. package/dist/components/shad-cn-ui/SolidCodeEditor.js.map +1 -1
  102. package/dist/components/shad-cn-ui/SolidCodeEditor.tsx +3 -0
  103. package/dist/helpers/adminViewRefresh.d.ts +13 -0
  104. package/dist/helpers/adminViewRefresh.d.ts.map +1 -0
  105. package/dist/helpers/adminViewRefresh.js +14 -0
  106. package/dist/helpers/adminViewRefresh.js.map +1 -0
  107. package/dist/helpers/adminViewRefresh.ts +26 -0
  108. package/dist/helpers/eventBus.d.ts +1 -0
  109. package/dist/helpers/eventBus.d.ts.map +1 -1
  110. package/dist/helpers/eventBus.js +1 -0
  111. package/dist/helpers/eventBus.js.map +1 -1
  112. package/dist/helpers/eventBus.ts +1 -0
  113. package/dist/helpers/fileTypeIcon.d.ts.map +1 -1
  114. package/dist/helpers/fileTypeIcon.js +4 -1
  115. package/dist/helpers/fileTypeIcon.js.map +1 -1
  116. package/dist/helpers/fileTypeIcon.tsx +15 -0
  117. package/dist/helpers/registry.d.ts.map +1 -1
  118. package/dist/helpers/registry.js +2 -0
  119. package/dist/helpers/registry.js.map +1 -1
  120. package/dist/helpers/registry.ts +2 -0
  121. package/dist/helpers/routePaths.d.ts +13 -0
  122. package/dist/helpers/routePaths.d.ts.map +1 -1
  123. package/dist/helpers/routePaths.js +39 -0
  124. package/dist/helpers/routePaths.js.map +1 -1
  125. package/dist/helpers/routePaths.ts +48 -0
  126. package/dist/redux/features/agentSlice.d.ts +2 -1
  127. package/dist/redux/features/agentSlice.d.ts.map +1 -1
  128. package/dist/redux/features/agentSlice.js +2 -2
  129. package/dist/redux/features/agentSlice.js.map +1 -1
  130. package/dist/redux/features/agentSlice.ts +8 -3
  131. package/dist/resources/solid-custom.css +42 -0
  132. package/dist/resources/solid-tailwind-generated.css +1 -1
  133. package/dist/routes/pages/admin/core/AgentHubModuleField.css +15 -0
  134. package/dist/routes/pages/admin/core/AgentHubModuleField.d.ts +22 -0
  135. package/dist/routes/pages/admin/core/AgentHubModuleField.d.ts.map +1 -0
  136. package/dist/routes/pages/admin/core/AgentHubModuleField.js +42 -0
  137. package/dist/routes/pages/admin/core/AgentHubModuleField.js.map +1 -0
  138. package/dist/routes/pages/admin/core/AgentHubModuleField.tsx +54 -0
  139. package/dist/routes/pages/admin/core/AgentHubTagsField.d.ts +3 -1
  140. package/dist/routes/pages/admin/core/AgentHubTagsField.d.ts.map +1 -1
  141. package/dist/routes/pages/admin/core/AgentHubTagsField.js +3 -3
  142. package/dist/routes/pages/admin/core/AgentHubTagsField.js.map +1 -1
  143. package/dist/routes/pages/admin/core/AgentHubTagsField.tsx +7 -3
  144. package/dist/routes/pages/admin/core/AgentRegistryEditorPage.d.ts.map +1 -1
  145. package/dist/routes/pages/admin/core/AgentRegistryEditorPage.js +37 -29
  146. package/dist/routes/pages/admin/core/AgentRegistryEditorPage.js.map +1 -1
  147. package/dist/routes/pages/admin/core/AgentRegistryEditorPage.tsx +12 -6
  148. package/dist/routes/pages/admin/core/AgentSkillRegistryEditorPage.d.ts.map +1 -1
  149. package/dist/routes/pages/admin/core/AgentSkillRegistryEditorPage.js +22 -15
  150. package/dist/routes/pages/admin/core/AgentSkillRegistryEditorPage.js.map +1 -1
  151. package/dist/routes/pages/admin/core/AgentSkillRegistryEditorPage.tsx +17 -7
  152. package/dist/routes/pages/admin/core/AgentToolRegistryEditorPage.d.ts.map +1 -1
  153. package/dist/routes/pages/admin/core/AgentToolRegistryEditorPage.js +21 -15
  154. package/dist/routes/pages/admin/core/AgentToolRegistryEditorPage.js.map +1 -1
  155. package/dist/routes/pages/admin/core/AgentToolRegistryEditorPage.tsx +16 -9
  156. package/dist/routes/pages/admin/core/ArchivedChatterMessagesPage.d.ts.map +1 -1
  157. package/dist/routes/pages/admin/core/ArchivedChatterMessagesPage.js +149 -37
  158. package/dist/routes/pages/admin/core/ArchivedChatterMessagesPage.js.map +1 -1
  159. package/dist/routes/pages/admin/core/ArchivedChatterMessagesPage.tsx +283 -73
  160. package/dist/routes/pages/admin/core/CardPage.d.ts.map +1 -1
  161. package/dist/routes/pages/admin/core/CardPage.js +9 -1
  162. package/dist/routes/pages/admin/core/CardPage.js.map +1 -1
  163. package/dist/routes/pages/admin/core/CardPage.tsx +9 -1
  164. package/dist/routes/pages/admin/core/KanbanPage.d.ts.map +1 -1
  165. package/dist/routes/pages/admin/core/KanbanPage.js +9 -1
  166. package/dist/routes/pages/admin/core/KanbanPage.js.map +1 -1
  167. package/dist/routes/pages/admin/core/KanbanPage.tsx +9 -1
  168. package/dist/routes/pages/admin/core/ListPage.d.ts.map +1 -1
  169. package/dist/routes/pages/admin/core/ListPage.js +10 -1
  170. package/dist/routes/pages/admin/core/ListPage.js.map +1 -1
  171. package/dist/routes/pages/admin/core/ListPage.tsx +10 -1
  172. package/dist/routes/pages/admin/core/TreePage.d.ts.map +1 -1
  173. package/dist/routes/pages/admin/core/TreePage.js +9 -1
  174. package/dist/routes/pages/admin/core/TreePage.js.map +1 -1
  175. package/dist/routes/pages/admin/core/TreePage.tsx +9 -1
  176. package/dist/routes/pages/embed/AgentEmbedPage.d.ts.map +1 -1
  177. package/dist/routes/pages/embed/AgentEmbedPage.js +67 -4
  178. package/dist/routes/pages/embed/AgentEmbedPage.js.map +1 -1
  179. package/dist/routes/pages/embed/AgentEmbedPage.tsx +61 -4
  180. package/package.json +1 -1
@@ -55,6 +55,7 @@ import { showToast } from "../../../../redux/features/toastSlice";
55
55
  import { solidPatch } from "../../../../http/solidHttp";
56
56
  import { AgentRegistryAuditPanel } from "./AgentRegistryAuditPanel";
57
57
  import { AgentHubTagsField, agentHubTagsFrom, agentHubTagsPayload } from "./AgentHubTagsField";
58
+ import { AgentHubModuleField, agentHubModuleFrom, agentHubModulePayload } from "./AgentHubModuleField";
58
59
  import { AgentToolActivationDialog } from "./AgentToolActivationDialog";
59
60
  import { AgentToolSessionsPanel } from "../../../../components/core/extension/solid-core/agentToolRegistry/AgentToolSessionsPanel";
60
61
  import { AgentRegistryCardWidget } from "../../../../components/core/extension/solid-core/agentRegistry/card/AgentRegistryCardWidget";
@@ -115,7 +116,7 @@ export function AgentToolRegistryEditorPage() {
115
116
  var dispatch = useDispatch();
116
117
  var entityApi = React.useMemo(function () { return createSolidEntityApi("agentToolRegistry"); }, []);
117
118
  var useCreateSolidEntityMutation = entityApi.useCreateSolidEntityMutation, useGetSolidEntityByIdQuery = entityApi.useGetSolidEntityByIdQuery, useUpdateSolidEntityMutation = entityApi.useUpdateSolidEntityMutation;
118
- var _c = useGetSolidEntityByIdQuery({ id: id, qs: "populate[0]=agentTools&populate[1]=agentTools.agentRegistry&populate[2]=tags" }, { skip: !id || id === "new" }), response = _c.data, isLoading = _c.isLoading, isFetching = _c.isFetching, refetch = _c.refetch;
119
+ var _c = useGetSolidEntityByIdQuery({ id: id, qs: "populate[0]=agentTools&populate[1]=agentTools.agentRegistry&populate[2]=tags&populate[3]=module" }, { skip: !id || id === "new" }), response = _c.data, isLoading = _c.isLoading, isFetching = _c.isFetching, refetch = _c.refetch;
119
120
  var _d = useCreateSolidEntityMutation(), createTool = _d[0], isCreating = _d[1].isLoading;
120
121
  var _e = useUpdateSolidEntityMutation(), updateTool = _e[0], isSaving = _e[1].isLoading;
121
122
  var record = extractEntityRecord(response);
@@ -126,25 +127,28 @@ export function AgentToolRegistryEditorPage() {
126
127
  var _k = React.useState("custom"), type = _k[0], setType = _k[1];
127
128
  var _l = React.useState(""), sourceCode = _l[0], setSourceCode = _l[1];
128
129
  var _m = React.useState([]), tags = _m[0], setTags = _m[1];
129
- var _o = React.useState(false), creatingTag = _o[0], setCreatingTag = _o[1];
130
- var _p = React.useState({}), fieldErrors = _p[0], setFieldErrors = _p[1];
131
- var _q = React.useState(0), auditRefreshVersion = _q[0], setAuditRefreshVersion = _q[1];
132
- var _r = React.useState(false), confirmRefresh = _r[0], setConfirmRefresh = _r[1];
133
- var _s = React.useState(false), activationOpen = _s[0], setActivationOpen = _s[1];
134
- var _t = React.useState(null), activationTool = _t[0], setActivationTool = _t[1];
130
+ var _o = React.useState(null), module = _o[0], setModule = _o[1];
131
+ var _p = React.useState(false), creatingTag = _p[0], setCreatingTag = _p[1];
132
+ var _q = React.useState({}), fieldErrors = _q[0], setFieldErrors = _q[1];
133
+ var _r = React.useState(0), auditRefreshVersion = _r[0], setAuditRefreshVersion = _r[1];
134
+ var _s = React.useState(false), confirmRefresh = _s[0], setConfirmRefresh = _s[1];
135
+ var _t = React.useState(false), activationOpen = _t[0], setActivationOpen = _t[1];
136
+ var _u = React.useState(null), activationTool = _u[0], setActivationTool = _u[1];
135
137
  var preparingActivation = React.useRef(false);
136
138
  var baseline = React.useRef("");
137
- var currentForm = function () { return JSON.stringify({ name: name, iconName: iconName, description: description, type: type, sourceCode: sourceCode, tags: tags }); };
139
+ var currentForm = function () { var _a; return JSON.stringify({ name: name, iconName: iconName, description: description, type: type, sourceCode: sourceCode, tags: tags, moduleId: (_a = module === null || module === void 0 ? void 0 : module.id) !== null && _a !== void 0 ? _a : null }); };
138
140
  React.useEffect(function () {
139
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
141
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
140
142
  var nextTags = agentHubTagsFrom(record === null || record === void 0 ? void 0 : record.tags);
143
+ var nextModule = agentHubModuleFrom(record === null || record === void 0 ? void 0 : record.module);
141
144
  setName((_a = record === null || record === void 0 ? void 0 : record.name) !== null && _a !== void 0 ? _a : "");
142
145
  setIconName((_b = record === null || record === void 0 ? void 0 : record.iconName) !== null && _b !== void 0 ? _b : "");
143
146
  setDescription((_c = record === null || record === void 0 ? void 0 : record.description) !== null && _c !== void 0 ? _c : "");
144
147
  setType((_d = record === null || record === void 0 ? void 0 : record.type) !== null && _d !== void 0 ? _d : "custom");
145
148
  setSourceCode((_e = record === null || record === void 0 ? void 0 : record.sourceCode) !== null && _e !== void 0 ? _e : "");
146
149
  setTags(nextTags);
147
- baseline.current = JSON.stringify({ name: (_f = record === null || record === void 0 ? void 0 : record.name) !== null && _f !== void 0 ? _f : "", iconName: (_g = record === null || record === void 0 ? void 0 : record.iconName) !== null && _g !== void 0 ? _g : "", description: (_h = record === null || record === void 0 ? void 0 : record.description) !== null && _h !== void 0 ? _h : "", type: (_j = record === null || record === void 0 ? void 0 : record.type) !== null && _j !== void 0 ? _j : "custom", sourceCode: (_k = record === null || record === void 0 ? void 0 : record.sourceCode) !== null && _k !== void 0 ? _k : "", tags: nextTags });
150
+ setModule(nextModule);
151
+ baseline.current = JSON.stringify({ name: (_f = record === null || record === void 0 ? void 0 : record.name) !== null && _f !== void 0 ? _f : "", iconName: (_g = record === null || record === void 0 ? void 0 : record.iconName) !== null && _g !== void 0 ? _g : "", description: (_h = record === null || record === void 0 ? void 0 : record.description) !== null && _h !== void 0 ? _h : "", type: (_j = record === null || record === void 0 ? void 0 : record.type) !== null && _j !== void 0 ? _j : "custom", sourceCode: (_k = record === null || record === void 0 ? void 0 : record.sourceCode) !== null && _k !== void 0 ? _k : "", tags: nextTags, moduleId: (_l = nextModule === null || nextModule === void 0 ? void 0 : nextModule.id) !== null && _l !== void 0 ? _l : null });
148
152
  }, [record]);
149
153
  var isReadOnly = (record === null || record === void 0 ? void 0 : record.type) === "solidx";
150
154
  var isDirty = Boolean(record === null || record === void 0 ? void 0 : record.id) && currentForm() !== baseline.current;
@@ -167,13 +171,15 @@ export function AgentToolRegistryEditorPage() {
167
171
  nextErrors.type = "Tool type is required.";
168
172
  if (!sourceCode.trim())
169
173
  nextErrors.sourceCode = "Tool source code is required.";
174
+ if (!module)
175
+ nextErrors.module = "Module is required. Select a module before saving this tool.";
170
176
  setFieldErrors(nextErrors);
171
177
  if (Object.keys(nextErrors).length > 0) {
172
178
  setActiveTab(nextErrors.sourceCode ? "tool" : "general");
173
179
  dispatch(showToast({ severity: "error", summary: "Missing information", detail: Object.values(nextErrors).join(" ") }));
174
180
  return [2 /*return*/];
175
181
  }
176
- _a = [__assign({ name: name.trim(), iconName: iconName || null, description: description.trim(), type: type, sourceCode: sourceCode }, agentHubTagsPayload(tags))];
182
+ _a = [__assign(__assign({ name: name.trim(), iconName: iconName || null, description: description.trim(), type: type, sourceCode: sourceCode }, agentHubTagsPayload(tags)), agentHubModulePayload(module))];
177
183
  if (!["custom", "thirdparty"].includes(type)) return [3 /*break*/, 2];
178
184
  _d = {};
179
185
  return [4 /*yield*/, sha256Hex(sourceCode)];
@@ -211,11 +217,11 @@ export function AgentToolRegistryEditorPage() {
211
217
  errorDetail = getSaveErrorMessage(error_1);
212
218
  serverFieldErrors = {};
213
219
  if (/required|not be empty|cannot be empty|should not be empty/i.test(errorDetail)) {
214
- for (_i = 0, _c = ["name", "description", "type", "sourceCode"]; _i < _c.length; _i++) {
220
+ for (_i = 0, _c = ["name", "description", "type", "sourceCode", "module"]; _i < _c.length; _i++) {
215
221
  field = _c[_i];
216
222
  if (!new RegExp("\\b".concat(field, "\\b"), "i").test(errorDetail))
217
223
  continue;
218
- label = field === "sourceCode" ? "Tool source code" : field[0].toUpperCase() + field.slice(1);
224
+ label = field === "sourceCode" ? "Tool source code" : field === "module" ? "Module" : field[0].toUpperCase() + field.slice(1);
219
225
  serverFieldErrors[field] = "".concat(label, " is required.");
220
226
  }
221
227
  }
@@ -288,7 +294,7 @@ export function AgentToolRegistryEditorPage() {
288
294
  }, [record === null || record === void 0 ? void 0 : record.agentTools]);
289
295
  var sessionAgents = React.useMemo(function () { return agents.filter(function (agent) { return agent.id !== undefined && agent.id !== null; }); }, [agents]);
290
296
  var tabs = [
291
- { value: "general", label: "General Info", content: _jsxs("fieldset", { className: "agent-tool-editor__general", disabled: isReadOnly, children: [isReadOnly && _jsx("p", { className: "agent-tool-editor__readonly-note", children: "SolidX tools are seeded by the AgentHub runtime and cannot be edited." }), (record === null || record === void 0 ? void 0 : record.status) && _jsxs("section", { className: "agent-tool-editor__runtime-status".concat(record.status === "load_failed" ? " agent-tool-editor__runtime-status--failed" : ""), role: record.status === "load_failed" ? "alert" : "status", children: [_jsxs("div", { className: "agent-tool-editor__runtime-heading", children: [_jsx("strong", { children: "Runtime status" }), _jsx("span", { children: record.status.replace(/[_-]+/g, " ") })] }), record.status === "load_failed" ? _jsxs(_Fragment, { children: [_jsx("p", { children: "The AgentHub runtime could not load this tool. After correcting its source or checksum, restart linked agent processes so the runtime retries loading it." }), record.lastLoadError && _jsx("pre", { children: record.lastLoadError })] }) : _jsx("p", { children: record.lastLoadError || "No tool load error has been reported." })] }), _jsxs("div", { className: "agent-tool-editor__fields", children: [_jsxs("label", { className: "agent-tool-editor__field", children: [_jsxs("span", { children: ["Name ", _jsx("b", { children: "*" })] }), _jsx(SolidInput, { value: name, "aria-invalid": Boolean(fieldErrors.name), "aria-describedby": fieldErrors.name ? "agent-tool-name-error" : undefined, className: fieldErrors.name ? "agent-tool-editor__input--invalid" : undefined, onChange: function (e) { setName(e.target.value); setFieldErrors(function (current) { return (__assign(__assign({}, current), { name: "" })); }); } }), fieldErrors.name && _jsx("small", { id: "agent-tool-name-error", className: "agent-tool-editor__field-error", children: fieldErrors.name })] }), _jsxs("div", { className: "agent-tool-editor__field", children: [_jsx("span", { children: "Icon" }), _jsx(SolidIconPicker, { value: iconName, onChange: setIconName })] }), _jsxs("label", { className: "agent-tool-editor__field", children: [_jsxs("span", { children: ["Description ", _jsx("b", { children: "*" })] }), _jsx(SolidInput, { value: description, "aria-invalid": Boolean(fieldErrors.description), "aria-describedby": fieldErrors.description ? "agent-tool-description-error" : undefined, className: fieldErrors.description ? "agent-tool-editor__input--invalid" : undefined, onChange: function (e) { setDescription(e.target.value); setFieldErrors(function (current) { return (__assign(__assign({}, current), { description: "" })); }); } }), fieldErrors.description && _jsx("small", { id: "agent-tool-description-error", className: "agent-tool-editor__field-error", children: fieldErrors.description })] })] }), !(record === null || record === void 0 ? void 0 : record.id) && _jsxs("label", { className: "agent-tool-editor__field", children: [_jsx("span", { children: "Tool status" }), _jsx("select", { value: "inactive", disabled: true, "aria-label": "Tool status", children: _jsx("option", { value: "inactive", children: "Inactive" }) }), _jsx("small", { children: "New tools start inactive. Run configuration and initialization checks to activate." })] }), _jsxs("label", { className: "agent-tool-editor__field", children: [_jsxs("span", { children: ["Tool type ", _jsx("b", { children: "*" })] }), _jsxs("select", { value: type, "aria-invalid": Boolean(fieldErrors.type), "aria-describedby": fieldErrors.type ? "agent-tool-type-error" : undefined, className: fieldErrors.type ? "agent-tool-editor__input--invalid" : undefined, onChange: function (e) { setType(e.target.value); setFieldErrors(function (current) { return (__assign(__assign({}, current), { type: "" })); }); }, children: [isReadOnly && _jsx("option", { value: "solidx", children: "SolidX" }), _jsx("option", { value: "thirdparty", children: "Third Party" }), _jsx("option", { value: "custom", children: "Custom" })] }), fieldErrors.type && _jsx("small", { id: "agent-tool-type-error", className: "agent-tool-editor__field-error", children: fieldErrors.type })] }), _jsx(AgentHubTagsField, { value: tags, onChange: setTags, disabled: isReadOnly || isCreating || isSaving, onBusyChange: setCreatingTag }), (record === null || record === void 0 ? void 0 : record.id) && _jsxs("section", { className: "agent-tool-editor__workflow", "aria-labelledby": "agent-tool-lifecycle-title", children: [_jsx("div", { className: "agent-tool-editor__workflow-head", children: _jsxs("div", { children: [_jsx("h2", { id: "agent-tool-lifecycle-title", children: "Tool lifecycle" }), _jsx("p", { children: "Configuration and initialization must pass before this tool can be activated." })] }) }), _jsx("div", { className: "agent-tool-editor__workflow-stages", "aria-label": "Current tool stage: ".concat(((_a = record.status) !== null && _a !== void 0 ? _a : "inactive").replace(/[_-]+/g, " ")), children: [["active", "Active", "Enabled for loading into linked agents."], ["inactive", "Inactive", "Not loaded for linked agents."], ["load_failed", "Load failed", "AgentHub could not load this tool."]].map(function (_a, index) {
297
+ { value: "general", label: "General Info", content: _jsxs("fieldset", { className: "agent-tool-editor__general", disabled: isReadOnly, children: [isReadOnly && _jsx("p", { className: "agent-tool-editor__readonly-note", children: "SolidX tools cannot be edited." }), (record === null || record === void 0 ? void 0 : record.status) && _jsxs("section", { className: "agent-tool-editor__runtime-status".concat(record.status === "load_failed" ? " agent-tool-editor__runtime-status--failed" : ""), role: record.status === "load_failed" ? "alert" : "status", children: [_jsxs("div", { className: "agent-tool-editor__runtime-heading", children: [_jsx("strong", { children: "Runtime status" }), _jsx("span", { children: record.status.replace(/[_-]+/g, " ") })] }), record.status === "load_failed" ? _jsxs(_Fragment, { children: [_jsx("p", { children: "The AgentHub runtime could not load this tool. After correcting its source or checksum, restart linked agent processes so the runtime retries loading it." }), record.lastLoadError && _jsx("pre", { children: record.lastLoadError })] }) : _jsx("p", { children: record.lastLoadError || "No tool load error has been reported." })] }), _jsxs("div", { className: "agent-tool-editor__fields", children: [_jsxs("label", { className: "agent-tool-editor__field", children: [_jsxs("span", { children: ["Name ", _jsx("b", { children: "*" })] }), _jsx(SolidInput, { value: name, "aria-invalid": Boolean(fieldErrors.name), "aria-describedby": fieldErrors.name ? "agent-tool-name-error" : undefined, className: fieldErrors.name ? "agent-tool-editor__input--invalid" : undefined, onChange: function (e) { setName(e.target.value); setFieldErrors(function (current) { return (__assign(__assign({}, current), { name: "" })); }); } }), fieldErrors.name && _jsx("small", { id: "agent-tool-name-error", className: "agent-tool-editor__field-error", children: fieldErrors.name })] }), _jsxs("div", { className: "agent-tool-editor__field", children: [_jsx("span", { children: "Icon" }), _jsx(SolidIconPicker, { value: iconName, onChange: setIconName })] }), _jsxs("label", { className: "agent-tool-editor__field", children: [_jsxs("span", { children: ["Description ", _jsx("b", { children: "*" })] }), _jsx(SolidInput, { value: description, "aria-invalid": Boolean(fieldErrors.description), "aria-describedby": fieldErrors.description ? "agent-tool-description-error" : undefined, className: fieldErrors.description ? "agent-tool-editor__input--invalid" : undefined, onChange: function (e) { setDescription(e.target.value); setFieldErrors(function (current) { return (__assign(__assign({}, current), { description: "" })); }); } }), fieldErrors.description && _jsx("small", { id: "agent-tool-description-error", className: "agent-tool-editor__field-error", children: fieldErrors.description })] })] }), !(record === null || record === void 0 ? void 0 : record.id) && _jsxs("label", { className: "agent-tool-editor__field", children: [_jsx("span", { children: "Tool status" }), _jsx("select", { value: "inactive", disabled: true, "aria-label": "Tool status", children: _jsx("option", { value: "inactive", children: "Inactive" }) }), _jsx("small", { children: "New tools start inactive. Run configuration and initialization checks to activate." })] }), _jsxs("label", { className: "agent-tool-editor__field", children: [_jsxs("span", { children: ["Tool type ", _jsx("b", { children: "*" })] }), _jsxs("select", { value: type, "aria-invalid": Boolean(fieldErrors.type), "aria-describedby": fieldErrors.type ? "agent-tool-type-error" : undefined, className: fieldErrors.type ? "agent-tool-editor__input--invalid" : undefined, onChange: function (e) { setType(e.target.value); setFieldErrors(function (current) { return (__assign(__assign({}, current), { type: "" })); }); }, children: [isReadOnly && _jsx("option", { value: "solidx", children: "SolidX" }), _jsx("option", { value: "thirdparty", children: "Third Party" }), _jsx("option", { value: "custom", children: "Custom" })] }), fieldErrors.type && _jsx("small", { id: "agent-tool-type-error", className: "agent-tool-editor__field-error", children: fieldErrors.type })] }), _jsx(AgentHubModuleField, { className: "agent-tool-editor__field", value: module, onChange: function (value) { setModule(value); setFieldErrors(function (current) { return (__assign(__assign({}, current), { module: "" })); }); }, disabled: isReadOnly || isCreating || isSaving, clearable: false, required: true, error: fieldErrors.module }), _jsx(AgentHubTagsField, { value: tags, onChange: setTags, module: module, disabled: isReadOnly || isCreating || isSaving, onBusyChange: setCreatingTag }), (record === null || record === void 0 ? void 0 : record.id) && _jsxs("section", { className: "agent-tool-editor__workflow", "aria-labelledby": "agent-tool-lifecycle-title", children: [_jsx("div", { className: "agent-tool-editor__workflow-head", children: _jsxs("div", { children: [_jsx("h2", { id: "agent-tool-lifecycle-title", children: "Tool lifecycle" }), _jsx("p", { children: "Configuration and initialization must pass before this tool can be activated." })] }) }), _jsx("div", { className: "agent-tool-editor__workflow-stages", "aria-label": "Current tool stage: ".concat(((_a = record.status) !== null && _a !== void 0 ? _a : "inactive").replace(/[_-]+/g, " ")), children: [["active", "Active", "Enabled for loading into linked agents."], ["inactive", "Inactive", "Not loaded for linked agents."], ["load_failed", "Load failed", "AgentHub could not load this tool."]].map(function (_a, index) {
292
298
  var _b;
293
299
  var value = _a[0], label = _a[1], description = _a[2];
294
300
  var currentStatus = (_b = record.status) !== null && _b !== void 0 ? _b : "inactive";
@@ -297,7 +303,7 @@ export function AgentToolRegistryEditorPage() {
297
303
  var disabled = isReadOnly || activationOpen || isCreating || isSaving || (!canRetry && (value === "load_failed" || isCurrent));
298
304
  return _jsxs(React.Fragment, { children: [index > 0 && _jsx("div", { className: "agent-tool-editor__workflow-connector", "aria-hidden": "true" }), _jsxs("button", { type: "button", className: "agent-tool-editor__workflow-stage agent-tool-editor__workflow-stage--".concat(value).concat(isCurrent ? " is-current" : ""), "aria-current": isCurrent ? "step" : undefined, "aria-pressed": isCurrent, disabled: disabled, onClick: function () { return value === "inactive" ? void save("inactive") : void beginActivation(); }, children: [_jsx("span", { className: "agent-tool-editor__workflow-mark", children: index + 1 }), _jsxs("span", { className: "agent-tool-editor__workflow-copy", children: [_jsx("strong", { children: label }), _jsx("small", { children: description }), _jsx("small", { className: "agent-tool-editor__workflow-cta", children: canRetry ? "Run checks and retry activation" : isCurrent ? "Current stage" : value === "load_failed" ? "Set automatically by AgentHub" : value === "active" ? "Run checks to activate" : "Click to deactivate" })] }), isCurrent && _jsx("span", { className: "agent-tool-editor__workflow-current", children: "Current" })] })] }, value);
299
305
  }) }), record.status === "load_failed" && _jsx("small", { className: "agent-tool-editor__workflow-hint", children: "Fix the source or checksum, then run configuration and initialization checks before retrying activation." }), _jsx("small", { className: "agent-tool-editor__workflow-hint", children: "Activation checks use the saved tool configuration. Restart linked agent processes to apply status changes." })] })] }) },
300
- { value: "tool", label: "Tool", content: _jsx("div", { className: "agent-tool-editor__tool", children: _jsxs("section", { className: "agent-tool-editor__panel", children: [_jsxs("header", { children: [_jsxs("h2", { children: ["Tool source code ", _jsx("b", { children: "*" })] }), _jsx("p", { children: "Write the tool's Python code here." })] }), _jsx(SolidCodeEditor, { value: sourceCode, onChange: function (value) { setSourceCode(value !== null && value !== void 0 ? value : ""); setFieldErrors(function (current) { return (__assign(__assign({}, current), { sourceCode: "" })); }); }, language: "python", readOnly: isReadOnly, fontSize: 11, height: "max(32rem, calc(100dvh - 18rem))", className: "agent-tool-editor__code".concat(fieldErrors.sourceCode ? " agent-tool-editor__code--invalid" : "") }), fieldErrors.sourceCode && _jsx("small", { className: "agent-tool-editor__field-error agent-tool-editor__code-error", children: fieldErrors.sourceCode })] }) }) },
306
+ { value: "tool", label: "Tool", content: _jsx("div", { className: "agent-tool-editor__tool", children: _jsxs("section", { className: "agent-tool-editor__panel", children: [_jsxs("header", { children: [_jsxs("h2", { children: ["Tool source code ", _jsx("b", { children: "*" })] }), _jsx("p", { children: "Write the tool's Python code here." })] }), _jsx(SolidCodeEditor, { value: sourceCode, onChange: function (value) { setSourceCode(value !== null && value !== void 0 ? value : ""); setFieldErrors(function (current) { return (__assign(__assign({}, current), { sourceCode: "" })); }); }, language: "python", wordWrap: "on", readOnly: isReadOnly, fontSize: 11, height: "max(32rem, calc(100dvh - 18rem))", className: "agent-tool-editor__code".concat(fieldErrors.sourceCode ? " agent-tool-editor__code--invalid" : "") }), fieldErrors.sourceCode && _jsx("small", { className: "agent-tool-editor__field-error agent-tool-editor__code-error", children: fieldErrors.sourceCode })] }) }) },
301
307
  { value: "agents", label: "Agents", content: _jsxs("section", { className: "agent-tool-editor__agents", children: [_jsxs("div", { children: [_jsx("h2", { children: "Associated agents" }), _jsx("p", { children: "Agents linked to this tool. Associations are read-only here." })] }), isLoading ? _jsx("p", { children: "Loading associated agents\u2026" }) : agents.length ? _jsx("div", { className: "agent-tool-editor__agent-grid", children: agents.map(function (agent, index) { var _a, _b; return _jsx("div", { className: "agent-tool-editor__agent-card", children: _jsx(SharedAgentRegistryCard, { rowData: agent }) }, String((_b = (_a = agent.id) !== null && _a !== void 0 ? _a : agent.name) !== null && _b !== void 0 ? _b : index)); }) }) : _jsx("div", { className: "agent-tool-editor__empty", children: "No agents are currently associated with this tool." })] }) },
302
308
  { value: "sessions", label: "Sessions", content: _jsx(AgentToolSessionsPanel, { agents: sessionAgents }) },
303
309
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"AgentToolRegistryEditorPage.js","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/AgentToolRegistryEditorPage.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,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IAAK,OAAA,OAAO,GAAG,CAAC,EAAX,CAAW,CAAC,CAAC;gCACjD,KAAK,OAAO,EAAE,CAAC;gCACf,QAAQ,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,iDAAiD,EAAE,CAAC,CAAC,CAAC;;;;qBACpI,GAAI,EACN,SAAS,CAAC,CAAC,CAAC,cAAK,SAAS,EAAC,4BAA4B,mCAAoB,CAAC,CAAC,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,EAAE,EAAC,CAAC,CAAC,CAC1F,KAAC,uBAAuB,IAAC,iBAAiB,EAAC,mBAAmB,EAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,cAAc,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,CAAC,IAAI,YAChJ,KAAC,aAAa,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAC,yBAAyB,EAAC,aAAa,EAAC,6BAA6B,EAAC,cAAc,EAAC,8BAA8B,GAAG,GAClL,CAC3B,CAAC,CAAC,CAAC,KAAC,aAAa,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAC,yBAAyB,EAAC,aAAa,EAAC,6BAA6B,EAAC,cAAc,EAAC,8BAA8B,GAAG,IACzM,CAAC;AACV,CAAC","sourcesContent":["import React from \"react\";\nimport { ArrowLeft, RefreshCw } from \"lucide-react\";\nimport { useDispatch } from \"react-redux\";\nimport { useNavigate, useParams } from \"react-router-dom\";\nimport { createSolidEntityApi } from \"../../../../redux/api/solidEntityApi\";\nimport { showToast } from \"../../../../redux/features/toastSlice\";\nimport { solidPatch } from \"../../../../http/solidHttp\";\nimport { AgentRegistryAuditPanel } from \"./AgentRegistryAuditPanel\";\nimport { AgentHubTagsField, agentHubTagsFrom, agentHubTagsPayload, type AgentHubTag } from \"./AgentHubTagsField\";\nimport { AgentToolActivationDialog } from \"./AgentToolActivationDialog\";\nimport { AgentToolSessionsPanel } from \"../../../../components/core/extension/solid-core/agentToolRegistry/AgentToolSessionsPanel\";\nimport { AgentRegistryCardWidget } from \"../../../../components/core/extension/solid-core/agentRegistry/card/AgentRegistryCardWidget\";\nimport { SolidButton, SolidCodeEditor, SolidDialog, SolidDialogBody, SolidIconPicker, SolidInput, SolidTabGroup } from \"../../../../components/shad-cn-ui\";\nimport \"./AgentToolRegistryEditorPage.css\";\n\nconst SharedAgentRegistryCard = AgentRegistryCardWidget as React.ComponentType<{ rowData: Record<string, any> }>;\n\ntype Agent = { id?: number | string; name?: string; title?: string; [key: string]: any };\ntype AgentToolLink = { agentRegistry?: Agent | number | string | null };\ntype ToolRecord = {\n id: number;\n name?: string;\n iconName?: string | null;\n description?: string;\n tags?: AgentHubTag[];\n type?: string;\n status?: string | null;\n lastLoadError?: string | null;\n sourceCode?: string;\n checksum?: string;\n agentTools?: AgentToolLink[] | AgentToolLink | null;\n};\n\nfunction extractEntityRecord(response: unknown): Record<string, any> | undefined {\n let candidate: unknown = response;\n for (let depth = 0; depth < 3; depth += 1) {\n if (!candidate || typeof candidate !== \"object\") return undefined;\n const value = candidate as Record<string, unknown>;\n if (\"id\" in value || \"name\" in value) return value;\n candidate = value.data;\n }\n return candidate && typeof candidate === \"object\" ? candidate as Record<string, any> : undefined;\n}\n\nasync function sha256Hex(value: string): Promise<string> {\n const digest = await crypto.subtle.digest(\"SHA-256\", new TextEncoder().encode(value));\n return Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, \"0\")).join(\"\");\n}\n\nfunction formatErrorMessage(value: unknown): string | undefined {\n if (typeof value === \"string\") return value.trim() || undefined;\n if (Array.isArray(value)) {\n const messages = value.map(formatErrorMessage).filter((message): message is string => Boolean(message));\n return messages.length ? messages.join(\"; \") : undefined;\n }\n if (value && typeof value === \"object\") {\n const error = value as Record<string, unknown>;\n return formatErrorMessage(error.message)\n ?? formatErrorMessage(error.constraints)\n ?? formatErrorMessage(error.error);\n }\n return undefined;\n}\n\nfunction getSaveErrorMessage(error: unknown): string {\n if (!error || typeof error !== \"object\") return \"Failed to save tool.\";\n const apiError = error as Record<string, any>;\n return formatErrorMessage(apiError.data?.data?.message)\n ?? formatErrorMessage(apiError.data?.message)\n ?? formatErrorMessage(apiError.data?.error)\n ?? formatErrorMessage(apiError.message)\n ?? \"Failed to save tool.\";\n}\n\nexport function AgentToolRegistryEditorPage() {\n const { id = \"\" } = useParams<{ id: string }>();\n const navigate = useNavigate();\n const dispatch = useDispatch();\n const entityApi = React.useMemo(() => createSolidEntityApi(\"agentToolRegistry\"), []);\n const { useCreateSolidEntityMutation, useGetSolidEntityByIdQuery, useUpdateSolidEntityMutation } = entityApi;\n const { data: response, isLoading, isFetching, refetch } = useGetSolidEntityByIdQuery(\n { id, qs: \"populate[0]=agentTools&populate[1]=agentTools.agentRegistry&populate[2]=tags\" },\n { skip: !id || id === \"new\" },\n );\n const [createTool, { isLoading: isCreating }] = useCreateSolidEntityMutation();\n const [updateTool, { isLoading: isSaving }] = useUpdateSolidEntityMutation();\n const record = extractEntityRecord(response) as ToolRecord | undefined;\n const [activeTab, setActiveTab] = React.useState(\"general\");\n const [name, setName] = React.useState(\"\");\n const [iconName, setIconName] = React.useState(\"\");\n const [description, setDescription] = React.useState(\"\");\n const [type, setType] = React.useState(\"custom\");\n const [sourceCode, setSourceCode] = React.useState(\"\");\n const [tags, setTags] = React.useState<AgentHubTag[]>([]);\n const [creatingTag, setCreatingTag] = React.useState(false);\n const [fieldErrors, setFieldErrors] = React.useState<Record<string, string>>({});\n const [auditRefreshVersion, setAuditRefreshVersion] = React.useState(0);\n const [confirmRefresh, setConfirmRefresh] = React.useState(false);\n const [activationOpen, setActivationOpen] = React.useState(false);\n const [activationTool, setActivationTool] = React.useState<{ id: number; checksum: string; name: string } | null>(null);\n const preparingActivation = React.useRef(false);\n const baseline = React.useRef(\"\");\n\n const currentForm = () => JSON.stringify({ name, iconName, description, type, sourceCode, tags });\n\n React.useEffect(() => {\n const nextTags = agentHubTagsFrom(record?.tags);\n setName(record?.name ?? \"\");\n setIconName(record?.iconName ?? \"\");\n setDescription(record?.description ?? \"\");\n setType(record?.type ?? \"custom\");\n setSourceCode(record?.sourceCode ?? \"\");\n setTags(nextTags);\n baseline.current = JSON.stringify({ name: record?.name ?? \"\", iconName: record?.iconName ?? \"\", description: record?.description ?? \"\", type: record?.type ?? \"custom\", sourceCode: record?.sourceCode ?? \"\", tags: nextTags });\n }, [record]);\n\n const isReadOnly = record?.type === \"solidx\";\n const isDirty = Boolean(record?.id) && currentForm() !== baseline.current;\n const requestRefresh = () => isDirty ? setConfirmRefresh(true) : void refetch();\n\n const save = async (nextStatus?: \"inactive\") => {\n if (creatingTag) return;\n const nextErrors: Record<string, string> = {};\n if (!name.trim()) nextErrors.name = \"Name is required.\";\n if (!description.trim()) nextErrors.description = \"Description is required.\";\n if (!type.trim()) nextErrors.type = \"Tool type is required.\";\n if (!sourceCode.trim()) nextErrors.sourceCode = \"Tool source code is required.\";\n\n setFieldErrors(nextErrors);\n if (Object.keys(nextErrors).length > 0) {\n setActiveTab(nextErrors.sourceCode ? \"tool\" : \"general\");\n dispatch(showToast({ severity: \"error\", summary: \"Missing information\", detail: Object.values(nextErrors).join(\" \") }));\n return;\n }\n const payload = {\n name: name.trim(), iconName: iconName || null, description: description.trim(), type,\n sourceCode, ...agentHubTagsPayload(tags),\n ...([\"custom\", \"thirdparty\"].includes(type) ? { checksum: await sha256Hex(sourceCode) } : {}),\n status: nextStatus ?? (record && (sourceCode !== record.sourceCode || name.trim() !== record.name || type !== record.type)\n ? \"inactive\" : record?.status ?? \"inactive\"),\n };\n try {\n if (record?.id) {\n const result = await updateTool({ id: record.id, data: payload }).unwrap();\n dispatch(showToast({ severity: \"success\", summary: nextStatus ? \"Tool status updated\" : \"Saved\", detail: nextStatus ? `Tool moved to ${nextStatus}. Restart linked agent processes to apply the change.` : \"Tool updated successfully.\" }));\n setAuditRefreshVersion((version) => version + 1);\n refetch();\n return (extractEntityRecord(result) ?? { ...record, ...payload }) as ToolRecord;\n } else {\n const result: any = await createTool(payload).unwrap();\n const createdId = result?.data?.id ?? result?.id;\n dispatch(showToast({ severity: \"success\", summary: \"Created\", detail: \"Tool created successfully.\" }));\n if (createdId) navigate(`/admin/core/solid-core/agent-tool-registry/editor/${createdId}`, { replace: true });\n }\n } catch (error: any) {\n const errorDetail = getSaveErrorMessage(error);\n const serverFieldErrors: Record<string, string> = {};\n if (/required|not be empty|cannot be empty|should not be empty/i.test(errorDetail)) {\n for (const field of [\"name\", \"description\", \"type\", \"sourceCode\"]) {\n if (!new RegExp(`\\\\b${field}\\\\b`, \"i\").test(errorDetail)) continue;\n const label = field === \"sourceCode\" ? \"Tool source code\" : field[0].toUpperCase() + field.slice(1);\n serverFieldErrors[field] = `${label} is required.`;\n }\n }\n if (Object.keys(serverFieldErrors).length > 0) {\n setFieldErrors(serverFieldErrors);\n setActiveTab(serverFieldErrors.sourceCode ? \"tool\" : \"general\");\n }\n dispatch(showToast({ severity: \"error\", summary: \"Save failed\", detail: errorDetail }));\n }\n };\n\n const beginActivation = async () => {\n if (isReadOnly) return;\n if (!record || activationOpen || isSaving || preparingActivation.current) return;\n preparingActivation.current = true;\n try {\n const saved = isDirty || record.status === \"load_failed\" ? await save(\"inactive\") : record;\n if (!saved?.id) return;\n const checksum = await sha256Hex(saved.sourceCode ?? sourceCode);\n setActivationTool({ id: saved.id, checksum, name: saved.name ?? name });\n setActivationOpen(true);\n } catch {\n dispatch(showToast({ severity: \"error\", summary: \"Activation failed\", detail: \"Could not prepare the saved tool source for checks.\" }));\n } finally {\n preparingActivation.current = false;\n }\n };\n\n const agents = React.useMemo(() => {\n const relatedTools = record?.agentTools;\n const links = Array.isArray(relatedTools) ? relatedTools : relatedTools ? [relatedTools] : [];\n const seen = new Set<string>();\n return links.map((link) => link.agentRegistry).filter((agent): agent is Agent => Boolean(agent && typeof agent === \"object\"))\n .filter((agent) => {\n const key = String(agent.id ?? agent.name ?? agent.title ?? \"\");\n if (!key || seen.has(key)) return false;\n seen.add(key);\n return true;\n });\n }, [record?.agentTools]);\n const sessionAgents = React.useMemo(() => agents.filter((agent): agent is Agent & { id: number | string } => agent.id !== undefined && agent.id !== null), [agents]);\n const tabs = [\n { value: \"general\", label: \"General Info\", content: <fieldset className=\"agent-tool-editor__general\" disabled={isReadOnly}>\n {isReadOnly && <p className=\"agent-tool-editor__readonly-note\">SolidX tools are seeded by the AgentHub runtime and cannot be edited.</p>}\n {record?.status && <section className={`agent-tool-editor__runtime-status${record.status === \"load_failed\" ? \" agent-tool-editor__runtime-status--failed\" : \"\"}`} role={record.status === \"load_failed\" ? \"alert\" : \"status\"}>\n <div className=\"agent-tool-editor__runtime-heading\"><strong>Runtime status</strong><span>{record.status.replace(/[_-]+/g, \" \")}</span></div>\n {record.status === \"load_failed\" ? <>\n <p>The AgentHub runtime could not load this tool. After correcting its source or checksum, restart linked agent processes so the runtime retries loading it.</p>\n {record.lastLoadError && <pre>{record.lastLoadError}</pre>}\n </> : <p>{record.lastLoadError || \"No tool load error has been reported.\"}</p>}\n </section>}\n <div className=\"agent-tool-editor__fields\">\n <label className=\"agent-tool-editor__field\"><span>Name <b>*</b></span><SolidInput value={name} aria-invalid={Boolean(fieldErrors.name)} aria-describedby={fieldErrors.name ? \"agent-tool-name-error\" : undefined} className={fieldErrors.name ? \"agent-tool-editor__input--invalid\" : undefined} onChange={(e) => { setName(e.target.value); setFieldErrors((current) => ({ ...current, name: \"\" })); }} />{fieldErrors.name && <small id=\"agent-tool-name-error\" className=\"agent-tool-editor__field-error\">{fieldErrors.name}</small>}</label>\n <div className=\"agent-tool-editor__field\"><span>Icon</span><SolidIconPicker value={iconName} onChange={setIconName} /></div>\n <label className=\"agent-tool-editor__field\"><span>Description <b>*</b></span><SolidInput value={description} aria-invalid={Boolean(fieldErrors.description)} aria-describedby={fieldErrors.description ? \"agent-tool-description-error\" : undefined} className={fieldErrors.description ? \"agent-tool-editor__input--invalid\" : undefined} onChange={(e) => { setDescription(e.target.value); setFieldErrors((current) => ({ ...current, description: \"\" })); }} />{fieldErrors.description && <small id=\"agent-tool-description-error\" className=\"agent-tool-editor__field-error\">{fieldErrors.description}</small>}</label>\n </div>\n {!record?.id && <label className=\"agent-tool-editor__field\"><span>Tool status</span><select value=\"inactive\" disabled aria-label=\"Tool status\"><option value=\"inactive\">Inactive</option></select><small>New tools start inactive. Run configuration and initialization checks to activate.</small></label>}\n <label className=\"agent-tool-editor__field\"><span>Tool type <b>*</b></span><select value={type} aria-invalid={Boolean(fieldErrors.type)} aria-describedby={fieldErrors.type ? \"agent-tool-type-error\" : undefined} className={fieldErrors.type ? \"agent-tool-editor__input--invalid\" : undefined} onChange={(e) => { setType(e.target.value); setFieldErrors((current) => ({ ...current, type: \"\" })); }}>\n {isReadOnly && <option value=\"solidx\">SolidX</option>}<option value=\"thirdparty\">Third Party</option><option value=\"custom\">Custom</option>\n </select>{fieldErrors.type && <small id=\"agent-tool-type-error\" className=\"agent-tool-editor__field-error\">{fieldErrors.type}</small>}</label>\n <AgentHubTagsField value={tags} onChange={setTags} disabled={isReadOnly || isCreating || isSaving} onBusyChange={setCreatingTag} />\n {record?.id && <section className=\"agent-tool-editor__workflow\" aria-labelledby=\"agent-tool-lifecycle-title\">\n <div className=\"agent-tool-editor__workflow-head\"><div><h2 id=\"agent-tool-lifecycle-title\">Tool lifecycle</h2><p>Configuration and initialization must pass before this tool can be activated.</p></div></div>\n <div className=\"agent-tool-editor__workflow-stages\" aria-label={`Current tool stage: ${(record.status ?? \"inactive\").replace(/[_-]+/g, \" \")}`}>\n {([ [\"active\", \"Active\", \"Enabled for loading into linked agents.\"], [\"inactive\", \"Inactive\", \"Not loaded for linked agents.\"], [\"load_failed\", \"Load failed\", \"AgentHub could not load this tool.\"] ] as const).map(([value, label, description], index) => {\n const currentStatus = record.status ?? \"inactive\";\n const isCurrent = currentStatus === value;\n const canRetry = value === \"load_failed\" && isCurrent;\n const disabled = isReadOnly || activationOpen || isCreating || isSaving || (!canRetry && (value === \"load_failed\" || isCurrent));\n return <React.Fragment key={value}>\n {index > 0 && <div className=\"agent-tool-editor__workflow-connector\" aria-hidden=\"true\" />}\n <button type=\"button\" className={`agent-tool-editor__workflow-stage agent-tool-editor__workflow-stage--${value}${isCurrent ? \" is-current\" : \"\"}`}\n aria-current={isCurrent ? \"step\" : undefined} aria-pressed={isCurrent} disabled={disabled}\n onClick={() => value === \"inactive\" ? void save(\"inactive\") : void beginActivation()}>\n <span className=\"agent-tool-editor__workflow-mark\">{index + 1}</span>\n <span className=\"agent-tool-editor__workflow-copy\"><strong>{label}</strong><small>{description}</small><small className=\"agent-tool-editor__workflow-cta\">{canRetry ? \"Run checks and retry activation\" : isCurrent ? \"Current stage\" : value === \"load_failed\" ? \"Set automatically by AgentHub\" : value === \"active\" ? \"Run checks to activate\" : \"Click to deactivate\"}</small></span>\n {isCurrent && <span className=\"agent-tool-editor__workflow-current\">Current</span>}\n </button>\n </React.Fragment>;\n })}\n </div>\n {record.status === \"load_failed\" && <small className=\"agent-tool-editor__workflow-hint\">Fix the source or checksum, then run configuration and initialization checks before retrying activation.</small>}\n <small className=\"agent-tool-editor__workflow-hint\">Activation checks use the saved tool configuration. Restart linked agent processes to apply status changes.</small>\n </section>}\n </fieldset> },\n { value: \"tool\", label: \"Tool\", content: <div className=\"agent-tool-editor__tool\">\n <section className=\"agent-tool-editor__panel\">\n <header><h2>Tool source code <b>*</b></h2><p>Write the tool's Python code here.</p></header>\n <SolidCodeEditor value={sourceCode} onChange={(value) => { setSourceCode(value ?? \"\"); setFieldErrors((current) => ({ ...current, sourceCode: \"\" })); }} language=\"python\" readOnly={isReadOnly} fontSize={11} height=\"max(32rem, calc(100dvh - 18rem))\" className={`agent-tool-editor__code${fieldErrors.sourceCode ? \" agent-tool-editor__code--invalid\" : \"\"}`} />\n {fieldErrors.sourceCode && <small className=\"agent-tool-editor__field-error agent-tool-editor__code-error\">{fieldErrors.sourceCode}</small>}\n </section>\n </div> },\n { value: \"agents\", label: \"Agents\", content: <section className=\"agent-tool-editor__agents\"><div><h2>Associated agents</h2><p>Agents linked to this tool. Associations are read-only here.</p></div>\n {isLoading ? <p>Loading associated agents…</p> : agents.length ? <div className=\"agent-tool-editor__agent-grid\">{agents.map((agent, index) => <div className=\"agent-tool-editor__agent-card\" key={String(agent.id ?? agent.name ?? index)}><SharedAgentRegistryCard rowData={agent} /></div>)}</div> : <div className=\"agent-tool-editor__empty\">No agents are currently associated with this tool.</div>}\n </section> },\n { value: \"sessions\", label: \"Sessions\", content: <AgentToolSessionsPanel agents={sessionAgents} /> },\n ];\n\n return <main className=\"agent-tool-editor\">\n <header className=\"agent-tool-editor__header\"><div><div className=\"agent-tool-editor__heading-with-refresh\"><h1>{record ? \"Edit Tool\" : \"Create Tool\"}</h1>{record?.id && <button type=\"button\" className={`agent-tool-editor__refresh${isFetching ? \" is-loading\" : \"\"}`} aria-label=\"Refresh tool\" title=\"Refresh tool\" disabled={isFetching || isSaving} onClick={requestRefresh}><RefreshCw size={14} /></button>}</div></div><div className=\"agent-tool-editor__actions\">\n <SolidButton variant=\"secondary\" leftIcon={<ArrowLeft size={16} />} onClick={() => navigate(-1)}>Back</SolidButton>\n {!isReadOnly && <SolidButton disabled={activationOpen || creatingTag} loading={isCreating || isSaving} onClick={() => void save()}>Save Tool</SolidButton>}\n </div></header>\n <SolidDialog open={confirmRefresh} onOpenChange={setConfirmRefresh} header=\"Discard unsaved changes?\" style={{ width: \"min(28rem, 94vw)\" }}\n footer={<><SolidButton type=\"button\" variant=\"secondary\" onClick={() => setConfirmRefresh(false)}>Cancel</SolidButton><SolidButton type=\"button\" disabled={isFetching} onClick={() => { setConfirmRefresh(false); void refetch(); }}>Refresh and discard</SolidButton></>}>\n <SolidDialogBody><p>You have unsaved changes. Refreshing will discard them and load the latest tool content.</p></SolidDialogBody>\n </SolidDialog>\n {activationOpen && activationTool && <AgentToolActivationDialog open={activationOpen} onOpenChange={setActivationOpen}\n toolId={activationTool.id} checksum={activationTool.checksum} toolName={activationTool.name}\n onActivated={async () => {\n await solidPatch(`/agent-tool-registry/${activationTool.id}`, { status: \"active\", checksum: activationTool.checksum });\n setAuditRefreshVersion((version) => version + 1);\n void refetch();\n dispatch(showToast({ severity: \"success\", summary: \"Tool activated\", detail: \"Configuration and initialization checks passed.\" }));\n }} />}\n {isLoading ? <div className=\"agent-tool-editor__loading\">Loading tool…</div> : record?.id ? (\n <AgentRegistryAuditPanel modelSingularName=\"agentToolRegistry\" recordId={record.id} refreshVersion={auditRefreshVersion} modelUserKey={record.name}>\n <SolidTabGroup tabs={tabs} value={activeTab} onValueChange={setActiveTab} className=\"agent-tool-editor__tabs\" listClassName=\"agent-tool-editor__tab-list\" panelClassName=\"agent-tool-editor__tab-panel\" />\n </AgentRegistryAuditPanel>\n ) : <SolidTabGroup tabs={tabs} value={activeTab} onValueChange={setActiveTab} className=\"agent-tool-editor__tabs\" listClassName=\"agent-tool-editor__tab-list\" panelClassName=\"agent-tool-editor__tab-panel\" />}\n </main>;\n}\n"]}
1
+ {"version":3,"file":"AgentToolRegistryEditorPage.js","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/AgentToolRegistryEditorPage.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,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,MAAM,CAAE,EAAE,EAAC,CAAC,CAAC,CAC1F,KAAC,uBAAuB,IAAC,iBAAiB,EAAC,mBAAmB,EAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,cAAc,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,CAAC,IAAI,YAChJ,KAAC,aAAa,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAC,yBAAyB,EAAC,aAAa,EAAC,6BAA6B,EAAC,cAAc,EAAC,8BAA8B,GAAG,GAClL,CAC3B,CAAC,CAAC,CAAC,KAAC,aAAa,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAC,yBAAyB,EAAC,aAAa,EAAC,6BAA6B,EAAC,cAAc,EAAC,8BAA8B,GAAG,IACzM,CAAC;AACV,CAAC","sourcesContent":["import React from \"react\";\nimport { ArrowLeft, RefreshCw } from \"lucide-react\";\nimport { useDispatch } from \"react-redux\";\nimport { useNavigate, useParams } from \"react-router-dom\";\nimport { createSolidEntityApi } from \"../../../../redux/api/solidEntityApi\";\nimport { showToast } from \"../../../../redux/features/toastSlice\";\nimport { solidPatch } from \"../../../../http/solidHttp\";\nimport { AgentRegistryAuditPanel } from \"./AgentRegistryAuditPanel\";\nimport { AgentHubTagsField, agentHubTagsFrom, agentHubTagsPayload, type AgentHubTag } from \"./AgentHubTagsField\";\nimport { AgentHubModuleField, agentHubModuleFrom, agentHubModulePayload, type AgentHubModule } from \"./AgentHubModuleField\";\nimport { AgentToolActivationDialog } from \"./AgentToolActivationDialog\";\nimport { AgentToolSessionsPanel } from \"../../../../components/core/extension/solid-core/agentToolRegistry/AgentToolSessionsPanel\";\nimport { AgentRegistryCardWidget } from \"../../../../components/core/extension/solid-core/agentRegistry/card/AgentRegistryCardWidget\";\nimport { SolidButton, SolidCodeEditor, SolidDialog, SolidDialogBody, SolidIconPicker, SolidInput, SolidTabGroup } from \"../../../../components/shad-cn-ui\";\nimport \"./AgentToolRegistryEditorPage.css\";\n\nconst SharedAgentRegistryCard = AgentRegistryCardWidget as React.ComponentType<{ rowData: Record<string, any> }>;\n\ntype Agent = { id?: number | string; name?: string; title?: string; [key: string]: any };\ntype AgentToolLink = { agentRegistry?: Agent | number | string | null };\ntype ToolRecord = {\n id: number;\n name?: string;\n iconName?: string | null;\n description?: string;\n tags?: AgentHubTag[];\n module?: AgentHubModule | null;\n type?: string;\n status?: string | null;\n lastLoadError?: string | null;\n sourceCode?: string;\n checksum?: string;\n agentTools?: AgentToolLink[] | AgentToolLink | null;\n};\n\nfunction extractEntityRecord(response: unknown): Record<string, any> | undefined {\n let candidate: unknown = response;\n for (let depth = 0; depth < 3; depth += 1) {\n if (!candidate || typeof candidate !== \"object\") return undefined;\n const value = candidate as Record<string, unknown>;\n if (\"id\" in value || \"name\" in value) return value;\n candidate = value.data;\n }\n return candidate && typeof candidate === \"object\" ? candidate as Record<string, any> : undefined;\n}\n\nasync function sha256Hex(value: string): Promise<string> {\n const digest = await crypto.subtle.digest(\"SHA-256\", new TextEncoder().encode(value));\n return Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, \"0\")).join(\"\");\n}\n\nfunction formatErrorMessage(value: unknown): string | undefined {\n if (typeof value === \"string\") return value.trim() || undefined;\n if (Array.isArray(value)) {\n const messages = value.map(formatErrorMessage).filter((message): message is string => Boolean(message));\n return messages.length ? messages.join(\"; \") : undefined;\n }\n if (value && typeof value === \"object\") {\n const error = value as Record<string, unknown>;\n return formatErrorMessage(error.message)\n ?? formatErrorMessage(error.constraints)\n ?? formatErrorMessage(error.error);\n }\n return undefined;\n}\n\nfunction getSaveErrorMessage(error: unknown): string {\n if (!error || typeof error !== \"object\") return \"Failed to save tool.\";\n const apiError = error as Record<string, any>;\n return formatErrorMessage(apiError.data?.data?.message)\n ?? formatErrorMessage(apiError.data?.message)\n ?? formatErrorMessage(apiError.data?.error)\n ?? formatErrorMessage(apiError.message)\n ?? \"Failed to save tool.\";\n}\n\nexport function AgentToolRegistryEditorPage() {\n const { id = \"\" } = useParams<{ id: string }>();\n const navigate = useNavigate();\n const dispatch = useDispatch();\n const entityApi = React.useMemo(() => createSolidEntityApi(\"agentToolRegistry\"), []);\n const { useCreateSolidEntityMutation, useGetSolidEntityByIdQuery, useUpdateSolidEntityMutation } = entityApi;\n const { data: response, isLoading, isFetching, refetch } = useGetSolidEntityByIdQuery(\n { id, qs: \"populate[0]=agentTools&populate[1]=agentTools.agentRegistry&populate[2]=tags&populate[3]=module\" },\n { skip: !id || id === \"new\" },\n );\n const [createTool, { isLoading: isCreating }] = useCreateSolidEntityMutation();\n const [updateTool, { isLoading: isSaving }] = useUpdateSolidEntityMutation();\n const record = extractEntityRecord(response) as ToolRecord | undefined;\n const [activeTab, setActiveTab] = React.useState(\"general\");\n const [name, setName] = React.useState(\"\");\n const [iconName, setIconName] = React.useState(\"\");\n const [description, setDescription] = React.useState(\"\");\n const [type, setType] = React.useState(\"custom\");\n const [sourceCode, setSourceCode] = React.useState(\"\");\n const [tags, setTags] = React.useState<AgentHubTag[]>([]);\n const [module, setModule] = React.useState<AgentHubModule | null>(null);\n const [creatingTag, setCreatingTag] = React.useState(false);\n const [fieldErrors, setFieldErrors] = React.useState<Record<string, string>>({});\n const [auditRefreshVersion, setAuditRefreshVersion] = React.useState(0);\n const [confirmRefresh, setConfirmRefresh] = React.useState(false);\n const [activationOpen, setActivationOpen] = React.useState(false);\n const [activationTool, setActivationTool] = React.useState<{ id: number; checksum: string; name: string } | null>(null);\n const preparingActivation = React.useRef(false);\n const baseline = React.useRef(\"\");\n\n const currentForm = () => JSON.stringify({ name, iconName, description, type, sourceCode, tags, moduleId: module?.id ?? null });\n\n React.useEffect(() => {\n const nextTags = agentHubTagsFrom(record?.tags);\n const nextModule = agentHubModuleFrom(record?.module);\n setName(record?.name ?? \"\");\n setIconName(record?.iconName ?? \"\");\n setDescription(record?.description ?? \"\");\n setType(record?.type ?? \"custom\");\n setSourceCode(record?.sourceCode ?? \"\");\n setTags(nextTags);\n setModule(nextModule);\n baseline.current = JSON.stringify({ name: record?.name ?? \"\", iconName: record?.iconName ?? \"\", description: record?.description ?? \"\", type: record?.type ?? \"custom\", sourceCode: record?.sourceCode ?? \"\", tags: nextTags, moduleId: nextModule?.id ?? null });\n }, [record]);\n\n const isReadOnly = record?.type === \"solidx\";\n const isDirty = Boolean(record?.id) && currentForm() !== baseline.current;\n const requestRefresh = () => isDirty ? setConfirmRefresh(true) : void refetch();\n\n const save = async (nextStatus?: \"inactive\") => {\n if (creatingTag) return;\n const nextErrors: Record<string, string> = {};\n if (!name.trim()) nextErrors.name = \"Name is required.\";\n if (!description.trim()) nextErrors.description = \"Description is required.\";\n if (!type.trim()) nextErrors.type = \"Tool type is required.\";\n if (!sourceCode.trim()) nextErrors.sourceCode = \"Tool source code is required.\";\n if (!module) nextErrors.module = \"Module is required. Select a module before saving this tool.\";\n\n setFieldErrors(nextErrors);\n if (Object.keys(nextErrors).length > 0) {\n setActiveTab(nextErrors.sourceCode ? \"tool\" : \"general\");\n dispatch(showToast({ severity: \"error\", summary: \"Missing information\", detail: Object.values(nextErrors).join(\" \") }));\n return;\n }\n const payload = {\n name: name.trim(), iconName: iconName || null, description: description.trim(), type,\n sourceCode, ...agentHubTagsPayload(tags), ...agentHubModulePayload(module),\n ...([\"custom\", \"thirdparty\"].includes(type) ? { checksum: await sha256Hex(sourceCode) } : {}),\n status: nextStatus ?? (record && (sourceCode !== record.sourceCode || name.trim() !== record.name || type !== record.type)\n ? \"inactive\" : record?.status ?? \"inactive\"),\n };\n try {\n if (record?.id) {\n const result = await updateTool({ id: record.id, data: payload }).unwrap();\n dispatch(showToast({ severity: \"success\", summary: nextStatus ? \"Tool status updated\" : \"Saved\", detail: nextStatus ? `Tool moved to ${nextStatus}. Restart linked agent processes to apply the change.` : \"Tool updated successfully.\" }));\n setAuditRefreshVersion((version) => version + 1);\n refetch();\n return (extractEntityRecord(result) ?? { ...record, ...payload }) as ToolRecord;\n } else {\n const result: any = await createTool(payload).unwrap();\n const createdId = result?.data?.id ?? result?.id;\n dispatch(showToast({ severity: \"success\", summary: \"Created\", detail: \"Tool created successfully.\" }));\n if (createdId) navigate(`/admin/core/solid-core/agent-tool-registry/editor/${createdId}`, { replace: true });\n }\n } catch (error: any) {\n const errorDetail = getSaveErrorMessage(error);\n const serverFieldErrors: Record<string, string> = {};\n if (/required|not be empty|cannot be empty|should not be empty/i.test(errorDetail)) {\n for (const field of [\"name\", \"description\", \"type\", \"sourceCode\", \"module\"]) {\n if (!new RegExp(`\\\\b${field}\\\\b`, \"i\").test(errorDetail)) continue;\n const label = field === \"sourceCode\" ? \"Tool source code\" : field === \"module\" ? \"Module\" : field[0].toUpperCase() + field.slice(1);\n serverFieldErrors[field] = `${label} is required.`;\n }\n }\n if (Object.keys(serverFieldErrors).length > 0) {\n setFieldErrors(serverFieldErrors);\n setActiveTab(serverFieldErrors.sourceCode ? \"tool\" : \"general\");\n }\n dispatch(showToast({ severity: \"error\", summary: \"Save failed\", detail: errorDetail }));\n }\n };\n\n const beginActivation = async () => {\n if (isReadOnly) return;\n if (!record || activationOpen || isSaving || preparingActivation.current) return;\n preparingActivation.current = true;\n try {\n const saved = isDirty || record.status === \"load_failed\" ? await save(\"inactive\") : record;\n if (!saved?.id) return;\n const checksum = await sha256Hex(saved.sourceCode ?? sourceCode);\n setActivationTool({ id: saved.id, checksum, name: saved.name ?? name });\n setActivationOpen(true);\n } catch {\n dispatch(showToast({ severity: \"error\", summary: \"Activation failed\", detail: \"Could not prepare the saved tool source for checks.\" }));\n } finally {\n preparingActivation.current = false;\n }\n };\n\n const agents = React.useMemo(() => {\n const relatedTools = record?.agentTools;\n const links = Array.isArray(relatedTools) ? relatedTools : relatedTools ? [relatedTools] : [];\n const seen = new Set<string>();\n return links.map((link) => link.agentRegistry).filter((agent): agent is Agent => Boolean(agent && typeof agent === \"object\"))\n .filter((agent) => {\n const key = String(agent.id ?? agent.name ?? agent.title ?? \"\");\n if (!key || seen.has(key)) return false;\n seen.add(key);\n return true;\n });\n }, [record?.agentTools]);\n const sessionAgents = React.useMemo(() => agents.filter((agent): agent is Agent & { id: number | string } => agent.id !== undefined && agent.id !== null), [agents]);\n const tabs = [\n { value: \"general\", label: \"General Info\", content: <fieldset className=\"agent-tool-editor__general\" disabled={isReadOnly}>\n {isReadOnly && <p className=\"agent-tool-editor__readonly-note\">SolidX tools cannot be edited.</p>}\n {record?.status && <section className={`agent-tool-editor__runtime-status${record.status === \"load_failed\" ? \" agent-tool-editor__runtime-status--failed\" : \"\"}`} role={record.status === \"load_failed\" ? \"alert\" : \"status\"}>\n <div className=\"agent-tool-editor__runtime-heading\"><strong>Runtime status</strong><span>{record.status.replace(/[_-]+/g, \" \")}</span></div>\n {record.status === \"load_failed\" ? <>\n <p>The AgentHub runtime could not load this tool. After correcting its source or checksum, restart linked agent processes so the runtime retries loading it.</p>\n {record.lastLoadError && <pre>{record.lastLoadError}</pre>}\n </> : <p>{record.lastLoadError || \"No tool load error has been reported.\"}</p>}\n </section>}\n <div className=\"agent-tool-editor__fields\">\n <label className=\"agent-tool-editor__field\"><span>Name <b>*</b></span><SolidInput value={name} aria-invalid={Boolean(fieldErrors.name)} aria-describedby={fieldErrors.name ? \"agent-tool-name-error\" : undefined} className={fieldErrors.name ? \"agent-tool-editor__input--invalid\" : undefined} onChange={(e) => { setName(e.target.value); setFieldErrors((current) => ({ ...current, name: \"\" })); }} />{fieldErrors.name && <small id=\"agent-tool-name-error\" className=\"agent-tool-editor__field-error\">{fieldErrors.name}</small>}</label>\n <div className=\"agent-tool-editor__field\"><span>Icon</span><SolidIconPicker value={iconName} onChange={setIconName} /></div>\n <label className=\"agent-tool-editor__field\"><span>Description <b>*</b></span><SolidInput value={description} aria-invalid={Boolean(fieldErrors.description)} aria-describedby={fieldErrors.description ? \"agent-tool-description-error\" : undefined} className={fieldErrors.description ? \"agent-tool-editor__input--invalid\" : undefined} onChange={(e) => { setDescription(e.target.value); setFieldErrors((current) => ({ ...current, description: \"\" })); }} />{fieldErrors.description && <small id=\"agent-tool-description-error\" className=\"agent-tool-editor__field-error\">{fieldErrors.description}</small>}</label>\n </div>\n {!record?.id && <label className=\"agent-tool-editor__field\"><span>Tool status</span><select value=\"inactive\" disabled aria-label=\"Tool status\"><option value=\"inactive\">Inactive</option></select><small>New tools start inactive. Run configuration and initialization checks to activate.</small></label>}\n <label className=\"agent-tool-editor__field\"><span>Tool type <b>*</b></span><select value={type} aria-invalid={Boolean(fieldErrors.type)} aria-describedby={fieldErrors.type ? \"agent-tool-type-error\" : undefined} className={fieldErrors.type ? \"agent-tool-editor__input--invalid\" : undefined} onChange={(e) => { setType(e.target.value); setFieldErrors((current) => ({ ...current, type: \"\" })); }}>\n {isReadOnly && <option value=\"solidx\">SolidX</option>}<option value=\"thirdparty\">Third Party</option><option value=\"custom\">Custom</option>\n </select>{fieldErrors.type && <small id=\"agent-tool-type-error\" className=\"agent-tool-editor__field-error\">{fieldErrors.type}</small>}</label>\n <AgentHubModuleField className=\"agent-tool-editor__field\" value={module} onChange={(value) => { setModule(value); setFieldErrors((current) => ({ ...current, module: \"\" })); }} disabled={isReadOnly || isCreating || isSaving} clearable={false} required error={fieldErrors.module} />\n <AgentHubTagsField value={tags} onChange={setTags} module={module} disabled={isReadOnly || isCreating || isSaving} onBusyChange={setCreatingTag} />\n {record?.id && <section className=\"agent-tool-editor__workflow\" aria-labelledby=\"agent-tool-lifecycle-title\">\n <div className=\"agent-tool-editor__workflow-head\"><div><h2 id=\"agent-tool-lifecycle-title\">Tool lifecycle</h2><p>Configuration and initialization must pass before this tool can be activated.</p></div></div>\n <div className=\"agent-tool-editor__workflow-stages\" aria-label={`Current tool stage: ${(record.status ?? \"inactive\").replace(/[_-]+/g, \" \")}`}>\n {([ [\"active\", \"Active\", \"Enabled for loading into linked agents.\"], [\"inactive\", \"Inactive\", \"Not loaded for linked agents.\"], [\"load_failed\", \"Load failed\", \"AgentHub could not load this tool.\"] ] as const).map(([value, label, description], index) => {\n const currentStatus = record.status ?? \"inactive\";\n const isCurrent = currentStatus === value;\n const canRetry = value === \"load_failed\" && isCurrent;\n const disabled = isReadOnly || activationOpen || isCreating || isSaving || (!canRetry && (value === \"load_failed\" || isCurrent));\n return <React.Fragment key={value}>\n {index > 0 && <div className=\"agent-tool-editor__workflow-connector\" aria-hidden=\"true\" />}\n <button type=\"button\" className={`agent-tool-editor__workflow-stage agent-tool-editor__workflow-stage--${value}${isCurrent ? \" is-current\" : \"\"}`}\n aria-current={isCurrent ? \"step\" : undefined} aria-pressed={isCurrent} disabled={disabled}\n onClick={() => value === \"inactive\" ? void save(\"inactive\") : void beginActivation()}>\n <span className=\"agent-tool-editor__workflow-mark\">{index + 1}</span>\n <span className=\"agent-tool-editor__workflow-copy\"><strong>{label}</strong><small>{description}</small><small className=\"agent-tool-editor__workflow-cta\">{canRetry ? \"Run checks and retry activation\" : isCurrent ? \"Current stage\" : value === \"load_failed\" ? \"Set automatically by AgentHub\" : value === \"active\" ? \"Run checks to activate\" : \"Click to deactivate\"}</small></span>\n {isCurrent && <span className=\"agent-tool-editor__workflow-current\">Current</span>}\n </button>\n </React.Fragment>;\n })}\n </div>\n {record.status === \"load_failed\" && <small className=\"agent-tool-editor__workflow-hint\">Fix the source or checksum, then run configuration and initialization checks before retrying activation.</small>}\n <small className=\"agent-tool-editor__workflow-hint\">Activation checks use the saved tool configuration. Restart linked agent processes to apply status changes.</small>\n </section>}\n </fieldset> },\n { value: \"tool\", label: \"Tool\", content: <div className=\"agent-tool-editor__tool\">\n <section className=\"agent-tool-editor__panel\">\n <header><h2>Tool source code <b>*</b></h2><p>Write the tool's Python code here.</p></header>\n <SolidCodeEditor value={sourceCode} onChange={(value) => { setSourceCode(value ?? \"\"); setFieldErrors((current) => ({ ...current, sourceCode: \"\" })); }} language=\"python\" wordWrap=\"on\" readOnly={isReadOnly} fontSize={11} height=\"max(32rem, calc(100dvh - 18rem))\" className={`agent-tool-editor__code${fieldErrors.sourceCode ? \" agent-tool-editor__code--invalid\" : \"\"}`} />\n {fieldErrors.sourceCode && <small className=\"agent-tool-editor__field-error agent-tool-editor__code-error\">{fieldErrors.sourceCode}</small>}\n </section>\n </div> },\n { value: \"agents\", label: \"Agents\", content: <section className=\"agent-tool-editor__agents\"><div><h2>Associated agents</h2><p>Agents linked to this tool. Associations are read-only here.</p></div>\n {isLoading ? <p>Loading associated agents…</p> : agents.length ? <div className=\"agent-tool-editor__agent-grid\">{agents.map((agent, index) => <div className=\"agent-tool-editor__agent-card\" key={String(agent.id ?? agent.name ?? index)}><SharedAgentRegistryCard rowData={agent} /></div>)}</div> : <div className=\"agent-tool-editor__empty\">No agents are currently associated with this tool.</div>}\n </section> },\n { value: \"sessions\", label: \"Sessions\", content: <AgentToolSessionsPanel agents={sessionAgents} /> },\n ];\n\n return <main className=\"agent-tool-editor\">\n <header className=\"agent-tool-editor__header\"><div><div className=\"agent-tool-editor__heading-with-refresh\"><h1>{record ? \"Edit Tool\" : \"Create Tool\"}</h1>{record?.id && <button type=\"button\" className={`agent-tool-editor__refresh${isFetching ? \" is-loading\" : \"\"}`} aria-label=\"Refresh tool\" title=\"Refresh tool\" disabled={isFetching || isSaving} onClick={requestRefresh}><RefreshCw size={14} /></button>}</div></div><div className=\"agent-tool-editor__actions\">\n <SolidButton variant=\"secondary\" leftIcon={<ArrowLeft size={16} />} onClick={() => navigate(-1)}>Back</SolidButton>\n {!isReadOnly && <SolidButton disabled={activationOpen || creatingTag} loading={isCreating || isSaving} onClick={() => void save()}>Save Tool</SolidButton>}\n </div></header>\n <SolidDialog open={confirmRefresh} onOpenChange={setConfirmRefresh} header=\"Discard unsaved changes?\" style={{ width: \"min(28rem, 94vw)\" }}\n footer={<><SolidButton type=\"button\" variant=\"secondary\" onClick={() => setConfirmRefresh(false)}>Cancel</SolidButton><SolidButton type=\"button\" disabled={isFetching} onClick={() => { setConfirmRefresh(false); void refetch(); }}>Refresh and discard</SolidButton></>}>\n <SolidDialogBody><p>You have unsaved changes. Refreshing will discard them and load the latest tool content.</p></SolidDialogBody>\n </SolidDialog>\n {activationOpen && activationTool && <AgentToolActivationDialog open={activationOpen} onOpenChange={setActivationOpen}\n toolId={activationTool.id} checksum={activationTool.checksum} toolName={activationTool.name}\n onActivated={async () => {\n await solidPatch(`/agent-tool-registry/${activationTool.id}`, { status: \"active\", checksum: activationTool.checksum });\n setAuditRefreshVersion((version) => version + 1);\n void refetch();\n dispatch(showToast({ severity: \"success\", summary: \"Tool activated\", detail: \"Configuration and initialization checks passed.\" }));\n }} />}\n {isLoading ? <div className=\"agent-tool-editor__loading\">Loading tool…</div> : record?.id ? (\n <AgentRegistryAuditPanel modelSingularName=\"agentToolRegistry\" recordId={record.id} refreshVersion={auditRefreshVersion} modelUserKey={record.name}>\n <SolidTabGroup tabs={tabs} value={activeTab} onValueChange={setActiveTab} className=\"agent-tool-editor__tabs\" listClassName=\"agent-tool-editor__tab-list\" panelClassName=\"agent-tool-editor__tab-panel\" />\n </AgentRegistryAuditPanel>\n ) : <SolidTabGroup tabs={tabs} value={activeTab} onValueChange={setActiveTab} className=\"agent-tool-editor__tabs\" listClassName=\"agent-tool-editor__tab-list\" panelClassName=\"agent-tool-editor__tab-panel\" />}\n </main>;\n}\n"]}
@@ -7,6 +7,7 @@ import { showToast } from "../../../../redux/features/toastSlice";
7
7
  import { solidPatch } from "../../../../http/solidHttp";
8
8
  import { AgentRegistryAuditPanel } from "./AgentRegistryAuditPanel";
9
9
  import { AgentHubTagsField, agentHubTagsFrom, agentHubTagsPayload, type AgentHubTag } from "./AgentHubTagsField";
10
+ import { AgentHubModuleField, agentHubModuleFrom, agentHubModulePayload, type AgentHubModule } from "./AgentHubModuleField";
10
11
  import { AgentToolActivationDialog } from "./AgentToolActivationDialog";
11
12
  import { AgentToolSessionsPanel } from "../../../../components/core/extension/solid-core/agentToolRegistry/AgentToolSessionsPanel";
12
13
  import { AgentRegistryCardWidget } from "../../../../components/core/extension/solid-core/agentRegistry/card/AgentRegistryCardWidget";
@@ -23,6 +24,7 @@ type ToolRecord = {
23
24
  iconName?: string | null;
24
25
  description?: string;
25
26
  tags?: AgentHubTag[];
27
+ module?: AgentHubModule | null;
26
28
  type?: string;
27
29
  status?: string | null;
28
30
  lastLoadError?: string | null;
@@ -79,7 +81,7 @@ export function AgentToolRegistryEditorPage() {
79
81
  const entityApi = React.useMemo(() => createSolidEntityApi("agentToolRegistry"), []);
80
82
  const { useCreateSolidEntityMutation, useGetSolidEntityByIdQuery, useUpdateSolidEntityMutation } = entityApi;
81
83
  const { data: response, isLoading, isFetching, refetch } = useGetSolidEntityByIdQuery(
82
- { id, qs: "populate[0]=agentTools&populate[1]=agentTools.agentRegistry&populate[2]=tags" },
84
+ { id, qs: "populate[0]=agentTools&populate[1]=agentTools.agentRegistry&populate[2]=tags&populate[3]=module" },
83
85
  { skip: !id || id === "new" },
84
86
  );
85
87
  const [createTool, { isLoading: isCreating }] = useCreateSolidEntityMutation();
@@ -92,6 +94,7 @@ export function AgentToolRegistryEditorPage() {
92
94
  const [type, setType] = React.useState("custom");
93
95
  const [sourceCode, setSourceCode] = React.useState("");
94
96
  const [tags, setTags] = React.useState<AgentHubTag[]>([]);
97
+ const [module, setModule] = React.useState<AgentHubModule | null>(null);
95
98
  const [creatingTag, setCreatingTag] = React.useState(false);
96
99
  const [fieldErrors, setFieldErrors] = React.useState<Record<string, string>>({});
97
100
  const [auditRefreshVersion, setAuditRefreshVersion] = React.useState(0);
@@ -101,17 +104,19 @@ export function AgentToolRegistryEditorPage() {
101
104
  const preparingActivation = React.useRef(false);
102
105
  const baseline = React.useRef("");
103
106
 
104
- const currentForm = () => JSON.stringify({ name, iconName, description, type, sourceCode, tags });
107
+ const currentForm = () => JSON.stringify({ name, iconName, description, type, sourceCode, tags, moduleId: module?.id ?? null });
105
108
 
106
109
  React.useEffect(() => {
107
110
  const nextTags = agentHubTagsFrom(record?.tags);
111
+ const nextModule = agentHubModuleFrom(record?.module);
108
112
  setName(record?.name ?? "");
109
113
  setIconName(record?.iconName ?? "");
110
114
  setDescription(record?.description ?? "");
111
115
  setType(record?.type ?? "custom");
112
116
  setSourceCode(record?.sourceCode ?? "");
113
117
  setTags(nextTags);
114
- baseline.current = JSON.stringify({ name: record?.name ?? "", iconName: record?.iconName ?? "", description: record?.description ?? "", type: record?.type ?? "custom", sourceCode: record?.sourceCode ?? "", tags: nextTags });
118
+ setModule(nextModule);
119
+ baseline.current = JSON.stringify({ name: record?.name ?? "", iconName: record?.iconName ?? "", description: record?.description ?? "", type: record?.type ?? "custom", sourceCode: record?.sourceCode ?? "", tags: nextTags, moduleId: nextModule?.id ?? null });
115
120
  }, [record]);
116
121
 
117
122
  const isReadOnly = record?.type === "solidx";
@@ -125,6 +130,7 @@ export function AgentToolRegistryEditorPage() {
125
130
  if (!description.trim()) nextErrors.description = "Description is required.";
126
131
  if (!type.trim()) nextErrors.type = "Tool type is required.";
127
132
  if (!sourceCode.trim()) nextErrors.sourceCode = "Tool source code is required.";
133
+ if (!module) nextErrors.module = "Module is required. Select a module before saving this tool.";
128
134
 
129
135
  setFieldErrors(nextErrors);
130
136
  if (Object.keys(nextErrors).length > 0) {
@@ -134,7 +140,7 @@ export function AgentToolRegistryEditorPage() {
134
140
  }
135
141
  const payload = {
136
142
  name: name.trim(), iconName: iconName || null, description: description.trim(), type,
137
- sourceCode, ...agentHubTagsPayload(tags),
143
+ sourceCode, ...agentHubTagsPayload(tags), ...agentHubModulePayload(module),
138
144
  ...(["custom", "thirdparty"].includes(type) ? { checksum: await sha256Hex(sourceCode) } : {}),
139
145
  status: nextStatus ?? (record && (sourceCode !== record.sourceCode || name.trim() !== record.name || type !== record.type)
140
146
  ? "inactive" : record?.status ?? "inactive"),
@@ -156,9 +162,9 @@ export function AgentToolRegistryEditorPage() {
156
162
  const errorDetail = getSaveErrorMessage(error);
157
163
  const serverFieldErrors: Record<string, string> = {};
158
164
  if (/required|not be empty|cannot be empty|should not be empty/i.test(errorDetail)) {
159
- for (const field of ["name", "description", "type", "sourceCode"]) {
165
+ for (const field of ["name", "description", "type", "sourceCode", "module"]) {
160
166
  if (!new RegExp(`\\b${field}\\b`, "i").test(errorDetail)) continue;
161
- const label = field === "sourceCode" ? "Tool source code" : field[0].toUpperCase() + field.slice(1);
167
+ const label = field === "sourceCode" ? "Tool source code" : field === "module" ? "Module" : field[0].toUpperCase() + field.slice(1);
162
168
  serverFieldErrors[field] = `${label} is required.`;
163
169
  }
164
170
  }
@@ -202,7 +208,7 @@ export function AgentToolRegistryEditorPage() {
202
208
  const sessionAgents = React.useMemo(() => agents.filter((agent): agent is Agent & { id: number | string } => agent.id !== undefined && agent.id !== null), [agents]);
203
209
  const tabs = [
204
210
  { value: "general", label: "General Info", content: <fieldset className="agent-tool-editor__general" disabled={isReadOnly}>
205
- {isReadOnly && <p className="agent-tool-editor__readonly-note">SolidX tools are seeded by the AgentHub runtime and cannot be edited.</p>}
211
+ {isReadOnly && <p className="agent-tool-editor__readonly-note">SolidX tools cannot be edited.</p>}
206
212
  {record?.status && <section className={`agent-tool-editor__runtime-status${record.status === "load_failed" ? " agent-tool-editor__runtime-status--failed" : ""}`} role={record.status === "load_failed" ? "alert" : "status"}>
207
213
  <div className="agent-tool-editor__runtime-heading"><strong>Runtime status</strong><span>{record.status.replace(/[_-]+/g, " ")}</span></div>
208
214
  {record.status === "load_failed" ? <>
@@ -219,7 +225,8 @@ export function AgentToolRegistryEditorPage() {
219
225
  <label className="agent-tool-editor__field"><span>Tool type <b>*</b></span><select value={type} aria-invalid={Boolean(fieldErrors.type)} aria-describedby={fieldErrors.type ? "agent-tool-type-error" : undefined} className={fieldErrors.type ? "agent-tool-editor__input--invalid" : undefined} onChange={(e) => { setType(e.target.value); setFieldErrors((current) => ({ ...current, type: "" })); }}>
220
226
  {isReadOnly && <option value="solidx">SolidX</option>}<option value="thirdparty">Third Party</option><option value="custom">Custom</option>
221
227
  </select>{fieldErrors.type && <small id="agent-tool-type-error" className="agent-tool-editor__field-error">{fieldErrors.type}</small>}</label>
222
- <AgentHubTagsField value={tags} onChange={setTags} disabled={isReadOnly || isCreating || isSaving} onBusyChange={setCreatingTag} />
228
+ <AgentHubModuleField className="agent-tool-editor__field" value={module} onChange={(value) => { setModule(value); setFieldErrors((current) => ({ ...current, module: "" })); }} disabled={isReadOnly || isCreating || isSaving} clearable={false} required error={fieldErrors.module} />
229
+ <AgentHubTagsField value={tags} onChange={setTags} module={module} disabled={isReadOnly || isCreating || isSaving} onBusyChange={setCreatingTag} />
223
230
  {record?.id && <section className="agent-tool-editor__workflow" aria-labelledby="agent-tool-lifecycle-title">
224
231
  <div className="agent-tool-editor__workflow-head"><div><h2 id="agent-tool-lifecycle-title">Tool lifecycle</h2><p>Configuration and initialization must pass before this tool can be activated.</p></div></div>
225
232
  <div className="agent-tool-editor__workflow-stages" aria-label={`Current tool stage: ${(record.status ?? "inactive").replace(/[_-]+/g, " ")}`}>
@@ -247,7 +254,7 @@ export function AgentToolRegistryEditorPage() {
247
254
  { value: "tool", label: "Tool", content: <div className="agent-tool-editor__tool">
248
255
  <section className="agent-tool-editor__panel">
249
256
  <header><h2>Tool source code <b>*</b></h2><p>Write the tool's Python code here.</p></header>
250
- <SolidCodeEditor value={sourceCode} onChange={(value) => { setSourceCode(value ?? ""); setFieldErrors((current) => ({ ...current, sourceCode: "" })); }} language="python" readOnly={isReadOnly} fontSize={11} height="max(32rem, calc(100dvh - 18rem))" className={`agent-tool-editor__code${fieldErrors.sourceCode ? " agent-tool-editor__code--invalid" : ""}`} />
257
+ <SolidCodeEditor value={sourceCode} onChange={(value) => { setSourceCode(value ?? ""); setFieldErrors((current) => ({ ...current, sourceCode: "" })); }} language="python" wordWrap="on" readOnly={isReadOnly} fontSize={11} height="max(32rem, calc(100dvh - 18rem))" className={`agent-tool-editor__code${fieldErrors.sourceCode ? " agent-tool-editor__code--invalid" : ""}`} />
251
258
  {fieldErrors.sourceCode && <small className="agent-tool-editor__field-error agent-tool-editor__code-error">{fieldErrors.sourceCode}</small>}
252
259
  </section>
253
260
  </div> },
@@ -1 +1 @@
1
- {"version":3,"file":"ArchivedChatterMessagesPage.d.ts","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/ArchivedChatterMessagesPage.tsx"],"names":[],"mappings":"AASA,wBAAgB,2BAA2B,4CAsF1C"}
1
+ {"version":3,"file":"ArchivedChatterMessagesPage.d.ts","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/ArchivedChatterMessagesPage.tsx"],"names":[],"mappings":"AA+CA,wBAAgB,2BAA2B,4CAkQ1C"}