(messages: string[])
| 533 | } |
| 534 | |
| 535 | function extractApproaches(messages: string[]): string[] { |
| 536 | const approaches: string[] = []; |
| 537 | const patterns = [ |
| 538 | /(?:tried|approach|attempted|tested|experimented with)\s+(.+?)(?:\.|$)/gi, |
| 539 | /(?:first|then|alternatively|instead)\s*,?\s*(?:I|we|let's)\s+(.+?)(?:\.|$)/gi, |
| 540 | ]; |
| 541 | |
| 542 | for (const msg of messages.slice(-10)) { |
| 543 | for (const pattern of patterns) { |
| 544 | pattern.lastIndex = 0; |
| 545 | let match: RegExpExecArray | null; |
| 546 | while ((match = pattern.exec(msg)) !== null) { |
| 547 | const a = match[0].trim(); |
| 548 | if (a.length > 10 && a.length < 200 && !approaches.includes(a)) { |
| 549 | approaches.push(a); |
| 550 | } |
| 551 | } |
| 552 | } |
| 553 | } |
| 554 | |
| 555 | return approaches.slice(0, 8); |
| 556 | } |
| 557 | |
| 558 | function extractState(messages: string[]): string { |
| 559 | // Look at last assistant message for state |
no outgoing calls
no test coverage detected