pub struct ProjectContextResolver { /* private fields */ }Implementations§
Source§impl ProjectContextResolver
impl ProjectContextResolver
pub fn new(source: Arc<dyn ProjectContextSource>) -> Self
Sourcepub fn project_id_from_session(session: &Session) -> Option<ProjectId>
pub fn project_id_from_session(session: &Session) -> Option<ProjectId>
Return the stable, opaque Project id persisted on the session.
The domain accessor dual-writes this compatibility key. Keeping the read centralized here prevents memory, Dream, prompt, and resource callers from independently falling back to mutable workspace identity.
Sourcepub fn session_project_identity(session: &Session) -> SessionProjectIdentity
pub fn session_project_identity(session: &Session) -> SessionProjectIdentity
Parse persisted Project membership into an authoritative three-state
value. Whitespace is normalized exactly like the rebuildable storage
index. Callers with security/resource consequences must distinguish
Invalid from truly Unassigned.
Sourcepub fn memory_read_scope_for_session(session: &Session) -> Option<String>
pub fn memory_read_scope_for_session(session: &Session) -> Option<String>
Resolve the Project id used for memory reads.
Assigned sessions always use their stable Project id. The path-derived
fallback is read-compatibility for unassigned legacy sessions only; new
sessions and writes must use Self::project_id_from_session.
pub fn memory_read_identity_for_session( session: &Session, ) -> Option<ProjectMemoryScope>
pub async fn resolve_memory_read_scope( &self, session: &Session, workspace: Option<&Path>, ) -> Result<Option<ProjectMemoryScope>, ProjectContextError>
pub async fn list_memory_read_scopes( &self, ) -> Result<Vec<ProjectMemoryScope>, ProjectContextError>
Sourcepub fn memory_write_scope_for_session(session: &Session) -> Option<String>
pub fn memory_write_scope_for_session(session: &Session) -> Option<String>
Resolve the only valid Project write scope.
Unassigned legacy sessions intentionally return None: their
path-derived scopes are read/migration aliases and must never receive
new Project memory or Dream writes.
pub async fn resolve( &self, session: &Session, workspace: Option<&Path>, ) -> Result<Option<ResolvedProjectContext>, ProjectContextError>
Sourcepub fn resolve_workspace_candidate(
session: &Session,
workspace: Option<&Path>,
) -> Result<Option<PathBuf>, ProjectContextError>
pub fn resolve_workspace_candidate( session: &Session, workspace: Option<&Path>, ) -> Result<Option<PathBuf>, ProjectContextError>
Resolve the exact workspace the runtime will use without publishing it.
This is shared by HTTP preflight, SDK/execute prompt refresh, and the Workspace tool so configured/session-default fallbacks cannot bypass Project ownership checks.
pub async fn workspace_owner( &self, workspace: &Path, ) -> Result<Option<ProjectId>, ProjectContextError>
Sourcepub async fn refresh_session_prompt(
&self,
session: &mut Session,
) -> Result<Option<ResolvedProjectContext>, ProjectContextError>
pub async fn refresh_session_prompt( &self, session: &mut Session, ) -> Result<Option<ResolvedProjectContext>, ProjectContextError>
Resolve and persist the stable Project and mutable Workspace prompt markers immediately.
Session-create and chat APIs call this before their first response so a freshly-created assigned session is already self-describing when read back, rather than waiting for the first execution round. The round prelude calls the same helper to keep the markers current.
Sourcepub async fn refresh_session_prompt_read_only(
&self,
session: &mut Session,
) -> Result<Option<ResolvedProjectContext>, ProjectContextError>
pub async fn refresh_session_prompt_read_only( &self, session: &mut Session, ) -> Result<Option<ResolvedProjectContext>, ProjectContextError>
Resolve Project/Workspace prompt markers on an in-memory snapshot without changing runtime workspace state.
Read APIs use this for sessions that have never entered the runner
(for example a disabled schedule or a child created with
auto_run=false). The caller is expected to discard the temporary
session after building the response.
Trait Implementations§
Source§impl Clone for ProjectContextResolver
impl Clone for ProjectContextResolver
Source§fn clone(&self) -> ProjectContextResolver
fn clone(&self) -> ProjectContextResolver
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more