Skip to content

Commit 8b109c6

Browse files
author
Sergey Ignatov
committed
feat: add SessionInfoUpdate to SessionUpdate enum
Add a new session_info_update variant to the SessionUpdate discriminated union, allowing agents to notify clients about session metadata changes (title, timestamps, custom metadata) in real-time.
1 parent 8e3919b commit 8b109c6

File tree

5 files changed

+229
-0
lines changed

5 files changed

+229
-0
lines changed

docs/protocol/draft/schema.mdx

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2926,6 +2926,32 @@ See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/exte
29262926
ISO 8601 timestamp of last activity
29272927
</ResponseField>
29282928

2929+
## <span class="font-mono">SessionInfoUpdate</span>
2930+
2931+
Update to session metadata. All fields are optional to support partial updates.
2932+
2933+
Agents send this notification to update session information like title or custom metadata.
2934+
This allows clients to display dynamic session names and track session state changes.
2935+
2936+
**Type:** Object
2937+
2938+
**Properties:**
2939+
2940+
<ResponseField name="_meta" type={"object | null"} >
2941+
The _meta property is reserved by ACP to allow clients and agents to attach additional
2942+
metadata to their interactions. Implementations MUST NOT make assumptions about values at
2943+
these keys.
2944+
2945+
See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
2946+
2947+
</ResponseField>
2948+
<ResponseField name="title" type={"string | null"} >
2949+
Human-readable title for the session. Set to null to clear.
2950+
</ResponseField>
2951+
<ResponseField name="updatedAt" type={"string | null"} >
2952+
ISO 8601 timestamp of last activity. Set to null to clear.
2953+
</ResponseField>
2954+
29292955
## <span class="font-mono">SessionListCapabilities</span>
29302956

29312957
Capabilities for the `session/list` method.
@@ -3288,6 +3314,31 @@ See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/exte
32883314
</Expandable>
32893315
</ResponseField>
32903316

3317+
<ResponseField name="session_info_update" type="object">
3318+
Session metadata has been updated (title, timestamps, custom metadata)
3319+
3320+
<Expandable title="Properties">
3321+
3322+
<ResponseField name="_meta" type={"object | null"} >
3323+
The _meta property is reserved by ACP to allow clients and agents to attach additional
3324+
metadata to their interactions. Implementations MUST NOT make assumptions about values at
3325+
these keys.
3326+
3327+
See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
3328+
3329+
</ResponseField>
3330+
<ResponseField name="sessionUpdate" type={"string"} required>
3331+
</ResponseField>
3332+
<ResponseField name="title" type={"string | null"} >
3333+
Human-readable title for the session. Set to null to clear.
3334+
</ResponseField>
3335+
<ResponseField name="updatedAt" type={"string | null"} >
3336+
ISO 8601 timestamp of last activity. Set to null to clear.
3337+
</ResponseField>
3338+
3339+
</Expandable>
3340+
</ResponseField>
3341+
32913342
## <span class="font-mono">StopReason</span>
32923343

32933344
Reasons why an agent stops processing a prompt turn.

docs/protocol/schema.mdx

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2421,6 +2421,32 @@ See protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session
24212421

24222422
**Type:** `string`
24232423

2424+
## <span class="font-mono">SessionInfoUpdate</span>
2425+
2426+
Update to session metadata. All fields are optional to support partial updates.
2427+
2428+
Agents send this notification to update session information like title or custom metadata.
2429+
This allows clients to display dynamic session names and track session state changes.
2430+
2431+
**Type:** Object
2432+
2433+
**Properties:**
2434+
2435+
<ResponseField name="_meta" type={"object | null"} >
2436+
The _meta property is reserved by ACP to allow clients and agents to attach additional
2437+
metadata to their interactions. Implementations MUST NOT make assumptions about values at
2438+
these keys.
2439+
2440+
See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
2441+
2442+
</ResponseField>
2443+
<ResponseField name="title" type={"string | null"} >
2444+
Human-readable title for the session. Set to null to clear.
2445+
</ResponseField>
2446+
<ResponseField name="updatedAt" type={"string | null"} >
2447+
ISO 8601 timestamp of last activity. Set to null to clear.
2448+
</ResponseField>
2449+
24242450
## <span class="font-mono">SessionMode</span>
24252451

24262452
A mode the agent can operate in.
@@ -2712,6 +2738,31 @@ See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/exte
27122738
</Expandable>
27132739
</ResponseField>
27142740

2741+
<ResponseField name="session_info_update" type="object">
2742+
Session metadata has been updated (title, timestamps, custom metadata)
2743+
2744+
<Expandable title="Properties">
2745+
2746+
<ResponseField name="_meta" type={"object | null"} >
2747+
The _meta property is reserved by ACP to allow clients and agents to attach additional
2748+
metadata to their interactions. Implementations MUST NOT make assumptions about values at
2749+
these keys.
2750+
2751+
See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
2752+
2753+
</ResponseField>
2754+
<ResponseField name="sessionUpdate" type={"string"} required>
2755+
</ResponseField>
2756+
<ResponseField name="title" type={"string | null"} >
2757+
Human-readable title for the session. Set to null to clear.
2758+
</ResponseField>
2759+
<ResponseField name="updatedAt" type={"string | null"} >
2760+
ISO 8601 timestamp of last activity. Set to null to clear.
2761+
</ResponseField>
2762+
2763+
</Expandable>
2764+
</ResponseField>
2765+
27152766
## <span class="font-mono">StopReason</span>
27162767

27172768
Reasons why an agent stops processing a prompt turn.

schema/schema.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2067,6 +2067,25 @@
20672067
"description": "A unique identifier for a conversation session between a client and agent.\n\nSessions maintain their own context, conversation history, and state,\nallowing multiple independent interactions with the same agent.\n\nSee protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)",
20682068
"type": "string"
20692069
},
2070+
"SessionInfoUpdate": {
2071+
"description": "Update to session metadata. All fields are optional to support partial updates.\n\nAgents send this notification to update session information like title or custom metadata.\nThis allows clients to display dynamic session names and track session state changes.",
2072+
"properties": {
2073+
"_meta": {
2074+
"additionalProperties": true,
2075+
"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)",
2076+
"type": ["object", "null"]
2077+
},
2078+
"title": {
2079+
"description": "Human-readable title for the session. Set to null to clear.",
2080+
"type": ["string", "null"]
2081+
},
2082+
"updatedAt": {
2083+
"description": "ISO 8601 timestamp of last activity. Set to null to clear.",
2084+
"type": ["string", "null"]
2085+
}
2086+
},
2087+
"type": "object"
2088+
},
20702089
"SessionMode": {
20712090
"description": "A mode the agent can operate in.\n\nSee protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)",
20722091
"properties": {
@@ -2282,6 +2301,22 @@
22822301
},
22832302
"required": ["sessionUpdate"],
22842303
"type": "object"
2304+
},
2305+
{
2306+
"allOf": [
2307+
{
2308+
"$ref": "#/$defs/SessionInfoUpdate"
2309+
}
2310+
],
2311+
"description": "Session metadata has been updated (title, timestamps, custom metadata)",
2312+
"properties": {
2313+
"sessionUpdate": {
2314+
"const": "session_info_update",
2315+
"type": "string"
2316+
}
2317+
},
2318+
"required": ["sessionUpdate"],
2319+
"type": "object"
22852320
}
22862321
]
22872322
},

schema/schema.unstable.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2460,6 +2460,25 @@
24602460
"required": ["sessionId", "cwd"],
24612461
"type": "object"
24622462
},
2463+
"SessionInfoUpdate": {
2464+
"description": "Update to session metadata. All fields are optional to support partial updates.\n\nAgents send this notification to update session information like title or custom metadata.\nThis allows clients to display dynamic session names and track session state changes.",
2465+
"properties": {
2466+
"_meta": {
2467+
"additionalProperties": true,
2468+
"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)",
2469+
"type": ["object", "null"]
2470+
},
2471+
"title": {
2472+
"description": "Human-readable title for the session. Set to null to clear.",
2473+
"type": ["string", "null"]
2474+
},
2475+
"updatedAt": {
2476+
"description": "ISO 8601 timestamp of last activity. Set to null to clear.",
2477+
"type": ["string", "null"]
2478+
}
2479+
},
2480+
"type": "object"
2481+
},
24632482
"SessionListCapabilities": {
24642483
"description": "Capabilities for the `session/list` method.\n\nBy supplying `{}` it means that the agent supports listing of sessions.\n\nFurther capabilities can be added in the future for other means of filtering or searching the list.",
24652484
"properties": {
@@ -2724,6 +2743,22 @@
27242743
},
27252744
"required": ["sessionUpdate"],
27262745
"type": "object"
2746+
},
2747+
{
2748+
"allOf": [
2749+
{
2750+
"$ref": "#/$defs/SessionInfoUpdate"
2751+
}
2752+
],
2753+
"description": "Session metadata has been updated (title, timestamps, custom metadata)",
2754+
"properties": {
2755+
"sessionUpdate": {
2756+
"const": "session_info_update",
2757+
"type": "string"
2758+
}
2759+
},
2760+
"required": ["sessionUpdate"],
2761+
"type": "object"
27272762
}
27282763
]
27292764
},

src/client.rs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ pub enum SessionUpdate {
9090
///
9191
/// See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)
9292
CurrentModeUpdate(CurrentModeUpdate),
93+
/// Session metadata has been updated (title, timestamps, custom metadata)
94+
SessionInfoUpdate(SessionInfoUpdate),
9395
}
9496

9597
/// The current mode of the session has changed
@@ -131,6 +133,61 @@ impl CurrentModeUpdate {
131133
}
132134
}
133135

136+
/// Update to session metadata. All fields are optional to support partial updates.
137+
///
138+
/// Agents send this notification to update session information like title or custom metadata.
139+
/// This allows clients to display dynamic session names and track session state changes.
140+
#[derive(Default, Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
141+
#[serde(rename_all = "camelCase")]
142+
#[non_exhaustive]
143+
pub struct SessionInfoUpdate {
144+
/// Human-readable title for the session. Set to null to clear.
145+
#[serde(skip_serializing_if = "Option::is_none")]
146+
pub title: Option<String>,
147+
/// ISO 8601 timestamp of last activity. Set to null to clear.
148+
#[serde(skip_serializing_if = "Option::is_none")]
149+
pub updated_at: Option<String>,
150+
/// The _meta property is reserved by ACP to allow clients and agents to attach additional
151+
/// metadata to their interactions. Implementations MUST NOT make assumptions about values at
152+
/// these keys.
153+
///
154+
/// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
155+
#[serde(skip_serializing_if = "Option::is_none", rename = "_meta")]
156+
pub meta: Option<Meta>,
157+
}
158+
159+
impl SessionInfoUpdate {
160+
#[must_use]
161+
pub fn new() -> Self {
162+
Self::default()
163+
}
164+
165+
/// Human-readable title for the session. Set to null to clear.
166+
#[must_use]
167+
pub fn title(mut self, title: impl IntoOption<String>) -> Self {
168+
self.title = title.into_option();
169+
self
170+
}
171+
172+
/// ISO 8601 timestamp of last activity. Set to null to clear.
173+
#[must_use]
174+
pub fn updated_at(mut self, updated_at: impl IntoOption<String>) -> Self {
175+
self.updated_at = updated_at.into_option();
176+
self
177+
}
178+
179+
/// The _meta property is reserved by ACP to allow clients and agents to attach additional
180+
/// metadata to their interactions. Implementations MUST NOT make assumptions about values at
181+
/// these keys.
182+
///
183+
/// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
184+
#[must_use]
185+
pub fn meta(mut self, meta: impl IntoOption<Meta>) -> Self {
186+
self.meta = meta.into_option();
187+
self
188+
}
189+
}
190+
134191
/// A streamed item of content
135192
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq)]
136193
#[serde(rename_all = "camelCase")]

0 commit comments

Comments
 (0)