mirror of
https://github.com/morluto/rea.git
synced 2026-12-06 23:09:34 +00:00
* fix(mcp): serve refinement-only input rules agents need before the first call - UEFI paths use the shared absolute-path schema, so the served schema carries the absolute-path pattern instead of a refinement. - Blank-text checks (guided workflow ids, prompt arguments, guidance queries, residual-unknown text) are a served `\S` pattern, not a trim refinement. - Input groups name the selector values that open them, for example `operation=architectures` for inspect_with_objdump. - inspect_native_data_type states its one-of rule in the tool description, from the same constant the refusal uses. - The served-schema parity sweep credits a cross-field rule when the description states the refusal or the selecting input group, with controls, and drops the fixed refinement gaps. Refs #15311 * fix(mcp): serve endpoint and literal rules on reduced schemas; state wider patterns - A reduced schema over budget drops name-derived fallback descriptions before its scalar rules, so analyze_web_bundle keeps its bounds. - Reduced root properties that are unions of literals serve their values as one enum (detail, format). - CDP and Inspector endpoint schemas declare the explicit-port envelope that explicitEndpointAuthority reads, as their pattern. - A pattern the portable grammar can only serve wider (`\S`, the adb serial) is also stated exactly in guidance. - The parity sweep drops the endpoint and literal gaps; the generated property accepts the host-independent absolute-path envelope. Refs #15311
51 lines
1.5 KiB
TypeScript
51 lines
1.5 KiB
TypeScript
import { z } from "zod";
|
|
|
|
import { presentObjectRoot } from "../domain/schemaAnnotations.js";
|
|
import {
|
|
NON_BLANK_MESSAGE,
|
|
NON_BLANK_PATTERN,
|
|
} from "../domain/stringPatterns.js";
|
|
|
|
/** Transport-independent request grammar; rendering never executes a workflow. */
|
|
export const guidedWorkflowsInputSchema = z.discriminatedUnion("action", [
|
|
z.strictObject({ action: z.literal("list") }),
|
|
z.strictObject({
|
|
action: z.literal("render"),
|
|
workflow_id: z
|
|
.string()
|
|
.regex(NON_BLANK_PATTERN, NON_BLANK_MESSAGE)
|
|
.describe("Exact guided workflow identifier from the list result"),
|
|
arguments: z
|
|
.record(z.string(), z.string())
|
|
.optional()
|
|
.describe("Caller-supplied string values for the selected workflow"),
|
|
}),
|
|
]);
|
|
|
|
const guidedWorkflowItemSchema = z.strictObject({
|
|
workflow_id: z.string(),
|
|
description: z.string(),
|
|
arguments: z.array(
|
|
z.strictObject({
|
|
name: z.string(),
|
|
description: z.string(),
|
|
required: z.boolean(),
|
|
}),
|
|
),
|
|
});
|
|
// Every alternative is an object; the advertised root says so for older MCP codecs.
|
|
export const guidedWorkflowsOutputSchema = presentObjectRoot(
|
|
z.discriminatedUnion("action", [
|
|
z.strictObject({
|
|
action: z.literal("list"),
|
|
workflows: z.array(guidedWorkflowItemSchema),
|
|
}),
|
|
z.strictObject({
|
|
action: z.literal("render"),
|
|
workflow_id: z.string(),
|
|
rendered_prompt: z.string(),
|
|
}),
|
|
]),
|
|
);
|
|
export type GuidedWorkflowsResult = z.infer<typeof guidedWorkflowsOutputSchema>;
|