MCPcopy Create free account
hub / github.com/microsoft/Webwright / finalizeTrace

Function finalizeTrace

assets/compare_trajectory/app.js:950–994  ·  view source on GitHub ↗
(base)

Source from the content-addressed store, hash-verified

948}
949
950function finalizeTrace(base) {
951 const commandFamilies = toBarRows(countBy(base.commandRuns, (run) => run.primaryCommand));
952 const defaultChannelFamilies = toBarRows(countBy(base.events, (event) => event.kind));
953 const exactTokens = base.exactTokens || null;
954 const tokenSourceLabel = base.tokenSourceLabel || 'Estimated from extracted trace text.';
955 return {
956 side: base.side,
957 kind: base.kind,
958 formatLabel: base.formatLabel,
959 description: base.description,
960 fileName: base.fileName,
961 filePath: base.filePath,
962 taskPrompt: base.taskPrompt,
963 events: base.events,
964 thoughtEntries: base.thoughtEntries,
965 commandRuns: base.commandRuns,
966 finalResponses: base.finalResponses,
967 pythonScripts: base.pythonScripts || [],
968 detailEntries: base.detailEntries || [],
969 metrics: base.metrics,
970 commandFamilies,
971 channelFamilies: base.channelFamilies || defaultChannelFamilies,
972 exactTokens,
973 baseExactTokens: exactTokens,
974 tokenRows: exactTokens ? tokenRowsFromTotals(exactTokens) : [{ label: 'availability', value: 'estimate pending' }],
975 tokenSourceLabel,
976 baseTokenSourceLabel: tokenSourceLabel,
977 tokenModeLabel: exactTokens ? 'exact' : 'estimate',
978 tokenEstimateParts: mergeEstimateParts(base.tokenEstimateParts || []),
979 countedFieldLabels: base.countedFieldLabels || [],
980 tokenBasisRows: [],
981 tokenEstimateTotal: null,
982 tokenEstimateError: '',
983 tokenSelectionLabel: '',
984 companionFileName: '',
985 summary: {
986 thoughts: base.thoughtEntries.length,
987 commands: base.commandRuns.length,
988 commandRuns: base.commandRuns.length,
989 pythonScripts: (base.pythonScripts || []).length,
990 finalResponses: base.finalResponses.length,
991 events: base.events.length
992 }
993 };
994}
995
996function normalizeCodex(text, fileName, filePath, side) {
997 const lines = text.split(/\r?\n/).filter(Boolean);

Callers 4

normalizeCodexFunction · 0.85
normalizeRawResponsesFunction · 0.85
normalizeTrajectoryFunction · 0.85

Calls 4

toBarRowsFunction · 0.85
countByFunction · 0.85
tokenRowsFromTotalsFunction · 0.85
mergeEstimatePartsFunction · 0.85

Tested by

no test coverage detected