mirror of
https://github.com/instructkr/claw-code.git
synced 2026-05-18 21:41:26 +08:00
omx(team): auto-checkpoint worker-4 [unknown]
This commit is contained in:
@@ -26,7 +26,7 @@ async fn send_message_uses_openai_compatible_endpoint_and_auth() {
|
|||||||
"\"message\":{\"role\":\"assistant\",\"content\":\"Hello from Grok\",\"tool_calls\":[]},",
|
"\"message\":{\"role\":\"assistant\",\"content\":\"Hello from Grok\",\"tool_calls\":[]},",
|
||||||
"\"finish_reason\":\"stop\"",
|
"\"finish_reason\":\"stop\"",
|
||||||
"}],",
|
"}],",
|
||||||
"\"usage\":{\"prompt_tokens\":11,\"completion_tokens\":5}",
|
"\"usage\":{\"prompt_tokens\":11,\"completion_tokens\":5,\"prompt_tokens_details\":{\"cached_tokens\":3}}",
|
||||||
"}"
|
"}"
|
||||||
);
|
);
|
||||||
let server = spawn_server(
|
let server = spawn_server(
|
||||||
|
|||||||
@@ -3496,18 +3496,21 @@ fn format_permissions_switch_report(previous: &str, next: &str) -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn format_cost_report(usage: TokenUsage) -> String {
|
fn format_cost_report(usage: TokenUsage) -> String {
|
||||||
|
let estimated_cost = usage.estimate_cost_usd();
|
||||||
format!(
|
format!(
|
||||||
"Cost
|
"Cost
|
||||||
Input tokens {}
|
Input tokens {}
|
||||||
Output tokens {}
|
Output tokens {}
|
||||||
Cache create {}
|
Cache create {}
|
||||||
Cache read {}
|
Cache read {}
|
||||||
Total tokens {}",
|
Total tokens {}
|
||||||
|
Estimated cost {}",
|
||||||
usage.input_tokens,
|
usage.input_tokens,
|
||||||
usage.output_tokens,
|
usage.output_tokens,
|
||||||
usage.cache_creation_input_tokens,
|
usage.cache_creation_input_tokens,
|
||||||
usage.cache_read_input_tokens,
|
usage.cache_read_input_tokens,
|
||||||
usage.total_tokens(),
|
usage.total_tokens(),
|
||||||
|
format_usd(estimated_cost.total_cost_usd()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3911,6 +3914,8 @@ fn run_resume_command(
|
|||||||
"cache_creation_input_tokens": usage.cache_creation_input_tokens,
|
"cache_creation_input_tokens": usage.cache_creation_input_tokens,
|
||||||
"cache_read_input_tokens": usage.cache_read_input_tokens,
|
"cache_read_input_tokens": usage.cache_read_input_tokens,
|
||||||
"total_tokens": usage.total_tokens(),
|
"total_tokens": usage.total_tokens(),
|
||||||
|
"estimated_cost_usd": format_usd(usage.estimate_cost_usd().total_cost_usd()),
|
||||||
|
"pricing": "estimated-default",
|
||||||
})),
|
})),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -6244,10 +6249,18 @@ fn status_json_value(
|
|||||||
"usage": {
|
"usage": {
|
||||||
"messages": usage.message_count,
|
"messages": usage.message_count,
|
||||||
"turns": usage.turns,
|
"turns": usage.turns,
|
||||||
|
"latest_input": usage.latest.input_tokens,
|
||||||
|
"latest_output": usage.latest.output_tokens,
|
||||||
|
"latest_cache_creation_input": usage.latest.cache_creation_input_tokens,
|
||||||
|
"latest_cache_read_input": usage.latest.cache_read_input_tokens,
|
||||||
"latest_total": usage.latest.total_tokens(),
|
"latest_total": usage.latest.total_tokens(),
|
||||||
"cumulative_input": usage.cumulative.input_tokens,
|
"cumulative_input": usage.cumulative.input_tokens,
|
||||||
"cumulative_output": usage.cumulative.output_tokens,
|
"cumulative_output": usage.cumulative.output_tokens,
|
||||||
|
"cumulative_cache_creation_input": usage.cumulative.cache_creation_input_tokens,
|
||||||
|
"cumulative_cache_read_input": usage.cumulative.cache_read_input_tokens,
|
||||||
"cumulative_total": usage.cumulative.total_tokens(),
|
"cumulative_total": usage.cumulative.total_tokens(),
|
||||||
|
"estimated_cost_usd": format_usd(usage.cumulative.estimate_cost_usd().total_cost_usd()),
|
||||||
|
"pricing": "estimated-default",
|
||||||
"estimated_tokens": usage.estimated_tokens,
|
"estimated_tokens": usage.estimated_tokens,
|
||||||
},
|
},
|
||||||
"lane_board": {
|
"lane_board": {
|
||||||
@@ -6408,11 +6421,17 @@ fn format_status_report(
|
|||||||
Latest total {}
|
Latest total {}
|
||||||
Cumulative input {}
|
Cumulative input {}
|
||||||
Cumulative output {}
|
Cumulative output {}
|
||||||
Cumulative total {}",
|
Cache create {}
|
||||||
|
Cache read {}
|
||||||
|
Cumulative total {}
|
||||||
|
Estimated cost {}",
|
||||||
usage.latest.total_tokens(),
|
usage.latest.total_tokens(),
|
||||||
usage.cumulative.input_tokens,
|
usage.cumulative.input_tokens,
|
||||||
usage.cumulative.output_tokens,
|
usage.cumulative.output_tokens,
|
||||||
|
usage.cumulative.cache_creation_input_tokens,
|
||||||
|
usage.cumulative.cache_read_input_tokens,
|
||||||
usage.cumulative.total_tokens(),
|
usage.cumulative.total_tokens(),
|
||||||
|
format_usd(usage.cumulative.estimate_cost_usd().total_cost_usd()),
|
||||||
),
|
),
|
||||||
format!(
|
format!(
|
||||||
"Workspace
|
"Workspace
|
||||||
@@ -12711,6 +12730,7 @@ mod tests {
|
|||||||
assert!(report.contains("Cache create 3"));
|
assert!(report.contains("Cache create 3"));
|
||||||
assert!(report.contains("Cache read 1"));
|
assert!(report.contains("Cache read 1"));
|
||||||
assert!(report.contains("Total tokens 32"));
|
assert!(report.contains("Total tokens 32"));
|
||||||
|
assert!(report.contains("Estimated cost"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -12858,7 +12878,10 @@ mod tests {
|
|||||||
assert!(status.contains("Permission mode workspace-write"));
|
assert!(status.contains("Permission mode workspace-write"));
|
||||||
assert!(status.contains("Messages 7"));
|
assert!(status.contains("Messages 7"));
|
||||||
assert!(status.contains("Latest total 10"));
|
assert!(status.contains("Latest total 10"));
|
||||||
|
assert!(status.contains("Cache create 2"));
|
||||||
|
assert!(status.contains("Cache read 1"));
|
||||||
assert!(status.contains("Cumulative total 31"));
|
assert!(status.contains("Cumulative total 31"));
|
||||||
|
assert!(status.contains("Estimated cost"));
|
||||||
assert!(status.contains("Cwd /tmp/project"));
|
assert!(status.contains("Cwd /tmp/project"));
|
||||||
assert!(status.contains("Project root /tmp"));
|
assert!(status.contains("Project root /tmp"));
|
||||||
assert!(status.contains("Git branch main"));
|
assert!(status.contains("Git branch main"));
|
||||||
|
|||||||
Reference in New Issue
Block a user