@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
@@ -0,0 +1,15 @@
1
+ .agent-hub-module-field > span b {
2
+ color: #dc2626;
3
+ }
4
+
5
+ .agent-hub-module-field__select--invalid {
6
+ border-color: #ef4444 !important;
7
+ box-shadow: 0 0 0 1px #fecaca inset;
8
+ }
9
+
10
+ .agent-hub-module-field__error {
11
+ color: #dc2626 !important;
12
+ font-size: 0.75rem;
13
+ font-weight: 400;
14
+ line-height: 1.35;
15
+ }
@@ -0,0 +1,22 @@
1
+ import "./AgentHubModuleField.css";
2
+ export type AgentHubModule = {
3
+ id: number;
4
+ name: string;
5
+ displayName?: string;
6
+ };
7
+ export declare function agentHubModuleFrom(value: unknown): AgentHubModule | null;
8
+ export declare function agentHubModulePayload(module: AgentHubModule | null): {
9
+ moduleId: number;
10
+ } | {
11
+ moduleId?: undefined;
12
+ };
13
+ export declare function AgentHubModuleField({ value, onChange, className, disabled, clearable, required, error }: {
14
+ value: AgentHubModule | null;
15
+ onChange: (module: AgentHubModule | null) => void;
16
+ className?: string;
17
+ disabled?: boolean;
18
+ clearable?: boolean;
19
+ required?: boolean;
20
+ error?: string;
21
+ }): import("react/jsx-runtime").JSX.Element;
22
+ //# sourceMappingURL=AgentHubModuleField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentHubModuleField.d.ts","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/AgentHubModuleField.tsx"],"names":[],"mappings":"AAEA,OAAO,2BAA2B,CAAC;AAEnC,MAAM,MAAM,cAAc,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAKxE;AAID,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI;;;;EAElE;AAID,wBAAgB,mBAAmB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAgB,EAAE,SAAgB,EAAE,QAAgB,EAAE,KAAK,EAAE,EAAE;IAC/H,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;IAC7B,QAAQ,EAAE,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,CAAC;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,2CAwBA"}
@@ -0,0 +1,42 @@
1
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3
+ if (ar || !(i in from)) {
4
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
5
+ ar[i] = from[i];
6
+ }
7
+ }
8
+ return to.concat(ar || Array.prototype.slice.call(from));
9
+ };
10
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
11
+ import React from "react";
12
+ import { createSolidEntityApi } from "../../../../redux/api/solidEntityApi";
13
+ import "./AgentHubModuleField.css";
14
+ export function agentHubModuleFrom(value) {
15
+ var module = value;
16
+ var id = Number(module === null || module === void 0 ? void 0 : module.id);
17
+ if (!Number.isInteger(id) || id <= 0 || typeof (module === null || module === void 0 ? void 0 : module.name) !== "string")
18
+ return null;
19
+ return { id: id, name: module.name, displayName: typeof module.displayName === "string" ? module.displayName : undefined };
20
+ }
21
+ // Mirrors the generic many-to-one form field: the backend resolves `moduleId` into the `module` relation.
22
+ // An empty moduleId is ignored by the backend, so an existing module can be changed but not cleared.
23
+ export function agentHubModulePayload(module) {
24
+ return module ? { moduleId: module.id } : {};
25
+ }
26
+ var moduleApi = createSolidEntityApi("moduleMetadata");
27
+ export function AgentHubModuleField(_a) {
28
+ var _b;
29
+ var value = _a.value, onChange = _a.onChange, className = _a.className, _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.clearable, clearable = _d === void 0 ? true : _d, _e = _a.required, required = _e === void 0 ? false : _e, error = _a.error;
30
+ var _f = moduleApi.useGetSolidEntitiesQuery("offset=0&limit=1000&fields[0]=id&fields[1]=name&fields[2]=displayName", { skip: disabled }), data = _f.data, isFetching = _f.isFetching, isError = _f.isError, refetch = _f.refetch;
31
+ var records = data === null || data === void 0 ? void 0 : data.records;
32
+ var catalog = (Array.isArray(records) ? records : [])
33
+ .map(agentHubModuleFrom)
34
+ .filter(function (module) { return Boolean(module); });
35
+ var options = value && !catalog.some(function (module) { return module.id === value.id; }) ? __spreadArray([value], catalog, true) : catalog;
36
+ var label = function (module) { return module.displayName || module.name; };
37
+ var fieldId = React.useId();
38
+ return _jsxs("label", { className: ["agent-hub-module-field", className].filter(Boolean).join(" "), htmlFor: fieldId, children: [_jsxs("span", { children: ["Module", required && _jsxs(_Fragment, { children: [" ", _jsx("b", { "aria-hidden": "true", children: "*" })] })] }), _jsxs("select", { id: fieldId, value: (_b = value === null || value === void 0 ? void 0 : value.id) !== null && _b !== void 0 ? _b : "", disabled: disabled || isFetching, "aria-invalid": Boolean(error), "aria-describedby": error ? "".concat(fieldId, "-error") : undefined, className: error ? "agent-hub-module-field__select--invalid" : undefined, onChange: function (event) { var _a; return onChange((_a = options.find(function (module) { return module.id === Number(event.target.value); })) !== null && _a !== void 0 ? _a : null); }, children: [_jsx("option", { value: "", disabled: !clearable, children: isFetching ? "Loading modules…" : "No module" }), __spreadArray([], options, true).sort(function (a, b) { return label(a).localeCompare(label(b)); }).map(function (module) {
39
+ return _jsx("option", { value: module.id, children: label(module) }, module.id);
40
+ })] }), error && _jsx("small", { id: "".concat(fieldId, "-error"), className: "agent-hub-module-field__error", role: "alert", children: error }), isError && _jsxs("small", { role: "alert", children: ["Modules could not be loaded. ", _jsx("button", { type: "button", onClick: function () { return void refetch(); }, children: "Retry" })] })] });
41
+ }
42
+ //# sourceMappingURL=AgentHubModuleField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentHubModuleField.js","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/AgentHubModuleField.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,2BAA2B,CAAC;AAInC,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,IAAM,MAAM,GAAG,KAAmD,CAAC;IACnE,IAAM,EAAE,GAAG,MAAM,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,EAAE,CAAC,CAAC;IAC9B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,OAAO,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CAAA,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACtF,OAAO,EAAE,EAAE,IAAA,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,MAAM,CAAC,WAAW,K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AE,CAAC,IAAK,OAAA,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAhC,CAAgC,CAAC,CAAC,GAAG,CAAC,UAAC,MAAM;wBACxE,OAAA,iBAAwB,KAAK,EAAE,MAAM,CAAC,EAAE,YAAG,KAAK,CAAC,MAAM,CAAC,IAA3C,MAAM,CAAC,EAAE,CAA4C;oBAAlE,CAAkE,CAAC,IAC9D,EACR,KAAK,IAAI,gBAAO,EAAE,EAAE,UAAG,OAAO,WAAQ,EAAE,SAAS,EAAC,+BAA+B,EAAC,IAAI,EAAC,OAAO,YAAE,KAAK,GAAS,EAC9G,OAAO,IAAI,iBAAO,IAAI,EAAC,OAAO,8CAA8B,iBAAQ,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,cAAM,OAAA,KAAK,OAAO,EAAE,EAAd,CAAc,sBAAgB,IAAQ,IAClI,CAAC;AACX,CAAC","sourcesContent":["import React from \"react\";\nimport { createSolidEntityApi } from \"../../../../redux/api/solidEntityApi\";\nimport \"./AgentHubModuleField.css\";\n\nexport type AgentHubModule = { id: number; name: string; displayName?: string };\n\nexport function agentHubModuleFrom(value: unknown): AgentHubModule | null {\n const module = value as Record<string, unknown> | null | undefined;\n const id = Number(module?.id);\n if (!Number.isInteger(id) || id <= 0 || typeof module?.name !== \"string\") return null;\n return { id, name: module.name, displayName: typeof module.displayName === \"string\" ? module.displayName : undefined };\n}\n\n// Mirrors the generic many-to-one form field: the backend resolves `moduleId` into the `module` relation.\n// An empty moduleId is ignored by the backend, so an existing module can be changed but not cleared.\nexport function agentHubModulePayload(module: AgentHubModule | null) {\n return module ? { moduleId: module.id } : {};\n}\n\nconst moduleApi = createSolidEntityApi(\"moduleMetadata\");\n\nexport function AgentHubModuleField({ value, onChange, className, disabled = false, clearable = true, required = false, error }: {\n value: AgentHubModule | null;\n onChange: (module: AgentHubModule | null) => void;\n className?: string;\n disabled?: boolean;\n clearable?: boolean;\n required?: boolean;\n error?: string;\n}) {\n const { data, isFetching, isError, refetch } = moduleApi.useGetSolidEntitiesQuery(\n \"offset=0&limit=1000&fields[0]=id&fields[1]=name&fields[2]=displayName\", { skip: disabled });\n const records = data?.records;\n const catalog = (Array.isArray(records) ? records : [])\n .map(agentHubModuleFrom)\n .filter((module): module is AgentHubModule => Boolean(module));\n const options = value && !catalog.some((module) => module.id === value.id) ? [value, ...catalog] : catalog;\n const label = (module: AgentHubModule) => module.displayName || module.name;\n const fieldId = React.useId();\n\n return <label className={[\"agent-hub-module-field\", className].filter(Boolean).join(\" \")} htmlFor={fieldId}>\n <span>Module{required && <> <b aria-hidden=\"true\">*</b></>}</span>\n <select id={fieldId} value={value?.id ?? \"\"} disabled={disabled || isFetching}\n aria-invalid={Boolean(error)} aria-describedby={error ? `${fieldId}-error` : undefined}\n className={error ? \"agent-hub-module-field__select--invalid\" : undefined}\n onChange={(event) => onChange(options.find((module) => module.id === Number(event.target.value)) ?? null)}>\n <option value=\"\" disabled={!clearable}>{isFetching ? \"Loading modules…\" : \"No module\"}</option>\n {[...options].sort((a, b) => label(a).localeCompare(label(b))).map((module) =>\n <option key={module.id} value={module.id}>{label(module)}</option>)}\n </select>\n {error && <small id={`${fieldId}-error`} className=\"agent-hub-module-field__error\" role=\"alert\">{error}</small>}\n {isError && <small role=\"alert\">Modules could not be loaded. <button type=\"button\" onClick={() => void refetch()}>Retry</button></small>}\n </label>;\n}\n"]}
@@ -0,0 +1,54 @@
1
+ import React from "react";
2
+ import { createSolidEntityApi } from "../../../../redux/api/solidEntityApi";
3
+ import "./AgentHubModuleField.css";
4
+
5
+ export type AgentHubModule = { id: number; name: string; displayName?: string };
6
+
7
+ export function agentHubModuleFrom(value: unknown): AgentHubModule | null {
8
+ const module = value as Record<string, unknown> | null | undefined;
9
+ const id = Number(module?.id);
10
+ if (!Number.isInteger(id) || id <= 0 || typeof module?.name !== "string") return null;
11
+ return { id, name: module.name, displayName: typeof module.displayName === "string" ? module.displayName : undefined };
12
+ }
13
+
14
+ // Mirrors the generic many-to-one form field: the backend resolves `moduleId` into the `module` relation.
15
+ // An empty moduleId is ignored by the backend, so an existing module can be changed but not cleared.
16
+ export function agentHubModulePayload(module: AgentHubModule | null) {
17
+ return module ? { moduleId: module.id } : {};
18
+ }
19
+
20
+ const moduleApi = createSolidEntityApi("moduleMetadata");
21
+
22
+ export function AgentHubModuleField({ value, onChange, className, disabled = false, clearable = true, required = false, error }: {
23
+ value: AgentHubModule | null;
24
+ onChange: (module: AgentHubModule | null) => void;
25
+ className?: string;
26
+ disabled?: boolean;
27
+ clearable?: boolean;
28
+ required?: boolean;
29
+ error?: string;
30
+ }) {
31
+ const { data, isFetching, isError, refetch } = moduleApi.useGetSolidEntitiesQuery(
32
+ "offset=0&limit=1000&fields[0]=id&fields[1]=name&fields[2]=displayName", { skip: disabled });
33
+ const records = data?.records;
34
+ const catalog = (Array.isArray(records) ? records : [])
35
+ .map(agentHubModuleFrom)
36
+ .filter((module): module is AgentHubModule => Boolean(module));
37
+ const options = value && !catalog.some((module) => module.id === value.id) ? [value, ...catalog] : catalog;
38
+ const label = (module: AgentHubModule) => module.displayName || module.name;
39
+ const fieldId = React.useId();
40
+
41
+ return <label className={["agent-hub-module-field", className].filter(Boolean).join(" ")} htmlFor={fieldId}>
42
+ <span>Module{required && <> <b aria-hidden="true">*</b></>}</span>
43
+ <select id={fieldId} value={value?.id ?? ""} disabled={disabled || isFetching}
44
+ aria-invalid={Boolean(error)} aria-describedby={error ? `${fieldId}-error` : undefined}
45
+ className={error ? "agent-hub-module-field__select--invalid" : undefined}
46
+ onChange={(event) => onChange(options.find((module) => module.id === Number(event.target.value)) ?? null)}>
47
+ <option value="" disabled={!clearable}>{isFetching ? "Loading modules…" : "No module"}</option>
48
+ {[...options].sort((a, b) => label(a).localeCompare(label(b))).map((module) =>
49
+ <option key={module.id} value={module.id}>{label(module)}</option>)}
50
+ </select>
51
+ {error && <small id={`${fieldId}-error`} className="agent-hub-module-field__error" role="alert">{error}</small>}
52
+ {isError && <small role="alert">Modules could not be loaded. <button type="button" onClick={() => void refetch()}>Retry</button></small>}
53
+ </label>;
54
+ }
@@ -1,3 +1,4 @@
1
+ import type { AgentHubModule } from "./AgentHubModuleField";
1
2
  import "./AgentHubTagsField.css";
