#![allow(
clippy::todo,
clippy::unimplemented,
clippy::panic,
clippy::unwrap_used,
clippy::expect_used,
clippy::missing_errors_doc,
clippy::missing_panics_doc,
clippy::doc_markdown,
clippy::needless_pass_by_value,
clippy::too_many_arguments,
clippy::unused_async,
clippy::diverging_sub_expression,
clippy::no_effect_underscore_binding,
clippy::let_unit_value,
clippy::used_underscore_binding,
clippy::let_underscore_untyped,
clippy::struct_field_names,
clippy::manual_let_else,
clippy::map_unwrap_or,
clippy::redundant_pub_crate,
dead_code,
unreachable_code,
unused_assignments,
unused_mut,
unused_imports,
unused_variables
)]
mod agents;
use arcp::error::ARCPError;
use arcp::transport::MemoryTransport;
use arcp::{ARCPClient, Envelope};
use serde_json::Value;
use tokio::sync::mpsc;
use crate::agents::{critique_thought, primary_step};
type Client = ARCPClient<MemoryTransport>;
const MAX_DEPTH: u32 = 3;
const TOKEN_BUDGET: u64 = 8_000;
async fn run_primary(
_client: &Client,
request: &str,
mut inbound_critiques: mpsc::Receiver<Value>,
) -> String {
let stream_id = "str_<uuid>";
let mut last: Option<Value> = None;
let mut answer = String::new();
for step in 0..MAX_DEPTH {
answer = primary_step(request, last.as_ref()).await;
let _ = (stream_id, step);
match tokio::time::timeout(std::time::Duration::from_secs(5), inbound_critiques.recv())
.await
{
Ok(Some(crit)) => {
if crit.get("severity").and_then(Value::as_str) == Some("halt") {
break;
}
last = Some(crit);
}
_ => last = None,
}
}
answer
}
async fn subscribe_thoughts(
_mirror: &Client,
_target_session_id: &str,
) -> Result<String, ARCPError> {
todo!()
}
fn is_thought(env: &Envelope) -> bool {
let _ = env;
todo!()
}
async fn run_mirror(_mirror: &Client, _target_session_id: &str) {
todo!()
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let primary: Client = todo!();
let mirror: Client = todo!();
let (tx, rx) = mpsc::channel::<Value>(32);
tokio::spawn(async move {
let _tx = tx;
});
tokio::spawn(async move {
run_mirror(&mirror, "<primary-session-id>").await;
});
let answer = run_primary(
&primary,
"Argue both sides: serializable vs snapshot iso?",
rx,
)
.await;
println!("{answer}");
Ok(())
}