From a10fbe84e4e5bc71556a41865650f99291c8b5cb Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Wed, 25 Nov 2026 10:25:53 -0800 Subject: [PATCH] chore: improve changelog guidelines and migrate instructions to skills Support multi-line details (code snippets and doc links) and linked issue references in changelog fragments, rewrite pending fragments and 1.1.0 changelogs for consumers, migrate agent/contributor instructions to skills/, and clarify @preserveUnknownMembers usage. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../general-instructions.instructions.md | 92 ------ AGENTS.md | 136 ++------- CHANGELOG.md | 156 +++++++--- CONTRIBUTING.md | 94 ++---- RELEASING.md | 276 +++--------------- clients/dotnet/CHANGELOG.md | 136 ++++++--- clients/go/CHANGELOG.md | 154 +++++++--- clients/kotlin/CHANGELOG.md | 152 +++++++--- clients/rust/CHANGELOG.md | 162 +++++++--- clients/swift/CHANGELOG.md | 166 +++++++---- clients/typescript/CHANGELOG.md | 150 +++++++--- .../20261022-go-capability-presence.json | 2 +- .../20261022-model-source-selection.json | 14 +- .../20261113-automation-run-target.json | 16 +- ...20261113-one-time-automation-triggers.json | 13 +- .../20261123-directory-entry-is-symlink.json | 2 +- .../20261124-completion-range-integers.json | 2 +- docs/.changes/20261124-deferred-turns.json | 21 +- .../20261124-deprecate-turn-paging.json | 3 +- docs/.changes/20261124-search-channel.json | 25 +- docs/.changes/20261124-turn-union-rename.json | 12 +- scripts/change-fragments.test.ts | 156 +++++++++- scripts/change-fragments.ts | 139 ++++++++- scripts/consume-change-fragments.ts | 1 + scripts/verify-changelog.ts | 18 +- skills/changelog/SKILL.md | 161 ++++++++++ skills/groom-backlog/SKILL.md | 8 +- skills/protocol-authoring/SKILL.md | 243 +++++++++++++++ .../protocol-authoring/naming.md | 16 +- skills/release-ahp/SKILL.md | 6 +- 30 files changed, 1691 insertions(+), 841 deletions(-) delete mode 100644 .github/instructions/general-instructions.instructions.md create mode 100644 skills/changelog/SKILL.md create mode 100644 skills/protocol-authoring/SKILL.md rename .github/instructions/protocol-naming.instructions.md => skills/protocol-authoring/naming.md (97%) diff --git a/.github/instructions/general-instructions.instructions.md b/.github/instructions/general-instructions.instructions.md deleted file mode 100644 index cb0d0e55e..000000000 --- a/.github/instructions/general-instructions.instructions.md +++ /dev/null @@ -1,92 +0,0 @@ ---- -description: Rules for iterating on protocol types -applyTo: 'types/**/*.ts' ---- - -- Treat [AHP Doctrine](../../docs/guide/doctrine.md) as the design compass for protocol changes. Before adding or changing protocol types, check the doctrine's principles and design tests: durable user-visible results should be represented in state, the host should remain authoritative, minimal clients should keep a coherent experience, and agent implementation details should stay behind the host boundary. -- Name things using the [protocol naming dictionary](./protocol-naming.instructions.md): reuse its established terms, identifier and unit conventions, and message-naming patterns, and don't copy the legacy names it lists. -- Always prefer dispatching state actions (that can cause side effects) rather than making imperative RPC calls. For example, rather than a `sendMessage` command, we have a `session/turnStarted` message. -- If a state is invalid, it should be inexpressible. For example, don't do something like - - ``` - interface IApproval { - denied: boolean; - reason?: string; // only present if denied=true - } - ``` - - Instead, use a discriminated union: - - ``` - interface IDenial { - denied: true; - reason: string; - } - interface IApproval { - denied: false; - } - type IApproval = IDenial | IApproval; - ``` - - Or just inline it if it's a single property: - - ``` - interface IApproval { - deniedReason?: string; // if present, implies denied - } - ``` - -- `number` types are assumed to be 64-bit integers. If a floating point values are reasonable for a field, you MUST annotate its jsdoc with `@format float` -- Every protocol `enum` declaration MUST carry exactly one JSDoc compatibility - annotation: use `@nonexhaustive` when later protocol versions may add wire - values (clients preserve unknown raw values), and `@exhaustive` only when an - unknown value is invalid and clients must reject it. The generators validate - this contract and use it for both raw enums and discriminated unions. -- Numeric flag enums MUST carry `@bitset` in their main JSDoc block. Members - must be unsigned 32-bit integers; combinations and unknown bits remain valid - wire values. Generators use this tag, not description prose, to identify - bitsets and include each named flag's value and documentation in JSON Schema. -- For actions or commands that could be implemented by returning an array `T[]` directly, still prefer to wrap it in `{ items: T[] }` for forward compatibility. This allows adding additional fields later without breaking the shape. -- Naming discriminants for discriminated unions: - - Lifecycle / state-machine unions: name the union `Foo*State` and its discriminant enum `Foo*Status`. Variant interfaces are `Foo*State` (e.g. `ToolCallState` + `ToolCallStatus` + `ToolCallStreamingState`; `McpServerState` + `McpServerStatus` + `McpServerStartingState`; `CustomizationLoadState` + `CustomizationLoadStatus`). - - General/typological unions (not a lifecycle): name the discriminant `Foo*Kind` (e.g. `MessageAttachment` + `MessageAttachmentKind`, `ResponsePart` + `ResponsePartKind`, `ToolCallContributor` + `ToolCallContributorKind`). - - Generator note: variant interface names must differ from the union wrapper names emitted by the per-language generators (e.g. Kotlin emits `value class FooStateStarting(val value: FooStartingState)`), so name variants `Foo*State` rather than `FooStatus*`. -- After making your changes, check to make sure the documentation in `docs` is up to date. For significant new flows or features, consider adding new documentation for it. Note that Mermaid diagrams are allowed. -- Whenever you change or add an action, you must review the reducers in `types/reducers.ts` to see if that needs to be propagated into the state. If it does, add the appropriate logic and unit tests for it. -- Actions that mutate a keyed collection in state (an array whose entries are identified by a stable key such as `id`, `clientId`, `resource`, or a URI — e.g. `chats`, `customizations`, `files`, `annotations`, `activeClients`) MUST follow the established add/remove/update convention rather than inventing a new shape: - - **Upsert** (`Foo*Set`): the action carries the **full entry object**. The reducer finds the entry by key, **appends** it when absent and **replaces** it in place when present (never duplicating a key). Always name a generic create-or-replace action `Set` — not `Added`, `Changed`, or `Updated` — so the upsert convention is recognisable at a glance. - - **Remove** (`Foo*Removed`): the action carries **only the key** (e.g. `{ clientId }`, `{ fileId }`), never the whole object. The reducer is a **no-op returning the original `state`** when no entry matches. - - **Partial update** (`Foo*Updated`): the action carries the **key plus the optional fields that changed**; the reducer merges them onto the existing entry and is a **no-op returning `state`** when no entry matches. Ignore the key inside any `changes` payload so it can't be reassigned. - - Prefer a key-only **remove** action over an upsert that accepts a nullable/sentinel "unset" value (e.g. do not model removal as `Changed` with `entry: null`). - - Reducer mechanics are uniform: `const idx = list.findIndex(x => x. === action.)`, branch on `idx < 0`, copy immutably (`list.slice()` / `[...list]`), then write or `splice`, and return `{ ...state, : next }`. Every branch (insert, replace, remove, no-op) needs a fixture in `types/test-cases/reducers/` to keep `types/reducers.ts` at 100% branch coverage. -- Keep `@preserveUnknownMembers` on automation patch replacement types, shared - types, and union variants; annotate new nested fixed-schema objects too. -- Never update the protocol version unless you were instructed to do so. - -## Finalizing changes - -Before declaring a protocol repo change complete, run `npm run generate` and `npm run test` from the repo root. Resolve any generated-output, typecheck, lint, test, or generator issues those commands expose before handing the change back. - -## Running toolchains you don't have locally - -A spec change ripples into every `clients//` mirror, so you often need to build/test a client whose toolchain isn't installed on your machine. **Don't skip verification** — run it in a container with `podman`. Use these pinned images so every agent verifies against the same environment (add a row when you containerize another toolchain so the images stay consistent): - -| Toolchain | Image | Notes | -| --- | --- | --- | -| JDK 17 (Kotlin client) | `docker.io/library/eclipse-temurin:17-jdk` | Gradle comes from the repo's `./gradlew` wrapper. | -| .NET SDK 10 (.NET client) | `mcr.microsoft.com/dotnet/sdk:10.0` | Supports `.slnx`; the test host rolls forward from .NET 8. | - -The full Swift client and tests import Apple-only `Network` and `CryptoKit`, so run them on macOS with a full Xcode install, which includes XCTest (Command Line Tools alone may lack it). Run every target; don't exclude transport targets or add platform shims to get a pass. - -Mount the **repo root** (the shared conformance fixtures under `types/test-cases/` are resolved by walking up from the working directory, so a client-dir-only mount fails) and keep build caches out of `$HOME`. Example — run the Kotlin client's tests: - -```sh -podman run --rm \ - -e GRADLE_USER_HOME=/tmp/gradle-home \ - -v "$PWD":/workspace \ - -w /workspace/clients/kotlin \ - docker.io/library/eclipse-temurin:17-jdk \ - ./gradlew test --no-daemon --console=plain -``` - -On macOS this needs a running `podman machine` (`podman machine start`). Build artifacts (`clients/kotlin/build/`, `.gradle/`) are git-ignored. diff --git a/AGENTS.md b/AGENTS.md index a4db3c43d..321f07a46 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,114 +1,38 @@ # Agent Guide — Agent Host Protocol Repo -Cross-cutting rules for AI coding agents working in this repository. Per-client -codegen conventions are in `clients/kotlin/AGENTS.md`, -`clients/swift/AGENTS.md`, `clients/go/AGENTS.md`, and -`clients/dotnet/AGENTS.md`. Editorial rules -for protocol types are in -`.github/instructions/general-instructions.instructions.md`, and the -protocol's vocabulary and naming conventions (identifiers, units, booleans, -message names, legacy names not to copy) are in -`.github/instructions/protocol-naming.instructions.md`. Release mechanics -are in [`RELEASING.md`](RELEASING.md). +This repository uses repo-scoped skills under [`skills/`](skills/) (symlinked +into `.claude/skills`, `.codex/skills`, and `.github/skills`) as the single +source of truth for task workflows and conventions. -## Adding changelog fragments +## Global invariants -This repo ships seven independently-versioned artifacts (the spec plus -the Rust / Kotlin / Swift / TypeScript / Go / .NET clients), each with its -own `CHANGELOG.md` in Keep-a-Changelog format. The publish workflows -refuse to release a tag whose matching `## [X.Y.Z]` heading is -missing. To avoid merge conflicts in shared `CHANGELOG.md` files, -normal PRs add JSON changelog fragments under `docs/.changes/` instead -of editing the changelogs directly. Release PRs collapse those fragments -into the seven changelogs with `npm run changelog:release`. +- **`types/` is canonical; never hand-edit `**/generated/**`.** After protocol + changes, run `npm run generate` and commit all regenerated schemas and client + mirrors. +- **Never bump `PROTOCOL_VERSION`** unless explicitly instructed to do so. +- **Validate before finishing:** run `npm test` at the repo root plus the build + and test suites for any affected clients (see [`CONTRIBUTING.md`](CONTRIBUTING.md)). +- **User-visible changes need a changelog fragment** under `docs/.changes/` + (never edit `CHANGELOG.md` directly on feature/fix PRs). Keep one fragment + per feature and update existing unreleased fragments instead of adding new + ones for follow-up iterations. -### When to add an entry +## Skills -Add a one-line fragment whenever your change is -**user-visible**: +Load the relevant skill before starting work in that area: -- A new, removed, renamed, or behaviourally-changed action, command, state - field, error, notification, or version constant in `types/`. -- A new, removed, or behaviourally-changed public API in one of the - `clients//` source trees (constructor signatures, exported - functions/types, transport options, reducer outputs, etc.). -- A bug fix that changes observable behaviour for a consumer of the spec or - any client. -- A security-relevant change (use `"type": "security"`). - -**Skip the fragment** when the change is purely: - -- Edits under `**/generated/**` (those mirror a `types/` change that should - have its own entry). -- Docs in `docs/`, `README.md`, comments, AGENTS.md, CONTRIBUTING.md. -- Tests, CI, lint config, formatting, internal refactors with no observable - effect. - -### Which artifact(s) to target - -Each fragment may specify a `targets` array. Omit `targets` when the same -entry applies to the spec and all clients (the common case for protocol -surface changes). Set `targets` to a subset when the change is only visible -to specific artifacts. - -Map source paths to fragment targets: - -| Source path touched | Fragment target(s) | +| Task | Skill | | --- | --- | -| `types/**` (protocol surface) | Omit `targets` (spec + all clients) unless the visibility is intentionally narrower. | -| `clients/rust/**` (non-generated) | `"targets": ["rust"]` | -| `clients/kotlin/**` (non-generated) | `"targets": ["kotlin"]` | -| `clients/swift/**` (non-generated) | `"targets": ["swift"]` | -| `clients/typescript/**` (non-generated) | `"targets": ["typescript"]` | -| `clients/go/**` (non-generated) | `"targets": ["go"]` | -| `clients/dotnet/**` (non-generated) | `"targets": ["dotnet"]` | -| `schema/**` | `"targets": ["spec"]` | -| `scripts/generate*.ts` that changes any client's generated output | Omit `targets` or list every affected target. | - -### Format - -Create a uniquely named JSON file under `docs/.changes/`, usually -`docs/.changes/YYYYMMDD-short-slug.json`. Use lowercase Keep-a-Changelog -types: `added`, `changed`, `deprecated`, `removed`, `fixed`, `security`. -Do not include the leading Markdown bullet in `message`. - -```json -{ - "type": "added", - "message": "`session/cancelTurn` action for client-initiated turn cancellation.", - "issues": [123] -} -``` - -Scoped client-only example: - -```json -{ - "type": "fixed", - "message": "`AhpClient.connect` now rejects with `AhpProtocolError` on negotiation failure.", - "targets": ["typescript"] -} -``` - -Do **not** edit `CHANGELOG.md` files for normal feature/fix PRs and do -not invent a `## [X.Y.Z]` heading. Changelogs are updated by the release -maintainer per [`RELEASING.md`](RELEASING.md). Run -`npm run verify:change-fragments` to validate fragment JSON. - -## Preserve protocol object types - -For new or changed protocol objects with a fixed schema, prefer named, reusable -types in `types/` and generated native models. Do not replace a known shape with -raw JSON to work around a generator gap. - -Reserve raw JSON for intentionally open data, such as `_meta`, JSON Schema and -tool payloads, provider extensions, and unknown variants. - -Update the canonical definitions and each affected generator. Do not hand-edit -generated files. Preserve wire names, nesting, optionality, numeric mappings, -and collection wrappers such as `{ items: ... }`. - -Check source and binary compatibility separately from JSON compatibility. -Define an explicit migration for public API changes. Keep native decoding -errors visible. Cover known shapes with shared round-trip fixtures, not -per-language serialization tests. +| Editing `types/`, reducers, or protocol docs (includes naming dictionary) | [`protocol-authoring`](skills/protocol-authoring/SKILL.md) ([naming dictionary](skills/protocol-authoring/naming.md)) | +| Adding, updating, or reviewing `docs/.changes/` changelog fragments | [`changelog`](skills/changelog/SKILL.md) | +| Cutting a coordinated AHP release or recovering publish triggers | [`release-ahp`](skills/release-ahp/SKILL.md) | +| Auditing closed PRs and triaging/implementing open issues | [`groom-backlog`](skills/groom-backlog/SKILL.md) | + +## Additional guides + +- Per-client codegen & runtime conventions: [`clients/dotnet/AGENTS.md`](clients/dotnet/AGENTS.md), + [`clients/go/AGENTS.md`](clients/go/AGENTS.md), + [`clients/kotlin/AGENTS.md`](clients/kotlin/AGENTS.md), + [`clients/swift/AGENTS.md`](clients/swift/AGENTS.md). +- Repo layout & local dev commands: [`CONTRIBUTING.md`](CONTRIBUTING.md). +- Release tags, CI guards & publishing infrastructure: [`RELEASING.md`](RELEASING.md). diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d6fe65b1..fae18b37c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,45 +33,111 @@ Spec version: `1.1.0` ### Added -- Optional typed `InitializeResult.environment.pathStyle` metadata for authoritative host path semantics. -- Optional `CreateChatParams.title` for a client-selected initial display title. -- Optional `SessionModelInfo.vendor` for the model vendor as the provider reports it. (#503) -- Experimental subscription-negotiated flow-control types using UTF-16 byte accounting, framed delivery and consumption credit notifications, and independent `reconnect.windows` metadata. (#492) -- `EmptyState` variant of `Snapshot.state` for channels whose state has no fields, such as telemetry. Every experimental windowed subscription starts with `channel/snapshot`. -- Experimental TCP channel: `createTcpConnection` opens a TCP connection on the host's network and returns an empty `CreateTcpConnectionResult`. The client forwards it over a windowed subscription with `tcp/data`, `tcp/eof`, and `tcp/reset`. TCP channels do not survive the loss of the AHP connection. (#488) -- Each client exposes the notification methods that do not count against the window on a windowed subscription (`WINDOW_EXEMPT_METHODS` and `countsAgainstWindow` in TypeScript, with equivalents in the other clients), generated from the new `@windowExempt` annotation. -- `ChatState.config`, the `chat/configChanged` action, and `chatMutable` on session config properties give each chat its own config for selected settings, such as tool auto-approval, so changing them in one chat no longer changes every chat in the session. `ChatConfigState.values` holds the chat's `chatMutable` properties and does not inherit from the session; missing keys take the schema default. Optional `ChatConfigState.schema` replaces the session's schema for a chat whose agent differs from the session's. -- Optional per-chat agent provider: `CreateChatParams.provider` and `ChatSummary.provider` (mirrored on `ChatState` and `SessionChatSummary`), gated by the host-level `InitializeResult.multipleChatProviders` capability, let one session contain chats backed by different agent providers. Absent `provider` means the session's agent provider; forks and side chats keep their source chat's agent provider. -- Optional `ChangesetFile.status`, a bitset of `ChangesetFileStatus` flags (initially `Editing`), reports per-file activity through existing changeset snapshots and actions without requiring provider-specific metadata. (#538) -- Optional changeset file and operation-target nonces let hosts reject operations on superseded changes without requiring a capability or a nonce from every client. (#538) -- Adds `chat/moved`, dispatched on a chat's channel after a cross-session move with its new session, `provider` and `config.schema`. -- Optional producer-recorded `startedAt` and `duration` fields on reasoning response parts and `chat/reasoning` updates preserve each contiguous reasoning run's timing across state snapshots and history restoration. -- Optional `ToolCallResult.resultMetadata` carries MCP `CallToolResult._meta` separately from host/provider tool-call metadata and is preserved through result confirmation. -- Optional `ResourceReadParams.position` and `ResourceReadParams.length` request a byte range from `resourceRead`, and optional `ResourceReadResult.size` reports the total size of the resource when the receiver honored the range. A result without `size` is the whole resource, and a ranged `utf-8` result does not split a UTF-8 sequence. (#554) -- `resourceRead` guidance: a peer SHOULD serve reads of the URIs it publishes as content, including HTTP(S) URLs that the other peer might not be able to reach. -- Optional `McpServerCustomization.children` for MCP-served skills (SEP-2640), toggleable by id with `session/customizationToggled`. -- Optional `authenticate.accountId` carries an opaque client-local account-selection hint without changing token validation or legacy authentication. +- Add optional `InitializeResult.environment.pathStyle` (`posix` or `windows`) so clients can parse and format host paths using the host's native path grammar instead of guessing locally. +- Add optional `CreateChatParams.title` so clients can choose an initial display title when creating a chat. +- Add optional `SessionModelInfo.vendor` so clients can display the model vendor reported by the provider separately from the owning agent provider. ([#503](https://github.com/microsoft/agent-host-protocol/issues/503)) +- Add experimental windowed delivery for subscriptions so fast producers do not overwhelm slow clients: peers negotiate soft `windowBytes` and hard `maxFrameBytes` limits using UTF-16 JSON-RPC message sizes, split large messages with `channel/frame`, return cumulative credit with `channel/credit`, renegotiate fresh zero-based windows in `reconnect.windows`, and expose generated `@windowExempt` helpers (`WINDOW_EXEMPT_METHODS` and `countsAgainstWindow` in TypeScript, with native equivalents in each client) for control notifications that do not count against the window. ([#492](https://github.com/microsoft/agent-host-protocol/issues/492)) + ```ts + // Offer windowed delivery on subscribe + await client.request('subscribe', { + channel: 'ahp-terminal:/t1', + flowControl: { receive: { windowBytes: 262144, maxFrameBytes: 16384 } }, + }); + // Return cumulative UTF-16 byte credit after processing incoming data + client.notify('channel/credit', { channel: 'ahp-terminal:/t1', consumedBytes }); + ``` + Read more in [Windowed Delivery](https://microsoft.github.io/agent-host-protocol/specification/windowed-delivery). +- Add `EmptyState` (`{}`) to `Snapshot.state` for channels with no state fields, such as telemetry and TCP channels. Windowed subscriptions always start with `channel/snapshot`, whereas ordinary subscriptions may send or omit an `EmptyState` snapshot; clients must accept both and ignore unrecognized snapshot shapes. + Read more in [Channels and Subscriptions](https://microsoft.github.io/agent-host-protocol/specification/subscriptions). +- Add an experimental TCP channel (`createTcpConnection`, `tcp/data`, `tcp/eof`, and `tcp/reset`, gated by `InitializeResult.tcpConnections`) so clients can forward TCP connections opened on the host's network over a windowed subscription; connections close if the AHP transport drops. ([#488](https://github.com/microsoft/agent-host-protocol/issues/488)) + ```ts + const channel = 'ahp-tcp:/t1'; + await client.request('createTcpConnection', { channel, host: 'localhost', port: 3000 }); + await client.request('subscribe', { + channel, + flowControl: { receive: { windowBytes: 262144, maxFrameBytes: 16384 } }, + }); + client.notify('tcp/data', { channel, data: base64Bytes }); + ``` + Read more in [TCP Channel](https://microsoft.github.io/agent-host-protocol/specification/tcp-channel). +- Add per-chat configuration (`ChatState.config`, `chat/configChanged`, and `SessionConfigPropertySchema.chatMutable`) so settings like tool auto-approval can be changed for one chat without affecting sibling chats; `ChatConfigState.values` does not inherit from the session (missing keys use the schema default), and optional `ChatConfigState.schema` overrides the session schema when a chat uses a different agent provider. + ```ts + client.notify('dispatchAction', { + channel: chatUri, + clientSeq: 1, + action: { type: 'chat/configChanged', config: { autoApprove: true } }, + }); + ``` + Read more in [Chat Channel — Per-chat configuration](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#per-chat-configuration). +- Add per-chat agent providers (`CreateChatParams.provider` and `provider` on `ChatSummary`, `ChatState`, and `SessionChatSummary`, gated by `InitializeResult.multipleChatProviders`) so a single session can mix chats backed by different agent providers; omitting `provider` uses the session's provider, and forks and side chats keep their source chat's provider. + ```ts + await client.request('createChat', { + channel: sessionUri, + chat: 'ahp-chat:/', + provider: 'claude', + }); + ``` + Read more in [Chat Channel — Chat providers](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#chat-providers). +- Add optional `ChangesetFile.status` (a bitset of `ChangesetFileStatus` flags, starting with `Editing`) so hosts can report ongoing per-file edits in changeset snapshots and actions without provider-specific metadata. ([#538](https://github.com/microsoft/agent-host-protocol/issues/538)) + Read more in [Changesets — Per-file Editing Activity](https://microsoft.github.io/agent-host-protocol/guide/changesets#per-file-editing-activity). +- Add optional optimistic-concurrency nonces (`ChangesetFile.nonce` and `ChangesetOperationTarget.nonce`) so hosts can reject `invokeChangesetOperation` calls targeting superseded file edits with `Conflict` without requiring a capability or breaking clients that omit nonces. ([#538](https://github.com/microsoft/agent-host-protocol/issues/538)) +- Add the `chat/moved` action, dispatched on a chat's channel after a cross-session `moveChat` to notify subscribers of its new `session` URI and updated relative `provider` and `config.schema`. + Read more in [Chat Channel — Moving chats](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#moving-chats). +- Add optional producer-recorded `startedAt` and `duration` fields to `ReasoningResponsePart` and `chat/reasoning` actions so each contiguous reasoning run's timing is preserved across snapshots, reconnects, and history restoration. + Read more in [Chat Channel — Reasoning timing](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#reasoning-timing). +- Add optional `ToolCallResult.resultMetadata` to carry MCP `CallToolResult._meta` separately from host/provider tool-call metadata and preserve it through result confirmation. +- Add optional byte-range parameters (`position` and `length`) to `resourceRead` and a total-size indicator (`ResourceReadResult.size`) so callers can read slices of large resources without splitting UTF-8 sequences; a response without `size` contains the whole resource. ([#554](https://github.com/microsoft/agent-host-protocol/issues/554)) + ```ts + const slice = await client.request('resourceRead', { + channel: 'ahp-root://', + uri: 'file:///workspace/logo.png', + position: 0, + length: 16, + }); + // slice.size is present iff the receiver honored the byte range + ``` +- Document that peers should serve `resourceRead` requests for URIs they publish as content, including HTTP(S) URLs that the other peer cannot reach directly (such as a loopback dev server). +- Add optional `McpServerCustomization.children` to surface MCP-served skills (SEP-2640) inside MCP server customizations, toggleable by ID via `session/customizationToggled`. + Read more in [Customizations](https://microsoft.github.io/agent-host-protocol/guide/customizations). +- Add optional `AuthenticateParams.accountId` to carry an opaque client-local account hint alongside tokens so hosts can detect account switches without changing token validation. + Read more in [Authentication — Account selection hints](https://microsoft.github.io/agent-host-protocol/specification/authentication#account-selection-hints). ### Changed -- Experimental windowed subscriptions count every data notification against the window, whether sent whole or in `channel/frame` notifications. Frames carry messages larger than `maxFrameBytes` and let subscriptions share the connection. -- `Snapshot.state` can be an `EmptyState` (`{}`) for channels whose state has no fields, such as telemetry. With ordinary delivery, a server may send such a snapshot or omit it, so clients must accept both. Clients must not fail on a snapshot state that they do not recognize. -- Experimental windowed delivery removes `maximumMessageBytes` and uses one size for everything: the UTF-16 size of each JSON-RPC data message as sent, including `channel/frame` envelopes. Each message and frame counts against `windowBytes`, which is a soft target; `maxFrameBytes` remains a hard limit on each message, and receivers can return credit for stored frames. -- Store steering and queued input in one `queuedMessages` list with optional `PendingMessage.kind` (absent means queued), using the existing per-ID pending actions. New IDs append, kind changes replace in place, and UIs group steering first without changing raw order. Mirror the latest steering update in the deprecated `steeringMessage` slot for older clients. -- Experimental windowed subscriptions no longer carry byte counters across `reconnect`. Their counters start at zero on the new connection, and each `reconnect.windows` item offers new limits in `flowControl`, which the result accepts as in `subscribe`. Removes `ChannelReceiveProgress` and the `clientReceive`/`hostReceive` counters from reconnect. -- Remove the User-only restriction on client-submitted messages in `chat/turnStarted` and `chat/pendingMessageSet`. (#542) -- Experimental `CanvasState.url` is renamed to `CanvasState.uri` and holds an absolute content URI, typically HTTP(S). A client that can't load it directly reads it, and the relative references in its content, with `resourceRead`. -- Preserve unknown members on automation patch objects and nested shared types (`extra` in Rust/Swift/Kotlin, `Extra` in Go/.NET). Rust struct literals must initialize `extra` and exhaustive patterns need `..`; Go map-bearing structs lose `==` comparability; .NET record equality compares `Extra` by reference; Swift/Kotlin consumers must recompile. (#592) -- Annotations channels use `ahp-annotations:/` with the owning session's id; clients should use `AnnotationsSummary.resource` rather than derive the URI. +- Unify steering and queued input in `ChatState.queuedMessages` with an optional `PendingMessage.kind` (`steering` or `queued`, defaulting to `queued`) using existing per-ID pending actions; new IDs append, kind changes replace in place, UIs group steering first without mutating raw order, and the latest steering entry is mirrored to the deprecated `steeringMessage` slot for older clients. + ```ts + client.notify('dispatchAction', { + channel: chatUri, + clientSeq: 1, + action: { type: 'chat/pendingMessageSet', kind: 'steering', id: 'p1', message }, + }); + ``` +- Allow non-`user` message origins (such as `automation` or `systemNotification`) in client-submitted `chat/turnStarted` and `chat/pendingMessageSet` actions. ([#542](https://github.com/microsoft/agent-host-protocol/issues/542)) +- Rename experimental `CanvasState.url` to `CanvasState.uri` to hold an absolute content URI (typically HTTP(S)); clients that cannot load the URI directly can fetch it and its relative references via `resourceRead`. +- Preserve unknown JSON members on automation patch objects and nested shared types (`extra` in Rust/Swift/Kotlin, `Extra` in Go/.NET) so newer fields survive client round-trips; Rust struct literals must initialize `extra` and exhaustive patterns need `..`, Go map-bearing structs lose `==` comparability, .NET record equality compares `Extra` by reference, and Swift/Kotlin consumers must recompile. ([#592](https://github.com/microsoft/agent-host-protocol/issues/592)) +- Standardize annotations channel URIs on `ahp-annotations:/` using the owning session's ID; clients should read `AnnotationsSummary.resource` rather than constructing the URI manually. ### Fixed -- JSON Schemas accept `SessionStatus` flag combinations and forward-compatible bits as unsigned 32-bit integers, using explicit `@bitset` annotations and documenting each named flag's value and meaning. (#581) -- Removed an empty `StateAction` reference from the actions JSON Schema so validators can resolve every union member. (#580) +- Fix JSON Schemas to accept `SessionStatus` flag combinations and forward-compatible bits as unsigned 32-bit integers via explicit `@bitset` annotations, documenting each flag's value and meaning. ([#581](https://github.com/microsoft/agent-host-protocol/issues/581)) +- Fix the actions JSON Schema by removing an empty `StateAction` reference so schema validators can resolve every union member. ([#580](https://github.com/microsoft/agent-host-protocol/issues/580)) ### Security -- Add an optional `authenticate.target` identifying an MCP server by session URI and customization ID, preventing tokens from reaching other consumers that share a protected resource and scopes. +- Add optional `AuthenticateParams.target` to bind a pushed OAuth token to a specific MCP server by session URI and customization ID, preventing credentials from leaking to other consumers that share a protected resource and scopes. + ```ts + await client.request('authenticate', { + channel: 'ahp-root://', + resource: 'https://mcp.example.com', + token: accessToken, + target: { + kind: 'mcpServer', + session: sessionUri, + customizationId: 'mcp-server-1', + }, + }); + ``` + Read more in [Authentication — Token Delivery](https://microsoft.github.io/agent-host-protocol/specification/authentication#token-delivery). ## [1.0.0] — 2026-10-02 @@ -85,7 +151,7 @@ Spec version: `1.0.0` - `ChatState.changesets` and `chat/changesetsChanged` expose each chat's changeset catalogue through the subscribed chat channel. - `AutomationDefinition.disableConditions` supports `afterRuns` (`max`) and `afterDate` (`date`) rules combined with logical OR, with at most one condition per kind. Host-owned `AutomationEntry.runCount` tracks the current scheduled-run allowance. Edit conditions through `automation/updateRequested`: omission leaves them unchanged, an array replaces them, and `[]` removes all conditions without re-enabling the automation. - `ChangesetStatus.Recomputing` distinguishes refreshes of a completed result from initial changeset computation. -- `ConfigPropertySchema.minItems` and `ConfigPropertySchema.maxItems` express array cardinality for `type: "array"` config properties. (#432) +- `ConfigPropertySchema.minItems` and `ConfigPropertySchema.maxItems` express array cardinality for `type: "array"` config properties. ([#432](https://github.com/microsoft/agent-host-protocol/issues/432)) - `McpServerStartingState.blocking` flag indicating that message processing may be held on the server, and the client-dispatchable `session/mcpServerBackgroundRequested` action asking the host to background such a startup. - `AutomationSessionTemplate.customizations` lets automations carry client plugins (skills, agents, prompts, rules) that the host captures when the definition is saved, with the host-owned copies reported in `AutomationEntry.customizations` and support advertised by `AutomationCapabilities.customizations`. - Hosts can advertise chat-owned canvas channel references and synchronize live presentation metadata and source URLs on experimental per-canvas channels. @@ -140,8 +206,8 @@ Spec version: `0.8.0` - Optional `_meta` request metadata on all command parameters. - `ClientPluginCustomization` can publish child enablement decisions. -- Reserve the `x-` prefix for implementation-defined channel URI schemes, commands, notifications, and actions. (#367) -- `session/workingDirectoryReplaced` atomically replaces a working-directory entry, including a replaceable primary. (#392) +- Reserve the `x-` prefix for implementation-defined channel URI schemes, commands, notifications, and actions. ([#367](https://github.com/microsoft/agent-host-protocol/issues/367)) +- `session/workingDirectoryReplaced` atomically replaces a working-directory entry, including a replaceable primary. ([#392](https://github.com/microsoft/agent-host-protocol/issues/392)) ### Changed @@ -161,9 +227,9 @@ Spec version: `0.7.0` ### Added - Capability-gated side chats can start from a chat turn and return bounded chat transcripts as message attachments. -- Multiroot session support: `AgentCapabilities.multipleWorkingDirectories` capability (with `immutablePrimary`, which pins `workingDirectories[0]` as a fixed primary root that clients MUST NOT remove or reorder), `CreateSessionParams.workingDirectories` and `SessionMetadata.workingDirectories` (equal-peer set, mirrored onto `SessionState`/`SessionSummary`), `CreateChatParams.workingDirectories` and `ChatState`/`ChatSummary.workingDirectories` (a subset of the session's set), and the client-dispatchable `session/workingDirectorySet` / `session/workingDirectoryRemoved` and `chat/workingDirectorySet` / `chat/workingDirectoryRemoved` actions for mutating those sets. (#337) -- `result` on `ToolResultTerminalContent` (`exitCode`, `preview`, `truncated`), present once the command exits. (#323) -- Optional `isPty` metadata on `ToolResultTerminalContent` and `TerminalState` indicating whether a terminal resource is PTY-backed. (#322) +- Multiroot session support: `AgentCapabilities.multipleWorkingDirectories` capability (with `immutablePrimary`, which pins `workingDirectories[0]` as a fixed primary root that clients MUST NOT remove or reorder), `CreateSessionParams.workingDirectories` and `SessionMetadata.workingDirectories` (equal-peer set, mirrored onto `SessionState`/`SessionSummary`), `CreateChatParams.workingDirectories` and `ChatState`/`ChatSummary.workingDirectories` (a subset of the session's set), and the client-dispatchable `session/workingDirectorySet` / `session/workingDirectoryRemoved` and `chat/workingDirectorySet` / `chat/workingDirectoryRemoved` actions for mutating those sets. ([#337](https://github.com/microsoft/agent-host-protocol/issues/337)) +- `result` on `ToolResultTerminalContent` (`exitCode`, `preview`, `truncated`), present once the command exits. ([#323](https://github.com/microsoft/agent-host-protocol/issues/323)) +- Optional `isPty` metadata on `ToolResultTerminalContent` and `TerminalState` indicating whether a terminal resource is PTY-backed. ([#322](https://github.com/microsoft/agent-host-protocol/issues/322)) - Side-chat sources and origins can now carry an immutable selected-text snapshot with optional response-part provenance. ### Changed @@ -175,8 +241,8 @@ Spec version: `0.7.0` ### Removed -- `ToolResultTerminalCompleteContent`; command completion data now lives on `ToolResultTerminalContent`. (#322, #323) -- Non-standard `resource_encryption_alg_values_supported` and `resource_encryption_enc_values_supported` fields from `ProtectedResourceMetadata`. (#368) +- `ToolResultTerminalCompleteContent`; command completion data now lives on `ToolResultTerminalContent`. ([#322](https://github.com/microsoft/agent-host-protocol/issues/322), [#323](https://github.com/microsoft/agent-host-protocol/issues/323)) +- Non-standard `resource_encryption_alg_values_supported` and `resource_encryption_enc_values_supported` fields from `ProtectedResourceMetadata`. ([#368](https://github.com/microsoft/agent-host-protocol/issues/368)) ### Fixed @@ -190,8 +256,8 @@ Spec version: `0.6.0` ### Added -- `Changeset.capabilities` with a `review` presence flag (`ChangesetCapabilities`) so a changeset can advertise support for the per-file review workflow up-front on the session's changeset list. (#328) -- 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`. (#308) +- `Changeset.capabilities` with a `review` presence flag (`ChangesetCapabilities`) so a changeset can advertise support for the per-file review workflow up-front on the session's changeset list. ([#328](https://github.com/microsoft/agent-host-protocol/issues/328)) +- 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`. ([#308](https://github.com/microsoft/agent-host-protocol/issues/308)) - `chat/turnStarted` carries a `startedAt` timestamp, `chat/turnComplete`/`chat/turnCancelled`/`chat/error` carry an elapsed `duration` (milliseconds, producer's own clock), and completed turns expose their start time and duration. - Asynchronous tool-call risk assessments with a model-provided explanation and normalized safety score. - `ToolCallStatus.AuthRequired` tool call state and `chat/toolCallAuthRequired` / `chat/toolCallAuthResolved` actions so a running MCP-contributed tool call can pause mid-execution on an OAuth challenge (`McpAuthRequirement`) and resume once the client authenticates; surfaced at the session level via a new `toolAuthentication` `SessionInputRequest` variant, and `AuthenticateParams` gained an optional `scopes` field and now accepts resources discovered from a live `McpServerAuthRequiredState` or `ToolCallAuthRequiredState` in addition to `AgentInfo.protectedResources`. `chat/toolCallComplete` now also accepts a failed result while a tool call is `auth-required`, letting a client cancel that invocation without completing the authentication challenge. @@ -199,8 +265,8 @@ Spec version: `0.6.0` ### Changed -- Renamed the changeset review action `changeset/filesReviewedChanged` to `changeset/filesReviewChanged` (field `fileIds` → `files`) and made it client-dispatchable, so a reviewer can toggle a file's `reviewed` flag directly through the write-ahead reducer. (#328) -- Input requests now live in turn `responseParts`, with an optional `response` until `chat/inputCompleted` submits the result. (#327) +- Renamed the changeset review action `changeset/filesReviewedChanged` to `changeset/filesReviewChanged` (field `fileIds` → `files`) and made it client-dispatchable, so a reviewer can toggle a file's `reviewed` flag directly through the write-ahead reducer. ([#328](https://github.com/microsoft/agent-host-protocol/issues/328)) +- Input requests now live in turn `responseParts`, with an optional `response` until `chat/inputCompleted` submits the result. ([#327](https://github.com/microsoft/agent-host-protocol/issues/327)) ## [0.5.2] — 2026-07-09 @@ -241,7 +307,7 @@ Spec version: `0.5.2` `accept`, `decline`, or `cancel`) to the active turn's `responseParts`, so an elicitation's outcome persists durably, mirroring how a resolved tool-call confirmation is retained. Requests abandoned by turn end, cancel, error, or - truncation still record nothing (#324). + truncation still record nothing ([#324](https://github.com/microsoft/agent-host-protocol/issues/324)). - Optional `terminalCommandPrefix` marker on `InitializeResult` for hosts that support interpreting `!`-prefixed user messages as terminal commands. - Optional `version` field on `PluginCustomization` (inherited by @@ -267,7 +333,7 @@ Spec version: `0.5.2` a union type alias's `oneOf` (which matched any value and defeated strict `oneOf` validation), backfills the `enum`, enum-member, and type-alias `$ref`s that were previously dangling across all five schema files, and renders `null` - members as `{ "type": "null" }` (#302). + members as `{ "type": "null" }` ([#302](https://github.com/microsoft/agent-host-protocol/issues/302)). ## [0.5.1] — 2026-07-02 @@ -537,7 +603,7 @@ commits between `spec/v0.1.0` (not yet tagged) and `spec/v0.2.0`. Highlights: - Channels reorganization — every command and notification carries a top-level `channel: URI`; per-channel state types and action unions live under - `types/channels-*/` (see PR #97 and PR #152). + `types/channels-*/` (see PR [#97](https://github.com/microsoft/agent-host-protocol/issues/97) and PR [#152](https://github.com/microsoft/agent-host-protocol/issues/152)). - New `otlp/*` notifications for telemetry export (`exportLogs` / `exportTraces` / `exportMetrics`). - New `session/agentChanged`, `session/customizationRemoved`, diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 536d5e895..4357fba9f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -67,80 +67,28 @@ npx vitepress build docs Check the homepage's chat, automation, terminal and channel chapters as well as guide/specification/reference pages, search, and mobile navigation in both modes. -## Releases - -Release mechanics — tag conventions, per-client publish flows, CI guards, -and the one-time admin setup for each environment — live in -[`RELEASING.md`](RELEASING.md). For the protocol-level versioning policy, -see [`docs/specification/versioning.md`](docs/specification/versioning.md). - -## Adding changelog fragments - -This repo ships seven independently-versioned artifacts (spec + six clients), -each with its own `CHANGELOG.md` in [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) -format. The publish workflows refuse to release a tag whose matching -`## [X.Y.Z]` heading is missing. Normal PRs should not edit those shared -changelog files directly; add a JSON changelog fragment under `docs/.changes/` -instead. Release PRs collapse those fragments into the seven changelogs. - -**Add a one-line fragment** when your change is -user-visible: a new / removed / renamed / behaviourally-changed action, -command, state field, error, notification, version constant, or public client -API; an observable bug fix; or anything security-relevant. **Skip the -fragment** for generated code (`**/generated/**`), docs, tests, CI, lint -config, formatting, or internal refactors with no observable effect. - -Fragments live directly under `docs/.changes/` and use this shape: - -```json -{ - "type": "added", - "message": "`session/cancelTurn` action for client-initiated turn cancellation.", - "issues": [123] -} -``` - -`type` must be one of `added`, `changed`, `deprecated`, `removed`, `fixed`, or -`security`. `message` is the changelog bullet text without a leading `-`. -`issues` is optional. - -Omit `targets` when the entry applies to the spec and all clients (the common -case for protocol additions). Add `targets` to scope the entry to a subset: - -```json -{ - "type": "fixed", - "message": "`AhpClient.connect` now rejects with `AhpProtocolError` on negotiation failure.", - "targets": ["typescript"] -} -``` - -Path → fragment target map: - -| Source path touched | Fragment target(s) | -| --- | --- | -| `types/**` (protocol surface) | Omit `targets` (spec + all clients) unless intentionally narrower. | -| `clients//**` (non-generated) | That client only, e.g. `["rust"]`. | -| `schema/**` | `["spec"]` | -| `scripts/generate*.ts` that changes any client's generated output | Omit `targets` or list every affected target. | - -Run `npm run verify:change-fragments` to validate fragments. Don't invent a -`## [X.Y.Z]` heading or edit changelogs directly for normal PRs — that's -reserved for release time per [`RELEASING.md`](RELEASING.md). - -This rule is also encoded in [`AGENTS.md`](AGENTS.md) so AI coding agents -working in the repo follow the same convention. +## Guides and skills + +Workflow guides live under [`skills/`](skills/) as the single source of truth +for both human contributors and AI coding agents: + +- **Protocol changes & naming:** [`skills/protocol-authoring/SKILL.md`](skills/protocol-authoring/SKILL.md) + and the [protocol naming dictionary](skills/protocol-authoring/naming.md). +- **Changelog fragments:** [`skills/changelog/SKILL.md`](skills/changelog/SKILL.md) + — add a single fragment under `docs/.changes/` (or update an existing + unreleased fragment) for user-visible changes, and validate with + `npm run verify:change-fragments`. Do not edit `CHANGELOG.md` files directly + on feature/fix PRs. +- **Releases:** [`skills/release-ahp/SKILL.md`](skills/release-ahp/SKILL.md) + for the coordinated release flow, and [`RELEASING.md`](RELEASING.md) for tag + conventions, CI guards, and publishing infrastructure. +- **Per-client conventions:** [`clients/dotnet/AGENTS.md`](clients/dotnet/AGENTS.md), + [`clients/go/AGENTS.md`](clients/go/AGENTS.md), + [`clients/kotlin/AGENTS.md`](clients/kotlin/AGENTS.md), and + [`clients/swift/AGENTS.md`](clients/swift/AGENTS.md). ## Code-style and review -Editor / lint / typecheck configuration lives in this repo's `eslint.config.mjs`, -`tsconfig.json`, and (per-client) the equivalent files. Run `npm test` before +Editor / lint / typecheck configuration lives in `eslint.config.mjs`, +`tsconfig.json`, and each client's native config. Run `npm test` before opening a PR; CI runs the same checks plus per-language builds. - -When iterating on the protocol surface in `types/`, see -[`.github/instructions/general-instructions.instructions.md`](.github/instructions/general-instructions.instructions.md) -for the project's editorial rules on type changes. - -For language-specific code-gen conventions, see the `AGENTS.md` file in each -client directory (`clients/go/AGENTS.md`, `clients/kotlin/AGENTS.md`, -`clients/swift/AGENTS.md`, `clients/dotnet/AGENTS.md`). diff --git a/RELEASING.md b/RELEASING.md index 1e78be655..e11f54904 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -1,65 +1,38 @@ # Releasing AHP -This document covers the mechanics of cutting a release of any shippable -artifact in this repo. For the protocol-level versioning policy (SemVer -rules for the spec itself, the supported-version window, etc.) see -[`docs/specification/versioning.md`](docs/specification/versioning.md). +Reference for AHP release conventions, CI guards, and publishing +infrastructure. + +- **Step-by-step coordinated release workflow:** + [`skills/release-ahp/SKILL.md`](skills/release-ahp/SKILL.md) (including + two-commit PR structure, pre-merge tag pushing, website promotion, and + missed-trigger recovery). +- **Changelog fragment rules:** + [`skills/changelog/SKILL.md`](skills/changelog/SKILL.md). +- **Protocol versioning policy:** + [`docs/specification/versioning.md`](docs/specification/versioning.md). ## Release model -Every shippable artifact in this repo is versioned independently using its -ecosystem's native SemVer. The protocol specification is a seventh artifact -with its own release cadence. Each client release advertises which protocol -versions it supports via a generated `SUPPORTED_PROTOCOL_VERSIONS` constant -and a checked-in `clients//release-metadata.json`. +Every shippable artifact in this repo (the protocol spec plus the six language +clients) is versioned independently using its ecosystem's native SemVer, and +each client advertises supported protocol versions via a generated +`SUPPORTED_PROTOCOL_VERSIONS` constant and `clients//release-metadata.json`. -For a coordinated release, use **one PR with two commits**: +Coordinated releases ship in **one PR with two commits** (release commit + +post-release development bump and `STABLE_DOC_VERSIONS` promotion), with all +seven release tags pushed at the first commit's SHA after approval and CI pass +but **before merging** (using a merge commit). See +[`skills/release-ahp/SKILL.md`](skills/release-ahp/SKILL.md) for the exact +commands. -1. Prepare and validate the release manifests, changelogs, and generated files - at `X.Y.Z`. Record this release commit's SHA; all seven tags point here. -2. Advance `PROTOCOL_VERSION` to the next development version and promote - `X.Y.Z` in `STABLE_DOC_VERSIONS` **in the same commit and PR**. Keep the - released compatibility baselines unchanged unless intentionally revising - the compatibility policy. - -Create the bare `vX.Y.Z` tag locally at the first commit before validating the -second commit with `npm test` and `npm run docs:build`. After all required CI -checks and collaborator approvals pass, push each release tag separately, -verify the remote tags point at the release SHA, then merge the PR with a merge -commit. **Do not enable auto-merge before pushing the tags.** Tag pushes start -publishing before the PR merges; this ordering ensures the tag needed by the -documentation build already exists when the merge triggers deployment. - -See [Updating published documentation](#updating-published-documentation) and -the [release skill](skills/release-ahp/SKILL.md) for the full coordinated flow. -Do not defer documentation promotion to another PR. - -## Changelog fragments - -Normal feature/fix PRs do **not** edit `CHANGELOG.md` files directly. They add -one or more JSON fragments under `docs/.changes/`; omitting `targets` applies -the entry to the spec and all six clients, while `targets` can scope an entry -to any subset of `spec`, `rust`, `kotlin`, `typescript`, `swift`, `go`, and -`dotnet`. - -Before tagging a coordinated release, collapse those fragments into the seven -Keep-a-Changelog files: +To collapse changelog fragments into the seven Keep-a-Changelog files (or a +single-artifact subset via `--targets `): ```sh npm run changelog:release -- --version X.Y.Z --date YYYY-MM-DD ``` -By default the command targets all artifacts. For a single-artifact hotfix, pass -`--targets rust` (or `spec`, `kotlin`, `typescript`, `swift`, `go`, `dotnet`; comma-join -multiple targets for a subset). The command creates or replaces the -`## [X.Y.Z] — YYYY-MM-DD` section in each selected artifact changelog, adds the -`Spec version` / `Implements AHP` line, groups fragment messages under standard -`Added` / `Changed` / `Fixed` subsections, and deletes consumed fragment files. -If a fragment also targets artifacts not included in `--targets`, the command -rewrites that fragment with the remaining targets so a later release can still -consume it. Run `npm run verify:change-fragments` before release if you only -want to validate fragment JSON without consuming it. - ## Tag conventions | Artifact | Tag pattern | Workflow | Registry / discovery | @@ -75,7 +48,8 @@ want to validate fragment JSON without consuming it. > **Why Swift gets the bare semver tag namespace:** SwiftPM only resolves > packages by matching plain `X.Y.Z` / `vX.Y.Z` git tags at the manifest's > repo root. Path-prefixed tags like `swift/v0.2.0` are invisible to it. Bare -> semver tags at this repo's root are therefore reserved for Swift releases. +> semver tags at this repo's root are therefore reserved for Swift releases +> (and also used by the docs builder to materialize stable doc snapshots). > **Why Go uses the `clients/go/` prefix:** Go's module-version resolution > for sub-module paths requires the tag prefix to match the module's @@ -83,190 +57,33 @@ want to validate fragment JSON without consuming it. > Without the prefix, `go get github.com/microsoft/agent-host-protocol/clients/go@vX.Y.Z` > would fail to find a matching tag. -> **Why TypeScript and Kotlin publish from Azure DevOps:** the npm -> registry publish for `@microsoft/agent-host-protocol` and the Maven -> Central publish for `com.microsoft.agenthostprotocol:agent-host-protocol` -> both go through Microsoft's ESRP-backed `vscode-engineering` pipeline -> templates (1ES-hosted agents, signed publish, retention policy) — that -> machinery lives in Azure DevOps. GitHub Actions cannot trigger an ADO -> pipeline in this repo (PATs are not permitted), so the ADO pipelines -> own the `typescript/vX.Y.Z` and `kotlin/vX.Y.Z` tag triggers directly -> and run the same validation steps (tag ↔ manifest match, CHANGELOG -> entry, release metadata, generated-source freshness, full client build -> + tests) before handing off to ESRP. Each pipeline can also be -> triggered manually from the ADO UI as a hotfix escape hatch. - -## Per-client release flow - -These recipes describe individual artifact releases. For coordinated releases, -use the two-commit PR and pre-merge tag order above instead of each recipe's -merge-then-tag order. - -### Rust (`rust/vX.Y.Z`) - -1. Bump `[workspace.package].version` in `clients/rust/Cargo.toml` (this - bumps all three crates — `ahp-types`, `ahp`, `ahp-ws` — together; the - workspace is intentionally version-locked). -2. Update cross-crate `version = "0.X.Y"` pins in - `[workspace.dependencies]` and any per-crate dependency declarations. -3. Run `npm run generate:metadata` and commit the regenerated - `clients/rust/release-metadata.json`. -4. Collapse Rust-scoped changelog fragments with - `npm run changelog:release -- --version X.Y.Z --targets rust`. -5. Merge to `main`. -6. Tag: `git tag rust/v0.X.Y && git push origin rust/v0.X.Y`. -7. `publish-rust.yml` validates, then publishes `ahp-types`, `ahp`, and - `ahp-ws` to crates.io in dependency order. - -### Kotlin (`kotlin/vX.Y.Z`) - -1. Bump `VERSION_NAME` in `clients/kotlin/gradle.properties`. Drop any - `-SNAPSHOT` suffix (the publish workflow rejects snapshot tags). -2. Run `npm run generate:metadata` and commit the regenerated - `clients/kotlin/release-metadata.json`. -3. Collapse Kotlin-scoped changelog fragments with - `npm run changelog:release -- --version X.Y.Z --targets kotlin`. -4. Merge to `main`. -5. Tag: `git tag kotlin/v0.X.Y && git push origin kotlin/v0.X.Y`. -6. `clients/kotlin/pipeline.yml` (Azure DevOps) validates the tag, - re-runs the generator + Gradle `check`, fetches the GPG signing key - from the `vscode` Key Vault, stages **and GPG-signs** a Maven - repository layout under `clients/kotlin/build/maven-staging/`, and - hands it to ESRP (`contenttype: maven`). ESRP uploads the signed - artifacts to Maven Central via the Sonatype Central Portal. No manual - Sonatype UI interaction is required. -7. Bump `VERSION_NAME` back to the next `-SNAPSHOT` for ongoing development. - -### TypeScript (`typescript/vX.Y.Z`) - -The TypeScript client publishes from an Azure DevOps pipeline -(`clients/typescript/pipeline.yml`) that extends Microsoft's internal -`vscode-engineering` npm-package template. ADO owns the tag trigger -directly — there is no GitHub Actions bridge — because this repo cannot -use PATs to trigger ADO from GHA. - -1. Bump `version` in `clients/typescript/package.json`. -2. `cd clients/typescript && npm install` to refresh the lockfile. -3. Run `npm run generate:metadata` from the repo root and commit the - regenerated `clients/typescript/release-metadata.json`. -4. Collapse TypeScript-scoped changelog fragments with - `npm run changelog:release -- --version X.Y.Z --targets typescript`. -5. Merge to `main`. -6. Tag: `git tag typescript/v0.X.Y && git push origin typescript/v0.X.Y`. -7. The ADO pipeline picks up the tag, validates it against - `package.json`, runs `verify:release-metadata`, `verify:changelog`, - and the regen + build + test sequence, then publishes - `@microsoft/agent-host-protocol` to npm with signed provenance via - the vscode-engineering template. - -The ADO pipeline can also be triggered manually from the ADO UI as a -hotfix escape hatch — manual runs publish too. Both paths funnel -through the same validation steps in the pipeline's `buildSteps` so a -release artifact can't ship from a broken state regardless of which -trigger started the run. - -### Swift (`vX.Y.Z`, bare) - -1. Update `clients/swift/VERSION` to the new bare semver string (no - leading `v`, no `-SNAPSHOT`). -2. Run `npm run generate:metadata` and commit the regenerated - `clients/swift/release-metadata.json`. -3. Collapse Swift-scoped changelog fragments with - `npm run changelog:release -- --version X.Y.Z --targets swift`. -4. Merge to `main`. -5. Tag: `git tag v0.X.Y && git push origin v0.X.Y`. **Note the absence of - any prefix** — this is the one place in the repo where bare semver tags - are correct. -6. `publish-swift.yml` validates the tag against `clients/swift/VERSION`, - builds and tests the Swift package on macOS, and publishes a GitHub - Release. SwiftPM consumers resolve the tag directly; no registry push - happens. - -### Go (`clients/go/vX.Y.Z`) - -1. Update `clients/go/VERSION` to the new bare semver string (no leading - `v`, no `-SNAPSHOT`). -2. Run `npm run generate:metadata` and commit the regenerated - `clients/go/release-metadata.json`. -3. Collapse Go-scoped changelog fragments with - `npm run changelog:release -- --version X.Y.Z --targets go`. -4. Merge to `main`. -5. Tag: `git tag clients/go/v0.X.Y && git push origin clients/go/v0.X.Y`. - **The `clients/go/` prefix is required** — it is what the Go module - proxy expects for sub-module tag resolution. Bare semver tags are - reserved for Swift. -6. `publish-go.yml` validates the tag against `clients/go/VERSION`, - builds + vets + tests the module, warms the Go module proxy with the - new version, and creates a GitHub Release with the CHANGELOG section - for the tag. Go consumers resolve the tag via - `go get github.com/microsoft/agent-host-protocol/clients/go@vX.Y.Z`; - no registry push happens. - -### .NET (`dotnet/vX.Y.Z`) - -1. Update `clients/dotnet/VERSION` to the new bare semver string (no - leading `v`). -2. Run `npm run generate:metadata` and commit the regenerated - `clients/dotnet/release-metadata.json`. -3. Rotate `clients/dotnet/CHANGELOG.md`. -4. Merge to `main`. -5. Tag: `git tag dotnet/v0.X.Y && git push origin dotnet/v0.X.Y`. -6. `clients/dotnet/pipeline.yml` validates the tag and release metadata, - builds and tests the solution, Authenticode-signs the assemblies through - ESRP, packs and author-signs - `Microsoft.VisualStudioCode.AgentHostProtocol` and - `Microsoft.VisualStudioCode.AgentHostProtocol.Abstractions`, and publishes - them to NuGet.org after approval. - -### Spec (`spec/vX.Y.Z`) - -1. Bump `PROTOCOL_VERSION` in `types/version/registry.ts` (and, if the - release is also adding the version to the supported list, - `SUPPORTED_PROTOCOL_VERSIONS`). -2. Update `ACTION_INTRODUCED_IN` / `NOTIFICATION_INTRODUCED_IN` for any - new symbols. -3. Run `npm run generate` to refresh schemas, generated client sources, - and metadata. -4. Collapse spec-scoped changelog fragments with - `npm run changelog:release -- --version X.Y.Z --targets spec`. -5. Merge to `main`. -6. Tag: `git tag spec/v0.X.Y && git push origin spec/v0.X.Y`. -7. `publish-spec.yml` validates, regenerates the JSON schemas from the - tagged commit, captures a `registry-snapshot.json` of the introduced-in - maps, and creates a GitHub Release with all of the above as assets. - -## Updating published documentation - -In the **same commit that bumps the next development version**, prepend the -released `X.Y.Z` to `STABLE_DOC_VERSIONS` in `docs/.vitepress/versions.ts`, -preserving older entries. For example, releasing `1.1.0` and starting `1.2.0` -sets `PROTOCOL_VERSION = '1.2.0'` and -`STABLE_DOC_VERSIONS = ['1.1.0', '1.0.0']` in the same PR. - -The homepage's specification label and the default docs version both use the -first stable entry; the draft label follows `PROTOCOL_VERSION` separately. -Pushing release tags alone does not promote the website. - -The docs builder materializes stable pages from bare `vX.Y.Z` tags. Create the -new tag locally at the release commit for `npm run docs:build`, then push it -with the other release tags after CI and review approval but **before merging** -the combined PR. Never tag the development-bump commit or merge while the -required remote tag is missing. - -After merge, confirm `Deploy Documentation` succeeds and check the live -homepage label, default docs, and version selector: `X.Y.Z` must be the default, -older releases must remain available, and only the next development version -must be labelled `(draft)`. The release is not complete until this deployment -is verified; a passing local build is not sufficient. +> **Why TypeScript, Kotlin, and .NET publish from Azure DevOps:** npm, Maven +> Central, and NuGet publishes go through Microsoft's ESRP-backed +> `vscode-engineering` pipeline templates (1ES-hosted agents, signed publish, +> retention policy). GitHub Actions cannot trigger ADO pipelines here (PATs +> are not permitted), so the ADO pipelines own the `typescript/vX.Y.Z`, +> `kotlin/vX.Y.Z`, and `dotnet/vX.Y.Z` tag triggers directly (and can also be +> triggered manually from the ADO UI as a hotfix escape hatch). + +## Single-artifact hotfix notes + +For an isolated single-artifact release (outside a coordinated release), bump +that artifact's version manifest, refresh its lockfile if applicable +(`clients/typescript`: `npm install --no-audit --no-fund`; `clients/rust`: +`cargo update -w` and update `[workspace.dependencies]` pins; `clients/kotlin`: +drop `-SNAPSHOT` before tagging and restore `-SNAPSHOT` afterward), run +`npm run generate:metadata`, consume scoped fragments with +`npm run changelog:release -- --version X.Y.Z --targets `, merge to +`main`, and push the matching tag from the table above. ## What CI guards against | Drift caught by | How | | --- | --- | -| `Version.generated.{rs,kt,swift,go}` ↔ `types/version/registry.ts` | Per-language CI job re-runs `npm run generate:` and fails on diff. | +| `Version.generated.{rs,kt,swift,go,cs}` ↔ `types/version/registry.ts` | Per-language CI job re-runs `npm run generate:` and fails on diff. | | `release-metadata.json` ↔ native manifest + registry | `npm run verify:release-metadata` (also gated on every publish workflow). | -| `docs/.changes/*.json` shape | `npm run verify:change-fragments` validates fragment type, message, targets, and issue references before release collapse. | -| Native package version ↔ matching CHANGELOG entry | `npm run verify:changelog` (in CI, and re-run in `publish-rust.yml` / `publish-swift.yml` / `publish-go.yml` / both ADO `pipeline.yml`s). | +| `docs/.changes/*.json` shape | `npm run verify:change-fragments` validates fragment type, message, optional details, targets, and issue references before release collapse. | +| Native package version ↔ matching CHANGELOG entry | `npm run verify:changelog` (in CI, and re-run in publish workflows and ADO pipelines). | | Tag ↔ manifest version | Every tag-driven publish workflow's "Verify tag matches" step. | | Tag-derived version ↔ CHANGELOG entry | Every tag-driven publish workflow's `grep -qE '^## \[\]'` step (defense-in-depth alongside `verify:changelog`). | @@ -281,4 +98,5 @@ function. They are set per-repo by a maintainer with admin access. | Azure DevOps Service Connection to ESRP + Maven Central provisioning | `clients/kotlin/pipeline.yml` (vscode-engineering `maven-package` template) | Uploads the GPG-signed staged Maven layout to Maven Central via the Sonatype Central Portal. Provisioned inside the Microsoft ADO tenant; no GitHub secret required. | | `vscode` Key Vault secrets `maven-gpg-private-key` + `maven-gpg-passphrase` | vscode-engineering `maven-package` template (`AzureKeyVault@2`), consumed by `clients/kotlin/pipeline.yml` | GPG key used to sign the Kotlin Maven artifacts (`.asc`) — Maven Central requires PGP signatures and ESRP does not generate them. The matching public key must be published to a keyserver. Provisioned inside the Microsoft ADO tenant; no GitHub secret required. | | Azure DevOps Service Connection to ESRP + npm publish creds | `clients/typescript/pipeline.yml` (vscode-engineering `npm-package` template) | Authenticates `npm publish` for `@microsoft/agent-host-protocol`. Provisioned inside the Microsoft ADO tenant; no GitHub secret required. | +| Azure DevOps Service Connection to ESRP + NuGet approval | `clients/dotnet/pipeline.yml` | Authenticode-signs assemblies, packs and author-signs NuGet packages, and publishes to NuGet.org after approval. | | (none required) | `publish-swift.yml`, `publish-spec.yml`, `publish-go.yml` | All three use the default `GITHUB_TOKEN` to create GitHub Releases. No external registry credentials needed — SwiftPM and the Go module proxy index tags directly. | diff --git a/clients/dotnet/CHANGELOG.md b/clients/dotnet/CHANGELOG.md index 61fe507e5..4b2470b71 100644 --- a/clients/dotnet/CHANGELOG.md +++ b/clients/dotnet/CHANGELOG.md @@ -18,45 +18,111 @@ Implements AHP 1.1.0. ### Added -- Optional typed `InitializeResult.environment.pathStyle` metadata for authoritative host path semantics. -- Optional `CreateChatParams.title` for a client-selected initial display title. -- Optional `SessionModelInfo.vendor` for the model vendor as the provider reports it. (#503) -- Experimental subscription-negotiated flow-control types using UTF-16 byte accounting, framed delivery and consumption credit notifications, and independent `reconnect.windows` metadata. (#492) -- `EmptyState` variant of `Snapshot.state` for channels whose state has no fields, such as telemetry. Every experimental windowed subscription starts with `channel/snapshot`. -- Experimental TCP channel: `createTcpConnection` opens a TCP connection on the host's network and returns an empty `CreateTcpConnectionResult`. The client forwards it over a windowed subscription with `tcp/data`, `tcp/eof`, and `tcp/reset`. TCP channels do not survive the loss of the AHP connection. (#488) -- Each client exposes the notification methods that do not count against the window on a windowed subscription (`WINDOW_EXEMPT_METHODS` and `countsAgainstWindow` in TypeScript, with equivalents in the other clients), generated from the new `@windowExempt` annotation. -- `ChatState.config`, the `chat/configChanged` action, and `chatMutable` on session config properties give each chat its own config for selected settings, such as tool auto-approval, so changing them in one chat no longer changes every chat in the session. `ChatConfigState.values` holds the chat's `chatMutable` properties and does not inherit from the session; missing keys take the schema default. Optional `ChatConfigState.schema` replaces the session's schema for a chat whose agent differs from the session's. -- Optional per-chat agent provider: `CreateChatParams.provider` and `ChatSummary.provider` (mirrored on `ChatState` and `SessionChatSummary`), gated by the host-level `InitializeResult.multipleChatProviders` capability, let one session contain chats backed by different agent providers. Absent `provider` means the session's agent provider; forks and side chats keep their source chat's agent provider. -- Optional `ChangesetFile.status`, a bitset of `ChangesetFileStatus` flags (initially `Editing`), reports per-file activity through existing changeset snapshots and actions without requiring provider-specific metadata. (#538) -- Optional changeset file and operation-target nonces let hosts reject operations on superseded changes without requiring a capability or a nonce from every client. (#538) -- Adds `chat/moved`, dispatched on a chat's channel after a cross-session move with its new session, `provider` and `config.schema`. -- Optional producer-recorded `startedAt` and `duration` fields on reasoning response parts and `chat/reasoning` updates preserve each contiguous reasoning run's timing across state snapshots and history restoration. -- Optional `ToolCallResult.resultMetadata` carries MCP `CallToolResult._meta` separately from host/provider tool-call metadata and is preserved through result confirmation. -- Optional `ResourceReadParams.position` and `ResourceReadParams.length` request a byte range from `resourceRead`, and optional `ResourceReadResult.size` reports the total size of the resource when the receiver honored the range. A result without `size` is the whole resource, and a ranged `utf-8` result does not split a UTF-8 sequence. (#554) -- `resourceRead` guidance: a peer SHOULD serve reads of the URIs it publishes as content, including HTTP(S) URLs that the other peer might not be able to reach. -- Optional `McpServerCustomization.children` for MCP-served skills (SEP-2640), toggleable by id with `session/customizationToggled`. -- Optional `authenticate.accountId` carries an opaque client-local account-selection hint without changing token validation or legacy authentication. +- Add optional `InitializeResult.environment.pathStyle` (`posix` or `windows`) so clients can parse and format host paths using the host's native path grammar instead of guessing locally. +- Add optional `CreateChatParams.title` so clients can choose an initial display title when creating a chat. +- Add optional `SessionModelInfo.vendor` so clients can display the model vendor reported by the provider separately from the owning agent provider. ([#503](https://github.com/microsoft/agent-host-protocol/issues/503)) +- Add experimental windowed delivery for subscriptions so fast producers do not overwhelm slow clients: peers negotiate soft `windowBytes` and hard `maxFrameBytes` limits using UTF-16 JSON-RPC message sizes, split large messages with `channel/frame`, return cumulative credit with `channel/credit`, renegotiate fresh zero-based windows in `reconnect.windows`, and expose generated `@windowExempt` helpers (`WindowedDelivery.ExemptMethods` and `WindowedDelivery.CountsAgainstWindow` in .NET) for control notifications that do not count against the window. ([#492](https://github.com/microsoft/agent-host-protocol/issues/492)) + ```ts + // Offer windowed delivery on subscribe + await client.request('subscribe', { + channel: 'ahp-terminal:/t1', + flowControl: { receive: { windowBytes: 262144, maxFrameBytes: 16384 } }, + }); + // Return cumulative UTF-16 byte credit after processing incoming data + client.notify('channel/credit', { channel: 'ahp-terminal:/t1', consumedBytes }); + ``` + Read more in [Windowed Delivery](https://microsoft.github.io/agent-host-protocol/specification/windowed-delivery). +- Add `EmptyState` (`{}`) to `Snapshot.state` for channels with no state fields, such as telemetry and TCP channels. Windowed subscriptions always start with `channel/snapshot`, whereas ordinary subscriptions may send or omit an `EmptyState` snapshot; clients must accept both and ignore unrecognized snapshot shapes. + Read more in [Channels and Subscriptions](https://microsoft.github.io/agent-host-protocol/specification/subscriptions). +- Add an experimental TCP channel (`createTcpConnection`, `tcp/data`, `tcp/eof`, and `tcp/reset`, gated by `InitializeResult.tcpConnections`) so clients can forward TCP connections opened on the host's network over a windowed subscription; connections close if the AHP transport drops. ([#488](https://github.com/microsoft/agent-host-protocol/issues/488)) + ```ts + const channel = 'ahp-tcp:/t1'; + await client.request('createTcpConnection', { channel, host: 'localhost', port: 3000 }); + await client.request('subscribe', { + channel, + flowControl: { receive: { windowBytes: 262144, maxFrameBytes: 16384 } }, + }); + client.notify('tcp/data', { channel, data: base64Bytes }); + ``` + Read more in [TCP Channel](https://microsoft.github.io/agent-host-protocol/specification/tcp-channel). +- Add per-chat configuration (`ChatState.config`, `chat/configChanged`, and `SessionConfigPropertySchema.chatMutable`) so settings like tool auto-approval can be changed for one chat without affecting sibling chats; `ChatConfigState.values` does not inherit from the session (missing keys use the schema default), and optional `ChatConfigState.schema` overrides the session schema when a chat uses a different agent provider. + ```ts + client.notify('dispatchAction', { + channel: chatUri, + clientSeq: 1, + action: { type: 'chat/configChanged', config: { autoApprove: true } }, + }); + ``` + Read more in [Chat Channel — Per-chat configuration](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#per-chat-configuration). +- Add per-chat agent providers (`CreateChatParams.provider` and `provider` on `ChatSummary`, `ChatState`, and `SessionChatSummary`, gated by `InitializeResult.multipleChatProviders`) so a single session can mix chats backed by different agent providers; omitting `provider` uses the session's provider, and forks and side chats keep their source chat's provider. + ```ts + await client.request('createChat', { + channel: sessionUri, + chat: 'ahp-chat:/', + provider: 'claude', + }); + ``` + Read more in [Chat Channel — Chat providers](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#chat-providers). +- Add optional `ChangesetFile.status` (a bitset of `ChangesetFileStatus` flags, starting with `Editing`) so hosts can report ongoing per-file edits in changeset snapshots and actions without provider-specific metadata. ([#538](https://github.com/microsoft/agent-host-protocol/issues/538)) + Read more in [Changesets — Per-file Editing Activity](https://microsoft.github.io/agent-host-protocol/guide/changesets#per-file-editing-activity). +- Add optional optimistic-concurrency nonces (`ChangesetFile.nonce` and `ChangesetOperationTarget.nonce`) so hosts can reject `invokeChangesetOperation` calls targeting superseded file edits with `Conflict` without requiring a capability or breaking clients that omit nonces. ([#538](https://github.com/microsoft/agent-host-protocol/issues/538)) +- Add the `chat/moved` action, dispatched on a chat's channel after a cross-session `moveChat` to notify subscribers of its new `session` URI and updated relative `provider` and `config.schema`. + Read more in [Chat Channel — Moving chats](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#moving-chats). +- Add optional producer-recorded `startedAt` and `duration` fields to `ReasoningResponsePart` and `chat/reasoning` actions so each contiguous reasoning run's timing is preserved across snapshots, reconnects, and history restoration. + Read more in [Chat Channel — Reasoning timing](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#reasoning-timing). +- Add optional `ToolCallResult.resultMetadata` to carry MCP `CallToolResult._meta` separately from host/provider tool-call metadata and preserve it through result confirmation. +- Add optional byte-range parameters (`position` and `length`) to `resourceRead` and a total-size indicator (`ResourceReadResult.size`) so callers can read slices of large resources without splitting UTF-8 sequences; a response without `size` contains the whole resource. ([#554](https://github.com/microsoft/agent-host-protocol/issues/554)) + ```ts + const slice = await client.request('resourceRead', { + channel: 'ahp-root://', + uri: 'file:///workspace/logo.png', + position: 0, + length: 16, + }); + // slice.size is present iff the receiver honored the byte range + ``` +- Document that peers should serve `resourceRead` requests for URIs they publish as content, including HTTP(S) URLs that the other peer cannot reach directly (such as a loopback dev server). +- Add optional `McpServerCustomization.children` to surface MCP-served skills (SEP-2640) inside MCP server customizations, toggleable by ID via `session/customizationToggled`. + Read more in [Customizations](https://microsoft.github.io/agent-host-protocol/guide/customizations). +- Add optional `AuthenticateParams.accountId` to carry an opaque client-local account hint alongside tokens so hosts can detect account switches without changing token validation. + Read more in [Authentication — Account selection hints](https://microsoft.github.io/agent-host-protocol/specification/authentication#account-selection-hints). ### Changed -- Experimental windowed subscriptions count every data notification against the window, whether sent whole or in `channel/frame` notifications. Frames carry messages larger than `maxFrameBytes` and let subscriptions share the connection. -- `Snapshot.state` can be an `EmptyState` (`{}`) for channels whose state has no fields, such as telemetry. With ordinary delivery, a server may send such a snapshot or omit it, so clients must accept both. Clients must not fail on a snapshot state that they do not recognize. -- Experimental windowed delivery removes `maximumMessageBytes` and uses one size for everything: the UTF-16 size of each JSON-RPC data message as sent, including `channel/frame` envelopes. Each message and frame counts against `windowBytes`, which is a soft target; `maxFrameBytes` remains a hard limit on each message, and receivers can return credit for stored frames. -- Store steering and queued input in one `queuedMessages` list with optional `PendingMessage.kind` (absent means queued), using the existing per-ID pending actions. New IDs append, kind changes replace in place, and UIs group steering first without changing raw order. Mirror the latest steering update in the deprecated `steeringMessage` slot for older clients. -- Experimental windowed subscriptions no longer carry byte counters across `reconnect`. Their counters start at zero on the new connection, and each `reconnect.windows` item offers new limits in `flowControl`, which the result accepts as in `subscribe`. Removes `ChannelReceiveProgress` and the `clientReceive`/`hostReceive` counters from reconnect. -- Remove the User-only restriction on client-submitted messages in `chat/turnStarted` and `chat/pendingMessageSet`. (#542) -- Experimental `CanvasState.url` is renamed to `CanvasState.uri` and holds an absolute content URI, typically HTTP(S). A client that can't load it directly reads it, and the relative references in its content, with `resourceRead`. -- Preserve unknown members on automation patch objects and nested shared types (`extra` in Rust/Swift/Kotlin, `Extra` in Go/.NET). Rust struct literals must initialize `extra` and exhaustive patterns need `..`; Go map-bearing structs lose `==` comparability; .NET record equality compares `Extra` by reference; Swift/Kotlin consumers must recompile. (#592) -- Annotations channels use `ahp-annotations:/` with the owning session's id; clients should use `AnnotationsSummary.resource` rather than derive the URI. +- Unify steering and queued input in `ChatState.queuedMessages` with an optional `PendingMessage.kind` (`steering` or `queued`, defaulting to `queued`) using existing per-ID pending actions; new IDs append, kind changes replace in place, UIs group steering first without mutating raw order, and the latest steering entry is mirrored to the deprecated `steeringMessage` slot for older clients. + ```ts + client.notify('dispatchAction', { + channel: chatUri, + clientSeq: 1, + action: { type: 'chat/pendingMessageSet', kind: 'steering', id: 'p1', message }, + }); + ``` +- Allow non-`user` message origins (such as `automation` or `systemNotification`) in client-submitted `chat/turnStarted` and `chat/pendingMessageSet` actions. ([#542](https://github.com/microsoft/agent-host-protocol/issues/542)) +- Rename experimental `CanvasState.url` to `CanvasState.uri` to hold an absolute content URI (typically HTTP(S)); clients that cannot load the URI directly can fetch it and its relative references via `resourceRead`. +- Preserve unknown JSON members on automation patch objects and nested shared types via an `Extra` property so newer fields survive round-trips; .NET record equality compares `Extra` by reference. ([#592](https://github.com/microsoft/agent-host-protocol/issues/592)) +- Standardize annotations channel URIs on `ahp-annotations:/` using the owning session's ID; clients should read `AnnotationsSummary.resource` rather than constructing the URI manually. ### Fixed -- Decoding a snapshot whose state has an unrecognized form no longer fails. The state is kept as an `Unknown` variant with its raw JSON, and state mirrors ignore it. Go no longer decodes such a state as an empty `RootState`. -- State mirrors leave confirmed state unchanged when an action envelope carries a rejection reason. (#586) +- Fix snapshot decoding so unrecognized channel states no longer fail; unknown states are preserved as an `Unknown` variant with their raw JSON and ignored by state mirrors. +- Fix state mirrors to leave confirmed state unchanged when an incoming action envelope carries a `rejectionReason`. ([#586](https://github.com/microsoft/agent-host-protocol/issues/586)) ### Security -- Add an optional `authenticate.target` identifying an MCP server by session URI and customization ID, preventing tokens from reaching other consumers that share a protected resource and scopes. +- Add optional `AuthenticateParams.target` to bind a pushed OAuth token to a specific MCP server by session URI and customization ID, preventing credentials from leaking to other consumers that share a protected resource and scopes. + ```ts + await client.request('authenticate', { + channel: 'ahp-root://', + resource: 'https://mcp.example.com', + token: accessToken, + target: { + kind: 'mcpServer', + session: sessionUri, + customizationId: 'mcp-server-1', + }, + }); + ``` + Read more in [Authentication — Token Delivery](https://microsoft.github.io/agent-host-protocol/specification/authentication#token-delivery). ## [1.0.0] — 2026-10-02 @@ -71,7 +137,7 @@ Implements AHP 1.0.0. - `ChatState.changesets` and `chat/changesetsChanged` expose each chat's changeset catalogue through the subscribed chat channel. - `AutomationDefinition.disableConditions` supports `afterRuns` (`max`) and `afterDate` (`date`) rules combined with logical OR, with at most one condition per kind. Host-owned `AutomationEntry.runCount` tracks the current scheduled-run allowance. Edit conditions through `automation/updateRequested`: omission leaves them unchanged, an array replaces them, and `[]` removes all conditions without re-enabling the automation. - `ChangesetStatus.Recomputing` distinguishes refreshes of a completed result from initial changeset computation. -- `ConfigPropertySchema.minItems` and `ConfigPropertySchema.maxItems` express array cardinality for `type: "array"` config properties. (#432) +- `ConfigPropertySchema.minItems` and `ConfigPropertySchema.maxItems` express array cardinality for `type: "array"` config properties. ([#432](https://github.com/microsoft/agent-host-protocol/issues/432)) - `McpServerStartingState.blocking` flag indicating that message processing may be held on the server, and the client-dispatchable `session/mcpServerBackgroundRequested` action asking the host to background such a startup. - `AutomationSessionTemplate.customizations` lets automations carry client plugins (skills, agents, prompts, rules) that the host captures when the definition is saved, with the host-owned copies reported in `AutomationEntry.customizations` and support advertised by `AutomationCapabilities.customizations`. - Hosts can advertise chat-owned canvas channel references and synchronize live presentation metadata and source URLs on experimental per-canvas channels. @@ -91,9 +157,9 @@ Implements AHP 1.0.0. ### Fixed -- Generated action and union-variant records now pin their own literal discriminator as the property initializer, so constructing one without setting the discriminator serializes the correct wire value. Previously the property fell back to the type's zero value — the *first* enum member, which silently emitted the wrong discriminator on every record but the first. (#366) -- Open (`@nonexhaustive`) protocol enums no longer fail decoding when a newer peer sends a wire value this build does not recognize. They are now generated as readonly structs wrapping the raw wire string (with the known values as static members) instead of closed C# enums, so an added enum value round-trips verbatim as `versioning.md` requires. Each open enum gets a generated converter, so the path no longer relies on reflection. (#366) -- Discriminated unions now derive whether an unrecognized discriminator is preserved from the discriminator enum's `@exhaustive` / `@nonexhaustive` annotation, matching the other generators. `SessionOrigin` and `CustomizationEnablement` previously rejected a discriminator added by a newer peer even though their discriminants are open; `ChangesetOperationTarget` is likewise derived now. (#366) +- Generated action and union-variant records now pin their own literal discriminator as the property initializer, so constructing one without setting the discriminator serializes the correct wire value. Previously the property fell back to the type's zero value — the *first* enum member, which silently emitted the wrong discriminator on every record but the first. ([#366](https://github.com/microsoft/agent-host-protocol/issues/366)) +- Open (`@nonexhaustive`) protocol enums no longer fail decoding when a newer peer sends a wire value this build does not recognize. They are now generated as readonly structs wrapping the raw wire string (with the known values as static members) instead of closed C# enums, so an added enum value round-trips verbatim as `versioning.md` requires. Each open enum gets a generated converter, so the path no longer relies on reflection. ([#366](https://github.com/microsoft/agent-host-protocol/issues/366)) +- Discriminated unions now derive whether an unrecognized discriminator is preserved from the discriminator enum's `@exhaustive` / `@nonexhaustive` annotation, matching the other generators. `SessionOrigin` and `CustomizationEnablement` previously rejected a discriminator added by a newer peer even though their discriminants are open; `ChangesetOperationTarget` is likewise derived now. ([#366](https://github.com/microsoft/agent-host-protocol/issues/366)) - Preserve unknown future chat move destinations when decoding and re-encoding with the .NET client. ## [0.9.0] — 2026-08-28 @@ -104,7 +170,7 @@ Implements AHP 0.9.0. - Automation catalogue and automation-run channels, including self-contained host-defined event triggers and automation-origin messages, for shared trigger-based agent session workflows. - Turn errors are durable response parts, and resumable errors can reopen the same turn through `chat/turnResume`. -- First-party .NET client with generated AHP 0.9.0 wire types, reducers, JSON-RPC and multi-host clients, and an integrated WebSocket transport targeting `netstandard2.0` and `net8.0`. (#206, #214) +- First-party .NET client with generated AHP 0.9.0 wire types, reducers, JSON-RPC and multi-host clients, and an integrated WebSocket transport targeting `netstandard2.0` and `net8.0`. ([#206](https://github.com/microsoft/agent-host-protocol/issues/206), [#214](https://github.com/microsoft/agent-host-protocol/issues/214)) - `ClientConfig.TimeProvider` enables deterministic request timeout, keep-alive, reconnect scheduling, and host timestamps. - `InitializeResult._meta` for hosts to advertise implementation-specific extension capabilities in initialize responses. diff --git a/clients/go/CHANGELOG.md b/clients/go/CHANGELOG.md index 9ddd37bb2..f9629fa13 100644 --- a/clients/go/CHANGELOG.md +++ b/clients/go/CHANGELOG.md @@ -20,45 +20,111 @@ Implements AHP 1.1.0. ### Added -- Optional typed `InitializeResult.environment.pathStyle` metadata for authoritative host path semantics. -- Optional `CreateChatParams.title` for a client-selected initial display title. -- Optional `SessionModelInfo.vendor` for the model vendor as the provider reports it. (#503) -- Experimental subscription-negotiated flow-control types using UTF-16 byte accounting, framed delivery and consumption credit notifications, and independent `reconnect.windows` metadata. (#492) -- `EmptyState` variant of `Snapshot.state` for channels whose state has no fields, such as telemetry. Every experimental windowed subscription starts with `channel/snapshot`. -- Experimental TCP channel: `createTcpConnection` opens a TCP connection on the host's network and returns an empty `CreateTcpConnectionResult`. The client forwards it over a windowed subscription with `tcp/data`, `tcp/eof`, and `tcp/reset`. TCP channels do not survive the loss of the AHP connection. (#488) -- Each client exposes the notification methods that do not count against the window on a windowed subscription (`WINDOW_EXEMPT_METHODS` and `countsAgainstWindow` in TypeScript, with equivalents in the other clients), generated from the new `@windowExempt` annotation. -- `ChatState.config`, the `chat/configChanged` action, and `chatMutable` on session config properties give each chat its own config for selected settings, such as tool auto-approval, so changing them in one chat no longer changes every chat in the session. `ChatConfigState.values` holds the chat's `chatMutable` properties and does not inherit from the session; missing keys take the schema default. Optional `ChatConfigState.schema` replaces the session's schema for a chat whose agent differs from the session's. -- Optional per-chat agent provider: `CreateChatParams.provider` and `ChatSummary.provider` (mirrored on `ChatState` and `SessionChatSummary`), gated by the host-level `InitializeResult.multipleChatProviders` capability, let one session contain chats backed by different agent providers. Absent `provider` means the session's agent provider; forks and side chats keep their source chat's agent provider. -- Optional `ChangesetFile.status`, a bitset of `ChangesetFileStatus` flags (initially `Editing`), reports per-file activity through existing changeset snapshots and actions without requiring provider-specific metadata. (#538) -- Optional changeset file and operation-target nonces let hosts reject operations on superseded changes without requiring a capability or a nonce from every client. (#538) -- Adds `chat/moved`, dispatched on a chat's channel after a cross-session move with its new session, `provider` and `config.schema`. -- Optional producer-recorded `startedAt` and `duration` fields on reasoning response parts and `chat/reasoning` updates preserve each contiguous reasoning run's timing across state snapshots and history restoration. -- Optional `ToolCallResult.resultMetadata` carries MCP `CallToolResult._meta` separately from host/provider tool-call metadata and is preserved through result confirmation. -- Optional `ResourceReadParams.position` and `ResourceReadParams.length` request a byte range from `resourceRead`, and optional `ResourceReadResult.size` reports the total size of the resource when the receiver honored the range. A result without `size` is the whole resource, and a ranged `utf-8` result does not split a UTF-8 sequence. (#554) -- `resourceRead` guidance: a peer SHOULD serve reads of the URIs it publishes as content, including HTTP(S) URLs that the other peer might not be able to reach. -- Optional `McpServerCustomization.children` for MCP-served skills (SEP-2640), toggleable by id with `session/customizationToggled`. -- Optional `authenticate.accountId` carries an opaque client-local account-selection hint without changing token validation or legacy authentication. +- Add optional `InitializeResult.environment.pathStyle` (`posix` or `windows`) so clients can parse and format host paths using the host's native path grammar instead of guessing locally. +- Add optional `CreateChatParams.title` so clients can choose an initial display title when creating a chat. +- Add optional `SessionModelInfo.vendor` so clients can display the model vendor reported by the provider separately from the owning agent provider. ([#503](https://github.com/microsoft/agent-host-protocol/issues/503)) +- Add experimental windowed delivery for subscriptions so fast producers do not overwhelm slow clients: peers negotiate soft `windowBytes` and hard `maxFrameBytes` limits using UTF-16 JSON-RPC message sizes, split large messages with `channel/frame`, return cumulative credit with `channel/credit`, renegotiate fresh zero-based windows in `reconnect.windows`, and expose generated `@windowExempt` helpers (`WindowExemptMethods` and `CountsAgainstWindow` in Go) for control notifications that do not count against the window. ([#492](https://github.com/microsoft/agent-host-protocol/issues/492)) + ```ts + // Offer windowed delivery on subscribe + await client.request('subscribe', { + channel: 'ahp-terminal:/t1', + flowControl: { receive: { windowBytes: 262144, maxFrameBytes: 16384 } }, + }); + // Return cumulative UTF-16 byte credit after processing incoming data + client.notify('channel/credit', { channel: 'ahp-terminal:/t1', consumedBytes }); + ``` + Read more in [Windowed Delivery](https://microsoft.github.io/agent-host-protocol/specification/windowed-delivery). +- Add `EmptyState` (`{}`) to `Snapshot.state` for channels with no state fields, such as telemetry and TCP channels. Windowed subscriptions always start with `channel/snapshot`, whereas ordinary subscriptions may send or omit an `EmptyState` snapshot; clients must accept both and ignore unrecognized snapshot shapes. + Read more in [Channels and Subscriptions](https://microsoft.github.io/agent-host-protocol/specification/subscriptions). +- Add an experimental TCP channel (`createTcpConnection`, `tcp/data`, `tcp/eof`, and `tcp/reset`, gated by `InitializeResult.tcpConnections`) so clients can forward TCP connections opened on the host's network over a windowed subscription; connections close if the AHP transport drops. ([#488](https://github.com/microsoft/agent-host-protocol/issues/488)) + ```ts + const channel = 'ahp-tcp:/t1'; + await client.request('createTcpConnection', { channel, host: 'localhost', port: 3000 }); + await client.request('subscribe', { + channel, + flowControl: { receive: { windowBytes: 262144, maxFrameBytes: 16384 } }, + }); + client.notify('tcp/data', { channel, data: base64Bytes }); + ``` + Read more in [TCP Channel](https://microsoft.github.io/agent-host-protocol/specification/tcp-channel). +- Add per-chat configuration (`ChatState.config`, `chat/configChanged`, and `SessionConfigPropertySchema.chatMutable`) so settings like tool auto-approval can be changed for one chat without affecting sibling chats; `ChatConfigState.values` does not inherit from the session (missing keys use the schema default), and optional `ChatConfigState.schema` overrides the session schema when a chat uses a different agent provider. + ```ts + client.notify('dispatchAction', { + channel: chatUri, + clientSeq: 1, + action: { type: 'chat/configChanged', config: { autoApprove: true } }, + }); + ``` + Read more in [Chat Channel — Per-chat configuration](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#per-chat-configuration). +- Add per-chat agent providers (`CreateChatParams.provider` and `provider` on `ChatSummary`, `ChatState`, and `SessionChatSummary`, gated by `InitializeResult.multipleChatProviders`) so a single session can mix chats backed by different agent providers; omitting `provider` uses the session's provider, and forks and side chats keep their source chat's provider. + ```ts + await client.request('createChat', { + channel: sessionUri, + chat: 'ahp-chat:/', + provider: 'claude', + }); + ``` + Read more in [Chat Channel — Chat providers](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#chat-providers). +- Add optional `ChangesetFile.status` (a bitset of `ChangesetFileStatus` flags, starting with `Editing`) so hosts can report ongoing per-file edits in changeset snapshots and actions without provider-specific metadata. ([#538](https://github.com/microsoft/agent-host-protocol/issues/538)) + Read more in [Changesets — Per-file Editing Activity](https://microsoft.github.io/agent-host-protocol/guide/changesets#per-file-editing-activity). +- Add optional optimistic-concurrency nonces (`ChangesetFile.nonce` and `ChangesetOperationTarget.nonce`) so hosts can reject `invokeChangesetOperation` calls targeting superseded file edits with `Conflict` without requiring a capability or breaking clients that omit nonces. ([#538](https://github.com/microsoft/agent-host-protocol/issues/538)) +- Add the `chat/moved` action, dispatched on a chat's channel after a cross-session `moveChat` to notify subscribers of its new `session` URI and updated relative `provider` and `config.schema`. + Read more in [Chat Channel — Moving chats](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#moving-chats). +- Add optional producer-recorded `startedAt` and `duration` fields to `ReasoningResponsePart` and `chat/reasoning` actions so each contiguous reasoning run's timing is preserved across snapshots, reconnects, and history restoration. + Read more in [Chat Channel — Reasoning timing](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#reasoning-timing). +- Add optional `ToolCallResult.resultMetadata` to carry MCP `CallToolResult._meta` separately from host/provider tool-call metadata and preserve it through result confirmation. +- Add optional byte-range parameters (`position` and `length`) to `resourceRead` and a total-size indicator (`ResourceReadResult.size`) so callers can read slices of large resources without splitting UTF-8 sequences; a response without `size` contains the whole resource. ([#554](https://github.com/microsoft/agent-host-protocol/issues/554)) + ```ts + const slice = await client.request('resourceRead', { + channel: 'ahp-root://', + uri: 'file:///workspace/logo.png', + position: 0, + length: 16, + }); + // slice.size is present iff the receiver honored the byte range + ``` +- Document that peers should serve `resourceRead` requests for URIs they publish as content, including HTTP(S) URLs that the other peer cannot reach directly (such as a loopback dev server). +- Add optional `McpServerCustomization.children` to surface MCP-served skills (SEP-2640) inside MCP server customizations, toggleable by ID via `session/customizationToggled`. + Read more in [Customizations](https://microsoft.github.io/agent-host-protocol/guide/customizations). +- Add optional `AuthenticateParams.accountId` to carry an opaque client-local account hint alongside tokens so hosts can detect account switches without changing token validation. + Read more in [Authentication — Account selection hints](https://microsoft.github.io/agent-host-protocol/specification/authentication#account-selection-hints). ### Changed -- Experimental windowed subscriptions count every data notification against the window, whether sent whole or in `channel/frame` notifications. Frames carry messages larger than `maxFrameBytes` and let subscriptions share the connection. -- `Snapshot.state` can be an `EmptyState` (`{}`) for channels whose state has no fields, such as telemetry. With ordinary delivery, a server may send such a snapshot or omit it, so clients must accept both. Clients must not fail on a snapshot state that they do not recognize. -- Experimental windowed delivery removes `maximumMessageBytes` and uses one size for everything: the UTF-16 size of each JSON-RPC data message as sent, including `channel/frame` envelopes. Each message and frame counts against `windowBytes`, which is a soft target; `maxFrameBytes` remains a hard limit on each message, and receivers can return credit for stored frames. -- Store steering and queued input in one `queuedMessages` list with optional `PendingMessage.kind` (absent means queued), using the existing per-ID pending actions. New IDs append, kind changes replace in place, and UIs group steering first without changing raw order. Mirror the latest steering update in the deprecated `steeringMessage` slot for older clients. -- Experimental windowed subscriptions no longer carry byte counters across `reconnect`. Their counters start at zero on the new connection, and each `reconnect.windows` item offers new limits in `flowControl`, which the result accepts as in `subscribe`. Removes `ChannelReceiveProgress` and the `clientReceive`/`hostReceive` counters from reconnect. -- Remove the User-only restriction on client-submitted messages in `chat/turnStarted` and `chat/pendingMessageSet`. (#542) -- Experimental `CanvasState.url` is renamed to `CanvasState.uri` and holds an absolute content URI, typically HTTP(S). A client that can't load it directly reads it, and the relative references in its content, with `resourceRead`. -- Preserve unknown members on automation patch objects and nested shared types (`extra` in Rust/Swift/Kotlin, `Extra` in Go/.NET). Rust struct literals must initialize `extra` and exhaustive patterns need `..`; Go map-bearing structs lose `==` comparability; .NET record equality compares `Extra` by reference; Swift/Kotlin consumers must recompile. (#592) -- Annotations channels use `ahp-annotations:/` with the owning session's id; clients should use `AnnotationsSummary.resource` rather than derive the URI. +- Unify steering and queued input in `ChatState.queuedMessages` with an optional `PendingMessage.kind` (`steering` or `queued`, defaulting to `queued`) using existing per-ID pending actions; new IDs append, kind changes replace in place, UIs group steering first without mutating raw order, and the latest steering entry is mirrored to the deprecated `steeringMessage` slot for older clients. + ```ts + client.notify('dispatchAction', { + channel: chatUri, + clientSeq: 1, + action: { type: 'chat/pendingMessageSet', kind: 'steering', id: 'p1', message }, + }); + ``` +- Allow non-`user` message origins (such as `automation` or `systemNotification`) in client-submitted `chat/turnStarted` and `chat/pendingMessageSet` actions. ([#542](https://github.com/microsoft/agent-host-protocol/issues/542)) +- Rename experimental `CanvasState.url` to `CanvasState.uri` to hold an absolute content URI (typically HTTP(S)); clients that cannot load the URI directly can fetch it and its relative references via `resourceRead`. +- Preserve unknown JSON members on automation patch objects and nested shared types via an `Extra` map field so newer fields survive round-trips; affected Go structs lose `==` comparability. ([#592](https://github.com/microsoft/agent-host-protocol/issues/592)) +- Standardize annotations channel URIs on `ahp-annotations:/` using the owning session's ID; clients should read `AnnotationsSummary.resource` rather than constructing the URI manually. ### Fixed -- `ReconnectResult` serialization preserves its `type` discriminator, including windowed subscription recovery results, and generated union serializers safely preserve nil variants. -- Decoding a snapshot whose state has an unrecognized form no longer fails. The state is kept as an `Unknown` variant with its raw JSON, and state mirrors ignore it. Go no longer decodes such a state as an empty `RootState`. +- Fix `ReconnectResult` serialization to preserve its `type` discriminator (including windowed subscription recovery results) and ensure generated union serializers safely preserve nil variants. +- Fix snapshot decoding so unrecognized channel states are preserved as an `Unknown` variant with raw JSON instead of decoding as an empty `RootState`, and are ignored by state mirrors. ### Security -- Add an optional `authenticate.target` identifying an MCP server by session URI and customization ID, preventing tokens from reaching other consumers that share a protected resource and scopes. +- Add optional `AuthenticateParams.target` to bind a pushed OAuth token to a specific MCP server by session URI and customization ID, preventing credentials from leaking to other consumers that share a protected resource and scopes. + ```ts + await client.request('authenticate', { + channel: 'ahp-root://', + resource: 'https://mcp.example.com', + token: accessToken, + target: { + kind: 'mcpServer', + session: sessionUri, + customizationId: 'mcp-server-1', + }, + }); + ``` + Read more in [Authentication — Token Delivery](https://microsoft.github.io/agent-host-protocol/specification/authentication#token-delivery). ## [1.0.0] — 2026-10-02 @@ -72,7 +138,7 @@ Implements AHP 1.0.0. - `ChatState.changesets` and `chat/changesetsChanged` expose each chat's changeset catalogue through the subscribed chat channel. - `AutomationDefinition.disableConditions` supports `afterRuns` (`max`) and `afterDate` (`date`) rules combined with logical OR, with at most one condition per kind. Host-owned `AutomationEntry.runCount` tracks the current scheduled-run allowance. Edit conditions through `automation/updateRequested`: omission leaves them unchanged, an array replaces them, and `[]` removes all conditions without re-enabling the automation. - `ChangesetStatus.Recomputing` distinguishes refreshes of a completed result from initial changeset computation. -- `ConfigPropertySchema.minItems` and `ConfigPropertySchema.maxItems` express array cardinality for `type: "array"` config properties. (#432) +- `ConfigPropertySchema.minItems` and `ConfigPropertySchema.maxItems` express array cardinality for `type: "array"` config properties. ([#432](https://github.com/microsoft/agent-host-protocol/issues/432)) - `McpServerStartingState.blocking` flag indicating that message processing may be held on the server, and the client-dispatchable `session/mcpServerBackgroundRequested` action asking the host to background such a startup. - `AutomationSessionTemplate.customizations` lets automations carry client plugins (skills, agents, prompts, rules) that the host captures when the definition is saved, with the host-owned copies reported in `AutomationEntry.customizations` and support advertised by `AutomationCapabilities.customizations`. - Hosts can advertise chat-owned canvas channel references and synchronize live presentation metadata and source URLs on experimental per-canvas channels. @@ -127,8 +193,8 @@ Implements AHP 0.8.0. - Optional `_meta` request metadata on all command parameters. - `ClientPluginCustomization` can publish child enablement decisions. -- Reserve the `x-` prefix for implementation-defined channel URI schemes, commands, notifications, and actions. (#367) -- `session/workingDirectoryReplaced` atomically replaces a working-directory entry, including a replaceable primary. (#392) +- Reserve the `x-` prefix for implementation-defined channel URI schemes, commands, notifications, and actions. ([#367](https://github.com/microsoft/agent-host-protocol/issues/367)) +- `session/workingDirectoryReplaced` atomically replaces a working-directory entry, including a replaceable primary. ([#392](https://github.com/microsoft/agent-host-protocol/issues/392)) ### Changed @@ -148,10 +214,10 @@ Implements AHP 0.7.0. ### Added - Capability-gated side chats can start from a chat turn and return bounded chat transcripts as message attachments. -- Multiroot session support: `AgentCapabilities.multipleWorkingDirectories` capability (with `immutablePrimary`, which pins `workingDirectories[0]` as a fixed primary root that clients MUST NOT remove or reorder), `CreateSessionParams.workingDirectories` and `SessionMetadata.workingDirectories` (equal-peer set, mirrored onto `SessionState`/`SessionSummary`), `CreateChatParams.workingDirectories` and `ChatState`/`ChatSummary.workingDirectories` (a subset of the session's set), and the client-dispatchable `session/workingDirectorySet` / `session/workingDirectoryRemoved` and `chat/workingDirectorySet` / `chat/workingDirectoryRemoved` actions for mutating those sets. (#337) -- `Client.Completions()` and `Client.SessionConfigCompletions()` typed wrappers for the `completions` / `sessionConfigCompletions` commands, matching the existing `resource*` convenience methods. (#340) -- `result` on `ToolResultTerminalContent` (`exitCode`, `preview`, `truncated`), present once the command exits. (#323) -- Optional `isPty` metadata on `ToolResultTerminalContent` and `TerminalState` indicating whether a terminal resource is PTY-backed. (#322) +- Multiroot session support: `AgentCapabilities.multipleWorkingDirectories` capability (with `immutablePrimary`, which pins `workingDirectories[0]` as a fixed primary root that clients MUST NOT remove or reorder), `CreateSessionParams.workingDirectories` and `SessionMetadata.workingDirectories` (equal-peer set, mirrored onto `SessionState`/`SessionSummary`), `CreateChatParams.workingDirectories` and `ChatState`/`ChatSummary.workingDirectories` (a subset of the session's set), and the client-dispatchable `session/workingDirectorySet` / `session/workingDirectoryRemoved` and `chat/workingDirectorySet` / `chat/workingDirectoryRemoved` actions for mutating those sets. ([#337](https://github.com/microsoft/agent-host-protocol/issues/337)) +- `Client.Completions()` and `Client.SessionConfigCompletions()` typed wrappers for the `completions` / `sessionConfigCompletions` commands, matching the existing `resource*` convenience methods. ([#340](https://github.com/microsoft/agent-host-protocol/issues/340)) +- `result` on `ToolResultTerminalContent` (`exitCode`, `preview`, `truncated`), present once the command exits. ([#323](https://github.com/microsoft/agent-host-protocol/issues/323)) +- Optional `isPty` metadata on `ToolResultTerminalContent` and `TerminalState` indicating whether a terminal resource is PTY-backed. ([#322](https://github.com/microsoft/agent-host-protocol/issues/322)) - Side-chat sources and origins can now carry an immutable selected-text snapshot with optional response-part provenance. ### Changed @@ -163,8 +229,8 @@ Implements AHP 0.7.0. ### Removed -- `ToolResultTerminalCompleteContent`; command completion data now lives on `ToolResultTerminalContent`. (#322, #323) -- Non-standard `resource_encryption_alg_values_supported` and `resource_encryption_enc_values_supported` fields from `ProtectedResourceMetadata`. (#368) +- `ToolResultTerminalCompleteContent`; command completion data now lives on `ToolResultTerminalContent`. ([#322](https://github.com/microsoft/agent-host-protocol/issues/322), [#323](https://github.com/microsoft/agent-host-protocol/issues/323)) +- Non-standard `resource_encryption_alg_values_supported` and `resource_encryption_enc_values_supported` fields from `ProtectedResourceMetadata`. ([#368](https://github.com/microsoft/agent-host-protocol/issues/368)) ### Fixed @@ -177,8 +243,8 @@ Implements AHP 0.6.0. ### Added -- `Changeset.capabilities` with a `review` presence flag (`ChangesetCapabilities`) so a changeset can advertise support for the per-file review workflow up-front on the session's changeset list. (#328) -- 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`. (#308) +- `Changeset.capabilities` with a `review` presence flag (`ChangesetCapabilities`) so a changeset can advertise support for the per-file review workflow up-front on the session's changeset list. ([#328](https://github.com/microsoft/agent-host-protocol/issues/328)) +- 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`. ([#308](https://github.com/microsoft/agent-host-protocol/issues/308)) - `chat/turnStarted` carries a `startedAt` timestamp, `chat/turnComplete`/`chat/turnCancelled`/`chat/error` carry an elapsed `duration` (milliseconds, producer's own clock), and completed turns expose their start time and duration. - Asynchronous tool-call risk assessments with a model-provided explanation and normalized safety score. - `ToolCallStatus.AuthRequired` tool call state and `chat/toolCallAuthRequired` / `chat/toolCallAuthResolved` actions so a running MCP-contributed tool call can pause mid-execution on an OAuth challenge (`McpAuthRequirement`) and resume once the client authenticates; surfaced at the session level via a new `toolAuthentication` `SessionInputRequest` variant, and `AuthenticateParams` gained an optional `scopes` field and now accepts resources discovered from a live `McpServerAuthRequiredState` or `ToolCallAuthRequiredState` in addition to `AgentInfo.protectedResources`. `chat/toolCallComplete` now also accepts a failed result while a tool call is `auth-required`, letting a client cancel that invocation without completing the authentication challenge. @@ -187,8 +253,8 @@ Implements AHP 0.6.0. ### Changed -- Renamed the changeset review action `changeset/filesReviewedChanged` to `changeset/filesReviewChanged` (field `fileIds` → `files`) and made it client-dispatchable, so a reviewer can toggle a file's `reviewed` flag directly through the write-ahead reducer. (#328) -- Input requests now live in turn `responseParts`, with an optional `response` until `chat/inputCompleted` submits the result. (#327) +- Renamed the changeset review action `changeset/filesReviewedChanged` to `changeset/filesReviewChanged` (field `fileIds` → `files`) and made it client-dispatchable, so a reviewer can toggle a file's `reviewed` flag directly through the write-ahead reducer. ([#328](https://github.com/microsoft/agent-host-protocol/issues/328)) +- Input requests now live in turn `responseParts`, with an optional `response` until `chat/inputCompleted` submits the result. ([#327](https://github.com/microsoft/agent-host-protocol/issues/327)) ## [0.5.2] — 2026-07-09 @@ -233,7 +299,7 @@ Implements AHP 0.5.2. `ResponseParts` on `ChatInputCompletedAction` — embedding the resolved `ChatInputRequest` (final `Answers`) and the `Response` (`accept`, `decline`, or `cancel`) — so the outcome persists after the live request is removed. - Abandoned requests still record nothing (#324). + Abandoned requests still record nothing ([#324](https://github.com/microsoft/agent-host-protocol/issues/324)). ### Changed diff --git a/clients/kotlin/CHANGELOG.md b/clients/kotlin/CHANGELOG.md index e03d88e9f..f26325732 100644 --- a/clients/kotlin/CHANGELOG.md +++ b/clients/kotlin/CHANGELOG.md @@ -21,45 +21,111 @@ Implements AHP 1.1.0. ### Added -- Optional typed `InitializeResult.environment.pathStyle` metadata for authoritative host path semantics. -- Optional `CreateChatParams.title` for a client-selected initial display title. -- Optional `SessionModelInfo.vendor` for the model vendor as the provider reports it. (#503) -- Experimental subscription-negotiated flow-control types using UTF-16 byte accounting, framed delivery and consumption credit notifications, and independent `reconnect.windows` metadata. (#492) -- `EmptyState` variant of `Snapshot.state` for channels whose state has no fields, such as telemetry. Every experimental windowed subscription starts with `channel/snapshot`. -- Experimental TCP channel: `createTcpConnection` opens a TCP connection on the host's network and returns an empty `CreateTcpConnectionResult`. The client forwards it over a windowed subscription with `tcp/data`, `tcp/eof`, and `tcp/reset`. TCP channels do not survive the loss of the AHP connection. (#488) -- Each client exposes the notification methods that do not count against the window on a windowed subscription (`WINDOW_EXEMPT_METHODS` and `countsAgainstWindow` in TypeScript, with equivalents in the other clients), generated from the new `@windowExempt` annotation. -- `ChatState.config`, the `chat/configChanged` action, and `chatMutable` on session config properties give each chat its own config for selected settings, such as tool auto-approval, so changing them in one chat no longer changes every chat in the session. `ChatConfigState.values` holds the chat's `chatMutable` properties and does not inherit from the session; missing keys take the schema default. Optional `ChatConfigState.schema` replaces the session's schema for a chat whose agent differs from the session's. -- Optional per-chat agent provider: `CreateChatParams.provider` and `ChatSummary.provider` (mirrored on `ChatState` and `SessionChatSummary`), gated by the host-level `InitializeResult.multipleChatProviders` capability, let one session contain chats backed by different agent providers. Absent `provider` means the session's agent provider; forks and side chats keep their source chat's agent provider. -- Optional `ChangesetFile.status`, a bitset of `ChangesetFileStatus` flags (initially `Editing`), reports per-file activity through existing changeset snapshots and actions without requiring provider-specific metadata. (#538) -- Optional changeset file and operation-target nonces let hosts reject operations on superseded changes without requiring a capability or a nonce from every client. (#538) -- Adds `chat/moved`, dispatched on a chat's channel after a cross-session move with its new session, `provider` and `config.schema`. -- Optional producer-recorded `startedAt` and `duration` fields on reasoning response parts and `chat/reasoning` updates preserve each contiguous reasoning run's timing across state snapshots and history restoration. -- Optional `ToolCallResult.resultMetadata` carries MCP `CallToolResult._meta` separately from host/provider tool-call metadata and is preserved through result confirmation. -- Optional `ResourceReadParams.position` and `ResourceReadParams.length` request a byte range from `resourceRead`, and optional `ResourceReadResult.size` reports the total size of the resource when the receiver honored the range. A result without `size` is the whole resource, and a ranged `utf-8` result does not split a UTF-8 sequence. (#554) -- `resourceRead` guidance: a peer SHOULD serve reads of the URIs it publishes as content, including HTTP(S) URLs that the other peer might not be able to reach. -- Optional `McpServerCustomization.children` for MCP-served skills (SEP-2640), toggleable by id with `session/customizationToggled`. -- Optional `authenticate.accountId` carries an opaque client-local account-selection hint without changing token validation or legacy authentication. +- Add optional `InitializeResult.environment.pathStyle` (`posix` or `windows`) so clients can parse and format host paths using the host's native path grammar instead of guessing locally. +- Add optional `CreateChatParams.title` so clients can choose an initial display title when creating a chat. +- Add optional `SessionModelInfo.vendor` so clients can display the model vendor reported by the provider separately from the owning agent provider. ([#503](https://github.com/microsoft/agent-host-protocol/issues/503)) +- Add experimental windowed delivery for subscriptions so fast producers do not overwhelm slow clients: peers negotiate soft `windowBytes` and hard `maxFrameBytes` limits using UTF-16 JSON-RPC message sizes, split large messages with `channel/frame`, return cumulative credit with `channel/credit`, renegotiate fresh zero-based windows in `reconnect.windows`, and expose generated `@windowExempt` helpers (`WINDOW_EXEMPT_METHODS` and `countsAgainstWindow`) for control notifications that do not count against the window. ([#492](https://github.com/microsoft/agent-host-protocol/issues/492)) + ```ts + // Offer windowed delivery on subscribe + await client.request('subscribe', { + channel: 'ahp-terminal:/t1', + flowControl: { receive: { windowBytes: 262144, maxFrameBytes: 16384 } }, + }); + // Return cumulative UTF-16 byte credit after processing incoming data + client.notify('channel/credit', { channel: 'ahp-terminal:/t1', consumedBytes }); + ``` + Read more in [Windowed Delivery](https://microsoft.github.io/agent-host-protocol/specification/windowed-delivery). +- Add `EmptyState` (`{}`) to `Snapshot.state` for channels with no state fields, such as telemetry and TCP channels. Windowed subscriptions always start with `channel/snapshot`, whereas ordinary subscriptions may send or omit an `EmptyState` snapshot; clients must accept both and ignore unrecognized snapshot shapes. + Read more in [Channels and Subscriptions](https://microsoft.github.io/agent-host-protocol/specification/subscriptions). +- Add an experimental TCP channel (`createTcpConnection`, `tcp/data`, `tcp/eof`, and `tcp/reset`, gated by `InitializeResult.tcpConnections`) so clients can forward TCP connections opened on the host's network over a windowed subscription; connections close if the AHP transport drops. ([#488](https://github.com/microsoft/agent-host-protocol/issues/488)) + ```ts + const channel = 'ahp-tcp:/t1'; + await client.request('createTcpConnection', { channel, host: 'localhost', port: 3000 }); + await client.request('subscribe', { + channel, + flowControl: { receive: { windowBytes: 262144, maxFrameBytes: 16384 } }, + }); + client.notify('tcp/data', { channel, data: base64Bytes }); + ``` + Read more in [TCP Channel](https://microsoft.github.io/agent-host-protocol/specification/tcp-channel). +- Add per-chat configuration (`ChatState.config`, `chat/configChanged`, and `SessionConfigPropertySchema.chatMutable`) so settings like tool auto-approval can be changed for one chat without affecting sibling chats; `ChatConfigState.values` does not inherit from the session (missing keys use the schema default), and optional `ChatConfigState.schema` overrides the session schema when a chat uses a different agent provider. + ```ts + client.notify('dispatchAction', { + channel: chatUri, + clientSeq: 1, + action: { type: 'chat/configChanged', config: { autoApprove: true } }, + }); + ``` + Read more in [Chat Channel — Per-chat configuration](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#per-chat-configuration). +- Add per-chat agent providers (`CreateChatParams.provider` and `provider` on `ChatSummary`, `ChatState`, and `SessionChatSummary`, gated by `InitializeResult.multipleChatProviders`) so a single session can mix chats backed by different agent providers; omitting `provider` uses the session's provider, and forks and side chats keep their source chat's provider. + ```ts + await client.request('createChat', { + channel: sessionUri, + chat: 'ahp-chat:/', + provider: 'claude', + }); + ``` + Read more in [Chat Channel — Chat providers](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#chat-providers). +- Add optional `ChangesetFile.status` (a bitset of `ChangesetFileStatus` flags, starting with `Editing`) so hosts can report ongoing per-file edits in changeset snapshots and actions without provider-specific metadata. ([#538](https://github.com/microsoft/agent-host-protocol/issues/538)) + Read more in [Changesets — Per-file Editing Activity](https://microsoft.github.io/agent-host-protocol/guide/changesets#per-file-editing-activity). +- Add optional optimistic-concurrency nonces (`ChangesetFile.nonce` and `ChangesetOperationTarget.nonce`) so hosts can reject `invokeChangesetOperation` calls targeting superseded file edits with `Conflict` without requiring a capability or breaking clients that omit nonces. ([#538](https://github.com/microsoft/agent-host-protocol/issues/538)) +- Add the `chat/moved` action, dispatched on a chat's channel after a cross-session `moveChat` to notify subscribers of its new `session` URI and updated relative `provider` and `config.schema`. + Read more in [Chat Channel — Moving chats](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#moving-chats). +- Add optional producer-recorded `startedAt` and `duration` fields to `ReasoningResponsePart` and `chat/reasoning` actions so each contiguous reasoning run's timing is preserved across snapshots, reconnects, and history restoration. + Read more in [Chat Channel — Reasoning timing](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#reasoning-timing). +- Add optional `ToolCallResult.resultMetadata` to carry MCP `CallToolResult._meta` separately from host/provider tool-call metadata and preserve it through result confirmation. +- Add optional byte-range parameters (`position` and `length`) to `resourceRead` and a total-size indicator (`ResourceReadResult.size`) so callers can read slices of large resources without splitting UTF-8 sequences; a response without `size` contains the whole resource. ([#554](https://github.com/microsoft/agent-host-protocol/issues/554)) + ```ts + const slice = await client.request('resourceRead', { + channel: 'ahp-root://', + uri: 'file:///workspace/logo.png', + position: 0, + length: 16, + }); + // slice.size is present iff the receiver honored the byte range + ``` +- Document that peers should serve `resourceRead` requests for URIs they publish as content, including HTTP(S) URLs that the other peer cannot reach directly (such as a loopback dev server). +- Add optional `McpServerCustomization.children` to surface MCP-served skills (SEP-2640) inside MCP server customizations, toggleable by ID via `session/customizationToggled`. + Read more in [Customizations](https://microsoft.github.io/agent-host-protocol/guide/customizations). +- Add optional `AuthenticateParams.accountId` to carry an opaque client-local account hint alongside tokens so hosts can detect account switches without changing token validation. + Read more in [Authentication — Account selection hints](https://microsoft.github.io/agent-host-protocol/specification/authentication#account-selection-hints). ### Changed -- Experimental windowed subscriptions count every data notification against the window, whether sent whole or in `channel/frame` notifications. Frames carry messages larger than `maxFrameBytes` and let subscriptions share the connection. -- `Snapshot.state` can be an `EmptyState` (`{}`) for channels whose state has no fields, such as telemetry. With ordinary delivery, a server may send such a snapshot or omit it, so clients must accept both. Clients must not fail on a snapshot state that they do not recognize. -- Experimental windowed delivery removes `maximumMessageBytes` and uses one size for everything: the UTF-16 size of each JSON-RPC data message as sent, including `channel/frame` envelopes. Each message and frame counts against `windowBytes`, which is a soft target; `maxFrameBytes` remains a hard limit on each message, and receivers can return credit for stored frames. -- Store steering and queued input in one `queuedMessages` list with optional `PendingMessage.kind` (absent means queued), using the existing per-ID pending actions. New IDs append, kind changes replace in place, and UIs group steering first without changing raw order. Mirror the latest steering update in the deprecated `steeringMessage` slot for older clients. -- Experimental windowed subscriptions no longer carry byte counters across `reconnect`. Their counters start at zero on the new connection, and each `reconnect.windows` item offers new limits in `flowControl`, which the result accepts as in `subscribe`. Removes `ChannelReceiveProgress` and the `clientReceive`/`hostReceive` counters from reconnect. -- `ChatState`, `ChatSummary`, and `SessionChatSummary` gained a `provider` parameter, which shifts their positional constructor arguments and `componentN` destructuring; use named arguments. -- Remove the User-only restriction on client-submitted messages in `chat/turnStarted` and `chat/pendingMessageSet`. (#542) -- Experimental `CanvasState.url` is renamed to `CanvasState.uri` and holds an absolute content URI, typically HTTP(S). A client that can't load it directly reads it, and the relative references in its content, with `resourceRead`. -- Preserve unknown members on automation patch objects and nested shared types (`extra` in Rust/Swift/Kotlin, `Extra` in Go/.NET). Rust struct literals must initialize `extra` and exhaustive patterns need `..`; Go map-bearing structs lose `==` comparability; .NET record equality compares `Extra` by reference; Swift/Kotlin consumers must recompile. (#592) -- Annotations channels use `ahp-annotations:/` with the owning session's id; clients should use `AnnotationsSummary.resource` rather than derive the URI. +- Unify steering and queued input in `ChatState.queuedMessages` with an optional `PendingMessage.kind` (`steering` or `queued`, defaulting to `queued`) using existing per-ID pending actions; new IDs append, kind changes replace in place, UIs group steering first without mutating raw order, and the latest steering entry is mirrored to the deprecated `steeringMessage` slot for older clients. + ```ts + client.notify('dispatchAction', { + channel: chatUri, + clientSeq: 1, + action: { type: 'chat/pendingMessageSet', kind: 'steering', id: 'p1', message }, + }); + ``` +- Add a `provider` parameter to `ChatState`, `ChatSummary`, and `SessionChatSummary`, which shifts their positional constructor arguments and `componentN` destructuring (prefer named arguments). +- Allow non-`user` message origins (such as `automation` or `systemNotification`) in client-submitted `chat/turnStarted` and `chat/pendingMessageSet` actions. ([#542](https://github.com/microsoft/agent-host-protocol/issues/542)) +- Rename experimental `CanvasState.url` to `CanvasState.uri` to hold an absolute content URI (typically HTTP(S)); clients that cannot load the URI directly can fetch it and its relative references via `resourceRead`. +- Preserve unknown JSON members on automation patch objects and nested shared types via an `extra` property so newer fields survive round-trips; Kotlin consumers must recompile against the updated data classes. ([#592](https://github.com/microsoft/agent-host-protocol/issues/592)) +- Standardize annotations channel URIs on `ahp-annotations:/` using the owning session's ID; clients should read `AnnotationsSummary.resource` rather than constructing the URI manually. ### Fixed -- Decoding a snapshot whose state has an unrecognized form no longer fails. The state is kept as an `Unknown` variant with its raw JSON, and state mirrors ignore it. Go no longer decodes such a state as an empty `RootState`. +- Fix snapshot decoding so unrecognized channel states no longer fail; unknown states are preserved as an `Unknown` variant with their raw JSON and ignored by state mirrors. ### Security -- Add an optional `authenticate.target` identifying an MCP server by session URI and customization ID, preventing tokens from reaching other consumers that share a protected resource and scopes. +- Add optional `AuthenticateParams.target` to bind a pushed OAuth token to a specific MCP server by session URI and customization ID, preventing credentials from leaking to other consumers that share a protected resource and scopes. + ```ts + await client.request('authenticate', { + channel: 'ahp-root://', + resource: 'https://mcp.example.com', + token: accessToken, + target: { + kind: 'mcpServer', + session: sessionUri, + customizationId: 'mcp-server-1', + }, + }); + ``` + Read more in [Authentication — Token Delivery](https://microsoft.github.io/agent-host-protocol/specification/authentication#token-delivery). ## [1.0.0] — 2026-10-02 @@ -73,7 +139,7 @@ Implements AHP 1.0.0. - `ChatState.changesets` and `chat/changesetsChanged` expose each chat's changeset catalogue through the subscribed chat channel. - `AutomationDefinition.disableConditions` supports `afterRuns` (`max`) and `afterDate` (`date`) rules combined with logical OR, with at most one condition per kind. Host-owned `AutomationEntry.runCount` tracks the current scheduled-run allowance. Edit conditions through `automation/updateRequested`: omission leaves them unchanged, an array replaces them, and `[]` removes all conditions without re-enabling the automation. - `ChangesetStatus.Recomputing` distinguishes refreshes of a completed result from initial changeset computation. -- `ConfigPropertySchema.minItems` and `ConfigPropertySchema.maxItems` express array cardinality for `type: "array"` config properties. (#432) +- `ConfigPropertySchema.minItems` and `ConfigPropertySchema.maxItems` express array cardinality for `type: "array"` config properties. ([#432](https://github.com/microsoft/agent-host-protocol/issues/432)) - `McpServerStartingState.blocking` flag indicating that message processing may be held on the server, and the client-dispatchable `session/mcpServerBackgroundRequested` action asking the host to background such a startup. - `AutomationSessionTemplate.customizations` lets automations carry client plugins (skills, agents, prompts, rules) that the host captures when the definition is saved, with the host-owned copies reported in `AutomationEntry.customizations` and support advertised by `AutomationCapabilities.customizations`. - Hosts can advertise chat-owned canvas channel references and synchronize live presentation metadata and source URLs on experimental per-canvas channels. @@ -128,8 +194,8 @@ Implements AHP 0.8.0. - Optional `_meta` request metadata on all command parameters. - `ClientPluginCustomization` can publish child enablement decisions. -- Reserve the `x-` prefix for implementation-defined channel URI schemes, commands, notifications, and actions. (#367) -- `session/workingDirectoryReplaced` atomically replaces a working-directory entry, including a replaceable primary. (#392) +- Reserve the `x-` prefix for implementation-defined channel URI schemes, commands, notifications, and actions. ([#367](https://github.com/microsoft/agent-host-protocol/issues/367)) +- `session/workingDirectoryReplaced` atomically replaces a working-directory entry, including a replaceable primary. ([#392](https://github.com/microsoft/agent-host-protocol/issues/392)) ### Changed @@ -149,9 +215,9 @@ Implements AHP 0.7.0. ### Added - Capability-gated side chats can start from a chat turn and return bounded chat transcripts as message attachments. -- Multiroot session support: `AgentCapabilities.multipleWorkingDirectories` capability (with `immutablePrimary`, which pins `workingDirectories[0]` as a fixed primary root that clients MUST NOT remove or reorder), `CreateSessionParams.workingDirectories` and `SessionMetadata.workingDirectories` (equal-peer set, mirrored onto `SessionState`/`SessionSummary`), `CreateChatParams.workingDirectories` and `ChatState`/`ChatSummary.workingDirectories` (a subset of the session's set), and the client-dispatchable `session/workingDirectorySet` / `session/workingDirectoryRemoved` and `chat/workingDirectorySet` / `chat/workingDirectoryRemoved` actions for mutating those sets. (#337) -- `result` on `ToolResultTerminalContent` (`exitCode`, `preview`, `truncated`), present once the command exits. (#323) -- Optional `isPty` metadata on `ToolResultTerminalContent` and `TerminalState` indicating whether a terminal resource is PTY-backed. (#322) +- Multiroot session support: `AgentCapabilities.multipleWorkingDirectories` capability (with `immutablePrimary`, which pins `workingDirectories[0]` as a fixed primary root that clients MUST NOT remove or reorder), `CreateSessionParams.workingDirectories` and `SessionMetadata.workingDirectories` (equal-peer set, mirrored onto `SessionState`/`SessionSummary`), `CreateChatParams.workingDirectories` and `ChatState`/`ChatSummary.workingDirectories` (a subset of the session's set), and the client-dispatchable `session/workingDirectorySet` / `session/workingDirectoryRemoved` and `chat/workingDirectorySet` / `chat/workingDirectoryRemoved` actions for mutating those sets. ([#337](https://github.com/microsoft/agent-host-protocol/issues/337)) +- `result` on `ToolResultTerminalContent` (`exitCode`, `preview`, `truncated`), present once the command exits. ([#323](https://github.com/microsoft/agent-host-protocol/issues/323)) +- Optional `isPty` metadata on `ToolResultTerminalContent` and `TerminalState` indicating whether a terminal resource is PTY-backed. ([#322](https://github.com/microsoft/agent-host-protocol/issues/322)) - Side-chat sources and origins can now carry an immutable selected-text snapshot with optional response-part provenance. ### Changed @@ -163,8 +229,8 @@ Implements AHP 0.7.0. ### Removed -- `ToolResultTerminalCompleteContent`; command completion data now lives on `ToolResultTerminalContent`. (#322, #323) -- Non-standard `resource_encryption_alg_values_supported` and `resource_encryption_enc_values_supported` fields from `ProtectedResourceMetadata`. (#368) +- `ToolResultTerminalCompleteContent`; command completion data now lives on `ToolResultTerminalContent`. ([#322](https://github.com/microsoft/agent-host-protocol/issues/322), [#323](https://github.com/microsoft/agent-host-protocol/issues/323)) +- Non-standard `resource_encryption_alg_values_supported` and `resource_encryption_enc_values_supported` fields from `ProtectedResourceMetadata`. ([#368](https://github.com/microsoft/agent-host-protocol/issues/368)) ### Fixed @@ -177,8 +243,8 @@ Implements AHP 0.6.0. ### Added -- `Changeset.capabilities` with a `review` presence flag (`ChangesetCapabilities`) so a changeset can advertise support for the per-file review workflow up-front on the session's changeset list. (#328) -- 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`. (#308) +- `Changeset.capabilities` with a `review` presence flag (`ChangesetCapabilities`) so a changeset can advertise support for the per-file review workflow up-front on the session's changeset list. ([#328](https://github.com/microsoft/agent-host-protocol/issues/328)) +- 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`. ([#308](https://github.com/microsoft/agent-host-protocol/issues/308)) - `chat/turnStarted` carries a `startedAt` timestamp, `chat/turnComplete`/`chat/turnCancelled`/`chat/error` carry an elapsed `duration` (milliseconds, producer's own clock), and completed turns expose their start time and duration. - Asynchronous tool-call risk assessments with a model-provided explanation and normalized safety score. - `ToolCallStatus.AuthRequired` tool call state and `chat/toolCallAuthRequired` / `chat/toolCallAuthResolved` actions so a running MCP-contributed tool call can pause mid-execution on an OAuth challenge (`McpAuthRequirement`) and resume once the client authenticates; surfaced at the session level via a new `toolAuthentication` `SessionInputRequest` variant, and `AuthenticateParams` gained an optional `scopes` field and now accepts resources discovered from a live `McpServerAuthRequiredState` or `ToolCallAuthRequiredState` in addition to `AgentInfo.protectedResources`. `chat/toolCallComplete` now also accepts a failed result while a tool call is `auth-required`, letting a client cancel that invocation without completing the authentication challenge. @@ -187,8 +253,8 @@ Implements AHP 0.6.0. ### Changed -- Renamed the changeset review action `changeset/filesReviewedChanged` to `changeset/filesReviewChanged` (field `fileIds` → `files`) and made it client-dispatchable, so a reviewer can toggle a file's `reviewed` flag directly through the write-ahead reducer. (#328) -- Input requests now live in turn `responseParts`, with an optional `response` until `chat/inputCompleted` submits the result. (#327) +- Renamed the changeset review action `changeset/filesReviewedChanged` to `changeset/filesReviewChanged` (field `fileIds` → `files`) and made it client-dispatchable, so a reviewer can toggle a file's `reviewed` flag directly through the write-ahead reducer. ([#328](https://github.com/microsoft/agent-host-protocol/issues/328)) +- Input requests now live in turn `responseParts`, with an optional `response` until `chat/inputCompleted` submits the result. ([#327](https://github.com/microsoft/agent-host-protocol/issues/327)) ## [0.5.2] — 2026-07-09 @@ -231,7 +297,7 @@ Implements AHP 0.5.2. `responseParts` on `StateActionChatInputCompleted` — embedding the resolved `ChatInputRequest` (final `answers`) and the `response` (`accept`, `decline`, or `cancel`) — so the outcome persists after the live request is removed. - Abandoned requests still record nothing (#324). + Abandoned requests still record nothing ([#324](https://github.com/microsoft/agent-host-protocol/issues/324)). ### Changed diff --git a/clients/rust/CHANGELOG.md b/clients/rust/CHANGELOG.md index fc42d145c..5047b7375 100644 --- a/clients/rust/CHANGELOG.md +++ b/clients/rust/CHANGELOG.md @@ -21,49 +21,115 @@ Implements AHP 1.1.0. ### Added -- Optional typed `InitializeResult.environment.pathStyle` metadata for authoritative host path semantics. -- Optional `CreateChatParams.title` for a client-selected initial display title. -- Optional `SessionModelInfo.vendor` for the model vendor as the provider reports it. (#503) -- Experimental subscription-negotiated flow-control types using UTF-16 byte accounting, framed delivery and consumption credit notifications, and independent `reconnect.windows` metadata. (#492) -- `EmptyState` variant of `Snapshot.state` for channels whose state has no fields, such as telemetry. Every experimental windowed subscription starts with `channel/snapshot`. -- Experimental TCP channel: `createTcpConnection` opens a TCP connection on the host's network and returns an empty `CreateTcpConnectionResult`. The client forwards it over a windowed subscription with `tcp/data`, `tcp/eof`, and `tcp/reset`. TCP channels do not survive the loss of the AHP connection. (#488) -- Each client exposes the notification methods that do not count against the window on a windowed subscription (`WINDOW_EXEMPT_METHODS` and `countsAgainstWindow` in TypeScript, with equivalents in the other clients), generated from the new `@windowExempt` annotation. -- `ChatState.config`, the `chat/configChanged` action, and `chatMutable` on session config properties give each chat its own config for selected settings, such as tool auto-approval, so changing them in one chat no longer changes every chat in the session. `ChatConfigState.values` holds the chat's `chatMutable` properties and does not inherit from the session; missing keys take the schema default. Optional `ChatConfigState.schema` replaces the session's schema for a chat whose agent differs from the session's. -- Optional per-chat agent provider: `CreateChatParams.provider` and `ChatSummary.provider` (mirrored on `ChatState` and `SessionChatSummary`), gated by the host-level `InitializeResult.multipleChatProviders` capability, let one session contain chats backed by different agent providers. Absent `provider` means the session's agent provider; forks and side chats keep their source chat's agent provider. -- Optional `ChangesetFile.status`, a bitset of `ChangesetFileStatus` flags (initially `Editing`), reports per-file activity through existing changeset snapshots and actions without requiring provider-specific metadata. (#538) -- Optional changeset file and operation-target nonces let hosts reject operations on superseded changes without requiring a capability or a nonce from every client. (#538) -- Adds `chat/moved`, dispatched on a chat's channel after a cross-session move with its new session, `provider` and `config.schema`. -- Optional producer-recorded `startedAt` and `duration` fields on reasoning response parts and `chat/reasoning` updates preserve each contiguous reasoning run's timing across state snapshots and history restoration. -- Optional `ToolCallResult.resultMetadata` carries MCP `CallToolResult._meta` separately from host/provider tool-call metadata and is preserved through result confirmation. -- Optional `ResourceReadParams.position` and `ResourceReadParams.length` request a byte range from `resourceRead`, and optional `ResourceReadResult.size` reports the total size of the resource when the receiver honored the range. A result without `size` is the whole resource, and a ranged `utf-8` result does not split a UTF-8 sequence. (#554) -- `resourceRead` guidance: a peer SHOULD serve reads of the URIs it publishes as content, including HTTP(S) URLs that the other peer might not be able to reach. -- Optional `McpServerCustomization.children` for MCP-served skills (SEP-2640), toggleable by id with `session/customizationToggled`. -- Optional `authenticate.accountId` carries an opaque client-local account-selection hint without changing token validation or legacy authentication. +- Add optional `InitializeResult.environment.pathStyle` (`posix` or `windows`) so clients can parse and format host paths using the host's native path grammar instead of guessing locally. +- Add optional `CreateChatParams.title` so clients can choose an initial display title when creating a chat. +- Add optional `SessionModelInfo.vendor` so clients can display the model vendor reported by the provider separately from the owning agent provider. ([#503](https://github.com/microsoft/agent-host-protocol/issues/503)) +- Add experimental windowed delivery for subscriptions so fast producers do not overwhelm slow clients: peers negotiate soft `windowBytes` and hard `maxFrameBytes` limits using UTF-16 JSON-RPC message sizes, split large messages with `channel/frame`, return cumulative credit with `channel/credit`, renegotiate fresh zero-based windows in `reconnect.windows`, and expose generated `@windowExempt` helpers (`WINDOW_EXEMPT_METHODS` and `counts_against_window` in Rust) for control notifications that do not count against the window. ([#492](https://github.com/microsoft/agent-host-protocol/issues/492)) + ```ts + // Offer windowed delivery on subscribe + await client.request('subscribe', { + channel: 'ahp-terminal:/t1', + flowControl: { receive: { windowBytes: 262144, maxFrameBytes: 16384 } }, + }); + // Return cumulative UTF-16 byte credit after processing incoming data + client.notify('channel/credit', { channel: 'ahp-terminal:/t1', consumedBytes }); + ``` + Read more in [Windowed Delivery](https://microsoft.github.io/agent-host-protocol/specification/windowed-delivery). +- Add `EmptyState` (`{}`) to `Snapshot.state` for channels with no state fields, such as telemetry and TCP channels. Windowed subscriptions always start with `channel/snapshot`, whereas ordinary subscriptions may send or omit an `EmptyState` snapshot; clients must accept both and ignore unrecognized snapshot shapes. + Read more in [Channels and Subscriptions](https://microsoft.github.io/agent-host-protocol/specification/subscriptions). +- Add an experimental TCP channel (`createTcpConnection`, `tcp/data`, `tcp/eof`, and `tcp/reset`, gated by `InitializeResult.tcpConnections`) so clients can forward TCP connections opened on the host's network over a windowed subscription; connections close if the AHP transport drops. ([#488](https://github.com/microsoft/agent-host-protocol/issues/488)) + ```ts + const channel = 'ahp-tcp:/t1'; + await client.request('createTcpConnection', { channel, host: 'localhost', port: 3000 }); + await client.request('subscribe', { + channel, + flowControl: { receive: { windowBytes: 262144, maxFrameBytes: 16384 } }, + }); + client.notify('tcp/data', { channel, data: base64Bytes }); + ``` + Read more in [TCP Channel](https://microsoft.github.io/agent-host-protocol/specification/tcp-channel). +- Add per-chat configuration (`ChatState.config`, `chat/configChanged`, and `SessionConfigPropertySchema.chatMutable`) so settings like tool auto-approval can be changed for one chat without affecting sibling chats; `ChatConfigState.values` does not inherit from the session (missing keys use the schema default), and optional `ChatConfigState.schema` overrides the session schema when a chat uses a different agent provider. + ```ts + client.notify('dispatchAction', { + channel: chatUri, + clientSeq: 1, + action: { type: 'chat/configChanged', config: { autoApprove: true } }, + }); + ``` + Read more in [Chat Channel — Per-chat configuration](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#per-chat-configuration). +- Add per-chat agent providers (`CreateChatParams.provider` and `provider` on `ChatSummary`, `ChatState`, and `SessionChatSummary`, gated by `InitializeResult.multipleChatProviders`) so a single session can mix chats backed by different agent providers; omitting `provider` uses the session's provider, and forks and side chats keep their source chat's provider. + ```ts + await client.request('createChat', { + channel: sessionUri, + chat: 'ahp-chat:/', + provider: 'claude', + }); + ``` + Read more in [Chat Channel — Chat providers](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#chat-providers). +- Add optional `ChangesetFile.status` (a bitset of `ChangesetFileStatus` flags, starting with `Editing`) so hosts can report ongoing per-file edits in changeset snapshots and actions without provider-specific metadata. ([#538](https://github.com/microsoft/agent-host-protocol/issues/538)) + Read more in [Changesets — Per-file Editing Activity](https://microsoft.github.io/agent-host-protocol/guide/changesets#per-file-editing-activity). +- Add optional optimistic-concurrency nonces (`ChangesetFile.nonce` and `ChangesetOperationTarget.nonce`) so hosts can reject `invokeChangesetOperation` calls targeting superseded file edits with `Conflict` without requiring a capability or breaking clients that omit nonces. ([#538](https://github.com/microsoft/agent-host-protocol/issues/538)) +- Add the `chat/moved` action, dispatched on a chat's channel after a cross-session `moveChat` to notify subscribers of its new `session` URI and updated relative `provider` and `config.schema`. + Read more in [Chat Channel — Moving chats](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#moving-chats). +- Add optional producer-recorded `startedAt` and `duration` fields to `ReasoningResponsePart` and `chat/reasoning` actions so each contiguous reasoning run's timing is preserved across snapshots, reconnects, and history restoration. + Read more in [Chat Channel — Reasoning timing](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#reasoning-timing). +- Add optional `ToolCallResult.resultMetadata` to carry MCP `CallToolResult._meta` separately from host/provider tool-call metadata and preserve it through result confirmation. +- Add optional byte-range parameters (`position` and `length`) to `resourceRead` and a total-size indicator (`ResourceReadResult.size`) so callers can read slices of large resources without splitting UTF-8 sequences; a response without `size` contains the whole resource. ([#554](https://github.com/microsoft/agent-host-protocol/issues/554)) + ```ts + const slice = await client.request('resourceRead', { + channel: 'ahp-root://', + uri: 'file:///workspace/logo.png', + position: 0, + length: 16, + }); + // slice.size is present iff the receiver honored the byte range + ``` +- Document that peers should serve `resourceRead` requests for URIs they publish as content, including HTTP(S) URLs that the other peer cannot reach directly (such as a loopback dev server). +- Add optional `McpServerCustomization.children` to surface MCP-served skills (SEP-2640) inside MCP server customizations, toggleable by ID via `session/customizationToggled`. + Read more in [Customizations](https://microsoft.github.io/agent-host-protocol/guide/customizations). +- Add optional `AuthenticateParams.accountId` to carry an opaque client-local account hint alongside tokens so hosts can detect account switches without changing token validation. + Read more in [Authentication — Account selection hints](https://microsoft.github.io/agent-host-protocol/specification/authentication#account-selection-hints). ### Changed -- Experimental windowed subscriptions count every data notification against the window, whether sent whole or in `channel/frame` notifications. Frames carry messages larger than `maxFrameBytes` and let subscriptions share the connection. -- `Snapshot.state` can be an `EmptyState` (`{}`) for channels whose state has no fields, such as telemetry. With ordinary delivery, a server may send such a snapshot or omit it, so clients must accept both. Clients must not fail on a snapshot state that they do not recognize. -- Experimental windowed delivery removes `maximumMessageBytes` and uses one size for everything: the UTF-16 size of each JSON-RPC data message as sent, including `channel/frame` envelopes. Each message and frame counts against `windowBytes`, which is a soft target; `maxFrameBytes` remains a hard limit on each message, and receivers can return credit for stored frames. -- Store steering and queued input in one `queuedMessages` list with optional `PendingMessage.kind` (absent means queued), using the existing per-ID pending actions. New IDs append, kind changes replace in place, and UIs group steering first without changing raw order. Mirror the latest steering update in the deprecated `steeringMessage` slot for older clients. -- Experimental windowed subscriptions no longer carry byte counters across `reconnect`. Their counters start at zero on the new connection, and each `reconnect.windows` item offers new limits in `flowControl`, which the result accepts as in `subscribe`. Removes `ChannelReceiveProgress` and the `clientReceive`/`hostReceive` counters from reconnect. -- Direct Rust struct literals for `ChatState`, `ChatSummary`, and `SessionChatSummary` must now include `provider: None`. -- Remove the User-only restriction on client-submitted messages in `chat/turnStarted` and `chat/pendingMessageSet`. (#542) -- Direct Rust struct literals for `ResourceReadParams` must now include `position: None` and `length: None`, and those for `ResourceReadResult` must include `size: None`. -- Experimental `CanvasState.url` is renamed to `CanvasState.uri` and holds an absolute content URI, typically HTTP(S). A client that can't load it directly reads it, and the relative references in its content, with `resourceRead`. -- Preserve unknown members on automation patch objects and nested shared types (`extra` in Rust/Swift/Kotlin, `Extra` in Go/.NET). Rust struct literals must initialize `extra` and exhaustive patterns need `..`; Go map-bearing structs lose `==` comparability; .NET record equality compares `Extra` by reference; Swift/Kotlin consumers must recompile. (#592) -- Annotations channels use `ahp-annotations:/` with the owning session's id; clients should use `AnnotationsSummary.resource` rather than derive the URI. +- Unify steering and queued input in `ChatState.queuedMessages` with an optional `PendingMessage.kind` (`steering` or `queued`, defaulting to `queued`) using existing per-ID pending actions; new IDs append, kind changes replace in place, UIs group steering first without mutating raw order, and the latest steering entry is mirrored to the deprecated `steeringMessage` slot for older clients. + ```ts + client.notify('dispatchAction', { + channel: chatUri, + clientSeq: 1, + action: { type: 'chat/pendingMessageSet', kind: 'steering', id: 'p1', message }, + }); + ``` +- Require direct Rust struct literals for `ChatState`, `ChatSummary`, and `SessionChatSummary` to initialize `provider: None` (added for per-chat agent providers). +- Allow non-`user` message origins (such as `automation` or `systemNotification`) in client-submitted `chat/turnStarted` and `chat/pendingMessageSet` actions. ([#542](https://github.com/microsoft/agent-host-protocol/issues/542)) +- Require direct Rust struct literals for `ResourceReadParams` to initialize `position: None` and `length: None`, and `ResourceReadResult` literals to initialize `size: None` (added for ranged `resourceRead`). +- Rename experimental `CanvasState.url` to `CanvasState.uri` to hold an absolute content URI (typically HTTP(S)); clients that cannot load the URI directly can fetch it and its relative references via `resourceRead`. +- Preserve unknown JSON members on automation patch objects and nested shared types via an `extra` field so newer fields survive round-trips; direct Rust struct literals must initialize `extra` and exhaustive patterns need `..`. ([#592](https://github.com/microsoft/agent-host-protocol/issues/592)) +- Standardize annotations channel URIs on `ahp-annotations:/` using the owning session's ID; clients should read `AnnotationsSummary.resource` rather than constructing the URI manually. ### Fixed -- Decoding a snapshot whose state has an unrecognized form no longer fails. The state is kept as an `Unknown` variant with its raw JSON, and state mirrors ignore it. Go no longer decodes such a state as an empty `RootState`. -- Rust `Client::request` removes pending entries when its future is dropped, including while waiting for outbound admission. (#565) -- State mirrors leave confirmed state unchanged when an action envelope carries a rejection reason. (#586) -- Swift and Rust select snapshot state types from `Snapshot.resource`, propagating errors for malformed known-channel states and preserving unrecognized schemes as raw JSON. (#590) +- Fix snapshot decoding so unrecognized channel states no longer fail; unknown states are preserved as an `Unknown` variant with their raw JSON and ignored by state mirrors. +- Fix `Client::request` to remove pending request entries when its future is dropped, including while waiting for outbound admission. ([#565](https://github.com/microsoft/agent-host-protocol/issues/565)) +- Fix state mirrors to leave confirmed state unchanged when an incoming action envelope carries a `rejectionReason`. ([#586](https://github.com/microsoft/agent-host-protocol/issues/586)) +- Fix snapshot state decoding to dispatch on `Snapshot.resource`, propagating decode errors for malformed known-channel states while preserving unrecognized URI schemes as raw JSON. ([#590](https://github.com/microsoft/agent-host-protocol/issues/590)) ### Security -- Add an optional `authenticate.target` identifying an MCP server by session URI and customization ID, preventing tokens from reaching other consumers that share a protected resource and scopes. +- Add optional `AuthenticateParams.target` to bind a pushed OAuth token to a specific MCP server by session URI and customization ID, preventing credentials from leaking to other consumers that share a protected resource and scopes. + ```ts + await client.request('authenticate', { + channel: 'ahp-root://', + resource: 'https://mcp.example.com', + token: accessToken, + target: { + kind: 'mcpServer', + session: sessionUri, + customizationId: 'mcp-server-1', + }, + }); + ``` + Read more in [Authentication — Token Delivery](https://microsoft.github.io/agent-host-protocol/specification/authentication#token-delivery). ## [1.0.0] — 2026-10-02 @@ -77,7 +143,7 @@ Implements AHP 1.0.0. - `ChatState.changesets` and `chat/changesetsChanged` expose each chat's changeset catalogue through the subscribed chat channel. - `AutomationDefinition.disableConditions` supports `afterRuns` (`max`) and `afterDate` (`date`) rules combined with logical OR, with at most one condition per kind. Host-owned `AutomationEntry.runCount` tracks the current scheduled-run allowance. Edit conditions through `automation/updateRequested`: omission leaves them unchanged, an array replaces them, and `[]` removes all conditions without re-enabling the automation. - `ChangesetStatus.Recomputing` distinguishes refreshes of a completed result from initial changeset computation. -- `ConfigPropertySchema.minItems` and `ConfigPropertySchema.maxItems` express array cardinality for `type: "array"` config properties. (#432) +- `ConfigPropertySchema.minItems` and `ConfigPropertySchema.maxItems` express array cardinality for `type: "array"` config properties. ([#432](https://github.com/microsoft/agent-host-protocol/issues/432)) - `McpServerStartingState.blocking` flag indicating that message processing may be held on the server, and the client-dispatchable `session/mcpServerBackgroundRequested` action asking the host to background such a startup. - `AutomationSessionTemplate.customizations` lets automations carry client plugins (skills, agents, prompts, rules) that the host captures when the definition is saved, with the host-owned copies reported in `AutomationEntry.customizations` and support advertised by `AutomationCapabilities.customizations`. - Hosts can advertise chat-owned canvas channel references and synchronize live presentation metadata and source URLs on experimental per-canvas channels. @@ -137,8 +203,8 @@ Implements AHP 0.8.0. - Optional `_meta` request metadata on all command parameters. - `ClientPluginCustomization` can publish child enablement decisions. -- Reserve the `x-` prefix for implementation-defined channel URI schemes, commands, notifications, and actions. (#367) -- `session/workingDirectoryReplaced` atomically replaces a working-directory entry, including a replaceable primary. (#392) +- Reserve the `x-` prefix for implementation-defined channel URI schemes, commands, notifications, and actions. ([#367](https://github.com/microsoft/agent-host-protocol/issues/367)) +- `session/workingDirectoryReplaced` atomically replaces a working-directory entry, including a replaceable primary. ([#392](https://github.com/microsoft/agent-host-protocol/issues/392)) ### Changed @@ -158,10 +224,10 @@ Implements AHP 0.7.0. ### Added - Capability-gated side chats can start from a chat turn and return bounded chat transcripts as message attachments. -- Multiroot session support: `AgentCapabilities.multipleWorkingDirectories` capability (with `immutablePrimary`, which pins `workingDirectories[0]` as a fixed primary root that clients MUST NOT remove or reorder), `CreateSessionParams.workingDirectories` and `SessionMetadata.workingDirectories` (equal-peer set, mirrored onto `SessionState`/`SessionSummary`), `CreateChatParams.workingDirectories` and `ChatState`/`ChatSummary.workingDirectories` (a subset of the session's set), and the client-dispatchable `session/workingDirectorySet` / `session/workingDirectoryRemoved` and `chat/workingDirectorySet` / `chat/workingDirectoryRemoved` actions for mutating those sets. (#337) -- `Client::completions()` and `Client::session_config_completions()` typed wrappers for the `completions` / `sessionConfigCompletions` commands, matching the existing `resource_*` convenience methods. (#340) -- `result` on `ToolResultTerminalContent` (`exitCode`, `preview`, `truncated`), present once the command exits. (#323) -- Optional `isPty` metadata on `ToolResultTerminalContent` and `TerminalState` indicating whether a terminal resource is PTY-backed. (#322) +- Multiroot session support: `AgentCapabilities.multipleWorkingDirectories` capability (with `immutablePrimary`, which pins `workingDirectories[0]` as a fixed primary root that clients MUST NOT remove or reorder), `CreateSessionParams.workingDirectories` and `SessionMetadata.workingDirectories` (equal-peer set, mirrored onto `SessionState`/`SessionSummary`), `CreateChatParams.workingDirectories` and `ChatState`/`ChatSummary.workingDirectories` (a subset of the session's set), and the client-dispatchable `session/workingDirectorySet` / `session/workingDirectoryRemoved` and `chat/workingDirectorySet` / `chat/workingDirectoryRemoved` actions for mutating those sets. ([#337](https://github.com/microsoft/agent-host-protocol/issues/337)) +- `Client::completions()` and `Client::session_config_completions()` typed wrappers for the `completions` / `sessionConfigCompletions` commands, matching the existing `resource_*` convenience methods. ([#340](https://github.com/microsoft/agent-host-protocol/issues/340)) +- `result` on `ToolResultTerminalContent` (`exitCode`, `preview`, `truncated`), present once the command exits. ([#323](https://github.com/microsoft/agent-host-protocol/issues/323)) +- Optional `isPty` metadata on `ToolResultTerminalContent` and `TerminalState` indicating whether a terminal resource is PTY-backed. ([#322](https://github.com/microsoft/agent-host-protocol/issues/322)) - Side-chat sources and origins can now carry an immutable selected-text snapshot with optional response-part provenance. ### Changed @@ -173,8 +239,8 @@ Implements AHP 0.7.0. ### Removed -- `ToolResultTerminalCompleteContent`; command completion data now lives on `ToolResultTerminalContent`. (#322, #323) -- Non-standard `resource_encryption_alg_values_supported` and `resource_encryption_enc_values_supported` fields from `ProtectedResourceMetadata`. (#368) +- `ToolResultTerminalCompleteContent`; command completion data now lives on `ToolResultTerminalContent`. ([#322](https://github.com/microsoft/agent-host-protocol/issues/322), [#323](https://github.com/microsoft/agent-host-protocol/issues/323)) +- Non-standard `resource_encryption_alg_values_supported` and `resource_encryption_enc_values_supported` fields from `ProtectedResourceMetadata`. ([#368](https://github.com/microsoft/agent-host-protocol/issues/368)) ### Fixed @@ -187,8 +253,8 @@ Implements AHP 0.6.0. ### Added -- `Changeset.capabilities` with a `review` presence flag (`ChangesetCapabilities`) so a changeset can advertise support for the per-file review workflow up-front on the session's changeset list. (#328) -- 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`. (#308) +- `Changeset.capabilities` with a `review` presence flag (`ChangesetCapabilities`) so a changeset can advertise support for the per-file review workflow up-front on the session's changeset list. ([#328](https://github.com/microsoft/agent-host-protocol/issues/328)) +- 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`. ([#308](https://github.com/microsoft/agent-host-protocol/issues/308)) - `chat/turnStarted` carries a `startedAt` timestamp, `chat/turnComplete`/`chat/turnCancelled`/`chat/error` carry an elapsed `duration` (milliseconds, producer's own clock), and completed turns expose their start time and duration. - Asynchronous tool-call risk assessments with a model-provided explanation and normalized safety score. - `ToolCallStatus.AuthRequired` tool call state and `chat/toolCallAuthRequired` / `chat/toolCallAuthResolved` actions so a running MCP-contributed tool call can pause mid-execution on an OAuth challenge (`McpAuthRequirement`) and resume once the client authenticates; surfaced at the session level via a new `toolAuthentication` `SessionInputRequest` variant, and `AuthenticateParams` gained an optional `scopes` field and now accepts resources discovered from a live `McpServerAuthRequiredState` or `ToolCallAuthRequiredState` in addition to `AgentInfo.protectedResources`. `chat/toolCallComplete` now also accepts a failed result while a tool call is `auth-required`, letting a client cancel that invocation without completing the authentication challenge. @@ -197,8 +263,8 @@ Implements AHP 0.6.0. ### Changed -- Renamed the changeset review action `changeset/filesReviewedChanged` to `changeset/filesReviewChanged` (field `fileIds` → `files`) and made it client-dispatchable, so a reviewer can toggle a file's `reviewed` flag directly through the write-ahead reducer. (#328) -- Input requests now live in turn `responseParts`, with an optional `response` until `chat/inputCompleted` submits the result. (#327) +- Renamed the changeset review action `changeset/filesReviewedChanged` to `changeset/filesReviewChanged` (field `fileIds` → `files`) and made it client-dispatchable, so a reviewer can toggle a file's `reviewed` flag directly through the write-ahead reducer. ([#328](https://github.com/microsoft/agent-host-protocol/issues/328)) +- Input requests now live in turn `responseParts`, with an optional `response` until `chat/inputCompleted` submits the result. ([#327](https://github.com/microsoft/agent-host-protocol/issues/327)) ## [0.5.2] — 2026-07-09 @@ -244,7 +310,7 @@ Implements AHP 0.5.2. `response_parts` on `chat/inputCompleted` — embedding the resolved `ChatInputRequest` (final `answers`) and the `response` (`accept`, `decline`, or `cancel`) — so the outcome persists after the live request is removed. - Abandoned requests still record nothing (#324). + Abandoned requests still record nothing ([#324](https://github.com/microsoft/agent-host-protocol/issues/324)). ### Changed diff --git a/clients/swift/CHANGELOG.md b/clients/swift/CHANGELOG.md index 6ef0ab706..c85323bc5 100644 --- a/clients/swift/CHANGELOG.md +++ b/clients/swift/CHANGELOG.md @@ -23,50 +23,116 @@ Implements AHP 1.1.0. ### Added -- Optional typed `InitializeResult.environment.pathStyle` metadata for authoritative host path semantics. -- Optional `CreateChatParams.title` for a client-selected initial display title. -- Optional `SessionModelInfo.vendor` for the model vendor as the provider reports it. (#503) -- Experimental subscription-negotiated flow-control types using UTF-16 byte accounting, framed delivery and consumption credit notifications, and independent `reconnect.windows` metadata. (#492) -- `EmptyState` variant of `Snapshot.state` for channels whose state has no fields, such as telemetry. Every experimental windowed subscription starts with `channel/snapshot`. -- Experimental TCP channel: `createTcpConnection` opens a TCP connection on the host's network and returns an empty `CreateTcpConnectionResult`. The client forwards it over a windowed subscription with `tcp/data`, `tcp/eof`, and `tcp/reset`. TCP channels do not survive the loss of the AHP connection. (#488) -- Each client exposes the notification methods that do not count against the window on a windowed subscription (`WINDOW_EXEMPT_METHODS` and `countsAgainstWindow` in TypeScript, with equivalents in the other clients), generated from the new `@windowExempt` annotation. -- `ChatState.config`, the `chat/configChanged` action, and `chatMutable` on session config properties give each chat its own config for selected settings, such as tool auto-approval, so changing them in one chat no longer changes every chat in the session. `ChatConfigState.values` holds the chat's `chatMutable` properties and does not inherit from the session; missing keys take the schema default. Optional `ChatConfigState.schema` replaces the session's schema for a chat whose agent differs from the session's. -- Optional per-chat agent provider: `CreateChatParams.provider` and `ChatSummary.provider` (mirrored on `ChatState` and `SessionChatSummary`), gated by the host-level `InitializeResult.multipleChatProviders` capability, let one session contain chats backed by different agent providers. Absent `provider` means the session's agent provider; forks and side chats keep their source chat's agent provider. -- Optional `ChangesetFile.status`, a bitset of `ChangesetFileStatus` flags (initially `Editing`), reports per-file activity through existing changeset snapshots and actions without requiring provider-specific metadata. (#538) -- Optional changeset file and operation-target nonces let hosts reject operations on superseded changes without requiring a capability or a nonce from every client. (#538) -- Adds `chat/moved`, dispatched on a chat's channel after a cross-session move with its new session, `provider` and `config.schema`. -- Optional producer-recorded `startedAt` and `duration` fields on reasoning response parts and `chat/reasoning` updates preserve each contiguous reasoning run's timing across state snapshots and history restoration. -- Optional `ToolCallResult.resultMetadata` carries MCP `CallToolResult._meta` separately from host/provider tool-call metadata and is preserved through result confirmation. -- Optional `ResourceReadParams.position` and `ResourceReadParams.length` request a byte range from `resourceRead`, and optional `ResourceReadResult.size` reports the total size of the resource when the receiver honored the range. A result without `size` is the whole resource, and a ranged `utf-8` result does not split a UTF-8 sequence. (#554) -- `resourceRead` guidance: a peer SHOULD serve reads of the URIs it publishes as content, including HTTP(S) URLs that the other peer might not be able to reach. -- Optional `McpServerCustomization.children` for MCP-served skills (SEP-2640), toggleable by id with `session/customizationToggled`. -- Optional `authenticate.accountId` carries an opaque client-local account-selection hint without changing token validation or legacy authentication. -- Add `Equatable` conformance to generated Swift protocol models, including associated-value enums and conditional conformance for generic JSON-RPC wrappers. (#591) -- Generated `AHPCommand` conformances and typed `request(_:)` APIs for every Swift protocol command, including null results. (#588) +- Add optional `InitializeResult.environment.pathStyle` (`posix` or `windows`) so clients can parse and format host paths using the host's native path grammar instead of guessing locally. +- Add optional `CreateChatParams.title` so clients can choose an initial display title when creating a chat. +- Add optional `SessionModelInfo.vendor` so clients can display the model vendor reported by the provider separately from the owning agent provider. ([#503](https://github.com/microsoft/agent-host-protocol/issues/503)) +- Add experimental windowed delivery for subscriptions so fast producers do not overwhelm slow clients: peers negotiate soft `windowBytes` and hard `maxFrameBytes` limits using UTF-16 JSON-RPC message sizes, split large messages with `channel/frame`, return cumulative credit with `channel/credit`, renegotiate fresh zero-based windows in `reconnect.windows`, and expose generated `@windowExempt` helpers (`windowExemptMethods` and `countsAgainstWindow(_:)` in Swift) for control notifications that do not count against the window. ([#492](https://github.com/microsoft/agent-host-protocol/issues/492)) + ```ts + // Offer windowed delivery on subscribe + await client.request('subscribe', { + channel: 'ahp-terminal:/t1', + flowControl: { receive: { windowBytes: 262144, maxFrameBytes: 16384 } }, + }); + // Return cumulative UTF-16 byte credit after processing incoming data + client.notify('channel/credit', { channel: 'ahp-terminal:/t1', consumedBytes }); + ``` + Read more in [Windowed Delivery](https://microsoft.github.io/agent-host-protocol/specification/windowed-delivery). +- Add `EmptyState` (`{}`) to `Snapshot.state` for channels with no state fields, such as telemetry and TCP channels. Windowed subscriptions always start with `channel/snapshot`, whereas ordinary subscriptions may send or omit an `EmptyState` snapshot; clients must accept both and ignore unrecognized snapshot shapes. + Read more in [Channels and Subscriptions](https://microsoft.github.io/agent-host-protocol/specification/subscriptions). +- Add an experimental TCP channel (`createTcpConnection`, `tcp/data`, `tcp/eof`, and `tcp/reset`, gated by `InitializeResult.tcpConnections`) so clients can forward TCP connections opened on the host's network over a windowed subscription; connections close if the AHP transport drops. ([#488](https://github.com/microsoft/agent-host-protocol/issues/488)) + ```ts + const channel = 'ahp-tcp:/t1'; + await client.request('createTcpConnection', { channel, host: 'localhost', port: 3000 }); + await client.request('subscribe', { + channel, + flowControl: { receive: { windowBytes: 262144, maxFrameBytes: 16384 } }, + }); + client.notify('tcp/data', { channel, data: base64Bytes }); + ``` + Read more in [TCP Channel](https://microsoft.github.io/agent-host-protocol/specification/tcp-channel). +- Add per-chat configuration (`ChatState.config`, `chat/configChanged`, and `SessionConfigPropertySchema.chatMutable`) so settings like tool auto-approval can be changed for one chat without affecting sibling chats; `ChatConfigState.values` does not inherit from the session (missing keys use the schema default), and optional `ChatConfigState.schema` overrides the session schema when a chat uses a different agent provider. + ```ts + client.notify('dispatchAction', { + channel: chatUri, + clientSeq: 1, + action: { type: 'chat/configChanged', config: { autoApprove: true } }, + }); + ``` + Read more in [Chat Channel — Per-chat configuration](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#per-chat-configuration). +- Add per-chat agent providers (`CreateChatParams.provider` and `provider` on `ChatSummary`, `ChatState`, and `SessionChatSummary`, gated by `InitializeResult.multipleChatProviders`) so a single session can mix chats backed by different agent providers; omitting `provider` uses the session's provider, and forks and side chats keep their source chat's provider. + ```ts + await client.request('createChat', { + channel: sessionUri, + chat: 'ahp-chat:/', + provider: 'claude', + }); + ``` + Read more in [Chat Channel — Chat providers](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#chat-providers). +- Add optional `ChangesetFile.status` (a bitset of `ChangesetFileStatus` flags, starting with `Editing`) so hosts can report ongoing per-file edits in changeset snapshots and actions without provider-specific metadata. ([#538](https://github.com/microsoft/agent-host-protocol/issues/538)) + Read more in [Changesets — Per-file Editing Activity](https://microsoft.github.io/agent-host-protocol/guide/changesets#per-file-editing-activity). +- Add optional optimistic-concurrency nonces (`ChangesetFile.nonce` and `ChangesetOperationTarget.nonce`) so hosts can reject `invokeChangesetOperation` calls targeting superseded file edits with `Conflict` without requiring a capability or breaking clients that omit nonces. ([#538](https://github.com/microsoft/agent-host-protocol/issues/538)) +- Add the `chat/moved` action, dispatched on a chat's channel after a cross-session `moveChat` to notify subscribers of its new `session` URI and updated relative `provider` and `config.schema`. + Read more in [Chat Channel — Moving chats](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#moving-chats). +- Add optional producer-recorded `startedAt` and `duration` fields to `ReasoningResponsePart` and `chat/reasoning` actions so each contiguous reasoning run's timing is preserved across snapshots, reconnects, and history restoration. + Read more in [Chat Channel — Reasoning timing](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#reasoning-timing). +- Add optional `ToolCallResult.resultMetadata` to carry MCP `CallToolResult._meta` separately from host/provider tool-call metadata and preserve it through result confirmation. +- Add optional byte-range parameters (`position` and `length`) to `resourceRead` and a total-size indicator (`ResourceReadResult.size`) so callers can read slices of large resources without splitting UTF-8 sequences; a response without `size` contains the whole resource. ([#554](https://github.com/microsoft/agent-host-protocol/issues/554)) + ```ts + const slice = await client.request('resourceRead', { + channel: 'ahp-root://', + uri: 'file:///workspace/logo.png', + position: 0, + length: 16, + }); + // slice.size is present iff the receiver honored the byte range + ``` +- Document that peers should serve `resourceRead` requests for URIs they publish as content, including HTTP(S) URLs that the other peer cannot reach directly (such as a loopback dev server). +- Add optional `McpServerCustomization.children` to surface MCP-served skills (SEP-2640) inside MCP server customizations, toggleable by ID via `session/customizationToggled`. + Read more in [Customizations](https://microsoft.github.io/agent-host-protocol/guide/customizations). +- Add optional `AuthenticateParams.accountId` to carry an opaque client-local account hint alongside tokens so hosts can detect account switches without changing token validation. + Read more in [Authentication — Account selection hints](https://microsoft.github.io/agent-host-protocol/specification/authentication#account-selection-hints). +- Add `Equatable` conformance to generated Swift protocol models, including associated-value enums and conditional conformance for generic JSON-RPC wrappers. ([#591](https://github.com/microsoft/agent-host-protocol/issues/591)) +- Add generated `AHPCommand` conformances and typed `request(_:)` APIs for every Swift protocol command, including commands with null results. ([#588](https://github.com/microsoft/agent-host-protocol/issues/588)) ### Changed -- Experimental windowed subscriptions count every data notification against the window, whether sent whole or in `channel/frame` notifications. Frames carry messages larger than `maxFrameBytes` and let subscriptions share the connection. -- `Snapshot.state` can be an `EmptyState` (`{}`) for channels whose state has no fields, such as telemetry. With ordinary delivery, a server may send such a snapshot or omit it, so clients must accept both. Clients must not fail on a snapshot state that they do not recognize. -- Experimental windowed delivery removes `maximumMessageBytes` and uses one size for everything: the UTF-16 size of each JSON-RPC data message as sent, including `channel/frame` envelopes. Each message and frame counts against `windowBytes`, which is a soft target; `maxFrameBytes` remains a hard limit on each message, and receivers can return credit for stored frames. -- Store steering and queued input in one `queuedMessages` list with optional `PendingMessage.kind` (absent means queued), using the existing per-ID pending actions. New IDs append, kind changes replace in place, and UIs group steering first without changing raw order. Mirror the latest steering update in the deprecated `steeringMessage` slot for older clients. -- Experimental windowed subscriptions no longer carry byte counters across `reconnect`. Their counters start at zero on the new connection, and each `reconnect.windows` item offers new limits in `flowControl`, which the result accepts as in `subscribe`. Removes `ChannelReceiveProgress` and the `clientReceive`/`hostReceive` counters from reconnect. -- Remove the User-only restriction on client-submitted messages in `chat/turnStarted` and `chat/pendingMessageSet`. (#542) -- Experimental `CanvasState.url` is renamed to `CanvasState.uri` and holds an absolute content URI, typically HTTP(S). A client that can't load it directly reads it, and the relative references in its content, with `resourceRead`. -- Preserve unknown members on automation patch objects and nested shared types (`extra` in Rust/Swift/Kotlin, `Extra` in Go/.NET). Rust struct literals must initialize `extra` and exhaustive patterns need `..`; Go map-bearing structs lose `==` comparability; .NET record equality compares `Extra` by reference; Swift/Kotlin consumers must recompile. (#592) -- Annotations channels use `ahp-annotations:/` with the owning session's id; clients should use `AnnotationsSummary.resource` rather than derive the URI. +- Unify steering and queued input in `ChatState.queuedMessages` with an optional `PendingMessage.kind` (`steering` or `queued`, defaulting to `queued`) using existing per-ID pending actions; new IDs append, kind changes replace in place, UIs group steering first without mutating raw order, and the latest steering entry is mirrored to the deprecated `steeringMessage` slot for older clients. + ```ts + client.notify('dispatchAction', { + channel: chatUri, + clientSeq: 1, + action: { type: 'chat/pendingMessageSet', kind: 'steering', id: 'p1', message }, + }); + ``` +- Allow non-`user` message origins (such as `automation` or `systemNotification`) in client-submitted `chat/turnStarted` and `chat/pendingMessageSet` actions. ([#542](https://github.com/microsoft/agent-host-protocol/issues/542)) +- Rename experimental `CanvasState.url` to `CanvasState.uri` to hold an absolute content URI (typically HTTP(S)); clients that cannot load the URI directly can fetch it and its relative references via `resourceRead`. +- Preserve unknown JSON members on automation patch objects and nested shared types via an `extra` property so newer fields survive round-trips; Swift consumers must recompile against the updated structs. ([#592](https://github.com/microsoft/agent-host-protocol/issues/592)) +- Standardize annotations channel URIs on `ahp-annotations:/` using the owning session's ID; clients should read `AnnotationsSummary.resource` rather than constructing the URI manually. ### Fixed -- Decoding a snapshot whose state has an unrecognized form no longer fails. The state is kept as an `Unknown` variant with its raw JSON, and state mirrors ignore it. Go no longer decodes such a state as an empty `RootState`. -- State mirrors leave confirmed state unchanged when an action envelope carries a rejection reason. (#586) -- Swift and Rust select snapshot state types from `Snapshot.resource`, propagating errors for malformed known-channel states and preserving unrecognized schemes as raw JSON. (#590) -- Swift subscriptions and client events now report undecodable action envelopes as `SubscriptionEvent.actionDecodingFailed` (a new case, so exhaustive switches must handle it) and advance the reconnect cursor past them. (#589) -- Generate `clientDispatchableActions` and `isClientDispatchable(_:)` from canonical action annotations, including all 48 client-dispatchable actions. (#587) +- Fix snapshot decoding so unrecognized channel states no longer fail; unknown states are preserved as an `Unknown` variant with their raw JSON and ignored by state mirrors. +- Fix state mirrors to leave confirmed state unchanged when an incoming action envelope carries a `rejectionReason`. ([#586](https://github.com/microsoft/agent-host-protocol/issues/586)) +- Fix snapshot state decoding to dispatch on `Snapshot.resource`, propagating decode errors for malformed known-channel states while preserving unrecognized URI schemes as raw JSON. ([#590](https://github.com/microsoft/agent-host-protocol/issues/590)) +- Fix subscription and client event handling to report undecodable action envelopes via a new `SubscriptionEvent.actionDecodingFailed` case (update exhaustive switches) and advance the reconnect cursor past them. ([#589](https://github.com/microsoft/agent-host-protocol/issues/589)) +- Fix `clientDispatchableActions` and `isClientDispatchable(_:)` by generating them from canonical `@clientDispatchable` annotations so all 48 client-dispatchable actions are included. ([#587](https://github.com/microsoft/agent-host-protocol/issues/587)) ### Security -- Add an optional `authenticate.target` identifying an MCP server by session URI and customization ID, preventing tokens from reaching other consumers that share a protected resource and scopes. +- Add optional `AuthenticateParams.target` to bind a pushed OAuth token to a specific MCP server by session URI and customization ID, preventing credentials from leaking to other consumers that share a protected resource and scopes. + ```ts + await client.request('authenticate', { + channel: 'ahp-root://', + resource: 'https://mcp.example.com', + token: accessToken, + target: { + kind: 'mcpServer', + session: sessionUri, + customizationId: 'mcp-server-1', + }, + }); + ``` + Read more in [Authentication — Token Delivery](https://microsoft.github.io/agent-host-protocol/specification/authentication#token-delivery). ## [1.0.0] — 2026-10-02 @@ -80,7 +146,7 @@ Implements AHP 1.0.0. - `ChatState.changesets` and `chat/changesetsChanged` expose each chat's changeset catalogue through the subscribed chat channel. - `AutomationDefinition.disableConditions` supports `afterRuns` (`max`) and `afterDate` (`date`) rules combined with logical OR, with at most one condition per kind. Host-owned `AutomationEntry.runCount` tracks the current scheduled-run allowance. Edit conditions through `automation/updateRequested`: omission leaves them unchanged, an array replaces them, and `[]` removes all conditions without re-enabling the automation. - `ChangesetStatus.Recomputing` distinguishes refreshes of a completed result from initial changeset computation. -- `ConfigPropertySchema.minItems` and `ConfigPropertySchema.maxItems` express array cardinality for `type: "array"` config properties. (#432) +- `ConfigPropertySchema.minItems` and `ConfigPropertySchema.maxItems` express array cardinality for `type: "array"` config properties. ([#432](https://github.com/microsoft/agent-host-protocol/issues/432)) - `McpServerStartingState.blocking` flag indicating that message processing may be held on the server, and the client-dispatchable `session/mcpServerBackgroundRequested` action asking the host to background such a startup. - `AutomationSessionTemplate.customizations` lets automations carry client plugins (skills, agents, prompts, rules) that the host captures when the definition is saved, with the host-owned copies reported in `AutomationEntry.customizations` and support advertised by `AutomationCapabilities.customizations`. - Hosts can advertise chat-owned canvas channel references and synchronize live presentation metadata and source URLs on experimental per-canvas channels. @@ -135,8 +201,8 @@ Implements AHP 0.8.0. - Optional `_meta` request metadata on all command parameters. - `ClientPluginCustomization` can publish child enablement decisions. -- Reserve the `x-` prefix for implementation-defined channel URI schemes, commands, notifications, and actions. (#367) -- `session/workingDirectoryReplaced` atomically replaces a working-directory entry, including a replaceable primary. (#392) +- Reserve the `x-` prefix for implementation-defined channel URI schemes, commands, notifications, and actions. ([#367](https://github.com/microsoft/agent-host-protocol/issues/367)) +- `session/workingDirectoryReplaced` atomically replaces a working-directory entry, including a replaceable primary. ([#392](https://github.com/microsoft/agent-host-protocol/issues/392)) ### Changed @@ -156,10 +222,10 @@ Implements AHP 0.7.0. ### Added - Capability-gated side chats can start from a chat turn and return bounded chat transcripts as message attachments. -- Multiroot session support: `AgentCapabilities.multipleWorkingDirectories` capability (with `immutablePrimary`, which pins `workingDirectories[0]` as a fixed primary root that clients MUST NOT remove or reorder), `CreateSessionParams.workingDirectories` and `SessionMetadata.workingDirectories` (equal-peer set, mirrored onto `SessionState`/`SessionSummary`), `CreateChatParams.workingDirectories` and `ChatState`/`ChatSummary.workingDirectories` (a subset of the session's set), and the client-dispatchable `session/workingDirectorySet` / `session/workingDirectoryRemoved` and `chat/workingDirectorySet` / `chat/workingDirectoryRemoved` actions for mutating those sets. (#337) -- `AHPClient.completions()` and `AHPClient.sessionConfigCompletions()` convenience methods, plus `AHPCommands.completions(id:)` / `AHPCommands.sessionConfigCompletions(id:)` request factories, giving the generated `Completions*` / `SessionConfigCompletions*` types a typed entry point. (#340) -- `result` on `ToolResultTerminalContent` (`exitCode`, `preview`, `truncated`), present once the command exits. (#323) -- Optional `isPty` metadata on `ToolResultTerminalContent` and `TerminalState` indicating whether a terminal resource is PTY-backed. (#322) +- Multiroot session support: `AgentCapabilities.multipleWorkingDirectories` capability (with `immutablePrimary`, which pins `workingDirectories[0]` as a fixed primary root that clients MUST NOT remove or reorder), `CreateSessionParams.workingDirectories` and `SessionMetadata.workingDirectories` (equal-peer set, mirrored onto `SessionState`/`SessionSummary`), `CreateChatParams.workingDirectories` and `ChatState`/`ChatSummary.workingDirectories` (a subset of the session's set), and the client-dispatchable `session/workingDirectorySet` / `session/workingDirectoryRemoved` and `chat/workingDirectorySet` / `chat/workingDirectoryRemoved` actions for mutating those sets. ([#337](https://github.com/microsoft/agent-host-protocol/issues/337)) +- `AHPClient.completions()` and `AHPClient.sessionConfigCompletions()` convenience methods, plus `AHPCommands.completions(id:)` / `AHPCommands.sessionConfigCompletions(id:)` request factories, giving the generated `Completions*` / `SessionConfigCompletions*` types a typed entry point. ([#340](https://github.com/microsoft/agent-host-protocol/issues/340)) +- `result` on `ToolResultTerminalContent` (`exitCode`, `preview`, `truncated`), present once the command exits. ([#323](https://github.com/microsoft/agent-host-protocol/issues/323)) +- Optional `isPty` metadata on `ToolResultTerminalContent` and `TerminalState` indicating whether a terminal resource is PTY-backed. ([#322](https://github.com/microsoft/agent-host-protocol/issues/322)) - Side-chat sources and origins can now carry an immutable selected-text snapshot with optional response-part provenance. ### Changed @@ -171,8 +237,8 @@ Implements AHP 0.7.0. ### Removed -- `ToolResultTerminalCompleteContent`; command completion data now lives on `ToolResultTerminalContent`. (#322, #323) -- Non-standard `resource_encryption_alg_values_supported` and `resource_encryption_enc_values_supported` fields from `ProtectedResourceMetadata`. (#368) +- `ToolResultTerminalCompleteContent`; command completion data now lives on `ToolResultTerminalContent`. ([#322](https://github.com/microsoft/agent-host-protocol/issues/322), [#323](https://github.com/microsoft/agent-host-protocol/issues/323)) +- Non-standard `resource_encryption_alg_values_supported` and `resource_encryption_enc_values_supported` fields from `ProtectedResourceMetadata`. ([#368](https://github.com/microsoft/agent-host-protocol/issues/368)) ### Fixed @@ -185,19 +251,19 @@ Implements AHP 0.6.0. ### Added -- `Changeset.capabilities` with a `review` presence flag (`ChangesetCapabilities`) so a changeset can advertise support for the per-file review workflow up-front on the session's changeset list. (#328) -- 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`. (#308) +- `Changeset.capabilities` with a `review` presence flag (`ChangesetCapabilities`) so a changeset can advertise support for the per-file review workflow up-front on the session's changeset list. ([#328](https://github.com/microsoft/agent-host-protocol/issues/328)) +- 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`. ([#308](https://github.com/microsoft/agent-host-protocol/issues/308)) - `chat/turnStarted` carries a `startedAt` timestamp, `chat/turnComplete`/`chat/turnCancelled`/`chat/error` carry an elapsed `duration` (milliseconds, producer's own clock), and completed turns expose their start time and duration. - Asynchronous tool-call risk assessments with a model-provided explanation and normalized safety score. - `ToolCallStatus.AuthRequired` tool call state and `chat/toolCallAuthRequired` / `chat/toolCallAuthResolved` actions so a running MCP-contributed tool call can pause mid-execution on an OAuth challenge (`McpAuthRequirement`) and resume once the client authenticates; surfaced at the session level via a new `toolAuthentication` `SessionInputRequest` variant, and `AuthenticateParams` gained an optional `scopes` field and now accepts resources discovered from a live `McpServerAuthRequiredState` or `ToolCallAuthRequiredState` in addition to `AgentInfo.protectedResources`. `chat/toolCallComplete` now also accepts a failed result while a tool call is `auth-required`, letting a client cancel that invocation without completing the authentication challenge. - `McpAuthRequirement.oauthClient` metadata for pre-registered public and confidential OAuth clients. - `AHPClient.ping()` for protocol-level connection liveness and an `AHPCommands.ping(id:)` request factory, mirroring the TypeScript client's `AhpClient.ping()`. -- `AHPCommands.createTerminal(id:params:)` and `AHPCommands.disposeTerminal(id:params:)` request factories, so the generated `CreateTerminalParams` / `DisposeTerminalParams` are reachable through the typed command surface for parity with `createSession` / `disposeSession`. (#341) +- `AHPCommands.createTerminal(id:params:)` and `AHPCommands.disposeTerminal(id:params:)` request factories, so the generated `CreateTerminalParams` / `DisposeTerminalParams` are reachable through the typed command surface for parity with `createSession` / `disposeSession`. ([#341](https://github.com/microsoft/agent-host-protocol/issues/341)) ### Changed -- Renamed the changeset review action `changeset/filesReviewedChanged` to `changeset/filesReviewChanged` (field `fileIds` → `files`) and made it client-dispatchable, so a reviewer can toggle a file's `reviewed` flag directly through the write-ahead reducer. (#328) -- Input requests now live in turn `responseParts`, with an optional `response` until `chat/inputCompleted` submits the result. (#327) +- Renamed the changeset review action `changeset/filesReviewedChanged` to `changeset/filesReviewChanged` (field `fileIds` → `files`) and made it client-dispatchable, so a reviewer can toggle a file's `reviewed` flag directly through the write-ahead reducer. ([#328](https://github.com/microsoft/agent-host-protocol/issues/328)) +- Input requests now live in turn `responseParts`, with an optional `response` until `chat/inputCompleted` submits the result. ([#327](https://github.com/microsoft/agent-host-protocol/issues/327)) ## [0.5.2] — 2026-07-09 @@ -241,7 +307,7 @@ Implements AHP 0.5.2. `responseParts` on `chatInputCompleted` — embedding the resolved `ChatInputRequest` (final `answers`) and the `response` (`accept`, `decline`, or `cancel`) — so the outcome persists after the live request is removed. - Abandoned requests still record nothing (#324). + Abandoned requests still record nothing ([#324](https://github.com/microsoft/agent-host-protocol/issues/324)). ### Changed diff --git a/clients/typescript/CHANGELOG.md b/clients/typescript/CHANGELOG.md index 98b720ca7..c40340128 100644 --- a/clients/typescript/CHANGELOG.md +++ b/clients/typescript/CHANGELOG.md @@ -26,43 +26,109 @@ Implements AHP 1.1.0. ### Added -- Optional typed `InitializeResult.environment.pathStyle` metadata for authoritative host path semantics. -- Optional `CreateChatParams.title` for a client-selected initial display title. -- Optional `SessionModelInfo.vendor` for the model vendor as the provider reports it. (#503) -- Experimental subscription-negotiated flow-control types using UTF-16 byte accounting, framed delivery and consumption credit notifications, and independent `reconnect.windows` metadata. (#492) -- `EmptyState` variant of `Snapshot.state` for channels whose state has no fields, such as telemetry. Every experimental windowed subscription starts with `channel/snapshot`. -- Experimental TCP channel: `createTcpConnection` opens a TCP connection on the host's network and returns an empty `CreateTcpConnectionResult`. The client forwards it over a windowed subscription with `tcp/data`, `tcp/eof`, and `tcp/reset`. TCP channels do not survive the loss of the AHP connection. (#488) -- Each client exposes the notification methods that do not count against the window on a windowed subscription (`WINDOW_EXEMPT_METHODS` and `countsAgainstWindow` in TypeScript, with equivalents in the other clients), generated from the new `@windowExempt` annotation. -- `ChatState.config`, the `chat/configChanged` action, and `chatMutable` on session config properties give each chat its own config for selected settings, such as tool auto-approval, so changing them in one chat no longer changes every chat in the session. `ChatConfigState.values` holds the chat's `chatMutable` properties and does not inherit from the session; missing keys take the schema default. Optional `ChatConfigState.schema` replaces the session's schema for a chat whose agent differs from the session's. -- Optional per-chat agent provider: `CreateChatParams.provider` and `ChatSummary.provider` (mirrored on `ChatState` and `SessionChatSummary`), gated by the host-level `InitializeResult.multipleChatProviders` capability, let one session contain chats backed by different agent providers. Absent `provider` means the session's agent provider; forks and side chats keep their source chat's agent provider. -- Optional `ChangesetFile.status`, a bitset of `ChangesetFileStatus` flags (initially `Editing`), reports per-file activity through existing changeset snapshots and actions without requiring provider-specific metadata. (#538) -- Optional changeset file and operation-target nonces let hosts reject operations on superseded changes without requiring a capability or a nonce from every client. (#538) -- Adds `chat/moved`, dispatched on a chat's channel after a cross-session move with its new session, `provider` and `config.schema`. -- Optional producer-recorded `startedAt` and `duration` fields on reasoning response parts and `chat/reasoning` updates preserve each contiguous reasoning run's timing across state snapshots and history restoration. -- Optional `ToolCallResult.resultMetadata` carries MCP `CallToolResult._meta` separately from host/provider tool-call metadata and is preserved through result confirmation. -- Optional `ResourceReadParams.position` and `ResourceReadParams.length` request a byte range from `resourceRead`, and optional `ResourceReadResult.size` reports the total size of the resource when the receiver honored the range. A result without `size` is the whole resource, and a ranged `utf-8` result does not split a UTF-8 sequence. (#554) -- `resourceRead` guidance: a peer SHOULD serve reads of the URIs it publishes as content, including HTTP(S) URLs that the other peer might not be able to reach. -- Optional `McpServerCustomization.children` for MCP-served skills (SEP-2640), toggleable by id with `session/customizationToggled`. -- Optional `authenticate.accountId` carries an opaque client-local account-selection hint without changing token validation or legacy authentication. +- Add optional `InitializeResult.environment.pathStyle` (`posix` or `windows`) so clients can parse and format host paths using the host's native path grammar instead of guessing locally. +- Add optional `CreateChatParams.title` so clients can choose an initial display title when creating a chat. +- Add optional `SessionModelInfo.vendor` so clients can display the model vendor reported by the provider separately from the owning agent provider. ([#503](https://github.com/microsoft/agent-host-protocol/issues/503)) +- Add experimental windowed delivery for subscriptions so fast producers do not overwhelm slow clients: peers negotiate soft `windowBytes` and hard `maxFrameBytes` limits using UTF-16 JSON-RPC message sizes, split large messages with `channel/frame`, return cumulative credit with `channel/credit`, renegotiate fresh zero-based windows in `reconnect.windows`, and expose generated `@windowExempt` helpers (`WINDOW_EXEMPT_METHODS` and `countsAgainstWindow`) for control notifications that do not count against the window. ([#492](https://github.com/microsoft/agent-host-protocol/issues/492)) + ```ts + // Offer windowed delivery on subscribe + await client.request('subscribe', { + channel: 'ahp-terminal:/t1', + flowControl: { receive: { windowBytes: 262144, maxFrameBytes: 16384 } }, + }); + // Return cumulative UTF-16 byte credit after processing incoming data + client.notify('channel/credit', { channel: 'ahp-terminal:/t1', consumedBytes }); + ``` + Read more in [Windowed Delivery](https://microsoft.github.io/agent-host-protocol/specification/windowed-delivery). +- Add `EmptyState` (`{}`) to `Snapshot.state` for channels with no state fields, such as telemetry and TCP channels. Windowed subscriptions always start with `channel/snapshot`, whereas ordinary subscriptions may send or omit an `EmptyState` snapshot; clients must accept both and ignore unrecognized snapshot shapes. + Read more in [Channels and Subscriptions](https://microsoft.github.io/agent-host-protocol/specification/subscriptions). +- Add an experimental TCP channel (`createTcpConnection`, `tcp/data`, `tcp/eof`, and `tcp/reset`, gated by `InitializeResult.tcpConnections`) so clients can forward TCP connections opened on the host's network over a windowed subscription; connections close if the AHP transport drops. ([#488](https://github.com/microsoft/agent-host-protocol/issues/488)) + ```ts + const channel = 'ahp-tcp:/t1'; + await client.request('createTcpConnection', { channel, host: 'localhost', port: 3000 }); + await client.request('subscribe', { + channel, + flowControl: { receive: { windowBytes: 262144, maxFrameBytes: 16384 } }, + }); + client.notify('tcp/data', { channel, data: base64Bytes }); + ``` + Read more in [TCP Channel](https://microsoft.github.io/agent-host-protocol/specification/tcp-channel). +- Add per-chat configuration (`ChatState.config`, `chat/configChanged`, and `SessionConfigPropertySchema.chatMutable`) so settings like tool auto-approval can be changed for one chat without affecting sibling chats; `ChatConfigState.values` does not inherit from the session (missing keys use the schema default), and optional `ChatConfigState.schema` overrides the session schema when a chat uses a different agent provider. + ```ts + client.notify('dispatchAction', { + channel: chatUri, + clientSeq: 1, + action: { type: 'chat/configChanged', config: { autoApprove: true } }, + }); + ``` + Read more in [Chat Channel — Per-chat configuration](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#per-chat-configuration). +- Add per-chat agent providers (`CreateChatParams.provider` and `provider` on `ChatSummary`, `ChatState`, and `SessionChatSummary`, gated by `InitializeResult.multipleChatProviders`) so a single session can mix chats backed by different agent providers; omitting `provider` uses the session's provider, and forks and side chats keep their source chat's provider. + ```ts + await client.request('createChat', { + channel: sessionUri, + chat: 'ahp-chat:/', + provider: 'claude', + }); + ``` + Read more in [Chat Channel — Chat providers](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#chat-providers). +- Add optional `ChangesetFile.status` (a bitset of `ChangesetFileStatus` flags, starting with `Editing`) so hosts can report ongoing per-file edits in changeset snapshots and actions without provider-specific metadata. ([#538](https://github.com/microsoft/agent-host-protocol/issues/538)) + Read more in [Changesets — Per-file Editing Activity](https://microsoft.github.io/agent-host-protocol/guide/changesets#per-file-editing-activity). +- Add optional optimistic-concurrency nonces (`ChangesetFile.nonce` and `ChangesetOperationTarget.nonce`) so hosts can reject `invokeChangesetOperation` calls targeting superseded file edits with `Conflict` without requiring a capability or breaking clients that omit nonces. ([#538](https://github.com/microsoft/agent-host-protocol/issues/538)) +- Add the `chat/moved` action, dispatched on a chat's channel after a cross-session `moveChat` to notify subscribers of its new `session` URI and updated relative `provider` and `config.schema`. + Read more in [Chat Channel — Moving chats](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#moving-chats). +- Add optional producer-recorded `startedAt` and `duration` fields to `ReasoningResponsePart` and `chat/reasoning` actions so each contiguous reasoning run's timing is preserved across snapshots, reconnects, and history restoration. + Read more in [Chat Channel — Reasoning timing](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#reasoning-timing). +- Add optional `ToolCallResult.resultMetadata` to carry MCP `CallToolResult._meta` separately from host/provider tool-call metadata and preserve it through result confirmation. +- Add optional byte-range parameters (`position` and `length`) to `resourceRead` and a total-size indicator (`ResourceReadResult.size`) so callers can read slices of large resources without splitting UTF-8 sequences; a response without `size` contains the whole resource. ([#554](https://github.com/microsoft/agent-host-protocol/issues/554)) + ```ts + const slice = await client.request('resourceRead', { + channel: 'ahp-root://', + uri: 'file:///workspace/logo.png', + position: 0, + length: 16, + }); + // slice.size is present iff the receiver honored the byte range + ``` +- Document that peers should serve `resourceRead` requests for URIs they publish as content, including HTTP(S) URLs that the other peer cannot reach directly (such as a loopback dev server). +- Add optional `McpServerCustomization.children` to surface MCP-served skills (SEP-2640) inside MCP server customizations, toggleable by ID via `session/customizationToggled`. + Read more in [Customizations](https://microsoft.github.io/agent-host-protocol/guide/customizations). +- Add optional `AuthenticateParams.accountId` to carry an opaque client-local account hint alongside tokens so hosts can detect account switches without changing token validation. + Read more in [Authentication — Account selection hints](https://microsoft.github.io/agent-host-protocol/specification/authentication#account-selection-hints). ### Changed -- Experimental windowed subscriptions count every data notification against the window, whether sent whole or in `channel/frame` notifications. Frames carry messages larger than `maxFrameBytes` and let subscriptions share the connection. -- `Snapshot.state` can be an `EmptyState` (`{}`) for channels whose state has no fields, such as telemetry. With ordinary delivery, a server may send such a snapshot or omit it, so clients must accept both. Clients must not fail on a snapshot state that they do not recognize. -- Experimental windowed delivery removes `maximumMessageBytes` and uses one size for everything: the UTF-16 size of each JSON-RPC data message as sent, including `channel/frame` envelopes. Each message and frame counts against `windowBytes`, which is a soft target; `maxFrameBytes` remains a hard limit on each message, and receivers can return credit for stored frames. -- Store steering and queued input in one `queuedMessages` list with optional `PendingMessage.kind` (absent means queued), using the existing per-ID pending actions. New IDs append, kind changes replace in place, and UIs group steering first without changing raw order. Mirror the latest steering update in the deprecated `steeringMessage` slot for older clients. -- Experimental windowed subscriptions no longer carry byte counters across `reconnect`. Their counters start at zero on the new connection, and each `reconnect.windows` item offers new limits in `flowControl`, which the result accepts as in `subscribe`. Removes `ChannelReceiveProgress` and the `clientReceive`/`hostReceive` counters from reconnect. -- Remove the User-only restriction on client-submitted messages in `chat/turnStarted` and `chat/pendingMessageSet`. (#542) -- Experimental `CanvasState.url` is renamed to `CanvasState.uri` and holds an absolute content URI, typically HTTP(S). A client that can't load it directly reads it, and the relative references in its content, with `resourceRead`. -- Annotations channels use `ahp-annotations:/` with the owning session's id; clients should use `AnnotationsSummary.resource` rather than derive the URI. +- Unify steering and queued input in `ChatState.queuedMessages` with an optional `PendingMessage.kind` (`steering` or `queued`, defaulting to `queued`) using existing per-ID pending actions; new IDs append, kind changes replace in place, UIs group steering first without mutating raw order, and the latest steering entry is mirrored to the deprecated `steeringMessage` slot for older clients. + ```ts + client.notify('dispatchAction', { + channel: chatUri, + clientSeq: 1, + action: { type: 'chat/pendingMessageSet', kind: 'steering', id: 'p1', message }, + }); + ``` +- Allow non-`user` message origins (such as `automation` or `systemNotification`) in client-submitted `chat/turnStarted` and `chat/pendingMessageSet` actions. ([#542](https://github.com/microsoft/agent-host-protocol/issues/542)) +- Rename experimental `CanvasState.url` to `CanvasState.uri` to hold an absolute content URI (typically HTTP(S)); clients that cannot load the URI directly can fetch it and its relative references via `resourceRead`. +- Standardize annotations channel URIs on `ahp-annotations:/` using the owning session's ID; clients should read `AnnotationsSummary.resource` rather than constructing the URI manually. ### Fixed -- State mirrors leave confirmed state unchanged when an action envelope carries a rejection reason. (#586) +- Fix state mirrors to leave confirmed state unchanged when an incoming action envelope carries a `rejectionReason`. ([#586](https://github.com/microsoft/agent-host-protocol/issues/586)) ### Security -- Add an optional `authenticate.target` identifying an MCP server by session URI and customization ID, preventing tokens from reaching other consumers that share a protected resource and scopes. +- Add optional `AuthenticateParams.target` to bind a pushed OAuth token to a specific MCP server by session URI and customization ID, preventing credentials from leaking to other consumers that share a protected resource and scopes. + ```ts + await client.request('authenticate', { + channel: 'ahp-root://', + resource: 'https://mcp.example.com', + token: accessToken, + target: { + kind: 'mcpServer', + session: sessionUri, + customizationId: 'mcp-server-1', + }, + }); + ``` + Read more in [Authentication — Token Delivery](https://microsoft.github.io/agent-host-protocol/specification/authentication#token-delivery). ## [1.0.0] — 2026-10-02 @@ -77,7 +143,7 @@ Implements AHP 1.0.0. - `ChatState.changesets` and `chat/changesetsChanged` expose each chat's changeset catalogue through the subscribed chat channel. - `AutomationDefinition.disableConditions` supports `afterRuns` (`max`) and `afterDate` (`date`) rules combined with logical OR, with at most one condition per kind. Host-owned `AutomationEntry.runCount` tracks the current scheduled-run allowance. Edit conditions through `automation/updateRequested`: omission leaves them unchanged, an array replaces them, and `[]` removes all conditions without re-enabling the automation. - `ChangesetStatus.Recomputing` distinguishes refreshes of a completed result from initial changeset computation. -- `ConfigPropertySchema.minItems` and `ConfigPropertySchema.maxItems` express array cardinality for `type: "array"` config properties. (#432) +- `ConfigPropertySchema.minItems` and `ConfigPropertySchema.maxItems` express array cardinality for `type: "array"` config properties. ([#432](https://github.com/microsoft/agent-host-protocol/issues/432)) - `McpServerStartingState.blocking` flag indicating that message processing may be held on the server, and the client-dispatchable `session/mcpServerBackgroundRequested` action asking the host to background such a startup. - `AutomationSessionTemplate.customizations` lets automations carry client plugins (skills, agents, prompts, rules) that the host captures when the definition is saved, with the host-owned copies reported in `AutomationEntry.customizations` and support advertised by `AutomationCapabilities.customizations`. - Hosts can advertise chat-owned canvas channel references and synchronize live presentation metadata and source URLs on experimental per-canvas channels. @@ -132,8 +198,8 @@ Implements AHP 0.8.0. - Optional `_meta` request metadata on all command parameters. - `ClientPluginCustomization` can publish child enablement decisions. -- Reserve the `x-` prefix for implementation-defined channel URI schemes, commands, notifications, and actions. (#367) -- `session/workingDirectoryReplaced` atomically replaces a working-directory entry, including a replaceable primary. (#392) +- Reserve the `x-` prefix for implementation-defined channel URI schemes, commands, notifications, and actions. ([#367](https://github.com/microsoft/agent-host-protocol/issues/367)) +- `session/workingDirectoryReplaced` atomically replaces a working-directory entry, including a replaceable primary. ([#392](https://github.com/microsoft/agent-host-protocol/issues/392)) ### Changed @@ -154,10 +220,10 @@ Implements AHP 0.7.0. ### Added - Capability-gated side chats can start from a chat turn and return bounded chat transcripts as message attachments. -- Multiroot session support: `AgentCapabilities.multipleWorkingDirectories` capability (with `immutablePrimary`, which pins `workingDirectories[0]` as a fixed primary root that clients MUST NOT remove or reorder), `CreateSessionParams.workingDirectories` and `SessionMetadata.workingDirectories` (equal-peer set, mirrored onto `SessionState`/`SessionSummary`), `CreateChatParams.workingDirectories` and `ChatState`/`ChatSummary.workingDirectories` (a subset of the session's set), and the client-dispatchable `session/workingDirectorySet` / `session/workingDirectoryRemoved` and `chat/workingDirectorySet` / `chat/workingDirectoryRemoved` actions for mutating those sets. (#337) -- `AhpClient.completions()` and `AhpClient.sessionConfigCompletions()` typed wrappers for the `completions` / `sessionConfigCompletions` commands, matching the existing `resource*` convenience methods. (#340) -- `result` on `ToolResultTerminalContent` (`exitCode`, `preview`, `truncated`), present once the command exits. (#323) -- Optional `isPty` metadata on `ToolResultTerminalContent` and `TerminalState` indicating whether a terminal resource is PTY-backed. (#322) +- Multiroot session support: `AgentCapabilities.multipleWorkingDirectories` capability (with `immutablePrimary`, which pins `workingDirectories[0]` as a fixed primary root that clients MUST NOT remove or reorder), `CreateSessionParams.workingDirectories` and `SessionMetadata.workingDirectories` (equal-peer set, mirrored onto `SessionState`/`SessionSummary`), `CreateChatParams.workingDirectories` and `ChatState`/`ChatSummary.workingDirectories` (a subset of the session's set), and the client-dispatchable `session/workingDirectorySet` / `session/workingDirectoryRemoved` and `chat/workingDirectorySet` / `chat/workingDirectoryRemoved` actions for mutating those sets. ([#337](https://github.com/microsoft/agent-host-protocol/issues/337)) +- `AhpClient.completions()` and `AhpClient.sessionConfigCompletions()` typed wrappers for the `completions` / `sessionConfigCompletions` commands, matching the existing `resource*` convenience methods. ([#340](https://github.com/microsoft/agent-host-protocol/issues/340)) +- `result` on `ToolResultTerminalContent` (`exitCode`, `preview`, `truncated`), present once the command exits. ([#323](https://github.com/microsoft/agent-host-protocol/issues/323)) +- Optional `isPty` metadata on `ToolResultTerminalContent` and `TerminalState` indicating whether a terminal resource is PTY-backed. ([#322](https://github.com/microsoft/agent-host-protocol/issues/322)) - Side-chat sources and origins can now carry an immutable selected-text snapshot with optional response-part provenance. ### Changed @@ -169,8 +235,8 @@ Implements AHP 0.7.0. ### Removed -- `ToolResultTerminalCompleteContent`; command completion data now lives on `ToolResultTerminalContent`. (#322, #323) -- Non-standard `resource_encryption_alg_values_supported` and `resource_encryption_enc_values_supported` fields from `ProtectedResourceMetadata`. (#368) +- `ToolResultTerminalCompleteContent`; command completion data now lives on `ToolResultTerminalContent`. ([#322](https://github.com/microsoft/agent-host-protocol/issues/322), [#323](https://github.com/microsoft/agent-host-protocol/issues/323)) +- Non-standard `resource_encryption_alg_values_supported` and `resource_encryption_enc_values_supported` fields from `ProtectedResourceMetadata`. ([#368](https://github.com/microsoft/agent-host-protocol/issues/368)) ### Fixed @@ -183,8 +249,8 @@ Implements AHP 0.6.0. ### Added -- `Changeset.capabilities` with a `review` presence flag (`ChangesetCapabilities`) so a changeset can advertise support for the per-file review workflow up-front on the session's changeset list. (#328) -- 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`. (#308) +- `Changeset.capabilities` with a `review` presence flag (`ChangesetCapabilities`) so a changeset can advertise support for the per-file review workflow up-front on the session's changeset list. ([#328](https://github.com/microsoft/agent-host-protocol/issues/328)) +- 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`. ([#308](https://github.com/microsoft/agent-host-protocol/issues/308)) - `chat/turnStarted` carries a `startedAt` timestamp, `chat/turnComplete`/`chat/turnCancelled`/`chat/error` carry an elapsed `duration` (milliseconds, producer's own clock), and completed turns expose their start time and duration. - Asynchronous tool-call risk assessments with a model-provided explanation and normalized safety score. - `ToolCallStatus.AuthRequired` tool call state and `chat/toolCallAuthRequired` / `chat/toolCallAuthResolved` actions so a running MCP-contributed tool call can pause mid-execution on an OAuth challenge (`McpAuthRequirement`) and resume once the client authenticates; surfaced at the session level via a new `toolAuthentication` `SessionInputRequest` variant, and `AuthenticateParams` gained an optional `scopes` field and now accepts resources discovered from a live `McpServerAuthRequiredState` or `ToolCallAuthRequiredState` in addition to `AgentInfo.protectedResources`. `chat/toolCallComplete` now also accepts a failed result while a tool call is `auth-required`, letting a client cancel that invocation without completing the authentication challenge. @@ -192,8 +258,8 @@ Implements AHP 0.6.0. ### Changed -- Renamed the changeset review action `changeset/filesReviewedChanged` to `changeset/filesReviewChanged` (field `fileIds` → `files`) and made it client-dispatchable, so a reviewer can toggle a file's `reviewed` flag directly through the write-ahead reducer. (#328) -- Input requests now live in turn `responseParts`, with an optional `response` until `chat/inputCompleted` submits the result. (#327) +- Renamed the changeset review action `changeset/filesReviewedChanged` to `changeset/filesReviewChanged` (field `fileIds` → `files`) and made it client-dispatchable, so a reviewer can toggle a file's `reviewed` flag directly through the write-ahead reducer. ([#328](https://github.com/microsoft/agent-host-protocol/issues/328)) +- Input requests now live in turn `responseParts`, with an optional `response` until `chat/inputCompleted` submits the result. ([#327](https://github.com/microsoft/agent-host-protocol/issues/327)) ## [0.5.2] — 2026-07-09 @@ -237,7 +303,7 @@ Implements AHP 0.5.2. `responseParts` on `chat/inputCompleted` — embedding the resolved `ChatInputRequest` (final `answers`) and the `response` (`accept`, `decline`, or `cancel`) — so the outcome persists after the live request is removed. - Abandoned requests still record nothing (#324). + Abandoned requests still record nothing ([#324](https://github.com/microsoft/agent-host-protocol/issues/324)). ### Changed diff --git a/docs/.changes/20261022-go-capability-presence.json b/docs/.changes/20261022-go-capability-presence.json index eb8e0fa57..b9c6134cc 100644 --- a/docs/.changes/20261022-go-capability-presence.json +++ b/docs/.changes/20261022-go-capability-presence.json @@ -1,5 +1,5 @@ { "type": "fixed", - "message": "Go preserves empty-object capability opt-ins on the wire; generated optional capability flags now use pointer-to-map fields instead of dropping `{}` through `omitempty`.", + "message": "Fix Go serialization of empty-object capability opt-ins by generating pointer-to-map fields so `{}` is preserved on the wire instead of being dropped by `omitempty`.", "targets": ["go"] } diff --git a/docs/.changes/20261022-model-source-selection.json b/docs/.changes/20261022-model-source-selection.json index 1af988cb1..e12312f29 100644 --- a/docs/.changes/20261022-model-source-selection.json +++ b/docs/.changes/20261022-model-source-selection.json @@ -1,4 +1,16 @@ { "type": "added", - "message": "`ModelSourceInfo`, `AgentInfo.modelSources`, and `SessionModelInfo.modelSourceId` let an agent label and group its models by source. Model IDs are unique within an agent and stable across catalog updates." + "message": "Add model source metadata (`ModelSourceInfo`, `AgentInfo.modelSources`, and `SessionModelInfo.modelSourceId`) so clients can label and group models by service or subscription while keeping model IDs unique and stable per agent.", + "details": [ + "```json", + "{", + " \"provider\": \"example\",", + " \"modelSources\": [{ \"id\": \"source-a\", \"displayName\": \"Service A\" }],", + " \"models\": [", + " { \"id\": \"model-a\", \"provider\": \"example\", \"name\": \"Model\", \"modelSourceId\": \"source-a\" }", + " ]", + "}", + "```", + "Read more in [Root Channel — Model sources](https://microsoft.github.io/agent-host-protocol/specification/root-channel#model-sources)." + ] } diff --git a/docs/.changes/20261113-automation-run-target.json b/docs/.changes/20261113-automation-run-target.json index 236708261..58af61dd5 100644 --- a/docs/.changes/20261113-automation-run-target.json +++ b/docs/.changes/20261113-automation-run-target.json @@ -1,5 +1,19 @@ { "type": "added", - "message": "`AutomationDefinition.target` and `AutomationCapabilities.targets`. With `previousSession`, each automation run continues the previous run's session instead of creating one; with `chat`, each run sends its message to one existing chat.", + "message": "Add automation run targets (`AutomationDefinition.target`, gated by `AutomationCapabilities.targets`) so runs can continue the previous run's session (`previousSession`) or queue messages into an existing chat (`chat`) instead of always creating a new session.", + "details": [ + "```ts", + "// Continue the previous run's session (creates one if none is usable)", + "const recurringTarget = { kind: 'previousSession' } as const;", + "", + "// Or deliver every run's message to one existing chat", + "const chatTarget = {", + " kind: 'chat',", + " session: 'ahp-session:/',", + " chat: 'ahp-chat:/',", + "} as const;", + "```", + "Read more in [Automations — Run targets](https://microsoft.github.io/agent-host-protocol/guide/automations#run-targets)." + ], "issues": [572] } diff --git a/docs/.changes/20261113-one-time-automation-triggers.json b/docs/.changes/20261113-one-time-automation-triggers.json index 1c3839b21..c26d28aeb 100644 --- a/docs/.changes/20261113-one-time-automation-triggers.json +++ b/docs/.changes/20261113-one-time-automation-triggers.json @@ -1,4 +1,15 @@ { "type": "added", - "message": "One-time automation triggers, advertised by `AutomationCapabilities.oneTime`." + "message": "Add one-time automation triggers (`AutomationOneTimeTrigger`, advertised by `AutomationCapabilities.oneTime`) to schedule a single run at a fixed ISO 8601 timestamp.", + "details": [ + "```ts", + "const trigger: AutomationOneTimeTrigger = {", + " id: 'release-check',", + " kind: 'oneTime',", + " runAt: '2026-12-01T15:00:00Z',", + " misfirePolicy: 'runOnce',", + "};", + "```", + "Read more in [Automations — One-time triggers](https://microsoft.github.io/agent-host-protocol/guide/automations#one-time-triggers)." + ] } diff --git a/docs/.changes/20261123-directory-entry-is-symlink.json b/docs/.changes/20261123-directory-entry-is-symlink.json index aa2fb6c03..897ed761f 100644 --- a/docs/.changes/20261123-directory-entry-is-symlink.json +++ b/docs/.changes/20261123-directory-entry-is-symlink.json @@ -1,5 +1,5 @@ { "type": "added", - "message": "Optional `isSymlink` boolean flag on `DirectoryEntry` in `resourceList` results.", + "message": "Add an optional `DirectoryEntry.isSymlink` flag to `resourceList` results so clients can identify symbolic links without resolving every entry individually.", "issues": [624] } diff --git a/docs/.changes/20261124-completion-range-integers.json b/docs/.changes/20261124-completion-range-integers.json index 1d568e938..8d8da2790 100644 --- a/docs/.changes/20261124-completion-range-integers.json +++ b/docs/.changes/20261124-completion-range-integers.json @@ -1,5 +1,5 @@ { "type": "changed", - "message": "`CompletionItem.rangeStart` and `rangeEnd` are now typed as integers in the JSON Schema, with minimums of 0 and 1.", + "message": "Update the JSON Schema for `CompletionItem.rangeStart` and `rangeEnd` to require integers with minimums of `0` and `1`.", "targets": ["spec"] } diff --git a/docs/.changes/20261124-deferred-turns.json b/docs/.changes/20261124-deferred-turns.json index 27809ec1e..dc4c6f60c 100644 --- a/docs/.changes/20261124-deferred-turns.json +++ b/docs/.changes/20261124-deferred-turns.json @@ -1,4 +1,23 @@ { "type": "added", - "message": "Deferred turns: clients that declare `ClientCapabilities.deferredTurns` may receive `DeferredTurn` entries (`isDeferred: true`, no `responseParts`) in `ChatState.turns`, and can expand a range of them with the `fetchDeferredTurns` command and `chat/turnsMaterialized` action." + "message": "Add deferred turns (`ClientCapabilities.deferredTurns`, `DeferredTurn`, `fetchDeferredTurns`, and `chat/turnsMaterialized`) so clients can render full chat histories without downloading every response up front and expand turn ranges on demand.", + "details": [ + "```ts", + "// 1. Opt in during initialize", + "await client.request('initialize', {", + " channel: 'ahp-root://',", + " protocolVersions: ['1.2.0'],", + " clientId,", + " capabilities: { deferredTurns: {} },", + "});", + "", + "// 2. Materialize a range of deferred turns in place (emits chat/turnsMaterialized)", + "await client.request('fetchDeferredTurns', {", + " channel: chatUri,", + " turnId: 't45',", + " endTurnId: 't49',", + "});", + "```", + "Read more in [Chat Channel — Deferred turns](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#deferred-turns)." + ] } diff --git a/docs/.changes/20261124-deprecate-turn-paging.json b/docs/.changes/20261124-deprecate-turn-paging.json index e43396f8e..93bbf6951 100644 --- a/docs/.changes/20261124-deprecate-turn-paging.json +++ b/docs/.changes/20261124-deprecate-turn-paging.json @@ -1,4 +1,5 @@ { "type": "deprecated", - "message": "Tail-window turn paging (`SubscribeView.turns`, `ChatState.turnsNextCursor`, `fetchTurns`, and `chat/turnsLoaded`) is now Legacy (stability 3) in favour of deferred turns. It remains supported for 1.x clients that do not declare `deferredTurns`." + "message": "Deprecate tail-window turn paging (`SubscribeView.turns`, `ChatState.turnsNextCursor`, `fetchTurns`, and `chat/turnsLoaded`, now stability 3 / Legacy) in favour of deferred turns; it remains supported for 1.x clients that do not declare `deferredTurns`.", + "details": "Read more in [Chat Channel — Legacy tail-window paging](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#legacy-tail-window-paging)." } diff --git a/docs/.changes/20261124-search-channel.json b/docs/.changes/20261124-search-channel.json index b7ed14908..d7be4dab2 100644 --- a/docs/.changes/20261124-search-channel.json +++ b/docs/.changes/20261124-search-channel.json @@ -1,4 +1,27 @@ { "type": "added", - "message": "Experimental `ahp-search:` channel: `createSearch` searches file names, file text, sessions, and chat messages and streams scored, highlighted results into `SearchState`. Clients change the query with `search/queryChanged` (results stay visible while the lifecycle is `pending`) and cancel by unsubscribing; hosts append or replace results with `search/resultsChanged` and report progress with `search/lifecycleChanged`." + "message": "Add an experimental `ahp-search:` channel (`createSearch`, `SearchState`, `search/queryChanged`, `search/resultsChanged`, and `search/lifecycleChanged`, gated by `InitializeResult.search`) so hosts can stream scored, highlighted matches across file names, file text, sessions, and chat messages.", + "details": [ + "```ts", + "const channel = 'ahp-search:/q1';", + "await client.request('createSearch', {", + " channel,", + " query: {", + " text: 'parseConfig',", + " targets: [", + " { kind: 'fileText', roots: ['file:///workspace'] },", + " { kind: 'sessions' },", + " ],", + " },", + "});", + "await client.request('subscribe', { channel });", + "// Refine the query in place (previous results stay visible while lifecycle is 'pending')", + "client.notify('dispatchAction', {", + " channel,", + " clientSeq: 1,", + " action: { type: 'search/queryChanged', query: nextQuery },", + "});", + "```", + "Read more in [Search Channel](https://microsoft.github.io/agent-host-protocol/specification/search-channel)." + ] } diff --git a/docs/.changes/20261124-turn-union-rename.json b/docs/.changes/20261124-turn-union-rename.json index 441994e07..f413abba8 100644 --- a/docs/.changes/20261124-turn-union-rename.json +++ b/docs/.changes/20261124-turn-union-rename.json @@ -1,4 +1,14 @@ { "type": "changed", - "message": "**Breaking (SDK source):** the full completed-turn type is renamed `Turn` → `MaterializedTurn`, and `Turn` is now the union `MaterializedTurn | DeferredTurn` used by `ChatState.turns` and `chat/turnsLoaded`. Code that reads `responseParts` must narrow to `MaterializedTurn` first. The wire format is unchanged for clients that don't declare `deferredTurns`." + "message": "Rename the full completed-turn type from `Turn` to `MaterializedTurn` (breaking SDK source change) and make `Turn` the union `MaterializedTurn | DeferredTurn` so consumers explicitly narrow before reading `responseParts`; the wire format is unchanged for clients that do not declare `deferredTurns`.", + "details": [ + "```ts", + "for (const turn of chatState.turns) {", + " if (turn.isDeferred) continue;", + " // Narrowed to MaterializedTurn — safe to read turn.responseParts", + " renderParts(turn.responseParts);", + "}", + "```", + "Read more in [Chat Channel — Deferred turns](https://microsoft.github.io/agent-host-protocol/specification/chat-channel#deferred-turns)." + ] } diff --git a/scripts/change-fragments.test.ts b/scripts/change-fragments.test.ts index d6696a3c6..567838dfe 100644 --- a/scripts/change-fragments.test.ts +++ b/scripts/change-fragments.test.ts @@ -3,8 +3,10 @@ import { strict as assert } from 'node:assert'; import { applyReleaseToChangelog, + findUnlinkedIssueReferences, parseChangeFragment, renderChangeSections, + REPO_ISSUES_URL, type ChangeFragment, } from './change-fragments.js'; @@ -48,6 +50,7 @@ describe('change fragments', () => { filePath: 'docs/.changes/all.json', type: 'added', message: 'Shared entry.', + details: [], targets: ['spec', 'rust', 'kotlin', 'typescript', 'swift', 'go', 'dotnet'], issues: [123], }, @@ -55,6 +58,7 @@ describe('change fragments', () => { filePath: 'docs/.changes/rust.json', type: 'fixed', message: 'Rust-only fix.', + details: [], targets: ['rust'], issues: [], }, @@ -63,7 +67,7 @@ describe('change fragments', () => { assert.deepEqual(renderChangeSections(fragments, 'rust'), [ '### Added', '', - '- Shared entry. (#123)', + `- Shared entry. ([#123](${REPO_ISSUES_URL}/123))`, '', '### Fixed', '', @@ -72,10 +76,156 @@ describe('change fragments', () => { assert.deepEqual(renderChangeSections(fragments, 'typescript'), [ '### Added', '', - '- Shared entry. (#123)', + `- Shared entry. ([#123](${REPO_ISSUES_URL}/123))`, ]); }); + it('parses and indents multi-line details from arrays or strings', () => { + const arrayResult = parseChangeFragment( + 'docs/.changes/rich.json', + JSON.stringify({ + type: 'added', + message: 'Add experimental flow-control with byte accounting and framed delivery.', + details: [ + '```ts', + 'const sub = await client.subscribe({ resource, flowControl: { windowBytes: 65536 } });', + '', + '// comments with # inside code blocks are fine', + '```', + 'Read more in [Windowed Delivery](https://microsoft.github.io/agent-host-protocol/specification/windowed-delivery).', + ], + issues: [492], + }), + ); + + assert.deepEqual(arrayResult.errors, []); + assert.ok(arrayResult.fragment); + assert.deepEqual(renderChangeSections([arrayResult.fragment], 'spec'), [ + '### Added', + '', + `- Add experimental flow-control with byte accounting and framed delivery. ([#492](${REPO_ISSUES_URL}/492))`, + ' ```ts', + ' const sub = await client.subscribe({ resource, flowControl: { windowBytes: 65536 } });', + '', + ' // comments with # inside code blocks are fine', + ' ```', + ' Read more in [Windowed Delivery](https://microsoft.github.io/agent-host-protocol/specification/windowed-delivery).', + ]); + + const stringResult = parseChangeFragment( + 'docs/.changes/string-details.json', + JSON.stringify({ + type: 'added', + message: 'Add a simple option.', + details: 'Read more in [Lifecycle](https://microsoft.github.io/agent-host-protocol/specification/lifecycle).', + }), + ); + + assert.deepEqual(stringResult.errors, []); + assert.deepEqual(stringResult.fragment?.details, [ + 'Read more in [Lifecycle](https://microsoft.github.io/agent-host-protocol/specification/lifecycle).', + ]); + }); + + it('rejects malformed details', () => { + const unclosedFence = parseChangeFragment( + 'docs/.changes/unclosed.json', + JSON.stringify({ + type: 'added', + message: 'Broken fence.', + details: ['```ts', 'const x = 1;'], + }), + ); + assert.deepEqual( + unclosedFence.errors.map((error) => error.message), + ['`details` has an unclosed fenced code block'], + ); + + const headingOutsideFence = parseChangeFragment( + 'docs/.changes/heading.json', + JSON.stringify({ + type: 'added', + message: 'Contains heading.', + details: ['## Not allowed'], + }), + ); + assert.deepEqual( + headingOutsideFence.errors.map((error) => error.message), + ['`details` must not contain Markdown headings outside fenced code blocks'], + ); + + const blankEdge = parseChangeFragment( + 'docs/.changes/blank.json', + JSON.stringify({ + type: 'added', + message: 'Leading blank.', + details: ['', 'Body'], + }), + ); + assert.deepEqual( + blankEdge.errors.map((error) => error.message), + ['`details` must not have leading or trailing blank lines'], + ); + + const multilineItem = parseChangeFragment( + 'docs/.changes/newline-entry.json', + JSON.stringify({ + type: 'added', + message: 'Newline in array entry.', + details: ['line 1\nline 2'], + }), + ); + assert.deepEqual( + multilineItem.errors.map((error) => error.message), + ['`details` array entries must each be a single line'], + ); + }); + + it('rejects unlinked #123 references while allowing linked issues and code blocks', () => { + const unlinkedMessage = parseChangeFragment( + 'docs/.changes/unlinked-message.json', + JSON.stringify({ + type: 'fixed', + message: 'Fix crash (#123).', + }), + ); + assert.deepEqual( + unlinkedMessage.errors.map((error) => error.message), + [ + `\`message\` contains unlinked issue/PR reference #123; put it in \`issues\` or link it as [#123](${REPO_ISSUES_URL}/123)`, + ], + ); + + const linkedAndCode = parseChangeFragment( + 'docs/.changes/linked.json', + JSON.stringify({ + type: 'fixed', + message: `Fix issue discussed in [#123](${REPO_ISSUES_URL}/123) and handle \`#456\`.`, + details: [ + '```ts', + '// #789 inside a fenced code block is ignored', + '```', + `See also [PR #99](${REPO_ISSUES_URL}/99).`, + ], + }), + ); + assert.deepEqual(linkedAndCode.errors, []); + + assert.deepEqual( + findUnlinkedIssueReferences([ + `- Linked ([#12](${REPO_ISSUES_URL}/12)) and unlinked (#34, #56).`, + '```', + '// #78 ignored', + '```', + 'Inline `#90` ignored, URL https://example.com/a#11 ignored.', + ]), + [ + { line: 1, reference: '#34' }, + { line: 1, reference: '#56' }, + ], + ); + }); + it('creates a dated release section after Unreleased', () => { const next = applyReleaseToChangelog( [ @@ -98,6 +248,7 @@ describe('change fragments', () => { filePath: 'docs/.changes/entry.json', type: 'changed', message: 'Updated client API.', + details: [], targets: ['typescript'], issues: [], }, @@ -153,6 +304,7 @@ describe('change fragments', () => { filePath: 'docs/.changes/spec.json', type: 'added', message: 'Added a protocol feature.', + details: [], targets: ['spec'], issues: [], }, diff --git a/scripts/change-fragments.ts b/scripts/change-fragments.ts index e8be2d929..a00670995 100644 --- a/scripts/change-fragments.ts +++ b/scripts/change-fragments.ts @@ -28,6 +28,7 @@ export interface ChangeFragment { readonly filePath: string; readonly type: ChangeType; readonly message: string; + readonly details: readonly string[]; readonly targets: readonly ChangelogTarget[]; readonly issues: readonly number[]; } @@ -42,8 +43,46 @@ interface ParsedMarkdownSection { body: string[]; } -const ALLOWED_FRAGMENT_KEYS = new Set(['type', 'message', 'targets', 'issues']); +const ALLOWED_FRAGMENT_KEYS = new Set(['type', 'message', 'details', 'targets', 'issues']); const DEFAULT_TARGETS: readonly ChangelogTarget[] = CHANGELOG_TARGETS; +export const REPO_ISSUES_URL = 'https://github.com/microsoft/agent-host-protocol/issues'; + +export interface UnlinkedIssueMatch { + readonly line: number; + readonly reference: string; +} + +export function findUnlinkedIssueReferences(lines: readonly string[]): UnlinkedIssueMatch[] { + const matches: UnlinkedIssueMatch[] = []; + let openFence: { char: string; length: number } | undefined; + + for (let index = 0; index < lines.length; index++) { + const line = lines[index]; + const fenceMatch = /^\s*(`{3,}|~{3,})(.*)$/.exec(line); + if (fenceMatch) { + const marker = fenceMatch[1]; + const rest = fenceMatch[2]; + if (!openFence) { + openFence = { char: marker[0], length: marker.length }; + } else if (marker[0] === openFence.char && marker.length >= openFence.length && rest.trim().length === 0) { + openFence = undefined; + } + continue; + } + if (openFence) { + continue; + } + + const stripped = line + .replace(/`[^`]*`/g, '') + .replace(/\[[^\]]*\]\([^)]*\)/g, ''); + for (const match of stripped.matchAll(/(? line.includes('\r'))) { + errors.push({ filePath, message: '`details` must not contain bare carriage returns' }); + return []; + } + } else if (Array.isArray(value)) { + if (value.length === 0) { + errors.push({ filePath, message: '`details` must be a non-empty string or array of lines when present' }); + return []; + } + lines = []; + let hasInvalidEntry = false; + for (const entry of value) { + if (typeof entry !== 'string') { + errors.push({ filePath, message: '`details` array entries must be strings' }); + hasInvalidEntry = true; + continue; + } + if (/\r|\n/.test(entry)) { + errors.push({ filePath, message: '`details` array entries must each be a single line' }); + hasInvalidEntry = true; + continue; + } + lines.push(entry); + } + if (hasInvalidEntry) { + return []; + } + } else { + errors.push({ filePath, message: '`details` must be a non-empty string or array of lines when present' }); + return []; + } + + if (lines[0].trim().length === 0 || lines[lines.length - 1].trim().length === 0) { + errors.push({ filePath, message: '`details` must not have leading or trailing blank lines' }); + return []; + } + + let openFence: { char: string; length: number } | undefined; + for (const line of lines) { + const fenceMatch = /^\s*(`{3,}|~{3,})(.*)$/.exec(line); + if (fenceMatch) { + const marker = fenceMatch[1]; + const rest = fenceMatch[2]; + if (!openFence) { + openFence = { char: marker[0], length: marker.length }; + } else if (marker[0] === openFence.char && marker.length >= openFence.length && rest.trim().length === 0) { + openFence = undefined; + } + continue; + } + + if (!openFence && /^\s*#{1,6}\s/.test(line)) { + errors.push({ filePath, message: '`details` must not contain Markdown headings outside fenced code blocks' }); + } + } + + if (openFence) { + errors.push({ filePath, message: '`details` has an unclosed fenced code block' }); + } + + for (const unlinked of findUnlinkedIssueReferences(lines)) { + errors.push({ + filePath, + message: `\`details\` contains unlinked issue/PR reference ${unlinked.reference}; link it as [${unlinked.reference}](${REPO_ISSUES_URL}/${unlinked.reference.slice(1)}) or put it in \`issues\``, + }); + } + + return lines; +} + export function parseChangeFragment(filePath: string, raw: string): { fragment?: ChangeFragment; errors: FragmentValidationError[] } { const errors: FragmentValidationError[] = []; let parsed: unknown; @@ -189,9 +310,17 @@ export function parseChangeFragment(filePath: string, raw: string): { fragment?: } else if (parsed.message.startsWith('- ')) { errors.push({ filePath, message: '`message` must not include the leading Markdown bullet' }); } else if (/\r|\n/.test(parsed.message)) { - errors.push({ filePath, message: '`message` must be a single line' }); + errors.push({ filePath, message: '`message` must be a single line; put code snippets, examples, or doc links in `details`' }); + } else { + for (const unlinked of findUnlinkedIssueReferences([parsed.message])) { + errors.push({ + filePath, + message: `\`message\` contains unlinked issue/PR reference ${unlinked.reference}; put it in \`issues\` or link it as [${unlinked.reference}](${REPO_ISSUES_URL}/${unlinked.reference.slice(1)})`, + }); + } } + const details = validateDetails(filePath, parsed.details, errors); const targets = validateTargets(filePath, parsed.targets, errors); const issues = validateIssues(filePath, parsed.issues, errors); @@ -204,6 +333,7 @@ export function parseChangeFragment(filePath: string, raw: string): { fragment?: filePath, type: parsed.type as ChangeType, message: parsed.message as string, + details, targets, issues, }, @@ -234,7 +364,7 @@ function issueSuffix(issues: readonly number[]): string { if (issues.length === 0) { return ''; } - return ` (${issues.map((issue) => `#${issue}`).join(', ')})`; + return ` (${issues.map((issue) => `[#${issue}](${REPO_ISSUES_URL}/${issue})`).join(', ')})`; } export function renderChangeSections(fragments: readonly ChangeFragment[], target: ChangelogTarget): string[] { @@ -250,6 +380,9 @@ export function renderChangeSections(fragments: readonly ChangeFragment[], targe lines.push(`### ${CHANGE_TYPE_HEADINGS[type]}`, ''); for (const fragment of matching) { lines.push(`- ${fragment.message}${issueSuffix(fragment.issues)}`); + for (const detailLine of fragment.details) { + lines.push(detailLine.trim().length === 0 ? '' : ` ${detailLine}`); + } } } return lines; diff --git a/scripts/consume-change-fragments.ts b/scripts/consume-change-fragments.ts index 7ec4b5153..76fdaa4c3 100644 --- a/scripts/consume-change-fragments.ts +++ b/scripts/consume-change-fragments.ts @@ -95,6 +95,7 @@ function writeRemainingFragment(fragment: ChangeFragment, remainingTargets: read const next = { type: fragment.type, message: fragment.message, + ...(fragment.details.length > 0 ? { details: fragment.details } : {}), targets: remainingTargets, ...(fragment.issues.length > 0 ? { issues: fragment.issues } : {}), }; diff --git a/scripts/verify-changelog.ts b/scripts/verify-changelog.ts index b11544488..52e6ead62 100644 --- a/scripts/verify-changelog.ts +++ b/scripts/verify-changelog.ts @@ -29,6 +29,7 @@ import { fileURLToPath } from 'url'; import { Project } from 'ts-morph'; import { readProtocolVersions } from './read-protocol-versions.js'; +import { findUnlinkedIssueReferences, REPO_ISSUES_URL } from './change-fragments.js'; import { readKotlinPackageVersion, readRustPackageVersion, @@ -171,12 +172,14 @@ function main(): void { ]; const failures: { target: ChangelogTarget; relative: string; expectedVersion: string }[] = []; + const unlinkedIssues: { relative: string; line: number; reference: string }[] = []; for (const target of targets) { const expectedVersion = changelogVersionFor(target.version); + const relative = path.relative(ROOT, target.changelogPath); if (!fs.existsSync(target.changelogPath)) { failures.push({ target, - relative: path.relative(ROOT, target.changelogPath), + relative, expectedVersion, }); continue; @@ -184,13 +187,17 @@ function main(): void { if (!changelogHasHeading(target.changelogPath, expectedVersion)) { failures.push({ target, - relative: path.relative(ROOT, target.changelogPath), + relative, expectedVersion, }); } + const body = fs.readFileSync(target.changelogPath, 'utf-8'); + for (const match of findUnlinkedIssueReferences(body.replace(/\r\n/g, '\n').split('\n'))) { + unlinkedIssues.push({ relative, line: match.line, reference: match.reference }); + } } - if (failures.length > 0) { + if (failures.length > 0 || unlinkedIssues.length > 0) { console.error('❌ CHANGELOG verification failed:'); for (const { target, relative, expectedVersion } of failures) { console.error( @@ -198,6 +205,11 @@ function main(): void { ); console.error(` hint: ${target.hint}`); } + for (const { relative, line, reference } of unlinkedIssues) { + console.error( + ` ${relative}:${line} contains unlinked issue/PR reference ${reference} — link it as [${reference}](${REPO_ISSUES_URL}/${reference.slice(1)})`, + ); + } process.exit(1); } diff --git a/skills/changelog/SKILL.md b/skills/changelog/SKILL.md new file mode 100644 index 000000000..70b3c491b --- /dev/null +++ b/skills/changelog/SKILL.md @@ -0,0 +1,161 @@ +--- +name: changelog +description: Write, update, or review AHP changelog fragments under docs/.changes/ using plain consumer-friendly language, brief code snippets for complex features, public documentation links, target scoping, and unreleased-feature consolidation. Use whenever a PR makes a user-visible change to types/, schema/, clients/, or generators, or when editing changelog entries. +--- + +# Writing AHP Changelog Fragments + +This repo ships seven independently-versioned artifacts (the spec plus the Rust, +Kotlin, Swift, TypeScript, Go, and .NET clients), each with its own +`CHANGELOG.md` in [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) +format. The publish workflows refuse to release a tag whose matching +`## [X.Y.Z]` heading is missing. + +To avoid merge conflicts in shared `CHANGELOG.md` files, normal PRs add or +update JSON changelog fragments under `docs/.changes/` instead of editing +changelogs directly. Release PRs collapse those fragments into the seven +changelogs with `npm run changelog:release` (see +[`release-ahp`](../release-ahp/SKILL.md)). + +## When to add an entry + +Add a fragment whenever your change is **user-visible**: + +- A new, removed, renamed, or behaviourally-changed action, command, state + field, error, notification, or version constant in `types/`. +- A new, removed, or behaviourally-changed public API in one of the + `clients//` source trees (constructor signatures, exported + functions/types, transport options, reducer outputs, etc.). +- A bug fix that changes observable behaviour for a consumer of the spec or + any client. +- A security-relevant change (use `"type": "security"`). + +**Skip the fragment** when the change is purely: + +- Edits under `**/generated/**` (those mirror a `types/` change that should + have its own entry). +- Docs in `docs/`, `README.md`, comments, `AGENTS.md`, `CONTRIBUTING.md`, or + `skills/`. +- Tests, CI, lint config, formatting, or internal refactors with no observable + effect. + +## One fragment per feature (update unreleased entries) + +- **One fragment per feature in a PR.** Do not split one feature across + multiple fragments for its sub-types, helper constants, or companion tweaks. + Use multiple fragments only when changes genuinely belong to different + Keep-a-Changelog types (for example, a breaking rename in `changed` alongside + a separate `deprecated` notice) or distinct artifact `targets`. +- **Update unreleased fragments instead of adding new ones.** Before creating + a new fragment, inspect existing files in `docs/.changes/`. If you are + iterating on, refining, or fixing a feature that was introduced since the + last release and has not shipped yet, **edit its existing fragment** (and + append any new issue numbers to `issues`) instead of creating another entry. + Consumers should see the final shape of an unreleased feature once, not a + play-by-play of pre-release iterations. + +## Writing style + +Write changelogs for **consumers adopting the release**, not as a mechanical +inventory of internal type names: + +- **Use plain, direct language.** Start `message` with a clear verb ("Add …", + "Rename …", "Fix …", "Deprecate …") and explain *why* the change exists or + *how* it helps a client or host author, not just which fields were added. +- **Give a brief example for complex changes.** When a change introduces a new + channel, command/action flow, capability negotiation, or non-trivial API + change, add a short `details` block with a concise TypeScript or pseudo-code + snippet (~5–15 lines) showing the feature in action. Keep simple single-field + additions and small fixes to a crisp single line (plus a doc link if useful). +- **Link relevant documentation and issue/PR numbers.** When a guide or + specification page covers the feature, link to it using the public + documentation URL (`https://microsoft.github.io/agent-host-protocol/...`, + without `/draft/`, since released pages are published at the site root). + Avoid relative repo links, which break in `clients//CHANGELOG.md` and + GitHub Releases. Always put issue/PR numbers in the fragment's `issues` + array so they render as Markdown links + (`([#123](https://github.com/microsoft/agent-host-protocol/issues/123))`); + if a `#123` reference appears in prose inside `message`, `details`, or a + `CHANGELOG.md`, always link it explicitly. + +## Which artifact(s) to target + +Each fragment may specify a `targets` array. Omit `targets` when the same +entry applies to the spec and all clients (the common case for protocol +surface changes). Set `targets` to a subset when the change is only visible +to specific artifacts. + +| Source path touched | Fragment target(s) | +| --- | --- | +| `types/**` (protocol surface) | Omit `targets` (spec + all clients) unless the visibility is intentionally narrower. | +| `clients/rust/**` (non-generated) | `"targets": ["rust"]` | +| `clients/kotlin/**` (non-generated) | `"targets": ["kotlin"]` | +| `clients/swift/**` (non-generated) | `"targets": ["swift"]` | +| `clients/typescript/**` (non-generated) | `"targets": ["typescript"]` | +| `clients/go/**` (non-generated) | `"targets": ["go"]` | +| `clients/dotnet/**` (non-generated) | `"targets": ["dotnet"]` | +| `schema/**` | `"targets": ["spec"]` | +| `scripts/generate*.ts` that changes any client's generated output | Omit `targets` or list every affected target. | + +## Format + +Create a uniquely named JSON file under `docs/.changes/`, usually +`docs/.changes/YYYYMMDD-short-slug.json`. Use lowercase Keep-a-Changelog +types: `added`, `changed`, `deprecated`, `removed`, `fixed`, `security`. +`message` is a single-line headline without a leading Markdown bullet (`issues` +are appended to it automatically as linked +` ([#123](https://github.com/microsoft/agent-host-protocol/issues/123))`). For +complex changes, add an optional `details` array of Markdown lines (or a +string); each line is rendered indented under the bullet. + +Simple one-line example: + +```json +{ + "type": "added", + "message": "Add optional `InitializeResult.environment.pathStyle` metadata describing how to represent agent host file paths." +} +``` + +Complex feature with a brief code snippet and docs link: + +```json +{ + "type": "added", + "message": "Add experimental flow-control with byte accounting, framed delivery, and consumption credit notifications so fast producers do not overwhelm slow clients.", + "details": [ + "```ts", + "const sub = await client.subscribe({", + " resource,", + " flowControl: { windowBytes: 65536, maxFrameBytes: 16384 },", + "});", + "// Return credit after processing incoming notifications", + "client.notify('channel/windowUpdate', { resource, consumedBytes });", + "```", + "Read more in [Windowed Delivery](https://microsoft.github.io/agent-host-protocol/specification/windowed-delivery)." + ], + "issues": [492] +} +``` + +Scoped client-only example: + +```json +{ + "type": "fixed", + "message": "Fix `AhpClient.connect` to reject with `AhpProtocolError` when protocol negotiation fails.", + "targets": ["typescript"] +} +``` + +## Validation + +Do **not** edit `CHANGELOG.md` files for normal feature/fix PRs and do not +invent a `## [X.Y.Z]` heading — changelogs are updated at release time per +[`RELEASING.md`](../../RELEASING.md) and [`release-ahp`](../release-ahp/SKILL.md). + +Validate fragment JSON before finishing: + +```bash +npm run verify:change-fragments +``` diff --git a/skills/groom-backlog/SKILL.md b/skills/groom-backlog/SKILL.md index 6761e7941..f79fc93da 100644 --- a/skills/groom-backlog/SKILL.md +++ b/skills/groom-backlog/SKILL.md @@ -32,8 +32,8 @@ Lean on the `explore` agent to parallelize research across many PRs / issues wit Before touching the backlog, ground yourself in the system the same way you would before any non-trivial change here: -- Read the repo's own source and docs: the canonical types under `types/` (the source of truth), the generated `schema/`, the prose in `docs/specification/` and `docs/guide/`, and `AGENTS.md`, `CONTRIBUTING.md`, and `RELEASING.md`. The editorial rules for changing protocol types live in [`.github/instructions/general-instructions.instructions.md`](../../.github/instructions/general-instructions.instructions.md) — follow them. -- Understand how a `types/` change ripples outward: every protocol change regenerates `schema/` and each client's `**/generated/**` mirror, may need a hand-written client update, must keep the conformance fixtures under `types/test-cases/` in sync, and lands a `docs/.changes` fragment for **every** affected artifact (per `AGENTS.md` → "Adding changelog fragments"). The version surface lives in `types/version/registry.ts` (`PROTOCOL_VERSION`, `SUPPORTED_PROTOCOL_VERSIONS`). +- Read the repo's own source and docs: the canonical types under `types/` (the source of truth), the generated `schema/`, the prose in `docs/specification/` and `docs/guide/`, and `AGENTS.md`, `CONTRIBUTING.md`, and `RELEASING.md`. Follow the [`protocol-authoring`](../protocol-authoring/SKILL.md) skill (and its [naming dictionary](../protocol-authoring/naming.md)) for protocol changes. +- Understand how a `types/` change ripples outward: every protocol change regenerates `schema/` and each client's `**/generated/**` mirror, may need a hand-written client update, must keep the conformance fixtures under `types/test-cases/` in sync, and lands a `docs/.changes` fragment for **every** affected artifact (per the [`changelog`](../changelog/SKILL.md) skill). The version surface lives in `types/version/registry.ts` (`PROTOCOL_VERSION`, `SUPPORTED_PROTOCOL_VERSIONS`). - Refresh your understanding of the protocol's public surface and its **published, versioned artifacts** — the crates, the npm package, the Maven/JVM library, the Swift package, and the Go module, all generated from `types/`. AHP is a contract that external clients implement and external products consume, so "is this follow-up still relevant?" is answered against the current spec, the generated and hand-maintained clients in this repo, and what the protocol already guarantees — not against any single implementation. You don't need to memorize everything up front, but a follow-up audit and an issue triage are only as good as your understanding of the current state of the system. Invest in that first. @@ -60,7 +60,7 @@ Ground yourself in the local conventions so your issues match the house style an - **Issue templates.** This repo has no `.github/ISSUE_TEMPLATE/` forms today, so new issues are free-form — which means a follow-up issue needs to carry its own structure and completeness. - **The quality bar for a follow-up issue.** A good follow-up issue stands on its own: a **Context** section linking the originating PR *and* the specific review thread *and* the `types/`/client code or spec prose in question, a **Problem** statement, a concrete **Proposed fix**, an **Affected artifacts** note (which of `types/` / `schema/` / each `clients//` / `docs/` / the CHANGELOGs the fix touches), a **Tests / conformance** list (the `types/test-cases/` fixtures or client tests it needs), and an **Out of scope** section. Well-scoped existing issues are the model; read a few current open ones to match the house depth (`gh issue list` / `gh issue view`). - **Where PRs call out future work.** Look in the PR **body** (`## What` / `## Why` / `## How` notes, "out of scope", "future work", "follow-up", "deferred"), in **review threads** (a reviewer asks for something and the author defers it), and in **the code the PR landed** (`TODO`, `FIXME`, "Known … gap", "deferred from PR #…" in `types/` comments, hand-written client source, or docs). The inverse — promised work with *no* issue — is exactly what phase 1 hunts for. -- **`types/` is the canonical wire contract.** A change to the protocol surface is never local: it regenerates `schema/` and every client's `**/generated/**` mirror, may require a matching hand-written client change, must keep the conformance fixtures in `types/test-cases/` aligned, and lands a `docs/.changes` fragment in each affected artifact's scope. `AGENTS.md` and [`.github/instructions/general-instructions.instructions.md`](../../.github/instructions/general-instructions.instructions.md) are the authorities on when and how to touch that tree; the [versioning policy](../../docs/specification/versioning.md) governs anything that moves `PROTOCOL_VERSION`. Follow them. +- **`types/` is the canonical wire contract.** A change to the protocol surface is never local: it regenerates `schema/` and every client's `**/generated/**` mirror, may require a matching hand-written client change, must keep the conformance fixtures in `types/test-cases/` aligned, and lands a `docs/.changes` fragment in each affected artifact's scope. [`protocol-authoring`](../protocol-authoring/SKILL.md) and [`changelog`](../changelog/SKILL.md) are the authorities on how to touch those trees; the [versioning policy](../../docs/specification/versioning.md) governs anything that moves `PROTOCOL_VERSION`. Follow them. ## The triage pass @@ -90,7 +90,7 @@ Treat the following as the shape of the work, not a rigid script. Adapt the orde 1. **Prioritize** the "implementable now" shortlist by importance and urgency. Security and spec-correctness items lead; then conformance gaps and behaviour bugs affecting consumers (e.g. a client mirror or reducer that diverges from `types/`); then enhancements and docs. State the ordering and the reasoning. 2. **Cluster** closely-related issues that can be implemented and reviewed together into a single PR; keep unrelated work in separate, focused PRs (per `CONTRIBUTING.md`). -3. **Implement in priority order.** For each issue (or tight cluster): work on a focused branch, make the change, and keep the whole chain in lockstep when the wire contract moves — edit `types/`, run `npm run generate` so `schema/` and every client's `**/generated/**` mirror regenerate, update any hand-written client surface and the `types/test-cases/` conformance fixtures, refresh the docs, and add the `docs/.changes` fragment(s) the change requires (per `AGENTS.md`). **Validate** with the repo's own build / lint / test gates (see appendix). Don't consider a change done until it builds and passes. Open the PR with `Closes #N` (list each issue in a cluster). +3. **Implement in priority order.** For each issue (or tight cluster): work on a focused branch, make the change, and keep the whole chain in lockstep when the wire contract moves — edit `types/`, run `npm run generate` so `schema/` and every client's `**/generated/**` mirror regenerate, update any hand-written client surface and the `types/test-cases/` conformance fixtures, refresh the docs, and add/update the `docs/.changes` fragment the change requires (per the [`changelog`](../changelog/SKILL.md) skill). **Validate** with the repo's own build / lint / test gates (see appendix). Don't consider a change done until it builds and passes. Open the PR with `Closes #N` (list each issue in a cluster). - If the user asked you to confirm before acting (e.g. "check with me first", "don't change anything yet"), present the audit results, the triage classification, and the proposed implementation order, and **wait for approval** before opening/closing issues or writing code. ### Report diff --git a/skills/protocol-authoring/SKILL.md b/skills/protocol-authoring/SKILL.md new file mode 100644 index 000000000..d4753bccf --- /dev/null +++ b/skills/protocol-authoring/SKILL.md @@ -0,0 +1,243 @@ +--- +name: protocol-authoring +description: Design and evolve canonical AHP protocol types, reducers, and documentation under types/ and docs/. Covers AHP doctrine, naming conventions, discriminated unions, enum compatibility tags, bitsets, keyed-collection actions, preserving named protocol object types, regenerating all 6 clients, and running Podman verification toolchains. Use before editing types/ or protocol specification docs. +--- + +# Authoring AHP Protocol Changes + +Follow these rules whenever you add, change, or document protocol types under +`types/` or protocol specification/guide prose under `docs/`. + +## Design & naming foundations + +- Treat [AHP Doctrine](../../docs/guide/doctrine.md) as the design compass for + protocol changes. Before adding or changing protocol types, check the + doctrine's principles and design tests: durable user-visible results should + be represented in state, the host should remain authoritative, minimal + clients should keep a coherent experience, and agent implementation details + should stay behind the host boundary. +- Name things using the [protocol naming dictionary](./naming.md): reuse its + established terms, identifier and unit conventions, and message-naming + patterns, and don't copy the legacy names it lists. +- Always prefer dispatching state actions (that can cause side effects) rather + than making imperative RPC calls. For example, rather than a `sendMessage` + command, we have a `session/turnStarted` message. +- Never update `PROTOCOL_VERSION` unless you were explicitly instructed to do + so. + +## Type modeling rules + +### Make invalid states inexpressible + +Don't write mutually dependent optional fields: + +```ts +interface IApproval { + denied: boolean; + reason?: string; // only present if denied=true +} +``` + +Instead, use a discriminated union: + +```ts +interface IDenial { + denied: true; + reason: string; +} +interface IApproval { + denied: false; +} +type IApproval = IDenial | IApproval; +``` + +Or inline a single optional field when its presence carries the state: + +```ts +interface IApproval { + deniedReason?: string; // if present, implies denied +} +``` + +### Preserve protocol object types + +- For new or changed protocol objects with a fixed schema, prefer named, + reusable types in `types/` and generated native models. Do not replace a + known shape with raw JSON to work around a generator gap. +- Reserve raw JSON (`Record` / `unknown`) for intentionally + open data, such as `_meta`, JSON Schema and tool payloads, provider + extensions, and unknown variants. +- Update the canonical definitions and each affected generator. **Do not + hand-edit generated files** (`**/generated/**`). Preserve wire names, + nesting, optionality, numeric mappings, and collection wrappers such as + `{ items: ... }`. +- Check source and binary compatibility separately from JSON compatibility. + Define an explicit migration for public API changes. Keep native decoding + errors visible. Cover known shapes with shared round-trip fixtures under + `types/test-cases/round-trips/`, not per-language serialization tests. + +### Numbers, enums, bitsets, and wrappers + +- `number` types are assumed to be 64-bit integers. Carry `@integer` in JSDoc + so JSON Schema emits `type: "integer"`. If floating-point values are + reasonable for a field, annotate its JSDoc with `@format float`. +- Every protocol `enum` declaration MUST carry exactly one JSDoc compatibility + annotation: use `@nonexhaustive` when later protocol versions may add wire + values (clients preserve unknown raw values), and `@exhaustive` only when an + unknown value is invalid and clients must reject it. The generators validate + this contract and use it for both raw enums and discriminated unions. +- Numeric flag enums MUST carry `@bitset` in their main JSDoc block. Members + must be unsigned 32-bit integers; combinations and unknown bits remain valid + wire values. Generators use this tag, not description prose, to identify + bitsets and include each named flag's value and documentation in JSON Schema. +- For actions or commands that could be implemented by returning an array + `T[]` directly, still prefer to wrap it in a named interface `{ items: T[] }` + for forward compatibility so additional fields can be added later without + breaking the shape. + +### Unknown-member preservation (`@preserveUnknownMembers`) + +**Default: do not add `@preserveUnknownMembers`.** Strongly-typed SDK decoders +(Rust, Swift, Kotlin, Go, .NET) intentionally ignore and discard unrecognized +JSON keys on ordinary types. + +Use `@preserveUnknownMembers` **only** on types that are **round-tripped +through a client in a read-modify-replace flow** — i.e., decoded from host +state by an older client, edited, and sent back to the host as a full +replacement object — plus every fixed-schema object and union variant +transitively nested inside those replacement payloads, so editing known fields +does not silently erase newer fields stored on the host: + +- **Annotate:** + - Existing round-trip graphs and any new fixed-schema types or union variants + nested inside them: `AutomationDefinitionPatch` (`automation/updateRequested` + — `AutomationSessionTemplate`, `AutomationTrigger`, + `AutomationDisableCondition`, `AutomationTarget`, `Message`, and their + nested types) and `SearchQuery` (`search/queryChanged` and its + `SearchTarget` variants). + - Any new action/command payload that replaces a host-stored object after the + client reads and edits it, along with its nested fixed-schema types. +- **Do NOT annotate:** + - **Host-to-client read-only state and metadata** (`*Summary`, `*Info`, + `*Capabilities`, `Turn`, `ToolCallState`, `SearchResult`, `ChangesetFile`, + etc.) — clients read these without sending them back as replacements. + - **Client-constructed one-shot requests** (`CreateSessionParams`, + `CreateChatParams`, `AuthenticateParams`, `McpServerAuthenticateTarget`, + `ResourceReadParams`, etc.) — clients build these fresh per call, so there + are no decoded unknown fields to preserve. + - **Host-only command results** (`*Result`). + +Keep this annotation minimal because it carries real SDK cost: it adds an +`extra` / `Extra` map field and custom serializers, breaks Go `==` +comparability, requires `extra` / `..` in Rust struct literals and exhaustive +patterns, and changes .NET record equality on `Extra` to reference comparison. +Because adding it to an already-published type is a source/binary breaking +change in generated SDKs, decide deliberately when introducing a new +read-modify-replace type rather than adding it speculatively everywhere. + +### Discriminated unions + +- Lifecycle / state-machine unions: name the union `Foo*State` and its + discriminant enum `Foo*Status`. Variant interfaces are `Foo*State` (e.g. + `ToolCallState` + `ToolCallStatus` + `ToolCallStreamingState`; + `McpServerState` + `McpServerStatus` + `McpServerStartingState`; + `CustomizationLoadState` + `CustomizationLoadStatus`). +- General / typological unions (not a lifecycle): name the discriminant + `Foo*Kind` (e.g. `MessageAttachment` + `MessageAttachmentKind`, + `ResponsePart` + `ResponsePartKind`, `ToolCallContributor` + + `ToolCallContributorKind`). +- Generator note: variant interface names must differ from the union wrapper + names emitted by the per-language generators (e.g. Kotlin emits + `value class FooStateStarting(val value: FooStartingState)`), so name + variants `Foo*State` rather than `FooStatus*`. + +## Actions and reducers + +- Whenever you change or add an action, review the reducers in `types/reducers.ts` + (and per-channel `reducer.ts` files) to see if it needs to be propagated into + state. If it does, add the logic, update every hand-written client reducer, + and add fixtures in `types/test-cases/reducers/` to keep `types/reducers.ts` + at 100% branch coverage. +- Actions that mutate a keyed collection in state (an array whose entries are + identified by a stable key such as `id`, `clientId`, `resource`, or a URI — + e.g. `chats`, `customizations`, `files`, `annotations`, `activeClients`) MUST + follow the established add/remove/update convention rather than inventing a + new shape: + - **Upsert (`Foo*Set`)**: carries the **full entry object**. The reducer + finds the entry by key, **appends** it when absent and **replaces** it in + place when present (never duplicating a key). Always name a generic + create-or-replace action `Set` — not `Added`, `Changed`, or `Updated`. + - **Remove (`Foo*Removed`)**: carries **only the key** (e.g. `{ clientId }`, + `{ fileId }`), never the whole object. The reducer is a **no-op returning + the original `state`** when no entry matches. + - **Partial update (`Foo*Updated`)**: carries the **key plus the optional + fields that changed**; the reducer merges them onto the existing entry and + is a **no-op returning `state`** when no entry matches. Ignore the key + inside any `changes` payload so it can't be reassigned. + - Prefer a key-only **remove** action over an upsert that accepts a + nullable/sentinel "unset" value (e.g. do not model removal as `Changed` + with `entry: null`). + - Reducer mechanics are uniform: + `const idx = list.findIndex(x => x. === action.)`, branch on + `idx < 0`, copy immutably (`list.slice()` / `[...list]`), then write or + `splice`, and return `{ ...state, : next }`. Every branch + (insert, replace, remove, no-op) needs a fixture in + `types/test-cases/reducers/`. + +## Docs, changelogs, and finalizing changes + +- After making your changes, check that the documentation in `docs/` is up to + date. For significant new flows or features, add or expand documentation + (Mermaid diagrams are supported). +- For user-visible protocol changes, load the [`changelog`](../changelog/SKILL.md) + skill and add a single fragment under `docs/.changes/` (or update the + existing fragment if iterating on an unreleased feature). +- Before declaring a protocol change complete, run from the repo root: + +```bash +npm run generate +npm test +``` + +Resolve any generated-output, typecheck, lint, test, or generator issues those +commands expose before handing the change back. For language-specific codegen +conventions, see the per-client guides: +[`clients/dotnet/AGENTS.md`](../../clients/dotnet/AGENTS.md), +[`clients/go/AGENTS.md`](../../clients/go/AGENTS.md), +[`clients/kotlin/AGENTS.md`](../../clients/kotlin/AGENTS.md), and +[`clients/swift/AGENTS.md`](../../clients/swift/AGENTS.md). + +## Running toolchains you don't have locally + +A spec change ripples into every `clients//` mirror, so you often need to +build and test a client whose toolchain isn't installed on your machine. +**Don't skip verification** — run it in a container with `podman`. Use these +pinned images so every agent verifies against the same environment (add a row +when you containerize another toolchain so the images stay consistent): + +| Toolchain | Image | Notes | +| --- | --- | --- | +| JDK 17 (Kotlin client) | `docker.io/library/eclipse-temurin:17-jdk` | Gradle comes from the repo's `./gradlew` wrapper. | +| .NET SDK 10 (.NET client) | `mcr.microsoft.com/dotnet/sdk:10.0` | Supports `.slnx`; the test host rolls forward from .NET 8. | + +The full Swift client and tests import Apple-only `Network` and `CryptoKit`, so +run them on macOS with a full Xcode install, which includes XCTest (Command +Line Tools alone may lack it). Run every target; don't exclude transport +targets or add platform shims to get a pass. + +Mount the **repo root** (the shared conformance fixtures under +`types/test-cases/` are resolved by walking up from the working directory, so a +client-dir-only mount fails) and keep build caches out of `$HOME`. Example — +run the Kotlin client's tests: + +```sh +podman run --rm \ + -e GRADLE_USER_HOME=/tmp/gradle-home \ + -v "$PWD":/workspace \ + -w /workspace/clients/kotlin \ + docker.io/library/eclipse-temurin:17-jdk \ + ./gradlew test --no-daemon --console=plain +``` + +On macOS this needs a running `podman machine` (`podman machine start`). Build +artifacts (`clients/kotlin/build/`, `.gradle/`) are git-ignored. diff --git a/.github/instructions/protocol-naming.instructions.md b/skills/protocol-authoring/naming.md similarity index 97% rename from .github/instructions/protocol-naming.instructions.md rename to skills/protocol-authoring/naming.md index 9564a57b6..d5e0d271d 100644 --- a/.github/instructions/protocol-naming.instructions.md +++ b/skills/protocol-authoring/naming.md @@ -1,17 +1,11 @@ ---- -description: Dictionary of protocol terms and naming conventions for AHP types -applyTo: 'types/**/*.ts,docs/specification/**/*.md,docs/guide/**/*.md' ---- - # Protocol naming dictionary Use this dictionary when you name or describe anything in `types/` or the protocol docs. Prefer the established name over a near-synonym, even when the synonym reads better locally. Structural rules (enum compatibility tags, bitsets, keyed-collection actions, `{ items }` wrappers, -`@preserveUnknownMembers`) are in -[general-instructions](./general-instructions.instructions.md); this file -covers vocabulary and naming. +`@preserveUnknownMembers`) are in [`SKILL.md`](./SKILL.md); this file covers +vocabulary and naming. Some existing names predate these rules. They are listed under [Legacy names](#legacy-names-do-not-copy). Keep them for wire compatibility, @@ -108,8 +102,8 @@ channel, `channels-automation` is the **Automation catalogue**, and ## Enums and discriminants -- `*Kind` is a typological discriminant and `*Status` is a lifecycle (see the - general instructions). `*Reason` explains an outcome, `*Mode` selects a +- `*Kind` is a typological discriminant and `*Status` is a lifecycle (see + [`SKILL.md`](./SKILL.md)). `*Reason` explains an outcome, `*Mode` selects a behaviour, and `*Policy` selects a rule. - **Don't name new discriminants `*Type`** (except `ActionType`), and don't name an enum `*State`: `*State` is reserved for state objects and union @@ -168,7 +162,7 @@ free-text fields named `status`: `status` is a typed lifecycle or bitset. | Suffix | Use for | | --- | --- | -| `Set` / `Removed` / `Updated` | Upsert, remove, or partially update a keyed collection entry (see the general instructions). | +| `Set` / `Removed` / `Updated` | Upsert, remove, or partially update a keyed collection entry (see [`SKILL.md`](./SKILL.md)). | | `Changed` | Replace one field or one whole value, such as `session/titleChanged` or `chat/changesetsChanged` (a full catalog replacement). | | `Requested` | A client asks the host to do something whose outcome the host reflects later (`session/mcpServerStartRequested`, `automation/createRequested`). | | `Reordered` / `Replaced` / `Toggled` / `Cleared` | Reorder a list / swap one entry for another / flip an enablement / empty a collection. | diff --git a/skills/release-ahp/SKILL.md b/skills/release-ahp/SKILL.md index abe98e61f..76cde7bfc 100644 --- a/skills/release-ahp/SKILL.md +++ b/skills/release-ahp/SKILL.md @@ -66,7 +66,11 @@ Before touching anything, confirm with the user: Create `release/ahp-` off `main`. Then in a single commit: -- **CHANGELOGs** — run +- **CHANGELOGs** — first review `docs/.changes/*.json` against the + [`changelog`](../changelog/SKILL.md) skill: merge any follow-up iterations on + the same unreleased feature into a single fragment, keep descriptions + consumer-friendly, and verify complex features include a brief code snippet + and public docs link in `details`. Then run `npm run changelog:release -- --version X.Y.Z --date ` to collapse `docs/.changes/*.json` into the seven changelogs. This creates or replaces each `## [X.Y.Z] — ` section and adds the