refactor(core): adopt CoreToolCallStatus enum for type safety (#18998)

This commit is contained in:
Jerop Kipruto
2026-02-13 11:27:20 -05:00
committed by GitHub
parent d0c6a56c65
commit 60be42f095
22 changed files with 631 additions and 431 deletions
+14 -13
View File
@@ -12,6 +12,7 @@ import type {
ErroredToolCall,
} from '../index.js';
import {
CoreToolCallStatus,
AuthType,
EditTool,
GeminiClient,
@@ -1070,7 +1071,7 @@ describe('loggers', () => {
it('should log a tool call with all fields', () => {
const tool = new EditTool(mockConfig, createMockMessageBus());
const call: CompletedToolCall = {
status: 'success',
status: CoreToolCallStatus.Success,
request: {
name: 'test-function',
args: {
@@ -1188,7 +1189,7 @@ describe('loggers', () => {
it('should merge data from response into metadata', () => {
const call: CompletedToolCall = {
status: 'success',
status: CoreToolCallStatus.Success,
request: {
name: 'ask_user',
args: { questions: [] },
@@ -1234,7 +1235,7 @@ describe('loggers', () => {
it('should log a tool call with a reject decision', () => {
const call: ErroredToolCall = {
status: 'error',
status: CoreToolCallStatus.Error,
request: {
name: 'test-function',
args: {
@@ -1312,7 +1313,7 @@ describe('loggers', () => {
it('should log a tool call with a modify decision', () => {
const call: CompletedToolCall = {
status: 'success',
status: CoreToolCallStatus.Success,
request: {
name: 'test-function',
args: {
@@ -1392,7 +1393,7 @@ describe('loggers', () => {
it('should log a tool call without a decision', () => {
const call: CompletedToolCall = {
status: 'success',
status: CoreToolCallStatus.Success,
request: {
name: 'test-function',
args: {
@@ -1472,7 +1473,7 @@ describe('loggers', () => {
it('should log a failed tool call with an error', () => {
const errorMessage = 'test-error';
const call: ErroredToolCall = {
status: 'error',
status: CoreToolCallStatus.Error,
request: {
name: 'test-function',
args: {
@@ -1573,7 +1574,7 @@ describe('loggers', () => {
);
const call: CompletedToolCall = {
status: 'success',
status: CoreToolCallStatus.Success,
request: {
name: 'mock_mcp_tool',
args: { arg1: 'value1', arg2: 2 },
@@ -1890,7 +1891,7 @@ describe('loggers', () => {
'testing-id',
'0.1.0',
'git',
'success',
CoreToolCallStatus.Success,
);
await logExtensionInstallEvent(mockConfig, event);
@@ -1911,7 +1912,7 @@ describe('loggers', () => {
extension_name: 'testing',
extension_version: '0.1.0',
extension_source: 'git',
status: 'success',
status: CoreToolCallStatus.Success,
},
});
});
@@ -1943,7 +1944,7 @@ describe('loggers', () => {
'0.1.0',
'0.1.1',
'git',
'success',
CoreToolCallStatus.Success,
);
await logExtensionUpdateEvent(mockConfig, event);
@@ -1965,7 +1966,7 @@ describe('loggers', () => {
extension_version: '0.1.0',
extension_previous_version: '0.1.1',
extension_source: 'git',
status: 'success',
status: CoreToolCallStatus.Success,
},
});
});
@@ -1993,7 +1994,7 @@ describe('loggers', () => {
'testing',
'testing-hash',
'testing-id',
'success',
CoreToolCallStatus.Success,
);
await logExtensionUninstall(mockConfig, event);
@@ -2012,7 +2013,7 @@ describe('loggers', () => {
'event.timestamp': '2025-01-01T00:00:00.000Z',
interactive: false,
extension_name: 'testing',
status: 'success',
status: CoreToolCallStatus.Success,
},
});
});