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

Function collectMemoryExtractorOutput

internal/daemon/memory_runtime.go:735–754  ·  view source on GitHub ↗
(ctx context.Context, events <-chan acp.AgentEvent)

Source from the content-addressed store, hash-verified

733}
734
735func collectMemoryExtractorOutput(ctx context.Context, events <-chan acp.AgentEvent) (string, error) {
736 var output strings.Builder
737 for {
738 select {
739 case <-ctx.Done():
740 return "", fmt.Errorf("daemon: collect memory extractor output: %w", ctx.Err())
741 case event, ok := <-events:
742 if !ok {
743 return output.String(), nil
744 }
745 switch event.Type {
746 case acp.EventTypeAgentMessage:
747 // Agent messages are stream chunks; inserting separators can corrupt JSONL.
748 output.WriteString(event.Text)
749 case acp.EventTypeError:
750 return "", fmt.Errorf("daemon: memory extractor agent error: %s", strings.TrimSpace(event.Error))
751 }
752 }
753 }
754}
755
756type extractedMemoryLine struct {
757 Type string `json:"type"`

Callers 2

ExtractMethod · 0.85

Calls 3

DoneMethod · 0.65
ErrMethod · 0.45
StringMethod · 0.45

Tested by 1