AI Engineering Workspace
PartialChat, files, terminal and preview in one place. Chat sessions run on a durable Postgres-backed queue (chat only: no tools or shell). Live models need an API key; the terminal is unavailable.
Project files
read-only- ..
- ai.ts
- apps.ts
- audit.ts
- auth.ts
- central-core.d.mts
- central-core.mjs
- central.ts
- cloud.ts
- config.ts
- crypto.ts
- db.ts
- design.ts
- engines.ts
- files.ts
- gates.ts
- gateway.ts
- marketplace-core.d.mts
- marketplace-core.mjs
- metrics.ts
- modules.ts
- motion.ts
- nexus-core.d.mts
- nexus-core.mjs
- oidc-core.d.mts
- oidc-core.mjs
- oidc.ts
- providers.ts
- proxy-core.d.mts
- proxy-core.mjs
- pwauth-core.d.mts
- pwauth-core.mjs
- requirements.ts
- rls.sql.d.mts
- rls.sql.mjs
- ssrf.ts
- status.ts
- tenant.ts
- tlsgate.ts
- workspace.ts
app/src/lib/ai.ts
1import { db, getSetting } from "./db";2import { DEFAULT_PRICING, mockAllowed } from "./providers";34export async function pricing(): Promise<Record<string, { in: number; out: number }>> {5 try { return { ...DEFAULT_PRICING, ...JSON.parse(await getSetting("ai.pricing", "{}")) }; } catch { return DEFAULT_PRICING; }6}7export const monthStart = () => { const d = new Date(); return new Date(Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), 1)).toISOString(); };8export async function limits() {9 return { monthly: Number(await getSetting("ai.monthly_cap_usd", "5")), project: Number(await getSetting("ai.project_cap_usd", "2")) };10}11export async function spend() {12 const m = await db().prepare("SELECT COALESCE(SUM(cost_usd),0) s, COALESCE(SUM(tokens_in),0) ti, COALESCE(SUM(tokens_out),0) tout, COUNT(*) n FROM usage_ledger WHERE ts>=?").get(monthStart()) as any;13 return { month_usd: Number(m.s), tokens_in: Number(m.ti), tokens_out: Number(m.tout), calls: Number(m.n) };14}15export const providerOk = (p: string) => p === "anthropic" || p === "openai" || p === "opencode" || (p === "mock" && mockAllowed());16export const ACTIVE = ["queued", "running", "paused"];17
Conversation
PartialSign in to start AI sessions.
Task checklist
- Application shell deployed
- Persistent projects
- Agent runtime
- Sandboxed terminal
Execution activity
No agent sessions. Git HEAD 1c27633 on master.
Approval requests
None pending.