Commit Graph

24 Commits

Author SHA1 Message Date
nyk e948a1399b
Merge pull request #204 from builderz-labs/fix/188-task-queue
feat(tasks): add queue polling endpoint for agent pickup
2026-03-05 13:35:44 +07:00
Nyk c0cf678c4d fix(gateway): use stored token for websocket connect payload 2026-03-05 13:31:37 +07:00
Nyk c024731764 feat(tasks): add agent queue polling endpoint 2026-03-05 13:22:12 +07:00
Nyk 6d7b20b33b chore: resolve merge conflict with main for PR #178 2026-03-05 12:50:30 +07:00
Nyk 3f2ecad411 chore: resolve merge conflict with main for PR #178 2026-03-05 12:44:32 +07:00
Nyk ee175597be chore: resolve merge conflict with main for PR #180 2026-03-05 12:41:02 +07:00
Nyk 2f2d380b3b fix(agents): enforce attribution scope and add e2e coverage 2026-03-05 12:39:53 +07:00
Nyk 4296943e05 fix(workload): harden signal recommendations and add route e2e coverage 2026-03-05 12:35:01 +07:00
Nyk 0f8f0a87e4 fix(agents): enforce diagnostics self-scope and validation 2026-03-05 12:12:32 +07:00
Nyk 36d5891d85 feat: add validated @mentions for tasks and comments 2026-03-04 23:37:45 +07:00
Nyk caf1dbf5ef merge: resolve PR conflicts and add OpenClaw offline E2E harness 2026-03-04 23:11:59 +07:00
nyk 57dee2094a
feat: scope workflows and webhooks to workspace (#132) 2026-03-04 09:28:43 +07:00
nyk 2111f03542
fix: prevent Docker build failure when pnpm lockfile is missing (#130)
* fix: make docker build resilient when lockfile is absent

* test: update e2e credentials for secure admin seed policy
2026-03-04 08:33:09 +07:00
nyk e4594c7854
feat: aggregate token usage from db with stable agent grouping 2026-03-03 21:06:54 +07:00
nyk a4a606d5ac
feat: Ed25519 device identity for WebSocket challenge-response handshake (#85)
Add client-side Ed25519 key pair generation and nonce signing for
OpenClaw gateway protocol v3 connect.challenge flow. Keys persist in
localStorage and are reused across sessions. The handshake falls back
gracefully to auth-token-only mode when Ed25519 is unavailable.

Closes #74, closes #79, closes #81
2026-03-03 14:30:25 +07:00
nyk 96168fe2f4
feat: audit hardening, webhook retry, and local Claude session tracking (#68)
Security hardening:
- Fix timing-safe comparison bugs in webhooks.ts and auth.ts (was comparing buffer with itself)
- Harden rate limiter IP extraction — use rightmost untrusted IP from XFF chain with MC_TRUSTED_PROXIES support
- Add 12-char minimum password validation in Zod schema and runtime check
- Add Zod validation on PUT /api/tasks bulk status update

Webhook retry system (completing in-progress feature):
- Exponential backoff with circuit breaker in webhooks.ts
- POST /api/webhooks/retry endpoint for manual retry
- GET /api/webhooks/verify-docs endpoint for signature verification docs
- Scheduler integration for automatic retry processing
- Unit tests for signature verification and backoff logic

Local Claude Code session tracking:
- New claude-sessions.ts scanner parses JSONL transcripts from ~/.claude/projects/
- Extracts model, tokens, messages, cost estimates, active status per session
- Migration 020 adds claude_sessions table
- GET/POST /api/claude/sessions endpoint with filtering and aggregate stats
- Scheduler runs scan every 60s with MC_CLAUDE_HOME config

Quality improvements:
- Replace all console.error/warn with structured logger across 31 API routes
- Add Docker HEALTHCHECK directive
- Add vitest coverage config with v8 provider (60% threshold)
- Update README with new features, API docs, env vars, and roadmap items
- Fix E2E tests for password length and rate limiter IP changes
2026-03-02 22:17:35 +07:00
nyk b2703b37d5
fix: resolve all 44 failing CI E2E tests (#64)
* fix: resolve all 44 failing CI E2E tests

- Bypass non-critical rate limiters in test env (MC_DISABLE_RATE_LIMIT=1)
  to prevent 429s when 165 tests share the same IP bucket
- Make admin seed idempotent (INSERT OR IGNORE) to fix UNIQUE constraint
  race when multiple Next.js workers initialize concurrently
- Add distinct x-forwarded-for headers to login-flow tests so they never
  share the critical login rate-limit bucket with other test suites
- Add missing 018_token_usage migration that the heartbeat POST handler
  depends on, fixing the 500 on inline token reporting

* docs: update README with latest features and test count

- Update migration count from 15 to 18
- Update E2E test count from 146 to 165
- Move Direct CLI, OpenAPI docs, and GitHub sync to completed roadmap
- Add Direct CLI and GitHub sync feature descriptions
- Add /api/connect and /api/github to API reference
- Remove resolved known limitation (vitest stubs)
- Update repo description

* fix: prevent build-time admin seed with wrong credentials in CI

Move `cp .env.test .env` before `pnpm build` in CI workflow so env vars
are present during build. Add NEXT_PHASE guard to skip seed during build
as belt-and-suspenders — env vars may not be available at build time.

Root cause: `next build` imports db.ts, triggering seedAdminUserFromEnv()
with undefined AUTH_USER/AUTH_PASS, seeding user `admin` instead of
`testadmin`. Runtime seed then sees count > 0 and skips. Tests login
as `testadmin` which doesn't exist → 401.
2026-03-02 13:53:00 +07:00
Nyk 60197ab21f feat: add GitHub Issues sync (Phase 1, Issue #58)
Import GitHub issues as Mission Control tasks with duplicate detection,
priority mapping from labels, and bidirectional actions (comment/close).

- Migration 017: github_syncs table for sync history tracking
- GitHub API client (src/lib/github.ts) with fetch, comment, close ops
- POST/GET /api/github route with sync, comment, close, status actions
- GitHubSyncPanel UI: import form, issue preview, sync history, linked tasks
- Nav rail + page router wiring
- 6 E2E tests (all passing)
- Validation schema + github.synced event type
2026-03-02 12:45:39 +07:00
Nyk f7aa1db27e feat: add direct CLI integration for gateway-free tool connections
- Add migration 016 for direct_connections table
- Add POST/GET/DELETE /api/connect for CLI tool registration
- Enhance heartbeat POST to accept connection_id and inline token_usage
- Add connectSchema to validation
- Add connection.created/disconnected event types to event bus
- Show direct CLI connections in gateway manager panel
- Add 5 E2E tests for connection lifecycle
- Add CLI integration documentation (docs/cli-integration.md)
- Fix openapi.json brace mismatch on line 642 (Phase 2 bug)
- Add /api/connect endpoints to OpenAPI spec
2026-03-02 11:45:12 +07:00
Nyk 4c7b3257d6 feat: add OpenAPI 3.1 documentation with Scalar UI
- Add openapi.json spec covering all 59 API routes (~95 operations)
- Serve spec at GET /api/docs (no auth required, cached)
- Add interactive Scalar API reference UI at /docs
- Allow unauthenticated access to /api/docs and /docs in middleware
- Add @scalar/api-reference-react dependency
- Add 3 E2E tests for spec validation and auth bypass
2026-03-02 11:03:16 +07:00
Nyk 98da58a8ba feat: add per-agent cost breakdown panel
- Add `agents` field to tokens action=stats response (groups by agent
  extracted from sessionId split on ':')
- Add new action=agent-costs returning per-agent stats, model breakdown,
  session list, and daily cost/token timeline
- New AgentCostPanel with summary cards, pie chart, trend lines,
  efficiency bars, and expandable ranking table
- Add nav-rail entry in OBSERVE group after Tokens
- Add ContentRouter case for agent-costs tab
- Add 5 E2E tests for the new API endpoints
2026-03-02 10:46:13 +07:00
Nyk 45ad4a488b test: add 94 E2E tests covering all CRUD routes + fix middleware location
Add comprehensive Playwright E2E test coverage for all major API routes:
- tasks-crud (18 tests): full lifecycle, filters, Aegis approval gate
- agents-crud (15 tests): CRUD, lookup by name/id, admin-only delete
- task-comments (7 tests): threaded comments, validation
- workflows-crud (8 tests): workflow template lifecycle
- webhooks-crud (9 tests): secret masking, regeneration
- alerts-crud (8 tests): alert rule lifecycle
- notifications (7 tests): delivery tracking, read status
- quality-review (6 tests): reviews with batch lookup
- search-and-export (7 tests): global search, export, activities
- user-management (8 tests): user admin CRUD
- helpers.ts: shared factory functions and cleanup utilities

Infrastructure fixes:
- Move middleware.ts to src/middleware.ts (Next.js 16 Turbopack
  requires middleware in src/ when using src/app/ directory — the
  root-level file was silently ignored, breaking CSRF protection)
- Add MC_DISABLE_RATE_LIMIT env var to bypass non-critical rate
  limiters during E2E runs (login limiter stays active via critical flag)
- Fix limit-caps test: /api/activities caps at 500, not 200
- Set playwright workers=1, fullyParallel=false for serial execution
- Add CSRF origin fallback to request.nextUrl.host

Roadmap additions from user feedback:
- Agent-agnostic gateway support (not just OpenClaw)
- Direct CLI integration (Codex, Claude Code, etc.)
- Native macOS app (Electron or Tauri)

146/146 E2E tests passing (up from 51).
2026-03-02 02:21:10 +07:00
Nyk 8de9e0b5c3 test: add 52 Playwright E2E tests covering all critical fixes
8 test suites verifying:
- Auth guards on 19 GET endpoints (Issue #4)
- Timing-safe API key comparison (Issue #5)
- Legacy cookie auth removal (Issue #7)
- Login rate limiting (Issue #8)
- CSRF Origin header validation (Issue #20)
- DELETE body standardization (Issue #18)
- Query limit caps at 200 (Issue #19)
- Login flow and session lifecycle

Also fixes migration 013 crash on fresh DB when gateways table
doesn't exist (created lazily by gateways API, not in migrations).
2026-02-27 15:38:49 +07:00
Nyk 99815d20b3 feat: initial open-source release
OpenClaw Mission Control — agent orchestration dashboard.

Built with Next.js 16, React 19, TypeScript, SQLite, and Tailwind CSS.
MIT License.
2026-02-23 02:00:44 +07:00