This commit is contained in:
jif-oai
2025-10-14 15:55:00 +01:00
parent f073bc5ccf
commit 87362d6ebd
3 changed files with 451 additions and 6 deletions

View File

@@ -76,6 +76,8 @@ struct DirectionRequestPayload<'a> {
#[serde(rename = "type")]
kind: &'static str,
prompt: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
objective: Option<&'a str>,
}
#[derive(Serialize)]
@@ -481,6 +483,7 @@ impl InftyOrchestrator {
let request = DirectionRequestPayload {
kind: "direction_request",
prompt,
objective: options.objective.as_deref(),
};
let request_text = serde_json::to_string_pretty(&request)?;
let handle = self
@@ -488,7 +491,7 @@ impl InftyOrchestrator {
&sessions.run_id,
&sessions.director.role,
request_text,
None,
Some(directive_response_schema()),
)
.await?;
let directive = self
@@ -608,7 +611,7 @@ impl InftyOrchestrator {
&sessions.run_id,
&verifier.role,
request_text.as_str(),
None,
Some(verifier_verdict_schema()),
)
.await?;
let response = self
@@ -750,11 +753,14 @@ impl InftyOrchestrator {
};
// Reset idle timer only for events emitted for our submission id.
if ev.event.id == sub_id {
if let Some(progress) = self.progress.as_ref()
&& let Some(role) = role_label
{
if let Some(progress) = self.progress.as_ref() && let Some(role) = role_label {
progress.role_event(role, &ev.event.msg);
}
// If the session emits an error for this submission, surface it immediately
// rather than waiting for the idle timeout.
if let EventMsg::Error(err) = &ev.event.msg {
bail!(anyhow!(err.message.clone()));
}
idle.as_mut().reset(Instant::now() + idle_timeout);
}
}
@@ -1045,7 +1051,7 @@ fn solver_signal_schema() -> Value {
fn final_delivery_schema() -> Value {
json!({
"type": "object",
"required": ["type", "deliverable_path"],
"required": ["type", "deliverable_path", "summary"],
"properties": {
"type": { "const": "final_delivery" },
"deliverable_path": { "type": "string" },
@@ -1055,6 +1061,31 @@ fn final_delivery_schema() -> Value {
})
}
fn directive_response_schema() -> Value {
json!({
"type": "object",
"required": ["directive", "rationale"],
"properties": {
"directive": { "type": "string" },
"rationale": { "type": ["string", "null"] }
},
"additionalProperties": false
})
}
fn verifier_verdict_schema() -> Value {
json!({
"type": "object",
"required": ["verdict", "reasons", "suggestions"],
"properties": {
"verdict": { "type": "string", "enum": ["pass", "fail"] },
"reasons": { "type": "array", "items": { "type": "string" } },
"suggestions": { "type": "array", "items": { "type": "string" } }
},
"additionalProperties": false
})
}
fn resolve_deliverable_path(base: &Path, candidate: &str) -> Result<PathBuf> {
let base_abs = base
.canonicalize()