Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ Spec version: `0.5.2`
optional `title`), so either side of the handshake can identify its
implementation and build. Informational only — mirrors LSP/MCP and MUST NOT
be used for feature detection.
- Optional `_meta` slot on `SystemNotificationResponsePart`, following the MCP
`_meta` convention. A host MAY attach a machine-readable descriptor of what
triggered the notification so clients can categorize, icon, group, filter, or
localize it without parsing `content`.

### Changed

Expand Down
3 changes: 3 additions & 0 deletions clients/go/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ Implements AHP 0.5.2.
`Version`, optional `Title`), identifying the implementation and build behind
either side of the handshake. Informational only — MUST NOT be used for
feature detection.
- `SystemNotificationResponsePart.Meta` (wire `_meta`) — optional
provider-specific metadata bag (`map[string]json.RawMessage`) carrying a
machine-readable descriptor of what triggered the notification.

### Changed

Expand Down
8 changes: 8 additions & 0 deletions clients/go/ahptypes/state.generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -1643,6 +1643,14 @@ type SystemNotificationResponsePart struct {
Kind ResponsePartKind `json:"kind"`
// The text of the system notification
Content StringOrMarkdown `json:"content"`
// Additional provider-specific metadata for this notification.
//
// A host MAY attach a machine-readable descriptor of what triggered the
// notification so clients can categorize, icon, group, filter, or localize
// it without parsing `content`. Clients MAY look for well-known keys here to
// provide enhanced UI, and MUST render coherently from `content` alone when
// `_meta` is absent or unrecognized.
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
}

// Tool execution result details, available after execution completes.
Expand Down
3 changes: 3 additions & 0 deletions clients/kotlin/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ Implements AHP 0.5.2.
`InitializeParams`, each an `Implementation` (`name`, optional `version`,
optional `title`), identifying the implementation and build behind either side
of the handshake. Informational only — MUST NOT be used for feature detection.
- `SystemNotificationResponsePart.meta` (serialized as `_meta`) — optional
provider-specific metadata bag (`Map<String, JsonElement>?`) carrying a
machine-readable descriptor of what triggered the notification.

### Changed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2285,7 +2285,18 @@ data class SystemNotificationResponsePart(
/**
* The text of the system notification
*/
val content: StringOrMarkdown
val content: StringOrMarkdown,
/**
* Additional provider-specific metadata for this notification.
*
* A host MAY attach a machine-readable descriptor of what triggered the
* notification so clients can categorize, icon, group, filter, or localize
* it without parsing `content`. Clients MAY look for well-known keys here to
* provide enhanced UI, and MUST render coherently from `content` alone when
* `_meta` is absent or unrecognized.
*/
@SerialName("_meta")
val meta: Map<String, JsonElement>? = null
)

@Serializable
Expand Down
3 changes: 3 additions & 0 deletions clients/rust/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ Implements AHP 0.5.2.
`version`, optional `title`), identifying the implementation and build behind
either side of the handshake. Informational only — MUST NOT be used for
feature detection.
- `SystemNotificationResponsePart.meta` (`_meta` on the wire) — optional
provider-specific metadata bag (`Option<JsonObject>`) carrying a
machine-readable descriptor of what triggered the notification.

### Changed

Expand Down
9 changes: 9 additions & 0 deletions clients/rust/crates/ahp-types/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2058,6 +2058,15 @@ pub struct ReasoningResponsePart {
pub struct SystemNotificationResponsePart {
/// The text of the system notification
pub content: StringOrMarkdown,
/// Additional provider-specific metadata for this notification.
///
/// A host MAY attach a machine-readable descriptor of what triggered the
/// notification so clients can categorize, icon, group, filter, or localize
/// it without parsing `content`. Clients MAY look for well-known keys here to
/// provide enhanced UI, and MUST render coherently from `content` alone when
/// `_meta` is absent or unrecognized.
#[serde(rename = "_meta", default, skip_serializing_if = "Option::is_none")]
pub meta: Option<JsonObject>,
}

/// Tool execution result details, available after execution completes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2289,13 +2289,29 @@ public struct SystemNotificationResponsePart: Codable, Sendable {
public var kind: ResponsePartKind
/// The text of the system notification
public var content: StringOrMarkdown
/// Additional provider-specific metadata for this notification.
///
/// A host MAY attach a machine-readable descriptor of what triggered the
/// notification so clients can categorize, icon, group, filter, or localize
/// it without parsing `content`. Clients MAY look for well-known keys here to
/// provide enhanced UI, and MUST render coherently from `content` alone when
/// `_meta` is absent or unrecognized.
public var meta: [String: AnyCodable]?

enum CodingKeys: String, CodingKey {
case kind
case content
case meta = "_meta"
}

public init(
kind: ResponsePartKind,
content: StringOrMarkdown
content: StringOrMarkdown,
meta: [String: AnyCodable]? = nil
) {
self.kind = kind
self.content = content
self.meta = meta
}
}

Expand Down
3 changes: 3 additions & 0 deletions clients/swift/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ Implements AHP 0.5.2.
`InitializeParams`, each an `Implementation` (`name`, optional `version`,
optional `title`), identifying the implementation and build behind either side
of the handshake. Informational only — MUST NOT be used for feature detection.
- `SystemNotificationResponsePart.meta` (serialized as `_meta`) — optional
provider-specific metadata bag (`[String: AnyCodable]?`) carrying a
machine-readable descriptor of what triggered the notification.

### Changed

