Skip to content
  1. Home
  2. workspace
Checking…
Demo view — sanitized data only. Sign in over HTTPS to create projects and manage the workspace.

AI Engineering Workspace

Partial

Chat, 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

app/src/lib/files.ts

1import fs from "node:fs";
2import path from "node:path";
3import { execFileSync } from "node:child_process";
4
5// Project-scoped, read-only explorer: only the application source tree, never secrets or dependencies.
6export const ROOT = path.resolve(process.cwd(), "..");
7const DENY = [/(^|\/)\.git(\/|$)/, /node_modules/, /(^|\/)\.next(\/|$)/, /(^|\/)data(\/|$)/, /\.env/, /\.db(-wal|-shm)?$/, /token|secret|\.pem$|\.key$/i, /\.runtime/];
8const MAX_VIEW = 200_000;
9
10export function safePath(rel: string): string | null {
11 if (rel.includes("\0")) return null;
12 const abs = path.resolve(ROOT, rel);
13 if (abs !== ROOT && !abs.startsWith(ROOT + path.sep)) return null;
14 const r = path.relative(ROOT, abs);
15 if (DENY.some(re => re.test(r))) return null;
16 return abs;
17}
18
19export type Node = { name: string; path: string; dir: boolean };
20export function list(rel: string): Node[] | null {
21 const abs = safePath(rel); if (!abs) return null;
22 try {
23 return fs.readdirSync(abs, { withFileTypes: true })
24 .map(d => ({ name: d.name, path: path.posix.join(rel, d.name).replace(/^\//, ""), dir: d.isDirectory() }))
25 .filter(n => safePath(n.path))
26 .sort((a, b) => Number(b.dir) - Number(a.dir) || a.name.localeCompare(b.name));
27 } catch { return null; }
28}
29export function read(rel: string): { text: string; truncated: boolean; bytes: number } | null {
30 const abs = safePath(rel); if (!abs) return null;
31 try {
32 const st = fs.statSync(abs); if (!st.isFile()) return null;
33 const buf = fs.readFileSync(abs);
34 if (buf.subarray(0, 4000).includes(0)) return { text: "[binary file]", truncated: false, bytes: st.size };
35 return { text: buf.subarray(0, MAX_VIEW).toString("utf8"), truncated: buf.length > MAX_VIEW, bytes: st.size };
36 } catch { return null; }
37}
38const git = (args: string[]) => { try { return execFileSync("git", args, { cwd: ROOT, encoding: "utf8", timeout: 5000 }).trim(); } catch { return ""; } };
39export function gitInfo() {
40 return { branch: git(["rev-parse", "--abbrev-ref", "HEAD"]), head: git(["rev-parse", "--short", "HEAD"]),
41 status: git(["status", "--short"]).split("\n").filter(Boolean).slice(0, 50),
42 log: git(["log", "--pretty=%h|%s|%cr", "-n", "15"]).split("\n").filter(Boolean).map(l => l.split("|")) };
43}
44export function gitDiff(rel: string) { const abs = safePath(rel); return abs ? git(["diff", "--", rel]).slice(0, 20000) : ""; }
45

Conversation

Partial
Sign in to start AI sessions.

Task checklist

  • Application shell deployed
  • Persistent projects
  • Agent runtime
  • Sandboxed terminal

Execution activity

No agent sessions. Git HEAD fb22adb on master.

Approval requests

None pending.