inspect-ai 0.3.58__py3-none-any.whl → 0.3.60__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.
Files changed (166) hide show
  1. inspect_ai/_cli/common.py +3 -1
  2. inspect_ai/_cli/eval.py +15 -9
  3. inspect_ai/_display/core/active.py +4 -1
  4. inspect_ai/_display/core/config.py +3 -3
  5. inspect_ai/_display/core/panel.py +7 -3
  6. inspect_ai/_display/plain/__init__.py +0 -0
  7. inspect_ai/_display/plain/display.py +203 -0
  8. inspect_ai/_display/rich/display.py +0 -5
  9. inspect_ai/_display/textual/widgets/port_mappings.py +110 -0
  10. inspect_ai/_display/textual/widgets/samples.py +79 -12
  11. inspect_ai/_display/textual/widgets/sandbox.py +37 -0
  12. inspect_ai/_eval/eval.py +10 -1
  13. inspect_ai/_eval/loader.py +79 -19
  14. inspect_ai/_eval/registry.py +6 -0
  15. inspect_ai/_eval/score.py +3 -1
  16. inspect_ai/_eval/task/results.py +51 -22
  17. inspect_ai/_eval/task/run.py +47 -13
  18. inspect_ai/_eval/task/sandbox.py +10 -5
  19. inspect_ai/_util/constants.py +1 -0
  20. inspect_ai/_util/port_names.py +61 -0
  21. inspect_ai/_util/text.py +23 -0
  22. inspect_ai/_view/www/App.css +31 -1
  23. inspect_ai/_view/www/dist/assets/index.css +31 -1
  24. inspect_ai/_view/www/dist/assets/index.js +25498 -2044
  25. inspect_ai/_view/www/log-schema.json +32 -2
  26. inspect_ai/_view/www/package.json +2 -0
  27. inspect_ai/_view/www/src/App.mjs +14 -16
  28. inspect_ai/_view/www/src/Types.mjs +1 -2
  29. inspect_ai/_view/www/src/api/Types.ts +133 -0
  30. inspect_ai/_view/www/src/api/{api-browser.mjs → api-browser.ts} +25 -13
  31. inspect_ai/_view/www/src/api/api-http.ts +219 -0
  32. inspect_ai/_view/www/src/api/api-shared.ts +47 -0
  33. inspect_ai/_view/www/src/api/{api-vscode.mjs → api-vscode.ts} +22 -19
  34. inspect_ai/_view/www/src/api/{client-api.mjs → client-api.ts} +93 -53
  35. inspect_ai/_view/www/src/api/index.ts +51 -0
  36. inspect_ai/_view/www/src/api/jsonrpc.ts +225 -0
  37. inspect_ai/_view/www/src/components/ChatView.mjs +133 -43
  38. inspect_ai/_view/www/src/components/DownloadButton.mjs +1 -1
  39. inspect_ai/_view/www/src/components/ExpandablePanel.mjs +0 -4
  40. inspect_ai/_view/www/src/components/LargeModal.mjs +19 -20
  41. inspect_ai/_view/www/src/components/TabSet.mjs +3 -1
  42. inspect_ai/_view/www/src/components/VirtualList.mjs +266 -84
  43. inspect_ai/_view/www/src/index.js +77 -4
  44. inspect_ai/_view/www/src/log/{remoteLogFile.mjs → remoteLogFile.ts} +62 -46
  45. inspect_ai/_view/www/src/navbar/Navbar.mjs +4 -1
  46. inspect_ai/_view/www/src/navbar/SecondaryBar.mjs +19 -10
  47. inspect_ai/_view/www/src/samples/SampleDialog.mjs +5 -1
  48. inspect_ai/_view/www/src/samples/SampleDisplay.mjs +23 -15
  49. inspect_ai/_view/www/src/samples/SampleList.mjs +19 -49
  50. inspect_ai/_view/www/src/samples/SampleScores.mjs +1 -1
  51. inspect_ai/_view/www/src/samples/SampleTranscript.mjs +8 -3
  52. inspect_ai/_view/www/src/samples/SamplesDescriptor.mjs +38 -26
  53. inspect_ai/_view/www/src/samples/SamplesTab.mjs +14 -11
  54. inspect_ai/_view/www/src/samples/SamplesTools.mjs +8 -8
  55. inspect_ai/_view/www/src/samples/tools/SampleFilter.mjs +712 -89
  56. inspect_ai/_view/www/src/samples/tools/SortFilter.mjs +2 -2
  57. inspect_ai/_view/www/src/samples/tools/filters.mjs +260 -87
  58. inspect_ai/_view/www/src/samples/transcript/ErrorEventView.mjs +24 -2
  59. inspect_ai/_view/www/src/samples/transcript/EventPanel.mjs +29 -24
  60. inspect_ai/_view/www/src/samples/transcript/EventRow.mjs +1 -1
  61. inspect_ai/_view/www/src/samples/transcript/InfoEventView.mjs +24 -2
  62. inspect_ai/_view/www/src/samples/transcript/InputEventView.mjs +24 -2
  63. inspect_ai/_view/www/src/samples/transcript/ModelEventView.mjs +31 -10
  64. inspect_ai/_view/www/src/samples/transcript/SampleInitEventView.mjs +24 -2
  65. inspect_ai/_view/www/src/samples/transcript/SampleLimitEventView.mjs +23 -2
  66. inspect_ai/_view/www/src/samples/transcript/ScoreEventView.mjs +24 -2
  67. inspect_ai/_view/www/src/samples/transcript/StepEventView.mjs +33 -3
  68. inspect_ai/_view/www/src/samples/transcript/SubtaskEventView.mjs +25 -2
  69. inspect_ai/_view/www/src/samples/transcript/ToolEventView.mjs +25 -2
  70. inspect_ai/_view/www/src/samples/transcript/TranscriptView.mjs +193 -11
  71. inspect_ai/_view/www/src/samples/transcript/Types.mjs +10 -0
  72. inspect_ai/_view/www/src/samples/transcript/state/StateEventView.mjs +26 -2
  73. inspect_ai/_view/www/src/types/log.d.ts +13 -2
  74. inspect_ai/_view/www/src/utils/Format.mjs +10 -3
  75. inspect_ai/_view/www/src/utils/{Json.mjs → json-worker.ts} +13 -9
  76. inspect_ai/_view/www/src/utils/vscode.ts +36 -0
  77. inspect_ai/_view/www/src/workspace/WorkSpace.mjs +11 -5
  78. inspect_ai/_view/www/vite.config.js +7 -0
  79. inspect_ai/_view/www/yarn.lock +116 -0
  80. inspect_ai/approval/_human/__init__.py +0 -0
  81. inspect_ai/approval/_human/manager.py +1 -1
  82. inspect_ai/approval/_policy.py +12 -6
  83. inspect_ai/log/_log.py +1 -1
  84. inspect_ai/log/_samples.py +16 -0
  85. inspect_ai/log/_transcript.py +4 -1
  86. inspect_ai/model/_call_tools.py +59 -0
  87. inspect_ai/model/_conversation.py +16 -7
  88. inspect_ai/model/_generate_config.py +12 -12
  89. inspect_ai/model/_model.py +117 -18
  90. inspect_ai/model/_model_output.py +22 -2
  91. inspect_ai/model/_openai.py +383 -0
  92. inspect_ai/model/_providers/anthropic.py +152 -55
  93. inspect_ai/model/_providers/azureai.py +21 -21
  94. inspect_ai/model/_providers/bedrock.py +37 -40
  95. inspect_ai/model/_providers/goodfire.py +248 -0
  96. inspect_ai/model/_providers/google.py +46 -54
  97. inspect_ai/model/_providers/groq.py +7 -3
  98. inspect_ai/model/_providers/hf.py +6 -0
  99. inspect_ai/model/_providers/mistral.py +13 -12
  100. inspect_ai/model/_providers/openai.py +51 -218
  101. inspect_ai/model/_providers/openai_o1.py +11 -12
  102. inspect_ai/model/_providers/providers.py +23 -1
  103. inspect_ai/model/_providers/together.py +12 -12
  104. inspect_ai/model/_providers/util/__init__.py +2 -3
  105. inspect_ai/model/_providers/util/hf_handler.py +1 -1
  106. inspect_ai/model/_providers/util/llama31.py +1 -1
  107. inspect_ai/model/_providers/util/util.py +0 -76
  108. inspect_ai/model/_providers/vertex.py +1 -4
  109. inspect_ai/scorer/_metric.py +3 -0
  110. inspect_ai/scorer/_reducer/reducer.py +1 -1
  111. inspect_ai/scorer/_scorer.py +4 -3
  112. inspect_ai/solver/__init__.py +4 -5
  113. inspect_ai/solver/_basic_agent.py +1 -1
  114. inspect_ai/solver/_bridge/__init__.py +3 -0
  115. inspect_ai/solver/_bridge/bridge.py +100 -0
  116. inspect_ai/solver/_bridge/patch.py +170 -0
  117. inspect_ai/solver/_prompt.py +35 -5
  118. inspect_ai/solver/_solver.py +6 -0
  119. inspect_ai/solver/_task_state.py +80 -38
  120. inspect_ai/tool/__init__.py +2 -0
  121. inspect_ai/tool/_tool.py +12 -1
  122. inspect_ai/tool/_tool_call.py +10 -0
  123. inspect_ai/tool/_tool_def.py +16 -5
  124. inspect_ai/tool/_tool_with.py +21 -4
  125. inspect_ai/tool/beta/__init__.py +5 -0
  126. inspect_ai/tool/beta/_computer/__init__.py +3 -0
  127. inspect_ai/tool/beta/_computer/_common.py +133 -0
  128. inspect_ai/tool/beta/_computer/_computer.py +155 -0
  129. inspect_ai/tool/beta/_computer/_computer_split.py +198 -0
  130. inspect_ai/tool/beta/_computer/_resources/Dockerfile +100 -0
  131. inspect_ai/tool/beta/_computer/_resources/README.md +30 -0
  132. inspect_ai/tool/beta/_computer/_resources/entrypoint/entrypoint.sh +18 -0
  133. inspect_ai/tool/beta/_computer/_resources/entrypoint/novnc_startup.sh +20 -0
  134. inspect_ai/tool/beta/_computer/_resources/entrypoint/x11vnc_startup.sh +48 -0
  135. inspect_ai/tool/beta/_computer/_resources/entrypoint/xfce_startup.sh +13 -0
  136. inspect_ai/tool/beta/_computer/_resources/entrypoint/xvfb_startup.sh +48 -0
  137. inspect_ai/tool/beta/_computer/_resources/image_home_dir/Desktop/Firefox Web Browser.desktop +10 -0
  138. inspect_ai/tool/beta/_computer/_resources/image_home_dir/Desktop/Visual Studio Code.desktop +10 -0
  139. inspect_ai/tool/beta/_computer/_resources/image_home_dir/Desktop/XPaint.desktop +10 -0
  140. inspect_ai/tool/beta/_computer/_resources/tool/__init__.py +0 -0
  141. inspect_ai/tool/beta/_computer/_resources/tool/_logger.py +22 -0
  142. inspect_ai/tool/beta/_computer/_resources/tool/_run.py +42 -0
  143. inspect_ai/tool/beta/_computer/_resources/tool/_tool_result.py +33 -0
  144. inspect_ai/tool/beta/_computer/_resources/tool/_x11_client.py +262 -0
  145. inspect_ai/tool/beta/_computer/_resources/tool/computer_tool.py +85 -0
  146. inspect_ai/tool/beta/_computer/_resources/tool/requirements.txt +0 -0
  147. inspect_ai/util/__init__.py +2 -0
  148. inspect_ai/util/_display.py +5 -0
  149. inspect_ai/util/_limit.py +26 -0
  150. inspect_ai/util/_sandbox/docker/docker.py +64 -1
  151. inspect_ai/util/_sandbox/docker/internal.py +3 -1
  152. inspect_ai/util/_sandbox/docker/prereqs.py +1 -1
  153. inspect_ai/util/_sandbox/environment.py +14 -0
  154. {inspect_ai-0.3.58.dist-info → inspect_ai-0.3.60.dist-info}/METADATA +3 -2
  155. {inspect_ai-0.3.58.dist-info → inspect_ai-0.3.60.dist-info}/RECORD +159 -126
  156. inspect_ai/_view/www/src/api/Types.mjs +0 -117
  157. inspect_ai/_view/www/src/api/api-http.mjs +0 -300
  158. inspect_ai/_view/www/src/api/api-shared.mjs +0 -10
  159. inspect_ai/_view/www/src/api/index.mjs +0 -49
  160. inspect_ai/_view/www/src/api/jsonrpc.mjs +0 -208
  161. inspect_ai/_view/www/src/samples/transcript/TranscriptState.mjs +0 -70
  162. inspect_ai/_view/www/src/utils/vscode.mjs +0 -16
  163. {inspect_ai-0.3.58.dist-info → inspect_ai-0.3.60.dist-info}/LICENSE +0 -0
  164. {inspect_ai-0.3.58.dist-info → inspect_ai-0.3.60.dist-info}/WHEEL +0 -0
  165. {inspect_ai-0.3.58.dist-info → inspect_ai-0.3.60.dist-info}/entry_points.txt +0 -0
  166. {inspect_ai-0.3.58.dist-info → inspect_ai-0.3.60.dist-info}/top_level.txt +0 -0
