agentpool 2.1.9__py3-none-any.whl → 2.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- acp/__init__.py +13 -4
- acp/acp_requests.py +20 -77
- acp/agent/connection.py +8 -0
- acp/agent/implementations/debug_server/debug_server.py +6 -2
- acp/agent/protocol.py +6 -0
- acp/bridge/README.md +15 -2
- acp/bridge/__init__.py +3 -2
- acp/bridge/__main__.py +60 -19
- acp/bridge/ws_server.py +173 -0
- acp/bridge/ws_server_cli.py +89 -0
- acp/client/connection.py +38 -29
- acp/client/implementations/default_client.py +3 -2
- acp/client/implementations/headless_client.py +2 -2
- acp/connection.py +2 -2
- acp/notifications.py +20 -50
- acp/schema/__init__.py +2 -0
- acp/schema/agent_responses.py +21 -0
- acp/schema/client_requests.py +3 -3
- acp/schema/session_state.py +63 -29
- acp/stdio.py +39 -9
- acp/task/supervisor.py +2 -2
- acp/transports.py +362 -2
- acp/utils.py +17 -4
- agentpool/__init__.py +6 -1
- agentpool/agents/__init__.py +2 -0
- agentpool/agents/acp_agent/acp_agent.py +407 -277
- agentpool/agents/acp_agent/acp_converters.py +196 -38
- agentpool/agents/acp_agent/client_handler.py +191 -26
- agentpool/agents/acp_agent/session_state.py +17 -6
- agentpool/agents/agent.py +607 -572
- agentpool/agents/agui_agent/__init__.py +0 -2
- agentpool/agents/agui_agent/agui_agent.py +176 -110
- agentpool/agents/agui_agent/agui_converters.py +0 -131
- agentpool/agents/agui_agent/helpers.py +3 -4
- agentpool/agents/base_agent.py +632 -17
- agentpool/agents/claude_code_agent/FORKING.md +191 -0
- agentpool/agents/claude_code_agent/__init__.py +13 -1
- agentpool/agents/claude_code_agent/claude_code_agent.py +1058 -291
- agentpool/agents/claude_code_agent/converters.py +74 -143
- agentpool/agents/claude_code_agent/history.py +474 -0
- agentpool/agents/claude_code_agent/models.py +77 -0
- agentpool/agents/claude_code_agent/static_info.py +100 -0
- agentpool/agents/claude_code_agent/usage.py +242 -0
- agentpool/agents/context.py +40 -0
- agentpool/agents/events/__init__.py +24 -0
- agentpool/agents/events/builtin_handlers.py +67 -1
- agentpool/agents/events/event_emitter.py +32 -2
- agentpool/agents/events/events.py +104 -3
- agentpool/agents/events/infer_info.py +145 -0
- agentpool/agents/events/processors.py +254 -0
- agentpool/agents/interactions.py +41 -6
- agentpool/agents/modes.py +67 -0
- agentpool/agents/slashed_agent.py +5 -4
- agentpool/agents/tool_call_accumulator.py +213 -0
- agentpool/agents/tool_wrapping.py +18 -6
- agentpool/common_types.py +56 -21
- agentpool/config_resources/__init__.py +38 -1
- agentpool/config_resources/acp_assistant.yml +2 -2
- agentpool/config_resources/agents.yml +3 -0
- agentpool/config_resources/agents_template.yml +1 -0
- agentpool/config_resources/claude_code_agent.yml +10 -6
- agentpool/config_resources/external_acp_agents.yml +2 -1
- agentpool/delegation/base_team.py +4 -30
- agentpool/delegation/pool.py +136 -289
- agentpool/delegation/team.py +58 -57
- agentpool/delegation/teamrun.py +51 -55
- agentpool/diagnostics/__init__.py +53 -0
- agentpool/diagnostics/lsp_manager.py +1593 -0
- agentpool/diagnostics/lsp_proxy.py +41 -0
- agentpool/diagnostics/lsp_proxy_script.py +229 -0
- agentpool/diagnostics/models.py +398 -0
- agentpool/functional/run.py +10 -4
- agentpool/mcp_server/__init__.py +0 -2
- agentpool/mcp_server/client.py +76 -32
- agentpool/mcp_server/conversions.py +54 -13
- agentpool/mcp_server/manager.py +34 -54
- agentpool/mcp_server/registries/official_registry_client.py +35 -1
- agentpool/mcp_server/tool_bridge.py +186 -139
- agentpool/messaging/__init__.py +0 -2
- agentpool/messaging/compaction.py +72 -197
- agentpool/messaging/connection_manager.py +11 -10
- agentpool/messaging/event_manager.py +5 -5
- agentpool/messaging/message_container.py +6 -30
- agentpool/messaging/message_history.py +99 -8
- agentpool/messaging/messagenode.py +52 -14
- agentpool/messaging/messages.py +54 -35
- agentpool/messaging/processing.py +12 -22
- agentpool/models/__init__.py +1 -1
- agentpool/models/acp_agents/base.py +6 -24
- agentpool/models/acp_agents/mcp_capable.py +126 -157
- agentpool/models/acp_agents/non_mcp.py +129 -95
- agentpool/models/agents.py +98 -76
- agentpool/models/agui_agents.py +1 -1
- agentpool/models/claude_code_agents.py +144 -19
- agentpool/models/file_parsing.py +0 -1
- agentpool/models/manifest.py +113 -50
- agentpool/prompts/conversion_manager.py +1 -1
- agentpool/prompts/prompts.py +5 -2
- agentpool/repomap.py +1 -1
- agentpool/resource_providers/__init__.py +11 -1
- agentpool/resource_providers/aggregating.py +56 -5
- agentpool/resource_providers/base.py +70 -4
- agentpool/resource_providers/codemode/code_executor.py +72 -5
- agentpool/resource_providers/codemode/helpers.py +2 -2
- agentpool/resource_providers/codemode/provider.py +64 -12
- agentpool/resource_providers/codemode/remote_mcp_execution.py +2 -2
- agentpool/resource_providers/codemode/remote_provider.py +9 -12
- agentpool/resource_providers/filtering.py +3 -1
- agentpool/resource_providers/mcp_provider.py +89 -12
- agentpool/resource_providers/plan_provider.py +228 -46
- agentpool/resource_providers/pool.py +7 -3
- agentpool/resource_providers/resource_info.py +111 -0
- agentpool/resource_providers/static.py +4 -2
- agentpool/sessions/__init__.py +4 -1
- agentpool/sessions/manager.py +33 -5
- agentpool/sessions/models.py +59 -6
- agentpool/sessions/protocol.py +28 -0
- agentpool/sessions/session.py +11 -55
- agentpool/skills/registry.py +13 -8
- agentpool/storage/manager.py +572 -49
- agentpool/talk/registry.py +4 -4
- agentpool/talk/talk.py +9 -10
- agentpool/testing.py +538 -20
- agentpool/tool_impls/__init__.py +6 -0
- agentpool/tool_impls/agent_cli/__init__.py +42 -0
- agentpool/tool_impls/agent_cli/tool.py +95 -0
- agentpool/tool_impls/bash/__init__.py +64 -0
- agentpool/tool_impls/bash/helpers.py +35 -0
- agentpool/tool_impls/bash/tool.py +171 -0
- agentpool/tool_impls/delete_path/__init__.py +70 -0
- agentpool/tool_impls/delete_path/tool.py +142 -0
- agentpool/tool_impls/download_file/__init__.py +80 -0
- agentpool/tool_impls/download_file/tool.py +183 -0
- agentpool/tool_impls/execute_code/__init__.py +55 -0
- agentpool/tool_impls/execute_code/tool.py +163 -0
- agentpool/tool_impls/grep/__init__.py +80 -0
- agentpool/tool_impls/grep/tool.py +200 -0
- agentpool/tool_impls/list_directory/__init__.py +73 -0
- agentpool/tool_impls/list_directory/tool.py +197 -0
- agentpool/tool_impls/question/__init__.py +42 -0
- agentpool/tool_impls/question/tool.py +127 -0
- agentpool/tool_impls/read/__init__.py +104 -0
- agentpool/tool_impls/read/tool.py +305 -0
- agentpool/tools/__init__.py +2 -1
- agentpool/tools/base.py +114 -34
- agentpool/tools/manager.py +57 -1
- agentpool/ui/base.py +2 -2
- agentpool/ui/mock_provider.py +2 -2
- agentpool/ui/stdlib_provider.py +2 -2
- agentpool/utils/file_watcher.py +269 -0
- agentpool/utils/identifiers.py +121 -0
- agentpool/utils/pydantic_ai_helpers.py +46 -0
- agentpool/utils/streams.py +616 -2
- agentpool/utils/subprocess_utils.py +155 -0
- agentpool/utils/token_breakdown.py +461 -0
- agentpool/vfs_registry.py +7 -2
- {agentpool-2.1.9.dist-info → agentpool-2.5.0.dist-info}/METADATA +41 -27
- agentpool-2.5.0.dist-info/RECORD +579 -0
- {agentpool-2.1.9.dist-info → agentpool-2.5.0.dist-info}/WHEEL +1 -1
- agentpool_cli/__main__.py +24 -0
- agentpool_cli/create.py +1 -1
- agentpool_cli/serve_acp.py +100 -21
- agentpool_cli/serve_agui.py +87 -0
- agentpool_cli/serve_opencode.py +119 -0
- agentpool_cli/ui.py +557 -0
- agentpool_commands/__init__.py +42 -5
- agentpool_commands/agents.py +75 -2
- agentpool_commands/history.py +62 -0
- agentpool_commands/mcp.py +176 -0
- agentpool_commands/models.py +56 -3
- agentpool_commands/pool.py +260 -0
- agentpool_commands/session.py +1 -1
- agentpool_commands/text_sharing/__init__.py +119 -0
- agentpool_commands/text_sharing/base.py +123 -0
- agentpool_commands/text_sharing/github_gist.py +80 -0
- agentpool_commands/text_sharing/opencode.py +462 -0
- agentpool_commands/text_sharing/paste_rs.py +59 -0
- agentpool_commands/text_sharing/pastebin.py +116 -0
- agentpool_commands/text_sharing/shittycodingagent.py +112 -0
- agentpool_commands/tools.py +57 -0
- agentpool_commands/utils.py +80 -30
- agentpool_config/__init__.py +30 -2
- agentpool_config/agentpool_tools.py +498 -0
- agentpool_config/builtin_tools.py +77 -22
- agentpool_config/commands.py +24 -1
- agentpool_config/compaction.py +258 -0
- agentpool_config/converters.py +1 -1
- agentpool_config/event_handlers.py +42 -0
- agentpool_config/events.py +1 -1
- agentpool_config/forward_targets.py +1 -4
- agentpool_config/jinja.py +3 -3
- agentpool_config/mcp_server.py +132 -6
- agentpool_config/nodes.py +1 -1
- agentpool_config/observability.py +44 -0
- agentpool_config/session.py +0 -3
- agentpool_config/storage.py +82 -38
- agentpool_config/task.py +3 -3
- agentpool_config/tools.py +11 -22
- agentpool_config/toolsets.py +109 -233
- agentpool_server/a2a_server/agent_worker.py +307 -0
- agentpool_server/a2a_server/server.py +23 -18
- agentpool_server/acp_server/acp_agent.py +234 -181
- agentpool_server/acp_server/commands/acp_commands.py +151 -156
- agentpool_server/acp_server/commands/docs_commands/fetch_repo.py +18 -17
- agentpool_server/acp_server/event_converter.py +651 -0
- agentpool_server/acp_server/input_provider.py +53 -10
- agentpool_server/acp_server/server.py +24 -90
- agentpool_server/acp_server/session.py +173 -331
- agentpool_server/acp_server/session_manager.py +8 -34
- agentpool_server/agui_server/server.py +3 -1
- agentpool_server/mcp_server/server.py +5 -2
- agentpool_server/opencode_server/.rules +95 -0
- agentpool_server/opencode_server/ENDPOINTS.md +401 -0
- agentpool_server/opencode_server/OPENCODE_UI_TOOLS_COMPLETE.md +202 -0
- agentpool_server/opencode_server/__init__.py +19 -0
- agentpool_server/opencode_server/command_validation.py +172 -0
- agentpool_server/opencode_server/converters.py +975 -0
- agentpool_server/opencode_server/dependencies.py +24 -0
- agentpool_server/opencode_server/input_provider.py +421 -0
- agentpool_server/opencode_server/models/__init__.py +250 -0
- agentpool_server/opencode_server/models/agent.py +53 -0
- agentpool_server/opencode_server/models/app.py +72 -0
- agentpool_server/opencode_server/models/base.py +26 -0
- agentpool_server/opencode_server/models/common.py +23 -0
- agentpool_server/opencode_server/models/config.py +37 -0
- agentpool_server/opencode_server/models/events.py +821 -0
- agentpool_server/opencode_server/models/file.py +88 -0
- agentpool_server/opencode_server/models/mcp.py +44 -0
- agentpool_server/opencode_server/models/message.py +179 -0
- agentpool_server/opencode_server/models/parts.py +323 -0
- agentpool_server/opencode_server/models/provider.py +81 -0
- agentpool_server/opencode_server/models/pty.py +43 -0
- agentpool_server/opencode_server/models/question.py +56 -0
- agentpool_server/opencode_server/models/session.py +111 -0
- agentpool_server/opencode_server/routes/__init__.py +29 -0
- agentpool_server/opencode_server/routes/agent_routes.py +473 -0
- agentpool_server/opencode_server/routes/app_routes.py +202 -0
- agentpool_server/opencode_server/routes/config_routes.py +302 -0
- agentpool_server/opencode_server/routes/file_routes.py +571 -0
- agentpool_server/opencode_server/routes/global_routes.py +94 -0
- agentpool_server/opencode_server/routes/lsp_routes.py +319 -0
- agentpool_server/opencode_server/routes/message_routes.py +761 -0
- agentpool_server/opencode_server/routes/permission_routes.py +63 -0
- agentpool_server/opencode_server/routes/pty_routes.py +300 -0
- agentpool_server/opencode_server/routes/question_routes.py +128 -0
- agentpool_server/opencode_server/routes/session_routes.py +1276 -0
- agentpool_server/opencode_server/routes/tui_routes.py +139 -0
- agentpool_server/opencode_server/server.py +475 -0
- agentpool_server/opencode_server/state.py +151 -0
- agentpool_server/opencode_server/time_utils.py +8 -0
- agentpool_storage/__init__.py +12 -0
- agentpool_storage/base.py +184 -2
- agentpool_storage/claude_provider/ARCHITECTURE.md +433 -0
- agentpool_storage/claude_provider/__init__.py +42 -0
- agentpool_storage/claude_provider/provider.py +1089 -0
- agentpool_storage/file_provider.py +278 -15
- agentpool_storage/memory_provider.py +193 -12
- agentpool_storage/models.py +3 -0
- agentpool_storage/opencode_provider/ARCHITECTURE.md +386 -0
- agentpool_storage/opencode_provider/__init__.py +16 -0
- agentpool_storage/opencode_provider/helpers.py +414 -0
- agentpool_storage/opencode_provider/provider.py +895 -0
- agentpool_storage/project_store.py +325 -0
- agentpool_storage/session_store.py +26 -6
- agentpool_storage/sql_provider/__init__.py +4 -2
- agentpool_storage/sql_provider/models.py +48 -0
- agentpool_storage/sql_provider/sql_provider.py +269 -3
- agentpool_storage/sql_provider/utils.py +12 -13
- agentpool_storage/zed_provider/__init__.py +16 -0
- agentpool_storage/zed_provider/helpers.py +281 -0
- agentpool_storage/zed_provider/models.py +130 -0
- agentpool_storage/zed_provider/provider.py +442 -0
- agentpool_storage/zed_provider.py +803 -0
- agentpool_toolsets/__init__.py +0 -2
- agentpool_toolsets/builtin/__init__.py +2 -12
- agentpool_toolsets/builtin/code.py +96 -57
- agentpool_toolsets/builtin/debug.py +118 -48
- agentpool_toolsets/builtin/execution_environment.py +115 -230
- agentpool_toolsets/builtin/file_edit/file_edit.py +115 -7
- agentpool_toolsets/builtin/skills.py +9 -4
- agentpool_toolsets/builtin/subagent_tools.py +64 -51
- agentpool_toolsets/builtin/workers.py +4 -2
- agentpool_toolsets/composio_toolset.py +2 -2
- agentpool_toolsets/entry_points.py +3 -1
- agentpool_toolsets/fsspec_toolset/__init__.py +13 -1
- agentpool_toolsets/fsspec_toolset/diagnostics.py +860 -73
- agentpool_toolsets/fsspec_toolset/grep.py +99 -7
- agentpool_toolsets/fsspec_toolset/helpers.py +3 -2
- agentpool_toolsets/fsspec_toolset/image_utils.py +161 -0
- agentpool_toolsets/fsspec_toolset/toolset.py +500 -95
- agentpool_toolsets/mcp_discovery/__init__.py +5 -0
- agentpool_toolsets/mcp_discovery/data/mcp_servers.parquet +0 -0
- agentpool_toolsets/mcp_discovery/toolset.py +511 -0
- agentpool_toolsets/mcp_run_toolset.py +87 -12
- agentpool_toolsets/notifications.py +33 -33
- agentpool_toolsets/openapi.py +3 -1
- agentpool_toolsets/search_toolset.py +3 -1
- agentpool-2.1.9.dist-info/RECORD +0 -474
- agentpool_config/resources.py +0 -33
- agentpool_server/acp_server/acp_tools.py +0 -43
- agentpool_server/acp_server/commands/spawn.py +0 -210
- agentpool_storage/text_log_provider.py +0 -275
- agentpool_toolsets/builtin/agent_management.py +0 -239
- agentpool_toolsets/builtin/chain.py +0 -288
- agentpool_toolsets/builtin/history.py +0 -36
- agentpool_toolsets/builtin/integration.py +0 -85
- agentpool_toolsets/builtin/tool_management.py +0 -90
- agentpool_toolsets/builtin/user_interaction.py +0 -52
- agentpool_toolsets/semantic_memory_toolset.py +0 -536
- {agentpool-2.1.9.dist-info → agentpool-2.5.0.dist-info}/entry_points.txt +0 -0
- {agentpool-2.1.9.dist-info → agentpool-2.5.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,821 @@
|
|
|
1
|
+
"""SSE event models."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, Literal, Self
|
|
6
|
+
|
|
7
|
+
from pydantic import Field
|
|
8
|
+
|
|
9
|
+
from agentpool_server.opencode_server.models.app import Project # noqa: TC001
|
|
10
|
+
from agentpool_server.opencode_server.models.base import OpenCodeBaseModel
|
|
11
|
+
from agentpool_server.opencode_server.models.message import ( # noqa: TC001
|
|
12
|
+
AssistantMessage,
|
|
13
|
+
UserMessage,
|
|
14
|
+
)
|
|
15
|
+
from agentpool_server.opencode_server.models.parts import Part # noqa: TC001
|
|
16
|
+
from agentpool_server.opencode_server.models.session import ( # noqa: TC001
|
|
17
|
+
Session,
|
|
18
|
+
SessionStatus,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class EmptyProperties(OpenCodeBaseModel):
|
|
23
|
+
"""Empty properties object."""
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class ServerConnectedEvent(OpenCodeBaseModel):
|
|
27
|
+
"""Server connected event."""
|
|
28
|
+
|
|
29
|
+
type: Literal["server.connected"] = "server.connected"
|
|
30
|
+
properties: EmptyProperties = Field(default_factory=EmptyProperties)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class SessionInfoProperties(OpenCodeBaseModel):
|
|
34
|
+
"""Session info wrapper for events."""
|
|
35
|
+
|
|
36
|
+
info: Session
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class SessionCreatedEvent(OpenCodeBaseModel):
|
|
40
|
+
"""Session created event."""
|
|
41
|
+
|
|
42
|
+
type: Literal["session.created"] = "session.created"
|
|
43
|
+
properties: SessionInfoProperties
|
|
44
|
+
|
|
45
|
+
@classmethod
|
|
46
|
+
def create(cls, session: Session) -> Self:
|
|
47
|
+
return cls(properties=SessionInfoProperties(info=session))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class SessionUpdatedEvent(OpenCodeBaseModel):
|
|
51
|
+
"""Session updated event."""
|
|
52
|
+
|
|
53
|
+
type: Literal["session.updated"] = "session.updated"
|
|
54
|
+
properties: SessionInfoProperties
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def create(cls, session: Session) -> Self:
|
|
58
|
+
return cls(properties=SessionInfoProperties(info=session))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class SessionDeletedProperties(OpenCodeBaseModel):
|
|
62
|
+
"""Properties for session deleted event."""
|
|
63
|
+
|
|
64
|
+
session_id: str
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class SessionDeletedEvent(OpenCodeBaseModel):
|
|
68
|
+
"""Session deleted event."""
|
|
69
|
+
|
|
70
|
+
type: Literal["session.deleted"] = "session.deleted"
|
|
71
|
+
properties: SessionDeletedProperties
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def create(cls, session_id: str) -> Self:
|
|
75
|
+
return cls(properties=SessionDeletedProperties(session_id=session_id))
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class SessionStatusProperties(OpenCodeBaseModel):
|
|
79
|
+
"""Properties for session status event."""
|
|
80
|
+
|
|
81
|
+
session_id: str
|
|
82
|
+
status: SessionStatus
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class SessionStatusEvent(OpenCodeBaseModel):
|
|
86
|
+
"""Session status event."""
|
|
87
|
+
|
|
88
|
+
type: Literal["session.status"] = "session.status"
|
|
89
|
+
properties: SessionStatusProperties
|
|
90
|
+
|
|
91
|
+
@classmethod
|
|
92
|
+
def create(cls, session_id: str, status: SessionStatus) -> Self:
|
|
93
|
+
return cls(properties=SessionStatusProperties(session_id=session_id, status=status))
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
class SessionIdleProperties(OpenCodeBaseModel):
|
|
97
|
+
"""Properties for session idle event (deprecated but still used by TUI)."""
|
|
98
|
+
|
|
99
|
+
session_id: str
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class SessionIdleEvent(OpenCodeBaseModel):
|
|
103
|
+
"""Session idle event (deprecated but still used by TUI run command)."""
|
|
104
|
+
|
|
105
|
+
type: Literal["session.idle"] = "session.idle"
|
|
106
|
+
properties: SessionIdleProperties
|
|
107
|
+
|
|
108
|
+
@classmethod
|
|
109
|
+
def create(cls, session_id: str) -> Self:
|
|
110
|
+
return cls(properties=SessionIdleProperties(session_id=session_id))
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
class SessionCompactedProperties(OpenCodeBaseModel):
|
|
114
|
+
"""Properties for session compacted event."""
|
|
115
|
+
|
|
116
|
+
session_id: str = Field(alias="sessionID")
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
class SessionCompactedEvent(OpenCodeBaseModel):
|
|
120
|
+
"""Session compacted event - emitted when context compaction completes."""
|
|
121
|
+
|
|
122
|
+
type: Literal["session.compacted"] = "session.compacted"
|
|
123
|
+
properties: SessionCompactedProperties
|
|
124
|
+
|
|
125
|
+
@classmethod
|
|
126
|
+
def create(cls, session_id: str) -> Self:
|
|
127
|
+
return cls(properties=SessionCompactedProperties(sessionID=session_id))
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
class SessionErrorInfo(OpenCodeBaseModel):
|
|
131
|
+
"""Error information for session error event.
|
|
132
|
+
|
|
133
|
+
Simplified version of OpenCode's error types (ProviderAuthError, UnknownError, etc.)
|
|
134
|
+
"""
|
|
135
|
+
|
|
136
|
+
name: str
|
|
137
|
+
"""Error type name (e.g., 'UnknownError', 'ProviderAuthError')."""
|
|
138
|
+
|
|
139
|
+
data: dict[str, Any] | None = None
|
|
140
|
+
"""Additional error data, typically contains 'message' field."""
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
class SessionErrorProperties(OpenCodeBaseModel):
|
|
144
|
+
"""Properties for session error event."""
|
|
145
|
+
|
|
146
|
+
session_id: str | None = Field(default=None, alias="sessionID")
|
|
147
|
+
error: SessionErrorInfo | None = None
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
class SessionErrorEvent(OpenCodeBaseModel):
|
|
151
|
+
"""Session error event - emitted when an error occurs during message processing."""
|
|
152
|
+
|
|
153
|
+
type: Literal["session.error"] = "session.error"
|
|
154
|
+
properties: SessionErrorProperties
|
|
155
|
+
|
|
156
|
+
@classmethod
|
|
157
|
+
def create(
|
|
158
|
+
cls,
|
|
159
|
+
session_id: str | None = None,
|
|
160
|
+
error_name: str = "UnknownError",
|
|
161
|
+
error_message: str | None = None,
|
|
162
|
+
) -> Self:
|
|
163
|
+
error_data = {"message": error_message} if error_message else None
|
|
164
|
+
return cls(
|
|
165
|
+
properties=SessionErrorProperties(
|
|
166
|
+
session_id=session_id,
|
|
167
|
+
error=SessionErrorInfo(name=error_name, data=error_data),
|
|
168
|
+
)
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
class MessageUpdatedEventProperties(OpenCodeBaseModel):
|
|
173
|
+
"""Properties for message updated event."""
|
|
174
|
+
|
|
175
|
+
info: UserMessage | AssistantMessage
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
class MessageUpdatedEvent(OpenCodeBaseModel):
|
|
179
|
+
"""Message updated event."""
|
|
180
|
+
|
|
181
|
+
type: Literal["message.updated"] = "message.updated"
|
|
182
|
+
properties: MessageUpdatedEventProperties
|
|
183
|
+
|
|
184
|
+
@classmethod
|
|
185
|
+
def create(cls, message: UserMessage | AssistantMessage) -> Self:
|
|
186
|
+
return cls(properties=MessageUpdatedEventProperties(info=message))
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
class PartUpdatedEventProperties(OpenCodeBaseModel):
|
|
190
|
+
"""Properties for part updated event."""
|
|
191
|
+
|
|
192
|
+
part: Part
|
|
193
|
+
delta: str | None = None
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
class PartUpdatedEvent(OpenCodeBaseModel):
|
|
197
|
+
"""Part updated event."""
|
|
198
|
+
|
|
199
|
+
type: Literal["message.part.updated"] = "message.part.updated"
|
|
200
|
+
properties: PartUpdatedEventProperties
|
|
201
|
+
|
|
202
|
+
@classmethod
|
|
203
|
+
def create(cls, part: Part, delta: str | None = None) -> Self:
|
|
204
|
+
return cls(properties=PartUpdatedEventProperties(part=part, delta=delta))
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
class MessageRemovedProperties(OpenCodeBaseModel):
|
|
208
|
+
"""Properties for message removed event."""
|
|
209
|
+
|
|
210
|
+
session_id: str = Field(alias="sessionID")
|
|
211
|
+
message_id: str = Field(alias="messageID")
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
class MessageRemovedEvent(OpenCodeBaseModel):
|
|
215
|
+
"""Message removed event - emitted during revert."""
|
|
216
|
+
|
|
217
|
+
type: Literal["message.removed"] = "message.removed"
|
|
218
|
+
properties: MessageRemovedProperties
|
|
219
|
+
|
|
220
|
+
@classmethod
|
|
221
|
+
def create(cls, session_id: str, message_id: str) -> Self:
|
|
222
|
+
"""Create message removed event.
|
|
223
|
+
|
|
224
|
+
Args:
|
|
225
|
+
session_id: Session identifier
|
|
226
|
+
message_id: Message identifier
|
|
227
|
+
|
|
228
|
+
Returns:
|
|
229
|
+
MessageRemovedEvent instance
|
|
230
|
+
"""
|
|
231
|
+
return cls(properties=MessageRemovedProperties(sessionID=session_id, messageID=message_id))
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
class PartRemovedProperties(OpenCodeBaseModel):
|
|
235
|
+
"""Properties for part removed event."""
|
|
236
|
+
|
|
237
|
+
session_id: str = Field(alias="sessionID")
|
|
238
|
+
message_id: str = Field(alias="messageID")
|
|
239
|
+
part_id: str = Field(alias="partID")
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
class PartRemovedEvent(OpenCodeBaseModel):
|
|
243
|
+
"""Part removed event - emitted during revert."""
|
|
244
|
+
|
|
245
|
+
type: Literal["message.part.removed"] = "message.part.removed"
|
|
246
|
+
properties: PartRemovedProperties
|
|
247
|
+
|
|
248
|
+
@classmethod
|
|
249
|
+
def create(cls, session_id: str, message_id: str, part_id: str) -> Self:
|
|
250
|
+
"""Create part removed event.
|
|
251
|
+
|
|
252
|
+
Args:
|
|
253
|
+
session_id: Session identifier
|
|
254
|
+
message_id: Message identifier
|
|
255
|
+
part_id: Part identifier
|
|
256
|
+
|
|
257
|
+
Returns:
|
|
258
|
+
PartRemovedEvent instance
|
|
259
|
+
"""
|
|
260
|
+
return cls(
|
|
261
|
+
properties=PartRemovedProperties(
|
|
262
|
+
sessionID=session_id, messageID=message_id, partID=part_id
|
|
263
|
+
)
|
|
264
|
+
)
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
class PermissionToolInfo(OpenCodeBaseModel):
|
|
268
|
+
"""Tool information for permission event."""
|
|
269
|
+
|
|
270
|
+
message_id: str
|
|
271
|
+
"""Message ID."""
|
|
272
|
+
|
|
273
|
+
call_id: str | None = None
|
|
274
|
+
"""Optional tool call ID."""
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
class PermissionAskedProperties(OpenCodeBaseModel):
|
|
278
|
+
"""Properties for permission.asked event.
|
|
279
|
+
|
|
280
|
+
Matches OpenCode's PermissionNext.Event.Asked schema.
|
|
281
|
+
"""
|
|
282
|
+
|
|
283
|
+
id: str
|
|
284
|
+
"""Permission request ID."""
|
|
285
|
+
|
|
286
|
+
session_id: str
|
|
287
|
+
"""Session ID."""
|
|
288
|
+
|
|
289
|
+
permission: str
|
|
290
|
+
"""Tool/permission type name."""
|
|
291
|
+
|
|
292
|
+
patterns: list[str]
|
|
293
|
+
"""Patterns for matching (e.g., file paths, commands)."""
|
|
294
|
+
|
|
295
|
+
metadata: dict[str, Any]
|
|
296
|
+
"""Arbitrary metadata about the tool call."""
|
|
297
|
+
|
|
298
|
+
always: list[str]
|
|
299
|
+
"""Patterns that would be approved for future requests if user selects 'always'."""
|
|
300
|
+
|
|
301
|
+
tool: PermissionToolInfo
|
|
302
|
+
"""Tool call information."""
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
class PermissionRequestEvent(OpenCodeBaseModel):
|
|
306
|
+
"""Permission request event - sent when a tool needs user confirmation.
|
|
307
|
+
|
|
308
|
+
Uses 'permission.asked' event type for OpenCode TUI compatibility.
|
|
309
|
+
"""
|
|
310
|
+
|
|
311
|
+
type: Literal["permission.asked"] = "permission.asked"
|
|
312
|
+
properties: PermissionAskedProperties
|
|
313
|
+
|
|
314
|
+
@classmethod
|
|
315
|
+
def create(
|
|
316
|
+
cls,
|
|
317
|
+
session_id: str,
|
|
318
|
+
permission_id: str,
|
|
319
|
+
tool_name: str,
|
|
320
|
+
args_preview: str,
|
|
321
|
+
message: str,
|
|
322
|
+
message_id: str = "",
|
|
323
|
+
call_id: str | None = None,
|
|
324
|
+
) -> Self:
|
|
325
|
+
# Create pattern from tool name and args
|
|
326
|
+
pattern = f"{tool_name}: {args_preview}" if args_preview else tool_name
|
|
327
|
+
|
|
328
|
+
props = PermissionAskedProperties(
|
|
329
|
+
id=permission_id,
|
|
330
|
+
session_id=session_id,
|
|
331
|
+
permission=tool_name,
|
|
332
|
+
patterns=[pattern],
|
|
333
|
+
metadata={"args_preview": args_preview},
|
|
334
|
+
always=[pattern], # Same pattern for "always" approval
|
|
335
|
+
tool=PermissionToolInfo(message_id=message_id, call_id=call_id),
|
|
336
|
+
)
|
|
337
|
+
return cls(properties=props)
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
class PermissionRepliedProperties(OpenCodeBaseModel):
|
|
341
|
+
"""Properties for permission replied event.
|
|
342
|
+
|
|
343
|
+
Matches OpenCode's permission.replied event schema.
|
|
344
|
+
"""
|
|
345
|
+
|
|
346
|
+
session_id: str
|
|
347
|
+
"""Session ID."""
|
|
348
|
+
|
|
349
|
+
request_id: str
|
|
350
|
+
"""Request/Permission ID."""
|
|
351
|
+
|
|
352
|
+
reply: Literal["once", "always", "reject"]
|
|
353
|
+
"""Reply: 'once' | 'always' | 'reject'."""
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
class PermissionResolvedEvent(OpenCodeBaseModel):
|
|
357
|
+
"""Permission resolved event - sent when a permission request is answered.
|
|
358
|
+
|
|
359
|
+
Uses 'permission.replied' event type for OpenCode TUI compatibility.
|
|
360
|
+
"""
|
|
361
|
+
|
|
362
|
+
type: Literal["permission.replied"] = "permission.replied"
|
|
363
|
+
properties: PermissionRepliedProperties
|
|
364
|
+
|
|
365
|
+
@classmethod
|
|
366
|
+
def create(
|
|
367
|
+
cls,
|
|
368
|
+
session_id: str,
|
|
369
|
+
request_id: str,
|
|
370
|
+
reply: Literal["once", "always", "reject"],
|
|
371
|
+
) -> Self:
|
|
372
|
+
props = PermissionRepliedProperties(
|
|
373
|
+
session_id=session_id,
|
|
374
|
+
request_id=request_id,
|
|
375
|
+
reply=reply,
|
|
376
|
+
)
|
|
377
|
+
return cls(properties=props)
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
# =============================================================================
|
|
381
|
+
# TUI Events - for external control of the TUI (e.g., VSCode extension)
|
|
382
|
+
# =============================================================================
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
class TuiPromptAppendProperties(OpenCodeBaseModel):
|
|
386
|
+
"""Properties for TUI prompt append event."""
|
|
387
|
+
|
|
388
|
+
text: str
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
class TuiPromptAppendEvent(OpenCodeBaseModel):
|
|
392
|
+
"""TUI prompt append event - appends text to the prompt input."""
|
|
393
|
+
|
|
394
|
+
type: Literal["tui.prompt.append"] = "tui.prompt.append"
|
|
395
|
+
properties: TuiPromptAppendProperties
|
|
396
|
+
|
|
397
|
+
@classmethod
|
|
398
|
+
def create(cls, text: str) -> Self:
|
|
399
|
+
return cls(properties=TuiPromptAppendProperties(text=text))
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
class TuiCommandExecuteProperties(OpenCodeBaseModel):
|
|
403
|
+
"""Properties for TUI command execute event."""
|
|
404
|
+
|
|
405
|
+
command: str
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
class TuiCommandExecuteEvent(OpenCodeBaseModel):
|
|
409
|
+
"""TUI command execute event - executes a TUI command.
|
|
410
|
+
|
|
411
|
+
Commands include:
|
|
412
|
+
- session.list, session.new, session.share, session.interrupt, session.compact
|
|
413
|
+
- session.page.up, session.page.down, session.half.page.up, session.half.page.down
|
|
414
|
+
- session.first, session.last
|
|
415
|
+
- prompt.clear, prompt.submit
|
|
416
|
+
- agent.cycle
|
|
417
|
+
"""
|
|
418
|
+
|
|
419
|
+
type: Literal["tui.command.execute"] = "tui.command.execute"
|
|
420
|
+
properties: TuiCommandExecuteProperties
|
|
421
|
+
|
|
422
|
+
@classmethod
|
|
423
|
+
def create(cls, command: str) -> Self:
|
|
424
|
+
return cls(properties=TuiCommandExecuteProperties(command=command))
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
class TuiToastShowProperties(OpenCodeBaseModel):
|
|
428
|
+
"""Properties for TUI toast show event."""
|
|
429
|
+
|
|
430
|
+
title: str | None = None
|
|
431
|
+
message: str
|
|
432
|
+
variant: Literal["info", "success", "warning", "error"] = "info"
|
|
433
|
+
duration: int = 5000 # Duration in milliseconds
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
class TuiToastShowEvent(OpenCodeBaseModel):
|
|
437
|
+
"""TUI toast show event - shows a toast notification."""
|
|
438
|
+
|
|
439
|
+
type: Literal["tui.toast.show"] = "tui.toast.show"
|
|
440
|
+
properties: TuiToastShowProperties
|
|
441
|
+
|
|
442
|
+
@classmethod
|
|
443
|
+
def create(
|
|
444
|
+
cls,
|
|
445
|
+
message: str,
|
|
446
|
+
variant: Literal["info", "success", "warning", "error"] = "info",
|
|
447
|
+
title: str | None = None,
|
|
448
|
+
duration: int = 5000,
|
|
449
|
+
) -> Self:
|
|
450
|
+
return cls(
|
|
451
|
+
properties=TuiToastShowProperties(
|
|
452
|
+
title=title,
|
|
453
|
+
message=message,
|
|
454
|
+
variant=variant,
|
|
455
|
+
duration=duration,
|
|
456
|
+
)
|
|
457
|
+
)
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
# =============================================================================
|
|
461
|
+
# Todo Events
|
|
462
|
+
# =============================================================================
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
class Todo(OpenCodeBaseModel):
|
|
466
|
+
"""A single todo item."""
|
|
467
|
+
|
|
468
|
+
id: str
|
|
469
|
+
"""Unique identifier for the todo item."""
|
|
470
|
+
|
|
471
|
+
content: str
|
|
472
|
+
"""Brief description of the task."""
|
|
473
|
+
|
|
474
|
+
status: str
|
|
475
|
+
"""Current status: pending, in_progress, completed, cancelled."""
|
|
476
|
+
|
|
477
|
+
priority: str
|
|
478
|
+
"""Priority level: high, medium, low."""
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
class TodoUpdatedProperties(OpenCodeBaseModel):
|
|
482
|
+
"""Properties for todo updated event."""
|
|
483
|
+
|
|
484
|
+
session_id: str
|
|
485
|
+
todos: list[Todo]
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
class TodoUpdatedEvent(OpenCodeBaseModel):
|
|
489
|
+
"""Todo list updated event."""
|
|
490
|
+
|
|
491
|
+
type: Literal["todo.updated"] = "todo.updated"
|
|
492
|
+
properties: TodoUpdatedProperties
|
|
493
|
+
|
|
494
|
+
@classmethod
|
|
495
|
+
def create(cls, session_id: str, todos: list[Todo]) -> Self:
|
|
496
|
+
return cls(properties=TodoUpdatedProperties(session_id=session_id, todos=todos))
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
# =============================================================================
|
|
500
|
+
# File Watcher Events
|
|
501
|
+
# =============================================================================
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
class FileWatcherUpdatedProperties(OpenCodeBaseModel):
|
|
505
|
+
"""Properties for file watcher updated event."""
|
|
506
|
+
|
|
507
|
+
file: str
|
|
508
|
+
"""Absolute path to the file that changed."""
|
|
509
|
+
|
|
510
|
+
event: Literal["add", "change", "unlink"]
|
|
511
|
+
"""Type of change: add (created), change (modified), unlink (deleted)."""
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
class FileWatcherUpdatedEvent(OpenCodeBaseModel):
|
|
515
|
+
"""File watcher updated event - sent when a project file changes."""
|
|
516
|
+
|
|
517
|
+
type: Literal["file.watcher.updated"] = "file.watcher.updated"
|
|
518
|
+
properties: FileWatcherUpdatedProperties
|
|
519
|
+
|
|
520
|
+
@classmethod
|
|
521
|
+
def create(cls, file: str, event: Literal["add", "change", "unlink"]) -> Self:
|
|
522
|
+
return cls(properties=FileWatcherUpdatedProperties(file=file, event=event))
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
# =============================================================================
|
|
526
|
+
# PTY Events
|
|
527
|
+
# =============================================================================
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
class PtyCreatedProperties(OpenCodeBaseModel):
|
|
531
|
+
"""Properties for PTY created event."""
|
|
532
|
+
|
|
533
|
+
info: Any
|
|
534
|
+
"""PTY session info."""
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
class PtyCreatedEvent(OpenCodeBaseModel):
|
|
538
|
+
"""PTY session created event."""
|
|
539
|
+
|
|
540
|
+
type: Literal["pty.created"] = "pty.created"
|
|
541
|
+
properties: PtyCreatedProperties
|
|
542
|
+
|
|
543
|
+
@classmethod
|
|
544
|
+
def create(cls, info: Any) -> Self:
|
|
545
|
+
return cls(properties=PtyCreatedProperties(info=info))
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
class PtyUpdatedProperties(OpenCodeBaseModel):
|
|
549
|
+
"""Properties for PTY updated event."""
|
|
550
|
+
|
|
551
|
+
info: Any
|
|
552
|
+
"""PTY session info."""
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
class PtyUpdatedEvent(OpenCodeBaseModel):
|
|
556
|
+
"""PTY session updated event."""
|
|
557
|
+
|
|
558
|
+
type: Literal["pty.updated"] = "pty.updated"
|
|
559
|
+
properties: PtyUpdatedProperties
|
|
560
|
+
|
|
561
|
+
@classmethod
|
|
562
|
+
def create(cls, info: Any) -> Self:
|
|
563
|
+
return cls(properties=PtyUpdatedProperties(info=info))
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
class PtyExitedProperties(OpenCodeBaseModel):
|
|
567
|
+
"""Properties for PTY exited event."""
|
|
568
|
+
|
|
569
|
+
id: str
|
|
570
|
+
"""PTY session ID."""
|
|
571
|
+
|
|
572
|
+
exit_code: int
|
|
573
|
+
"""Process exit code."""
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
class PtyExitedEvent(OpenCodeBaseModel):
|
|
577
|
+
"""PTY process exited event."""
|
|
578
|
+
|
|
579
|
+
type: Literal["pty.exited"] = "pty.exited"
|
|
580
|
+
properties: PtyExitedProperties
|
|
581
|
+
|
|
582
|
+
@classmethod
|
|
583
|
+
def create(cls, pty_id: str, exit_code: int) -> Self:
|
|
584
|
+
return cls(properties=PtyExitedProperties(id=pty_id, exit_code=exit_code))
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
class PtyDeletedProperties(OpenCodeBaseModel):
|
|
588
|
+
"""Properties for PTY deleted event."""
|
|
589
|
+
|
|
590
|
+
id: str
|
|
591
|
+
"""PTY session ID."""
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
class PtyDeletedEvent(OpenCodeBaseModel):
|
|
595
|
+
"""PTY session deleted event."""
|
|
596
|
+
|
|
597
|
+
type: Literal["pty.deleted"] = "pty.deleted"
|
|
598
|
+
properties: PtyDeletedProperties
|
|
599
|
+
|
|
600
|
+
@classmethod
|
|
601
|
+
def create(cls, pty_id: str) -> Self:
|
|
602
|
+
return cls(properties=PtyDeletedProperties(id=pty_id))
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
# =============================================================================
|
|
606
|
+
# LSP Events
|
|
607
|
+
# =============================================================================
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
class LspStatus(OpenCodeBaseModel):
|
|
611
|
+
"""LSP server status information."""
|
|
612
|
+
|
|
613
|
+
id: str
|
|
614
|
+
"""Server identifier (e.g., 'pyright', 'rust-analyzer')."""
|
|
615
|
+
|
|
616
|
+
name: str
|
|
617
|
+
"""Server name."""
|
|
618
|
+
|
|
619
|
+
root: str
|
|
620
|
+
"""Relative workspace root path."""
|
|
621
|
+
|
|
622
|
+
status: Literal["connected", "error"]
|
|
623
|
+
"""Connection status."""
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
class LspUpdatedEvent(OpenCodeBaseModel):
|
|
627
|
+
"""LSP status updated event - sent when LSP server status changes."""
|
|
628
|
+
|
|
629
|
+
type: Literal["lsp.updated"] = "lsp.updated"
|
|
630
|
+
properties: EmptyProperties = Field(default_factory=EmptyProperties)
|
|
631
|
+
|
|
632
|
+
@classmethod
|
|
633
|
+
def create(cls) -> Self:
|
|
634
|
+
return cls()
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
class LspClientDiagnosticsProperties(OpenCodeBaseModel):
|
|
638
|
+
"""Properties for LSP client diagnostics event."""
|
|
639
|
+
|
|
640
|
+
server_id: str = Field(alias="serverID")
|
|
641
|
+
"""LSP server ID that produced the diagnostics."""
|
|
642
|
+
|
|
643
|
+
path: str
|
|
644
|
+
"""File path the diagnostics apply to."""
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
class LspClientDiagnosticsEvent(OpenCodeBaseModel):
|
|
648
|
+
"""LSP client diagnostics event - sent when diagnostics are published."""
|
|
649
|
+
|
|
650
|
+
type: Literal["lsp.client.diagnostics"] = "lsp.client.diagnostics"
|
|
651
|
+
properties: LspClientDiagnosticsProperties
|
|
652
|
+
|
|
653
|
+
@classmethod
|
|
654
|
+
def create(cls, server_id: str, path: str) -> Self:
|
|
655
|
+
return cls(properties=LspClientDiagnosticsProperties(serverID=server_id, path=path))
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
# =============================================================================
|
|
659
|
+
# VCS Events
|
|
660
|
+
# =============================================================================
|
|
661
|
+
|
|
662
|
+
|
|
663
|
+
class ProjectUpdatedEvent(OpenCodeBaseModel):
|
|
664
|
+
"""Project metadata updated event."""
|
|
665
|
+
|
|
666
|
+
type: Literal["project.updated"] = "project.updated"
|
|
667
|
+
properties: Project
|
|
668
|
+
|
|
669
|
+
@classmethod
|
|
670
|
+
def create(cls, project: Project) -> Self:
|
|
671
|
+
"""Create project updated event.
|
|
672
|
+
|
|
673
|
+
Args:
|
|
674
|
+
project: The updated project data
|
|
675
|
+
|
|
676
|
+
Returns:
|
|
677
|
+
ProjectUpdatedEvent instance
|
|
678
|
+
"""
|
|
679
|
+
return cls(properties=project)
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
class VcsBranchUpdatedProperties(OpenCodeBaseModel):
|
|
683
|
+
"""Properties for VCS branch updated event."""
|
|
684
|
+
|
|
685
|
+
branch: str | None = None
|
|
686
|
+
"""Current branch name, or None if detached HEAD."""
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
class VcsBranchUpdatedEvent(OpenCodeBaseModel):
|
|
690
|
+
"""VCS branch updated event - sent when git branch changes."""
|
|
691
|
+
|
|
692
|
+
type: Literal["vcs.branch.updated"] = "vcs.branch.updated"
|
|
693
|
+
properties: VcsBranchUpdatedProperties
|
|
694
|
+
|
|
695
|
+
@classmethod
|
|
696
|
+
def create(cls, branch: str | None) -> Self:
|
|
697
|
+
return cls(properties=VcsBranchUpdatedProperties(branch=branch))
|
|
698
|
+
|
|
699
|
+
|
|
700
|
+
class QuestionAskedProperties(OpenCodeBaseModel):
|
|
701
|
+
"""Properties for question asked event."""
|
|
702
|
+
|
|
703
|
+
id: str
|
|
704
|
+
session_id: str
|
|
705
|
+
questions: list[dict[str, Any]]
|
|
706
|
+
tool: dict[str, str] | None = None
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
class QuestionAskedEvent(OpenCodeBaseModel):
|
|
710
|
+
"""Question asked event - sent when agent asks a question."""
|
|
711
|
+
|
|
712
|
+
type: Literal["question.asked"] = "question.asked"
|
|
713
|
+
properties: QuestionAskedProperties
|
|
714
|
+
|
|
715
|
+
@classmethod
|
|
716
|
+
def create(
|
|
717
|
+
cls,
|
|
718
|
+
request_id: str,
|
|
719
|
+
session_id: str,
|
|
720
|
+
questions: list[dict[str, Any]],
|
|
721
|
+
tool: dict[str, str] | None = None,
|
|
722
|
+
) -> Self:
|
|
723
|
+
return cls(
|
|
724
|
+
properties=QuestionAskedProperties(
|
|
725
|
+
id=request_id,
|
|
726
|
+
sessionID=session_id,
|
|
727
|
+
questions=questions,
|
|
728
|
+
tool=tool,
|
|
729
|
+
)
|
|
730
|
+
)
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
class QuestionRepliedProperties(OpenCodeBaseModel):
|
|
734
|
+
"""Properties for question replied event."""
|
|
735
|
+
|
|
736
|
+
session_id: str
|
|
737
|
+
request_id: str
|
|
738
|
+
answers: list[list[str]]
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
class QuestionRepliedEvent(OpenCodeBaseModel):
|
|
742
|
+
"""Question replied event - sent when user answers a question."""
|
|
743
|
+
|
|
744
|
+
type: Literal["question.replied"] = "question.replied"
|
|
745
|
+
properties: QuestionRepliedProperties
|
|
746
|
+
|
|
747
|
+
@classmethod
|
|
748
|
+
def create(
|
|
749
|
+
cls,
|
|
750
|
+
session_id: str,
|
|
751
|
+
request_id: str,
|
|
752
|
+
answers: list[list[str]],
|
|
753
|
+
) -> Self:
|
|
754
|
+
return cls(
|
|
755
|
+
properties=QuestionRepliedProperties(
|
|
756
|
+
sessionID=session_id,
|
|
757
|
+
requestID=request_id,
|
|
758
|
+
answers=answers,
|
|
759
|
+
)
|
|
760
|
+
)
|
|
761
|
+
|
|
762
|
+
|
|
763
|
+
class QuestionRejectedProperties(OpenCodeBaseModel):
|
|
764
|
+
"""Properties for question rejected event."""
|
|
765
|
+
|
|
766
|
+
session_id: str
|
|
767
|
+
request_id: str
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
class QuestionRejectedEvent(OpenCodeBaseModel):
|
|
771
|
+
"""Question rejected event - sent when user dismisses a question."""
|
|
772
|
+
|
|
773
|
+
type: Literal["question.rejected"] = "question.rejected"
|
|
774
|
+
properties: QuestionRejectedProperties
|
|
775
|
+
|
|
776
|
+
@classmethod
|
|
777
|
+
def create(
|
|
778
|
+
cls,
|
|
779
|
+
session_id: str,
|
|
780
|
+
request_id: str,
|
|
781
|
+
) -> Self:
|
|
782
|
+
return cls(
|
|
783
|
+
properties=QuestionRejectedProperties(
|
|
784
|
+
sessionID=session_id,
|
|
785
|
+
requestID=request_id,
|
|
786
|
+
)
|
|
787
|
+
)
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
Event = (
|
|
791
|
+
ServerConnectedEvent
|
|
792
|
+
| SessionCreatedEvent
|
|
793
|
+
| SessionUpdatedEvent
|
|
794
|
+
| SessionDeletedEvent
|
|
795
|
+
| SessionStatusEvent
|
|
796
|
+
| SessionErrorEvent
|
|
797
|
+
| SessionIdleEvent
|
|
798
|
+
| MessageUpdatedEvent
|
|
799
|
+
| MessageRemovedEvent
|
|
800
|
+
| PartUpdatedEvent
|
|
801
|
+
| PartRemovedEvent
|
|
802
|
+
| PermissionRequestEvent
|
|
803
|
+
| PermissionResolvedEvent
|
|
804
|
+
| QuestionAskedEvent
|
|
805
|
+
| QuestionRepliedEvent
|
|
806
|
+
| QuestionRejectedEvent
|
|
807
|
+
| TodoUpdatedEvent
|
|
808
|
+
| FileWatcherUpdatedEvent
|
|
809
|
+
| SessionCompactedEvent
|
|
810
|
+
| PtyCreatedEvent
|
|
811
|
+
| PtyUpdatedEvent
|
|
812
|
+
| PtyExitedEvent
|
|
813
|
+
| PtyDeletedEvent
|
|
814
|
+
| LspUpdatedEvent
|
|
815
|
+
| LspClientDiagnosticsEvent
|
|
816
|
+
| ProjectUpdatedEvent
|
|
817
|
+
| VcsBranchUpdatedEvent
|
|
818
|
+
| TuiPromptAppendEvent
|
|
819
|
+
| TuiCommandExecuteEvent
|
|
820
|
+
| TuiToastShowEvent
|
|
821
|
+
)
|