mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-01 04:42:10 +03:00
feat(schemas): add agentBridge/inspector Zod schemas (F1)
- AgentBridgeStateRow/Mapping/Bypass/ServerAction/Dns/MappingPut/BypassUpsert/UpstreamCaPost schemas - InspectorCustomHost/SessionStart/SessionPatch/CaptureModeAction/SystemProxy/TlsInterceptToggle/AnnotationPut/ListQuery schemas
This commit is contained in:
37
src/shared/schemas/agentBridge.ts
Normal file
37
src/shared/schemas/agentBridge.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const AgentBridgeStateRowSchema = z.object({
|
||||
agent_id: z.string(),
|
||||
dns_enabled: z.boolean(),
|
||||
cert_trusted: z.boolean(),
|
||||
setup_completed: z.boolean(),
|
||||
last_started_at: z.string().datetime().nullable(),
|
||||
last_error: z.string().nullable(),
|
||||
});
|
||||
|
||||
export const AgentBridgeMappingRowSchema = z.object({
|
||||
agent_id: z.string(),
|
||||
source_model: z.string(),
|
||||
target_model: z.string(),
|
||||
updated_at: z.string().datetime(),
|
||||
});
|
||||
|
||||
export const AgentBridgeBypassRowSchema = z.object({
|
||||
pattern: z.string(),
|
||||
source: z.enum(["default", "user"]),
|
||||
created_at: z.string().datetime(),
|
||||
});
|
||||
|
||||
export const AgentBridgeServerActionSchema = z.object({
|
||||
action: z.enum(["start", "stop", "restart", "trust-cert", "regenerate-cert"]),
|
||||
});
|
||||
|
||||
export const AgentBridgeDnsActionSchema = z.object({ enabled: z.boolean() });
|
||||
|
||||
export const AgentBridgeMappingPutSchema = z.object({
|
||||
mappings: z.array(z.object({ source: z.string(), target: z.string() })),
|
||||
});
|
||||
|
||||
export const AgentBridgeBypassUpsertSchema = z.object({ patterns: z.array(z.string()) });
|
||||
|
||||
export const AgentBridgeUpstreamCaPostSchema = z.object({ path: z.string().min(1) });
|
||||
42
src/shared/schemas/inspector.ts
Normal file
42
src/shared/schemas/inspector.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const InspectorCustomHostSchema = z.object({
|
||||
host: z.string().min(1),
|
||||
enabled: z.boolean().default(true),
|
||||
label: z.string().nullable().optional(),
|
||||
kind: z.enum(["llm", "app", "custom"]).default("custom"),
|
||||
});
|
||||
|
||||
export const InspectorSessionStartSchema = z.object({ name: z.string().optional() });
|
||||
|
||||
export const InspectorSessionPatchSchema = z.object({
|
||||
action: z.enum(["stop", "rename"]),
|
||||
name: z.string().optional(),
|
||||
});
|
||||
|
||||
export const InspectorCaptureModeActionSchema = z.object({
|
||||
action: z.enum(["start", "stop"]),
|
||||
});
|
||||
|
||||
export const InspectorSystemProxyActionSchema = z.object({
|
||||
action: z.enum(["apply", "revert"]),
|
||||
port: z.number().int().positive().max(65535).optional(),
|
||||
guardMinutes: z.number().int().positive().optional(),
|
||||
});
|
||||
|
||||
export const InspectorTlsInterceptToggleSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
});
|
||||
|
||||
export const InspectorAnnotationPutSchema = z.object({
|
||||
annotation: z.string().max(10_000),
|
||||
});
|
||||
|
||||
export const InspectorListQuerySchema = z.object({
|
||||
profile: z.enum(["llm", "custom", "all"]).optional(),
|
||||
host: z.string().optional(),
|
||||
agent: z.string().optional(),
|
||||
status: z.enum(["2xx", "3xx", "4xx", "5xx", "error"]).optional(),
|
||||
source: z.enum(["agent-bridge", "custom-host", "http-proxy", "system-proxy"]).optional(),
|
||||
sessionId: z.string().uuid().optional(),
|
||||
});
|
||||
Reference in New Issue
Block a user