Skip to main content

vela_scientist/
lib.rs

1//! # vela-scientist — the agent layer
2//!
3//! Sits on top of `vela-protocol`. Reads a researcher's working
4//! directory and emits `StateProposal`s tagged with an `AgentRun`
5//! for reviewer-facing provenance. Never signs canonical state.
6//!
7//! v0.22 ships **Literature Scout** only: PDF folder → `finding.add`
8//! proposals. Other agents (Notes Compiler, Code Analyst,
9//! Contradiction Finder, Experiment Planner, Reviewer Agent) land
10//! one at a time in v0.23+.
11
12pub mod agent;
13pub mod code_analyst;
14pub mod datasets;
15pub mod experiments;
16pub mod extract;
17pub mod llm_cli;
18pub mod notebook;
19pub mod notes;
20pub mod reviewer;
21pub mod scout;
22pub mod tensions;
23
24/// Stable agent name + actor id for Literature Scout. Pairs with
25/// `StateProposal::actor.id == AGENT_ACTOR_ID_LITERATURE_SCOUT` so
26/// the Workbench can group its proposals.
27pub const AGENT_LITERATURE_SCOUT: &str = "literature-scout";
28pub const AGENT_ACTOR_ID_LITERATURE_SCOUT: &str = "agent:literature-scout";
29
30/// Generate a fresh run id for an agent invocation. Format:
31/// `vrun_<16 hex chars>` derived from the agent name + a UTC
32/// timestamp. Not content-addressed (two identical inputs at
33/// different wall-clock instants produce different ids); the run
34/// id's job is to group proposals from the same invocation in the
35/// reviewer UI, not to act as a substrate primitive.
36pub fn new_run_id(agent: &str) -> String {
37    use sha2::{Digest, Sha256};
38    let now = chrono::Utc::now().to_rfc3339();
39    let mut h = Sha256::new();
40    h.update(agent.as_bytes());
41    h.update(b"\0");
42    h.update(now.as_bytes());
43    format!("vrun_{}", &hex::encode(h.finalize())[..16])
44}