MCPcopy Create free account
hub / github.com/betta-tech/byo-coding-agent / Compact

Method Compact

internal/compact/logging.go:25–41  ·  view source on GitHub ↗
(ctx context.Context, messages []api.Message)

Source from the content-addressed store, hash-verified

23}
24
25func (l *LoggingStrategy) Compact(ctx context.Context, messages []api.Message) ([]api.Message, error) {
26 before := messages
27 after, err := l.Inner.Compact(ctx, messages)
28 if err != nil {
29 return after, err
30 }
31 if len(after) == len(before) {
32 return after, nil
33 }
34 if l.FilePath == "" {
35 return after, nil
36 }
37 if writeErr := l.writeEvent(before, after); writeErr != nil {
38 fmt.Printf("compaction log write failed: %v\n", writeErr)
39 }
40 return after, nil
41}
42
43func (l *LoggingStrategy) writeEvent(before, after []api.Message) error {
44 f, err := os.OpenFile(l.FilePath, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)

Callers

nothing calls this directly

Calls 2

writeEventMethod · 0.95
CompactMethod · 0.65

Tested by

no test coverage detected