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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions .claude/schema-sync.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Schema Synchronization

Instructions for updating the model files to match the latest ACP schema from https://github.com/agentclientprotocol/agent-client-protocol

## Process

### 1. Fetch Latest Schema Files

Schema URLs:
- https://raw.githubusercontent.com/agentclientprotocol/agent-client-protocol/main/schema/schema.json
- https://raw.githubusercontent.com/agentclientprotocol/agent-client-protocol/main/schema/meta.json
- https://raw.githubusercontent.com/agentclientprotocol/agent-client-protocol/main/schema/schema.unstable.json
- https://raw.githubusercontent.com/agentclientprotocol/agent-client-protocol/main/schema/meta.unstable.json

### 2. Analyze Schema Changes

Use the Task agent to analyze and compare schemas:
- Read the JSON schema files (large files, read in sections)
- Identify all types, requests, responses, and notifications
- Compare with `acp-model/src/commonMain/kotlin/com/agentclientprotocol/model/`
- Find missing types, fields, or methods
- Identify items marked as "unstable" in schema

### 3. Update Model Files

Key files in `acp-model/src/commonMain/kotlin/com/agentclientprotocol/model/`:
- `Types.kt` - Core types and value classes
- `Capabilities.kt` - Client and Agent capabilities
- `Requests.kt` - Request and Response types
- `SessionUpdate.kt` - Session update types
- `ToolCall.kt` - Tool call related types
- `Terminal.kt` - Terminal related types
- `Methods.kt` - AcpMethod enum with all protocol methods

Rules:
- Mark unstable API with `@UnstableApi` annotation
- If a type is marked `@UnstableApi`, don't mark its methods
- Add `_meta: JsonElement?` field to types extending `AcpWithMeta`
- Use `@EncodeDefault` for optional fields with defaults in capabilities
- Use `@JsonClassDiscriminator` for sealed classes

### 4. Update Agent/Client Integration

If request/response signatures changed:
- `acp/src/commonMain/kotlin/com/agentclientprotocol/agent/Agent.kt`
- `acp/src/commonMain/kotlin/com/agentclientprotocol/agent/AgentInfo.kt`
- `acp/src/commonMain/kotlin/com/agentclientprotocol/client/Client.kt`
- `acp/src/commonMain/kotlin/com/agentclientprotocol/client/ClientInfo.kt`

### 5. Update API Dumps

Run: `./gradlew :acp-model:apiDump :acp:apiDump :acp-ktor:apiDump :acp-ktor-client:apiDump :acp-ktor-server:apiDump`

### 6. Update Schema Version Markers

Clone schema repo to get metadata:
- Repository: https://github.com/agentclientprotocol/agent-client-protocol
- Get commit hash, date, and SHA256 checksums of schema files

Update in `acp-model/`:
- `SCHEMA_VERSION.md` - commit hash, date, checksums, changelog
- `.schema-checksums` - SHA256 checksums for all 4 schema files
- `.schema-revision` - commit hash

### 7. Verify Build

Run: `./gradlew build`

## Code Patterns

### New Type
```kotlin
@Serializable
public data class NewType(
val requiredField: String,
val optionalField: String? = null,
override val _meta: JsonElement? = null
) : AcpWithMeta
```

### Unstable API
```kotlin
/**
* **UNSTABLE**
*
* This capability is not part of the spec yet, and may be removed or changed at any point.
*/
@UnstableApi
@Serializable
public data class UnstableType(
val field: String,
override val _meta: JsonElement? = null
) : AcpWithMeta
```

### New Method
```kotlin
// In Methods.kt
public object NewMethod : AcpRequestResponseMethod<NewRequest, NewResponse>(
"method/name",
NewRequest.serializer(),
NewResponse.serializer()
)
```
11 changes: 11 additions & 0 deletions acp-model/.schema-checksums
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# ACP Schema Checksums
# This file is used for automated verification
# Format: SHA256 FILENAME

# Stable schemas
796e38e275a1587b5a711a4b4508cb69825448b70e79b14bdb4256b24688b89d schema/schema.json
f242b95def9a9cbfddd2db1a45d8d3d489ad1b4f564a1322547c90a94c647637 schema/meta.json

