Commit Graph

296 Commits

Author SHA1 Message Date
q792602257 be8d5e3a1b feat(mcp,acp): Repository.WithTx + acp.Repository.InTx
Cross-module transactional support for spec §6.1: ACP CreateSession must
atomically insert acp_sessions row + mcp_tokens row (FK NOT NULL).

- mcp.Repository.WithTx(tx) -> Repository (tx-bound, no pool)
- acp.Repository.InTx(ctx, fn) -> error (pgx.BeginFunc wrapper)
- acp.Repository.WithTx(tx) -> Repository (tx-bound)
- Update fakeRepos in test files to satisfy new interface methods

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 12:40:54 +08:00
q792602257 62d9a91ca5 test(mcp): 13 PM tool tests + fix jsonschema tags
Add tools_pm_test.go with 13 integration tests covering all 16 PM
tools via SDK in-memory transport with fake services.

Fix jsonschema tags in tools_pm.go and tools_chat.go — SDK's tag
parser rejects "required,min=1" and "required,description=X" syntax;
use plain description text instead (non-pointer fields are auto-required).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 11:52:24 +08:00
q792602257 7d9164d478 feat(mcp): 16 PM tools + chat tool + 6 resource URIs + admin token UI
Phase F: tools_pm.go — list/get/create/update/close/reopen/assign for
projects, workspaces, requirements, issues (16 tools total).

Phase G: tools_chat.go — list_recent_messages tool; resources.go — 6 PM
resource URI templates (projects, project-detail, requirements, issues,
workspaces, workspace-detail).

Phase H: frontend admin UI — mcpTokens API client, Pinia store,
MCPTokenAdminView with create/revoke/list, router entry, NavBar link.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 11:27:47 +08:00
q792602257 d0efe2bdd4 feat(mcp): admin token CRUD HTTP handler (POST/GET/DELETE) + TokenService.List/GetByID
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 11:04:37 +08:00
q792602257 2d6521e610 feat(mcp): prompts registration via RegisterSystemPrompts (system-scope only)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 10:52:54 +08:00
q792602257 5cccc97edd feat(app): wire MCP module — repo/service/ratelimiter/server + transport mount + AuditWrap
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 10:44:17 +08:00
q792602257 6ce21d178e feat(mcp): mount Streamable HTTP + legacy SSE transports with auth+ratelimit
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 10:37:48 +08:00
q792602257 5fd4eab7ca feat(mcp): audit recorder wrapper injecting via_mcp + mcp_token_id from ctx
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 10:35:44 +08:00
q792602257 d6279c6ee1 feat(mcp): scope check helpers (CheckToolFromCtx + CheckProjectFromCtx)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 10:34:54 +08:00
q792602257 59e0138e7c feat(mcp): CallerResolver (AuthSession -> project.Caller bridge)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 10:34:47 +08:00
q792602257 319b3a8baa feat(mcp): add MCP Go SDK v1.6.0 + NewMCPServer scaffold with register stubs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 10:34:08 +08:00
q792602257 a00f5a9efd refactor(mcp): apply Part 1 review I1+I3+I4+I5
- Rename MCPToken -> Token (mcp.Token reads cleaner; zero external callers yet)
- IssueSystemToken: guard against nil ACPSessionID / UserID (early input validation)
- TokenService: inject now func for clock injection (parity with RateLimiter)
- Repository CHECK constraint tests: assert wrapped CodeInternal

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 10:28:49 +08:00
q792602257 980c6fcf0e models 2026-05-08 08:57:09 +08:00
q792602257 71a3a85b26 fix(mcp): code review I2 — admin expires_at must be future + Part 3 tx TODO + scope JSON round-trip tests
- IssueAdmin now rejects past/now ExpiresAt with CodeMcpTokenExpiresRequired
- TestIssueAdmin_ExpiresMustBeFuture covers the new path
- IssueSystemToken doc comment notes pgRepo currently ignores ctx tx; Part 3
  must add Repository.WithTx for true same-transaction guarantee with
  acp_sessions (spec §6.1)
- New scope_test.go (whitebox) verifies JSON round-trip preserves nil-vs-empty
  semantics on Tools / ProjectIDs and exercises AllowsTool / AllowsProject
  edges that Authenticate / future tool gating depend on
