MCPcopy Index your code
hub / github.com/anomalyco/opencode / sessionHistory

Function sessionHistory

packages/opencode/src/cli/cmd/run/session.shared.ts:163–179  ·  view source on GitHub ↗
(session: RunSession, limit = LIMIT)

Source from the content-addressed store, hash-verified

161}
162
163export function sessionHistory(session: RunSession, limit = LIMIT): RunPrompt[] {
164 const out: RunPrompt[] = []
165
166 for (const turn of session.turns) {
167 if (!turn.prompt.text.trim()) {
168 continue
169 }
170
171 if (out[out.length - 1] && promptSame(out[out.length - 1], turn.prompt)) {
172 continue
173 }
174
175 out.push(promptCopy(turn.prompt))
176 }
177
178 return out.slice(-limit)
179}
180
181export function sessionVariant(session: RunSession, model: RunInput["model"]): string | undefined {
182 if (!model) {

Callers 2

runtime.boot.tsFile · 0.90

Calls 3

promptSameFunction · 0.90
promptCopyFunction · 0.90
pushMethod · 0.80

Tested by

no test coverage detected