diff --git a/app/api/openshell/dashboard/open/route.ts b/app/api/openshell/dashboard/open/route.ts new file mode 100644 index 0000000..fd41fd9 --- /dev/null +++ b/app/api/openshell/dashboard/open/route.ts @@ -0,0 +1,13 @@ +import { NextResponse } from 'next/server' +import { getOpenClawDashboardUrl } from '../../../../lib/openshellHost' + +export async function GET() { + const dashboardUrl = getOpenClawDashboardUrl() + return NextResponse.json({ + ok: true, + dashboardUrl, + openInNewTab: true, + loopbackOnly: true, + note: 'OpenClaw Dashboard is loopback-only on the host. For remote browser access, add a reverse proxy route or rebind the gateway.' + }) +} diff --git a/app/api/openshell/terminal/open/route.ts b/app/api/openshell/terminal/open/route.ts new file mode 100644 index 0000000..280d18c --- /dev/null +++ b/app/api/openshell/terminal/open/route.ts @@ -0,0 +1,29 @@ +import { NextResponse } from 'next/server' +import { probeSandboxShell } from '../../../../lib/openshellHost' + +export async function GET(request: Request) { + try { + const { searchParams } = new URL(request.url) + const sandboxId = searchParams.get('sandboxId') + + if (!sandboxId) { + return NextResponse.json({ error: 'sandboxId is required' }, { status: 400 }) + } + + const result = await probeSandboxShell(sandboxId) + + return NextResponse.json({ + ok: true, + sandboxId, + attached: true, + output: result.stdout.trim(), + stderr: result.stderr.trim(), + note: 'Backend-local terminal probe succeeded. Next step is persistent interactive terminal transport.' + }) + } catch (error) { + return NextResponse.json({ + ok: false, + error: error instanceof Error ? error.message : 'Failed to probe terminal attach' + }, { status: 500 }) + } +} diff --git a/app/components/SandboxList.tsx b/app/components/SandboxList.tsx index c20fa20..c62e04e 100644 --- a/app/components/SandboxList.tsx +++ b/app/components/SandboxList.tsx @@ -178,11 +178,14 @@ export default function SandboxList({