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,260 +0,0 @@
|
|
1
|
-
// @ts-check
|
2
|
-
import { html } from "htm/preact";
|
3
|
-
|
4
|
-
/**
|
5
|
-
* Converts an array or a single value to a comma-separated string.
|
6
|
-
*
|
7
|
-
* @param {(string|string[])} val - The value to be converted. Can be a string or an array of strings.
|
8
|
-
* @returns {string} - A comma-separated string.
|
9
|
-
*/
|
10
|
-
export const arrayToString = (val) => {
|
11
|
-
val = Array.isArray(val) ? val : [val];
|
12
|
-
return val.join(", ");
|
13
|
-
};
|
14
|
-
|
15
|
-
/**
|
16
|
-
* Gets a string for a sample input.
|
17
|
-
*
|
18
|
-
* @param {(string|Array.<import("../types/log").ChatMessageUser | import("../types/log").ChatMessageSystem | import("../types/log").ChatMessageAssistant | import("../types/log").ChatMessageTool>)} input - The input to process. Can be a string or an array of objects containing a content string.
|
19
|
-
* @returns {(string[])} - The processed string or an array of strings.
|
20
|
-
*/
|
21
|
-
export const inputString = (input) => {
|
22
|
-
if (typeof input === "string") {
|
23
|
-
return [input];
|
24
|
-
} else {
|
25
|
-
return input.map((inp) => {
|
26
|
-
if (typeof inp === "string") {
|
27
|
-
return inp;
|
28
|
-
} else {
|
29
|
-
const content = inp.content;
|
30
|
-
if (typeof content === "string") {
|
31
|
-
return content;
|
32
|
-
} else {
|
33
|
-
const result = content.map((con) => {
|
34
|
-
if (con.type === "text") {
|
35
|
-
return con.text;
|
36
|
-
} else {
|
37
|
-
return "";
|
38
|
-
}
|
39
|
-
});
|
40
|
-
return result.join("\n");
|
41
|
-
}
|
42
|
-
}
|
43
|
-
});
|
44
|
-
}
|
45
|
-
};
|
46
|
-
|
47
|
-
/**
|
48
|
-
* Formats dataset information into a string.
|
49
|
-
*
|
50
|
-
* @param {string} name - The name of the dataset.
|
51
|
-
* @param {number} samples - The total number of samples in the dataset.
|
52
|
-
* @param {number} epochs - The number of epochs.
|
53
|
-
* @returns {string} - A formatted string describing the dataset.
|
54
|
-
*/
|
55
|
-
export const formatDataset = (name, samples, epochs) => {
|
56
|
-
const perEpochSamples = epochs > 0 ? samples / epochs : samples;
|
57
|
-
return `${name ? "— " : ""}${perEpochSamples + " "}${epochs > 1 ? `x ${epochs} ` : ""}${samples === 1 ? "sample" : "samples"}`;
|
58
|
-
};
|
59
|
-
|
60
|
-
/**
|
61
|
-
* Extracts and trims the user prompt from a sample input.
|
62
|
-
*
|
63
|
-
* @param {import("../types/log").EvalSample} sample - The sample containing input data.
|
64
|
-
* @returns {(string | Array<string|import("preact").JSX.Element>)} - The trimmed user prompt or an array of contents if the input is an array.
|
65
|
-
*/
|
66
|
-
export const userPromptForSample = (sample) => {
|
67
|
-
if (sample) {
|
68
|
-
if (typeof sample.input == "string") {
|
69
|
-
return sample.input.trim();
|
70
|
-
} else if (Array.isArray(sample.input)) {
|
71
|
-
const userPrompt = sample.input.find((message) => message.role == "user");
|
72
|
-
if (userPrompt) {
|
73
|
-
const contents = userPrompt.content;
|
74
|
-
if (Array.isArray(contents)) {
|
75
|
-
const results = [];
|
76
|
-
for (const content of contents) {
|
77
|
-
if (content.type === "text") {
|
78
|
-
results.push(content.text);
|
79
|
-
} else {
|
80
|
-
results.push(
|
81
|
-
html`<img
|
82
|
-
src="${content.image}"
|
83
|
-
style=${{
|
84
|
-
maxWidth: "400px",
|
85
|
-
border: "solid var(--bs-border-color) 1px",
|
86
|
-
}}
|
87
|
-
/>`,
|
88
|
-
);
|
89
|
-
}
|
90
|
-
}
|
91
|
-
return results;
|
92
|
-
} else {
|
93
|
-
return contents.trim();
|
94
|
-
}
|
95
|
-
}
|
96
|
-
}
|
97
|
-
}
|
98
|
-
return "";
|
99
|
-
};
|
100
|
-
|
101
|
-
/**
|
102
|
-
* Formats a score with specific HTML based on its value.
|
103
|
-
*
|
104
|
-
* @param {string} score - The score to format.
|
105
|
-
* @returns {import("preact").JSX.Element|string} The formatted score as an HTML template or the original score if not "C" or "I".
|
106
|
-
*/
|
107
|
-
export const formatScore = (score) => {
|
108
|
-
// Circle with single letter
|
109
|
-
if (score === "C") {
|
110
|
-
return html`<span class="circle-border score-green">C</span>`;
|
111
|
-
} else if (score === "I") {
|
112
|
-
return html`<span class="circle-border score-red">I</span>`;
|
113
|
-
} else {
|
114
|
-
return score;
|
115
|
-
}
|
116
|
-
};
|
117
|
-
|
118
|
-
/**
|
119
|
-
* Formats a duration given in seconds into a human-readable string.
|
120
|
-
*
|
121
|
-
* @param {number} seconds - The duration in seconds.
|
122
|
-
* @returns {string} - The formatted time string.
|
123
|
-
*/
|
124
|
-
export const formatTime = (seconds) => {
|
125
|
-
if (seconds < 60) {
|
126
|
-
return `${seconds} sec`;
|
127
|
-
} else if (seconds < 60 * 60) {
|
128
|
-
return `${Math.floor(seconds / 60)} min ${seconds % 60} sec`;
|
129
|
-
} else if (seconds < 60 * 60 * 24) {
|
130
|
-
const hours = Math.floor(seconds / (60 * 60));
|
131
|
-
const minutes = Math.floor((seconds % (60 * 60)) / 60);
|
132
|
-
const remainingSeconds = seconds % 60;
|
133
|
-
return `${hours} hr ${minutes} min ${remainingSeconds} sec`;
|
134
|
-
} else {
|
135
|
-
const days = Math.floor(seconds / (60 * 60 * 24));
|
136
|
-
const hours = Math.floor((seconds % (60 * 60 * 24)) / (60 * 60));
|
137
|
-
const minutes = Math.floor((seconds % (60 * 60)) / 60);
|
138
|
-
const remainingSeconds = seconds % 60;
|
139
|
-
return `${days} days ${hours} hr ${minutes} min ${remainingSeconds} sec`;
|
140
|
-
}
|
141
|
-
};
|
142
|
-
|
143
|
-
/**
|
144
|
-
* Formats a number to a string with specific decimal places for prettiness.
|
145
|
-
*
|
146
|
-
* @param {number} num - The number to format.
|
147
|
-
* @returns {string} - The formatted number as a string.
|
148
|
-
*/
|
149
|
-
export function formatPrettyDecimal(num) {
|
150
|
-
const numDecimalPlaces = num.toString().includes(".")
|
151
|
-
? num.toString().split(".")[1].length
|
152
|
-
: 0;
|
153
|
-
|
154
|
-
if (numDecimalPlaces === 0) {
|
155
|
-
return num.toFixed(1);
|
156
|
-
} else if (numDecimalPlaces > 3) {
|
157
|
-
return num.toFixed(3);
|
158
|
-
} else {
|
159
|
-
return num.toString();
|
160
|
-
}
|
161
|
-
}
|
162
|
-
|
163
|
-
/**
|
164
|
-
* Formats a number to a string without trailing zeroes after the decimal point.
|
165
|
-
*
|
166
|
-
* @param {number} num - The number to format.
|
167
|
-
* @returns {string|number} - The formatted number as a string, or the original input if it's not a number.
|
168
|
-
*/
|
169
|
-
export function formatDecimalNoTrailingZeroes(num) {
|
170
|
-
// This isn't a number, continue
|
171
|
-
if (typeof num !== "number") {
|
172
|
-
return num;
|
173
|
-
}
|
174
|
-
|
175
|
-
if (num.toString().includes(".")) {
|
176
|
-
const decimal = num.toString().split(".")[1];
|
177
|
-
const trimmed = decimal.replace(/\.?0+$/, "");
|
178
|
-
return num.toFixed(trimmed.length);
|
179
|
-
} else {
|
180
|
-
return num.toFixed(0);
|
181
|
-
}
|
182
|
-
}
|
183
|
-
|
184
|
-
/**
|
185
|
-
* Converts a string to title case.
|
186
|
-
*
|
187
|
-
* @param {string} str - The string to convert.
|
188
|
-
* @returns {string} - The string in title case.
|
189
|
-
*/
|
190
|
-
export function toTitleCase(str) {
|
191
|
-
return str
|
192
|
-
.split(" ")
|
193
|
-
.map((w) => w[0].toUpperCase() + w.substr(1).toLowerCase())
|
194
|
-
.join(" ");
|
195
|
-
}
|
196
|
-
|
197
|
-
/**
|
198
|
-
* Formats a number to a string without trailing zeroes after the decimal point.
|
199
|
-
*
|
200
|
-
* @param {number} num - The number to format.
|
201
|
-
* @returns {string|number} - The formatted number as a string, or the original input if it's not a number.
|
202
|
-
*/
|
203
|
-
export function formatNoDecimal(num) {
|
204
|
-
// This isn't a number, continue
|
205
|
-
if (typeof num !== "number") {
|
206
|
-
return num;
|
207
|
-
}
|
208
|
-
|
209
|
-
// Round to a whole number
|
210
|
-
const rounded = Math.round(num);
|
211
|
-
return rounded.toFixed(0);
|
212
|
-
}
|
213
|
-
|
214
|
-
/**
|
215
|
-
* Formats a number to a string without trailing zeroes after the decimal point.
|
216
|
-
*
|
217
|
-
* @param {number} num - The number to format.
|
218
|
-
* @returns {string} - The formatted number as a string
|
219
|
-
*/
|
220
|
-
export function formatNumber(num) {
|
221
|
-
return num.toLocaleString(navigator.language, {
|
222
|
-
minimumFractionDigits: 0,
|
223
|
-
maximumFractionDigits: 5,
|
224
|
-
});
|
225
|
-
}
|
226
|
-
|
227
|
-
/**
|
228
|
-
* Formats a number to a string without trailing zeroes after the decimal point.
|
229
|
-
*
|
230
|
-
* @param {Date} date - The number to format.
|
231
|
-
* @returns {string} - The formatted number as a string
|
232
|
-
*/
|
233
|
-
export function formatDateTime(date) {
|
234
|
-
const options = {
|
235
|
-
year: "2-digit",
|
236
|
-
month: "2-digit",
|
237
|
-
day: "2-digit",
|
238
|
-
hour: "numeric",
|
239
|
-
minute: "2-digit",
|
240
|
-
second: "2-digit",
|
241
|
-
hour12: true,
|
242
|
-
};
|
243
|
-
|
244
|
-
// Use the default system locale and timezone
|
245
|
-
// @ts-ignore
|
246
|
-
return new Intl.DateTimeFormat(undefined, options).format(date);
|
247
|
-
}
|
248
|
-
|
249
|
-
/**
|
250
|
-
* Returns the formatted duration between two dates
|
251
|
-
*
|
252
|
-
* @param {Date} start - The starting date/time to format.
|
253
|
-
* @param {Date} end - The starting date/time to format.
|
254
|
-
* @returns {string} - The formatted number as a string
|
255
|
-
*/
|
256
|
-
export function formatDuration(start, end) {
|
257
|
-
const durationMs = end.getTime() - start.getTime();
|
258
|
-
const durationSec = durationMs / 1000;
|
259
|
-
return formatTime(durationSec);
|
260
|
-
}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
// @ts-check
|
2
|
-
/**
|
3
|
-
* Generates a GitHub commit URL based on the repository origin URL and the commit hash.
|
4
|
-
*
|
5
|
-
* @param {string} origin - The origin URL of the GitHub repository.
|
6
|
-
* @param {string} commit - The commit hash.
|
7
|
-
* @returns {string} - The generated GitHub commit URL.
|
8
|
-
*/
|
9
|
-
export const ghCommitUrl = (origin, commit) => {
|
10
|
-
const baseUrl = origin.replace(/\.git$/, "");
|
11
|
-
return `${baseUrl}/commit/${commit}`;
|
12
|
-
};
|
@@ -1,21 +0,0 @@
|
|
1
|
-
// @ts-check
|
2
|
-
|
3
|
-
/**
|
4
|
-
* Escapes special characters in a string to make it safe for use in a CSS selector.
|
5
|
-
*
|
6
|
-
* @param {string} id - The string (usually an id or class name) to be escaped for use in a CSS selector.
|
7
|
-
* @returns {string} - The escaped string safe for use in `querySelector` or `querySelectorAll`.
|
8
|
-
*/
|
9
|
-
export function escapeSelector(id) {
|
10
|
-
return id.replace(/([ #.;,?!+*~'":^$[\]()=>|/\\])/g, "\\$1");
|
11
|
-
}
|
12
|
-
|
13
|
-
// Determine the capabilities
|
14
|
-
// If this is vscode, check for the version meta
|
15
|
-
// so we know it supports downloads
|
16
|
-
export const isVscode = () => {
|
17
|
-
const bodyEl = document.querySelector("body");
|
18
|
-
return !!bodyEl.getAttributeNames().find((attr) => {
|
19
|
-
return attr.includes("data-vscode-");
|
20
|
-
});
|
21
|
-
};
|
@@ -1,31 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Resolves individual value
|
3
|
-
*
|
4
|
-
* @param {any} value - The value to resolve.
|
5
|
-
* @param {Record<string,string>} attachments - The transcript events to display.
|
6
|
-
* @returns {any} Value with resolved content.
|
7
|
-
*/
|
8
|
-
export const resolveAttachments = (value, attachments) => {
|
9
|
-
const kContentProtocol = "tc://";
|
10
|
-
const kAttachmentProtocol = "attachment://";
|
11
|
-
|
12
|
-
if (Array.isArray(value)) {
|
13
|
-
return value.map((v) => resolveAttachments(v, attachments));
|
14
|
-
} else if (value && typeof value === "object") {
|
15
|
-
/** @type {Record<string, unknown>} */
|
16
|
-
const resolvedObject = {};
|
17
|
-
for (const key of Object.keys(value)) {
|
18
|
-
//@ts-ignore
|
19
|
-
resolvedObject[key] = resolveAttachments(value[key], attachments);
|
20
|
-
}
|
21
|
-
return resolvedObject;
|
22
|
-
} else if (typeof value === "string") {
|
23
|
-
if (value.startsWith(kContentProtocol)) {
|
24
|
-
value = value.replace(kContentProtocol, kAttachmentProtocol);
|
25
|
-
}
|
26
|
-
if (value.startsWith(kAttachmentProtocol)) {
|
27
|
-
return attachments[value.replace(kAttachmentProtocol, "")];
|
28
|
-
}
|
29
|
-
}
|
30
|
-
return value;
|
31
|
-
};
|
@@ -1,23 +0,0 @@
|
|
1
|
-
export function printCircularReferences(obj) {
|
2
|
-
const seenObjects = new WeakMap();
|
3
|
-
|
4
|
-
function detect(value, path = "") {
|
5
|
-
if (typeof value === "object" && value !== null) {
|
6
|
-
if (seenObjects.has(value)) {
|
7
|
-
console.log(
|
8
|
-
`Circular reference detected at path: ${seenObjects.get(value)}`,
|
9
|
-
);
|
10
|
-
return;
|
11
|
-
}
|
12
|
-
seenObjects.set(value, path);
|
13
|
-
|
14
|
-
for (const key in value) {
|
15
|
-
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
16
|
-
detect(value[key], `${path}.${key}`);
|
17
|
-
}
|
18
|
-
}
|
19
|
-
}
|
20
|
-
}
|
21
|
-
|
22
|
-
detect(obj, "root");
|
23
|
-
}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
//@ts-check
|
2
|
-
|
3
|
-
/**
|
4
|
-
* Fetches a range of bytes from a remote resource and returns it as a `Uint8Array`.
|
5
|
-
*
|
6
|
-
* @param {string} url - The URL of the remote resource to fetch.
|
7
|
-
* @param {number} start - The starting byte position of the range to fetch.
|
8
|
-
* @param {number} end - The ending byte position of the range to fetch.
|
9
|
-
* @returns {Promise<Uint8Array>} A promise that resolves to a `Uint8Array` containing the fetched byte range.
|
10
|
-
* @throws {Error} If there is an issue with the network request.
|
11
|
-
*/
|
12
|
-
export const fetchRange = async (url, start, end) => {
|
13
|
-
const response = await fetch(url, {
|
14
|
-
headers: { Range: `bytes=${start}-${end}` },
|
15
|
-
});
|
16
|
-
const arrayBuffer = await response.arrayBuffer();
|
17
|
-
return new Uint8Array(arrayBuffer);
|
18
|
-
};
|
@@ -1,67 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* A class that manages asynchronous task execution with a limit on concurrent tasks.
|
3
|
-
*/
|
4
|
-
export class AsyncQueue {
|
5
|
-
/**
|
6
|
-
* Creates an instance of AsyncQueue.
|
7
|
-
* @param {number} [concurrentLimit=6] - The maximum number of tasks that can run concurrently.
|
8
|
-
*/
|
9
|
-
constructor(concurrentLimit = 6) {
|
10
|
-
/**
|
11
|
-
* The maximum number of concurrent tasks.
|
12
|
-
* @type {number}
|
13
|
-
*/
|
14
|
-
this.concurrentLimit = concurrentLimit;
|
15
|
-
|
16
|
-
/**
|
17
|
-
* The queue of tasks waiting to be executed.
|
18
|
-
* @type {Array<Function>}
|
19
|
-
*/
|
20
|
-
this.queue = [];
|
21
|
-
|
22
|
-
/**
|
23
|
-
* The count of currently running tasks.
|
24
|
-
* @type {number}
|
25
|
-
*/
|
26
|
-
this.runningCount = 0;
|
27
|
-
}
|
28
|
-
|
29
|
-
/**
|
30
|
-
* Adds a task to the queue and runs it if the concurrency limit allows.
|
31
|
-
* @param {Function} task - The task to be executed asynchronously. This should be a function that returns a promise.
|
32
|
-
* @returns {Promise<*>} - A promise that resolves with the result of the task or rejects if the task throws an error.
|
33
|
-
*/
|
34
|
-
async enqueue(task) {
|
35
|
-
return new Promise((resolve, reject) => {
|
36
|
-
this.queue.push(async () => {
|
37
|
-
try {
|
38
|
-
const result = await task();
|
39
|
-
resolve(result);
|
40
|
-
} catch (error) {
|
41
|
-
reject(error);
|
42
|
-
} finally {
|
43
|
-
this.runningCount--;
|
44
|
-
this.runNext();
|
45
|
-
}
|
46
|
-
});
|
47
|
-
|
48
|
-
if (this.runningCount < this.concurrentLimit) {
|
49
|
-
this.runNext();
|
50
|
-
}
|
51
|
-
});
|
52
|
-
}
|
53
|
-
|
54
|
-
/**
|
55
|
-
* Runs the next task in the queue if there are available slots for concurrent execution.
|
56
|
-
* @private
|
57
|
-
*/
|
58
|
-
runNext() {
|
59
|
-
if (this.queue.length > 0 && this.runningCount < this.concurrentLimit) {
|
60
|
-
const task = this.queue.shift();
|
61
|
-
if (task) {
|
62
|
-
this.runningCount++;
|
63
|
-
task();
|
64
|
-
}
|
65
|
-
}
|
66
|
-
}
|
67
|
-
}
|
@@ -1,101 +0,0 @@
|
|
1
|
-
// @ts-check
|
2
|
-
/**
|
3
|
-
* Delays the execution of code for a specified number of milliseconds.
|
4
|
-
*
|
5
|
-
* @param {number} ms - The number of milliseconds to delay.
|
6
|
-
* @returns {Promise<void>} - A promise that resolves after the specified delay.
|
7
|
-
*/
|
8
|
-
export function sleep(ms) {
|
9
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
10
|
-
}
|
11
|
-
|
12
|
-
/**
|
13
|
-
* Creates a throttled version of a function that only invokes the original function
|
14
|
-
* at most once per every `wait` milliseconds. The throttled function will run as much
|
15
|
-
* as it can, without ever going more than once per `wait` duration.
|
16
|
-
*
|
17
|
-
* @param {Function} func - The function to throttle.
|
18
|
-
* @param {number} wait - The number of milliseconds to throttle executions to.
|
19
|
-
* @param {Object} [options] - The options object.
|
20
|
-
* @param {boolean} [options.leading=true] - If `false`, the function will not be invoked on the leading edge.
|
21
|
-
* @param {boolean} [options.trailing=true] - If `false`, the function will not be invoked on the trailing edge.
|
22
|
-
* @returns {Function} - The throttled function.
|
23
|
-
*/
|
24
|
-
export function throttle(func, wait, options) {
|
25
|
-
var context, args, result;
|
26
|
-
var timeout = null;
|
27
|
-
var previous = 0;
|
28
|
-
if (!options) options = {};
|
29
|
-
var later = function () {
|
30
|
-
previous = options.leading === false ? 0 : Date.now();
|
31
|
-
timeout = null;
|
32
|
-
result = func.apply(context, args);
|
33
|
-
if (!timeout) context = args = null;
|
34
|
-
};
|
35
|
-
return function () {
|
36
|
-
var now = Date.now();
|
37
|
-
if (!previous && options.leading === false) previous = now;
|
38
|
-
var remaining = wait - (now - previous);
|
39
|
-
context = this;
|
40
|
-
args = arguments;
|
41
|
-
if (remaining <= 0 || remaining > wait) {
|
42
|
-
if (timeout) {
|
43
|
-
clearTimeout(timeout);
|
44
|
-
timeout = null;
|
45
|
-
}
|
46
|
-
previous = now;
|
47
|
-
result = func.apply(context, args);
|
48
|
-
|
49
|
-
if (!timeout) context = args = null;
|
50
|
-
} else if (!timeout && options.trailing !== false) {
|
51
|
-
timeout = setTimeout(later, remaining);
|
52
|
-
}
|
53
|
-
return result;
|
54
|
-
};
|
55
|
-
}
|
56
|
-
|
57
|
-
/**
|
58
|
-
* Creates a debounced version of a function that delays invoking the function
|
59
|
-
* until after `wait` milliseconds have passed since the last time it was invoked.
|
60
|
-
*
|
61
|
-
* @param {Function} func - The function to debounce.
|
62
|
-
* @param {number} wait - The number of milliseconds to delay.
|
63
|
-
* @param {Object} [options] - The options object.
|
64
|
-
* @param {boolean} [options.leading=false] - If `true`, the function will be invoked on the leading edge of the timeout.
|
65
|
-
* @param {boolean} [options.trailing=true] - If `false`, the function will not be invoked on the trailing edge.
|
66
|
-
* @returns {Function} - The debounced function.
|
67
|
-
*/
|
68
|
-
export function debounce(func, wait, options = {}) {
|
69
|
-
let timeout, context, args, result;
|
70
|
-
let lastCallTime = null;
|
71
|
-
|
72
|
-
const later = () => {
|
73
|
-
const last = Date.now() - lastCallTime;
|
74
|
-
if (last < wait && last >= 0) {
|
75
|
-
timeout = setTimeout(later, wait - last);
|
76
|
-
} else {
|
77
|
-
timeout = null;
|
78
|
-
if (!options.leading) {
|
79
|
-
result = func.apply(context, args);
|
80
|
-
if (!timeout) context = args = null;
|
81
|
-
}
|
82
|
-
}
|
83
|
-
};
|
84
|
-
|
85
|
-
return function () {
|
86
|
-
context = this;
|
87
|
-
args = arguments;
|
88
|
-
lastCallTime = Date.now();
|
89
|
-
|
90
|
-
const callNow = options.leading && !timeout;
|
91
|
-
if (!timeout) {
|
92
|
-
timeout = setTimeout(later, wait);
|
93
|
-
}
|
94
|
-
if (callNow) {
|
95
|
-
result = func.apply(context, args);
|
96
|
-
context = args = null;
|
97
|
-
}
|
98
|
-
|
99
|
-
return result;
|
100
|
-
};
|
101
|
-
}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import { html } from "htm/preact";
|
2
|
-
import { FontSize } from "../appearance/Fonts.mjs";
|
3
|
-
import { ApplicationIcons } from "../appearance/Icons.mjs";
|
4
|
-
|
5
|
-
import { Card, CardHeader, CardBody } from "../components/Card.mjs";
|
6
|
-
import { ANSIDisplay } from "../components/AnsiDisplay.mjs";
|
7
|
-
|
8
|
-
export const TaskErrorCard = ({ evalError }) => {
|
9
|
-
return html`
|
10
|
-
<${Card}>
|
11
|
-
<${CardHeader} icon=${ApplicationIcons.error} label="Task Failed: ${evalError.message}"></${CardHeader}>
|
12
|
-
<${CardBody} style=${{ fontSize: FontSize.smaller }}>
|
13
|
-
<${ANSIDisplay} output=${evalError.traceback_ansi} style=${{ fontSize: "clamp(0.2rem, calc(0.2em + .93vw), 0.9rem)" }}/>
|
14
|
-
</${CardBody}>
|
15
|
-
</${Card}>
|
16
|
-
`;
|
17
|
-
};
|