2
3
  export type AgentHubTag = {
3
4
  id: number;
@@ -8,9 +9,10 @@ export declare function agentHubTagsPayload(tags: AgentHubTag[]): {
8
9
  tagsIds: number[];
9
10
  tagsCommand: string;
10
11
  };
11
- export declare function AgentHubTagsField({ value, onChange, disabled, onBusyChange }: {
12
+ export declare function AgentHubTagsField({ value, onChange, module, disabled, onBusyChange }: {
12
13
  value: AgentHubTag[];
13
14
  onChange: (tags: AgentHubTag[]) => void;
15
+ module: AgentHubModule | null;
14
16
  disabled?: boolean;
15
17
  onBusyChange?: (busy: boolean) => void;
16
18
  }): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"AgentHubTagsField.d.ts","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/AgentHubTagsField.tsx"],"names":[],"mappings":"AAIA,OAAO,yBAAyB,CAAC;AAEjC,MAAM,MAAM,WAAW,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,EAAE,CAS9D;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,WAAW,EAAE;;;EAEtD;AAID,wBAAgB,iBAAiB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAgB,EAAE,YAAY,EAAE,EAAE;IACrF,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC,2CA8FA"}
1
+ {"version":3,"file":"AgentHubTagsField.d.ts","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/AgentHubTagsField.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,yBAAyB,CAAC;AAEjC,MAAM,MAAM,WAAW,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,EAAE,CAS9D;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,WAAW,EAAE;;;EAEtD;AAID,wBAAgB,iBAAiB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAgB,EAAE,YAAY,EAAE,EAAE;IAC7F,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,IAAI,CAAC;IACxC,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC,2CAgGA"}
@@ -67,7 +67,7 @@ export function agentHubTagsPayload(tags) {
67
67
  var tagApi = createSolidEntityApi("agentHubTag");
68
68
  export function AgentHubTagsField(_a) {
69
69
  var _this = this;
70
- var value = _a.value, onChange = _a.onChange, _b = _a.disabled, disabled = _b === void 0 ? false : _b, onBusyChange = _a.onBusyChange;
70
+ var value = _a.value, onChange = _a.onChange, module = _a.module, _b = _a.disabled, disabled = _b === void 0 ? false : _b, onBusyChange = _a.onBusyChange;
71
71
  var _c = tagApi.useGetSolidEntitiesQuery("offset=0&limit=1000&fields[0]=id&fields[1]=name", { skip: disabled }), data = _c.data, isFetching = _c.isFetching, isError = _c.isError, refetch = _c.refetch;
72
72
  var _d = tagApi.useCreateSolidEntityMutation(), createTag = _d[0], isCreating = _d[1].isLoading;
73
73
  var _e = React.useState(""), query = _e[0], setQuery = _e[1];
@@ -110,7 +110,7 @@ export function AgentHubTagsField(_a) {
110
110
  _g.label = 1;
111
111
  case 1:
112
112
  _g.trys.push([1, 3, 5, 6]);
113
- return [4 /*yield*/, createTag({ name: name }).unwrap()];
113
+ return [4 /*yield*/, createTag({ name: name, moduleId: module === null || module === void 0 ? void 0 : module.id }).unwrap()];
114
114
  case 2:
115
115
  result = _g.sent();
116
116
  for (depth = 0; depth < 3 && result && !result.id; depth += 1)
@@ -164,7 +164,7 @@ export function AgentHubTagsField(_a) {
164
164
  else
165
165
  void add();
166
166
  }
167
- } }), name && _jsx(SolidButton, { variant: "secondary", size: "small", loading: isCreating, disabled: !exact && !canCreate, onClick: function () { return void add(); }, leftIcon: _jsx(Plus, { size: 14 }), children: exact ? "Select" : "Create tag" })] }), isError && _jsxs("div", { className: "agent-hub-tags__error", role: "alert", children: ["Tags could not be loaded. ", _jsx("button", { type: "button", onClick: function () { return void refetch(); }, children: "Retry" })] }), open && _jsx("div", { className: "agent-hub-tags__options", id: "".concat(fieldId, "-options"), role: "listbox", "aria-label": "Available tags", children: isFetching ? _jsx("div", { className: "agent-hub-tags__empty", role: "status", children: "Loading tags\u2026" })
167
+ } }), name && _jsx(SolidButton, { variant: "secondary", size: "small", loading: isCreating, disabled: !exact && !canCreate, tooltip: isFetching ? "Wait for tag lookup to finish." : isError ? "Retry tag lookup before creating a tag." : undefined, onClick: function () { return void add(); }, leftIcon: _jsx(Plus, { size: 14 }), children: exact ? "Select" : "Create tag" })] }), isError && _jsxs("div", { className: "agent-hub-tags__error", role: "alert", children: ["Tags could not be loaded. ", _jsx("button", { type: "button", onClick: function () { return void refetch(); }, children: "Retry" })] }), open && _jsx("div", { className: "agent-hub-tags__options", id: "".concat(fieldId, "-options"), role: "listbox", "aria-label": "Available tags", children: isFetching ? _jsx("div", { className: "agent-hub-tags__empty", role: "status", children: "Loading tags\u2026" })
168
168
  : options.length ? options.map(function (tag, index) { return _jsxs("button", { id: "".concat(fieldId, "-option-").concat(index), type: "button", role: "option", "aria-selected": false, disabled: isCreating, className: activeIndex === index ? "is-active" : undefined, onMouseDown: function (event) { return event.preventDefault(); }, onClick: function () { return select(tag); }, children: [tag.name, _jsx(Plus, { size: 14 })] }, tag.id); })
169
169
  : !isError && _jsx("div", { className: "agent-hub-tags__empty", children: exact ? "Tag already selected." : canCreate ? "Create \u201C".concat(name, "\u201D to add it.") : "No tags available. Type a name to create one." }) }), error && _jsx("small", { className: "agent-hub-tags__error", role: "alert", children: error }), _jsx("small", { className: "agent-hub-tags__hint", children: "Tags are shared across agents, skills, and tools." })] })] });
