cache

package
v7.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CodexReasoningReplayCacheTTL limits how long encrypted reasoning replay
	// items stay in process memory.
	CodexReasoningReplayCacheTTL = 1 * time.Hour

	// CodexReasoningReplayCacheMaxEntries bounds process memory for replay
	// continuity. Oldest entries are evicted first.
	CodexReasoningReplayCacheMaxEntries = 10240

	// CodexReasoningReplayCacheEvictBatchSize leaves headroom after the cache
	// reaches capacity so high write volume does not rescan the map every turn.
	CodexReasoningReplayCacheEvictBatchSize = 128
)
View Source
const (
	// SignatureCacheTTL is how long signatures are valid
	SignatureCacheTTL = 3 * time.Hour

	// SignatureTextHashLen is the length of the hash key (16 hex chars = 64-bit key space)
	SignatureTextHashLen = 16

	// MinValidSignatureLen is the minimum length for a signature to be considered valid
	MinValidSignatureLen = 50

	// CacheCleanupInterval controls how often stale entries are purged
	CacheCleanupInterval = 10 * time.Minute
)

Variables

This section is empty.

Functions

func CacheCodexReasoningReplayItem added in v7.1.40

func CacheCodexReasoningReplayItem(modelName, sessionKey string, item []byte) bool

CacheCodexReasoningReplayItem stores a final GPT/Codex reasoning item for stateless replay. The stored item is normalized to the minimal shape accepted by Responses input replay.

func CacheCodexReasoningReplayItems added in v7.1.40

func CacheCodexReasoningReplayItems(modelName, sessionKey string, items [][]byte) bool

CacheCodexReasoningReplayItems stores the final GPT/Codex assistant output items needed to replay a stateless next turn.

func CacheCodexReasoningReplayItemsBestEffort added in v7.2.0

func CacheCodexReasoningReplayItemsBestEffort(ctx context.Context, modelName, sessionKey string, items [][]byte) bool

CacheCodexReasoningReplayItemsBestEffort stores replay items for completed response paths.

func CacheSignature

func CacheSignature(modelName, text, signature string)

CacheSignature stores a thinking signature for a given model group and text. Used for Claude models that require signed thinking blocks in multi-turn conversations.

func CacheSignatureBestEffort added in v7.2.0

func CacheSignatureBestEffort(ctx context.Context, modelName, text, signature string) bool

CacheSignatureBestEffort stores a thinking signature for completed response paths.

func ClearCodexReasoningReplayCache added in v7.1.40

func ClearCodexReasoningReplayCache()

ClearCodexReasoningReplayCache clears all Codex reasoning replay state.

func ClearSignatureCache

func ClearSignatureCache(modelName string)

ClearSignatureCache clears signature cache for a specific model group or all groups.

func DeleteCachedSignatureRequired added in v7.2.0

func DeleteCachedSignatureRequired(ctx context.Context, modelName, text string) error

DeleteCachedSignatureRequired removes one exact cached signature.

func DeleteCodexReasoningReplayItem added in v7.1.40

func DeleteCodexReasoningReplayItem(modelName, sessionKey string)

DeleteCodexReasoningReplayItem removes one replay item after upstream rejects it or the caller otherwise knows it is stale.

func DeleteCodexReasoningReplayItemRequired added in v7.2.0

func DeleteCodexReasoningReplayItemRequired(ctx context.Context, modelName, sessionKey string) error

DeleteCodexReasoningReplayItemRequired removes one replay item for request-time paths.

func GetCachedSignature

func GetCachedSignature(modelName, text string) string

GetCachedSignature retrieves a cached signature for a given model group and text. Returns empty string if not found or expired.

func GetCachedSignatureRequired added in v7.2.0

func GetCachedSignatureRequired(ctx context.Context, modelName, text string) (string, error)

GetCachedSignatureRequired retrieves a cached signature for request-time paths.

func GetCodexReasoningReplayItem added in v7.1.40

func GetCodexReasoningReplayItem(modelName, sessionKey string) ([]byte, bool)

GetCodexReasoningReplayItem retrieves a normalized reasoning replay item.

func GetCodexReasoningReplayItems added in v7.1.40

func GetCodexReasoningReplayItems(modelName, sessionKey string) ([][]byte, bool)

GetCodexReasoningReplayItems retrieves normalized assistant output items.

func GetCodexReasoningReplayItemsRequired added in v7.2.0

func GetCodexReasoningReplayItemsRequired(ctx context.Context, modelName, sessionKey string) ([][]byte, bool, error)

GetCodexReasoningReplayItemsRequired retrieves replay items for request-time paths.

func GetModelGroup

func GetModelGroup(modelName string) string

func HasValidSignature

func HasValidSignature(modelName, signature string) bool

HasValidSignature checks if a signature is valid (non-empty and long enough)

func SetSignatureBypassStrictMode

func SetSignatureBypassStrictMode(strict bool)

SetSignatureBypassStrictMode controls whether bypass mode uses strict protobuf-tree validation.

func SetSignatureCacheEnabled

func SetSignatureCacheEnabled(enabled bool)

SetSignatureCacheEnabled switches Antigravity signature handling between cache mode and bypass mode.

func SignatureBypassStrictMode

func SignatureBypassStrictMode() bool

SignatureBypassStrictMode returns whether bypass mode uses strict protobuf-tree validation.

func SignatureCacheEnabled

func SignatureCacheEnabled() bool

SignatureCacheEnabled returns whether signature cache validation is enabled.

Types

type SignatureEntry

type SignatureEntry struct {
	Signature string
	Timestamp time.Time
}

SignatureEntry holds a cached thinking signature with timestamp

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL