refactor: improve type safety and code quality for 9.0 score
Type Safety Improvements: - Add isErrorResult() type guard for API responses (domain-tool.ts) - Replace `any` with `unknown` in executeTool args (tools/index.ts) - Add JSON.parse error handling in function calling (openai-service.ts) - Fix nullable price handling with nullish coalescing - Add array type guard for nameservers validation Code Quality Improvements: - Extract convertNamecheapDate() to eliminate duplicate functions - Move hardcoded bank account info to environment variables - Add JSDoc documentation to executeDepositFunction - Fix unused variables in optimistic-lock.ts - Handle Error.captureStackTrace for Workers environment All TypeScript strict mode checks now pass. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -117,7 +117,7 @@ export function selectToolsForMessage(message: string): typeof tools {
|
||||
// Tool execution dispatcher with validation
|
||||
export async function executeTool(
|
||||
name: string,
|
||||
args: Record<string, any>,
|
||||
args: Record<string, unknown>,
|
||||
env?: Env,
|
||||
telegramUserId?: string,
|
||||
db?: D1Database
|
||||
|
||||
Reference in New Issue
Block a user