diff --git a/apiclient/types/assitant.go b/apiclient/types/assitant.go
index 35f01e7d..c43e871f 100644
--- a/apiclient/types/assitant.go
+++ b/apiclient/types/assitant.go
@@ -5,6 +5,7 @@ type Assistant struct {
Name string `json:"name"`
Description string `json:"description"`
Icons AgentIcons `json:"icons"`
+ EntityID string `json:"entityID"`
}
type AssistantList List[Assistant]
diff --git a/pkg/api/handlers/assistants.go b/pkg/api/handlers/assistants.go
index 984526e3..bd21d631 100644
--- a/pkg/api/handlers/assistants.go
+++ b/pkg/api/handlers/assistants.go
@@ -120,6 +120,7 @@ func convertAssistant(agent v1.Agent) types.Assistant {
Metadata: MetadataFrom(&agent),
Name: agent.Spec.Manifest.Name,
Description: agent.Spec.Manifest.Description,
+ EntityID: agent.ObjectMeta.Name,
Icons: icons,
}
assistant.ID = agent.Spec.Manifest.RefName
diff --git a/pkg/storage/openapi/generated/openapi_generated.go b/pkg/storage/openapi/generated/openapi_generated.go
index d35416e9..22b2faa4 100644
--- a/pkg/storage/openapi/generated/openapi_generated.go
+++ b/pkg/storage/openapi/generated/openapi_generated.go
@@ -574,8 +574,15 @@ func schema_otto8_ai_otto8_apiclient_types_Assistant(ref common.ReferenceCallbac
Ref: ref("github.com/otto8-ai/otto8/apiclient/types.AgentIcons"),
},
},
+ "entityID": {
+ SchemaProps: spec.SchemaProps{
+ Default: "",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
},
- Required: []string{"Metadata", "name", "description", "icons"},
+ Required: []string{"Metadata", "name", "description", "icons", "entityID"},
},
},
Dependencies: []string{
diff --git a/ui/admin/app/components/agent/Agent.tsx b/ui/admin/app/components/agent/Agent.tsx
index b07249e9..70b8d9b3 100644
--- a/ui/admin/app/components/agent/Agent.tsx
+++ b/ui/admin/app/components/agent/Agent.tsx
@@ -7,11 +7,9 @@ import { cn } from "~/lib/utils";
import { TypographyH4, TypographyP } from "~/components/Typography";
import { useAgent } from "~/components/agent/AgentContext";
import { AgentForm } from "~/components/agent/AgentForm";
+import { AgentPublishStatus } from "~/components/agent/AgentPublishStatus";
import { PastThreads } from "~/components/agent/PastThreads";
-import { Publish } from "~/components/agent/Publish";
import { ToolForm } from "~/components/agent/ToolForm";
-import { Unpublish } from "~/components/agent/Unpublish";
-import { CopyText } from "~/components/composed/CopyText";
import { AgentKnowledgePanel } from "~/components/knowledge";
import { Button } from "~/components/ui/button";
import { Card } from "~/components/ui/card";
@@ -52,26 +50,11 @@ export function Agent({ className, onRefresh }: AgentProps) {
return (
-
- {agentUpdates.refName ? (
-
- ) : (
-
- )}
-
- {agentUpdates.refName ? (
-
- ) : (
-
- )}
-
+
+
);
}
+
function convertTools(
tools: { tool: string; variant: "fixed" | "default" | "available" }[]
) {
diff --git a/ui/admin/app/components/agent/AgentPublishStatus.tsx b/ui/admin/app/components/agent/AgentPublishStatus.tsx
new file mode 100644
index 00000000..deb976d9
--- /dev/null
+++ b/ui/admin/app/components/agent/AgentPublishStatus.tsx
@@ -0,0 +1,97 @@
+import { Link } from "@remix-run/react";
+import { useMemo } from "react";
+import { $path } from "remix-routes";
+import useSWR from "swr";
+
+import { AgentBase } from "~/lib/model/agents";
+import { AssistantApiService } from "~/lib/service/api/assistantApiService";
+
+import { TypographySmall } from "~/components/Typography";
+import { Publish } from "~/components/agent/Publish";
+import { Unpublish } from "~/components/agent/Unpublish";
+import { CopyText } from "~/components/composed/CopyText";
+
+type AgentPublishStatusProps = {
+ agent: AgentBase;
+ onChange: (agent: Partial) => void;
+};
+
+export function AgentPublishStatus({
+ agent,
+ onChange,
+}: AgentPublishStatusProps) {
+ const getAssistants = useSWR(
+ () =>
+ agent.refName && !agent.refNameAssigned
+ ? AssistantApiService.getAssistants.key()
+ : null,
+ () => AssistantApiService.getAssistants()
+ );
+
+ const refAgent = useMemo(() => {
+ if (!getAssistants.data) return null;
+
+ return getAssistants.data.find(({ id }) => id === agent.refName);
+ }, [getAssistants.data, agent.refName]);
+
+ return (
+
+ {renderAgentRef()}
+
+ {agent.refName ? (
+
onChange({ refName: "" })} />
+ ) : (
+ onChange({ refName })}
+ />
+ )}
+
+ );
+
+ function renderAgentRef() {
+ if (!agent.refName) return ;
+
+ if (refAgent) {
+ const route =
+ refAgent.type === "agent"
+ ? $path("/agents/:agent", {
+ agent: refAgent.entityID,
+ })
+ : $path("/workflows/:workflow", {
+ workflow: refAgent.entityID,
+ });
+
+ return (
+
+
+
+
+
+ Ref name {refAgent.id} used by{" "}
+
+
+ {refAgent.name}
+
+
+
+ );
+ }
+
+ if (!agent.refNameAssigned) return ;
+
+ return (
+
+ );
+ }
+}
diff --git a/ui/admin/app/components/agent/Publish.tsx b/ui/admin/app/components/agent/Publish.tsx
index d3bcf515..ad1a1f48 100644
--- a/ui/admin/app/components/agent/Publish.tsx
+++ b/ui/admin/app/components/agent/Publish.tsx
@@ -1,8 +1,6 @@
import { Eye } from "lucide-react";
import { useState } from "react";
-import { Agent } from "~/lib/model/agents";
-
import {
TypographyMuted,
TypographyMutedAccent,
@@ -20,19 +18,18 @@ import { Input } from "~/components/ui/input";
type PublishProps = {
className?: string;
- agent: Agent;
- onChange: (agent: Agent) => void;
+ refName: string;
+ onPublish: (refName: string) => void;
};
-export function Publish({ className, agent, onChange }: PublishProps) {
- const [refName, setRefName] = useState(agent.refName);
+export function Publish({
+ className,
+ refName: _refName,
+ onPublish,
+}: PublishProps) {
+ const [refName, setRefName] = useState(_refName);
- const handlePublish = () => {
- onChange({
- ...agent,
- refName,
- });
- };
+ const handlePublish = () => onPublish(refName);
return (