zen: data dumper

This commit is contained in:
Frank
2025-12-02 14:51:25 -05:00
parent b308503ab5
commit 1f11d4fb1a
27 changed files with 636 additions and 589 deletions

2
github/sst-env.d.ts vendored
View File

@@ -6,4 +6,4 @@
/// <reference path="../sst-env.d.ts" /> /// <reference path="../sst-env.d.ts" />
import "sst" import "sst"
export {} export {}

View File

@@ -116,7 +116,8 @@ const gatewayKv = new sst.cloudflare.Kv("GatewayKv")
// CONSOLE // CONSOLE
//////////////// ////////////////
const bucket = new sst.cloudflare.Bucket("ConsoleData") const oldBucket = new sst.cloudflare.Bucket("ConsoleData")
const bucket = new sst.cloudflare.Bucket("ZenData")
const AWS_SES_ACCESS_KEY_ID = new sst.Secret("AWS_SES_ACCESS_KEY_ID") const AWS_SES_ACCESS_KEY_ID = new sst.Secret("AWS_SES_ACCESS_KEY_ID")
const AWS_SES_SECRET_ACCESS_KEY = new sst.Secret("AWS_SES_SECRET_ACCESS_KEY") const AWS_SES_SECRET_ACCESS_KEY = new sst.Secret("AWS_SES_SECRET_ACCESS_KEY")

View File

