fix(contracts): align CLI/MCP boundary contracts (#946)
* fix(cli): validate native scenario and preserve JSON paths * fix(process): reject invalid UTF-8 JSON inputs * fix(cli): retain missing JSON path diagnostics * test(cli): cover relative brace and bracket JSON paths * test(cli): reject missing native scenario steps * fix(mcp): advertise reserved process environment key * fix(process): reject NUL in process scenario values * fix(process): advertise NUL input constraints to MCP * fix(cli): report scenario input schema issues * fix(contracts): align CLI and MCP input validation * fix(mcp): document semantic output constraints * fix(mcp): describe process journal compatibility * docs: regenerate catalog after schema grouping * docs: regenerate catalog after main merge * fix(cli): preserve JSON and native UI input diagnostics * test(mcp): reuse advertised tool schemas in managed flow
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
import { electronActiveObservationInputSchema } from "../domain/javascript/electronActiveObservation.js";
|
||||
import { AnalysisInputError } from "../domain/analysisErrorCore.js";
|
||||
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
|
||||
import { projectInputIssues } from "../domain/inputIssueProjection.js";
|
||||
import type { JsonValue } from "../domain/jsonValue.js";
|
||||
import type { Logger } from "../logger.js";
|
||||
import { CLI_COMMANDS } from "../cliCommandNames.js";
|
||||
@@ -58,7 +59,12 @@ const registerElectronActiveCommand = (
|
||||
const parsed = electronActiveObservationInputSchema.safeParse(
|
||||
input.value,
|
||||
);
|
||||
if (!parsed.success) return inputError("capture_electron_scenario");
|
||||
if (!parsed.success)
|
||||
return inputError(
|
||||
"capture_electron_scenario",
|
||||
parsed.error.issues,
|
||||
input.value,
|
||||
);
|
||||
const { createElectronScenarioProvider } =
|
||||
await import("../composition/electronScenario.js");
|
||||
const result = await captureElectronScenario(
|
||||
@@ -186,8 +192,18 @@ const electronObservationContext = async () => {
|
||||
return { provider: createElectronObservationProvider() };
|
||||
};
|
||||
|
||||
const inputError = (operation: string): JsonValue =>
|
||||
cliError(new AnalysisInputError(operation));
|
||||
const inputError = (
|
||||
operation: string,
|
||||
issues?: Parameters<typeof projectInputIssues>[0],
|
||||
input?: unknown,
|
||||
): JsonValue =>
|
||||
cliError(
|
||||
new AnalysisInputError(
|
||||
operation,
|
||||
undefined,
|
||||
issues === undefined ? [] : projectInputIssues(issues, input),
|
||||
),
|
||||
);
|
||||
|
||||
const cliError = (
|
||||
error: Parameters<typeof projectAnalysisError>[0],
|
||||
|
||||
Reference in New Issue
Block a user