types.ts 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. import { Anthropic } from "@anthropic-ai/sdk"
  2. import { ToolParamName } from "../../src/core/assistant-message"
  3. import { ClineDefaultTool } from "../../src/shared/tools"
  4. export interface InputMessage {
  5. role: "user" | "assistant"
  6. text: string
  7. images?: string[]
  8. }
  9. export interface ProcessedTestCase {
  10. test_id: string
  11. messages: Anthropic.Messages.MessageParam[]
  12. file_contents: string
  13. file_path: string
  14. system_prompt_details: SystemPromptDetails
  15. original_diff_edit_tool_call_message: string
  16. }
  17. export interface TestCase {
  18. test_id: string
  19. messages: InputMessage[]
  20. file_contents: string
  21. file_path: string
  22. system_prompt_details: SystemPromptDetails
  23. original_diff_edit_tool_call_message: string
  24. }
  25. export interface TestConfig {
  26. model_id: string
  27. system_prompt_name: string
  28. number_of_runs: number
  29. max_attempts_per_case: number
  30. parsing_function: string
  31. diff_edit_function: string
  32. thinking_tokens_budget: number
  33. replay: boolean
  34. diff_apply_file?: string
  35. }
  36. export interface SystemPromptDetails {
  37. mcp_string: string
  38. cwd_value: string
  39. browser_use: boolean
  40. width: number
  41. height: number
  42. os_value: string
  43. shell_value: string
  44. home_value: string
  45. user_custom_instructions: string
  46. }
  47. export type ConstructSystemPromptFn = (
  48. cwdFormatted: string,
  49. supportsBrowserUse: boolean,
  50. browserWidth: number,
  51. browserHeight: number,
  52. os: string,
  53. shell: string,
  54. homeFormatted: string,
  55. mcpHubString: string,
  56. userCustomInstructions: string,
  57. ) => string
  58. export interface TestResult {
  59. success: boolean
  60. streamResult?: {
  61. assistantMessage: string
  62. reasoningMessage: string
  63. usage: {
  64. inputTokens: number
  65. outputTokens: number
  66. cacheWriteTokens: number
  67. cacheReadTokens: number
  68. totalCost: number
  69. }
  70. timing?: {
  71. timeToFirstTokenMs: number
  72. timeToFirstEditMs?: number
  73. totalRoundTripMs: number
  74. }
  75. }
  76. diffEdit?: string
  77. toolCalls?: ExtractedToolCall[]
  78. diffEditSuccess?: boolean
  79. replacementData?: any
  80. error?: string
  81. errorString?: string
  82. }
  83. export interface ExtractedToolCall {
  84. name: ClineDefaultTool
  85. input: Partial<Record<ToolParamName, string>>
  86. }
  87. export interface TestInput {
  88. apiKey?: string
  89. systemPrompt: string
  90. messages: Anthropic.Messages.MessageParam[]
  91. modelId: string
  92. originalFile: string
  93. originalFilePath: string
  94. parsingFunction: string
  95. diffEditFunction: string
  96. thinkingBudgetTokens: number
  97. originalDiffEditToolCallMessage?: string
  98. diffApplyFile?: string
  99. provider?: string
  100. isVerbose: boolean
  101. }