fix: stabilize gateway config tests + tool schema
This commit is contained in:
@@ -2,20 +2,19 @@ import type { AgentElevatedAllowFromConfig } from "./types.base.js";
|
||||
|
||||
export type ToolProfileId = "minimal" | "coding" | "messaging" | "full";
|
||||
|
||||
export type ToolPolicyConfig = {
|
||||
allow?: string[];
|
||||
deny?: string[];
|
||||
profile?: ToolProfileId;
|
||||
};
|
||||
|
||||
export type AgentToolsConfig = {
|
||||
/** Base tool profile applied before allow/deny lists. */
|
||||
profile?: ToolProfileId;
|
||||
allow?: string[];
|
||||
deny?: string[];
|
||||
/** Optional tool policy overrides keyed by provider id or "provider/model". */
|
||||
byProvider?: Record<
|
||||
string,
|
||||
{
|
||||
profile?: ToolProfileId;
|
||||
allow?: string[];
|
||||
deny?: string[];
|
||||
}
|
||||
>;
|
||||
byProvider?: Record<string, ToolPolicyConfig>;
|
||||
/** Per-agent elevated exec gate (can only further restrict global tools.elevated). */
|
||||
elevated?: {
|
||||
/** Enable or disable elevated mode for this agent (default: true). */
|
||||
@@ -83,14 +82,7 @@ export type ToolsConfig = {
|
||||
allow?: string[];
|
||||
deny?: string[];
|
||||
/** Optional tool policy overrides keyed by provider id or "provider/model". */
|
||||
byProvider?: Record<
|
||||
string,
|
||||
{
|
||||
profile?: ToolProfileId;
|
||||
allow?: string[];
|
||||
deny?: string[];
|
||||
}
|
||||
>;
|
||||
byProvider?: Record<string, ToolPolicyConfig>;
|
||||
web?: {
|
||||
search?: {
|
||||
/** Enable web search tool (default: true when API key is present). */
|
||||
|
||||
@@ -146,10 +146,10 @@ export const ToolProfileSchema = z
|
||||
.union([z.literal("minimal"), z.literal("coding"), z.literal("messaging"), z.literal("full")])
|
||||
.optional();
|
||||
|
||||
const ByProviderPolicySchema = z.object({
|
||||
profile: ToolProfileSchema,
|
||||
export const ToolPolicyWithProfileSchema = z.object({
|
||||
allow: z.array(z.string()).optional(),
|
||||
deny: z.array(z.string()).optional(),
|
||||
profile: ToolProfileSchema,
|
||||
});
|
||||
|
||||
// Provider docking: allowlists keyed by provider id (no schema updates when adding providers).
|
||||
@@ -176,7 +176,7 @@ export const AgentToolsSchema = z
|
||||
profile: ToolProfileSchema,
|
||||
allow: z.array(z.string()).optional(),
|
||||
deny: z.array(z.string()).optional(),
|
||||
byProvider: z.record(z.string(), ByProviderPolicySchema).optional(),
|
||||
byProvider: z.record(z.string(), ToolPolicyWithProfileSchema).optional(),
|
||||
elevated: z
|
||||
.object({
|
||||
enabled: z.boolean().optional(),
|
||||
@@ -280,7 +280,7 @@ export const ToolsSchema = z
|
||||
profile: ToolProfileSchema,
|
||||
allow: z.array(z.string()).optional(),
|
||||
deny: z.array(z.string()).optional(),
|
||||
byProvider: z.record(z.string(), ByProviderPolicySchema).optional(),
|
||||
byProvider: z.record(z.string(), ToolPolicyWithProfileSchema).optional(),
|
||||
web: ToolsWebSchema,
|
||||
audio: z
|
||||
.object({
|
||||
|
||||
Reference in New Issue
Block a user