2026-05-08 08:30:26 +08:00
q792602257 c046d77a6e test(mcp): auth middleware + rate limiter tests 2026-05-08 08:11:02 +08:00
q792602257 e1e6508c4c feat(mcp): rate limit middleware (per-token + global token bucket, 1-min window) 2026-05-08 08:08:13 +08:00
q792602257 416a7d5023 feat(mcp): auth middleware (Bearer + ?token= fallback) 2026-05-08 08:06:41 +08:00
q792602257 8031579487 test(mcp): TokenService unit tests with fake repo 2026-05-08 08:04:54 +08:00
q792602257 7d9cd4bf6b feat(mcp): TokenService.Revoke + RevokeBySession (with audit) 2026-05-08 08:02:11 +08:00
q792602257 796e1e0d4c feat(mcp): TokenService.Authenticate (hash lookup + revoked/expired check + async last_used) 2026-05-08 08:00:35 +08:00
q792602257 0081ad6e49 feat(mcp): TokenService.IssueSystemToken (with default scope + 24h TTL) 2026-05-08 07:59:00 +08:00
q792602257 d1573bde09 feat(mcp): TokenService skeleton + IssueAdmin 2026-05-08 07:57:17 +08:00
q792602257 4071778930 test(mcp): RevokeBySession + ReapStaleSystemTokens integration 2026-05-08 07:27:59 +08:00
q792602257 d431b8103d test(mcp): repository CRUD + CHECK constraints + filter + purge integration 2026-05-08 07:25:21 +08:00
q792602257 bb512c0029 feat(mcp): repository RevokeBySession + ReapStaleSystemTokens + PurgeExpired 2026-05-08 07:22:16 +08:00
q792602257 21f29a68b5 feat(mcp): repository List + UpdateLastUsed + Revoke + DeleteByID 2026-05-08 07:20:19 +08:00
q792602257 3d16e4a877 feat(mcp): repository skeleton + Create + GetByHash + GetByID 2026-05-08 07:18:09 +08:00
q792602257 ce586a43ee docs(config): example mcp section (default values) 2026-05-08 07:15:45 +08:00
q792602257 30a85d1b2d feat(config): add MCPConfig (enabled / public_url / system_token_ttl / rate_limit) 2026-05-08 07:14:24 +08:00
q792602257 29b4c50888 feat(mcp): plaintext token generator + SHA-256 hash helper 2026-05-08 07:12:43 +08:00
q792602257 a3710c8645 feat(mcp): domain types — Issuer / Scope / MCPToken + helpers 2026-05-08 07:11:03 +08:00
q792602257 b1db7841c7 feat(errs): add 8 MCP error codes + HTTPStatus mapping 2026-05-08 07:09:26 +08:00
q792602257 39f57df882 feat(mcp): sqlc queries for mcp_tokens (CRUD + revoke + reaper + purge) 2026-05-08 07:07:47 +08:00
q792602257 6e43792bd6 feat(mcp): register mcpsqlc package in sqlc.yaml 2026-05-08 07:05:37 +08:00
q792602257 a46075fc5e feat(mcp): add migration 0007 down — drop mcp_tokens 2026-05-08 07:04:38 +08:00
q792602257 f9f5c15345 feat(mcp): add migration 0007 up — mcp_tokens table 2026-05-08 07:03:24 +08:00
q792602257 08f530bc0a Merge feat/acp: ACP module (Agent Client Protocol) — Phases D-K 2026-05-07 18:50:02 +08:00
q792602257 a666ee8f08 fix(web): SessionStatusBadge add default case to satisfy vue/return-in-computed-property 2026-05-07 18:23:02 +08:00
q792602257 508b73c381 test(web): useAcpStream composable (connect/state/reconnect/prompt/close) 2026-05-07 18:19:19 +08:00
q792602257 ce53c54fde test(acp): integration matrix scaffold + 3 implemented scenarios (CreateSuccess/Quota/BranchConflict) 2026-05-07 18:18:08 +08:00
q792602257 48be59cc73 test(web): smoke tests for ACP session list/create views 2026-05-07 18:14:40 +08:00
q792602257 422e730502 feat(web): register acp-sessions routes + fix route param convention to slug/wsSlug 2026-05-07 18:07:19 +08:00
q792602257 d558aed27e feat(web): AcpSessionDetailView (core: status + stream + prompt) 2026-05-07 18:03:33 +08:00
q792602257 0b903168c8 feat(web): useAcpStream composable (auto-reconnect + ?since= + prompt/cancel) 2026-05-07 17:59:07 +08:00
q792602257 fc8f2db5d2 feat(web): AcpSessionCreateView (form with branch/issue/req fields) 2026-05-07 17:57:47 +08:00
q792602257 2ca3a81838 feat(web): AcpSessionListView (table with terminate action) 2026-05-07 17:55:45 +08:00
q792602257 22e3c6cbf3 feat(web): PromptInput component (Send/Cancel toggle) 2026-05-07 17:52:06 +08:00
q792602257 fa43d2ed32 feat(web): AgentEventCard component (per-method rendering) 2026-05-07 17:52:02 +08:00
q792602257 fdd6fd7111 docs(config): document webhook topics whitelist + add acp.session_crashed example 2026-05-07 17:49:11 +08:00
q792602257 faebfc3135 feat(app): wire acp_events_purge runner into jobs scheduler 2026-05-07 17:47:50 +08:00