provenance: convert from enum to freeform string
The Provenance enum couldn't represent agents defined outside the source code. Replace it with a Text field in the capnp schema so any agent can write its own provenance label (e.g. "extractor:write", "rename:tombstone") without a code change. Schema: rename old enum fields to provenanceOld, add new Text provenance fields. Old enum kept for reading legacy records. Migration: from_capnp_migrate() falls back to old enum when the new text field is empty. Also adds `poc-memory tail` command for viewing recent store writes. Co-Authored-By: ProofOfConcept <poc@bcachefs.org>
This commit is contained in:
parent
de204e3075
commit
d76b14dfcd
14 changed files with 160 additions and 67 deletions
|
|
@ -8,7 +8,7 @@
|
|||
use crate::config;
|
||||
use super::llm;
|
||||
use super::transcript;
|
||||
use crate::store::{self, Provenance};
|
||||
use crate::store;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashSet;
|
||||
|
|
@ -266,7 +266,7 @@ pub fn mine_and_store(
|
|||
eprintln!(" Merging facts into existing node: {}", existing_key);
|
||||
if let Some(node) = store.nodes.get(existing_key.as_str()) {
|
||||
let merged = format!("{}\n\n{}", node.content, json);
|
||||
store.upsert_provenance(&existing_key, &merged, Provenance::AgentFactMine)?;
|
||||
store.upsert_provenance(&existing_key, &merged, "fact-mine:write")?;
|
||||
store.save()?;
|
||||
return Ok(facts.len());
|
||||
}
|
||||
|
|
@ -275,7 +275,7 @@ pub fn mine_and_store(
|
|||
}
|
||||
};
|
||||
|
||||
store.upsert_provenance(&key, &json, Provenance::AgentFactMine)?;
|
||||
store.upsert_provenance(&key, &json, "fact-mine:write")?;
|
||||
store.save()?;
|
||||
|
||||
eprintln!(" Stored {} facts as {}", facts.len(), key);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue