Commit Graph

44 Commits

Author SHA1 Message Date
1ff020cf53 fix(prompt): require all 12 PRD sections, no truncation, finalize only when complete
Made-with: Cursor
2026-03-17 17:10:07 -07:00
1cb173a822 fix(prompt): save phase and continue immediately — no confirmation wait
- Rule 3: replace 'get explicit confirmation' with 'summarize and keep moving'
- Checkpoint rule: append marker immediately, then continue to next phase in same message
- Brain dump edge case: save all phases, chain PHASE_COMPLETE markers, no pausing

Made-with: Cursor
2026-03-17 17:00:25 -07:00
9b1f25fa4a rename: replace Atlas with Vibn in agent system prompt and greeting
Made-with: Cursor
2026-03-17 16:25:47 -07:00
772f5357a8 Fix Atlas init: add user turn so Gemini doesn't reject empty conversation
When is_init=true, no user message was being added to history before
calling the LLM. Gemini requires at least one user turn — without it
the API returned "contents are required" and Atlas never sent its
opening greeting. Now adds the init message marked internally so it's
sent to the LLM but filtered out of returned/stored history.

Made-with: Cursor
2026-03-17 15:56:50 -07:00
8ae640c911 feat: update orchestrator prompt and knowledge context injection
- Rewrite system prompt to support dual-mode: COO for user projects
  when knowledge_context provides project data, or platform orchestrator
  when called without context
- Remove the "Project Memory" wrapper prefix so knowledge_context is
  injected cleanly (the COO persona header in context is self-contained)
- Clarify tools, style, security rules

Made-with: Cursor
2026-03-09 22:32:05 -07:00
ba4b94790c feat(mirror): support GitHub PAT for private repo mirroring
Accept optional github_token in POST /api/mirror and inject it into
the git clone URL so private repos can be cloned without interactive auth.

Made-with: Cursor
2026-03-09 18:05:09 -07:00
c00080bc67 feat: add ImportAnalyzer agent and GitHub mirror endpoint
- POST /api/mirror: clones public GitHub repo and pushes to Gitea as-is
- ImportAnalyzer agent: reads unknown codebase, writes CODEBASE_MAP.md
  and MIGRATION_PLAN.md in plain language for non-technical founders
- Register ImportAnalyzer agent and prompt in agents/index.ts

Made-with: Cursor
2026-03-09 11:31:00 -07:00
b04d7b2e13 feat(phase-2): Theia HTTP sync via sync-server on port 3001
- theia-exec.ts: primary path is now HTTP sync (syncRepoToTheia) via
  sync-server.js running inside Theia on port 3001 — no docker socket needed
- syncRepoToTheia(giteaRepo): POST /sync → Theia git-pulls latest committed code
- isTheiaSyncAvailable(): health check before attempting sync
- docker exec path preserved for future use when socket is mounted
- agent-session-runner: use syncRepoToTheia after auto-commit
- server.ts: log both docker exec + HTTP sync status at startup

Made-with: Cursor
2026-03-07 13:38:07 -08:00
7f10009b4f feat(phase-2): Theia container bridge via docker exec
- Dockerfile: install docker-ce-cli, run as root for socket access
- theia-exec.ts: container discovery (env > label > name), theiaExec(),
  syncToTheia() via docker cp
- agent-session-runner: execute_command → docker exec into Theia (fallback to local)
- agent-session-runner: syncToTheia() before auto-commit so "Open in Theia"
  shows agent files immediately after session completes
- server.ts: compute theiaWorkspaceSubdir from giteaRepo slug, log bridge status
  at startup
- custom_docker_run_options already set to mount /var/run/docker.sock

Made-with: Cursor
2026-03-07 13:26:07 -08:00
214e8c1037 feat: auto-approve — commit + deploy on session completion
- SessionRunOptions: autoApprove, giteaRepo, repoRoot, coolifyAppUuid/Url/Token
- autoCommitAndDeploy(): git add -A, commit with "agent: <task>", push,
  trigger Coolify deploy, PATCH session → approved
- Falls back to done status if commit fails so manual approve still works
- /agent/execute: captures repoRoot before appPath scoping, defaults
  autoApprove to true, passes coolify params from env
- System prompt: "do NOT commit" → "platform handles committing"

Made-with: Cursor
2026-03-07 13:17:25 -08:00
551fdb9e54 feat: add AnthropicVertexClient for claude-* models
- @anthropic-ai/vertex-sdk: proper Anthropic Messages API on Vertex
- AnthropicVertexClient: converts OAI message format ↔ Anthropic format,
  handles tool_use blocks, retries 429/503 with backoff
- createLLM: routes anthropic/* and claude-* models through new client
- Tier B/C default: claude-sonnet-4-6 via us-east5 Vertex endpoint
- /generate endpoint: accepts region param for regional endpoint testing

Made-with: Cursor
2026-03-07 12:54:39 -08:00
9c8a08a686 fix: revert Tier B/C to glm-5-maas — claude not enabled in GCP project
Made-with: Cursor
2026-03-07 12:49:25 -08:00
487c13317c fix: retry 429 with backoff; switch Tier B/C to claude-sonnet-4-6
- VertexOpenAIClient: retry on 429/503 up to 4 times with exponential
  backoff (2s/4s/8s/16s + jitter), respects Retry-After header
- Tier B/C default: zai-org/glm-5-maas → claude-sonnet-4-6 (much higher
  rate limits, still Vertex MaaS)
- /agent/execute: accept continueTask param to run a follow-up within
  the original task context without starting a fresh session

Made-with: Cursor
2026-03-07 12:25:51 -08:00
b16a216e0e add /agent/approve endpoint — commit, push and trigger deploy
Receives giteaRepo + commitMessage, stages all workspace changes,
commits with the user-supplied message, pushes to Gitea, then
optionally calls Coolify /start to trigger a rolling redeploy.
Returns { committed, deployed, message } to the frontend.

Made-with: Cursor
2026-03-07 11:36:47 -08:00
5aeddace91 wire up /agent/execute and /agent/stop endpoints
- Add runSessionAgent: streaming variant of runAgent that PATCHes VIBN DB
  after every LLM turn and tool call so frontend can poll live output
- Track changed files from write_file / replace_in_file tool calls
- Add /agent/execute: receives sessionId + giteaRepo + task, clones repo,
  scopes workspace to appPath, runs Coder agent async (returns 202 immediately)
- Add /agent/stop: sets stopped flag; agent checks between turns and exits cleanly
- Agent does NOT commit on completion — leaves changes for user review/approval

Made-with: Cursor
2026-03-06 18:01:30 -08:00
335c7a7e97 feat(atlas): signal post-PRD next step with NEXT_STEP marker for architecture trigger
Made-with: Cursor
2026-03-03 21:18:33 -08:00
d2ee04db59 feat: add /generate endpoint for structured one-shot LLM calls
Made-with: Cursor
2026-03-03 21:11:19 -08:00
6185e71578 feat: Atlas emits PHASE_COMPLETE marker to trigger save button in UI
Made-with: Cursor
2026-03-02 20:24:08 -08:00
d9496ce847 Fix web_search: switch from Jina AI (now requires key) to DuckDuckGo HTML scraping
Made-with: Cursor
2026-03-02 19:49:09 -08:00
6fc4d52232 Fix: escape backtick in atlas prompt template literal
Made-with: Cursor
2026-03-02 19:44:35 -08:00
229f1fc7a3 Give Atlas access to web_search tool
- Add web_search to ATLAS_TOOLS filter (was only finalize_prd)
- Add Tools Available section to atlas prompt so it knows when/how to use it

Made-with: Cursor
2026-03-02 19:12:18 -08:00
e8fdbff9f4 Atlas: opening message, isInit flag, strip trigger from history
- Add opening message instruction to atlas prompt
- Handle isInit flag in atlasChat() to not store the greeting trigger
  as a user turn in conversation history
- Update server.ts to pass is_init through to atlasChat()

Made-with: Cursor
2026-03-02 16:55:16 -08:00
ecd207108c feat: add web_search tool to Atlas using Jina AI free search
Atlas can now search the internet during product discovery conversations
to research competitors, pricing models, and market context. Uses Jina
AI's free search endpoint — no API key required.

Made-with: Cursor
2026-03-01 20:10:53 -08:00
e503e4312d feat: add Atlas PRD agent for product discovery
- src/prompts/atlas.ts — full Atlas system prompt (6-phase PM discovery flow)
- src/tools/prd.ts — finalize_prd tool that signals PRD completion
- src/agents/atlas.ts — Atlas agent config (Tier A, conversational)
- src/atlas.ts — atlasChat() multi-turn session handler
- server.ts — /atlas/chat, /atlas/sessions endpoints

Made-with: Cursor
2026-03-01 15:56:26 -08:00
e29dccf745 refactor: implement three-layer agent architecture (agents / prompts / skills)
Layer 1 — src/agents/ (thin agent definitions, no prompt text)
  registry.ts   — AgentConfig, registerAgent(), getAgent(), AGENTS proxy, pick()
  orchestrator.ts, coder.ts, pm.ts, marketing.ts — one file each, just metadata + tool picks
  index.ts      — barrel: imports prompts then agents (correct registration order)

Layer 2 — src/prompts/ (prompt text separated from agent logic)
  loader.ts     — registerPrompt(), resolvePrompt() with {{variable}} substitution
  orchestrator.ts, coder.ts, pm.ts, marketing.ts — prompt templates as registered strings
  orchestrator.ts now uses resolvePrompt('orchestrator', { knowledge }) instead of
  inline SYSTEM_PROMPT const; {{knowledge}} variable injects project memory cleanly.
  agent-runner.ts uses resolvePrompt(config.promptId) per agent turn.

Layer 3 — src/tools/skills.ts (new skills capability)
  list_skills(repo)      — lists .skills/<name>/SKILL.md directories from a Gitea repo
  get_skill(repo, name)  — reads and returns the markdown body of a skill file
  Orchestrator and all agents now have get_skill in their tool sets.
  Orchestrator also has list_skills and references skills in its prompt.

Also fixed:
  - server.ts now passes history + knowledge_context from request body to orchestratorChat()
    (these were being sent by the frontend but silently dropped)
  - server.ts imports PROTECTED_GITEA_REPOS from tools/security.ts (no more duplicate)
  - Deleted src/agents.ts (replaced by src/agents/ directory)

Made-with: Cursor
2026-03-01 15:38:42 -08:00
e91e5e0e37 refactor: split tools.ts into registry-based domain files
Replaces the single 800-line tools.ts and its switch dispatcher with a
Theia-inspired registry pattern — each tool domain is its own file, and
dispatch is a plain Map.get() call with no central routing function.

New structure in src/tools/:
  registry.ts   — ToolDefinition (with handler), registerTool(), executeTool(), ALL_TOOLS
  context.ts    — ToolContext, MemoryUpdate interfaces
  security.ts   — PROTECTED_* constants + assertGiteaWritable/assertCoolifyDeployable
  utils.ts      — safeResolve(), EXCLUDED set
  file.ts       — read_file, write_file, replace_in_file, list_directory, find_files, search_code
  shell.ts      — execute_command
  git.ts        — git_commit_and_push
  coolify.ts    — coolify_*, list_all_apps, get_app_status, deploy_app
  gitea.ts      — gitea_*, list_repos, list_all_issues, read_repo_file
  agent.ts      — spawn_agent, get_job_status
  memory.ts     — save_memory
  index.ts      — barrel with side-effect imports + re-exports

Adding a new tool now requires only a new file + registerTool() call.
No switch statement, no shared array to edit. External API unchanged.

Made-with: Cursor
2026-03-01 15:27:29 -08:00
7a601b57b8 fix: rotate Gitea token and prevent empty assistant messages in history
- Empty message fix: skip pushing assistant msg to history when both
  content and tool_calls are absent (GLM-5 mid-reasoning token exhaustion).
  Also filter preexisting empty assistant messages from returned history.
- System prompt now correctly injects knowledgeContext from opts into the
  Tier-B system message (was missing in the loop's buildMessages).
- GITEA_API_TOKEN updated externally in Coolify (old token was invalid).

Made-with: Cursor
2026-02-27 20:17:34 -08:00
3417578c28 fix: decode GCP_SA_KEY_BASE64 for Vertex AI auth (avoids Dockerfile injection issues)
Made-with: Cursor
2026-02-27 20:00:21 -08:00
229987e788 fix: use service account JSON key for Vertex AI auth instead of metadata server
The VM's metadata server doesn't grant cloud-platform scope by default.
Read GOOGLE_APPLICATION_CREDENTIALS_JSON env var (service account key JSON)
and pass it directly to GoogleAuth. Falls back to metadata server if unset.
This restores GLM-5 access via Vertex AI.

Made-with: Cursor
2026-02-27 19:51:48 -08:00
1dafd05371 fix: replace gcloud shell-out with google-auth-library for Vertex AI tokens
gcloud is not available inside the Docker container. Use google-auth-library
instead, which reads credentials from the GCP metadata server (works on any
GCP VM) or GOOGLE_APPLICATION_CREDENTIALS env var. Also rebuilds dist/.

Made-with: Cursor
2026-02-27 19:38:07 -08:00
59fe313963 fix: add all missing source files (llm.ts, updated agent-runner/agents)
src/llm.ts was never committed — this caused the Docker build to fail
with "Cannot find module './llm'". Also commit updated agent-runner.ts,
agents.ts, and .env.example that reference the new LLM client.

Made-with: Cursor
2026-02-27 19:33:59 -08:00
f2fc976637 fix: force NODE_ENV=development during npm ci so tsc is installed
Made-with: Cursor
2026-02-27 19:30:40 -08:00
d9368e4abd fix: compile dist from source in Docker, fix ChatResult interface
- Dockerfile now runs tsc during build so committed dist/ is never stale
- ChatResult interface was missing history[] and memoryUpdates[] fields
- Re-add missing MemoryUpdate import in orchestrator.ts
- Rebuild dist/ with all new fields included

Made-with: Cursor
2026-02-27 19:27:42 -08:00
837b6e8b8d feat: persistent conversation + save_memory tool
- ToolContext gets memoryUpdates[] — accumulated by save_memory calls
- orchestratorChat accepts preloadedHistory and knowledgeContext opts
- History trimmed to last 40 messages per turn (cost control)
- Knowledge items injected into system prompt as ## Project Memory
- ChatResult returns history[] and memoryUpdates[] for frontend persistence
- server.ts accepts history/knowledge_context from POST body
- save_memory tool: lets AI persist facts (key, type, value) to long-term memory

Made-with: Cursor
2026-02-27 18:55:33 -08:00
5cb1e82169 feat: Master Orchestrator — persistent chat with full project context and awareness tools
Made-with: Cursor
2026-02-26 15:54:03 -08:00
Vibn Agent Runner
7d426c36e2 feat: Add GET /api/status endpoint with job stats and update PROJECT.md 2026-02-26 23:30:15 +00:00
Vibn Agent Runner
24b18e98bd feat: add simple test file and script 2026-02-26 23:29:40 +00:00
f969fb3b6b fix: capture raw body for HMAC before express.json() middleware
Made-with: Cursor
2026-02-26 15:27:38 -08:00
d3b04fcd22 feat: Gitea webhook with HMAC-SHA256 auth, agent label routing, auto-close issues
Made-with: Cursor
2026-02-26 15:24:25 -08:00
Vibn Agent Runner
1eadbb6631 feat: Add PROJECT.md documentation for vibn-agent-runner 2026-02-26 23:04:01 +00:00
45bca13479 fix: clean git credentials before push to avoid double-auth URLs
Made-with: Cursor
2026-02-26 15:01:42 -08:00
d3c3270309 fix: set git identity for agent commits in container
Made-with: Cursor
2026-02-26 14:58:16 -08:00
0de41a3401 fix: create /workspaces dir, clone repo before running agent
Made-with: Cursor
2026-02-26 14:55:29 -08:00
8870f2b1e0 init: vibn-agent-runner — Gemini autonomous agent backend
Made-with: Cursor
2026-02-26 14:50:20 -08:00