stasis/application/runtime/
runtime_handler_execution_context.rs1use std::sync::Arc;
2
3use crate::application::orchestration::prompt_pipeline::PromptExecutionContext;
4use crate::domain::runtime::job::Job;
5
6#[derive(Clone)]
7pub struct RuntimeHandlerExecutionContext {
8 correlation_id: Arc<str>,
9 policy_profile: Arc<Option<String>>,
10 model_hint: Arc<Option<String>>,
11 prompt_context: Arc<PromptExecutionContext>,
12 memory_reader_enabled: bool,
13 memory_writer_enabled: bool,
14 identity_enabled: bool,
15}
16
17impl RuntimeHandlerExecutionContext {
18 pub fn new(
19 job: &Job,
20 policy_profile: Option<String>,
21 model_hint: Option<String>,
22 memory_reader_enabled: bool,
23 memory_writer_enabled: bool,
24 identity_enabled: bool,
25 ) -> Self {
26 let prompt_context = PromptExecutionContext {
27 trace_id: Some(job.trace_id.clone()),
28 correlation_id: Some(job.correlation_id.clone()),
29 policy_profile: policy_profile.clone(),
30 model_hint: model_hint.clone(),
31 };
32
33 Self {
34 correlation_id: Arc::<str>::from(job.correlation_id.as_str()),
35 policy_profile: Arc::new(policy_profile),
36 model_hint: Arc::new(model_hint),
37 prompt_context: Arc::new(prompt_context),
38 memory_reader_enabled,
39 memory_writer_enabled,
40 identity_enabled,
41 }
42 }
43
44 pub fn correlation_id(&self) -> &str {
45 &self.correlation_id
46 }
47
48 pub fn prompt_context_clone(&self) -> PromptExecutionContext {
49 (*self.prompt_context).clone()
50 }
51
52 pub fn policy_profile(&self) -> Option<&str> {
53 self.policy_profile.as_ref().as_deref()
54 }
55
56 pub fn policy_profile_clone(&self) -> Option<String> {
57 (*self.policy_profile).clone()
58 }
59
60 pub fn model_hint_clone(&self) -> Option<String> {
61 (*self.model_hint).clone()
62 }
63
64 pub fn memory_reader_enabled(&self) -> bool {
65 self.memory_reader_enabled
66 }
67
68 pub fn memory_writer_enabled(&self) -> bool {
69 self.memory_writer_enabled
70 }
71
72 pub fn identity_enabled(&self) -> bool {
73 self.identity_enabled
74 }
75}