Skip to content

Commit f2a8bc7

Browse files
chore(detection-emulation): remove dead code
- Remove unused DetectionEmulationFeatureFlags type import from gate_checks.ts - Migrate get_emulation_history_tool.ts to use the shared toolError builder instead of inline ToolResultType.error construction
1 parent c0412ee commit f2a8bc7

2 files changed

Lines changed: 8 additions & 15 deletions

File tree

x-pack/solutions/security/plugins/security_solution/server/agent_builder/skills/detection_emulation/gate_checks.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
getRealExecutionDisableReason,
2121
isRealExecutionEnabled,
2222
REAL_EXECUTION_DISABLE_REASON_TEXT,
23-
type DetectionEmulationFeatureFlags,
2423
} from '../../../lib/detection_emulation/feature_flag';
2524
import {
2625
resolveAllowlistConfig,

x-pack/solutions/security/plugins/security_solution/server/agent_builder/skills/detection_emulation/get_emulation_history_tool.ts

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import type { BuiltinSkillBoundedTool } from '@kbn/agent-builder-server/skills';
1212
import type { SecuritySolutionPluginCoreSetupDependencies } from '../../../plugin_contract';
1313
import { findEmulationHistory } from '../../../lib/detection_emulation/emulation_history';
1414
import { emulationReportTypeName } from '../../../lib/detection_emulation/emulation_report_type';
15+
import { toolError } from './emulation_tool_errors';
1516

1617
// ─── Schema ───────────────────────────────────────────────────────────────────
1718

@@ -111,20 +112,13 @@ Results are scoped to the current Kibana space — reports from other spaces are
111112
tags: ['detection-emulation'],
112113
stack: error.stack,
113114
} as Record<string, unknown>);
114-
return {
115-
results: [
116-
{
117-
type: ToolResultType.error,
118-
data: {
119-
error_type: 'execution_error',
120-
message: 'Failed to retrieve emulation history.',
121-
rule_id: ruleId,
122-
status_code: 500,
123-
likely_cause: 'Internal error querying the emulation history saved objects.',
124-
},
125-
},
126-
],
127-
};
115+
return toolError.executionError(
116+
{ rule_id: ruleId },
117+
{
118+
message: 'Failed to retrieve emulation history.',
119+
likelyCause: 'Internal error querying the emulation history saved objects.',
120+
}
121+
);
128122
}
129123
},
130124
};

0 commit comments

Comments
 (0)