Skip to content
Merged
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
30 changes: 30 additions & 0 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,36 @@ update = AgentMessageChunk(
)
```

## Session notices (unstable)

The v1 bindings use `schema-v1.23.0`. Clients that can display live advisory
notices advertise `ClientCapabilities(session=ClientSessionCapabilities(notices=NoticeCapabilities()))`
in `initialize`; these models are available from `acp.schema`.

After checking that capability, agents can send a notice:

```python
from acp.schema import SessionUpdateNotice

await client.session_update(
session_id=session_id,
update=SessionUpdateNotice(
severity="warning",
title="Context is nearly full",
description="Start a new session soon.",
),
)
```

Notices are live events, outside session history. The title must be non-empty;
severity accepts `info`, `warning`, `error`, and custom or future strings.
Agents must only send notices to clients that advertise support.

Tool calls now expose the stable `name` field. Terminal authentication methods
are available as `TerminalAuthMethod`, replacing the incorrect `EnvVarAuthMethod`
name. Accepted elicitation content validates scalar values and string lists;
nested objects are not valid form values.

## Optional — Talk to the Gemini CLI

_Have the Gemini CLI installed? Run the bridge to exercise permission flows._
Expand Down
2 changes: 1 addition & 1 deletion schema/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
refs/tags/schema-v1.21.0
refs/tags/schema-v1.23.0
103 changes: 101 additions & 2 deletions schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@
"x-deserialize-default-on-error": true
},
"name": {
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nUpdate the programmatic name of the tool being invoked.\n\nThis field is optional. Omitting it or sending `null` both mean that\nthe existing name is left unchanged.",
"description": "Update the programmatic name of the tool being invoked.\n\nThis field is optional. Omitting it or sending `null` both mean that\nthe existing name is left unchanged.",
"type": [
"string",
"null"
Expand Down Expand Up @@ -6012,6 +6012,24 @@
}
]
},
{
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nAdvisory information for the user that is not part of session history.\n\nAgents MUST only send this update when the Client advertised\n[`ClientSessionCapabilities::notices`].",
"type": "object",
"properties": {
"sessionUpdate": {
"type": "string",
"const": "notice"
}
},
"required": [
"sessionUpdate"
],
"allOf": [
{
"$ref": "#/$defs/Notice"
}
]
},
{
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nA context compaction has been created or updated.\n\nAgents MUST only send this update when the Client advertised\n[`ClientSessionCapabilities::compaction`].",
"type": "object",
Expand Down Expand Up @@ -6112,7 +6130,7 @@
"type": "string"
},
"name": {
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nProgrammatic name of the tool being invoked.\n\nThis field is optional. Omitting it or sending `null` both mean that no\ntool name is available.",
"description": "Programmatic name of the tool being invoked.\n\nThis field is optional. Omitting it or sending `null` both mean that no\ntool name is available.",
"type": [
"string",
"null"
Expand Down Expand Up @@ -6758,6 +6776,71 @@
"size"
]
},
"NoticeSeverity": {
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nSeverity hint for a session notice.",
"anyOf": [
{
"description": "Informational notice.",
"type": "string",
"const": "info"
},
{
"description": "Warning notice.",
"type": "string",
"const": "warning"
},
{
"description": "Error notice.",
"type": "string",
"const": "error"
},
{
"title": "other",
"description": "Custom or future notice severity.\n\nValues beginning with `_` are reserved for implementation-specific\nextensions. Other unknown values are reserved for future ACP severities.",
"type": "string"
}
]
},
"Notice": {
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nFire-and-forget advisory information for the user.\n\nNotices are live events rather than session history. Agents must not rely on\na notice being received, displayed, or seen by the user.\nAgents MUST only send notices when the Client advertised\n[`ClientSessionCapabilities::notices`]. Otherwise, Agents may use an agent\nmessage when the information should still be surfaced to the user.\n\nSee RFD: [Session Notices](https://agentclientprotocol.com/rfds/session-notices)",
"type": "object",
"properties": {
"severity": {
"description": "Presentation severity hint.",
"allOf": [
{
"$ref": "#/$defs/NoticeSeverity"
}
]
},
"title": {
"description": "Required non-empty plain-text title that can stand alone.",
"type": "string",
"minLength": 1
},
"description": {
"description": "Optional plain-text detail or guidance.\n\nOmitted and `null` are equivalent and mean no description was supplied.",
"type": [
"string",
"null"
],
"x-deserialize-default-on-error": true
},
"_meta": {
"description": "Metadata scoped to this notice.\n\nOmitted and `null` are equivalent and mean no metadata was supplied.",
"type": [
"object",
"null"
],
"x-deserialize-default-on-error": true,
"additionalProperties": true
}
},
"required": [
"severity",
"title"
]
},
"CompactionId": {
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nUnique identifier for a context compaction within a session.",
"type": "string"
Expand Down Expand Up @@ -7397,6 +7480,18 @@
],
"x-deserialize-default-on-error": true
},
"notices": {
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nSupport for live advisory `notice` session updates.\n\nOptional. Omitted or `null` both mean the client does not advertise support.\nSupplying `{}` means the client can present notices to the user.",
"anyOf": [
{
"$ref": "#/$defs/NoticeCapabilities"
},
{
"type": "null"
}
],
"x-deserialize-default-on-error": true
},
"_meta": {
"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)",
"type": [
Expand Down Expand Up @@ -7454,6 +7549,10 @@
}
}
},
"NoticeCapabilities": {
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nClient support for presenting live advisory notices to the user.",
"type": "object"
},
"PlanCapabilities": {
"description": "**UNSTABLE**\n\nThis capability is not part of the spec yet, and may be removed or changed at any point.\n\nCapabilities for receiving `plan_update` and `plan_removed` session updates.",
"type": "object",
Expand Down
3 changes: 2 additions & 1 deletion scripts/_schema_semantics.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from dataclasses import dataclass
from dataclasses import dataclass, field
from importlib import import_module
from pathlib import Path
from typing import Protocol, cast
Expand All @@ -23,6 +23,7 @@ class SchemaSemantics:
base_class: str
model_name_map: dict[str, str]
compatibility_aliases: str = ""
field_type_overrides: dict[str, str] = field(default_factory=dict)


class _SemanticsModule(Protocol):
Expand Down
1 change: 1 addition & 0 deletions scripts/gen_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def render_schema(semantics: SchemaSemantics) -> str:
infer_union_variant_names=True,
naming_strategy=NamingStrategy.PrimaryFirst,
model_name_map=semantics.model_name_map,
type_overrides=semantics.field_type_overrides,
strict_refs=True,
schema_version="2020-12",
schema_version_mode=VersionMode.Strict,
Expand Down
4 changes: 3 additions & 1 deletion scripts/gen_schema_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
for variant_names in (
variant_model_map("AgentResponse", "anyOf", "object", ("AgentResponseMessage", "AgentErrorMessage")),
variant_model_map("ClientResponse", "anyOf", "object", ("ClientResponseMessage", "ClientErrorMessage")),
variant_model_map("AuthMethod", "anyOf", "allOf", ("EnvVarAuthMethod", "TerminalAuthMethod")),
variant_model_map("AuthMethod", "anyOf", "allOf", ("TerminalAuthMethod", "AgentAuthMethod")),
variant_model_map("McpServer", "anyOf", "allOf", ("HttpMcpServer", "SseMcpServer", "AcpMcpServer")),
variant_model_map(
"SetSessionConfigOptionRequest",
Expand Down Expand Up @@ -230,4 +230,6 @@ class Jsonrpc(Enum):
base_class="acp._schema_base.BaseModel",
model_name_map=MODEL_NAME_MAP,
compatibility_aliases=COMPATIBILITY_ALIASES,
# The generator loses additionalProperties types on nullable objects.
field_type_overrides={"ElicitationAcceptAction.content": "acp._schema_base.ElicitationContent"},
)
2 changes: 2 additions & 0 deletions src/acp/_schema_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

from ._deserialize import use_default_on_error

ElicitationContent = dict[str, str | int | float | bool | list[str]]


class BaseModel(pydantic.BaseModel):
"""Runtime behavior shared by generated ACP schema models."""
Expand Down
2 changes: 2 additions & 0 deletions src/acp/agent/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
SessionNotification,
SessionUpdateCompactionSummaryChunk,
SessionUpdateCompactionUpdate,
SessionUpdateNotice,
TerminalOutputRequest,
TerminalOutputResponse,
ToolCallProgress,
Expand Down Expand Up @@ -150,6 +151,7 @@ async def session_update(
| ConfigOptionUpdate
| SessionInfoUpdate
| UsageUpdate
| SessionUpdateNotice
| SessionUpdateCompactionUpdate
| SessionUpdateCompactionSummaryChunk,
**kwargs: Any,
Expand Down
2 changes: 2 additions & 0 deletions src/acp/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
SessionNotification,
SessionUpdateCompactionSummaryChunk,
SessionUpdateCompactionUpdate,
SessionUpdateNotice,
SetSessionConfigOptionBooleanRequest,
SetSessionConfigOptionResponse,
SetSessionConfigOptionSelectRequest,
Expand Down Expand Up @@ -105,6 +106,7 @@ async def session_update(
| ConfigOptionUpdate
| SessionInfoUpdate
| UsageUpdate
| SessionUpdateNotice
| SessionUpdateCompactionUpdate
| SessionUpdateCompactionSummaryChunk,
**kwargs: Any,
Expand Down
2 changes: 1 addition & 1 deletion src/acp/meta.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Generated from schema/meta.json. Do not edit by hand.
# Schema ref: refs/tags/schema-v1.21.0
# Schema ref: refs/tags/schema-v1.23.0
AGENT_METHODS = {
"initialize": "initialize",
"authenticate": "authenticate",
Expand Down
Loading
Loading