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

Method handleSessionsEvents

internal/extension/host_api.go:1013–1049  ·  view source on GitHub ↗
(ctx context.Context, raw json.RawMessage)

Source from the content-addressed store, hash-verified

1011}
1012
1013func (h *HostAPIHandler) handleSessionsEvents(ctx context.Context, raw json.RawMessage) (any, error) {
1014 var params hostAPISessionEventsParams
1015 if err := decodeHostAPIParams(raw, &params); 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
1051func (h *HostAPIHandler) handleSandboxList(ctx context.Context, raw json.RawMessage) (any, error) {
1052 if h.sessions == nil {

Callers

nothing calls this directly

Calls 6

decodeHostAPIParamsFunction · 0.85
invalidParamsRPCErrorFunction · 0.85
appendFunction · 0.85
decodeJSONValueFunction · 0.85
EventsMethod · 0.65

Tested by

no test coverage detected