diff --git a/CHANGELOG.md b/CHANGELOG.md index 97b181dd..96de2297 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,11 @@ changes accumulate. Track in-flight protocol changes via PRs touching - `SessionSummary._meta` optional provider metadata field for lightweight session-list presentation hints. +- `JsonPrimitive` type alias (`string | number | boolean | null`) in `types/common/state.ts`. + +### Changed + +- `ConfigPropertySchema.enum` now accepts `JsonPrimitive[]` instead of `string[]`, allowing numeric, boolean, and null enum values. ## [0.5.0] — Unreleased diff --git a/clients/go/CHANGELOG.md b/clients/go/CHANGELOG.md index c8a44fcd..25f962d5 100644 --- a/clients/go/CHANGELOG.md +++ b/clients/go/CHANGELOG.md @@ -19,6 +19,11 @@ tag whose matching `## [X.Y.Z]` heading is missing from this file. - `SessionSummary.Meta` (wire `_meta`) optional provider metadata field for lightweight session-list presentation hints. +### Changed + +- `ConfigPropertySchema.Enum` field is now `[]json.RawMessage` instead of `[]string`, + allowing numeric, boolean, and null enum values. + ## [0.4.0] — 2026-06-19 Implements AHP 0.4.0. diff --git a/clients/go/ahptypes/state.generated.go b/clients/go/ahptypes/state.generated.go index f7e1fce5..3581ac09 100644 --- a/clients/go/ahptypes/state.generated.go +++ b/clients/go/ahptypes/state.generated.go @@ -595,8 +595,8 @@ type ConfigPropertySchema struct { Description *string `json:"description,omitempty"` // JSON Schema: default value Default *json.RawMessage `json:"default,omitempty"` - // JSON Schema: allowed values (typically used with `string` type) - Enum []string `json:"enum,omitempty"` + // JSON Schema: allowed values. May be primitives of any JSON type. + Enum []json.RawMessage `json:"enum,omitempty"` // Display extension: human-readable label per enum value (parallel array) EnumLabels []string `json:"enumLabels,omitempty"` // Display extension: description per enum value (parallel array) @@ -916,8 +916,8 @@ type SessionConfigPropertySchema struct { Description *string `json:"description,omitempty"` // JSON Schema: default value Default *json.RawMessage `json:"default,omitempty"` - // JSON Schema: allowed values (typically used with `string` type) - Enum []string `json:"enum,omitempty"` + // JSON Schema: allowed values. May be primitives of any JSON type. + Enum []json.RawMessage `json:"enum,omitempty"` // Display extension: human-readable label per enum value (parallel array) EnumLabels []string `json:"enumLabels,omitempty"` // Display extension: description per enum value (parallel array) diff --git a/clients/kotlin/CHANGELOG.md b/clients/kotlin/CHANGELOG.md index e5ee6dd8..090cc564 100644 --- a/clients/kotlin/CHANGELOG.md +++ b/clients/kotlin/CHANGELOG.md @@ -20,6 +20,11 @@ versions (`*-SNAPSHOT`) are explicitly rejected by the publish pipeline; bump - `SessionSummary.meta` (`_meta` on the wire) optional provider metadata field for lightweight session-list presentation hints. +### Changed + +- `ConfigPropertySchema.enum` field is now `List?` instead of + `List?`, allowing numeric, boolean, and null enum values. + ## [0.4.0] — 2026-06-19 Implements AHP 0.4.0. diff --git a/clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/generated/Commands.generated.kt b/clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/generated/Commands.generated.kt index 652585dc..817d46bb 100644 --- a/clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/generated/Commands.generated.kt +++ b/clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/generated/Commands.generated.kt @@ -877,9 +877,9 @@ data class SessionConfigPropertySchema( */ val default: JsonElement? = null, /** - * JSON Schema: allowed values (typically used with `string` type) + * JSON Schema: allowed values. May be primitives of any JSON type. */ - val enum: List? = null, + val enum: List? = null, /** * Display extension: human-readable label per enum value (parallel array) */ diff --git a/clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/generated/State.generated.kt b/clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/generated/State.generated.kt index 73724ab3..98a9bdd7 100644 --- a/clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/generated/State.generated.kt +++ b/clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/generated/State.generated.kt @@ -957,9 +957,9 @@ data class ConfigPropertySchema( */ val default: JsonElement? = null, /** - * JSON Schema: allowed values (typically used with `string` type) + * JSON Schema: allowed values. May be primitives of any JSON type. */ - val enum: List? = null, + val enum: List? = null, /** * Display extension: human-readable label per enum value (parallel array) */ diff --git a/clients/rust/CHANGELOG.md b/clients/rust/CHANGELOG.md index bcccc8a4..b47bf70c 100644 --- a/clients/rust/CHANGELOG.md +++ b/clients/rust/CHANGELOG.md @@ -30,6 +30,8 @@ matching `## [X.Y.Z]` heading is missing from this file. instead of `native-tls`, dropping the OpenSSL link on Linux while still validating against the OS trust store. To keep the previous behaviour, depend on `ahp-ws` with `default-features = false, features = ["native-tls"]`. +- `ConfigPropertySchema.enum` field is now `Option>` instead of + `Option>`, allowing numeric, boolean, and null enum values. ## [0.4.0] — 2026-06-19 diff --git a/clients/rust/crates/ahp-types/src/state.rs b/clients/rust/crates/ahp-types/src/state.rs index 08893473..74483a37 100644 --- a/clients/rust/crates/ahp-types/src/state.rs +++ b/clients/rust/crates/ahp-types/src/state.rs @@ -819,9 +819,9 @@ pub struct ConfigPropertySchema { /// JSON Schema: default value #[serde(default, skip_serializing_if = "Option::is_none")] pub default: Option, - /// JSON Schema: allowed values (typically used with `string` type) + /// JSON Schema: allowed values. May be primitives of any JSON type. #[serde(default, skip_serializing_if = "Option::is_none")] - pub r#enum: Option>, + pub r#enum: Option>, /// Display extension: human-readable label per enum value (parallel array) #[serde(default, skip_serializing_if = "Option::is_none")] pub enum_labels: Option>, @@ -1209,9 +1209,9 @@ pub struct SessionConfigPropertySchema { /// JSON Schema: default value #[serde(default, skip_serializing_if = "Option::is_none")] pub default: Option, - /// JSON Schema: allowed values (typically used with `string` type) + /// JSON Schema: allowed values. May be primitives of any JSON type. #[serde(default, skip_serializing_if = "Option::is_none")] - pub r#enum: Option>, + pub r#enum: Option>, /// Display extension: human-readable label per enum value (parallel array) #[serde(default, skip_serializing_if = "Option::is_none")] pub enum_labels: Option>, diff --git a/clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Generated/Commands.generated.swift b/clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Generated/Commands.generated.swift index 1e4389b9..91d62916 100644 --- a/clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Generated/Commands.generated.swift +++ b/clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Generated/Commands.generated.swift @@ -977,8 +977,8 @@ public struct SessionConfigPropertySchema: Codable, Sendable { public var description: String? /// JSON Schema: default value public var `default`: AnyCodable? - /// JSON Schema: allowed values (typically used with `string` type) - public var `enum`: [String]? + /// JSON Schema: allowed values. May be primitives of any JSON type. + public var `enum`: [AnyCodable]? /// Display extension: human-readable label per enum value (parallel array) public var enumLabels: [String]? /// Display extension: description per enum value (parallel array) @@ -1023,7 +1023,7 @@ public struct SessionConfigPropertySchema: Codable, Sendable { title: String, description: String? = nil, `default`: AnyCodable? = nil, - `enum`: [String]? = nil, + `enum`: [AnyCodable]? = nil, enumLabels: [String]? = nil, enumDescriptions: [String]? = nil, readOnly: Bool? = nil, diff --git a/clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Generated/State.generated.swift b/clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Generated/State.generated.swift index 3cee0e9d..ce2f559b 100644 --- a/clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Generated/State.generated.swift +++ b/clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Generated/State.generated.swift @@ -677,8 +677,8 @@ public final class ConfigPropertySchema: Codable, @unchecked Sendable { public var description: String? /// JSON Schema: default value public var `default`: AnyCodable? - /// JSON Schema: allowed values (typically used with `string` type) - public var `enum`: [String]? + /// JSON Schema: allowed values. May be primitives of any JSON type. + public var `enum`: [AnyCodable]? /// Display extension: human-readable label per enum value (parallel array) public var enumLabels: [String]? /// Display extension: description per enum value (parallel array) @@ -714,7 +714,7 @@ public final class ConfigPropertySchema: Codable, @unchecked Sendable { title: String, description: String? = nil, `default`: AnyCodable? = nil, - `enum`: [String]? = nil, + `enum`: [AnyCodable]? = nil, enumLabels: [String]? = nil, enumDescriptions: [String]? = nil, readOnly: Bool? = nil, diff --git a/clients/swift/CHANGELOG.md b/clients/swift/CHANGELOG.md index 39312b98..b57ea8a9 100644 --- a/clients/swift/CHANGELOG.md +++ b/clients/swift/CHANGELOG.md @@ -22,6 +22,11 @@ the tag matches the version pinned in [`VERSION`](VERSION). - `SessionSummary.meta` (`_meta` on the wire) optional provider metadata field for lightweight session-list presentation hints. +### Changed + +- `ConfigPropertySchema.enum` field is now `[AnyCodable]?` instead of + `[String]?`, allowing numeric, boolean, and null enum values. + ## [0.4.0] — 2026-06-19 Implements AHP 0.4.0. diff --git a/clients/typescript/CHANGELOG.md b/clients/typescript/CHANGELOG.md index 8b2706e2..742e6d56 100644 --- a/clients/typescript/CHANGELOG.md +++ b/clients/typescript/CHANGELOG.md @@ -24,6 +24,12 @@ hotfix escape hatch. - `SessionSummary._meta` optional provider metadata field for lightweight session-list presentation hints. +- Exported `JsonPrimitive` type alias (`string | number | boolean | null`). + +### Changed + +- `ConfigPropertySchema.enum` field is now `JsonPrimitive[]` instead of + `string[]`, allowing numeric, boolean, and null enum values. ### Fixed diff --git a/schema/actions.schema.json b/schema/actions.schema.json index 5abb8e54..26dad004 100644 --- a/schema/actions.schema.json +++ b/schema/actions.schema.json @@ -2044,9 +2044,9 @@ "enum": { "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/JsonPrimitive" }, - "description": "JSON Schema: allowed values (typically used with `string` type)" + "description": "JSON Schema: allowed values. May be primitives of any JSON type." }, "enumLabels": { "type": "array", @@ -2753,9 +2753,9 @@ "enum": { "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/JsonPrimitive" }, - "description": "JSON Schema: allowed values (typically used with `string` type)" + "description": "JSON Schema: allowed values. May be primitives of any JSON type." }, "enumLabels": { "type": "array", @@ -5992,6 +5992,21 @@ ], "description": "A string that may optionally be rendered as Markdown.\n\n- A plain `string` is rendered as-is (no Markdown processing).\n- An object with `{ markdown: string }` is rendered with Markdown formatting." }, + "JsonPrimitive": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + {} + ], + "description": "A primitive JSON value: a string, number, boolean, or `null`." + }, "ChildCustomizationType": { "oneOf": [ {}, diff --git a/schema/commands.schema.json b/schema/commands.schema.json index 9a1d2d4c..b73882b8 100644 --- a/schema/commands.schema.json +++ b/schema/commands.schema.json @@ -1382,9 +1382,9 @@ "enum": { "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/JsonPrimitive" }, - "description": "JSON Schema: allowed values (typically used with `string` type)" + "description": "JSON Schema: allowed values. May be primitives of any JSON type." }, "enumLabels": { "type": "array", @@ -2091,9 +2091,9 @@ "enum": { "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/JsonPrimitive" }, - "description": "JSON Schema: allowed values (typically used with `string` type)" + "description": "JSON Schema: allowed values. May be primitives of any JSON type." }, "enumLabels": { "type": "array", diff --git a/schema/errors.schema.json b/schema/errors.schema.json index 6e125661..e5cdb9e4 100644 --- a/schema/errors.schema.json +++ b/schema/errors.schema.json @@ -234,9 +234,9 @@ "enum": { "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/JsonPrimitive" }, - "description": "JSON Schema: allowed values (typically used with `string` type)" + "description": "JSON Schema: allowed values. May be primitives of any JSON type." }, "enumLabels": { "type": "array", @@ -943,9 +943,9 @@ "enum": { "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/JsonPrimitive" }, - "description": "JSON Schema: allowed values (typically used with `string` type)" + "description": "JSON Schema: allowed values. May be primitives of any JSON type." }, "enumLabels": { "type": "array", diff --git a/schema/notifications.schema.json b/schema/notifications.schema.json index ddee7f3c..1a8d4a30 100644 --- a/schema/notifications.schema.json +++ b/schema/notifications.schema.json @@ -368,9 +368,9 @@ "enum": { "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/JsonPrimitive" }, - "description": "JSON Schema: allowed values (typically used with `string` type)" + "description": "JSON Schema: allowed values. May be primitives of any JSON type." }, "enumLabels": { "type": "array", @@ -1077,9 +1077,9 @@ "enum": { "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/JsonPrimitive" }, - "description": "JSON Schema: allowed values (typically used with `string` type)" + "description": "JSON Schema: allowed values. May be primitives of any JSON type." }, "enumLabels": { "type": "array", diff --git a/schema/state.schema.json b/schema/state.schema.json index 667db5d2..b9488eef 100644 --- a/schema/state.schema.json +++ b/schema/state.schema.json @@ -145,9 +145,9 @@ "enum": { "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/JsonPrimitive" }, - "description": "JSON Schema: allowed values (typically used with `string` type)" + "description": "JSON Schema: allowed values. May be primitives of any JSON type." }, "enumLabels": { "type": "array", @@ -854,9 +854,9 @@ "enum": { "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/JsonPrimitive" }, - "description": "JSON Schema: allowed values (typically used with `string` type)" + "description": "JSON Schema: allowed values. May be primitives of any JSON type." }, "enumLabels": { "type": "array", @@ -4093,6 +4093,21 @@ ], "description": "A string that may optionally be rendered as Markdown.\n\n- A plain `string` is rendered as-is (no Markdown processing).\n- An object with `{ markdown: string }` is rendered with Markdown formatting." }, + "JsonPrimitive": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + {} + ], + "description": "A primitive JSON value: a string, number, boolean, or `null`." + }, "ChildCustomizationType": { "oneOf": [ {}, diff --git a/scripts/generate-go.ts b/scripts/generate-go.ts index d152d47f..ed5c72d2 100644 --- a/scripts/generate-go.ts +++ b/scripts/generate-go.ts @@ -149,6 +149,10 @@ function mapType(tsType: string): string { if (tsType === 'object') return 'json.RawMessage'; if (tsType === 'true' || tsType === 'false') return 'bool'; + // A primitive JSON value (`string | number | boolean | null`) has no single + // Go counterpart — represent it as an arbitrary JSON value. + if (tsType === 'JsonPrimitive') return 'json.RawMessage'; + if (tsType === 'URI') return 'URI'; if (tsType === 'StringOrMarkdown') return 'StringOrMarkdown'; @@ -1849,6 +1853,7 @@ function checkExhaustiveness(project: Project): void { const knownSpecial = new Set([ 'URI', + 'JsonPrimitive', 'BaseParams', 'StringOrMarkdown', 'ToolCallState', diff --git a/scripts/generate-kotlin.ts b/scripts/generate-kotlin.ts index 81ef7077..2e10f165 100644 --- a/scripts/generate-kotlin.ts +++ b/scripts/generate-kotlin.ts @@ -128,6 +128,9 @@ function mapType(tsType: string): string { if (tsType === 'boolean') return 'Boolean'; if (tsType === 'unknown') return 'JsonElement'; if (tsType === 'object') return 'JsonElement'; + // A primitive JSON value (`string | number | boolean | null`) maps to a + // generic JSON element. + if (tsType === 'JsonPrimitive') return 'JsonElement'; if (tsType === 'true' || tsType === 'false') return 'Boolean'; // Type aliases @@ -1832,6 +1835,7 @@ function checkExhaustiveness(project: Project): void { const knownSpecial = new Set([ 'URI', // type alias for string + 'JsonPrimitive', // primitive JSON value alias; mapped to JsonElement 'BaseParams', // marker base interface; flattened into each command params struct // PingParams shape is `interface PingParams extends BaseParams { channel: 'ahp-root://' }` // (i.e. a `BaseParams` with `channel` narrowed to a string literal). We don't diff --git a/scripts/generate-rust.ts b/scripts/generate-rust.ts index b8bfd2ad..b41e0578 100644 --- a/scripts/generate-rust.ts +++ b/scripts/generate-rust.ts @@ -139,6 +139,10 @@ function mapType(tsType: string, propName?: string, containerName?: string): str if (tsType === 'object') return 'AnyValue'; if (tsType === 'true' || tsType === 'false') return 'bool'; + // A primitive JSON value (`string | number | boolean | null`) has no single + // Rust counterpart — represent it as an arbitrary JSON value. + if (tsType === 'JsonPrimitive') return 'AnyValue'; + if (tsType === 'URI') return 'Uri'; if (tsType === 'StringOrMarkdown') return 'StringOrMarkdown'; @@ -1717,6 +1721,7 @@ function checkExhaustiveness(project: Project): void { const knownSpecial = new Set([ 'URI', + 'JsonPrimitive', 'BaseParams', 'StringOrMarkdown', 'ToolCallState', diff --git a/scripts/generate-swift.ts b/scripts/generate-swift.ts index 28f325a1..fa2c53cc 100644 --- a/scripts/generate-swift.ts +++ b/scripts/generate-swift.ts @@ -97,6 +97,9 @@ function mapType(tsType: string, propName?: string, containerName?: string): str if (tsType === 'unknown') return 'AnyCodable'; if (tsType === 'object') return 'AnyCodable'; if (tsType === 'true' || tsType === 'false') return 'Bool'; + // A primitive JSON value (`string | number | boolean | null`) maps to a + // type-erased JSON value. + if (tsType === 'JsonPrimitive') return 'AnyCodable'; // Type aliases if (tsType === 'URI') return 'String'; @@ -1856,6 +1859,7 @@ function checkExhaustiveness(project: Project): void { // Types that ARE generated but via explicit non-list code paths. const knownSpecial = new Set([ 'URI', // type alias for string + 'JsonPrimitive', // primitive JSON value alias; mapped to AnyCodable 'BaseParams', // marker base interface; flattened into each command params struct 'StringOrMarkdown', // generateStringOrMarkdown() 'ToolCallState', // TOOL_CALL_STATE_UNION discriminated union diff --git a/types/common/state.ts b/types/common/state.ts index 2c86236c..a451c5f1 100644 --- a/types/common/state.ts +++ b/types/common/state.ts @@ -28,6 +28,9 @@ export type URI = string; */ export type StringOrMarkdown = string | { markdown: string }; +/** A primitive JSON value: a string, number, boolean, or `null`. */ +export type JsonPrimitive = string | number | boolean | null; + // ─── Icon ──────────────────────────────────────────────────────────────────── /** @@ -162,8 +165,8 @@ export interface ConfigPropertySchema { description?: string; /** JSON Schema: default value */ default?: unknown; - /** JSON Schema: allowed values (typically used with `string` type) */ - enum?: string[]; + /** JSON Schema: allowed values. May be primitives of any JSON type. */ + enum?: JsonPrimitive[]; /** Display extension: human-readable label per enum value (parallel array) */ enumLabels?: string[]; /** Display extension: description per enum value (parallel array) */