pub struct ProjectContextResolver { /* private fields */ }Implementations§
Source§impl ProjectContextResolver
impl ProjectContextResolver
pub fn new(source: Arc<dyn ProjectContextSource>) -> Self
Sourcepub fn new_with_workspace_resolver(
source: Arc<dyn ProjectContextSource>,
workspace_resolver: WorkspaceResolver,
) -> Self
pub fn new_with_workspace_resolver( source: Arc<dyn ProjectContextSource>, workspace_resolver: WorkspaceResolver, ) -> Self
Build a Project resolver against one coherent workspace-provider pair.
The server uses this form so preview/ownership validation cannot observe
a different AppState’s process-global first-wins provider. Other
embeddings retain Self::new’s dynamic global behavior.
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.
pub fn memory_read_identity_for_session(session: &Session) -> Option<ProjectId>
pub async fn resolve_memory_read_scope( &self, session: &Session, workspace: Option<&Path>, ) -> Result<Option<ProjectId>, ProjectContextError>
pub async fn list_project_ids( &self, ) -> Result<Vec<ProjectId>, ProjectContextError>
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 stable Project identity plus mutable Workspace metadata 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 metadata current. Provider context is rendered later from this authority; this method never injects Project or Workspace markers into a System message.
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 metadata 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