170
170
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AgentHubTagsField.js","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/AgentHubTagsField.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC5E,OAAO,yBAAyB,CAAC;AAIjC,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACrC,IAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,OAAO,KAAK,CAAC,OAAO,CAAC,UAAC,GAAG;QACvB,IAAM,EAAE,GAAG,MAAM,CAAC,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,EAAE,CAAC,CAAC;QAC3B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE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c,CAAC,CAAC,CAAC,+CAA+C,GAAO,GAC1L,EACL,KAAK,IAAI,gBAAO,SAAS,EAAC,uBAAuB,EAAC,IAAI,EAAC,OAAO,YAAE,KAAK,GAAS,EAC/E,gBAAO,SAAS,EAAC,sBAAsB,kEAA0D,IAChG,IACC,CAAC;AACT,CAAC","sourcesContent":["import React from \"react\";\nimport { Plus, Search, X } from \"lucide-react\";\nimport { createSolidEntityApi } from \"../../../../redux/api/solidEntityApi\";\nimport { SolidButton } from \"../../../../components/shad-cn-ui/SolidButton\";\nimport \"./AgentHubTagsField.css\";\n\nexport type AgentHubTag = { id: number; name: string };\n\nexport function agentHubTagsFrom(value: unknown): AgentHubTag[] {\n if (!Array.isArray(value)) return [];\n const seen = new Set<number>();\n return value.flatMap((tag) => {\n const id = Number(tag?.id);\n if (!Number.isInteger(id) || id <= 0 || typeof tag?.name !== \"string\" || seen.has(id)) return [];\n seen.add(id);\n return [{ id, name: tag.name }];\n });\n}\n\nexport function agentHubTagsPayload(tags: AgentHubTag[]) {\n return { tagsIds: tags.map((tag) => tag.id), tagsCommand: tags.length ? \"set\" : \"clear\" };\n}\n\nconst tagApi = createSolidEntityApi(\"agentHubTag\");\n\nexport function AgentHubTagsField({ value, onChange, disabled = false, onBusyChange }: {\n value: AgentHubTag[];\n onChange: (tags: AgentHubTag[]) => void;\n disabled?: boolean;\n onBusyChange?: (busy: boolean) => void;\n}) {\n const { data, isFetching, isError, refetch } = tagApi.useGetSolidEntitiesQuery(\n \"offset=0&limit=1000&fields[0]=id&fields[1]=name\", { skip: disabled });\n const [createTag, { isLoading: isCreating }] = tagApi.useCreateSolidEntityMutation();\n const [query, setQuery] = React.useState(\"\");\n const [open, setOpen] = React.useState(false);\n const [activeIndex, setActiveIndex] = React.useState(-1);\n const [error, setError] = React.useState(\"\");\n const inputRef = React.useRef<HTMLInputElement>(null);\n const fieldId = React.useId();\n const name = query.trim();\n const catalog = agentHubTagsFrom(data?.records);\n const exact = [...catalog, ...value].find((tag) => tag.name.toLowerCase() === name.toLowerCase());\n const options = catalog.filter((tag) => !value.some((selected) => selected.id === tag.id)\n && tag.name.toLowerCase().includes(name.toLowerCase())).sort((a, b) => a.name.localeCompare(b.name));\n const canCreate = Boolean(name && !exact && !isFetching && !isError);\n\n const select = (tag: AgentHubTag) => {\n if (!value.some((selected) => selected.id === tag.id)) onChange([...value, tag]);\n setQuery(\"\");\n setActiveIndex(-1);\n setError(\"\");\n inputRef.current?.focus();\n };\n\n const add = async () => {\n if (disabled || isCreating || !name) return;\n if (exact) { select(exact); return; }\n if (!canCreate) return;\n setError(\"\");\n onBusyChange?.(true);\n try {\n let result = await createTag({ name }).unwrap();\n for (let depth = 0; depth < 3 && result && !result.id; depth += 1) result = result.data;\n const created = agentHubTagsFrom([result])[0];\n if (!created) throw new Error(\"The tag could not be loaded. Search for it again.\");\n select(created);\n } catch (failure: any) {\n const refreshed = await refetch();\n const existing = agentHubTagsFrom(refreshed.data?.records).find((tag) => tag.name.toLowerCase() === name.toLowerCase());\n if (existing) select(existing);\n else {\n const message = failure?.data?.data?.message ?? failure?.data?.message ?? failure?.message;\n setError(typeof message === \"string\" ? message : \"Could not create this tag. Try again.\");\n }\n } finally {\n onBusyChange?.(false);\n }\n };\n\n return <div className=\"agent-hub-tags\" onBlur={(event) => {\n if (!event.currentTarget.contains(event.relatedTarget as Node | null)) setOpen(false);\n }}>\n <label htmlFor={fieldId}>Tags <span className=\"agent-hub-tags__count\">{value.length}</span></label>\n <div className=\"agent-hub-tags__selection\">\n {value.map((tag) => <span className=\"agent-hub-tags__chip\" key={tag.id}>{tag.name}\n {!disabled && <button type=\"button\" disabled={isCreating} aria-label={`Remove ${tag.name}`}\n onClick={() => onChange(value.filter((selected) => selected.id !== tag.id))}><X size={13} /></button>}\n </span>)}\n {!value.length && <span className=\"agent-hub-tags__empty\">No tags selected</span>}\n </div>\n {!disabled && <>\n <div className=\"agent-hub-tags__search\">\n <Search size={16} aria-hidden=\"true\" />\n <input ref={inputRef} id={fieldId} role=\"combobox\" autoComplete=\"off\" aria-expanded={open}\n aria-controls={`${fieldId}-options`} aria-autocomplete=\"list\"\n aria-activedescendant={open && options[activeIndex] ? `${fieldId}-option-${activeIndex}` : undefined}\n disabled={isCreating} value={query} placeholder=\"Search or create tags…\"\n onFocus={() => setOpen(true)}\n onChange={(event) => { setQuery(event.target.value); setActiveIndex(-1); setOpen(true); setError(\"\"); }}\n onKeyDown={(event) => {\n if (event.key === \"Escape\") { event.preventDefault(); setOpen(false); }\n if (event.key === \"ArrowDown\") { event.preventDefault(); setOpen(true); setActiveIndex((index) => Math.min(index + 1, options.length - 1)); }\n if (event.key === \"ArrowUp\") { event.preventDefault(); setActiveIndex((index) => Math.max(index - 1, 0)); }\n if (event.key === \"Enter\") { event.preventDefault(); if (open && options[activeIndex]) select(options[activeIndex]); else void add(); }\n }} />\n {name && <SolidButton variant=\"secondary\" size=\"small\" loading={isCreating}\n disabled={!exact && !canCreate} onClick={() => void add()} leftIcon={<Plus size={14} />}>\n {exact ? \"Select\" : \"Create tag\"}\n </SolidButton>}\n </div>\n {isError && <div className=\"agent-hub-tags__error\" role=\"alert\">Tags could not be loaded. <button type=\"button\" onClick={() => void refetch()}>Retry</button></div>}\n {open && <div className=\"agent-hub-tags__options\" id={`${fieldId}-options`} role=\"listbox\" aria-label=\"Available tags\">\n {isFetching ? <div className=\"agent-hub-tags__empty\" role=\"status\">Loading tags…</div>\n : options.length ? options.map((tag, index) => <button key={tag.id} id={`${fieldId}-option-${index}`}\n type=\"button\" role=\"option\" aria-selected={false} disabled={isCreating}\n className={activeIndex === index ? \"is-active\" : undefined}\n onMouseDown={(event) => event.preventDefault()} onClick={() => select(tag)}>{tag.name}<Plus size={14} /></button>)\n : !isError && <div className=\"agent-hub-tags__empty\">{exact ? \"Tag already selected.\" : canCreate ? `Create “${name}” to add it.` : \"No tags available. Type a name to create one.\"}</div>}\n </div>}\n {error && <small className=\"agent-hub-tags__error\" role=\"alert\">{error}</small>}\n <small className=\"agent-hub-tags__hint\">Tags are shared across agents, skills, and tools.</small>\n </>}\n </div>;\n}\n"]}
1
+ {"version":3,"file":"AgentHubTagsField.js","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/AgentHubTagsField.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAE5E,OAAO,yBAAyB,CAAC;AAIjC,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACrC,IAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,OAAO,KAAK,CAAC,OAAO,CAAC,UAAC,GAAG;QACvB,IAAM,EAAE,GAAG,MAAM,CAAC,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,EAAE,CAAC,CAAC;QAC3B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,OAAO,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,CAAA,KAAK,QAAQ,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YAAE,OAAO,EAAE,CAAC;QACjG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACb,OAAO,CAAC,EAAE,EAAE,IAAA,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,IAAmB;IACrD,OAAO,EAAE,OAAO,EAAE,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\"react\";\nimport { Plus, Search, X } from \"lucide-react\";\nimport { createSolidEntityApi } from \"../../../../redux/api/solidEntityApi\";\nimport { SolidButton } from \"../../../../components/shad-cn-ui/SolidButton\";\nimport type { AgentHubModule } from \"./AgentHubModuleField\";\nimport \"./AgentHubTagsField.css\";\n\nexport type AgentHubTag = { id: number; name: string };\n\nexport function agentHubTagsFrom(value: unknown): AgentHubTag[] {\n if (!Array.isArray(value)) return [];\n const seen = new Set<number>();\n return value.flatMap((tag) => {\n const id = Number(tag?.id);\n if (!Number.isInteger(id) || id <= 0 || typeof tag?.name !== \"string\" || seen.has(id)) return [];\n seen.add(id);\n return [{ id, name: tag.name }];\n });\n}\n\nexport function agentHubTagsPayload(tags: AgentHubTag[]) {\n return { tagsIds: tags.map((tag) => tag.id), tagsCommand: tags.length ? \"set\" : \"clear\" };\n}\n\nconst tagApi = createSolidEntityApi(\"agentHubTag\");\n\nexport function AgentHubTagsField({ value, onChange, module, disabled = false, onBusyChange }: {\n value: AgentHubTag[];\n onChange: (tags: AgentHubTag[]) => void;\n module: AgentHubModule | null;\n disabled?: boolean;\n onBusyChange?: (busy: boolean) => void;\n}) {\n const { data, isFetching, isError, refetch } = tagApi.useGetSolidEntitiesQuery(\n \"offset=0&limit=1000&fields[0]=id&fields[1]=name\", { skip: disabled });\n const [createTag, { isLoading: isCreating }] = tagApi.useCreateSolidEntityMutation();\n const [query, setQuery] = React.useState(\"\");\n const [open, setOpen] = React.useState(false);\n const [activeIndex, setActiveIndex] = React.useState(-1);\n const [error, setError] = React.useState(\"\");\n const inputRef = React.useRef<HTMLInputElement>(null);\n const fieldId = React.useId();\n const name = query.trim();\n const catalog = agentHubTagsFrom(data?.records);\n const exact = [...catalog, ...value].find((tag) => tag.name.toLowerCase() === name.toLowerCase());\n const options = catalog.filter((tag) => !value.some((selected) => selected.id === tag.id)\n && tag.name.toLowerCase().includes(name.toLowerCase())).sort((a, b) => a.name.localeCompare(b.name));\n const canCreate = Boolean(name && !exact && !isFetching && !isError);\n\n const select = (tag: AgentHubTag) => {\n if (!value.some((selected) => selected.id === tag.id)) onChange([...value, tag]);\n setQuery(\"\");\n setActiveIndex(-1);\n setError(\"\");\n inputRef.current?.focus();\n };\n\n const add = async () => {\n if (disabled || isCreating || !name) return;\n if (exact) { select(exact); return; }\n if (!canCreate) return;\n setError(\"\");\n onBusyChange?.(true);\n try {\n let result = await createTag({ name, moduleId: module?.id }).unwrap();\n for (let depth = 0; depth < 3 && result && !result.id; depth += 1) result = result.data;\n const created = agentHubTagsFrom([result])[0];\n if (!created) throw new Error(\"The tag could not be loaded. Search for it again.\");\n select(created);\n } catch (failure: any) {\n const refreshed = await refetch();\n const existing = agentHubTagsFrom(refreshed.data?.records).find((tag) => tag.name.toLowerCase() === name.toLowerCase());\n if (existing) select(existing);\n else {\n const message = failure?.data?.data?.message ?? failure?.data?.message ?? failure?.message;\n setError(typeof message === \"string\" ? message : \"Could not create this tag. Try again.\");\n }\n } finally {\n onBusyChange?.(false);\n }\n };\n\n return <div className=\"agent-hub-tags\" onBlur={(event) => {\n if (!event.currentTarget.contains(event.relatedTarget as Node | null)) setOpen(false);\n }}>\n <label htmlFor={fieldId}>Tags <span className=\"agent-hub-tags__count\">{value.length}</span></label>\n <div className=\"agent-hub-tags__selection\">\n {value.map((tag) => <span className=\"agent-hub-tags__chip\" key={tag.id}>{tag.name}\n {!disabled && <button type=\"button\" disabled={isCreating} aria-label={`Remove ${tag.name}`}\n onClick={() => onChange(value.filter((selected) => selected.id !== tag.id))}><X size={13} /></button>}\n </span>)}\n {!value.length && <span className=\"agent-hub-tags__empty\">No tags selected</span>}\n </div>\n {!disabled && <>\n <div className=\"agent-hub-tags__search\">\n <Search size={16} aria-hidden=\"true\" />\n <input ref={inputRef} id={fieldId} role=\"combobox\" autoComplete=\"off\" aria-expanded={open}\n aria-controls={`${fieldId}-options`} aria-autocomplete=\"list\"\n aria-activedescendant={open && options[activeIndex] ? `${fieldId}-option-${activeIndex}` : undefined}\n disabled={isCreating} value={query} placeholder=\"Search or create tags…\"\n onFocus={() => setOpen(true)}\n onChange={(event) => { setQuery(event.target.value); setActiveIndex(-1); setOpen(true); setError(\"\"); }}\n onKeyDown={(event) => {\n if (event.key === \"Escape\") { event.preventDefault(); setOpen(false); }\n if (event.key === \"ArrowDown\") { event.preventDefault(); setOpen(true); setActiveIndex((index) => Math.min(index + 1, options.length - 1)); }\n if (event.key === \"ArrowUp\") { event.preventDefault(); setActiveIndex((index) => Math.max(index - 1, 0)); }\n if (event.key === \"Enter\") { event.preventDefault(); if (open && options[activeIndex]) select(options[activeIndex]); else void add(); }\n }} />\n {name && <SolidButton variant=\"secondary\" size=\"small\" loading={isCreating}\n disabled={!exact && !canCreate}\n tooltip={isFetching ? \"Wait for tag lookup to finish.\" : isError ? \"Retry tag lookup before creating a tag.\" : undefined}\n onClick={() => void add()} leftIcon={<Plus size={14} />}>\n {exact ? \"Select\" : \"Create tag\"}\n </SolidButton>}\n </div>\n {isError && <div className=\"agent-hub-tags__error\" role=\"alert\">Tags could not be loaded. <button type=\"button\" onClick={() => void refetch()}>Retry</button></div>}\n {open && <div className=\"agent-hub-tags__options\" id={`${fieldId}-options`} role=\"listbox\" aria-label=\"Available tags\">\n {isFetching ? <div className=\"agent-hub-tags__empty\" role=\"status\">Loading tags…</div>\n : options.length ? options.map((tag, index) => <button key={tag.id} id={`${fieldId}-option-${index}`}\n type=\"button\" role=\"option\" aria-selected={false} disabled={isCreating}\n className={activeIndex === index ? \"is-active\" : undefined}\n onMouseDown={(event) => event.preventDefault()} onClick={() => select(tag)}>{tag.name}<Plus size={14} /></button>)\n : !isError && <div className=\"agent-hub-tags__empty\">{exact ? \"Tag already selected.\" : canCreate ? `Create “${name}” to add it.` : \"No tags available. Type a name to create one.\"}</div>}\n </div>}\n {error && <small className=\"agent-hub-tags__error\" role=\"alert\">{error}</small>}\n <small className=\"agent-hub-tags__hint\">Tags are shared across agents, skills, and tools.</small>\n </>}\n </div>;\n}\n"]}
@@ -2,6 +2,7 @@ import React from "react";
2
2
  import { Plus, Search, X } from "lucide-react";
3
3
  import { createSolidEntityApi } from "../../../../redux/api/solidEntityApi";
4
4
  import { SolidButton } from "../../../../components/shad-cn-ui/SolidButton";
5
+ import type { AgentHubModule } from "./AgentHubModuleField";
5
6
  import "./AgentHubTagsField.css";
6
7
 
7
8
  export type AgentHubTag = { id: number; name: string };
@@ -23,9 +24,10 @@ export function agentHubTagsPayload(tags: AgentHubTag[]) {
23
24
 
24
25
  const tagApi = createSolidEntityApi("agentHubTag");
25
26
 
26
- export function AgentHubTagsField({ value, onChange, disabled = false, onBusyChange }: {
27
+ export function AgentHubTagsField({ value, onChange, module, disabled = false, onBusyChange }: {
27
28
  value: AgentHubTag[];
28
29
  onChange: (tags: AgentHubTag[]) => void;
30
+ module: AgentHubModule | null;
29
31
  disabled?: boolean;
30
32
  onBusyChange?: (busy: boolean) => void;
31
33
  }) {
@@ -60,7 +62,7 @@ export function AgentHubTagsField({ value, onChange, disabled = false, onBusyCha
60
62
  setError("");
61
63
  onBusyChange?.(true);
62
64
  try {
63
- let result = await createTag({ name }).unwrap();
65
+ let result = await createTag({ name, moduleId: module?.id }).unwrap();
64
66
  for (let depth = 0; depth < 3 && result && !result.id; depth += 1) result = result.data;
65
67
  const created = agentHubTagsFrom([result])[0];
66
68
  if (!created) throw new Error("The tag could not be loaded. Search for it again.");
@@ -105,7 +107,9 @@ export function AgentHubTagsField({ value, onChange, disabled = false, onBusyCha
105
107
  if (event.key === "Enter") { event.preventDefault(); if (open && options[activeIndex]) select(options[activeIndex]); else void add(); }
106
108
  }} />
107
109
  {name && <SolidButton variant="secondary" size="small" loading={isCreating}
108
- disabled={!exact && !canCreate} onClick={() => void add()} leftIcon={<Plus size={14} />}>
110
+ disabled={!exact && !canCreate}
111
+ tooltip={isFetching ? "Wait for tag lookup to finish." : isError ? "Retry tag lookup before creating a tag." : undefined}
112
+ onClick={() => void add()} leftIcon={<Plus size={14} />}>
109
113
  {exact ? "Select" : "Create tag"}
110
114
  </SolidButton>}
111
115
  </div>
@@ -1 +1 @@
1
- {"version":3,"file":"AgentRegistryEditorPage.d.ts","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/AgentRegistryEditorPage.tsx"],"names":[],"mappings":"AAqBA,OAAO,+BAA+B,CAAC;AAuTvC,wBAAgB,uBAAuB,4CAuYtC"}
1
+ {"version":3,"file":"AgentRegistryEditorPage.d.ts","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/AgentRegistryEditorPage.tsx"],"names":[],"mappings":"AAsBA,OAAO,+BAA+B,CAAC;AAuTvC,wBAAgB,uBAAuB,4CA4YtC"}
@@ -66,6 +66,7 @@ import { showToast } from "../../../../redux/features/toastSlice";
66
66
  import { AgentRegistryAuditPanel } from "./AgentRegistryAuditPanel";
67
67
  import { AgentPersonaHistory } from "./AgentPersonaHistory";
68
68
  import { AgentHubTagsField, agentHubTagsFrom, agentHubTagsPayload } from "./AgentHubTagsField";
69
+ import { AgentHubModuleField, agentHubModuleFrom, agentHubModulePayload } from "./AgentHubModuleField";
69
70
  import { AgentResourceCardWidget } from "../../../../components/core/extension/solid-core/agentRegistry/card/AgentResourceCardWidget";
70
71
  import { AgentSessionsPanel } from "../../../../components/core/extension/solid-core/agentToolRegistry/AgentToolSessionsPanel";
71
72
  import { AgentProcessesPanel } from "../../../../components/core/extension/solid-core/agentToolRegistry/AgentProcessesPanel";
@@ -172,7 +173,7 @@ var detailFields = [
172
173
  "reasoningModelKey", "fastModelKey", "status", "stepLimit", "turnStepLimit", "costLimit", "configVersion",
173
174
  ];
174
175
  var detailQuery = [
175
- "agentRoles", "agentRoles.roleMetadata", "agentSecrets", "agentSecrets.secret", "tags",
176
+ "agentRoles", "agentRoles.roleMetadata", "agentSecrets", "agentSecrets.secret", "tags", "module",
176
177
  ].map(function (name, index) { return "populate[".concat(index, "]=").concat(name); }).join("&") + "&" + fieldsQuery(detailFields);
177
178
  // Group by link ID to project summary columns without populating full registry records.
178
179
  function resourceLinksQuery(id, relation, registry, setting, fields) {
@@ -204,7 +205,7 @@ function recordFrom(value) {
204
205
  }
205
206
  function items(value) { return Array.isArray(value) ? value : value ? [value] : []; }
206
207
  function agentFormFromRecord(record) {
207
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
208
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
208
209
  var skills = items(record.agentSkills);
209
210
  var tools = items(record.agentTools);
210
211
  var secrets = items(record.agentSecrets);
@@ -212,7 +213,7 @@ function agentFormFromRecord(record) {
212
213
  name: (_a = record.name) !== null && _a !== void 0 ? _a : "", title: (_b = record.title) !== null && _b !== void 0 ? _b : "", description: (_c = record.description) !== null && _c !== void 0 ? _c : "", iconName: (_d = record.iconName) !== null && _d !== void 0 ? _d : "",
213
214
  inputs: parseInputs(record.requiredInputs), reasoningModelKey: (_e = record.reasoningModelKey) !== null && _e !== void 0 ? _e : "", fastModelKey: (_f = record.fastModelKey) !== null && _f !== void 0 ? _f : "",
214
215
  systemPrompt: (_g = record.systemPrompt) !== null && _g !== void 0 ? _g : "", stepLimit: (_h = record.stepLimit) !== null && _h !== void 0 ? _h : 100, turnStepLimit: (_j = record.turnStepLimit) !== null && _j !== void 0 ? _j : 20,
215
- costLimit: Number((_k = record.costLimit) !== null && _k !== void 0 ? _k : 3), tags: agentHubTagsFrom(record.tags), skillIds: skills.map(function (link) { var _a; return (_a = link.agentSkillRegistry) === null || _a === void 0 ? void 0 : _a.id; }).filter(Boolean),
216
+ costLimit: Number((_k = record.costLimit) !== null && _k !== void 0 ? _k : 3), tags: agentHubTagsFrom(record.tags), moduleId: (_m = (_l = agentHubModuleFrom(record.module)) === null || _l === void 0 ? void 0 : _l.id) !== null && _m !== void 0 ? _m : null, skillIds: skills.map(function (link) { var _a; return (_a = link.agentSkillRegistry) === null || _a === void 0 ? void 0 : _a.id; }).filter(Boolean),
216
217
  toolIds: tools.map(function (link) { var _a; return (_a = link.agentToolRegistry) === null || _a === void 0 ? void 0 : _a.id; }).filter(Boolean),
217
218
  roleIds: items(record.agentRoles).map(function (link) { var _a; return (_a = link.roleMetadata) === null || _a === void 0 ? void 0 : _a.id; }).filter(Boolean),
218
219
  secretIds: secrets.map(function (link) { var _a; return (_a = link.secret) === null || _a === void 0 ? void 0 : _a.id; }).filter(Boolean),
@@ -388,22 +389,26 @@ export function AgentRegistryEditorPage() {
388
389
  var _10 = React.useState(20), turnStepLimit = _10[0], setTurnStepLimit = _10[1];
389
390
  var _11 = React.useState(3), costLimit = _11[0], setCostLimit = _11[1];
390
391
  var _12 = React.useState([]), tags = _12[0], setTags = _12[1];
391
- var _13 = React.useState(false), creatingTag = _13[0], setCreatingTag = _13[1];
392
- var _14 = React.useState([]), skillIds = _14[0], setSkillIds = _14[1];
393
- var _15 = React.useState([]), toolIds = _15[0], setToolIds = _15[1];
394
- var _16 = React.useState([]), roleIds = _16[0], setRoleIds = _16[1];
395
- var _17 = React.useState([]), secretIds = _17[0], setSecretIds = _17[1];
396
- var _18 = React.useState({}), alwaysIncludeValues = _18[0], setAlwaysIncludeValues = _18[1];
397
- var _19 = React.useState({}), requiresApprovalValues = _19[0], setRequiresApprovalValues = _19[1];
398
- var _20 = React.useState({}), secretEnvVarNames = _20[0], setSecretEnvVarNames = _20[1];
399
- var _21 = React.useState(null), pendingSecret = _21[0], setPendingSecret = _21[1];
400
- var _22 = React.useState(""), secretEnvVarDraft = _22[0], setSecretEnvVarDraft = _22[1];
401
- var _23 = React.useState(""), secretEnvVarError = _23[0], setSecretEnvVarError = _23[1];
402
- var _24 = React.useState({}), errors = _24[0], setErrors = _24[1];
403
- var _25 = React.useState(0), auditVersion = _25[0], setAuditVersion = _25[1];
404
- var _26 = React.useState(false), confirmRefresh = _26[0], setConfirmRefresh = _26[1];
392
+ var _13 = React.useState(null), module = _13[0], setModule = _13[1];
393
+ var _14 = React.useState(false), creatingTag = _14[0], setCreatingTag = _14[1];
394
+ var _15 = React.useState([]), skillIds = _15[0], setSkillIds = _15[1];
395
+ var _16 = React.useState([]), toolIds = _16[0], setToolIds = _16[1];
396
+ var _17 = React.useState([]), roleIds = _17[0], setRoleIds = _17[1];
397
+ var _18 = React.useState([]), secretIds = _18[0], setSecretIds = _18[1];
398
+ var _19 = React.useState({}), alwaysIncludeValues = _19[0], setAlwaysIncludeValues = _19[1];
399
+ var _20 = React.useState({}), requiresApprovalValues = _20[0], setRequiresApprovalValues = _20[1];
400
+ var _21 = React.useState({}), secretEnvVarNames = _21[0], setSecretEnvVarNames = _21[1];
401
+ var _22 = React.useState(null), pendingSecret = _22[0], setPendingSecret = _22[1];
402
+ var _23 = React.useState(""), secretEnvVarDraft = _23[0], setSecretEnvVarDraft = _23[1];
403
+ var _24 = React.useState(""), secretEnvVarError = _24[0], setSecretEnvVarError = _24[1];
404
+ var _25 = React.useState({}), errors = _25[0], setErrors = _25[1];
405
+ var _26 = React.useState(0), auditVersion = _26[0], setAuditVersion = _26[1];
406
+ var _27 = React.useState(false), confirmRefresh = _27[0], setConfirmRefresh = _27[1];
405
407
  var baseline = React.useRef("");
406
- var currentForm = function () { return JSON.stringify({ name: name, title: title, description: description, iconName: iconName, inputs: inputs, reasoningModelKey: reasoningModelKey, fastModelKey: fastModelKey, systemPrompt: systemPrompt, stepLimit: Number(stepLimit), turnStepLimit: Number(turnStepLimit), costLimit: Number(costLimit), tags: tags, skillIds: skillIds, toolIds: toolIds, roleIds: roleIds, secretIds: secretIds, alwaysIncludeValues: alwaysIncludeValues, requiresApprovalValues: requiresApprovalValues, secretEnvVarNames: secretEnvVarNames }); };
408
+ var currentForm = function () {
409
+ var _a;
410
+ return JSON.stringify({ name: name, title: title, description: description, iconName: iconName, inputs: inputs, reasoningModelKey: reasoningModelKey, fastModelKey: fastModelKey, systemPrompt: systemPrompt, stepLimit: Number(stepLimit), turnStepLimit: Number(turnStepLimit), costLimit: Number(costLimit), tags: tags, moduleId: (_a = module === null || module === void 0 ? void 0 : module.id) !== null && _a !== void 0 ? _a : null, skillIds: skillIds, toolIds: toolIds, roleIds: roleIds, secretIds: secretIds, alwaysIncludeValues: alwaysIncludeValues, requiresApprovalValues: requiresApprovalValues, secretEnvVarNames: secretEnvVarNames });
411
+ };
407
412
  React.useEffect(function () {
408
413
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
409
414
  if (!record)
@@ -421,6 +426,7 @@ export function AgentRegistryEditorPage() {
421
426
  setTurnStepLimit((_j = record.turnStepLimit) !== null && _j !== void 0 ? _j : 20);
422
427
  setCostLimit(Number((_k = record.costLimit) !== null && _k !== void 0 ? _k : 3));
423
428
  setTags(agentHubTagsFrom(record.tags));
429
+ setModule(agentHubModuleFrom(record.module));
424
430
  setSkillIds(items(record.agentSkills).map(function (link) { var _a; return (_a = link.agentSkillRegistry) === null || _a === void 0 ? void 0 : _a.id; }).filter(Boolean));
425
431
  setToolIds(items(record.agentTools).map(function (link) { var _a; return (_a = link.agentToolRegistry) === null || _a === void 0 ? void 0 : _a.id; }).filter(Boolean));
426
432
  setRoleIds(items(record.agentRoles).map(function (link) { var _a; return (_a = link.roleMetadata) === null || _a === void 0 ? void 0 : _a.id; }).filter(Boolean));
@@ -454,7 +460,7 @@ export function AgentRegistryEditorPage() {
454
460
  try {
455
461
  aiConfig = (_a = (typeof configValue === "string" ? JSON.parse(configValue) : configValue)) !== null && _a !== void 0 ? _a : {};
456
462
  }
457
- catch ( /* Invalid configuration has no enabled providers. */_27) { /* Invalid configuration has no enabled providers. */ }
463
+ catch ( /* Invalid configuration has no enabled providers. */_28) { /* Invalid configuration has no enabled providers. */ }
458
464
  var modelsCatalog = useModelsDevCatalog().catalog;
459
465
  var savedModelKeys = [record === null || record === void 0 ? void 0 : record.reasoningModelKey, record === null || record === void 0 ? void 0 : record.fastModelKey].filter(function (key) { return !!key; });
460
466
  var modelOptions = buildModelOptions((_b = aiConfig.providers) !== null && _b !== void 0 ? _b : {}, { Reasoning: (_d = (_c = aiConfig.models) === null || _c === void 0 ? void 0 : _c.default) !== null && _d !== void 0 ? _d : (_e = aiConfig.models) === null || _e === void 0 ? void 0 : _e.main, Fast: (_f = aiConfig.models) === null || _f === void 0 ? void 0 : _f.fast }, modelsCatalog, savedModelKeys);
@@ -502,15 +508,15 @@ export function AgentRegistryEditorPage() {
502
508
  case 4:
503
509
  _loop_1 = function (targetId) {
504
510
  var values, existing;
505
- var _d;
506
- return __generator(this, function (_e) {
507
- switch (_e.label) {
511
+ var _d, _e;
512
+ return __generator(this, function (_f) {
513
+ switch (_f.label) {
508
514
  case 0:
509
515
  values = typeof extra === "function" ? extra(targetId) : extra;
510
516
  if (!!oldIds.includes(targetId)) return [3 /*break*/, 2];
511
517
  return [4 /*yield*/, create(__assign((_d = { agentRegistryId: agentId }, _d["".concat(field, "Id")] = targetId, _d), values)).unwrap()];
512
518
  case 1:
513
- _e.sent();
519
+ _f.sent();
514
520
  return [2 /*return*/, "continue"];
515
521
  case 2:
516
522
  existing = links.find(function (link) { var _a; return ((_a = link[field]) === null || _a === void 0 ? void 0 : _a.id) === targetId; });
@@ -518,10 +524,10 @@ export function AgentRegistryEditorPage() {
518
524
  var key = _a[0], value = _a[1];
519
525
  return existing[key] !== value;
520
526
  }))) return [3 /*break*/, 4];
521
- return [4 /*yield*/, update({ id: existing.id, data: values }).unwrap()];
527
+ return [4 /*yield*/, update({ id: existing.id, data: __assign((_e = { agentRegistryId: agentId }, _e["".concat(field, "Id")] = targetId, _e), values) }).unwrap()];
522
528
  case 3:
523
- _e.sent();
524
- _e.label = 4;
529
+ _f.sent();
530
+ _f.label = 4;
525
531
  case 4: return [2 /*return*/];
526
532
  }
527
533
  });
@@ -556,6 +562,8 @@ export function AgentRegistryEditorPage() {
556
562
  next.name = "Name is required.";
557
563
  if (!title.trim())
558
564
  next.title = "Title is required.";
565
+ if (!module)
566
+ next.module = "Module is required. Select a module before saving this agent.";
559
567
  if (!systemPrompt.trim())
560
568
  next.systemPrompt = "Persona instructions are required.";
561
569
  if (!isValidModelKey(reasoningModelKey))
@@ -583,7 +591,7 @@ export function AgentRegistryEditorPage() {
583
591
  setTab("basics");
584
592
  return [2 /*return*/];
585
593
  }
586
- payload = __assign(__assign({ name: name.trim(), title: title.trim(), description: description.trim(), iconName: iconName, requiredInputs: JSON.stringify(normalizedInputs), reasoningModelKey: reasoningModelKey, fastModelKey: fastModelKey, systemPrompt: systemPrompt, stepLimit: Number(stepLimit), turnStepLimit: Number(turnStepLimit), costLimit: Number(costLimit) }, agentHubTagsPayload(tags)), { status: (_b = nextStatus !== null && nextStatus !== void 0 ? nextStatus : record === null || record === void 0 ? void 0 : record.status) !== null && _b !== void 0 ? _b : "draft" });
594
+ payload = __assign(__assign(__assign({ name: name.trim(), title: title.trim(), description: description.trim(), iconName: iconName, requiredInputs: JSON.stringify(normalizedInputs), reasoningModelKey: reasoningModelKey, fastModelKey: fastModelKey, systemPrompt: systemPrompt, stepLimit: Number(stepLimit), turnStepLimit: Number(turnStepLimit), costLimit: Number(costLimit) }, agentHubTagsPayload(tags)), agentHubModulePayload(module)), { status: (_b = nextStatus !== null && nextStatus !== void 0 ? nextStatus : record === null || record === void 0 ? void 0 : record.status) !== null && _b !== void 0 ? _b : "draft" });
587
595
  scalarSaved = false;
588
596
  _e.label = 1;
589
597
  case 1:
@@ -691,7 +699,7 @@ export function AgentRegistryEditorPage() {
691
699
  };
692
700
  var agentStatus = (_h = record === null || record === void 0 ? void 0 : record.status) !== null && _h !== void 0 ? _h : "draft";
693
701
  var tabs = __spreadArray(__spreadArray(__spreadArray(__spreadArray([
694
- { value: "basics", label: "Basics", content: _jsxs("div", { className: "agent-editor__stack", children: [_jsxs("div", { className: "agent-editor__grid", children: [field("Name", name, setName, "name", true), field("Title", title, setTitle, "title", true), field("Description", description, setDescription, "description"), _jsxs("div", { className: "agent-editor__field", children: [_jsx("span", { children: "Icon" }), _jsx(SolidIconPicker, { value: iconName, onChange: setIconName })] })] }), _jsx(AgentHubTagsField, { value: tags, onChange: setTags, disabled: creating || updating || isLoading || isFetching || isError, onBusyChange: setCreatingTag }), _jsxs("section", { className: "agent-editor__section", children: [_jsxs("div", { className: "agent-editor__section-head", children: [_jsxs("div", { children: [_jsx("h2", { children: "Inputs" }), _jsx("p", { children: "Define the variables this agent can use. Mark inputs optional or provide a default value when people do not need to enter them." })] }), inputs.length > 0 && _jsxs(SolidButton, { type: "button", variant: "secondary", size: "small", onClick: function () { return setInputs(function (current) { return __spreadArray(__spreadArray([], current, true), [{ name: "", description: "", dataType: "string", defaultValue: null, optional: false }], false); }); }, children: [_jsx(Plus, { size: 15 }), " Add input"] })] }), !inputs.length ? _jsxs("div", { className: "agent-editor__empty", children: ["This agent has no inputs. ", _jsxs("button", { type: "button", onClick: function () { return setInputs([{ name: "", description: "", dataType: "string", defaultValue: null, optional: false }]); }, children: [_jsx(Plus, { size: 15 }), " Add an input variable"] })] })
702
+ { value: "basics", label: "Basics", content: _jsxs("div", { className: "agent-editor__stack", children: [_jsxs("div", { className: "agent-editor__grid", children: [field("Name", name, setName, "name", true), field("Title", title, setTitle, "title", true), field("Description", description, setDescription, "description"), _jsxs("div", { className: "agent-editor__field", children: [_jsx("span", { children: "Icon" }), _jsx(SolidIconPicker, { value: iconName, onChange: setIconName })] }), _jsx(AgentHubModuleField, { className: "agent-editor__field", value: module, onChange: function (value) { setModule(value); setErrors(function (current) { return (__assign(__assign({}, current), { module: "" })); }); }, disabled: creating || updating || isLoading || isFetching || isError, clearable: false, required: true, error: errors.module })] }), _jsx(AgentHubTagsField, { value: tags, onChange: setTags, module: module, disabled: creating || updating || isLoading || isFetching || isError, onBusyChange: setCreatingTag }), _jsxs("section", { className: "agent-editor__section", children: [_jsxs("div", { className: "agent-editor__section-head", children: [_jsxs("div", { children: [_jsx("h2", { children: "Inputs" }), _jsx("p", { children: "Define the variables this agent can use. Mark inputs optional or provide a default value when people do not need to enter them." })] }), inputs.length > 0 && _jsxs(SolidButton, { type: "button", variant: "secondary", size: "small", onClick: function () { return setInputs(function (current) { return __spreadArray(__spreadArray([], current, true), [{ name: "", description: "", dataType: "string", defaultValue: null, optional: false }], false); }); }, children: [_jsx(Plus, { size: 15 }), " Add input"] })] }), !inputs.length ? _jsxs("div", { className: "agent-editor__empty", children: ["This agent has no inputs. ", _jsxs("button", { type: "button", onClick: function () { return setInputs([{ name: "", description: "", dataType: "string", defaultValue: null, optional: false }]); }, children: [_jsx(Plus, { size: 15 }), " Add an input variable"] })] })
695
703
  : _jsx("div", { className: "agent-editor__inputs", children: inputs.map(function (input, index) { return _jsxs("div", { className: "agent-editor__input-row", children: [_jsx(SolidInput, { "aria-label": "Input ".concat(index + 1, " name"), placeholder: "Variable name", value: input.name, onChange: function (event) { return setInputs(function (current) { return current.map(function (item, i) { return i === index ? __assign(__assign({}, item), { name: event.target.value }) : item; }); }); } }), _jsx(SolidInput, { "aria-label": "Input ".concat(index + 1, " description"), placeholder: "Description", value: input.description, onChange: function (event) { return setInputs(function (current) { return current.map(function (item, i) { return i === index ? __assign(__assign({}, item), { description: event.target.value }) : item; }); }); } }), _jsx(SolidInput, { "aria-label": "Input ".concat(index + 1, " default value"), placeholder: "Default value", value: formatDefaultValue(input.defaultValue), onChange: function (event) { return setInputs(function (current) { return current.map(function (item, i) { return i === index ? __assign(__assign({}, item), { defaultValue: event.target.value }) : item; }); }); } }), _jsx("select", { "aria-label": "Input ".concat(index + 1, " data type"), value: input.dataType, onChange: function (event) { return setInputs(function (current) { return current.map(function (item, i) { return i === index ? __assign(__assign({}, item), { dataType: event.target.value }) : item; }); }); }, children: ["string", "number", "integer", "boolean", "date", "datetime", "object", "array"].map(function (type) { return _jsx("option", { value: type, children: type }, type); }) }), _jsxs("label", { className: "agent-editor__input-optional", children: [_jsx("input", { type: "checkbox", checked: input.optional, onChange: function (event) { return setInputs(function (current) { return current.map(function (item, i) { return i === index ? __assign(__assign({}, item), { optional: event.target.checked }) : item; }); }); } }), " Optional"] }), _jsx("button", { type: "button", "aria-label": "Remove input ".concat(index + 1), onClick: function () { return setInputs(function (current) { return current.filter(function (_, i) { return i !== index; }); }); }, children: _jsx(Trash2, { size: 17 }) })] }, index); }) }), errors.inputs && _jsx("small", { className: "agent-editor__error", children: errors.inputs })] }), _jsxs("section", { className: "agent-editor__section agent-editor__models", children: [_jsx("h2", { children: "Models" }), _jsx("p", { children: "Choose a configured provider and model for each role. Select Other to enter a model ID manually." }), _jsx("div", { className: "agent-editor__grid", children: [["Reasoning model", reasoningModelKey, setReasoningModelKey, "reasoningModelKey"], ["Fast model", fastModelKey, setFastModelKey, "fastModelKey"]].map(function (_a) {
696
704
  var _b;
697
705
  var label = _a[0], value = _a[1], setter = _a[2], key = _a[3];
@@ -706,7 +714,7 @@ export function AgentRegistryEditorPage() {
706
714
  var value = _a[0], label = _a[1], description = _a[2];
707
715
  return _jsxs(React.Fragment, { children: [index > 0 && _jsx("div", { className: "agent-editor__workflow-connector", "aria-hidden": "true" }), _jsxs("button", { type: "button", className: "agent-editor__workflow-stage".concat(agentStatus === value ? " is-current" : ""), "aria-current": agentStatus === value ? "step" : undefined, "aria-pressed": agentStatus === value, disabled: creating || updating || agentStatus === value, onClick: function () { return void save(value); }, children: [_jsx("span", { className: "agent-editor__workflow-stage-mark", children: index + 1 }), _jsxs("div", { className: "agent-editor__workflow-stage-copy", children: [_jsx("strong", { children: label }), _jsx("small", { children: description }), _jsx("small", { className: "agent-editor__workflow-stage-cta", children: agentStatus === value ? "Current stage" : "Click to move to this stage" })] }), agentStatus === value && _jsx("span", { className: "agent-editor__workflow-current", children: "Current" })] })] }, value);
708
716
  }) }), _jsx("small", { className: "agent-editor__workflow-save-hint", children: "Changing stage saves the current form and its linked skills, tools, roles, and secrets." })] })] }) },
709
- { value: "persona", label: "Persona", content: _jsxs("section", { className: "agent-editor__section agent-editor__persona", children: [_jsxs("div", { className: "agent-editor__section-head", children: [_jsxs("div", { children: [_jsx("h2", { children: "System prompt *" }), _jsx("p", { children: "Describe the agent's role, behavior, and instructions in Markdown." })] }), (record === null || record === void 0 ? void 0 : record.id) && _jsx(AgentPersonaHistory, { agentId: record.id, savedPrompt: (_j = record.systemPrompt) !== null && _j !== void 0 ? _j : "", refreshVersion: auditVersion })] }), _jsx(SolidCodeEditor, { value: systemPrompt, onChange: function (value) { setSystemPrompt(value !== null && value !== void 0 ? value : ""); setErrors(function (current) { return (__assign(__assign({}, current), { systemPrompt: "" })); }); }, language: "markdown", fontSize: 11, height: "max(34rem, calc(100dvh - 18rem))" }), errors.systemPrompt && _jsx("small", { className: "agent-editor__error", children: errors.systemPrompt })] }) },
717
+ { value: "persona", label: "Persona", content: _jsxs("section", { className: "agent-editor__section agent-editor__persona", children: [_jsxs("div", { className: "agent-editor__section-head", children: [_jsxs("div", { children: [_jsx("h2", { children: "System prompt *" }), _jsx("p", { children: "Describe the agent's role, behavior, and instructions in Markdown." })] }), (record === null || record === void 0 ? void 0 : record.id) && _jsx(AgentPersonaHistory, { agentId: record.id, savedPrompt: (_j = record.systemPrompt) !== null && _j !== void 0 ? _j : "", refreshVersion: auditVersion })] }), _jsx(SolidCodeEditor, { value: systemPrompt, onChange: function (value) { setSystemPrompt(value !== null && value !== void 0 ? value : ""); setErrors(function (current) { return (__assign(__assign({}, current), { systemPrompt: "" })); }); }, language: "markdown", wordWrap: "on", fontSize: 11, height: "max(34rem, calc(100dvh - 18rem))" }), errors.systemPrompt && _jsx("small", { className: "agent-editor__error", children: errors.systemPrompt })] }) },
710
718
  { value: "skills", label: "Skills", content: _jsx(LinkPicker, { label: "Skills", description: "Skills available to this agent.", options: skills.records, selected: linked(skillIds, skills.records, items(record === null || record === void 0 ? void 0 : record.agentSkills).map(function (link) { return link.agentSkillRegistry; }).filter(Boolean)), onAdd: function (id) { return toggle(setSkillIds, id); }, onRemove: function (id) { return toggle(setSkillIds, id); }, createUrl: "/admin/core/solid-core/agent-skill-registry/editor/new", onView: function (item) { return setPreview({ item: item, kind: "skill" }); }, editUrlFor: function (item) { return "/admin/core/solid-core/agent-skill-registry/editor/".concat(item.id); }, linkFor: function (id) { return linkForTarget(record === null || record === void 0 ? void 0 : record.agentSkills, "agentSkillRegistry", id); }, render: function (item) { return _jsx(AgentResourceCardWidget, __assign({}, { rowData: item })); }, renderSettings: function (item) {
711
719
  var _a;
712
720
  return _jsx("div", { className: "agent-editor__link-settings", children: linkSetting("Always include", (_a = alwaysIncludeValues[item.id]) !== null && _a !== void 0 ? _a : true, function (checked) { return setAlwaysIncludeValues(function (current) {