Commit Graph

305 Commits

Author SHA1 Message Date
James 4931e008b2 wip: local modifications — agent-sync, doctor, scheduler, task-dispatch, session-cookie 2026-03-29 06:54:52 -04:00
James 9ff79ad87b fix: disable auto-router — inbox tasks stay unassigned until manually assigned 2026-03-24 01:08:55 -04:00
James 40ee077d2c feat: require agents to post Result section with artifact locations in task responses 2026-03-24 00:53:14 -04:00
James 9f224434d9 fix: reduce column min-width from 320px to 160px so all 7 columns fit viewport 2026-03-24 00:22:07 -04:00
nyk 648347cab7
fix(tui): show only 24h token costs, not all-time session estimates (#478)
The cost bar was falling back to summing estimatedCost from ALL Claude
Code sessions (all-time) when the token_usage table was empty, showing
inflated costs like $3678. Now only uses the token_usage table which
is already filtered to the 24h timeframe.
2026-03-22 19:47:25 +07:00
nyk 034865201e
fix(tui): render input bar in task detail view (#477)
The task detail view was setting inputMode for status/assign/priority/
comment but never rendering the input bar — keystrokes were captured
but invisible. Add input bar rendering before the footer in
renderTaskDetail().
2026-03-22 19:43:14 +07:00
nyk 1acbf8e053
feat: auto-route inbox tasks to best available agent (#476)
Tasks in inbox status are now automatically assigned to the best
matching agent based on role affinity and capability scoring:

- Role keywords: coder matches code/implement/fix, researcher matches
  research/analyze/audit, etc.
- Agent capabilities from config are matched against task text
- Idle agents preferred over busy ones
- Capacity limit: agents with 3+ in-progress tasks are skipped
- Runs every 60s before task dispatch (inbox → assigned → dispatch)

Flow: create task (inbox) → auto-route picks best agent (assigned)
→ scheduler dispatches to Claude API (in_progress) → response stored
(review) → Aegis approves (done). Fully hands-free.
2026-03-22 19:06:07 +07:00
nyk 27f6a3d6c1
fix(tui): fix agent list access pattern for assign prompts (#474) 2026-03-22 17:58:15 +07:00
nyk 78b472a63a
feat: direct Claude API task dispatch (gateway-free) (#473)
* feat: direct Claude API task dispatch (gateway-free)

Add a built-in task executor that calls the Anthropic Messages API
directly when no OpenClaw gateway is available. This makes the full
task lifecycle work out of the box — tasks are actually executed by
Claude, not just tracked as metadata.

How it works:
- Scheduler checks: is a gateway registered? If yes, use gateway
  dispatch (existing path). If no, check for ANTHROPIC_API_KEY.
- When dispatching via direct API: builds prompt from task + agent
  SOUL, selects model by complexity (Opus/Sonnet/Haiku), calls
  Claude Messages API, stores response as resolution.
- Aegis reviews also work via direct API — same fallback logic.
- Token usage is recorded in the token_usage table.
- After dispatch, task moves to 'review' for Aegis quality check.

Setup: add ANTHROPIC_API_KEY=sk-ant-... to .env.local
No gateway, no OpenClaw, no extra dependencies needed.

* fix(tui): add missing ansi.blue color function
2026-03-22 17:50:16 +07:00
nyk 32447a4b08
feat(tui): multi-step task creation + assign/priority actions (#472)
* fix: add inline token editor to gateway card (#459)

The gateway card showed token status as read-only (set/none) with no
way to update it. Users with a registered gateway but missing token
had to delete and re-add the gateway.

Add [edit] link next to the token indicator that expands an inline
password input. Supports Enter to save, Escape to cancel. Calls
PUT /api/gateways with the token field (already supported by API).

* feat(tui): multi-step task creation + assign/priority actions

- [n]ew now prompts: title → description → priority → assign agent
  (Enter skips optional steps)
- [a]ssign key to assign selected task to an agent (shows available
  agent names)
- [p]riority key to change task priority (low/medium/high/critical)
- Updated help bar and usage text with new keybindings

* feat(tui): task detail view, activity feed, comments, priority column

- Enter on a task opens full detail view showing: status, priority,
  assignment, description, resolution, quality reviews, and comments
- Task detail supports [s]tatus, [a]ssign, [p]riority, [c]omment,
  [r]efresh actions
- Activity feed below task list shows recent task/agent events with
  timestamps and icons
- Priority column added to task list with color coding
- [e]dit key for title editing (moved from Enter)
2026-03-22 17:25:07 +07:00
nyk 5bc5737d56
fix: add inline token editor to gateway card (#459) (#471)
The gateway card showed token status as read-only (set/none) with no
way to update it. Users with a registered gateway but missing token
had to delete and re-add the gateway.

Add [edit] link next to the token indicator that expands an inline
password input. Supports Enter to save, Escape to cancel. Calls
PUT /api/gateways with the token field (already supported by API).
2026-03-22 16:25:04 +07:00
nyk 60f6dc07a1
Merge pull request #466 from builderz-labs/feat/api-parity-tranche-c-cli-audit
feat: API parity tranche C — CLI, MCP server, TUI, task routing fixes
2026-03-22 15:47:08 +07:00
Nyk e56203b6a8 fix: Settings panel now respects NEXT_PUBLIC_GATEWAY_URL (#468)
The multi-gateway panel was constructing WebSocket URLs client-side
using buildGatewayWebSocketUrl() with the gateway's DB host/port,
ignoring the server-side URL resolution that respects
NEXT_PUBLIC_GATEWAY_URL, Tailscale Serve, and reverse-proxy configs.

- Remove client-side buildGatewayWebSocketUrl fallback in connectTo()
  — server's /api/gateways/connect already handles all URL resolution
- Simplify gatewayMatchesConnection() to use direct host/port string
  matching without constructing a derived WS URL
- Remove unused buildGatewayWebSocketUrl import

Fixes #468
2026-03-22 13:08:40 +07:00
Nyk 34cbc351a1 docs: add quickstart, agent setup, orchestration guides + SEO overhaul
Documentation:
- Add docs/quickstart.md — 5-minute first agent tutorial (register,
  create task, poll queue, complete, heartbeat)
- Add docs/agent-setup.md — registration methods, SOUL personalities,
  config, heartbeats, agent sources
- Add docs/orchestration.md — 7 patterns: manual assignment, queue
  dispatch, auto-dispatch with model routing, Aegis quality review,
  cron recurring tasks, multi-agent handoff, stale task recovery
- Add "Getting Started with Agents" section to README with guide table
- Add cross-reference links to docs/deployment.md

SEO:
- Fix app layout title/description for search ranking
- Add og:type, og:siteName, upgrade twitter card to summary_large_image
- Add public/robots.txt (block /api/, /setup, /login from crawlers)
- Add public/llms.txt for AI discoverability
2026-03-22 12:28:29 +07:00
Nyk 14a0eefd65 feat(tui): task management — create, edit, status change, delete
- [n] new task with inline title input
- [enter] edit task title on selected task
- [s] change task status (inbox/assigned/in_progress/done/failed)
- [d] delete task with y/n confirmation
- Full text input mode with backspace, esc cancel, enter submit
- Input bar renders at footer with context-aware hints
2026-03-22 00:16:28 +07:00
Nyk 6fd1abf6fa fix(ci): allow rate limit bypass in production test mode
The E2E tests run the standalone server (NODE_ENV=production) but need
rate limiting disabled. Allow MC_DISABLE_RATE_LIMIT bypass when
MISSION_CONTROL_TEST_MODE=1 is also set, even in production.

Fixes 100 E2E failures (429 rate limited) in CI.
2026-03-21 23:53:40 +07:00
Nyk 666af416f9 fix(ci): add git identity for gnap-sync test 2026-03-21 23:29:26 +07:00
Nyk 531101dc2d fix(tui): only show last seen when agent actually heartbeated 2026-03-21 23:10:22 +07:00
Nyk e2e9560d1d fix(tui): last seen fallback, session cost aggregation, dark blue header
- Fall back to updated_at/created_at when last_seen is null
- Sum session estimatedCost when token_usage table is empty
- Dark navy blue header background (256-color 17)
2026-03-21 22:54:24 +07:00
Nyk 3ada2e5380 feat(tui): v2 with arrow navigation, agent detail, and chat viewer
- Arrow keys navigate agent/task lists with highlighted selection
- Tab switches between agents and tasks panels
- Enter on agent opens detail view with sessions list
- Enter on session loads chat transcript
- PgUp/PgDn scrolls chat history
- Esc goes back to dashboard
- Scrolling window keeps cursor visible in long lists
2026-03-21 22:48:32 +07:00
Nyk 404092e81d fix(tui): treat DB+Disk as essential health checks 2026-03-21 22:42:50 +07:00
Nyk aa65a1b0b2 fix(tui): alternate screen buffer + smarter health display
- Use alternate screen buffer so terminal doesn't scroll
- Show "healthy (no gateway)" when core checks pass but gateway is down
- Restore original terminal state on exit
2026-03-21 22:41:42 +07:00
Nyk 5c873a0d2c fix(openapi): add GET /api/frameworks to spec
Fixes API contract parity check in CI.
2026-03-21 22:35:41 +07:00
Nyk 9cac9eb362 chore: merge main, resolve migration conflict
Renumber spawn_history → 044, dispatch_attempts → 045 to follow
043_hash_session_tokens from main.
2026-03-21 22:33:26 +07:00
Nyk bf87864a96 fix: CI typecheck error + standalone bind address
- Fix TS2339 in mcp-server.spec.ts (content.task access on string type)
- Default HOSTNAME=0.0.0.0 in start-standalone.sh for external access

Fixes #465, unblocks docker-publish workflow (#464)
2026-03-21 22:29:44 +07:00
Nyk 2d171ad464 fix: task routing stuck issues + k8s agent visibility
- Add stale task watchdog (requeueStaleTasks) to scheduler — detects
  in_progress tasks with offline agents and requeues or fails them
- Fix Aegis rejection loop: rejected tasks now requeue to 'assigned'
  instead of staying in 'in_progress', with max 3 retries before failing
- Track dispatch_attempts on tasks (migration 044) to prevent infinite
  retry loops — tasks fail after 5 dispatch attempts
- Include error_message and reason in SSE event broadcasts so UI can
  show why a task reverted
- Atomic task queue claim: replace SELECT-then-UPDATE race with single
  UPDATE...RETURNING statement
- Gateway agent auto-registration: POST/PUT /api/gateways accepts
  optional 'agents' array to upsert agents (k8s sidecar support)
- Document k8s sidecar deployment in docs/deployment.md

Fixes: tasks stuck in assigned, Aegis rejection loops, agents invisible
in k8s sidecar deployments
2026-03-21 22:21:33 +07:00
Nyk dd7d663a36 feat: add framework template adapters 2026-03-21 22:21:18 +07:00
Nyk b8c121ebea fix(test): relax sessions list exit code assertion 2026-03-21 22:04:11 +07:00
Nyk a7ef6a0de5 fix(openapi): complete parity burn-down — 0 ignored entries remaining
Add OpenAPI specs for all 56 previously-ignored API operations:

Methods added to existing paths (15):
- backup (GET, DELETE), agents/sync, cleanup, integrations (PUT, DELETE),
  logs (POST), memory (DELETE), notifications (PUT, DELETE, deliver),
  pipelines/run, spawn, standup, super/provision-jobs/{id}

New paths (41 operations across 28 paths):
- agents/evals, agents/optimize, channels, claude-tasks, gateways/discover,
  gateways/health/history, github/sync, gnap, hermes (+ memory, tasks),
  index, local/agents-doc, local/flight-deck, local/terminal,
  memory/context, memory/graph, memory/health, memory/links, memory/process,
  nodes, projects/{id}/agents, schedule-parse, security-audit, security-scan
  (+ agent, fix), super/os-users, system-monitor, auth/google/disconnect,
  releases/update

Parity ignore list is now empty (was 66 entries at branch start).
Route coverage: 240/241 (only untracked GET /api/frameworks remains).
2026-03-21 21:58:29 +07:00
Nyk f12aac13c3 feat: platform hardening — spawn history, auth warnings, security docs
FR-D1: Add least-privilege auth guidance to SECURITY-HARDENING.md
  - Agent-scoped keys vs global API key comparison
  - Auth hierarchy table (scoped key > global key > session > proxy)
  - CLI examples for creating scoped keys
  - Monitoring guidance for global key usage

FR-D2: Log security event when global admin API key is used
  - Emits 'global_api_key_used' event to audit trail
  - Hints toward agent-scoped keys for least-privilege

FR-D3: Add durable spawn history persistence
  - New migration 043_spawn_history with indexed table
  - spawn-history.ts with recordSpawnStart/Finish, getSpawnHistory,
    getSpawnStats functions
  - Replaces log-scraping fallback with DB-backed tracking

FR-D4: Document rate-limit backend strategy
  - Current in-memory Map approach documented
  - Pluggable backend plan for multi-instance (Redis, SQLite WAL)
  - Per-agent rate limiter details documented

Also fixes MCP test type annotation (content: string → any).
2026-03-21 21:52:12 +07:00
Nyk 06cfb3d9db feat(tui): add terminal dashboard for Mission Control
Zero-dependency TUI using raw ANSI escape codes. Shows:
- System health status with connection indicator
- Agents panel (sorted by status, with last heartbeat)
- Tasks panel (recent tasks with status and assignee)
- Token costs summary (24h)

Keyboard controls:
- r: refresh now
- a: focus agents panel
- t: focus tasks panel
- w: wake first sleeping agent
- q/Esc: quit

Auto-refreshes every 5s (configurable with --refresh flag).
Uses same profile/auth system as CLI and MCP server.

Run with: pnpm mc:tui
2026-03-21 21:46:45 +07:00
Nyk a9d9005bac docs: add agent control interfaces section to CLAUDE.md 2026-03-21 21:41:36 +07:00
Nyk 7994aa6c6c fix(openapi): burn down 7 parity mismatches (66 → 59 ignored)
Add OpenAPI specs for 7 routes that the CLI/MCP server depend on:

- DELETE /api/agents/{id}/memory — agent memory clear
- GET /api/tokens/by-agent — per-agent cost breakdown
- POST /api/tokens/rotate — API key rotation
- POST /api/agents/register — agent self-registration
- PATCH /api/auth/me — self-service profile update
- GET /api/tasks/outcomes — task outcome analytics
- GET /api/tasks/regression — regression comparison metrics

Remove corresponding entries from the parity ignore list.
2026-03-21 21:35:27 +07:00
Nyk 5cd515105e test: add CLI and MCP server integration tests (38 new e2e tests)
CLI tests cover:
- Help/usage output and exit codes
- Unknown group/action handling
- Missing required flag validation
- Status health/overview
- Agent list, get, heartbeat lifecycle
- Agent memory set/get
- Agent attribution
- Task list, queue polling, comments add/list
- Sessions, tokens, skills, cron, connect list
- Raw passthrough

MCP server tests cover:
- Protocol: initialize handshake, tools/list, ping, unknown method
- Tool schema validation (all 35 tools have name, description, schema)
- Unknown tool error handling
- mc_health and mc_dashboard
- Agent tools: list, heartbeat, write/read/clear memory
- Task tools: list, poll queue, create, add comment, list comments
- Token stats, skills list, cron list

Total e2e: 472 → 510 (all passing)
2026-03-21 21:14:59 +07:00
Nyk b8e04864cd chore: chmod +x CLI and MCP server scripts 2026-03-21 20:10:18 +07:00
Nyk 59f7f0d720 feat(mcp): add Mission Control MCP server for agent-native tool access
Zero-dependency MCP server (stdio transport, JSON-RPC 2.0) that wraps
the Mission Control REST API as 35 MCP tools. Agents can add it with:

  claude mcp add mission-control -- node scripts/mc-mcp-server.cjs

Tools cover the full agent workflow:
- Agent lifecycle: list, get, heartbeat, wake, diagnostics, attribution
- Memory & Soul: read/write/clear working memory, read/write SOUL,
  list/retrieve SOUL templates
- Tasks: CRUD, queue polling, broadcast, comments (list/add)
- Sessions: list, control, continue, transcript
- Connections: list, register
- Tokens & Costs: stats, agent-costs, costs-by-agent
- Skills: list, read content
- Cron: list jobs
- Status: health, dashboard, overview

Auth uses the same profile system as the CLI (~/.mission-control/profiles/)
or MC_URL/MC_API_KEY/MC_COOKIE environment variables.

Also adds `mc` and `mc:mcp` package.json scripts.
2026-03-21 19:42:58 +07:00
Nyk f2747b5330 feat(cli): v2 rewrite with full command coverage and lazy evaluation
- Fix eager required() evaluation bug (route map was evaluated at parse
  time, causing unrelated commands to crash on missing flags)
- Refactor to lazy command handler pattern (functions only execute when
  their group+action matches)
- Add compound subcommands: agents memory get|set|clear, agents soul
  get|set|templates, tasks comments list|add
- Add missing PRD commands: agents attribution, tasks broadcast,
  sessions transcript, tokens agent-costs/task-costs/trends/export/rotate,
  status health/overview/dashboard/gateway/models/capabilities,
  export audit/tasks/activities/pipelines
- Add proper SSE streaming for events watch (NDJSON in --json mode,
  human-readable otherwise, graceful Ctrl+C shutdown)
- Add optional() helper for flags with defaults
- Update docs/cli-agent-control.md with full v2 command reference
2026-03-21 19:30:28 +07:00
nyk dbf9ab1423
Merge pull request #463 from builderz-labs/fix/open-issues-458-461
fix: debug panel gateway routes and Docker file permissions (#461, #458)
2026-03-21 18:52:24 +07:00
Nyk 9a4c7c7b3c fix: update debug panel gateway routes and Docker file permissions (#461, #458)
- Debug panel now probes both legacy (/api/status, /api/health) and current
  OpenClaw routes (/healthz, /health, /ready) with automatic fallback.
  Returns probedPath in response so admins know which route succeeded.
- POST proxy allowlist updated to include current gateway health routes.
- Path validation relaxed from /api/ prefix to / prefix (health routes
  don't use /api/).
- Dockerfile: chmod 755 entrypoint (was +x/711, shell needs read permission)
  and chmod -R a+rX on public/ and src/ for nextjs user access.
2026-03-21 18:51:40 +07:00
nyk 311c7b06ab
Merge pull request #462 from builderz-labs/fix/security-audit-hardening
fix: security hardening from audit
2026-03-21 18:47:07 +07:00
Nyk afa8e9dacb fix: security hardening from audit (closes #460)
- Hash session tokens (SHA-256) before storing in DB; migration for existing tokens
- Enforce 12-char password minimum on self-service change (was 8, creation was 12)
- Increase scrypt cost N=16384→65536 with progressive rehash on login
- Add MC_PROXY_AUTH_TRUSTED_IPS to restrict proxy auth header spoofing
- Enable HSTS by default in production (opt-out via MC_DISABLE_HSTS=1)
- Restrict debug endpoint to allowlisted gateway API paths (SSRF prevention)
- Default session cookie secure=true in production
- Gate MC_DISABLE_RATE_LIMIT on NODE_ENV !== 'production'
- Remove password value from insecure-default log warning
- chmod 600 generated secrets file in Docker entrypoint
2026-03-21 18:45:48 +07:00
Nyk 7b104952cc chore(api): tranche C parity burn-down and CLI integration scaffolding 2026-03-20 23:53:02 +07:00
nyk 69e89a97a1
fix: add timeout/retry for setup status check (#457)
- add bounded timeout+retry helper for /api/setup checks
- show actionable setup error state with Retry button
- avoid blank-screen fallback when setup status check fails
- add unit tests for retry helper

Fixes #456
2026-03-19 23:59:02 +07:00
danielaustralia1 465cd96107
feat: add system monitor panel (btop-style) (#455)
* feat: add system monitor panel with live CPU, memory, disk, and GPU metrics

New btop-inspired monitoring page in the OBSERVE sidebar group.
Polls /api/system-monitor every 2s and renders rolling Recharts area
charts for CPU/memory/GPU and progress bars for disk usage.

* feat: add network I/O monitoring to system monitor panel

Add live network throughput (rx/tx bytes/sec) as a dual area chart.
API returns cumulative byte counters per interface (stateless), frontend
computes rates from deltas between 2s polls. Supports Linux (/proc/net/dev)
and macOS (netstat -ib).

* feat: add top processes list to system monitor

Shows top 8 processes by CPU usage in a compact table with CPU%, Mem%,
and RSS columns. Color-codes high usage values. Uses ps on both Linux
and macOS with fallback for platforms without --sort support.

* fix: normalize process CPU% to 0-100 and filter out ps itself

CPU% from ps is per-core (e.g. 200% on 4 cores), now divided by core
count to show total system percentage. Also filters out the ps command
that briefly appears while collecting process data.

---------

Co-authored-by: Dan <github@bookkept.com.au>
2026-03-19 22:40:55 +07:00
danielaustralia1 8431992866
fix: sync agent live statuses from gateway sessions during scheduled sync (#454)
Closes #450

Co-authored-by: Dan <github@bookkept.com.au>
2026-03-19 20:48:28 +07:00
danielaustralia1 f872aac504
feat: add hide/unhide agents from UI (#453)
Add ability to hide agents from the dashboard without deleting them.
Hidden agents still receive heartbeats and exist in the DB — they are
purely hidden from the default UI view.

- Migration 042: adds `hidden` column to agents table
- API: POST/DELETE /api/agents/[id]/hide to toggle visibility
- GET /api/agents filters hidden by default, ?show_hidden=true to include
- UI: "Show hidden" toggle in panel header, Hide/Unhide button on cards

Co-authored-by: Dan <github@bookkept.com.au>
2026-03-19 20:48:25 +07:00
danielaustralia1 51a51a0ba2
fix: enable vertical scrolling on tasks board columns (#452)
Add min-h-0 to the kanban board flex container and its column children
so that overflow-y-auto on column bodies can actually trigger. Without
this, flexbox min-height:auto causes containers to grow unbounded
instead of constraining height and enabling scroll.

Fixes #376

Co-authored-by: Dan <github@bookkept.com.au>
2026-03-19 20:48:15 +07:00
Nyk 4ddb4d0268 chore: release v2.0.1 2026-03-18 20:48:26 +07:00
nyk 8517d5e896
fix: support gateway defaults for spawn and Docker Hub publish
- make /api/spawn compatible with gateway-managed default models
- add regression coverage for gateway dashboard registration
- publish official multi-arch images to Docker Hub when configured
2026-03-18 19:36:04 +07:00
nyk fc4384bba9
feat: add awaiting_owner task status detection (#428)
Add awaiting_owner column to task board with keyword-based detection
for tasks requiring human action. Tasks matching keywords like
"waiting for", "needs human", "approval needed" are automatically
placed in a dedicated column with orange styling.

Supersedes #397
2026-03-17 13:52:37 +07:00