(ctx context.Context, raw json.RawMessage)
| 1011 | } |
| 1012 | |
| 1013 | func (h *HostAPIHandler) handleSessionsEvents(ctx context.Context, raw json.RawMessage) (any, error) { |
| 1014 | var params hostAPISessionEventsParams |
| 1015 | if err := decodeHostAPIParams(raw, ¶ms); err != nil { |
| 1016 | return nil, err |
| 1017 | } |
| 1018 | if h.sessions == nil { |
| 1019 | return nil, errors.New("extension: session manager is not configured") |
| 1020 | } |
| 1021 | if strings.TrimSpace(params.SessionID) == "" { |
| 1022 | return nil, invalidParamsRPCError(errors.New("session_id is required")) |
| 1023 | } |
| 1024 | if _, err := h.requireHostAPISessionWorkspace(ctx, params.WorkspaceID, params.SessionID); err != nil { |
| 1025 | return nil, err |
| 1026 | } |
| 1027 | |
| 1028 | events, err := h.sessions.Events(ctx, params.SessionID, store.EventQuery{ |
| 1029 | Type: strings.TrimSpace(params.Type), |
| 1030 | AgentName: strings.TrimSpace(params.AgentName), |
| 1031 | TurnID: strings.TrimSpace(params.TurnID), |
| 1032 | Since: params.Since, |
| 1033 | Limit: params.Limit, |
| 1034 | AfterSequence: params.Offset, |
| 1035 | }) |
| 1036 | if err != nil { |
| 1037 | return nil, err |
| 1038 | } |
| 1039 | |
| 1040 | result := make([]hostAPISessionEvent, 0, len(events)) |
| 1041 | for _, event := range events { |
| 1042 | result = append(result, hostAPISessionEvent{ |
| 1043 | Type: event.Type, |
| 1044 | Timestamp: event.Timestamp, |
| 1045 | Data: decodeJSONValue(event.Content), |
| 1046 | }) |
| 1047 | } |
| 1048 | return result, nil |
| 1049 | } |
| 1050 | |
| 1051 | func (h *HostAPIHandler) handleSandboxList(ctx context.Context, raw json.RawMessage) (any, error) { |
| 1052 | if h.sessions == nil { |
nothing calls this directly
no test coverage detected