This PR fixes critical issues with token tracking and provides users with actionable warnings based on real failure data. 1. **Incorrect token counting**: The system was adding cache tokens (cache_creation_input_tokens, cache_read_input_tokens) as if they were new tokens, causing inflated counts like 28125% usage. Cache tokens are cumulative state, not incremental additions. 2. **No user guidance**: Users had no warning when approaching context limits, leading to unexpected "Prompt is too long" errors. - Show only raw token counts from Claude API (input + output) - Remove percentage calculations and context window estimates - Display running totals that users can trust Based on analysis of 29 failed sessions, implemented three warning levels: - ✅ Safe: < 80K tokens - ⚠️ Caution: 80K-95K tokens (yellow warning) - 🚨 Danger: > 95K tokens (red alert) The lowest observed failure was at 96,800 tokens, so warnings start at 80K to give users ample time to start a new session. - Styled clickable popover (replacing poor native tooltips) - Token breakdown (input/output/total) - Clear warning messages with context - Dark mode support - Fixed `extractTokenUsage()` to only count actual input/output tokens - Removed hardcoded system overhead calculations - Added contextWindowTokens tracking for future use - Updated UI to show raw truth instead of estimates This gives users the information they need without confusing calculations or impossible percentages.
159 lines
6.5 KiB
JSON
159 lines
6.5 KiB
JSON
{
|
|
"name": "crystal",
|
|
"version": "0.1.16",
|
|
"private": true,
|
|
"description": "Crystal - Claude Code Commander for managing multiple Claude Code instances",
|
|
"author": {
|
|
"name": "Crystal Team",
|
|
"email": "jordan@stravu.com"
|
|
},
|
|
"license": "MIT",
|
|
"main": "main/dist/index.js",
|
|
"engines": {
|
|
"node": ">=22.14.0",
|
|
"pnpm": ">=8.0.0"
|
|
},
|
|
"pnpm": {
|
|
"onlyBuiltDependencies": [
|
|
"electron"
|
|
]
|
|
},
|
|
"scripts": {
|
|
"dev": "pnpm run electron-dev",
|
|
"electron-dev": "concurrently \"pnpm run --filter frontend dev\" \"wait-on http://localhost:4521 && electron .\"",
|
|
"electron-dev:custom": "concurrently \"pnpm run --filter frontend dev\" \"wait-on http://localhost:4521 && electron .\"",
|
|
"build": "pnpm run build:frontend && pnpm run build:main && pnpm run build:electron",
|
|
"build:frontend": "pnpm run --filter frontend build",
|
|
"build:main": "pnpm run --filter main build",
|
|
"build:electron": "electron-builder --publish never",
|
|
"build:mac": "pnpm run build:frontend && pnpm run build:main && pnpm run inject-build-info && pnpm run generate-notices && electron-builder --mac --publish never",
|
|
"build:mac:universal": "pnpm run build:frontend && pnpm run build:main && pnpm run inject-build-info && pnpm run generate-notices && electron-builder --mac --universal --publish never",
|
|
"build:mac:x64": "pnpm run build:frontend && pnpm run build:main && pnpm run inject-build-info && pnpm run generate-notices && electron-builder --mac --x64 --publish never",
|
|
"build:mac:arm64": "pnpm run build:frontend && pnpm run build:main && pnpm run inject-build-info && pnpm run generate-notices && electron-builder --mac --arm64 --publish never",
|
|
"build:linux": "pnpm run build:frontend && pnpm run build:main && pnpm run inject-build-info && pnpm run generate-notices && electron-builder --linux --publish never",
|
|
"build:linux:ci": "pnpm run inject-build-info && pnpm run generate-notices && electron-builder --linux --publish never",
|
|
"build:mac:ci": "pnpm run inject-build-info && pnpm run generate-notices && electron-builder --mac --publish never",
|
|
"inject-build-info": "node scripts/inject-build-info.js",
|
|
"release:mac": "pnpm run build:frontend && pnpm run build:main && pnpm run inject-build-info && pnpm run generate-notices && electron-builder --mac --publish always",
|
|
"release:mac:universal": "pnpm run build:frontend && pnpm run build:main && pnpm run inject-build-info && pnpm run generate-notices && electron-builder --mac --universal --publish always",
|
|
"release:linux": "pnpm run build:frontend && pnpm run build:main && pnpm run inject-build-info && pnpm run generate-notices && electron-builder --linux --publish always",
|
|
"preview": "pnpm run --filter frontend preview",
|
|
"lint": "pnpm run -r lint",
|
|
"typecheck": "pnpm run -r typecheck",
|
|
"postinstall": "electron-builder install-app-deps",
|
|
"electron:rebuild": "cd main && electron-rebuild -f -w better-sqlite3",
|
|
"setup": "pnpm install && pnpm run build:main && pnpm run electron:rebuild",
|
|
"generate-notices": "node scripts/generate-notices.js",
|
|
"test": "playwright test",
|
|
"test:ci": "playwright test --config=playwright.ci.config.ts",
|
|
"test:ci:minimal": "playwright test --config=playwright.ci.minimal.config.ts",
|
|
"test:ui": "playwright test --ui",
|
|
"test:headed": "playwright test --headed",
|
|
"backfill-tokens": "cd main && npx tsx ../scripts/backfill-tokens.ts",
|
|
"backfill-tokens:dry": "cd main && npx tsx ../scripts/backfill-tokens.ts --dry-run"
|
|
},
|
|
"dependencies": {
|
|
"@anthropic-ai/claude-code": "^1.0.33",
|
|
"@anthropic-ai/sdk": "^0.53.0",
|
|
"@homebridge/node-pty-prebuilt-multiarch": "^0.12.0",
|
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
"better-sqlite3": "^11.7.0",
|
|
"bull": "^4.16.3",
|
|
"dotenv": "^16.4.7",
|
|
"electron-updater": "^6.6.2",
|
|
"glob": "^11.0.0",
|
|
"openai": "^5.1.1"
|
|
},
|
|
"devDependencies": {
|
|
"@playwright/test": "^1.52.0",
|
|
"concurrently": "^9.1.0",
|
|
"electron": "^36.4.0",
|
|
"electron-builder": "^25.1.8",
|
|
"electron-rebuild": "^3.2.9",
|
|
"playwright": "^1.52.0",
|
|
"vite-plugin-electron": "^0.29.0",
|
|
"vite-plugin-electron-renderer": "^0.14.6",
|
|
"wait-on": "^8.0.1"
|
|
},
|
|
"build": {
|
|
"appId": "com.stravu.crystal",
|
|
"productName": "Crystal",
|
|
"directories": {
|
|
"output": "dist-electron"
|
|
},
|
|
"files": [
|
|
"main/dist/**/*",
|
|
"frontend/dist/**/*",
|
|
"package.json",
|
|
"node_modules/**/*",
|
|
"!node_modules/@anthropic-ai/claude-code/vendor/**/*.jar",
|
|
"build/**/*",
|
|
"LICENSE",
|
|
"NOTICES"
|
|
],
|
|
"npmRebuild": true,
|
|
"buildDependenciesFromSource": false,
|
|
"asar": true,
|
|
"asarUnpack": [
|
|
"node_modules/**/*.node",
|
|
"!node_modules/@anthropic-ai/claude-code/vendor/**",
|
|
"main/dist/services/mcpPermissionBridge.js",
|
|
"main/dist/services/mcpPermissionBridgeStandalone.js",
|
|
"main/dist/services/**/*.js"
|
|
],
|
|
"afterSign": "build/afterSign.js",
|
|
"mac": {
|
|
"category": "public.app-category.developer-tools",
|
|
"icon": "main/assets/icon.icns",
|
|
"hardenedRuntime": true,
|
|
"gatekeeperAssess": false,
|
|
"entitlements": "build/entitlements.mac.plist",
|
|
"entitlementsInherit": "build/entitlements.mac.plist",
|
|
"signIgnore": [
|
|
"node_modules/@anthropic-ai/claude-code/vendor/.*\\.jar$"
|
|
],
|
|
"notarize": true,
|
|
"target": [
|
|
{
|
|
"target": "default",
|
|
"arch": "universal"
|
|
}
|
|
],
|
|
"artifactName": "${productName}-${version}-macOS-universal.${ext}"
|
|
},
|
|
"linux": {
|
|
"target": [
|
|
{
|
|
"target": "deb",
|
|
"arch": ["x64"]
|
|
},
|
|
{
|
|
"target": "AppImage",
|
|
"arch": ["x64"]
|
|
}
|
|
],
|
|
"category": "Development",
|
|
"icon": "main/assets/icon.png",
|
|
"desktop": {
|
|
"Name": "Crystal",
|
|
"Comment": "Claude Code Commander for managing multiple Claude Code instances",
|
|
"Categories": "Development;IDE;",
|
|
"StartupWMClass": "crystal"
|
|
}
|
|
},
|
|
"deb": {
|
|
"depends": ["libgtk-3-0", "libnotify4", "libnss3", "libxss1", "libxtst6", "xdg-utils", "libatspi2.0-0", "libuuid1"],
|
|
"artifactName": "${productName}-${version}-linux-${arch}.deb"
|
|
},
|
|
"appImage": {
|
|
"artifactName": "${productName}-${version}-linux-${arch}.${ext}"
|
|
},
|
|
"publish": {
|
|
"provider": "github",
|
|
"owner": "stravu",
|
|
"repo": "crystal"
|
|
}
|
|
},
|
|
"packageManager": "pnpm@10.11.1+sha512.e519b9f7639869dc8d5c3c5dfef73b3f091094b0a006d7317353c72b124e80e1afd429732e28705ad6bfa1ee879c1fce46c128ccebd3192101f43dd67c667912"
|
|
}
|