MCPcopy Create free account
hub / github.com/Noumena-Network/code / countUserPromptsFromEntries

Function countUserPromptsFromEntries

src/utils/attribution.ts:157–163  ·  view source on GitHub ↗

* Count non-sidechain user messages in transcript entries. * Used to calculate the number of "steers" (user prompts - 1). * * Counts user messages that contain actual user-typed text, * excluding tool_result blocks, sidechain messages, and terminal output.

(entries: ReadonlyArray<Entry>)

Source from the content-addressed store, hash-verified

155 * excluding tool_result blocks, sidechain messages, and terminal output.
156 */
157function countUserPromptsFromEntries(entries: ReadonlyArray<Entry>): number {
158 const nonSidechain = entries.filter(
159 entry =>
160 entry.type === 'user' && !('isSidechain' in entry && entry.isSidechain),
161 )
162 return countUserPromptsInMessages(nonSidechain)
163}
164
165/**
166 * Get full attribution data from the provided AppState's attribution state.

Callers 1

getTranscriptStatsFunction · 0.85

Calls 1

Tested by

no test coverage detected