Skip to content

refactor: introduce model-agnostic agent interfaces#323

Merged
tiann merged 3 commits intotiann:mainfrom
junmo-kim:refactor/generic-agent-interface
Mar 20, 2026
Merged

refactor: introduce model-agnostic agent interfaces#323
tiann merged 3 commits intotiann:mainfrom
junmo-kim:refactor/generic-agent-interface

Conversation

@junmo-kim
Copy link
Contributor

Overview

As HAPI expands its support for multiple AI models, this PR introduces a model-agnostic abstraction layer for agent communication. The goal is to improve code consistency and developer experience (DX) while keeping the existing communication schema intact for compatibility.

Key Changes

  1. Protocol Abstraction: Extracted the legacy 'codex' literal into a shared constant AGENT_MESSAGE_PAYLOAD_TYPE. This decouples the internal code from the specific wire format while keeping data packets identical to the current version.
  2. Generic Interface Alignment: Renamed internal methods like sendCodexMessage to sendAgentMessage within the CLI package to accurately reflect their role as a common interface for all supported agents.
  3. Historical Context: Added JSDoc documentation to provide clarity on the historical significance of the payload type identifier.

Rationale & Future Vision

This refactoring is a preparatory step for future protocol evolution. By centralizing the payload identifier, we create a Single Source of Truth (SSOT) that will simplify any eventual transition to a model-neutral identifier (e.g., a dedicated HAPI message schema) without scouring the entire codebase for hardcoded strings.

…D_TYPE

Encapsulates the 'codex' literal used in network payloads into a shared constant.
…AD_TYPE

Replaces communication payload literals with the shared constant for better maintainability.
Internal identifier cleanup for better developer experience.
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Findings

  • None.

Summary

  • Review mode: initial
  • No issues found. Residual risk: refactor-only change; no functional validation in this review.

Testing

  • Not run (automation)

@tiann tiann merged commit d76b1a6 into tiann:main Mar 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants