MCPcopy Create free account
hub / github.com/compozy/agh / Validate

Method Validate

internal/task/validate.go:1054–1082  ·  view source on GitHub ↗

Validate reports whether the session-start request contains the task and run context required by the bridge.

()

Source from the content-addressed store, hash-verified

1052
1053// Validate reports whether the session-start request contains the task and run context required by the bridge.
1054func (r *StartTaskSession) Validate() error {
1055 if r == nil {
1056 return fmt.Errorf("%w: start_task_session is required", ErrValidation)
1057 }
1058 if err := r.Task.Validate(); err != nil {
1059 return err
1060 }
1061 if err := r.Run.Validate(); err != nil {
1062 return err
1063 }
1064 if err := r.Actor.Validate(); err != nil {
1065 return err
1066 }
1067 if strings.TrimSpace(r.Run.TaskID) != strings.TrimSpace(r.Task.ID) {
1068 return fmt.Errorf("%w: start_task_session.run.task_id must match start_task_session.task.id", ErrValidation)
1069 }
1070 if r.ExecutionProfile != nil {
1071 if strings.TrimSpace(r.ExecutionProfile.TaskID) != strings.TrimSpace(r.Task.ID) {
1072 return fmt.Errorf(
1073 "%w: start_task_session.execution_profile.task_id must match start_task_session.task.id",
1074 ErrValidation,
1075 )
1076 }
1077 if err := r.ExecutionProfile.Validate(DefaultExecutionProfileValidationOptions()); err != nil {
1078 return err
1079 }
1080 }
1081 return nil
1082}
1083
1084// Validate reports whether the session reference returned by the bridge is usable.
1085func (r SessionRef) Validate() error {

Callers 2

Calls 2

ValidateMethod · 0.65

Tested by 2