@atolis-hq/wake 0.2.25 → 0.2.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -164,6 +164,7 @@ const METRIC_OPTIONS = [
|
|
|
164
164
|
['duration-over-time', 'Duration over time'],
|
|
165
165
|
['work-items-over-time', 'Work items completed over time'],
|
|
166
166
|
['work-item-durations', 'Work item e2e duration'],
|
|
167
|
+
['work-item-totals', 'Work item totals'],
|
|
167
168
|
];
|
|
168
169
|
|
|
169
170
|
async function getJson(path, signal) {
|
|
@@ -640,6 +641,20 @@ function renderWorkItemDurations(rows) {
|
|
|
640
641
|
]);
|
|
641
642
|
}
|
|
642
643
|
|
|
644
|
+
function renderWorkItemTotals(rows) {
|
|
645
|
+
if (rows.length === 0) return el('p', { class: 'meta', text: 'No runs for this window.' });
|
|
646
|
+
const maxTokens = Math.max(...rows.map((row) => row.totalTokens));
|
|
647
|
+
return el('table', {}, [
|
|
648
|
+
el('tr', {}, ['work item', 'runs', 'total tokens', 'total duration'].map((h) => el('th', { text: h }))),
|
|
649
|
+
...rows.map((row) => el('tr', {}, [
|
|
650
|
+
el('td', { text: row.key }),
|
|
651
|
+
el('td', { text: String(row.runCount) }),
|
|
652
|
+
metricValueCell(row.totalTokens, maxTokens, fmtNumber),
|
|
653
|
+
el('td', { text: fmtMs(row.totalDurationMs) }),
|
|
654
|
+
])),
|
|
655
|
+
]);
|
|
656
|
+
}
|
|
657
|
+
|
|
643
658
|
function renderMetricDetail(detail) {
|
|
644
659
|
if (detail.kind === 'runs-over-time') return renderRunsOverTime(detail.rows);
|
|
645
660
|
if (detail.kind === 'runs-by-status-over-time') return renderRunsByStatusOverTime(detail.rows);
|
|
@@ -650,6 +665,7 @@ function renderMetricDetail(detail) {
|
|
|
650
665
|
if (detail.kind === 'duration-over-time') return renderDurationTable(detail.rows, 'bucket');
|
|
651
666
|
if (detail.kind === 'work-items-over-time') return renderWorkItemsOverTime(detail.rows);
|
|
652
667
|
if (detail.kind === 'work-item-durations') return renderWorkItemDurations(detail.rows);
|
|
668
|
+
if (detail.kind === 'work-item-totals') return renderWorkItemTotals(detail.rows);
|
|
653
669
|
return el('p', { class: 'meta', text: 'Unsupported metric.' });
|
|
654
670
|
}
|
|
655
671
|
|
|
@@ -381,6 +381,7 @@ const metricsMetrics = new Set([
|
|
|
381
381
|
'duration-over-time',
|
|
382
382
|
'work-items-over-time',
|
|
383
383
|
'work-item-durations',
|
|
384
|
+
'work-item-totals',
|
|
384
385
|
]);
|
|
385
386
|
function parseMetricsWindow(value) {
|
|
386
387
|
return metricsWindows.has(value) ? value : '7d';
|
|
@@ -867,6 +868,27 @@ export async function buildMetrics(input) {
|
|
|
867
868
|
summary,
|
|
868
869
|
detail: { kind: 'work-item-durations', rows: workItemDurations },
|
|
869
870
|
};
|
|
871
|
+
case 'work-item-totals': {
|
|
872
|
+
const groups = new Map();
|
|
873
|
+
for (const run of runs) {
|
|
874
|
+
const key = run.workItemKey;
|
|
875
|
+
const existing = groups.get(key) ?? { runCount: 0, totalTokens: 0, totalDurationMs: 0 };
|
|
876
|
+
existing.runCount += 1;
|
|
877
|
+
existing.totalTokens += runTokenTotal(run);
|
|
878
|
+
existing.totalDurationMs += runDurationMs(run) ?? 0;
|
|
879
|
+
groups.set(key, existing);
|
|
880
|
+
}
|
|
881
|
+
const rows = [...groups.entries()]
|
|
882
|
+
.map(([key, value]) => ({ key, ...value }))
|
|
883
|
+
.sort((left, right) => right.totalTokens - left.totalTokens || left.key.localeCompare(right.key));
|
|
884
|
+
return {
|
|
885
|
+
window,
|
|
886
|
+
metric,
|
|
887
|
+
generatedAt: input.now.toISOString(),
|
|
888
|
+
summary,
|
|
889
|
+
detail: { kind: 'work-item-totals', rows },
|
|
890
|
+
};
|
|
891
|
+
}
|
|
870
892
|
case 'runs-over-time':
|
|
871
893
|
return {
|
|
872
894
|
window,
|
package/dist/src/version.js
CHANGED