@ailib-official/ai-protocol 0.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/LICENSE +6 -0
  2. package/README.md +415 -0
  3. package/dist/index.json +8 -0
  4. package/dist/v1/models/ai21.json +140 -0
  5. package/dist/v1/models/baichuan.json +138 -0
  6. package/dist/v1/models/cerebras.json +147 -0
  7. package/dist/v1/models/claude.json +114 -0
  8. package/dist/v1/models/cohere.json +235 -0
  9. package/dist/v1/models/deepinfra.json +43 -0
  10. package/dist/v1/models/deepseek-chat.json +55 -0
  11. package/dist/v1/models/doubao.json +197 -0
  12. package/dist/v1/models/ernie.json +223 -0
  13. package/dist/v1/models/fireworks.json +222 -0
  14. package/dist/v1/models/gemini.json +58 -0
  15. package/dist/v1/models/gpt.json +166 -0
  16. package/dist/v1/models/grok.json +138 -0
  17. package/dist/v1/models/huggingface.json +183 -0
  18. package/dist/v1/models/hunyuan.json +255 -0
  19. package/dist/v1/models/jina.json +139 -0
  20. package/dist/v1/models/lepton.json +188 -0
  21. package/dist/v1/models/llama.json +143 -0
  22. package/dist/v1/models/minimax.json +194 -0
  23. package/dist/v1/models/mistral.json +177 -0
  24. package/dist/v1/models/moonshot.json +144 -0
  25. package/dist/v1/models/nvidia.json +212 -0
  26. package/dist/v1/models/palmyra.json +103 -0
  27. package/dist/v1/models/perplexity.json +143 -0
  28. package/dist/v1/models/qwen.json +49 -0
  29. package/dist/v1/models/replicate.json +206 -0
  30. package/dist/v1/models/sensenova.json +144 -0
  31. package/dist/v1/models/siliconflow.json +44 -0
  32. package/dist/v1/models/spark.json +173 -0
  33. package/dist/v1/models/stable-diffusion.json +161 -0
  34. package/dist/v1/models/tiangong.json +169 -0
  35. package/dist/v1/models/together.json +43 -0
  36. package/dist/v1/models/yi.json +199 -0
  37. package/dist/v1/models/zhipu.json +250 -0
  38. package/dist/v1/providers/ai21.json +215 -0
  39. package/dist/v1/providers/anthropic.json +253 -0
  40. package/dist/v1/providers/anyscale.json +115 -0
  41. package/dist/v1/providers/azure.json +188 -0
  42. package/dist/v1/providers/baichuan.json +205 -0
  43. package/dist/v1/providers/baidu.json +205 -0
  44. package/dist/v1/providers/cerebras.json +216 -0
  45. package/dist/v1/providers/cohere.json +209 -0
  46. package/dist/v1/providers/deepinfra.json +196 -0
  47. package/dist/v1/providers/deepseek.json +221 -0
  48. package/dist/v1/providers/doubao.json +209 -0
  49. package/dist/v1/providers/fireworks.json +227 -0
  50. package/dist/v1/providers/gemini.json +279 -0
  51. package/dist/v1/providers/groq.json +218 -0
  52. package/dist/v1/providers/huggingface.json +181 -0
  53. package/dist/v1/providers/hunyuan.json +198 -0
  54. package/dist/v1/providers/jina.json +202 -0
  55. package/dist/v1/providers/lepton.json +221 -0
  56. package/dist/v1/providers/minimax.json +209 -0
  57. package/dist/v1/providers/mistral.json +214 -0
  58. package/dist/v1/providers/moonshot.json +214 -0
  59. package/dist/v1/providers/nvidia.json +213 -0
  60. package/dist/v1/providers/openai.json +267 -0
  61. package/dist/v1/providers/openrouter.json +220 -0
  62. package/dist/v1/providers/perplexity.json +172 -0
  63. package/dist/v1/providers/qwen.json +231 -0
  64. package/dist/v1/providers/replicate.json +192 -0
  65. package/dist/v1/providers/sensenova.json +185 -0
  66. package/dist/v1/providers/siliconflow.json +197 -0
  67. package/dist/v1/providers/spark.json +204 -0
  68. package/dist/v1/providers/stability.json +221 -0
  69. package/dist/v1/providers/tiangong.json +207 -0
  70. package/dist/v1/providers/together.json +196 -0
  71. package/dist/v1/providers/writer.json +253 -0
  72. package/dist/v1/providers/xai.json +238 -0
  73. package/dist/v1/providers/yi.json +205 -0
  74. package/dist/v1/providers/zhipu.json +208 -0
  75. package/dist/v1/spec.json +783 -0
  76. package/dist/v2/providers/anthropic.json +372 -0
  77. package/dist/v2/providers/cohere.json +109 -0
  78. package/dist/v2/providers/deepseek.json +272 -0
  79. package/dist/v2/providers/doubao.json +260 -0
  80. package/dist/v2/providers/google.json +388 -0
  81. package/dist/v2/providers/jina.json +71 -0
  82. package/dist/v2/providers/moonshot.json +284 -0
  83. package/dist/v2/providers/openai.json +419 -0
  84. package/dist/v2/providers/qwen.json +274 -0
  85. package/dist/v2/providers/zhipu.json +257 -0
  86. package/dist/v2-alpha/providers/anthropic.json +182 -0
  87. package/dist/v2-alpha/providers/gemini.json +187 -0
  88. package/dist/v2-alpha/providers/openai.json +215 -0
  89. package/dist/v2-alpha/spec.json +644 -0
  90. package/package.json +61 -0
  91. package/schemas/spec.json +186 -0
  92. package/schemas/v1.json +1116 -0
  93. package/schemas/v2/availability.json +66 -0
  94. package/schemas/v2/capabilities.json +182 -0
  95. package/schemas/v2/capability-profile.json +174 -0
  96. package/schemas/v2/computer-use.json +222 -0
  97. package/schemas/v2/context-policy.json +148 -0
  98. package/schemas/v2/endpoint.json +2 -0
  99. package/schemas/v2/error-codes.yaml +225 -0
  100. package/schemas/v2/errors.json +250 -0
  101. package/schemas/v2/execution-metadata.json +59 -0
  102. package/schemas/v2/mcp.json +225 -0
  103. package/schemas/v2/message-roles.json +10 -0
  104. package/schemas/v2/multimodal.json +297 -0
  105. package/schemas/v2/pricing.json +14 -0
  106. package/schemas/v2/provider-contract.json +317 -0
  107. package/schemas/v2/provider.json +203 -0
  108. package/schemas/v2/regions.json +14 -0
  109. package/v1/models/ai21.yaml +97 -0
  110. package/v1/models/baichuan.yaml +95 -0
  111. package/v1/models/cerebras.yaml +99 -0
  112. package/v1/models/claude.yaml +59 -0
  113. package/v1/models/cohere.yaml +165 -0
  114. package/v1/models/deepinfra.yaml +29 -0
  115. package/v1/models/deepseek-chat.yaml +32 -0
  116. package/v1/models/doubao.yaml +129 -0
  117. package/v1/models/ernie.yaml +146 -0
  118. package/v1/models/fireworks.yaml +145 -0
  119. package/v1/models/gemini.yaml +32 -0
  120. package/v1/models/gpt.yaml +90 -0
  121. package/v1/models/grok.yaml +74 -0
  122. package/v1/models/huggingface.yaml +110 -0
  123. package/v1/models/hunyuan.yaml +164 -0
  124. package/v1/models/jina.yaml +98 -0
  125. package/v1/models/lepton.yaml +130 -0
  126. package/v1/models/llama.yaml +91 -0
  127. package/v1/models/minimax.yaml +132 -0
  128. package/v1/models/mistral.yaml +100 -0
  129. package/v1/models/moonshot.yaml +97 -0
  130. package/v1/models/nvidia.yaml +118 -0
  131. package/v1/models/palmyra.yaml +59 -0
  132. package/v1/models/perplexity.yaml +97 -0
  133. package/v1/models/qwen.yaml +27 -0
  134. package/v1/models/replicate.yaml +136 -0
  135. package/v1/models/sensenova.yaml +97 -0
  136. package/v1/models/siliconflow.yaml +29 -0
  137. package/v1/models/spark.yaml +114 -0
  138. package/v1/models/stable-diffusion.yaml +113 -0
  139. package/v1/models/tiangong.yaml +114 -0
  140. package/v1/models/together.yaml +29 -0
  141. package/v1/models/yi.yaml +132 -0
  142. package/v1/models/zhipu.yaml +163 -0
  143. package/v1/providers/ai21.yaml +176 -0
  144. package/v1/providers/anthropic.yaml +209 -0
  145. package/v1/providers/anyscale.yaml +106 -0
  146. package/v1/providers/azure.yaml +155 -0
  147. package/v1/providers/baichuan.yaml +168 -0
  148. package/v1/providers/baidu.yaml +173 -0
  149. package/v1/providers/cerebras.yaml +178 -0
  150. package/v1/providers/cohere.yaml +175 -0
  151. package/v1/providers/deepinfra.yaml +156 -0
  152. package/v1/providers/deepseek.yaml +189 -0
  153. package/v1/providers/doubao.yaml +172 -0
  154. package/v1/providers/fireworks.yaml +187 -0
  155. package/v1/providers/gemini.yaml +229 -0
  156. package/v1/providers/groq.yaml +181 -0
  157. package/v1/providers/huggingface.yaml +157 -0
  158. package/v1/providers/hunyuan.yaml +162 -0
  159. package/v1/providers/jina.yaml +171 -0
  160. package/v1/providers/lepton.yaml +183 -0
  161. package/v1/providers/minimax.yaml +172 -0
  162. package/v1/providers/mistral.yaml +186 -0
  163. package/v1/providers/moonshot.yaml +176 -0
  164. package/v1/providers/nvidia.yaml +172 -0
  165. package/v1/providers/openai.yaml +224 -0
  166. package/v1/providers/openrouter.yaml +181 -0
  167. package/v1/providers/perplexity.yaml +144 -0
  168. package/v1/providers/qwen.yaml +192 -0
  169. package/v1/providers/replicate.yaml +159 -0
  170. package/v1/providers/sensenova.yaml +153 -0
  171. package/v1/providers/siliconflow.yaml +156 -0
  172. package/v1/providers/spark.yaml +167 -0
  173. package/v1/providers/stability.yaml +185 -0
  174. package/v1/providers/tiangong.yaml +170 -0
  175. package/v1/providers/together.yaml +156 -0
  176. package/v1/providers/writer.yaml +212 -0
  177. package/v1/providers/xai.yaml +206 -0
  178. package/v1/providers/yi.yaml +168 -0
  179. package/v1/providers/zhipu.yaml +171 -0
  180. package/v1/spec.yaml +637 -0
  181. package/v2/providers/anthropic.yaml +244 -0
  182. package/v2/providers/cohere.yaml +75 -0
  183. package/v2/providers/deepseek.yaml +176 -0
  184. package/v2/providers/doubao.yaml +169 -0
  185. package/v2/providers/google.yaml +245 -0
  186. package/v2/providers/jina.yaml +55 -0
  187. package/v2/providers/moonshot.yaml +186 -0
  188. package/v2/providers/openai.yaml +266 -0
  189. package/v2/providers/qwen.yaml +174 -0
  190. package/v2/providers/zhipu.yaml +176 -0
  191. package/v2-alpha/providers/anthropic.yaml +134 -0
  192. package/v2-alpha/providers/gemini.yaml +144 -0
  193. package/v2-alpha/providers/openai.yaml +154 -0
  194. package/v2-alpha/spec.yaml +512 -0
@@ -0,0 +1,512 @@
1
+ # ==============================================================================
2
+ # AI-Protocol V2 Manifest Specification
3
+ # Concentric Circle Model
4
+ # ==============================================================================
5
+ #
6
+ # This document formally specifies the V2 provider manifest structure using the
7
+ # "Concentric Circle" model. Each ring builds upon the inner one: Ring 1 is
8
+ # mandatory for all manifests, Ring 2 adds capability-specific configuration,
9
+ # and Ring 3 provides optional advanced extensions.
10
+ #
11
+ # Experimental multimodal and RTC extensions are documented in the forward-looking
12
+ # section at the end.
13
+ #
14
+ # ==============================================================================
15
+
16
+ version: "2.0-alpha"
17
+ metadata:
18
+ description: "AI-Protocol V2 Manifest Specification - Concentric Circle Model"
19
+ last_updated: "2026-02-14"
20
+ authors: ["AI-Protocol Team"]
21
+ license: "MIT OR Apache-2.0"
22
+ schema_ref: "schemas/v2/provider.json"
23
+
24
+ # ==============================================================================
25
+ # Ring 1: Core Skeleton (Required)
26
+ # ==============================================================================
27
+ # Every V2 manifest MUST contain Ring 1. This is the minimal valid manifest.
28
+ # Runtimes MUST reject manifests that fail Ring 1 validation.
29
+ # ==============================================================================
30
+
31
+ ring_1_core:
32
+ description: |
33
+ Required fields for all V2 manifests. Defines the provider identity,
34
+ endpoint configuration, and error classification. No capability-specific
35
+ or advanced configuration is required at this level.
36
+ required_fields:
37
+ - id
38
+ - protocol_version
39
+ - endpoint
40
+ - error_classification
41
+ schema_ref: "schemas/v2/provider.json"
42
+ validation_rules:
43
+ - "id MUST be unique across providers; pattern ^[a-z0-9][a-z0-9-_]{1,63}$"
44
+ - "protocol_version MUST be '2.0'"
45
+ - "endpoint.base_url MUST be a valid HTTPS URL (or HTTP for local dev)"
46
+ - "endpoint.chat MUST specify the chat completions path"
47
+ - "endpoint.auth MUST specify type and header (or param_name for query_param)"
48
+ - "error_classification.by_http_status MUST map at least 400, 401, 429, 500"
49
+ - "All mapped error names MUST reference standard error codes (see schemas/v2/errors.json)"
50
+ example:
51
+ id: "openai"
52
+ protocol_version: "2.0"
53
+ endpoint:
54
+ base_url: "https://api.openai.com/v1"
55
+ chat: "/chat/completions"
56
+ auth:
57
+ type: "bearer"
58
+ header: "Authorization"
59
+ prefix: "Bearer"
60
+ error_classification:
61
+ by_http_status:
62
+ "400": "invalid_request"
63
+ "401": "authentication"
64
+ "403": "permission_denied"
65
+ "404": "not_found"
66
+ "429": "rate_limited"
67
+ "500": "server_error"
68
+ "503": "overloaded"
69
+ optional_ring_1_fields:
70
+ name: "Human-readable provider name"
71
+ status: "stable | beta | deprecated (default: stable)"
72
+ category: "ai_provider | model_provider | third_party_aggregator"
73
+ official_url: "Documentation URL"
74
+ support_contact: "Support URL"
75
+
76
+ # ==============================================================================
77
+ # Standard Error Codes (Reference)
78
+ # ==============================================================================
79
+ # Runtimes map provider errors to these standard codes. See schemas/v2/errors.json
80
+ # and schemas/v2/error-codes.yaml for full definitions.
81
+ # ==============================================================================
82
+
83
+ standard_error_codes:
84
+ reference: "schemas/v2/error-codes.yaml"
85
+ reference_schema: "schemas/v2/errors.json"
86
+ summary:
87
+ client:
88
+ - "invalid_request (E1001) — 400"
89
+ - "authentication (E1002) — 401"
90
+ - "permission_denied (E1003) — 403"
91
+ - "not_found (E1004) — 404"
92
+ - "request_too_large (E1005) — 413"
93
+ rate:
94
+ - "rate_limited (E2001) — 429"
95
+ - "quota_exhausted (E2002) — 429"
96
+ server:
97
+ - "server_error (E3001) — 500"
98
+ - "overloaded (E3002) — 503"
99
+ - "timeout (E3003) — 504, 408"
100
+ operational:
101
+ - "conflict (E4001) — 409"
102
+ - "cancelled (E4002) — N/A"
103
+ unknown:
104
+ - "unknown (E9999) — varies"
105
+ minimum_required_mappings:
106
+ - "400 -> invalid_request"
107
+ - "401 -> authentication"
108
+ - "429 -> rate_limited"
109
+ - "500 -> server_error"
110
+ extended_classification:
111
+ description: "Providers MAY add by_error_code and by_error_message for finer mapping"
112
+ by_error_code:
113
+ example:
114
+ context_length_exceeded: "request_too_large"
115
+ model_not_found: "not_found"
116
+ rate_limit_exceeded: "rate_limited"
117
+ by_error_message:
118
+ description: "Pattern-based mapping when provider error body lacks structured code"
119
+
120
+ # ==============================================================================
121
+ # Standard Message Roles (Reference)
122
+ # ==============================================================================
123
+ # Runtimes use these canonical roles for message building and role_mapping in
124
+ # provider contracts. All major LLMs (OpenAI, Anthropic, Gemini, etc.) support
125
+ # this set. See schemas/v2/provider-contract.json role_mapping.
126
+ # ==============================================================================
127
+
128
+ standard_message_roles:
129
+ schema_ref: "schemas/v2/message-roles.json"
130
+ description: |
131
+ Canonical message roles for chat. Runtimes MUST support these roles when
132
+ building messages and mapping to provider-specific formats.
133
+ roles:
134
+ system:
135
+ description: "System instructions; availability controlled by feature_flags.system_messages"
136
+ capability: "text (default true)"
137
+ user:
138
+ description: "User input messages"
139
+ capability: "text (always)"
140
+ assistant:
141
+ description: "Model responses, including tool_call content when tools capability is enabled"
142
+ capability: "text (always)"
143
+ tool:
144
+ description: "Tool result messages for multi-turn tool calling; pairs with assistant tool_calls"
145
+ capability: "tools"
146
+ validation_rules:
147
+ - "role_mapping in provider contract MUST map each used role to provider-specific role string"
148
+ - "tool role is only valid when tools capability is declared"
149
+ - "system role MAY be disabled via feature_flags.system_messages"
150
+
151
+ # ==============================================================================
152
+ # Ring 2: Capability Mapping (Conditional)
153
+ # ==============================================================================
154
+ # Ring 2 sections are present when the provider supports the corresponding
155
+ # capability. Each capability block is validated only when that capability
156
+ # is declared in capabilities.required or capabilities.optional.
157
+ # ==============================================================================
158
+
159
+ ring_2_capabilities:
160
+ description: |
161
+ Capability-specific configuration. Sections under Ring 2 are conditional:
162
+ - capabilities: Declares what the provider supports; required when Ring 2 is used
163
+ - streaming: Required when streaming is in capabilities
164
+ - parameters: Optional parameter definitions (temperature, max_tokens, etc.)
165
+ - tools: Optional when tools capability is declared
166
+ - multimodal: Optional when vision/audio/video is declared
167
+ - capability_profile: Experimental staged metadata profile (IOS phase only in current rollout)
168
+ schema_ref: "schemas/v2/capabilities.json"
169
+ validation_rules:
170
+ - "capabilities.required MUST include 'text' for chat providers"
171
+ - "When streaming in capabilities, streaming.decoder MUST be present"
172
+ - "Capability names MUST be from standard_capabilities list"
173
+ - "Unknown capabilities MUST be ignored (not rejected)"
174
+ - "capability_profile is optional and currently limited to Inputs/Outcomes/Systems (IOS phase)"
175
+ - "process/contract fields are reserved for later phases and MUST NOT be used in IOS phase manifests"
176
+
177
+ # --- Standard Capabilities ---
178
+ standard_capabilities:
179
+ text: "Basic text chat (always required for chat providers)"
180
+ streaming: "Server-sent event streaming"
181
+ vision: "Image input support"
182
+ audio: "Audio input/output"
183
+ video: "Video input/output"
184
+ tools: "Function/tool calling"
185
+ parallel_tools: "Parallel tool invocations in single response"
186
+ agentic: "Multi-turn agent reasoning"
187
+ reasoning: "Extended thinking / chain-of-thought"
188
+ embeddings: "Embedding generation"
189
+ structured_output: "JSON mode / schema-constrained output"
190
+ batch: "Batch request API"
191
+ image_generation: "Image generation from prompts"
192
+ computer_use: "Computer use / GUI automation (screen control, mouse, keyboard)"
193
+ mcp_client: "MCP client — connect to external MCP servers for tools/resources"
194
+ mcp_server: "MCP server — expose provider capabilities via MCP protocol"
195
+ stt: "Speech-to-text transcription"
196
+ tts: "Text-to-speech synthesis"
197
+ rerank: "Document reranking by relevance"
198
+
199
+ # --- Capability Module Mapping ---
200
+ capability_module_mapping:
201
+ description: "Maps capability names to runtime protocol modules"
202
+ table:
203
+ text: { module: "Core (always loaded)", feature_rust: "default", extra_python: "default" }
204
+ streaming: { module: "streaming.*", feature_rust: "default", extra_python: "default" }
205
+ vision: { module: "multimodal.vision", feature_rust: "vision", extra_python: "vision" }
206
+ audio: { module: "multimodal.audio", feature_rust: "audio", extra_python: "audio" }
207
+ video: { module: "multimodal.video", feature_rust: "video", extra_python: "video" }
208
+ tools: { module: "tools.*", feature_rust: "default", extra_python: "default" }
209
+ parallel_tools: { module: "tools.parallel", feature_rust: "default", extra_python: "default" }
210
+ agentic: { module: "agentic.*", feature_rust: "agentic", extra_python: "agentic" }
211
+ reasoning: { module: "reasoning.*", feature_rust: "reasoning", extra_python: "reasoning" }
212
+ embeddings: { module: "embeddings.*", feature_rust: "embeddings", extra_python: "embeddings" }
213
+ structured_output: { module: "structured.*", feature_rust: "structured", extra_python: "structured" }
214
+ batch: { module: "batch.*", feature_rust: "batch", extra_python: "batch" }
215
+ image_generation: { module: "generation.image", feature_rust: "image_gen", extra_python: "image_gen" }
216
+ computer_use: { module: "computer_use.*", feature_rust: "computer_use", extra_python: "computer_use" }
217
+ mcp_client: { module: "mcp.client", feature_rust: "mcp", extra_python: "mcp" }
218
+ mcp_server: { module: "mcp.server", feature_rust: "mcp", extra_python: "mcp" }
219
+ stt: { module: "stt.*", feature_rust: "stt", extra_python: "stt" }
220
+ tts: { module: "tts.*", feature_rust: "tts", extra_python: "tts" }
221
+ rerank: { module: "rerank.*", feature_rust: "reranking", extra_python: "reranking" }
222
+
223
+ # --- Feature Flags ---
224
+ feature_flags:
225
+ description: "Fine-grained toggles within capabilities; see capabilities.feature_flags"
226
+ standard_flags:
227
+ structured_output: "Enable JSON mode / schema-constrained output"
228
+ parallel_tool_calls: "Enable parallel tool invocations"
229
+ extended_thinking: "Enable thinking/reasoning blocks"
230
+ streaming_usage: "Report token usage during streaming"
231
+ system_messages: "Support system role (default true)"
232
+ image_generation: "Support image generation from prompts"
233
+
234
+ # --- Ring 2 Example ---
235
+ example:
236
+ capabilities:
237
+ required: [text, streaming]
238
+ optional: [vision, tools, parallel_tools]
239
+ streaming:
240
+ decoder:
241
+ format: "sse"
242
+ strategy: "openai_chat"
243
+ event_map:
244
+ - match: "$.choices[0].delta.content"
245
+ emit: "PartialContentDelta"
246
+ extract:
247
+ content: "$.choices[0].delta.content"
248
+ - match: "$.choices[0].finish_reason"
249
+ emit: "StreamEnd"
250
+ extract:
251
+ finish_reason: "$.choices[0].finish_reason"
252
+ parameters:
253
+ temperature: { type: float, range: [0.0, 2.0] }
254
+ max_tokens: { type: integer, min: 1 }
255
+
256
+ # ==============================================================================
257
+ # Ring 3: Advanced Extensions (Optional)
258
+ # ==============================================================================
259
+ # Ring 3 sections are always optional. Runtimes load them when present and
260
+ # gracefully ignore when absent. Unknown Ring 3 extensions MUST be ignored.
261
+ # ==============================================================================
262
+
263
+ ring_3_extensions:
264
+ description: |
265
+ Advanced, cross-cutting extensions. None are required. Providers include
266
+ these when they offer the corresponding functionality.
267
+ validation_rules:
268
+ - "All Ring 3 sections are optional"
269
+ - "Unknown extension keys MUST be ignored"
270
+ - "Invalid values in known extensions SHOULD produce warnings, not rejection"
271
+
272
+ # --- Standard Extensions ---
273
+ standard_extensions:
274
+ guardrails:
275
+ description: "Input/output content filters"
276
+ schema_hint:
277
+ input_filters: "List of filter configs (content_safety, pii_detection, etc.)"
278
+ output_filters: "List of filter configs"
279
+ example:
280
+ input_filters:
281
+ - type: "content_safety"
282
+ action: "block" # block | warn | log
283
+ - type: "pii_detection"
284
+ action: "mask" # mask | block
285
+ output_filters:
286
+ - type: "content_safety"
287
+ action: "block" # block | warn
288
+
289
+ rate_limit_headers:
290
+ description: "HTTP header names for rate limit information"
291
+ fields:
292
+ requests_limit: "e.g., x-ratelimit-limit-requests"
293
+ requests_remaining: "e.g., x-ratelimit-remaining-requests"
294
+ tokens_limit: "e.g., x-ratelimit-limit-tokens"
295
+ tokens_remaining: "e.g., x-ratelimit-remaining-tokens"
296
+ retry_after: "retry-after"
297
+ example:
298
+ requests_limit: "x-ratelimit-limit-requests"
299
+ requests_remaining: "x-ratelimit-remaining-requests"
300
+
301
+ retry_policy:
302
+ description: "Retry strategy for transient failures"
303
+ fields:
304
+ strategy: "exponential_backoff | linear_backoff | fixed_delay"
305
+ max_retries: "integer (default 3)"
306
+ min_delay_ms: "integer"
307
+ max_delay_ms: "integer"
308
+ jitter: "full | equal | none"
309
+ retry_on_http_status: "[429, 500, 502, 503]"
310
+ retry_on_error_code: "['rate_limited', 'server_error', 'overloaded']"
311
+ example:
312
+ strategy: "exponential_backoff"
313
+ max_retries: 3
314
+ min_delay_ms: 1000
315
+ max_delay_ms: 30000
316
+ jitter: "full"
317
+
318
+ termination:
319
+ description: "Finish reason / termination normalization"
320
+ fields:
321
+ source_field: "JSONPath to provider finish_reason"
322
+ mapping: "Provider value -> standard reason"
323
+
324
+ context_policy:
325
+ description: "Context window and usage policies (future)"
326
+
327
+ routing:
328
+ description: "Request routing hints (future)"
329
+
330
+ telemetry:
331
+ description: "Observability and tracing configuration (future)"
332
+
333
+ # --- Ring 3 Example ---
334
+ example:
335
+ guardrails:
336
+ input_filters: []
337
+ output_filters: []
338
+ rate_limit_headers:
339
+ requests_limit: "x-ratelimit-limit-requests"
340
+ retry_policy:
341
+ strategy: "exponential_backoff"
342
+ max_retries: 3
343
+
344
+ # ==============================================================================
345
+ # Validation Rules (Summary)
346
+ # ==============================================================================
347
+
348
+ validation:
349
+ ring_1_complete: "Ring 1 MUST pass before Ring 2 is evaluated; invalid Ring 1 = reject manifest"
350
+ ring_2_conditional: "Ring 2 sections only validated when corresponding capability is declared"
351
+ ring_3_optional: "Ring 3 sections are always optional; invalid values SHOULD warn, not fail"
352
+ unknown_fields: "Unknown top-level and nested fields MUST be ignored (not rejected)"
353
+ backward_compatibility:
354
+ - "V2 runtimes MUST accept valid V1 manifests (promote with defaults)"
355
+ - "New optional fields MAY be added in 2.x; MUST NOT break existing manifests"
356
+ - "Breaking changes require protocol_version bump to 3.0"
357
+
358
+ # ==============================================================================
359
+ # Migration from V1
360
+ # ==============================================================================
361
+
362
+ migration:
363
+ from_v1:
364
+ description: "V1 manifests are auto-promoted to V2; runtimes detect protocol_version"
365
+ mapping:
366
+ - v1_field: "protocol_version"
367
+ v2_field: "protocol_version"
368
+ notes: "Update value from '1.5' to '2.0'"
369
+ - v1_field: "base_url"
370
+ v2_field: "endpoint.base_url"
371
+ notes: "Nested under endpoint"
372
+ - v1_field: "chat_path"
373
+ v2_field: "endpoint.chat"
374
+ notes: "Rename to chat"
375
+ - v1_field: "capabilities (flat list)"
376
+ v2_field: "capabilities.required / capabilities.optional"
377
+ notes: "Split into required and optional"
378
+ - v1_field: "error_classification"
379
+ v2_field: "error_classification"
380
+ notes: "Unchanged; extend with standard error codes"
381
+ - v1_field: "streaming"
382
+ v2_field: "streaming"
383
+ notes: "Unchanged structure; new event types added"
384
+ - v1_field: "parameters (in spec)"
385
+ v2_field: "parameters (per-provider)"
386
+ notes: "More flexibility for per-provider overrides"
387
+ compatibility_notes:
388
+ - "V2 runtimes MUST continue to support V1 manifests"
389
+ - "V1 manifests are promoted with defaults for new required fields"
390
+ - "Runtimes detect version via protocol_version field"
391
+
392
+ # ==============================================================================
393
+ # Backward Compatibility Notes
394
+ # ==============================================================================
395
+
396
+ backward_compatibility:
397
+ v1_support: "V2 runtimes MUST accept and correctly handle V1 manifests"
398
+ v1_promotion:
399
+ - "Missing endpoint.auth: infer bearer + Authorization from provider conventions"
400
+ - "Flat capabilities list: treat as capabilities.required"
401
+ - "Missing error_classification.by_http_status: use provider-agnostic defaults"
402
+ extensibility:
403
+ - "New capability names MAY be added; runtimes MUST ignore unknown capabilities"
404
+ - "New Ring 3 extensions MAY be added; runtimes MUST ignore unknown extensions"
405
+ - "New optional fields in existing schemas MUST have sensible defaults"
406
+
407
+ # ==============================================================================
408
+ # Experimental Extensions (Forward-Looking)
409
+ # ==============================================================================
410
+ # The following sections describe experimental features beyond the current
411
+ # three-ring model. These are not part of the core specification and may
412
+ # change or be incorporated into future rings.
413
+ # ==============================================================================
414
+
415
+ experimental:
416
+ description: |
417
+ Experimental multimodal, real-time, and schema-less extensions.
418
+ Subject to change. Implementations MAY support these but MUST NOT require them.
419
+ status: "alpha / incubating"
420
+
421
+ # --- 1. Multimodal Interleave Operators ---
422
+ multimodal_interleave:
423
+ description: "Simultaneous decoding of multiple content streams"
424
+ frame_interleave:
425
+ operators:
426
+ - "audio_frame"
427
+ - "video_frame"
428
+ - "text_delta"
429
+ - "image_generation_progress"
430
+ synchronization:
431
+ timestamp_alignment: "utc_microseconds"
432
+ frame_rate_matching: "adaptive"
433
+ buffer_strategy: "sliding_window"
434
+ content_fusion:
435
+ fusion_rules:
436
+ - match: ["audio_frame", "text_delta"]
437
+ operator: "speech_to_text_alignment"
438
+ - match: ["video_frame", "text_delta"]
439
+ operator: "visual_captioning"
440
+ - match: ["image_generation_progress", "text_delta"]
441
+ operator: "progress_annotation"
442
+
443
+ # --- 2. Real-time Actions (RTC Events) ---
444
+ rtc_events:
445
+ description: "Agent state sync and tool streaming across UI boundaries"
446
+ state_sync:
447
+ operators:
448
+ - "agent_state_delta"
449
+ - "ui_state_mirror"
450
+ - "action_confirmation"
451
+ state_model:
452
+ internal_monologue: "observable_stream"
453
+ working_memory: "shared_buffer"
454
+ action_queue: "priority_fifo"
455
+ tool_streaming:
456
+ execution_feedback:
457
+ - "tool_started"
458
+ - "tool_progress"
459
+ - "tool_partial_result"
460
+ - "tool_completed"
461
+ - "tool_error"
462
+ coordination:
463
+ parallel_execution: true
464
+ dependency_resolution: "dynamic"
465
+ rollback_support: true
466
+
467
+ # --- 3. Schema-less Mapping Extensions ---
468
+ schema_less_mapping:
469
+ description: "Dynamic field mapping and type inference"
470
+ dynamic_fields:
471
+ strategy: "auto_discover"
472
+ validation: "permissive"
473
+ metadata_extraction: "intelligent"
474
+ type_inference:
475
+ primitives: ["string", "number", "boolean", "null"]
476
+ complex_types: ["array", "object", "binary"]
477
+ custom_types: ["datetime", "uuid", "uri"]
478
+ extra_metadata:
479
+ storage: "key_value_store"
480
+ indexing: "full_text"
481
+ querying: "json_path"
482
+
483
+ # --- 4. Advanced Streaming Events (V2 Additions) ---
484
+ streaming_events_v2:
485
+ supported_events:
486
+ - "PartialContentDelta"
487
+ - "ThinkingDelta"
488
+ - "PartialToolCall"
489
+ - "ToolCallStarted"
490
+ - "ToolCallEnded"
491
+ - "MultimodalFrame"
492
+ - "AgentStateSync"
493
+ - "ToolExecutionFeedback"
494
+ - "SchemaLessField"
495
+ event_correlation:
496
+ session_id: "uuid_v4"
497
+ sequence_number: "incremental"
498
+ causal_dependencies: "vector_clock"
499
+
500
+ # --- 5. Performance and Reliability Extensions ---
501
+ performance:
502
+ adaptive_batching:
503
+ strategy: "latency_optimized"
504
+ max_batch_size: 32
505
+ timeout_ms: 100
506
+ circuit_breaker:
507
+ failure_threshold: 0.5
508
+ recovery_timeout_ms: 30000
509
+ monitoring_window_ms: 60000
510
+ qos:
511
+ priority_levels: ["realtime", "interactive", "batch"]
512
+ sla_guarantees: ["latency", "throughput", "reliability"]