(id toolspkg.ToolID)
| 3961 | } |
| 3962 | |
| 3963 | func (i sessionEventQueryInput) eventQuery(id toolspkg.ToolID) (store.EventQuery, error) { |
| 3964 | query := store.EventQuery{ |
| 3965 | Type: strings.TrimSpace(i.Type), |
| 3966 | AgentName: strings.TrimSpace(i.AgentName), |
| 3967 | TurnID: strings.TrimSpace(i.TurnID), |
| 3968 | AfterSequence: i.AfterSequence, |
| 3969 | Limit: i.Limit, |
| 3970 | } |
| 3971 | if rawSince := strings.TrimSpace(i.Since); rawSince != "" { |
| 3972 | since, err := time.Parse(time.RFC3339, rawSince) |
| 3973 | if err != nil { |
| 3974 | return store.EventQuery{}, toolspkg.NewToolError( |
| 3975 | toolspkg.ErrorCodeInvalidInput, |
| 3976 | id, |
| 3977 | "session event since must be an RFC3339 timestamp", |
| 3978 | fmt.Errorf("%w: %w", toolspkg.ErrToolInvalidInput, err), |
| 3979 | toolspkg.ReasonSchemaInvalid, |
| 3980 | ) |
| 3981 | } |
| 3982 | query.Since = since |
| 3983 | } |
| 3984 | if err := query.Validate(); err != nil { |
| 3985 | return store.EventQuery{}, toolspkg.NewToolError( |
| 3986 | toolspkg.ErrorCodeInvalidInput, |
| 3987 | id, |
| 3988 | "session event query is invalid", |
| 3989 | fmt.Errorf("%w: %w", toolspkg.ErrToolInvalidInput, err), |
| 3990 | toolspkg.ReasonSchemaInvalid, |
| 3991 | ) |
| 3992 | } |
| 3993 | return query, nil |
| 3994 | } |
| 3995 | |
| 3996 | type workspaceRefInput struct { |
| 3997 | Workspace string `json:"workspace"` |
no test coverage detected