journal tools: use NodeType instead of string key matching

- journal_new: create EpisodicSession node with auto-generated key
- journal_tail: query by node_type, not by parsing a monolithic node
- journal_update: find latest EpisodicSession by timestamp
- No string key matching anywhere — all typed
- Fixes journal entries not appearing in 'poc-memory journal tail'
- Also: added --provenance/-p filter to 'poc-memory tail'
- Also: fix early return in surface_observe_cycle store load failure
- Also: scale max_turns by number of steps (50 per step)

Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
ProofOfConcept 2026-03-26 18:41:10 -04:00
parent 41fcec58f0
commit 85fa54cba9
5 changed files with 72 additions and 54 deletions

View file

@ -1,7 +1,7 @@
// cli/journal.rs — journal subcommand handlers
pub fn cmd_tail(n: usize, full: bool) -> Result<(), String> {
pub fn cmd_tail(n: usize, full: bool, provenance: Option<&str>) -> Result<(), String> {
let path = crate::store::nodes_path();
if !path.exists() {
return Err("No node log found".into());
@ -24,6 +24,11 @@ pub fn cmd_tail(n: usize, full: bool) -> Result<(), String> {
}
}
// Filter by provenance if specified (prefix match)
if let Some(prov) = provenance {
entries.retain(|n| n.provenance.contains(prov));
}
let start = entries.len().saturating_sub(n);
for node in &entries[start..] {
let ts = if node.timestamp > 0 && node.timestamp < 4_000_000_000 {