Skip to content

Commit 8216c09

Browse files
committed
add tests and renaming
Signed-off-by: Richard Chien <stdrc@outlook.com>
1 parent 577a3c5 commit 8216c09

File tree

7 files changed

+93
-3
lines changed

7 files changed

+93
-3
lines changed

scripts/gen_schema.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"McpServer2": "SseMcpServer",
5454
"RequestPermissionOutcome1": "DeniedOutcome",
5555
"RequestPermissionOutcome2": "AllowedOutcome",
56+
"SessionConfigOption1": "SessionConfigOptionSelect",
5657
"SessionUpdate1": "UserMessageChunk",
5758
"SessionUpdate2": "AgentMessageChunk",
5859
"SessionUpdate3": "AgentThoughtChunk",

src/acp/schema.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2207,7 +2207,7 @@ class Content(BaseModel):
22072207
]
22082208

22092209

2210-
class SessionConfigOption1(SessionConfigSelect):
2210+
class SessionConfigOptionSelect(SessionConfigSelect):
22112211
# The _meta property is reserved by ACP to allow clients and agents to attach additional
22122212
# metadata to their interactions. Implementations MUST NOT make assumptions about values at
22132213
# these keys.
@@ -2232,14 +2232,14 @@ class SessionConfigOption1(SessionConfigSelect):
22322232
type: Literal["select"]
22332233

22342234

2235-
class SessionConfigOption(RootModel[SessionConfigOption1]):
2235+
class SessionConfigOption(RootModel[SessionConfigOptionSelect]):
22362236
# **UNSTABLE**
22372237
#
22382238
# This capability is not part of the spec yet, and may be removed or changed at any point.
22392239
#
22402240
# A session configuration option selector and its current state.
22412241
root: Annotated[
2242-
SessionConfigOption1,
2242+
SessionConfigOptionSelect,
22432243
Field(
22442244
description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA session configuration option selector and its current state.",
22452245
discriminator="type",
@@ -2781,6 +2781,7 @@ class AgentNotification(BaseModel):
27812781
McpServer2 = SseMcpServer
27822782
RequestPermissionOutcome1 = DeniedOutcome
27832783
RequestPermissionOutcome2 = AllowedOutcome
2784+
SessionConfigOption1 = SessionConfigOptionSelect
27842785
SessionUpdate1 = UserMessageChunk
27852786
SessionUpdate10 = SessionInfoUpdate
27862787
SessionUpdate2 = AgentMessageChunk

tests/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
AudioContentBlock,
3535
AvailableCommandsUpdate,
3636
ClientCapabilities,
37+
ConfigOptionUpdate,
3738
CurrentModeUpdate,
3839
DeniedOutcome,
3940
EmbeddedResourceContentBlock,
@@ -173,6 +174,7 @@ async def session_update(
173174
| AgentPlanUpdate
174175
| AvailableCommandsUpdate
175176
| CurrentModeUpdate
177+
| ConfigOptionUpdate
176178
| SessionInfoUpdate,
177179
**kwargs: Any,
178180
) -> None:
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"sessionUpdate": "config_option_update",
3+
"configOptions": [
4+
{
5+
"type": "select",
6+
"id": "model",
7+
"name": "Model",
8+
"description": "Choose a model",
9+
"currentValue": "gpt-4o-mini",
10+
"options": [
11+
{
12+
"name": "GPT-4o Mini",
13+
"value": "gpt-4o-mini"
14+
},
15+
{
16+
"name": "GPT-4o",
17+
"value": "gpt-4o",
18+
"description": "Highest quality"
19+
}
20+
]
21+
},
22+
{
23+
"type": "select",
24+
"id": "mode",
25+
"name": "Mode",
26+
"currentValue": "fast",
27+
"options": [
28+
{
29+
"group": "speed",
30+
"name": "Speed",
31+
"options": [
32+
{
33+
"name": "Fast",
34+
"value": "fast"
35+
},
36+
{
37+
"name": "Balanced",
38+
"value": "balanced"
39+
}
40+
]
41+
},
42+
{
43+
"group": "quality",
44+
"name": "Quality",
45+
"options": [
46+
{
47+
"name": "High",
48+
"value": "high"
49+
}
50+
]
51+
}
52+
]
53+
}
54+
]
55+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"sessionId": "sess-123",
3+
"configId": "model",
4+
"value": "gpt-4o-mini"
5+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"configOptions": [
3+
{
4+
"type": "select",
5+
"id": "mode",
6+
"name": "Mode",
7+
"currentValue": "balanced",
8+
"options": [
9+
{
10+
"name": "Fast",
11+
"value": "fast"
12+
},
13+
{
14+
"name": "Balanced",
15+
"value": "balanced"
16+
}
17+
]
18+
}
19+
]
20+
}

tests/test_golden.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
AllowedOutcome,
3636
AudioContentBlock,
3737
CancelNotification,
38+
ConfigOptionUpdate,
3839
ContentToolCallContent,
3940
DeniedOutcome,
4041
EmbeddedResourceContentBlock,
@@ -50,6 +51,8 @@
5051
RequestPermissionRequest,
5152
RequestPermissionResponse,
5253
ResourceContentBlock,
54+
SetSessionConfigOptionRequest,
55+
SetSessionConfigOptionResponse,
5356
TerminalToolCallContent,
5457
TextContentBlock,
5558
ToolCallLocation,
@@ -84,6 +87,7 @@
8487
"request_permission_response_selected": RequestPermissionResponse,
8588
"session_update_agent_message_chunk": AgentMessageChunk,
8689
"session_update_agent_thought_chunk": AgentThoughtChunk,
90+
"session_update_config_option_update": ConfigOptionUpdate,
8791
"session_update_plan": AgentPlanUpdate,
8892
"session_update_tool_call": ToolCallStart,
8993
"session_update_tool_call_edit": ToolCallStart,
@@ -92,6 +96,8 @@
9296
"session_update_tool_call_update_content": ToolCallProgress,
9397
"session_update_tool_call_update_more_fields": ToolCallProgress,
9498
"session_update_user_message_chunk": UserMessageChunk,
99+
"set_session_config_option_request": SetSessionConfigOptionRequest,
100+
"set_session_config_option_response": SetSessionConfigOptionResponse,
95101
"tool_content_content_text": ContentToolCallContent,
96102
"tool_content_diff": FileEditToolCallContent,
97103
"tool_content_diff_no_old": FileEditToolCallContent,

0 commit comments

Comments
 (0)