inspect-ai 0.3.62__py3-none-any.whl → 0.3.64__py3-none-any.whl
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.
- inspect_ai/_cli/cache.py +8 -7
- inspect_ai/_cli/common.py +0 -12
- inspect_ai/_cli/eval.py +32 -4
- inspect_ai/_cli/info.py +1 -0
- inspect_ai/_cli/list.py +1 -1
- inspect_ai/_cli/log.py +2 -0
- inspect_ai/_cli/main.py +1 -1
- inspect_ai/_cli/sandbox.py +4 -1
- inspect_ai/_cli/score.py +181 -32
- inspect_ai/_cli/trace.py +10 -0
- inspect_ai/_cli/view.py +4 -2
- inspect_ai/_display/core/active.py +2 -3
- inspect_ai/_display/core/config.py +7 -1
- inspect_ai/_display/textual/widgets/samples.py +4 -3
- inspect_ai/_display/textual/widgets/sandbox.py +6 -0
- inspect_ai/_eval/eval.py +104 -101
- inspect_ai/_eval/evalset.py +75 -75
- inspect_ai/_eval/loader.py +122 -12
- inspect_ai/_eval/registry.py +1 -1
- inspect_ai/_eval/run.py +14 -0
- inspect_ai/_eval/score.py +125 -36
- inspect_ai/_eval/task/log.py +105 -4
- inspect_ai/_eval/task/results.py +92 -38
- inspect_ai/_eval/task/run.py +9 -2
- inspect_ai/_eval/task/sandbox.py +35 -2
- inspect_ai/_eval/task/task.py +49 -46
- inspect_ai/_util/constants.py +1 -1
- inspect_ai/_util/content.py +8 -0
- inspect_ai/_util/error.py +2 -0
- inspect_ai/_util/file.py +15 -1
- inspect_ai/_util/hash.py +1 -1
- inspect_ai/_util/logger.py +4 -2
- inspect_ai/_util/registry.py +7 -1
- inspect_ai/_view/view.py +1 -2
- inspect_ai/_view/www/.vscode/extensions.json +3 -0
- inspect_ai/_view/www/.vscode/settings.json +8 -0
- inspect_ai/_view/www/App.css +97 -29
- inspect_ai/_view/www/README.md +1 -1
- inspect_ai/_view/www/dist/assets/index.css +16663 -14674
- inspect_ai/_view/www/dist/assets/index.js +58808 -51348
- inspect_ai/_view/www/dist/index.html +1 -1
- inspect_ai/_view/www/index.html +2 -2
- inspect_ai/_view/www/log-schema.json +87 -73
- inspect_ai/_view/www/package.json +22 -4
- inspect_ai/_view/www/postcss.config.cjs +8 -9
- inspect_ai/_view/www/src/{App.mjs → App.tsx} +356 -365
- inspect_ai/_view/www/src/AppErrorBoundary.tsx +47 -0
- inspect_ai/_view/www/src/api/api-browser.ts +2 -2
- inspect_ai/_view/www/src/api/api-http.ts +3 -5
- inspect_ai/_view/www/src/api/api-vscode.ts +6 -6
- inspect_ai/_view/www/src/api/client-api.ts +4 -4
- inspect_ai/_view/www/src/api/index.ts +4 -4
- inspect_ai/_view/www/src/api/{Types.ts → types.ts} +25 -9
- inspect_ai/_view/www/src/appearance/colors.ts +9 -0
- inspect_ai/_view/www/src/appearance/fonts.ts +39 -0
- inspect_ai/_view/www/src/appearance/icons.ts +100 -0
- inspect_ai/_view/www/src/appearance/{Styles.mjs → styles.ts} +2 -32
- inspect_ai/_view/www/src/components/AnsiDisplay.tsx +198 -0
- inspect_ai/_view/www/src/components/AsciinemaPlayer.tsx +86 -0
- inspect_ai/_view/www/src/components/Card.css +60 -0
- inspect_ai/_view/www/src/components/Card.tsx +109 -0
- inspect_ai/_view/www/src/components/CopyButton.module.css +11 -0
- inspect_ai/_view/www/src/components/CopyButton.tsx +58 -0
- inspect_ai/_view/www/src/components/DownloadButton.css +4 -0
- inspect_ai/_view/www/src/components/DownloadButton.tsx +25 -0
- inspect_ai/_view/www/src/components/DownloadPanel.css +10 -0
- inspect_ai/_view/www/src/components/DownloadPanel.tsx +30 -0
- inspect_ai/_view/www/src/components/EmptyPanel.css +12 -0
- inspect_ai/_view/www/src/components/EmptyPanel.tsx +15 -0
- inspect_ai/_view/www/src/components/ErrorPanel.css +37 -0
- inspect_ai/_view/www/src/components/ErrorPanel.tsx +39 -0
- inspect_ai/_view/www/src/components/ExpandablePanel.css +40 -0
- inspect_ai/_view/www/src/components/ExpandablePanel.tsx +115 -0
- inspect_ai/_view/www/src/components/FindBand.css +49 -0
- inspect_ai/_view/www/src/components/FindBand.tsx +130 -0
- inspect_ai/_view/www/src/components/HumanBaselineView.css +41 -0
- inspect_ai/_view/www/src/components/HumanBaselineView.tsx +162 -0
- inspect_ai/_view/www/src/components/JsonPanel.css +20 -0
- inspect_ai/_view/www/src/components/JsonPanel.tsx +82 -0
- inspect_ai/_view/www/src/components/LabeledValue.css +20 -0
- inspect_ai/_view/www/src/components/LabeledValue.tsx +41 -0
- inspect_ai/_view/www/src/components/LargeModal.module.css +54 -0
- inspect_ai/_view/www/src/components/LargeModal.tsx +189 -0
- inspect_ai/_view/www/src/components/LightboxCarousel.css +95 -0
- inspect_ai/_view/www/src/components/LightboxCarousel.tsx +132 -0
- inspect_ai/_view/www/src/components/MarkdownDiv.css +3 -0
- inspect_ai/_view/www/src/components/MarkdownDiv.tsx +133 -0
- inspect_ai/_view/www/src/components/MessageBand.css +43 -0
- inspect_ai/_view/www/src/components/MessageBand.tsx +39 -0
- inspect_ai/_view/www/src/components/MorePopOver.css +0 -0
- inspect_ai/_view/www/src/components/MorePopOver.tsx +67 -0
- inspect_ai/_view/www/src/components/NavPills.module.css +18 -0
- inspect_ai/_view/www/src/components/NavPills.tsx +101 -0
- inspect_ai/_view/www/src/components/ProgressBar.module.css +37 -0
- inspect_ai/_view/www/src/components/ProgressBar.tsx +22 -0
- inspect_ai/_view/www/src/components/TabSet.module.css +40 -0
- inspect_ai/_view/www/src/components/TabSet.tsx +215 -0
- inspect_ai/_view/www/src/components/ToolButton.css +3 -0
- inspect_ai/_view/www/src/components/ToolButton.tsx +27 -0
- inspect_ai/_view/www/src/components/VirtualList.module.css +19 -0
- inspect_ai/_view/www/src/components/VirtualList.tsx +292 -0
- inspect_ai/_view/www/src/{index.js → index.tsx} +45 -19
- inspect_ai/_view/www/src/{log → logfile}/remoteLogFile.ts +3 -8
- inspect_ai/_view/www/src/{utils/remoteZipFile.mjs → logfile/remoteZipFile.ts} +86 -80
- inspect_ai/_view/www/src/metadata/MetaDataGrid.tsx +83 -0
- inspect_ai/_view/www/src/metadata/MetaDataView.module.css +35 -0
- inspect_ai/_view/www/src/metadata/MetaDataView.tsx +95 -0
- inspect_ai/_view/www/src/metadata/MetadataGrid.module.css +15 -0
- inspect_ai/_view/www/src/metadata/RenderedContent.module.css +12 -0
- inspect_ai/_view/www/src/{components/RenderedContent/RenderedContent.mjs → metadata/RenderedContent.tsx} +92 -73
- inspect_ai/_view/www/src/metadata/types.ts +18 -0
- inspect_ai/_view/www/src/plan/DatasetDetailView.module.css +3 -0
- inspect_ai/_view/www/src/plan/DatasetDetailView.tsx +37 -0
- inspect_ai/_view/www/src/plan/DetailStep.module.css +9 -0
- inspect_ai/_view/www/src/plan/DetailStep.tsx +31 -0
- inspect_ai/_view/www/src/plan/PlanCard.tsx +28 -0
- inspect_ai/_view/www/src/plan/PlanDetailView.module.css +48 -0
- inspect_ai/_view/www/src/plan/PlanDetailView.tsx +324 -0
- inspect_ai/_view/www/src/plan/ScorerDetailView.module.css +3 -0
- inspect_ai/_view/www/src/plan/ScorerDetailView.tsx +30 -0
- inspect_ai/_view/www/src/plan/SolverDetailView.module.css +15 -0
- inspect_ai/_view/www/src/plan/SolverDetailView.tsx +32 -0
- inspect_ai/_view/www/src/samples/InlineSampleDisplay.module.css +8 -0
- inspect_ai/_view/www/src/samples/InlineSampleDisplay.tsx +53 -0
- inspect_ai/_view/www/src/samples/SampleDialog.tsx +122 -0
- inspect_ai/_view/www/src/samples/SampleDisplay.module.css +29 -0
- inspect_ai/_view/www/src/samples/SampleDisplay.tsx +331 -0
- inspect_ai/_view/www/src/samples/SampleSummaryView.module.css +24 -0
- inspect_ai/_view/www/src/samples/SampleSummaryView.tsx +177 -0
- inspect_ai/_view/www/src/samples/SamplesTools.tsx +52 -0
- inspect_ai/_view/www/src/samples/chat/ChatMessage.module.css +29 -0
- inspect_ai/_view/www/src/samples/chat/ChatMessage.tsx +76 -0
- inspect_ai/_view/www/src/samples/chat/ChatMessageRenderer.tsx +60 -0
- inspect_ai/_view/www/src/samples/chat/ChatMessageRow.module.css +9 -0
- inspect_ai/_view/www/src/samples/chat/ChatMessageRow.tsx +57 -0
- inspect_ai/_view/www/src/samples/chat/ChatView.tsx +47 -0
- inspect_ai/_view/www/src/samples/chat/ChatViewVirtualList.module.css +4 -0
- inspect_ai/_view/www/src/samples/chat/ChatViewVirtualList.tsx +58 -0
- inspect_ai/_view/www/src/samples/chat/MessageContent.module.css +4 -0
- inspect_ai/_view/www/src/samples/chat/MessageContent.tsx +157 -0
- inspect_ai/_view/www/src/samples/chat/MessageContents.module.css +3 -0
- inspect_ai/_view/www/src/samples/chat/MessageContents.tsx +133 -0
- inspect_ai/_view/www/src/samples/chat/messages.ts +112 -0
- inspect_ai/_view/www/src/samples/chat/tools/ToolCallView.tsx +147 -0
- inspect_ai/_view/www/src/samples/chat/tools/ToolInput.module.css +14 -0
- inspect_ai/_view/www/src/samples/chat/tools/ToolInput.tsx +76 -0
- inspect_ai/_view/www/src/samples/chat/tools/ToolOutput.module.css +19 -0
- inspect_ai/_view/www/src/samples/chat/tools/ToolOutput.tsx +60 -0
- inspect_ai/_view/www/src/samples/chat/tools/ToolTitle.module.css +4 -0
- inspect_ai/_view/www/src/samples/chat/tools/ToolTitle.tsx +18 -0
- inspect_ai/_view/www/src/samples/chat/tools/tool.ts +92 -0
- inspect_ai/_view/www/src/samples/descriptor/samplesDescriptor.tsx +365 -0
- inspect_ai/_view/www/src/samples/descriptor/score/BooleanScoreDescriptor.module.css +22 -0
- inspect_ai/_view/www/src/samples/descriptor/score/BooleanScoreDescriptor.tsx +26 -0
- inspect_ai/_view/www/src/samples/descriptor/score/CategoricalScoreDescriptor.tsx +18 -0
- inspect_ai/_view/www/src/samples/descriptor/score/NumericScoreDescriptor.tsx +27 -0
- inspect_ai/_view/www/src/samples/descriptor/score/ObjectScoreDescriptor.module.css +18 -0
- inspect_ai/_view/www/src/samples/descriptor/score/ObjectScoreDescriptor.tsx +71 -0
- inspect_ai/_view/www/src/samples/descriptor/score/OtherScoreDescriptor.tsx +20 -0
- inspect_ai/_view/www/src/samples/descriptor/score/PassFailScoreDescriptor.module.css +28 -0
- inspect_ai/_view/www/src/samples/descriptor/score/PassFailScoreDescriptor.tsx +81 -0
- inspect_ai/_view/www/src/samples/descriptor/score/ScoreDescriptor.tsx +99 -0
- inspect_ai/_view/www/src/samples/descriptor/types.ts +55 -0
- inspect_ai/_view/www/src/samples/error/FlatSampleErrorView.module.css +19 -0
- inspect_ai/_view/www/src/samples/error/FlatSampleErrorView.tsx +22 -0
- inspect_ai/_view/www/src/samples/error/SampleErrorView.module.css +17 -0
- inspect_ai/_view/www/src/samples/error/SampleErrorView.tsx +31 -0
- inspect_ai/_view/www/src/samples/error/error.ts +15 -0
- inspect_ai/_view/www/src/samples/list/SampleFooter.module.css +9 -0
- inspect_ai/_view/www/src/samples/list/SampleFooter.tsx +14 -0
- inspect_ai/_view/www/src/samples/list/SampleHeader.module.css +13 -0
- inspect_ai/_view/www/src/samples/list/SampleHeader.tsx +36 -0
- inspect_ai/_view/www/src/samples/list/SampleList.module.css +11 -0
- inspect_ai/_view/www/src/samples/list/SampleList.tsx +247 -0
- inspect_ai/_view/www/src/samples/list/SampleRow.module.css +33 -0
- inspect_ai/_view/www/src/samples/list/SampleRow.tsx +98 -0
- inspect_ai/_view/www/src/samples/list/SampleSeparator.module.css +6 -0
- inspect_ai/_view/www/src/samples/list/SampleSeparator.tsx +24 -0
- inspect_ai/_view/www/src/samples/sample-tools/EpochFilter.module.css +9 -0
- inspect_ai/_view/www/src/samples/sample-tools/EpochFilter.tsx +51 -0
- inspect_ai/_view/www/src/samples/sample-tools/SelectScorer.module.css +16 -0
- inspect_ai/_view/www/src/samples/sample-tools/SelectScorer.tsx +175 -0
- inspect_ai/_view/www/src/samples/sample-tools/SortFilter.module.css +9 -0
- inspect_ai/_view/www/src/samples/sample-tools/SortFilter.tsx +186 -0
- inspect_ai/_view/www/src/samples/{tools/filters.mjs → sample-tools/filters.ts} +86 -81
- inspect_ai/_view/www/src/samples/sample-tools/sample-filter/SampleFilter.module.css +16 -0
- inspect_ai/_view/www/src/samples/sample-tools/sample-filter/SampleFilter.tsx +288 -0
- inspect_ai/_view/www/src/samples/sample-tools/sample-filter/completions.ts +346 -0
- inspect_ai/_view/www/src/samples/sample-tools/sample-filter/language.ts +19 -0
- inspect_ai/_view/www/src/samples/sample-tools/sample-filter/tokenize.ts +97 -0
- inspect_ai/_view/www/src/samples/{SampleLimit.mjs → sampleLimit.ts} +3 -6
- inspect_ai/_view/www/src/samples/scores/SampleScoreView.module.css +53 -0
- inspect_ai/_view/www/src/samples/scores/SampleScoreView.tsx +168 -0
- inspect_ai/_view/www/src/samples/scores/SampleScores.module.css +5 -0
- inspect_ai/_view/www/src/samples/scores/SampleScores.tsx +37 -0
- inspect_ai/_view/www/src/samples/transcript/ApprovalEventView.tsx +66 -0
- inspect_ai/_view/www/src/samples/transcript/ErrorEventView.tsx +51 -0
- inspect_ai/_view/www/src/samples/transcript/InfoEventView.module.css +3 -0
- inspect_ai/_view/www/src/samples/transcript/InfoEventView.tsx +54 -0
- inspect_ai/_view/www/src/samples/transcript/InputEventView.tsx +48 -0
- inspect_ai/_view/www/src/samples/transcript/LoggerEventView.module.css +6 -0
- inspect_ai/_view/www/src/samples/transcript/LoggerEventView.tsx +36 -0
- inspect_ai/_view/www/src/samples/transcript/ModelEventView.module.css +43 -0
- inspect_ai/_view/www/src/samples/transcript/ModelEventView.tsx +223 -0
- inspect_ai/_view/www/src/samples/transcript/SampleInitEventView.module.css +23 -0
- inspect_ai/_view/www/src/samples/transcript/SampleInitEventView.tsx +112 -0
- inspect_ai/_view/www/src/samples/transcript/SampleLimitEventView.tsx +75 -0
- inspect_ai/_view/www/src/samples/transcript/SampleTranscript.tsx +22 -0
- inspect_ai/_view/www/src/samples/transcript/ScoreEventView.module.css +15 -0
- inspect_ai/_view/www/src/samples/transcript/ScoreEventView.tsx +100 -0
- inspect_ai/_view/www/src/samples/transcript/StepEventView.tsx +171 -0
- inspect_ai/_view/www/src/samples/transcript/SubtaskEventView.module.css +19 -0
- inspect_ai/_view/www/src/samples/transcript/SubtaskEventView.tsx +133 -0
- inspect_ai/_view/www/src/samples/transcript/ToolEventView.module.css +10 -0
- inspect_ai/_view/www/src/samples/transcript/ToolEventView.tsx +92 -0
- inspect_ai/_view/www/src/samples/transcript/TranscriptView.module.css +49 -0
- inspect_ai/_view/www/src/samples/transcript/TranscriptView.tsx +449 -0
- inspect_ai/_view/www/src/samples/transcript/event/EventNav.module.css +5 -0
- inspect_ai/_view/www/src/samples/transcript/event/EventNav.tsx +43 -0
- inspect_ai/_view/www/src/samples/transcript/event/EventNavs.module.css +3 -0
- inspect_ai/_view/www/src/samples/transcript/event/EventNavs.tsx +39 -0
- inspect_ai/_view/www/src/samples/transcript/event/EventPanel.module.css +25 -0
- inspect_ai/_view/www/src/samples/transcript/event/EventPanel.tsx +191 -0
- inspect_ai/_view/www/src/samples/transcript/event/EventRow.module.css +13 -0
- inspect_ai/_view/www/src/samples/transcript/event/EventRow.tsx +32 -0
- inspect_ai/_view/www/src/samples/transcript/event/EventSection.module.css +8 -0
- inspect_ai/_view/www/src/samples/transcript/event/EventSection.tsx +29 -0
- inspect_ai/_view/www/src/samples/transcript/state/StateDiffView.tsx +67 -0
- inspect_ai/_view/www/src/samples/transcript/state/StateEventRenderers.tsx +285 -0
- inspect_ai/_view/www/src/samples/transcript/state/StateEventRenders.module.css +10 -0
- inspect_ai/_view/www/src/samples/transcript/state/StateEventView.module.css +9 -0
- inspect_ai/_view/www/src/samples/transcript/state/StateEventView.tsx +346 -0
- inspect_ai/_view/www/src/samples/transcript/types.ts +58 -0
- inspect_ai/_view/www/src/types/log.d.ts +108 -19
- inspect_ai/_view/www/src/types/prism.d.ts +11 -0
- inspect_ai/_view/www/src/types.ts +71 -0
- inspect_ai/_view/www/src/usage/ModelTokenTable.tsx +28 -0
- inspect_ai/_view/www/src/usage/ModelUsagePanel.module.css +24 -0
- inspect_ai/_view/www/src/usage/ModelUsagePanel.tsx +97 -0
- inspect_ai/_view/www/src/usage/TokenTable.module.css +17 -0
- inspect_ai/_view/www/src/usage/TokenTable.tsx +91 -0
- inspect_ai/_view/www/src/usage/UsageCard.module.css +15 -0
- inspect_ai/_view/www/src/usage/UsageCard.tsx +67 -0
- inspect_ai/_view/www/src/utils/attachments.ts +42 -0
- inspect_ai/_view/www/src/utils/{Base64.mjs → base64.ts} +1 -6
- inspect_ai/_view/www/src/{components/Browser.mjs → utils/browser.ts} +0 -1
- inspect_ai/_view/www/src/utils/debugging.ts +28 -0
- inspect_ai/_view/www/src/utils/dom.ts +30 -0
- inspect_ai/_view/www/src/utils/format.ts +194 -0
- inspect_ai/_view/www/src/utils/git.ts +7 -0
- inspect_ai/_view/www/src/utils/html.ts +6 -0
- inspect_ai/_view/www/src/utils/http.ts +14 -0
- inspect_ai/_view/www/src/utils/{Path.mjs → path.ts} +2 -9
- inspect_ai/_view/www/src/utils/{Print.mjs → print.ts} +34 -26
- inspect_ai/_view/www/src/utils/queue.ts +51 -0
- inspect_ai/_view/www/src/utils/sync.ts +114 -0
- inspect_ai/_view/www/src/utils/{Type.mjs → type.ts} +3 -6
- inspect_ai/_view/www/src/utils/vscode.ts +13 -0
- inspect_ai/_view/www/src/workspace/WorkSpace.tsx +324 -0
- inspect_ai/_view/www/src/workspace/WorkSpaceView.module.css +33 -0
- inspect_ai/_view/www/src/workspace/WorkSpaceView.tsx +158 -0
- inspect_ai/_view/www/src/workspace/error/TaskErrorPanel.module.css +3 -0
- inspect_ai/_view/www/src/workspace/error/TaskErrorPanel.tsx +28 -0
- inspect_ai/_view/www/src/workspace/navbar/Navbar.module.css +54 -0
- inspect_ai/_view/www/src/workspace/navbar/Navbar.tsx +68 -0
- inspect_ai/_view/www/src/workspace/navbar/PrimaryBar.module.css +52 -0
- inspect_ai/_view/www/src/workspace/navbar/PrimaryBar.tsx +114 -0
- inspect_ai/_view/www/src/workspace/navbar/ResultsPanel.module.css +90 -0
- inspect_ai/_view/www/src/workspace/navbar/ResultsPanel.tsx +180 -0
- inspect_ai/_view/www/src/workspace/navbar/SecondaryBar.module.css +28 -0
- inspect_ai/_view/www/src/workspace/navbar/SecondaryBar.tsx +226 -0
- inspect_ai/_view/www/src/workspace/navbar/StatusPanel.module.css +14 -0
- inspect_ai/_view/www/src/workspace/navbar/StatusPanel.tsx +61 -0
- inspect_ai/_view/www/src/workspace/sidebar/EvalStatus.module.css +15 -0
- inspect_ai/_view/www/src/workspace/sidebar/EvalStatus.tsx +71 -0
- inspect_ai/_view/www/src/workspace/sidebar/LogDirectoryTitleView.module.css +5 -0
- inspect_ai/_view/www/src/workspace/sidebar/LogDirectoryTitleView.tsx +56 -0
- inspect_ai/_view/www/src/workspace/sidebar/Sidebar.module.css +68 -0
- inspect_ai/_view/www/src/workspace/sidebar/Sidebar.tsx +85 -0
- inspect_ai/_view/www/src/workspace/sidebar/SidebarLogEntry.module.css +29 -0
- inspect_ai/_view/www/src/workspace/sidebar/SidebarLogEntry.tsx +95 -0
- inspect_ai/_view/www/src/workspace/sidebar/SidebarScoreView.module.css +23 -0
- inspect_ai/_view/www/src/workspace/sidebar/SidebarScoreView.tsx +43 -0
- inspect_ai/_view/www/src/workspace/sidebar/SidebarScoresView.module.css +35 -0
- inspect_ai/_view/www/src/workspace/sidebar/SidebarScoresView.tsx +63 -0
- inspect_ai/_view/www/src/workspace/tabs/InfoTab.module.css +0 -0
- inspect_ai/_view/www/src/workspace/tabs/InfoTab.tsx +70 -0
- inspect_ai/_view/www/src/workspace/tabs/JsonTab.module.css +5 -0
- inspect_ai/_view/www/src/workspace/tabs/JsonTab.tsx +46 -0
- inspect_ai/_view/www/src/workspace/tabs/SamplesTab.tsx +204 -0
- inspect_ai/_view/www/src/workspace/tabs/grouping.ts +195 -0
- inspect_ai/_view/www/src/workspace/tabs/types.ts +19 -0
- inspect_ai/_view/www/src/workspace/types.ts +10 -0
- inspect_ai/_view/www/src/workspace/utils.ts +34 -0
- inspect_ai/_view/www/tsconfig.json +23 -9
- inspect_ai/_view/www/vite.config.js +8 -17
- inspect_ai/_view/www/yarn.lock +627 -556
- inspect_ai/approval/_approval.py +2 -0
- inspect_ai/approval/_approver.py +4 -4
- inspect_ai/approval/_auto.py +1 -1
- inspect_ai/approval/_human/approver.py +3 -0
- inspect_ai/approval/_policy.py +5 -0
- inspect_ai/approval/_registry.py +2 -2
- inspect_ai/dataset/_dataset.py +64 -37
- inspect_ai/dataset/_sources/__init__.py +0 -0
- inspect_ai/dataset/_sources/csv.py +20 -12
- inspect_ai/dataset/_sources/file.py +4 -0
- inspect_ai/dataset/_sources/hf.py +39 -29
- inspect_ai/dataset/_sources/json.py +17 -9
- inspect_ai/log/__init__.py +2 -0
- inspect_ai/log/_convert.py +3 -3
- inspect_ai/log/_file.py +24 -9
- inspect_ai/log/_log.py +101 -13
- inspect_ai/log/_message.py +4 -2
- inspect_ai/log/_recorders/file.py +4 -0
- inspect_ai/log/_recorders/json.py +5 -7
- inspect_ai/log/_recorders/recorder.py +3 -0
- inspect_ai/log/_transcript.py +19 -8
- inspect_ai/model/__init__.py +2 -0
- inspect_ai/model/_cache.py +39 -21
- inspect_ai/model/_call_tools.py +4 -3
- inspect_ai/model/_chat_message.py +14 -4
- inspect_ai/model/_generate_config.py +1 -1
- inspect_ai/model/_model.py +31 -24
- inspect_ai/model/_model_output.py +14 -1
- inspect_ai/model/_openai.py +10 -18
- inspect_ai/model/_providers/anthropic.py +3 -3
- inspect_ai/model/_providers/google.py +9 -5
- inspect_ai/model/_providers/openai.py +5 -9
- inspect_ai/model/_providers/openai_o1.py +3 -5
- inspect_ai/model/_providers/openrouter.py +86 -0
- inspect_ai/model/_providers/providers.py +11 -0
- inspect_ai/scorer/__init__.py +6 -1
- inspect_ai/scorer/_answer.py +7 -7
- inspect_ai/scorer/_classification.py +38 -18
- inspect_ai/scorer/_common.py +2 -8
- inspect_ai/scorer/_match.py +4 -5
- inspect_ai/scorer/_metric.py +87 -28
- inspect_ai/scorer/_metrics/__init__.py +3 -3
- inspect_ai/scorer/_metrics/accuracy.py +8 -10
- inspect_ai/scorer/_metrics/mean.py +3 -17
- inspect_ai/scorer/_metrics/std.py +111 -30
- inspect_ai/scorer/_model.py +12 -12
- inspect_ai/scorer/_pattern.py +3 -3
- inspect_ai/scorer/_reducer/reducer.py +36 -21
- inspect_ai/scorer/_reducer/registry.py +2 -2
- inspect_ai/scorer/_reducer/types.py +7 -1
- inspect_ai/scorer/_score.py +11 -1
- inspect_ai/scorer/_scorer.py +110 -16
- inspect_ai/solver/__init__.py +1 -1
- inspect_ai/solver/_basic_agent.py +19 -22
- inspect_ai/solver/_bridge/__init__.py +0 -3
- inspect_ai/solver/_bridge/bridge.py +3 -3
- inspect_ai/solver/_chain.py +1 -2
- inspect_ai/solver/_critique.py +3 -3
- inspect_ai/solver/_fork.py +2 -2
- inspect_ai/solver/_human_agent/__init__.py +0 -0
- inspect_ai/solver/_human_agent/agent.py +5 -8
- inspect_ai/solver/_human_agent/commands/clock.py +14 -10
- inspect_ai/solver/_human_agent/commands/note.py +1 -1
- inspect_ai/solver/_human_agent/commands/score.py +0 -11
- inspect_ai/solver/_multiple_choice.py +38 -26
- inspect_ai/solver/_prompt.py +7 -7
- inspect_ai/solver/_solver.py +53 -52
- inspect_ai/solver/_task_state.py +80 -69
- inspect_ai/solver/_use_tools.py +9 -9
- inspect_ai/tool/__init__.py +4 -1
- inspect_ai/tool/_tool.py +43 -14
- inspect_ai/tool/_tool_call.py +6 -2
- inspect_ai/tool/_tool_choice.py +3 -1
- inspect_ai/tool/_tool_def.py +10 -8
- inspect_ai/tool/_tool_params.py +24 -0
- inspect_ai/tool/_tool_with.py +7 -7
- inspect_ai/tool/_tools/__init__.py +0 -0
- inspect_ai/tool/{beta → _tools}/_computer/_common.py +2 -2
- inspect_ai/tool/{beta → _tools}/_computer/_computer.py +13 -5
- inspect_ai/tool/_tools/_computer/_resources/tool/__init__.py +0 -0
- inspect_ai/tool/{beta → _tools}/_computer/_resources/tool/_x11_client.py +1 -1
- inspect_ai/tool/_tools/_computer/_resources/tool/requirements.txt +0 -0
- inspect_ai/tool/_tools/_execute.py +23 -11
- inspect_ai/tool/_tools/_web_browser/_resources/README.md +2 -2
- inspect_ai/tool/_tools/_web_browser/_web_browser.py +5 -3
- inspect_ai/tool/_tools/_web_search.py +7 -5
- inspect_ai/tool/beta.py +3 -0
- inspect_ai/util/_concurrency.py +3 -3
- inspect_ai/util/_panel.py +2 -0
- inspect_ai/util/_resource.py +12 -12
- inspect_ai/util/_sandbox/docker/compose.py +23 -20
- inspect_ai/util/_sandbox/docker/config.py +2 -1
- inspect_ai/util/_sandbox/docker/docker.py +42 -86
- inspect_ai/util/_sandbox/docker/service.py +100 -0
- inspect_ai/util/_sandbox/environment.py +99 -96
- inspect_ai/util/_sandbox/self_check.py +124 -16
- inspect_ai/util/_subprocess.py +5 -3
- inspect_ai/util/_subtask.py +15 -16
- {inspect_ai-0.3.62.dist-info → inspect_ai-0.3.64.dist-info}/LICENSE +1 -1
- {inspect_ai-0.3.62.dist-info → inspect_ai-0.3.64.dist-info}/METADATA +11 -6
- inspect_ai-0.3.64.dist-info/RECORD +625 -0
- inspect_ai/_view/www/src/Register.mjs +0 -3
- inspect_ai/_view/www/src/Types.mjs +0 -38
- inspect_ai/_view/www/src/appearance/Colors.mjs +0 -27
- inspect_ai/_view/www/src/appearance/Fonts.mjs +0 -66
- inspect_ai/_view/www/src/appearance/Icons.mjs +0 -240
- inspect_ai/_view/www/src/components/AnsiDisplay.mjs +0 -184
- inspect_ai/_view/www/src/components/AppErrorBoundary.mjs +0 -34
- inspect_ai/_view/www/src/components/AsciiCinemaPlayer.mjs +0 -74
- inspect_ai/_view/www/src/components/Card.mjs +0 -126
- inspect_ai/_view/www/src/components/ChatView.mjs +0 -441
- inspect_ai/_view/www/src/components/CopyButton.mjs +0 -48
- inspect_ai/_view/www/src/components/Dialog.mjs +0 -61
- inspect_ai/_view/www/src/components/DownloadButton.mjs +0 -15
- inspect_ai/_view/www/src/components/DownloadPanel.mjs +0 -29
- inspect_ai/_view/www/src/components/EmptyPanel.mjs +0 -23
- inspect_ai/_view/www/src/components/ErrorPanel.mjs +0 -66
- inspect_ai/_view/www/src/components/ExpandablePanel.mjs +0 -136
- inspect_ai/_view/www/src/components/FindBand.mjs +0 -157
- inspect_ai/_view/www/src/components/HumanBaselineView.mjs +0 -168
- inspect_ai/_view/www/src/components/JsonPanel.mjs +0 -61
- inspect_ai/_view/www/src/components/LabeledValue.mjs +0 -32
- inspect_ai/_view/www/src/components/LargeModal.mjs +0 -190
- inspect_ai/_view/www/src/components/LightboxCarousel.mjs +0 -217
- inspect_ai/_view/www/src/components/MarkdownDiv.mjs +0 -118
- inspect_ai/_view/www/src/components/MessageBand.mjs +0 -48
- inspect_ai/_view/www/src/components/MessageContent.mjs +0 -111
- inspect_ai/_view/www/src/components/MetaDataGrid.mjs +0 -92
- inspect_ai/_view/www/src/components/MetaDataView.mjs +0 -109
- inspect_ai/_view/www/src/components/MorePopOver.mjs +0 -50
- inspect_ai/_view/www/src/components/NavPills.mjs +0 -63
- inspect_ai/_view/www/src/components/ProgressBar.mjs +0 -51
- inspect_ai/_view/www/src/components/RenderedContent/ChatMessageRenderer.mjs +0 -54
- inspect_ai/_view/www/src/components/RenderedContent/Types.mjs +0 -19
- inspect_ai/_view/www/src/components/TabSet.mjs +0 -184
- inspect_ai/_view/www/src/components/ToolButton.mjs +0 -16
- inspect_ai/_view/www/src/components/Tools.mjs +0 -376
- inspect_ai/_view/www/src/components/VirtualList.mjs +0 -280
- inspect_ai/_view/www/src/components/ansi-output.js +0 -932
- inspect_ai/_view/www/src/json/JsonTab.mjs +0 -48
- inspect_ai/_view/www/src/log-reader/Log-Reader.mjs +0 -25
- inspect_ai/_view/www/src/log-reader/Native-Log-Reader.mjs +0 -13
- inspect_ai/_view/www/src/log-reader/Open-AI-Log-Reader.mjs +0 -263
- inspect_ai/_view/www/src/navbar/Navbar.mjs +0 -418
- inspect_ai/_view/www/src/navbar/SecondaryBar.mjs +0 -175
- inspect_ai/_view/www/src/plan/PlanCard.mjs +0 -418
- inspect_ai/_view/www/src/samples/SampleDialog.mjs +0 -123
- inspect_ai/_view/www/src/samples/SampleDisplay.mjs +0 -516
- inspect_ai/_view/www/src/samples/SampleError.mjs +0 -99
- inspect_ai/_view/www/src/samples/SampleList.mjs +0 -427
- inspect_ai/_view/www/src/samples/SampleScoreView.mjs +0 -172
- inspect_ai/_view/www/src/samples/SampleScores.mjs +0 -34
- inspect_ai/_view/www/src/samples/SampleTranscript.mjs +0 -20
- inspect_ai/_view/www/src/samples/SamplesDescriptor.mjs +0 -771
- inspect_ai/_view/www/src/samples/SamplesTab.mjs +0 -399
- inspect_ai/_view/www/src/samples/SamplesTools.mjs +0 -64
- inspect_ai/_view/www/src/samples/tools/EpochFilter.mjs +0 -38
- inspect_ai/_view/www/src/samples/tools/SampleFilter.mjs +0 -756
- inspect_ai/_view/www/src/samples/tools/SelectScorer.mjs +0 -141
- inspect_ai/_view/www/src/samples/tools/SortFilter.mjs +0 -151
- inspect_ai/_view/www/src/samples/transcript/ApprovalEventView.mjs +0 -71
- inspect_ai/_view/www/src/samples/transcript/ErrorEventView.mjs +0 -44
- inspect_ai/_view/www/src/samples/transcript/EventPanel.mjs +0 -271
- inspect_ai/_view/www/src/samples/transcript/EventRow.mjs +0 -46
- inspect_ai/_view/www/src/samples/transcript/EventSection.mjs +0 -33
- inspect_ai/_view/www/src/samples/transcript/InfoEventView.mjs +0 -59
- inspect_ai/_view/www/src/samples/transcript/InputEventView.mjs +0 -44
- inspect_ai/_view/www/src/samples/transcript/LoggerEventView.mjs +0 -32
- inspect_ai/_view/www/src/samples/transcript/ModelEventView.mjs +0 -216
- inspect_ai/_view/www/src/samples/transcript/SampleInitEventView.mjs +0 -107
- inspect_ai/_view/www/src/samples/transcript/SampleLimitEventView.mjs +0 -74
- inspect_ai/_view/www/src/samples/transcript/ScoreEventView.mjs +0 -100
- inspect_ai/_view/www/src/samples/transcript/StepEventView.mjs +0 -187
- inspect_ai/_view/www/src/samples/transcript/SubtaskEventView.mjs +0 -133
- inspect_ai/_view/www/src/samples/transcript/ToolEventView.mjs +0 -88
- inspect_ai/_view/www/src/samples/transcript/TranscriptView.mjs +0 -459
- inspect_ai/_view/www/src/samples/transcript/Types.mjs +0 -44
- inspect_ai/_view/www/src/samples/transcript/state/StateDiffView.mjs +0 -53
- inspect_ai/_view/www/src/samples/transcript/state/StateEventRenderers.mjs +0 -254
- inspect_ai/_view/www/src/samples/transcript/state/StateEventView.mjs +0 -313
- inspect_ai/_view/www/src/sidebar/Sidebar.mjs +0 -418
- inspect_ai/_view/www/src/usage/ModelTokenTable.mjs +0 -72
- inspect_ai/_view/www/src/usage/UsageCard.mjs +0 -159
- inspect_ai/_view/www/src/utils/Format.mjs +0 -260
- inspect_ai/_view/www/src/utils/Git.mjs +0 -12
- inspect_ai/_view/www/src/utils/Html.mjs +0 -21
- inspect_ai/_view/www/src/utils/attachments.mjs +0 -31
- inspect_ai/_view/www/src/utils/debugging.mjs +0 -23
- inspect_ai/_view/www/src/utils/http.mjs +0 -18
- inspect_ai/_view/www/src/utils/queue.mjs +0 -67
- inspect_ai/_view/www/src/utils/sync.mjs +0 -101
- inspect_ai/_view/www/src/workspace/TaskErrorPanel.mjs +0 -17
- inspect_ai/_view/www/src/workspace/WorkSpace.mjs +0 -516
- inspect_ai/tool/beta/__init__.py +0 -5
- inspect_ai-0.3.62.dist-info/RECORD +0 -481
- /inspect_ai/{tool/beta/_computer/_resources/tool → _eval}/__init__.py +0 -0
- /inspect_ai/{tool/beta/_computer/_resources/tool/requirements.txt → _util/__init__.py} +0 -0
- /inspect_ai/_view/www/src/{constants.mjs → constants.ts} +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/__init__.py +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_computer_split.py +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/Dockerfile +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/README.md +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/entrypoint/entrypoint.sh +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/entrypoint/novnc_startup.sh +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/entrypoint/x11vnc_startup.sh +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/entrypoint/xfce_startup.sh +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/entrypoint/xvfb_startup.sh +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/image_home_dir/.config/Code/User/globalStorage/state.vscdb +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/image_home_dir/.config/Code/User/settings.json +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/image_home_dir/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/image_home_dir/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-screensaver.xml +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/image_home_dir/Desktop/Firefox Web Browser.desktop +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/image_home_dir/Desktop/Terminal.desktop +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/image_home_dir/Desktop/Visual Studio Code.desktop +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/tool/_logger.py +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/tool/_run.py +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/tool/_tool_result.py +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/tool/computer_tool.py +0 -0
- {inspect_ai-0.3.62.dist-info → inspect_ai-0.3.64.dist-info}/WHEEL +0 -0
- {inspect_ai-0.3.62.dist-info → inspect_ai-0.3.64.dist-info}/entry_points.txt +0 -0
- {inspect_ai-0.3.62.dist-info → inspect_ai-0.3.64.dist-info}/top_level.txt +0 -0
@@ -1,178 +1,181 @@
|
|
1
|
-
import "bootstrap/dist/css/bootstrap.css";
|
2
1
|
import "bootstrap-icons/font/bootstrap-icons.css";
|
3
|
-
import "
|
2
|
+
import "bootstrap/dist/css/bootstrap.css";
|
3
|
+
|
4
4
|
import "prismjs";
|
5
|
+
import "prismjs/components/prism-bash";
|
6
|
+
import "prismjs/components/prism-clike";
|
7
|
+
import "prismjs/components/prism-javascript";
|
8
|
+
import "prismjs/components/prism-json";
|
9
|
+
import "prismjs/components/prism-python";
|
10
|
+
import "prismjs/themes/prism.css";
|
11
|
+
|
5
12
|
import "../App.css";
|
6
|
-
import "asciinema-player/dist/bundle/asciinema-player.css";
|
7
13
|
|
8
|
-
import {
|
9
|
-
|
10
|
-
import {
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
useRef,
|
17
|
-
useState,
|
18
|
-
} from "preact/hooks";
|
19
|
-
|
20
|
-
// Registration component
|
21
|
-
import "./Register.mjs";
|
22
|
-
|
23
|
-
import { debounce, sleep } from "./utils/sync.mjs";
|
24
|
-
import { clearDocumentSelection } from "./components/Browser.mjs";
|
25
|
-
import { AppErrorBoundary } from "./components/AppErrorBoundary.mjs";
|
26
|
-
import { ErrorPanel } from "./components/ErrorPanel.mjs";
|
27
|
-
import { ProgressBar } from "./components/ProgressBar.mjs";
|
28
|
-
|
29
|
-
import { Sidebar } from "./sidebar/Sidebar.mjs";
|
30
|
-
import { WorkSpace } from "./workspace/WorkSpace.mjs";
|
31
|
-
import { FindBand } from "./components/FindBand.mjs";
|
32
|
-
import { isVscode } from "./utils/Html.mjs";
|
33
|
-
import { getVscodeApi } from "./utils/vscode";
|
34
|
-
import { kDefaultSort } from "./constants.mjs";
|
14
|
+
import { AppErrorBoundary } from "./AppErrorBoundary";
|
15
|
+
import { ErrorPanel } from "./components/ErrorPanel";
|
16
|
+
import { ProgressBar } from "./components/ProgressBar";
|
17
|
+
import { clearDocumentSelection } from "./utils/browser";
|
18
|
+
import { debounce, sleep } from "./utils/sync";
|
19
|
+
|
20
|
+
import { FindBand } from "./components/FindBand";
|
21
|
+
import { kDefaultSort } from "./constants";
|
35
22
|
import {
|
36
23
|
createEvalDescriptor,
|
37
24
|
createSamplesDescriptor,
|
38
|
-
} from "./samples/
|
39
|
-
import {
|
40
|
-
import {
|
41
|
-
|
25
|
+
} from "./samples/descriptor/samplesDescriptor";
|
26
|
+
import { filterSamples } from "./samples/sample-tools/filters";
|
27
|
+
import {
|
28
|
+
byEpoch,
|
29
|
+
bySample,
|
30
|
+
sortSamples,
|
31
|
+
} from "./samples/sample-tools/SortFilter";
|
32
|
+
import { resolveAttachments } from "./utils/attachments";
|
33
|
+
import { getVscodeApi } from "./utils/vscode";
|
34
|
+
import { Sidebar } from "./workspace/sidebar/Sidebar.tsx";
|
35
|
+
import { WorkSpace } from "./workspace/WorkSpace";
|
42
36
|
|
37
|
+
import ClipboardJS from "clipboard";
|
38
|
+
import clsx from "clsx";
|
39
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
40
|
+
import {
|
41
|
+
ClientAPI,
|
42
|
+
EvalLogHeader,
|
43
|
+
EvalSummary,
|
44
|
+
HostMessage,
|
45
|
+
LogFiles,
|
46
|
+
SampleSummary,
|
47
|
+
} from "./api/types.ts";
|
43
48
|
import {
|
44
49
|
kEvalWorkspaceTabId,
|
45
50
|
kInfoWorkspaceTabId,
|
46
51
|
kSampleMessagesTabId,
|
47
52
|
kSampleTranscriptTabId,
|
48
|
-
} from "./constants
|
53
|
+
} from "./constants";
|
54
|
+
import {
|
55
|
+
ApplicationState,
|
56
|
+
AppStatus,
|
57
|
+
Capabilities,
|
58
|
+
CurrentLog,
|
59
|
+
ScoreFilter,
|
60
|
+
ScoreLabel,
|
61
|
+
} from "./types.ts";
|
62
|
+
import { EvalSample } from "./types/log";
|
63
|
+
|
64
|
+
interface AppProps {
|
65
|
+
api: ClientAPI;
|
66
|
+
applicationState?: ApplicationState;
|
67
|
+
saveApplicationState?: (state: ApplicationState) => void;
|
68
|
+
pollForLogs: boolean;
|
69
|
+
capabilities: Capabilities;
|
70
|
+
}
|
49
71
|
|
50
72
|
/**
|
51
73
|
* Renders the Main Application
|
52
|
-
*
|
53
|
-
* @param {Object} props - The parameters for the component.
|
54
|
-
* @param {import("./api/Types.ts").ClientAPI} props.api - The api that this view should use
|
55
|
-
* @param {Object} [props.initialState] - Initial state for app (optional, used by VS Code extension)
|
56
|
-
* @param {(state: Object) => void} [props.saveInitialState] - Save initial state for app (optional, used by VS Code extension)
|
57
|
-
* @param {boolean} props.pollForLogs - Whether the application should poll for log changes
|
58
|
-
* @returns {import("preact").JSX.Element} The App component.
|
59
74
|
*/
|
60
|
-
export
|
75
|
+
export const App: React.FC<AppProps> = ({
|
61
76
|
api,
|
62
|
-
|
63
|
-
|
77
|
+
applicationState,
|
78
|
+
saveApplicationState,
|
64
79
|
pollForLogs = true,
|
65
|
-
|
80
|
+
capabilities,
|
81
|
+
}) => {
|
66
82
|
// List of Logs
|
67
|
-
const [logs, setLogs] = useState(
|
68
|
-
|
83
|
+
const [logs, setLogs] = useState<LogFiles>(
|
84
|
+
applicationState?.logs || { log_dir: "", files: [] },
|
69
85
|
);
|
70
|
-
const [selectedLogIndex, setSelectedLogIndex] = useState(
|
71
|
-
|
72
|
-
?
|
86
|
+
const [selectedLogIndex, setSelectedLogIndex] = useState<number>(
|
87
|
+
applicationState?.selectedLogIndex !== undefined
|
88
|
+
? applicationState.selectedLogIndex
|
73
89
|
: -1,
|
74
90
|
);
|
75
91
|
|
76
92
|
// Log Headers
|
77
|
-
const [logHeaders, setLogHeaders] = useState(
|
78
|
-
|
79
|
-
|
93
|
+
const [logHeaders, setLogHeaders] = useState<Record<string, EvalLogHeader>>(
|
94
|
+
applicationState?.logHeaders || {},
|
95
|
+
);
|
96
|
+
const [headersLoading, setHeadersLoading] = useState<boolean>(
|
97
|
+
applicationState?.headersLoading || false,
|
80
98
|
);
|
81
99
|
|
82
|
-
|
83
|
-
|
84
|
-
initialState?.selectedLog || {
|
85
|
-
contents: undefined,
|
86
|
-
name: undefined,
|
87
|
-
},
|
100
|
+
const [selectedLog, setSelectedLog] = useState<CurrentLog | undefined>(
|
101
|
+
applicationState?.selectedLog,
|
88
102
|
);
|
89
103
|
|
90
104
|
// Workspace (the selected tab)
|
91
|
-
const [selectedWorkspaceTab, setSelectedWorkspaceTab] = useState(
|
92
|
-
|
105
|
+
const [selectedWorkspaceTab, setSelectedWorkspaceTab] = useState<string>(
|
106
|
+
applicationState?.selectedWorkspaceTab || kEvalWorkspaceTabId,
|
93
107
|
);
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
initialState?.selectedSampleIndex !== undefined
|
98
|
-
? initialState.selectedSampleIndex
|
108
|
+
const [selectedSampleIndex, setSelectedSampleIndex] = useState<number>(
|
109
|
+
applicationState?.selectedSampleIndex !== undefined
|
110
|
+
? applicationState.selectedSampleIndex
|
99
111
|
: -1,
|
100
112
|
);
|
101
|
-
|
102
|
-
|
103
|
-
initialState?.selectedSample,
|
113
|
+
const [selectedSample, setSelectedSample] = useState<EvalSample | undefined>(
|
114
|
+
applicationState?.selectedSample,
|
104
115
|
);
|
105
|
-
const [sampleStatus, setSampleStatus] = useState(
|
106
|
-
|
107
|
-
const [selectedSampleTab, setSelectedSampleTab] = useState(
|
108
|
-
initialState?.selectedSampleTab,
|
116
|
+
const [sampleStatus, setSampleStatus] = useState<"loading" | "ok" | "error">(
|
117
|
+
applicationState?.sampleStatus || "loading",
|
109
118
|
);
|
110
|
-
const
|
111
|
-
|
112
|
-
const workspaceTabScrollPosition = useRef(
|
113
|
-
initialState?.workspaceTabScrollPosition || {},
|
119
|
+
const [sampleError, setSampleError] = useState<Error | undefined>(
|
120
|
+
applicationState?.sampleError,
|
114
121
|
);
|
115
|
-
|
116
|
-
|
117
|
-
|
122
|
+
const [selectedSampleTab, setSelectedSampleTab] = useState<
|
123
|
+
string | undefined
|
124
|
+
>(applicationState?.selectedSampleTab);
|
125
|
+
const sampleScrollPosition = useRef<number>(
|
126
|
+
applicationState?.sampleScrollPosition || 0,
|
127
|
+
);
|
128
|
+
const loadingSampleIndexRef = useRef<number | null>(null);
|
129
|
+
const workspaceTabScrollPosition = useRef<Record<string, number>>(
|
130
|
+
applicationState?.workspaceTabScrollPosition || {},
|
118
131
|
);
|
119
132
|
|
120
|
-
|
121
|
-
|
122
|
-
initialState?.status || {
|
123
|
-
loading: true,
|
124
|
-
error: undefined,
|
125
|
-
},
|
133
|
+
const [showingSampleDialog, setShowingSampleDialog] = useState<boolean>(
|
134
|
+
!!applicationState?.showingSampleDialog,
|
126
135
|
);
|
127
136
|
|
128
|
-
// App
|
129
|
-
const [
|
130
|
-
|
131
|
-
downloadFiles: true,
|
132
|
-
webWorkers: true,
|
133
|
-
},
|
137
|
+
// App loading status
|
138
|
+
const [status, setStatus] = useState<AppStatus>(
|
139
|
+
applicationState?.status || { loading: false },
|
134
140
|
);
|
135
141
|
|
136
142
|
// Other application state
|
137
|
-
const [offcanvas, setOffcanvas] = useState(
|
138
|
-
|
143
|
+
const [offcanvas, setOffcanvas] = useState<boolean>(
|
144
|
+
applicationState?.offcanvas || false,
|
145
|
+
);
|
146
|
+
const [showFind, setShowFind] = useState<boolean>(
|
147
|
+
applicationState?.showFind || false,
|
148
|
+
);
|
139
149
|
|
140
150
|
// Filtering and sorting
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
const [filter, setFilter] = useState(initialState?.filter || {});
|
145
|
-
|
146
|
-
/**
|
147
|
-
* @type {[string, function(string): void]}
|
148
|
-
*/
|
149
|
-
const [epoch, setEpoch] = useState(initialState?.epoch || "all");
|
151
|
+
const [filter, setFilter] = useState<ScoreFilter>(
|
152
|
+
applicationState?.filter || {},
|
153
|
+
);
|
150
154
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
+
const [epoch, setEpoch] = useState<string>(applicationState?.epoch || "all");
|
156
|
+
const [sort, setSort] = useState<string>(
|
157
|
+
applicationState?.sort || kDefaultSort,
|
158
|
+
);
|
155
159
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
const [scores, setScores] = useState(initialState?.scores || []);
|
160
|
+
const [scores, setScores] = useState<ScoreLabel[]>(
|
161
|
+
applicationState?.scores || [],
|
162
|
+
);
|
160
163
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
const [score, setScore] = useState(initialState?.score);
|
164
|
+
const [score, setScore] = useState<ScoreLabel | undefined>(
|
165
|
+
applicationState?.score,
|
166
|
+
);
|
165
167
|
|
166
168
|
// Re-filter the samples
|
167
|
-
const [filteredSamples, setFilteredSamples] = useState(
|
168
|
-
|
169
|
+
const [filteredSamples, setFilteredSamples] = useState<SampleSummary[]>(
|
170
|
+
applicationState?.filteredSamples || [],
|
171
|
+
);
|
172
|
+
const [groupBy, setGroupBy] = useState<"none" | "epoch" | "sample">(
|
173
|
+
applicationState?.groupBy || "none",
|
169
174
|
);
|
170
|
-
const [
|
171
|
-
|
172
|
-
initialState?.groupByOrder || "asc",
|
175
|
+
const [groupByOrder, setGroupByOrder] = useState<"asc" | "desc">(
|
176
|
+
applicationState?.groupByOrder || "asc",
|
173
177
|
);
|
174
178
|
|
175
|
-
const afterBodyElements = [];
|
176
179
|
const saveState = useCallback(() => {
|
177
180
|
const state = {
|
178
181
|
logs,
|
@@ -188,7 +191,6 @@ export function App({
|
|
188
191
|
selectedSampleTab,
|
189
192
|
showingSampleDialog,
|
190
193
|
status,
|
191
|
-
capabilities,
|
192
194
|
offcanvas,
|
193
195
|
showFind,
|
194
196
|
filter,
|
@@ -202,8 +204,8 @@ export function App({
|
|
202
204
|
sampleScrollPosition: sampleScrollPosition.current,
|
203
205
|
workspaceTabScrollPosition: workspaceTabScrollPosition.current,
|
204
206
|
};
|
205
|
-
if (
|
206
|
-
|
207
|
+
if (saveApplicationState) {
|
208
|
+
saveApplicationState(state);
|
207
209
|
}
|
208
210
|
}, [
|
209
211
|
logs,
|
@@ -219,7 +221,6 @@ export function App({
|
|
219
221
|
selectedSampleTab,
|
220
222
|
showingSampleDialog,
|
221
223
|
status,
|
222
|
-
capabilities,
|
223
224
|
offcanvas,
|
224
225
|
showFind,
|
225
226
|
filter,
|
@@ -277,7 +278,6 @@ export function App({
|
|
277
278
|
selectedSampleTab,
|
278
279
|
showingSampleDialog,
|
279
280
|
status,
|
280
|
-
capabilities,
|
281
281
|
offcanvas,
|
282
282
|
showFind,
|
283
283
|
filter,
|
@@ -291,7 +291,7 @@ export function App({
|
|
291
291
|
]);
|
292
292
|
|
293
293
|
const handleSampleShowingDialog = useCallback(
|
294
|
-
(show) => {
|
294
|
+
(show: boolean) => {
|
295
295
|
setShowingSampleDialog(show);
|
296
296
|
if (!show) {
|
297
297
|
setSelectedSample(undefined);
|
@@ -308,15 +308,15 @@ export function App({
|
|
308
308
|
|
309
309
|
useEffect(() => {
|
310
310
|
const samples = selectedLog?.contents?.sampleSummaries || [];
|
311
|
-
const { result: prefiltered } =
|
312
|
-
evalDescriptor
|
313
|
-
|
314
|
-
|
315
|
-
|
311
|
+
const { result: prefiltered } =
|
312
|
+
evalDescriptor && filter?.value
|
313
|
+
? filterSamples(evalDescriptor, samples, filter.value)
|
314
|
+
: { result: samples };
|
315
|
+
|
316
316
|
const filtered = prefiltered.filter((sample) => {
|
317
317
|
// Filter by epoch if specified
|
318
318
|
if (epoch && epoch !== "all") {
|
319
|
-
if (epoch !== sample.epoch
|
319
|
+
if (epoch !== String(sample.epoch)) {
|
320
320
|
return false;
|
321
321
|
}
|
322
322
|
}
|
@@ -324,50 +324,53 @@ export function App({
|
|
324
324
|
});
|
325
325
|
|
326
326
|
// Sort the samples
|
327
|
-
|
327
|
+
if (samplesDescriptor) {
|
328
|
+
const { sorted, order } = sortSamples(sort, filtered, samplesDescriptor);
|
329
|
+
setFilteredSamples(sorted);
|
330
|
+
setGroupByOrder(order);
|
331
|
+
}
|
328
332
|
|
329
333
|
// Set the grouping
|
330
|
-
let grouping = "none";
|
331
|
-
if (
|
334
|
+
let grouping: "none" | "epoch" | "sample" = "none";
|
335
|
+
if (
|
336
|
+
samplesDescriptor?.evalDescriptor?.epochs &&
|
337
|
+
samplesDescriptor.evalDescriptor.epochs > 1
|
338
|
+
) {
|
332
339
|
if (byEpoch(sort) || epoch !== "all") {
|
333
340
|
grouping = "epoch";
|
334
341
|
} else if (bySample(sort)) {
|
335
342
|
grouping = "sample";
|
336
343
|
}
|
337
344
|
}
|
338
|
-
|
339
|
-
setFilteredSamples(sorted);
|
340
345
|
setGroupBy(grouping);
|
341
|
-
setGroupByOrder(order);
|
342
346
|
}, [selectedLog, filter, sort, epoch]);
|
343
347
|
|
344
348
|
const evalDescriptor = useMemo(() => {
|
345
349
|
return createEvalDescriptor(
|
346
350
|
scores,
|
347
|
-
selectedLog
|
348
|
-
selectedLog
|
351
|
+
selectedLog?.contents?.eval?.config?.epochs || 1,
|
352
|
+
selectedLog?.contents?.sampleSummaries,
|
349
353
|
);
|
350
354
|
}, [selectedLog, scores]);
|
351
355
|
|
352
356
|
const samplesDescriptor = useMemo(() => {
|
353
|
-
return
|
357
|
+
return evalDescriptor && score
|
358
|
+
? createSamplesDescriptor(evalDescriptor, score)
|
359
|
+
: undefined;
|
354
360
|
}, [evalDescriptor, score]);
|
355
361
|
|
356
|
-
|
357
|
-
(
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
},
|
366
|
-
[selectedSampleTab, showingSampleDialog],
|
367
|
-
);
|
362
|
+
useEffect(() => {
|
363
|
+
if (selectedSampleTab === undefined && selectedSample) {
|
364
|
+
setSelectedSampleTab(
|
365
|
+
selectedSample.events && selectedSample.events.length > 0
|
366
|
+
? kSampleTranscriptTabId
|
367
|
+
: kSampleMessagesTabId,
|
368
|
+
);
|
369
|
+
}
|
370
|
+
}, [selectedSample, selectedSampleTab]);
|
368
371
|
|
369
372
|
// The main application reference
|
370
|
-
const mainAppRef = useRef();
|
373
|
+
const mainAppRef = useRef<HTMLDivElement>(null);
|
371
374
|
|
372
375
|
// Loads a sample
|
373
376
|
useEffect(() => {
|
@@ -408,30 +411,34 @@ export function App({
|
|
408
411
|
api
|
409
412
|
.get_log_sample(selectedLog.name, summary.id, summary.epoch)
|
410
413
|
.then((sample) => {
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
414
|
+
if (sample) {
|
415
|
+
// This migrates old samples (with raw transcript element)
|
416
|
+
// to the new structure (hence the type bypass).
|
417
|
+
const anySample = sample as any;
|
418
|
+
if (anySample.transcript) {
|
419
|
+
sample.events = anySample.transcript.events;
|
420
|
+
sample.attachments = anySample.transcript.content;
|
421
|
+
}
|
422
|
+
sample.attachments = sample.attachments || {};
|
423
|
+
sample.input = resolveAttachments(sample.input, sample.attachments);
|
424
|
+
sample.messages = resolveAttachments(
|
425
|
+
sample.messages,
|
426
|
+
sample.attachments,
|
427
|
+
);
|
428
|
+
sample.events = resolveAttachments(
|
429
|
+
sample.events,
|
430
|
+
sample.attachments,
|
431
|
+
);
|
432
|
+
sample.attachments = {};
|
433
|
+
|
434
|
+
sampleScrollPosition.current = 0;
|
435
|
+
setSelectedSample(sample);
|
436
|
+
|
437
|
+
setSampleStatus("ok");
|
438
|
+
loadingSampleIndexRef.current = null;
|
439
|
+
} else {
|
440
|
+
throw Error("Unable to load sample - an unknown error occurred.");
|
418
441
|
}
|
419
|
-
sample.attachments = sample.attachments || {};
|
420
|
-
sample.input = resolveAttachments(sample.input, sample.attachments);
|
421
|
-
sample.messages = resolveAttachments(
|
422
|
-
sample.messages,
|
423
|
-
sample.attachments,
|
424
|
-
);
|
425
|
-
sample.events = resolveAttachments(sample.events, sample.attachments);
|
426
|
-
sample.attachments = {};
|
427
|
-
|
428
|
-
sampleScrollPosition.current = 0;
|
429
|
-
setSelectedSample(sample);
|
430
|
-
|
431
|
-
refreshSampleTab(sample);
|
432
|
-
|
433
|
-
setSampleStatus("ok");
|
434
|
-
loadingSampleIndexRef.current = null;
|
435
442
|
})
|
436
443
|
.catch((e) => {
|
437
444
|
setSampleStatus("error");
|
@@ -473,10 +480,10 @@ export function App({
|
|
473
480
|
for (const fileList of fileLists) {
|
474
481
|
const headers = await api.get_log_headers(fileList);
|
475
482
|
setLogHeaders((prev) => {
|
476
|
-
const updatedHeaders = {};
|
483
|
+
const updatedHeaders: Record<string, EvalLogHeader> = {};
|
477
484
|
headers.forEach((header, index) => {
|
478
485
|
const logFile = fileList[index];
|
479
|
-
updatedHeaders[logFile] = header;
|
486
|
+
updatedHeaders[logFile] = header as EvalLogHeader;
|
480
487
|
});
|
481
488
|
return { ...prev, ...updatedHeaders };
|
482
489
|
});
|
@@ -485,16 +492,18 @@ export function App({
|
|
485
492
|
await sleep(5000); // Pause between chunks
|
486
493
|
}
|
487
494
|
}
|
488
|
-
} catch (e) {
|
489
|
-
if (
|
495
|
+
} catch (e: unknown) {
|
496
|
+
if (
|
497
|
+
e instanceof Error &&
|
498
|
+
(e.message === "Load failed" || e.message === "Failed to fetch")
|
499
|
+
) {
|
490
500
|
// This will happen if the server disappears (e.g. inspect view is terminated)
|
491
501
|
setStatus({ loading: false });
|
492
502
|
} else {
|
493
503
|
console.log(e);
|
494
|
-
setStatus({ loading: false, error: e });
|
504
|
+
setStatus({ loading: false, error: e as Error });
|
495
505
|
}
|
496
506
|
}
|
497
|
-
|
498
507
|
setHeadersLoading(false);
|
499
508
|
};
|
500
509
|
|
@@ -506,15 +515,9 @@ export function App({
|
|
506
515
|
*
|
507
516
|
* Determines whether the workspace tab should display samples or info,
|
508
517
|
* depending on the presence of samples and the log status.
|
509
|
-
*
|
510
|
-
* @param {import("./api/Types.ts").EvalSummary} log - The log object containing sample summaries and status.
|
511
|
-
* @returns {void}
|
512
518
|
*/
|
513
519
|
const resetWorkspace = useCallback(
|
514
|
-
|
515
|
-
* @param {import("./api/Types.ts").EvalSummary} log
|
516
|
-
*/
|
517
|
-
(log) => {
|
520
|
+
(log: EvalSummary) => {
|
518
521
|
// Reset the workspace tab
|
519
522
|
const hasSamples =
|
520
523
|
!!log.sampleSummaries && log.sampleSummaries.length > 0;
|
@@ -573,7 +576,7 @@ export function App({
|
|
573
576
|
}
|
574
577
|
} catch (e) {
|
575
578
|
console.log(e);
|
576
|
-
setStatus({ loading: false, error: e });
|
579
|
+
setStatus({ loading: false, error: e as Error });
|
577
580
|
}
|
578
581
|
} else if (logs.log_dir && logs.files.length === 0) {
|
579
582
|
setStatus({
|
@@ -586,36 +589,31 @@ export function App({
|
|
586
589
|
};
|
587
590
|
|
588
591
|
loadSpecificLog();
|
589
|
-
}, [
|
590
|
-
selectedLogIndex,
|
591
|
-
logs,
|
592
|
-
capabilities,
|
593
|
-
selectedLog,
|
594
|
-
setSelectedLog,
|
595
|
-
setStatus,
|
596
|
-
]);
|
592
|
+
}, [selectedLogIndex, logs, selectedLog, setSelectedLog, setStatus]);
|
597
593
|
|
598
594
|
// Load the list of logs
|
599
|
-
const loadLogs = async () => {
|
595
|
+
const loadLogs = async (): Promise<LogFiles> => {
|
600
596
|
try {
|
601
597
|
const result = await api.get_log_paths();
|
598
|
+
|
602
599
|
return result;
|
603
600
|
} catch (e) {
|
604
601
|
// Show an error
|
605
602
|
console.log(e);
|
606
|
-
setStatus({ loading: false, error: e });
|
603
|
+
setStatus({ loading: false, error: e as Error });
|
604
|
+
return { log_dir: "", files: [] };
|
607
605
|
}
|
608
606
|
};
|
609
607
|
|
610
608
|
// Load a specific log file
|
611
|
-
const loadLog = async (logFileName) => {
|
609
|
+
const loadLog = async (logFileName: string) => {
|
612
610
|
try {
|
613
611
|
const logContents = await api.get_log_summary(logFileName);
|
614
612
|
return logContents;
|
615
613
|
} catch (e) {
|
616
614
|
// Show an error
|
617
615
|
console.log(e);
|
618
|
-
setStatus({ loading: false, error: e });
|
616
|
+
setStatus({ loading: false, error: e as Error });
|
619
617
|
}
|
620
618
|
};
|
621
619
|
|
@@ -629,10 +627,10 @@ export function App({
|
|
629
627
|
if (log.status !== "started") {
|
630
628
|
setLogHeaders((prev) => {
|
631
629
|
const updatedState = { ...prev };
|
632
|
-
const freshHeaders = {
|
630
|
+
const freshHeaders: EvalLogHeader = {
|
633
631
|
eval: log.eval,
|
634
632
|
plan: log.plan,
|
635
|
-
results: log.results,
|
633
|
+
results: log.results !== null ? log.results : undefined,
|
636
634
|
stats: log.stats,
|
637
635
|
status: log.status,
|
638
636
|
version: log.version,
|
@@ -655,12 +653,12 @@ export function App({
|
|
655
653
|
} catch (e) {
|
656
654
|
// Show an error
|
657
655
|
console.log(e);
|
658
|
-
setStatus({ loading: false, error: e });
|
656
|
+
setStatus({ loading: false, error: e as Error });
|
659
657
|
}
|
660
658
|
}, [logs, selectedLogIndex, setStatus, setSelectedLog, setLogHeaders]);
|
661
659
|
|
662
660
|
const showLogFile = useCallback(
|
663
|
-
async (logUrl) => {
|
661
|
+
async (logUrl: string) => {
|
664
662
|
const index = logs.files.findIndex((val) => {
|
665
663
|
return logUrl.endsWith(val.name);
|
666
664
|
});
|
@@ -668,11 +666,11 @@ export function App({
|
|
668
666
|
setSelectedLogIndex(index);
|
669
667
|
} else {
|
670
668
|
const result = await loadLogs();
|
671
|
-
const idx = result
|
669
|
+
const idx = result?.files.findIndex((file) => {
|
672
670
|
return logUrl.endsWith(file.name);
|
673
671
|
});
|
674
|
-
setLogs(result);
|
675
|
-
setSelectedLogIndex(idx > -1 ? idx : 0);
|
672
|
+
setLogs(result || { log_dir: "", files: [] });
|
673
|
+
setSelectedLogIndex(idx && idx > -1 ? idx : 0);
|
676
674
|
}
|
677
675
|
},
|
678
676
|
[logs, setSelectedLogIndex, setLogs],
|
@@ -680,19 +678,20 @@ export function App({
|
|
680
678
|
|
681
679
|
const refreshLogList = useCallback(async () => {
|
682
680
|
const currentLog = logs.files[selectedLogIndex > -1 ? selectedLogIndex : 0];
|
683
|
-
|
684
681
|
const refreshedLogs = await loadLogs();
|
685
|
-
|
682
|
+
setLogs(refreshedLogs || { log_dir: "", files: [] });
|
683
|
+
|
684
|
+
const newIndex = refreshedLogs?.files.findIndex((file) => {
|
686
685
|
return currentLog.name.endsWith(file.name);
|
687
686
|
});
|
688
|
-
|
689
|
-
|
687
|
+
if (newIndex !== undefined) {
|
688
|
+
setSelectedLogIndex(newIndex);
|
689
|
+
}
|
690
690
|
}, [logs, selectedLogIndex, setSelectedLogIndex, setLogs]);
|
691
691
|
|
692
|
-
const onMessage =
|
693
|
-
|
694
|
-
|
695
|
-
switch (type) {
|
692
|
+
const onMessage = useCallback(
|
693
|
+
async (e: HostMessage) => {
|
694
|
+
switch (e.data.type) {
|
696
695
|
case "updateState": {
|
697
696
|
if (e.data.url) {
|
698
697
|
const decodedUrl = decodeURIComponent(e.data.url);
|
@@ -716,8 +715,9 @@ export function App({
|
|
716
715
|
break;
|
717
716
|
}
|
718
717
|
}
|
719
|
-
}
|
720
|
-
|
718
|
+
},
|
719
|
+
[logs, showLogFile, refreshLogList],
|
720
|
+
);
|
721
721
|
|
722
722
|
// listen for updateState messages from vscode
|
723
723
|
useEffect(() => {
|
@@ -732,29 +732,13 @@ export function App({
|
|
732
732
|
// See whether a specific task_file has been passed.
|
733
733
|
const urlParams = new URLSearchParams(window.location.search);
|
734
734
|
|
735
|
-
// Determine the capabilities
|
736
|
-
const extensionVersionEl = document.querySelector(
|
737
|
-
'meta[name="inspect-extension:version"]',
|
738
|
-
);
|
739
|
-
const extensionVersion = extensionVersionEl
|
740
|
-
? extensionVersionEl.getAttribute("content")
|
741
|
-
: undefined;
|
742
|
-
|
743
|
-
if (isVscode()) {
|
744
|
-
if (!extensionVersion) {
|
745
|
-
setCapabilities({ downloadFiles: false, webWorkers: false });
|
746
|
-
}
|
747
|
-
}
|
748
|
-
|
749
|
-
setOffcanvas(true);
|
750
|
-
|
751
735
|
// If the URL provides a task file, load that
|
752
736
|
const logPath = urlParams.get("task_file");
|
753
737
|
|
754
738
|
// Replace spaces with a '+' sign:
|
755
739
|
const resolvedLogPath = logPath ? logPath.replace(" ", "+") : logPath;
|
756
740
|
const load = resolvedLogPath
|
757
|
-
? async () => {
|
741
|
+
? async (): Promise<LogFiles> => {
|
758
742
|
return {
|
759
743
|
log_dir: "",
|
760
744
|
files: [{ name: resolvedLogPath }],
|
@@ -764,7 +748,7 @@ export function App({
|
|
764
748
|
|
765
749
|
const embeddedState = document.getElementById("logview-state");
|
766
750
|
if (embeddedState) {
|
767
|
-
const state = JSON.parse(embeddedState.textContent);
|
751
|
+
const state = JSON.parse(embeddedState.textContent || "");
|
768
752
|
onMessage({ data: state });
|
769
753
|
} else {
|
770
754
|
const result = await load();
|
@@ -828,31 +812,6 @@ export function App({
|
|
828
812
|
// Configure an app envelope specific to the current state
|
829
813
|
// if there are no log files, then don't show sidebar
|
830
814
|
const fullScreen = logs.files.length === 1 && !logs.log_dir;
|
831
|
-
const sidebar =
|
832
|
-
!fullScreen && selectedLog.contents
|
833
|
-
? html`
|
834
|
-
<${Sidebar}
|
835
|
-
logs=${logs}
|
836
|
-
logHeaders=${logHeaders}
|
837
|
-
loading=${headersLoading}
|
838
|
-
offcanvas=${offcanvas}
|
839
|
-
selectedIndex=${selectedLogIndex}
|
840
|
-
onSelectedIndexChanged=${(index) => {
|
841
|
-
setSelectedLogIndex(index);
|
842
|
-
|
843
|
-
// hide the sidebar offcanvas
|
844
|
-
var myOffcanvas = document.getElementById("sidebarOffCanvas");
|
845
|
-
var bsOffcanvas = Offcanvas.getInstance(myOffcanvas);
|
846
|
-
if (bsOffcanvas) {
|
847
|
-
bsOffcanvas.hide();
|
848
|
-
}
|
849
|
-
}}
|
850
|
-
/>
|
851
|
-
`
|
852
|
-
: "";
|
853
|
-
|
854
|
-
const fullScreenClz = fullScreen ? " full-screen" : "";
|
855
|
-
const offcanvasClz = offcanvas ? " off-canvas" : "";
|
856
815
|
|
857
816
|
const hideFind = useCallback(() => {
|
858
817
|
clearDocumentSelection();
|
@@ -861,12 +820,10 @@ export function App({
|
|
861
820
|
}
|
862
821
|
}, [showFind, setShowFind]);
|
863
822
|
|
864
|
-
const showToggle = logs.files.length > 1 || logs.log_dir;
|
823
|
+
const showToggle = logs.files.length > 1 || !!logs.log_dir || false;
|
865
824
|
|
866
825
|
/**
|
867
826
|
* Determines the sample mode based on the selected log's contents.
|
868
|
-
*
|
869
|
-
* @type {import("./Types.mjs").SampleMode}
|
870
827
|
*/
|
871
828
|
const sampleMode =
|
872
829
|
selectedLog?.contents?.sampleSummaries === undefined ||
|
@@ -875,104 +832,135 @@ export function App({
|
|
875
832
|
: selectedLog.contents.sampleSummaries.length === 1
|
876
833
|
? "single"
|
877
834
|
: "many";
|
878
|
-
return
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
835
|
+
return (
|
836
|
+
<AppErrorBoundary>
|
837
|
+
{!fullScreen && selectedLog?.contents ? (
|
838
|
+
<Sidebar
|
839
|
+
logs={logs}
|
840
|
+
logHeaders={logHeaders}
|
841
|
+
loading={headersLoading}
|
842
|
+
offcanvas={offcanvas}
|
843
|
+
setOffcanvas={setOffcanvas}
|
844
|
+
selectedIndex={selectedLogIndex}
|
845
|
+
onSelectedIndexChanged={(index) => {
|
846
|
+
setSelectedLogIndex(index);
|
847
|
+
setOffcanvas(false);
|
848
|
+
}}
|
849
|
+
/>
|
850
|
+
) : undefined}
|
851
|
+
<div
|
852
|
+
ref={mainAppRef}
|
853
|
+
className={clsx(
|
854
|
+
"app-main-grid",
|
855
|
+
fullScreen ? "full-screen" : undefined,
|
856
|
+
offcanvas ? "off-canvas" : undefined,
|
857
|
+
)}
|
858
|
+
tabIndex={0}
|
859
|
+
onKeyDown={(e) => {
|
860
|
+
// regular browsers user their own find
|
861
|
+
if (!getVscodeApi()) {
|
862
|
+
return;
|
863
|
+
}
|
888
864
|
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
865
|
+
if ((e.ctrlKey || e.metaKey) && e.key === "f") {
|
866
|
+
setShowFind(true);
|
867
|
+
} else if (e.key === "Escape") {
|
868
|
+
hideFind();
|
869
|
+
}
|
870
|
+
}}
|
871
|
+
>
|
872
|
+
{showFind ? <FindBand hideBand={hideFind} /> : ""}
|
873
|
+
<ProgressBar animating={status?.loading} />
|
874
|
+
{status?.error ? (
|
875
|
+
<ErrorPanel
|
876
|
+
title="An error occurred while loading this task."
|
877
|
+
error={status.error}
|
878
|
+
/>
|
879
|
+
) : (
|
880
|
+
<WorkSpace
|
881
|
+
task_id={selectedLog?.contents?.eval?.task_id}
|
882
|
+
logFileName={selectedLog?.name}
|
883
|
+
evalStatus={selectedLog?.contents?.status}
|
884
|
+
evalError={filterNull(selectedLog?.contents?.error)}
|
885
|
+
evalVersion={selectedLog?.contents?.version}
|
886
|
+
evalSpec={selectedLog?.contents?.eval}
|
887
|
+
evalPlan={selectedLog?.contents?.plan}
|
888
|
+
evalStats={selectedLog?.contents?.stats}
|
889
|
+
evalResults={filterNull(selectedLog?.contents?.results)}
|
890
|
+
showToggle={showToggle}
|
891
|
+
samples={filteredSamples}
|
892
|
+
sampleMode={sampleMode}
|
893
|
+
groupBy={groupBy}
|
894
|
+
groupByOrder={groupByOrder}
|
895
|
+
sampleStatus={sampleStatus}
|
896
|
+
sampleError={sampleError}
|
897
|
+
samplesDescriptor={samplesDescriptor}
|
898
|
+
refreshLog={refreshLog}
|
899
|
+
offcanvas={offcanvas}
|
900
|
+
setOffcanvas={setOffcanvas}
|
901
|
+
capabilities={capabilities}
|
902
|
+
selectedSample={selectedSample}
|
903
|
+
selectedSampleIndex={selectedSampleIndex}
|
904
|
+
setSelectedSampleIndex={setSelectedSampleIndex}
|
905
|
+
showingSampleDialog={showingSampleDialog}
|
906
|
+
setShowingSampleDialog={handleSampleShowingDialog}
|
907
|
+
selectedTab={selectedWorkspaceTab}
|
908
|
+
setSelectedTab={setSelectedWorkspaceTab}
|
909
|
+
selectedSampleTab={selectedSampleTab}
|
910
|
+
setSelectedSampleTab={setSelectedSampleTab}
|
911
|
+
sort={sort}
|
912
|
+
setSort={setSort}
|
913
|
+
epochs={selectedLog?.contents?.eval?.config?.epochs}
|
914
|
+
epoch={epoch}
|
915
|
+
setEpoch={setEpoch}
|
916
|
+
filter={filter}
|
917
|
+
setFilter={setFilter}
|
918
|
+
score={score}
|
919
|
+
setScore={setScore}
|
920
|
+
scores={scores}
|
921
|
+
sampleScrollPositionRef={sampleScrollPosition}
|
922
|
+
setSampleScrollPosition={setSampleScrollPosition}
|
923
|
+
workspaceTabScrollPositionRef={workspaceTabScrollPosition}
|
924
|
+
setWorkspaceTabScrollPosition={setWorkspaceTabScrollPosition}
|
925
|
+
/>
|
926
|
+
)}
|
927
|
+
</div>
|
928
|
+
</AppErrorBoundary>
|
929
|
+
);
|
930
|
+
};
|
931
|
+
|
932
|
+
const filterNull = <T,>(obj: T | null): T | undefined => {
|
933
|
+
if (obj === null) {
|
934
|
+
return undefined;
|
935
|
+
}
|
936
|
+
return obj;
|
937
|
+
};
|
938
|
+
|
939
|
+
interface ScorerInfo {
|
940
|
+
name: string;
|
941
|
+
scorer: string;
|
957
942
|
}
|
958
943
|
|
959
944
|
/**
|
960
945
|
* Determines the default scorer for a log
|
961
|
-
*
|
962
|
-
* @param {import("./api/Types.ts").EvalSummary} log - The log object containing sample summaries and status.
|
963
|
-
* @returns {{name: string, scorer: string} | undefined} A scorer object with name and scorer properties, or undefined
|
964
946
|
*/
|
965
|
-
const defaultScorer = (log) => {
|
947
|
+
const defaultScorer = (log: EvalSummary): ScorerInfo | undefined => {
|
948
|
+
if (log.sampleSummaries.length === 0) {
|
949
|
+
return undefined;
|
950
|
+
}
|
951
|
+
|
966
952
|
// Select the default scorer to use
|
953
|
+
const scores = log.sampleSummaries[0].scores;
|
954
|
+
|
967
955
|
const scorer = log.results?.scores[0]
|
968
956
|
? {
|
969
957
|
name: log.results?.scores[0].name,
|
970
958
|
scorer: log.results?.scores[0].scorer,
|
971
959
|
}
|
972
|
-
: log.sampleSummaries.length > 0
|
960
|
+
: log.sampleSummaries.length > 0 && scores !== null
|
973
961
|
? {
|
974
|
-
name: Object.keys(
|
975
|
-
scorer: Object.keys(
|
962
|
+
name: Object.keys(scores)[0],
|
963
|
+
scorer: Object.keys(scores)[0],
|
976
964
|
}
|
977
965
|
: undefined;
|
978
966
|
return scorer;
|
@@ -980,14 +968,11 @@ const defaultScorer = (log) => {
|
|
980
968
|
|
981
969
|
/**
|
982
970
|
* Determines the default scorers for a log
|
983
|
-
*
|
984
|
-
* @param {import("./api/Types.ts").EvalSummary} log - The log object containing sample summaries and status.
|
985
|
-
* @returns {Array<{name: string, scorer: string}>} An array of scorer objects with name and scorer properties, or an empty array if no scorers are found.
|
986
971
|
*/
|
987
|
-
const defaultScorers = (log) => {
|
972
|
+
const defaultScorers = (log: EvalSummary): Array<ScorerInfo> => {
|
988
973
|
if (log.results?.scores) {
|
989
974
|
return (log.results?.scores || [])
|
990
|
-
.map((score) => {
|
975
|
+
.map((score): ScorerInfo => {
|
991
976
|
return {
|
992
977
|
name: score.name,
|
993
978
|
scorer: score.scorer,
|
@@ -1002,14 +987,20 @@ const defaultScorers = (log) => {
|
|
1002
987
|
accum.push(scorer);
|
1003
988
|
}
|
1004
989
|
return accum;
|
1005
|
-
}, []);
|
990
|
+
}, [] as Array<ScorerInfo>);
|
1006
991
|
} else if (log.sampleSummaries && log.sampleSummaries.length > 0) {
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
992
|
+
const scores = log.sampleSummaries[0].scores;
|
993
|
+
|
994
|
+
if (scores !== null) {
|
995
|
+
return Object.keys(scores).map((key) => {
|
996
|
+
return {
|
997
|
+
name: key,
|
998
|
+
scorer: key,
|
999
|
+
};
|
1000
|
+
});
|
1001
|
+
} else {
|
1002
|
+
return [];
|
1003
|
+
}
|
1013
1004
|
} else {
|
1014
1005
|
return [];
|
1015
1006
|
}
|