From bf6171a667fafbd6cca5a8965683bf2ab17818d8 Mon Sep 17 00:00:00 2001 From: mawkone Date: Thu, 28 May 2026 16:05:47 -0700 Subject: [PATCH] feat: added desktop sso endpoints --- VIBNCODE_PLAN.md | 161 +++++++++++++ talkcody | 1 + vibn-attribution-package/README.md | 226 ++++++++++++++++++ vibn-attribution-package/backend/mixins.py | 61 +++++ vibn-attribution-package/backend/models.py | 164 +++++++++++++ .../frontend/VibnTracker.tsx | 185 ++++++++++++++ .../umami-bridge/umami_service.py | 139 +++++++++++ vibn-code | 1 + vibn-frontend/app/api/auth/me/route.ts | 46 ++++ vibn-frontend/app/api/auth/token/route.ts | 61 +++++ vibn-frontend/app/auth/page.tsx | 37 ++- 11 files changed, 1077 insertions(+), 5 deletions(-) create mode 100644 VIBNCODE_PLAN.md create mode 160000 talkcody create mode 100644 vibn-attribution-package/README.md create mode 100644 vibn-attribution-package/backend/mixins.py create mode 100644 vibn-attribution-package/backend/models.py create mode 100644 vibn-attribution-package/frontend/VibnTracker.tsx create mode 100644 vibn-attribution-package/umami-bridge/umami_service.py create mode 160000 vibn-code create mode 100644 vibn-frontend/app/api/auth/me/route.ts create mode 100644 vibn-frontend/app/api/auth/token/route.ts diff --git a/VIBNCODE_PLAN.md b/VIBNCODE_PLAN.md new file mode 100644 index 0000000..562c1d1 --- /dev/null +++ b/VIBNCODE_PLAN.md @@ -0,0 +1,161 @@ +# VibnCode: Cloud-Powered Agent Desktop IDE Architecture & Implementation Plan + +**Project Name:** `vibncode` (formerly TalkCody) +**Target Architecture:** Desktop Thin Client with Monaco + Native Cloud Hosting Integration +**Backend Platform:** Vibnai Cloud Infrastructure (`vibn-frontend`, `vibn-agent-runner`, Gitea, Coolify) +**Status File Location:** `master-ai/VIBNCODE_PLAN.md` + +--- + +## 1. System High-Level Architecture Diagram + +`vibncode` functions as a high-fidelity window into your cloud-hosted workspace, routing all actions, skills, and terminal commands to the `vibn-agent-runner` and Gitea/Coolify backend. + +```mermaid +graph TD + %% Styling + classDef client fill:#E1F5FE,stroke:#0288D1,stroke-width:2px; + classDef runner fill:#EDE7F6,stroke:#5E35B1,stroke-width:2px; + classDef infra fill:#E8F5E9,stroke:#2E7D32,stroke-width:2px; + + subgraph Client [Desktop client - vibncode] + UI[React 19 / Monaco Editor UI] + State[Zustand Stores / Local SQLite DB Cache] + Tauri[Tauri v2 App Wrapper] + end + + subgraph CloudRunner [Cloud Workspace - vibn-agent-runner] + Runner[Agent Session Runner Engine] + Workspace[Sandboxed Project Dir: /workspaces] + Tools[Vibn Platform & Sentry Tools] + end + + subgraph Infrastructure [Vibnai Platform] + DB[(PostgreSQL Database)] + WebAPI[Next.js API Server: vibn-frontend] + Gitea[(Gitea Git Server)] + Coolify[Coolify Server Hosting] + end + + %% Connections + UI <-->|1. Event Streams & File Sync| WebAPI + UI -->|2. Start/Cancel Execution| WebAPI + WebAPI -->|3. Route Exec Request| Runner + Runner <-->|4. Code Edits & Shell Runs| Workspace + Runner -->|5. Save Output & File Changes| WebAPI + WebAPI <-->|6. Write State & Logs| DB + Runner <-->|7. Push/Pull/Clone Code| Gitea + Runner -->|8. Manage & Deploy Apps| Coolify + Workspace -->|9. Pull Guidelines| Gitea + + class UI,State,Tauri client; + class Runner,Workspace,Tools runner; + class DB,WebAPI,Gitea,Coolify,Workspace infra; +``` + +--- + +## 2. Structural Requirements & Feature Specification + +### 2.1 Rebranding to `vibncode` +* All codebase identifiers, folder structures, logs, config registries, and binary product properties are renamed from `talkcody` to `vibncode` / `VibnCode` to prevent trademark leaks. +* The application bundle identifier is modified to `com.vibnai.vibncode`. + +### 2.2 Preservation of the Desktop UI Experience +* The Monaco Editor, collapsible multi-panel grid, dark theme, and rich agent step logs are preserved exactly. +* All compiler execution and file system checks are offloaded to your secure cloud container runner. + +### 2.3 Cloud-Hosted Live Browser Preview Pane +* **Split-Screen Interface**: Adjacent to the Monaco code editor, we inject a live webview/iframe tab. +* **Wildcard DNS Mapping**: The pane points directly to your dynamic wildcard URL generated during a dev server boot: + `https://[projectSlug]-[devServerPort].preview.vibnai.com` +* **Instant Hot-Module Replacement (HMR)**: As the cloud agent or the developer edits files, Vite or Next.js compiles the changes inside the cloud container in milliseconds. Traefik reverse-proxies the stream, causing the embedded browser pane to update instantly on-screen without requiring a manual refresh. + +### 2.4 Autonomous Gitea & Coolify Environment Administration +* We add tabs to the left navigation panel matching the modules of your Vibnai Web Dashboard: + 1. **Code [📝]**: Monaco editor, virtual filesystem browser. + 2. **Plan [📋]**: Synchronized feature checklist showing requirements directly tied to `fs_projects.phase_data`. + 3. **Host [🚀]**: Lists running Coolify application containers, database states, environment credentials (`.env`), and displays live resource monitors (RAM, CPU, Build Logs). + 4. **Market [📊]**: Suggests GBP categories, researches competitor domains (DataForSEO), and performs technical site scrapes. + 5. **Preview [🌐]**: Embedded browser preview tab rendering the wildcard live deployment URL. +* **Autonomous Agent Tools**: The AI is equipped with Gitea and Coolify administration commands (e.g. `git_commit_and_push`, `apps_create_database`, `apps_deploy`, `hosting_set_env`, `project_recent_errors`). The AI can provision databases, modify env keys, verify compiling logs, and fix its own code bugs inside the sandboxed cloud workspaces autonomously. + +--- + +## 3. Database & Database Synchronization Specifications + +### 3.1 Mapping Local Client States to PostgreSQL +We will link `vibncode`'s local state structures with your `vibn-frontend` PostgreSQL databases: + +* **Project Lists**: Retrieved via `GET /api/projects` querying the `fs_projects` and `fs_users` tables. +* **Active Agent Session**: Instantiated via `POST /api/projects/[projectId]/agent/sessions` and updated by `vibn-agent-runner` sending `PATCH /api/projects/[projectId]/agent/sessions/[sessionId]` with `outputLine` and `changedFile` updates. +* **Virtual File Tree**: Read via `GET /api/workspace/tree` which performs a directory scrape of `/workspaces/[giteaRepo]` and renders a visual file browser in the desktop client's sidebar. + +--- + +## 4. Key Code Paths & Planned Refactoring + +To implement this architecture elegantly, the following specific files will be refactored: + +### 4.1 Client-Side Refactoring (Tauri / React) +1. **`src/services/file-service.ts`**: Replace `@tauri-apps/plugin-fs` reads/writes with authorized cloud workspace endpoints: + * `GET /api/workspace/tree` $\rightarrow$ Scrapes Gitea directory tree. + * `POST /api/workspace/file/read` $\rightarrow$ Fetches content for Monaco. + * `POST /api/workspace/file/write` $\rightarrow$ Writes edits back to the cloud. +2. **`src/services/execution-service.ts`**: + * Redirect `startExecution()` to trigger `POST /api/projects/[projectId]/agent/execute` on the server instead of running the loop inside the local app process. + * Connect to `vibn-frontend`'s SSE or session poll endpoint to map logs, changed file notifications, and status streams directly to Zustand. +3. **`src/components/chat/embedded-preview.tsx`** (New Component): + * Incorporate a split-screen panel with an `