feat(ql3): compare bounded task run outcomes

This commit is contained in:
whyour
2026-08-14 17:18:25 +08:00
parent a55613afaa
commit 828370c60b
22 changed files with 1802 additions and 22 deletions
@@ -50,6 +50,11 @@ import {
BUILTIN_RUN_COMPARE_TOOL_DEFINITION,
executeBuiltInRunCompareTool,
} from '@qinglong/runtime-core/builtin-run-compare-projection';
import {
BUILTIN_TASK_RUN_OUTCOME_COMPARE_TOOL,
BUILTIN_TASK_RUN_OUTCOME_COMPARE_TOOL_DEFINITION,
executeBuiltInTaskRunOutcomeCompareTool,
} from '@qinglong/runtime-core/builtin-task-run-outcome-compare-projection';
import {
BUILTIN_RUN_READ_TOOL,
BUILTIN_RUN_READ_TOOL_DEFINITION,
@@ -58,6 +63,7 @@ import {
import type { RunRepositoryReader } from '@qinglong/runtime-core/run-repository';
import type { StepRunRepository } from '@qinglong/runtime-core/step-run';
import type { ProjectRunListReader } from '@qinglong/runtime-core/project-run-list';
import type { TaskRunOutcomeWindowReader } from '@qinglong/runtime-core/task-run-outcome-window';
import type { SecurityPrincipal } from '@qinglong/runtime-core/security';
import type { TaskDefinitionSource } from '@qinglong/runtime-core/task-definition';
import type { TriggerSource } from '@qinglong/runtime-core/trigger';
@@ -112,7 +118,8 @@ type LocalMcpRunReader = Pick<
RunRepositoryReader,
'findRunById' | 'listEvents'
> &
ProjectRunListReader;
ProjectRunListReader &
TaskRunOutcomeWindowReader;
type LocalMcpTaskReader = Pick<
TaskDefinitionSource,
@@ -194,6 +201,24 @@ const LOCAL_MCP_READ_TOOLS: readonly LocalMcpReadToolDescriptor[] =
input: ToolJsonValue,
) => executeBuiltInRunCompareTool(authority.runs, projectId, input),
}),
Object.freeze({
tool: BUILTIN_TASK_RUN_OUTCOME_COMPARE_TOOL,
definition: BUILTIN_TASK_RUN_OUTCOME_COMPARE_TOOL_DEFINITION,
title: 'Compare Latest QingLong Task Run Outcomes',
auditReason: 'tool_qinglong_task_runs_compare',
unavailableCode: 'task_run_outcome_compare_unavailable',
execute: (
authority: LocalMcpReadAuthority,
projectId: string,
input: ToolJsonValue,
) =>
executeBuiltInTaskRunOutcomeCompareTool(
authority.runs,
authority.runs,
projectId,
input,
),
}),
Object.freeze({
tool: BUILTIN_RUN_EVENT_LIST_TOOL,
definition: BUILTIN_RUN_EVENT_LIST_TOOL_DEFINITION,