@@ -1,25 +1,37 @@
import { Resource, waitUntil } from "@opencode-ai/console-resource" import { Resource, waitUntil } from "@opencode-ai/console-resource"
export function createDataDumper(sessionId: string, requestId: string) { export function createDataDumper(sessionId: string, requestId: string, projectId: string) {
if (Resource.App.stage !== "production") return if (Resource.App.stage !== "production") return
if (sessionId === "") return
let data: Record<string, any> = {} let data: Record<string, any> = { sessionId, requestId, projectId }
let modelName: string | undefined let metadata: Record<string, any> = { sessionId, requestId, projectId }
return { return {
provideModel: (model?: string) => (modelName = model), provideModel: (model?: string) => {
data.modelName = model
metadata.modelName = model
},
provideRequest: (request: string) => (data.request = request), provideRequest: (request: string) => (data.request = request),
provideResponse: (response: string) => (data.response = response), provideResponse: (response: string) => (data.response = response),
provideStream: (chunk: string) => (data.response = (data.response ?? "") + chunk), provideStream: (chunk: string) => (data.response = (data.response ?? "") + chunk),
flush: () => { flush: () => {
if (!modelName) return if (!data.modelName) return
const str = new Date().toISOString().replace(/[^0-9]/g, "") const timestamp = new Date().toISOString().replace(/[^0-9]/g, "")
const yyyymmdd = str.substring(0, 8)
const hh = str.substring(8, 10)
waitUntil( waitUntil(
Resource.ConsoleData.put(`${yyyymmdd}/${hh}/${modelName}/${sessionId}/${requestId}.json`, JSON.stringify(data)), Resource.ZenData.put(
`data/${data.modelName}/${sessionId}/${requestId}.json`,
JSON.stringify({ timestamp, ...data }),
),
)
waitUntil(
Resource.ZenData.put(
`meta/${data.modelName}/${timestamp}/${requestId}.json`,
JSON.stringify({ timestamp, ...metadata }),
),
) )
}, },
} }

View File

@@ -13,13 +13,7 @@ import { ModelTable } from "@opencode-ai/console-core/schema/model.sql.js"
import { ProviderTable } from "@opencode-ai/console-core/schema/provider.sql.js" import { ProviderTable } from "@opencode-ai/console-core/schema/provider.sql.js"
import { logger } from "./logger" import { logger } from "./logger"
import { AuthError, CreditsError, MonthlyLimitError, UserLimitError, ModelError, RateLimitError } from "./error" import { AuthError, CreditsError, MonthlyLimitError, UserLimitError, ModelError, RateLimitError } from "./error"
import { import { createBodyConverter, createStreamPartConverter, createResponseConverter, UsageInfo } from "./provider/provider"
createBodyConverter,
createStreamPartConverter,
createResponseConverter,
ProviderHelper,
UsageInfo,
} from "./provider/provider"
import { anthropicHelper } from "./provider/anthropic" import { anthropicHelper } from "./provider/anthropic"
import { googleHelper } from "./provider/google" import { googleHelper } from "./provider/google"
import { openaiHelper } from "./provider/openai" import { openaiHelper } from "./provider/openai"
@@ -61,6 +55,7 @@ export async function handler(
const ip = input.request.headers.get("x-real-ip") ?? "" const ip = input.request.headers.get("x-real-ip") ?? ""
const sessionId = input.request.headers.get("x-opencode-session") ?? "" const sessionId = input.request.headers.get("x-opencode-session") ?? ""
const requestId = input.request.headers.get("x-opencode-request") ?? "" const requestId = input.request.headers.get("x-opencode-request") ?? ""
const projectId = input.request.headers.get("x-opencode-project") ?? ""
logger.metric({ logger.metric({
is_tream: isStream, is_tream: isStream,
session: sessionId, session: sessionId,
@@ -68,7 +63,7 @@ export async function handler(
}) })
const zenData = ZenData.list() const zenData = ZenData.list()
const modelInfo = validateModel(zenData, model) const modelInfo = validateModel(zenData, model)
const dataDumper = createDataDumper(sessionId, requestId) const dataDumper = createDataDumper(sessionId, requestId, projectId)
const trialLimiter = createTrialLimiter(modelInfo.trial?.limit, ip) const trialLimiter = createTrialLimiter(modelInfo.trial?.limit, ip)
const isTrial = await trialLimiter?.isTrial() const isTrial = await trialLimiter?.isTrial()
const rateLimiter = createRateLimiter(modelInfo.id, modelInfo.rateLimit, ip) const rateLimiter = createRateLimiter(modelInfo.id, modelInfo.rateLimit, ip)

View File

@@ -6,4 +6,4 @@
/// <reference path="../../../sst-env.d.ts" /> /// <reference path="../../../sst-env.d.ts" />
import "sst" import "sst"
export {} export {}

View File

@@ -6,126 +6,131 @@
import "sst" import "sst"
declare module "sst" { declare module "sst" {
export interface Resource { export interface Resource {
ADMIN_SECRET: { "ADMIN_SECRET": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
AUTH_API_URL: { "AUTH_API_URL": {
type: "sst.sst.Linkable" "type": "sst.sst.Linkable"
value: string "value": string
} }
AWS_SES_ACCESS_KEY_ID: { "AWS_SES_ACCESS_KEY_ID": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
AWS_SES_SECRET_ACCESS_KEY: { "AWS_SES_SECRET_ACCESS_KEY": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
CLOUDFLARE_API_TOKEN: { "CLOUDFLARE_API_TOKEN": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
CLOUDFLARE_DEFAULT_ACCOUNT_ID: { "CLOUDFLARE_DEFAULT_ACCOUNT_ID": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
Console: { "Console": {
type: "sst.cloudflare.SolidStart" "type": "sst.cloudflare.SolidStart"
url: string "url": string
} }
Database: { "Database": {
database: string "database": string
host: string "host": string
password: string "password": string
port: number "port": number
type: "sst.sst.Linkable" "type": "sst.sst.Linkable"
username: string "username": string
} }
Desktop: { "Desktop": {
type: "sst.cloudflare.StaticSite" "type": "sst.cloudflare.StaticSite"
url: string "url": string
} }
EMAILOCTOPUS_API_KEY: { "EMAILOCTOPUS_API_KEY": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
GITHUB_APP_ID: { "Enterprise": {
type: "sst.sst.Secret" "type": "sst.cloudflare.SolidStart"
value: string "url": string
} }
GITHUB_APP_PRIVATE_KEY: { "GITHUB_APP_ID": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
GITHUB_CLIENT_ID_CONSOLE: { "GITHUB_APP_PRIVATE_KEY": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
GITHUB_CLIENT_SECRET_CONSOLE: { "GITHUB_CLIENT_ID_CONSOLE": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
GOOGLE_CLIENT_ID: { "GITHUB_CLIENT_SECRET_CONSOLE": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
HONEYCOMB_API_KEY: { "GOOGLE_CLIENT_ID": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
R2AccessKey: { "HONEYCOMB_API_KEY": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
R2SecretKey: { "R2AccessKey": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
STRIPE_SECRET_KEY: { "R2SecretKey": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
STRIPE_WEBHOOK_SECRET: { "STRIPE_SECRET_KEY": {
type: "sst.sst.Linkable" "type": "sst.sst.Secret"
value: string "value": string
} }
Web: { "STRIPE_WEBHOOK_SECRET": {
type: "sst.cloudflare.Astro" "type": "sst.sst.Linkable"
url: string "value": string
} }
ZEN_MODELS1: { "Web": {
type: "sst.sst.Secret" "type": "sst.cloudflare.Astro"
value: string "url": string
} }
ZEN_MODELS2: { "ZEN_MODELS1": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
ZEN_MODELS3: { "ZEN_MODELS2": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
ZEN_MODELS4: { "ZEN_MODELS3": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
}
"ZEN_MODELS4": {
"type": "sst.sst.Secret"
"value": string
} }
} }
} }
// cloudflare // cloudflare
import * as cloudflare from "@cloudflare/workers-types" import * as cloudflare from "@cloudflare/workers-types";
declare module "sst" { declare module "sst" {
export interface Resource { export interface Resource {
Api: cloudflare.Service "Api": cloudflare.Service
AuthApi: cloudflare.Service "AuthApi": cloudflare.Service
AuthStorage: cloudflare.KVNamespace "AuthStorage": cloudflare.KVNamespace
Bucket: cloudflare.R2Bucket "Bucket": cloudflare.R2Bucket
ConsoleData: cloudflare.R2Bucket "ConsoleData": cloudflare.R2Bucket
EnterpriseStorage: cloudflare.R2Bucket "EnterpriseStorage": cloudflare.R2Bucket
GatewayKv: cloudflare.KVNamespace "GatewayKv": cloudflare.KVNamespace
LogProcessor: cloudflare.Service "LogProcessor": cloudflare.Service
"ZenData": cloudflare.R2Bucket
} }
} }
import "sst" import "sst"
export {} export {}

View File

@@ -6,126 +6,131 @@
import "sst" import "sst"
declare module "sst" { declare module "sst" {
export interface Resource { export interface Resource {
ADMIN_SECRET: { "ADMIN_SECRET": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
AUTH_API_URL: { "AUTH_API_URL": {
type: "sst.sst.Linkable" "type": "sst.sst.Linkable"
value: string "value": string
} }
AWS_SES_ACCESS_KEY_ID: { "AWS_SES_ACCESS_KEY_ID": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
AWS_SES_SECRET_ACCESS_KEY: { "AWS_SES_SECRET_ACCESS_KEY": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
CLOUDFLARE_API_TOKEN: { "CLOUDFLARE_API_TOKEN": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
CLOUDFLARE_DEFAULT_ACCOUNT_ID: { "CLOUDFLARE_DEFAULT_ACCOUNT_ID": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
Console: { "Console": {
type: "sst.cloudflare.SolidStart" "type": "sst.cloudflare.SolidStart"
url: string "url": string
} }
Database: { "Database": {
database: string "database": string
host: string "host": string
password: string "password": string
port: number "port": number
type: "sst.sst.Linkable" "type": "sst.sst.Linkable"
username: string "username": string
} }
Desktop: { "Desktop": {
type: "sst.cloudflare.StaticSite" "type": "sst.cloudflare.StaticSite"
url: string "url": string
} }
EMAILOCTOPUS_API_KEY: { "EMAILOCTOPUS_API_KEY": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
GITHUB_APP_ID: { "Enterprise": {
type: "sst.sst.Secret" "type": "sst.cloudflare.SolidStart"
value: string "url": string
} }
GITHUB_APP_PRIVATE_KEY: { "GITHUB_APP_ID": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
GITHUB_CLIENT_ID_CONSOLE: { "GITHUB_APP_PRIVATE_KEY": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
GITHUB_CLIENT_SECRET_CONSOLE: { "GITHUB_CLIENT_ID_CONSOLE": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
GOOGLE_CLIENT_ID: { "GITHUB_CLIENT_SECRET_CONSOLE": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
HONEYCOMB_API_KEY: { "GOOGLE_CLIENT_ID": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
R2AccessKey: { "HONEYCOMB_API_KEY": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
R2SecretKey: { "R2AccessKey": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
STRIPE_SECRET_KEY: { "R2SecretKey": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
STRIPE_WEBHOOK_SECRET: { "STRIPE_SECRET_KEY": {
type: "sst.sst.Linkable" "type": "sst.sst.Secret"
value: string "value": string
} }
Web: { "STRIPE_WEBHOOK_SECRET": {
type: "sst.cloudflare.Astro" "type": "sst.sst.Linkable"
url: string "value": string
} }
ZEN_MODELS1: { "Web": {
type: "sst.sst.Secret" "type": "sst.cloudflare.Astro"
value: string "url": string
} }
ZEN_MODELS2: { "ZEN_MODELS1": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
ZEN_MODELS3: { "ZEN_MODELS2": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
ZEN_MODELS4: { "ZEN_MODELS3": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
}
"ZEN_MODELS4": {
"type": "sst.sst.Secret"
"value": string
} }
} }
} }
// cloudflare // cloudflare
import * as cloudflare from "@cloudflare/workers-types" import * as cloudflare from "@cloudflare/workers-types";
declare module "sst" { declare module "sst" {
export interface Resource { export interface Resource {
Api: cloudflare.Service "Api": cloudflare.Service
AuthApi: cloudflare.Service "AuthApi": cloudflare.Service
AuthStorage: cloudflare.KVNamespace "AuthStorage": cloudflare.KVNamespace
Bucket: cloudflare.R2Bucket "Bucket": cloudflare.R2Bucket
ConsoleData: cloudflare.R2Bucket "ConsoleData": cloudflare.R2Bucket
EnterpriseStorage: cloudflare.R2Bucket "EnterpriseStorage": cloudflare.R2Bucket
GatewayKv: cloudflare.KVNamespace "GatewayKv": cloudflare.KVNamespace
LogProcessor: cloudflare.Service "LogProcessor": cloudflare.Service
"ZenData": cloudflare.R2Bucket
} }
} }
import "sst" import "sst"
export {} export {}

View File

@@ -6,4 +6,4 @@
/// <reference path="../../../sst-env.d.ts" /> /// <reference path="../../../sst-env.d.ts" />
import "sst" import "sst"
export {} export {}

View File

@@ -2,8 +2,8 @@ import type { KVNamespaceListOptions, KVNamespaceListResult, KVNamespacePutOptio
import { Resource as ResourceBase } from "sst" import { Resource as ResourceBase } from "sst"
import Cloudflare from "cloudflare" import Cloudflare from "cloudflare"
export const waitUntil = async (fn: () => Promise<void>) => { export const waitUntil = async (promise: Promise<any>) => {
await fn() await promise
} }
export const Resource = new Proxy( export const Resource = new Proxy(

View File

@@ -6,126 +6,131 @@
import "sst" import "sst"
declare module "sst" { declare module "sst" {
export interface Resource { export interface Resource {
ADMIN_SECRET: { "ADMIN_SECRET": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
AUTH_API_URL: { "AUTH_API_URL": {
type: "sst.sst.Linkable" "type": "sst.sst.Linkable"
value: string "value": string
} }
AWS_SES_ACCESS_KEY_ID: { "AWS_SES_ACCESS_KEY_ID": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
AWS_SES_SECRET_ACCESS_KEY: { "AWS_SES_SECRET_ACCESS_KEY": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
CLOUDFLARE_API_TOKEN: { "CLOUDFLARE_API_TOKEN": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
CLOUDFLARE_DEFAULT_ACCOUNT_ID: { "CLOUDFLARE_DEFAULT_ACCOUNT_ID": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
Console: { "Console": {
type: "sst.cloudflare.SolidStart" "type": "sst.cloudflare.SolidStart"
url: string "url": string
} }
Database: { "Database": {
database: string "database": string
host: string "host": string
password: string "password": string
port: number "port": number
type: "sst.sst.Linkable" "type": "sst.sst.Linkable"
username: string "username": string
} }
Desktop: { "Desktop": {
type: "sst.cloudflare.StaticSite" "type": "sst.cloudflare.StaticSite"
url: string "url": string
} }
EMAILOCTOPUS_API_KEY: { "EMAILOCTOPUS_API_KEY": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
GITHUB_APP_ID: { "Enterprise": {
type: "sst.sst.Secret" "type": "sst.cloudflare.SolidStart"
value: string "url": string
} }
GITHUB_APP_PRIVATE_KEY: { "GITHUB_APP_ID": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
GITHUB_CLIENT_ID_CONSOLE: { "GITHUB_APP_PRIVATE_KEY": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
GITHUB_CLIENT_SECRET_CONSOLE: { "GITHUB_CLIENT_ID_CONSOLE": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
GOOGLE_CLIENT_ID: { "GITHUB_CLIENT_SECRET_CONSOLE": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
HONEYCOMB_API_KEY: { "GOOGLE_CLIENT_ID": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
R2AccessKey: { "HONEYCOMB_API_KEY": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
R2SecretKey: { "R2AccessKey": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
STRIPE_SECRET_KEY: { "R2SecretKey": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
STRIPE_WEBHOOK_SECRET: { "STRIPE_SECRET_KEY": {
type: "sst.sst.Linkable" "type": "sst.sst.Secret"
value: string "value": string
} }
Web: { "STRIPE_WEBHOOK_SECRET": {
type: "sst.cloudflare.Astro" "type": "sst.sst.Linkable"
url: string "value": string
} }
ZEN_MODELS1: { "Web": {
type: "sst.sst.Secret" "type": "sst.cloudflare.Astro"
value: string "url": string
} }
ZEN_MODELS2: { "ZEN_MODELS1": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
ZEN_MODELS3: { "ZEN_MODELS2": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
ZEN_MODELS4: { "ZEN_MODELS3": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
}
"ZEN_MODELS4": {
"type": "sst.sst.Secret"
"value": string
} }
} }
} }
// cloudflare // cloudflare
import * as cloudflare from "@cloudflare/workers-types" import * as cloudflare from "@cloudflare/workers-types";
declare module "sst" { declare module "sst" {
export interface Resource { export interface Resource {
Api: cloudflare.Service "Api": cloudflare.Service
AuthApi: cloudflare.Service "AuthApi": cloudflare.Service
AuthStorage: cloudflare.KVNamespace "AuthStorage": cloudflare.KVNamespace
Bucket: cloudflare.R2Bucket "Bucket": cloudflare.R2Bucket
ConsoleData: cloudflare.R2Bucket "ConsoleData": cloudflare.R2Bucket
EnterpriseStorage: cloudflare.R2Bucket "EnterpriseStorage": cloudflare.R2Bucket
GatewayKv: cloudflare.KVNamespace "GatewayKv": cloudflare.KVNamespace
LogProcessor: cloudflare.Service "LogProcessor": cloudflare.Service
"ZenData": cloudflare.R2Bucket
} }
} }
import "sst" import "sst"
export {} export {}

View File

@@ -2,7 +2,9 @@
/* tslint:disable */ /* tslint:disable */
/* eslint-disable */ /* eslint-disable */
/// <reference types="vite/client" /> /// <reference types="vite/client" />
interface ImportMetaEnv {} interface ImportMetaEnv {
}
interface ImportMeta { interface ImportMeta {
readonly env: ImportMetaEnv readonly env: ImportMetaEnv
} }

View File

@@ -6,4 +6,4 @@
/// <reference path="../../sst-env.d.ts" /> /// <reference path="../../sst-env.d.ts" />
import "sst" import "sst"
export {} export {}

View File

@@ -6,126 +6,131 @@
import "sst" import "sst"
declare module "sst" { declare module "sst" {
export interface Resource { export interface Resource {
ADMIN_SECRET: { "ADMIN_SECRET": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
AUTH_API_URL: { "AUTH_API_URL": {
type: "sst.sst.Linkable" "type": "sst.sst.Linkable"
value: string "value": string
} }
AWS_SES_ACCESS_KEY_ID: { "AWS_SES_ACCESS_KEY_ID": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
AWS_SES_SECRET_ACCESS_KEY: { "AWS_SES_SECRET_ACCESS_KEY": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
CLOUDFLARE_API_TOKEN: { "CLOUDFLARE_API_TOKEN": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
CLOUDFLARE_DEFAULT_ACCOUNT_ID: { "CLOUDFLARE_DEFAULT_ACCOUNT_ID": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
Console: { "Console": {
type: "sst.cloudflare.SolidStart" "type": "sst.cloudflare.SolidStart"
url: string "url": string
} }
Database: { "Database": {
database: string "database": string
host: string "host": string
password: string "password": string
port: number "port": number
type: "sst.sst.Linkable" "type": "sst.sst.Linkable"
username: string "username": string
} }
Desktop: { "Desktop": {
type: "sst.cloudflare.StaticSite" "type": "sst.cloudflare.StaticSite"
url: string "url": string
} }
EMAILOCTOPUS_API_KEY: { "EMAILOCTOPUS_API_KEY": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
GITHUB_APP_ID: { "Enterprise": {
type: "sst.sst.Secret" "type": "sst.cloudflare.SolidStart"
value: string "url": string
} }
GITHUB_APP_PRIVATE_KEY: { "GITHUB_APP_ID": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
GITHUB_CLIENT_ID_CONSOLE: { "GITHUB_APP_PRIVATE_KEY": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
GITHUB_CLIENT_SECRET_CONSOLE: { "GITHUB_CLIENT_ID_CONSOLE": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
GOOGLE_CLIENT_ID: { "GITHUB_CLIENT_SECRET_CONSOLE": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
HONEYCOMB_API_KEY: { "GOOGLE_CLIENT_ID": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
R2AccessKey: { "HONEYCOMB_API_KEY": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
R2SecretKey: { "R2AccessKey": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
STRIPE_SECRET_KEY: { "R2SecretKey": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
STRIPE_WEBHOOK_SECRET: { "STRIPE_SECRET_KEY": {
type: "sst.sst.Linkable" "type": "sst.sst.Secret"
value: string "value": string
} }
Web: { "STRIPE_WEBHOOK_SECRET": {
type: "sst.cloudflare.Astro" "type": "sst.sst.Linkable"
url: string "value": string
} }
ZEN_MODELS1: { "Web": {
type: "sst.sst.Secret" "type": "sst.cloudflare.Astro"
value: string "url": string
} }
ZEN_MODELS2: { "ZEN_MODELS1": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
ZEN_MODELS3: { "ZEN_MODELS2": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
ZEN_MODELS4: { "ZEN_MODELS3": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
}
"ZEN_MODELS4": {
"type": "sst.sst.Secret"
"value": string
} }
} }
} }
// cloudflare // cloudflare
import * as cloudflare from "@cloudflare/workers-types" import * as cloudflare from "@cloudflare/workers-types";
declare module "sst" { declare module "sst" {
export interface Resource { export interface Resource {
Api: cloudflare.Service "Api": cloudflare.Service
AuthApi: cloudflare.Service "AuthApi": cloudflare.Service
AuthStorage: cloudflare.KVNamespace "AuthStorage": cloudflare.KVNamespace
Bucket: cloudflare.R2Bucket "Bucket": cloudflare.R2Bucket
ConsoleData: cloudflare.R2Bucket "ConsoleData": cloudflare.R2Bucket
EnterpriseStorage: cloudflare.R2Bucket "EnterpriseStorage": cloudflare.R2Bucket
GatewayKv: cloudflare.KVNamespace "GatewayKv": cloudflare.KVNamespace
LogProcessor: cloudflare.Service "LogProcessor": cloudflare.Service
"ZenData": cloudflare.R2Bucket
} }
} }
import "sst" import "sst"
export {} export {}

View File

@@ -6,126 +6,131 @@
import "sst" import "sst"
declare module "sst" { declare module "sst" {
export interface Resource { export interface Resource {
ADMIN_SECRET: { "ADMIN_SECRET": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
AUTH_API_URL: { "AUTH_API_URL": {
type: "sst.sst.Linkable" "type": "sst.sst.Linkable"
value: string "value": string
} }
AWS_SES_ACCESS_KEY_ID: { "AWS_SES_ACCESS_KEY_ID": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
AWS_SES_SECRET_ACCESS_KEY: { "AWS_SES_SECRET_ACCESS_KEY": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
CLOUDFLARE_API_TOKEN: { "CLOUDFLARE_API_TOKEN": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
CLOUDFLARE_DEFAULT_ACCOUNT_ID: { "CLOUDFLARE_DEFAULT_ACCOUNT_ID": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
Console: { "Console": {
type: "sst.cloudflare.SolidStart" "type": "sst.cloudflare.SolidStart"
url: string "url": string
} }
Database: { "Database": {
database: string "database": string
host: string "host": string
password: string "password": string
port: number "port": number
type: "sst.sst.Linkable" "type": "sst.sst.Linkable"
username: string "username": string
} }
Desktop: { "Desktop": {
type: "sst.cloudflare.StaticSite" "type": "sst.cloudflare.StaticSite"
url: string "url": string
} }
EMAILOCTOPUS_API_KEY: { "EMAILOCTOPUS_API_KEY": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
GITHUB_APP_ID: { "Enterprise": {
type: "sst.sst.Secret" "type": "sst.cloudflare.SolidStart"
value: string "url": string
} }
GITHUB_APP_PRIVATE_KEY: { "GITHUB_APP_ID": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
GITHUB_CLIENT_ID_CONSOLE: { "GITHUB_APP_PRIVATE_KEY": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
GITHUB_CLIENT_SECRET_CONSOLE: { "GITHUB_CLIENT_ID_CONSOLE": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
GOOGLE_CLIENT_ID: { "GITHUB_CLIENT_SECRET_CONSOLE": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
HONEYCOMB_API_KEY: { "GOOGLE_CLIENT_ID": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
R2AccessKey: { "HONEYCOMB_API_KEY": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
R2SecretKey: { "R2AccessKey": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
STRIPE_SECRET_KEY: { "R2SecretKey": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
STRIPE_WEBHOOK_SECRET: { "STRIPE_SECRET_KEY": {
type: "sst.sst.Linkable" "type": "sst.sst.Secret"
value: string "value": string
} }
Web: { "STRIPE_WEBHOOK_SECRET": {
type: "sst.cloudflare.Astro" "type": "sst.sst.Linkable"
url: string "value": string
} }
ZEN_MODELS1: { "Web": {
type: "sst.sst.Secret" "type": "sst.cloudflare.Astro"
value: string "url": string
} }
ZEN_MODELS2: { "ZEN_MODELS1": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
ZEN_MODELS3: { "ZEN_MODELS2": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
ZEN_MODELS4: { "ZEN_MODELS3": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
}
"ZEN_MODELS4": {
"type": "sst.sst.Secret"
"value": string
} }
} }
} }
// cloudflare // cloudflare
import * as cloudflare from "@cloudflare/workers-types" import * as cloudflare from "@cloudflare/workers-types";
declare module "sst" { declare module "sst" {
export interface Resource { export interface Resource {
Api: cloudflare.Service "Api": cloudflare.Service
AuthApi: cloudflare.Service "AuthApi": cloudflare.Service
AuthStorage: cloudflare.KVNamespace "AuthStorage": cloudflare.KVNamespace
Bucket: cloudflare.R2Bucket "Bucket": cloudflare.R2Bucket
ConsoleData: cloudflare.R2Bucket "ConsoleData": cloudflare.R2Bucket
EnterpriseStorage: cloudflare.R2Bucket "EnterpriseStorage": cloudflare.R2Bucket
GatewayKv: cloudflare.KVNamespace "GatewayKv": cloudflare.KVNamespace
LogProcessor: cloudflare.Service "LogProcessor": cloudflare.Service
"ZenData": cloudflare.R2Bucket
} }
} }
import "sst" import "sst"
export {} export {}

View File

@@ -544,6 +544,7 @@ export namespace SessionPrompt {
headers: { headers: {
...(model.providerID.startsWith("opencode") ...(model.providerID.startsWith("opencode")
? { ? {
"x-opencode-project": Instance.project.id,
"x-opencode-session": sessionID, "x-opencode-session": sessionID,
"x-opencode-request": lastUser.id, "x-opencode-request": lastUser.id,
} }

View File

@@ -6,4 +6,4 @@
/// <reference path="../../sst-env.d.ts" /> /// <reference path="../../sst-env.d.ts" />
import "sst" import "sst"
export {} export {}

View File

@@ -6,4 +6,4 @@
/// <reference path="../../sst-env.d.ts" /> /// <reference path="../../sst-env.d.ts" />
import "sst" import "sst"
export {} export {}

View File

@@ -6,4 +6,4 @@
/// <reference path="../../sst-env.d.ts" /> /// <reference path="../../sst-env.d.ts" />
import "sst" import "sst"
export {} export {}

View File

@@ -6,4 +6,4 @@
/// <reference path="../../../sst-env.d.ts" /> /// <reference path="../../../sst-env.d.ts" />
import "sst" import "sst"
export {} export {}

View File

@@ -111,4 +111,7 @@ class Resource:
class ZEN_MODELS4: class ZEN_MODELS4:
type: str type: str
value: str value: str
class ZenData:
name: str
type: str

View File

@@ -6,4 +6,4 @@
/// <reference path="../../sst-env.d.ts" /> /// <reference path="../../sst-env.d.ts" />
import "sst" import "sst"
export {} export {}

View File

@@ -6,4 +6,4 @@
/// <reference path="../../sst-env.d.ts" /> /// <reference path="../../sst-env.d.ts" />
import "sst" import "sst"
export {} export {}

View File

@@ -6,4 +6,4 @@
/// <reference path="../../sst-env.d.ts" /> /// <reference path="../../sst-env.d.ts" />
import "sst" import "sst"
export {} export {}

View File

@@ -6,4 +6,4 @@
/// <reference path="../../sst-env.d.ts" /> /// <reference path="../../sst-env.d.ts" />
import "sst" import "sst"
export {} export {}

View File

@@ -6,4 +6,4 @@
/// <reference path="../../sst-env.d.ts" /> /// <reference path="../../sst-env.d.ts" />
import "sst" import "sst"
export {} export {}

View File

@@ -6,4 +6,4 @@
/// <reference path="../../sst-env.d.ts" /> /// <reference path="../../sst-env.d.ts" />
import "sst" import "sst"
export {} export {}

214
sst-env.d.ts vendored
View File

@@ -5,144 +5,152 @@
declare module "sst" { declare module "sst" {
export interface Resource { export interface Resource {
ADMIN_SECRET: { "ADMIN_SECRET": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
AUTH_API_URL: { "AUTH_API_URL": {
type: "sst.sst.Linkable" "type": "sst.sst.Linkable"
value: string "value": string
} }
AWS_SES_ACCESS_KEY_ID: { "AWS_SES_ACCESS_KEY_ID": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
AWS_SES_SECRET_ACCESS_KEY: { "AWS_SES_SECRET_ACCESS_KEY": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
Api: { "Api": {
type: "sst.cloudflare.Worker" "type": "sst.cloudflare.Worker"
url: string "url": string
} }
AuthApi: { "AuthApi": {
type: "sst.cloudflare.Worker" "type": "sst.cloudflare.Worker"
url: string "url": string
} }
AuthStorage: { "AuthStorage": {
namespaceId: string "namespaceId": string
type: "sst.cloudflare.Kv" "type": "sst.cloudflare.Kv"
} }
Bucket: { "Bucket": {
name: string "name": string
type: "sst.cloudflare.Bucket" "type": "sst.cloudflare.Bucket"
} }
CLOUDFLARE_API_TOKEN: { "CLOUDFLARE_API_TOKEN": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
CLOUDFLARE_DEFAULT_ACCOUNT_ID: { "CLOUDFLARE_DEFAULT_ACCOUNT_ID": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
Console: { "Console": {
type: "sst.cloudflare.SolidStart" "type": "sst.cloudflare.SolidStart"
url: string "url": string
} }
ConsoleData: { "ConsoleData": {
name: string "name": string
type: "sst.cloudflare.Bucket" "type": "sst.cloudflare.Bucket"
} }
Database: { "Database": {
database: string "database": string
host: string "host": string
password: string "password": string
port: number "port": number
type: "sst.sst.Linkable" "type": "sst.sst.Linkable"
username: string "username": string
} }
Desktop: { "Desktop": {
type: "sst.cloudflare.StaticSite" "type": "sst.cloudflare.StaticSite"
url: string "url": string
} }
EMAILOCTOPUS_API_KEY: { "EMAILOCTOPUS_API_KEY": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
EnterpriseStorage: { "Enterprise": {
name: string "type": "sst.cloudflare.SolidStart"
type: "sst.cloudflare.Bucket" "url": string
} }
GITHUB_APP_ID: { "EnterpriseStorage": {
type: "sst.sst.Secret" "name": string
value: string "type": "sst.cloudflare.Bucket"
} }
GITHUB_APP_PRIVATE_KEY: { "GITHUB_APP_ID": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
GITHUB_CLIENT_ID_CONSOLE: { "GITHUB_APP_PRIVATE_KEY": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
GITHUB_CLIENT_SECRET_CONSOLE: { "GITHUB_CLIENT_ID_CONSOLE": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
GOOGLE_CLIENT_ID: { "GITHUB_CLIENT_SECRET_CONSOLE": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
GatewayKv: { "GOOGLE_CLIENT_ID": {
namespaceId: string "type": "sst.sst.Secret"
type: "sst.cloudflare.Kv" "value": string
} }
HONEYCOMB_API_KEY: { "GatewayKv": {
type: "sst.sst.Secret" "namespaceId": string
value: string "type": "sst.cloudflare.Kv"
} }
LogProcessor: { "HONEYCOMB_API_KEY": {
type: "sst.cloudflare.Worker" "type": "sst.sst.Secret"
"value": string
} }
R2AccessKey: { "LogProcessor": {
type: "sst.sst.Secret" "type": "sst.cloudflare.Worker"
value: string
} }
R2SecretKey: { "R2AccessKey": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
STRIPE_SECRET_KEY: { "R2SecretKey": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
STRIPE_WEBHOOK_SECRET: { "STRIPE_SECRET_KEY": {
type: "sst.sst.Linkable" "type": "sst.sst.Secret"
value: string "value": string
} }
Web: { "STRIPE_WEBHOOK_SECRET": {
type: "sst.cloudflare.Astro" "type": "sst.sst.Linkable"
url: string "value": string
} }
ZEN_MODELS1: { "Web": {
type: "sst.sst.Secret" "type": "sst.cloudflare.Astro"
value: string "url": string
} }
ZEN_MODELS2: { "ZEN_MODELS1": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
ZEN_MODELS3: { "ZEN_MODELS2": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
} }
ZEN_MODELS4: { "ZEN_MODELS3": {
type: "sst.sst.Secret" "type": "sst.sst.Secret"
value: string "value": string
}
"ZEN_MODELS4": {
"type": "sst.sst.Secret"
"value": string
}
"ZenData": {
"name": string
"type": "sst.cloudflare.Bucket"
} }
} }
} }
/// <reference path="sst-env.d.ts" /> /// <reference path="sst-env.d.ts" />
import "sst" import "sst"
export {} export {}