@solidxai/core-ui 0.1.22-beta.1 → 0.1.22-beta.3
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.
- package/dist/components/core/chatter/SolidChatterCustomMessage.d.ts.map +1 -1
- package/dist/components/core/chatter/SolidChatterCustomMessage.js +17 -5
- package/dist/components/core/chatter/SolidChatterCustomMessage.js.map +1 -1
- package/dist/components/core/chatter/SolidChatterCustomMessage.tsx +23 -6
- package/dist/components/core/kanban/SolidKanbanView.d.ts.map +1 -1
- package/dist/components/core/kanban/SolidKanbanView.js +27 -24
- package/dist/components/core/kanban/SolidKanbanView.js.map +1 -1
- package/dist/components/core/kanban/SolidKanbanView.tsx +14 -7
- package/dist/components/core/module/ModulePackageDialog.d.ts.map +1 -1
- package/dist/components/core/module/ModulePackageDialog.js +28 -22
- package/dist/components/core/module/ModulePackageDialog.js.map +1 -1
- package/dist/components/core/module/ModulePackageDialog.tsx +24 -2
- package/dist/resources/globals.css +10 -1
- package/dist/routes/pages/admin/core/AgentRegistryEditorPage.css +5 -0
- package/dist/routes/pages/admin/core/AgentRegistryEditorPage.d.ts.map +1 -1
- package/dist/routes/pages/admin/core/AgentRegistryEditorPage.js +67 -57
- package/dist/routes/pages/admin/core/AgentRegistryEditorPage.js.map +1 -1
- package/dist/routes/pages/admin/core/AgentRegistryEditorPage.tsx +14 -5
- package/dist/routes/pages/admin/core/AgentSkillRegistryEditorPage.css +29 -0
- package/dist/routes/pages/admin/core/AgentSkillRegistryEditorPage.d.ts.map +1 -1
- package/dist/routes/pages/admin/core/AgentSkillRegistryEditorPage.js +10 -8
- package/dist/routes/pages/admin/core/AgentSkillRegistryEditorPage.js.map +1 -1
- package/dist/routes/pages/admin/core/AgentSkillRegistryEditorPage.tsx +10 -5
- package/dist/routes/pages/admin/core/AgentToolRegistryEditorPage.d.ts.map +1 -1
- package/dist/routes/pages/admin/core/AgentToolRegistryEditorPage.js +38 -25
- package/dist/routes/pages/admin/core/AgentToolRegistryEditorPage.js.map +1 -1
- package/dist/routes/pages/admin/core/AgentToolRegistryEditorPage.tsx +8 -3
- package/package.json +1 -1
|
@@ -5,6 +5,8 @@ import { useNavigate, useParams, useSearchParams } from "react-router-dom";
|
|
|
5
5
|
import { createSolidEntityApi } from "../../../../redux/api/solidEntityApi";
|
|
6
6
|
import { solidPost } from "../../../../http/solidHttp";
|
|
7
7
|
import { useGetSolidSettingsQuery } from "../../../../redux/api/solidSettingsApi";
|
|
8
|
+
import { hasAnyRole } from "../../../../helpers/rolesHelper";
|
|
9
|
+
import { useSession } from "../../../../hooks/useSession";
|
|
8
10
|
import { getSettingsMap } from "../../../../helpers/settingsPayload";
|
|
9
11
|
import { showToast } from "../../../../redux/features/toastSlice";
|
|
10
12
|
import { AgentRegistryAuditPanel } from "./AgentRegistryAuditPanel";
|
|
@@ -342,6 +344,8 @@ function LinkPicker({ label, description, options, selected, onAdd, onRemove, cr
|
|
|
342
344
|
|
|
343
345
|
export function AgentRegistryEditorPage() {
|
|
344
346
|
const { id = "new" } = useParams<{ id: string }>();
|
|
347
|
+
const { data: session } = useSession();
|
|
348
|
+
const isAdmin = hasAnyRole(session?.user?.roles, ["Admin"]);
|
|
345
349
|
const [searchParams] = useSearchParams();
|
|
346
350
|
const navigate = useNavigate();
|
|
347
351
|
const dispatch = useDispatch();
|
|
@@ -381,6 +385,7 @@ export function AgentRegistryEditorPage() {
|
|
|
381
385
|
const [updateSecretLink] = agentSecretApi.useUpdateSolidEntityMutation();
|
|
382
386
|
const record = recordFrom(response) as Agent | undefined;
|
|
383
387
|
const [tab, setTab] = React.useState(searchParams.get("tab") === "config-versions" ? "config-versions" : "basics");
|
|
388
|
+
const [previewSystemPrompt, setPreviewSystemPrompt] = React.useState(false);
|
|
384
389
|
const jobs = jobApi.useGetSolidEntitiesQuery(
|
|
385
390
|
`offset=0&limit=1000&filters[agent][id][$eq]=${encodeURIComponent(id)}&${fieldsQuery(["id", "status"])}`,
|
|
386
391
|
{ skip: id === "new" || tab !== "jobs" });
|
|
@@ -585,7 +590,7 @@ export function AgentRegistryEditorPage() {
|
|
|
585
590
|
if (stepLimit < 1 || turnStepLimit < 1 || costLimit < 0) next.limits = "Step limits must be positive and cost limit cannot be negative.";
|
|
586
591
|
setErrors(next);
|
|
587
592
|
if (Object.keys(next).length) {
|
|
588
|
-
setTab(next.systemPrompt ? "persona" : next.limits ? "policies" : "basics");
|
|
593
|
+
setTab(next.systemPrompt ? "persona" : next.limits && isAdmin ? "policies" : "basics");
|
|
589
594
|
dispatch(showToast({ severity: "error", summary: "Missing information", detail: Object.values(next).join(" ") }));
|
|
590
595
|
return false;
|
|
591
596
|
}
|
|
@@ -753,8 +758,11 @@ export function AgentRegistryEditorPage() {
|
|
|
753
758
|
</section>
|
|
754
759
|
</div> },
|
|
755
760
|
{ value: "persona", label: "System Prompt", 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>
|
|
756
|
-
|
|
757
|
-
|
|
761
|
+
<div className="agent-editor__persona-actions"><button type="button" className="agent-editor__persona-preview-toggle" aria-pressed={previewSystemPrompt} aria-label={previewSystemPrompt ? "Edit system prompt" : "Preview system prompt"} title={previewSystemPrompt ? "Edit system prompt" : "Preview system prompt"} onClick={() => setPreviewSystemPrompt((current) => !current)}>
|
|
762
|
+
{previewSystemPrompt ? <Pencil size={15} aria-hidden="true" /> : <Eye size={15} aria-hidden="true" />}
|
|
763
|
+
</button>{record?.id && <AgentPersonaHistory agentId={record.id} savedPrompt={record.systemPrompt ?? ""} refreshVersion={auditVersion} />}</div></div>
|
|
764
|
+
{previewSystemPrompt ? <div className="agent-editor__persona-preview" role="region" aria-label="System prompt preview">{systemPrompt.trim() ? <SolidAgentMarkdown text={systemPrompt} /> : <p className="agent-editor__hint">Nothing to preview yet.</p>}</div>
|
|
765
|
+
: <SolidCodeEditor value={systemPrompt} onChange={(value) => { setSystemPrompt(value ?? ""); setErrors((current) => ({ ...current, systemPrompt: "" })); }} language="markdown" wordWrap="on" fontSize={11} height="max(34rem, calc(100dvh - 18rem))" />}
|
|
758
766
|
{errors.systemPrompt && <small className="agent-editor__error">{errors.systemPrompt}</small>}</section> },
|
|
759
767
|
{ 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))}
|
|
760
768
|
onAdd={(id) => toggle(setSkillIds, id)} onRemove={(id) => toggle(setSkillIds, id)} createUrl="/admin/core/solid-core/agent-skill-registry/editor/new"
|
|
@@ -793,12 +801,13 @@ export function AgentRegistryEditorPage() {
|
|
|
793
801
|
: items(related).length ? <div className="agent-editor__related">{items(related).map((item) => <article key={item.id}><strong>{item.name ?? item.title ?? `#${item.id}`}</strong><span>{item.status ?? ""}</span></article>)}</div>
|
|
794
802
|
: <div className="agent-editor__empty">No {label.toLowerCase()} for this agent yet.</div>}</section> })),
|
|
795
803
|
...(record?.id ? [{ value: "sessions", label: "Sessions", content: <AgentSessionsPanel agentId={record.id} agentLabel={record.name ?? record.title} /> }] : []),
|
|
796
|
-
...(record?.id ? [{ value: "config-versions", label: "
|
|
804
|
+
...(record?.id ? [{ value: "config-versions", label: "Version History", content: <AgentConfigVersionsPanel agentId={record.id} active={tab === "config-versions"} /> }] : []),
|
|
797
805
|
...(record?.id ? [{ value: "embedding", label: "Embedding", content: <AgentEmbeddingPanel agentId={record.id}
|
|
798
806
|
fields={parseInputs(record.requiredInputs)} active={record.status === "active"}
|
|
799
807
|
hubUrl={String(getSettingsMap(settings).solidxAgentHubBackendUrl ?? "")} /> }] : []),
|
|
800
808
|
];
|
|
801
|
-
const
|
|
809
|
+
const visibleTabs = isAdmin ? tabs : tabs.filter(({ value }) => !["policies", "processes", "jobs", "sessions", "embedding"].includes(value));
|
|
810
|
+
const content = <SolidTabGroup tabs={visibleTabs} value={tab} onValueChange={setTab} className="agent-editor__tabs" listClassName="agent-editor__tab-list" panelClassName="agent-editor__tab-panel" />;
|
|
802
811
|
return <main className="agent-editor"><header className="agent-editor__header"><div className="agent-editor__heading-with-refresh"><h1>{record?.id ? "Edit Agent" : "Create Agent"}</h1>{record?.id && <button type="button" className={`agent-editor__refresh${isFetching ? " is-loading" : ""}`} aria-label="Refresh agent" title="Refresh agent" disabled={isFetching || updating} onClick={requestRefresh}><RefreshCw size={14} /></button>}</div><div className="agent-editor__actions">
|
|
803
812
|
<SolidButton variant="secondary" leftIcon={<ArrowLeft size={16} />} onClick={() => navigate(-1)}>Back</SolidButton>
|
|
804
813
|
{record?.id && <SolidButton variant="secondary" leftIcon={<FlaskConical size={16} />} onClick={openAgentTest}>Test Agent</SolidButton>}
|
|
@@ -191,10 +191,39 @@
|
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
.agent-skill-editor__panel header {
|
|
194
|
+
display: flex;
|
|
195
|
+
align-items: center;
|
|
196
|
+
justify-content: space-between;
|
|
197
|
+
gap: 1rem;
|
|
194
198
|
padding: 0.9rem 1rem;
|
|
195
199
|
border-bottom: 1px solid var(--surface-border, var(--border));
|
|
196
200
|
}
|
|
197
201
|
|
|
202
|
+
.agent-skill-editor__preview-toggle {
|
|
203
|
+
display: grid;
|
|
204
|
+
flex: 0 0 auto;
|
|
205
|
+
place-items: center;
|
|
206
|
+
width: 2.15rem;
|
|
207
|
+
height: 2.15rem;
|
|
208
|
+
padding: 0;
|
|
209
|
+
border: 1px solid var(--surface-border, var(--border));
|
|
210
|
+
border-radius: 0.6rem;
|
|
211
|
+
background: var(--surface-card, var(--card));
|
|
212
|
+
color: var(--text-color-secondary, var(--muted-foreground));
|
|
213
|
+
cursor: pointer;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.agent-skill-editor__preview-toggle:hover,
|
|
217
|
+
.agent-skill-editor__preview-toggle[aria-pressed="true"] {
|
|
218
|
+
border-color: color-mix(in srgb, var(--primary-color, var(--primary)) 42%, var(--surface-border, var(--border)));
|
|
219
|
+
background: color-mix(in srgb, var(--primary-color, var(--primary)) 7%, var(--surface-card, var(--card)));
|
|
220
|
+
color: var(--primary-color, var(--primary));
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.agent-skill-editor__preview-toggle:focus-visible { outline: 2px solid var(--primary-color, var(--primary)); outline-offset: 2px; }
|
|
224
|
+
.agent-skill-editor__preview { box-sizing: border-box; min-height: max(32rem, calc(100dvh - 18rem)); padding: 1.25rem; background: var(--surface-ground, var(--background)); }
|
|
225
|
+
.agent-skill-editor__preview-empty { color: var(--text-color-secondary, var(--muted-foreground)); }
|
|
226
|
+
|
|
198
227
|
.agent-skill-editor__panel h2,
|
|
199
228
|
.agent-skill-editor__agents h2 {
|
|
200
229
|
font-size: 1rem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentSkillRegistryEditorPage.d.ts","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/AgentSkillRegistryEditorPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AgentSkillRegistryEditorPage.d.ts","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/AgentSkillRegistryEditorPage.tsx"],"names":[],"mappings":"AAmBA,OAAO,oCAAoC,CAAC;AA+E5C,wBAAgB,4BAA4B,4CAoT3C"}
|
|
@@ -47,7 +47,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
47
47
|
};
|
|
48
48
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
49
49
|
import React from "react";
|
|
50
|
-
import { ArrowLeft, RefreshCw } from "lucide-react";
|
|
50
|
+
import { ArrowLeft, Eye, Pencil, RefreshCw } from "lucide-react";
|
|
51
51
|
import { useDispatch } from "react-redux";
|
|
52
52
|
import { useNavigate, useParams } from "react-router-dom";
|
|
53
53
|
import { createSolidEntityApi } from "../../../../redux/api/solidEntityApi";
|
|
@@ -55,6 +55,7 @@ import { showToast } from "../../../../redux/features/toastSlice";
|
|
|
55
55
|
import { AgentRegistryAuditPanel } from "./AgentRegistryAuditPanel";
|
|
56
56
|
import { AgentHubTagsField, agentHubTagsFrom, agentHubTagsPayload } from "./AgentHubTagsField";
|
|
57
57
|
import { AgentHubModuleField, agentHubModuleFrom, agentHubModulePayload } from "./AgentHubModuleField";
|
|
58
|
+
import { SolidAgentMarkdown } from "../../../../components/core/solid-agent/SolidAgentMarkdown";
|
|
58
59
|
import { SolidButton, SolidCodeEditor, SolidDialog, SolidDialogBody, SolidIconPicker, SolidInput, SolidTabGroup, } from "../../../../components/shad-cn-ui";
|
|
59
60
|
import "./AgentSkillRegistryEditorPage.css";
|
|
60
61
|
function extractEntityRecord(response) {
|
|
@@ -132,12 +133,13 @@ export function AgentSkillRegistryEditorPage() {
|
|
|
132
133
|
var _h = React.useState(""), iconName = _h[0], setIconName = _h[1];
|
|
133
134
|
var _j = React.useState(""), description = _j[0], setDescription = _j[1];
|
|
134
135
|
var _k = React.useState(""), body = _k[0], setBody = _k[1];
|
|
135
|
-
var _l = React.useState(
|
|
136
|
-
var _m = React.useState(
|
|
137
|
-
var _o = React.useState(
|
|
138
|
-
var _p = React.useState(
|
|
139
|
-
var _q = React.useState(
|
|
140
|
-
var _r = React.useState(
|
|
136
|
+
var _l = React.useState(false), previewBody = _l[0], setPreviewBody = _l[1];
|
|
137
|
+
var _m = React.useState([]), tags = _m[0], setTags = _m[1];
|
|
138
|
+
var _o = React.useState(null), module = _o[0], setModule = _o[1];
|
|
139
|
+
var _p = React.useState(false), creatingTag = _p[0], setCreatingTag = _p[1];
|
|
140
|
+
var _q = React.useState({}), fieldErrors = _q[0], setFieldErrors = _q[1];
|
|
141
|
+
var _r = React.useState(0), auditRefreshVersion = _r[0], setAuditRefreshVersion = _r[1];
|
|
142
|
+
var _s = React.useState(false), confirmRefresh = _s[0], setConfirmRefresh = _s[1];
|
|
141
143
|
var baseline = React.useRef("");
|
|
142
144
|
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 }); };
|
|
143
145
|
React.useEffect(function () {
|
|
@@ -263,7 +265,7 @@ export function AgentSkillRegistryEditorPage() {
|
|
|
263
265
|
{
|
|
264
266
|
value: "skill",
|
|
265
267
|
label: "Skill",
|
|
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) {
|
|
268
|
+
content: (_jsx("div", { className: "agent-skill-editor__skill", children: _jsxs("section", { className: "agent-skill-editor__panel", children: [_jsxs("header", { children: [_jsxs("div", { children: [_jsxs("h2", { children: ["Skill instructions ", _jsx("b", { children: "*" })] }), _jsx("p", { children: "Write the skill's Markdown body here." })] }), _jsx("button", { type: "button", className: "agent-skill-editor__preview-toggle", "aria-pressed": previewBody, "aria-label": previewBody ? "Edit skill body" : "Preview skill body", title: previewBody ? "Edit skill body" : "Preview skill body", onClick: function () { return setPreviewBody(function (current) { return !current; }); }, children: previewBody ? _jsx(Pencil, { size: 15, "aria-hidden": "true" }) : _jsx(Eye, { size: 15, "aria-hidden": "true" }) })] }), previewBody ? _jsx("div", { className: "agent-skill-editor__preview", role: "region", "aria-label": "Skill body preview", children: body.trim() ? _jsx(SolidAgentMarkdown, { text: body }) : _jsx("p", { className: "agent-skill-editor__preview-empty", children: "Nothing to preview yet." }) }) : _jsx(SolidCodeEditor, { value: body, onChange: function (value) {
|
|
267
269
|
setBody(value !== null && value !== void 0 ? value : "");
|
|
268
270
|
setFieldErrors(function (current) { return (__assign(__assign({}, current), { body: "" })); });
|
|
269
271
|
}, 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 })] }) })),
|
|
@@ -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,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,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE;QACzC,IAAI,CAAC,SAAS,IAAI,OAAO,SAAS,KAAK,QA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W,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"]}
|
|
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,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACjE,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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port { ArrowLeft, Eye, Pencil, 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 { SolidAgentMarkdown } from \"../../../../components/core/solid-agent/SolidAgentMarkdown\";\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 [previewBody, setPreviewBody] = React.useState(false);\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 <div><h2>Skill instructions <b>*</b></h2>\n <p>Write the skill's Markdown body here.</p></div>\n <button type=\"button\" className=\"agent-skill-editor__preview-toggle\" aria-pressed={previewBody} aria-label={previewBody ? \"Edit skill body\" : \"Preview skill body\"} title={previewBody ? \"Edit skill body\" : \"Preview skill body\"} onClick={() => setPreviewBody((current) => !current)}>\n {previewBody ? <Pencil size={15} aria-hidden=\"true\" /> : <Eye size={15} aria-hidden=\"true\" />}\n </button>\n </header>\n {previewBody ? <div className=\"agent-skill-editor__preview\" role=\"region\" aria-label=\"Skill body preview\">{body.trim() ? <SolidAgentMarkdown text={body} /> : <p className=\"agent-skill-editor__preview-empty\">Nothing to preview yet.</p>}</div> : <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"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { ArrowLeft, RefreshCw } from "lucide-react";
|
|
2
|
+
import { ArrowLeft, Eye, Pencil, RefreshCw } from "lucide-react";
|
|
3
3
|
import { useDispatch } from "react-redux";
|
|
4
4
|
import { useNavigate, useParams } from "react-router-dom";
|
|
5
5
|
import { createSolidEntityApi } from "../../../../redux/api/solidEntityApi";
|
|
@@ -7,6 +7,7 @@ import { showToast } from "../../../../redux/features/toastSlice";
|
|
|
7
7
|
import { AgentRegistryAuditPanel } from "./AgentRegistryAuditPanel";
|
|
8
8
|
import { AgentHubTagsField, agentHubTagsFrom, agentHubTagsPayload, type AgentHubTag } from "./AgentHubTagsField";
|
|
9
9
|
import { AgentHubModuleField, agentHubModuleFrom, agentHubModulePayload, type AgentHubModule } from "./AgentHubModuleField";
|
|
10
|
+
import { SolidAgentMarkdown } from "../../../../components/core/solid-agent/SolidAgentMarkdown";
|
|
10
11
|
import {
|
|
11
12
|
SolidButton,
|
|
12
13
|
SolidCodeEditor,
|
|
@@ -123,6 +124,7 @@ export function AgentSkillRegistryEditorPage() {
|
|
|
123
124
|
const [iconName, setIconName] = React.useState("");
|
|
124
125
|
const [description, setDescription] = React.useState("");
|
|
125
126
|
const [body, setBody] = React.useState("");
|
|
127
|
+
const [previewBody, setPreviewBody] = React.useState(false);
|
|
126
128
|
const [tags, setTags] = React.useState<AgentHubTag[]>([]);
|
|
127
129
|
const [module, setModule] = React.useState<AgentHubModule | null>(null);
|
|
128
130
|
const [creatingTag, setCreatingTag] = React.useState(false);
|
|
@@ -297,10 +299,13 @@ export function AgentSkillRegistryEditorPage() {
|
|
|
297
299
|
<div className="agent-skill-editor__skill">
|
|
298
300
|
<section className="agent-skill-editor__panel">
|
|
299
301
|
<header>
|
|
300
|
-
<h2>Skill instructions <b>*</b></h2>
|
|
301
|
-
|
|
302
|
+
<div><h2>Skill instructions <b>*</b></h2>
|
|
303
|
+
<p>Write the skill's Markdown body here.</p></div>
|
|
304
|
+
<button type="button" className="agent-skill-editor__preview-toggle" aria-pressed={previewBody} aria-label={previewBody ? "Edit skill body" : "Preview skill body"} title={previewBody ? "Edit skill body" : "Preview skill body"} onClick={() => setPreviewBody((current) => !current)}>
|
|
305
|
+
{previewBody ? <Pencil size={15} aria-hidden="true" /> : <Eye size={15} aria-hidden="true" />}
|
|
306
|
+
</button>
|
|
302
307
|
</header>
|
|
303
|
-
<SolidCodeEditor
|
|
308
|
+
{previewBody ? <div className="agent-skill-editor__preview" role="region" aria-label="Skill body preview">{body.trim() ? <SolidAgentMarkdown text={body} /> : <p className="agent-skill-editor__preview-empty">Nothing to preview yet.</p>}</div> : <SolidCodeEditor
|
|
304
309
|
value={body}
|
|
305
310
|
onChange={(value) => {
|
|
306
311
|
setBody(value ?? "");
|
|
@@ -312,7 +317,7 @@ export function AgentSkillRegistryEditorPage() {
|
|
|
312
317
|
fontSize={11}
|
|
313
318
|
height="max(32rem, calc(100dvh - 18rem))"
|
|
314
319
|
className={`agent-skill-editor__code${fieldErrors.body ? " agent-skill-editor__code--invalid" : ""}`}
|
|
315
|
-
/>
|
|
320
|
+
/>}
|
|
316
321
|
{fieldErrors.body && <small className="agent-skill-editor__field-error agent-skill-editor__body-error">{fieldErrors.body}</small>}
|
|
317
322
|
</section>
|
|
318
323
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentToolRegistryEditorPage.d.ts","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/AgentToolRegistryEditorPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AgentToolRegistryEditorPage.d.ts","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/AgentToolRegistryEditorPage.tsx"],"names":[],"mappings":"AAgBA,OAAO,mCAAmC,CAAC;AA8D3C,wBAAgB,2BAA2B,4CAwN1C"}
|
|
@@ -45,12 +45,23 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
49
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
50
|
+
if (ar || !(i in from)) {
|
|
51
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
52
|
+
ar[i] = from[i];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
56
|
+
};
|
|
48
57
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
49
58
|
import React from "react";
|
|
50
59
|
import { ArrowLeft, RefreshCw } from "lucide-react";
|
|
51
60
|
import { useDispatch } from "react-redux";
|
|
52
61
|
import { useNavigate, useParams } from "react-router-dom";
|
|
53
62
|
import { createSolidEntityApi } from "../../../../redux/api/solidEntityApi";
|
|
63
|
+
import { hasAnyRole } from "../../../../helpers/rolesHelper";
|
|
64
|
+
import { useSession } from "../../../../hooks/useSession";
|
|
54
65
|
import { showToast } from "../../../../redux/features/toastSlice";
|
|
55
66
|
import { solidPatch } from "../../../../http/solidHttp";
|
|
56
67
|
import { AgentRegistryAuditPanel } from "./AgentRegistryAuditPanel";
|
|
@@ -110,30 +121,32 @@ function getSaveErrorMessage(error) {
|
|
|
110
121
|
}
|
|
111
122
|
export function AgentToolRegistryEditorPage() {
|
|
112
123
|
var _this = this;
|
|
113
|
-
var _a;
|
|
114
|
-
var
|
|
124
|
+
var _a, _b;
|
|
125
|
+
var _c = useParams().id, id = _c === void 0 ? "" : _c;
|
|
126
|
+
var session = useSession().data;
|
|
127
|
+
var isAdmin = hasAnyRole((_a = session === null || session === void 0 ? void 0 : session.user) === null || _a === void 0 ? void 0 : _a.roles, ["Admin"]);
|
|
115
128
|
var navigate = useNavigate();
|
|
116
129
|
var dispatch = useDispatch();
|
|
117
130
|
var entityApi = React.useMemo(function () { return createSolidEntityApi("agentToolRegistry"); }, []);
|
|
118
131
|
var useCreateSolidEntityMutation = entityApi.useCreateSolidEntityMutation, useGetSolidEntityByIdQuery = entityApi.useGetSolidEntityByIdQuery, useUpdateSolidEntityMutation = entityApi.useUpdateSolidEntityMutation;
|
|
119
|
-
var
|
|
120
|
-
var
|
|
121
|
-
var
|
|
132
|
+
var _d = useGetSolidEntityByIdQuery({ id: id, qs: "populate[0]=agentTools&populate[1]=agentTools.agentRegistry&populate[2]=tags&populate[3]=module" }, { skip: !id || id === "new" }), response = _d.data, isLoading = _d.isLoading, isFetching = _d.isFetching, refetch = _d.refetch;
|
|
133
|
+
var _e = useCreateSolidEntityMutation(), createTool = _e[0], isCreating = _e[1].isLoading;
|
|
134
|
+
var _f = useUpdateSolidEntityMutation(), updateTool = _f[0], isSaving = _f[1].isLoading;
|
|
122
135
|
var record = extractEntityRecord(response);
|
|
123
|
-
var
|
|
124
|
-
var
|
|
125
|
-
var
|
|
126
|
-
var
|
|
127
|
-
var
|
|
128
|
-
var
|
|
129
|
-
var
|
|
130
|
-
var
|
|
131
|
-
var
|
|
132
|
-
var
|
|
133
|
-
var
|
|
134
|
-
var
|
|
135
|
-
var
|
|
136
|
-
var
|
|
136
|
+
var _g = React.useState("general"), activeTab = _g[0], setActiveTab = _g[1];
|
|
137
|
+
var _h = React.useState(""), name = _h[0], setName = _h[1];
|
|
138
|
+
var _j = React.useState(""), iconName = _j[0], setIconName = _j[1];
|
|
139
|
+
var _k = React.useState(""), description = _k[0], setDescription = _k[1];
|
|
140
|
+
var _l = React.useState("custom"), type = _l[0], setType = _l[1];
|
|
141
|
+
var _m = React.useState(""), sourceCode = _m[0], setSourceCode = _m[1];
|
|
142
|
+
var _o = React.useState([]), tags = _o[0], setTags = _o[1];
|
|
143
|
+
var _p = React.useState(null), module = _p[0], setModule = _p[1];
|
|
144
|
+
var _q = React.useState(false), creatingTag = _q[0], setCreatingTag = _q[1];
|
|
145
|
+
var _r = React.useState({}), fieldErrors = _r[0], setFieldErrors = _r[1];
|
|
146
|
+
var _s = React.useState(0), auditRefreshVersion = _s[0], setAuditRefreshVersion = _s[1];
|
|
147
|
+
var _t = React.useState(false), confirmRefresh = _t[0], setConfirmRefresh = _t[1];
|
|
148
|
+
var _u = React.useState(false), activationOpen = _u[0], setActivationOpen = _u[1];
|
|
149
|
+
var _v = React.useState(null), activationTool = _v[0], setActivationTool = _v[1];
|
|
137
150
|
var preparingActivation = React.useRef(false);
|
|
138
151
|
var baseline = React.useRef("");
|
|
139
152
|
var currentForm = function () { var _a; return JSON.stringify({ name: name, iconName: iconName, description: description, type: type, sourceCode: sourceCode, tags: tags, moduleId: (_a = module === null || module === void 0 ? void 0 : module.id) !== null && _a !== void 0 ? _a : null }); };
|
|
@@ -293,8 +306,8 @@ export function AgentToolRegistryEditorPage() {
|
|
|
293
306
|
});
|
|
294
307
|
}, [record === null || record === void 0 ? void 0 : record.agentTools]);
|
|
295
308
|
var sessionAgents = React.useMemo(function () { return agents.filter(function (agent) { return agent.id !== undefined && agent.id !== null; }); }, [agents]);
|
|
296
|
-
var tabs = [
|
|
297
|
-
{ value: "general", label: "General Info", content: _jsxs("fieldset", { className: "agent-tool-editor__general", disabled: isReadOnly, children: [isReadOnly && _jsx("p", { className: "agent-tool-editor__readonly-note", children: "SolidX tools cannot be edited." }), (record === null || record === void 0 ? void 0 : record.status) && _jsxs("section", { className: "agent-tool-editor__runtime-status".concat(record.status === "load_failed" ? " agent-tool-editor__runtime-status--failed" : ""), role: record.status === "load_failed" ? "alert" : "status", children: [_jsxs("div", { className: "agent-tool-editor__runtime-heading", children: [_jsx("strong", { children: "Runtime status" }), _jsx("span", { children: record.status.replace(/[_-]+/g, " ") })] }), record.status === "load_failed" ? _jsxs(_Fragment, { children: [_jsx("p", { children: "The AgentHub runtime could not load this tool. After correcting its source or checksum, restart linked agent processes so the runtime retries loading it." }), record.lastLoadError && _jsx("pre", { children: record.lastLoadError })] }) : _jsx("p", { children: record.lastLoadError || "No tool load error has been reported." })] }), _jsxs("div", { className: "agent-tool-editor__fields", children: [_jsxs("label", { className: "agent-tool-editor__field", children: [_jsxs("span", { children: ["Name ", _jsx("b", { children: "*" })] }), _jsx(SolidInput, { value: name, "aria-invalid": Boolean(fieldErrors.name), "aria-describedby": fieldErrors.name ? "agent-tool-name-error" : undefined, className: fieldErrors.name ? "agent-tool-editor__input--invalid" : undefined, onChange: function (e) { setName(e.target.value); setFieldErrors(function (current) { return (__assign(__assign({}, current), { name: "" })); }); } }), fieldErrors.name && _jsx("small", { id: "agent-tool-name-error", className: "agent-tool-editor__field-error", children: fieldErrors.name })] }), _jsxs("div", { className: "agent-tool-editor__field", children: [_jsx("span", { children: "Icon" }), _jsx(SolidIconPicker, { value: iconName, onChange: setIconName })] }), _jsxs("label", { className: "agent-tool-editor__field", children: [_jsxs("span", { children: ["Description ", _jsx("b", { children: "*" })] }), _jsx(SolidInput, { value: description, "aria-invalid": Boolean(fieldErrors.description), "aria-describedby": fieldErrors.description ? "agent-tool-description-error" : undefined, className: fieldErrors.description ? "agent-tool-editor__input--invalid" : undefined, onChange: function (e) { setDescription(e.target.value); setFieldErrors(function (current) { return (__assign(__assign({}, current), { description: "" })); }); } }), fieldErrors.description && _jsx("small", { id: "agent-tool-description-error", className: "agent-tool-editor__field-error", children: fieldErrors.description })] })] }), !(record === null || record === void 0 ? void 0 : record.id) && _jsxs("label", { className: "agent-tool-editor__field", children: [_jsx("span", { children: "Tool status" }), _jsx("select", { value: "inactive", disabled: true, "aria-label": "Tool status", children: _jsx("option", { value: "inactive", children: "Inactive" }) }), _jsx("small", { children: "New tools start inactive. Run configuration and initialization checks to activate." })] }), _jsxs("label", { className: "agent-tool-editor__field", children: [_jsxs("span", { children: ["Tool type ", _jsx("b", { children: "*" })] }), _jsxs("select", { value: type, "aria-invalid": Boolean(fieldErrors.type), "aria-describedby": fieldErrors.type ? "agent-tool-type-error" : undefined, className: fieldErrors.type ? "agent-tool-editor__input--invalid" : undefined, onChange: function (e) { setType(e.target.value); setFieldErrors(function (current) { return (__assign(__assign({}, current), { type: "" })); }); }, children: [isReadOnly && _jsx("option", { value: "solidx", children: "SolidX" }), _jsx("option", { value: "thirdparty", children: "Third Party" }), _jsx("option", { value: "custom", children: "Custom" })] }), fieldErrors.type && _jsx("small", { id: "agent-tool-type-error", className: "agent-tool-editor__field-error", children: fieldErrors.type })] }), _jsx(AgentHubModuleField, { className: "agent-tool-editor__field", value: module, onChange: function (value) { setModule(value); setFieldErrors(function (current) { return (__assign(__assign({}, current), { module: "" })); }); }, disabled: isReadOnly || isCreating || isSaving, clearable: false, required: true, error: fieldErrors.module }), _jsx(AgentHubTagsField, { value: tags, onChange: setTags, module: module, disabled: isReadOnly || isCreating || isSaving, onBusyChange: setCreatingTag }), (record === null || record === void 0 ? void 0 : record.id) && _jsxs("section", { className: "agent-tool-editor__workflow", "aria-labelledby": "agent-tool-lifecycle-title", children: [_jsx("div", { className: "agent-tool-editor__workflow-head", children: _jsxs("div", { children: [_jsx("h2", { id: "agent-tool-lifecycle-title", children: "Tool lifecycle" }), _jsx("p", { children: "Configuration and initialization must pass before this tool can be activated." })] }) }), _jsx("div", { className: "agent-tool-editor__workflow-stages", "aria-label": "Current tool stage: ".concat(((
|
|
309
|
+
var tabs = __spreadArray([
|
|
310
|
+
{ value: "general", label: "General Info", content: _jsxs("fieldset", { className: "agent-tool-editor__general", disabled: isReadOnly, children: [isReadOnly && _jsx("p", { className: "agent-tool-editor__readonly-note", children: "SolidX tools cannot be edited." }), (record === null || record === void 0 ? void 0 : record.status) && _jsxs("section", { className: "agent-tool-editor__runtime-status".concat(record.status === "load_failed" ? " agent-tool-editor__runtime-status--failed" : ""), role: record.status === "load_failed" ? "alert" : "status", children: [_jsxs("div", { className: "agent-tool-editor__runtime-heading", children: [_jsx("strong", { children: "Runtime status" }), _jsx("span", { children: record.status.replace(/[_-]+/g, " ") })] }), record.status === "load_failed" ? _jsxs(_Fragment, { children: [_jsx("p", { children: "The AgentHub runtime could not load this tool. After correcting its source or checksum, restart linked agent processes so the runtime retries loading it." }), record.lastLoadError && _jsx("pre", { children: record.lastLoadError })] }) : _jsx("p", { children: record.lastLoadError || "No tool load error has been reported." })] }), _jsxs("div", { className: "agent-tool-editor__fields", children: [_jsxs("label", { className: "agent-tool-editor__field", children: [_jsxs("span", { children: ["Name ", _jsx("b", { children: "*" })] }), _jsx(SolidInput, { value: name, "aria-invalid": Boolean(fieldErrors.name), "aria-describedby": fieldErrors.name ? "agent-tool-name-error" : undefined, className: fieldErrors.name ? "agent-tool-editor__input--invalid" : undefined, onChange: function (e) { setName(e.target.value); setFieldErrors(function (current) { return (__assign(__assign({}, current), { name: "" })); }); } }), fieldErrors.name && _jsx("small", { id: "agent-tool-name-error", className: "agent-tool-editor__field-error", children: fieldErrors.name })] }), _jsxs("div", { className: "agent-tool-editor__field", children: [_jsx("span", { children: "Icon" }), _jsx(SolidIconPicker, { value: iconName, onChange: setIconName })] }), _jsxs("label", { className: "agent-tool-editor__field", children: [_jsxs("span", { children: ["Description ", _jsx("b", { children: "*" })] }), _jsx(SolidInput, { value: description, "aria-invalid": Boolean(fieldErrors.description), "aria-describedby": fieldErrors.description ? "agent-tool-description-error" : undefined, className: fieldErrors.description ? "agent-tool-editor__input--invalid" : undefined, onChange: function (e) { setDescription(e.target.value); setFieldErrors(function (current) { return (__assign(__assign({}, current), { description: "" })); }); } }), fieldErrors.description && _jsx("small", { id: "agent-tool-description-error", className: "agent-tool-editor__field-error", children: fieldErrors.description })] })] }), !(record === null || record === void 0 ? void 0 : record.id) && _jsxs("label", { className: "agent-tool-editor__field", children: [_jsx("span", { children: "Tool status" }), _jsx("select", { value: "inactive", disabled: true, "aria-label": "Tool status", children: _jsx("option", { value: "inactive", children: "Inactive" }) }), _jsx("small", { children: "New tools start inactive. Run configuration and initialization checks to activate." })] }), _jsxs("label", { className: "agent-tool-editor__field", children: [_jsxs("span", { children: ["Tool type ", _jsx("b", { children: "*" })] }), _jsxs("select", { value: type, "aria-invalid": Boolean(fieldErrors.type), "aria-describedby": fieldErrors.type ? "agent-tool-type-error" : undefined, className: fieldErrors.type ? "agent-tool-editor__input--invalid" : undefined, onChange: function (e) { setType(e.target.value); setFieldErrors(function (current) { return (__assign(__assign({}, current), { type: "" })); }); }, children: [isReadOnly && _jsx("option", { value: "solidx", children: "SolidX" }), _jsx("option", { value: "thirdparty", children: "Third Party" }), _jsx("option", { value: "custom", children: "Custom" })] }), fieldErrors.type && _jsx("small", { id: "agent-tool-type-error", className: "agent-tool-editor__field-error", children: fieldErrors.type })] }), _jsx(AgentHubModuleField, { className: "agent-tool-editor__field", value: module, onChange: function (value) { setModule(value); setFieldErrors(function (current) { return (__assign(__assign({}, current), { module: "" })); }); }, disabled: isReadOnly || isCreating || isSaving, clearable: false, required: true, error: fieldErrors.module }), _jsx(AgentHubTagsField, { value: tags, onChange: setTags, module: module, disabled: isReadOnly || isCreating || isSaving, onBusyChange: setCreatingTag }), (record === null || record === void 0 ? void 0 : record.id) && _jsxs("section", { className: "agent-tool-editor__workflow", "aria-labelledby": "agent-tool-lifecycle-title", children: [_jsx("div", { className: "agent-tool-editor__workflow-head", children: _jsxs("div", { children: [_jsx("h2", { id: "agent-tool-lifecycle-title", children: "Tool lifecycle" }), _jsx("p", { children: "Configuration and initialization must pass before this tool can be activated." })] }) }), _jsx("div", { className: "agent-tool-editor__workflow-stages", "aria-label": "Current tool stage: ".concat(((_b = record.status) !== null && _b !== void 0 ? _b : "inactive").replace(/[_-]+/g, " ")), children: [["active", "Active", "Enabled for loading into linked agents."], ["inactive", "Inactive", "Not loaded for linked agents."], ["load_failed", "Load failed", "AgentHub could not load this tool."]].map(function (_a, index) {
|
|
298
311
|
var _b;
|
|
299
312
|
var value = _a[0], label = _a[1], description = _a[2];
|
|
300
313
|
var currentStatus = (_b = record.status) !== null && _b !== void 0 ? _b : "inactive";
|
|
@@ -304,9 +317,9 @@ export function AgentToolRegistryEditorPage() {
|
|
|
304
317
|
return _jsxs(React.Fragment, { children: [index > 0 && _jsx("div", { className: "agent-tool-editor__workflow-connector", "aria-hidden": "true" }), _jsxs("button", { type: "button", className: "agent-tool-editor__workflow-stage agent-tool-editor__workflow-stage--".concat(value).concat(isCurrent ? " is-current" : ""), "aria-current": isCurrent ? "step" : undefined, "aria-pressed": isCurrent, disabled: disabled, onClick: function () { return value === "inactive" ? void save("inactive") : void beginActivation(); }, children: [_jsx("span", { className: "agent-tool-editor__workflow-mark", children: index + 1 }), _jsxs("span", { className: "agent-tool-editor__workflow-copy", children: [_jsx("strong", { children: label }), _jsx("small", { children: description }), _jsx("small", { className: "agent-tool-editor__workflow-cta", children: canRetry ? "Run checks and retry activation" : isCurrent ? "Current stage" : value === "load_failed" ? "Set automatically by AgentHub" : value === "active" ? "Run checks to activate" : "Click to deactivate" })] }), isCurrent && _jsx("span", { className: "agent-tool-editor__workflow-current", children: "Current" })] })] }, value);
|
|
305
318
|
}) }), record.status === "load_failed" && _jsx("small", { className: "agent-tool-editor__workflow-hint", children: "Fix the source or checksum, then run configuration and initialization checks before retrying activation." }), _jsx("small", { className: "agent-tool-editor__workflow-hint", children: "Activation checks use the saved tool configuration. Restart linked agent processes to apply status changes." })] })] }) },
|
|
306
319
|
{ value: "tool", label: "Tool", content: _jsx("div", { className: "agent-tool-editor__tool", children: _jsxs("section", { className: "agent-tool-editor__panel", children: [_jsxs("header", { children: [_jsxs("h2", { children: ["Tool source code ", _jsx("b", { children: "*" })] }), _jsx("p", { children: "Write the tool's Python code here." })] }), _jsx(SolidCodeEditor, { value: sourceCode, onChange: function (value) { setSourceCode(value !== null && value !== void 0 ? value : ""); setFieldErrors(function (current) { return (__assign(__assign({}, current), { sourceCode: "" })); }); }, language: "python", wordWrap: "on", readOnly: isReadOnly, fontSize: 11, height: "max(32rem, calc(100dvh - 18rem))", className: "agent-tool-editor__code".concat(fieldErrors.sourceCode ? " agent-tool-editor__code--invalid" : "") }), fieldErrors.sourceCode && _jsx("small", { className: "agent-tool-editor__field-error agent-tool-editor__code-error", children: fieldErrors.sourceCode })] }) }) },
|
|
307
|
-
{ value: "agents", label: "Agents", content: _jsxs("section", { className: "agent-tool-editor__agents", children: [_jsxs("div", { children: [_jsx("h2", { children: "Associated agents" }), _jsx("p", { children: "Agents linked to this tool. Associations are read-only here." })] }), isLoading ? _jsx("p", { children: "Loading associated agents\u2026" }) : agents.length ? _jsx("div", { className: "agent-tool-editor__agent-grid", children: agents.map(function (agent, index) { var _a, _b; return _jsx("div", { className: "agent-tool-editor__agent-card", children: _jsx(SharedAgentRegistryCard, { rowData: agent }) }, String((_b = (_a = agent.id) !== null && _a !== void 0 ? _a : agent.name) !== null && _b !== void 0 ? _b : index)); }) }) : _jsx("div", { className: "agent-tool-editor__empty", children: "No agents are currently associated with this tool." })] }) }
|
|
308
|
-
|
|
309
|
-
|
|
320
|
+
{ value: "agents", label: "Agents", content: _jsxs("section", { className: "agent-tool-editor__agents", children: [_jsxs("div", { children: [_jsx("h2", { children: "Associated agents" }), _jsx("p", { children: "Agents linked to this tool. Associations are read-only here." })] }), isLoading ? _jsx("p", { children: "Loading associated agents\u2026" }) : agents.length ? _jsx("div", { className: "agent-tool-editor__agent-grid", children: agents.map(function (agent, index) { var _a, _b; return _jsx("div", { className: "agent-tool-editor__agent-card", children: _jsx(SharedAgentRegistryCard, { rowData: agent }) }, String((_b = (_a = agent.id) !== null && _a !== void 0 ? _a : agent.name) !== null && _b !== void 0 ? _b : index)); }) }) : _jsx("div", { className: "agent-tool-editor__empty", children: "No agents are currently associated with this tool." })] }) }
|
|
321
|
+
], (isAdmin ? [{ value: "sessions", label: "Sessions", content: _jsx(AgentToolSessionsPanel, { agents: sessionAgents }) }] : []), true);
|
|
322
|
+
var visibleActiveTab = !isAdmin && activeTab === "sessions" ? "general" : activeTab;
|
|
310
323
|
return _jsxs("main", { className: "agent-tool-editor", children: [_jsxs("header", { className: "agent-tool-editor__header", children: [_jsx("div", { children: _jsxs("div", { className: "agent-tool-editor__heading-with-refresh", children: [_jsx("h1", { children: record ? "Edit Tool" : "Create Tool" }), (record === null || record === void 0 ? void 0 : record.id) && _jsx("button", { type: "button", className: "agent-tool-editor__refresh".concat(isFetching ? " is-loading" : ""), "aria-label": "Refresh tool", title: "Refresh tool", disabled: isFetching || isSaving, onClick: requestRefresh, children: _jsx(RefreshCw, { size: 14 }) })] }) }), _jsxs("div", { className: "agent-tool-editor__actions", children: [_jsx(SolidButton, { variant: "secondary", leftIcon: _jsx(ArrowLeft, { size: 16 }), onClick: function () { return navigate(-1); }, children: "Back" }), !isReadOnly && _jsx(SolidButton, { disabled: activationOpen || creatingTag, loading: isCreating || isSaving, onClick: function () { return void save(); }, children: "Save Tool" })] })] }), _jsx(SolidDialog, { open: confirmRefresh, onOpenChange: setConfirmRefresh, header: "Discard unsaved changes?", style: { width: "min(28rem, 94vw)" }, footer: _jsxs(_Fragment, { children: [_jsx(SolidButton, { type: "button", variant: "secondary", onClick: function () { return setConfirmRefresh(false); }, children: "Cancel" }), _jsx(SolidButton, { type: "button", disabled: isFetching, onClick: function () { setConfirmRefresh(false); void refetch(); }, children: "Refresh and discard" })] }), children: _jsx(SolidDialogBody, { children: _jsx("p", { children: "You have unsaved changes. Refreshing will discard them and load the latest tool content." }) }) }), activationOpen && activationTool && _jsx(AgentToolActivationDialog, { open: activationOpen, onOpenChange: setActivationOpen, toolId: activationTool.id, checksum: activationTool.checksum, toolName: activationTool.name, onActivated: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
311
324
|
return __generator(this, function (_a) {
|
|
312
325
|
switch (_a.label) {
|
|
@@ -319,6 +332,6 @@ export function AgentToolRegistryEditorPage() {
|
|
|
319
332
|
return [2 /*return*/];
|
|
320
333
|
}
|
|
321
334
|
});
|
|
322
|
-
}); } }), isLoading ? _jsx("div", { className: "agent-tool-editor__loading", children: "Loading tool\u2026" }) : (record === null || record === void 0 ? void 0 : record.id) ? (_jsx(AgentRegistryAuditPanel, { modelSingularName: "agentToolRegistry", recordId: record.id, refreshVersion: auditRefreshVersion, modelUserKey: record.name, children: _jsx(SolidTabGroup, { tabs: tabs, value:
|
|
335
|
+
}); } }), isLoading ? _jsx("div", { className: "agent-tool-editor__loading", children: "Loading tool\u2026" }) : (record === null || record === void 0 ? void 0 : record.id) ? (_jsx(AgentRegistryAuditPanel, { modelSingularName: "agentToolRegistry", recordId: record.id, refreshVersion: auditRefreshVersion, modelUserKey: record.name, children: _jsx(SolidTabGroup, { tabs: tabs, value: visibleActiveTab, onValueChange: setActiveTab, className: "agent-tool-editor__tabs", listClassName: "agent-tool-editor__tab-list", panelClassName: "agent-tool-editor__tab-panel" }) })) : _jsx(SolidTabGroup, { tabs: tabs, value: visibleActiveTab, onValueChange: setActiveTab, className: "agent-tool-editor__tabs", listClassName: "agent-tool-editor__tab-list", panelClassName: "agent-tool-editor__tab-panel" })] });
|
|
323
336
|
}
|
|
324
337
|
//# sourceMappingURL=AgentToolRegistryEditorPage.js.map
|