Skip to content

Commit f360a8c

Browse files
committed
feat: agregar soporte para el comité de hack, incluyendo roles y síntesis de ideas
1 parent f5b6ab2 commit f360a8c

8 files changed

Lines changed: 573 additions & 60 deletions

File tree

src/agent/router.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,23 @@ impl ModelRouter {
414414
}
415415
}
416416

417+
/// Mentor barato para subagentes: investigar es tarea mecánica, no necesita
418+
/// el cerebro caro. En DeepSeek usa `flash` sin thinking (12× más barato que
419+
/// el `pro`); Kimi y Qwen no tienen tier barato → mismo modelo, documentado.
420+
pub fn subagent_mentor(&self, preamble: &str) -> Result<Mentor> {
421+
match self.brain {
422+
Brain::Deepseek => build_deepseek(
423+
DEEPSEEK_FLASH,
424+
preamble,
425+
0.2,
426+
deepseek_no_thinking(),
427+
),
428+
// Kimi y Qwen no tienen un tier "flash": el subagente usa el mismo
429+
// modelo. Su consumo se suma igualmente al ledger de /cost.
430+
other => other.build(preamble, 0.2, None),
431+
}
432+
}
433+
417434
/// Resumen de cierre de sesión (un turno, baja temperatura). Tarea mecánica:
418435
/// en DeepSeek usamos `flash` SIN thinking (12x más barato), no el caro `pro`.
419436
pub async fn summarize(&self, preamble: &str, content: &str) -> Result<String> {

src/agent/tools.rs

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use serde_json::{Value, json};
1212
/// Una llamada a herramienta ya parseada y validada.
1313
#[derive(Debug, PartialEq, Eq)]
1414
pub enum DpxCall {
15-
Read { path: String },
15+
Read { path: String, offset: Option<usize>, limit: Option<usize> },
1616
Search { pattern: String },
1717
Write { path: String, content: String },
1818
Edit { path: String, search: String, replace: String },
@@ -66,8 +66,16 @@ fn native_definitions() -> Vec<ToolDefinition> {
6666
def(
6767
"read_file",
6868
"Lee un archivo del proyecto y te devuelve su contenido. Úsala siempre que \
69-
necesites ver código existente: NUNCA le pidas al usuario que te pegue archivos.",
70-
json!({ "path": path("Ruta relativa al archivo, p.ej. src/main/java/App.java") }),
69+
necesites ver código existente: NUNCA le pidas al usuario que te pegue archivos NI \
70+
escribas scripts (python/tail/etc.) para leer un archivo. Para archivos largos lee \
71+
un RANGO con `offset` (línea inicial, 1-based) y `limit` (nº de líneas): si la \
72+
salida dice cuántas líneas faltan, vuelve a llamar con el `offset` indicado para \
73+
ver el resto (p.ej. el final del archivo).",
74+
json!({
75+
"path": path("Ruta relativa al archivo, p.ej. src/main/java/App.java"),
76+
"offset": { "type": "integer", "description": "Opcional: línea inicial (1-based) para leer un rango de un archivo grande" },
77+
"limit": { "type": "integer", "description": "Opcional: máximo de líneas a leer desde offset" },
78+
}),
7179
&["path"],
7280
),
7381
def(
@@ -188,7 +196,11 @@ pub fn parse_call(name: &str, args: &Value) -> Result<DpxCall, String> {
188196
.ok_or_else(|| format!("falta el argumento `{key}` (string) en la llamada a `{name}`"))
189197
};
190198
match name {
191-
"read_file" => Ok(DpxCall::Read { path: arg("path")? }),
199+
"read_file" => Ok(DpxCall::Read {
200+
path: arg("path")?,
201+
offset: args.get("offset").and_then(Value::as_u64).map(|v| v as usize),
202+
limit: args.get("limit").and_then(Value::as_u64).map(|v| v as usize),
203+
}),
192204
"search_project" => Ok(DpxCall::Search { pattern: arg("pattern")? }),
193205
"write_file" => Ok(DpxCall::Write { path: arg("path")?, content: arg("content")? }),
194206
"edit_file" => Ok(DpxCall::Edit {
@@ -241,7 +253,14 @@ mod tests {
241253
#[test]
242254
fn parse_call_valida_argumentos() {
243255
let ok = parse_call("read_file", &json!({ "path": "src/main.rs" }));
244-
assert_eq!(ok, Ok(DpxCall::Read { path: "src/main.rs".into() }));
256+
assert_eq!(ok, Ok(DpxCall::Read { path: "src/main.rs".into(), offset: None, limit: None }));
257+
258+
// Con rango (offset/limit) para archivos grandes.
259+
let ranged = parse_call("read_file", &json!({ "path": "big.rs", "offset": 2501, "limit": 500 }));
260+
assert_eq!(
261+
ranged,
262+
Ok(DpxCall::Read { path: "big.rs".into(), offset: Some(2501), limit: Some(500) })
263+
);
245264

246265
let edit = parse_call(
247266
"edit_file",

0 commit comments

Comments
 (0)