feat(agent): unify MCP tools and adopt Responses delivery

Move project and host queries into native MCP with host-owned OAuth/context,
while retaining memory, skills, actions and publication plugins. Add nearby-model
queries and explicit chat/task/learning model defaults.

Adopt Responses HTTP/SSE and native steer/queue inbox delivery, preserving scoped
session ownership, pending input edits and investigation communication.

Disable local-provider discovery: Server /health allowed native vLLM to probe
/v1/models on port 8000. A native before/after regression prevents recurrence.

Validation: 170 focused Bun tests; service/plugin typechecks; native discovery,
provider-discovery and input-inbox smoke checks; no paid model inference.
This commit is contained in:
2026-10-19 18:46:58 +08:00
parent f5c3cde2c2
commit 6a49d2209e
164 changed files with 12286 additions and 2368 deletions
+46
View File
@@ -0,0 +1,46 @@
import { z } from "zod";
import { safeChartInput } from "../frontendAction/registry.js";
export const supplyLayerSchema = z.enum(["junctions", "pipes", "valves", "pumps", "tanks", "reservoirs", "scada"]);
const identifier = z.string().trim().min(1).max(128);
export const taskPresentationCommandSchema = z.discriminatedUnion("action", [
z.object({
action: z.literal("highlight_features"),
layer: supplyLayerSchema,
feature_ids: z.array(identifier).min(1).max(100),
effect: z.enum(["steady", "pulse"]).default("steady"),
}).strict(),
z.object({ action: z.literal("clear_highlights") }).strict(),
z.object({
action: z.literal("open_chart"),
chart_id: identifier,
chart: safeChartInput,
evidence_refs: z.array(z.string().trim().min(1)).min(1).max(100),
}).strict(),
z.object({ action: z.literal("close_chart"), chart_id: identifier }).strict(),
z.object({
action: z.literal("set_overlay"),
overlay_id: identifier,
title: z.string().trim().min(1).max(200),
mode: z.enum(["geometry", "heatmap"]),
evidence_id: z.string().trim().min(1),
}).strict(),
z.object({ action: z.literal("clear_overlay"), overlay_id: identifier }).strict(),
]);
export type TaskPresentationCommand = z.infer<typeof taskPresentationCommandSchema>;
export const taskPresentationResultSchema = z.object({
recorded: z.literal(true),
event_seq: z.number().int().positive(),
run_id: z.string().uuid(),
execution_generation: z.number().int().positive(),
}).strict();
export const taskPresentationBridgeSchema = z.object({
session_id: z.string().trim().min(1).max(128),
request_id: z.string().uuid(),
command: taskPresentationCommandSchema,
}).strict();