* Apply the same context transforms query.ts does before the API call, so * /context shows what the model actually sees rather than the REPL's raw * history. Without projectView the token count overcounts by however much * was collapsed — user sees "180k, 3 spans collapsed" when the API sees 120k
(messages: Message[])
| 16 | * was collapsed — user sees "180k, 3 spans collapsed" when the API sees 120k. |
| 17 | */ |
| 18 | function toApiView(messages: Message[]): Message[] { |
| 19 | let view = getMessagesAfterCompactBoundary(messages); |
| 20 | if (feature('CONTEXT_COLLAPSE')) { |
| 21 | /* eslint-disable @typescript-eslint/no-require-imports */ |
| 22 | const { |
| 23 | projectView |
| 24 | } = require('../../services/contextCollapse/operations.js') as typeof import('../../services/contextCollapse/operations.js'); |
| 25 | /* eslint-enable @typescript-eslint/no-require-imports */ |
| 26 | view = projectView(view); |
| 27 | } |
| 28 | return view; |
| 29 | } |
| 30 | export async function call(onDone: LocalJSXCommandOnDone, context: LocalJSXCommandContext): Promise<React.ReactNode> { |
| 31 | const { |
| 32 | messages, |
no test coverage detected