(side, event)
| 1942 | await this.loadFile(side, file); |
| 1943 | }, |
| 1944 | async handleCompanionInput(side, event) { |
| 1945 | const file = event.target.files && event.target.files[0]; |
| 1946 | if (!file) { |
| 1947 | return; |
| 1948 | } |
| 1949 | this.attachmentErrors[side] = ''; |
| 1950 | try { |
| 1951 | const trace = this[side]; |
| 1952 | if (!trace || trace.kind !== 'raw_response_jsonl') { |
| 1953 | throw new Error('Attach trajectory.json only to a Webwright Responses JSONL trace (raw_responses.jsonl).'); |
| 1954 | } |
| 1955 | const text = await file.text(); |
| 1956 | const companion = extractTrajectoryUsage(text, file.name); |
| 1957 | const updatedTrace = applyTrajectoryCompanion(trace, companion); |
| 1958 | this[side] = updatedTrace; |
| 1959 | this.enrichTraceTokens(updatedTrace); |
| 1960 | } catch (error) { |
| 1961 | this.attachmentErrors[side] = error && error.message ? error.message : 'Failed to attach trajectory.json'; |
| 1962 | } finally { |
| 1963 | event.target.value = ''; |
| 1964 | } |
| 1965 | }, |
| 1966 | async enrichTraceTokens(trace) { |
| 1967 | const selection = getTokenizerSelection(this.tokenTarget); |
| 1968 | trace.tokenSelectionLabel = selection.mode === 'model' ? selection.name + ' / ' + selection.encoding : selection.encoding; |
nothing calls this directly
no test coverage detected