MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / record

Method record

src/mcp/explore-session-state.ts:220–241  ·  view source on GitHub ↗

* File an emission. Returns the record as stored (with its session call * index), or `null` if the emission was unusable.

(emission: ExploreEmission)

Source from the content-addressed store, hash-verified

218 * index), or `null` if the emission was unusable.
219 */
220 record(emission: ExploreEmission): ExploreCallRecord | null {
221 if (!emission || typeof emission.projectRoot !== 'string' || !emission.projectRoot) return null;
222 const key = exploreProjectKey(emission.projectRoot);
223 const state = this.touch(key, emission.projectRoot);
224
225 state.callCount += 1;
226 state.responseBytes += Math.max(0, emission.responseBytes || 0);
227
228 const record: ExploreCallRecord = {
229 index: state.callCount,
230 projectRoot: emission.projectRoot,
231 query: typeof emission.query === 'string' ? emission.query : '',
232 files: this.boundFiles(emission.files),
233 sourceBytes: Math.max(0, emission.sourceBytes || 0),
234 responseBytes: Math.max(0, emission.responseBytes || 0),
235 };
236 state.calls.push(record);
237 if (state.calls.length > EXPLORE_SESSION_LIMITS.MAX_CALLS_RETAINED) {
238 state.calls.splice(0, state.calls.length - EXPLORE_SESSION_LIMITS.MAX_CALLS_RETAINED);
239 }
240 return record;
241 }
242
243 /** Full state for one project, or `null` if it was never queried this session. */
244 forProject(projectRoot: string): ExploreProjectState | null {

Callers 2

takeExploreEmissionMethod · 0.80

Calls 4

touchMethod · 0.95
boundFilesMethod · 0.95
exploreProjectKeyFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected