-
Notifications
You must be signed in to change notification settings - Fork 8
refactor(types): promote protocol types to agentex.protocol.* #371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
max-parke-scale
merged 5 commits into
next
from
maxparke/agx1-292-promote-protocol-types
May 27, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7590970
refactor(types): promote protocol types to agentex.protocol.*
max-parke-scale 348f608
fix(types): address Greptile review feedback
max-parke-scale d56d088
test(types): pin back-compat shim contract for agentex.lib.types.{acp…
max-parke-scale d1ad15f
fix(lint): sort imports in test_protocol_shims.py per ruff length-sort
max-parke-scale 9f237a0
docs(claude): document agentex.protocol/* canonical location + shim p…
max-parke-scale File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,116 +1,15 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from enum import Enum | ||
| from typing import Any | ||
|
|
||
| from pydantic import Field, BaseModel | ||
|
|
||
| from agentex.types.task import Task | ||
| from agentex.types.agent import Agent | ||
| from agentex.types.event import Event | ||
| from agentex.types.task_message_content import TaskMessageContent | ||
|
|
||
|
|
||
| class RPCMethod(str, Enum): | ||
| """Available JSON-RPC methods for agent communication.""" | ||
|
|
||
| EVENT_SEND = "event/send" | ||
| MESSAGE_SEND = "message/send" | ||
| TASK_CANCEL = "task/cancel" | ||
| TASK_CREATE = "task/create" | ||
|
|
||
|
|
||
| class CreateTaskParams(BaseModel): | ||
| """Parameters for task/create method. | ||
|
|
||
| Attributes: | ||
| agent: The agent that the task was sent to. | ||
| task: The task to be created. | ||
| params: The parameters for the task as inputted by the user. | ||
| request: Additional request context including headers forwarded to this agent. | ||
| """ | ||
|
|
||
| agent: Agent = Field(..., description="The agent that the task was sent to") | ||
| task: Task = Field(..., description="The task to be created") | ||
| params: dict[str, Any] | None = Field( | ||
| None, | ||
| description="The parameters for the task as inputted by the user", | ||
| ) | ||
| request: dict[str, Any] | None = Field( | ||
| default=None, | ||
| description="Additional request context including headers forwarded to this agent", | ||
| ) | ||
|
|
||
|
|
||
| class SendMessageParams(BaseModel): | ||
| """Parameters for message/send method. | ||
|
|
||
| Attributes: | ||
| agent: The agent that the message was sent to. | ||
| task: The task that the message was sent to. | ||
| content: The message that was sent to the agent. | ||
| stream: Whether to stream the message back to the agentex server from the agent. | ||
| request: Additional request context including headers forwarded to this agent. | ||
| """ | ||
|
|
||
| agent: Agent = Field(..., description="The agent that the message was sent to") | ||
| task: Task = Field(..., description="The task that the message was sent to") | ||
| content: TaskMessageContent = Field( | ||
| ..., description="The message that was sent to the agent" | ||
| ) | ||
| stream: bool = Field( | ||
| False, | ||
| description="Whether to stream the message back to the agentex server from the agent", | ||
| ) | ||
| request: dict[str, Any] | None = Field( | ||
| default=None, | ||
| description="Additional request context including headers forwarded to this agent", | ||
| ) | ||
|
|
||
|
|
||
| class SendEventParams(BaseModel): | ||
| """Parameters for event/send method. | ||
|
|
||
| Attributes: | ||
| agent: The agent that the event was sent to. | ||
| task: The task that the message was sent to. | ||
| event: The event that was sent to the agent. | ||
| request: Additional request context including headers forwarded to this agent. | ||
| """ | ||
|
|
||
| agent: Agent = Field(..., description="The agent that the event was sent to") | ||
| task: Task = Field(..., description="The task that the message was sent to") | ||
| event: Event = Field(..., description="The event that was sent to the agent") | ||
| request: dict[str, Any] | None = Field( | ||
| default=None, | ||
| description="Additional request context including headers forwarded to this agent", | ||
| ) | ||
|
|
||
|
|
||
| class CancelTaskParams(BaseModel): | ||
| """Parameters for task/cancel method. | ||
|
|
||
| Attributes: | ||
| agent: The agent that the task was sent to. | ||
| task: The task that was cancelled. | ||
| request: Additional request context including headers forwarded to this agent. | ||
| """ | ||
|
|
||
| agent: Agent = Field(..., description="The agent that the task was sent to") | ||
| task: Task = Field(..., description="The task that was cancelled") | ||
| request: dict[str, Any] | None = Field( | ||
| default=None, | ||
| description="Additional request context including headers forwarded to this agent", | ||
| ) | ||
|
|
||
|
|
||
| RPC_SYNC_METHODS = [ | ||
| RPCMethod.MESSAGE_SEND, | ||
| ] | ||
|
|
||
| PARAMS_MODEL_BY_METHOD: dict[RPCMethod, type[BaseModel]] = { | ||
| RPCMethod.EVENT_SEND: SendEventParams, | ||
| RPCMethod.TASK_CANCEL: CancelTaskParams, | ||
| RPCMethod.MESSAGE_SEND: SendMessageParams, | ||
| RPCMethod.TASK_CREATE: CreateTaskParams, | ||
| } | ||
| """Back-compat shim. The canonical location is :mod:`agentex.protocol.acp`. | ||
|
|
||
| Kept here so existing ``from agentex.lib.types.acp import ...`` imports | ||
| continue to work. New code should import from the canonical path. | ||
| """ | ||
|
|
||
| from agentex.protocol.acp import ( # noqa: F401 | ||
| RPC_SYNC_METHODS, | ||
| PARAMS_MODEL_BY_METHOD, | ||
| RPCMethod, | ||
| SendEventParams, | ||
| CancelTaskParams, | ||
| CreateTaskParams, | ||
| SendMessageParams, | ||
| ) | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.