persona-delta-verbs: box large MemoryAddCli and PersonaCommand variants for clippy
This commit is contained in:
parent
6e799081d1
commit
3bc296a535
2 changed files with 72 additions and 86 deletions
|
|
@ -219,7 +219,7 @@ enum Command {
|
|||
/// The mind's persona document (gamecult.persona_state.v0).
|
||||
Persona {
|
||||
#[command(subcommand)]
|
||||
command: PersonaCommand,
|
||||
command: Box<PersonaCommand>,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -374,7 +374,7 @@ fn run(settings: &Settings, command: Command) -> Result<u8, Trouble> {
|
|||
let session = settings.session(session)?;
|
||||
import::run(settings, import::Flags { campaign, from, from_endpoint, faculty, agent, session })
|
||||
}
|
||||
Command::Persona { command } => persona::run(settings, command),
|
||||
Command::Persona { command } => persona::run(settings, *command),
|
||||
Command::Recall { command: RecallCommand::Dispatch { top_k, max_anchors, budget, deadline_ms } } => Ok(recall::dispatch(
|
||||
settings,
|
||||
&recall::Flags { top_k: top_k as usize, max_anchors: max_anchors as usize, budget: budget as usize, deadline_ms },
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use std::collections::BTreeSet;
|
|||
use std::fmt::Write as _;
|
||||
|
||||
use chrono::{DateTime, Duration, Utc};
|
||||
use clap::{Subcommand, ValueEnum};
|
||||
use clap::{Args, Subcommand, ValueEnum};
|
||||
use huginn_mind::eureka_pipeline::{Short, Slug};
|
||||
use huginn_mind::persona::validate_document;
|
||||
use huginn_mind::{
|
||||
|
|
@ -63,55 +63,7 @@ const THOUGHT_STATUSES: [&str; 6] = [
|
|||
#[derive(Subcommand, Debug)]
|
||||
pub enum MemoryCommand {
|
||||
/// Add an anchored thought to thoughtMemory.{shortTerm,memories,incubation}.
|
||||
Add {
|
||||
#[arg(long, value_parser = crate::faculty)]
|
||||
faculty: Faculty,
|
||||
/// The writing agent's name.
|
||||
#[arg(long)]
|
||||
agent: String,
|
||||
/// The writing session; else HUGINN_SESSION.
|
||||
#[arg(long)]
|
||||
session: Option<String>,
|
||||
/// The thought's summary text.
|
||||
#[arg(long)]
|
||||
summary: String,
|
||||
/// Which thoughtMemory pool to write into.
|
||||
#[arg(long, value_enum, default_value_t = MemoryKind::ShortTerm)]
|
||||
kind: MemoryKind,
|
||||
/// Explicit id (default: generated m-... or w-...).
|
||||
#[arg(long)]
|
||||
id: Option<String>,
|
||||
/// Target kind (default: self).
|
||||
#[arg(long)]
|
||||
target_kind: Option<String>,
|
||||
/// Target id (default: current instance when target is self).
|
||||
#[arg(long)]
|
||||
target_id: Option<String>,
|
||||
/// Optional target label.
|
||||
#[arg(long)]
|
||||
target_label: Option<String>,
|
||||
/// Optional tension text.
|
||||
#[arg(long)]
|
||||
tension: Option<String>,
|
||||
/// Optional actionImplication text.
|
||||
#[arg(long)]
|
||||
action_implication: Option<String>,
|
||||
/// Optional claim text.
|
||||
#[arg(long)]
|
||||
claim: Option<String>,
|
||||
/// Optional question text.
|
||||
#[arg(long)]
|
||||
question: Option<String>,
|
||||
/// Importance / intensity in [0, 1].
|
||||
#[arg(long, allow_hyphen_values = true)]
|
||||
importance: Option<f64>,
|
||||
/// Valence in [-1, 1].
|
||||
#[arg(long, allow_hyphen_values = true)]
|
||||
valence: Option<f64>,
|
||||
/// Public tags (private and room:! tags are rejected).
|
||||
#[arg(long = "tag")]
|
||||
tags: Vec<String>,
|
||||
},
|
||||
Add(Box<MemoryAddCli>),
|
||||
/// Retire, resolve, or crystallize an existing thoughtMemory entry by id.
|
||||
Retire {
|
||||
#[arg(long, value_parser = crate::faculty)]
|
||||
|
|
@ -130,6 +82,57 @@ pub enum MemoryCommand {
|
|||
},
|
||||
}
|
||||
|
||||
#[derive(Args, Debug)]
|
||||
pub struct MemoryAddCli {
|
||||
#[arg(long, value_parser = crate::faculty)]
|
||||
pub faculty: Faculty,
|
||||
/// The writing agent's name.
|
||||
#[arg(long)]
|
||||
pub agent: String,
|
||||
/// The writing session; else HUGINN_SESSION.
|
||||
#[arg(long)]
|
||||
pub session: Option<String>,
|
||||
/// The thought's summary text.
|
||||
#[arg(long)]
|
||||
pub summary: String,
|
||||
/// Which thoughtMemory pool to write into.
|
||||
#[arg(long, value_enum, default_value_t = MemoryKind::ShortTerm)]
|
||||
pub kind: MemoryKind,
|
||||
/// Explicit id (default: generated m-... or w-...).
|
||||
#[arg(long)]
|
||||
pub id: Option<String>,
|
||||
/// Target kind (default: self).
|
||||
#[arg(long)]
|
||||
pub target_kind: Option<String>,
|
||||
/// Target id (default: current instance when target is self).
|
||||
#[arg(long)]
|
||||
pub target_id: Option<String>,
|
||||
/// Optional target label.
|
||||
#[arg(long)]
|
||||
pub target_label: Option<String>,
|
||||
/// Optional tension text.
|
||||
#[arg(long)]
|
||||
pub tension: Option<String>,
|
||||
/// Optional actionImplication text.
|
||||
#[arg(long)]
|
||||
pub action_implication: Option<String>,
|
||||
/// Optional claim text.
|
||||
#[arg(long)]
|
||||
pub claim: Option<String>,
|
||||
/// Optional question text.
|
||||
#[arg(long)]
|
||||
pub question: Option<String>,
|
||||
/// Importance / intensity in [0, 1].
|
||||
#[arg(long, allow_hyphen_values = true)]
|
||||
pub importance: Option<f64>,
|
||||
/// Valence in [-1, 1].
|
||||
#[arg(long, allow_hyphen_values = true)]
|
||||
pub valence: Option<f64>,
|
||||
/// Public tags (private and room:! tags are rejected).
|
||||
#[arg(long = "tag")]
|
||||
pub tags: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(ValueEnum, Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum MemoryKind {
|
||||
#[value(name = "short-term")]
|
||||
|
|
@ -311,42 +314,25 @@ pub fn run(settings: &Settings, command: PersonaCommand) -> Result<u8, Trouble>
|
|||
persona_put(settings, faculty, agent, session, expected_updated_at, &file)
|
||||
}
|
||||
PersonaCommand::Seed => persona_seed(settings),
|
||||
PersonaCommand::Memory { command: MemoryCommand::Add {
|
||||
faculty,
|
||||
agent,
|
||||
session,
|
||||
summary,
|
||||
kind,
|
||||
id,
|
||||
target_kind,
|
||||
target_id,
|
||||
target_label,
|
||||
tension,
|
||||
action_implication,
|
||||
claim,
|
||||
question,
|
||||
importance,
|
||||
valence,
|
||||
tags,
|
||||
} } => memory_add(
|
||||
PersonaCommand::Memory { command: MemoryCommand::Add(cli) } => memory_add(
|
||||
settings,
|
||||
faculty,
|
||||
agent,
|
||||
session,
|
||||
cli.faculty,
|
||||
cli.agent,
|
||||
cli.session,
|
||||
MemoryAddArgs {
|
||||
summary,
|
||||
kind,
|
||||
id,
|
||||
target_kind,
|
||||
target_id,
|
||||
target_label,
|
||||
tension,
|
||||
action_implication,
|
||||
claim,
|
||||
question,
|
||||
importance,
|
||||
valence,
|
||||
tags,
|
||||
summary: cli.summary,
|
||||
kind: cli.kind,
|
||||
id: cli.id,
|
||||
target_kind: cli.target_kind,
|
||||
target_id: cli.target_id,
|
||||
target_label: cli.target_label,
|
||||
tension: cli.tension,
|
||||
action_implication: cli.action_implication,
|
||||
claim: cli.claim,
|
||||
question: cli.question,
|
||||
importance: cli.importance,
|
||||
valence: cli.valence,
|
||||
tags: cli.tags,
|
||||
},
|
||||
),
|
||||
PersonaCommand::Memory { command: MemoryCommand::Retire { faculty, agent, session, status, id } } => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue