|
@@ -1,4 +1,4 @@
|
|
|
-import { paasText } from "@/paas"
|
|
|
|
|
|
|
+import { paasRecord, paasText } from "@/paas"
|
|
|
|
|
|
|
|
export type AgentEntryMode = "default" | "professional" | "workflow" | "internal"
|
|
export type AgentEntryMode = "default" | "professional" | "workflow" | "internal"
|
|
|
|
|
|
|
@@ -10,6 +10,7 @@ export type AgentProfile = {
|
|
|
outputs: string[]
|
|
outputs: string[]
|
|
|
example: string
|
|
example: string
|
|
|
requiresWorkspace: boolean
|
|
requiresWorkspace: boolean
|
|
|
|
|
+ routingCapabilities: string[]
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const modes: Record<string, AgentEntryMode> = {
|
|
const modes: Record<string, AgentEntryMode> = {
|
|
@@ -48,6 +49,37 @@ const templates: Record<string, AgentEntryMode> = {
|
|
|
"research.scientific-planner": "workflow",
|
|
"research.scientific-planner": "workflow",
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// Compatibility for existing versions created before Desktop metadata existed.
|
|
|
|
|
+// These are config identities, so renaming an instance does not reveal child roles.
|
|
|
|
|
+const legacyTypes: Record<string, AgentEntryMode> = {
|
|
|
|
|
+ "research-67-orchestrator": "workflow",
|
|
|
|
|
+ "research-67-pipeline": "workflow",
|
|
|
|
|
+ "research-67-artifact-gate": "internal",
|
|
|
|
|
+ "research-67-ontology-auditor": "internal",
|
|
|
|
|
+ "research-67-ontology-enricher": "internal",
|
|
|
|
|
+ "research-67-hypothesis-builder": "internal",
|
|
|
|
|
+ "research-67-plan-builder": "internal",
|
|
|
|
|
+ "research-67-action-reasoner": "internal",
|
|
|
|
|
+ "research-67-ontology-experiment-planner": "internal",
|
|
|
|
|
+ "research-67-claim-verifier": "internal",
|
|
|
|
|
+ "research-67-idea-analyst": "internal",
|
|
|
|
|
+ "research-67-lit-searcher": "internal",
|
|
|
|
|
+ "research-67-exp-planner": "internal",
|
|
|
|
|
+ "research-67-exp-executor": "internal",
|
|
|
|
|
+ "research-67-result-analyzer": "internal",
|
|
|
|
|
+ "research-67-paper-writer": "internal",
|
|
|
|
|
+ "research-67-data-verifier": "internal",
|
|
|
|
|
+ "research-67-paper-reviewer": "internal",
|
|
|
|
|
+ "research-67-review-feedback": "internal",
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const capabilities: Record<string, string[]> = {
|
|
|
|
|
+ "workspace.assistant": ["workspace"],
|
|
|
|
|
+ "data.analyst": ["data-analysis"],
|
|
|
|
|
+ "knowledge.document-qa": ["document-qa"],
|
|
|
|
|
+ "research.scientific-planner": ["research"],
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const summaries: Record<string, string> = {
|
|
const summaries: Record<string, string> = {
|
|
|
research67: "从研究问题出发,支持连续追问、证据检索和研究方案起草。",
|
|
research67: "从研究问题出发,支持连续追问、证据检索和研究方案起草。",
|
|
|
data67: "处理表格、数据清洗、统计分析和图表生成。",
|
|
data67: "处理表格、数据清洗、统计分析和图表生成。",
|
|
@@ -73,7 +105,9 @@ function list(agent: Record<string, unknown>, key: string) {
|
|
|
export function resolveAgentProfile(agent: Record<string, unknown>): AgentProfile {
|
|
export function resolveAgentProfile(agent: Record<string, unknown>): AgentProfile {
|
|
|
const id = paasText(agent.id)
|
|
const id = paasText(agent.id)
|
|
|
const name = paasText(agent.name)
|
|
const name = paasText(agent.name)
|
|
|
- const entryMode = valid(paasText(agent.entry_mode)) ? (paasText(agent.entry_mode) as AgentEntryMode) : templates[paasText(agent.agent_template)] || modes[id] || modes[name] || "professional"
|
|
|
|
|
|
|
+ const desktop = paasRecord(agent.desktop) || {}
|
|
|
|
|
+ const declared = paasText(desktop.entry_mode) || paasText(agent.entry_mode)
|
|
|
|
|
+ const entryMode = valid(declared) ? declared : legacyTypes[paasText(agent.agent_type)] || templates[paasText(agent.agent_template)] || modes[id] || modes[name] || "professional"
|
|
|
const summary = paasText(agent.summary) || summaries[id] || summaries[name] || paasText(agent.description)
|
|
const summary = paasText(agent.summary) || summaries[id] || summaries[name] || paasText(agent.description)
|
|
|
return {
|
|
return {
|
|
|
entryMode,
|
|
entryMode,
|
|
@@ -84,7 +118,8 @@ export function resolveAgentProfile(agent: Record<string, unknown>): AgentProfil
|
|
|
inputs: list(agent, "inputs"),
|
|
inputs: list(agent, "inputs"),
|
|
|
outputs: list(agent, "outputs"),
|
|
outputs: list(agent, "outputs"),
|
|
|
example: paasText(agent.example),
|
|
example: paasText(agent.example),
|
|
|
- requiresWorkspace: agent.requires_workspace === true || agent.agent_template === "workspace.assistant" || name === "工作区助手",
|
|
|
|
|
|
|
+ routingCapabilities: list(desktop, "capabilities").length ? list(desktop, "capabilities") : capabilities[paasText(agent.agent_template)] || [],
|
|
|
|
|
+ requiresWorkspace: desktop.requires_workspace === true || agent.requires_workspace === true || agent.agent_template === "workspace.assistant" || name === "工作区助手",
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -107,15 +142,15 @@ export function directAgents(agents: Record<string, unknown>[]) {
|
|
|
if (tags.includes("desktop:entry") || profile.entryMode === "default") return true
|
|
if (tags.includes("desktop:entry") || profile.entryMode === "default") return true
|
|
|
// Existing PaaS built-ins remain callable by workflows, but are not all
|
|
// Existing PaaS built-ins remain callable by workflows, but are not all
|
|
|
// Desktop products. Unknown user-created/installed entries remain available.
|
|
// Desktop products. Unknown user-created/installed entries remain available.
|
|
|
- return !modes[paasText(agent.id)] && !modes[paasText(agent.name)] && profile.entryMode !== "workflow"
|
|
|
|
|
|
|
+ return !legacyTypes[paasText(agent.agent_type)] && !modes[paasText(agent.id)] && !modes[paasText(agent.name)] && profile.entryMode !== "workflow"
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** Present legacy built-in names consistently without changing persisted IDs or custom names. */
|
|
/** Present legacy built-in names consistently without changing persisted IDs or custom names. */
|
|
|
export function agentDisplayName(agent: Record<string, unknown> | undefined) {
|
|
export function agentDisplayName(agent: Record<string, unknown> | undefined) {
|
|
|
const name = paasText(agent?.name).trim()
|
|
const name = paasText(agent?.name).trim()
|
|
|
- if (["research67", "科研助手", "λ-Scientist"].includes(name)) return "λ-Scientist 科研助手"
|
|
|
|
|
- if (name === "data67") return "数据分析助手"
|
|
|
|
|
|
|
+ if (["research67", "科研助手", "λ-Scientist", "Research67 科学研究规划"].includes(name)) return "λ-Scientist 科研助手"
|
|
|
|
|
+ if (["data67", "Data67 数据分析"].includes(name)) return "数据分析助手"
|
|
|
if (name) return name
|
|
if (name) return name
|
|
|
const id = paasText(agent?.id) || paasText(agent?.agentID)
|
|
const id = paasText(agent?.id) || paasText(agent?.agentID)
|
|
|
if (id === "research67") return "λ-Scientist 科研助手"
|
|
if (id === "research67") return "λ-Scientist 科研助手"
|