Skip to content

Sessions API

AgentSession and UserSession are intentionally separated for safety.

interface AgentSession {
read(path: string): Promise<Bytes>
write(path: string, bytes: Bytes): Promise<void>
commit(message: string): Promise<Sha>
writeAndCommit(opts: { files: Record<string, Bytes>, message: string }): Promise<Sha>
list(path: string): Promise<Entry[]>
diff(): Promise<UnifiedDiff>
log(): Promise<Commit[]>
}
interface UserSession extends AgentSession {
promote(opts: PromoteOpts): Promise<PromoteResult>
discard(): Promise<void>
extend(ttl: Duration): Promise<void>
forAgent(): AgentSession
}

AgentSession has no promote method by design.