The open source coding agent.
TypeScript
get rid of extra file
Dax Raadeaa76dad0cd7
diff --git a/infra/console.ts b/infra/console.tsindex 1e584ca576c..1368ef202aa 100644--- a/infra/console.ts+++ b/infra/console.ts@@ -163,6 +163,7 @@ new sst.cloudflare.x.SolidStart("Console", {AWS_SES_ACCESS_KEY_ID,AWS_SES_SECRET_ACCESS_KEY,ZEN_BLACK,+ new sst.Secret("ZEN_SESSION_SECRET"),...ZEN_MODELS,...($dev? [diff --git a/packages/console/app/src/context/auth.session.ts b/packages/console/app/src/context/auth.session.tsindex 726b6c8346c..e69de29bb2d 100644--- a/packages/console/app/src/context/auth.session.ts+++ b/packages/console/app/src/context/auth.session.ts@@ -1,24 +0,0 @@-import { useSession } from "@solidjs/start/http"--export interface AuthSession {- account?: Record<- string,- {- id: string- email: string- }- >- current?: string-}--export function useAuthSession() {- return useSession<AuthSession>({- password: "0".repeat(32),- name: "auth",- maxAge: 60 * 60 * 24 * 365,- cookie: {- secure: false,- httpOnly: true,- },- })-}diff --git a/packages/console/app/src/context/auth.ts b/packages/console/app/src/context/auth.tsindex dbbd3c3b2fb..aed07a630f8 100644--- a/packages/console/app/src/context/auth.ts+++ b/packages/console/app/src/context/auth.ts@@ -5,13 +5,38 @@ import { redirect } from "@solidjs/router"import { Actor } from "@opencode-ai/console-core/actor.js"import { createClient } from "@openauthjs/openauth/client"-import { useAuthSession } from "./auth.session"export const AuthClient = createClient({clientID: "app",issuer: import.meta.env.VITE_AUTH_URL,})+import { useSession } from "@solidjs/start/http"+import { Resource } from "@opencode-ai/console-resource"++export interface AuthSession {+ account?: Record<+ string,+ {+ id: string+ email: string+ }+ >+ current?: string+}++export function useAuthSession() {+ return useSession<AuthSession>({+ password: Resource.ZEN_SESSION_SECRET.value,+ name: "auth",+ maxAge: 60 * 60 * 24 * 365,+ cookie: {+ secure: false,+ httpOnly: true,+ },+ })+}+export const getActor = async (workspace?: string): Promise<Actor.Info> => {"use server"const evt = getRequestEvent()diff --git a/packages/console/app/src/routes/auth/callback.ts b/packages/console/app/src/routes/auth/callback.tsindex 2f8781e9882..9b7296791d4 100644--- a/packages/console/app/src/routes/auth/callback.ts+++ b/packages/console/app/src/routes/auth/callback.ts@@ -1,7 +1,7 @@import { redirect } from "@solidjs/router"import type { APIEvent } from "@solidjs/start/server"import { AuthClient } from "~/context/auth"-import { useAuthSession } from "~/context/auth.session"+import { useAuthSession } from "~/context/auth"export async function GET(input: APIEvent) {const url = new URL(input.request.url)diff --git a/packages/console/app/src/routes/auth/logout.ts b/packages/console/app/src/routes/auth/logout.tsindex 7fbe5199a74..9aaac37e224 100644--- a/packages/console/app/src/routes/auth/logout.ts+++ b/packages/console/app/src/routes/auth/logout.ts@@ -1,6 +1,6 @@import { redirect } from "@solidjs/router"import { APIEvent } from "@solidjs/start"-import { useAuthSession } from "~/context/auth.session"+import { useAuthSession } from "~/context/auth"export async function GET(event: APIEvent) {const auth = await useAuthSession()diff --git a/packages/console/app/src/routes/auth/status.ts b/packages/console/app/src/routes/auth/status.tsindex eaab9dbef27..215cae698f9 100644--- a/packages/console/app/src/routes/auth/status.ts+++ b/packages/console/app/src/routes/auth/status.ts@@ -1,5 +1,5 @@import { APIEvent } from "@solidjs/start"-import { useAuthSession } from "~/context/auth.session"+import { useAuthSession } from "~/context/auth"export async function GET(input: APIEvent) {const session = await useAuthSession()diff --git a/packages/console/app/src/routes/user-menu.tsx b/packages/console/app/src/routes/user-menu.tsxindex e0931efd951..a910c2efd1b 100644--- a/packages/console/app/src/routes/user-menu.tsx+++ b/packages/console/app/src/routes/user-menu.tsx@@ -1,6 +1,6 @@import { action } from "@solidjs/router"import { getRequestEvent } from "solid-js/web"-import { useAuthSession } from "~/context/auth.session"+import { useAuthSession } from "~/context/auth"import { Dropdown } from "~/component/dropdown"import "./user-menu.css"diff --git a/packages/console/core/sst-env.d.ts b/packages/console/core/sst-env.d.tsindex 4450c6cb691..96fada3e3c0 100644--- a/packages/console/core/sst-env.d.ts+++ b/packages/console/core/sst-env.d.ts@@ -130,6 +130,10 @@ declare module "sst" {"type": "sst.sst.Secret""value": string}+ "ZEN_SESSION_SECRET": {+ "type": "sst.sst.Secret"+ "value": string+ }}}// cloudflarediff --git a/packages/console/function/sst-env.d.ts b/packages/console/function/sst-env.d.tsindex 4450c6cb691..96fada3e3c0 100644--- a/packages/console/function/sst-env.d.ts+++ b/packages/console/function/sst-env.d.ts@@ -130,6 +130,10 @@ declare module "sst" {"type": "sst.sst.Secret""value": string}+ "ZEN_SESSION_SECRET": {+ "type": "sst.sst.Secret"+ "value": string+ }}}// cloudflarediff --git a/packages/console/resource/sst-env.d.ts b/packages/console/resource/sst-env.d.tsindex 4450c6cb691..96fada3e3c0 100644--- a/packages/console/resource/sst-env.d.ts+++ b/packages/console/resource/sst-env.d.ts@@ -130,6 +130,10 @@ declare module "sst" {"type": "sst.sst.Secret""value": string}+ "ZEN_SESSION_SECRET": {+ "type": "sst.sst.Secret"+ "value": string+ }}}// cloudflarediff --git a/packages/enterprise/sst-env.d.ts b/packages/enterprise/sst-env.d.tsindex 4450c6cb691..96fada3e3c0 100644--- a/packages/enterprise/sst-env.d.ts+++ b/packages/enterprise/sst-env.d.ts@@ -130,6 +130,10 @@ declare module "sst" {"type": "sst.sst.Secret""value": string}+ "ZEN_SESSION_SECRET": {+ "type": "sst.sst.Secret"+ "value": string+ }}}// cloudflarediff --git a/packages/function/sst-env.d.ts b/packages/function/sst-env.d.tsindex 4450c6cb691..96fada3e3c0 100644--- a/packages/function/sst-env.d.ts+++ b/packages/function/sst-env.d.ts@@ -130,6 +130,10 @@ declare module "sst" {"type": "sst.sst.Secret""value": string}+ "ZEN_SESSION_SECRET": {+ "type": "sst.sst.Secret"+ "value": string+ }}}// cloudflarediff --git a/sst-env.d.ts b/sst-env.d.tsindex 6e8b8e67e6a..035a5fc21dd 100644--- a/sst-env.d.ts+++ b/sst-env.d.ts@@ -156,6 +156,10 @@ declare module "sst" {"type": "sst.sst.Secret""value": string}+ "ZEN_SESSION_SECRET": {+ "type": "sst.sst.Secret"+ "value": string+ }"ZenData": {"name": string"type": "sst.cloudflare.Bucket"