foley.agent.session#
Session-scoped audition state — cached candidates, picks, and rejects (#12).
An interactive/agentic foley loop is stateful: find / search surface candidates,
the user (or an LLM) previews, picks and rejects them, and plan / weave
then consume the picks. SessionStore holds that state in three namespaced dol
stores under FOLEY_DATA_DIR/sessions/{id}/ (swap in any Mapping for the cloud):
candidates — the full
Candidate.to_dict()keyed by sound id; the *rehydration source* soplan/weavecan rebuild realCandidateobjects from ids without the agent ever handling the heavy object. Internal — never exposed as writable MCP CRUD (protects thefrom_dictsource).picks — accepted sounds (+ optional layer/onset) that
planfolds into a timeline.rejects — dismissed sounds that feed
refine’s relevance feedback.
Stdlib + dol only (via foley.stores); keeps import foley dol-only.
Classes
|
Three namespaced stores for one audition session (candidates / picks / rejects). |
- class foley.agent.session.SessionStore(session_id='default', candidates=None, picks=None, rejects=None)[source]#
Bases:
objectThree namespaced stores for one audition session (candidates / picks / rejects).
Each store defaults to a
foley.stores.make_session_store()JSON store; tests inject plain dicts. All values are JSON-safe dicts.- Parameters:
- add_pick(sound_id, *, layer=None, onset=None)[source]#
Persist an accepted pick (+ optional layer/onset); return the pick count.
- Return type:
- add_reject(sound_id, *, reason=None)[source]#
Record a rejected sound (feeds
refinerelevance feedback); return the count.- Return type:
- cache_candidates(candidates)[source]#
Cache each candidate’s full
to_dict()keyed by sound id; return the count cached.- Return type:
- drop_pick(sound_id)[source]#
Remove a pick (idempotent); return the remaining pick count.
- Return type: