Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 8 additions & 44 deletions apps/decodex-app/Sources/DecodexApp/AccountPanelView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3039,10 +3039,7 @@ struct OperatorLanePopoverView: View {
items.append(
OperatorLaneReadoutItem(
label: "max output",
value: formatLargestOutput(
bytes: largestOutput,
tool: activity.largestToolOutputTool
)
value: formatLargestOutput(bytes: largestOutput)
)
)
}
Expand Down Expand Up @@ -3179,10 +3176,7 @@ struct OperatorLanePopoverView: View {
items.append(
OperatorLaneReadoutItem(
label: "max output",
value: formatLargestOutput(
bytes: largestOutput,
tool: metrics.largestToolOutputTool
)
value: formatLargestOutput(bytes: largestOutput)
)
)
}
Expand Down Expand Up @@ -3258,8 +3252,7 @@ struct OperatorLanePopoverView: View {
inputTokens: phase.inputTokensCumulative,
outputTokens: phase.outputTokensCumulative,
toolCallCount: phase.toolCallCount,
largestOutputBytes: phase.largestToolOutputBytes,
largestOutputTool: phase.largestToolOutputTool
largestOutputBytes: phase.largestToolOutputBytes
)
}
}
Expand All @@ -3272,8 +3265,7 @@ struct OperatorLanePopoverView: View {
inputTokens: Int,
outputTokens: Int,
toolCallCount: Int,
largestOutputBytes: Int?,
largestOutputTool: String?
largestOutputBytes: Int?
) -> OperatorLifecycleTableRow {
let runtimeSeconds = lifecycleModelSeconds(buckets) ?? 0
let runtime = runtimeShareParts(
Expand All @@ -3284,7 +3276,7 @@ struct OperatorLanePopoverView: View {
runtimeSeconds: runtimeSeconds
)
)
let largestOutput = formatLargestOutput(bytes: largestOutputBytes, tool: largestOutputTool)
let largestOutput = formatLargestOutput(bytes: largestOutputBytes)

return OperatorLifecycleTableRow(
stage: stage,
Expand All @@ -3297,15 +3289,12 @@ struct OperatorLanePopoverView: View {
)
}

private func formatLargestOutput(bytes: Int?, tool: String?) -> String {
private func formatLargestOutput(bytes: Int?) -> String {
guard let bytes, bytes > 0 else {
return "-"
}
guard let tool = panelTrimmed(tool) else {
return formatCompactBytes(bytes)
}

return "\(formatCompactBytes(bytes))(\(tool))"
return formatCompactBytes(bytes)
}

private func lifecycleWallSeconds(
Expand Down Expand Up @@ -3771,9 +3760,6 @@ struct OperatorLaneReadoutItem: Identifiable {
case "output bytes":
return [.value(displayValue), .meta(" output")]
case "max output", "max tool output", "largest output":
if let source = splitLargestOutputSource(displayValue) {
return [.value("\(source.output)(\(source.tool))"), .meta(" max output")]
}
return [.value(displayValue), .meta(" max output")]
case "largest tool", "source":
return [.value(displayValue), .meta(" source")]
Expand All @@ -3796,20 +3782,6 @@ struct OperatorLaneReadoutItem: Identifiable {
}
}

fileprivate func splitLargestOutputSource(_ value: String) -> (output: String, tool: String)? {
guard let range = value.range(of: " from ") else {
return nil
}

let output = String(value[..<range.lowerBound]).trimmingCharacters(in: .whitespacesAndNewlines)
let tool = String(value[range.upperBound...]).trimmingCharacters(in: .whitespacesAndNewlines)
guard output.isEmpty == false, tool.isEmpty == false else {
return nil
}

return (output, tool)
}

fileprivate enum OperatorLaneReadoutTextRole {
case meta
case value
Expand Down Expand Up @@ -3884,15 +3856,7 @@ struct OperatorLaneReadoutRow: View {
fragments.append([.value(calls), .meta(" tools")])
}
if let maxOutput = value(for: "max output") ?? value(for: "max tool output") ?? value(for: "largest output") {
if let embeddedSource = splitLargestOutputSource(maxOutput) {
fragments.append([.value("\(embeddedSource.output)(\(embeddedSource.tool))"), .meta(" max output")])
} else if let source = value(for: "source") ?? value(for: "largest tool") {
fragments.append([.value("\(maxOutput)(\(source))"), .meta(" max output")])
} else {
fragments.append([.value(maxOutput), .meta(" max output")])
}
} else if let source = value(for: "source") ?? value(for: "largest tool") {
fragments.append([.value(source), .meta(" source")])
fragments.append([.value(maxOutput), .meta(" max output")])
}

return fragments
Expand Down
23 changes: 7 additions & 16 deletions apps/decodex/src/orchestrator/operator_dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -6481,10 +6481,7 @@ <h2 id="recent-title">Run History</h2>
if (metrics.largest_tool_output_bytes != null) {
facts.push([
"max output",
formatLargestOutputValue(
metrics.largest_tool_output_bytes,
metrics.largest_tool_output_tool,
),
formatLargestOutputValue(metrics.largest_tool_output_bytes),
]);
}

Expand Down Expand Up @@ -8525,14 +8522,12 @@ <h2 id="recent-title">Run History</h2>
}
}

function formatLargestOutputValue(bytes, tool = "") {
function formatLargestOutputValue(bytes) {
if (bytes == null) {
return "-";
}

const output = formatCompactBytes(bytes);
const source = tool ? String(tool).trim() : "";
return source ? `${output}(${source})` : output;
return formatCompactBytes(bytes);
}

function renderLifecycleMetricSegment(segment, slotIndex) {
Expand Down Expand Up @@ -8620,7 +8615,7 @@ <h2 id="recent-title">Run History</h2>
if (largestOutput != null) {
appendLifecycleMetricSegment(
toolSegments,
formatLargestOutputValue(largestOutput, lifecycle?.largest_tool_output_tool),
formatLargestOutputValue(largestOutput),
"max output",
);
}
Expand Down Expand Up @@ -8671,10 +8666,7 @@ <h2 id="recent-title">Run History</h2>
const outputTokens = lifecycleNumber(phase.output_tokens_cumulative);
const toolCalls = lifecycleNumber(phase.tool_call_count);
const largestOutput = phase?.largest_tool_output_bytes != null
? formatLargestOutputValue(
phase.largest_tool_output_bytes,
phase.largest_tool_output_tool,
)
? formatLargestOutputValue(phase.largest_tool_output_bytes)
: "-";

return [
Expand Down Expand Up @@ -8862,7 +8854,7 @@ <h2 id="recent-title">Run History</h2>
? ""
: `, ${peakInput} peak window`;

return `input ${latestInput} current window${peakSummary}, cumulative input ${formatCompactCount(summary.input_tokens_cumulative)}, max output ${formatLargestOutputValue(summary.largest_tool_output_bytes, summary.largest_tool_output_tool)}`;
return `input ${latestInput} current window${peakSummary}, cumulative input ${formatCompactCount(summary.input_tokens_cumulative)}, max output ${formatLargestOutputValue(summary.largest_tool_output_bytes)}`;
}

function childAgentLargeOutputSummary(summary) {
Expand Down Expand Up @@ -8987,10 +8979,9 @@ <h2 id="recent-title">Run History</h2>
];

if (metrics.largest_tool_output_bytes != null) {
const tool = metrics.largest_tool_output_tool || "tool";
facts.push([
"Largest output",
formatLargestOutputValue(metrics.largest_tool_output_bytes, displayToken(tool)),
formatLargestOutputValue(metrics.largest_tool_output_bytes),
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,10 +437,12 @@ fn assert_child_lifecycle_contract(response: &str) {
"gap: 4px clamp(24px, 2vw, 34px);",
"overflow: hidden;",
"text-overflow: ellipsis;",
"function formatLargestOutputValue(bytes)",
"return formatCompactBytes(bytes);",
"const header = [\"Stage\", \"attempts\", \"inference\", \"input\", \"output\", \"tools\", \"max output\"];",
"const alignRight = new Set([1, 2, 3, 4, 5, 6]);",
"width: fit-content;\n\t\t\t\tmax-width: 100%;",
"appendLifecycleMetricSegment(\n\t\t\t\t\t\t\ttoolSegments,\n\t\t\t\t\t\t\tformatLargestOutputValue(largestOutput, lifecycle?.largest_tool_output_tool),\n\t\t\t\t\t\t\t\"max output\",",
"appendLifecycleMetricSegment(\n\t\t\t\t\t\t\ttoolSegments,\n\t\t\t\t\t\t\tformatLargestOutputValue(largestOutput),\n\t\t\t\t\t\t\t\"max output\",",
"\"tools\"",
"output bytes",
"field(\"Large outputs\", childAgentLargeOutputSummary(childAgentActivity(run)))",
Expand All @@ -463,6 +465,11 @@ fn assert_child_lifecycle_contract(response: &str) {
"\"model time\"",
"\"input tokens\"",
"\"output tokens\"",
"${output}(${source})",
"function largestOutputHelp(bytes, tool = \"\")",
"const titleAttribute = segment.help ? ` title=\"${escapeHtml(segment.help)}\"` : \"\";",
"largestOutputHelp(largestOutput, lifecycle?.largest_tool_output_tool)",
"formatLargestOutputValue(largestOutput, lifecycle?.largest_tool_output_tool)",
],
);
}
Expand Down