agent-workspace-contract 0.7.0

Transport-neutral contracts for Agent Infra workspace APIs
Documentation
//! Conversation defaults select an authorized Space on a concrete Computer, independent of tenant/project auth scope.
use crate::{PrincipalRef, ResourceScope};
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct ResolveConversationSpaceRequest {
    pub conversation_id: String,
    #[serde(default)]
    pub space_id: Option<String>,
    /// When provided by a workload, must equal the authenticated domain actor.
    #[serde(default)]
    pub user_id: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct ResolvedConversationSpace {
    pub computer_id: String,
    pub space_id: String,
    pub conversation_id: String,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct ConversationSpaceBinding {
    pub id: String,
    pub scope: ResourceScope,
    pub creator: PrincipalRef,
    pub target: ResolvedConversationSpace,
    pub auto_created: bool,
    pub ready: bool,
    pub created_at_ms: u64,
}

pub const CONVERSATION_SPACE_RESOLVE_PATH: &str =
    "/internal/v1/workspace/computers/{computerId}/conversation-space/resolve";

/// Admin-selected public Snapshot. Scope is stored with the ID to avoid changing tenancy.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct DefaultExecutionSnapshot {
    pub snapshot_id: String,
    pub scope: ResourceScope,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct ResolveExecutionTargetRequest {
    #[serde(default)]
    pub computer_id: Option<String>,
    #[serde(default)]
    pub space_id: Option<String>,
    pub conversation_id: String,
    #[serde(default)]
    pub snapshot_id: Option<String>,
    #[serde(default)]
    pub user_id: Option<String>,
}

/// First-creation input is immutable even when Admin defaults change during retry.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct UserComputerBinding {
    pub id: String,
    pub scope: ResourceScope,
    pub creator: PrincipalRef,
    pub computer_id: String,
    pub request: crate::CreateComputerRequest,
    pub provider_template_id: String,
}

pub const EXECUTION_TARGET_RESOLVE_PATH: &str = "/internal/v1/workspace/execution-target/resolve";