Expand Down
3 changes: 3 additions & 0 deletions clients/typescript/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ Implements AHP 0.5.2.
`InitializeParams`, each an `Implementation` (`name`, optional `version`,
optional `title`), identifying the implementation and build behind either side
of the handshake. Informational only — MUST NOT be used for feature detection.
- `SystemNotificationResponsePart._meta?: Record<string, unknown>` — optional
provider-specific metadata bag carrying a machine-readable descriptor of what
triggered the notification, following the existing `_meta` convention.

### Changed

Expand Down
10 changes: 10 additions & 0 deletions docs/guide/state-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,18 @@ ContentRef {
sizeHint?: number
mimeType?: string
}

// A system notification surfaced in the response stream — an out-of-band
// harness event (e.g. "background subagent completed", "task cancelled")
SystemNotificationResponsePart {
kind: 'systemNotification'
content: StringOrMarkdown // human-readable notification text
_meta?: Record<string, unknown> // machine-readable trigger metadata; see below
}
```

`SystemNotificationResponsePart._meta` carries provider-specific metadata describing what triggered the notification. A host MAY attach a machine-readable descriptor so clients can categorize, icon, group, filter, or localize the notification without parsing `content`. Clients MAY inspect well-known keys for enhanced UI, and MUST render coherently from `content` alone when `_meta` is absent or unrecognized.

Text content uses a **create-then-append** pattern: the server first emits a `session/responsePart` action to create a new markdown (or reasoning) part with an `id`, then streams text into it via `session/delta` (or `session/reasoning`) actions targeting that `partId`. This pattern is extensible to future streaming content types.

Clients fetch `ContentRef` content separately via the `resourceRead(uri)` command. This keeps the state tree small and serializable.
Expand Down
5 changes: 5 additions & 0 deletions schema/actions.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5078,6 +5078,11 @@
"content": {
"$ref": "#/$defs/StringOrMarkdown",
"description": "The text of the system notification"
},
"_meta": {
"type": "object",
"additionalProperties": {},
"description": "Additional provider-specific metadata for this notification.\n\nA host MAY attach a machine-readable descriptor of what triggered the\nnotification so clients can categorize, icon, group, filter, or localize\nit without parsing `content`. Clients MAY look for well-known keys here to\nprovide enhanced UI, and MUST render coherently from `content` alone when\n`_meta` is absent or unrecognized."
}
},
"required": [
Expand Down
5 changes: 5 additions & 0 deletions schema/commands.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4419,6 +4419,11 @@
"content": {
"$ref": "#/$defs/StringOrMarkdown",
"description": "The text of the system notification"
},
"_meta": {
"type": "object",
"additionalProperties": {},
"description": "Additional provider-specific metadata for this notification.\n\nA host MAY attach a machine-readable descriptor of what triggered the\nnotification so clients can categorize, icon, group, filter, or localize\nit without parsing `content`. Clients MAY look for well-known keys here to\nprovide enhanced UI, and MUST render coherently from `content` alone when\n`_meta` is absent or unrecognized."
}
},
"required": [
Expand Down
5 changes: 5 additions & 0 deletions schema/errors.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3214,6 +3214,11 @@
"content": {
"$ref": "#/$defs/StringOrMarkdown",
"description": "The text of the system notification"
},
"_meta": {
"type": "object",
"additionalProperties": {},
"description": "Additional provider-specific metadata for this notification.\n\nA host MAY attach a machine-readable descriptor of what triggered the\nnotification so clients can categorize, icon, group, filter, or localize\nit without parsing `content`. Clients MAY look for well-known keys here to\nprovide enhanced UI, and MUST render coherently from `content` alone when\n`_meta` is absent or unrecognized."
}
},
"required": [
Expand Down
5 changes: 5 additions & 0 deletions schema/notifications.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3374,6 +3374,11 @@
"content": {
"$ref": "#/$defs/StringOrMarkdown",
"description": "The text of the system notification"
},
"_meta": {
"type": "object",
"additionalProperties": {},
"description": "Additional provider-specific metadata for this notification.\n\nA host MAY attach a machine-readable descriptor of what triggered the\nnotification so clients can categorize, icon, group, filter, or localize\nit without parsing `content`. Clients MAY look for well-known keys here to\nprovide enhanced UI, and MUST render coherently from `content` alone when\n`_meta` is absent or unrecognized."
}
},
"required": [
Expand Down
5 changes: 5 additions & 0 deletions schema/state.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3125,6 +3125,11 @@
"content": {
"$ref": "#/$defs/StringOrMarkdown",
"description": "The text of the system notification"
},
"_meta": {
"type": "object",
"additionalProperties": {},
"description": "Additional provider-specific metadata for this notification.\n\nA host MAY attach a machine-readable descriptor of what triggered the\nnotification so clients can categorize, icon, group, filter, or localize\nit without parsing `content`. Clients MAY look for well-known keys here to\nprovide enhanced UI, and MUST render coherently from `content` alone when\n`_meta` is absent or unrecognized."
}
},
"required": [
Expand Down
10 changes: 10 additions & 0 deletions types/channels-chat/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,16 @@ export interface SystemNotificationResponsePart {
kind: ResponsePartKind.SystemNotification;
/** The text of the system notification */
content: StringOrMarkdown;
/**
* Additional provider-specific metadata for this notification.
*
* A host MAY attach a machine-readable descriptor of what triggered the
* notification so clients can categorize, icon, group, filter, or localize
* it without parsing `content`. Clients MAY look for well-known keys here to
* provide enhanced UI, and MUST render coherently from `content` alone when
* `_meta` is absent or unrecognized.
*/
_meta?: Record<string, unknown>;
}


Expand Down
Loading