xithead 1.4.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +108 -72
- package/app/api/config/route.ts +22 -0
- package/app/api/export/route.ts +83 -0
- package/app/api/models/route.ts +12 -0
- package/app/api/stats/route.ts +46 -0
- package/app/dashboard/page.tsx +445 -0
- package/app/globals.css +35 -0
- package/app/installation/page.tsx +293 -0
- package/app/layout.tsx +35 -0
- package/app/master-design-system.css +2076 -0
- package/app/master-design-system.source.css +8 -0
- package/app/page.tsx +187 -0
- package/app/rechtliches/agb/page.tsx +165 -0
- package/app/rechtliches/datenschutz/page.tsx +128 -0
- package/app/rechtliches/impressum/page.tsx +122 -0
- package/app/rechtliches/widerruf/page.tsx +185 -0
- package/bin/xithead.js +264 -0
- package/components/layout/AppShell.tsx +25 -0
- package/components/layout/Footer.tsx +120 -0
- package/components/layout/Header.tsx +145 -0
- package/components/marketing/LegalHighlights.tsx +45 -0
- package/components/marketing/LegalPageShell.tsx +49 -0
- package/components/marketing/LegalPanel.tsx +41 -0
- package/components/marketing/index.ts +3 -0
- package/design-system/README.md +80 -0
- package/design-system/base.css +127 -0
- package/design-system/components.css +1943 -0
- package/design-system/fonts.css +17 -0
- package/design-system/tailwind-preset.js +95 -0
- package/design-system/tokens.css +48 -0
- package/design-system/utilities.css +53 -0
- package/lib/config/index.ts +12 -0
- package/lib/hooks/index.ts +4 -0
- package/lib/hooks/use-mounted.ts +13 -0
- package/lib/hooks/use-session.ts +34 -0
- package/lib/hooks/use-settings.ts +49 -0
- package/lib/utils/index.ts +1 -0
- package/lib/utils/settings.ts +162 -0
- package/lib/utils/utils.ts +6 -0
- package/middleware.ts +26 -0
- package/next-env.d.ts +7 -0
- package/next.config.ts +12 -0
- package/package.json +77 -36
- package/postcss.config.mjs +7 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/logo-transparent.png +0 -0
- package/public/xithead.ps1 +937 -0
- package/scripts/README.md +77 -0
- package/scripts/audit_wheel_glibc_symbols.py +217 -0
- package/scripts/build-master-design-system.cjs +33 -0
- package/scripts/build_rust_extension.sh +58 -0
- package/scripts/changelog-gen.py +203 -0
- package/scripts/eval_output_shaper.py +235 -0
- package/scripts/export_kompress_v2_onnx.py +267 -0
- package/scripts/fixtures/anthropic_replay_body.json +133 -0
- package/scripts/fixtures/codex_response_create_frame.json +52 -0
- package/scripts/install-git-hooks.sh +104 -0
- package/scripts/install.ps1 +1809 -0
- package/scripts/install.sh +1673 -0
- package/scripts/pr-governance.py +297 -0
- package/scripts/record_fixtures.py +59 -0
- package/scripts/refresh_model_limits.sh +48 -0
- package/scripts/replay_codex_ws_load.py +445 -0
- package/scripts/repro_codex_replay.py +699 -0
- package/scripts/smoke_issue_327.py +233 -0
- package/scripts/sync-plugin-versions.py +116 -0
- package/scripts/tests/test_changelog_gen.py +302 -0
- package/scripts/tests/test_pr_governance.py +163 -0
- package/scripts/tests/test_pr_health_labels.py +94 -0
- package/scripts/tests/test_pr_health_workflow.py +14 -0
- package/scripts/tests/test_sync_plugin_versions.py +131 -0
- package/scripts/tests/test_version_sync.py +291 -0
- package/scripts/validate-workflows.sh +39 -0
- package/scripts/verify-versions.py +106 -0
- package/scripts/version-sync.py +207 -0
- package/tailwind.config.js +31 -0
- package/tailwind.master.config.cjs +47 -0
- package/tsconfig.json +84 -0
- package/types/api.ts +12 -0
- package/types/config.ts +9 -0
- package/types/index.ts +2 -0
- package/npm/bin/xithead.js +0 -366
- package/npm/index.d.ts +0 -57
- package/npm/index.js +0 -139
- package/npm/package.json +0 -54
- package/npm/postinstall.js +0 -43
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Validate Headroom PR template compliance for GitHub Actions."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import argparse
|
|
7
|
+
import json
|
|
8
|
+
import os
|
|
9
|
+
import re
|
|
10
|
+
import sys
|
|
11
|
+
from dataclasses import asdict, dataclass, field
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
from typing import Any
|
|
14
|
+
|
|
15
|
+
COMMENT_MARKER = "<!-- headroom-pr-governance -->"
|
|
16
|
+
READY_LABEL = "status: ready for review"
|
|
17
|
+
AUTHOR_ACTION_LABEL = "status: needs author action"
|
|
18
|
+
|
|
19
|
+
REQUIRED_SECTIONS = (
|
|
20
|
+
"Description",
|
|
21
|
+
"Type of Change",
|
|
22
|
+
"Changes Made",
|
|
23
|
+
"Testing",
|
|
24
|
+
"Real Behavior Proof",
|
|
25
|
+
"Review Readiness",
|
|
26
|
+
)
|
|
27
|
+
PROOF_FIELDS = (
|
|
28
|
+
"Environment",
|
|
29
|
+
"Exact command / steps",
|
|
30
|
+
"Observed result",
|
|
31
|
+
"Not tested",
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
SECTION_RE = re.compile(r"^##\s+(.+?)\s*$", re.MULTILINE)
|
|
35
|
+
CHECKBOX_RE = re.compile(r"^- \[(?P<checked>[ xX])\] (?P<label>.+)$", re.MULTILINE)
|
|
36
|
+
HTML_COMMENT_RE = re.compile(r"<!--.*?-->", re.DOTALL)
|
|
37
|
+
CODE_BLOCK_RE = re.compile(r"```(?:[\w.+-]+)?\n(?P<content>.*?)```", re.DOTALL)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@dataclass(slots=True)
|
|
41
|
+
class GovernanceReport:
|
|
42
|
+
"""Serializable PR governance result."""
|
|
43
|
+
|
|
44
|
+
comment_marker: str
|
|
45
|
+
valid: bool
|
|
46
|
+
is_draft: bool
|
|
47
|
+
is_bot_pr: bool
|
|
48
|
+
ready_for_review: bool
|
|
49
|
+
needs_author_action: bool
|
|
50
|
+
problems: list[str] = field(default_factory=list)
|
|
51
|
+
labels_to_add: list[str] = field(default_factory=list)
|
|
52
|
+
labels_to_remove: list[str] = field(default_factory=list)
|
|
53
|
+
comment_markdown: str = ""
|
|
54
|
+
summary_markdown: str = ""
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> dict[str, Any]:
|
|
57
|
+
return asdict(self)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def load_event(path: Path) -> dict[str, Any]:
|
|
61
|
+
return json.loads(path.read_text(encoding="utf-8"))
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def extract_sections(body: str) -> dict[str, str]:
|
|
65
|
+
matches = list(SECTION_RE.finditer(body))
|
|
66
|
+
sections: dict[str, str] = {}
|
|
67
|
+
for index, match in enumerate(matches):
|
|
68
|
+
start = match.end()
|
|
69
|
+
end = matches[index + 1].start() if index + 1 < len(matches) else len(body)
|
|
70
|
+
sections[match.group(1).strip()] = body[start:end].strip()
|
|
71
|
+
return sections
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def strip_html_comments(text: str) -> str:
|
|
75
|
+
return HTML_COMMENT_RE.sub("", text).strip()
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def non_empty_lines(text: str) -> list[str]:
|
|
79
|
+
return [line.strip() for line in strip_html_comments(text).splitlines() if line.strip()]
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def checked_items(section: str) -> list[str]:
|
|
83
|
+
return [
|
|
84
|
+
match.group("label").strip()
|
|
85
|
+
for match in CHECKBOX_RE.finditer(section)
|
|
86
|
+
if match.group("checked").lower() == "x"
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def has_descriptive_text(section: str) -> bool:
|
|
91
|
+
ignored_prefixes = ("closes #", "fixes #", "resolves #", "related to #")
|
|
92
|
+
for line in non_empty_lines(section):
|
|
93
|
+
lowered = line.lower()
|
|
94
|
+
if line.startswith("#"):
|
|
95
|
+
continue
|
|
96
|
+
if lowered.startswith(ignored_prefixes):
|
|
97
|
+
continue
|
|
98
|
+
if len(line) >= 10:
|
|
99
|
+
return True
|
|
100
|
+
return False
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def has_non_placeholder_bullets(section: str) -> bool:
|
|
104
|
+
placeholders = {"change 1", "change 2", "change 3"}
|
|
105
|
+
for line in non_empty_lines(section):
|
|
106
|
+
if not line.startswith("- "):
|
|
107
|
+
continue
|
|
108
|
+
bullet = line[2:].strip().lower()
|
|
109
|
+
if bullet and bullet not in placeholders:
|
|
110
|
+
return True
|
|
111
|
+
return False
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def has_test_output(section: str) -> bool:
|
|
115
|
+
for match in CODE_BLOCK_RE.finditer(section):
|
|
116
|
+
content = strip_html_comments(match.group("content")).strip()
|
|
117
|
+
if not content:
|
|
118
|
+
continue
|
|
119
|
+
if "paste relevant command output or artifact links here" in content.lower():
|
|
120
|
+
continue
|
|
121
|
+
return True
|
|
122
|
+
return False
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def proof_field_values(section: str) -> dict[str, str]:
|
|
126
|
+
values: dict[str, str] = {}
|
|
127
|
+
for line in non_empty_lines(section):
|
|
128
|
+
if not line.startswith("- ") or ":" not in line:
|
|
129
|
+
continue
|
|
130
|
+
label, value = line[2:].split(":", 1)
|
|
131
|
+
values[label.strip()] = value.strip()
|
|
132
|
+
return values
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def normalize_checkbox_map(items: list[str]) -> set[str]:
|
|
136
|
+
return {item.lower() for item in items}
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def validate_pull_request(event: dict[str, Any]) -> GovernanceReport:
|
|
140
|
+
pull_request = event["pull_request"]
|
|
141
|
+
author = pull_request["user"]["login"]
|
|
142
|
+
is_draft = bool(pull_request.get("draft", False))
|
|
143
|
+
is_bot_pr = author.endswith("[bot]")
|
|
144
|
+
body = pull_request.get("body") or ""
|
|
145
|
+
|
|
146
|
+
if is_bot_pr:
|
|
147
|
+
summary = "### PR governance\n\nBot-authored PR detected; template enforcement is skipped."
|
|
148
|
+
return GovernanceReport(
|
|
149
|
+
comment_marker=COMMENT_MARKER,
|
|
150
|
+
valid=True,
|
|
151
|
+
is_draft=is_draft,
|
|
152
|
+
is_bot_pr=True,
|
|
153
|
+
ready_for_review=False,
|
|
154
|
+
needs_author_action=False,
|
|
155
|
+
comment_markdown=summary,
|
|
156
|
+
summary_markdown=summary,
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
sections = extract_sections(body)
|
|
160
|
+
problems: list[str] = []
|
|
161
|
+
|
|
162
|
+
for section_name in REQUIRED_SECTIONS:
|
|
163
|
+
if section_name not in sections:
|
|
164
|
+
problems.append(f"Missing required section `{section_name}`.")
|
|
165
|
+
|
|
166
|
+
description = sections.get("Description", "")
|
|
167
|
+
if description and not has_descriptive_text(description):
|
|
168
|
+
problems.append("Fill in `Description` with a real summary of the change.")
|
|
169
|
+
|
|
170
|
+
changes_made = sections.get("Changes Made", "")
|
|
171
|
+
if changes_made and not has_non_placeholder_bullets(changes_made):
|
|
172
|
+
problems.append(
|
|
173
|
+
"Replace the placeholder bullets in `Changes Made` with the actual changes."
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
type_of_change_checked = checked_items(sections.get("Type of Change", ""))
|
|
177
|
+
if sections.get("Type of Change") and not type_of_change_checked:
|
|
178
|
+
problems.append("Check at least one box in `Type of Change`.")
|
|
179
|
+
|
|
180
|
+
testing_section = sections.get("Testing", "")
|
|
181
|
+
testing_checked = checked_items(testing_section)
|
|
182
|
+
if testing_section and not testing_checked:
|
|
183
|
+
problems.append("Check at least one verification item in `Testing`.")
|
|
184
|
+
if testing_section and not has_test_output(testing_section):
|
|
185
|
+
problems.append("Paste real command output or artifact links in `Testing` → `Test Output`.")
|
|
186
|
+
|
|
187
|
+
proof_section = sections.get("Real Behavior Proof", "")
|
|
188
|
+
proof_values = proof_field_values(proof_section)
|
|
189
|
+
for field_name in PROOF_FIELDS:
|
|
190
|
+
if proof_section and not proof_values.get(field_name):
|
|
191
|
+
problems.append(f"Fill in `Real Behavior Proof` → `{field_name}`.")
|
|
192
|
+
|
|
193
|
+
readiness_checked = normalize_checkbox_map(checked_items(sections.get("Review Readiness", "")))
|
|
194
|
+
has_self_review = "i have performed a self-review" in readiness_checked
|
|
195
|
+
has_ready_checkbox = "this pr is ready for human review" in readiness_checked
|
|
196
|
+
if not is_draft:
|
|
197
|
+
if not has_self_review:
|
|
198
|
+
problems.append(
|
|
199
|
+
"Check `I have performed a self-review` before requesting human review."
|
|
200
|
+
)
|
|
201
|
+
if not has_ready_checkbox:
|
|
202
|
+
problems.append(
|
|
203
|
+
"Check `This PR is ready for human review` or convert the PR back to draft."
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
valid = not problems
|
|
207
|
+
ready_for_review = valid and not is_draft and has_ready_checkbox and has_self_review
|
|
208
|
+
needs_author_action = not valid
|
|
209
|
+
|
|
210
|
+
if valid and ready_for_review:
|
|
211
|
+
status_lines = [
|
|
212
|
+
"### PR governance",
|
|
213
|
+
"",
|
|
214
|
+
"This PR follows the template and is marked ready for human review.",
|
|
215
|
+
]
|
|
216
|
+
elif valid:
|
|
217
|
+
status_lines = [
|
|
218
|
+
"### PR governance",
|
|
219
|
+
"",
|
|
220
|
+
"This draft PR follows the template so far. Keep it in draft until it is ready for human review.",
|
|
221
|
+
]
|
|
222
|
+
else:
|
|
223
|
+
status_lines = [
|
|
224
|
+
"### PR governance",
|
|
225
|
+
"",
|
|
226
|
+
"This PR does not yet satisfy the required template fields:",
|
|
227
|
+
"",
|
|
228
|
+
*[f"- {problem}" for problem in problems],
|
|
229
|
+
"",
|
|
230
|
+
"Please update the PR body, or move the PR back to draft while it is still in progress.",
|
|
231
|
+
]
|
|
232
|
+
|
|
233
|
+
labels_to_add: list[str] = []
|
|
234
|
+
labels_to_remove: list[str] = []
|
|
235
|
+
if needs_author_action:
|
|
236
|
+
labels_to_add.append(AUTHOR_ACTION_LABEL)
|
|
237
|
+
labels_to_remove.append(READY_LABEL)
|
|
238
|
+
else:
|
|
239
|
+
labels_to_remove.append(AUTHOR_ACTION_LABEL)
|
|
240
|
+
if ready_for_review:
|
|
241
|
+
labels_to_add.append(READY_LABEL)
|
|
242
|
+
else:
|
|
243
|
+
labels_to_remove.append(READY_LABEL)
|
|
244
|
+
|
|
245
|
+
comment_markdown = "\n".join(status_lines)
|
|
246
|
+
return GovernanceReport(
|
|
247
|
+
comment_marker=COMMENT_MARKER,
|
|
248
|
+
valid=valid,
|
|
249
|
+
is_draft=is_draft,
|
|
250
|
+
is_bot_pr=False,
|
|
251
|
+
ready_for_review=ready_for_review,
|
|
252
|
+
needs_author_action=needs_author_action,
|
|
253
|
+
problems=problems,
|
|
254
|
+
labels_to_add=labels_to_add,
|
|
255
|
+
labels_to_remove=labels_to_remove,
|
|
256
|
+
comment_markdown=comment_markdown,
|
|
257
|
+
summary_markdown=comment_markdown,
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
def emit_outputs(report: GovernanceReport) -> None:
|
|
262
|
+
output_path = os.environ.get("GITHUB_OUTPUT")
|
|
263
|
+
lines = [
|
|
264
|
+
f"valid={str(report.valid).lower()}",
|
|
265
|
+
f"ready_for_review={str(report.ready_for_review).lower()}",
|
|
266
|
+
f"needs_author_action={str(report.needs_author_action).lower()}",
|
|
267
|
+
f"is_bot_pr={str(report.is_bot_pr).lower()}",
|
|
268
|
+
]
|
|
269
|
+
if not output_path:
|
|
270
|
+
for line in lines:
|
|
271
|
+
print(line)
|
|
272
|
+
return
|
|
273
|
+
|
|
274
|
+
with Path(output_path).open("a", encoding="utf-8") as output_file:
|
|
275
|
+
for line in lines:
|
|
276
|
+
output_file.write(f"{line}\n")
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
def parse_args(argv: list[str]) -> argparse.Namespace:
|
|
280
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
281
|
+
parser.add_argument(
|
|
282
|
+
"--event", type=Path, required=True, help="Path to the GitHub event payload JSON."
|
|
283
|
+
)
|
|
284
|
+
parser.add_argument("--report", type=Path, required=True, help="Path to write the JSON report.")
|
|
285
|
+
return parser.parse_args(argv)
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
def main(argv: list[str] | None = None) -> int:
|
|
289
|
+
args = parse_args(argv or sys.argv[1:])
|
|
290
|
+
report = validate_pull_request(load_event(args.event))
|
|
291
|
+
args.report.write_text(json.dumps(report.to_dict(), indent=2), encoding="utf-8")
|
|
292
|
+
emit_outputs(report)
|
|
293
|
+
return 0
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
if __name__ == "__main__":
|
|
297
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Entry point for recording Rust-vs-Python parity fixtures.
|
|
3
|
+
|
|
4
|
+
Usage:
|
|
5
|
+
python scripts/record_fixtures.py
|
|
6
|
+
|
|
7
|
+
This driver:
|
|
8
|
+
1. Monkey-patches the Phase-1 transform classes via
|
|
9
|
+
`tests.parity.recorder.record_all()`.
|
|
10
|
+
2. Runs a small deterministic synthetic workload (no network, no real LLM
|
|
11
|
+
calls) that hits each transform at least 20 times with varied inputs.
|
|
12
|
+
3. Prints a summary and exits non-zero if any transform was blocked.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import logging
|
|
18
|
+
import sys
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
|
|
21
|
+
# Make `tests/parity/recorder.py` importable without installing it.
|
|
22
|
+
_REPO_ROOT = Path(__file__).resolve().parent.parent
|
|
23
|
+
sys.path.insert(0, str(_REPO_ROOT))
|
|
24
|
+
|
|
25
|
+
from tests.parity.recorder import record_all, run_default_workload # noqa: E402
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def main() -> int:
|
|
29
|
+
logging.basicConfig(level=logging.INFO, format="%(levelname)s %(name)s: %(message)s")
|
|
30
|
+
log = logging.getLogger("record_fixtures")
|
|
31
|
+
|
|
32
|
+
statuses = record_all()
|
|
33
|
+
log.info("patch status:")
|
|
34
|
+
blocked = []
|
|
35
|
+
for name, status in statuses.items():
|
|
36
|
+
log.info(" %-16s %s", name, status)
|
|
37
|
+
if status.startswith("blocked:"):
|
|
38
|
+
blocked.append((name, status))
|
|
39
|
+
|
|
40
|
+
counts = run_default_workload()
|
|
41
|
+
log.info("fixture counts:")
|
|
42
|
+
shortfall = []
|
|
43
|
+
for name, n in counts.items():
|
|
44
|
+
log.info(" %-16s %d", name, n)
|
|
45
|
+
if n < 20:
|
|
46
|
+
shortfall.append((name, n))
|
|
47
|
+
|
|
48
|
+
if blocked:
|
|
49
|
+
log.error("blocked transforms: %s", blocked)
|
|
50
|
+
if shortfall:
|
|
51
|
+
log.error("transforms with <20 fixtures: %s", shortfall)
|
|
52
|
+
|
|
53
|
+
# Exit non-zero if anything was wholly blocked; short recordings are
|
|
54
|
+
# a soft warning.
|
|
55
|
+
return 1 if blocked else 0
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
if __name__ == "__main__":
|
|
59
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# Refresh the vendored LiteLLM model_prices_and_context_window.json
|
|
4
|
+
# used by `crates/headroom-proxy/src/compression/model_limits.rs`.
|
|
5
|
+
#
|
|
6
|
+
# We vendor the snapshot rather than fetching at build/runtime so the
|
|
7
|
+
# proxy binary ships with no network dependency at startup. Operators
|
|
8
|
+
# tracking new model releases run this script and commit the diff.
|
|
9
|
+
#
|
|
10
|
+
# Validation:
|
|
11
|
+
# 1. JSON parses
|
|
12
|
+
# 2. Contains a known-stable Claude model entry
|
|
13
|
+
# 3. Contains a known-stable GPT model entry
|
|
14
|
+
# These guard against accidentally vendoring an empty / malformed file.
|
|
15
|
+
|
|
16
|
+
set -euo pipefail
|
|
17
|
+
|
|
18
|
+
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
19
|
+
DEST="$REPO_ROOT/crates/headroom-proxy/data/model_prices_and_context_window.json"
|
|
20
|
+
URL="https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json"
|
|
21
|
+
|
|
22
|
+
echo "Fetching $URL"
|
|
23
|
+
TMP="$(mktemp)"
|
|
24
|
+
trap 'rm -f "$TMP"' EXIT
|
|
25
|
+
curl -fsSL "$URL" -o "$TMP"
|
|
26
|
+
|
|
27
|
+
# Validate the snapshot before swapping it in.
|
|
28
|
+
python3 -c "
|
|
29
|
+
import json, sys
|
|
30
|
+
with open('$TMP') as f:
|
|
31
|
+
data = json.load(f)
|
|
32
|
+
if not isinstance(data, dict):
|
|
33
|
+
sys.exit('top-level not an object')
|
|
34
|
+
if 'sample_spec' not in data:
|
|
35
|
+
sys.exit('missing sample_spec entry — schema may have changed')
|
|
36
|
+
# Spot-check stable entries.
|
|
37
|
+
required = ['claude-sonnet-4-5-20250929', 'gpt-4o-mini', 'gpt-4-turbo']
|
|
38
|
+
missing = [k for k in required if k not in data]
|
|
39
|
+
if missing:
|
|
40
|
+
sys.exit(f'missing required entries: {missing!r}')
|
|
41
|
+
print(f'OK: {len(data)} entries, including {required}')
|
|
42
|
+
"
|
|
43
|
+
|
|
44
|
+
mv "$TMP" "$DEST"
|
|
45
|
+
trap - EXIT
|
|
46
|
+
|
|
47
|
+
echo "Updated $DEST"
|
|
48
|
+
echo "Run 'cargo test -p headroom-proxy --lib compression::model_limits' to verify."
|