feat(acp): implement F102 transparent ACP agent server#362
Merged
Conversation
b485ef9 to
0e5120c
Compare
- `.awf.yaml`: Add ACP server workflow configuration - `.gitignore`: Exclude ACP runtime artifacts - `.go-arch-lint.yml`: Register acp infrastructure and acpserver packages with dependency rules - `.zpm/kb/default/knowledge.pl`: Add project knowledge facts for F102 implementation - `.zpm/kb/feedback/knowledge.pl`: Add learned rules from F102 review - `.zpm/kb/pr_feature_f102_acp_transparent_agent_server/knowledge.pl`: Add PR-scoped tracking facts - `.zpm/mounts.json`: Mount pr_feature_f102 segment - `CHANGELOG.md`: Document F102 ACP transparent agent server release - `CLAUDE.md`: Add architecture rules learned during F102 implementation - `README.md`: Mention ACP server capability - `docs/ADR/018-acp-transparent-agent-server-protocol.md`: Add ADR for ACP JSON-RPC protocol design - `docs/ADR/README.md`: Register ADR-018 - `docs/user-guide/acp-server.md`: Add ACP server user guide - `docs/user-guide/agent-steps.md`: Document ACP-aware step configuration - `docs/user-guide/api.md`: Add pack workflow execution via REST API - `docs/user-guide/workflow-packs.md`: Add ACP command registration for pack workflows - `docs/superpowers/plans/2026-05-31-acp-full-execution-stack.md`: Add full execution stack plan - `go.mod`: Add acpserver package dependency - `internal/application/acp_errors.go`: Define ACP-specific domain error types - `internal/application/acp_session.go`: Implement ACPSession with parking and continuation support - `internal/application/acp_session_service.go`: Implement ACPSessionService with workflow catalog and multi-turn routing - `internal/application/acp_session_service_concurrency_test.go`: Add concurrency tests for session service - `internal/application/acp_session_service_parking_test.go`: Add parking/continuation workflow tests - `internal/application/acp_session_service_test.go`: Add comprehensive session service unit tests - `internal/application/acp_session_test.go`: Add ACPSession unit tests - `internal/application/acp_audit_fixes_test.go`: Add audit-driven regression tests - `internal/application/execution_service.go`: Wire renderer factory for ACP streaming output - `internal/application/execution_service_render_test.go`: Test renderer injection in execution service - `internal/application/execution_setup.go`: Add ACP context propagation in execution setup - `internal/application/service.go`: Expose ACPSessionService from application service - `internal/domain/errors/codes.go`: Add ACP error codes (ErrACPSessionNotFound, ErrACPBadRequest) - `internal/domain/ports/acp_client.go`: Define ACPClient port interface - `internal/domain/ports/acp_client_test.go`: Test ACP client port contract - `internal/domain/ports/logger.go`: Add ACP-specific log fields - `internal/domain/ports/repository.go`: Add WorkflowEntryLister port for ACP catalog - `internal/domain/workflow/entry.go`: Add ACP name conversion utilities for pack workflows - `internal/domain/workflow/entry_test.go`: Test ACP name round-trip mapping - `internal/domain/workflow/agent_role.go`: Extend role with ACP metadata - `internal/infrastructure/acp/doc.go`: Document ACP infrastructure package architecture - `internal/infrastructure/acp/event_projector.go`: Implement streaming event projector for ACP output - `internal/infrastructure/acp/fanout_publisher.go`: Implement fan-out SSE publisher for concurrent subscribers - `internal/infrastructure/acp/input_reader.go`: Implement blocking ACP input reader for conversation turns - `internal/infrastructure/acp/message.go`: Define ACP JSON-RPC message envelope types - `internal/infrastructure/acp/renderer.go`: Implement ACP event renderer bridging display events to JSON-RPC - `internal/infrastructure/agents/base_cli_provider.go`: Pass render callback through provider execution - `internal/infrastructure/repository/composite_repository.go`: Add WorkflowEntryLister to composite - `internal/infrastructure/repository/yaml_repository.go`: Implement path-traversal-safe workflow loading - `internal/infrastructure/repository/yaml_repository_path_traversal_test.go`: Test path traversal prevention - `internal/infrastructure/roles/doc.go`: Document roles infrastructure package - `internal/infrastructure/roles/filesystem_repository.go`: Harden role loading against path traversal - `internal/infrastructure/skills/filesystem_repository.go`: Harden skill loading against path traversal - `internal/infrastructure/workflowpkg/discoverer.go`: Fix context cancellation bug blocking pack discovery - `internal/infrastructure/workflowpkg/manifest.go`: Expose pack workflow entries for ACP catalog - `internal/infrastructure/xdg/xdg.go`: Add XDG roles directory resolution - `internal/interfaces/api/bridge.go`: Wire ACPSessionService into REST API bridge - `internal/interfaces/api/handlers_executions.go`: Add pack workflow execution handler - `internal/interfaces/api/handlers_workflows.go`: Add pack workflow listing handler - `internal/interfaces/api/routing.go`: Extract route registration to dedicated file - `internal/interfaces/api/types.go`: Add pack workflow API response types - `internal/interfaces/cli/acp_serve.go`: Implement `awf acp-serve` command with full lifecycle - `internal/interfaces/cli/acp_wiring.go`: Wire ACPSessionService dependencies from CLI context - `internal/interfaces/cli/pack_resolver.go`: Fix pack workflow name resolution for ACP commands - `internal/interfaces/cli/root.go`: Register acp-serve subcommand - `internal/interfaces/cli/serve.go`: Share port flag with acp-serve - `internal/interfaces/cli/ui/agent_renderer.go`: Extend renderer with ACP streaming mode - `internal/interfaces/cli/validate.go`: Add role validation support - `internal/interfaces/tui/command.go`: Add ACP session command to TUI - `internal/interfaces/tui/tab_workflows.go`: Show pack workflows in TUI workflow tab - `internal/testutil/env.go`: Add environment variable test helpers - `internal/testutil/mocks/mocks.go`: Add ACPClient and WorkflowEntryLister mocks - `pkg/acpserver/doc.go`: Document acpserver public package architecture - `pkg/acpserver/protocol.go`: Define JSON-RPC 2.0 protocol framing - `pkg/acpserver/server.go`: Implement ACP HTTP/SSE server with session lifecycle - `pkg/acpserver/types.go`: Define ACP session and message public types - `pkg/display/renderer_context.go`: Add renderer context carrier for dependency injection - `pkg/validation/name.go`: Add workflow name validation utilities - `tests/fixtures/acp/`: Add ACP test fixtures (valid/malformed JSON, workflow YAMLs) - `tests/fixtures/api/packs/speckit/`: Add pack fixture for API integration tests - `tests/integration/acp/acp_jsonrpc_e2e_test.go`: Add JSON-RPC end-to-end integration tests - `tests/integration/acp/acp_goroutine_leak_test.go`: Add goroutine leak integration tests - `tests/integration/acp/testhelpers_test.go`: Add ACP integration test helpers - `tests/integration/api/pack_workflow_test.go`: Add pack workflow REST API integration tests Closes #360
0e5120c to
dec6bcc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pkg/acpserverlibrary (JSON-RPC framing, SSE fanout, event projection, input bridging) and a newawf acp-serveCLI command with complete wiring, tests, and architecture validationChanges
ACP Server Core (
pkg/acpserver)pkg/acpserver/server.go: New JSON-RPC 2.0 server over stdio with session lifecycle, tool dispatch, and graceful shutdownpkg/acpserver/protocol.go: ACP protocol types and JSON-RPC envelope definitionspkg/acpserver/types.go: Shared value types for ACP request/response payloadspkg/acpserver/doc.go: Package documentation with architecture overview, protocol invariants, and usage patternspkg/acpserver/server_test.go,pkg/acpserver/protocol_test.go,pkg/acpserver/types_test.go: Full unit test coveragepkg/acpserver/goroutine_leak_test.go: Goroutine leak detector ensuring server shutdown is cleanpkg/acpserver/architecture_test.go: Architecture constraint tests (no external dependencies)pkg/acpserver/writeframe_internal_test.go: Internal frame-writing path testsACP Infrastructure (
internal/infrastructure/acp)internal/infrastructure/acp/doc.go: Package documentation with adapter patterns and SSE lifecycleinternal/infrastructure/acp/event_projector.go: Projects domain workflow events onto ACP SSE streamsinternal/infrastructure/acp/fanout_publisher.go: Fan-out SSE publisher delivering events to all connected ACP clientsinternal/infrastructure/acp/input_reader.go: Bridges ACP turn continuations into the workflowUserInputReaderportinternal/infrastructure/acp/message.go: ACP message construction helpersinternal/infrastructure/acp/renderer.go: ACP-aware display renderer translating domain events to ACP protocol messagesinternal/infrastructure/acp/*_test.go: Full unit test coverage for all adapters (734+ lines for renderer alone)ACP Application Layer
internal/application/acp_session.go: ACP session entity managing per-connection lifecycle and run stateinternal/application/acp_session_service.go: Service orchestrating session creation, workflow dispatch, multi-turn parking, and shutdown (954 lines)internal/application/acp_errors.go: ACP-specific error types and JSON-RPC error code mappinginternal/application/acp_session_service_test.go: Comprehensive unit tests for session service (970 lines)internal/application/acp_session_service_concurrency_test.go: Concurrency and race-condition testsinternal/application/acp_session_service_parking_test.go: Multi-turn workflow parking and continuation testsinternal/application/acp_session_test.go: Session entity testsinternal/application/acp_audit_fixes_test.go: Audit-driven regression tests for identified quality findingsACP CLI Command
internal/interfaces/cli/acp_serve.go:awf acp-servecommand implementation with flag parsing, server startup, and signal handling (436 lines)internal/interfaces/cli/acp_wiring.go: Dependency wiring for ACP server — assembles all infrastructure adapters and injects into session serviceinternal/interfaces/cli/acp_serve_test.go: CLI command unit testsinternal/interfaces/cli/acp_serve_statestore_test.go: State store integration tests for ACP serve pathinternal/interfaces/cli/acp_wiring_test.go: Wiring correctness testsinternal/interfaces/cli/root.go: Registeracp-servesubcommandinternal/interfaces/cli/serve.go: Add ACP serve to top-level serve groupDomain Ports & Errors
internal/domain/ports/acp_client.go:ACPClientport interface (session callbacks, event push, input request)internal/domain/ports/acp_client_test.go: Port contract testsinternal/domain/ports/logger.go: Add ACP-related log level constantsinternal/domain/ports/repository.go: Extend repository interface with pack workflow listing for ACP cataloginternal/domain/ports/repository_test.go: Repository interface testsinternal/domain/errors/codes.go: Add ACP error codes (SessionNotFound, WorkflowNotFound, InvalidCommand)internal/domain/errors/codes_test.go: Error code testsinternal/domain/workflow/agent_role.go: Add role fields needed for ACP session contextinternal/domain/workflow/entry.go: AddEntryNames()helper for ACP workflow catalog constructioninternal/domain/workflow/entry_test.go: Entry helper testsExecution Service & Application Service
internal/application/execution_service.go: Inject ACP renderer factory; route ACP-mode executions through dedicated display pipelineinternal/application/execution_service_render_test.go: Renderer injection testsinternal/application/execution_setup.go: Wire ACP renderer context into execution setupinternal/application/execution_setup_test.go: Execution setup testsinternal/application/service.go: ExposeListAllWorkflowsfor ACP catalog; add pack discovery delegationinternal/application/service_test.go: Service-layer catalog testsinternal/application/loop_executor_core_test.go: Update loop executor tests for new execution context shapeinternal/application/plugin_service_interface_test.go: Plugin service interface alignmentinternal/application/role_loader_test.go: Role loader tests (213 new lines)Pack Discovery for ACP
internal/infrastructure/workflowpkg/discoverer.go: Expose pack workflows to ACP catalog with slash-safe name encodinginternal/infrastructure/workflowpkg/discoverer_test.go: Pack discoverer tests (344 lines)internal/infrastructure/workflowpkg/manifest.go: Add manifest helpers for ACP name round-trip mappinginternal/infrastructure/workflowpkg/manifest_test.go: Manifest testsREST API Integration
internal/interfaces/api/routing.go: Extract route registration to separate file for cleaner compositioninternal/interfaces/api/routing_test.go: Route registration testsinternal/interfaces/api/bridge.go: Wire pack workflow execution through REST API bridgeinternal/interfaces/api/bridge_test.go: Bridge testsinternal/interfaces/api/handlers_executions.go: Handle pack workflow execution requestsinternal/interfaces/api/handlers_executions_test.go: Execution handler testsinternal/interfaces/api/handlers_workflows.go: List pack workflows via REST APIinternal/interfaces/api/handlers_workflows_test.go: Workflow handler testsinternal/interfaces/api/doc.go: Updated API package documentationinternal/interfaces/api/server_test.go,internal/interfaces/api/sse_test.go: Updated server and SSE testsinternal/interfaces/api/types.go: Add pack workflow response typesInfrastructure: Roles, Skills, Repository, XDG
internal/infrastructure/roles/doc.go: Package documentation for roles infrastructureinternal/infrastructure/roles/filesystem_repository.go: Path traversal hardening and XDG roles dir supportinternal/infrastructure/roles/filesystem_repository_test.go: Role repository testsinternal/infrastructure/skills/filesystem_repository.go: Align with roles repository patternsinternal/infrastructure/skills/filesystem_repository_test.go: Skills repository testsinternal/infrastructure/repository/composite_repository.go: Add pack source to composite repositoryinternal/infrastructure/repository/composite_repository_test.go: Composite repository testsinternal/infrastructure/repository/source.go: Remove obsolete source fieldinternal/infrastructure/repository/yaml_repository.go: Path traversal validation improvementsinternal/infrastructure/repository/yaml_repository_path_traversal_test.go: Path traversal attack testsinternal/infrastructure/xdg/xdg.go: Add roles directory resolutioninternal/infrastructure/xdg/xdg_roles_dir_test.go: XDG roles dir testsinternal/infrastructure/xdg/xdg_test.go: XDG test updatesinternal/infrastructure/agents/base_cli_provider.go: Attach render context for ACP output routinginternal/infrastructure/agents/base_cli_provider_render_test.go: Render context injection testsCLI: Pack Resolver, Validate, TUI, Workflow Command
internal/interfaces/cli/pack_resolver.go: Resolve pack workflow name from ACP slash-safe encodinginternal/interfaces/cli/pack_resolver_test.go: Pack resolver testsinternal/interfaces/cli/validate.go: Add ACP command name validation helpersinternal/interfaces/cli/validate_helpers_test.go: Validate helper testsinternal/interfaces/cli/validate_role_test.go: Role validation testsinternal/interfaces/cli/workflow_cmd.go: Wire pack resolver for workflow executioninternal/interfaces/cli/workflow_cmd_test.go: Workflow command testsinternal/interfaces/cli/mcp_serve_test.go: MCP serve test alignmentinternal/interfaces/cli/run_pack_wiring_test.go: Pack wiring testsinternal/interfaces/cli/root_test.go: Root command registration testsinternal/interfaces/cli/ui/agent_renderer.go: ACP render mode in agent rendererinternal/interfaces/tui/command.go: Add ACP serve entry to TUI command listinternal/interfaces/tui/command_test.go: TUI command testsinternal/interfaces/tui/tab_workflows.go: Display pack workflows in TUI workflows tabinternal/interfaces/tui/tab_workflows_test.go: TUI workflows tab testsShared Packages
pkg/display/event.go: Add ACP event typespkg/display/renderer_context.go: NewRendererContextcarrying ACP vs CLI render modepkg/display/renderer_context_test.go: Renderer context testspkg/validation/name.go: ACP command name validation and slash-safe encoding/decoding utilitiespkg/validation/name_test.go: Name validation testsTests, Fixtures & Integration
tests/integration/acp/acp_jsonrpc_e2e_test.go: End-to-end JSON-RPC integration tests over stdio (358 lines)tests/integration/acp/acp_goroutine_leak_test.go: Integration-level goroutine leak teststests/integration/acp/testhelpers_test.go: ACP integration test helperstests/integration/api/pack_workflow_test.go: REST API pack workflow integration tests (298 lines)tests/integration/api/functional_test.go,tests/integration/api/server_integration_test.go: API integration test updatestests/fixtures/acp/valid.json,tests/fixtures/acp/malformed.json: ACP protocol message fixturestests/fixtures/acp/workflows/trivial.yaml,tests/fixtures/acp/workflows/long-running.yaml,tests/fixtures/acp/workflows/input-echo.yaml: ACP test workflow fixturestests/fixtures/api/packs/speckit/manifest.yaml,tests/fixtures/api/packs/speckit/state.json,tests/fixtures/api/packs/speckit/workflows/specify.yaml: REST API pack fixturesinternal/testutil/env.go: Test environment helpersinternal/testutil/mocks/mocks.go: Additional mock implementationsArchitecture & Configuration
.go-arch-lint.yml: Registerpkg-acpserverandinfra-acpcomponents with dependency rules.zpm/kb/default/knowledge.pl,.zpm/kb/feedback/knowledge.pl,.zpm/kb/pr_feature_f102_acp_transparent_agent_server/knowledge.pl: ZPM knowledge base entries for F102 decisions and feedback rules.zpm/kb/feedback/journal.wal,.zpm/kb/pr_feature_f102_acp_transparent_agent_server/journal.wal: ZPM WAL journals.zpm/mounts.json: Mount PR-scoped ZPM segment for F102.awf.yaml: Set log level to debug during development.gitignore: Ignore.awf/storage/states/and.awf/storage/logs/go.mod: Add new dependencies for ACP server packageDocumentation
docs/ADR/018-acp-transparent-agent-server-protocol.md: Architecture Decision Record for ACP protocol choice and design tradeoffsdocs/ADR/README.md: Register ADR-018docs/user-guide/acp-server.md: Full user guide forawf acp-servecommanddocs/user-guide/api.md: Document pack workflow REST API endpointsdocs/user-guide/agent-steps.md: Document ACP-specific agent step behaviordocs/user-guide/workflow-packs.md: Document ACP slash command integration for packsdocs/user-guide/workflow-syntax.md: Minor syntax clarificationsdocs/reference/error-codes.md: Add ACP error codesdocs/README.md: Link to new ACP server guidedocs/superpowers/plans/2026-05-31-acp-full-execution-stack.md: Implementation plan documentCHANGELOG.md: F102 release notesCLAUDE.md: Updated architecture rules from F102 learningsREADME.md: Mention ACP server in feature listTest plan
make buildpasses andawf acp-serve --helpshows the command with expected flagsecho '{"jsonrpc":"2.0","id":1,"method":"session/new","params":{}}' | awf acp-servereturns a valid JSON-RPC session response listing available workflows as slash commandsmake testpasses with zero failures and race detector clean (make test-race)make lintreports zero violationsCloses #360
Generated with awf commit workflow