( id: string, outcome: 'accepted' | 'aborted' | 'error', startTime: number, suggestionLength: number, messages: Message[], boundary: CompletionBoundary | null, extras?: Record<string, string | number | boolean | undefined>, )
| 122 | > |
| 123 | |
| 124 | function logSpeculation( |
| 125 | id: string, |
| 126 | outcome: 'accepted' | 'aborted' | 'error', |
| 127 | startTime: number, |
| 128 | suggestionLength: number, |
| 129 | messages: Message[], |
| 130 | boundary: CompletionBoundary | null, |
| 131 | extras?: Record<string, string | number | boolean | undefined>, |
| 132 | ): void { |
| 133 | logEvent('tengu_speculation', { |
| 134 | speculation_id: |
| 135 | id as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, |
| 136 | outcome: |
| 137 | outcome as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, |
| 138 | duration_ms: Date.now() - startTime, |
| 139 | suggestion_length: suggestionLength, |
| 140 | tools_executed: countToolsInMessages(messages), |
| 141 | completed: boundary !== null, |
| 142 | boundary_type: boundary?.type as |
| 143 | | AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS |
| 144 | | undefined, |
| 145 | boundary_tool: getBoundaryTool(boundary) as |
| 146 | | AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS |
| 147 | | undefined, |
| 148 | boundary_detail: getBoundaryDetail(boundary) as |
| 149 | | AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS |
| 150 | | undefined, |
| 151 | ...extras, |
| 152 | }) |
| 153 | } |
| 154 | |
| 155 | function countToolsInMessages(messages: Message[]): number { |
| 156 | const blocks = messages |
no test coverage detected