From a3cc1297f9ba5e205ae45fb8c13c26da66b6697f Mon Sep 17 00:00:00 2001 From: jariy17 Date: Thu, 3 Sep 2026 19:20:07 +0000 Subject: [PATCH] fix(eval): keep CLI-only commands out of the TUI menu The eval router and its batch-evaluation subgroup open an interactive TUI on a bare invocation but never restricted which children the menu offers via supportedTuiCommands(), so the menu surfaced commands that have no interactive screen: - eval menu listed ondemand (help-only) and recommendation (no screen) - batch-evaluation menu listed evaluate and simulate (imperative jobs) Selecting one navigated to a route with no screen. Add the allowlists, matching the existing batch-insights / gateway pattern, so only groups and leaves with a real screen appear. Behaviour of the commands themselves is unchanged; this only gates TUI-menu membership. --- src/handlers/eval/batch-evaluation/index.tsx | 7 ++-- src/handlers/eval/index.tsx | 40 +++++++++++++------- 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/src/handlers/eval/batch-evaluation/index.tsx b/src/handlers/eval/batch-evaluation/index.tsx index 3d865cb7c..04170d308 100644 --- a/src/handlers/eval/batch-evaluation/index.tsx +++ b/src/handlers/eval/batch-evaluation/index.tsx @@ -8,13 +8,14 @@ import { createListBatchEvaluationsHandler } from "./list"; import { createEvaluateBatchEvaluationHandler } from "./evaluate"; import { createSimulateBatchEvaluationHandler } from "./simulate"; -// batch-evaluation supports evaluate (start an async job) plus get + list. A bare -// invocation opens the interactive TUI (list → get), matching evaluator and -// online-eval. +// batch-evaluation supports evaluate + simulate (start jobs) plus get + list. A +// bare invocation opens the interactive TUI (list → get), matching evaluator and +// online-eval; evaluate/simulate are CLI-only and stay out of the TUI menu. export function createBatchEvaluationHandler(core: Core, io: AppIO): Router { return new Router("batch-evaluation", "run and inspect AgentCore batch evaluations") .use(withTuiOnEmptyFlagsAndArgs(core, io)) .default(renderTui(core, io)) + .supportedTuiCommands("get", "list") .handler(createEvaluateBatchEvaluationHandler(core, io)) .handler(createSimulateBatchEvaluationHandler(core, io)) .handler(createGetBatchEvaluationHandler(core, io)) diff --git a/src/handlers/eval/index.tsx b/src/handlers/eval/index.tsx index 0c610ed32..38d6d635e 100644 --- a/src/handlers/eval/index.tsx +++ b/src/handlers/eval/index.tsx @@ -15,19 +15,33 @@ import { createAbTestHandler } from "./ab-test"; import { createRecommendationHandler } from "./recommendation"; export function createEvalHandler(core: Core, io: AppIO): Router { - return new Router("eval", "evaluate and optimize AgentCore agents") - .use(withTuiOnEmptyFlagsAndArgs(core, io)) - .default(renderTui(core, io)) - .handler(createEvaluatorHandler(core, io)) - .handler(createOnlineEvalHandler(core, io)) - .handler(createOnlineInsightHandler(core, io)) - .handler(createDatasetHandler(core, io)) - .handler(createBatchEvaluationHandler(core, io)) - .handler(createBatchInsightsHandler(core, io)) - .handler(createOnDemandHandler(core, io)) - .handler(createConfigBundleHandler(core, io)) - .handler(createAbTestHandler(core, io)) - .handler(createRecommendationHandler(core, io)); + return ( + new Router("eval", "evaluate and optimize AgentCore agents") + .use(withTuiOnEmptyFlagsAndArgs(core, io)) + .default(renderTui(core, io)) + // Only the groups with an interactive screen belong in the TUI menu. + // ondemand (help-only) and recommendation (no screen) are CLI-only. + .supportedTuiCommands( + "evaluator", + "online-eval", + "online-insight", + "dataset", + "batch-evaluation", + "batch-insights", + "config-bundle", + "ab-test", + ) + .handler(createEvaluatorHandler(core, io)) + .handler(createOnlineEvalHandler(core, io)) + .handler(createOnlineInsightHandler(core, io)) + .handler(createDatasetHandler(core, io)) + .handler(createBatchEvaluationHandler(core, io)) + .handler(createBatchInsightsHandler(core, io)) + .handler(createOnDemandHandler(core, io)) + .handler(createConfigBundleHandler(core, io)) + .handler(createAbTestHandler(core, io)) + .handler(createRecommendationHandler(core, io)) + ); } export { EvalScreen } from "./screen.tsx";