Files
vibn-frontend/lib/chat-context-refs.ts
Mark Henderson 651ddf1e11 Rip out Theia, ship P5.1 attach E2E + Justine UI work-in-progress
Theia rip-out:
- Delete app/api/theia-auth/route.ts (Traefik ForwardAuth shim)
- Delete app/api/projects/[projectId]/workspace/route.ts and
  app/api/projects/prewarm/route.ts (Cloud Run Theia provisioning)
- Delete lib/cloud-run-workspace.ts and lib/coolify-workspace.ts
- Strip provisionTheiaWorkspace + theiaWorkspaceUrl/theiaAppUuid/
  theiaError from app/api/projects/create/route.ts response
- Remove Theia callbackUrl branch in app/auth/page.tsx
- Drop "Open in Theia" button + xterm/Theia PTY copy in build/page.tsx
- Drop theiaWorkspaceUrl from deployment/page.tsx Project type
- Strip Theia IDE line + theia-code-os from advisor + agent-chat
  context strings
- Scrub Theia mention from lib/auth/workspace-auth.ts comment

P5.1 (custom apex domains + DNS):
- lib/coolify.ts + lib/opensrs.ts: nameserver normalization, OpenSRS
  XML auth, Cloud DNS plumbing
- scripts/smoke-attach-e2e.ts: full prod GCP + sandbox OpenSRS +
  prod Coolify smoke covering register/zone/A/NS/PATCH/cleanup

In-progress (Justine onboarding/build, MVP setup, agent telemetry):
- New (justine)/stories, project (home) layouts, mvp-setup, run, tasks
  routes + supporting components
- Project shell + sidebar + nav refactor for the Stackless palette
- Agent session API hardening (sessions, events, stream, approve,
  retry, stop) + atlas-chat, advisor, design-surfaces refresh
- New scripts/sync-db-url-from-coolify.mjs +
  scripts/prisma-db-push.mjs + docker-compose.local-db.yml for
  local Prisma workflows
- lib/dev-bypass.ts, lib/chat-context-refs.ts, lib/prd-sections.ts
- Misc: stories CSS, debug/prisma route, modal-theme, BuildLivePlanPanel

Made-with: Cursor
2026-04-22 18:05:01 -07:00

50 lines
2.0 KiB
TypeScript

/**
* References attached from the overview sidebar so the user can point Vibn at a
* PRD section or discovery phase. Sent with chat; not shown in stored user text.
*/
export type ChatContextRef =
| { kind: "section"; label: string; phaseId: string | null }
| { kind: "phase"; label: string; phaseId: string }
| { kind: "app"; label: string; path: string };
export function contextRefKey(r: ChatContextRef): string {
if (r.kind === "section") return `s:${r.label}`;
if (r.kind === "phase") return `p:${r.phaseId}`;
return `a:${r.path}`;
}
export function augmentAtlasMessage(
message: string,
refs: ChatContextRef[] | null | undefined
): string {
const list = refs?.filter(Boolean) ?? [];
if (!list.length) return message;
const lines = list.map(r =>
r.kind === "section"
? `- PRD section: "${r.label}"${r.phaseId ? ` (discovery phase: ${r.phaseId})` : ""}`
: r.kind === "phase"
? `- Discovery phase: "${r.label}" (id: ${r.phaseId})`
: `- Monorepo workspace / package: "${r.label}" (path: ${r.path})`
);
return `[The user attached these project references for this message. Prioritize them in your reply:\n${lines.join("\n")}\n]\n\n${message}`;
}
export function parseContextRefs(raw: unknown): ChatContextRef[] {
if (!Array.isArray(raw)) return [];
const out: ChatContextRef[] = [];
for (const item of raw) {
if (!item || typeof item !== "object") continue;
const o = item as Record<string, unknown>;
if (o.kind === "section" && typeof o.label === "string") {
const phaseId: string | null =
o.phaseId === null ? null : typeof o.phaseId === "string" ? o.phaseId : null;
out.push({ kind: "section", label: o.label, phaseId });
} else if (o.kind === "phase" && typeof o.label === "string" && typeof o.phaseId === "string") {
out.push({ kind: "phase", label: o.label, phaseId: o.phaseId });
} else if (o.kind === "app" && typeof o.label === "string" && typeof o.path === "string") {
out.push({ kind: "app", label: o.label, path: o.path });
}
}
return out;
}