mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-12-03 12:32:02 +00:00
context: Fable and Mythos 5 report a 1M window (#1522)
This commit is contained in:
parent
445d7ad944
commit
4d0f02a51c
2 changed files with 22 additions and 3 deletions
|
|
@ -406,9 +406,11 @@ async function findLastBoundary(filePath: string): Promise<{
|
|||
}
|
||||
|
||||
// Claude models with a 1M window: opus-4-8 (auto-compactions on disk show
|
||||
// ~1.0M preTokens) and the "[1m]" long-context variants. Others default to
|
||||
// 200K unless the session itself proves bigger.
|
||||
const MILLION_WINDOW_RE = /opus-4-8|\[1m\]/
|
||||
// ~1.0M preTokens), the Claude 5 Fable / Mythos ids (claude-fable-5-1 and
|
||||
// claude-mythos-5-1 run a 1M window from the first turn), and the "[1m]"
|
||||
// long-context variants. Others default to 200K unless the session itself
|
||||
// proves bigger.
|
||||
const MILLION_WINDOW_RE = /opus-4-8|fable-5|mythos-5|\[1m\]/
|
||||
|
||||
export function reportedContextWindow(model: string, maxSeenTokens: number): number {
|
||||
return MILLION_WINDOW_RE.test(model) || maxSeenTokens > 220_000 ? 1_000_000 : 200_000
|
||||
|
|
|
|||
17
tests/context-window.test.ts
Normal file
17
tests/context-window.test.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { reportedContextWindow } from '../src/context-tree.js'
|
||||
|
||||
describe('reportedContextWindow', () => {
|
||||
it('treats the Claude 5 Fable and Mythos ids as 1M windows from the first turn', () => {
|
||||
expect(reportedContextWindow('claude-fable-5-1', 10_000)).toBe(1_000_000)
|
||||
expect(reportedContextWindow('claude-mythos-5-1', 10_000)).toBe(1_000_000)
|
||||
})
|
||||
|
||||
it('keeps the existing 1M names and the 220k proof rule', () => {
|
||||
expect(reportedContextWindow('claude-opus-4-8', 10_000)).toBe(1_000_000)
|
||||
expect(reportedContextWindow('claude-sonnet-4-5[1m]', 10_000)).toBe(1_000_000)
|
||||
expect(reportedContextWindow('claude-sonnet-4-5', 10_000)).toBe(200_000)
|
||||
expect(reportedContextWindow('claude-sonnet-4-5', 220_001)).toBe(1_000_000)
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue