| 1 | // Code generated by cmd/extension-protocol-gen; DO NOT EDIT. |
| 2 | |
| 3 | // Package extension: Extension Protocol v1 wire DTOs, enums, method |
| 4 | // names, frozen limits, and the frozen error table, mirrored from the |
| 5 | // host's internal/extension/protocol package. Behavior (validators, |
| 6 | // error constructors, helpers) lives in the handwritten files. |
| 7 | package extension |
| 8 | |
| 9 | import "encoding/json" |
| 10 | |
| 11 | // ProtocolID is the immutable identity string peers exchange during the |
| 12 | // initialize handshake. |
| 13 | const ProtocolID = "reasonix.extension.v1" |
| 14 | |
| 15 | // ProtocolMajor is the frozen major version of this protocol build. |
| 16 | const ProtocolMajor = 1 |
| 17 | |
| 18 | // ProtocolVersion is the wire string form of ProtocolMajor carried in the |
| 19 | // initialize handshake. |
| 20 | const ProtocolVersion = "1" |
| 21 | |
| 22 | // Frozen wire limits. These constants are part of the protocol contract. |
| 23 | const ( |
| 24 | // FrameBytes caps one JSON-RPC frame on the extension transport. |
| 25 | FrameBytes = 8388608 |
| 26 | // ExternalizeFieldBytes is the threshold above which an externalizable |
| 27 | // payload must move into a content ref instead of traveling inline. |
| 28 | ExternalizeFieldBytes = 65536 |
| 29 | // ContentRefChunkBytes caps one host/content/read chunk. |
| 30 | ContentRefChunkBytes = 262144 |
| 31 | // ContentRefObjectBytes caps one externalized object. |
| 32 | ContentRefObjectBytes = 8388608 |
| 33 | ) |
| 34 | |
| 35 | // Method names, frozen for Extension Protocol v1. |
| 36 | const ( |
| 37 | MethodExtensionEvent = "extension/event" |
| 38 | MethodExtensionInitialize = "extension/initialize" |
| 39 | MethodExtensionInitialized = "extension/initialized" |
| 40 | MethodExtensionIntercept = "extension/intercept" |
| 41 | MethodExtensionProviderCatalog = "extension/provider/catalog" |
| 42 | MethodExtensionProviderStreamCancel = "extension/provider/stream/cancel" |
| 43 | MethodExtensionProviderStreamChunk = "extension/provider/stream/chunk" |
| 44 | MethodExtensionProviderStreamEnd = "extension/provider/stream/end" |
| 45 | MethodExtensionProviderStreamOpen = "extension/provider/stream/open" |
| 46 | MethodExtensionResourcesChanged = "extension/resources/changed" |
| 47 | MethodExtensionShutdown = "extension/shutdown" |
| 48 | MethodExtensionUIAction = "extension/ui/action" |
| 49 | MethodExtensionUISubmit = "extension/ui/submit" |
| 50 | MethodHostContentRead = "host/content/read" |
| 51 | MethodHostUIPublish = "host/ui/publish" |
| 52 | MethodHostUIRequest = "host/ui/request" |
| 53 | ) |
| 54 | |
| 55 | // DomainErrorCode is the JSON-RPC code every extension domain error uses on |
| 56 | // the wire. The structured ProtocolErrorData reason distinguishes them. |
| 57 | const DomainErrorCode = -32000 |
| 58 | |
| 59 | // errorSpec is one frozen error table entry: the JSON-RPC code, the |
| 60 | // generic wire message, and whether the call may be retried. |
| 61 | type errorSpec struct { |
| 62 | Code int |
| 63 | Message string |
| 64 | Retryable bool |
| 65 | } |
| 66 | |
| 67 | // frozenErrorSpecs mirrors the host's frozen error table. Adding an entry |
| 68 | // is a conscious protocol change. |
| 69 | var frozenErrorSpecs = map[ErrorReason]errorSpec{ |
| 70 | ErrCapabilityNotDeclared: {DomainErrorCode, "The extension used a capability its manifest did not declare.", false}, |
| 71 | ErrContentRefExpired: {DomainErrorCode, "The referenced content has expired.", true}, |
| 72 | ErrFrameTooLarge: {DomainErrorCode, "The frame exceeds the frozen protocol size limit.", false}, |
| 73 | ErrInterceptTimeout: {DomainErrorCode, "The extension did not answer an intercept within its timeout.", true}, |
| 74 | ErrInternal: {CodeInternal, "An internal extension protocol error occurred.", true}, |
| 75 | ErrInvalidParams: {CodeInvalidParams, "The params do not match the registered method schema.", false}, |
| 76 | ErrProtocolError: {CodeInvalidRequest, "The extension protocol frame or envelope is invalid.", false}, |
| 77 | ErrProviderFailed: {DomainErrorCode, "The extension provider stream failed.", true}, |
| 78 | ErrProviderInterrupted: {DomainErrorCode, "The extension provider stream was interrupted.", true}, |
| 79 | ErrShutdownTimeout: {DomainErrorCode, "The extension did not shut down within the requested timeout.", true}, |
| 80 | ErrStreamCancelled: {DomainErrorCode, "The provider stream was cancelled.", false}, |
| 81 | ErrStreamGap: {DomainErrorCode, "A provider stream chunk is missing from the ordered sequence.", true}, |
| 82 | ErrUnknownMethod: {CodeMethodNotFound, "The method is not registered in Extension Protocol v1.", false}, |
| 83 | ErrUnsupportedVersion: {DomainErrorCode, "The peer's extension protocol version is not supported.", false}, |
| 84 | } |
| 85 | |
| 86 | // EventParams is a generated Extension Protocol v1 wire DTO. |
| 87 | type EventParams struct { |
| 88 | Event InterceptEvent `json:"event"` |
| 89 | Payload json.RawMessage `json:"payload" externalizable:"true"` |
| 90 | Externalized []ExternalizedField `json:"externalized,omitempty"` |
| 91 | } |
| 92 | |
| 93 | // InterceptEvent is a generated Extension Protocol v1 string enum. |
| 94 | type InterceptEvent string |
| 95 | |
| 96 | const ( |
| 97 | EventAgentBeforeStart InterceptEvent = "agent.before_start" |
| 98 | EventCompactionComplete InterceptEvent = "compaction.complete" |
| 99 | EventCompactionPrepare InterceptEvent = "compaction.prepare" |
| 100 | EventContextPrepare InterceptEvent = "context.prepare" |
| 101 | EventFrontendEvent InterceptEvent = "frontend.event" |
| 102 | EventInputReceive InterceptEvent = "input.receive" |
| 103 | EventPermissionDecision InterceptEvent = "permission.decision" |
| 104 | EventProviderRequest InterceptEvent = "provider.request" |
| 105 | EventProviderResponse InterceptEvent = "provider.response" |
| 106 | EventSessionEnd InterceptEvent = "session.end" |
| 107 | EventSessionLoad InterceptEvent = "session.load" |
| 108 | EventSessionRotate InterceptEvent = "session.rotate" |
| 109 | EventSessionSave InterceptEvent = "session.save" |
| 110 | EventSessionStart InterceptEvent = "session.start" |
| 111 | EventSystemPromptBuild InterceptEvent = "system_prompt.build" |
| 112 | EventToolAfter InterceptEvent = "tool.after" |
| 113 | EventToolBefore InterceptEvent = "tool.before" |
| 114 | ) |
| 115 | |
| 116 | // ExternalizedField is a generated Extension Protocol v1 wire DTO. |
| 117 | type ExternalizedField struct { |
| 118 | JSONPointer string `json:"jsonPointer" validate:"nonempty"` |
| 119 | ContentRef string `json:"contentRef" validate:"nonempty"` |
| 120 | TotalBytes int64 `json:"totalBytes" validate:"min=0"` |
| 121 | SHA256 string `json:"sha256" validate:"sha256"` |
| 122 | } |
| 123 | |
| 124 | // InitializeParams is a generated Extension Protocol v1 wire DTO. |
| 125 | type InitializeParams struct { |
| 126 | ProtocolVersion string `json:"protocolVersion" validate:"nonempty"` |
| 127 | ProtocolID string `json:"protocolId" validate:"nonempty"` |
| 128 | Manifest ManifestExpectation `json:"manifest"` |
| 129 | Session SessionContext `json:"session"` |
| 130 | Capabilities HostCapabilities `json:"capabilities"` |
| 131 | } |
| 132 | |
| 133 | // ManifestExpectation is a generated Extension Protocol v1 wire DTO. |
| 134 | type ManifestExpectation struct { |
| 135 | Intercepts []string `json:"intercepts,omitempty"` |
| 136 | Replaces []string `json:"replaces,omitempty"` |
| 137 | Providers []string `json:"providers,omitempty"` |
| 138 | UIActions []string `json:"uiActions,omitempty"` |
| 139 | Capabilities []string `json:"capabilities,omitempty"` |
| 140 | } |
| 141 | |
| 142 | // SessionContext is a generated Extension Protocol v1 wire DTO. |
| 143 | type SessionContext struct { |
| 144 | SessionID string `json:"sessionId" validate:"nonempty"` |
| 145 | WorkspaceRoot string `json:"workspaceRoot" validate:"nonempty"` |
| 146 | Generation uint64 `json:"generation"` |
| 147 | } |
| 148 | |
| 149 | // HostCapabilities is a generated Extension Protocol v1 wire DTO. |
| 150 | type HostCapabilities struct { |
| 151 | ContentRefs bool `json:"contentRefs"` |
| 152 | UIHost UIHostKind `json:"uiHost"` |
| 153 | ProtocolVersion string `json:"protocolVersion" validate:"nonempty"` |
| 154 | } |
| 155 | |
| 156 | // UIHostKind is a generated Extension Protocol v1 string enum. |
| 157 | type UIHostKind string |
| 158 | |
| 159 | const ( |
| 160 | UIHostTUI UIHostKind = "tui" |
| 161 | UIHostDesktop UIHostKind = "desktop" |
| 162 | UIHostACP UIHostKind = "acp" |
| 163 | UIHostHeadless UIHostKind = "headless" |
| 164 | ) |
| 165 | |
| 166 | // InitializeResult is a generated Extension Protocol v1 wire DTO. |
| 167 | type InitializeResult struct { |
| 168 | ProtocolVersion string `json:"protocolVersion" validate:"nonempty"` |
| 169 | Name string `json:"name" validate:"nonempty"` |
| 170 | Version string `json:"version" validate:"nonempty"` |
| 171 | Subscriptions []string `json:"subscriptions,omitempty"` |
| 172 | Replaces []string `json:"replaces,omitempty"` |
| 173 | Providers []ProviderDescriptor `json:"providers,omitempty"` |
| 174 | UIActions []UIActionDecl `json:"uiActions,omitempty"` |
| 175 | StateSchemaVersion int `json:"stateSchemaVersion" validate:"min=0"` |
| 176 | } |
| 177 | |
| 178 | // ProviderDescriptor is a generated Extension Protocol v1 wire DTO. |
| 179 | type ProviderDescriptor struct { |
| 180 | Ref string `json:"ref" validate:"nonempty"` |
| 181 | DisplayName string `json:"displayName,omitempty"` |
| 182 | Model string `json:"model,omitempty"` |
| 183 | ContextWindow int `json:"contextWindow,omitempty" validate:"min=0"` |
| 184 | PricingCurrency string `json:"pricingCurrency,omitempty"` |
| 185 | CacheHitPerMillion float64 `json:"cacheHitPerMillion,omitempty" validate:"min=0"` |
| 186 | InputPerMillion float64 `json:"inputPerMillion,omitempty" validate:"min=0"` |
| 187 | OutputPerMillion float64 `json:"outputPerMillion,omitempty" validate:"min=0"` |
| 188 | Vision bool `json:"vision,omitempty"` |
| 189 | Tools bool `json:"tools,omitempty"` |
| 190 | Reasoning bool `json:"reasoning,omitempty"` |
| 191 | Efforts []string `json:"efforts,omitempty"` |
| 192 | DefaultEffort string `json:"defaultEffort,omitempty"` |
| 193 | ToolCallReasoning bool `json:"toolCallReasoning,omitempty"` |
| 194 | ReasoningRoundTrip bool `json:"reasoningRoundTrip,omitempty"` |
| 195 | WarnOnMissingToolCallReasoning bool `json:"warnOnMissingToolCallReasoning,omitempty"` |
| 196 | } |
| 197 | |
| 198 | // UIActionDecl is a generated Extension Protocol v1 wire DTO. |
| 199 | type UIActionDecl struct { |
| 200 | ActionID string `json:"actionId" validate:"nonempty"` |
| 201 | Label string `json:"label,omitempty"` |
| 202 | } |
| 203 | |
| 204 | // InitializedParams is a generated Extension Protocol v1 wire DTO. |
| 205 | type InitializedParams struct{} |
| 206 | |
| 207 | // InterceptParams is a generated Extension Protocol v1 wire DTO. |
| 208 | type InterceptParams struct { |
| 209 | Event InterceptEvent `json:"event"` |
| 210 | Seq uint64 `json:"seq" validate:"min=1"` |
| 211 | Payload json.RawMessage `json:"payload" externalizable:"true"` |
| 212 | TimeoutMillis int `json:"timeoutMillis" validate:"min=0"` |
| 213 | Externalized []ExternalizedField `json:"externalized,omitempty"` |
| 214 | } |
| 215 | |
| 216 | // InterceptResult is a generated Extension Protocol v1 wire DTO. |
| 217 | type InterceptResult struct { |
| 218 | Decision InterceptDecision `json:"decision"` |
| 219 | Reason string `json:"reason,omitempty"` |
| 220 | Replacement json.RawMessage `json:"replacement,omitempty" externalizable:"true"` |
| 221 | Externalized []ExternalizedField `json:"externalized,omitempty"` |
| 222 | } |
| 223 | |
| 224 | // InterceptDecision is a generated Extension Protocol v1 string enum. |
| 225 | type InterceptDecision string |
| 226 | |
| 227 | const ( |
| 228 | DecisionContinue InterceptDecision = "continue" |
| 229 | DecisionBlock InterceptDecision = "block" |
| 230 | DecisionReplace InterceptDecision = "replace" |
| 231 | DecisionAllow InterceptDecision = "allow" |
| 232 | DecisionDeny InterceptDecision = "deny" |
| 233 | ) |
| 234 | |
| 235 | // ProviderCatalogParams is a generated Extension Protocol v1 wire DTO. |
| 236 | type ProviderCatalogParams struct{} |
| 237 | |
| 238 | // ProviderCatalogResult is a generated Extension Protocol v1 wire DTO. |
| 239 | type ProviderCatalogResult struct { |
| 240 | Providers []ProviderDescriptor `json:"providers"` |
| 241 | } |
| 242 | |
| 243 | // StreamCancelParams is a generated Extension Protocol v1 wire DTO. |
| 244 | type StreamCancelParams struct { |
| 245 | StreamID string `json:"streamId" validate:"nonempty"` |
| 246 | } |
| 247 | |
| 248 | // StreamCancelResult is a generated Extension Protocol v1 wire DTO. |
| 249 | type StreamCancelResult struct { |
| 250 | Cancelled bool `json:"cancelled"` |
| 251 | } |
| 252 | |
| 253 | // StreamChunkParams is a generated Extension Protocol v1 wire DTO. |
| 254 | type StreamChunkParams struct { |
| 255 | StreamID string `json:"streamId" validate:"nonempty"` |
| 256 | Seq int64 `json:"seq" validate:"min=1"` |
| 257 | Chunk ProviderChunk `json:"chunk"` |
| 258 | } |
| 259 | |
| 260 | // ProviderChunk is a generated Extension Protocol v1 wire DTO. |
| 261 | type ProviderChunk struct { |
| 262 | Type ProviderChunkType `json:"type"` |
| 263 | Text string `json:"text,omitempty"` |
| 264 | Signature string `json:"signature,omitempty"` |
| 265 | ToolCall *ProviderToolCall `json:"toolCall,omitempty"` |
| 266 | ArgChars int `json:"argChars,omitempty" validate:"min=0"` |
| 267 | Usage *ProviderUsage `json:"usage,omitempty"` |
| 268 | Error *ProviderError `json:"error,omitempty"` |
| 269 | } |
| 270 | |
| 271 | // ProviderChunkType is a generated Extension Protocol v1 string enum. |
| 272 | type ProviderChunkType string |
| 273 | |
| 274 | const ( |
| 275 | ChunkText ProviderChunkType = "text" |
| 276 | ChunkReasoning ProviderChunkType = "reasoning" |
| 277 | ChunkToolCallStart ProviderChunkType = "tool_call_start" |
| 278 | ChunkToolCallDelta ProviderChunkType = "tool_call_args_delta" |
| 279 | ChunkToolCall ProviderChunkType = "tool_call" |
| 280 | ChunkUsage ProviderChunkType = "usage" |
| 281 | ChunkDone ProviderChunkType = "done" |
| 282 | ChunkError ProviderChunkType = "error" |
| 283 | ) |
| 284 | |
| 285 | // ProviderToolCall is a generated Extension Protocol v1 wire DTO. |
| 286 | type ProviderToolCall struct { |
| 287 | ID string `json:"id" validate:"nonempty"` |
| 288 | Name string `json:"name" validate:"nonempty"` |
| 289 | Arguments string `json:"arguments"` |
| 290 | ThoughtSignature string `json:"thought_signature,omitempty"` |
| 291 | } |
| 292 | |
| 293 | // ProviderUsage is a generated Extension Protocol v1 wire DTO. |
| 294 | type ProviderUsage struct { |
| 295 | PromptTokens int `json:"promptTokens" validate:"min=0"` |
| 296 | CompletionTokens int `json:"completionTokens" validate:"min=0"` |
| 297 | TotalTokens int `json:"totalTokens" validate:"min=0"` |
| 298 | CacheHitTokens int `json:"cacheHitTokens" validate:"min=0"` |
| 299 | CacheMissTokens int `json:"cacheMissTokens" validate:"min=0"` |
| 300 | ReasoningTokens int `json:"reasoningTokens" validate:"min=0"` |
| 301 | FinishReason string `json:"finishReason,omitempty"` |
| 302 | } |
| 303 | |
| 304 | // ProviderError is a generated Extension Protocol v1 wire DTO. |
| 305 | type ProviderError struct { |
| 306 | Code ProviderErrorCode `json:"code"` |
| 307 | Message string `json:"message" validate:"nonempty"` |
| 308 | } |
| 309 | |
| 310 | // ProviderErrorCode is a generated Extension Protocol v1 string enum. |
| 311 | type ProviderErrorCode string |
| 312 | |
| 313 | const ( |
| 314 | ProviderFailed ProviderErrorCode = "provider_failed" |
| 315 | ProviderInterrupted ProviderErrorCode = "provider_interrupted" |
| 316 | ) |
| 317 | |
| 318 | // StreamEndParams is a generated Extension Protocol v1 wire DTO. |
| 319 | type StreamEndParams struct { |
| 320 | StreamID string `json:"streamId" validate:"nonempty"` |
| 321 | LastSeq int64 `json:"lastSeq" validate:"min=0"` |
| 322 | Error string `json:"error,omitempty"` |
| 323 | Interrupted bool `json:"interrupted,omitempty"` |
| 324 | } |
| 325 | |
| 326 | // StreamOpenParams is a generated Extension Protocol v1 wire DTO. |
| 327 | type StreamOpenParams struct { |
| 328 | StreamID string `json:"streamId" validate:"nonempty"` |
| 329 | ProviderRef string `json:"providerRef" validate:"nonempty"` |
| 330 | Model string `json:"model,omitempty"` |
| 331 | Effort string `json:"effort,omitempty"` |
| 332 | Request ProviderRequest `json:"request"` |
| 333 | SeqBase int `json:"seqBase" validate:"min=0"` |
| 334 | } |
| 335 | |
| 336 | // ProviderRequest is a generated Extension Protocol v1 wire DTO. |
| 337 | type ProviderRequest struct { |
| 338 | Messages []ProviderMessage `json:"messages"` |
| 339 | Tools []ProviderToolSchema `json:"tools"` |
| 340 | Temperature *float64 `json:"temperature,omitempty"` |
| 341 | MaxTokens int `json:"maxTokens" validate:"min=0"` |
| 342 | ResponseFormat *ProviderResponseFormat `json:"responseFormat,omitempty"` |
| 343 | } |
| 344 | |
| 345 | // ProviderMessage is a generated Extension Protocol v1 wire DTO. |
| 346 | type ProviderMessage struct { |
| 347 | Role ProviderRole `json:"role,omitempty"` |
| 348 | Content string `json:"content,omitempty" externalizable:"true"` |
| 349 | Images []string `json:"images,omitempty"` |
| 350 | ReasoningContent string `json:"reasoning_content,omitempty"` |
| 351 | ReasoningSignature string `json:"reasoning_signature,omitempty"` |
| 352 | ToolCalls []ProviderToolCall `json:"tool_calls,omitempty"` |
| 353 | ToolCallID string `json:"tool_call_id,omitempty"` |
| 354 | Name string `json:"name,omitempty"` |
| 355 | } |
| 356 | |
| 357 | // ProviderRole is a generated Extension Protocol v1 string enum. |
| 358 | type ProviderRole string |
| 359 | |
| 360 | const ( |
| 361 | ProviderRoleSystem ProviderRole = "system" |
| 362 | ProviderRoleUser ProviderRole = "user" |
| 363 | ProviderRoleAssistant ProviderRole = "assistant" |
| 364 | ProviderRoleTool ProviderRole = "tool" |
| 365 | ) |
| 366 | |
| 367 | // ProviderToolSchema is a generated Extension Protocol v1 wire DTO. |
| 368 | type ProviderToolSchema struct { |
| 369 | Name string `json:"name" validate:"nonempty"` |
| 370 | Description string `json:"description,omitempty"` |
| 371 | Parameters json.RawMessage `json:"parameters"` |
| 372 | } |
| 373 | |
| 374 | // ProviderResponseFormat is a generated Extension Protocol v1 wire DTO. |
| 375 | type ProviderResponseFormat struct { |
| 376 | Type string `json:"type" validate:"nonempty"` |
| 377 | } |
| 378 | |
| 379 | // StreamOpenResult is a generated Extension Protocol v1 wire DTO. |
| 380 | type StreamOpenResult struct { |
| 381 | Accepted bool `json:"accepted"` |
| 382 | } |
| 383 | |
| 384 | // ResourcesChangedParams is a generated Extension Protocol v1 wire DTO. |
| 385 | type ResourcesChangedParams struct { |
| 386 | Paths []string `json:"paths"` |
| 387 | } |
| 388 | |
| 389 | // ShutdownParams is a generated Extension Protocol v1 wire DTO. |
| 390 | type ShutdownParams struct { |
| 391 | TimeoutMillis int `json:"timeoutMillis" validate:"min=0"` |
| 392 | } |
| 393 | |
| 394 | // ShutdownResult is a generated Extension Protocol v1 wire DTO. |
| 395 | type ShutdownResult struct { |
| 396 | Accepted bool `json:"accepted"` |
| 397 | } |
| 398 | |
| 399 | // UIActionParams is a generated Extension Protocol v1 wire DTO. |
| 400 | type UIActionParams struct { |
| 401 | ActionID string `json:"actionId" validate:"nonempty"` |
| 402 | SessionID string `json:"sessionId" validate:"nonempty"` |
| 403 | Generation uint64 `json:"generation"` |
| 404 | Args map[string]string `json:"args,omitempty"` |
| 405 | } |
| 406 | |
| 407 | // UIActionResult is a generated Extension Protocol v1 wire DTO. |
| 408 | type UIActionResult struct { |
| 409 | Accepted bool `json:"accepted"` |
| 410 | Message string `json:"message,omitempty"` |
| 411 | } |
| 412 | |
| 413 | // UISubmitParams is a generated Extension Protocol v1 wire DTO. |
| 414 | type UISubmitParams struct { |
| 415 | SurfaceID string `json:"surfaceId" validate:"nonempty"` |
| 416 | SessionID string `json:"sessionId" validate:"nonempty"` |
| 417 | Generation uint64 `json:"generation"` |
| 418 | Values map[string]any `json:"values"` |
| 419 | } |
| 420 | |
| 421 | // UISubmitResult is a generated Extension Protocol v1 wire DTO. |
| 422 | type UISubmitResult struct { |
| 423 | Accepted bool `json:"accepted"` |
| 424 | } |
| 425 | |
| 426 | // ContentReadParams is a generated Extension Protocol v1 wire DTO. |
| 427 | type ContentReadParams struct { |
| 428 | ContentRef string `json:"contentRef" validate:"nonempty"` |
| 429 | Offset int64 `json:"offset" validate:"min=0"` |
| 430 | } |
| 431 | |
| 432 | // ContentReadResult is a generated Extension Protocol v1 wire DTO. |
| 433 | type ContentReadResult struct { |
| 434 | ContentRef string `json:"contentRef" validate:"nonempty"` |
| 435 | Offset int64 `json:"offset" validate:"min=0"` |
| 436 | DataBase64 string `json:"dataBase64"` |
| 437 | NextOffset *int64 `json:"nextOffset,omitempty" validate:"min=0"` |
| 438 | TotalBytes int64 `json:"totalBytes" validate:"min=0"` |
| 439 | SHA256 string `json:"sha256" validate:"sha256"` |
| 440 | Encoding ContentEncoding `json:"encoding"` |
| 441 | } |
| 442 | |
| 443 | // ContentEncoding is a generated Extension Protocol v1 string enum. |
| 444 | type ContentEncoding string |
| 445 | |
| 446 | const ( |
| 447 | ContentUTF8 ContentEncoding = "utf8" |
| 448 | ) |
| 449 | |
| 450 | // UIPublishParams is a generated Extension Protocol v1 wire DTO. |
| 451 | type UIPublishParams struct { |
| 452 | SurfaceID string `json:"surfaceId" validate:"nonempty"` |
| 453 | SessionID string `json:"sessionId" validate:"nonempty"` |
| 454 | Generation uint64 `json:"generation"` |
| 455 | Kind UISurfaceKind `json:"kind"` |
| 456 | Payload json.RawMessage `json:"payload"` |
| 457 | } |
| 458 | |
| 459 | // UISurfaceKind is a generated Extension Protocol v1 string enum. |
| 460 | type UISurfaceKind string |
| 461 | |
| 462 | const ( |
| 463 | UISurfaceStatus UISurfaceKind = "status" |
| 464 | UISurfaceCard UISurfaceKind = "card" |
| 465 | UISurfaceForm UISurfaceKind = "form" |
| 466 | UISurfaceNotification UISurfaceKind = "notification" |
| 467 | ) |
| 468 | |
| 469 | // UIPublishResult is a generated Extension Protocol v1 wire DTO. |
| 470 | type UIPublishResult struct { |
| 471 | Accepted bool `json:"accepted"` |
| 472 | } |
| 473 | |
| 474 | // UIRequestParams is a generated Extension Protocol v1 wire DTO. |
| 475 | type UIRequestParams struct { |
| 476 | SurfaceID string `json:"surfaceId" validate:"nonempty"` |
| 477 | SessionID string `json:"sessionId" validate:"nonempty"` |
| 478 | Generation uint64 `json:"generation"` |
| 479 | Kind UIRequestKind `json:"kind"` |
| 480 | Payload json.RawMessage `json:"payload"` |
| 481 | } |
| 482 | |
| 483 | // UIRequestKind is a generated Extension Protocol v1 string enum. |
| 484 | type UIRequestKind string |
| 485 | |
| 486 | const ( |
| 487 | UIRequestConfirm UIRequestKind = "confirm" |
| 488 | UIRequestInput UIRequestKind = "input" |
| 489 | UIRequestSelect UIRequestKind = "select" |
| 490 | UIRequestMultiselect UIRequestKind = "multiselect" |
| 491 | ) |
| 492 | |
| 493 | // UIRequestResult is a generated Extension Protocol v1 wire DTO. |
| 494 | type UIRequestResult struct { |
| 495 | Cancelled bool `json:"cancelled"` |
| 496 | Values map[string]any `json:"values,omitempty"` |
| 497 | } |
| 498 | |
| 499 | // UIStatusPayload is a generated Extension Protocol v1 wire DTO. |
| 500 | type UIStatusPayload struct { |
| 501 | Label string `json:"label" validate:"nonempty"` |
| 502 | Detail string `json:"detail,omitempty"` |
| 503 | Severity UISeverity `json:"severity,omitempty"` |
| 504 | Progress *float64 `json:"progress,omitempty"` |
| 505 | } |
| 506 | |
| 507 | // UISeverity is a generated Extension Protocol v1 string enum. |
| 508 | type UISeverity string |
| 509 | |
| 510 | const ( |
| 511 | UISeverityInfo UISeverity = "info" |
| 512 | UISeverityWarn UISeverity = "warn" |
| 513 | UISeverityError UISeverity = "error" |
| 514 | ) |
| 515 | |
| 516 | // UICardPayload is a generated Extension Protocol v1 wire DTO. |
| 517 | type UICardPayload struct { |
| 518 | Title string `json:"title,omitempty"` |
| 519 | Markdown string `json:"markdown,omitempty"` |
| 520 | Text string `json:"text,omitempty"` |
| 521 | Fields []UIKeyValue `json:"fields,omitempty"` |
| 522 | Progress *float64 `json:"progress,omitempty"` |
| 523 | Actions []UIActionRef `json:"actions,omitempty"` |
| 524 | } |
| 525 | |
| 526 | // UIKeyValue is a generated Extension Protocol v1 wire DTO. |
| 527 | type UIKeyValue struct { |
| 528 | Key string `json:"key" validate:"nonempty"` |
| 529 | Value string `json:"value"` |
| 530 | } |
| 531 | |
| 532 | // UIActionRef is a generated Extension Protocol v1 wire DTO. |
| 533 | type UIActionRef struct { |
| 534 | ActionID string `json:"actionId" validate:"nonempty"` |
| 535 | Label string `json:"label" validate:"nonempty"` |
| 536 | } |
| 537 | |
| 538 | // UIFormPayload is a generated Extension Protocol v1 wire DTO. |
| 539 | type UIFormPayload struct { |
| 540 | Title string `json:"title,omitempty"` |
| 541 | Message string `json:"message,omitempty"` |
| 542 | Fields []UIFormField `json:"fields"` |
| 543 | } |
| 544 | |
| 545 | // UIFormField is a generated Extension Protocol v1 wire DTO. |
| 546 | type UIFormField struct { |
| 547 | Key string `json:"key" validate:"nonempty"` |
| 548 | Label string `json:"label,omitempty"` |
| 549 | Kind UIFieldKind `json:"kind"` |
| 550 | Options []string `json:"options,omitempty"` |
| 551 | Default any `json:"default,omitempty"` |
| 552 | Required bool `json:"required,omitempty"` |
| 553 | } |
| 554 | |
| 555 | // UIFieldKind is a generated Extension Protocol v1 string enum. |
| 556 | type UIFieldKind string |
| 557 | |
| 558 | const ( |
| 559 | UIFieldConfirm UIFieldKind = "confirm" |
| 560 | UIFieldInput UIFieldKind = "input" |
| 561 | UIFieldSelect UIFieldKind = "select" |
| 562 | UIFieldMultiselect UIFieldKind = "multiselect" |
| 563 | ) |
| 564 | |
| 565 | // UINotificationPayload is a generated Extension Protocol v1 wire DTO. |
| 566 | type UINotificationPayload struct { |
| 567 | Title string `json:"title" validate:"nonempty"` |
| 568 | Body string `json:"body,omitempty"` |
| 569 | Severity UISeverity `json:"severity,omitempty"` |
| 570 | } |
| 571 | |
| 572 | // ProtocolErrorData is a generated Extension Protocol v1 wire DTO. |
| 573 | type ProtocolErrorData struct { |
| 574 | Reason ErrorReason `json:"reason"` |
| 575 | Retryable bool `json:"retryable"` |
| 576 | } |
| 577 | |
| 578 | // ErrorReason is a generated Extension Protocol v1 string enum. |
| 579 | type ErrorReason string |
| 580 | |
| 581 | const ( |
| 582 | ErrCapabilityNotDeclared ErrorReason = "capability_not_declared" |
| 583 | ErrContentRefExpired ErrorReason = "content_ref_expired" |
| 584 | ErrFrameTooLarge ErrorReason = "frame_too_large" |
| 585 | ErrInterceptTimeout ErrorReason = "intercept_timeout" |
| 586 | ErrInternal ErrorReason = "internal" |
| 587 | ErrInvalidParams ErrorReason = "invalid_params" |
| 588 | ErrProtocolError ErrorReason = "protocol_error" |
| 589 | ErrProviderFailed ErrorReason = "provider_failed" |
| 590 | ErrProviderInterrupted ErrorReason = "provider_interrupted" |
| 591 | ErrShutdownTimeout ErrorReason = "shutdown_timeout" |
| 592 | ErrStreamCancelled ErrorReason = "stream_cancelled" |
| 593 | ErrStreamGap ErrorReason = "stream_gap" |
| 594 | ErrUnknownMethod ErrorReason = "unknown_method" |
| 595 | ErrUnsupportedVersion ErrorReason = "unsupported_version" |
| 596 | ) |
| 597 |