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

Function markLastSystem

packages/llm/src/cache-policy.ts:54–59  ·  view source on GitHub ↗
(system: LLMRequest["system"], hint: CacheHint)

Source from the content-addressed store, hash-verified

52}
53
54const markLastSystem = (system: LLMRequest["system"], hint: CacheHint): LLMRequest["system"] => {
55 if (system.length === 0) return system
56 const last = system.length - 1
57 if (system[last]!.cache) return system
58 return system.map((part, i) => (i === last ? { ...part, cache: hint } : part))
59}
60
61const lastIndexOfRole = (messages: ReadonlyArray<Message>, role: Message["role"]): number =>
62 messages.findLastIndex((m) => m.role === role)

Callers 1

applyCachePolicyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected