modestore

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package modestore keeps each session's routing mode override: one small file per Codex thread under <state>/codex-router/modes/<home id>/. The override then survives a launcher or brain restart and a Codex resume of the thread, and a new thread starts without one.

Index

Constants

View Source
const MaxAge = 30 * 24 * time.Hour

MaxAge is how long an override may go unused before Open deletes it. A load counts as use, so a thread still being resumed keeps its override.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is one home's overrides. Safe for concurrent use: each thread has its own file, written atomically.

func Open

func Open(app, homeID string, log *slog.Logger) (*Store, error)

Open returns the store of home homeID under app (statedir.Dir), creating its dir private, and deletes overrides unused for MaxAge.

func (*Store) Load

func (s *Store) Load(thread string) config.RoutingMode

Load is thread's override, "" for none. A file that does not read or parse, or names an unknown mode, is no override. A load marks the file used.

func (*Store) Save

func (s *Store) Save(thread string, m config.RoutingMode)

Save stores thread's override; "" deletes it. A failure only warns: the override still holds in the running engine.

Jump to

Keyboard shortcuts

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