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,126 +0,0 @@
|
|
1
|
-
import { html } from "htm/preact";
|
2
|
-
import { ApplicationIcons } from "../appearance/Icons.mjs";
|
3
|
-
import { FontSize, TextStyle } from "../appearance/Fonts.mjs";
|
4
|
-
|
5
|
-
export const CardHeader = ({ id, icon, label, classes, style, children }) => {
|
6
|
-
return html`<div
|
7
|
-
class="${classes || ""}"
|
8
|
-
...${{ id }}
|
9
|
-
style=${{
|
10
|
-
display: "grid",
|
11
|
-
gridTemplateColumns: "max-content auto",
|
12
|
-
columnGap: "0em",
|
13
|
-
padding: "0.5em 0.5em 0.5em 0.5em",
|
14
|
-
fontSize: FontSize.small,
|
15
|
-
fontWeight: 600,
|
16
|
-
...TextStyle.label,
|
17
|
-
...style,
|
18
|
-
}}
|
19
|
-
>
|
20
|
-
${icon
|
21
|
-
? html`<i
|
22
|
-
class="${icon}"
|
23
|
-
style=${{
|
24
|
-
paddingRight: "0.2rem",
|
25
|
-
}}
|
26
|
-
></i>`
|
27
|
-
: html`<span
|
28
|
-
style=${{
|
29
|
-
paddingRight: "0.2rem",
|
30
|
-
}}
|
31
|
-
></span>`}
|
32
|
-
${label ? label : ""} ${children}
|
33
|
-
</div> `;
|
34
|
-
};
|
35
|
-
|
36
|
-
export const CardBody = ({ id, classes, style, children }) => {
|
37
|
-
return html`<div
|
38
|
-
class="${classes || ""}"
|
39
|
-
...${{ id }}
|
40
|
-
style=${{
|
41
|
-
backgroundColor: "var(--bs-body-bg)",
|
42
|
-
border: "solid 1px var(--bs-light-border-subtle)",
|
43
|
-
borderRadius: "var(--bs-border-radius)",
|
44
|
-
margin: "0 8px 8px 8px",
|
45
|
-
padding: "0.5em",
|
46
|
-
...style,
|
47
|
-
}}
|
48
|
-
>
|
49
|
-
${children}
|
50
|
-
</div>`;
|
51
|
-
};
|
52
|
-
|
53
|
-
export const Card = ({ id, classes, style, children }) => {
|
54
|
-
return html`
|
55
|
-
<div
|
56
|
-
class="${classes || ""}"
|
57
|
-
...${{ id }}
|
58
|
-
style=${{
|
59
|
-
backgroundColor: "var(--bs-light-bg-subtle)",
|
60
|
-
border: "solid 1px var(--bs-light-border-subtle)",
|
61
|
-
borderRadius: "var(--bs-border-radius)",
|
62
|
-
marginBottom: "1.5em",
|
63
|
-
...style,
|
64
|
-
}}
|
65
|
-
>
|
66
|
-
${children}
|
67
|
-
</div>
|
68
|
-
`;
|
69
|
-
};
|
70
|
-
|
71
|
-
export const CardCollapsingHeader = ({
|
72
|
-
id,
|
73
|
-
icon,
|
74
|
-
label,
|
75
|
-
cardBodyId,
|
76
|
-
children,
|
77
|
-
}) => {
|
78
|
-
return html`
|
79
|
-
<${CardHeader} id=${id} classes="container-fluid collapse show do-not-collapse-self" style=${{
|
80
|
-
borderBottom: "none",
|
81
|
-
}}>
|
82
|
-
<div class="row row-cols-3"
|
83
|
-
type="button"
|
84
|
-
data-bs-toggle="collapse"
|
85
|
-
data-bs-target="#${cardBodyId}"
|
86
|
-
aria-expanded="false"
|
87
|
-
aria-controls="${cardBodyId}"
|
88
|
-
style=${{
|
89
|
-
justifyContent: "space-between",
|
90
|
-
alignItems: "center",
|
91
|
-
}}>
|
92
|
-
<div style=${{ flex: "0 0 content", paddingRight: "0.5rem" }}>
|
93
|
-
<i class="${icon}"></i> <span class="hide-when-collapsed">${label}</span>
|
94
|
-
</div>
|
95
|
-
<div
|
96
|
-
class="hide-when-expanded"
|
97
|
-
style=${{
|
98
|
-
color: "var(--body-color)",
|
99
|
-
opacity: "0.8",
|
100
|
-
flex: "1 1 auto",
|
101
|
-
fontSize: FontSize.smaller,
|
102
|
-
paddingRight: "0",
|
103
|
-
paddingLeft: "0",
|
104
|
-
transition: "opacity 0.2s ease-out",
|
105
|
-
display: "flex",
|
106
|
-
justifyContent: "space-between",
|
107
|
-
}}
|
108
|
-
>
|
109
|
-
|
110
|
-
|
111
|
-
${children}
|
112
|
-
|
113
|
-
</div>
|
114
|
-
<div style=${{
|
115
|
-
flex: "0 1 1em",
|
116
|
-
textAlign: "right",
|
117
|
-
padding: "0 0.5em 0.1em 0.5em",
|
118
|
-
fontSize: FontSize.smaller,
|
119
|
-
}}>
|
120
|
-
<i class="${ApplicationIcons["toggle-right"]} toggle-rotated"></i>
|
121
|
-
</div>
|
122
|
-
</div>
|
123
|
-
|
124
|
-
</${CardHeader}>
|
125
|
-
`;
|
126
|
-
};
|
@@ -1,441 +0,0 @@
|
|
1
|
-
// @ts-check
|
2
|
-
import { html } from "htm/preact";
|
3
|
-
|
4
|
-
import { ApplicationIcons } from "../appearance/Icons.mjs";
|
5
|
-
|
6
|
-
import { MessageContent } from "./MessageContent.mjs";
|
7
|
-
import { ExpandablePanel } from "./ExpandablePanel.mjs";
|
8
|
-
import { FontSize, TextStyle } from "../appearance/Fonts.mjs";
|
9
|
-
import { resolveToolInput, ToolCallView } from "./Tools.mjs";
|
10
|
-
import { VirtualList } from "./VirtualList.mjs";
|
11
|
-
import { MarkdownDiv } from "./MarkdownDiv.mjs";
|
12
|
-
|
13
|
-
/**
|
14
|
-
* Renders the ChatViewVirtualList component.
|
15
|
-
*
|
16
|
-
* @param {Object} props - The properties passed to the component.
|
17
|
-
* @param {string} props.id - The ID for the chat view.
|
18
|
-
* @param {import("../types/log").Messages} props.messages - The array of chat messages.
|
19
|
-
* @param {"compact" | "complete"} [props.toolCallStyle] - Whether to show tool calls
|
20
|
-
* @param {Object} [props.style] - Inline styles for the chat view.
|
21
|
-
* @param {boolean} props.indented - Whether the chatview has indented messages
|
22
|
-
* @param {boolean} [props.numbered] - Whether the chatview is numbered
|
23
|
-
* @param {import("htm/preact").MutableRef<HTMLElement>} props.scrollRef - The scrollable parent element
|
24
|
-
* @returns {import("preact").JSX.Element} The component.
|
25
|
-
*/
|
26
|
-
export const ChatViewVirtualList = ({
|
27
|
-
id,
|
28
|
-
messages,
|
29
|
-
toolCallStyle,
|
30
|
-
style,
|
31
|
-
indented,
|
32
|
-
numbered = true,
|
33
|
-
scrollRef,
|
34
|
-
}) => {
|
35
|
-
const collapsedMessages = resolveMessages(messages);
|
36
|
-
|
37
|
-
const renderRow = (item, index) => {
|
38
|
-
const number =
|
39
|
-
collapsedMessages.length > 1 && numbered ? index + 1 : undefined;
|
40
|
-
return html`<${ChatMessageRow}
|
41
|
-
id=${id}
|
42
|
-
number=${number}
|
43
|
-
resolvedMessage=${item}
|
44
|
-
indented=${indented}
|
45
|
-
toolCallStyle=${toolCallStyle}
|
46
|
-
/>`;
|
47
|
-
};
|
48
|
-
|
49
|
-
const result = html`<${VirtualList}
|
50
|
-
data=${collapsedMessages}
|
51
|
-
tabIndex="0"
|
52
|
-
renderRow=${renderRow}
|
53
|
-
scrollRef=${scrollRef}
|
54
|
-
style=${{ width: "100%", marginTop: "1em", ...style }}
|
55
|
-
/>`;
|
56
|
-
|
57
|
-
return result;
|
58
|
-
};
|
59
|
-
|
60
|
-
/**
|
61
|
-
* Renders the ChatView component.
|
62
|
-
*
|
63
|
-
* @param {Object} props - The properties passed to the component.
|
64
|
-
* @param {string} props.id - The ID for the chat view.
|
65
|
-
* @param {import("../types/log").Messages} props.messages - The array of chat messages.
|
66
|
-
* @param {"compact" | "complete"} [props.toolCallStyle] - Whether to show tool calls
|
67
|
-
* @param {Object} [props.style] - Inline styles for the chat view.
|
68
|
-
* @param {boolean} props.indented - Whether the chatview has indented messages
|
69
|
-
* @param {boolean} [props.numbered] - Whether the chatview is numbered
|
70
|
-
* @returns {import("preact").JSX.Element} The component.
|
71
|
-
*/
|
72
|
-
export const ChatView = ({
|
73
|
-
id,
|
74
|
-
messages,
|
75
|
-
toolCallStyle,
|
76
|
-
style,
|
77
|
-
indented,
|
78
|
-
numbered = true,
|
79
|
-
}) => {
|
80
|
-
const collapsedMessages = resolveMessages(messages);
|
81
|
-
const result = html` <div style=${style}>
|
82
|
-
${collapsedMessages.map((msg, index) => {
|
83
|
-
const number =
|
84
|
-
collapsedMessages.length > 1 && numbered ? index + 1 : undefined;
|
85
|
-
return html`<${ChatMessageRow}
|
86
|
-
id=${id}
|
87
|
-
number=${number}
|
88
|
-
resolvedMessage=${msg}
|
89
|
-
indented=${indented}
|
90
|
-
toolCallStyle=${toolCallStyle}
|
91
|
-
/>`;
|
92
|
-
})}
|
93
|
-
</div>`;
|
94
|
-
return result;
|
95
|
-
};
|
96
|
-
|
97
|
-
/**
|
98
|
-
* Renders the ChatMessage component.
|
99
|
-
*
|
100
|
-
* @param {Object} props - The properties passed to the component.
|
101
|
-
* @param {string} props.id - The ID for the chat view.
|
102
|
-
* @param {number} [props.number] - The message number
|
103
|
-
* @param {ResolvedMessage} props.resolvedMessage - The array of chat messages.
|
104
|
-
* @param {"compact" | "complete"} [props.toolCallStyle] - Whether to show tool calls
|
105
|
-
* @param {boolean} props.indented - Whether the chatview has indented messages
|
106
|
-
* @returns {import("preact").JSX.Element} The component.
|
107
|
-
*/
|
108
|
-
export const ChatMessageRow = ({
|
109
|
-
id,
|
110
|
-
number,
|
111
|
-
resolvedMessage,
|
112
|
-
toolCallStyle,
|
113
|
-
indented,
|
114
|
-
}) => {
|
115
|
-
if (number) {
|
116
|
-
return html` <div
|
117
|
-
style=${{
|
118
|
-
display: "grid",
|
119
|
-
gridTemplateColumns: "max-content auto",
|
120
|
-
columnGap: "0.4em",
|
121
|
-
}}
|
122
|
-
>
|
123
|
-
<div
|
124
|
-
style=${{
|
125
|
-
fontSize: FontSize.smaller,
|
126
|
-
...TextStyle.secondary,
|
127
|
-
marginTop: "0.1em",
|
128
|
-
}}
|
129
|
-
>
|
130
|
-
${number}
|
131
|
-
</div>
|
132
|
-
<${ChatMessage}
|
133
|
-
id=${`${id}-chat-messages`}
|
134
|
-
message=${resolvedMessage.message}
|
135
|
-
toolMessages=${resolvedMessage.toolMessages}
|
136
|
-
indented=${indented}
|
137
|
-
toolCallStyle=${toolCallStyle}
|
138
|
-
/>
|
139
|
-
</div>`;
|
140
|
-
} else {
|
141
|
-
return html`<${ChatMessage}
|
142
|
-
id=${`${id}-chat-messages`}
|
143
|
-
message=${resolvedMessage.message}
|
144
|
-
toolMessages=${resolvedMessage.toolMessages}
|
145
|
-
indented=${indented}
|
146
|
-
toolCallStyle=${toolCallStyle}
|
147
|
-
/>`;
|
148
|
-
}
|
149
|
-
};
|
150
|
-
|
151
|
-
/**
|
152
|
-
* @typedef {Object} ResolvedMessage
|
153
|
-
* @property {import("../types/log").ChatMessageAssistant | import("../types/log").ChatMessageSystem | import("../types/log").ChatMessageUser} message - The main chat message.
|
154
|
-
* @property {import("../types/log").ChatMessageTool[]} [toolMessages] - Optional array of tool-related messages.
|
155
|
-
*/
|
156
|
-
|
157
|
-
/**
|
158
|
-
* Renders the ChatView component.
|
159
|
-
*
|
160
|
-
* @param {import("../types/log").Messages} messages - The array of chat messages.
|
161
|
-
* @returns {ResolvedMessage[]} The component.
|
162
|
-
*/
|
163
|
-
export const resolveMessages = (messages) => {
|
164
|
-
// Filter tool messages into a sidelist that the chat stream
|
165
|
-
// can use to lookup the tool responses
|
166
|
-
|
167
|
-
/**
|
168
|
-
* @type {Array<{message: import("../types/log").ChatMessageAssistant | import("../types/log").ChatMessageSystem | import("../types/log").ChatMessageUser, toolMessages?: import("../types/log").ChatMessageTool[]}>}
|
169
|
-
*/
|
170
|
-
const resolvedMessages = [];
|
171
|
-
for (const message of messages) {
|
172
|
-
if (message.role === "tool") {
|
173
|
-
// Add this tool message onto the previous message
|
174
|
-
if (resolvedMessages.length > 0) {
|
175
|
-
const msg = resolvedMessages[resolvedMessages.length - 1];
|
176
|
-
msg.toolMessages.push(message);
|
177
|
-
}
|
178
|
-
} else {
|
179
|
-
resolvedMessages.push({ message, toolMessages: [] });
|
180
|
-
}
|
181
|
-
}
|
182
|
-
|
183
|
-
// Capture system messages (there could be multiple)
|
184
|
-
/**
|
185
|
-
* @type {Array<import("../types/log").ChatMessageSystem>}
|
186
|
-
*/
|
187
|
-
const systemMessages = [];
|
188
|
-
const collapsedMessages = resolvedMessages
|
189
|
-
.map((resolved) => {
|
190
|
-
if (resolved.message.role === "system") {
|
191
|
-
systemMessages.push(resolved.message);
|
192
|
-
}
|
193
|
-
return resolved;
|
194
|
-
})
|
195
|
-
.filter((resolved) => {
|
196
|
-
return resolved.message.role !== "system";
|
197
|
-
});
|
198
|
-
|
199
|
-
// Collapse system messages
|
200
|
-
/**
|
201
|
-
* @type {Array<import("../types/log").ContentImage | import("../types/log").ContentText>}
|
202
|
-
*/
|
203
|
-
const systemContent = [];
|
204
|
-
for (const systemMessage of systemMessages) {
|
205
|
-
const contents = Array.isArray(systemMessage.content)
|
206
|
-
? systemMessage.content
|
207
|
-
: [systemMessage.content];
|
208
|
-
systemContent.push(...contents.map(normalizeContent));
|
209
|
-
}
|
210
|
-
|
211
|
-
/**
|
212
|
-
* @type {import("../types/log").ChatMessageSystem}
|
213
|
-
*/
|
214
|
-
const systemMessage = {
|
215
|
-
role: "system",
|
216
|
-
content: systemContent,
|
217
|
-
source: "input",
|
218
|
-
};
|
219
|
-
|
220
|
-
// Converge them
|
221
|
-
if (systemMessage && systemMessage.content.length > 0) {
|
222
|
-
collapsedMessages.unshift({ message: systemMessage });
|
223
|
-
}
|
224
|
-
return collapsedMessages;
|
225
|
-
};
|
226
|
-
|
227
|
-
/**
|
228
|
-
* Ensure that content is a proper content type
|
229
|
-
*
|
230
|
-
* @param {import("../types/log").ContentText | import("../types/log").ContentImage | string} content - The properties passed to the component.
|
231
|
-
* @returns {import("../types/log").ContentText | import("../types/log").ContentImage} The component.
|
232
|
-
*/
|
233
|
-
const normalizeContent = (content) => {
|
234
|
-
if (typeof content === "string") {
|
235
|
-
return {
|
236
|
-
type: "text",
|
237
|
-
text: content,
|
238
|
-
};
|
239
|
-
} else {
|
240
|
-
return content;
|
241
|
-
}
|
242
|
-
};
|
243
|
-
|
244
|
-
/**
|
245
|
-
*
|
246
|
-
* @param {Object} props
|
247
|
-
* @param {string} props.id - The ID for the chat view.
|
248
|
-
* @param {import("../types/log").ChatMessageAssistant | import("../types/log").ChatMessageSystem | import("../types/log").ChatMessageUser} props.message - The primary message
|
249
|
-
* @param {import("../types/log").ChatMessageTool[]} props.toolMessages - The tool output message
|
250
|
-
* @param {boolean} props.indented - Whether the chatview has indented messages
|
251
|
-
* @param {"compact" | "complete"} props.toolCallStyle - Whether to hide tool calls
|
252
|
-
* @returns {import("preact").JSX.Element} The component.
|
253
|
-
*/
|
254
|
-
const ChatMessage = ({
|
255
|
-
id,
|
256
|
-
message,
|
257
|
-
toolMessages,
|
258
|
-
indented,
|
259
|
-
toolCallStyle,
|
260
|
-
}) => {
|
261
|
-
const collapse = message.role === "system";
|
262
|
-
return html`
|
263
|
-
<div
|
264
|
-
class="${message.role}"
|
265
|
-
style=${{
|
266
|
-
fontSize: FontSize.base,
|
267
|
-
fontWeight: "300",
|
268
|
-
paddingBottom: ".5em",
|
269
|
-
marginLeft: "0",
|
270
|
-
marginRight: "0",
|
271
|
-
opacity: message.role === "system" ? "0.7" : "1",
|
272
|
-
whiteSpace: "normal",
|
273
|
-
}}
|
274
|
-
>
|
275
|
-
<div style=${{
|
276
|
-
display: "grid",
|
277
|
-
gridTemplateColumns: "max-content auto",
|
278
|
-
columnGap: "0.3em",
|
279
|
-
fontWeight: "500",
|
280
|
-
marginBottom: "0.5em",
|
281
|
-
...TextStyle.label,
|
282
|
-
}}>
|
283
|
-
<i class="${iconForMsg(message)}"></i>
|
284
|
-
${message.role}
|
285
|
-
</div>
|
286
|
-
|
287
|
-
${
|
288
|
-
message.role === "assistant" && message.reasoning
|
289
|
-
? html` <div
|
290
|
-
style=${{
|
291
|
-
marginLeft: indented ? "1.1rem" : "0",
|
292
|
-
paddingBottom: "0.8rem",
|
293
|
-
}}
|
294
|
-
>
|
295
|
-
<div style=${{ ...TextStyle.label, ...TextStyle.secondary }}>Reasoning</div>
|
296
|
-
<${ExpandablePanel} collapse=${true}><${MarkdownDiv} markdown=${message.reasoning}/></${ExpandablePanel}>
|
297
|
-
</div>`
|
298
|
-
: undefined
|
299
|
-
}
|
300
|
-
|
301
|
-
<div style=${{ marginLeft: indented ? "1.1rem" : "0", paddingBottom: indented ? "0.8rem" : "0" }}>
|
302
|
-
${
|
303
|
-
message.role === "assistant" && message.reasoning
|
304
|
-
? html`<div style=${{ ...TextStyle.label, ...TextStyle.secondary }}>
|
305
|
-
Response
|
306
|
-
</div>`
|
307
|
-
: ""
|
308
|
-
}
|
309
|
-
<${ExpandablePanel} collapse=${collapse}>
|
310
|
-
<${MessageContents}
|
311
|
-
key=${`${id}-contents`}
|
312
|
-
message=${message}
|
313
|
-
toolMessages=${toolMessages}
|
314
|
-
toolCallStyle=${toolCallStyle}
|
315
|
-
/>
|
316
|
-
</${ExpandablePanel}>
|
317
|
-
</div>
|
318
|
-
</div>
|
319
|
-
`;
|
320
|
-
};
|
321
|
-
|
322
|
-
/**
|
323
|
-
*
|
324
|
-
* @param {Object} props
|
325
|
-
* @param {import("../types/log").ChatMessageAssistant | import("../types/log").ChatMessageSystem | import("../types/log").ChatMessageUser} props.message - The primary message
|
326
|
-
* @param {import("../types/log").ChatMessageTool[]} props.toolMessages - The tool output message
|
327
|
-
* @param {"compact" | "complete"} props.toolCallStyle - Whether to hide tool calls
|
328
|
-
* @returns {import("preact").JSX.Element | import("preact").JSX.Element[]} The component.
|
329
|
-
*/
|
330
|
-
const MessageContents = ({ message, toolMessages, toolCallStyle }) => {
|
331
|
-
if (
|
332
|
-
message.role === "assistant" &&
|
333
|
-
message.tool_calls &&
|
334
|
-
message.tool_calls.length
|
335
|
-
) {
|
336
|
-
const result = [];
|
337
|
-
// If the message contains content, render that.
|
338
|
-
if (message.content) {
|
339
|
-
result.push(
|
340
|
-
html`<div style=${{ marginBottom: "1em" }}>
|
341
|
-
<${MessageContent} contents=${message.content} />
|
342
|
-
</div>`,
|
343
|
-
);
|
344
|
-
}
|
345
|
-
|
346
|
-
// Render the tool calls made by this message
|
347
|
-
const toolCalls = message.tool_calls.map((tool_call, idx) => {
|
348
|
-
// Extract tool input
|
349
|
-
const { input, functionCall, inputType } = resolveToolInput(
|
350
|
-
tool_call.function,
|
351
|
-
tool_call.arguments,
|
352
|
-
);
|
353
|
-
|
354
|
-
let toolMessage;
|
355
|
-
if (tool_call.id) {
|
356
|
-
toolMessage = toolMessages.find((msg) => {
|
357
|
-
return msg.tool_call_id === tool_call.id;
|
358
|
-
});
|
359
|
-
} else {
|
360
|
-
toolMessage = toolMessages[idx];
|
361
|
-
}
|
362
|
-
|
363
|
-
// Resolve the tool output
|
364
|
-
const resolvedToolOutput = resolveToolMessage(toolMessage);
|
365
|
-
if (toolCallStyle === "compact") {
|
366
|
-
return html`<code>tool: ${functionCall}</code>`;
|
367
|
-
} else {
|
368
|
-
return html`<${ToolCallView}
|
369
|
-
functionCall=${functionCall}
|
370
|
-
input=${input}
|
371
|
-
inputType=${inputType}
|
372
|
-
output=${resolvedToolOutput}
|
373
|
-
/>`;
|
374
|
-
}
|
375
|
-
});
|
376
|
-
|
377
|
-
if (toolCalls) {
|
378
|
-
result.push(...toolCalls);
|
379
|
-
}
|
380
|
-
return result;
|
381
|
-
} else {
|
382
|
-
return html`<${MessageContent} contents=${message.content} />`;
|
383
|
-
}
|
384
|
-
};
|
385
|
-
|
386
|
-
export const iconForMsg = (msg) => {
|
387
|
-
if (msg.role === "user") {
|
388
|
-
return ApplicationIcons.role.user;
|
389
|
-
} else if (msg.role === "system") {
|
390
|
-
return ApplicationIcons.role.system;
|
391
|
-
} else if (msg.role === "tool") {
|
392
|
-
return ApplicationIcons.role.tool;
|
393
|
-
} else if (msg.role === "assistant") {
|
394
|
-
return ApplicationIcons.role.assistant;
|
395
|
-
} else {
|
396
|
-
return ApplicationIcons.role.unknown;
|
397
|
-
}
|
398
|
-
};
|
399
|
-
|
400
|
-
/**
|
401
|
-
*
|
402
|
-
* @param {import("../types/log").ChatMessageTool} toolMessage - The tool output message
|
403
|
-
* @returns {Array<{type: string, content: import("../types/log").Content4}>|undefined} An array of formatted tool message objects, or undefined if toolMessage is falsy.
|
404
|
-
*/
|
405
|
-
const resolveToolMessage = (toolMessage) => {
|
406
|
-
if (!toolMessage) {
|
407
|
-
return undefined;
|
408
|
-
}
|
409
|
-
|
410
|
-
const content =
|
411
|
-
toolMessage.error !== null && toolMessage.error
|
412
|
-
? toolMessage.error.message
|
413
|
-
: toolMessage.content;
|
414
|
-
if (typeof content === "string") {
|
415
|
-
return [
|
416
|
-
{
|
417
|
-
type: "tool",
|
418
|
-
content,
|
419
|
-
},
|
420
|
-
];
|
421
|
-
} else {
|
422
|
-
return content.map((con) => {
|
423
|
-
if (typeof content === "string") {
|
424
|
-
return {
|
425
|
-
type: "tool",
|
426
|
-
content,
|
427
|
-
};
|
428
|
-
} else if (con.type === "text") {
|
429
|
-
return {
|
430
|
-
content,
|
431
|
-
type: "tool",
|
432
|
-
};
|
433
|
-
} else if (con.type === "image") {
|
434
|
-
return {
|
435
|
-
content,
|
436
|
-
type: "tool",
|
437
|
-
};
|
438
|
-
}
|
439
|
-
});
|
440
|
-
}
|
441
|
-
};
|
@@ -1,48 +0,0 @@
|
|
1
|
-
// @ts-check
|
2
|
-
import { html } from "htm/preact";
|
3
|
-
import { ApplicationIcons } from "../appearance/Icons.mjs";
|
4
|
-
|
5
|
-
/**
|
6
|
-
* @typedef {Object} CopyButtonProps
|
7
|
-
* @property {string} value - The text value to be copied to the clipboard.
|
8
|
-
*/
|
9
|
-
|
10
|
-
/**
|
11
|
-
* CopyButton component.
|
12
|
-
* @param {CopyButtonProps} props - The props object.
|
13
|
-
* @returns {import("preact").JSX.Element} The CopyButton component.
|
14
|
-
*/
|
15
|
-
export const CopyButton = ({ value }) => {
|
16
|
-
return html`<button
|
17
|
-
class="copy-button"
|
18
|
-
style=${{
|
19
|
-
border: "none",
|
20
|
-
backgroundColor: "inherit",
|
21
|
-
opacity: "0.5",
|
22
|
-
paddingTop: "0px",
|
23
|
-
}}
|
24
|
-
data-clipboard-text=${value}
|
25
|
-
onclick=${(e) => {
|
26
|
-
let iEl = e.target;
|
27
|
-
// I haven't yet been able to consistently cause this, but
|
28
|
-
// this issue https://github.com/UKGovernmentBEIS/inspect_ai/issues/717
|
29
|
-
// does sometimes happen and when it does, the target element is the BUTTON
|
30
|
-
// not the I. Since I can't reliably determine the cause, for now just band-aid
|
31
|
-
// by getting the child in this case.
|
32
|
-
if (iEl.tagName === "BUTTON") {
|
33
|
-
iEl = iEl.firstChild;
|
34
|
-
}
|
35
|
-
if (iEl) {
|
36
|
-
if (iEl) {
|
37
|
-
iEl.className = `${ApplicationIcons.confirm} primary`;
|
38
|
-
setTimeout(() => {
|
39
|
-
iEl.className = ApplicationIcons.copy;
|
40
|
-
}, 1250);
|
41
|
-
}
|
42
|
-
}
|
43
|
-
return false;
|
44
|
-
}}
|
45
|
-
>
|
46
|
-
<i class=${ApplicationIcons.copy}></i>
|
47
|
-
</button>`;
|
48
|
-
};
|
@@ -1,61 +0,0 @@
|
|
1
|
-
import { html } from "htm/preact";
|
2
|
-
|
3
|
-
export const DialogButton = ({ id, btnType, classes, style, children }) => {
|
4
|
-
return html`<button
|
5
|
-
type="button"
|
6
|
-
class="btn ${btnType ? btnType : ""} ${classes ? classes : ""}"
|
7
|
-
data-bs-toggle="modal"
|
8
|
-
data-bs-target="#${id}"
|
9
|
-
...${{ style }}
|
10
|
-
>
|
11
|
-
${children}
|
12
|
-
</button>`;
|
13
|
-
};
|
14
|
-
|
15
|
-
export const DialogAfterBody = ({
|
16
|
-
id,
|
17
|
-
title,
|
18
|
-
classes,
|
19
|
-
scrollable,
|
20
|
-
centered,
|
21
|
-
styles,
|
22
|
-
children,
|
23
|
-
}) => {
|
24
|
-
return html`
|
25
|
-
<div
|
26
|
-
class="modal fade ${classes}"
|
27
|
-
id="${id}"
|
28
|
-
tabindex="0"
|
29
|
-
aria-hidden="true"
|
30
|
-
styles=${{ ...styles }}
|
31
|
-
>
|
32
|
-
<div
|
33
|
-
class="modal-dialog modal-lg ${centered
|
34
|
-
? "modal-dialog-centered"
|
35
|
-
: ""} ${scrollable ? "modal-dialog-scrollable" : ""}"
|
36
|
-
>
|
37
|
-
<div class="modal-content">
|
38
|
-
<div class="modal-header">
|
39
|
-
<h5 class="modal-title">${title}</h5>
|
40
|
-
<button
|
41
|
-
type="button"
|
42
|
-
class="btn-close"
|
43
|
-
data-bs-dismiss="modal"
|
44
|
-
aria-label="Close"
|
45
|
-
></button>
|
46
|
-
</div>
|
47
|
-
<div class="modal-body">${children}</div>
|
48
|
-
<div class="modal-footer">
|
49
|
-
<button
|
50
|
-
type="button"
|
51
|
-
class="btn btn-outline-secondary"
|
52
|
-
data-bs-dismiss="modal"
|
53
|
-
>
|
54
|
-
Close
|
55
|
-
</button>
|
56
|
-
</div>
|
57
|
-
</div>
|
58
|
-
</div>
|
59
|
-
</div>
|
60
|
-
`;
|
61
|
-
};
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import { html } from "htm/preact";
|
2
|
-
import api from "../api/index";
|
3
|
-
import { FontSize } from "../appearance/Fonts.mjs";
|
4
|
-
|
5
|
-
export const DownloadButton = ({ label, fileName, fileContents }) => {
|
6
|
-
return html`<button
|
7
|
-
class="btn btn-outline-primary"
|
8
|
-
style=${{ fontSize: FontSize.small, marginTop: "3em" }}
|
9
|
-
onclick=${async () => {
|
10
|
-
await api.download_file(fileName, fileContents);
|
11
|
-
}}
|
12
|
-
>
|
13
|
-
${label}
|
14
|
-
</button>`;
|
15
|
-
};
|