mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-25 10:04:40 +00:00
fix(core): put workspace routing behind OPENCODE_EXPERIMENTAL_WORKSPACES flag (#16775)
This commit is contained in:
@@ -372,7 +372,7 @@ function App() {
|
|||||||
dialog.replace(() => <DialogSessionList />)
|
dialog.replace(() => <DialogSessionList />)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
...(Flag.OPENCODE_EXPERIMENTAL_WORKSPACES_TUI
|
...(Flag.OPENCODE_EXPERIMENTAL_WORKSPACES
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
title: "Manage workspaces",
|
title: "Manage workspaces",
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ export function Header() {
|
|||||||
<Match when={session()?.parentID}>
|
<Match when={session()?.parentID}>
|
||||||
<box flexDirection="column" gap={1}>
|
<box flexDirection="column" gap={1}>
|
||||||
<box flexDirection={narrow() ? "column" : "row"} justifyContent="space-between" gap={narrow() ? 1 : 0}>
|
<box flexDirection={narrow() ? "column" : "row"} justifyContent="space-between" gap={narrow() ? 1 : 0}>
|
||||||
{Flag.OPENCODE_EXPERIMENTAL_WORKSPACES_TUI ? (
|
{Flag.OPENCODE_EXPERIMENTAL_WORKSPACES ? (
|
||||||
<box flexDirection="column">
|
<box flexDirection="column">
|
||||||
<text fg={theme.text}>
|
<text fg={theme.text}>
|
||||||
<b>Subagent session</b>
|
<b>Subagent session</b>
|
||||||
@@ -154,7 +154,7 @@ export function Header() {
|
|||||||
</Match>
|
</Match>
|
||||||
<Match when={true}>
|
<Match when={true}>
|
||||||
<box flexDirection={narrow() ? "column" : "row"} justifyContent="space-between" gap={1}>
|
<box flexDirection={narrow() ? "column" : "row"} justifyContent="space-between" gap={1}>
|
||||||
{Flag.OPENCODE_EXPERIMENTAL_WORKSPACES_TUI ? (
|
{Flag.OPENCODE_EXPERIMENTAL_WORKSPACES ? (
|
||||||
<box flexDirection="column">
|
<box flexDirection="column">
|
||||||
<Title session={session} />
|
<Title session={session} />
|
||||||
<WorkspaceInfo workspace={workspace} />
|
<WorkspaceInfo workspace={workspace} />
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { Instance } from "@/project/instance"
|
|
||||||
import type { MiddlewareHandler } from "hono"
|
import type { MiddlewareHandler } from "hono"
|
||||||
import { Installation } from "../installation"
|
import { Flag } from "../flag/flag"
|
||||||
import { getAdaptor } from "./adaptors"
|
import { getAdaptor } from "./adaptors"
|
||||||
import { Workspace } from "./workspace"
|
import { Workspace } from "./workspace"
|
||||||
import { WorkspaceContext } from "./workspace-context"
|
import { WorkspaceContext } from "./workspace-context"
|
||||||
@@ -38,7 +37,7 @@ async function routeRequest(req: Request) {
|
|||||||
|
|
||||||
export const WorkspaceRouterMiddleware: MiddlewareHandler = async (c, next) => {
|
export const WorkspaceRouterMiddleware: MiddlewareHandler = async (c, next) => {
|
||||||
// Only available in development for now
|
// Only available in development for now
|
||||||
if (!Installation.isLocal()) {
|
if (!Flag.OPENCODE_EXPERIMENTAL_WORKSPACES) {
|
||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ export namespace Flag {
|
|||||||
export const OPENCODE_EXPERIMENTAL_LSP_TOOL = OPENCODE_EXPERIMENTAL || truthy("OPENCODE_EXPERIMENTAL_LSP_TOOL")
|
export const OPENCODE_EXPERIMENTAL_LSP_TOOL = OPENCODE_EXPERIMENTAL || truthy("OPENCODE_EXPERIMENTAL_LSP_TOOL")
|
||||||
export const OPENCODE_DISABLE_FILETIME_CHECK = truthy("OPENCODE_DISABLE_FILETIME_CHECK")
|
export const OPENCODE_DISABLE_FILETIME_CHECK = truthy("OPENCODE_DISABLE_FILETIME_CHECK")
|
||||||
export const OPENCODE_EXPERIMENTAL_PLAN_MODE = OPENCODE_EXPERIMENTAL || truthy("OPENCODE_EXPERIMENTAL_PLAN_MODE")
|
export const OPENCODE_EXPERIMENTAL_PLAN_MODE = OPENCODE_EXPERIMENTAL || truthy("OPENCODE_EXPERIMENTAL_PLAN_MODE")
|
||||||
export const OPENCODE_EXPERIMENTAL_WORKSPACES_TUI =
|
export const OPENCODE_EXPERIMENTAL_WORKSPACES =
|
||||||
OPENCODE_EXPERIMENTAL || truthy("OPENCODE_EXPERIMENTAL_WORKSPACES_TUI")
|
OPENCODE_EXPERIMENTAL || truthy("OPENCODE_EXPERIMENTAL_WORKSPACES")
|
||||||
export const OPENCODE_EXPERIMENTAL_MARKDOWN = !falsy("OPENCODE_EXPERIMENTAL_MARKDOWN")
|
export const OPENCODE_EXPERIMENTAL_MARKDOWN = !falsy("OPENCODE_EXPERIMENTAL_MARKDOWN")
|
||||||
export const OPENCODE_MODELS_URL = process.env["OPENCODE_MODELS_URL"]
|
export const OPENCODE_MODELS_URL = process.env["OPENCODE_MODELS_URL"]
|
||||||
export const OPENCODE_MODELS_PATH = process.env["OPENCODE_MODELS_PATH"]
|
export const OPENCODE_MODELS_PATH = process.env["OPENCODE_MODELS_PATH"]
|
||||||
|
|||||||
@@ -10,12 +10,22 @@ import { Database } from "../../src/storage/db"
|
|||||||
import { resetDatabase } from "../fixture/db"
|
import { resetDatabase } from "../fixture/db"
|
||||||
import * as adaptors from "../../src/control-plane/adaptors"
|
import * as adaptors from "../../src/control-plane/adaptors"
|
||||||
import type { Adaptor } from "../../src/control-plane/types"
|
import type { Adaptor } from "../../src/control-plane/types"
|
||||||
|
import { Flag } from "../../src/flag/flag"
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
mock.restore()
|
mock.restore()
|
||||||
await resetDatabase()
|
await resetDatabase()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const original = Flag.OPENCODE_EXPERIMENTAL_WORKSPACES
|
||||||
|
// @ts-expect-error don't do this normally, but it works
|
||||||
|
Flag.OPENCODE_EXPERIMENTAL_WORKSPACES = true
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
// @ts-expect-error don't do this normally, but it works
|
||||||
|
Flag.OPENCODE_EXPERIMENTAL_WORKSPACES = original
|
||||||
|
})
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
workspace?: "first" | "second"
|
workspace?: "first" | "second"
|
||||||
calls: Array<{ method: string; url: string; body?: string }>
|
calls: Array<{ method: string; url: string; body?: string }>
|
||||||
|
|||||||
Reference in New Issue
Block a user