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,92 @@
|
|
1
|
+
import { ApplicationIcons } from "../../appearance/icons";
|
2
|
+
import { ToolEvent } from "../../types/log";
|
3
|
+
import { formatDateTime } from "../../utils/format";
|
4
|
+
import { resolveToolInput } from "../chat/tools/tool";
|
5
|
+
import { ToolCallView } from "../chat/tools/ToolCallView";
|
6
|
+
import { ApprovalEventView } from "./ApprovalEventView";
|
7
|
+
import { EventPanel } from "./event/EventPanel";
|
8
|
+
import { TranscriptView } from "./TranscriptView";
|
9
|
+
import { TranscriptEventState } from "./types";
|
10
|
+
|
11
|
+
import { useMemo } from "react";
|
12
|
+
import styles from "./ToolEventView.module.css";
|
13
|
+
|
14
|
+
interface ToolEventViewProps {
|
15
|
+
id: string;
|
16
|
+
event: ToolEvent;
|
17
|
+
eventState: TranscriptEventState;
|
18
|
+
setEventState: (state: TranscriptEventState) => void;
|
19
|
+
depth: number;
|
20
|
+
className?: string | string[];
|
21
|
+
}
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Renders the ToolEventView component.
|
25
|
+
*/
|
26
|
+
export const ToolEventView: React.FC<ToolEventViewProps> = ({
|
27
|
+
id,
|
28
|
+
event,
|
29
|
+
eventState,
|
30
|
+
setEventState,
|
31
|
+
depth,
|
32
|
+
className,
|
33
|
+
}) => {
|
34
|
+
// Extract tool input
|
35
|
+
const { input, functionCall, highlightLanguage } = useMemo(
|
36
|
+
() => resolveToolInput(event.function, event.arguments),
|
37
|
+
[event.function, event.arguments],
|
38
|
+
);
|
39
|
+
|
40
|
+
// Find an approval if there is one
|
41
|
+
const approvalEvent = event.events.find((e) => {
|
42
|
+
return e.event === "approval";
|
43
|
+
});
|
44
|
+
|
45
|
+
const title = `Tool: ${event.view?.title || event.function}`;
|
46
|
+
return (
|
47
|
+
<EventPanel
|
48
|
+
id={id}
|
49
|
+
title={title}
|
50
|
+
className={className}
|
51
|
+
subTitle={formatDateTime(new Date(event.timestamp))}
|
52
|
+
icon={ApplicationIcons.solvers.use_tools}
|
53
|
+
selectedNav={eventState.selectedNav || ""}
|
54
|
+
setSelectedNav={(selectedNav) => {
|
55
|
+
setEventState({ ...eventState, selectedNav });
|
56
|
+
}}
|
57
|
+
collapsed={eventState.collapsed}
|
58
|
+
setCollapsed={(collapsed) => {
|
59
|
+
setEventState({ ...eventState, collapsed });
|
60
|
+
}}
|
61
|
+
>
|
62
|
+
<div data-name="Summary" className={styles.summary}>
|
63
|
+
<ToolCallView
|
64
|
+
functionCall={functionCall}
|
65
|
+
input={input}
|
66
|
+
highlightLanguage={highlightLanguage}
|
67
|
+
output={event.error?.message || event.result}
|
68
|
+
mode="compact"
|
69
|
+
view={event.view ? event.view : undefined}
|
70
|
+
/>
|
71
|
+
{approvalEvent ? (
|
72
|
+
<ApprovalEventView
|
73
|
+
event={approvalEvent}
|
74
|
+
className={styles.approval}
|
75
|
+
/>
|
76
|
+
) : (
|
77
|
+
""
|
78
|
+
)}
|
79
|
+
</div>
|
80
|
+
{event.events.length > 0 ? (
|
81
|
+
<TranscriptView
|
82
|
+
id={`${id}-subtask`}
|
83
|
+
data-name="Transcript"
|
84
|
+
events={event.events}
|
85
|
+
depth={depth + 1}
|
86
|
+
/>
|
87
|
+
) : (
|
88
|
+
""
|
89
|
+
)}
|
90
|
+
</EventPanel>
|
91
|
+
);
|
92
|
+
};
|
@@ -0,0 +1,49 @@
|
|
1
|
+
.darkenedBg {
|
2
|
+
background-color: var(--bs-light-bg-subtle);
|
3
|
+
}
|
4
|
+
|
5
|
+
.normalBg {
|
6
|
+
background-color: var(--bs-body-bg);
|
7
|
+
}
|
8
|
+
|
9
|
+
.node.first {
|
10
|
+
padding-top: 0.5em;
|
11
|
+
}
|
12
|
+
|
13
|
+
.node {
|
14
|
+
padding-top: 0;
|
15
|
+
padding-bottom: 0.5em;
|
16
|
+
}
|
17
|
+
|
18
|
+
.nodes {
|
19
|
+
width: 100%;
|
20
|
+
margin-top: 1em;
|
21
|
+
}
|
22
|
+
|
23
|
+
.transcriptComponent {
|
24
|
+
display: grid;
|
25
|
+
margin: 0.5em 0 0 0;
|
26
|
+
width: 100%;
|
27
|
+
}
|
28
|
+
|
29
|
+
.eventNode {
|
30
|
+
background-color: var(--bs-body-bg);
|
31
|
+
margin-bottom: 1.5em;
|
32
|
+
padding-bottom: 0.5em;
|
33
|
+
}
|
34
|
+
|
35
|
+
.eventNode.darkenBg {
|
36
|
+
background-color: var(--bs-light-bg-subtle);
|
37
|
+
}
|
38
|
+
|
39
|
+
.eventNode.lastNode {
|
40
|
+
margin-bottom: 0;
|
41
|
+
}
|
42
|
+
|
43
|
+
.eventNodeContainer {
|
44
|
+
padding-bottom: 0.5em;
|
45
|
+
}
|
46
|
+
|
47
|
+
.eventNodeContainer.noBottom {
|
48
|
+
padding-bottom: 0;
|
49
|
+
}
|
@@ -0,0 +1,449 @@
|
|
1
|
+
import React, { RefObject, useCallback, useState } from "react";
|
2
|
+
import { VirtualList } from "../../components/VirtualList";
|
3
|
+
import { Events } from "../../types/log";
|
4
|
+
import { ApprovalEventView } from "./ApprovalEventView";
|
5
|
+
import { ErrorEventView } from "./ErrorEventView";
|
6
|
+
import { InfoEventView } from "./InfoEventView";
|
7
|
+
import { InputEventView } from "./InputEventView";
|
8
|
+
import { LoggerEventView } from "./LoggerEventView";
|
9
|
+
import { ModelEventView } from "./ModelEventView";
|
10
|
+
import { SampleInitEventView } from "./SampleInitEventView";
|
11
|
+
import { SampleLimitEventView } from "./SampleLimitEventView";
|
12
|
+
import { ScoreEventView } from "./ScoreEventView";
|
13
|
+
import { StateEventView } from "./state/StateEventView";
|
14
|
+
import { StepEventView } from "./StepEventView";
|
15
|
+
import { SubtaskEventView } from "./SubtaskEventView";
|
16
|
+
import { ToolEventView } from "./ToolEventView";
|
17
|
+
import { EventNode, EventType, TranscriptEventState } from "./types";
|
18
|
+
|
19
|
+
import clsx from "clsx";
|
20
|
+
import styles from "./TranscriptView.module.css";
|
21
|
+
|
22
|
+
interface TranscriptViewProps {
|
23
|
+
id: string;
|
24
|
+
events: Events;
|
25
|
+
depth: number;
|
26
|
+
}
|
27
|
+
|
28
|
+
type TranscriptState = Record<string, TranscriptEventState>;
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Renders the TranscriptView component.
|
32
|
+
*/
|
33
|
+
export const TranscriptView: React.FC<TranscriptViewProps> = ({
|
34
|
+
id,
|
35
|
+
events,
|
36
|
+
depth,
|
37
|
+
}) => {
|
38
|
+
const [transcriptState, setTranscriptState] = useState<TranscriptState>({});
|
39
|
+
const onTranscriptState = useCallback(
|
40
|
+
(state: TranscriptState) => {
|
41
|
+
setTranscriptState(state);
|
42
|
+
},
|
43
|
+
[setTranscriptState],
|
44
|
+
);
|
45
|
+
|
46
|
+
// Normalize Events themselves
|
47
|
+
const resolvedEvents = fixupEventStream(events);
|
48
|
+
const eventNodes = treeifyEvents(
|
49
|
+
resolvedEvents,
|
50
|
+
depth !== undefined ? depth : 0,
|
51
|
+
);
|
52
|
+
return (
|
53
|
+
<TranscriptComponent
|
54
|
+
id={id}
|
55
|
+
eventNodes={eventNodes}
|
56
|
+
transcriptState={transcriptState}
|
57
|
+
setTranscriptState={onTranscriptState}
|
58
|
+
/>
|
59
|
+
);
|
60
|
+
};
|
61
|
+
|
62
|
+
interface TranscriptVirtualListProps {
|
63
|
+
id: string;
|
64
|
+
events: Events;
|
65
|
+
depth?: number;
|
66
|
+
scrollRef: RefObject<HTMLDivElement | null>;
|
67
|
+
}
|
68
|
+
|
69
|
+
/**
|
70
|
+
* Renders the Transcript Virtual List.
|
71
|
+
*/
|
72
|
+
export const TranscriptVirtualList: React.FC<TranscriptVirtualListProps> = (
|
73
|
+
props,
|
74
|
+
) => {
|
75
|
+
let { id, scrollRef, events, depth } = props;
|
76
|
+
|
77
|
+
// Normalize Events themselves
|
78
|
+
const resolvedEvents = fixupEventStream(events);
|
79
|
+
const eventNodes = treeifyEvents(resolvedEvents, depth || 0);
|
80
|
+
|
81
|
+
const [transcriptState, setTranscriptState] = useState({});
|
82
|
+
const onTranscriptState = useCallback(
|
83
|
+
(state: TranscriptEventState) => {
|
84
|
+
setTranscriptState(state);
|
85
|
+
},
|
86
|
+
[transcriptState, setTranscriptState],
|
87
|
+
);
|
88
|
+
|
89
|
+
return (
|
90
|
+
<TranscriptVirtualListComponent
|
91
|
+
id={id}
|
92
|
+
eventNodes={eventNodes}
|
93
|
+
scrollRef={scrollRef}
|
94
|
+
transcriptState={transcriptState}
|
95
|
+
setTranscriptState={onTranscriptState}
|
96
|
+
/>
|
97
|
+
);
|
98
|
+
};
|
99
|
+
|
100
|
+
interface TranscriptVirtualListComponentProps {
|
101
|
+
id: string;
|
102
|
+
eventNodes: EventNode[];
|
103
|
+
transcriptState: TranscriptState;
|
104
|
+
setTranscriptState: (state: TranscriptState) => void;
|
105
|
+
scrollRef?: RefObject<HTMLDivElement | null>;
|
106
|
+
}
|
107
|
+
|
108
|
+
/**
|
109
|
+
* Renders the Transcript component.
|
110
|
+
*/
|
111
|
+
export const TranscriptVirtualListComponent: React.FC<
|
112
|
+
TranscriptVirtualListComponentProps
|
113
|
+
> = ({ id, eventNodes, scrollRef, transcriptState, setTranscriptState }) => {
|
114
|
+
const setEventState = useCallback(
|
115
|
+
(eventId: string, state: TranscriptEventState) => {
|
116
|
+
setTranscriptState({ ...transcriptState, [eventId]: state });
|
117
|
+
},
|
118
|
+
[setTranscriptState],
|
119
|
+
);
|
120
|
+
|
121
|
+
const renderRow = (item: EventNode, index: number) => {
|
122
|
+
const bgClass = item.depth % 2 == 0 ? styles.darkenedBg : styles.normalBg;
|
123
|
+
const paddingClass = index === 0 ? styles.first : undefined;
|
124
|
+
|
125
|
+
const eventId = `${id}-event${index}`;
|
126
|
+
|
127
|
+
return (
|
128
|
+
<div key={eventId} className={clsx(styles.node, paddingClass)}>
|
129
|
+
<RenderedEventNode
|
130
|
+
id={eventId}
|
131
|
+
node={item}
|
132
|
+
className={clsx(bgClass)}
|
133
|
+
scrollRef={scrollRef}
|
134
|
+
eventState={transcriptState[eventId] || {}}
|
135
|
+
setEventState={(state) => setEventState(eventId, state)}
|
136
|
+
/>
|
137
|
+
</div>
|
138
|
+
);
|
139
|
+
};
|
140
|
+
|
141
|
+
return (
|
142
|
+
<VirtualList
|
143
|
+
data={eventNodes}
|
144
|
+
tabIndex={0}
|
145
|
+
renderRow={renderRow}
|
146
|
+
scrollRef={scrollRef}
|
147
|
+
className={styles.nodes}
|
148
|
+
/>
|
149
|
+
);
|
150
|
+
};
|
151
|
+
|
152
|
+
interface TranscriptComponentProps {
|
153
|
+
id: string;
|
154
|
+
transcriptState: TranscriptState;
|
155
|
+
setTranscriptState: (state: TranscriptState) => void;
|
156
|
+
eventNodes: EventNode[];
|
157
|
+
}
|
158
|
+
/**
|
159
|
+
* Renders the Transcript component.
|
160
|
+
*/
|
161
|
+
export const TranscriptComponent: React.FC<TranscriptComponentProps> = ({
|
162
|
+
id,
|
163
|
+
transcriptState,
|
164
|
+
setTranscriptState,
|
165
|
+
eventNodes,
|
166
|
+
}) => {
|
167
|
+
const rows = eventNodes.map((eventNode, index) => {
|
168
|
+
const clz = [styles.eventNode];
|
169
|
+
if (eventNode.depth % 2 == 0) {
|
170
|
+
clz.push(styles.darkenBg);
|
171
|
+
}
|
172
|
+
if (index === eventNodes.length - 1) {
|
173
|
+
clz.push(styles.lastNode);
|
174
|
+
}
|
175
|
+
|
176
|
+
const eventId = `${id}-event${index}`;
|
177
|
+
const setEventState = useCallback(
|
178
|
+
(state: TranscriptEventState) => {
|
179
|
+
setTranscriptState({ ...transcriptState, [eventId]: state });
|
180
|
+
},
|
181
|
+
[setTranscriptState, transcriptState],
|
182
|
+
);
|
183
|
+
|
184
|
+
const row = (
|
185
|
+
<div
|
186
|
+
key={eventId}
|
187
|
+
className={clsx(
|
188
|
+
styles.eventNodeContainer,
|
189
|
+
index === eventNodes.length - 1 ? styles.noBottom : undefined,
|
190
|
+
)}
|
191
|
+
>
|
192
|
+
<RenderedEventNode
|
193
|
+
id={eventId}
|
194
|
+
node={eventNode}
|
195
|
+
className={clsx(clz)}
|
196
|
+
eventState={transcriptState[eventId] || {}}
|
197
|
+
setEventState={setEventState}
|
198
|
+
/>
|
199
|
+
</div>
|
200
|
+
);
|
201
|
+
return row;
|
202
|
+
});
|
203
|
+
|
204
|
+
return (
|
205
|
+
<div
|
206
|
+
id={id}
|
207
|
+
className={clsx("text-size-small", styles.transcriptComponent)}
|
208
|
+
>
|
209
|
+
{rows}
|
210
|
+
</div>
|
211
|
+
);
|
212
|
+
};
|
213
|
+
|
214
|
+
interface RenderedEventNodeProps {
|
215
|
+
id: string;
|
216
|
+
node: EventNode;
|
217
|
+
scrollRef?: RefObject<HTMLDivElement | null>;
|
218
|
+
eventState: TranscriptEventState;
|
219
|
+
setEventState: (state: TranscriptEventState) => void;
|
220
|
+
className?: string | string[];
|
221
|
+
}
|
222
|
+
/**
|
223
|
+
* Renders the event based on its type.
|
224
|
+
*/
|
225
|
+
export const RenderedEventNode: React.FC<RenderedEventNodeProps> = ({
|
226
|
+
id,
|
227
|
+
node,
|
228
|
+
scrollRef,
|
229
|
+
eventState,
|
230
|
+
setEventState,
|
231
|
+
className,
|
232
|
+
}) => {
|
233
|
+
switch (node.event.event) {
|
234
|
+
case "sample_init":
|
235
|
+
return (
|
236
|
+
<SampleInitEventView
|
237
|
+
id={id}
|
238
|
+
event={node.event}
|
239
|
+
eventState={eventState}
|
240
|
+
setEventState={setEventState}
|
241
|
+
className={className}
|
242
|
+
/>
|
243
|
+
);
|
244
|
+
|
245
|
+
case "sample_limit":
|
246
|
+
return (
|
247
|
+
<SampleLimitEventView
|
248
|
+
id={id}
|
249
|
+
event={node.event}
|
250
|
+
eventState={eventState}
|
251
|
+
setEventState={setEventState}
|
252
|
+
className={className}
|
253
|
+
/>
|
254
|
+
);
|
255
|
+
|
256
|
+
case "info":
|
257
|
+
return (
|
258
|
+
<InfoEventView
|
259
|
+
id={id}
|
260
|
+
event={node.event}
|
261
|
+
eventState={eventState}
|
262
|
+
setEventState={setEventState}
|
263
|
+
className={className}
|
264
|
+
/>
|
265
|
+
);
|
266
|
+
|
267
|
+
case "logger":
|
268
|
+
return <LoggerEventView event={node.event} className={className} />;
|
269
|
+
|
270
|
+
case "model":
|
271
|
+
return (
|
272
|
+
<ModelEventView
|
273
|
+
id={id}
|
274
|
+
event={node.event}
|
275
|
+
eventState={eventState}
|
276
|
+
setEventState={setEventState}
|
277
|
+
className={className}
|
278
|
+
/>
|
279
|
+
);
|
280
|
+
|
281
|
+
case "score":
|
282
|
+
return (
|
283
|
+
<ScoreEventView
|
284
|
+
id={id}
|
285
|
+
event={node.event}
|
286
|
+
eventState={eventState}
|
287
|
+
setEventState={setEventState}
|
288
|
+
className={className}
|
289
|
+
/>
|
290
|
+
);
|
291
|
+
|
292
|
+
case "state":
|
293
|
+
return (
|
294
|
+
<StateEventView
|
295
|
+
id={id}
|
296
|
+
event={node.event}
|
297
|
+
eventState={eventState}
|
298
|
+
setEventState={setEventState}
|
299
|
+
className={className}
|
300
|
+
/>
|
301
|
+
);
|
302
|
+
|
303
|
+
case "step":
|
304
|
+
return (
|
305
|
+
<StepEventView
|
306
|
+
event={node.event}
|
307
|
+
eventState={eventState}
|
308
|
+
setEventState={setEventState}
|
309
|
+
children={node.children}
|
310
|
+
scrollRef={scrollRef}
|
311
|
+
className={className}
|
312
|
+
/>
|
313
|
+
);
|
314
|
+
|
315
|
+
case "store":
|
316
|
+
return (
|
317
|
+
<StateEventView
|
318
|
+
id={id}
|
319
|
+
event={node.event}
|
320
|
+
eventState={eventState}
|
321
|
+
setEventState={setEventState}
|
322
|
+
className={className}
|
323
|
+
isStore={true}
|
324
|
+
/>
|
325
|
+
);
|
326
|
+
|
327
|
+
case "subtask":
|
328
|
+
return (
|
329
|
+
<SubtaskEventView
|
330
|
+
id={id}
|
331
|
+
event={node.event}
|
332
|
+
eventState={eventState}
|
333
|
+
setEventState={setEventState}
|
334
|
+
className={className}
|
335
|
+
depth={node.depth}
|
336
|
+
/>
|
337
|
+
);
|
338
|
+
|
339
|
+
case "tool":
|
340
|
+
return (
|
341
|
+
<ToolEventView
|
342
|
+
id={id}
|
343
|
+
event={node.event}
|
344
|
+
eventState={eventState}
|
345
|
+
setEventState={setEventState}
|
346
|
+
className={className}
|
347
|
+
depth={node.depth}
|
348
|
+
/>
|
349
|
+
);
|
350
|
+
|
351
|
+
case "input":
|
352
|
+
return (
|
353
|
+
<InputEventView
|
354
|
+
id={id}
|
355
|
+
event={node.event}
|
356
|
+
eventState={eventState}
|
357
|
+
setEventState={setEventState}
|
358
|
+
className={className}
|
359
|
+
/>
|
360
|
+
);
|
361
|
+
|
362
|
+
case "error":
|
363
|
+
return (
|
364
|
+
<ErrorEventView
|
365
|
+
id={id}
|
366
|
+
event={node.event}
|
367
|
+
eventState={eventState}
|
368
|
+
setEventState={setEventState}
|
369
|
+
className={className}
|
370
|
+
/>
|
371
|
+
);
|
372
|
+
|
373
|
+
case "approval":
|
374
|
+
return <ApprovalEventView event={node.event} className={className} />;
|
375
|
+
|
376
|
+
default:
|
377
|
+
return null;
|
378
|
+
}
|
379
|
+
};
|
380
|
+
|
381
|
+
/**
|
382
|
+
* Normalizes event content
|
383
|
+
*/
|
384
|
+
const fixupEventStream = (events: Events) => {
|
385
|
+
const initEventIndex = events.findIndex((e) => {
|
386
|
+
return e.event === "sample_init";
|
387
|
+
});
|
388
|
+
const initEvent = events[initEventIndex];
|
389
|
+
|
390
|
+
const fixedUp = [...events];
|
391
|
+
if (initEvent) {
|
392
|
+
fixedUp.splice(initEventIndex, 0, {
|
393
|
+
timestamp: initEvent.timestamp,
|
394
|
+
event: "step",
|
395
|
+
action: "begin",
|
396
|
+
type: null,
|
397
|
+
name: "sample_init",
|
398
|
+
pending: false,
|
399
|
+
});
|
400
|
+
|
401
|
+
fixedUp.splice(initEventIndex + 2, 0, {
|
402
|
+
timestamp: initEvent.timestamp,
|
403
|
+
event: "step",
|
404
|
+
action: "end",
|
405
|
+
type: null,
|
406
|
+
name: "sample_init",
|
407
|
+
pending: false,
|
408
|
+
});
|
409
|
+
}
|
410
|
+
|
411
|
+
return fixedUp;
|
412
|
+
};
|
413
|
+
|
414
|
+
/**
|
415
|
+
* Gathers events into a hierarchy of EventNodes.
|
416
|
+
*/
|
417
|
+
function treeifyEvents(events: Events, depth: number): EventNode[] {
|
418
|
+
const rootNodes: EventNode[] = [];
|
419
|
+
const stack: EventNode[] = [];
|
420
|
+
|
421
|
+
const pushNode = (event: EventType): EventNode => {
|
422
|
+
const node = new EventNode(event, stack.length + depth);
|
423
|
+
if (stack.length > 0) {
|
424
|
+
const parentNode = stack[stack.length - 1];
|
425
|
+
parentNode.children.push(node);
|
426
|
+
} else {
|
427
|
+
rootNodes.push(node);
|
428
|
+
}
|
429
|
+
return node;
|
430
|
+
};
|
431
|
+
|
432
|
+
events.forEach((event) => {
|
433
|
+
if (event.event === "step" && event.action === "begin") {
|
434
|
+
// Starting a new step
|
435
|
+
const node = pushNode(event);
|
436
|
+
stack.push(node);
|
437
|
+
} else if (event.event === "step" && event.action === "end") {
|
438
|
+
// An ending step
|
439
|
+
if (stack.length > 0) {
|
440
|
+
stack.pop();
|
441
|
+
}
|
442
|
+
} else {
|
443
|
+
// An event
|
444
|
+
pushNode(event);
|
445
|
+
}
|
446
|
+
});
|
447
|
+
|
448
|
+
return rootNodes;
|
449
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import clsx from "clsx";
|
2
|
+
|
3
|
+
import styles from "./EventNav.module.css";
|
4
|
+
|
5
|
+
interface EventNavProps {
|
6
|
+
target: string;
|
7
|
+
title: string;
|
8
|
+
selectedNav: string;
|
9
|
+
setSelectedNav: (nav: string) => void;
|
10
|
+
}
|
11
|
+
/**
|
12
|
+
* Component to render a single navigation item.
|
13
|
+
*/
|
14
|
+
export const EventNav: React.FC<EventNavProps> = ({
|
15
|
+
target,
|
16
|
+
title,
|
17
|
+
selectedNav,
|
18
|
+
setSelectedNav,
|
19
|
+
}) => {
|
20
|
+
const active = target === selectedNav;
|
21
|
+
return (
|
22
|
+
<li className="nav-item">
|
23
|
+
<button
|
24
|
+
type="button"
|
25
|
+
role="tab"
|
26
|
+
aria-controls={target}
|
27
|
+
aria-selected={active}
|
28
|
+
className={clsx(
|
29
|
+
"nav-link",
|
30
|
+
active ? "active " : "",
|
31
|
+
"text-style-label",
|
32
|
+
"text-size-small",
|
33
|
+
styles.tab,
|
34
|
+
)}
|
35
|
+
onClick={() => {
|
36
|
+
setSelectedNav(target);
|
37
|
+
}}
|
38
|
+
>
|
39
|
+
{title}
|
40
|
+
</button>
|
41
|
+
</li>
|
42
|
+
);
|
43
|
+
};
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import clsx from "clsx";
|
2
|
+
import { EventNav } from "./EventNav";
|
3
|
+
|
4
|
+
import styles from "./EventNavs.module.css";
|
5
|
+
|
6
|
+
interface EventNavsProps {
|
7
|
+
navs: Array<{ id: string; title: string; target: string }>;
|
8
|
+
selectedNav: string;
|
9
|
+
setSelectedNav: (target: string) => void;
|
10
|
+
}
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Component to render navigation items.
|
14
|
+
*/
|
15
|
+
export const EventNavs: React.FC<EventNavsProps> = ({
|
16
|
+
navs,
|
17
|
+
selectedNav,
|
18
|
+
setSelectedNav,
|
19
|
+
}) => {
|
20
|
+
return (
|
21
|
+
<ul
|
22
|
+
className={clsx("nav", "nav-pills", styles.navs)}
|
23
|
+
role="tablist"
|
24
|
+
aria-orientation="horizontal"
|
25
|
+
>
|
26
|
+
{navs.map((nav) => {
|
27
|
+
return (
|
28
|
+
<EventNav
|
29
|
+
key={nav.title}
|
30
|
+
target={nav.target}
|
31
|
+
title={nav.title}
|
32
|
+
selectedNav={selectedNav}
|
33
|
+
setSelectedNav={setSelectedNav}
|
34
|
+
/>
|
35
|
+
);
|
36
|
+
})}
|
37
|
+
</ul>
|
38
|
+
);
|
39
|
+
};
|
@@ -0,0 +1,25 @@
|
|
1
|
+
.label {
|
2
|
+
margin-right: 0.2em;
|
3
|
+
justify-self: end;
|
4
|
+
}
|
5
|
+
|
6
|
+
.navs {
|
7
|
+
justify-self: end;
|
8
|
+
display: flex;
|
9
|
+
flex-direction: columns;
|
10
|
+
}
|
11
|
+
|
12
|
+
.card {
|
13
|
+
padding: 0.625rem;
|
14
|
+
border: solid 1px var(--bs-light-border-subtle);
|
15
|
+
border-radius: var(--bs-border-radius);
|
16
|
+
}
|
17
|
+
|
18
|
+
.cardContent {
|
19
|
+
padding: 0;
|
20
|
+
display: inherit;
|
21
|
+
}
|
22
|
+
|
23
|
+
.cardContent.hidden {
|
24
|
+
display: none;
|
25
|
+
}
|