({ providerProfile, threadId, onTurnStarted = null })
| 426 | return true; |
| 427 | } |
| 428 | async compactThread({ providerProfile, threadId, onTurnStarted = null }) { |
| 429 | this.compactThreadCalls.push({ providerProfile, threadId }); |
| 430 | const existingThread = this.threads.get(threadId); |
| 431 | if (!existingThread) { |
| 432 | throw new Error(`thread not found: ${threadId}`); |
| 433 | } |
| 434 | const turnId = `${threadId}-compact-${this.compactThreadCalls.length}`; |
| 435 | if (typeof onTurnStarted === 'function') { |
| 436 | await onTurnStarted({ |
| 437 | turnId, |
| 438 | threadId, |
| 439 | }); |
| 440 | } |
| 441 | this.threads.set(threadId, { |
| 442 | ...existingThread, |
| 443 | updatedAt: this.nextUpdatedAt(), |
| 444 | preview: '[compacted]', |
| 445 | }); |
| 446 | return { |
| 447 | requestedThreadId: threadId, |
| 448 | threadId, |
| 449 | cwd: existingThread.cwd ?? null, |
| 450 | title: existingThread.title ?? null, |
| 451 | turnId, |
| 452 | status: 'completed', |
| 453 | }; |
| 454 | } |
| 455 | |
| 456 | |
| 457 | async archiveThread({ threadId }) { |
nothing calls this directly
no test coverage detected