Files
oh-my-pi/python/omp-rpc/src/omp_rpc/__init__.py
T
can1357 d1d0187859 feat(omp-rpc): introduced host tool execution framework with custom tool registration
- Added host tool execution framework with HostTool, HostToolContext, and host_tool() factory for custom tool integration.
- Added RpcConcurrencyError exception and _PromptLifecycleCoordinator to enforce single-flight constraint on prompt lifecycle methods.
- Enhanced JSON parsing with 10 validation helpers and enum frozensets for safe field extraction with detailed error messages.
- Replaced manual event/error list management with _BoundedHistory for bounded-size history with offset tracking.
- Added deep JSON cloning to prevent external mutations of stored payloads and improved UTF-8 error handling in subprocess stderr.
- Added custom_tools parameter to RpcClient and set_custom_tools() method for runtime tool registration.
2026-04-08 06:28:27 +02:00

166 lines
3.7 KiB
Python

from .client import (
AgentEventListener,
ExtensionErrorListener,
ListenerErrorEvent,
ListenerErrorListener,
NotificationListener,
PromptTurn,
ReadyListener,
RpcClient,
RpcCommandError,
RpcConcurrencyError,
RpcError,
RpcProcessExitError,
RpcProtocolError,
RpcTimeoutError,
ProtocolErrorListener,
UiRequestListener,
)
from .host_tools import HostTool, HostToolContext, HostToolResultPayload, HostToolResultValue, host_tool
from .protocol import (
AgentEndEvent,
AgentMessage,
AssistantMessage,
AssistantMessageEvent,
AutoCompactionEndEvent,
AutoCompactionStartEvent,
AutoRetryEndEvent,
AutoRetryStartEvent,
BashResult,
BranchMessage,
BranchResult,
CancellationResult,
CompactionResult,
CompactionSummaryMessage,
CustomMessage,
DeveloperMessage,
ExtensionError,
ExtensionUiRequest,
FileMentionMessage,
HookMessage,
ImageContent,
MessageEndEvent,
MessageStartEvent,
MessageUpdateEvent,
ModelCycleResult,
ModelInfo,
ModelCost,
PythonExecutionMessage,
ReadyEvent,
RetryFallbackAppliedEvent,
RetryFallbackSucceededEvent,
RpcAgentEvent,
RpcNotification,
SessionState,
SessionStats,
ThinkingConfig,
ThinkingLevel,
ThinkingLevelCycleResult,
TodoAutoClearEvent,
TodoItem,
TodoPhase,
TodoReminderEvent,
TodoStatus,
ToolDescriptor,
ToolExecutionEndEvent,
ToolExecutionStartEvent,
ToolExecutionUpdateEvent,
ToolResultMessage,
TurnEndEvent,
TurnStartEvent,
UnknownNotification,
UserMessage,
assistant_text,
assistant_text_with_thinking,
image_from_path,
message_text,
message_text_with_thinking,
parse_notification,
parse_session_state,
parse_todo_phases,
)
__all__ = [
"AgentEventListener",
"AgentEndEvent",
"AgentMessage",
"AssistantMessage",
"AssistantMessageEvent",
"AutoCompactionEndEvent",
"AutoCompactionStartEvent",
"AutoRetryEndEvent",
"AutoRetryStartEvent",
"BashResult",
"BranchMessage",
"BranchResult",
"CancellationResult",
"CompactionResult",
"CompactionSummaryMessage",
"CustomMessage",
"DeveloperMessage",
"ExtensionError",
"ExtensionErrorListener",
"ExtensionUiRequest",
"FileMentionMessage",
"HostTool",
"HostToolContext",
"HostToolResultPayload",
"HostToolResultValue",
"HookMessage",
"ImageContent",
"ListenerErrorEvent",
"ListenerErrorListener",
"MessageEndEvent",
"MessageStartEvent",
"MessageUpdateEvent",
"ModelCost",
"ModelCycleResult",
"ModelInfo",
"NotificationListener",
"PromptTurn",
"ProtocolErrorListener",
"PythonExecutionMessage",
"ReadyEvent",
"ReadyListener",
"RetryFallbackAppliedEvent",
"RetryFallbackSucceededEvent",
"RpcAgentEvent",
"RpcClient",
"RpcCommandError",
"RpcConcurrencyError",
"RpcError",
"RpcNotification",
"RpcProcessExitError",
"RpcProtocolError",
"RpcTimeoutError",
"SessionState",
"SessionStats",
"ThinkingConfig",
"ThinkingLevel",
"ThinkingLevelCycleResult",
"TodoAutoClearEvent",
"TodoItem",
"TodoPhase",
"TodoReminderEvent",
"TodoStatus",
"ToolDescriptor",
"ToolExecutionEndEvent",
"ToolExecutionStartEvent",
"ToolExecutionUpdateEvent",
"ToolResultMessage",
"TurnEndEvent",
"TurnStartEvent",
"UiRequestListener",
"UnknownNotification",
"UserMessage",
"assistant_text",
"assistant_text_with_thinking",
"image_from_path",
"message_text",
"message_text_with_thinking",
"parse_notification",
"parse_session_state",
"parse_todo_phases",
"host_tool",
]