Skip to content

Commit b4f253c

Browse files
authored
feat: bump agentclientprotocol to 0.10.8 (#63)
* feat: bump agentclientprotocol to 0.10.8 Signed-off-by: Chojan Shang <psiace@apache.org> * fix: minor fix Signed-off-by: Chojan Shang <psiace@apache.org> --------- Signed-off-by: Chojan Shang <psiace@apache.org>
1 parent e63a997 commit b4f253c

File tree

8 files changed

+558
-106
lines changed

8 files changed

+558
-106
lines changed

schema/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
refs/tags/v0.10.5
1+
refs/tags/v0.10.8

schema/schema.json

Lines changed: 449 additions & 74 deletions
Large diffs are not rendered by default.

scripts/gen_schema.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"SessionUpdate8": "CurrentModeUpdate",
6363
"SessionUpdate9": "ConfigOptionUpdate",
6464
"SessionUpdate10": "SessionInfoUpdate",
65+
"SessionUpdate11": "UsageUpdate",
6566
"ToolCallContent1": "ContentToolCallContent",
6667
"ToolCallContent2": "FileEditToolCallContent",
6768
"ToolCallContent3": "TerminalToolCallContent",

src/acp/agent/connection.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
ToolCallProgress,
3434
ToolCallStart,
3535
ToolCallUpdate,
36+
UsageUpdate,
3637
UserMessageChunk,
3738
WaitForTerminalExitRequest,
3839
WaitForTerminalExitResponse,
@@ -88,7 +89,8 @@ async def session_update(
8889
| AvailableCommandsUpdate
8990
| CurrentModeUpdate
9091
| ConfigOptionUpdate
91-
| SessionInfoUpdate,
92+
| SessionInfoUpdate
93+
| UsageUpdate,
9294
**kwargs: Any,
9395
) -> None:
9496
await notify_model(
@@ -216,5 +218,4 @@ async def __aexit__(self, exc_type, exc, tb) -> None:
216218
await self.close()
217219

218220
def on_connect(self, conn: Agent) -> None:
219-
# A dummy method to match the Client protocol
220221
pass

src/acp/client/connection.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,5 +225,4 @@ async def __aexit__(self, exc_type, exc, tb) -> None:
225225
await self.close()
226226

227227
def on_connect(self, conn: Client) -> None:
228-
# A dummy method to match the Agent protocol
229228
pass

src/acp/interfaces.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
ToolCallProgress,
6060
ToolCallStart,
6161
ToolCallUpdate,
62+
UsageUpdate,
6263
UserMessageChunk,
6364
WaitForTerminalExitRequest,
6465
WaitForTerminalExitResponse,
@@ -89,7 +90,8 @@ async def session_update(
8990
| AvailableCommandsUpdate
9091
| CurrentModeUpdate
9192
| ConfigOptionUpdate
92-
| SessionInfoUpdate,
93+
| SessionInfoUpdate
94+
| UsageUpdate,
9395
**kwargs: Any,
9496
) -> None: ...
9597

src/acp/meta.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Generated from schema/meta.json. Do not edit by hand.
2-
# Schema ref: refs/tags/v0.10.5
2+
# Schema ref: refs/tags/v0.10.8
33
AGENT_METHODS = {
44
"authenticate": "authenticate",
55
"initialize": "initialize",

src/acp/schema.py

Lines changed: 100 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Generated from schema/schema.json. Do not edit by hand.
2-
# Schema ref: refs/tags/v0.10.5
2+
# Schema ref: refs/tags/v0.10.8
33

44
from __future__ import annotations
55

@@ -111,6 +111,13 @@ class BlobResourceContents(BaseModel):
111111
uri: str
112112

113113

114+
class Cost(BaseModel):
115+
# Total cumulative cost for session.
116+
amount: Annotated[float, Field(description="Total cumulative cost for session.")]
117+
# ISO 4217 currency code (e.g., "USD", "EUR").
118+
currency: Annotated[str, Field(description='ISO 4217 currency code (e.g., "USD", "EUR").')]
119+
120+
114121
class CreateTerminalResponse(BaseModel):
115122
# The _meta property is reserved by ACP to allow clients and agents to attach additional
116123
# metadata to their interactions. Implementations MUST NOT make assumptions about values at
@@ -900,6 +907,72 @@ class UnstructuredCommandInput(BaseModel):
900907
]
901908

902909

910+
class Usage(BaseModel):
911+
# Total cache read tokens.
912+
cached_read_tokens: Annotated[
913+
Optional[int],
914+
Field(alias="cachedReadTokens", description="Total cache read tokens.", ge=0),
915+
] = None
916+
# Total cache write tokens.
917+
cached_write_tokens: Annotated[
918+
Optional[int],
919+
Field(alias="cachedWriteTokens", description="Total cache write tokens.", ge=0),
920+
] = None
921+
# Total input tokens across all turns.
922+
input_tokens: Annotated[
923+
int,
924+
Field(
925+
alias="inputTokens",
926+
description="Total input tokens across all turns.",
927+
ge=0,
928+
),
929+
]
930+
# Total output tokens across all turns.
931+
output_tokens: Annotated[
932+
int,
933+
Field(
934+
alias="outputTokens",
935+
description="Total output tokens across all turns.",
936+
ge=0,
937+
),
938+
]
939+
# Total thought/reasoning tokens
940+
thought_tokens: Annotated[
941+
Optional[int],
942+
Field(alias="thoughtTokens", description="Total thought/reasoning tokens", ge=0),
943+
] = None
944+
# Sum of all token types across session.
945+
total_tokens: Annotated[
946+
int,
947+
Field(
948+
alias="totalTokens",
949+
description="Sum of all token types across session.",
950+
ge=0,
951+
),
952+
]
953+
954+
955+
class _UsageUpdate(BaseModel):
956+
# The _meta property is reserved by ACP to allow clients and agents to attach additional
957+
# metadata to their interactions. Implementations MUST NOT make assumptions about values at
958+
# these keys.
959+
#
960+
# See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
961+
field_meta: Annotated[
962+
Optional[Dict[str, Any]],
963+
Field(
964+
alias="_meta",
965+
description="The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
966+
),
967+
] = None
968+
# Cumulative session cost (optional).
969+
cost: Annotated[Optional[Cost], Field(description="Cumulative session cost (optional).")] = None
970+
# Total context window size in tokens.
971+
size: Annotated[int, Field(description="Total context window size in tokens.", ge=0)]
972+
# Tokens currently in context.
973+
used: Annotated[int, Field(description="Tokens currently in context.", ge=0)]
974+
975+
903976
class WaitForTerminalExitRequest(BaseModel):
904977
# The _meta property is reserved by ACP to allow clients and agents to attach additional
905978
# metadata to their interactions. Implementations MUST NOT make assumptions about values at
@@ -1423,6 +1496,17 @@ class PromptResponse(BaseModel):
14231496
description="Indicates why the agent stopped processing the turn.",
14241497
),
14251498
]
1499+
# **UNSTABLE**
1500+
#
1501+
# This capability is not part of the spec yet, and may be removed or changed at any point.
1502+
#
1503+
# Token usage for this turn (optional).
1504+
usage: Annotated[
1505+
Optional[Usage],
1506+
Field(
1507+
description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nToken usage for this turn (optional)."
1508+
),
1509+
] = None
14261510

14271511

14281512
class ReadTextFileRequest(BaseModel):
@@ -1666,6 +1750,10 @@ class CurrentModeUpdate(_CurrentModeUpdate):
16661750
session_update: Annotated[Literal["current_mode_update"], Field(alias="sessionUpdate")]
16671751

16681752

1753+
class UsageUpdate(_UsageUpdate):
1754+
session_update: Annotated[Literal["usage_update"], Field(alias="sessionUpdate")]
1755+
1756+
16691757
class TextContent(BaseModel):
16701758
# The _meta property is reserved by ACP to allow clients and agents to attach additional
16711759
# metadata to their interactions. Implementations MUST NOT make assumptions about values at
@@ -2220,6 +2308,11 @@ class SessionConfigOptionSelect(SessionConfigSelect):
22202308
description="The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
22212309
),
22222310
] = None
2311+
# Optional semantic category for this option (UX only).
2312+
category: Annotated[
2313+
Optional[str],
2314+
Field(description="Optional semantic category for this option (UX only)."),
2315+
] = None
22232316
# Optional description for the Client to display to the user.
22242317
description: Annotated[
22252318
Optional[str],
@@ -2233,15 +2326,11 @@ class SessionConfigOptionSelect(SessionConfigSelect):
22332326

22342327

22352328
class SessionConfigOption(RootModel[SessionConfigOptionSelect]):
2236-
# **UNSTABLE**
2237-
#
2238-
# This capability is not part of the spec yet, and may be removed or changed at any point.
2239-
#
22402329
# A session configuration option selector and its current state.
22412330
root: Annotated[
22422331
SessionConfigOptionSelect,
22432332
Field(
2244-
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.",
2333+
description="A session configuration option selector and its current state.",
22452334
discriminator="type",
22462335
),
22472336
]
@@ -2350,16 +2439,12 @@ class ForkSessionResponse(BaseModel):
23502439
description="The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
23512440
),
23522441
] = None
2353-
# **UNSTABLE**
2354-
#
2355-
# This capability is not part of the spec yet, and may be removed or changed at any point.
2356-
#
23572442
# Initial session configuration options if supported by the Agent.
23582443
config_options: Annotated[
23592444
Optional[List[SessionConfigOption]],
23602445
Field(
23612446
alias="configOptions",
2362-
description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial session configuration options if supported by the Agent.",
2447+
description="Initial session configuration options if supported by the Agent.",
23632448
),
23642449
] = None
23652450
# **UNSTABLE**
@@ -2405,16 +2490,12 @@ class LoadSessionResponse(BaseModel):
24052490
description="The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
24062491
),
24072492
] = None
2408-
# **UNSTABLE**
2409-
#
2410-
# This capability is not part of the spec yet, and may be removed or changed at any point.
2411-
#
24122493
# Initial session configuration options if supported by the Agent.
24132494
config_options: Annotated[
24142495
Optional[List[SessionConfigOption]],
24152496
Field(
24162497
alias="configOptions",
2417-
description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial session configuration options if supported by the Agent.",
2498+
description="Initial session configuration options if supported by the Agent.",
24182499
),
24192500
] = None
24202501
# **UNSTABLE**
@@ -2452,16 +2533,12 @@ class NewSessionResponse(BaseModel):
24522533
description="The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
24532534
),
24542535
] = None
2455-
# **UNSTABLE**
2456-
#
2457-
# This capability is not part of the spec yet, and may be removed or changed at any point.
2458-
#
24592536
# Initial session configuration options if supported by the Agent.
24602537
config_options: Annotated[
24612538
Optional[List[SessionConfigOption]],
24622539
Field(
24632540
alias="configOptions",
2464-
description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial session configuration options if supported by the Agent.",
2541+
description="Initial session configuration options if supported by the Agent.",
24652542
),
24662543
] = None
24672544
# **UNSTABLE**
@@ -2539,16 +2616,12 @@ class ResumeSessionResponse(BaseModel):
25392616
description="The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)",
25402617
),
25412618
] = None
2542-
# **UNSTABLE**
2543-
#
2544-
# This capability is not part of the spec yet, and may be removed or changed at any point.
2545-
#
25462619
# Initial session configuration options if supported by the Agent.
25472620
config_options: Annotated[
25482621
Optional[List[SessionConfigOption]],
25492622
Field(
25502623
alias="configOptions",
2551-
description="**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nInitial session configuration options if supported by the Agent.",
2624+
description="Initial session configuration options if supported by the Agent.",
25522625
),
25532626
] = None
25542627
# **UNSTABLE**
@@ -2757,6 +2830,7 @@ class SessionNotification(BaseModel):
27572830
CurrentModeUpdate,
27582831
ConfigOptionUpdate,
27592832
SessionInfoUpdate,
2833+
UsageUpdate,
27602834
],
27612835
Field(description="The actual update content.", discriminator="session_update"),
27622836
]

0 commit comments

Comments
 (0)