MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / observe_context_record

Method observe_context_record

src/sessions/codex/context.rs:74–102  ·  view source on GitHub ↗
(
        &mut self,
        record: &Value,
        path: &Path,
        meta: &CodexMeta,
    )

Source from the content-addressed store, hash-verified

72 }
73
74 pub(super) fn observe_context_record(
75 &mut self,
76 record: &Value,
77 path: &Path,
78 meta: &CodexMeta,
79 ) -> bool {
80 if let Some(updated) = session_meta_from_record(record, path) {
81 if updated.session_id == meta.session_id {
82 self.cwd = Some(updated.cwd);
83 if updated.git.is_some() {
84 self.git = updated.git;
85 }
86 if updated.model.is_some() {
87 self.model = updated.model;
88 }
89 }
90 return true;
91 }
92 if let Some(context) = turn_context_from_record(record) {
93 if context.model.is_some() {
94 self.model = context.model;
95 }
96 if context.cwd.is_some() {
97 self.cwd = context.cwd;
98 }
99 return true;
100 }
101 false
102 }
103
104 fn observe_prior_record(&mut self, record: &Value, path: &Path, meta: &CodexMeta) {
105 if record.get("type").and_then(Value::as_str) == Some("compacted") {

Callers 2

parse_newMethod · 0.80
observe_prior_recordMethod · 0.80

Calls 2

session_meta_from_recordFunction · 0.85
turn_context_from_recordFunction · 0.85

Tested by

no test coverage detected