refactor(ai): default route tool namespaces to flat

This commit is contained in:
Aiden Cline
2026-09-29 21:28:12 -05:00
parent dffcd7767b
commit bdfa58e2c1
2 changed files with 5 additions and 4 deletions
+5 -3
View File
@@ -60,7 +60,8 @@ export interface Route<
readonly body: RouteBody<Body>
readonly supportsEffortUpdates?: (request: LLMRequest) => boolean
readonly sanitizer?: LanguageModelSanitizerCompatibility
readonly namespaces: NamespaceStyle
/** How protocol bodies receive tool namespaces; defaults to `"flat"`. */
readonly namespaces?: NamespaceStyle
readonly with: {
<Next extends CompactionOperations | undefined>(
patch: RoutePatch<Body, Prepared> & { readonly compact: Next },
@@ -393,7 +394,7 @@ function makeFromTransport<Body, Prepared, Frame, Event, State>(
body: protocol.body,
supportsEffortUpdates: protocol.supportsEffortUpdates,
sanitizer: protocol.sanitizer,
namespaces: protocol.namespaces ?? "flat",
namespaces: protocol.namespaces,
with: (patch: RoutePatch<Body, Prepared>) => {
const { compact, id, provider, providerMetadataKey, auth, transport, endpoint, ...defaults } = patch
return build({
@@ -576,7 +577,8 @@ const prepareRequest = (request: LLMRequest) => {
}
// Protocols receive wire tool names; callers keep declared names in both directions.
const lowerRequest = (request: LLMRequest) => ToolNames.lower(prepareRequest(request), request.model.route.namespaces)
const lowerRequest = (request: LLMRequest) =>
ToolNames.lower(prepareRequest(request), request.model.route.namespaces ?? "flat")
const compile = Effect.fn("LLM.compile")(function* (request: LLMRequest, options?: StreamOptions) {
const lowered = yield* lowerRequest(request)
-1
View File
@@ -368,7 +368,6 @@ function modelFromLanguage(info: RuntimeInfo, language: LanguageModelV3) {
protocol: "ai-sdk",
// AI SDK providers convert tool schemas themselves, so model-family sanitizers stay off here.
sanitizer: "none",
namespaces: "flat",
endpoint: Endpoint.path("/", { baseURL: "https://ai-sdk.local" }),
auth: Auth.none,
transport: {