Skip to main content

agent_workspace_contract/
conversation_space.rs

1//! Conversation defaults select an authorized Space on a concrete Computer, independent of tenant/project auth scope.
2use crate::{PrincipalRef, ResourceScope};
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
6#[serde(rename_all = "camelCase", deny_unknown_fields)]
7pub struct ResolveConversationSpaceRequest {
8    pub conversation_id: String,
9    #[serde(default)]
10    pub space_id: Option<String>,
11    /// When provided by a workload, must equal the authenticated domain actor.
12    #[serde(default)]
13    pub user_id: Option<String>,
14}
15
16#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
17#[serde(rename_all = "camelCase", deny_unknown_fields)]
18pub struct ResolvedConversationSpace {
19    pub computer_id: String,
20    pub space_id: String,
21    pub conversation_id: String,
22}
23
24#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
25#[serde(rename_all = "camelCase", deny_unknown_fields)]
26pub struct ConversationSpaceBinding {
27    pub id: String,
28    pub scope: ResourceScope,
29    pub creator: PrincipalRef,
30    pub target: ResolvedConversationSpace,
31    pub auto_created: bool,
32    pub ready: bool,
33    pub created_at_ms: u64,
34}
35
36pub const CONVERSATION_SPACE_RESOLVE_PATH: &str =
37    "/internal/v1/workspace/computers/{computerId}/conversation-space/resolve";
38
39/// Admin-selected public Snapshot. Scope is stored with the ID to avoid changing tenancy.
40#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
41#[serde(rename_all = "camelCase", deny_unknown_fields)]
42pub struct DefaultExecutionSnapshot {
43    pub snapshot_id: String,
44    pub scope: ResourceScope,
45}
46
47#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
48#[serde(rename_all = "camelCase", deny_unknown_fields)]
49pub struct ResolveExecutionTargetRequest {
50    #[serde(default)]
51    pub computer_id: Option<String>,
52    #[serde(default)]
53    pub space_id: Option<String>,
54    pub conversation_id: String,
55    #[serde(default)]
56    pub snapshot_id: Option<String>,
57    #[serde(default)]
58    pub user_id: Option<String>,
59}
60
61/// First-creation input is immutable even when Admin defaults change during retry.
62#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
63#[serde(rename_all = "camelCase", deny_unknown_fields)]
64pub struct UserComputerBinding {
65    pub id: String,
66    pub scope: ResourceScope,
67    pub creator: PrincipalRef,
68    pub computer_id: String,
69    pub request: crate::CreateComputerRequest,
70    pub provider_template_id: String,
71}
72
73pub const EXECUTION_TARGET_RESOLVE_PATH: &str = "/internal/v1/workspace/execution-target/resolve";