MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / runExtraction

Method runExtraction

agent/memory_extraction.go:146–202  ·  view source on GitHub ↗
(ctx context.Context, payload *extractionContext, runID uint64)

Source from the content-addressed store, hash-verified

144 if len(messages) >= limit {
145 break
146 }
147 }
148 return messages, messageIDs, start, end, sessionID, consumerID
149}
150
151func (c *ExtractionController) HasPendingResult() bool {
152 c.mu.Lock()
153 defer c.mu.Unlock()
154 return c.lastResult != nil
155}
156
157func (c *ExtractionController) ConsumeResult() string {
158 c.mu.Lock()
159 defer c.mu.Unlock()
160 if c.lastResult == nil {
161 return ""
162 }
163 result := *c.lastResult
164 c.lastResult = nil
165 return result
166}
167
168func (c *ExtractionController) Cancel() {
169 c.mu.Lock()
170 cancel := c.currentCancel
171 c.currentCancel = nil
172 c.currentRunning = false
173 c.currentRunID++
174 c.pendingContext = nil
175 c.lastResult = nil
176 c.mu.Unlock()
177 if cancel != nil {
178 cancel()
179 }
180}
181
182func (c *ExtractionController) runExtraction(ctx context.Context, payload *extractionContext, runID uint64) {
183 defer func() {
184 c.mu.Lock()
185 pending := c.pendingContext
186 c.pendingContext = nil
187 if pending != nil {
188 runCtx, cancel := context.WithCancel(context.Background())
189 c.currentCancel = cancel
190 c.currentRunning = true
191 c.currentRunID++
192 nextRunID := c.currentRunID
193 c.mu.Unlock()
194 go c.runExtraction(runCtx, pending, nextRunID)
195 return
196 }
197 if c.currentRunID == runID {
198 c.currentRunning = false
199 c.currentCancel = nil
200 }
201 c.mu.Unlock()
202 }()
203 _, _ = c.runFabricExtraction(ctx, payload)

Callers 1

ScheduleMethod · 0.95

Calls 8

defaultRunnerMethod · 0.95
LoadMemoryIndexFunction · 0.92
WriteMemoryIndexFunction · 0.92
BuildExtractionPromptFunction · 0.85
BuildExtractionRegistryFunction · 0.85
FormatExtractionResultFunction · 0.85
firstNonEmptyStringFunction · 0.70

Tested by

no test coverage detected