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.
Files changed (86) hide show
  1. package/README.md +108 -72
  2. package/app/api/config/route.ts +22 -0
  3. package/app/api/export/route.ts +83 -0
  4. package/app/api/models/route.ts +12 -0
  5. package/app/api/stats/route.ts +46 -0
  6. package/app/dashboard/page.tsx +445 -0
  7. package/app/globals.css +35 -0
  8. package/app/installation/page.tsx +293 -0
  9. package/app/layout.tsx +35 -0
  10. package/app/master-design-system.css +2076 -0
  11. package/app/master-design-system.source.css +8 -0
  12. package/app/page.tsx +187 -0
  13. package/app/rechtliches/agb/page.tsx +165 -0
  14. package/app/rechtliches/datenschutz/page.tsx +128 -0
  15. package/app/rechtliches/impressum/page.tsx +122 -0
  16. package/app/rechtliches/widerruf/page.tsx +185 -0
  17. package/bin/xithead.js +264 -0
  18. package/components/layout/AppShell.tsx +25 -0
  19. package/components/layout/Footer.tsx +120 -0
  20. package/components/layout/Header.tsx +145 -0
  21. package/components/marketing/LegalHighlights.tsx +45 -0
  22. package/components/marketing/LegalPageShell.tsx +49 -0
  23. package/components/marketing/LegalPanel.tsx +41 -0
  24. package/components/marketing/index.ts +3 -0
  25. package/design-system/README.md +80 -0
  26. package/design-system/base.css +127 -0
  27. package/design-system/components.css +1943 -0
  28. package/design-system/fonts.css +17 -0
  29. package/design-system/tailwind-preset.js +95 -0
  30. package/design-system/tokens.css +48 -0
  31. package/design-system/utilities.css +53 -0
  32. package/lib/config/index.ts +12 -0
  33. package/lib/hooks/index.ts +4 -0
  34. package/lib/hooks/use-mounted.ts +13 -0
  35. package/lib/hooks/use-session.ts +34 -0
  36. package/lib/hooks/use-settings.ts +49 -0
  37. package/lib/utils/index.ts +1 -0
  38. package/lib/utils/settings.ts +162 -0
  39. package/lib/utils/utils.ts +6 -0
  40. package/middleware.ts +26 -0
  41. package/next-env.d.ts +7 -0
  42. package/next.config.ts +12 -0
  43. package/package.json +77 -36
  44. package/postcss.config.mjs +7 -0
  45. package/public/apple-touch-icon.png +0 -0
  46. package/public/logo-transparent.png +0 -0
  47. package/public/xithead.ps1 +937 -0
  48. package/scripts/README.md +77 -0
  49. package/scripts/audit_wheel_glibc_symbols.py +217 -0
  50. package/scripts/build-master-design-system.cjs +33 -0
  51. package/scripts/build_rust_extension.sh +58 -0
  52. package/scripts/changelog-gen.py +203 -0
  53. package/scripts/eval_output_shaper.py +235 -0
  54. package/scripts/export_kompress_v2_onnx.py +267 -0
  55. package/scripts/fixtures/anthropic_replay_body.json +133 -0
  56. package/scripts/fixtures/codex_response_create_frame.json +52 -0
  57. package/scripts/install-git-hooks.sh +104 -0
  58. package/scripts/install.ps1 +1809 -0
  59. package/scripts/install.sh +1673 -0
  60. package/scripts/pr-governance.py +297 -0
  61. package/scripts/record_fixtures.py +59 -0
  62. package/scripts/refresh_model_limits.sh +48 -0
  63. package/scripts/replay_codex_ws_load.py +445 -0
  64. package/scripts/repro_codex_replay.py +699 -0
  65. package/scripts/smoke_issue_327.py +233 -0
  66. package/scripts/sync-plugin-versions.py +116 -0
  67. package/scripts/tests/test_changelog_gen.py +302 -0
  68. package/scripts/tests/test_pr_governance.py +163 -0
  69. package/scripts/tests/test_pr_health_labels.py +94 -0
  70. package/scripts/tests/test_pr_health_workflow.py +14 -0
  71. package/scripts/tests/test_sync_plugin_versions.py +131 -0
  72. package/scripts/tests/test_version_sync.py +291 -0
  73. package/scripts/validate-workflows.sh +39 -0
  74. package/scripts/verify-versions.py +106 -0
  75. package/scripts/version-sync.py +207 -0
  76. package/tailwind.config.js +31 -0
  77. package/tailwind.master.config.cjs +47 -0
  78. package/tsconfig.json +84 -0
  79. package/types/api.ts +12 -0
  80. package/types/config.ts +9 -0
  81. package/types/index.ts +2 -0
  82. package/npm/bin/xithead.js +0 -366
  83. package/npm/index.d.ts +0 -57
  84. package/npm/index.js +0 -139
  85. package/npm/package.json +0 -54
  86. package/npm/postinstall.js +0 -43
