inspect-ai 0.3.69__py3-none-any.whl → 0.3.71__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/eval.py +27 -9
- inspect_ai/_display/core/display.py +2 -0
- inspect_ai/_display/core/footer.py +13 -3
- inspect_ai/_display/plain/display.py +6 -2
- inspect_ai/_display/rich/display.py +19 -6
- inspect_ai/_display/textual/app.py +9 -3
- inspect_ai/_display/textual/display.py +4 -0
- inspect_ai/_display/textual/widgets/samples.py +4 -10
- inspect_ai/_display/textual/widgets/transcript.py +35 -18
- inspect_ai/_eval/eval.py +14 -2
- inspect_ai/_eval/evalset.py +6 -1
- inspect_ai/_eval/run.py +6 -0
- inspect_ai/_eval/task/run.py +49 -23
- inspect_ai/_eval/task/task.py +26 -3
- inspect_ai/_util/content.py +20 -1
- inspect_ai/_util/interrupt.py +6 -0
- inspect_ai/_util/logger.py +19 -0
- inspect_ai/_util/rich.py +7 -8
- inspect_ai/_util/text.py +13 -0
- inspect_ai/_util/transcript.py +20 -6
- inspect_ai/_util/working.py +50 -0
- inspect_ai/_view/www/App.css +6 -0
- inspect_ai/_view/www/dist/assets/index.css +171 -99
- inspect_ai/_view/www/dist/assets/index.js +5972 -2770
- inspect_ai/_view/www/eslint.config.mjs +24 -1
- inspect_ai/_view/www/log-schema.json +619 -21
- inspect_ai/_view/www/package.json +8 -3
- inspect_ai/_view/www/src/App.tsx +2 -2
- inspect_ai/_view/www/src/appearance/icons.ts +3 -1
- inspect_ai/_view/www/src/components/AnsiDisplay.tsx +4 -3
- inspect_ai/_view/www/src/components/Card.tsx +9 -8
- inspect_ai/_view/www/src/components/DownloadButton.tsx +2 -1
- inspect_ai/_view/www/src/components/EmptyPanel.tsx +2 -2
- inspect_ai/_view/www/src/components/ErrorPanel.tsx +4 -3
- inspect_ai/_view/www/src/components/ExpandablePanel.tsx +13 -5
- inspect_ai/_view/www/src/components/FindBand.tsx +3 -3
- inspect_ai/_view/www/src/components/HumanBaselineView.tsx +3 -3
- inspect_ai/_view/www/src/components/LabeledValue.tsx +5 -4
- inspect_ai/_view/www/src/components/LargeModal.tsx +18 -13
- inspect_ai/_view/www/src/components/{LightboxCarousel.css → LightboxCarousel.module.css} +22 -18
- inspect_ai/_view/www/src/components/LightboxCarousel.tsx +36 -27
- inspect_ai/_view/www/src/components/MessageBand.tsx +2 -1
- inspect_ai/_view/www/src/components/NavPills.tsx +9 -8
- inspect_ai/_view/www/src/components/ProgressBar.tsx +2 -1
- inspect_ai/_view/www/src/components/TabSet.tsx +21 -15
- inspect_ai/_view/www/src/index.tsx +2 -2
- inspect_ai/_view/www/src/metadata/MetaDataGrid.tsx +11 -9
- inspect_ai/_view/www/src/metadata/MetaDataView.tsx +3 -2
- inspect_ai/_view/www/src/metadata/MetadataGrid.module.css +1 -0
- inspect_ai/_view/www/src/metadata/RenderedContent.tsx +16 -1
- inspect_ai/_view/www/src/plan/DatasetDetailView.tsx +3 -2
- inspect_ai/_view/www/src/plan/DetailStep.tsx +2 -1
- inspect_ai/_view/www/src/plan/PlanCard.tsx +2 -5
- inspect_ai/_view/www/src/plan/PlanDetailView.tsx +6 -9
- inspect_ai/_view/www/src/plan/ScorerDetailView.tsx +2 -1
- inspect_ai/_view/www/src/plan/SolverDetailView.tsx +3 -3
- inspect_ai/_view/www/src/samples/InlineSampleDisplay.tsx +2 -2
- inspect_ai/_view/www/src/samples/SampleDialog.tsx +3 -3
- inspect_ai/_view/www/src/samples/SampleDisplay.module.css +9 -1
- inspect_ai/_view/www/src/samples/SampleDisplay.tsx +30 -3
- inspect_ai/_view/www/src/samples/SampleSummaryView.module.css +4 -0
- inspect_ai/_view/www/src/samples/SampleSummaryView.tsx +25 -4
- inspect_ai/_view/www/src/samples/SamplesTools.tsx +2 -1
- inspect_ai/_view/www/src/samples/chat/ChatMessage.tsx +3 -19
- inspect_ai/_view/www/src/samples/chat/ChatMessageRenderer.tsx +2 -1
- inspect_ai/_view/www/src/samples/chat/ChatMessageRow.tsx +2 -1
- inspect_ai/_view/www/src/samples/chat/ChatView.tsx +2 -1
- inspect_ai/_view/www/src/samples/chat/ChatViewVirtualList.tsx +22 -7
- inspect_ai/_view/www/src/samples/chat/MessageContent.tsx +35 -6
- inspect_ai/_view/www/src/samples/chat/MessageContents.tsx +2 -2
- inspect_ai/_view/www/src/samples/chat/messages.ts +15 -2
- inspect_ai/_view/www/src/samples/chat/tools/ToolCallView.tsx +13 -4
- inspect_ai/_view/www/src/samples/chat/tools/ToolInput.module.css +2 -2
- inspect_ai/_view/www/src/samples/chat/tools/ToolInput.tsx +18 -19
- inspect_ai/_view/www/src/samples/chat/tools/ToolOutput.module.css +1 -1
- inspect_ai/_view/www/src/samples/chat/tools/ToolOutput.tsx +4 -3
- inspect_ai/_view/www/src/samples/chat/tools/ToolTitle.tsx +2 -2
- inspect_ai/_view/www/src/samples/error/FlatSampleErrorView.tsx +2 -3
- inspect_ai/_view/www/src/samples/error/SampleErrorView.tsx +3 -2
- inspect_ai/_view/www/src/samples/list/SampleFooter.tsx +2 -1
- inspect_ai/_view/www/src/samples/list/SampleHeader.tsx +2 -1
- inspect_ai/_view/www/src/samples/list/SampleList.tsx +57 -45
- inspect_ai/_view/www/src/samples/list/SampleRow.tsx +2 -1
- inspect_ai/_view/www/src/samples/list/SampleSeparator.tsx +2 -1
- inspect_ai/_view/www/src/samples/sample-tools/EpochFilter.tsx +2 -2
- inspect_ai/_view/www/src/samples/sample-tools/SelectScorer.tsx +4 -3
- inspect_ai/_view/www/src/samples/sample-tools/SortFilter.tsx +2 -5
- inspect_ai/_view/www/src/samples/sample-tools/sample-filter/SampleFilter.tsx +2 -2
- inspect_ai/_view/www/src/samples/scores/SampleScoreView.tsx +2 -1
- inspect_ai/_view/www/src/samples/scores/SampleScores.tsx +2 -2
- inspect_ai/_view/www/src/samples/transcript/ApprovalEventView.tsx +2 -1
- inspect_ai/_view/www/src/samples/transcript/ErrorEventView.tsx +2 -1
- inspect_ai/_view/www/src/samples/transcript/InfoEventView.tsx +2 -1
- inspect_ai/_view/www/src/samples/transcript/InputEventView.tsx +2 -1
- inspect_ai/_view/www/src/samples/transcript/LoggerEventView.module.css +4 -0
- inspect_ai/_view/www/src/samples/transcript/LoggerEventView.tsx +12 -2
- inspect_ai/_view/www/src/samples/transcript/ModelEventView.module.css +1 -1
- inspect_ai/_view/www/src/samples/transcript/ModelEventView.tsx +25 -28
- inspect_ai/_view/www/src/samples/transcript/SampleInitEventView.tsx +2 -1
- inspect_ai/_view/www/src/samples/transcript/SampleLimitEventView.tsx +9 -4
- inspect_ai/_view/www/src/samples/transcript/SampleTranscript.tsx +2 -2
- inspect_ai/_view/www/src/samples/transcript/SandboxEventView.module.css +32 -0
- inspect_ai/_view/www/src/samples/transcript/SandboxEventView.tsx +153 -0
- inspect_ai/_view/www/src/samples/transcript/ScoreEventView.tsx +2 -2
- inspect_ai/_view/www/src/samples/transcript/StepEventView.tsx +12 -5
- inspect_ai/_view/www/src/samples/transcript/SubtaskEventView.tsx +18 -14
- inspect_ai/_view/www/src/samples/transcript/ToolEventView.tsx +5 -5
- inspect_ai/_view/www/src/samples/transcript/TranscriptView.tsx +53 -16
- inspect_ai/_view/www/src/samples/transcript/event/EventNav.tsx +2 -1
- inspect_ai/_view/www/src/samples/transcript/event/EventNavs.tsx +2 -1
- inspect_ai/_view/www/src/samples/transcript/event/EventPanel.tsx +6 -3
- inspect_ai/_view/www/src/samples/transcript/event/EventRow.tsx +3 -2
- inspect_ai/_view/www/src/samples/transcript/event/EventSection.tsx +2 -2
- inspect_ai/_view/www/src/samples/transcript/event/EventTimingPanel.module.css +28 -0
- inspect_ai/_view/www/src/samples/transcript/event/EventTimingPanel.tsx +115 -0
- inspect_ai/_view/www/src/samples/transcript/event/utils.ts +29 -0
- inspect_ai/_view/www/src/samples/transcript/state/StateDiffView.tsx +2 -1
- inspect_ai/_view/www/src/samples/transcript/state/StateEventRenderers.tsx +3 -3
- inspect_ai/_view/www/src/samples/transcript/state/StateEventView.tsx +11 -8
- inspect_ai/_view/www/src/samples/transcript/types.ts +3 -1
- inspect_ai/_view/www/src/types/log.d.ts +312 -137
- inspect_ai/_view/www/src/usage/ModelTokenTable.tsx +6 -10
- inspect_ai/_view/www/src/usage/ModelUsagePanel.module.css +4 -0
- inspect_ai/_view/www/src/usage/ModelUsagePanel.tsx +32 -9
- inspect_ai/_view/www/src/usage/TokenTable.tsx +4 -6
- inspect_ai/_view/www/src/usage/UsageCard.tsx +2 -1
- inspect_ai/_view/www/src/utils/format.ts +8 -5
- inspect_ai/_view/www/src/utils/json.ts +24 -0
- inspect_ai/_view/www/src/workspace/WorkSpace.tsx +6 -5
- inspect_ai/_view/www/src/workspace/WorkSpaceView.tsx +18 -8
- inspect_ai/_view/www/src/workspace/error/TaskErrorPanel.tsx +2 -1
- inspect_ai/_view/www/src/workspace/navbar/Navbar.tsx +2 -1
- inspect_ai/_view/www/src/workspace/navbar/PrimaryBar.tsx +3 -3
- inspect_ai/_view/www/src/workspace/navbar/ResultsPanel.tsx +4 -3
- inspect_ai/_view/www/src/workspace/navbar/SecondaryBar.tsx +5 -4
- inspect_ai/_view/www/src/workspace/navbar/StatusPanel.tsx +5 -8
- inspect_ai/_view/www/src/workspace/sidebar/EvalStatus.tsx +5 -4
- inspect_ai/_view/www/src/workspace/sidebar/LogDirectoryTitleView.tsx +2 -1
- inspect_ai/_view/www/src/workspace/sidebar/Sidebar.tsx +2 -1
- inspect_ai/_view/www/src/workspace/sidebar/SidebarLogEntry.tsx +2 -2
- inspect_ai/_view/www/src/workspace/sidebar/SidebarScoreView.tsx +2 -1
- inspect_ai/_view/www/src/workspace/sidebar/SidebarScoresView.tsx +2 -2
- inspect_ai/_view/www/src/workspace/tabs/InfoTab.tsx +2 -2
- inspect_ai/_view/www/src/workspace/tabs/JsonTab.tsx +2 -5
- inspect_ai/_view/www/src/workspace/tabs/SamplesTab.tsx +12 -11
- inspect_ai/_view/www/yarn.lock +241 -5
- inspect_ai/log/__init__.py +2 -0
- inspect_ai/log/_condense.py +4 -0
- inspect_ai/log/_log.py +72 -12
- inspect_ai/log/_recorders/eval.py +6 -1
- inspect_ai/log/_samples.py +5 -1
- inspect_ai/log/_transcript.py +89 -2
- inspect_ai/model/__init__.py +2 -0
- inspect_ai/model/_call_tools.py +8 -1
- inspect_ai/model/_chat_message.py +22 -7
- inspect_ai/model/_conversation.py +11 -9
- inspect_ai/model/_generate_config.py +25 -4
- inspect_ai/model/_model.py +164 -72
- inspect_ai/model/_model_call.py +10 -3
- inspect_ai/model/_model_output.py +3 -0
- inspect_ai/model/_openai.py +106 -40
- inspect_ai/model/_providers/anthropic.py +145 -26
- inspect_ai/model/_providers/bedrock.py +7 -0
- inspect_ai/model/_providers/cloudflare.py +20 -7
- inspect_ai/model/_providers/google.py +29 -8
- inspect_ai/model/_providers/groq.py +66 -27
- inspect_ai/model/_providers/hf.py +6 -0
- inspect_ai/model/_providers/mistral.py +78 -51
- inspect_ai/model/_providers/openai.py +66 -4
- inspect_ai/model/_providers/openai_o1.py +10 -0
- inspect_ai/model/_providers/providers.py +2 -2
- inspect_ai/model/_providers/util/tracker.py +92 -0
- inspect_ai/model/_providers/vllm.py +13 -5
- inspect_ai/model/_reasoning.py +15 -2
- inspect_ai/scorer/_model.py +23 -19
- inspect_ai/solver/_basic_agent.py +1 -3
- inspect_ai/solver/_bridge/patch.py +0 -2
- inspect_ai/solver/_human_agent/agent.py +14 -10
- inspect_ai/solver/_human_agent/commands/__init__.py +7 -3
- inspect_ai/solver/_human_agent/commands/submit.py +76 -30
- inspect_ai/solver/_limit.py +4 -4
- inspect_ai/solver/_plan.py +0 -3
- inspect_ai/solver/_task_state.py +7 -0
- inspect_ai/tool/__init__.py +2 -0
- inspect_ai/tool/_tool.py +3 -1
- inspect_ai/tool/_tools/_computer/_resources/tool/_run.py +1 -1
- inspect_ai/tool/_tools/_web_browser/_resources/.pylintrc +8 -0
- inspect_ai/tool/_tools/_web_browser/_resources/.vscode/launch.json +24 -0
- inspect_ai/tool/_tools/_web_browser/_resources/.vscode/settings.json +25 -0
- inspect_ai/tool/_tools/_web_browser/_resources/Dockerfile +5 -6
- inspect_ai/tool/_tools/_web_browser/_resources/README.md +10 -11
- inspect_ai/tool/_tools/_web_browser/_resources/accessibility_tree.py +71 -0
- inspect_ai/tool/_tools/_web_browser/_resources/accessibility_tree_node.py +323 -0
- inspect_ai/tool/_tools/_web_browser/_resources/cdp/__init__.py +5 -0
- inspect_ai/tool/_tools/_web_browser/_resources/cdp/a11y.py +279 -0
- inspect_ai/tool/_tools/_web_browser/_resources/cdp/dom.py +9 -0
- inspect_ai/tool/_tools/_web_browser/_resources/cdp/dom_snapshot.py +293 -0
- inspect_ai/tool/_tools/_web_browser/_resources/cdp/page.py +94 -0
- inspect_ai/tool/_tools/_web_browser/_resources/constants.py +2 -0
- inspect_ai/tool/_tools/_web_browser/_resources/images/usage_diagram.svg +2 -0
- inspect_ai/tool/_tools/_web_browser/_resources/playwright_browser.py +50 -0
- inspect_ai/tool/_tools/_web_browser/_resources/playwright_crawler.py +31 -359
- inspect_ai/tool/_tools/_web_browser/_resources/playwright_page_crawler.py +280 -0
- inspect_ai/tool/_tools/_web_browser/_resources/pyproject.toml +65 -0
- inspect_ai/tool/_tools/_web_browser/_resources/rectangle.py +64 -0
- inspect_ai/tool/_tools/_web_browser/_resources/rpc_client_helpers.py +146 -0
- inspect_ai/tool/_tools/_web_browser/_resources/scale_factor.py +64 -0
- inspect_ai/tool/_tools/_web_browser/_resources/test_accessibility_tree_node.py +180 -0
- inspect_ai/tool/_tools/_web_browser/_resources/test_playwright_crawler.py +15 -9
- inspect_ai/tool/_tools/_web_browser/_resources/test_rectangle.py +15 -0
- inspect_ai/tool/_tools/_web_browser/_resources/test_web_client.py +44 -0
- inspect_ai/tool/_tools/_web_browser/_resources/web_browser_rpc_types.py +39 -0
- inspect_ai/tool/_tools/_web_browser/_resources/web_client.py +198 -48
- inspect_ai/tool/_tools/_web_browser/_resources/web_client_new_session.py +26 -25
- inspect_ai/tool/_tools/_web_browser/_resources/web_server.py +178 -39
- inspect_ai/tool/_tools/_web_browser/_web_browser.py +38 -19
- inspect_ai/tool/_tools/_web_search.py +3 -3
- inspect_ai/util/__init__.py +2 -1
- inspect_ai/util/_concurrency.py +14 -8
- inspect_ai/util/_display.py +12 -0
- inspect_ai/util/_sandbox/context.py +15 -0
- inspect_ai/util/_sandbox/docker/docker.py +7 -5
- inspect_ai/util/_sandbox/environment.py +32 -1
- inspect_ai/util/_sandbox/events.py +183 -0
- inspect_ai/util/_sandbox/local.py +3 -3
- inspect_ai/util/_sandbox/self_check.py +131 -43
- inspect_ai/util/_subtask.py +11 -0
- {inspect_ai-0.3.69.dist-info → inspect_ai-0.3.71.dist-info}/METADATA +3 -3
- {inspect_ai-0.3.69.dist-info → inspect_ai-0.3.71.dist-info}/RECORD +233 -211
- {inspect_ai-0.3.69.dist-info → inspect_ai-0.3.71.dist-info}/WHEEL +1 -1
- inspect_ai/_view/www/src/components/VirtualList.module.css +0 -19
- inspect_ai/_view/www/src/components/VirtualList.tsx +0 -292
- inspect_ai/tool/_tools/_web_browser/_resources/accessibility_node.py +0 -312
- inspect_ai/tool/_tools/_web_browser/_resources/dm_env_servicer.py +0 -275
- inspect_ai/tool/_tools/_web_browser/_resources/images/usage_diagram.png +0 -0
- inspect_ai/tool/_tools/_web_browser/_resources/test_accessibility_node.py +0 -176
- inspect_ai/tool/_tools/_web_browser/_resources/test_dm_env_servicer.py +0 -135
- inspect_ai/tool/_tools/_web_browser/_resources/test_web_environment.py +0 -71
- inspect_ai/tool/_tools/_web_browser/_resources/web_environment.py +0 -184
- {inspect_ai-0.3.69.dist-info → inspect_ai-0.3.71.dist-info}/LICENSE +0 -0
- {inspect_ai-0.3.69.dist-info → inspect_ai-0.3.71.dist-info}/entry_points.txt +0 -0
- {inspect_ai-0.3.69.dist-info → inspect_ai-0.3.71.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,115 @@
|
|
1
|
+
import clsx from "clsx";
|
2
|
+
import { FC, Fragment } from "react";
|
3
|
+
import { formatDateTime, formatTime } from "../../../utils/format";
|
4
|
+
import styles from "./EventTimingPanel.module.css";
|
5
|
+
|
6
|
+
interface EventTimingPanelProps {
|
7
|
+
timestamp: string;
|
8
|
+
completed?: string | null;
|
9
|
+
working_start?: number | null;
|
10
|
+
working_time?: number | null;
|
11
|
+
}
|
12
|
+
|
13
|
+
interface EventTimingPanelRow {
|
14
|
+
label: string | "---";
|
15
|
+
value?: string;
|
16
|
+
secondary?: boolean;
|
17
|
+
bordered?: boolean;
|
18
|
+
topMargin?: boolean;
|
19
|
+
}
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Renders the ModelUsagePanel component.
|
23
|
+
*/
|
24
|
+
export const EventTimingPanel: FC<EventTimingPanelProps> = ({
|
25
|
+
timestamp,
|
26
|
+
completed,
|
27
|
+
working_start,
|
28
|
+
working_time,
|
29
|
+
}) => {
|
30
|
+
const rows: EventTimingPanelRow[] = [
|
31
|
+
{
|
32
|
+
label: "Clock Time",
|
33
|
+
value: undefined,
|
34
|
+
secondary: false,
|
35
|
+
},
|
36
|
+
{
|
37
|
+
label: "---",
|
38
|
+
value: undefined,
|
39
|
+
secondary: false,
|
40
|
+
},
|
41
|
+
];
|
42
|
+
|
43
|
+
if (!completed) {
|
44
|
+
rows.push({
|
45
|
+
label: "Timestamp",
|
46
|
+
value: formatDateTime(new Date(timestamp)),
|
47
|
+
});
|
48
|
+
} else {
|
49
|
+
rows.push({ label: "Start", value: formatDateTime(new Date(timestamp)) });
|
50
|
+
rows.push({ label: "End", value: formatDateTime(new Date(completed)) });
|
51
|
+
}
|
52
|
+
|
53
|
+
if (working_start || working_time) {
|
54
|
+
rows.push({
|
55
|
+
label: "Working Time",
|
56
|
+
value: undefined,
|
57
|
+
secondary: false,
|
58
|
+
topMargin: true,
|
59
|
+
});
|
60
|
+
rows.push({
|
61
|
+
label: "---",
|
62
|
+
value: undefined,
|
63
|
+
secondary: false,
|
64
|
+
});
|
65
|
+
if (working_start) {
|
66
|
+
rows.push({
|
67
|
+
label: "Start",
|
68
|
+
value: formatTime(working_start),
|
69
|
+
});
|
70
|
+
}
|
71
|
+
if (working_time) {
|
72
|
+
rows.push({
|
73
|
+
label: "Duration",
|
74
|
+
value: formatTime(working_time),
|
75
|
+
});
|
76
|
+
}
|
77
|
+
if (working_start && working_time) {
|
78
|
+
rows.push({
|
79
|
+
label: "End",
|
80
|
+
value: formatTime(
|
81
|
+
Math.round(working_start * 10) / 10 +
|
82
|
+
Math.round(working_time * 10) / 10,
|
83
|
+
),
|
84
|
+
});
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
return (
|
89
|
+
<div className={clsx("text-size-small", styles.wrapper)}>
|
90
|
+
{rows.map((row, idx) => {
|
91
|
+
if (row.label === "---") {
|
92
|
+
return (
|
93
|
+
<div key={`$usage-sep-${idx}`} className={styles.separator}></div>
|
94
|
+
);
|
95
|
+
} else {
|
96
|
+
return (
|
97
|
+
<Fragment key={`$usage-row-${idx}`}>
|
98
|
+
<div
|
99
|
+
className={clsx(
|
100
|
+
"text-style-label",
|
101
|
+
"text-style-secondary",
|
102
|
+
row.secondary ? styles.col2 : styles.col1_3,
|
103
|
+
row.topMargin ? styles.topMargin : undefined,
|
104
|
+
)}
|
105
|
+
>
|
106
|
+
{row.label}
|
107
|
+
</div>
|
108
|
+
<div className={styles.col3}>{row.value ? row.value : ""}</div>
|
109
|
+
</Fragment>
|
110
|
+
);
|
111
|
+
}
|
112
|
+
})}
|
113
|
+
</div>
|
114
|
+
);
|
115
|
+
};
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import {
|
2
|
+
formatDateTime,
|
3
|
+
formatNumber,
|
4
|
+
formatTime,
|
5
|
+
} from "../../../utils/format";
|
6
|
+
|
7
|
+
export const formatTiming = (timestamp: string, working_start?: number) => {
|
8
|
+
if (working_start) {
|
9
|
+
return `${formatDateTime(new Date(timestamp))}\n@ working time: ${formatTime(working_start)}`;
|
10
|
+
} else {
|
11
|
+
return formatDateTime(new Date(timestamp));
|
12
|
+
}
|
13
|
+
};
|
14
|
+
|
15
|
+
export const formatTitle = (
|
16
|
+
title: string,
|
17
|
+
total_tokens?: number,
|
18
|
+
working_start?: number | null,
|
19
|
+
) => {
|
20
|
+
const subItems = [];
|
21
|
+
if (total_tokens) {
|
22
|
+
subItems.push(`${formatNumber(total_tokens)} tokens`);
|
23
|
+
}
|
24
|
+
if (working_start) {
|
25
|
+
subItems.push(`${formatTime(working_start)}`);
|
26
|
+
}
|
27
|
+
const subtitle = subItems.length > 0 ? ` (${subItems.join(", ")})` : "";
|
28
|
+
return `${title}${subtitle}`;
|
29
|
+
};
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import clsx from "clsx";
|
2
2
|
import { diff } from "jsondiffpatch";
|
3
3
|
import { format } from "jsondiffpatch/formatters/html";
|
4
|
+
import { FC } from "react";
|
4
5
|
|
5
6
|
interface StateDiffViewProps {
|
6
7
|
before: Object;
|
@@ -11,7 +12,7 @@ interface StateDiffViewProps {
|
|
11
12
|
/**
|
12
13
|
* Renders a view displaying a list of state changes.
|
13
14
|
*/
|
14
|
-
export const StateDiffView:
|
15
|
+
export const StateDiffView: FC<StateDiffViewProps> = ({
|
15
16
|
before,
|
16
17
|
after,
|
17
18
|
className,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import clsx from "clsx";
|
2
|
-
import { Fragment, JSX, ReactNode } from "react";
|
2
|
+
import { FC, Fragment, JSX, ReactNode } from "react";
|
3
3
|
import {
|
4
4
|
HumanBaselineView,
|
5
5
|
SessionLog,
|
@@ -246,7 +246,7 @@ interface ToolsProps {
|
|
246
246
|
/**
|
247
247
|
* Renders a list of tool components based on the provided tool definitions.
|
248
248
|
*/
|
249
|
-
export const Tools:
|
249
|
+
export const Tools: FC<ToolsProps> = ({ toolDefinitions }) => {
|
250
250
|
return toolDefinitions.map((toolDefinition, idx) => {
|
251
251
|
const toolName = toolDefinition.name;
|
252
252
|
const toolArgs = toolDefinition.parameters?.properties
|
@@ -270,7 +270,7 @@ interface ToolProps {
|
|
270
270
|
/**
|
271
271
|
* Renders a single tool component.
|
272
272
|
*/
|
273
|
-
export const Tool:
|
273
|
+
export const Tool: FC<ToolProps> = ({ toolName, toolArgs }) => {
|
274
274
|
const functionCall =
|
275
275
|
toolArgs && toolArgs.length > 0
|
276
276
|
? `${toolName}(${toolArgs.join(", ")})`
|
@@ -17,6 +17,7 @@ import {
|
|
17
17
|
StoreSpecificRenderableTypes,
|
18
18
|
} from "./StateEventRenderers";
|
19
19
|
|
20
|
+
import { useMemo, FC } from "react";
|
20
21
|
import styles from "./StateEventView.module.css";
|
21
22
|
|
22
23
|
interface StateEventViewProps {
|
@@ -31,7 +32,7 @@ interface StateEventViewProps {
|
|
31
32
|
/**
|
32
33
|
* Renders the StateEventView component.
|
33
34
|
*/
|
34
|
-
export const StateEventView:
|
35
|
+
export const StateEventView: FC<StateEventViewProps> = ({
|
35
36
|
id,
|
36
37
|
event,
|
37
38
|
eventState,
|
@@ -39,19 +40,21 @@ export const StateEventView: React.FC<StateEventViewProps> = ({
|
|
39
40
|
isStore = false,
|
40
41
|
className,
|
41
42
|
}) => {
|
42
|
-
const summary =
|
43
|
+
const summary = useMemo(() => {
|
44
|
+
return summarizeChanges(event.changes);
|
45
|
+
}, [event.changes]);
|
43
46
|
|
44
47
|
// Synthesize objects for comparison
|
45
|
-
const [before, after] =
|
48
|
+
const [before, after] = useMemo(() => {
|
49
|
+
return synthesizeComparable(event.changes);
|
50
|
+
}, [event.changes]);
|
46
51
|
|
47
52
|
// This clone is important since the state is used by react as potential values that are rendered
|
48
53
|
// and as a result may be decorated with additional properties, etc..., resulting in DOM elements
|
49
54
|
// appearing attached to state.
|
50
|
-
const changePreview =
|
51
|
-
event.changes,
|
52
|
-
|
53
|
-
isStore,
|
54
|
-
);
|
55
|
+
const changePreview = useMemo(() => {
|
56
|
+
return generatePreview(event.changes, structuredClone(after), isStore);
|
57
|
+
}, [event.changes, after, isStore]);
|
55
58
|
// Compute the title
|
56
59
|
const title = event.event === "state" ? "State Updated" : "Store Updated";
|
57
60
|
|
@@ -8,6 +8,7 @@ import {
|
|
8
8
|
ModelEvent,
|
9
9
|
SampleInitEvent,
|
10
10
|
SampleLimitEvent,
|
11
|
+
SandboxEvent,
|
11
12
|
ScoreEvent,
|
12
13
|
StateEvent,
|
13
14
|
StepEvent,
|
@@ -37,7 +38,8 @@ export type EventType =
|
|
37
38
|
| ToolEvent
|
38
39
|
| InputEvent
|
39
40
|
| ErrorEvent
|
40
|
-
| ApprovalEvent
|
41
|
+
| ApprovalEvent
|
42
|
+
| SandboxEvent;
|
41
43
|
|
42
44
|
export class EventNode {
|
43
45
|
event: EventType;
|