mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-20 18:57:17 +03:00
refactor(data): strict dev/production stages and data naming
- services/data/stage.ts: stage(mode) throws on anything but dev or production, used by all three configs, build.ts and deploy.ts - packages/stats -> packages/data (@opencode/data-app, -core, -server) - StatsSyncWorkflow -> DataSyncWorkflow, instance ids data-hourly-/data-history-, Data* resource keys, data sync log lines - worker, route, workflow and cron names unchanged
This commit is contained in:
@@ -277,6 +277,67 @@
|
||||
"@anthropic-ai/claude-agent-sdk",
|
||||
],
|
||||
},
|
||||
"packages/data/app": {
|
||||
"name": "@opencode/data-app",
|
||||
"version": "2.2.7",
|
||||
"dependencies": {
|
||||
"@kobalte/core": "catalog:",
|
||||
"@opencode/data-core": "workspace:*",
|
||||
"@opencode/nav-menus": "workspace:*",
|
||||
"@opencode/ui": "workspace:*",
|
||||
"@resvg/resvg-wasm": "2.6.2",
|
||||
"@solidjs/meta": "catalog:",
|
||||
"@solidjs/router": "catalog:",
|
||||
"@solidjs/start": "catalog:",
|
||||
"d3-scale": "4.0.2",
|
||||
"effect": "catalog:",
|
||||
"i18n-iso-countries": "7.14.0",
|
||||
"nitro": "3.0.260903-beta",
|
||||
"satori": "0.63.2",
|
||||
"solid-js": "catalog:",
|
||||
"vite": "8.2.4",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/bun": "catalog:",
|
||||
"@types/d3-scale": "4.0.9",
|
||||
"@typescript/native": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"wawoff2": "2.0.1",
|
||||
},
|
||||
},
|
||||
"packages/data/core": {
|
||||
"name": "@opencode/data-core",
|
||||
"version": "2.2.7",
|
||||
"dependencies": {
|
||||
"@planetscale/database": "1.19.0",
|
||||
"drizzle-orm": "catalog:",
|
||||
"effect": "catalog:",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tsconfig/node22": "catalog:",
|
||||
"@types/bun": "catalog:",
|
||||
"@types/node": "catalog:",
|
||||
"@typescript/native": "catalog:",
|
||||
"drizzle-kit": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
},
|
||||
},
|
||||
"packages/data/server": {
|
||||
"name": "@opencode/data-server",
|
||||
"version": "2.2.7",
|
||||
"dependencies": {
|
||||
"@opencode/data-core": "workspace:*",
|
||||
"effect": "catalog:",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@cloudflare/workers-types": "catalog:",
|
||||
"@tsconfig/node22": "catalog:",
|
||||
"@types/bun": "catalog:",
|
||||
"@types/node": "catalog:",
|
||||
"@typescript/native": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
},
|
||||
},
|
||||
"packages/desktop": {
|
||||
"name": "@opencode/desktop",
|
||||
"version": "2.2.7",
|
||||
@@ -665,67 +726,6 @@
|
||||
"@typescript/native": "catalog:",
|
||||
},
|
||||
},
|
||||
"packages/stats/app": {
|
||||
"name": "@opencode/stats-app",
|
||||
"version": "2.2.7",
|
||||
"dependencies": {
|
||||
"@kobalte/core": "catalog:",
|
||||
"@opencode/nav-menus": "workspace:*",
|
||||
"@opencode/stats-core": "workspace:*",
|
||||
"@opencode/ui": "workspace:*",
|
||||
"@resvg/resvg-wasm": "2.6.2",
|
||||
"@solidjs/meta": "catalog:",
|
||||
"@solidjs/router": "catalog:",
|
||||
"@solidjs/start": "catalog:",
|
||||
"d3-scale": "4.0.2",
|
||||
"effect": "catalog:",
|
||||
"i18n-iso-countries": "7.14.0",
|
||||
"nitro": "3.0.260903-beta",
|
||||
"satori": "0.63.2",
|
||||
"solid-js": "catalog:",
|
||||
"vite": "8.2.4",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/bun": "catalog:",
|
||||
"@types/d3-scale": "4.0.9",
|
||||
"@typescript/native": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"wawoff2": "2.0.1",
|
||||
},
|
||||
},
|
||||
"packages/stats/core": {
|
||||
"name": "@opencode/stats-core",
|
||||
"version": "2.2.7",
|
||||
"dependencies": {
|
||||
"@planetscale/database": "1.19.0",
|
||||
"drizzle-orm": "catalog:",
|
||||
"effect": "catalog:",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tsconfig/node22": "catalog:",
|
||||
"@types/bun": "catalog:",
|
||||
"@types/node": "catalog:",
|
||||
"@typescript/native": "catalog:",
|
||||
"drizzle-kit": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
},
|
||||
},
|
||||
"packages/stats/server": {
|
||||
"name": "@opencode/stats-server",
|
||||
"version": "2.2.7",
|
||||
"dependencies": {
|
||||
"@opencode/stats-core": "workspace:*",
|
||||
"effect": "catalog:",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@cloudflare/workers-types": "catalog:",
|
||||
"@tsconfig/node22": "catalog:",
|
||||
"@types/bun": "catalog:",
|
||||
"@types/node": "catalog:",
|
||||
"@typescript/native": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
},
|
||||
},
|
||||
"packages/stories": {
|
||||
"name": "@opencode/stories",
|
||||
"devDependencies": {
|
||||
@@ -870,8 +870,8 @@
|
||||
"devDependencies": {
|
||||
"@cloudflare/build-output-utils": "0.8.5",
|
||||
"@cloudflare/config": "0.23.0",
|
||||
"@opencode/stats-app": "workspace:*",
|
||||
"@opencode/stats-server": "workspace:*",
|
||||
"@opencode/data-app": "workspace:*",
|
||||
"@opencode/data-server": "workspace:*",
|
||||
"@types/bun": "catalog:",
|
||||
"@typescript/native": "catalog:",
|
||||
"cf": "1.0.0-beta.12",
|
||||
@@ -1798,6 +1798,12 @@
|
||||
|
||||
"@opencode/data": ["@opencode/data@workspace:services/data"],
|
||||
|
||||
"@opencode/data-app": ["@opencode/data-app@workspace:packages/data/app"],
|
||||
|
||||
"@opencode/data-core": ["@opencode/data-core@workspace:packages/data/core"],
|
||||
|
||||
"@opencode/data-server": ["@opencode/data-server@workspace:packages/data/server"],
|
||||
|
||||
"@opencode/desktop": ["@opencode/desktop@workspace:packages/desktop"],
|
||||
|
||||
"@opencode/files": ["@opencode/files@workspace:services/files"],
|
||||
@@ -1858,12 +1864,6 @@
|
||||
|
||||
"@opencode/site": ["@opencode/site@workspace:services/site"],
|
||||
|
||||
"@opencode/stats-app": ["@opencode/stats-app@workspace:packages/stats/app"],
|
||||
|
||||
"@opencode/stats-core": ["@opencode/stats-core@workspace:packages/stats/core"],
|
||||
|
||||
"@opencode/stats-server": ["@opencode/stats-server@workspace:packages/stats/server"],
|
||||
|
||||
"@opencode/stories": ["@opencode/stories@workspace:packages/stories"],
|
||||
|
||||
"@opencode/theme": ["@opencode/theme@workspace:packages/theme"],
|
||||
@@ -3084,7 +3084,7 @@
|
||||
|
||||
"ffi-rs": ["ffi-rs@1.3.7", "", { "optionalDependencies": { "@yuuang/ffi-rs-android-arm64": "1.3.7", "@yuuang/ffi-rs-darwin-arm64": "1.3.7", "@yuuang/ffi-rs-darwin-x64": "1.3.7", "@yuuang/ffi-rs-linux-arm-gnueabihf": "1.3.7", "@yuuang/ffi-rs-linux-arm64-gnu": "1.3.7", "@yuuang/ffi-rs-linux-arm64-musl": "1.3.7", "@yuuang/ffi-rs-linux-x64-gnu": "1.3.7", "@yuuang/ffi-rs-linux-x64-musl": "1.3.7", "@yuuang/ffi-rs-win32-arm64-msvc": "1.3.7", "@yuuang/ffi-rs-win32-ia32-msvc": "1.3.7", "@yuuang/ffi-rs-win32-x64-msvc": "1.3.7" } }, "sha512-5MMZQS2t/6f/ec3sx0f51gBcKGZPGfolPAW04lvLOSYnr7gmOKs8YzH1Rh+34WGO+VtcgcTuxaUUoJLcR4Tirg=="],
|
||||
|
||||
"fflate": ["fflate@0.8.3", "", {}, "sha512-tbZNuJrLwGUp3zshBtdy4W+ORxZuIh8a5ilyIEQDC5rY1f3U20JMry0Ll3WBzU58EZKsEuJFXhb5gwv8CsPvgA=="],
|
||||
"fflate": ["fflate@0.7.3", "", {}, "sha512-0Zz1jOzJWERhyhsimS54VTqOteCNwRtIlh8isdL0AXLo0g7xNTfTL7oWrkmCnPhZGocKIkWHBistBrrpoNH3aw=="],
|
||||
|
||||
"filelist": ["filelist@1.0.6", "", { "dependencies": { "minimatch": "^5.0.1" } }, "sha512-5giy2PkLYY1cP39p17Ech+2xlpTRL9HLspOfEgm0L6CwBXBTgsK5ou0JtzYuepxkaQ/tvhCFIJ5uXo0OrM2DxA=="],
|
||||
|
||||
@@ -3800,7 +3800,7 @@
|
||||
|
||||
"path-scurry": ["path-scurry@2.0.2", "", { "dependencies": { "lru-cache": "^11.0.0", "minipass": "^7.1.2" } }, "sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg=="],
|
||||
|
||||
"path-to-regexp": ["path-to-regexp@6.3.0", "", {}, "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ=="],
|
||||
"path-to-regexp": ["path-to-regexp@8.4.2", "", {}, "sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA=="],
|
||||
|
||||
"pathe": ["pathe@2.0.3", "", {}, "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w=="],
|
||||
|
||||
@@ -4646,10 +4646,6 @@
|
||||
|
||||
"@sentry/server-utils/@sentry/core": ["@sentry/core@10.73.0", "", { "dependencies": { "@sentry/conventions": "^0.16.0" } }, "sha512-FLO1UgH19RyasVpofu612WCOgb2nEH0dZy+R72d7p65XU9i0wxlMKm3+sgfwKmiSJp1Qhilaaxs4Jg6BbiM5HA=="],
|
||||
|
||||
"@shuding/opentype.js/fflate": ["fflate@0.7.3", "", {}, "sha512-0Zz1jOzJWERhyhsimS54VTqOteCNwRtIlh8isdL0AXLo0g7xNTfTL7oWrkmCnPhZGocKIkWHBistBrrpoNH3aw=="],
|
||||
|
||||
"@solidjs/start/path-to-regexp": ["path-to-regexp@8.4.2", "", {}, "sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA=="],
|
||||
|
||||
"@tailwindcss/node/lightningcss": ["lightningcss@1.32.0", "", { "dependencies": { "detect-libc": "^2.0.3" }, "optionalDependencies": { "lightningcss-android-arm64": "1.32.0", "lightningcss-darwin-arm64": "1.32.0", "lightningcss-darwin-x64": "1.32.0", "lightningcss-freebsd-x64": "1.32.0", "lightningcss-linux-arm-gnueabihf": "1.32.0", "lightningcss-linux-arm64-gnu": "1.32.0", "lightningcss-linux-arm64-musl": "1.32.0", "lightningcss-linux-x64-gnu": "1.32.0", "lightningcss-linux-x64-musl": "1.32.0", "lightningcss-win32-arm64-msvc": "1.32.0", "lightningcss-win32-x64-msvc": "1.32.0" } }, "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ=="],
|
||||
|
||||
"@tailwindcss/oxide-wasm32-wasi/@emnapi/core": ["@emnapi/core@1.11.3", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.3", "tslib": "^2.4.0" }, "bundled": true }, "sha512-zLpS5asjEb7lq8jYLq37N6XKaE41DIexlY1rF/z4/tIl3wo13Sqm28fRyfIsKZD+NZ8mM5RoKkpW/rBcuoSZSg=="],
|
||||
@@ -4668,6 +4664,8 @@
|
||||
|
||||
"@textjs/app/vite": ["vite@6.4.5", "", { "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.4.4", "picomatch": "^4.0.2", "postcss": "^8.5.3", "rollup": "^4.34.9", "tinyglobby": "^0.2.13" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", "jiti": ">=1.21.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", "sass-embedded": "*", "stylus": "*", "sugarss": "*", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-4enwjFfi4IwtEh0w+jPzpLVOFQiPHmmzPxcHXQOyEur47o6u0jE573DmGpjA+7irXoMLYRZD5ZaFUEneS3abPg=="],
|
||||
|
||||
"@types/three/fflate": ["fflate@0.8.3", "", {}, "sha512-tbZNuJrLwGUp3zshBtdy4W+ORxZuIh8a5ilyIEQDC5rY1f3U20JMry0Ll3WBzU58EZKsEuJFXhb5gwv8CsPvgA=="],
|
||||
|
||||
"app-builder-lib/js-yaml": ["js-yaml@4.3.2", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA=="],
|
||||
|
||||
"app-builder-lib/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="],
|
||||
@@ -4820,14 +4818,10 @@
|
||||
|
||||
"roarr/sprintf-js": ["sprintf-js@1.1.3", "", {}, "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA=="],
|
||||
|
||||
"router/path-to-regexp": ["path-to-regexp@8.4.2", "", {}, "sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA=="],
|
||||
|
||||
"safe-array-concat/isarray": ["isarray@2.0.5", "", {}, "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw=="],
|
||||
|
||||
"safe-push-apply/isarray": ["isarray@2.0.5", "", {}, "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw=="],
|
||||
|
||||
"satori/fflate": ["fflate@0.7.3", "", {}, "sha512-0Zz1jOzJWERhyhsimS54VTqOteCNwRtIlh8isdL0AXLo0g7xNTfTL7oWrkmCnPhZGocKIkWHBistBrrpoNH3aw=="],
|
||||
|
||||
"serialize-error/type-fest": ["type-fest@0.13.1", "", {}, "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg=="],
|
||||
|
||||
"slice-ansi/ansi-styles": ["ansi-styles@6.2.3", "", {}, "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg=="],
|
||||
@@ -4884,6 +4878,8 @@
|
||||
|
||||
"wrangler/miniflare": ["miniflare@4.20260708.1", "", { "dependencies": { "@cspotcode/source-map-support": "0.8.1", "sharp": "0.34.5", "undici": "7.28.0", "workerd": "1.20260708.1", "ws": "8.21.0", "youch": "4.1.0-beta.10" }, "bin": { "miniflare": "bootstrap.js" } }, "sha512-c94O9zRDISdqO18EHt6l0iF/fWgWt8p18PJvRsA/L/NJZ9Cfke3s/F5Blg1XXF7WDutVRzWVWy8Vy4LaT5ifsA=="],
|
||||
|
||||
"wrangler/path-to-regexp": ["path-to-regexp@6.3.0", "", {}, "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ=="],
|
||||
|
||||
"wrap-ansi/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
|
||||
|
||||
"wrap-ansi/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
|
||||
@@ -4958,6 +4954,8 @@
|
||||
|
||||
"@opencode/legacy/wrangler/miniflare": ["miniflare@5.20261102.0-beta", "", { "dependencies": { "@cspotcode/source-map-support": "0.8.1", "sharp": "0.35.5", "undici": "7.30.1", "workerd": "1.20261102.1", "ws": "8.21.0", "youch": "4.1.0-beta.10" } }, "sha512-FGqoi2BF7Vq6v8aSraq9Tmhg8ORpUBC5RkNGhfa11J597cWlLJ5QP9vJwDMOzwJx+W4U+IuHWSidVceBK6VRZQ=="],
|
||||
|
||||
"@opencode/legacy/wrangler/path-to-regexp": ["path-to-regexp@6.3.0", "", {}, "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ=="],
|
||||
|
||||
"@opencode/legacy/wrangler/workerd": ["workerd@1.20261102.1", "", { "optionalDependencies": { "@cloudflare/workerd-darwin-64": "1.20261102.1", "@cloudflare/workerd-darwin-arm64": "1.20261102.1", "@cloudflare/workerd-linux-64": "1.20261102.1", "@cloudflare/workerd-linux-arm64": "1.20261102.1", "@cloudflare/workerd-windows-64": "1.20261102.1" }, "hasInstallScript": true, "bin": { "workerd": "bin/workerd" } }, "sha512-5A+/vm0M5oc98pB3aR+DZ5cIOvRMhVWVS9tg+CrjUap7PIo8tqAnvNdvuiHBIE47/wkxtNM3jToAaU38dBsZTw=="],
|
||||
|
||||
"@opencode/stories/@tailwindcss/vite/@tailwindcss/node": ["@tailwindcss/node@4.1.11", "", { "dependencies": { "@ampproject/remapping": "^2.3.0", "enhanced-resolve": "^5.18.1", "jiti": "^2.4.2", "lightningcss": "1.30.1", "magic-string": "^0.30.17", "source-map-js": "^1.2.1", "tailwindcss": "4.1.11" } }, "sha512-yzhzuGRmv5QyU9qLNg4GTlYI6STedBWRE7NjxP45CsFYYq9taI0zJXZBMqIC/c8fViNLhmrbpSFS57EoxUmD6Q=="],
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@
|
||||
"packages/*",
|
||||
"packages/plugins/*",
|
||||
"services/*",
|
||||
"packages/stats/*"
|
||||
"packages/data/*"
|
||||
],
|
||||
"catalog": {
|
||||
"@effect/opentelemetry": "4.1.0",
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
To start the data site locally, run `bun run --cwd packages/data/app dev` with the database variables in README.md exported.
|
||||
@@ -1,48 +1,48 @@
|
||||
# OpenCode Stats
|
||||
# OpenCode Data
|
||||
|
||||
Stats is a separate site from the console. Runtime, database, and domain services live in `core`; the SolidStart website lives in `app`; the Cloudflare Workers that sync stats live in `server`.
|
||||
The data site (opencode.ai/data) is separate from the console. Runtime, database, and domain services live in `core`; the SolidStart website lives in `app`; the Cloudflare Workers that sync its data live in `server`.
|
||||
|
||||
## Packages
|
||||
|
||||
- `app`: SolidStart frontend/site.
|
||||
- `core`: Effect services, app config, Drizzle schema/migrations, and stats domains.
|
||||
- `server`: the `StatsSyncWorkflow` Workflow, the cron handler that starts it, and a local sync script.
|
||||
- `core`: Effect services, app config, Drizzle schema/migrations, and the data domains.
|
||||
- `server`: the `DataSyncWorkflow` Workflow, the cron handler that starts it, and a local sync script.
|
||||
|
||||
`services/data` builds and deploys them as the `opencode-data-<stage>`, `opencode-data-og-<stage>` and `opencode-data-sync-<stage>` Workers.
|
||||
|
||||
## Commands
|
||||
|
||||
- `bun run --cwd packages/stats/app dev` starts the SolidStart app (see Stats sync for its environment).
|
||||
- `bun run --cwd packages/stats/app typecheck` typechecks the site.
|
||||
- `bun run --cwd packages/stats/core typecheck` typechecks the Effect/database package.
|
||||
- `bun run --cwd packages/stats/server typecheck` typechecks the sync Workers.
|
||||
- `bun run --cwd packages/data/app dev` starts the SolidStart app (see Data sync for its environment).
|
||||
- `bun run --cwd packages/data/app typecheck` typechecks the site.
|
||||
- `bun run --cwd packages/data/core typecheck` typechecks the Effect/database package.
|
||||
- `bun run --cwd packages/data/server typecheck` typechecks the sync Workers.
|
||||
|
||||
## Stats sync
|
||||
## Data sync
|
||||
|
||||
The sync reads aggregates from R2 SQL and writes them to the stats PlanetScale database. It runs on the `dev` and `production` stages as a Cloudflare Workflow, `StatsSyncWorkflow`, in the `opencode-data-sync-<stage>` Worker that `services/data` deploys.
|
||||
The sync reads aggregates from R2 SQL and writes them to the `opencode-stats` PlanetScale database. It runs on the `dev` and `production` stages as a Cloudflare Workflow, `DataSyncWorkflow`, in the `opencode-data-sync-<stage>` Worker that `services/data` deploys.
|
||||
|
||||
Each run has a `plan` step, then one step per stat period (`week 2026-W45`, `day 2026-11-03`) and one per retention cohort (`retention 2026-10-05`). The plan snapshots the model catalog once, so every step attributes models the same way. Steps run one at a time and retry twice with exponential backoff. A rejected query (HTTP 400, 401 or 403) or a result over the 10,000-row limit fails its step after one attempt, since a retry repeats the same R2 SQL spend. A failed step does not stop the others, but the run ends as errored and logs each failed step with its error. Because queries run per period, expect an hourly run to take about 15 to 25 minutes and a history run about 2 to 3.5 hours. These are estimates until measured on a deployed stage.
|
||||
|
||||
The same Worker's cron handler starts runs on two schedules:
|
||||
|
||||
- `5 * * * *`: an hourly run of the current ISO week and the most recent complete retention cohort, with instance ID `stats-hourly-YYYY-MM-DDTHH`.
|
||||
- `20 3 * * *`: a daily history run of the rest of the 56-day display window, with instance ID `stats-history-YYYY-MM-DD`.
|
||||
- `5 * * * *`: an hourly run of the current ISO week and the most recent complete retention cohort, with instance ID `data-hourly-YYYY-MM-DDTHH`.
|
||||
- `20 3 * * *`: a daily history run of the rest of the 56-day display window, with instance ID `data-history-YYYY-MM-DD`.
|
||||
|
||||
Times and IDs are in UTC. Before starting a run, the cron handler checks this slot's ID and the recent IDs of the same kind: the five previous hours for an hourly run, the two previous days for a history run. It skips the run if any of them is queued, running, waiting or paused, or if this slot's instance already exists, and logs the reason. Hourly and history runs can overlap, since they cover different periods and their writes are idempotent.
|
||||
|
||||
To start a run by hand, trigger the `opencode-data-sync-<stage>` Workflow with an ID from the cron handler's convention so scheduled runs of the same kind see it and wait:
|
||||
|
||||
```sh
|
||||
cf workflows instances create opencode-data-sync-dev --instance-id stats-history-2026-11-03 --params '{"history":true}'
|
||||
cf workflows instances get stats-history-2026-11-03 --workflow-name opencode-data-sync-dev
|
||||
cf workflows instances create opencode-data-sync-dev --instance-id data-history-2026-11-03 --params '{"history":true}'
|
||||
cf workflows instances get data-history-2026-11-03 --workflow-name opencode-data-sync-dev
|
||||
```
|
||||
|
||||
Omit `history` for an hourly run. If the ID already exists, that slot has run; wait for the next one. You can also trigger a run from the Workflow's page in the Cloudflare dashboard; without params it runs as an hourly pass.
|
||||
|
||||
To run one sync pass on your machine against a stage's resources, export `STAGE`, `DATA_DATABASE_HOST`, `DATA_DATABASE_USERNAME`, `DATA_DATABASE_PASSWORD`, `R2_SQL_AUTH_TOKEN` and `DATA_HIDDEN_MODELS` (AWS Secrets Manager `opencode/<stage>/*`; `packages/stats/core/src/resource.ts` reads them), then run `bun run --cwd packages/stats/server sync`, adding `--history` for a history pass. `bun run --cwd packages/stats/app dev` reads the same database variables.
|
||||
To run one sync pass on your machine against a stage's resources, export `STAGE`, `DATA_DATABASE_HOST`, `DATA_DATABASE_USERNAME`, `DATA_DATABASE_PASSWORD`, `R2_SQL_AUTH_TOKEN` and `DATA_HIDDEN_MODELS` (AWS Secrets Manager `opencode/<stage>/*`; `packages/data/core/src/resource.ts` reads them), then run `bun run --cwd packages/data/server sync`, adding `--history` for a history pass. `bun run --cwd packages/data/app dev` reads the same database variables.
|
||||
|
||||
## Public page caching
|
||||
|
||||
Stats HTML, JSON, and Markdown use a one-minute browser cache and a five-minute shared cache. Expired responses must revalidate instead of serving stale snapshots.
|
||||
Data site HTML, JSON, and Markdown use a one-minute browser cache and a five-minute shared cache. Expired responses must revalidate instead of serving stale snapshots.
|
||||
|
||||
The Worker has no custom domain. `services/data/cloudflare.config.ts` routes `/data*` and `/<locale>/data*` on the main host straight to it, so its responses skip the Cloudflare cache and reach browsers with these headers unchanged. Static assets are uploaded under `/data`, and the build moves Nitro's `_headers` to the assets root so they stay immutable.
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/package.json",
|
||||
"name": "@opencode/stats-app",
|
||||
"name": "@opencode/data-app",
|
||||
"version": "2.2.7",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
@@ -23,7 +23,7 @@
|
||||
"dependencies": {
|
||||
"@kobalte/core": "catalog:",
|
||||
"@opencode/nav-menus": "workspace:*",
|
||||
"@opencode/stats-core": "workspace:*",
|
||||
"@opencode/data-core": "workspace:*",
|
||||
"@opencode/ui": "workspace:*",
|
||||
"@resvg/resvg-wasm": "2.6.2",
|
||||
"@solidjs/meta": "catalog:",
|
||||
|
Before Width: | Height: | Size: 163 KiB After Width: | Height: | Size: 163 KiB |
|
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Vendored
+1
-1
@@ -6,7 +6,7 @@ import {
|
||||
type RetentionEntry,
|
||||
type StatsModelComparisonInput,
|
||||
type StatsModelComparisonEntry,
|
||||
} from "@opencode/stats-core/domain/home"
|
||||
} from "@opencode/data-core/domain/home"
|
||||
import { createAsync, query, useParams, useSearchParams } from "@solidjs/router"
|
||||
import { createEffect, createMemo, createSignal, For, onMount, Show } from "solid-js"
|
||||
import { getRequestEvent } from "solid-js/web"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import type { UsagePoint } from "@opencode/stats-core/domain/home"
|
||||
import type { UsagePoint } from "@opencode/data-core/domain/home"
|
||||
import { translate } from "../i18n"
|
||||
import {
|
||||
catalogModelPath,
|
||||
@@ -1,4 +1,4 @@
|
||||
import { statModel } from "@opencode/stats-core/domain/model-normalization"
|
||||
import { statModel } from "@opencode/data-core/domain/model-normalization"
|
||||
|
||||
const glmFlashModel = "glm-5.3-flash"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { createMiddleware } from "@solidjs/start/middleware"
|
||||
import { Resource } from "@opencode/stats-core/resource"
|
||||
import { Resource } from "@opencode/data-core/resource"
|
||||
|
||||
// Only production may be indexed: dev.opencode.ai and the personal stages run unreleased builds, and
|
||||
// search engines must never list them in place of opencode.ai. Every response there asks them not
|
||||
@@ -5,8 +5,8 @@ import {
|
||||
getStatsModelsComparisonData,
|
||||
type MarketDay,
|
||||
type TokenCostEntry,
|
||||
} from "@opencode/stats-core/domain/home"
|
||||
import { statModel } from "@opencode/stats-core/domain/model-normalization"
|
||||
} from "@opencode/data-core/domain/home"
|
||||
import { statModel } from "@opencode/data-core/domain/model-normalization"
|
||||
import { runStatsEffect } from "../stats-runtime"
|
||||
import {
|
||||
catalogSlug,
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// The Stats Worker's bindings for the OG image route (src/og/response.ts). package.json `imports` picks this file for
|
||||
// The data Worker's bindings for the OG image route (src/og/response.ts). package.json `imports` picks this file for
|
||||
// builds; resource.node.ts stands in under `vite dev` and tests.
|
||||
import { env } from "cloudflare:workers"
|
||||
import type { OgCard } from "../og/card"
|
||||
@@ -1,4 +1,4 @@
|
||||
import { statModel } from "@opencode/stats-core/domain/model-normalization"
|
||||
import { statModel } from "@opencode/data-core/domain/model-normalization"
|
||||
import { formatTokens, fromFirstUsage, isoDay } from "../lib/format"
|
||||
import { baseUrl } from "../lib/language"
|
||||
import { publicModelName } from "../lib/model-name"
|
||||
+2
-2
@@ -2,8 +2,8 @@ import { Meta, Title } from "@solidjs/meta"
|
||||
import { ProviderIcon } from "@opencode/ui/provider-icon"
|
||||
import { scaleSqrt } from "d3-scale"
|
||||
import countryCodesSource from "i18n-iso-countries/codes.json?raw"
|
||||
import { type CountryEntry, type ModelUsagePoint } from "@opencode/stats-core/domain/home"
|
||||
import { statModel } from "@opencode/stats-core/domain/model-normalization"
|
||||
import { type CountryEntry, type ModelUsagePoint } from "@opencode/data-core/domain/home"
|
||||
import { statModel } from "@opencode/data-core/domain/model-normalization"
|
||||
import { createAsync, query, useParams } from "@solidjs/router"
|
||||
import { createMemo, createSignal, createUniqueId, For, onMount, Show, type JSX } from "solid-js"
|
||||
import { getRequestEvent } from "solid-js/web"
|
||||
+1
-1
@@ -5,7 +5,7 @@ import {
|
||||
type MarketDay,
|
||||
type ModelUsagePoint,
|
||||
type StatsLabData,
|
||||
} from "@opencode/stats-core/domain/home"
|
||||
} from "@opencode/data-core/domain/home"
|
||||
import { createAsync, query, useParams } from "@solidjs/router"
|
||||
import { createMemo, createSignal, createUniqueId, For, onMount, Show, type JSX } from "solid-js"
|
||||
import { getRequestEvent } from "solid-js/web"
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
type SessionCostEntry,
|
||||
type TokenCostEntry,
|
||||
type UsagePoint,
|
||||
} from "@opencode/stats-core/domain/home"
|
||||
} from "@opencode/data-core/domain/home"
|
||||
import { createAsync, query } from "@solidjs/router"
|
||||
import { createEffect, createMemo, createSignal, For, onCleanup, onMount, Show, type JSX } from "solid-js"
|
||||
import { getRequestEvent } from "solid-js/web"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { STEALTH_MODELS, statModel } from "@opencode/stats-core/domain/model-normalization"
|
||||
import { STEALTH_MODELS, statModel } from "@opencode/data-core/domain/model-normalization"
|
||||
import { query } from "@solidjs/router"
|
||||
|
||||
export const modelCatalogSourceUrl = "https://models.opencode.ai/catalog.json"
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import { getStatsHomeData } from "@opencode/stats-core/domain/home"
|
||||
import { runtime } from "@opencode/stats-core/runtime"
|
||||
import { getStatsHomeData } from "@opencode/data-core/domain/home"
|
||||
import { runtime } from "@opencode/data-core/runtime"
|
||||
import {
|
||||
canonicalFamilyComparisonPath,
|
||||
canonicalModelComparisonPath,
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user