# Unstable schemas
4a886716877f97bc24c4c7f1ae24c9ad06a779107afbdf0718110fc50b5135b7 schema/schema.unstable.json
8ad80116767e0921970b28766c214d7921268653544d5996a8e2814e1244d4d2 schema/meta.unstable.json
1 change: 1 addition & 0 deletions acp-model/.schema-revision
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e23620fe29cb24555db8fb8b58b641b680788e5f
70 changes: 70 additions & 0 deletions acp-model/SCHEMA_VERSION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# ACP Schema Version

This file tracks the version of the Agent Client Protocol schema that the model classes are based on.

## Schema Source
- Repository: https://github.com/agentclientprotocol/agent-client-protocol
- Branch: main
- Release: v0.9.1

## Schema Files

### Stable Schema
- **schema.json**
- Commit: `e23620fe29cb24555db8fb8b58b641b680788e5f`
- Date: 2025-12-01 17:17:19 +0100
- SHA256: `796e38e275a1587b5a711a4b4508cb69825448b70e79b14bdb4256b24688b89d`
- URL: https://github.com/agentclientprotocol/agent-client-protocol/blob/main/schema/schema.json

- **meta.json**
- Commit: `e23620fe29cb24555db8fb8b58b641b680788e5f`
- Date: 2025-12-01 17:17:19 +0100
- SHA256: `f242b95def9a9cbfddd2db1a45d8d3d489ad1b4f564a1322547c90a94c647637`
- URL: https://github.com/agentclientprotocol/agent-client-protocol/blob/main/schema/meta.json

### Unstable Schema
- **schema.unstable.json**
- Commit: `e23620fe29cb24555db8fb8b58b641b680788e5f`
- Date: 2025-12-01 17:17:19 +0100
- SHA256: `4a886716877f97bc24c4c7f1ae24c9ad06a779107afbdf0718110fc50b5135b7`
- URL: https://github.com/agentclientprotocol/agent-client-protocol/blob/main/schema/schema.unstable.json

- **meta.unstable.json**
- Commit: `e23620fe29cb24555db8fb8b58b641b680788e5f`
- Date: 2025-12-01 17:17:19 +0100
- SHA256: `8ad80116767e0921970b28766c214d7921268653544d5996a8e2814e1244d4d2`
- URL: https://github.com/agentclientprotocol/agent-client-protocol/blob/main/schema/meta.unstable.json

**Note:** All types from unstable schema must be marked with `@UnstableApi` annotation.

## Last Updated
- Date: 2025-12-01
- Updated by: Manual schema synchronization

## Changes in This Version
- Added `Implementation` type for client/agent identification
- Added `SessionCapabilities` type (empty, for future expansion)
- Added `clientInfo` field to `InitializeRequest`
- Added `agentInfo` field to `InitializeResponse`
- Added `sessionCapabilities` field to `AgentCapabilities`
- Changed `AvailableCommandInput` from data class to sealed class with `Unstructured` variant
- Added `_meta` field to `ToolCallContent.Terminal`
- Terminal types are now stable (removed unstable warning)

## Verification
To verify the schema files match:
```bash
# Stable schemas
curl -s https://raw.githubusercontent.com/agentclientprotocol/agent-client-protocol/main/schema/schema.json | sha256sum
# Expected: 796e38e275a1587b5a711a4b4508cb69825448b70e79b14bdb4256b24688b89d

curl -s https://raw.githubusercontent.com/agentclientprotocol/agent-client-protocol/main/schema/meta.json | sha256sum
# Expected: f242b95def9a9cbfddd2db1a45d8d3d489ad1b4f564a1322547c90a94c647637

# Unstable schemas
curl -s https://raw.githubusercontent.com/agentclientprotocol/agent-client-protocol/main/schema/schema.unstable.json | sha256sum
# Expected: 4a886716877f97bc24c4c7f1ae24c9ad06a779107afbdf0718110fc50b5135b7

curl -s https://raw.githubusercontent.com/agentclientprotocol/agent-client-protocol/main/schema/meta.unstable.json | sha256sum
# Expected: 8ad80116767e0921970b28766c214d7921268653544d5996a8e2814e1244d4d2
```
Loading
Loading