mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 04:11:22 +00:00
refactor(agents): share agent entry and block reply payload types
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
listAgentEntries,
|
||||
resolveAgentDir,
|
||||
resolveAgentWorkspaceDir,
|
||||
resolveDefaultAgentId,
|
||||
@@ -31,14 +32,7 @@ export type AgentSummary = {
|
||||
type AgentEntry = NonNullable<NonNullable<OpenClawConfig["agents"]>["list"]>[number];
|
||||
|
||||
export type AgentIdentity = AgentIdentityFile;
|
||||
|
||||
export function listAgentEntries(cfg: OpenClawConfig): AgentEntry[] {
|
||||
const list = cfg.agents?.list;
|
||||
if (!Array.isArray(list)) {
|
||||
return [];
|
||||
}
|
||||
return list.filter((entry): entry is AgentEntry => Boolean(entry && typeof entry === "object"));
|
||||
}
|
||||
export { listAgentEntries };
|
||||
|
||||
export function findAgentEntryIndex(list: AgentEntry[], agentId: string): number {
|
||||
const id = normalizeAgentId(agentId);
|
||||
|
||||
Reference in New Issue
Block a user