zen: track session in usage

This commit is contained in:
Frank 2026-02-22 18:41:34 -05:00
commit 5712cff5c4
187 changed files with 87618 additions and 47656 deletions

View file

@ -5,7 +5,7 @@ import { Billing } from "@opencode-ai/console-core/billing.js"
import { Database, eq, and, isNull, sql } from "@opencode-ai/console-core/drizzle/index.js"
import { BillingTable, SubscriptionTable } from "@opencode-ai/console-core/schema/billing.sql.js"
import { Actor } from "@opencode-ai/console-core/actor.js"
import { Black } from "@opencode-ai/console-core/black.js"
import { Subscription } from "@opencode-ai/console-core/black.js"
import { withActor } from "~/context/auth.withActor"
import { queryBillingInfo } from "../../common"
import styles from "./black-section.module.css"
@ -35,12 +35,12 @@ const querySubscription = query(async (workspaceID: string) => {
return {
plan: row.subscription.plan,
useBalance: row.subscription.useBalance ?? false,
rollingUsage: Black.analyzeRollingUsage({
rollingUsage: Subscription.analyzeRollingUsage({
plan: row.subscription.plan,
usage: row.rollingUsage ?? 0,
timeUpdated: row.timeRollingUpdated ?? new Date(),
}),
weeklyUsage: Black.analyzeWeeklyUsage({
weeklyUsage: Subscription.analyzeWeeklyUsage({
plan: row.subscription.plan,
usage: row.fixedUsage ?? 0,
timeUpdated: row.timeFixedUpdated ?? new Date(),