Commit Graph
100 Commits
Author SHA1 Message Date
RainbowBird a3a401d79d feat(server): new metrics for auth
- Added a new ObservableGauge for distinct active users to track real active user count, mitigating session row inflation issues.
- Updated the Grafana dashboard to reflect changes, including the removal of redundant WS Connections panel and the addition of new metrics for active sessions and distinct users.
- Improved documentation for verification automation processes, outlining a structured approach to automate verification steps and maintain evidence of tests.
2026-05-15 18:54:05 +08:00
RainbowBird 3984677b01 feat(analytics): integrate PostHog for server-side event tracking
- Added a new PostHog client for capturing server-side business events such as Stripe webhooks and subscription state changes.
- Implemented various tracking functions for pricing funnel steps, character creation, and chat session starts.
- Enhanced the flux meter tests to handle partial charges and report unbilled flux correctly.
- Updated the CharacterDialog and Flux settings pages to track user interactions with analytics events.
- Introduced a mechanism to identify users on PostHog based on authentication state to ensure accurate funnel tracking.
- Added necessary dependencies for PostHog integration in the project.
2026-05-15 16:20:47 +08:00
RainbowBird eada7e8c4e chore: update @moeru/eventa to version 1.0.0-beta.5 in pnpm-workspace.yaml 2026-05-15 02:51:23 +08:00
RainbowBird 7267b0d6b2 feat(server/billing): partial-debit semantics to prevent unpaid usage exploit 2026-05-15 00:50:53 +08:00
RainbowBird a860583c1d fix(server): build 2026-05-14 16:23:40 +08:00
RainbowBird 272cdae03b feat(server/otel): restructure observability metrics and add active sessions gauge
- Moved RateLimitMetrics import path to a more centralized location.
- Introduced a new file for active sessions gauge to track user sessions in the database.
- Updated index.ts to include new metrics and ensure proper initialization of observability metrics.
- Modified various routes and services to utilize the new observability structure.
- Added smoke tests for HTTP and WebSocket metrics to ensure proper metric registration and functionality.
- Enhanced error handling for metrics reading failures to improve observability.
2026-05-12 23:10:13 +08:00
RainbowBird d24b22a561 refactor(server/otel): hono otel integrate 2026-05-11 12:01:57 +08:00
RainbowBird 21b180ced7 refactor(server/otel): enhance otel setup with improved SDK lifecycle management 2026-05-10 23:43:18 +08:00
RainbowBird 9d2d43855c refactor(chat): update datetime prefixing logic for user messages and improve formatting 2026-05-09 00:38:50 +08:00
RainbowBird fdaf98b076 fix(server/otel): move HttpInstrumentation registration to NodeSDK config for proper metrics handling 2026-05-09 00:35:53 +08:00
RainbowBird fe59f91c84 refactor(server/flux): replace UpDownCounter with ObservableGauge for WebSocket connections
- Updated the EngagementMetrics interface to use ObservableGauge for tracking active WebSocket connections.
- Added detailed comments explaining the rationale for this change, highlighting the benefits of using a pull-based gauge over a delta-based counter.
- Implemented the ObservableGauge in the createChatWsHandlers function, ensuring it accurately reflects the live count of active connections.
- Removed the previous UpDownCounter logic to prevent issues with connection drift during process crashes or network interruptions.
2026-05-09 00:23:02 +08:00
RainbowBird 917450fdfb feat(server/otel): enhance observability with new metrics for email, rate limiting, and billing
- Added new metrics for email service including send, failures, and duration tracking.
- Introduced rate limit metrics to monitor blocked requests and improve abuse detection.
- Enhanced billing metrics to track credited and unbilled flux, as well as TTS character processing.
- Updated OpenAI and Stripe routes to utilize new metrics for better revenue tracking and rate limiting.
- Implemented a smoke test for OpenTelemetry metrics registration to ensure visibility at startup.
2026-05-08 23:35:38 +08:00
RainbowBird f2cf395fd2 docs(server): update ai-context 2026-05-08 22:21:31 +08:00
RainbowBird abd37dd96e fix(docker): enhance server-schema build process with error handling 2026-05-08 21:59:36 +08:00
RainbowBird 54b0af0a08 chore(stage-pages): resolve type 2026-05-08 21:34:11 +08:00
RainbowBird f8d1fa7a64 refactor(server): drop redis stream + worker role (#1792)
The Redis Stream `billing-events` + `worker` Railway role +
advisory-lock poller layered together didn't actually buy us reliability
— `debitFlux` swallowed XADD failures, leaving the door open to "balance
updated, ledger row never written". Collapse the whole thing back to:
`creditFlux` and `debitFlux` write `flux_transaction` ledger rows inline
within the same DB transaction that mutates `user_flux`, and `(user_id,
request_id)` remains the partial unique index that keeps retries safe.

Concrete changes:
- Inline ledger inserts in `BillingService.{debitFlux, creditFlux,
creditFluxFromStripeCheckout, creditFluxFromInvoice}`; drop `billingMq`
and `publishEvent` plumbing entirely.
- `routes/openai/v1` writes `llm_request_log` synchronously via the
existing `requestLogService`; the duplicate `llm-request-log.ts` service
module is removed.
- `bin/run-worker.ts`, `libs/mq/*`,
`services/billing/billing-events.ts`,
`services/billing/billing-consumer-handler.ts`, and matching tests are
deleted. CLI now exposes only `api`.
- `BILLING_EVENTS_*` env vars and the `DEFAULT_BILLING_EVENTS_STREAM`
helper are dropped; `docker-compose.yml` no longer ships a worker
service.
- `docs/ai-context/{workers-and-runtime, billing-architecture,
redis-boundaries-and-pubsub, data-model-and-state,
architecture-overview, README}.md`, `CLAUDE.md`, and the existing
verification docs are updated to describe the single-process synchronous
pipeline.

Tests: 29 files / 247 cases pass. Production deployments need to drop
the worker Railway service after this lands.
2026-05-08 21:14:01 +08:00
RainbowBird 99956014fa feat(server): admin api (#1788) 2026-05-08 21:14:00 +08:00
RainbowBird d0e2b450cd feat(stage-ui): chat sync (#1775) 2026-05-08 21:14:00 +08:00
RainbowBird 9d6d99192c feat(auth): enhance token refresh handling and clear auth state on errors 2026-05-08 21:14:00 +08:00
RainbowBird 10c6e22cca chore: disable gemini review 2026-05-06 12:54:36 +08:00
RainbowBird 40284514d4 fix(stage-*): isDev constant 2026-05-04 20:04:24 +08:00
RainbowBird 7edfa4291e chore(stage-*): only show status-island in dev mode 2026-05-04 19:56:59 +08:00
RainbowBird 250e7e2eb0 chore(pocket): exclude build and public folder in tsconfig 2026-05-04 19:47:38 +08:00
RainbowBird 6f0b7e0b9b feat(auth): delete account (#1756) 2026-04-28 20:53:00 +08:00
RainbowBirdandLiet Blue 0af7d294a8 feat(auth): oidc jwt bearer plugin & linked social accounts (#1753)
Co-authored-by: Liet Blue <127093491+lietblue@users.noreply.github.com>
2026-04-28 16:56:51 +08:00
RainbowBird 5d5f739eba revert(server/docker): restore assets distribution image 2026-04-28 00:54:13 +08:00
RainbowBird 924d3e3005 fix(server/docker): switch from alpine to slim for ui-build to support canvas dependencies 2026-04-28 00:47:39 +08:00
RainbowBird e36f015c7c fix(server/docker): remove cache mount for pnpm install in Dockerfile 2026-04-28 00:39:38 +08:00
RainbowBird 4d4c582160 fix(spark-notify): add options to expose built-in tools for no response and spark command 2026-04-28 00:38:43 +08:00
RainbowBird c0859c9798 fix(server/docker): squash auth ui to server image 2026-04-28 00:34:14 +08:00
RainbowBirdandLiet Blue 172e4ce59c feat(auth): email login & profile (#1745)
Co-authored-by: Liet Blue <127093491+lietblue@users.noreply.github.com>
2026-04-28 00:07:38 +08:00
RainbowBird 9db55c3496 refactor(chat): remove datetime context and implement per-message timestamp prefixing 2026-04-25 22:43:51 +08:00
RainbowBird f292ab9b99 feat(ui): add ErrorBoundary component for error handling in Vue 2026-04-25 17:23:43 +08:00
RainbowBird 7312e471bc fix(background-store): rename store id to avoid collision with stage-layouts 2026-04-25 17:05:41 +08:00
RainbowBird bc030812d3 fix(stage-ui): configure Histoire to exclude node_modules from vendor chunking 2026-04-25 16:46:08 +08:00
RainbowBird 0b30ced0c2 refactor(speech): remove selectedLanguage from speech store and related components 2026-04-25 03:38:58 +08:00
RainbowBird bef1598179 fix(stage-ui): refresh token concurrency 2026-04-17 02:59:14 +08:00
RainbowBird 8967bbe211 feat(server): add TTS support with per-character billing 2026-04-17 02:59:14 +08:00
RainbowBird 57533044f7 feat(server): add gateway and model configuration to environment variables 2026-04-17 02:59:14 +08:00
RainbowBird a11727020a feat(server/billing): implement debt ledger for TTS service using FluxMeter 2026-04-17 02:59:14 +08:00
RainbowBird b9ba5a6bf5 chore: prune deps 2026-04-15 17:36:59 +08:00
RainbowBird fc0ad03411 feat(server): require BETTER_AUTH_SECRET and pass it explicitly to betterAuth
Without a stable secret, better-auth generates a random one per process,
which invalidates every session cookie and JWKS private key on redeploy
and across multi-instance deployments. Make it a required env var and
wire it into betterAuth({ secret }) explicitly so missing config fails
fast at boot instead of silently rotating keys.
2026-04-13 18:13:19 +08:00
RainbowBird b7f9ff2749 chore(stage-ui): enhance flux package display and add recommended badge 2026-04-12 05:30:55 +08:00
RainbowBird 671517864a feat(flux): update transaction stats to use capacity from latest credit/initial transaction 2026-04-12 04:52:42 +08:00
RainbowBird 93888e6935 feat(server): use stripe product as flux pricing (#1640) 2026-04-12 04:32:42 +08:00
RainbowBird f769580099 docs(ui-components): add comprehensive component reference for standardized UI primitives 2026-04-10 15:58:19 +08:00
RainbowBird 525e13a179 chore(workflow): remove luoling8192 from PR deploying notifaction 2026-04-09 22:41:41 +08:00
RainbowBird d212da146a fix(stage-ui): improve LLM KV-cache compatibility for XML context injection (#1593) 2026-04-08 23:24:53 +08:00
RainbowBird 6541969fdb fix(stage-ui): disable coupon 2026-04-07 18:31:34 +08:00
RainbowBird 9451cd7cc0 feat(otel): server instrumentation script 2026-04-02 18:21:30 +08:00
RainbowBird 457ad19f09 fix(tests): server build 2026-04-02 18:04:46 +08:00
RainbowBird d782313464 feat(auth): jwt sign 2026-04-02 17:48:12 +08:00
RainbowBird 2eb30d6081 docs(auth): ai-context 2026-04-02 17:48:12 +08:00
RainbowBird f31a37e7e4 refactor(server): prune otel dashboard and active http request 2026-03-30 20:10:50 +08:00
RainbowBird 33bf61f3f7 fix(server): no cache 2026-03-30 19:45:43 +08:00
RainbowBird bb0c93edb4 fix(server/auth): skip state_mismatch check 2026-03-28 15:47:19 +08:00
RainbowBird 88c195f672 fix(server): better-auth cookie login 2026-03-28 05:41:43 +08:00
RainbowBird 4a85654d9b feat(server/otel): follow opentelemetry metrics sharded 2026-03-28 04:57:28 +08:00
RainbowBird 9f14013b06 fix(package): set package as private to prevent unintended publishing 2026-03-28 04:12:00 +08:00
RainbowBird ee9b799721 fix(server/stripe): ensure valid fluxAmount check in checkout session processing 2026-03-28 04:00:14 +08:00
RainbowBird 45bc5fef22 feat(server/otel): integrate OpenTelemetry logging and emit logs with context 2026-03-28 03:59:09 +08:00
RainbowBird 04c8f499b9 feat(server/stripe): update flux package handling and metadata integration 2026-03-28 03:24:51 +08:00
RainbowBird 1645d2a475 fix(stage-ui/auth): prevent multiple syncs and ensure providers are only set if not already configured 2026-03-28 02:25:44 +08:00
RainbowBird 2f730ef93a feat(server): refactor flux auditing to transaction logging 2026-03-28 02:25:44 +08:00
RainbowBird 28f5c87fb2 chore(server): disable audio endpoint 2026-03-28 02:25:44 +08:00
RainbowBird 4673494e73 chore: cleanup 2026-03-28 02:25:44 +08:00
RainbowBird 87d3d65b6a refactor(billing): rename debitFlux to consumeFluxForLLM and enhance metadata handling 2026-03-28 02:25:44 +08:00
RainbowBird 750e48ad95 refactor(server): redesign server routes structure 2026-03-28 02:25:44 +08:00
RainbowBird a515d20091 feat(server): chat broadcast utilities for message handling 2026-03-28 02:25:44 +08:00
RainbowBird b3bd772152 refactor(server): enhance observability metrics and error handling in v1 completions 2026-03-28 02:25:44 +08:00
RainbowBird c0d4c9043a docs(server): ai context 2026-03-28 02:25:44 +08:00
RainbowBird c4018c63c3 refactor(server/o11y): otel constants 2026-03-28 02:25:44 +08:00
RainbowBird 2714a44c5b refactor(server): http query utils for pagination 2026-03-28 02:25:44 +08:00
RainbowBird ab5a00b77f refactor(server): redis keys 2026-03-28 02:25:44 +08:00
RainbowBird fa1fed0c15 refactor(server): error-message util 2026-03-28 02:25:44 +08:00
RainbowBird bf85158aa9 fix(server,stage-ui,i18n): address PR #1376 review comments 2026-03-28 02:25:44 +08:00
RainbowBird 8322c2c622 refactor(server): split mq libs, organize billing services structure 2026-03-28 02:25:44 +08:00
RainbowBird aed2265d4a fix(stage-pages): flux page display 2026-03-28 02:25:44 +08:00
RainbowBird 11c456c0a7 refactor(server): squash flux-audit-log into flux-ledger 2026-03-28 02:25:44 +08:00
RainbowBird 0a2fefc304 refactor(server): rename tests folder 2026-03-28 02:25:44 +08:00
RainbowBird eab60d0bdb feat(server): reimplement message queue, drop outbox 2026-03-28 02:25:44 +08:00
RainbowBird 405904183f refactor(server): revert a8f445a17985a90d7eb5d981b4231114c3066e94 2026-03-28 02:25:44 +08:00
RainbowBird 2b3721b3ac fix(server/docker): remove apply .env.example 2026-03-28 02:25:44 +08:00
RainbowBird 563d50fbee feat(server): retry when booting error 2026-03-28 02:25:44 +08:00
RainbowBird a64e67e0ff chore(docker): disable railway pnpm cache 2026-03-28 02:25:44 +08:00
RainbowBird bce1405b79 fix(docker): railway deploy 2026-03-28 02:25:44 +08:00
RainbowBird ba3d66de86 feat(server-protocol): introduce shared protocol types for AIRI server clients and frontends
- Added package.json for @proj-airi/server-protocol with necessary configurations.
- Implemented chat event types including WireMessage, SendMessagesRequest, and PullMessagesRequest.
- Defined WebSocket event types and structures for better integration with AIRI components.
- Updated server-runtime and server-sdk to utilize the new server-protocol package.
- Refactored imports across various packages to replace server-shared types with server-protocol types.
- Enhanced type definitions and added TypeScript configurations for better development experience.
2026-03-28 02:25:44 +08:00
RainbowBird c0d0e22f12 fix(server): docker build 2026-03-28 02:25:44 +08:00
RainbowBird 34b8c82bd5 fix(server): type error 2026-03-28 02:25:44 +08:00
RainbowBird b78a8477e6 feat(server): enable tts, asr base 2026-03-28 02:25:44 +08:00
RainbowBird 7a16121135 chore(stage-ui): remove sync schedule 2026-03-28 02:25:44 +08:00
RainbowBird 96b417f39e fix(stage-ui): step-welcome 2026-03-28 02:25:44 +08:00
RainbowBird e24da799d0 fix(server): squash drizzle schema 2026-03-28 02:25:44 +08:00
RainbowBird 9641df258e docs(server): add ai-context 2026-03-28 02:25:44 +08:00
RainbowBird ef18772798 feat(server): message queue 2026-03-28 02:25:44 +08:00
RainbowBird 5b1ccb55c2 fix(auth): clarify return type and avoid TS2742 in createAuth function
fix(tests): cast response data to any in character and provider tests
refactor(v1completions): use Array.at() for last data line retrieval
feat(accounts): add indexes for session, account, and verification tables
chore(deps): update package.json and pnpm-lock.yaml with new dependencies
refactor(onboarding): replace context injection with props in step-welcome component
2026-03-28 02:25:44 +08:00
RainbowBird 97cadd5f7a fix(stage-ui): update onboarding provider list and improve validation logic 2026-03-28 02:25:44 +08:00
RainbowBird 1b3ade3f41 chore(stage-*): login component icon alignment 2026-03-28 02:25:44 +08:00
RainbowBird 0d9eebc368 chore(ci): rename dev server workflow 2026-03-28 02:25:44 +08:00
RainbowBird a63bfa0da0 refactor(stage-*): useBreakpoints 2026-03-28 02:25:44 +08:00