feat(cli): add Agent Client Protocol (ACP) integration for external agent support

Implements comprehensive ACP backend enabling integration with ACP-compliant agents like Gemini. Includes stdio transport, message handling, permission flow, and registry for agent management. Adds new 'hapi gemini' command to launch ACP agent sessions.
This commit is contained in:
weishu
2025-12-21 18:40:04 +08:00
parent 76a82c27c5
commit 56ae2c85a2
23 changed files with 1254 additions and 12 deletions
@@ -32,7 +32,10 @@ function isToolAllowedForSession(toolName: string, toolInput: unknown, allowedTo
}
function isCodexSession(metadata: SessionMetadataSummary | null, toolName: string): boolean {
return metadata?.flavor === 'codex' || toolName.startsWith('Codex')
return metadata?.flavor === 'codex'
|| metadata?.flavor === 'gemini'
|| toolName.startsWith('Codex')
|| toolName.startsWith('Gemini')
}
function formatPermissionSummary(permission: ToolPermission, toolName: string, toolInput: unknown, codex: boolean): string {