openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
28 lines (27 loc) • 1.23 kB
JavaScript
import { l as normalizeOptionalString } from "./string-coerce-CIXf7egm.js";
import { w as tryResolveAmbientOwnerAgentId } from "./agent-scope-config-DcbEhP0R.js";
import { ln as validateModelsListParams } from "./src-BiL5aQto.js";
import { t as resolveAgentIdOrRespondError } from "./agent-id-shared-MLgRqPvR.js";
import { n as resolveAuthenticatedProfileId } from "./users-profile-access-Cefbw_TB.js";
import { t as assertValidParams } from "./validation-pzrlzFvo.js";
import { t as buildModelsListResult } from "./models-list-result-uPcMvPuL.js";
//#region src/gateway/server-methods/models.ts
const modelsHandlers = { "models.list": async ({ params, respond, context, client }) => {
if (!assertValidParams(params, validateModelsListParams, "models.list", respond)) return;
const cfg = context.getRuntimeConfig();
const resolved = resolveAgentIdOrRespondError({
rawAgentId: params.agentId ?? tryResolveAmbientOwnerAgentId(cfg),
respond,
cfg,
normalize: normalizeOptionalString
});
if (!resolved) return;
respond(true, await buildModelsListResult({
context,
agentId: resolved.agentId,
params,
requesterProfileId: resolveAuthenticatedProfileId(client)
}), void 0);
} };
//#endregion
export { modelsHandlers };