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

Method memoryHealthWorkspaces

internal/api/core/memory.go:2441–2473  ·  view source on GitHub ↗
(ctx context.Context, rawWorkspace string)

Source from the content-addressed store, hash-verified

2439}
2440
2441func (h *BaseHandlers) memoryHealthWorkspaces(ctx context.Context, rawWorkspace string) ([]string, error) {
2442 if strings.TrimSpace(rawWorkspace) != "" {
2443 workspace, _, err := h.resolveMemoryWorkspaceRef(ctx, rawWorkspace)
2444 if err != nil {
2445 return nil, err
2446 }
2447 return []string{workspace}, nil
2448 }
2449
2450 infos, err := h.Sessions.ListAll(ctx)
2451 if err != nil {
2452 return nil, err
2453 }
2454
2455 workspaces := make([]string, 0, len(infos))
2456 seen := make(map[string]struct{}, len(infos))
2457 for _, info := range infos {
2458 if info == nil || strings.TrimSpace(info.Workspace) == "" {
2459 continue
2460 }
2461 workspace, err := resolveMemoryWorkspace(info.Workspace)
2462 if err != nil {
2463 return nil, err
2464 }
2465 if _, exists := seen[workspace]; exists {
2466 continue
2467 }
2468 seen[workspace] = struct{}{}
2469 workspaces = append(workspaces, workspace)
2470 }
2471
2472 return workspaces, nil
2473}
2474
2475// MemoryHealthWorkspaces returns the workspaces considered for memory health checks.
2476func (h *BaseHandlers) MemoryHealthWorkspaces(ctx context.Context, rawWorkspace string) ([]string, error) {

Callers 2

memoryHealthSnapshotMethod · 0.95

Calls 4

appendFunction · 0.85
resolveMemoryWorkspaceFunction · 0.70
ListAllMethod · 0.65

Tested by

no test coverage detected