MCPcopy Create free account
hub / github.com/cucoleadan/opencode-cowork-proxy / hasCacheControl

Function hasCacheControl

src/cache.ts:22–33  ·  view source on GitHub ↗
(messages: any[], system?: any)

Source from the content-addressed store, hash-verified

20
21/** Check if any message or system prompt has Anthropic cache_control markers */
22export function hasCacheControl(messages: any[], system?: any): boolean {
23 if (Array.isArray(system)) {
24 if (system.some((s: any) => s.cache_control)) return true;
25 }
26 if (typeof system === 'object' && system?.cache_control) return true;
27 for (const msg of messages || []) {
28 if (Array.isArray(msg.content)) {
29 if (msg.content.some((block: any) => block.cache_control)) return true;
30 }
31 }
32 return false;
33}
34
35function tokenCount(...values: any[]): number {
36 for (const value of values) {

Callers 1

cache.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected