fix(gateway): harden agent provider routing

This commit is contained in:
Peter Steinberger
2026-01-09 23:00:23 +01:00
parent 3adec35632
commit 79f5ccc99d
18 changed files with 327 additions and 89 deletions

View File

@@ -1,5 +1,6 @@
import { type Static, type TSchema, Type } from "@sinclair/typebox";
import { SESSION_LABEL_MAX_LENGTH } from "../../sessions/session-label.js";
import { GATEWAY_AGENT_PROVIDER_VALUES } from "../../utils/message-provider.js";
const NonEmptyString = Type.String({ minLength: 1 });
const SessionLabelString = Type.String({
@@ -7,6 +8,10 @@ const SessionLabelString = Type.String({
maxLength: SESSION_LABEL_MAX_LENGTH,
});
const AgentProviderSchema = Type.Union(
GATEWAY_AGENT_PROVIDER_VALUES.map((provider) => Type.Literal(provider)),
);
export const PresenceEntrySchema = Type.Object(
{
host: Type.Optional(NonEmptyString),
@@ -225,7 +230,7 @@ export const AgentParamsSchema = Type.Object(
sessionKey: Type.Optional(Type.String()),
thinking: Type.Optional(Type.String()),
deliver: Type.Optional(Type.Boolean()),
provider: Type.Optional(Type.String()),
provider: Type.Optional(AgentProviderSchema),
timeout: Type.Optional(Type.Integer({ minimum: 0 })),
lane: Type.Optional(Type.String()),
extraSystemPrompt: Type.Optional(Type.String()),