Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
50 lines
1.4 KiB
Go
50 lines
1.4 KiB
Go
package agentruntime
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
const claudeSDKSidecarProtocolVersion = 10
|
|
|
|
type claudeSDKSidecarRequest struct {
|
|
Version int `json:"version"`
|
|
ID string `json:"id,omitempty"`
|
|
Type string `json:"type"`
|
|
Payload map[string]any `json:"payload,omitempty"`
|
|
}
|
|
|
|
type claudeSDKSidecarEvent struct {
|
|
Version int `json:"version"`
|
|
ID string `json:"id,omitempty"`
|
|
Type string `json:"type"`
|
|
Payload map[string]any `json:"payload,omitempty"`
|
|
inputUnit *ProviderInputUnit
|
|
}
|
|
|
|
func (request *claudeSDKSidecarRequest) normalize() error {
|
|
if request == nil {
|
|
return fmt.Errorf("claude sdk sidecar request is required")
|
|
}
|
|
if request.Version == 0 {
|
|
request.Version = claudeSDKSidecarProtocolVersion
|
|
}
|
|
if request.Version != claudeSDKSidecarProtocolVersion {
|
|
return fmt.Errorf("unsupported claude sdk sidecar protocol version %d", request.Version)
|
|
}
|
|
if strings.TrimSpace(request.Type) == "" {
|
|
return fmt.Errorf("claude sdk sidecar request type is required")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (event claudeSDKSidecarEvent) validate() error {
|
|
if event.Version != claudeSDKSidecarProtocolVersion {
|
|
return fmt.Errorf("unsupported claude sdk sidecar protocol version %d", event.Version)
|
|
}
|
|
if strings.TrimSpace(event.Type) == "" {
|
|
return fmt.Errorf("claude sdk sidecar event type is required")
|
|
}
|
|
return nil
|
|
}
|