package/README.md CHANGED
@@ -1,72 +1,108 @@
1
- # xtream-head
2
-
3
- **Lokaler Claude Code Proxy** von [Xtream-ITSolutions UG](https://xtream-itsolutions.com) — setzt sich zwischen Claude Code und die Anthropic API, maximiert den Prompt Cache und reduziert Token-Kosten bis zu **88%**.
4
-
5
- Dashboard läuft lokal auf `localhost:8787/dashboard` — deine Stats, deine Daten.
6
-
7
- ---
8
-
9
- ## Installation
10
-
11
- ### Option 1: Von GitHub (EMPFOHLEN) ⭐
12
-
13
- Immer die neueste Version mit allen Features:
14
-
15
- ```bash
16
- npm install github:xtream-itsolutions/xithead
17
- ```
18
-
19
- Dann starten:
20
- ```bash
21
- xithead
22
- ```
23
-
24
- ### Option 2: Skript-Installation (Windows)
25
-
26
- ```powershell
27
- iex (irm https://raw.githubusercontent.com/xtream-itsolutions/xithead/main/xithead.ps1)
28
- xithead
29
- ```
30
-
31
- ### Option 3: npm (Stable Release)
32
-
33
- ```bash
34
- npm install xithead@latest
35
- xithead
36
- ```
37
-
38
- Vollständige Anleitung für Windows, macOS und Linux: **[xtream-head.com/installation](https://xtream-head.com/installation)**
39
-
40
- ---
41
-
42
- ## Befehle
43
-
44
- | Befehl | Funktion |
45
- |--------|----------|
46
- | `xithead` | Proxy + Claude Code starten |
47
- | `xithead-dashboard` | Dashboard im Browser öffnen |
48
- | `xithead-stats` | Einsparungen in der Konsole anzeigen |
49
- | `xithead-update` | Alles aktualisieren |
50
- | `xithead-doctor` | System-Diagnose |
51
-
52
- ---
53
-
54
- ## Was es macht
55
-
56
- - **Cache-Control Normalisierung** — Verhindert HTTP 400 Fehler
57
- - **Lossless Compression** — ANSI-Strip, Run-Collapse, Diff-Strip, Line-Truncation
58
- - **Message Dedup** — Identische Nachrichten werden eliminiert
59
- - **Context Trim** — Automatische Kürzung bei Token-Overflow
60
- - **Lokales Dashboard** — Echtzeit-Stats auf `localhost:8787/dashboard`
61
-
62
- ---
63
-
64
- ## Links
65
-
66
- - Website: [xtream-head.com](https://xtream-head.com)
67
- - Discord: [discord.gg/xtream-itsolutions](https://discord.gg/xtream-itsolutions)
68
- - Unternehmen: [xtream-itsolutions.com](https://xtream-itsolutions.com)
69
-
70
- ---
71
-
72
- Apache 2.0 License · © 2026 Xtream-ITSolutions UG
1
+ # xtream-head
2
+
3
+ **Lokaler Claude Code Proxy** von [Xtream-ITSolutions UG](https://xtream-itsolutions.com) — setzt sich zwischen Claude Code und die Anthropic API, maximiert den Prompt Cache und reduziert Token-Kosten bis zu **88%**.
4
+
5
+ Dashboard läuft lokal auf `localhost:8787/dashboard` — deine Stats, deine Daten.
6
+
7
+ ---
8
+
9
+ ## Installation
10
+
11
+ ### Option 1: Proxy (Python, empfohlen für Claude Code)
12
+
13
+ Der Proxy ist das Python-Paket. Er startet auf `http://127.0.0.1:8787` und leitet Anfragen an `https://api.anthropic.com` weiter.
14
+
15
+ ```bash
16
+ pip install "xtream-head[proxy]" # aus PyPI, sobald veröffentlicht
17
+ # oder aus dem Repo:
18
+ pip install -e ".[proxy]"
19
+ ```
20
+
21
+ Proxy starten und Claude Code direkt darüber laufen lassen:
22
+ ```bash
23
+ xithead wrap claude
24
+ ```
25
+
26
+ Oder den Proxy separat starten und die Umgebungsvariable selbst setzen:
27
+ ```bash
28
+ xithead proxy --port 8787
29
+ export ANTHROPIC_BASE_URL=http://127.0.0.1:8787 # Windows PowerShell: $env:ANTHROPIC_BASE_URL='http://127.0.0.1:8787'
30
+ claude
31
+ ```
32
+
33
+ ### Option 2: Dashboard (npm)
34
+
35
+ Das npm-Paket startet nur das Next.js-Dashboard. Es startet keinen Proxy.
36
+
37
+ ```bash
38
+ npm install -g github:xtream-itsolutions/xithead
39
+ xithead # Dashboard auf http://localhost:8787/dashboard
40
+ ```
41
+
42
+ > **Hinweis:** Beide Pakete stellen einen Befehl `xithead` bereit. Nicht beide gleichzeitig installieren, und beide Dienste nicht gleichzeitig auf Port 8787 starten.
43
+
44
+ ### Option 3: Skript-Installation (Windows)
45
+
46
+ ```powershell
47
+ iex (irm https://raw.githubusercontent.com/xtream-itsolutions/xithead/main/xithead.ps1)
48
+ xithead
49
+ ```
50
+
51
+ ### VS Code: Claude Code Extension über den Proxy betreiben
52
+
53
+ Die Extension liest dieselbe Claude-Code-Konfiguration wie die CLI. Die Umgebungsvariable deshalb in `~/.claude/settings.json` eintragen, nicht nur in der Shell:
54
+
55
+ ```json
56
+ {
57
+ "env": {
58
+ "ANTHROPIC_BASE_URL": "http://127.0.0.1:8787"
59
+ }
60
+ }
61
+ ```
62
+
63
+ Danach:
64
+ 1. Proxy starten: `xithead proxy --port 8787`.
65
+ 2. VS Code komplett neu starten, damit die Extension die Einstellung übernimmt.
66
+ 3. Im Claude-Code-Panel eine Nachricht senden.
67
+
68
+ Ist der Proxy nicht gestartet, schlagen Anfragen fehl. Dann den `env`-Eintrag entfernen, damit Claude Code wieder direkt mit der Anthropic-API spricht.
69
+
70
+ Vollständige Anleitung für Windows, macOS und Linux: **[xtream-head.com/installation](https://xtream-head.com/installation)**
71
+
72
+ ---
73
+
74
+ ## Befehle
75
+
76
+ | Befehl | Funktion |
77
+ |--------|----------|
78
+ | `xtream-head` | Proxy + Claude Code starten |
79
+ | `xtream-head-dashboard` | Dashboard im Browser öffnen |
80
+ | `xtream-head-stats` | Einsparungen in der Konsole anzeigen |
81
+ | `xtream-head-update` | Alles aktualisieren |
82
+ | `xtream-head-doctor` | System-Diagnose |
83
+ | `headroom privacy doctor` | Datenschutz- und Deployment-Sicherheit prüfen |
84
+
85
+ ---
86
+
87
+ ## Was es macht
88
+
89
+ - **Cache-Control Normalisierung** — Verhindert HTTP 400 Fehler
90
+ - **Lossless Compression** — ANSI-Strip, Run-Collapse, Diff-Strip, Line-Truncation
91
+ - **Message Dedup** — Identische Nachrichten werden eliminiert
92
+ - **Context Trim** — Automatische Kürzung bei Token-Overflow
93
+ - **Lokales Dashboard** — Echtzeit-Stats auf `localhost:8787/dashboard`
94
+ - **Policy Engine** — Provider-, Modell- und Projektregeln für sichere Kompression
95
+ - **Replay-Fixtures** — anonymisierte Requests reproduzierbar analysieren
96
+ - **Quality Score** — Einsparung, Latenz, Struktur und Zuverlässigkeit gemeinsam bewerten
97
+
98
+ ---
99
+
100
+ ## Links
101
+
102
+ - Website: [xtream-head.com](https://xtream-head.com)
103
+ - Discord: [discord.gg/xtream-itsolutions](https://discord.gg/xtream-itsolutions)
104
+ - Unternehmen: [xtream-itsolutions.com](https://xtream-itsolutions.com)
105
+
106
+ ---
107
+
108
+ Apache 2.0 License · © 2026 Xtream-ITSolutions UG
@@ -0,0 +1,22 @@
1
+ import { NextResponse } from "next/server"
2
+
3
+ let config = {
4
+ model: "claude-sonnet-5",
5
+ theme: "dark",
6
+ autoUpdate: true,
7
+ cacheEnabled: true,
8
+ }
9
+
10
+ export async function GET() {
11
+ return NextResponse.json(config)
12
+ }
13
+
14
+ export async function POST(request: Request) {
15
+ try {
16
+ const body = await request.json()
17
+ config = { ...config, ...body }
18
+ return NextResponse.json({ success: true, config })
19
+ } catch (error) {
20
+ return NextResponse.json({ error: "Invalid request" }, { status: 400 })
21
+ }
22
+ }
@@ -0,0 +1,83 @@
1
+ import { NextResponse } from "next/server"
2
+
3
+ export async function GET(request: Request) {
4
+ try {
5
+ const { searchParams } = new URL(request.url)
6
+ const format = searchParams.get("format") || "json"
7
+
8
+ // Fetch current config and stats
9
+ const configRes = await fetch("http://localhost:8787/api/config", {
10
+ cache: "no-store",
11
+ }).catch(() => null)
12
+ const statsRes = await fetch("http://localhost:8787/api/stats", {
13
+ cache: "no-store",
14
+ }).catch(() => null)
15
+ const logsRes = await fetch("http://localhost:8787/api/logs", {
16
+ cache: "no-store",
17
+ }).catch(() => null)
18
+
19
+ const config = configRes ? await configRes.json() : {}
20
+ const stats = statsRes ? await statsRes.json() : {}
21
+ const logs = logsRes ? await logsRes.json() : {}
22
+
23
+ const exportData = {
24
+ version: "1.5.0",
25
+ exported_at: new Date().toISOString(),
26
+ config,
27
+ stats,
28
+ logs: logs.logs || [],
29
+ }
30
+
31
+ if (format === "json") {
32
+ return new NextResponse(JSON.stringify(exportData, null, 2), {
33
+ headers: {
34
+ "Content-Type": "application/json",
35
+ "Content-Disposition": `attachment; filename="xithead-export-${Date.now()}.json"`,
36
+ },
37
+ })
38
+ }
39
+
40
+ if (format === "csv") {
41
+ const csv = convertToCSV(exportData)
42
+ return new NextResponse(csv, {
43
+ headers: {
44
+ "Content-Type": "text/csv",
45
+ "Content-Disposition": `attachment; filename="xithead-export-${Date.now()}.csv"`,
46
+ },
47
+ })
48
+ }
49
+
50
+ return NextResponse.json({ error: "Invalid format" }, { status: 400 })
51
+ } catch (error) {
52
+ return NextResponse.json({ error: "Export failed" }, { status: 500 })
53
+ }
54
+ }
55
+
56
+ function convertToCSV(data: any): string {
57
+ const lines: string[] = []
58
+
59
+ // Config section
60
+ lines.push("=== Configuration ===")
61
+ lines.push(`Model,${data.config.model || "N/A"}`)
62
+ lines.push(`Cache Enabled,${data.config.cacheEnabled || false}`)
63
+ lines.push(`Auto Update,${data.config.autoUpdate || false}`)
64
+
65
+ lines.push("")
66
+ lines.push("=== Statistics ===")
67
+ lines.push(`Requests,${data.stats.requests || 0}`)
68
+ lines.push(`Tokens Saved,${data.stats.tokensSaved || 0}`)
69
+ lines.push(`Cost Saved,${data.stats.costSaved || 0}`)
70
+ lines.push(`Cache Hit Rate,${((data.stats.cacheHitRate || 0) * 100).toFixed(1)}%`)
71
+
72
+ if (data.logs && data.logs.length > 0) {
73
+ lines.push("")
74
+ lines.push("=== Recent Activity ===")
75
+ lines.push("Timestamp,Type,Message")
76
+ data.logs.slice(0, 20).forEach((log: any) => {
77
+ const timestamp = new Date(log.timestamp).toLocaleString()
78
+ lines.push(`"${timestamp}","${log.type}","${log.message}"`)
79
+ })
80
+ }
81
+
82
+ return lines.join("\n")
83
+ }
@@ -0,0 +1,12 @@
1
+ import { NextResponse } from "next/server"
2
+
3
+ export async function GET() {
4
+ const models = [
5
+ { id: "claude-opus-5-5", name: "Claude Opus 5.5", description: "Most capable, for complex tasks" },
6
+ { id: "claude-sonnet-5", name: "Claude Sonnet 5", description: "Balanced, fast and capable" },
7
+ { id: "claude-haiku-4-5-20251001", name: "Claude Haiku 4.5", description: "Fastest, for simple tasks" },
8
+ { id: "claude-fable-5-1", name: "Claude Fable 5.1", description: "Lightweight, experimental" },
9
+ ]
10
+
11
+ return NextResponse.json({ models })
12
+ }
@@ -0,0 +1,46 @@
1
+ import { NextResponse } from "next/server"
2
+
3
+ // In-memory stats (in production would use database)
4
+ let stats = {
5
+ requests: 0,
6
+ tokensSaved: 0,
7
+ costSaved: 0,
8
+ cacheHitRate: 0,
9
+ uptime: Date.now(),
10
+ lastRequest: new Date(),
11
+ }
12
+
13
+ export async function GET() {
14
+ const uptime = Math.floor((Date.now() - stats.uptime) / 1000)
15
+
16
+ return NextResponse.json({
17
+ ...stats,
18
+ uptime,
19
+ uptime_formatted: formatUptime(uptime),
20
+ })
21
+ }
22
+
23
+ export async function POST(request: Request) {
24
+ try {
25
+ const body = await request.json()
26
+
27
+ if (body.requests !== undefined) stats.requests = body.requests
28
+ if (body.tokensSaved !== undefined) stats.tokensSaved = body.tokensSaved
29
+ if (body.costSaved !== undefined) stats.costSaved = body.costSaved
30
+ if (body.cacheHitRate !== undefined) stats.cacheHitRate = body.cacheHitRate
31
+
32
+ stats.lastRequest = new Date()
33
+
34
+ return NextResponse.json({ success: true, stats })
35
+ } catch (error) {
36
+ return NextResponse.json({ error: "Invalid request" }, { status: 400 })
37
+ }
38
+ }
39
+
40
+ function formatUptime(seconds: number): string {
41
+ const hours = Math.floor(seconds / 3600)
42
+ const minutes = Math.floor((seconds % 3600) / 60)
43
+
44
+ if (hours === 0) return `${minutes}m`
45
+ return `${hours}h ${minutes}m`
46
+ }