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,190 +0,0 @@
|
|
1
|
-
import { html } from "htm/preact";
|
2
|
-
import { useCallback, useEffect, useRef } from "preact/hooks";
|
3
|
-
|
4
|
-
import { FontSize } from "../appearance/Fonts.mjs";
|
5
|
-
import { ProgressBar } from "./ProgressBar.mjs";
|
6
|
-
import { MessageBand } from "./MessageBand.mjs";
|
7
|
-
|
8
|
-
export const LargeModal = ({
|
9
|
-
id,
|
10
|
-
title,
|
11
|
-
detail,
|
12
|
-
detailTools,
|
13
|
-
footer,
|
14
|
-
onkeyup,
|
15
|
-
visible,
|
16
|
-
onHide,
|
17
|
-
showProgress,
|
18
|
-
children,
|
19
|
-
initialScrollPositionRef,
|
20
|
-
setInitialScrollPosition,
|
21
|
-
warning,
|
22
|
-
warningHidden,
|
23
|
-
setWarningHidden,
|
24
|
-
scrollRef,
|
25
|
-
}) => {
|
26
|
-
// The footer
|
27
|
-
const modalFooter = footer
|
28
|
-
? html`<div class="modal-footer">${footer}</div>`
|
29
|
-
: "";
|
30
|
-
|
31
|
-
// Support restoring the scroll position
|
32
|
-
// but only do this for the first time that the children are set
|
33
|
-
scrollRef = scrollRef || useRef(/** @type {HTMLElement|null} */ (null));
|
34
|
-
useEffect(() => {
|
35
|
-
if (scrollRef.current) {
|
36
|
-
setTimeout(() => {
|
37
|
-
if (scrollRef.current.scrollTop !== initialScrollPositionRef?.current) {
|
38
|
-
scrollRef.current.scrollTop = initialScrollPositionRef?.current;
|
39
|
-
}
|
40
|
-
}, 0);
|
41
|
-
}
|
42
|
-
}, []);
|
43
|
-
|
44
|
-
const onScroll = useCallback(
|
45
|
-
(e) => {
|
46
|
-
setInitialScrollPosition(e.srcElement.scrollTop);
|
47
|
-
},
|
48
|
-
[setInitialScrollPosition],
|
49
|
-
);
|
50
|
-
|
51
|
-
// Capture header elements
|
52
|
-
const headerEls = [];
|
53
|
-
// The title
|
54
|
-
headerEls.push(
|
55
|
-
html`<div
|
56
|
-
class="modal-title"
|
57
|
-
style=${{ fontSize: FontSize.smaller, flex: "1 1 auto" }}
|
58
|
-
>
|
59
|
-
${title || ""}
|
60
|
-
</div>`,
|
61
|
-
);
|
62
|
-
|
63
|
-
// A centered text element with tools to the left and right
|
64
|
-
if (detail) {
|
65
|
-
headerEls.push(
|
66
|
-
html`<div
|
67
|
-
style=${{
|
68
|
-
marginLeft: "auto",
|
69
|
-
marginRight: "auto",
|
70
|
-
display: "flex",
|
71
|
-
flex: "1 1 auto",
|
72
|
-
justifyContent: "center",
|
73
|
-
}}
|
74
|
-
>
|
75
|
-
${detailTools.left
|
76
|
-
? detailTools.left.map((tool) => {
|
77
|
-
return html`<${TitleTool} ...${tool} />`;
|
78
|
-
})
|
79
|
-
: ""}
|
80
|
-
<div
|
81
|
-
style=${{
|
82
|
-
fontSize: FontSize.smaller,
|
83
|
-
display: "flex",
|
84
|
-
alignItems: "center",
|
85
|
-
}}
|
86
|
-
>
|
87
|
-
<div>${detail}</div>
|
88
|
-
</div>
|
89
|
-
${detailTools.right
|
90
|
-
? detailTools.right.map((tool) => {
|
91
|
-
return html`<${TitleTool} ...${tool} />`;
|
92
|
-
})
|
93
|
-
: ""}
|
94
|
-
</div>`,
|
95
|
-
);
|
96
|
-
}
|
97
|
-
|
98
|
-
// The close 'x'
|
99
|
-
headerEls.push(html`<button
|
100
|
-
type="button"
|
101
|
-
class="btn btn-close-large-dialog"
|
102
|
-
onclick=${() => {
|
103
|
-
onHide();
|
104
|
-
}}
|
105
|
-
aria-label="Close"
|
106
|
-
style=${{
|
107
|
-
borderWidth: "0px",
|
108
|
-
fontSize: FontSize.larger,
|
109
|
-
fontWeight: "300",
|
110
|
-
padding: "0em 0.5em",
|
111
|
-
flex: 1,
|
112
|
-
textAlign: "right",
|
113
|
-
}}
|
114
|
-
>
|
115
|
-
<${HtmlEntity}>×</${HtmlEntity}>
|
116
|
-
</button>`);
|
117
|
-
|
118
|
-
return html`<div
|
119
|
-
id=${id}
|
120
|
-
class="modal"
|
121
|
-
tabindex="0"
|
122
|
-
role="dialog"
|
123
|
-
onkeyup=${onkeyup}
|
124
|
-
style=${{
|
125
|
-
borderRadius: "var(--bs-border-radius)",
|
126
|
-
display: visible ? "block" : "none",
|
127
|
-
}}
|
128
|
-
tabindex=${visible ? 0 : undefined}
|
129
|
-
>
|
130
|
-
<div
|
131
|
-
class="modal-dialog modal-dialog-scrollable"
|
132
|
-
style=${{
|
133
|
-
maxWidth: "100%",
|
134
|
-
marginLeft: "var(--bs-modal-margin)",
|
135
|
-
marginRight: "var(--bs-modal-margin)",
|
136
|
-
}}
|
137
|
-
role="document"
|
138
|
-
>
|
139
|
-
<div class="modal-content" style=${{ height: "100%" }}>
|
140
|
-
<div
|
141
|
-
class="modal-header"
|
142
|
-
style=${{ padding: "0 0 0 1em", display: "flex" }}
|
143
|
-
>
|
144
|
-
${headerEls}
|
145
|
-
</div>
|
146
|
-
<${ProgressBar}
|
147
|
-
animating=${showProgress}
|
148
|
-
containerStyle=${{
|
149
|
-
marginBottom: "-2px",
|
150
|
-
backgroundColor: "var(--bs-body-bg)",
|
151
|
-
}}
|
152
|
-
/>
|
153
|
-
|
154
|
-
${warning
|
155
|
-
? html`<${MessageBand}
|
156
|
-
message=${warning}
|
157
|
-
hidden=${warningHidden}
|
158
|
-
setHidden=${setWarningHidden}
|
159
|
-
type="warning"
|
160
|
-
/>`
|
161
|
-
: ""}
|
162
|
-
<div class="modal-body" ref=${scrollRef} onscroll=${onScroll}>
|
163
|
-
${children}
|
164
|
-
</div>
|
165
|
-
${modalFooter}
|
166
|
-
</div>
|
167
|
-
</div>
|
168
|
-
</div>`;
|
169
|
-
};
|
170
|
-
|
171
|
-
const HtmlEntity = ({ children }) =>
|
172
|
-
html`<span dangerouslySetInnerHTML=${{ __html: children }} />`;
|
173
|
-
|
174
|
-
const TitleTool = ({ label, icon, enabled, onclick }) => {
|
175
|
-
return html`<button
|
176
|
-
type="button"
|
177
|
-
class="btn btn-outline"
|
178
|
-
aria-label=${label}
|
179
|
-
onclick=${onclick}
|
180
|
-
disabled=${!enabled}
|
181
|
-
style=${{
|
182
|
-
paddingTop: 0,
|
183
|
-
paddingBottom: 0,
|
184
|
-
border: "none",
|
185
|
-
fontSize: FontSize.small,
|
186
|
-
}}
|
187
|
-
>
|
188
|
-
<i class="${icon}" />
|
189
|
-
</button>`;
|
190
|
-
};
|
@@ -1,217 +0,0 @@
|
|
1
|
-
import { html } from "htm/preact";
|
2
|
-
import { useState, useCallback, useEffect } from "preact/hooks";
|
3
|
-
import { ApplicationIcons } from "../appearance/Icons.mjs";
|
4
|
-
|
5
|
-
/**
|
6
|
-
* @typedef {Object} Slide
|
7
|
-
* @property {string} label - The label for the slide.
|
8
|
-
* @property {() => import("preact").JSX.Element} render - A function that returns another function to render the slide as a JSX element.
|
9
|
-
*/
|
10
|
-
|
11
|
-
/**
|
12
|
-
* LightboxCarousel component provides a carousel with lightbox functionality.
|
13
|
-
* @param {Object} props - Component properties.
|
14
|
-
* @property {Array<Slide>} props.slides - Array of slide render functions.
|
15
|
-
* @returns {import("preact").JSX.Element} LightboxCarousel component.
|
16
|
-
*/
|
17
|
-
export const LightboxCarousel = ({ slides }) => {
|
18
|
-
const [isOpen, setIsOpen] = useState(false);
|
19
|
-
const [showOverlay, setShowOverlay] = useState(false);
|
20
|
-
const [currentIndex, setCurrentIndex] = useState(0);
|
21
|
-
|
22
|
-
const openLightbox = (index) => {
|
23
|
-
setCurrentIndex(index);
|
24
|
-
setShowOverlay(true);
|
25
|
-
|
26
|
-
// Slight delay before setting isOpen so the fade-in starts from opacity: 0
|
27
|
-
setTimeout(() => setIsOpen(true), 10);
|
28
|
-
};
|
29
|
-
|
30
|
-
const closeLightbox = () => {
|
31
|
-
setIsOpen(false);
|
32
|
-
};
|
33
|
-
|
34
|
-
// Remove the overlay from the DOM after fade-out completes
|
35
|
-
useEffect(() => {
|
36
|
-
if (!isOpen && showOverlay) {
|
37
|
-
const timer = setTimeout(() => {
|
38
|
-
setShowOverlay(false);
|
39
|
-
}, 300); // match your transition duration
|
40
|
-
return () => clearTimeout(timer);
|
41
|
-
}
|
42
|
-
}, [isOpen, showOverlay]);
|
43
|
-
|
44
|
-
const showNext = useCallback(() => {
|
45
|
-
setCurrentIndex((prev) => {
|
46
|
-
return (prev + 1) % slides.length;
|
47
|
-
});
|
48
|
-
}, [slides]);
|
49
|
-
|
50
|
-
const showPrev = useCallback(() => {
|
51
|
-
setCurrentIndex((prev) => (prev - 1 + slides.length) % slides.length);
|
52
|
-
}, [slides]);
|
53
|
-
|
54
|
-
// Keyboard Navigation
|
55
|
-
useEffect(() => {
|
56
|
-
if (!isOpen) return;
|
57
|
-
const handleKeyUp = (e) => {
|
58
|
-
if (e.key === "Escape") {
|
59
|
-
closeLightbox();
|
60
|
-
} else if (e.key === "ArrowRight") {
|
61
|
-
showNext();
|
62
|
-
} else if (e.key === "ArrowLeft") {
|
63
|
-
showPrev();
|
64
|
-
}
|
65
|
-
e.preventDefault();
|
66
|
-
e.stopPropagation();
|
67
|
-
};
|
68
|
-
window.addEventListener("keyup", handleKeyUp, true);
|
69
|
-
return () => window.removeEventListener("keyup", handleKeyUp);
|
70
|
-
}, [isOpen, showNext, showPrev]);
|
71
|
-
|
72
|
-
// Common button style
|
73
|
-
const buttonStyle = {
|
74
|
-
position: "absolute",
|
75
|
-
top: "50%",
|
76
|
-
transform: "translateY(-50%)",
|
77
|
-
background: "none",
|
78
|
-
color: "#fff",
|
79
|
-
border: "none",
|
80
|
-
padding: "0.5em",
|
81
|
-
fontSize: "3em",
|
82
|
-
cursor: "pointer",
|
83
|
-
zIndex: "9999",
|
84
|
-
};
|
85
|
-
|
86
|
-
const prevButtonStyle = {
|
87
|
-
...buttonStyle,
|
88
|
-
left: "10px",
|
89
|
-
};
|
90
|
-
|
91
|
-
const nextButtonStyle = {
|
92
|
-
...buttonStyle,
|
93
|
-
right: "10px",
|
94
|
-
};
|
95
|
-
|
96
|
-
// Overlay style (fixed to fill the screen, flex for centering)
|
97
|
-
const overlayStyle = {
|
98
|
-
position: "fixed",
|
99
|
-
top: 0,
|
100
|
-
left: 0,
|
101
|
-
width: "100vw",
|
102
|
-
height: "100vh",
|
103
|
-
background: "rgba(0,0,0,0.8)",
|
104
|
-
display: "flex",
|
105
|
-
alignItems: "center",
|
106
|
-
justifyContent: "center",
|
107
|
-
opacity: isOpen ? "1" : "0",
|
108
|
-
visibility: isOpen ? "visible" : "hidden",
|
109
|
-
transition: "opacity 0.3s ease, visibility 0.3s ease",
|
110
|
-
zIndex: 9998,
|
111
|
-
};
|
112
|
-
|
113
|
-
// Close button style
|
114
|
-
const closeButtonWrapperStyle = {
|
115
|
-
position: "absolute",
|
116
|
-
top: "10px",
|
117
|
-
right: "10px",
|
118
|
-
};
|
119
|
-
|
120
|
-
const closeButtonStyle = {
|
121
|
-
border: "none",
|
122
|
-
background: "none",
|
123
|
-
color: "#fff",
|
124
|
-
fontSize: "3em",
|
125
|
-
fontWeight: "500",
|
126
|
-
cursor: "pointer",
|
127
|
-
paddingLeft: "1em",
|
128
|
-
paddingBottom: "1em",
|
129
|
-
zIndex: "10000",
|
130
|
-
};
|
131
|
-
|
132
|
-
// Lightbox content container style
|
133
|
-
const contentStyle = {
|
134
|
-
maxWidth: "90%",
|
135
|
-
maxHeight: "90%",
|
136
|
-
display: "flex",
|
137
|
-
alignItems: "center",
|
138
|
-
justifyContent: "center",
|
139
|
-
position: "relative",
|
140
|
-
// fade in/out
|
141
|
-
opacity: isOpen ? "1" : "0",
|
142
|
-
visibility: isOpen ? "visible" : "hidden",
|
143
|
-
transition: "opacity 0.3s ease, visibility 0.3s ease",
|
144
|
-
zIndex: 9999,
|
145
|
-
};
|
146
|
-
|
147
|
-
return html`
|
148
|
-
<div className="lightbox-carousel-container">
|
149
|
-
<!-- Thumbnails -->
|
150
|
-
<div
|
151
|
-
className="carousel-thumbs"
|
152
|
-
style=${{
|
153
|
-
display: "grid",
|
154
|
-
gridTemplateColumns: "auto auto auto auto",
|
155
|
-
}}
|
156
|
-
>
|
157
|
-
${slides.map((slide, index) => {
|
158
|
-
return html`
|
159
|
-
<div
|
160
|
-
key=${index}
|
161
|
-
className="carousel-thumb"
|
162
|
-
onClick=${() => openLightbox(index)}
|
163
|
-
style=${{
|
164
|
-
background: "black",
|
165
|
-
color: "white",
|
166
|
-
padding: "4em 0",
|
167
|
-
border: "0",
|
168
|
-
margin: "5px",
|
169
|
-
cursor: "pointer",
|
170
|
-
textAlign: "center",
|
171
|
-
}}
|
172
|
-
>
|
173
|
-
<div>${slide.label}</div>
|
174
|
-
<div>
|
175
|
-
<i
|
176
|
-
class=${ApplicationIcons.play}
|
177
|
-
style=${{ fontSize: "4em" }}
|
178
|
-
></i>
|
179
|
-
</div>
|
180
|
-
</div>
|
181
|
-
`;
|
182
|
-
})}
|
183
|
-
</div>
|
184
|
-
|
185
|
-
<!-- Lightbox Overlay -->
|
186
|
-
${showOverlay &&
|
187
|
-
html`
|
188
|
-
<div className="lightbox-overlay" style=${overlayStyle}>
|
189
|
-
<div style=${closeButtonWrapperStyle}>
|
190
|
-
<button style=${closeButtonStyle} onClick=${closeLightbox}>
|
191
|
-
<i class=${ApplicationIcons.close}></i>
|
192
|
-
</button>
|
193
|
-
</div>
|
194
|
-
|
195
|
-
${slides.length > 1
|
196
|
-
? html` <button style=${prevButtonStyle} onClick=${showPrev}>
|
197
|
-
<i class=${ApplicationIcons.previous}></i>
|
198
|
-
</button>`
|
199
|
-
: ""}
|
200
|
-
${slides.length > 1
|
201
|
-
? html` <button style=${nextButtonStyle} onClick=${showNext}>
|
202
|
-
<i class=${ApplicationIcons.next}></i>
|
203
|
-
</button>`
|
204
|
-
: ""}
|
205
|
-
|
206
|
-
<div
|
207
|
-
key=${`carousel-slide-${currentIndex}`}
|
208
|
-
className="lightbox-content"
|
209
|
-
style=${contentStyle}
|
210
|
-
>
|
211
|
-
${slides[currentIndex].render()}
|
212
|
-
</div>
|
213
|
-
</div>
|
214
|
-
`}
|
215
|
-
</div>
|
216
|
-
`;
|
217
|
-
};
|
@@ -1,118 +0,0 @@
|
|
1
|
-
import markdownit from "markdown-it";
|
2
|
-
import { html } from "htm/preact";
|
3
|
-
|
4
|
-
export const MarkdownDiv = (props) => {
|
5
|
-
const { markdown, style, contentRef } = props;
|
6
|
-
|
7
|
-
// Escape all tags
|
8
|
-
const escaped = markdown ? escape(markdown) : "";
|
9
|
-
|
10
|
-
// Pre-render any text that isn't handled by markdown
|
11
|
-
const preRendered = preRenderText(escaped);
|
12
|
-
|
13
|
-
const protectedText = protectMarkdown(preRendered);
|
14
|
-
|
15
|
-
let renderedHtml = protectedText;
|
16
|
-
try {
|
17
|
-
const md = markdownit({
|
18
|
-
breaks: true,
|
19
|
-
html: true,
|
20
|
-
});
|
21
|
-
renderedHtml = md.render(protectedText);
|
22
|
-
} catch (ex) {
|
23
|
-
console.log("Unable to markdown render content");
|
24
|
-
console.error(ex);
|
25
|
-
}
|
26
|
-
|
27
|
-
const unescaped = unprotectMarkdown(renderedHtml);
|
28
|
-
|
29
|
-
// For `code` tags, reverse the escaping if we can
|
30
|
-
const withCode = unescapeCodeHtmlEntities(unescaped);
|
31
|
-
|
32
|
-
// Return the rendered markdown
|
33
|
-
const markup = { __html: withCode };
|
34
|
-
|
35
|
-
return html`<div
|
36
|
-
ref=${contentRef}
|
37
|
-
dangerouslySetInnerHTML=${markup}
|
38
|
-
style=${style}
|
39
|
-
class="${props.class ? `${props.class} ` : ""}markdown-content"
|
40
|
-
/>`;
|
41
|
-
};
|
42
|
-
|
43
|
-
const kLetterListPattern = /^([a-zA-Z][).]\s.*?)$/gm;
|
44
|
-
const kCommonmarkReferenceLinkPattern = /\[([^\]]*)\]: (?!http)(.*)/g;
|
45
|
-
|
46
|
-
const preRenderText = (txt) => {
|
47
|
-
// eslint-disable-next-line no-misleading-character-class
|
48
|
-
txt = txt.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/, "");
|
49
|
-
|
50
|
-
// Special handling for ordered lists that look like
|
51
|
-
// multiple choice (e.g. a), b), c), d) etc..)
|
52
|
-
return txt.replaceAll(
|
53
|
-
kLetterListPattern,
|
54
|
-
"<p style='margin-bottom: 0.2em;'>$1</p>",
|
55
|
-
);
|
56
|
-
};
|
57
|
-
|
58
|
-
const protectMarkdown = (txt) => {
|
59
|
-
// Special handling for commonmark like reference links which might
|
60
|
-
// look like:
|
61
|
-
// [alias]: http://www.google.com
|
62
|
-
// but text like:
|
63
|
-
// [expert]: answer
|
64
|
-
// Also fools this
|
65
|
-
return txt.replaceAll(
|
66
|
-
kCommonmarkReferenceLinkPattern,
|
67
|
-
"(open:767A125E)$1(close:767A125E) $2 ",
|
68
|
-
);
|
69
|
-
};
|
70
|
-
|
71
|
-
const unprotectMarkdown = (txt) => {
|
72
|
-
txt = txt.replaceAll("(open:767A125E)", "[");
|
73
|
-
txt = txt.replaceAll("(close:767A125E)", "]");
|
74
|
-
return txt;
|
75
|
-
};
|
76
|
-
|
77
|
-
const escape = (content) => {
|
78
|
-
return content.replace(/[<>&'"]/g, function (c) {
|
79
|
-
switch (c) {
|
80
|
-
case "<":
|
81
|
-
return "<";
|
82
|
-
case ">":
|
83
|
-
return ">";
|
84
|
-
case "&":
|
85
|
-
return "&";
|
86
|
-
case "'":
|
87
|
-
return "'";
|
88
|
-
case '"':
|
89
|
-
return """;
|
90
|
-
}
|
91
|
-
});
|
92
|
-
};
|
93
|
-
|
94
|
-
function unescapeCodeHtmlEntities(str) {
|
95
|
-
const htmlEntities = {
|
96
|
-
"<": "<",
|
97
|
-
">": ">",
|
98
|
-
"&": "&",
|
99
|
-
"\": "\\",
|
100
|
-
""": '"',
|
101
|
-
};
|
102
|
-
|
103
|
-
return str.replace(
|
104
|
-
/(<code[^>]*>)([\s\S]*?)(<\/code>)/gi,
|
105
|
-
function (match, starttag, content, endtag) {
|
106
|
-
return (
|
107
|
-
starttag +
|
108
|
-
content.replace(
|
109
|
-
/&(?:amp|lt|gt|quot|#39|#x2F|#x5C|#96);/g,
|
110
|
-
function (entity) {
|
111
|
-
return htmlEntities[entity] || entity;
|
112
|
-
},
|
113
|
-
) +
|
114
|
-
endtag
|
115
|
-
);
|
116
|
-
},
|
117
|
-
);
|
118
|
-
}
|
@@ -1,48 +0,0 @@
|
|
1
|
-
import { html } from "htm/preact";
|
2
|
-
|
3
|
-
import { FontSize } from "../appearance/Fonts.mjs";
|
4
|
-
|
5
|
-
import { ApplicationIcons } from "../appearance/Icons.mjs";
|
6
|
-
|
7
|
-
export const MessageBand = ({ message, hidden, setHidden, type }) => {
|
8
|
-
const bgColor =
|
9
|
-
type === "info" ? "var(--bs-light)" : "var(--bs-" + type + "-bg-subtle)";
|
10
|
-
const color =
|
11
|
-
type === "info" ? undefined : "var(--bs-" + type + "-text-emphasis)";
|
12
|
-
|
13
|
-
return html`
|
14
|
-
<div
|
15
|
-
style=${{
|
16
|
-
gridTemplateColumns: "max-content auto max-content",
|
17
|
-
alignItems: "center",
|
18
|
-
columnGap: "0.5em",
|
19
|
-
fontSize: FontSize.small,
|
20
|
-
color: color,
|
21
|
-
background: bgColor,
|
22
|
-
borderBottom: "solid 1px var(--bs-light-border-subtle)",
|
23
|
-
padding: "0.3em 1em",
|
24
|
-
display: hidden ? "none" : "grid",
|
25
|
-
}}
|
26
|
-
>
|
27
|
-
<i class=${ApplicationIcons.logging[type]} />
|
28
|
-
${message}
|
29
|
-
<button
|
30
|
-
title="Close"
|
31
|
-
style=${{
|
32
|
-
fontSize: FontSize["title-secondary"],
|
33
|
-
margin: "0",
|
34
|
-
padding: "0",
|
35
|
-
color: color,
|
36
|
-
height: FontSize["title-secondary"],
|
37
|
-
lineHeight: FontSize["title-secondary"],
|
38
|
-
}}
|
39
|
-
class="btn"
|
40
|
-
onclick=${() => {
|
41
|
-
setHidden(true);
|
42
|
-
}}
|
43
|
-
>
|
44
|
-
<i class=${ApplicationIcons.close}></i>
|
45
|
-
</button>
|
46
|
-
</div>
|
47
|
-
`;
|
48
|
-
};
|
@@ -1,111 +0,0 @@
|
|
1
|
-
import { html } from "htm/preact";
|
2
|
-
import { MarkdownDiv } from "./MarkdownDiv.mjs";
|
3
|
-
import { ToolOutput } from "./Tools.mjs";
|
4
|
-
|
5
|
-
/**
|
6
|
-
* Renders message content based on its type.
|
7
|
-
* Supports rendering strings, images, and tools using specific renderers.
|
8
|
-
*
|
9
|
-
* @param {Object} props - The props object.
|
10
|
-
* @param {string|string[]| (import("../types/log").ContentText | import("../types/log").ContentImage | import("../types/log").ContentAudio | import("../types/log").ContentVideo | import("../Types.mjs").ContentTool)[]} props.contents - The content or array of contents to render.
|
11
|
-
* @returns {import("preact").JSX.Element | import("preact").JSX.Element[]} The component.
|
12
|
-
*/
|
13
|
-
export const MessageContent = ({ contents }) => {
|
14
|
-
if (Array.isArray(contents)) {
|
15
|
-
return contents.map((content, index) => {
|
16
|
-
if (typeof content === "string") {
|
17
|
-
return messageRenderers["text"].render({
|
18
|
-
text: content,
|
19
|
-
index: index === contents.length - 1,
|
20
|
-
});
|
21
|
-
} else {
|
22
|
-
if (content) {
|
23
|
-
const renderer = messageRenderers[content.type];
|
24
|
-
if (renderer) {
|
25
|
-
return renderer.render(content, index === contents.length - 1);
|
26
|
-
} else {
|
27
|
-
console.error(`Unknown message content type '${content.type}'`);
|
28
|
-
}
|
29
|
-
}
|
30
|
-
}
|
31
|
-
});
|
32
|
-
} else {
|
33
|
-
// This is a simple string
|
34
|
-
return messageRenderers["text"].render({ text: contents });
|
35
|
-
}
|
36
|
-
};
|
37
|
-
|
38
|
-
// TODO: We should setting overflow scrolling here
|
39
|
-
// don't break-all
|
40
|
-
const messageRenderers = {
|
41
|
-
text: {
|
42
|
-
render: (content, isLast) => {
|
43
|
-
return html`<${MarkdownDiv}
|
44
|
-
markdown=${content.text}
|
45
|
-
class=${isLast ? "no-last-para-padding" : ""}
|
46
|
-
/>`;
|
47
|
-
},
|
48
|
-
},
|
49
|
-
image: {
|
50
|
-
render: (content) => {
|
51
|
-
if (content.image.startsWith("data:")) {
|
52
|
-
return html`<img
|
53
|
-
src="${content.image}"
|
54
|
-
style=${{
|
55
|
-
maxWidth: "800px",
|
56
|
-
border: "solid var(--bs-border-color) 1px",
|
57
|
-
}}
|
58
|
-
/>`;
|
59
|
-
} else {
|
60
|
-
return html`<code>${content.image}</code>`;
|
61
|
-
}
|
62
|
-
},
|
63
|
-
},
|
64
|
-
audio: {
|
65
|
-
render: (content) => {
|
66
|
-
return html` <audio controls>
|
67
|
-
<source
|
68
|
-
src=${content.audio}
|
69
|
-
type=${mimeTypeForFormat(content.format)}
|
70
|
-
/>
|
71
|
-
</audio>`;
|
72
|
-
},
|
73
|
-
},
|
74
|
-
video: {
|
75
|
-
render: (content) => {
|
76
|
-
return html` <video width="500" height="375" controls>
|
77
|
-
<source
|
78
|
-
src=${content.video}
|
79
|
-
type=${mimeTypeForFormat(content.format)}
|
80
|
-
/>
|
81
|
-
</video>`;
|
82
|
-
},
|
83
|
-
},
|
84
|
-
tool: {
|
85
|
-
render: (content) => {
|
86
|
-
return html`<${ToolOutput} output=${content.content} />`;
|
87
|
-
},
|
88
|
-
},
|
89
|
-
};
|
90
|
-
|
91
|
-
/**
|
92
|
-
* Renders message content based on its type.
|
93
|
-
* Supports rendering strings, images, and tools using specific renderers.
|
94
|
-
*
|
95
|
-
* @param {import("../types/log").Format | import("../types/log").Format1 } format - The format
|
96
|
-
* @returns {string} - The mime type.
|
97
|
-
*/
|
98
|
-
const mimeTypeForFormat = (format) => {
|
99
|
-
switch (format) {
|
100
|
-
case "mov":
|
101
|
-
return "video/quicktime";
|
102
|
-
case "wav":
|
103
|
-
return "audio/wav";
|
104
|
-
case "mp3":
|
105
|
-
return "audio/mpeg";
|
106
|
-
case "mp4":
|
107
|
-
return "video/mp4";
|
108
|
-
case "mpeg":
|
109
|
-
return "video/mpeg";
|
110
|
-
}
|
111
|
-
};
|