@@ -6,7 +6,7 @@ import "prismjs/components/prism-bash";
6
6
  import "prismjs/components/prism-json";
7
7
 
8
8
  import { html } from "htm/preact";
9
- import { useEffect, useRef } from "preact/hooks";
9
+ import { useEffect, useMemo, useRef } from "preact/hooks";
10
10
  import { ChatView } from "../../components/ChatView.mjs";
11
11
  import { EventPanel } from "./EventPanel.mjs";
12
12
  import { EventSection } from "./EventSection.mjs";
@@ -26,11 +26,19 @@ import {
26
26
  * @param {Object} props - The properties passed to the component.
27
27
  * @param { string } props.id - The id of this event.
28
28
  * @param {import("../../types/log").ModelEvent} props.event - The event object to display.
29
+ * @param {import("./Types.mjs").TranscriptEventState} props.eventState - The state for this event
30
+ * @param {(state: import("./Types.mjs").TranscriptEventState) => void} props.setEventState - Update the state for this event
29
31
  * @param { Object } props.style - The style of this event.
30
32
  * @param {string} props.baseId - The baseId of the event.
31
33
  * @returns {import("preact").JSX.Element} The component.
32
34
  */
33
- export const ModelEventView = ({ id, event, style }) => {
35
+ export const ModelEventView = ({
36
+ id,
37
+ event,
38
+ eventState,
39
+ setEventState,
40
+ style,
41
+ }) => {
34
42
  const totalUsage = event.output.usage?.total_tokens;
35
43
  const callTime = event.output.time;
36
44
 
@@ -72,7 +80,21 @@ export const ModelEventView = ({ id, event, style }) => {
72
80
  }
73
81
 
74
82
  return html`
75
- <${EventPanel} id=${id} title="Model Call: ${event.model} ${subtitle}" subTitle=${formatDateTime(new Date(event.timestamp))} icon=${ApplicationIcons.model} style=${style}>
83
+ <${EventPanel}
84
+ id=${id}
85
+ title="Model Call: ${event.model} ${subtitle}"
86
+ subTitle=${formatDateTime(new Date(event.timestamp))}
87
+ icon=${ApplicationIcons.model}
88
+ style=${style}
89
+ selectedNav=${eventState.selectedNav || ""}
90
+ onSelectedNav=${(selectedNav) => {
91
+ setEventState({ ...eventState, selectedNav });
92
+ }}
93
+ collapsed=${eventState.collapsed}
94
+ onCollapsed=${(collapsed) => {
95
+ setEventState({ ...eventState, collapsed });
96
+ }}
97
+ >
76
98
 
77
99
  <div name="Summary" style=${{ margin: "0.5em 0" }}>
78
100
  <${ChatView}
@@ -137,17 +159,15 @@ export const APICodeCell = ({ id, contents }) => {
137
159
  return "";
138
160
  }
139
161
 
140
- const sourceCode = JSON.stringify(contents, undefined, 2);
141
162
  const codeRef = useRef();
163
+ const sourceCode = useMemo(() => {
164
+ return JSON.stringify(contents, undefined, 2);
165
+ }, [contents]);
142
166
 
143
167
  useEffect(() => {
144
168
  if (codeRef.current) {
145
169
  // @ts-ignore
146
- codeRef.current.innerHTML = Prism.highlight(
147
- sourceCode,
148
- Prism.languages.javascript,
149
- "javacript",
150
- );
170
+ Prism.highlightElement(codeRef.current);
151
171
  }
152
172
  }, [codeRef.current, contents]);
153
173
 
@@ -163,12 +183,13 @@ export const APICodeCell = ({ id, contents }) => {
163
183
  <code
164
184
  id=${id}
165
185
  ref=${codeRef}
166
- class="sourceCode-js"
186
+ class="language-json"
167
187
  style=${{
168
188
  fontSize: FontSize.small,
169
189
  whiteSpace: "pre-wrap",
170
190
  wordWrap: "anywhere",
171
191
  }}>
192
+ ${sourceCode}
172
193
  </code>
173
194
  </pre>
174
195
  </div>`;
@@ -15,9 +15,17 @@ import { formatDateTime } from "../../utils/Format.mjs";
15
15
  * @param { string } props.id - The id of this event.
16
16
  * @param {import("../../types/log").SampleInitEvent} props.event - The event object to display.
17
17
  * @param {Object} props.style - The style for this view
18
+ * @param {import("./Types.mjs").TranscriptEventState} props.eventState - The state for this event
19
+ * @param {(state: import("./Types.mjs").TranscriptEventState) => void} props.setEventState - Update the state for this event
18
20
  * @returns {import("preact").JSX.Element} The component.
19
21
  */
20
- export const SampleInitEventView = ({ id, event, style }) => {
22
+ export const SampleInitEventView = ({
23
+ id,
24
+ event,
25
+ style,
26
+ eventState,
27
+ setEventState,
28
+ }) => {
21
29
  /**
22
30
  * @type {Record<string, unknown>}
23
31
  */
@@ -43,7 +51,21 @@ export const SampleInitEventView = ({ id, event, style }) => {
43
51
  }
44
52
 
45
53
  return html`
46
- <${EventPanel} id=${id} style=${style} title="Sample" icon=${ApplicationIcons.sample} subTitle=${formatDateTime(new Date(event.timestamp))}>
54
+ <${EventPanel}
55
+ id=${id}
56
+ style=${style}
57
+ title="Sample"
58
+ icon=${ApplicationIcons.sample}
59
+ subTitle=${formatDateTime(new Date(event.timestamp))}
60
+ selectedNav=${eventState.selectedNav || ""}
61
+ onSelectedNav=${(selectedNav) => {
62
+ setEventState({ ...eventState, selectedNav });
63
+ }}
64
+ collapsed=${eventState.collapsed}
65
+ onCollapsed=${(collapsed) => {
66
+ setEventState({ ...eventState, collapsed });
67
+ }}
68
+ >
47
69
  <div name="Sample" style=${{ margin: "1em 0em" }}>
48
70
  <${ChatView} messages=${stateObj["messages"]}/>
49
71
  <div>
@@ -10,9 +10,17 @@ import { EventPanel } from "./EventPanel.mjs";
10
10
  * @param { string } props.id - The id of this event.
11
11
  * @param { Object } props.style - The style of this event.
12
12
  * @param {import("../../types/log").SampleLimitEvent} props.event - The event object to display.
13
+ * @param {import("./Types.mjs").TranscriptEventState} props.eventState - The state for this event
14
+ * @param {(state: import("./Types.mjs").TranscriptEventState) => void} props.setEventState - Update the state for this event
13
15
  * @returns {import("preact").JSX.Element} The component.
14
16
  */
15
- export const SampleLimitEventView = ({ id, event, style }) => {
17
+ export const SampleLimitEventView = ({
18
+ id,
19
+ event,
20
+ eventState,
21
+ setEventState,
22
+ style,
23
+ }) => {
16
24
  const resolve_title = (type) => {
17
25
  switch (type) {
18
26
  case "context":
@@ -47,7 +55,20 @@ export const SampleLimitEventView = ({ id, event, style }) => {
47
55
  const icon = resolve_icon(event.type);
48
56
 
49
57
  return html`
50
- <${EventPanel} id=${id} title=${title} icon=${icon} style=${style}>
58
+ <${EventPanel}
59
+ id=${id}
60
+ title=${title}
61
+ icon=${icon}
62
+ style=${style}
63
+ selectedNav=${eventState.selectedNav || ""}
64
+ onSelectedNav=${(selectedNav) => {
65
+ setEventState({ ...eventState, selectedNav });
66
+ }}
67
+ collapsed=${eventState.collapsed}
68
+ onCollapsed=${(collapsed) => {
69
+ setEventState({ ...eventState, collapsed });
70
+ }}
71
+ >
51
72
  ${event.message}
52
73
  </${EventPanel}>`;
53
74
  };
@@ -14,9 +14,17 @@ import { formatDateTime } from "../../utils/Format.mjs";
14
14
  * @param { string } props.id - The id of this event.
15
15
  * @param {Object} props.style - The style properties passed to the component.
16
16
  * @param {import("../../types/log").ScoreEvent} props.event - The event object to display.
17
+ * @param {import("./Types.mjs").TranscriptEventState} props.eventState - The state for this event
18
+ * @param {(state: import("./Types.mjs").TranscriptEventState) => void} props.setEventState - Update the state for this event
17
19
  * @returns {import("preact").JSX.Element} The component.
18
20
  */
19
- export const ScoreEventView = ({ id, event, style }) => {
21
+ export const ScoreEventView = ({
22
+ id,
23
+ event,
24
+ eventState,
25
+ setEventState,
26
+ style,
27
+ }) => {
20
28
  const resolvedTarget = event.target
21
29
  ? Array.isArray(event.target)
22
30
  ? event.target.join("\n")
@@ -24,7 +32,21 @@ export const ScoreEventView = ({ id, event, style }) => {
24
32
  : undefined;
25
33
 
26
34
  return html`
27
- <${EventPanel} id=${id} title="Score" subTitle=${formatDateTime(new Date(event.timestamp))} icon=${ApplicationIcons.scorer} style=${style}>
35
+ <${EventPanel}
36
+ id=${id}
37
+ title="Score"
38
+ subTitle=${formatDateTime(new Date(event.timestamp))}
39
+ icon=${ApplicationIcons.scorer}
40
+ style=${style}
41
+ selectedNav=${eventState.selectedNav || ""}
42
+ onSelectedNav=${(selectedNav) => {
43
+ setEventState({ ...eventState, selectedNav });
44
+ }}
45
+ collapsed=${eventState.collapsed}
46
+ onCollapsed=${(collapsed) => {
47
+ setEventState({ ...eventState, collapsed });
48
+ }}
49
+ >
28
50
 
29
51
  <div
30
52
  name="Explanation"
@@ -1,7 +1,8 @@
1
1
  // @ts-check
2
2
  import { html } from "htm/preact";
3
+ import { useCallback, useState } from "preact/hooks";
3
4
  import { EventPanel } from "./EventPanel.mjs";
4
- import { TranscriptComponent } from "./TranscriptView.mjs";
5
+ import { TranscriptVirtualListComponent } from "./TranscriptView.mjs";
5
6
  import { formatDateTime } from "../../utils/Format.mjs";
6
7
 
7
8
  /**
@@ -10,16 +11,34 @@ import { formatDateTime } from "../../utils/Format.mjs";
10
11
  * @param {Object} props - The properties passed to the component.
11
12
  * @param {Object} props.style - The style properties passed to the component.
12
13
  * @param {import("../../types/log").StepEvent} props.event - The event object to display.
14
+ * @param {import("./Types.mjs").TranscriptEventState} props.eventState - The state for this event
15
+ * @param {(state: import("./Types.mjs").TranscriptEventState) => void} props.setEventState - Update the state for this event
13
16
  * @param {import("./Types.mjs").EventNode[]} props.children - The event notes children of this step
17
+ * @param {import("htm/preact").MutableRef<HTMLElement>} props.scrollRef - The scrollable parent element
14
18
  * @returns {import("preact").JSX.Element} The component that displays event details.
15
19
  */
16
- export const StepEventView = ({ event, children, style }) => {
20
+ export const StepEventView = ({
21
+ event,
22
+ eventState,
23
+ setEventState,
24
+ children,
25
+ style,
26
+ scrollRef,
27
+ }) => {
17
28
  const descriptor = stepDescriptor(event);
18
29
  const title =
19
30
  descriptor.name ||
20
31
  `${event.type ? event.type + ": " : "Step: "}${event.name}`;
21
32
  const text = summarize(children);
22
33
 
34
+ const [transcriptState, setTranscriptState] = useState({});
35
+ const onTranscriptState = useCallback(
36
+ (state) => {
37
+ setTranscriptState({ ...state });
38
+ },
39
+ [transcriptState, setTranscriptState],
40
+ );
41
+
23
42
  return html`<${EventPanel}
24
43
  id=${`step-${event.name}`}
25
44
  classes="transcript-step"
@@ -30,10 +49,21 @@ export const StepEventView = ({ event, children, style }) => {
30
49
  titleStyle=${{ ...descriptor.titleStyle }}
31
50
  collapse=${false}
32
51
  text=${text}
52
+ selectedNav=${eventState.selectedNav || ""}
53
+ onSelectedNav=${(selectedNav) => {
54
+ setEventState({ ...eventState, selectedNav });
55
+ }}
56
+ collapsed=${eventState.collapsed}
57
+ onCollapsed=${(collapsed) => {
58
+ setEventState({ ...eventState, collapsed });
59
+ }}
33
60
  >
34
- <${TranscriptComponent}
61
+ <${TranscriptVirtualListComponent}
35
62
  id=${`step-${event.name}-transcript`}
36
63
  eventNodes=${children}
64
+ scrollRef=${scrollRef}
65
+ transcriptState=${transcriptState}
66
+ setTranscriptState=${onTranscriptState}
37
67
  />
38
68
  </EventPanel>
39
69
  `;
@@ -14,10 +14,19 @@ import { formatDateTime } from "../../utils/Format.mjs";
14
14
  * @param { string } props.id - The id of this event.
15
15
  * @param { Object } props.style - The style of this event.
16
16
  * @param {import("../../types/log").SubtaskEvent} props.event - The event object to display.
17
+ * @param {import("./Types.mjs").TranscriptEventState} props.eventState - The state for this event
18
+ * @param {(state: import("./Types.mjs").TranscriptEventState) => void} props.setEventState - Update the state for this event
17
19
  * @param { Object } props.depth - The depth of this event.
18
20
  * @returns {import("preact").JSX.Element} The component.
19
21
  */
20
- export const SubtaskEventView = ({ id, event, style, depth }) => {
22
+ export const SubtaskEventView = ({
23
+ id,
24
+ event,
25
+ eventState,
26
+ setEventState,
27
+ style,
28
+ depth,
29
+ }) => {
21
30
  // Render Forks specially
22
31
 
23
32
  const transcript =
@@ -54,7 +63,21 @@ export const SubtaskEventView = ({ id, event, style, depth }) => {
54
63
  // Is this a traditional subtask or a fork?
55
64
  const type = event.type === "fork" ? "Fork" : "Subtask";
56
65
  return html`
57
- <${EventPanel} id=${id} title="${type}: ${event.name}" subTitle=${formatDateTime(new Date(event.timestamp))} style=${style} collapse=${false}>
66
+ <${EventPanel}
67
+ id=${id}
68
+ title="${type}: ${event.name}"
69
+ subTitle=${formatDateTime(new Date(event.timestamp))}
70
+ style=${style}
71
+ collapse=${false}
72
+ selectedNav=${eventState.selectedNav || ""}
73
+ onSelectedNav=${(selectedNav) => {
74
+ setEventState({ ...eventState, selectedNav });
75
+ }}
76
+ collapsed=${eventState.collapsed}
77
+ onCollapsed=${(collapsed) => {
78
+ setEventState({ ...eventState, collapsed });
79
+ }}
80
+ >
58
81
  ${body}
59
82
  </${EventPanel}>`;
60
83
  };
@@ -13,11 +13,20 @@ import { formatDateTime } from "../../utils/Format.mjs";
13
13
  * @param {Object} props - The properties passed to the component.
14
14
  * @param { string } props.id - The id of this event.
15
15
  * @param {import("../../types/log").ToolEvent} props.event - The event object to display.
16
+ * @param {import("./Types.mjs").TranscriptEventState} props.eventState - The state for this event
17
+ * @param {(state: import("./Types.mjs").TranscriptEventState) => void} props.setEventState - Update the state for this event
16
18
  * @param { Object } props.style - The style of this event.
17
19
  * @param { number } props.depth - The depth of this event.
18
20
  * @returns {import("preact").JSX.Element} The component.
19
21
  */
20
- export const ToolEventView = ({ id, event, style, depth }) => {
22
+ export const ToolEventView = ({
23
+ id,
24
+ event,
25
+ eventState,
26
+ setEventState,
27
+ style,
28
+ depth,
29
+ }) => {
21
30
  // Extract tool input
22
31
  const { input, functionCall, inputType } = resolveToolInput(
23
32
  event.function,
@@ -31,7 +40,21 @@ export const ToolEventView = ({ id, event, style, depth }) => {
31
40
 
32
41
  const title = `Tool: ${event.view?.title || event.function}`;
33
42
  return html`
34
- <${EventPanel} id=${id} title="${title}" subTitle=${formatDateTime(new Date(event.timestamp))} icon=${ApplicationIcons.solvers.use_tools} style=${style}>
43
+ <${EventPanel}
44
+ id=${id}
45
+ title="${title}"
46
+ subTitle=${formatDateTime(new Date(event.timestamp))}
47
+ icon=${ApplicationIcons.solvers.use_tools}
48
+ style=${style}
49
+ selectedNav=${eventState.selectedNav || ""}
50
+ onSelectedNav=${(selectedNav) => {
51
+ setEventState({ ...eventState, selectedNav });
52
+ }}
53
+ collapsed=${eventState.collapsed}
54
+ onCollapsed=${(collapsed) => {
55
+ setEventState({ ...eventState, collapsed });
56
+ }}
57
+ >
35
58
  <div name="Summary" style=${{ margin: "0.5em 0", width: "100%" }}>
36
59
  <${ToolCallView}
37
60
  functionCall=${functionCall}