| 1 | // Code generated by cmd/extension-protocol-gen; DO NOT EDIT. |
| 2 | |
| 3 | // Package extension: Extension Protocol v2 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.v2" |
| 14 | |
| 15 | // ProtocolMajor is the frozen major version of this protocol build. |
| 16 | const ProtocolMajor = 2 |
| 17 | |
| 18 | // ProtocolVersion is the wire string form of ProtocolMajor carried in the |
| 19 | // initialize handshake. |
| 20 | const ProtocolVersion = "2" |
| 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 v2. |
| 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 | ErrActivationFailed: {DomainErrorCode, "Component activation failed; the new generation was not published.", false}, |
| 71 | ErrCapabilityNotDeclared: {DomainErrorCode, "The extension used a capability its manifest did not declare.", false}, |
| 72 | ErrCleanupFailed: {DomainErrorCode, "Component cleanup failed while disposing scoped effects.", true}, |
| 73 | ErrContentRefExpired: {DomainErrorCode, "The referenced content has expired.", true}, |
| 74 | ErrDependencyCycle: {DomainErrorCode, "The dependency graph contains a required cycle.", false}, |
| 75 | ErrDependencyUnsatisfied: {DomainErrorCode, "A required dependency is missing or not version-compatible.", false}, |
| 76 | ErrFrameTooLarge: {DomainErrorCode, "The frame exceeds the frozen protocol size limit.", false}, |
| 77 | ErrInterceptTimeout: {DomainErrorCode, "The extension did not answer an intercept within its timeout.", true}, |
| 78 | ErrInternal: {CodeInternal, "An internal extension protocol error occurred.", true}, |
| 79 | ErrInvalidParams: {CodeInvalidParams, "The params do not match the registered method schema.", false}, |
| 80 | ErrProtocolError: {CodeInvalidRequest, "The extension protocol frame or envelope is invalid.", false}, |
| 81 | ErrProviderFailed: {DomainErrorCode, "The extension provider stream failed.", true}, |
| 82 | ErrProviderInterrupted: {DomainErrorCode, "The extension provider stream was interrupted.", true}, |
| 83 | ErrSchemaMismatch: {DomainErrorCode, "A capability schema hash does not match the expected pin.", false}, |
| 84 | ErrShutdownTimeout: {DomainErrorCode, "The extension did not shut down within the requested timeout.", true}, |
| 85 | ErrStaleGeneration: {DomainErrorCode, "The message belongs to a superseded runtime generation.", false}, |
| 86 | ErrStreamCancelled: {DomainErrorCode, "The provider stream was cancelled.", false}, |
| 87 | ErrStreamGap: {DomainErrorCode, "A provider stream chunk is missing from the ordered sequence.", true}, |
| 88 | ErrUnknownMethod: {CodeMethodNotFound, "The method is not registered in Extension Protocol v2.", false}, |
| 89 | ErrUnsupportedVersion: {DomainErrorCode, "The peer's extension protocol version is not supported.", false}, |
| 90 | } |
| 91 | |
| 92 | // EventParams is a generated Extension Protocol v2 wire DTO. |
| 93 | type EventParams struct { |
| 94 | Event InterceptEvent `json:"event"` |
| 95 | Payload json.RawMessage `json:"payload" externalizable:"true"` |
| 96 | Externalized []ExternalizedField `json:"externalized,omitempty"` |
| 97 | } |
| 98 | |
| 99 | // InterceptEvent is a generated Extension Protocol v2 string enum. |
| 100 | type InterceptEvent string |
| 101 | |
| 102 | const ( |
| 103 | EventAgentBeforeStart InterceptEvent = "agent.before_start" |
| 104 | EventCompactionComplete InterceptEvent = "compaction.complete" |
| 105 | EventCompactionPrepare InterceptEvent = "compaction.prepare" |
| 106 | EventContextPrepare InterceptEvent = "context.prepare" |
| 107 | EventFrontendEvent InterceptEvent = "frontend.event" |
| 108 | EventInputReceive InterceptEvent = "input.receive" |
| 109 | EventPermissionDecision InterceptEvent = "permission.decision" |
| 110 | EventProviderRequest InterceptEvent = "provider.request" |
| 111 | EventProviderResponse InterceptEvent = "provider.response" |
| 112 | EventSessionEnd InterceptEvent = "session.end" |
| 113 | EventSessionLoad InterceptEvent = "session.load" |
| 114 | EventSessionRotate InterceptEvent = "session.rotate" |
| 115 | EventSessionSave InterceptEvent = "session.save" |
| 116 | EventSessionStart InterceptEvent = "session.start" |
| 117 | EventSystemPromptBuild InterceptEvent = "system_prompt.build" |
| 118 | EventToolAfter InterceptEvent = "tool.after" |
| 119 | EventToolBefore InterceptEvent = "tool.before" |
| 120 | ) |
| 121 | |
| 122 | // ExternalizedField is a generated Extension Protocol v2 wire DTO. |
| 123 | type ExternalizedField struct { |
| 124 | JSONPointer string `json:"jsonPointer" validate:"nonempty"` |
| 125 | ContentRef string `json:"contentRef" validate:"nonempty"` |
| 126 | TotalBytes int64 `json:"totalBytes" validate:"min=0"` |
| 127 | SHA256 string `json:"sha256" validate:"sha256"` |
| 128 | } |
| 129 | |
| 130 | // InitializeParams is a generated Extension Protocol v2 wire DTO. |
| 131 | type InitializeParams struct { |
| 132 | ProtocolVersion string `json:"protocolVersion" validate:"nonempty"` |
| 133 | ProtocolID string `json:"protocolId" validate:"nonempty"` |
| 134 | Manifest ManifestExpectation `json:"manifest"` |
| 135 | Session SessionContext `json:"session"` |
| 136 | Capabilities HostCapabilities `json:"capabilities"` |
| 137 | DependencySchemaVersion int `json:"dependencySchemaVersion,omitempty" validate:"min=0"` |
| 138 | } |
| 139 | |
| 140 | // ManifestExpectation is a generated Extension Protocol v2 wire DTO. |
| 141 | type ManifestExpectation struct { |
| 142 | Intercepts []string `json:"intercepts,omitempty"` |
| 143 | Replaces []string `json:"replaces,omitempty"` |
| 144 | Providers []string `json:"providers,omitempty"` |
| 145 | UIActions []string `json:"uiActions,omitempty"` |
| 146 | Capabilities []string `json:"capabilities,omitempty"` |
| 147 | Requires []RequirementWire `json:"requires,omitempty"` |
| 148 | Provides []CapabilityWire `json:"provides,omitempty"` |
| 149 | } |
| 150 | |
| 151 | // RequirementWire is a generated Extension Protocol v2 wire DTO. |
| 152 | type RequirementWire struct { |
| 153 | Namespace string `json:"namespace" validate:"nonempty"` |
| 154 | Kind string `json:"kind" validate:"nonempty"` |
| 155 | ID string `json:"id" validate:"nonempty"` |
| 156 | Version string `json:"version,omitempty"` |
| 157 | SchemaHash string `json:"schemaHash,omitempty"` |
| 158 | VersionRange string `json:"versionRange,omitempty"` |
| 159 | Optional bool `json:"optional,omitempty"` |
| 160 | } |
| 161 | |
| 162 | // CapabilityWire is a generated Extension Protocol v2 wire DTO. |
| 163 | type CapabilityWire struct { |
| 164 | Namespace string `json:"namespace" validate:"nonempty"` |
| 165 | Kind string `json:"kind" validate:"nonempty"` |
| 166 | ID string `json:"id" validate:"nonempty"` |
| 167 | Version string `json:"version,omitempty"` |
| 168 | SchemaHash string `json:"schemaHash,omitempty"` |
| 169 | } |
| 170 | |
| 171 | // SessionContext is a generated Extension Protocol v2 wire DTO. |
| 172 | type SessionContext struct { |
| 173 | SessionID string `json:"sessionId" validate:"nonempty"` |
| 174 | WorkspaceRoot string `json:"workspaceRoot" validate:"nonempty"` |
| 175 | Generation uint64 `json:"generation"` |
| 176 | Epoch string `json:"epoch,omitempty"` |
| 177 | } |
| 178 | |
| 179 | // HostCapabilities is a generated Extension Protocol v2 wire DTO. |
| 180 | type HostCapabilities struct { |
| 181 | ContentRefs bool `json:"contentRefs"` |
| 182 | UIHost UIHostKind `json:"uiHost"` |
| 183 | ProtocolVersion string `json:"protocolVersion" validate:"nonempty"` |
| 184 | DependencySchemaVersion int `json:"dependencySchemaVersion,omitempty" validate:"min=0"` |
| 185 | } |
| 186 | |
| 187 | // UIHostKind is a generated Extension Protocol v2 string enum. |
| 188 | type UIHostKind string |
| 189 | |
| 190 | const ( |
| 191 | UIHostTUI UIHostKind = "tui" |
| 192 | UIHostDesktop UIHostKind = "desktop" |
| 193 | UIHostACP UIHostKind = "acp" |
| 194 | UIHostHeadless UIHostKind = "headless" |
| 195 | ) |
| 196 | |
| 197 | // InitializeResult is a generated Extension Protocol v2 wire DTO. |
| 198 | type InitializeResult struct { |
| 199 | ProtocolVersion string `json:"protocolVersion" validate:"nonempty"` |
| 200 | Name string `json:"name" validate:"nonempty"` |
| 201 | Version string `json:"version" validate:"nonempty"` |
| 202 | ComponentID string `json:"componentId,omitempty"` |
| 203 | Subscriptions []string `json:"subscriptions,omitempty"` |
| 204 | Replaces []string `json:"replaces,omitempty"` |
| 205 | Providers []ProviderDescriptor `json:"providers,omitempty"` |
| 206 | UIActions []UIActionDecl `json:"uiActions,omitempty"` |
| 207 | Requires []RequirementWire `json:"requires,omitempty"` |
| 208 | Provides []CapabilityWire `json:"provides,omitempty"` |
| 209 | StateSchemaVersion int `json:"stateSchemaVersion" validate:"min=0"` |
| 210 | } |
| 211 | |
| 212 | // ProviderDescriptor is a generated Extension Protocol v2 wire DTO. |
| 213 | type ProviderDescriptor struct { |
| 214 | Ref string `json:"ref" validate:"nonempty"` |
| 215 | DisplayName string `json:"displayName,omitempty"` |
| 216 | Model string `json:"model,omitempty"` |
| 217 | ContextWindow int `json:"contextWindow,omitempty" validate:"min=0"` |
| 218 | PricingCurrency string `json:"pricingCurrency,omitempty"` |
| 219 | CacheHitPerMillion float64 `json:"cacheHitPerMillion,omitempty" validate:"min=0"` |
| 220 | InputPerMillion float64 `json:"inputPerMillion,omitempty" validate:"min=0"` |
| 221 | OutputPerMillion float64 `json:"outputPerMillion,omitempty" validate:"min=0"` |
| 222 | Vision bool `json:"vision,omitempty"` |
| 223 | InputModalities []string `json:"inputModalities,omitempty"` |
| 224 | Tools bool `json:"tools,omitempty"` |
| 225 | Reasoning bool `json:"reasoning,omitempty"` |
| 226 | Efforts []string `json:"efforts,omitempty"` |
| 227 | DefaultEffort string `json:"defaultEffort,omitempty"` |
| 228 | ToolCallReasoning bool `json:"toolCallReasoning,omitempty"` |
| 229 | ReasoningRoundTrip bool `json:"reasoningRoundTrip,omitempty"` |
| 230 | WarnOnMissingToolCallReasoning bool `json:"warnOnMissingToolCallReasoning,omitempty"` |
| 231 | } |
| 232 | |
| 233 | // UIActionDecl is a generated Extension Protocol v2 wire DTO. |
| 234 | type UIActionDecl struct { |
| 235 | ActionID string `json:"actionId" validate:"nonempty"` |
| 236 | Label string `json:"label,omitempty"` |
| 237 | } |
| 238 | |
| 239 | // InitializedParams is a generated Extension Protocol v2 wire DTO. |
| 240 | type InitializedParams struct{} |
| 241 | |
| 242 | // InterceptParams is a generated Extension Protocol v2 wire DTO. |
| 243 | type InterceptParams struct { |
| 244 | Event InterceptEvent `json:"event"` |
| 245 | Seq uint64 `json:"seq" validate:"min=1"` |
| 246 | Payload json.RawMessage `json:"payload" externalizable:"true"` |
| 247 | TimeoutMillis int `json:"timeoutMillis" validate:"min=0"` |
| 248 | Externalized []ExternalizedField `json:"externalized,omitempty"` |
| 249 | } |
| 250 | |
| 251 | // InterceptResult is a generated Extension Protocol v2 wire DTO. |
| 252 | type InterceptResult struct { |
| 253 | Decision InterceptDecision `json:"decision"` |
| 254 | Reason string `json:"reason,omitempty"` |
| 255 | Replacement json.RawMessage `json:"replacement,omitempty" externalizable:"true"` |
| 256 | Externalized []ExternalizedField `json:"externalized,omitempty"` |
| 257 | } |
| 258 | |
| 259 | // InterceptDecision is a generated Extension Protocol v2 string enum. |
| 260 | type InterceptDecision string |
| 261 | |
| 262 | const ( |
| 263 | DecisionContinue InterceptDecision = "continue" |
| 264 | DecisionBlock InterceptDecision = "block" |
| 265 | DecisionReplace InterceptDecision = "replace" |
| 266 | DecisionAllow InterceptDecision = "allow" |
| 267 | DecisionDeny InterceptDecision = "deny" |
| 268 | ) |
| 269 | |
| 270 | // ProviderCatalogParams is a generated Extension Protocol v2 wire DTO. |
| 271 | type ProviderCatalogParams struct{} |
| 272 | |
| 273 | // ProviderCatalogResult is a generated Extension Protocol v2 wire DTO. |
| 274 | type ProviderCatalogResult struct { |
| 275 | Providers []ProviderDescriptor `json:"providers"` |
| 276 | } |
| 277 | |
| 278 | // StreamCancelParams is a generated Extension Protocol v2 wire DTO. |
| 279 | type StreamCancelParams struct { |
| 280 | StreamID string `json:"streamId" validate:"nonempty"` |
| 281 | } |
| 282 | |
| 283 | // StreamCancelResult is a generated Extension Protocol v2 wire DTO. |
| 284 | type StreamCancelResult struct { |
| 285 | Cancelled bool `json:"cancelled"` |
| 286 | } |
| 287 | |
| 288 | // StreamChunkParams is a generated Extension Protocol v2 wire DTO. |
| 289 | type StreamChunkParams struct { |
| 290 | StreamID string `json:"streamId" validate:"nonempty"` |
| 291 | Seq int64 `json:"seq" validate:"min=1"` |
| 292 | Chunk ProviderChunk `json:"chunk"` |
| 293 | Generation uint64 `json:"generation,omitempty"` |
| 294 | Epoch string `json:"epoch,omitempty"` |
| 295 | } |
| 296 | |
| 297 | // ProviderChunk is a generated Extension Protocol v2 wire DTO. |
| 298 | type ProviderChunk struct { |
| 299 | Type ProviderChunkType `json:"type"` |
| 300 | Text string `json:"text,omitempty"` |
| 301 | Signature string `json:"signature,omitempty"` |
| 302 | ToolCall *ProviderToolCall `json:"toolCall,omitempty"` |
| 303 | ArgChars int `json:"argChars,omitempty" validate:"min=0"` |
| 304 | Usage *ProviderUsage `json:"usage,omitempty"` |
| 305 | Error *ProviderError `json:"error,omitempty"` |
| 306 | Generation uint64 `json:"generation,omitempty"` |
| 307 | Epoch string `json:"epoch,omitempty"` |
| 308 | } |
| 309 | |
| 310 | // ProviderChunkType is a generated Extension Protocol v2 string enum. |
| 311 | type ProviderChunkType string |
| 312 | |
| 313 | const ( |
| 314 | ChunkText ProviderChunkType = "text" |
| 315 | ChunkReasoning ProviderChunkType = "reasoning" |
| 316 | ChunkToolCallStart ProviderChunkType = "tool_call_start" |
| 317 | ChunkToolCallDelta ProviderChunkType = "tool_call_args_delta" |
| 318 | ChunkToolCall ProviderChunkType = "tool_call" |
| 319 | ChunkUsage ProviderChunkType = "usage" |
| 320 | ChunkDone ProviderChunkType = "done" |
| 321 | ChunkError ProviderChunkType = "error" |
| 322 | ) |
| 323 | |
| 324 | // ProviderToolCall is a generated Extension Protocol v2 wire DTO. |
| 325 | type ProviderToolCall struct { |
| 326 | ID string `json:"id" validate:"nonempty"` |
| 327 | Name string `json:"name" validate:"nonempty"` |
| 328 | Arguments string `json:"arguments"` |
| 329 | ThoughtSignature string `json:"thought_signature,omitempty"` |
| 330 | } |
| 331 | |
| 332 | // ProviderUsage is a generated Extension Protocol v2 wire DTO. |
| 333 | type ProviderUsage struct { |
| 334 | PromptTokens int `json:"promptTokens" validate:"min=0"` |
| 335 | CompletionTokens int `json:"completionTokens" validate:"min=0"` |
| 336 | TotalTokens int `json:"totalTokens" validate:"min=0"` |
| 337 | CacheHitTokens int `json:"cacheHitTokens" validate:"min=0"` |
| 338 | CacheMissTokens int `json:"cacheMissTokens" validate:"min=0"` |
| 339 | ReasoningTokens int `json:"reasoningTokens" validate:"min=0"` |
| 340 | FinishReason string `json:"finishReason,omitempty"` |
| 341 | } |
| 342 | |
| 343 | // ProviderError is a generated Extension Protocol v2 wire DTO. |
| 344 | type ProviderError struct { |
| 345 | Code ProviderErrorCode `json:"code"` |
| 346 | Message string `json:"message" validate:"nonempty"` |
| 347 | } |
| 348 | |
| 349 | // ProviderErrorCode is a generated Extension Protocol v2 string enum. |
| 350 | type ProviderErrorCode string |
| 351 | |
| 352 | const ( |
| 353 | ProviderFailed ProviderErrorCode = "provider_failed" |
| 354 | ProviderInterrupted ProviderErrorCode = "provider_interrupted" |
| 355 | ) |
| 356 | |
| 357 | // StreamEndParams is a generated Extension Protocol v2 wire DTO. |
| 358 | type StreamEndParams struct { |
| 359 | StreamID string `json:"streamId" validate:"nonempty"` |
| 360 | LastSeq int64 `json:"lastSeq" validate:"min=0"` |
| 361 | Error string `json:"error,omitempty"` |
| 362 | Interrupted bool `json:"interrupted,omitempty"` |
| 363 | } |
| 364 | |
| 365 | // StreamOpenParams is a generated Extension Protocol v2 wire DTO. |
| 366 | type StreamOpenParams struct { |
| 367 | StreamID string `json:"streamId" validate:"nonempty"` |
| 368 | ProviderRef string `json:"providerRef" validate:"nonempty"` |
| 369 | Model string `json:"model,omitempty"` |
| 370 | Effort string `json:"effort,omitempty"` |
| 371 | Request ProviderRequest `json:"request"` |
| 372 | SeqBase int `json:"seqBase" validate:"min=0"` |
| 373 | Generation uint64 `json:"generation,omitempty"` |
| 374 | Epoch string `json:"epoch,omitempty"` |
| 375 | } |
| 376 | |
| 377 | // ProviderRequest is a generated Extension Protocol v2 wire DTO. |
| 378 | type ProviderRequest struct { |
| 379 | Messages []ProviderMessage `json:"messages"` |
| 380 | Tools []ProviderToolSchema `json:"tools"` |
| 381 | Temperature *float64 `json:"temperature,omitempty"` |
| 382 | MaxTokens int `json:"maxTokens" validate:"min=0"` |
| 383 | ResponseFormat *ProviderResponseFormat `json:"responseFormat,omitempty"` |
| 384 | } |
| 385 | |
| 386 | // ProviderMessage is a generated Extension Protocol v2 wire DTO. |
| 387 | type ProviderMessage struct { |
| 388 | Role ProviderRole `json:"role,omitempty"` |
| 389 | Content string `json:"content,omitempty" externalizable:"true"` |
| 390 | Images []string `json:"images,omitempty"` |
| 391 | ReasoningContent string `json:"reasoning_content,omitempty"` |
| 392 | ReasoningSignature string `json:"reasoning_signature,omitempty"` |
| 393 | ToolCalls []ProviderToolCall `json:"tool_calls,omitempty"` |
| 394 | ToolCallID string `json:"tool_call_id,omitempty"` |
| 395 | Name string `json:"name,omitempty"` |
| 396 | } |
| 397 | |
| 398 | // ProviderRole is a generated Extension Protocol v2 string enum. |
| 399 | type ProviderRole string |
| 400 | |
| 401 | const ( |
| 402 | ProviderRoleSystem ProviderRole = "system" |
| 403 | ProviderRoleUser ProviderRole = "user" |
| 404 | ProviderRoleAssistant ProviderRole = "assistant" |
| 405 | ProviderRoleTool ProviderRole = "tool" |
| 406 | ) |
| 407 | |
| 408 | // ProviderToolSchema is a generated Extension Protocol v2 wire DTO. |
| 409 | type ProviderToolSchema struct { |
| 410 | Name string `json:"name" validate:"nonempty"` |
| 411 | Description string `json:"description,omitempty"` |
| 412 | Parameters json.RawMessage `json:"parameters"` |
| 413 | } |
| 414 | |
| 415 | // ProviderResponseFormat is a generated Extension Protocol v2 wire DTO. |
| 416 | type ProviderResponseFormat struct { |
| 417 | Type string `json:"type" validate:"nonempty"` |
| 418 | } |
| 419 | |
| 420 | // StreamOpenResult is a generated Extension Protocol v2 wire DTO. |
| 421 | type StreamOpenResult struct { |
| 422 | Accepted bool `json:"accepted"` |
| 423 | } |
| 424 | |
| 425 | // ResourcesChangedParams is a generated Extension Protocol v2 wire DTO. |
| 426 | type ResourcesChangedParams struct { |
| 427 | Paths []string `json:"paths"` |
| 428 | } |
| 429 | |
| 430 | // ShutdownParams is a generated Extension Protocol v2 wire DTO. |
| 431 | type ShutdownParams struct { |
| 432 | TimeoutMillis int `json:"timeoutMillis" validate:"min=0"` |
| 433 | } |
| 434 | |
| 435 | // ShutdownResult is a generated Extension Protocol v2 wire DTO. |
| 436 | type ShutdownResult struct { |
| 437 | Accepted bool `json:"accepted"` |
| 438 | } |
| 439 | |
| 440 | // UIActionParams is a generated Extension Protocol v2 wire DTO. |
| 441 | type UIActionParams struct { |
| 442 | ActionID string `json:"actionId" validate:"nonempty"` |
| 443 | SessionID string `json:"sessionId" validate:"nonempty"` |
| 444 | Generation uint64 `json:"generation"` |
| 445 | Args map[string]string `json:"args,omitempty"` |
| 446 | } |
| 447 | |
| 448 | // UIActionResult is a generated Extension Protocol v2 wire DTO. |
| 449 | type UIActionResult struct { |
| 450 | Accepted bool `json:"accepted"` |
| 451 | Message string `json:"message,omitempty"` |
| 452 | } |
| 453 | |
| 454 | // UISubmitParams is a generated Extension Protocol v2 wire DTO. |
| 455 | type UISubmitParams struct { |
| 456 | SurfaceID string `json:"surfaceId" validate:"nonempty"` |
| 457 | SessionID string `json:"sessionId" validate:"nonempty"` |
| 458 | Generation uint64 `json:"generation"` |
| 459 | Values map[string]any `json:"values"` |
| 460 | } |
| 461 | |
| 462 | // UISubmitResult is a generated Extension Protocol v2 wire DTO. |
| 463 | type UISubmitResult struct { |
| 464 | Accepted bool `json:"accepted"` |
| 465 | } |
| 466 | |
| 467 | // ContentReadParams is a generated Extension Protocol v2 wire DTO. |
| 468 | type ContentReadParams struct { |
| 469 | ContentRef string `json:"contentRef" validate:"nonempty"` |
| 470 | Offset int64 `json:"offset" validate:"min=0"` |
| 471 | } |
| 472 | |
| 473 | // ContentReadResult is a generated Extension Protocol v2 wire DTO. |
| 474 | type ContentReadResult struct { |
| 475 | ContentRef string `json:"contentRef" validate:"nonempty"` |
| 476 | Offset int64 `json:"offset" validate:"min=0"` |
| 477 | DataBase64 string `json:"dataBase64"` |
| 478 | NextOffset *int64 `json:"nextOffset,omitempty" validate:"min=0"` |
| 479 | TotalBytes int64 `json:"totalBytes" validate:"min=0"` |
| 480 | SHA256 string `json:"sha256" validate:"sha256"` |
| 481 | Encoding ContentEncoding `json:"encoding"` |
| 482 | } |
| 483 | |
| 484 | // ContentEncoding is a generated Extension Protocol v2 string enum. |
| 485 | type ContentEncoding string |
| 486 | |
| 487 | const ( |
| 488 | ContentUTF8 ContentEncoding = "utf8" |
| 489 | ) |
| 490 | |
| 491 | // UIPublishParams is a generated Extension Protocol v2 wire DTO. |
| 492 | type UIPublishParams struct { |
| 493 | SurfaceID string `json:"surfaceId" validate:"nonempty"` |
| 494 | SessionID string `json:"sessionId" validate:"nonempty"` |
| 495 | Generation uint64 `json:"generation"` |
| 496 | Kind UISurfaceKind `json:"kind"` |
| 497 | Payload json.RawMessage `json:"payload"` |
| 498 | } |
| 499 | |
| 500 | // UISurfaceKind is a generated Extension Protocol v2 string enum. |
| 501 | type UISurfaceKind string |
| 502 | |
| 503 | const ( |
| 504 | UISurfaceStatus UISurfaceKind = "status" |
| 505 | UISurfaceCard UISurfaceKind = "card" |
| 506 | UISurfaceForm UISurfaceKind = "form" |
| 507 | UISurfaceNotification UISurfaceKind = "notification" |
| 508 | ) |
| 509 | |
| 510 | // UIPublishResult is a generated Extension Protocol v2 wire DTO. |
| 511 | type UIPublishResult struct { |
| 512 | Accepted bool `json:"accepted"` |
| 513 | } |
| 514 | |
| 515 | // UIRequestParams is a generated Extension Protocol v2 wire DTO. |
| 516 | type UIRequestParams struct { |
| 517 | SurfaceID string `json:"surfaceId" validate:"nonempty"` |
| 518 | SessionID string `json:"sessionId" validate:"nonempty"` |
| 519 | Generation uint64 `json:"generation"` |
| 520 | Kind UIRequestKind `json:"kind"` |
| 521 | Payload json.RawMessage `json:"payload"` |
| 522 | } |
| 523 | |
| 524 | // UIRequestKind is a generated Extension Protocol v2 string enum. |
| 525 | type UIRequestKind string |
| 526 | |
| 527 | const ( |
| 528 | UIRequestConfirm UIRequestKind = "confirm" |
| 529 | UIRequestInput UIRequestKind = "input" |
| 530 | UIRequestSelect UIRequestKind = "select" |
| 531 | UIRequestMultiselect UIRequestKind = "multiselect" |
| 532 | ) |
| 533 | |
| 534 | // UIRequestResult is a generated Extension Protocol v2 wire DTO. |
| 535 | type UIRequestResult struct { |
| 536 | Cancelled bool `json:"cancelled"` |
| 537 | Values map[string]any `json:"values,omitempty"` |
| 538 | } |
| 539 | |
| 540 | // UIStatusPayload is a generated Extension Protocol v2 wire DTO. |
| 541 | type UIStatusPayload struct { |
| 542 | Label string `json:"label" validate:"nonempty"` |
| 543 | Detail string `json:"detail,omitempty"` |
| 544 | Severity UISeverity `json:"severity,omitempty"` |
| 545 | Progress *float64 `json:"progress,omitempty"` |
| 546 | } |
| 547 | |
| 548 | // UISeverity is a generated Extension Protocol v2 string enum. |
| 549 | type UISeverity string |
| 550 | |
| 551 | const ( |
| 552 | UISeverityInfo UISeverity = "info" |
| 553 | UISeverityWarn UISeverity = "warn" |
| 554 | UISeverityError UISeverity = "error" |
| 555 | ) |
| 556 | |
| 557 | // UICardPayload is a generated Extension Protocol v2 wire DTO. |
| 558 | type UICardPayload struct { |
| 559 | Title string `json:"title,omitempty"` |
| 560 | Markdown string `json:"markdown,omitempty"` |
| 561 | Text string `json:"text,omitempty"` |
| 562 | Fields []UIKeyValue `json:"fields,omitempty"` |
| 563 | Progress *float64 `json:"progress,omitempty"` |
| 564 | Actions []UIActionRef `json:"actions,omitempty"` |
| 565 | } |
| 566 | |
| 567 | // UIKeyValue is a generated Extension Protocol v2 wire DTO. |
| 568 | type UIKeyValue struct { |
| 569 | Key string `json:"key" validate:"nonempty"` |
| 570 | Value string `json:"value"` |
| 571 | } |
| 572 | |
| 573 | // UIActionRef is a generated Extension Protocol v2 wire DTO. |
| 574 | type UIActionRef struct { |
| 575 | ActionID string `json:"actionId" validate:"nonempty"` |
| 576 | Label string `json:"label" validate:"nonempty"` |
| 577 | } |
| 578 | |
| 579 | // UIFormPayload is a generated Extension Protocol v2 wire DTO. |
| 580 | type UIFormPayload struct { |
| 581 | Title string `json:"title,omitempty"` |
| 582 | Message string `json:"message,omitempty"` |
| 583 | Fields []UIFormField `json:"fields"` |
| 584 | } |
| 585 | |
| 586 | // UIFormField is a generated Extension Protocol v2 wire DTO. |
| 587 | type UIFormField struct { |
| 588 | Key string `json:"key" validate:"nonempty"` |
| 589 | Label string `json:"label,omitempty"` |
| 590 | Kind UIFieldKind `json:"kind"` |
| 591 | Options []string `json:"options,omitempty"` |
| 592 | Default any `json:"default,omitempty"` |
| 593 | Required bool `json:"required,omitempty"` |
| 594 | } |
| 595 | |
| 596 | // UIFieldKind is a generated Extension Protocol v2 string enum. |
| 597 | type UIFieldKind string |
| 598 | |
| 599 | const ( |
| 600 | UIFieldConfirm UIFieldKind = "confirm" |
| 601 | UIFieldInput UIFieldKind = "input" |
| 602 | UIFieldSelect UIFieldKind = "select" |
| 603 | UIFieldMultiselect UIFieldKind = "multiselect" |
| 604 | ) |
| 605 | |
| 606 | // UINotificationPayload is a generated Extension Protocol v2 wire DTO. |
| 607 | type UINotificationPayload struct { |
| 608 | Title string `json:"title" validate:"nonempty"` |
| 609 | Body string `json:"body,omitempty"` |
| 610 | Severity UISeverity `json:"severity,omitempty"` |
| 611 | } |
| 612 | |
| 613 | // ProtocolErrorData is a generated Extension Protocol v2 wire DTO. |
| 614 | type ProtocolErrorData struct { |
| 615 | Reason ErrorReason `json:"reason"` |
| 616 | Retryable bool `json:"retryable"` |
| 617 | } |
| 618 | |
| 619 | // ErrorReason is a generated Extension Protocol v2 string enum. |
| 620 | type ErrorReason string |
| 621 | |
| 622 | const ( |
| 623 | ErrActivationFailed ErrorReason = "activation_failed" |
| 624 | ErrCapabilityNotDeclared ErrorReason = "capability_not_declared" |
| 625 | ErrCleanupFailed ErrorReason = "cleanup_failed" |
| 626 | ErrContentRefExpired ErrorReason = "content_ref_expired" |
| 627 | ErrDependencyCycle ErrorReason = "dependency_cycle" |
| 628 | ErrDependencyUnsatisfied ErrorReason = "dependency_unsatisfied" |
| 629 | ErrFrameTooLarge ErrorReason = "frame_too_large" |
| 630 | ErrInterceptTimeout ErrorReason = "intercept_timeout" |
| 631 | ErrInternal ErrorReason = "internal" |
| 632 | ErrInvalidParams ErrorReason = "invalid_params" |
| 633 | ErrProtocolError ErrorReason = "protocol_error" |
| 634 | ErrProviderFailed ErrorReason = "provider_failed" |
| 635 | ErrProviderInterrupted ErrorReason = "provider_interrupted" |
| 636 | ErrSchemaMismatch ErrorReason = "schema_mismatch" |
| 637 | ErrShutdownTimeout ErrorReason = "shutdown_timeout" |
| 638 | ErrStaleGeneration ErrorReason = "stale_generation" |
| 639 | ErrStreamCancelled ErrorReason = "stream_cancelled" |
| 640 | ErrStreamGap ErrorReason = "stream_gap" |
| 641 | ErrUnknownMethod ErrorReason = "unknown_method" |
| 642 | ErrUnsupportedVersion ErrorReason = "unsupported_version" |
| 643 | ) |
| 644 |