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
77 lines
2.5 KiB
Go
77 lines
2.5 KiB
Go
package agentruntime
|
|
|
|
import "errors"
|
|
|
|
const (
|
|
AppErrorProviderSessionNotFound = "agent.provider_session_not_found"
|
|
AppErrorProviderSessionCreateFailed = "agent.provider_session_create_failed"
|
|
AppErrorProviderAcceptanceMissingIdentity = "provider_acceptance_missing_identity"
|
|
AppErrorProcessCleanupPending = "agent.process_cleanup_pending"
|
|
AppErrorResumeSessionNotLocal = "agent.resume_session_not_local"
|
|
)
|
|
|
|
var (
|
|
// ErrProviderStartTimeout is attached only by a provider adapter that has
|
|
// reached its provider-readiness boundary and observed the start deadline
|
|
// before a runtime Session was established. Callers must not infer this
|
|
// verdict from an arbitrary context deadline.
|
|
ErrProviderStartTimeout = errors.New("agent provider start timed out")
|
|
ErrSessionDisconnected = errors.New("agent session is not connected")
|
|
ErrInteractiveRequestNotLive = errors.New("interactive request is no longer live")
|
|
ErrInteractiveAlreadyAnswered = errors.New("interactive request has already been answered")
|
|
ErrInteractiveResponseInvalid = errors.New("interactive response is invalid")
|
|
ErrSessionNoActiveTurn = errors.New("agent session has no active turn")
|
|
ErrProviderStateLost = errors.New("agent provider state was lost")
|
|
ErrCancelTargetMismatch = errors.New("agent cancellation target is no longer active")
|
|
ErrActiveTurnTargetRequired = errors.New("active-turn guidance requires an exact target turn")
|
|
ErrActiveTurnTargetMismatch = errors.New("active-turn guidance target is no longer active")
|
|
ErrActiveTurnGuidanceUnsupported = errors.New("agent provider does not support active-turn guidance")
|
|
ErrMCPHTTPUnsupported = errors.New("agent provider does not support HTTP MCP servers")
|
|
)
|
|
|
|
type AppError struct {
|
|
Code string
|
|
Message string
|
|
DebugMessage string
|
|
Cause error
|
|
}
|
|
|
|
func (e *AppError) Error() string {
|
|
if e == nil {
|
|
return ""
|
|
}
|
|
if e.Message != "" {
|
|
return e.Message
|
|
}
|
|
if e.Code != "" {
|
|
return e.Code
|
|
}
|
|
if e.Cause != nil {
|
|
return e.Cause.Error()
|
|
}
|
|
return "agent session error"
|
|
}
|
|
|
|
func (e *AppError) Unwrap() error {
|
|
if e == nil {
|
|
return nil
|
|
}
|
|
return e.Cause
|
|
}
|
|
|
|
func AppErrorCode(err error) string {
|
|
var appErr *AppError
|
|
if !errors.As(err, &appErr) || appErr == nil {
|
|
return ""
|
|
}
|
|
return appErr.Code
|
|
}
|
|
|
|
func AppErrorDebugMessage(err error) string {
|
|
var appErr *AppError
|
|
if !errors.As(err, &appErr) || appErr == nil {
|
|
return ""
|
|
}
|
|
return appErr.DebugMessage
|
|
}
|