MCPcopy Create free account
hub / github.com/OperationT00/T-Code / pushStatus

Method pushStatus

src/main/java/com/tcode/agent/Agent.java:554–582  ·  view source on GitHub ↗

把当前预算/耗时/HITL 状态推送给 renderer 状态栏。

(AgentBudget budget, long startNanos, String phase)

Source from the content-addressed store, hash-verified

552
553 /** 把当前预算/耗时/HITL 状态推送给 renderer 状态栏。 */
554 private void pushStatus(AgentBudget budget, long startNanos, String phase) {
555 try {
556 String model = llmClient == null ? "—" : llmClient.getModelName();
557 long totalTokens = budget == null ? 0L
558 : (long) (budget.totalInputTokens() + budget.totalOutputTokens());
559 long contextWindow = llmClient == null ? 0L : llmClient.maxContextWindow();
560 boolean hitl = Boolean.TRUE.equals(hitlEnabledSupplier.get());
561 long elapsed = (System.nanoTime() - startNanos) / 1_000_000L;
562 String cost = budget == null ? null : TokenUsageFormatter.estimatedCostCny(
563 llmClient,
564 budget.totalInputTokens(),
565 budget.totalOutputTokens(),
566 budget.totalCachedInputTokens());
567 renderer().updateStatus(StatusInfo.tokens(
568 model,
569 contextWindow,
570 budget == null ? 0L : budget.totalInputTokens(),
571 budget == null ? 0L : budget.totalOutputTokens(),
572 budget == null ? 0L : budget.totalCachedInputTokens(),
573 cost,
574 hitl,
575 elapsed,
576 phase == null || phase.isBlank()
577 ? (totalTokens > 0 || elapsed > 0 ? "running" : "idle")
578 : phase));
579 } catch (Exception e) {
580 log.debug("status push failed", e);
581 }
582 }
583
584 private void appendReasoning(StringBuilder reasoningTranscript, String reasoningContent) {
585 if (reasoningContent == null || reasoningContent.isBlank()) {

Callers 1

runMethod · 0.95

Calls 10

estimatedCostCnyMethod · 0.95
rendererMethod · 0.95
tokensMethod · 0.95
totalInputTokensMethod · 0.80
totalOutputTokensMethod · 0.80
getModelNameMethod · 0.65
maxContextWindowMethod · 0.65
getMethod · 0.65
updateStatusMethod · 0.65

Tested by

no test coverage detected