Documentation
¶
Overview ¶
Package programresume implements authenticated OSC 7577 reports and private per-instance state storage for terminal session restoration.
Index ¶
- Constants
- func Clear(token string, pid int, now time.Time) string
- func NewInstanceID() (string, error)
- func PermissionsHash(allow, ask, deny []string) string
- func Report(token string, pid int, now time.Time, argv []string, cwd string) string
- func ValidInstanceID(id string) bool
- func ValidToken(s string) bool
- func Version() int
- type Instance
- type InstanceStore
- func (s *InstanceStore) Close() error
- func (s *InstanceStore) Delete(id string) error
- func (s *InstanceStore) Exists(id string) bool
- func (s *InstanceStore) Load(id string) (Instance, error)
- func (s *InstanceStore) Prune(now time.Time, maxAge time.Duration, keepID string)
- func (s *InstanceStore) Save(id string, state Instance) error
- type Tab
Constants ¶
const (
StaleInstanceMaxAge = 30 * 24 * time.Hour
)
const TokenEnv = "OSC7577_TOKEN"
Variables ¶
This section is empty.
Functions ¶
func NewInstanceID ¶
NewInstanceID generates a random 128-bit hex instance identifier.
func PermissionsHash ¶
PermissionsHash returns a deterministic SHA-256 fingerprint for a session's permission rules, or "" when no rules are present.
func ValidInstanceID ¶
ValidInstanceID reports whether id is a valid generated instance identifier.
func ValidToken ¶
Types ¶
type Instance ¶
type Instance struct {
Version int `json:"version"`
Agent string `json:"agent"`
AgentCanonical string `json:"agent_canonical"`
ConfigDir string `json:"config_dir"`
DataDir string `json:"data_dir"`
SessionDB string `json:"session_db"`
Tabs []Tab `json:"tabs"`
Active string `json:"active"`
}
Instance contains only the launch context and persisted tab identities, not conversation contents, credentials, or one-shot inputs.
type InstanceStore ¶
type InstanceStore struct {
// contains filtered or unexported fields
}
InstanceStore confines reads and atomic replacements to the private state directory.
func OpenExistingInstanceStore ¶
func OpenExistingInstanceStore(dataDir string) (*InstanceStore, error)
OpenExistingInstanceStore opens an already-existing private instance state directory without creating missing directories.
func OpenInstanceStore ¶
func OpenInstanceStore(dataDir string) (*InstanceStore, error)
OpenInstanceStore opens (creating if necessary) the private instance state directory inside a verified dataDir.
func (*InstanceStore) Close ¶
func (s *InstanceStore) Close() error
func (*InstanceStore) Delete ¶
func (s *InstanceStore) Delete(id string) error
func (*InstanceStore) Exists ¶
func (s *InstanceStore) Exists(id string) bool
Exists reports whether a regular private instance state file currently exists for id.