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
@@ -0,0 +1,130 @@
|
|
1
|
+
import { useCallback, useEffect, useRef } from "react";
|
2
|
+
import { ApplicationIcons } from "../appearance/icons";
|
3
|
+
import "./FindBand.css";
|
4
|
+
|
5
|
+
interface FindBandProps {
|
6
|
+
hideBand: () => void;
|
7
|
+
}
|
8
|
+
|
9
|
+
export const FindBand: React.FC<FindBandProps> = ({ hideBand }) => {
|
10
|
+
const searchBoxRef = useRef<HTMLInputElement>(null);
|
11
|
+
|
12
|
+
useEffect(() => {
|
13
|
+
setTimeout(() => {
|
14
|
+
searchBoxRef.current?.focus();
|
15
|
+
}, 10);
|
16
|
+
}, []);
|
17
|
+
|
18
|
+
const getParentExpandablePanel = useCallback(
|
19
|
+
(selection: Selection): HTMLElement | undefined => {
|
20
|
+
let node = selection.anchorNode;
|
21
|
+
while (node) {
|
22
|
+
if (
|
23
|
+
node instanceof HTMLElement &&
|
24
|
+
node.classList.contains("expandable-panel")
|
25
|
+
) {
|
26
|
+
return node;
|
27
|
+
}
|
28
|
+
node = node.parentElement;
|
29
|
+
}
|
30
|
+
return undefined;
|
31
|
+
},
|
32
|
+
[],
|
33
|
+
);
|
34
|
+
|
35
|
+
const handleSearch = useCallback(
|
36
|
+
(back = false) => {
|
37
|
+
const searchTerm = searchBoxRef.current?.value ?? "";
|
38
|
+
const focusedElement = document.activeElement as HTMLElement;
|
39
|
+
// @ts-expect-error: `Window.find` is non-standard
|
40
|
+
const result = window.find(
|
41
|
+
searchTerm,
|
42
|
+
false,
|
43
|
+
back,
|
44
|
+
false,
|
45
|
+
false,
|
46
|
+
true,
|
47
|
+
false,
|
48
|
+
);
|
49
|
+
const noResultEl = document.getElementById("inspect-find-no-results");
|
50
|
+
|
51
|
+
if (!noResultEl) return;
|
52
|
+
|
53
|
+
noResultEl.style.opacity = result ? "0" : "1";
|
54
|
+
|
55
|
+
if (result) {
|
56
|
+
const selection = window.getSelection();
|
57
|
+
if (selection && selection.rangeCount > 0) {
|
58
|
+
const parentPanel = getParentExpandablePanel(selection);
|
59
|
+
if (parentPanel) {
|
60
|
+
parentPanel.style.display = "block";
|
61
|
+
parentPanel.style.webkitLineClamp = "";
|
62
|
+
parentPanel.style.webkitBoxOrient = "";
|
63
|
+
}
|
64
|
+
|
65
|
+
const range = selection.getRangeAt(0);
|
66
|
+
const element = range.startContainer.parentElement;
|
67
|
+
|
68
|
+
if (element) {
|
69
|
+
setTimeout(() => {
|
70
|
+
element.scrollIntoView({
|
71
|
+
behavior: "smooth",
|
72
|
+
block: "center",
|
73
|
+
});
|
74
|
+
}, 100);
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
focusedElement?.focus();
|
80
|
+
},
|
81
|
+
[getParentExpandablePanel],
|
82
|
+
);
|
83
|
+
|
84
|
+
const handleKeyDown = useCallback(
|
85
|
+
(e: React.KeyboardEvent<HTMLInputElement>) => {
|
86
|
+
if (e.key === "Escape") {
|
87
|
+
hideBand();
|
88
|
+
} else if (e.key === "Enter") {
|
89
|
+
handleSearch(false);
|
90
|
+
}
|
91
|
+
},
|
92
|
+
[hideBand, handleSearch],
|
93
|
+
);
|
94
|
+
|
95
|
+
return (
|
96
|
+
<div className="findBand">
|
97
|
+
<input
|
98
|
+
type="text"
|
99
|
+
ref={searchBoxRef}
|
100
|
+
placeholder="Find"
|
101
|
+
onKeyDown={handleKeyDown}
|
102
|
+
/>
|
103
|
+
<span id="inspect-find-no-results">No results</span>
|
104
|
+
<button
|
105
|
+
type="button"
|
106
|
+
title="Previous match"
|
107
|
+
className="btn next"
|
108
|
+
onClick={() => handleSearch(true)}
|
109
|
+
>
|
110
|
+
<i className={ApplicationIcons.arrows.up} />
|
111
|
+
</button>
|
112
|
+
<button
|
113
|
+
type="button"
|
114
|
+
title="Next match"
|
115
|
+
className="btn prev"
|
116
|
+
onClick={() => handleSearch(false)}
|
117
|
+
>
|
118
|
+
<i className={ApplicationIcons.arrows.down} />
|
119
|
+
</button>
|
120
|
+
<button
|
121
|
+
type="button"
|
122
|
+
title="Close"
|
123
|
+
className="btn close"
|
124
|
+
onClick={hideBand}
|
125
|
+
>
|
126
|
+
<i className={ApplicationIcons.close} />
|
127
|
+
</button>
|
128
|
+
</div>
|
129
|
+
);
|
130
|
+
};
|
@@ -0,0 +1,41 @@
|
|
1
|
+
.asciinema-player {
|
2
|
+
max-height: 100vh;
|
3
|
+
max-width: 100vw;
|
4
|
+
}
|
5
|
+
|
6
|
+
.asciinema-player-status {
|
7
|
+
margin-right: 0.5em;
|
8
|
+
}
|
9
|
+
|
10
|
+
.asciinema-wrapper {
|
11
|
+
display: flex;
|
12
|
+
justify-content: center;
|
13
|
+
}
|
14
|
+
|
15
|
+
.asciinema-container {
|
16
|
+
display: grid;
|
17
|
+
grid-template-columns: 1fr 1fr 1fr;
|
18
|
+
grid-template-rows: auto auto;
|
19
|
+
width: 100%;
|
20
|
+
}
|
21
|
+
|
22
|
+
.asciinema-header-left {
|
23
|
+
justify-self: start;
|
24
|
+
font-size: var(--inspect-font-size-small);
|
25
|
+
}
|
26
|
+
|
27
|
+
.asciinema-header-center {
|
28
|
+
justify-self: center;
|
29
|
+
font-size: var(--inspect-font-size-small);
|
30
|
+
}
|
31
|
+
|
32
|
+
.asciinema-header-right {
|
33
|
+
justify-self: start;
|
34
|
+
font-size: var(--inspect-font-size-small);
|
35
|
+
}
|
36
|
+
|
37
|
+
.asciinema-body {
|
38
|
+
border-top: 1px solid var(--bs-light-border-subtle);
|
39
|
+
grid-column: span 3;
|
40
|
+
width: 100%;
|
41
|
+
}
|
@@ -0,0 +1,162 @@
|
|
1
|
+
import { useEffect } from "react";
|
2
|
+
import { formatDateTime, formatTime } from "../utils/format";
|
3
|
+
import { AsciinemaPlayer } from "./AsciinemaPlayer";
|
4
|
+
import "./HumanBaselineView.css";
|
5
|
+
import { LightboxCarousel } from "./LightboxCarousel";
|
6
|
+
|
7
|
+
export interface SessionLog {
|
8
|
+
name: string;
|
9
|
+
user: string;
|
10
|
+
input: string;
|
11
|
+
output: string;
|
12
|
+
timing: string;
|
13
|
+
}
|
14
|
+
|
15
|
+
interface HumanBaselineViewProps {
|
16
|
+
started?: Date;
|
17
|
+
running: boolean;
|
18
|
+
completed?: boolean;
|
19
|
+
runtime?: number;
|
20
|
+
answer?: string;
|
21
|
+
sessionLogs: SessionLog[];
|
22
|
+
}
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Renders the HumanBaselineView component.
|
26
|
+
*/
|
27
|
+
export const HumanBaselineView: React.FC<HumanBaselineViewProps> = ({
|
28
|
+
started,
|
29
|
+
runtime,
|
30
|
+
answer,
|
31
|
+
completed,
|
32
|
+
running,
|
33
|
+
sessionLogs,
|
34
|
+
}) => {
|
35
|
+
const player_fns = [];
|
36
|
+
|
37
|
+
// handle creation and revoking of these URLs
|
38
|
+
const revokableUrls: string[] = [];
|
39
|
+
const revokableUrl = (data: BlobPart) => {
|
40
|
+
const blob = new Blob([data], { type: "text/plain" });
|
41
|
+
const url = URL.createObjectURL(blob);
|
42
|
+
revokableUrls.push(url);
|
43
|
+
return url;
|
44
|
+
};
|
45
|
+
|
46
|
+
useEffect(() => {
|
47
|
+
return () => {
|
48
|
+
revokableUrls.forEach((url) => URL.revokeObjectURL(url));
|
49
|
+
};
|
50
|
+
}, []);
|
51
|
+
|
52
|
+
// Make a player for each session log
|
53
|
+
let count = 1;
|
54
|
+
let maxCols = 0;
|
55
|
+
|
56
|
+
for (const sessionLog of sessionLogs) {
|
57
|
+
const rows = extractSize(sessionLog.output, "LINES", 24);
|
58
|
+
const cols = extractSize(sessionLog.output, "COLUMNS", 80);
|
59
|
+
maxCols = Math.max(maxCols, cols);
|
60
|
+
|
61
|
+
const currentCount = count;
|
62
|
+
const title =
|
63
|
+
sessionLogs.length === 1
|
64
|
+
? "Terminal Session"
|
65
|
+
: `Terminal Session ${currentCount}`;
|
66
|
+
|
67
|
+
player_fns.push({
|
68
|
+
label: title,
|
69
|
+
render: () => (
|
70
|
+
<AsciinemaPlayer
|
71
|
+
id={`player-${currentCount}`}
|
72
|
+
inputUrl={revokableUrl(sessionLog.input)}
|
73
|
+
outputUrl={revokableUrl(sessionLog.output)}
|
74
|
+
timingUrl={revokableUrl(sessionLog.timing)}
|
75
|
+
rows={rows}
|
76
|
+
cols={cols}
|
77
|
+
className={"asciinema-player"}
|
78
|
+
style={{
|
79
|
+
height: `${rows * 2}em`,
|
80
|
+
width: `${cols * 2}em`,
|
81
|
+
}}
|
82
|
+
fit="both"
|
83
|
+
/>
|
84
|
+
),
|
85
|
+
});
|
86
|
+
count += 1;
|
87
|
+
}
|
88
|
+
|
89
|
+
interface StatusMessageProps {
|
90
|
+
completed?: boolean;
|
91
|
+
running?: boolean;
|
92
|
+
answer?: string;
|
93
|
+
}
|
94
|
+
|
95
|
+
const StatusMessage: React.FC<StatusMessageProps> = ({
|
96
|
+
completed,
|
97
|
+
running,
|
98
|
+
answer,
|
99
|
+
}) => {
|
100
|
+
if (running) {
|
101
|
+
return <span className={"text-style-label"}>Running</span>;
|
102
|
+
} else if (completed) {
|
103
|
+
return (
|
104
|
+
<div>
|
105
|
+
<span
|
106
|
+
className={
|
107
|
+
"text-style-label text-style-secondary asciinema-player-status"
|
108
|
+
}
|
109
|
+
>
|
110
|
+
Answer
|
111
|
+
</span>
|
112
|
+
<span>{answer}</span>
|
113
|
+
</div>
|
114
|
+
);
|
115
|
+
} else {
|
116
|
+
return "Unknown status";
|
117
|
+
}
|
118
|
+
};
|
119
|
+
|
120
|
+
return (
|
121
|
+
<div className={"asciinema-wrapper"}>
|
122
|
+
<div className={"asciinema-container"}>
|
123
|
+
<div className={"asciinema-header-left text-style-label"}>
|
124
|
+
{started ? formatDateTime(started) : ""}
|
125
|
+
{runtime ? ` (${formatTime(Math.floor(runtime))})` : ""}
|
126
|
+
</div>
|
127
|
+
<div className={"asciinema-header-center text-style-label"}></div>
|
128
|
+
<div className={"asciinema-header-right"}>
|
129
|
+
<StatusMessage
|
130
|
+
completed={completed}
|
131
|
+
running={running}
|
132
|
+
answer={answer}
|
133
|
+
/>
|
134
|
+
</div>
|
135
|
+
<div className={"asciinema-body"}>
|
136
|
+
<LightboxCarousel slides={player_fns} />
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
</div>
|
140
|
+
);
|
141
|
+
};
|
142
|
+
|
143
|
+
/**
|
144
|
+
* Extracts a numeric size value from a string based on a given label.
|
145
|
+
*
|
146
|
+
* Searches the input string for a pattern matching the format `LABEL="VALUE"`,
|
147
|
+
* where `LABEL` is the provided label and `VALUE` is a numeric value.
|
148
|
+
*/
|
149
|
+
const extractSize = (
|
150
|
+
value: string,
|
151
|
+
label: string,
|
152
|
+
defaultValue: number,
|
153
|
+
): number => {
|
154
|
+
const regex = new RegExp(`${label}="(\\d+)"`);
|
155
|
+
const match = value.match(regex);
|
156
|
+
const size = match ? match[1] : undefined;
|
157
|
+
if (size) {
|
158
|
+
return parseInt(size);
|
159
|
+
} else {
|
160
|
+
return defaultValue;
|
161
|
+
}
|
162
|
+
};
|
@@ -0,0 +1,20 @@
|
|
1
|
+
.json-panel {
|
2
|
+
width: 100%;
|
3
|
+
padding: 0.5em;
|
4
|
+
}
|
5
|
+
|
6
|
+
.json-panel:not(.simple) {
|
7
|
+
background: var(--bs-light);
|
8
|
+
border-radius: var(--bs-border-radius);
|
9
|
+
}
|
10
|
+
|
11
|
+
.json-panel .source-code {
|
12
|
+
font-size: var(--inspect-font-size-small);
|
13
|
+
white-space: pre-wrap;
|
14
|
+
word-wrap: anywhere;
|
15
|
+
}
|
16
|
+
|
17
|
+
/* Prism.js theme customizations can go here if needed */
|
18
|
+
.language-javascript {
|
19
|
+
background: transparent !important;
|
20
|
+
}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
import clsx from "clsx";
|
2
|
+
import { highlightElement } from "prismjs";
|
3
|
+
import React, { useEffect, useMemo, useRef } from "react";
|
4
|
+
import "./JsonPanel.css";
|
5
|
+
|
6
|
+
const kPrismRenderMaxSize = 250000;
|
7
|
+
|
8
|
+
interface JSONPanelProps {
|
9
|
+
id?: string;
|
10
|
+
data?: unknown;
|
11
|
+
json?: string;
|
12
|
+
simple?: boolean;
|
13
|
+
style?: React.CSSProperties;
|
14
|
+
className?: string | string[];
|
15
|
+
}
|
16
|
+
|
17
|
+
export const JSONPanel: React.FC<JSONPanelProps> = ({
|
18
|
+
id,
|
19
|
+
json,
|
20
|
+
data,
|
21
|
+
simple = false,
|
22
|
+
style,
|
23
|
+
className,
|
24
|
+
}) => {
|
25
|
+
const codeRef = useRef<HTMLElement>(null);
|
26
|
+
const sourceCode = useMemo(() => {
|
27
|
+
return json || JSON.stringify(resolveBase64(data), undefined, 2);
|
28
|
+
}, [json, data]);
|
29
|
+
|
30
|
+
useEffect(() => {
|
31
|
+
if (sourceCode.length < kPrismRenderMaxSize && codeRef.current) {
|
32
|
+
highlightElement(codeRef.current);
|
33
|
+
}
|
34
|
+
}, [sourceCode]);
|
35
|
+
|
36
|
+
return (
|
37
|
+
<pre
|
38
|
+
className={clsx("json-panel", simple ? "simple" : "", className)}
|
39
|
+
style={style}
|
40
|
+
>
|
41
|
+
<code
|
42
|
+
id={id}
|
43
|
+
ref={codeRef}
|
44
|
+
className={clsx("source-code", "language-javascript")}
|
45
|
+
>
|
46
|
+
{sourceCode}
|
47
|
+
</code>
|
48
|
+
</pre>
|
49
|
+
);
|
50
|
+
};
|
51
|
+
|
52
|
+
export default JSONPanel;
|
53
|
+
|
54
|
+
export const resolveBase64 = (value: any): any => {
|
55
|
+
const prefix = "data:image";
|
56
|
+
|
57
|
+
// Handle arrays recursively
|
58
|
+
if (Array.isArray(value)) {
|
59
|
+
return value.map((v) => resolveBase64(v));
|
60
|
+
}
|
61
|
+
|
62
|
+
// Handle objects recursively
|
63
|
+
if (value && typeof value === "object") {
|
64
|
+
const resolvedObject: Record<string, unknown> = {};
|
65
|
+
for (const key of Object.keys(value)) {
|
66
|
+
resolvedObject[key] = resolveBase64(value[key]);
|
67
|
+
}
|
68
|
+
return resolvedObject;
|
69
|
+
}
|
70
|
+
|
71
|
+
// Handle string values with protocol references
|
72
|
+
if (typeof value === "string") {
|
73
|
+
let resolvedValue = value;
|
74
|
+
if (resolvedValue.startsWith(prefix)) {
|
75
|
+
resolvedValue = "[base64 image]";
|
76
|
+
}
|
77
|
+
return resolvedValue;
|
78
|
+
}
|
79
|
+
|
80
|
+
// Return unchanged for other types
|
81
|
+
return value;
|
82
|
+
};
|
@@ -0,0 +1,20 @@
|
|
1
|
+
.labeled-value-label {
|
2
|
+
font-size: var(--inspect-font-size-smaller);
|
3
|
+
margin-bottom: -0.2rem;
|
4
|
+
}
|
5
|
+
|
6
|
+
.labeled-value-value {
|
7
|
+
font-size: var(--inspect-font-size-base);
|
8
|
+
}
|
9
|
+
|
10
|
+
.labeled-value {
|
11
|
+
display: "flex";
|
12
|
+
}
|
13
|
+
|
14
|
+
.labeled-value .row {
|
15
|
+
flex-direction: row;
|
16
|
+
}
|
17
|
+
|
18
|
+
.labeled-value .column {
|
19
|
+
flex-direction: column;
|
20
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import clsx from "clsx";
|
2
|
+
|
3
|
+
interface LabeledValueProps {
|
4
|
+
label: string;
|
5
|
+
style?: React.CSSProperties;
|
6
|
+
valueStyle?: React.CSSProperties;
|
7
|
+
layout?: "column" | "row";
|
8
|
+
children: React.ReactNode;
|
9
|
+
className?: string | string[];
|
10
|
+
}
|
11
|
+
|
12
|
+
export const LabeledValue: React.FC<LabeledValueProps> = ({
|
13
|
+
layout = "column",
|
14
|
+
style,
|
15
|
+
label,
|
16
|
+
children,
|
17
|
+
valueStyle,
|
18
|
+
className,
|
19
|
+
}) => {
|
20
|
+
return (
|
21
|
+
<div
|
22
|
+
className={clsx(
|
23
|
+
"labeled-value",
|
24
|
+
layout === "column" ? "column" : "row",
|
25
|
+
className,
|
26
|
+
)}
|
27
|
+
style={{
|
28
|
+
...style,
|
29
|
+
}}
|
30
|
+
>
|
31
|
+
<div
|
32
|
+
className={"labeled-value-label text-style-label text-style-secondary"}
|
33
|
+
>
|
34
|
+
{label}
|
35
|
+
</div>
|
36
|
+
<div className={"labeled-value-value"} style={{ ...valueStyle }}>
|
37
|
+
{children}
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
);
|
41
|
+
};
|
@@ -0,0 +1,54 @@
|
|
1
|
+
.title {
|
2
|
+
flex: 1 1 auto;
|
3
|
+
}
|
4
|
+
|
5
|
+
.detail {
|
6
|
+
margin-left: auto;
|
7
|
+
margin-right: auto;
|
8
|
+
display: flex;
|
9
|
+
flex: 1 1 auto;
|
10
|
+
justify-content: center;
|
11
|
+
}
|
12
|
+
|
13
|
+
.detailText {
|
14
|
+
display: flex;
|
15
|
+
align-items: center;
|
16
|
+
}
|
17
|
+
|
18
|
+
.close {
|
19
|
+
border-width: 0px;
|
20
|
+
font-weight: 300;
|
21
|
+
padding: 0em 0.5em;
|
22
|
+
flex: 1;
|
23
|
+
text-align: right;
|
24
|
+
}
|
25
|
+
|
26
|
+
.modal {
|
27
|
+
border-radius: var(--bs-border-radius);
|
28
|
+
display: block;
|
29
|
+
}
|
30
|
+
|
31
|
+
.hidden {
|
32
|
+
display: none;
|
33
|
+
}
|
34
|
+
|
35
|
+
.modalBody {
|
36
|
+
max-width: 100%;
|
37
|
+
margin-left: var(--bs-modal-margin);
|
38
|
+
margin-right: var(--bs-modal-margin);
|
39
|
+
}
|
40
|
+
|
41
|
+
.content {
|
42
|
+
height: 100%;
|
43
|
+
}
|
44
|
+
|
45
|
+
.header {
|
46
|
+
padding: 0 0 0 1em;
|
47
|
+
display: flex;
|
48
|
+
}
|
49
|
+
|
50
|
+
.titleTool {
|
51
|
+
padding-top: 0;
|
52
|
+
padding-bottom: 0;
|
53
|
+
border: none;
|
54
|
+
}
|