Commit Graph

32 Commits

Author SHA1 Message Date
saltbo c874ecacd0 docs(auth): distinguish OIDC from Realmroot extensions 2026-09-02 22:43:26 -04:00
saltbo b00f7be468 fix(docs): remove erroneous Remote terminology 2026-09-02 22:34:25 -04:00
saltbo df9cb3b3d1 docs(architecture): establish ADR and BDD baseline 2026-09-02 22:23:12 -04:00
realmroot[bot] 7ed77d2295 fix: harden v2 service boundaries (#243)
* fix: harden v2 service boundaries

* fix(sessions): validate observation configuration first

---------

Co-authored-by: jarvis <jarvis@agents.realmroot.dev>
2026-09-02 16:50:47 -04:00
jarvis 10f315930a fix(v2): harden boundaries and clean final artifacts 2026-09-02 09:50:29 -04:00
jarvis a2fa54a729 feat!: rebuild Agent Kanban for Realmroot Toolbox
Replace the v1 Agent/Machine runtime and CLI architecture with the v2 Resource Server, AMA-backed projections, task lifecycle, session observation, BDD specifications, and a single-package layered codebase.

BREAKING CHANGE: remove the v1 CLI, internal Agent/Machine runtime entities, workspace layout, and legacy runtime coordination APIs.
2026-09-02 00:17:52 -04:00
saltbo e1f0e0c76e fix(auth): follow Realmroot native token mode 2026-08-21 08:05:10 -06:00
saltbo d2c6c6c5f6 fix(auth)!: restore AK-owned agent sessions
Use Realmroot only for human and machine authentication, authorize AMA through the browser user's multi-resource grant, and restore AK-managed Ed25519 Agent sessions.

Preserve Better Auth source tables while removing the mistaken Realmroot Agent binding and machine M2M paths.

BREAKING CHANGE: AK no longer accepts Realmroot Agent tokens or AMA machine credentials; active browser users must sign in again to authorize the AMA resource.
2026-08-21 01:55:28 -06:00
saltbo 972673aecd feat(auth)!: snapshot Realmroot native cutover
Replace Better Auth user, machine, and agent authentication with Realmroot native flows, migrate tenant ownership, and route AMA access through the cutover adapter. Preserve this deployed migration state as the baseline for the narrower user-auth-only redesign.
2026-08-21 00:44:07 -06:00
saltbo c19116850e fix(runtime): adapt chat to AMA 0.5 events 2026-07-01 12:20:04 -04:00
saltbo 6b8d3d38f2 fix(ama): apply runtime operations before task state 2026-06-24 23:20:46 -04:00
saltbo 3f18ee4ec1 build: add real 'pnpm typecheck' (root tsc --noEmit was a no-op)
The root tsconfig is solution-style (files:[] + references to non-composite
projects), so 'tsc --noEmit' there type-checks nothing — which let an arity bug
slip into taskDispatch.ts. Add a typecheck script that runs tsc --noEmit per
project (shared, cli, web incl. server/worker) and point the CLAUDE.md regression
step at it.
2026-06-18 11:59:01 -04:00
saltbo 7fbbbfe2eb feat: add registered worker subagents 2026-05-03 10:55:55 -04:00
saltbo c5bdd68380 docs: require daemon smoke test in post-write workflow 2026-04-14 02:12:43 -04:00
saltbo c9e9339ec8 refactor: migrate from Pages+Functions to Cloudflare Worker
Unify the app into a single Worker deployment:
- Move functions/api/ → server/, add worker/index.ts entry point
- Merge relay-worker DO (TunnelRelay) into the main worker
- Replace Pages Functions with @cloudflare/vite-plugin build
- Integrate share SSR (OG meta injection) into Hono routes
- Remove dayjs dep from shared (native Date suffices)
- Simplify dev to single `vite dev`, deploy via CF Git integration
- Delete packages/relay-worker/ and Pages-specific _routes.json
2026-04-13 07:58:39 -04:00
Jasper Van a884782457 docs: update agent-kanban skill and CLAUDE.md for kubectl-style CLI (#60)
Replace old-style commands (ak task list, ak task log, ak task view, etc.)
with new kubectl-style format (ak get task, ak create note, etc.). Remove
references to daemon-managed commands (assign, complete, release, link/unlink).
Add task lifecycle subcommands (claim, cancel, review, reject) and create
task options reference.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 14:10:29 -04:00
saltbo 0d54f72da7 docs: reviewer can be human or lead agent, not just human
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 21:38:02 -04:00
saltbo 5580e3818c refactor(ui): make board read-only, keep only reject/complete for review
Remove all human task management from UI — task creation (+ Task button,
onboarding Create Task step), status transitions (claim/cancel/release/assign),
delete button, and AssignDropdown component.

Board is now observation-only. Only reject and complete buttons remain,
shown exclusively for in_review tasks. Onboarding simplified from 3 to 2 steps.

Update CLAUDE.md with UI Principles and Post-Write Workflow to include
Playwright tests for frontend changes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 17:08:37 -04:00
saltbo de7d3dc3ae test: add unit tests for API layer (boardRepo, repositoryRepo, routes, sse)
Coverage improved from 36.73% to 47.33%. Four new test files with 115 test
cases covering board CRUD, repository CRUD, all HTTP routes, and SSE streaming.
Shared test infrastructure extracted to tests/helpers/db.ts. Updated CLAUDE.md
with test ownership rule: main agent owns source code, test-writer agent owns
test code.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 16:19:35 -04:00
saltbo b285b60ad6 ci: add GitHub Actions CI with test coverage and badge
- Add CI workflow: build, type check, test with coverage on PRs and master
- Configure vitest coverage (v8 provider) scoped to source directories
- PR coverage report via vitest-coverage-report-action
- Coverage badge via GitHub Pages (no external services needed)
- Update CLAUDE.md with post-write workflow and testing conventions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 15:46:45 -04:00
saltbo 61b50c6837 feat: agent identity via @better-auth/agent-auth
Each agent gets a cryptographic Ed25519 identity. Daemon generates
ephemeral keypair per spawn, registers public key with the server.
Agents authenticate via short-lived JWT instead of sharing machine
API key.

Backend:
- Integrate agentAuth plugin (Ed25519, 24h TTL, autonomous mode)
- Three-way auth: machine API key, agent JWT, user session
- Clear permission boundaries: requireMachine (daemon), requireAgent
  (agent), requireUser (web)
- agents table gains public_key column

CLI:
- Daemon registers as Host on first start
- Ed25519 keypair generated per agent spawn (ephemeral, in-memory)
- AgentClient signs requests with EdDSA JWT (60s expiry)
- ProcessManager uses AgentClient for message relay and usage reporting

Frontend:
- Identicon: 5×5 symmetric SVG grid derived from public key hash
- Per-agent color: hue 160-220 (cyan-blue spectrum) from key bytes
- Fingerprint: 4-byte hex (XX:XX:XX:XX) displayed in agent profiles
- Task cards glow with agent-specific color when active
- Falls back to initials avatar for agents without public key

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 17:32:58 -04:00
saltbo b390db8d73 refactor: replace hand-rolled auth with Better Auth API key plugin
- Add @better-auth/api-key for machine API key management
- Two identity types: user (session) and machine (API key)
- RBAC: requireUser/requireMachine guards on routes
- Remove key_hash from machines table (auth handled by Better Auth)
- Remove synthetic "web" machine hack from auth middleware
- Context: ownerId + identityType + machineId (replaces c.get("machine"))
- owner_id stays as-is (user.id now, org.id when teams are added)
- Migration 0002: recreate machines without key_hash

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 16:04:07 -04:00
saltbo d189ef4f38 Revert "refactor: replace hand-rolled auth with Better Auth API key plugin"
This reverts commit 99419afdee.
2026-03-21 16:00:50 -04:00
saltbo 99419afdee refactor: replace hand-rolled auth with Better Auth API key plugin
- Add @better-auth/api-key for machine API key management
- Two identity types: user (session) and machine (API key)
- RBAC: requireUser/requireMachine guards on routes
  - user: manage boards, repos, machines, complete tasks
  - machine: assign, claim, review, release, heartbeat
- Rename owner_id → user_id across schema, types, and repo layers
- Remove key_hash from machines table (auth handled by Better Auth)
- Remove synthetic "web" machine hack from auth middleware
- Migration 0002: recreate machines table, rename columns in boards/repos
- Update SSE to validate tokens via Better Auth
- Add .claude/worktrees/ to .gitignore

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 15:57:33 -04:00
saltbo c177e2ecbd refactor: remove Project table, promote Board to top-level entity
Project and Board were 1:1 with no independent value. Board now absorbs
owner_id and description, becoming the workspace unit directly. API
surface changes from /api/projects/* to /api/boards/* with a new PATCH
endpoint for updates. Migrations consolidated into a single file.

Frontend: board switcher modal replaces dropdown, settings page gains
board rename/description/delete, CLI command renamed from project to board.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 12:29:18 -04:00
saltbo a2d7df0c28 refactor: promote repositories to tenant-level, add Repositories page
Repositories now belong to owner (like machines) instead of projects.
Schema: project_id → owner_id with UNIQUE(owner_id, url).
New tenant-scoped API endpoints: GET/POST/DELETE /api/repositories.
New top-level Repositories page in web UI with task count per repo.
CLI: ak link registers repo at tenant level, maps repoId → localPath.
Daemon resolves work directory via task.repository_id → links lookup.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 11:46:51 -04:00
saltbo b385b1937d refactor: restructure data model — Project as workspace, Board internal, repositories replace resources
- Project is now the central workspace unit; Board is 1:1 internal entity (no public API)
- project_resources table → repositories table (simpler: name + url)
- tasks.project_id → tasks.repository_id (nullable FK to repositories)
- Board CRUD routes removed; GET /api/projects/:id/board added
- createProject atomically creates both project and board via db.batch()
- CLI: board command removed, project board subcommand added
- Frontend: useBoard fetches via projects API, FilterBar filters by repository
- Onboarding creates project (board auto-created), not board directly
- Dead code removed: project.ts, CreateBoardInput, DEFAULT_BOARD_NAME, RESOURCE_TYPES

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 09:54:40 -04:00
saltbo 75d4c06b44 feat: Agent Kanban v1 completion — Machine daemon, chat, ak link
Machine daemon (ak start):
- Poll loop with exponential backoff, auto-assign todo tasks to agents
- Process manager: spawn agent CLI, monitor exit, crash recovery
- PID lock, graceful SIGINT/SIGTERM shutdown
- Chat relay: poll messages from platform, pipe to agent stdin

Chat (messages table + API):
- D1 messages table for human ↔ agent conversation
- POST/GET /api/tasks/:id/messages endpoints
- SSE extended with typed events (event: log | message)
- ChatPanel UI component in TaskDetail with Details/Chat tabs

ak link:
- Bind local repo to project via ~/.agent-kanban/links.json
- Auto-add git_repo resource to project

Agent identity cleanup:
- agent_id (UUID) = session ID, used everywhere consistently
- ensureAgent() replaces findOrCreateAgent() — auto-generates display name
- Removed agent_name from all API request parameters
- assign route used by daemon (not claim)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 00:13:28 -04:00
Jasper Van 15d4638aa5 feat: add In Review and Cancelled task statuses (v1.2.1) (#2)
* feat: add In Review and Cancelled task statuses

Add two new kanban columns (In Review, Cancelled) with full-stack support:
- API endpoints: POST /api/tasks/:id/review and /cancel
- CLI commands: task review, task cancel
- D1 migration: 0003_review_cancel.sql
- Frontend: 5-column grid, ActivityLog labels/styles
- Agent idle check now considers In Review as active
- Dependency blocked check treats Cancelled as finished

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(qa): ISSUE-001 — use dynamic grid columns instead of hardcoded grid-cols-5

Tailwind JIT can't generate grid-cols-N dynamically. Use inline style
with gridTemplateColumns based on actual column count from API.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(qa): ISSUE-002 — rename migration to 0004 to avoid conflict with 0003_projects.sql

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: reject cancel on completed tasks — Done → Cancelled guard

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: add coverage for In Review and Cancelled constants

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: bump version and changelog (v1.2.1)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 19:23:27 -04:00
saltbo bac11e408b feat: Agent Kanban v1.3.0 — first-class projects + git_repo resources
Replace bare `project TEXT` on tasks with `projects` table and
`project_resources` (git_repo type). Tasks reference project_id with
LEFT JOIN for project_name.

- Migration 0003: projects, project_resources tables, tasks recreated
- Backend: projectRepo.ts, 7 API endpoints, task queries updated
- CLI: project create/list, resource add/list, detectProjectId async
- Frontend: project dropdown in TaskDetail, FilterBar by id, ProjectSettings
- Shared: Project/ProjectResource types, RESOURCE_TYPES constant

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:32:29 -04:00
Jasper Van d8fffb55ce feat: Agent Kanban v1.2.0 — agent observatory, dependencies, SSE streaming (#1)
* feat: Agent Kanban v2 — agent observatory, dependencies, SSE streaming

Transform the board from a task tracker into an agent observatory with
real-time visibility, platform-driven assignment, and dependency-aware
task coordination.

- Agent entity: status tracking (idle/working/offline), GET /api/agents
- Task dependencies: depends_on with cycle detection, blocked computation
- Task origin: created_from for subtask tracking
- Assign/Release: POST /api/tasks/:id/assign and /release endpoints
- Stale detection: auto-release after 2h, write-on-read in board fetch
- SSE streaming: GET /api/tasks/:id/stream with polling fallback
- CLI: task assign/release, agent list, --parent/--depends-on flags
- UI: ActivityLog, AssignDropdown, AgentProfile, SubtaskList, blocked badges

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(review): address 5 review findings from pre-landing review

- Narrow SSE auth bypass to exact path pattern (was too broad)
- Fix SSE reconnection: resolve log ID to timestamp for since filtering
- Compute blocked status in getBoard() so kanban view shows blocked badges
- Remove dead code in useSSE polling fallback
- Rename fetch→load in useAgents to avoid shadowing global

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: bootstrap test framework (vitest)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: enum completeness coverage for v2 actions and agent statuses

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: bump version and changelog (v1.2.0)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs: sync CLAUDE.md with v1.2.0 patterns

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 17:51:35 -04:00
saltbo 79ecb56e77 feat: Agent Kanban v1 — full implementation
Monorepo with Hono API (Cloudflare Pages + D1), React SPA, CLI, and agent skill.

- API: boards CRUD, tasks CRUD, claim/complete, logs, auth (Machine-level API keys + auto-registered agents)
- Web UI: kanban board, inline task creation, slide-out detail with editing (title, description, project, priority, column move), filter bar, onboarding flow, dark mode, settings page
- CLI: config, task create/list/claim/log/complete, board view, smart project detection
- Skill: SKILL.md teaching agents the CLI workflow
- Design system: Geist + Geist Mono, cyan accent, industrial/utilitarian aesthetic

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 14:56:37 -04:00