| 128 | } |
| 129 | |
| 130 | func memoryEventQueryForWorkspaces( |
| 131 | ctx context.Context, |
| 132 | query store.EventSummaryQuery, |
| 133 | workspaces []string, |
| 134 | ) (store.EventSummaryQuery, error) { |
| 135 | if strings.TrimSpace(query.WorkspaceID) == "" || len(workspaces) != 1 { |
| 136 | return query, nil |
| 137 | } |
| 138 | workspaceRoot := strings.TrimSpace(workspaces[0]) |
| 139 | if workspaceRoot == "" { |
| 140 | return query, nil |
| 141 | } |
| 142 | identity, err := aghworkspace.EnsureIdentity(ctx, workspaceRoot) |
| 143 | if err != nil { |
| 144 | return store.EventSummaryQuery{}, fmt.Errorf( |
| 145 | "observe: resolve memory event workspace identity %q: %w", |
| 146 | workspaceRoot, |
| 147 | err, |
| 148 | ) |
| 149 | } |
| 150 | query.WorkspaceID = identity.WorkspaceID |
| 151 | return query, nil |
| 152 | } |
| 153 | |
| 154 | // QueryPermissionLog returns permission audit rows. |
| 155 | func (o *Observer) QueryPermissionLog( |