claudeModelId.ts ×9

Frontier kind: Code frontier

unlabeled · c_14b34a37a8b2

222 tests · 3484 LOC · 19 files · introduces 0 tests · 22 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
9 ranges22 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
498 ranges3484 lines · 19 files · Browse complete extent
All tests (intent)
222 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 22 introduced LOC across 9 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/claude/claudeModelId.ts 22 introduced LOC · 9 ranges

Open complete file

81 */
82 export function tryParseClaudeModelId(modelId: string): ParsedClaudeModelId | undefined {
83 > const cacheKey = modelId.toLowerCase(); claudeModelId.ts
84 > if (cache.has(cacheKey)) {
85 return cache.get(cacheKey);
86 }
88 > const result = doParse(cacheKey);
89 > cache.set(cacheKey, result);
90 > return result;
91 > }
92
93 const DATE_SUFFIX_RE = /^(?<base>.*)-(?<date>\d{8})$/;
94
95 > function doParse(lower: string): ParsedClaudeModelId | undefined { claudeModelId.ts
96 > let dateSuffix = '';
97 > let base = lower;
98 >
99 > const dateMatch = DATE_SUFFIX_RE.exec(lower);
100 > if (dateMatch?.groups) {
101 base = dateMatch.groups.base;
102 dateSuffix = dateMatch.groups.date;
103 }
105 > // Pattern 1: claude-{name}-{major}-{minor}[-{mod}] (e.g. claude-opus-4-5, claude-opus-4-6-1m)
106 > const p1 = base.match(/^claude-(?<name>\w+)-(?<major>\d+)-(?<minor>\d+)(?:-(?<mod>.+))?$/);
107 > if (p1?.groups) {
108 return makeResult(p1.groups.name, p1.groups.major, p1.groups.minor, joinModifiers(p1.groups.mod, dateSuffix));
109 }
111 // Pattern 2: claude-{major}-{minor}-{name}[-{mod}] (e.g. claude-3-5-sonnet)
112 const p2 = base.match(/^claude-(?<major>\d+)-(?<minor>\d+)-(?<name>\w+)(?:-(?<mod>.+))?$/);
113 > if (p2?.groups) { claudeModelId.ts
114 return makeResult(p2.groups.name, p2.groups.major, p2.groups.minor, joinModifiers(p2.groups.mod, dateSuffix));
115 }
117 // Pattern 3: claude-{name}-{major}.{minor}[-{mod}] (e.g. claude-opus-4.5, claude-opus-4.6-1m)
118 const p3 = base.match(/^claude-(?<name>\w+)-(?<major>\d+)\.(?<minor>\d+)(?:-(?<mod>.+))?$/);
119 > if (p3?.groups) { claudeModelId.ts
120 return makeResult(p3.groups.name, p3.groups.major, p3.groups.minor, joinModifiers(p3.groups.mod, dateSuffix));
121 }
123 // Pattern 4: claude-{name}-{major}[-{mod}] (e.g. claude-sonnet-4, claude-sonnet-4-1m)
124 const p4 = base.match(/^claude-(?<name>\w+)-(?<major>\d+)(?:-(?<mod>.+))?$/);
125 > if (p4?.groups) { claudeModelId.ts
126 return makeResult(p4.groups.name, p4.groups.major, undefined, joinModifiers(p4.groups.mod, dateSuffix));
127 }
129 // Pattern 5: claude-{major}-{name}[-{mod}] (e.g. claude-3-opus)
130 const p5 = base.match(/^claude-(?<major>\d+)-(?<name>\w+)(?:-(?<mod>.+))?$/);
131 > if (p5?.groups) { claudeModelId.ts
132 return makeResult(p5.groups.name, p5.groups.major, undefined, joinModifiers(p5.groups.mod, dateSuffix));
133 }
135 // Pattern 6: bare model name with no version (e.g. nectarine)
136 const p6 = base.match(/^(?<name>\w+)$/);
137 > if (p6?.groups) { claudeModelId.ts
138 return makeBareResult(p6.groups.name);
139 }