Documentation
¶
Index ¶
- Constants
- Variables
- func Apply(ctx context.Context, store Store, s Settings, runID string, generation int64, ...) []byte
- func InjectRetrieveTool(body []byte) []byte
- func IsDisabled(err error) bool
- func IsMissingRef(err error) bool
- func Live(s Settings, store Store) bool
- func ParseRef(args json.RawMessage) string
- func Retrieve(ctx context.Context, store Store, s Settings, runID string, generation int64, ...) ([]byte, error)
- type FailStore
- func (f FailStore) DecrBy(context.Context, string, int64) (int64, error)
- func (f FailStore) Expire(context.Context, string, time.Duration) error
- func (f FailStore) Get(context.Context, string) ([]byte, error)
- func (f FailStore) IncrBy(context.Context, string, int64) (int64, error)
- func (f FailStore) Set(context.Context, string, []byte, time.Duration) error
- type MemoryStore
- func (m *MemoryStore) DecrBy(_ context.Context, key string, n int64) (int64, error)
- func (m *MemoryStore) Expire(context.Context, string, time.Duration) error
- func (m *MemoryStore) Get(_ context.Context, key string) ([]byte, error)
- func (m *MemoryStore) IncrBy(_ context.Context, key string, n int64) (int64, error)
- func (m *MemoryStore) Set(_ context.Context, key string, value []byte, _ time.Duration) error
- type RedisAPI
- type Settings
- type Store
Constants ¶
const ToolName = "runkite_retrieve_payload"
ToolName is injected on tools/list and intercepted on tools/call so the runner's MCP client never forwards the retrieve to the connector.
Variables ¶
var ErrNotFound = errors.New("payload not found")
ErrNotFound is a cache miss (expired TTL, wrong ref, or never stored).
Functions ¶
func Apply ¶
func Apply(ctx context.Context, store Store, s Settings, runID string, generation int64, respBody []byte) []byte
Apply rewrites a successful JSON-RPC tools/call body when it is over max_bytes and the stash fits the run+generation budget. On any store error it returns the original body. Downstream already succeeded, so this never fails the MCP call.
func InjectRetrieveTool ¶
InjectRetrieveTool appends (or replaces) the retrieve tool on a tools/list JSON-RPC result. Unparseable bodies pass through.
func IsDisabled ¶
func IsMissingRef ¶
func ParseRef ¶
func ParseRef(args json.RawMessage) string
Types ¶
type FailStore ¶
type FailStore struct {
Err error
}
FailStore returns Err on every method so a Redis blip cannot fail the already-successful downstream tools/call.
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
MemoryStore is an in-process stash for tests. TTL is ignored.
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
type RedisAPI ¶
type RedisAPI interface {
Get(ctx context.Context, key string) *redis.StringCmd
Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *redis.StatusCmd
IncrBy(ctx context.Context, key string, value int64) *redis.IntCmd
DecrBy(ctx context.Context, key string, decrement int64) *redis.IntCmd
Expire(ctx context.Context, key string, expiration time.Duration) *redis.BoolCmd
}
RedisAPI is the go-redis subset Store needs.
type Settings ¶
type Settings struct {
Enabled bool
MaxBytes int
PreviewBytes int
CacheTTL time.Duration
MaxStoreBytes int
}
Settings is the runtime shrink config after defaults and validation.
type Store ¶
type Store interface {
Get(ctx context.Context, key string) ([]byte, error)
Set(ctx context.Context, key string, value []byte, ttl time.Duration) error
IncrBy(ctx context.Context, key string, n int64) (int64, error)
DecrBy(ctx context.Context, key string, n int64) (int64, error)
Expire(ctx context.Context, key string, ttl time.Duration) error
}
Store is the Redis (or test) backend for original MCP result bytes.