@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
@@ -9,6 +9,7 @@ import { showToast } from "../../../../redux/features/toastSlice";
9
9
  import { AgentRegistryAuditPanel } from "./AgentRegistryAuditPanel";
10
10
  import { AgentPersonaHistory } from "./AgentPersonaHistory";
11
11
  import { AgentHubTagsField, agentHubTagsFrom, agentHubTagsPayload, type AgentHubTag } from "./AgentHubTagsField";
12
+ import { AgentHubModuleField, agentHubModuleFrom, agentHubModulePayload, type AgentHubModule } from "./AgentHubModuleField";
12
13
  import { AgentResourceCardWidget } from "../../../../components/core/extension/solid-core/agentRegistry/card/AgentResourceCardWidget";
13
14
  import { AgentSessionsPanel } from "../../../../components/core/extension/solid-core/agentToolRegistry/AgentToolSessionsPanel";
14
15
  import { AgentProcessesPanel } from "../../../../components/core/extension/solid-core/agentToolRegistry/AgentProcessesPanel";
@@ -165,7 +166,7 @@ const detailFields = [
165
166
  ];
166
167
 
167
168
  const detailQuery = [
168
- "agentRoles", "agentRoles.roleMetadata", "agentSecrets", "agentSecrets.secret", "tags",
169
+ "agentRoles", "agentRoles.roleMetadata", "agentSecrets", "agentSecrets.secret", "tags", "module",
169
170
  ].map((name, index) => `populate[${index}]=${name}`).join("&") + "&" + fieldsQuery(detailFields);
170
171
 
171
172
  // Group by link ID to project summary columns without populating full registry records.
@@ -205,7 +206,7 @@ function agentFormFromRecord(record: Agent) {
205
206
  name: record.name ?? "", title: record.title ?? "", description: record.description ?? "", iconName: record.iconName ?? "",
206
207
  inputs: parseInputs(record.requiredInputs), reasoningModelKey: record.reasoningModelKey ?? "", fastModelKey: record.fastModelKey ?? "",
207
208
  systemPrompt: record.systemPrompt ?? "", stepLimit: record.stepLimit ?? 100, turnStepLimit: record.turnStepLimit ?? 20,
208
- costLimit: Number(record.costLimit ?? 3), tags: agentHubTagsFrom(record.tags), skillIds: skills.map((link) => link.agentSkillRegistry?.id).filter(Boolean),
209
+ costLimit: Number(record.costLimit ?? 3), tags: agentHubTagsFrom(record.tags), moduleId: agentHubModuleFrom(record.module)?.id ?? null, skillIds: skills.map((link) => link.agentSkillRegistry?.id).filter(Boolean),
209
210
  toolIds: tools.map((link) => link.agentToolRegistry?.id).filter(Boolean),
210
211
  roleIds: items(record.agentRoles).map((link) => link.roleMetadata?.id).filter(Boolean),
211
212
  secretIds: secrets.map((link) => link.secret?.id).filter(Boolean),
@@ -392,6 +393,7 @@ export function AgentRegistryEditorPage() {
392
393
  const [turnStepLimit, setTurnStepLimit] = React.useState(20);
393
394
  const [costLimit, setCostLimit] = React.useState(3);
394
395
  const [tags, setTags] = React.useState<AgentHubTag[]>([]);
396
+ const [module, setModule] = React.useState<AgentHubModule | null>(null);
395
397
  const [creatingTag, setCreatingTag] = React.useState(false);
396
398
  const [skillIds, setSkillIds] = React.useState<number[]>([]);
397
399
  const [toolIds, setToolIds] = React.useState<number[]>([]);
@@ -409,7 +411,7 @@ export function AgentRegistryEditorPage() {
409
411
  const baseline = React.useRef("");
410
412
 
411
413
  const currentForm = () => JSON.stringify({ name, title, description, iconName, inputs, reasoningModelKey, fastModelKey, systemPrompt,
412
- stepLimit: Number(stepLimit), turnStepLimit: Number(turnStepLimit), costLimit: Number(costLimit), tags, skillIds, toolIds, roleIds, secretIds,
414
+ stepLimit: Number(stepLimit), turnStepLimit: Number(turnStepLimit), costLimit: Number(costLimit), tags, moduleId: module?.id ?? null, skillIds, toolIds, roleIds, secretIds,
413
415
  alwaysIncludeValues, requiresApprovalValues, secretEnvVarNames });
414
416
 
415
417
  React.useEffect(() => {
@@ -421,6 +423,7 @@ export function AgentRegistryEditorPage() {
421
423
  setSystemPrompt(record.systemPrompt ?? ""); setStepLimit(record.stepLimit ?? 100);
422
424
  setTurnStepLimit(record.turnStepLimit ?? 20); setCostLimit(Number(record.costLimit ?? 3));
423
425
  setTags(agentHubTagsFrom(record.tags));
426
+ setModule(agentHubModuleFrom(record.module));
424
427
  setSkillIds(items(record.agentSkills).map((link) => link.agentSkillRegistry?.id).filter(Boolean));
425
428
  setToolIds(items(record.agentTools).map((link) => link.agentToolRegistry?.id).filter(Boolean));
426
429
  setRoleIds(items(record.agentRoles).map((link) => link.roleMetadata?.id).filter(Boolean));
@@ -482,7 +485,7 @@ export function AgentRegistryEditorPage() {
482
485
  }
483
486
  const existing = links.find((link) => (link as any)[field]?.id === targetId);
484
487
  if (existing && Object.entries(values).some(([key, value]) => (existing as any)[key] !== value)) {
485
- await update({ id: existing.id, data: values }).unwrap();
488
+ await update({ id: existing.id, data: { agentRegistryId: agentId, [`${field}Id`]: targetId, ...values } }).unwrap();
486
489
  }
487
490
  }
488
491
  };
@@ -492,6 +495,7 @@ export function AgentRegistryEditorPage() {
492
495
  const next: Record<string, string> = {};
493
496
  if (!name.trim()) next.name = "Name is required.";
494
497
  if (!title.trim()) next.title = "Title is required.";
498
+ if (!module) next.module = "Module is required. Select a module before saving this agent.";
495
499
  if (!systemPrompt.trim()) next.systemPrompt = "Persona instructions are required.";
496
500
  if (!isValidModelKey(reasoningModelKey)) next.reasoningModelKey = "Choose an enabled reasoning provider and model.";
497
501
  if (!isValidModelKey(fastModelKey)) next.fastModelKey = "Choose an enabled fast provider and model.";
@@ -520,6 +524,7 @@ export function AgentRegistryEditorPage() {
520
524
  reasoningModelKey, fastModelKey, systemPrompt, stepLimit: Number(stepLimit),
521
525
  turnStepLimit: Number(turnStepLimit), costLimit: Number(costLimit),
522
526
  ...agentHubTagsPayload(tags),
527
+ ...agentHubModulePayload(module),
523
528
  status: nextStatus ?? record?.status ?? "draft",
524
529
  };
525
530
  let newlyCreatedId: number | undefined;
@@ -593,8 +598,9 @@ export function AgentRegistryEditorPage() {
593
598
  { value: "basics", label: "Basics", content: <div className="agent-editor__stack">
594
599
  <div className="agent-editor__grid">{field("Name", name, setName, "name", true)}{field("Title", title, setTitle, "title", true)}
595
600
  {field("Description", description, setDescription, "description")}<div className="agent-editor__field"><span>Icon</span><SolidIconPicker value={iconName} onChange={setIconName} /></div>
601
+ <AgentHubModuleField className="agent-editor__field" value={module} onChange={(value) => { setModule(value); setErrors((current) => ({ ...current, module: "" })); }} disabled={creating || updating || isLoading || isFetching || isError} clearable={false} required error={errors.module} />
596
602
  </div>
597
- <AgentHubTagsField value={tags} onChange={setTags} disabled={creating || updating || isLoading || isFetching || isError} onBusyChange={setCreatingTag} />
603
+ <AgentHubTagsField value={tags} onChange={setTags} module={module} disabled={creating || updating || isLoading || isFetching || isError} onBusyChange={setCreatingTag} />
598
604
  <section className="agent-editor__section"><div className="agent-editor__section-head"><div><h2>Inputs</h2><p>Define the variables this agent can use. Mark inputs optional or provide a default value when people do not need to enter them.</p></div>
599
605
  {inputs.length > 0 && <SolidButton type="button" variant="secondary" size="small" onClick={() => setInputs((current) => [...current, { name: "", description: "", dataType: "string", defaultValue: null, optional: false }])}><Plus size={15} /> Add input</SolidButton>}
600
606
  </div>
@@ -638,7 +644,7 @@ export function AgentRegistryEditorPage() {
638
644
  </div> },
639
645
  { value: "persona", label: "Persona", content: <section className="agent-editor__section agent-editor__persona"><div className="agent-editor__section-head"><div><h2>System prompt *</h2><p>Describe the agent's role, behavior, and instructions in Markdown.</p></div>
640
646
  {record?.id && <AgentPersonaHistory agentId={record.id} savedPrompt={record.systemPrompt ?? ""} refreshVersion={auditVersion} />}</div>
641
- <SolidCodeEditor value={systemPrompt} onChange={(value) => { setSystemPrompt(value ?? ""); setErrors((current) => ({ ...current, systemPrompt: "" })); }} language="markdown" fontSize={11} height="max(34rem, calc(100dvh - 18rem))" />
647
+ <SolidCodeEditor value={systemPrompt} onChange={(value) => { setSystemPrompt(value ?? ""); setErrors((current) => ({ ...current, systemPrompt: "" })); }} language="markdown" wordWrap="on" fontSize={11} height="max(34rem, calc(100dvh - 18rem))" />
642
648
  {errors.systemPrompt && <small className="agent-editor__error">{errors.systemPrompt}</small>}</section> },
643
649
  { value: "skills", label: "Skills", content: <LinkPicker label="Skills" description="Skills available to this agent." options={skills.records} selected={linked(skillIds, skills.records, items(record?.agentSkills).map((link) => link.agentSkillRegistry).filter(Boolean))}
644
650
  onAdd={(id) => toggle(setSkillIds, id)} onRemove={(id) => toggle(setSkillIds, id)} createUrl="/admin/core/solid-core/agent-skill-registry/editor/new"
@@ -1 +1 @@
1
- {"version":3,"file":"AgentSkillRegistryEditorPage.d.ts","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/AgentSkillRegistryEditorPage.tsx"],"names":[],"mappings":"AAiBA,OAAO,oCAAoC,CAAC;AA8E5C,wBAAgB,4BAA4B,4CAwS3C"}
1
+ {"version":3,"file":"AgentSkillRegistryEditorPage.d.ts","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/AgentSkillRegistryEditorPage.tsx"],"names":[],"mappings":"AAkBA,OAAO,oCAAoC,CAAC;AA+E5C,wBAAgB,4BAA4B,4CAgT3C"}
@@ -54,6 +54,7 @@ import { createSolidEntityApi } from "../../../../redux/api/solidEntityApi";
54
54
  import { showToast } from "../../../../redux/features/toastSlice";
55
55
  import { AgentRegistryAuditPanel } from "./AgentRegistryAuditPanel";
56
56
  import { AgentHubTagsField, agentHubTagsFrom, agentHubTagsPayload } from "./AgentHubTagsField";
57
+ import { AgentHubModuleField, agentHubModuleFrom, agentHubModulePayload } from "./AgentHubModuleField";
57
58
  import { SolidButton, SolidCodeEditor, SolidDialog, SolidDialogBody, SolidIconPicker, SolidInput, SolidTabGroup, } from "../../../../components/shad-cn-ui";
58
59
  import "./AgentSkillRegistryEditorPage.css";
59
60
  function extractEntityRecord(response) {
@@ -120,7 +121,7 @@ export function AgentSkillRegistryEditorPage() {
120
121
  var useCreateSolidEntityMutation = entityApi.useCreateSolidEntityMutation, useGetSolidEntityByIdQuery = entityApi.useGetSolidEntityByIdQuery, useUpdateSolidEntityMutation = entityApi.useUpdateSolidEntityMutation;
121
122
  var _b = useGetSolidEntityByIdQuery({
122
123
  id: id,
123
- qs: "populate[0]=agentSkills&populate[1]=agentSkills.agentRegistry&populate[2]=tags",
124
+ qs: "populate[0]=agentSkills&populate[1]=agentSkills.agentRegistry&populate[2]=tags&populate[3]=module",
124
125
  }, { skip: !id || id === "new" }), response = _b.data, isLoading = _b.isLoading, isFetching = _b.isFetching, refetch = _b.refetch;
125
126
  var _c = useCreateSolidEntityMutation(), createSkill = _c[0], isCreating = _c[1].isLoading;
126
127
  var _d = useUpdateSolidEntityMutation(), updateSkill = _d[0], isSaving = _d[1].isLoading;
@@ -132,28 +133,31 @@ export function AgentSkillRegistryEditorPage() {
132
133
  var _j = React.useState(""), description = _j[0], setDescription = _j[1];
133
134
  var _k = React.useState(""), body = _k[0], setBody = _k[1];
134
135
  var _l = React.useState([]), tags = _l[0], setTags = _l[1];
135
- var _m = React.useState(false), creatingTag = _m[0], setCreatingTag = _m[1];
136
- var _o = React.useState({}), fieldErrors = _o[0], setFieldErrors = _o[1];
137
- var _p = React.useState(0), auditRefreshVersion = _p[0], setAuditRefreshVersion = _p[1];
138
- var _q = React.useState(false), confirmRefresh = _q[0], setConfirmRefresh = _q[1];
136
+ var _m = React.useState(null), module = _m[0], setModule = _m[1];
137
+ var _o = React.useState(false), creatingTag = _o[0], setCreatingTag = _o[1];
138
+ var _p = React.useState({}), fieldErrors = _p[0], setFieldErrors = _p[1];
139
+ var _q = React.useState(0), auditRefreshVersion = _q[0], setAuditRefreshVersion = _q[1];
140
+ var _r = React.useState(false), confirmRefresh = _r[0], setConfirmRefresh = _r[1];
139
141
  var baseline = React.useRef("");
140
- var currentForm = function () { return JSON.stringify({ name: name, type: type, iconName: iconName, description: description, body: body, tags: tags }); };
142
+ var currentForm = function () { var _a; return JSON.stringify({ name: name, type: type, iconName: iconName, description: description, body: body, tags: tags, moduleId: (_a = module === null || module === void 0 ? void 0 : module.id) !== null && _a !== void 0 ? _a : null }); };
141
143
  React.useEffect(function () {
142
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
144
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
143
145
  var nextTags = agentHubTagsFrom(record === null || record === void 0 ? void 0 : record.tags);
146
+ var nextModule = agentHubModuleFrom(record === null || record === void 0 ? void 0 : record.module);
144
147
  setName((_a = record === null || record === void 0 ? void 0 : record.name) !== null && _a !== void 0 ? _a : "");
145
148
  setType((_b = record === null || record === void 0 ? void 0 : record.type) !== null && _b !== void 0 ? _b : "custom");
146
149
  setIconName((_c = record === null || record === void 0 ? void 0 : record.iconName) !== null && _c !== void 0 ? _c : "");
147
150
  setDescription((_d = record === null || record === void 0 ? void 0 : record.description) !== null && _d !== void 0 ? _d : "");
148
151
  setBody((_e = record === null || record === void 0 ? void 0 : record.body) !== null && _e !== void 0 ? _e : "");
149
152
  setTags(nextTags);
150
- baseline.current = JSON.stringify({ name: (_f = record === null || record === void 0 ? void 0 : record.name) !== null && _f !== void 0 ? _f : "", type: (_g = record === null || record === void 0 ? void 0 : record.type) !== null && _g !== void 0 ? _g : "custom", iconName: (_h = record === null || record === void 0 ? void 0 : record.iconName) !== null && _h !== void 0 ? _h : "", description: (_j = record === null || record === void 0 ? void 0 : record.description) !== null && _j !== void 0 ? _j : "", body: (_k = record === null || record === void 0 ? void 0 : record.body) !== null && _k !== void 0 ? _k : "", tags: nextTags });
153
+ setModule(nextModule);
154
+ baseline.current = JSON.stringify({ name: (_f = record === null || record === void 0 ? void 0 : record.name) !== null && _f !== void 0 ? _f : "", type: (_g = record === null || record === void 0 ? void 0 : record.type) !== null && _g !== void 0 ? _g : "custom", iconName: (_h = record === null || record === void 0 ? void 0 : record.iconName) !== null && _h !== void 0 ? _h : "", description: (_j = record === null || record === void 0 ? void 0 : record.description) !== null && _j !== void 0 ? _j : "", body: (_k = record === null || record === void 0 ? void 0 : record.body) !== null && _k !== void 0 ? _k : "", tags: nextTags, moduleId: (_l = nextModule === null || nextModule === void 0 ? void 0 : nextModule.id) !== null && _l !== void 0 ? _l : null });
151
155
  }, [record]);
152
156
  var isReadOnly = (record === null || record === void 0 ? void 0 : record.type) === "solidx";
153
157
  var isDirty = Boolean(record === null || record === void 0 ? void 0 : record.id) && currentForm() !== baseline.current;
154
158
  var requestRefresh = function () { return isDirty ? setConfirmRefresh(true) : void refetch(); };
155
159
  var handleSave = function () { return __awaiter(_this, void 0, void 0, function () {
156
- var nextErrors, payload, result, createdId, error_1, errorDetail, serverFieldErrors, _i, _a, field;
160
+ var nextErrors, payload, result, createdId, error_1, errorDetail, serverFieldErrors, _i, _a, field, label;
157
161
  var _b, _c;
158
162
  return __generator(this, function (_d) {
159
163
  switch (_d.label) {
@@ -169,6 +173,8 @@ export function AgentSkillRegistryEditorPage() {
169
173
  nextErrors.description = "Description is required.";
170
174
  if (!body.trim())
171
175
  nextErrors.body = "Skill instructions are required.";
176
+ if (!module)
177
+ nextErrors.module = "Module is required. Select a module before saving this skill.";
172
178
  setFieldErrors(nextErrors);
173
179
  if (Object.keys(nextErrors).length > 0) {
174
180
  setActiveTab(nextErrors.body ? "skill" : "general");
@@ -179,7 +185,7 @@ export function AgentSkillRegistryEditorPage() {
179
185
  }));
180
186
  return [2 /*return*/];
181
187
  }
182
- payload = __assign({ name: name.trim(), type: type, iconName: iconName || null, description: description.trim(), body: body }, agentHubTagsPayload(tags));
188
+ payload = __assign(__assign({ name: name.trim(), type: type, iconName: iconName || null, description: description.trim(), body: body }, agentHubTagsPayload(tags)), agentHubModulePayload(module));
183
189
  _d.label = 1;
184
190
  case 1:
185
191
  _d.trys.push([1, 6, , 7]);
@@ -216,11 +222,12 @@ export function AgentSkillRegistryEditorPage() {
216
222
  errorDetail = getSaveErrorMessage(error_1);
217
223
  serverFieldErrors = {};
218
224
  if (/required|not be empty|cannot be empty|should not be empty/i.test(errorDetail)) {
219
- for (_i = 0, _a = ["name", "type", "description", "body"]; _i < _a.length; _i++) {
225
+ for (_i = 0, _a = ["name", "type", "description", "body", "module"]; _i < _a.length; _i++) {
220
226
  field = _a[_i];
221
227
  if (!new RegExp("\\b".concat(field, "\\b"), "i").test(errorDetail))
222
228
  continue;
223
- serverFieldErrors[field] = "".concat(field === "body" ? "Skill instructions" : field[0].toUpperCase() + field.slice(1), " is required.");
229
+ label = field === "body" ? "Skill instructions" : field === "module" ? "Module" : field[0].toUpperCase() + field.slice(1);
230
+ serverFieldErrors[field] = "".concat(label, " is required.");
224
231
  }
225
232
  }
226
233
  if (Object.keys(serverFieldErrors).length > 0) {
@@ -242,7 +249,7 @@ export function AgentSkillRegistryEditorPage() {
242
249
  {
243
250
  value: "general",
244
251
  label: "General Info",
245
- content: (_jsxs("fieldset", { className: "agent-skill-editor__general", disabled: isReadOnly, children: [isReadOnly && _jsx("p", { className: "agent-skill-editor__readonly-note", children: "SolidX skills are seeded by the AgentHub runtime and cannot be edited." }), _jsxs("div", { className: "agent-skill-editor__fields", children: [_jsxs("label", { className: "agent-skill-editor__field", children: [_jsxs("span", { children: ["Name ", _jsx("b", { children: "*" })] }), _jsx(SolidInput, { value: name, "aria-invalid": Boolean(fieldErrors.name), "aria-describedby": fieldErrors.name ? "agent-skill-name-error" : undefined, className: fieldErrors.name ? "agent-skill-editor__input--invalid" : undefined, onChange: function (event) {
252
+ content: (_jsxs("fieldset", { className: "agent-skill-editor__general", disabled: isReadOnly, children: [isReadOnly && _jsx("p", { className: "agent-skill-editor__readonly-note", children: "SolidX skills cannot be edited." }), _jsxs("div", { className: "agent-skill-editor__fields", children: [_jsxs("label", { className: "agent-skill-editor__field", children: [_jsxs("span", { children: ["Name ", _jsx("b", { children: "*" })] }), _jsx(SolidInput, { value: name, "aria-invalid": Boolean(fieldErrors.name), "aria-describedby": fieldErrors.name ? "agent-skill-name-error" : undefined, className: fieldErrors.name ? "agent-skill-editor__input--invalid" : undefined, onChange: function (event) {
246
253
  setName(event.target.value);
247
254
  setFieldErrors(function (current) { return (__assign(__assign({}, current), { name: "" })); });
248
255
  } }), fieldErrors.name && _jsx("small", { id: "agent-skill-name-error", className: "agent-skill-editor__field-error", children: fieldErrors.name })] }), _jsxs("div", { className: "agent-skill-editor__field", children: [_jsx("span", { children: "Icon" }), _jsx(SolidIconPicker, { value: iconName, onChange: setIconName })] }), _jsxs("label", { className: "agent-skill-editor__field", children: [_jsxs("span", { children: ["Description ", _jsx("b", { children: "*" })] }), _jsx(SolidInput, { value: description, "aria-invalid": Boolean(fieldErrors.description), "aria-describedby": fieldErrors.description ? "agent-skill-description-error" : undefined, className: fieldErrors.description ? "agent-skill-editor__input--invalid" : undefined, onChange: function (event) {
@@ -251,7 +258,7 @@ export function AgentSkillRegistryEditorPage() {
251
258
  } }), fieldErrors.description && _jsx("small", { id: "agent-skill-description-error", className: "agent-skill-editor__field-error", children: fieldErrors.description })] })] }), _jsxs("label", { className: "agent-skill-editor__field", children: [_jsxs("span", { children: ["Skill type ", _jsx("b", { children: "*" })] }), _jsxs("select", { value: type, "aria-invalid": Boolean(fieldErrors.type), "aria-describedby": fieldErrors.type ? "agent-skill-type-error" : undefined, className: fieldErrors.type ? "agent-skill-editor__input--invalid" : undefined, onChange: function (event) {
252
259
  setType(event.target.value);
253
260
  setFieldErrors(function (current) { return (__assign(__assign({}, current), { type: "" })); });
254
- }, 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-skill-type-error", className: "agent-skill-editor__field-error", children: fieldErrors.type })] }), _jsx(AgentHubTagsField, { value: tags, onChange: setTags, disabled: isReadOnly || isCreating || isSaving, onBusyChange: setCreatingTag })] })),
261
+ }, 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-skill-type-error", className: "agent-skill-editor__field-error", children: fieldErrors.type })] }), _jsx(AgentHubModuleField, { className: "agent-skill-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 })] })),
255
262
  },
256
263
  {
257
264
  value: "skill",
@@ -259,7 +266,7 @@ export function AgentSkillRegistryEditorPage() {
259
266
  content: (_jsx("div", { className: "agent-skill-editor__skill", children: _jsxs("section", { className: "agent-skill-editor__panel", children: [_jsxs("header", { children: [_jsxs("h2", { children: ["Skill instructions ", _jsx("b", { children: "*" })] }), _jsx("p", { children: "Write the skill's Markdown body here." })] }), _jsx(SolidCodeEditor, { value: body, onChange: function (value) {
260
267
  setBody(value !== null && value !== void 0 ? value : "");
261
268
  setFieldErrors(function (current) { return (__assign(__assign({}, current), { body: "" })); });
262
- }, language: "markdown", readOnly: isReadOnly, fontSize: 11, height: "max(32rem, calc(100dvh - 18rem))", className: "agent-skill-editor__code".concat(fieldErrors.body ? " agent-skill-editor__code--invalid" : "") }), fieldErrors.body && _jsx("small", { className: "agent-skill-editor__field-error agent-skill-editor__body-error", children: fieldErrors.body })] }) })),
269
+ }, language: "markdown", wordWrap: "on", readOnly: isReadOnly, fontSize: 11, height: "max(32rem, calc(100dvh - 18rem))", className: "agent-skill-editor__code".concat(fieldErrors.body ? " agent-skill-editor__code--invalid" : "") }), fieldErrors.body && _jsx("small", { className: "agent-skill-editor__field-error agent-skill-editor__body-error", children: fieldErrors.body })] }) })),
263
270
  },
264
271
  {
265
272
  value: "agents",
@@ -1 +1 @@
1
- {"version":3,"file":"AgentSkillRegistryEditorPage.js","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/AgentSkillRegistryEditorPage.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,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,mBAAmB,EAAoB,MAAM,qBAAqB,CAAC;AACjH,OAAO,EACL,WAAW,EACX,eAAe,EACf,WAAW,EACX,eAAe,EACf,eAAe,EACf,UAAU,EACV,aAAa,GACd,MAAM,mCAAmC,CAAC;AAC3C,OAAO,oCAAoC,CAAC;AAoB5C,SAAS,mBAAmB,CAAC,QAAiB;IAC5C,IAAI,SAAS,GAAY,QAAQ,CAAC;IAClC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE;QACzC,IAAI,CAAC,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ;YAAE,OAAO,SAAS,CAAC;QAClE,IAAM,KAAK,GAAG,SAAoC,CAAC;QACnD,IAAI,IAAI,IAAI,KAAK,IAAI,MAAM,IAAI,KAAK;YAAE,OAAO,KAAK,CAAC;QACnD,SAAS,GAAG,KAAK,C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,EAAA,KAAC,WAAW,IAAC,IAAI,EAAC,QAAQ,EAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,cAAQ,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC,CAAC,oCAAmC,IAAG,YACzQ,KAAC,eAAe,cAAC,oHAAgG,GAAkB,GACvH,EAEb,SAAS,CAAC,CAAC,CAAC,CACX,cAAK,SAAS,EAAC,6BAA6B,oCAAqB,CAClE,CAAC,CAAC,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,EAAE,EAAC,CAAC,CAAC,CACf,KAAC,uBAAuB,IACtB,iBAAiB,EAAC,oBAAoB,EACtC,QAAQ,EAAE,MAAM,CAAC,EAAE,EACnB,cAAc,EAAE,mBAAmB,EACnC,YAAY,EAAE,MAAM,CAAC,IAAI,YAEzB,KAAC,aAAa,IACZ,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,SAAS,EAChB,aAAa,EAAE,YAAY,EAC3B,SAAS,EAAC,0BAA0B,EACpC,aAAa,EAAC,8BAA8B,EAC5C,cAAc,EAAC,+BAA+B,GAC9C,GACsB,CAC3B,CAAC,CAAC,CAAC,CACF,KAAC,aAAa,IACZ,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,SAAS,EAChB,aAAa,EAAE,YAAY,EAC3B,SAAS,EAAC,0BAA0B,EACpC,aAAa,EAAC,8BAA8B,EAC5C,cAAc,EAAC,+BAA+B,GAC9C,CACH,IACI,CACR,CAAC;AACJ,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 { AgentRegistryAuditPanel } from \"./AgentRegistryAuditPanel\";\nimport { AgentHubTagsField, agentHubTagsFrom, agentHubTagsPayload, type AgentHubTag } from \"./AgentHubTagsField\";\nimport {\n SolidButton,\n SolidCodeEditor,\n SolidDialog,\n SolidDialogBody,\n SolidIconPicker,\n SolidInput,\n SolidTabGroup,\n} from \"../../../../components/shad-cn-ui\";\nimport \"./AgentSkillRegistryEditorPage.css\";\n\ntype AgentReference = {\n id?: number | string;\n name?: string;\n title?: string;\n agentRegistry?: AgentReference | number | string | null;\n};\n\ntype SkillRecord = {\n id: number;\n name?: string;\n type?: string;\n iconName?: string | null;\n description?: string;\n body?: string;\n tags?: AgentHubTag[];\n agentSkills?: AgentReference[] | AgentReference | 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\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 skill.\";\n const apiError = error as Record<string, any>;\n // Nest validation details are nested at data.data.message; prefer them over\n // the generic outer \"Bad Request Exception\" message.\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 skill.\";\n}\n\nfunction skillAgents(record?: SkillRecord): AgentReference[] {\n const related = record?.agentSkills;\n const links = Array.isArray(related)\n ? related\n : related\n ? [related]\n : [];\n const seen = new Set<string>();\n\n return links\n .map((link) => link.agentRegistry)\n .filter((agent): agent is AgentReference => 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}\n\nexport function AgentSkillRegistryEditorPage() {\n const { id = \"\" } = useParams<{ id: string }>();\n const navigate = useNavigate();\n const dispatch = useDispatch();\n const entityApi = React.useMemo(() => createSolidEntityApi(\"agentSkillRegistry\"), []);\n const {\n useCreateSolidEntityMutation,\n useGetSolidEntityByIdQuery,\n useUpdateSolidEntityMutation,\n } = entityApi;\n\n const { data: response, isLoading, isFetching, refetch } = useGetSolidEntityByIdQuery(\n {\n id,\n qs: \"populate[0]=agentSkills&populate[1]=agentSkills.agentRegistry&populate[2]=tags\",\n },\n { skip: !id || id === \"new\" },\n );\n const [createSkill, { isLoading: isCreating }] = useCreateSolidEntityMutation();\n const [updateSkill, { isLoading: isSaving }] = useUpdateSolidEntityMutation();\n const record = extractEntityRecord(response) as SkillRecord | undefined;\n\n const [activeTab, setActiveTab] = React.useState(\"general\");\n const [name, setName] = React.useState(\"\");\n const [type, setType] = React.useState(\"custom\");\n const [iconName, setIconName] = React.useState(\"\");\n const [description, setDescription] = React.useState(\"\");\n const [body, setBody] = 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 baseline = React.useRef(\"\");\n const currentForm = () => JSON.stringify({ name, type, iconName, description, body, tags });\n\n React.useEffect(() => {\n const nextTags = agentHubTagsFrom(record?.tags);\n setName(record?.name ?? \"\");\n setType(record?.type ?? \"custom\");\n setIconName(record?.iconName ?? \"\");\n setDescription(record?.description ?? \"\");\n setBody(record?.body ?? \"\");\n setTags(nextTags);\n baseline.current = JSON.stringify({ name: record?.name ?? \"\", type: record?.type ?? \"custom\", iconName: record?.iconName ?? \"\", description: record?.description ?? \"\", body: record?.body ?? \"\", 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 handleSave = async () => {\n if (creatingTag) return;\n const nextErrors: Record<string, string> = {};\n if (!name.trim()) nextErrors.name = \"Name is required.\";\n if (!type.trim()) nextErrors.type = \"Skill type is required.\";\n if (!description.trim()) nextErrors.description = \"Description is required.\";\n if (!body.trim()) nextErrors.body = \"Skill instructions are required.\";\n\n setFieldErrors(nextErrors);\n if (Object.keys(nextErrors).length > 0) {\n setActiveTab(nextErrors.body ? \"skill\" : \"general\");\n dispatch(showToast({\n severity: \"error\",\n summary: \"Missing information\",\n detail: Object.values(nextErrors).join(\" \"),\n }));\n return;\n }\n\n const payload = {\n name: name.trim(),\n type,\n iconName: iconName || null,\n description: description.trim(),\n body,\n ...agentHubTagsPayload(tags),\n };\n\n try {\n if (record?.id) {\n await updateSkill({ id: record.id, data: payload }).unwrap();\n dispatch(showToast({\n severity: \"success\",\n summary: \"Saved\",\n detail: \"Skill updated successfully.\",\n }));\n setAuditRefreshVersion((version) => version + 1);\n refetch();\n } else {\n const result: any = await createSkill(payload).unwrap();\n const createdId = result?.data?.id ?? result?.id;\n dispatch(showToast({\n severity: \"success\",\n summary: \"Created\",\n detail: \"Skill created successfully.\",\n }));\n if (createdId) {\n navigate(`/admin/core/solid-core/agent-skill-registry/editor/${createdId}`, {\n replace: true,\n });\n }\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\", \"type\", \"description\", \"body\"]) {\n if (!new RegExp(`\\\\b${field}\\\\b`, \"i\").test(errorDetail)) continue;\n serverFieldErrors[field] = `${field === \"body\" ? \"Skill instructions\" : field[0].toUpperCase() + field.slice(1)} is required.`;\n }\n }\n if (Object.keys(serverFieldErrors).length > 0) {\n setFieldErrors(serverFieldErrors);\n setActiveTab(serverFieldErrors.body ? \"skill\" : \"general\");\n }\n dispatch(showToast({\n severity: \"error\",\n summary: \"Save failed\",\n detail: errorDetail,\n }));\n }\n };\n\n const agents = skillAgents(record);\n const tabs = [\n {\n value: \"general\",\n label: \"General Info\",\n content: (\n <fieldset className=\"agent-skill-editor__general\" disabled={isReadOnly}>\n {isReadOnly && <p className=\"agent-skill-editor__readonly-note\">SolidX skills are seeded by the AgentHub runtime and cannot be edited.</p>}\n <div className=\"agent-skill-editor__fields\">\n <label className=\"agent-skill-editor__field\">\n <span>Name <b>*</b></span>\n <SolidInput\n value={name}\n aria-invalid={Boolean(fieldErrors.name)}\n aria-describedby={fieldErrors.name ? \"agent-skill-name-error\" : undefined}\n className={fieldErrors.name ? \"agent-skill-editor__input--invalid\" : undefined}\n onChange={(event) => {\n setName(event.target.value);\n setFieldErrors((current) => ({ ...current, name: \"\" }));\n }}\n />\n {fieldErrors.name && <small id=\"agent-skill-name-error\" className=\"agent-skill-editor__field-error\">{fieldErrors.name}</small>}\n </label>\n <div className=\"agent-skill-editor__field\">\n <span>Icon</span>\n <SolidIconPicker value={iconName} onChange={setIconName} />\n </div>\n <label className=\"agent-skill-editor__field\">\n <span>Description <b>*</b></span>\n <SolidInput\n value={description}\n aria-invalid={Boolean(fieldErrors.description)}\n aria-describedby={fieldErrors.description ? \"agent-skill-description-error\" : undefined}\n className={fieldErrors.description ? \"agent-skill-editor__input--invalid\" : undefined}\n onChange={(event) => {\n setDescription(event.target.value);\n setFieldErrors((current) => ({ ...current, description: \"\" }));\n }}\n />\n {fieldErrors.description && <small id=\"agent-skill-description-error\" className=\"agent-skill-editor__field-error\">{fieldErrors.description}</small>}\n </label>\n </div>\n <label className=\"agent-skill-editor__field\">\n <span>Skill type <b>*</b></span>\n <select\n value={type}\n aria-invalid={Boolean(fieldErrors.type)}\n aria-describedby={fieldErrors.type ? \"agent-skill-type-error\" : undefined}\n className={fieldErrors.type ? \"agent-skill-editor__input--invalid\" : undefined}\n onChange={(event) => {\n setType(event.target.value);\n setFieldErrors((current) => ({ ...current, type: \"\" }));\n }}\n >\n {isReadOnly && <option value=\"solidx\">SolidX</option>}\n <option value=\"thirdparty\">Third Party</option>\n <option value=\"custom\">Custom</option>\n </select>\n {fieldErrors.type && <small id=\"agent-skill-type-error\" className=\"agent-skill-editor__field-error\">{fieldErrors.type}</small>}\n </label>\n <AgentHubTagsField value={tags} onChange={setTags} disabled={isReadOnly || isCreating || isSaving} onBusyChange={setCreatingTag} />\n </fieldset>\n ),\n },\n {\n value: \"skill\",\n label: \"Skill\",\n content: (\n <div className=\"agent-skill-editor__skill\">\n <section className=\"agent-skill-editor__panel\">\n <header>\n <h2>Skill instructions <b>*</b></h2>\n <p>Write the skill's Markdown body here.</p>\n </header>\n <SolidCodeEditor\n value={body}\n onChange={(value) => {\n setBody(value ?? \"\");\n setFieldErrors((current) => ({ ...current, body: \"\" }));\n }}\n language=\"markdown\"\n readOnly={isReadOnly}\n fontSize={11}\n height=\"max(32rem, calc(100dvh - 18rem))\"\n className={`agent-skill-editor__code${fieldErrors.body ? \" agent-skill-editor__code--invalid\" : \"\"}`}\n />\n {fieldErrors.body && <small className=\"agent-skill-editor__field-error agent-skill-editor__body-error\">{fieldErrors.body}</small>}\n </section>\n </div>\n ),\n },\n {\n value: \"agents\",\n label: \"Agents\",\n content: (\n <section className=\"agent-skill-editor__agents\">\n <div>\n <h2>Associated agents</h2>\n <p>Agents linked to this skill. Associations are read-only here.</p>\n </div>\n {isLoading ? (\n <p>Loading associated agents…</p>\n ) : agents.length ? (\n <div className=\"agent-skill-editor__agent-grid\">\n {agents.map((agent, index) => (\n <article className=\"agent-skill-editor__agent-card\" key={String(agent.id ?? agent.name ?? index)}>\n <span>{(agent.name ?? agent.title ?? \"A\").slice(0, 1).toUpperCase()}</span>\n <strong>{agent.name ?? agent.title ?? \"Unnamed agent\"}</strong>\n </article>\n ))}\n </div>\n ) : (\n <div className=\"agent-skill-editor__empty\">No agents are currently associated with this skill.</div>\n )}\n </section>\n ),\n },\n ];\n\n return (\n <main className=\"agent-skill-editor\">\n <header className=\"agent-skill-editor__header\">\n <div>\n <div className=\"agent-skill-editor__heading-with-refresh\"><h1>{record ? \"Edit Skill\" : \"Create Skill\"}</h1>{record?.id && <button type=\"button\" className={`agent-skill-editor__refresh${isFetching ? \" is-loading\" : \"\"}`} aria-label=\"Refresh skill\" title=\"Refresh skill\" disabled={isFetching || isSaving} onClick={requestRefresh}><RefreshCw size={14} /></button>}</div>\n </div>\n <div className=\"agent-skill-editor__actions\">\n <SolidButton variant=\"secondary\" leftIcon={<ArrowLeft size={16} />} onClick={() => navigate(-1)}>\n Back\n </SolidButton>\n {!isReadOnly && (\n <SolidButton loading={isCreating || isSaving} disabled={creatingTag} onClick={handleSave}>\n Save Skill\n </SolidButton>\n )}\n </div>\n </header>\n\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 skill content.</p></SolidDialogBody>\n </SolidDialog>\n\n {isLoading ? (\n <div className=\"agent-skill-editor__loading\">Loading skill…</div>\n ) : record?.id ? (\n <AgentRegistryAuditPanel\n modelSingularName=\"agentSkillRegistry\"\n recordId={record.id}\n refreshVersion={auditRefreshVersion}\n modelUserKey={record.name}\n >\n <SolidTabGroup\n tabs={tabs}\n value={activeTab}\n onValueChange={setActiveTab}\n className=\"agent-skill-editor__tabs\"\n listClassName=\"agent-skill-editor__tab-list\"\n panelClassName=\"agent-skill-editor__tab-panel\"\n />\n </AgentRegistryAuditPanel>\n ) : (\n <SolidTabGroup\n tabs={tabs}\n value={activeTab}\n onValueChange={setActiveTab}\n className=\"agent-skill-editor__tabs\"\n listClassName=\"agent-skill-editor__tab-list\"\n panelClassName=\"agent-skill-editor__tab-panel\"\n />\n )}\n </main>\n );\n}\n"]}
1
+ {"version":3,"file":"AgentSkillRegistryEditorPage.js","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/AgentSkillRegistryEditorPage.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,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,mBAAmB,EAAoB,MAAM,qBAAqB,CAAC;AACjH,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,qBAAqB,EAAuB,MAAM,uBAAuB,CAAC;AAC5H,OAAO,EACL,WAAW,EACX,eAAe,EACf,WAAW,EACX,eAAe,EACf,eAAe,EACf,UAAU,EACV,aAAa,GACd,MAAM,mCAAmC,CAAC;AAC3C,OAAO,oCAAoC,CAAC;AAqB5C,SAAS,mBAAmB,CAAC,QAAiB;IAC5C,IAAI,SAAS,GAAY,QAAQ,CAAC;IAClC,KAAK,IAAI,KAAK,GA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,OAAO,EAAC,WAAW,EAAC,OAAO,EAAE,cAAM,OAAA,iBAAiB,CAAC,KAAK,CAAC,EAAxB,CAAwB,uBAAsB,EAAA,KAAC,WAAW,IAAC,IAAI,EAAC,QAAQ,EAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,cAAQ,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC,CAAC,oCAAmC,IAAG,YACzQ,KAAC,eAAe,cAAC,oHAAgG,GAAkB,GACvH,EAEb,SAAS,CAAC,CAAC,CAAC,CACX,cAAK,SAAS,EAAC,6BAA6B,oCAAqB,CAClE,CAAC,CAAC,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,EAAE,EAAC,CAAC,CAAC,CACf,KAAC,uBAAuB,IACtB,iBAAiB,EAAC,oBAAoB,EACtC,QAAQ,EAAE,MAAM,CAAC,EAAE,EACnB,cAAc,EAAE,mBAAmB,EACnC,YAAY,EAAE,MAAM,CAAC,IAAI,YAEzB,KAAC,aAAa,IACZ,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,SAAS,EAChB,aAAa,EAAE,YAAY,EAC3B,SAAS,EAAC,0BAA0B,EACpC,aAAa,EAAC,8BAA8B,EAC5C,cAAc,EAAC,+BAA+B,GAC9C,GACsB,CAC3B,CAAC,CAAC,CAAC,CACF,KAAC,aAAa,IACZ,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,SAAS,EAChB,aAAa,EAAE,YAAY,EAC3B,SAAS,EAAC,0BAA0B,EACpC,aAAa,EAAC,8BAA8B,EAC5C,cAAc,EAAC,+BAA+B,GAC9C,CACH,IACI,CACR,CAAC;AACJ,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 { AgentRegistryAuditPanel } from \"./AgentRegistryAuditPanel\";\nimport { AgentHubTagsField, agentHubTagsFrom, agentHubTagsPayload, type AgentHubTag } from \"./AgentHubTagsField\";\nimport { AgentHubModuleField, agentHubModuleFrom, agentHubModulePayload, type AgentHubModule } from \"./AgentHubModuleField\";\nimport {\n SolidButton,\n SolidCodeEditor,\n SolidDialog,\n SolidDialogBody,\n SolidIconPicker,\n SolidInput,\n SolidTabGroup,\n} from \"../../../../components/shad-cn-ui\";\nimport \"./AgentSkillRegistryEditorPage.css\";\n\ntype AgentReference = {\n id?: number | string;\n name?: string;\n title?: string;\n agentRegistry?: AgentReference | number | string | null;\n};\n\ntype SkillRecord = {\n id: number;\n name?: string;\n type?: string;\n iconName?: string | null;\n description?: string;\n body?: string;\n tags?: AgentHubTag[];\n module?: AgentHubModule | null;\n agentSkills?: AgentReference[] | AgentReference | 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\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 skill.\";\n const apiError = error as Record<string, any>;\n // Nest validation details are nested at data.data.message; prefer them over\n // the generic outer \"Bad Request Exception\" message.\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 skill.\";\n}\n\nfunction skillAgents(record?: SkillRecord): AgentReference[] {\n const related = record?.agentSkills;\n const links = Array.isArray(related)\n ? related\n : related\n ? [related]\n : [];\n const seen = new Set<string>();\n\n return links\n .map((link) => link.agentRegistry)\n .filter((agent): agent is AgentReference => 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}\n\nexport function AgentSkillRegistryEditorPage() {\n const { id = \"\" } = useParams<{ id: string }>();\n const navigate = useNavigate();\n const dispatch = useDispatch();\n const entityApi = React.useMemo(() => createSolidEntityApi(\"agentSkillRegistry\"), []);\n const {\n useCreateSolidEntityMutation,\n useGetSolidEntityByIdQuery,\n useUpdateSolidEntityMutation,\n } = entityApi;\n\n const { data: response, isLoading, isFetching, refetch } = useGetSolidEntityByIdQuery(\n {\n id,\n qs: \"populate[0]=agentSkills&populate[1]=agentSkills.agentRegistry&populate[2]=tags&populate[3]=module\",\n },\n { skip: !id || id === \"new\" },\n );\n const [createSkill, { isLoading: isCreating }] = useCreateSolidEntityMutation();\n const [updateSkill, { isLoading: isSaving }] = useUpdateSolidEntityMutation();\n const record = extractEntityRecord(response) as SkillRecord | undefined;\n\n const [activeTab, setActiveTab] = React.useState(\"general\");\n const [name, setName] = React.useState(\"\");\n const [type, setType] = React.useState(\"custom\");\n const [iconName, setIconName] = React.useState(\"\");\n const [description, setDescription] = React.useState(\"\");\n const [body, setBody] = 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 baseline = React.useRef(\"\");\n const currentForm = () => JSON.stringify({ name, type, iconName, description, body, 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 setType(record?.type ?? \"custom\");\n setIconName(record?.iconName ?? \"\");\n setDescription(record?.description ?? \"\");\n setBody(record?.body ?? \"\");\n setTags(nextTags);\n setModule(nextModule);\n baseline.current = JSON.stringify({ name: record?.name ?? \"\", type: record?.type ?? \"custom\", iconName: record?.iconName ?? \"\", description: record?.description ?? \"\", body: record?.body ?? \"\", 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 handleSave = async () => {\n if (creatingTag) return;\n const nextErrors: Record<string, string> = {};\n if (!name.trim()) nextErrors.name = \"Name is required.\";\n if (!type.trim()) nextErrors.type = \"Skill type is required.\";\n if (!description.trim()) nextErrors.description = \"Description is required.\";\n if (!body.trim()) nextErrors.body = \"Skill instructions are required.\";\n if (!module) nextErrors.module = \"Module is required. Select a module before saving this skill.\";\n\n setFieldErrors(nextErrors);\n if (Object.keys(nextErrors).length > 0) {\n setActiveTab(nextErrors.body ? \"skill\" : \"general\");\n dispatch(showToast({\n severity: \"error\",\n summary: \"Missing information\",\n detail: Object.values(nextErrors).join(\" \"),\n }));\n return;\n }\n\n const payload = {\n name: name.trim(),\n type,\n iconName: iconName || null,\n description: description.trim(),\n body,\n ...agentHubTagsPayload(tags),\n ...agentHubModulePayload(module),\n };\n\n try {\n if (record?.id) {\n await updateSkill({ id: record.id, data: payload }).unwrap();\n dispatch(showToast({\n severity: \"success\",\n summary: \"Saved\",\n detail: \"Skill updated successfully.\",\n }));\n setAuditRefreshVersion((version) => version + 1);\n refetch();\n } else {\n const result: any = await createSkill(payload).unwrap();\n const createdId = result?.data?.id ?? result?.id;\n dispatch(showToast({\n severity: \"success\",\n summary: \"Created\",\n detail: \"Skill created successfully.\",\n }));\n if (createdId) {\n navigate(`/admin/core/solid-core/agent-skill-registry/editor/${createdId}`, {\n replace: true,\n });\n }\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\", \"type\", \"description\", \"body\", \"module\"]) {\n if (!new RegExp(`\\\\b${field}\\\\b`, \"i\").test(errorDetail)) continue;\n const label = field === \"body\" ? \"Skill instructions\" : 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.body ? \"skill\" : \"general\");\n }\n dispatch(showToast({\n severity: \"error\",\n summary: \"Save failed\",\n detail: errorDetail,\n }));\n }\n };\n\n const agents = skillAgents(record);\n const tabs = [\n {\n value: \"general\",\n label: \"General Info\",\n content: (\n <fieldset className=\"agent-skill-editor__general\" disabled={isReadOnly}>\n {isReadOnly && <p className=\"agent-skill-editor__readonly-note\">SolidX skills cannot be edited.</p>}\n <div className=\"agent-skill-editor__fields\">\n <label className=\"agent-skill-editor__field\">\n <span>Name <b>*</b></span>\n <SolidInput\n value={name}\n aria-invalid={Boolean(fieldErrors.name)}\n aria-describedby={fieldErrors.name ? \"agent-skill-name-error\" : undefined}\n className={fieldErrors.name ? \"agent-skill-editor__input--invalid\" : undefined}\n onChange={(event) => {\n setName(event.target.value);\n setFieldErrors((current) => ({ ...current, name: \"\" }));\n }}\n />\n {fieldErrors.name && <small id=\"agent-skill-name-error\" className=\"agent-skill-editor__field-error\">{fieldErrors.name}</small>}\n </label>\n <div className=\"agent-skill-editor__field\">\n <span>Icon</span>\n <SolidIconPicker value={iconName} onChange={setIconName} />\n </div>\n <label className=\"agent-skill-editor__field\">\n <span>Description <b>*</b></span>\n <SolidInput\n value={description}\n aria-invalid={Boolean(fieldErrors.description)}\n aria-describedby={fieldErrors.description ? \"agent-skill-description-error\" : undefined}\n className={fieldErrors.description ? \"agent-skill-editor__input--invalid\" : undefined}\n onChange={(event) => {\n setDescription(event.target.value);\n setFieldErrors((current) => ({ ...current, description: \"\" }));\n }}\n />\n {fieldErrors.description && <small id=\"agent-skill-description-error\" className=\"agent-skill-editor__field-error\">{fieldErrors.description}</small>}\n </label>\n </div>\n <label className=\"agent-skill-editor__field\">\n <span>Skill type <b>*</b></span>\n <select\n value={type}\n aria-invalid={Boolean(fieldErrors.type)}\n aria-describedby={fieldErrors.type ? \"agent-skill-type-error\" : undefined}\n className={fieldErrors.type ? \"agent-skill-editor__input--invalid\" : undefined}\n onChange={(event) => {\n setType(event.target.value);\n setFieldErrors((current) => ({ ...current, type: \"\" }));\n }}\n >\n {isReadOnly && <option value=\"solidx\">SolidX</option>}\n <option value=\"thirdparty\">Third Party</option>\n <option value=\"custom\">Custom</option>\n </select>\n {fieldErrors.type && <small id=\"agent-skill-type-error\" className=\"agent-skill-editor__field-error\">{fieldErrors.type}</small>}\n </label>\n <AgentHubModuleField className=\"agent-skill-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 </fieldset>\n ),\n },\n {\n value: \"skill\",\n label: \"Skill\",\n content: (\n <div className=\"agent-skill-editor__skill\">\n <section className=\"agent-skill-editor__panel\">\n <header>\n <h2>Skill instructions <b>*</b></h2>\n <p>Write the skill's Markdown body here.</p>\n </header>\n <SolidCodeEditor\n value={body}\n onChange={(value) => {\n setBody(value ?? \"\");\n setFieldErrors((current) => ({ ...current, body: \"\" }));\n }}\n language=\"markdown\"\n wordWrap=\"on\"\n readOnly={isReadOnly}\n fontSize={11}\n height=\"max(32rem, calc(100dvh - 18rem))\"\n className={`agent-skill-editor__code${fieldErrors.body ? \" agent-skill-editor__code--invalid\" : \"\"}`}\n />\n {fieldErrors.body && <small className=\"agent-skill-editor__field-error agent-skill-editor__body-error\">{fieldErrors.body}</small>}\n </section>\n </div>\n ),\n },\n {\n value: \"agents\",\n label: \"Agents\",\n content: (\n <section className=\"agent-skill-editor__agents\">\n <div>\n <h2>Associated agents</h2>\n <p>Agents linked to this skill. Associations are read-only here.</p>\n </div>\n {isLoading ? (\n <p>Loading associated agents…</p>\n ) : agents.length ? (\n <div className=\"agent-skill-editor__agent-grid\">\n {agents.map((agent, index) => (\n <article className=\"agent-skill-editor__agent-card\" key={String(agent.id ?? agent.name ?? index)}>\n <span>{(agent.name ?? agent.title ?? \"A\").slice(0, 1).toUpperCase()}</span>\n <strong>{agent.name ?? agent.title ?? \"Unnamed agent\"}</strong>\n </article>\n ))}\n </div>\n ) : (\n <div className=\"agent-skill-editor__empty\">No agents are currently associated with this skill.</div>\n )}\n </section>\n ),\n },\n ];\n\n return (\n <main className=\"agent-skill-editor\">\n <header className=\"agent-skill-editor__header\">\n <div>\n <div className=\"agent-skill-editor__heading-with-refresh\"><h1>{record ? \"Edit Skill\" : \"Create Skill\"}</h1>{record?.id && <button type=\"button\" className={`agent-skill-editor__refresh${isFetching ? \" is-loading\" : \"\"}`} aria-label=\"Refresh skill\" title=\"Refresh skill\" disabled={isFetching || isSaving} onClick={requestRefresh}><RefreshCw size={14} /></button>}</div>\n </div>\n <div className=\"agent-skill-editor__actions\">\n <SolidButton variant=\"secondary\" leftIcon={<ArrowLeft size={16} />} onClick={() => navigate(-1)}>\n Back\n </SolidButton>\n {!isReadOnly && (\n <SolidButton loading={isCreating || isSaving} disabled={creatingTag} onClick={handleSave}>\n Save Skill\n </SolidButton>\n )}\n </div>\n </header>\n\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 skill content.</p></SolidDialogBody>\n </SolidDialog>\n\n {isLoading ? (\n <div className=\"agent-skill-editor__loading\">Loading skill…</div>\n ) : record?.id ? (\n <AgentRegistryAuditPanel\n modelSingularName=\"agentSkillRegistry\"\n recordId={record.id}\n refreshVersion={auditRefreshVersion}\n modelUserKey={record.name}\n >\n <SolidTabGroup\n tabs={tabs}\n value={activeTab}\n onValueChange={setActiveTab}\n className=\"agent-skill-editor__tabs\"\n listClassName=\"agent-skill-editor__tab-list\"\n panelClassName=\"agent-skill-editor__tab-panel\"\n />\n </AgentRegistryAuditPanel>\n ) : (\n <SolidTabGroup\n tabs={tabs}\n value={activeTab}\n onValueChange={setActiveTab}\n className=\"agent-skill-editor__tabs\"\n listClassName=\"agent-skill-editor__tab-list\"\n panelClassName=\"agent-skill-editor__tab-panel\"\n />\n )}\n </main>\n );\n}\n"]}
@@ -6,6 +6,7 @@ import { createSolidEntityApi } from "../../../../redux/api/solidEntityApi";
6
6
  import { showToast } from "../../../../redux/features/toastSlice";
7
7
  import { AgentRegistryAuditPanel } from "./AgentRegistryAuditPanel";
8
8
  import { AgentHubTagsField, agentHubTagsFrom, agentHubTagsPayload, type AgentHubTag } from "./AgentHubTagsField";
9
+ import { AgentHubModuleField, agentHubModuleFrom, agentHubModulePayload, type AgentHubModule } from "./AgentHubModuleField";
9
10
  import {
10
11
  SolidButton,
11
12
  SolidCodeEditor,
@@ -32,6 +33,7 @@ type SkillRecord = {
32
33
  description?: string;
33
34
  body?: string;
34
35
  tags?: AgentHubTag[];
36
+ module?: AgentHubModule | null;
35
37
  agentSkills?: AgentReference[] | AgentReference | null;
36
38
  };
37
39
 
@@ -107,7 +109,7 @@ export function AgentSkillRegistryEditorPage() {
107
109
  const { data: response, isLoading, isFetching, refetch } = useGetSolidEntityByIdQuery(
108
110
  {
109
111
  id,
110
- qs: "populate[0]=agentSkills&populate[1]=agentSkills.agentRegistry&populate[2]=tags",
112
+ qs: "populate[0]=agentSkills&populate[1]=agentSkills.agentRegistry&populate[2]=tags&populate[3]=module",
111
113
  },
112
114
  { skip: !id || id === "new" },
113
115
  );
@@ -122,22 +124,25 @@ export function AgentSkillRegistryEditorPage() {
122
124
  const [description, setDescription] = React.useState("");
123
125
  const [body, setBody] = React.useState("");
124
126
  const [tags, setTags] = React.useState<AgentHubTag[]>([]);
127
+ const [module, setModule] = React.useState<AgentHubModule | null>(null);
125
128
  const [creatingTag, setCreatingTag] = React.useState(false);
126
129
  const [fieldErrors, setFieldErrors] = React.useState<Record<string, string>>({});
127
130
  const [auditRefreshVersion, setAuditRefreshVersion] = React.useState(0);
128
131
  const [confirmRefresh, setConfirmRefresh] = React.useState(false);
129
132
  const baseline = React.useRef("");
130
- const currentForm = () => JSON.stringify({ name, type, iconName, description, body, tags });
133
+ const currentForm = () => JSON.stringify({ name, type, iconName, description, body, tags, moduleId: module?.id ?? null });
131
134
 
132
135
  React.useEffect(() => {
133
136
  const nextTags = agentHubTagsFrom(record?.tags);
137
+ const nextModule = agentHubModuleFrom(record?.module);
134
138
  setName(record?.name ?? "");
135
139
  setType(record?.type ?? "custom");
136
140
  setIconName(record?.iconName ?? "");
137
141
  setDescription(record?.description ?? "");
138
142
  setBody(record?.body ?? "");
139
143
  setTags(nextTags);
140
- baseline.current = JSON.stringify({ name: record?.name ?? "", type: record?.type ?? "custom", iconName: record?.iconName ?? "", description: record?.description ?? "", body: record?.body ?? "", tags: nextTags });
144
+ setModule(nextModule);
145
+ baseline.current = JSON.stringify({ name: record?.name ?? "", type: record?.type ?? "custom", iconName: record?.iconName ?? "", description: record?.description ?? "", body: record?.body ?? "", tags: nextTags, moduleId: nextModule?.id ?? null });
141
146
  }, [record]);
142
147
 
143
148
  const isReadOnly = record?.type === "solidx";
@@ -151,6 +156,7 @@ export function AgentSkillRegistryEditorPage() {
151
156
  if (!type.trim()) nextErrors.type = "Skill type is required.";
152
157
  if (!description.trim()) nextErrors.description = "Description is required.";
153
158
  if (!body.trim()) nextErrors.body = "Skill instructions are required.";
159
+ if (!module) nextErrors.module = "Module is required. Select a module before saving this skill.";
154
160
 
155
161
  setFieldErrors(nextErrors);
156
162
  if (Object.keys(nextErrors).length > 0) {
@@ -170,6 +176,7 @@ export function AgentSkillRegistryEditorPage() {
170
176
  description: description.trim(),
171
177
  body,
172
178
  ...agentHubTagsPayload(tags),
179
+ ...agentHubModulePayload(module),
173
180
  };
174
181
 
175
182
  try {
@@ -200,9 +207,10 @@ export function AgentSkillRegistryEditorPage() {
200
207
  const errorDetail = getSaveErrorMessage(error);
201
208
  const serverFieldErrors: Record<string, string> = {};
202
209
  if (/required|not be empty|cannot be empty|should not be empty/i.test(errorDetail)) {
203
- for (const field of ["name", "type", "description", "body"]) {
210
+ for (const field of ["name", "type", "description", "body", "module"]) {
204
211
  if (!new RegExp(`\\b${field}\\b`, "i").test(errorDetail)) continue;
205
- serverFieldErrors[field] = `${field === "body" ? "Skill instructions" : field[0].toUpperCase() + field.slice(1)} is required.`;
212
+ const label = field === "body" ? "Skill instructions" : field === "module" ? "Module" : field[0].toUpperCase() + field.slice(1);
213
+ serverFieldErrors[field] = `${label} is required.`;
206
214
  }
207
215
  }
208
216
  if (Object.keys(serverFieldErrors).length > 0) {
@@ -224,7 +232,7 @@ export function AgentSkillRegistryEditorPage() {
224
232
  label: "General Info",
225
233
  content: (
226
234
  <fieldset className="agent-skill-editor__general" disabled={isReadOnly}>
227
- {isReadOnly && <p className="agent-skill-editor__readonly-note">SolidX skills are seeded by the AgentHub runtime and cannot be edited.</p>}
235
+ {isReadOnly && <p className="agent-skill-editor__readonly-note">SolidX skills cannot be edited.</p>}
228
236
  <div className="agent-skill-editor__fields">
229
237
  <label className="agent-skill-editor__field">
230
238
  <span>Name <b>*</b></span>
@@ -277,7 +285,8 @@ export function AgentSkillRegistryEditorPage() {
277
285
  </select>
278
286
  {fieldErrors.type && <small id="agent-skill-type-error" className="agent-skill-editor__field-error">{fieldErrors.type}</small>}
279
287
  </label>
280
- <AgentHubTagsField value={tags} onChange={setTags} disabled={isReadOnly || isCreating || isSaving} onBusyChange={setCreatingTag} />
288
+ <AgentHubModuleField className="agent-skill-editor__field" value={module} onChange={(value) => { setModule(value); setFieldErrors((current) => ({ ...current, module: "" })); }} disabled={isReadOnly || isCreating || isSaving} clearable={false} required error={fieldErrors.module} />
289
+ <AgentHubTagsField value={tags} onChange={setTags} module={module} disabled={isReadOnly || isCreating || isSaving} onBusyChange={setCreatingTag} />
281
290
  </fieldset>
282
291
  ),
283
292
  },
@@ -298,6 +307,7 @@ export function AgentSkillRegistryEditorPage() {
298
307
  setFieldErrors((current) => ({ ...current, body: "" }));
299
308
  }}
300
309
  language="markdown"
310
+ wordWrap="on"
301
311
  readOnly={isReadOnly}
302
312
  fontSize={11}
303
313
  height="max(32rem, calc(100dvh - 18rem))"
@@ -1 +1 @@
1
- {"version":3,"file":"AgentToolRegistryEditorPage.d.ts","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/AgentToolRegistryEditorPage.tsx"],"names":[],"mappings":"AAaA,OAAO,mCAAmC,CAAC;AA6D3C,wBAAgB,2BAA2B,4CAgN1C"}
1
+ {"version":3,"file":"AgentToolRegistryEditorPage.d.ts","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/AgentToolRegistryEditorPage.tsx"],"names":[],"mappings":"AAcA,OAAO,mCAAmC,CAAC;AA8D3C,wBAAgB,2BAA2B,4CAqN1C"}