openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
30 lines (29 loc) • 1.08 kB
JavaScript
import { a as asOptionalRecord } from "./record-coerce-CVPuDqcc.mjs";
import { n as normalizeAgentId } from "./agent-id-CQjtp2ft.mjs";
import "./session-key-CqAyZeVk.mjs";
//#region src/commands/doctor/shared/codex-route-agent-entries.ts
/** Lists mutable canonical agent entries, with legacy list fallback for raw Doctor input. */
function listMutableCodexRouteAgentEntries(e) {
const t = asOptionalRecord(asOptionalRecord(e)?.agents);
const n = asOptionalRecord(t?.entries);
if (n) return Object.entries(n).flatMap(([e, t]) => {
const n = asOptionalRecord(t);
return n ? [{
agent: n,
agentId: normalizeAgentId(e),
path: `agents.entries.${e}`
}] : [];
});
return (Array.isArray(t?.list) ? t.list : []).flatMap((e, t) => {
const n = asOptionalRecord(e);
if (!n) return [];
const r = typeof n.id === "string" && n.id.trim() ? n.id.trim() : String(t);
return [{
agent: n,
agentId: normalizeAgentId(typeof n.id === "string" ? n.id : void 0),
path: `agents.list.${r}`
}];
});
}
//#endregion
export { listMutableCodexRouteAgentEntries as t };