@bolt-foundry/gambit 0.8.6-rc.6 → 0.8.6-rc.7
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.
- package/CHANGELOG.md +5 -1
- package/esm/gambit/simulator-ui/dist/bundle.js +1304 -2405
- package/esm/gambit/simulator-ui/dist/bundle.js.map +4 -4
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorGradePage/normalization_ast.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorGradePage/normalization_ast.js +5 -0
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorGradePage/query_text.d.ts +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorGradePage/query_text.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorGradePage/query_text.js +1 -0
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorGradePage/raw_response_type.d.ts +1 -0
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorGradePage/raw_response_type.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/normalization_ast.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/normalization_ast.js +5 -0
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/query_text.d.ts +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/query_text.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/query_text.js +1 -0
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/raw_response_type.d.ts +1 -0
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/raw_response_type.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorVerifyPage/normalization_ast.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorVerifyPage/normalization_ast.js +5 -0
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorVerifyPage/query_text.d.ts +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorVerifyPage/query_text.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorVerifyPage/query_text.js +1 -0
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorVerifyPage/raw_response_type.d.ts +1 -0
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorVerifyPage/raw_response_type.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorWorkspaceShell/normalization_ast.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorWorkspaceShell/normalization_ast.js +5 -0
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorWorkspaceShell/query_text.d.ts +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorWorkspaceShell/query_text.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorWorkspaceShell/query_text.js +1 -0
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorWorkspaceShell/raw_response_type.d.ts +1 -0
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorWorkspaceShell/raw_response_type.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Workspace/GradeTab/param_type.d.ts +65 -0
- package/esm/simulator-ui/__generated__/__isograph/Workspace/GradeTab/param_type.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Workspace/GradeTab/resolver_reader.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Workspace/GradeTab/resolver_reader.js +8 -1
- package/esm/simulator-ui/__generated__/__isograph/Workspace/TestTab/param_type.d.ts +82 -0
- package/esm/simulator-ui/__generated__/__isograph/Workspace/TestTab/param_type.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Workspace/TestTab/resolver_reader.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Workspace/TestTab/resolver_reader.js +8 -1
- package/esm/simulator-ui/__generated__/__isograph/Workspace/VerifyTab/param_type.d.ts +106 -0
- package/esm/simulator-ui/__generated__/__isograph/Workspace/VerifyTab/param_type.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Workspace/VerifyTab/resolver_reader.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Workspace/VerifyTab/resolver_reader.js +8 -1
- package/esm/simulator-ui/__generated__/__isograph/Workspace/WorkbenchChatDrawer/param_type.d.ts +32 -0
- package/esm/simulator-ui/__generated__/__isograph/Workspace/WorkbenchChatDrawer/param_type.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Workspace/WorkbenchChatDrawer/resolver_reader.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Workspace/WorkbenchChatDrawer/resolver_reader.js +8 -1
- package/esm/simulator-ui/isograph/components/Query/SimulatorGradePage.d.ts.map +1 -1
- package/esm/simulator-ui/isograph/components/Query/SimulatorGradePage.js +76 -2
- package/esm/simulator-ui/isograph/components/Query/SimulatorTestPage.d.ts.map +1 -1
- package/esm/simulator-ui/isograph/components/Query/SimulatorTestPage.js +80 -6
- package/esm/simulator-ui/isograph/components/Query/SimulatorVerifyPage.d.ts.map +1 -1
- package/esm/simulator-ui/isograph/components/Query/SimulatorVerifyPage.js +24 -1
- package/esm/simulator-ui/isograph/components/Workspace/WorkbenchChatDrawer.d.ts.map +1 -1
- package/esm/simulator-ui/isograph/components/Workspace/WorkbenchChatDrawer.js +16 -6
- package/esm/simulator-ui/isograph/components/WorkspaceConversationRun/WorkbenchConversationRunChat.d.ts +4 -0
- package/esm/simulator-ui/isograph/components/WorkspaceConversationRun/WorkbenchConversationRunChat.d.ts.map +1 -1
- package/esm/simulator-ui/isograph/components/WorkspaceConversationRun/WorkbenchConversationRunChat.js +59 -24
- package/esm/simulator-ui/isograph/components/grade/GradeTabView.d.ts +14 -0
- package/esm/simulator-ui/isograph/components/grade/GradeTabView.d.ts.map +1 -1
- package/esm/simulator-ui/isograph/components/grade/GradeTabView.js +1 -1
- package/esm/simulator-ui/src/AppShell.d.ts.map +1 -1
- package/esm/simulator-ui/src/AppShell.js +6 -6
- package/esm/simulator-ui/src/Chat.d.ts +6 -30
- package/esm/simulator-ui/src/Chat.d.ts.map +1 -1
- package/esm/simulator-ui/src/Chat.js +14 -109
- package/esm/simulator-ui/src/TestBotChatPanel.d.ts +2 -0
- package/esm/simulator-ui/src/TestBotChatPanel.d.ts.map +1 -1
- package/esm/simulator-ui/src/TestBotChatPanel.js +2 -2
- package/esm/simulator-ui/src/WorkbenchDrawerIso.d.ts +2 -0
- package/esm/simulator-ui/src/WorkbenchDrawerIso.d.ts.map +1 -1
- package/esm/simulator-ui/src/WorkbenchDrawerIso.js +3 -1
- package/esm/simulator-ui/src/gds/WorkbenchComposerChip.d.ts +2 -17
- package/esm/simulator-ui/src/gds/WorkbenchComposerChip.d.ts.map +1 -1
- package/esm/simulator-ui/src/grade/GradeResultsPanel.d.ts +10 -0
- package/esm/simulator-ui/src/grade/GradeResultsPanel.d.ts.map +1 -1
- package/esm/simulator-ui/src/grade/GradeResultsPanel.js +16 -1
- package/esm/simulator-ui/src/shared.d.ts +1 -0
- package/esm/simulator-ui/src/shared.d.ts.map +1 -1
- package/esm/simulator-ui/src/shared.js +4 -2
- package/esm/simulator-ui/src/workbenchChipStore.d.ts +12 -0
- package/esm/simulator-ui/src/workbenchChipStore.d.ts.map +1 -0
- package/esm/simulator-ui/src/workbenchChipStore.js +69 -0
- package/esm/simulator-ui/src/workbenchContext.d.ts +50 -0
- package/esm/simulator-ui/src/workbenchContext.d.ts.map +1 -0
- package/esm/simulator-ui/src/workbenchContext.js +159 -0
- package/esm/src/simulator_graphql.d.ts.map +1 -1
- package/esm/src/simulator_graphql.js +5 -0
- package/package.json +1 -1
- package/script/gambit/simulator-ui/dist/bundle.js +1304 -2405
- package/script/gambit/simulator-ui/dist/bundle.js.map +4 -4
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorGradePage/normalization_ast.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorGradePage/normalization_ast.js +5 -0
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorGradePage/query_text.d.ts +1 -1
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorGradePage/query_text.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorGradePage/query_text.js +1 -0
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorGradePage/raw_response_type.d.ts +1 -0
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorGradePage/raw_response_type.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/normalization_ast.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/normalization_ast.js +5 -0
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/query_text.d.ts +1 -1
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/query_text.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/query_text.js +1 -0
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/raw_response_type.d.ts +1 -0
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/raw_response_type.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorVerifyPage/normalization_ast.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorVerifyPage/normalization_ast.js +5 -0
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorVerifyPage/query_text.d.ts +1 -1
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorVerifyPage/query_text.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorVerifyPage/query_text.js +1 -0
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorVerifyPage/raw_response_type.d.ts +1 -0
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorVerifyPage/raw_response_type.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorWorkspaceShell/normalization_ast.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorWorkspaceShell/normalization_ast.js +5 -0
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorWorkspaceShell/query_text.d.ts +1 -1
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorWorkspaceShell/query_text.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorWorkspaceShell/query_text.js +1 -0
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorWorkspaceShell/raw_response_type.d.ts +1 -0
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorWorkspaceShell/raw_response_type.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Workspace/GradeTab/param_type.d.ts +65 -0
- package/script/simulator-ui/__generated__/__isograph/Workspace/GradeTab/param_type.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Workspace/GradeTab/resolver_reader.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Workspace/GradeTab/resolver_reader.js +8 -1
- package/script/simulator-ui/__generated__/__isograph/Workspace/TestTab/param_type.d.ts +82 -0
- package/script/simulator-ui/__generated__/__isograph/Workspace/TestTab/param_type.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Workspace/TestTab/resolver_reader.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Workspace/TestTab/resolver_reader.js +8 -1
- package/script/simulator-ui/__generated__/__isograph/Workspace/VerifyTab/param_type.d.ts +106 -0
- package/script/simulator-ui/__generated__/__isograph/Workspace/VerifyTab/param_type.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Workspace/VerifyTab/resolver_reader.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Workspace/VerifyTab/resolver_reader.js +8 -1
- package/script/simulator-ui/__generated__/__isograph/Workspace/WorkbenchChatDrawer/param_type.d.ts +32 -0
- package/script/simulator-ui/__generated__/__isograph/Workspace/WorkbenchChatDrawer/param_type.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Workspace/WorkbenchChatDrawer/resolver_reader.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Workspace/WorkbenchChatDrawer/resolver_reader.js +8 -1
- package/script/simulator-ui/isograph/components/Query/SimulatorGradePage.d.ts.map +1 -1
- package/script/simulator-ui/isograph/components/Query/SimulatorGradePage.js +109 -2
- package/script/simulator-ui/isograph/components/Query/SimulatorTestPage.d.ts.map +1 -1
- package/script/simulator-ui/isograph/components/Query/SimulatorTestPage.js +113 -6
- package/script/simulator-ui/isograph/components/Query/SimulatorVerifyPage.d.ts.map +1 -1
- package/script/simulator-ui/isograph/components/Query/SimulatorVerifyPage.js +24 -1
- package/script/simulator-ui/isograph/components/Workspace/WorkbenchChatDrawer.d.ts.map +1 -1
- package/script/simulator-ui/isograph/components/Workspace/WorkbenchChatDrawer.js +16 -6
- package/script/simulator-ui/isograph/components/WorkspaceConversationRun/WorkbenchConversationRunChat.d.ts +4 -0
- package/script/simulator-ui/isograph/components/WorkspaceConversationRun/WorkbenchConversationRunChat.d.ts.map +1 -1
- package/script/simulator-ui/isograph/components/WorkspaceConversationRun/WorkbenchConversationRunChat.js +58 -23
- package/script/simulator-ui/isograph/components/grade/GradeTabView.d.ts +14 -0
- package/script/simulator-ui/isograph/components/grade/GradeTabView.d.ts.map +1 -1
- package/script/simulator-ui/isograph/components/grade/GradeTabView.js +1 -1
- package/script/simulator-ui/src/AppShell.d.ts.map +1 -1
- package/script/simulator-ui/src/AppShell.js +6 -6
- package/script/simulator-ui/src/Chat.d.ts +6 -30
- package/script/simulator-ui/src/Chat.d.ts.map +1 -1
- package/script/simulator-ui/src/Chat.js +14 -109
- package/script/simulator-ui/src/TestBotChatPanel.d.ts +2 -0
- package/script/simulator-ui/src/TestBotChatPanel.d.ts.map +1 -1
- package/script/simulator-ui/src/TestBotChatPanel.js +2 -2
- package/script/simulator-ui/src/WorkbenchDrawerIso.d.ts +2 -0
- package/script/simulator-ui/src/WorkbenchDrawerIso.d.ts.map +1 -1
- package/script/simulator-ui/src/WorkbenchDrawerIso.js +3 -1
- package/script/simulator-ui/src/gds/WorkbenchComposerChip.d.ts +2 -17
- package/script/simulator-ui/src/gds/WorkbenchComposerChip.d.ts.map +1 -1
- package/script/simulator-ui/src/grade/GradeResultsPanel.d.ts +10 -0
- package/script/simulator-ui/src/grade/GradeResultsPanel.d.ts.map +1 -1
- package/script/simulator-ui/src/grade/GradeResultsPanel.js +16 -1
- package/script/simulator-ui/src/shared.d.ts +1 -0
- package/script/simulator-ui/src/shared.d.ts.map +1 -1
- package/script/simulator-ui/src/shared.js +4 -2
- package/script/simulator-ui/src/workbenchChipStore.d.ts +12 -0
- package/script/simulator-ui/src/workbenchChipStore.d.ts.map +1 -0
- package/script/simulator-ui/src/workbenchChipStore.js +108 -0
- package/script/simulator-ui/src/workbenchContext.d.ts +50 -0
- package/script/simulator-ui/src/workbenchContext.d.ts.map +1 -0
- package/script/simulator-ui/src/workbenchContext.js +165 -0
- package/script/src/simulator_graphql.d.ts.map +1 -1
- package/script/src/simulator_graphql.js +5 -0
- package/esm/simulator-ui/src/ProviderLoginPanel.d.ts +0 -8
- package/esm/simulator-ui/src/ProviderLoginPanel.d.ts.map +0 -1
- package/esm/simulator-ui/src/ProviderLoginPanel.js +0 -156
- package/esm/simulator-ui/src/WorkbenchDrawer.d.ts +0 -38
- package/esm/simulator-ui/src/WorkbenchDrawer.d.ts.map +0 -1
- package/esm/simulator-ui/src/WorkbenchDrawer.js +0 -716
- package/esm/simulator-ui/src/gds/Accordion.d.ts +0 -19
- package/esm/simulator-ui/src/gds/Accordion.d.ts.map +0 -1
- package/esm/simulator-ui/src/gds/Accordion.js +0 -47
- package/script/simulator-ui/src/ProviderLoginPanel.d.ts +0 -8
- package/script/simulator-ui/src/ProviderLoginPanel.d.ts.map +0 -1
- package/script/simulator-ui/src/ProviderLoginPanel.js +0 -162
- package/script/simulator-ui/src/WorkbenchDrawer.d.ts +0 -38
- package/script/simulator-ui/src/WorkbenchDrawer.d.ts.map +0 -1
- package/script/simulator-ui/src/WorkbenchDrawer.js +0 -722
- package/script/simulator-ui/src/gds/Accordion.d.ts +0 -19
- package/script/simulator-ui/src/gds/Accordion.d.ts.map +0 -1
- package/script/simulator-ui/src/gds/Accordion.js +0 -86
|
@@ -1,716 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect, useMemo, useReducer, useRef, useState, } from "react";
|
|
2
|
-
import { WORKSPACES_API_BASE } from "../../src/workspace_contract.js";
|
|
3
|
-
import Button from "./gds/Button.js";
|
|
4
|
-
import Badge from "./gds/Badge.js";
|
|
5
|
-
import Icon from "./gds/Icon.js";
|
|
6
|
-
import ScrollingText from "./gds/ScrollingText.js";
|
|
7
|
-
import Callout from "./gds/Callout.js";
|
|
8
|
-
import Chat from "./Chat.js";
|
|
9
|
-
import Accordion from "./gds/Accordion.js";
|
|
10
|
-
import Listbox from "./gds/Listbox.js";
|
|
11
|
-
import CodexLoginRequiredOverlay from "./CodexLoginRequiredOverlay.js";
|
|
12
|
-
import { useBuildChat } from "./BuildChatContext.js";
|
|
13
|
-
import List from "./gds/List.js";
|
|
14
|
-
import ListItem from "./gds/ListItem.js";
|
|
15
|
-
import ProviderLoginPanel from "./ProviderLoginPanel.js";
|
|
16
|
-
import { chatAccordionEnabled, extractGradingFlags, extractScoreAndReason, extractTurnContext, formatSnippet, formatTimestampShort, getScoreClass, } from "./utils.js";
|
|
17
|
-
const initialCodexOverlayState = {
|
|
18
|
-
copiedCodexLoginCommand: false,
|
|
19
|
-
codexLoginRecheckPending: false,
|
|
20
|
-
showCodexLoginRecheck: false,
|
|
21
|
-
codexAutoRecheckActive: false,
|
|
22
|
-
codexWorkspaceLoggedIn: null,
|
|
23
|
-
codexLoginError: null,
|
|
24
|
-
codexLoginStatusText: null,
|
|
25
|
-
codexLoginOverlayDismissed: false,
|
|
26
|
-
};
|
|
27
|
-
function codexOverlayReducer(state, action) {
|
|
28
|
-
switch (action.type) {
|
|
29
|
-
case "reset_for_session":
|
|
30
|
-
return initialCodexOverlayState;
|
|
31
|
-
case "status_fetch_start":
|
|
32
|
-
return {
|
|
33
|
-
...state,
|
|
34
|
-
codexLoginError: null,
|
|
35
|
-
};
|
|
36
|
-
case "status_fetch_success":
|
|
37
|
-
return {
|
|
38
|
-
...state,
|
|
39
|
-
codexWorkspaceLoggedIn: action.loggedIn,
|
|
40
|
-
codexLoginStatusText: action.statusText,
|
|
41
|
-
showCodexLoginRecheck: action.loggedIn
|
|
42
|
-
? false
|
|
43
|
-
: state.showCodexLoginRecheck,
|
|
44
|
-
codexAutoRecheckActive: action.loggedIn
|
|
45
|
-
? false
|
|
46
|
-
: state.codexAutoRecheckActive,
|
|
47
|
-
};
|
|
48
|
-
case "status_fetch_error":
|
|
49
|
-
return {
|
|
50
|
-
...state,
|
|
51
|
-
codexWorkspaceLoggedIn: null,
|
|
52
|
-
codexLoginStatusText: null,
|
|
53
|
-
codexLoginError: action.error,
|
|
54
|
-
};
|
|
55
|
-
case "copy_login_command":
|
|
56
|
-
return {
|
|
57
|
-
...state,
|
|
58
|
-
copiedCodexLoginCommand: true,
|
|
59
|
-
showCodexLoginRecheck: true,
|
|
60
|
-
codexAutoRecheckActive: true,
|
|
61
|
-
};
|
|
62
|
-
case "clear_copied_login_command":
|
|
63
|
-
return {
|
|
64
|
-
...state,
|
|
65
|
-
copiedCodexLoginCommand: false,
|
|
66
|
-
};
|
|
67
|
-
case "start_recheck":
|
|
68
|
-
return {
|
|
69
|
-
...state,
|
|
70
|
-
codexLoginRecheckPending: true,
|
|
71
|
-
codexLoginError: null,
|
|
72
|
-
};
|
|
73
|
-
case "finish_recheck":
|
|
74
|
-
return {
|
|
75
|
-
...state,
|
|
76
|
-
codexLoginRecheckPending: false,
|
|
77
|
-
};
|
|
78
|
-
case "show_recheck":
|
|
79
|
-
return {
|
|
80
|
-
...state,
|
|
81
|
-
showCodexLoginRecheck: true,
|
|
82
|
-
};
|
|
83
|
-
case "dismiss_overlay":
|
|
84
|
-
return {
|
|
85
|
-
...state,
|
|
86
|
-
codexLoginOverlayDismissed: true,
|
|
87
|
-
codexAutoRecheckActive: false,
|
|
88
|
-
};
|
|
89
|
-
default:
|
|
90
|
-
return state;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
export default function WorkbenchDrawer(props) {
|
|
94
|
-
const { run, chatSending, resetChat, loadChat, buildChatProvider, setBuildChatProvider, } = useBuildChat();
|
|
95
|
-
const { open = true, onClose, statePath, loading = false, error = null, sessionId, messages, sessionDetail, feedbackItems, gradingFlags, runLabelById = new Map(), runItemByRefId = new Map(), composerChips = [], onComposerChipsChange, } = props;
|
|
96
|
-
const [chatHistoryOpen, setChatHistoryOpen] = useState(false);
|
|
97
|
-
const [chatHistory, setChatHistory] = useState([]);
|
|
98
|
-
const [chatHistoryLoading, setChatHistoryLoading] = useState(false);
|
|
99
|
-
const [chatHistoryError, setChatHistoryError] = useState(null);
|
|
100
|
-
const [copiedStatePath, setCopiedStatePath] = useState(false);
|
|
101
|
-
const [codexOverlayState, dispatchCodexOverlay] = useReducer(codexOverlayReducer, initialCodexOverlayState);
|
|
102
|
-
const { copiedCodexLoginCommand, codexLoginRecheckPending, showCodexLoginRecheck, codexAutoRecheckActive, codexWorkspaceLoggedIn, codexLoginError, codexLoginStatusText, codexLoginOverlayDismissed, } = codexOverlayState;
|
|
103
|
-
const initializedChipTrackingRef = useRef(false);
|
|
104
|
-
const seenRatingChipIdsRef = useRef(new Set());
|
|
105
|
-
const seenFlagChipIdsRef = useRef(new Set());
|
|
106
|
-
const buildProviderOptions = useMemo(() => [
|
|
107
|
-
{ value: "codex-cli", label: "Codex" },
|
|
108
|
-
{ value: "claude-code-cli", label: "Claude Code" },
|
|
109
|
-
], []);
|
|
110
|
-
const codexLoginCommand = "codex login";
|
|
111
|
-
const codexWorkspaceId = sessionId ?? run.id;
|
|
112
|
-
const codexStatusEndpoint = codexWorkspaceId
|
|
113
|
-
? `/api/codex/trust-workspace?workspaceId=${encodeURIComponent(codexWorkspaceId)}`
|
|
114
|
-
: "/api/codex/trust-workspace";
|
|
115
|
-
const showCodexLoginOverlay = (codexWorkspaceLoggedIn === false &&
|
|
116
|
-
!codexLoginOverlayDismissed) || Boolean(codexLoginError);
|
|
117
|
-
const resolvedStatePath = useMemo(() => {
|
|
118
|
-
if (statePath)
|
|
119
|
-
return statePath;
|
|
120
|
-
const meta = sessionDetail?.meta;
|
|
121
|
-
if (meta && typeof meta === "object") {
|
|
122
|
-
const sessionStatePath = meta
|
|
123
|
-
.sessionStatePath;
|
|
124
|
-
if (typeof sessionStatePath === "string") {
|
|
125
|
-
return sessionStatePath;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return null;
|
|
129
|
-
}, [sessionDetail?.meta, statePath]);
|
|
130
|
-
const resolvedFeedbackItems = useMemo(() => {
|
|
131
|
-
if (sessionDetail) {
|
|
132
|
-
const feedback = sessionDetail.feedback ?? [];
|
|
133
|
-
const refs = sessionDetail.messageRefs ?? [];
|
|
134
|
-
const messages = sessionDetail.messages ?? [];
|
|
135
|
-
const messageByRefId = new Map();
|
|
136
|
-
const roleByRefId = new Map();
|
|
137
|
-
refs.forEach((ref, index) => {
|
|
138
|
-
if (!ref?.id)
|
|
139
|
-
return;
|
|
140
|
-
const message = messages[index];
|
|
141
|
-
if (message) {
|
|
142
|
-
messageByRefId.set(ref.id, message);
|
|
143
|
-
}
|
|
144
|
-
if (ref.role)
|
|
145
|
-
roleByRefId.set(ref.id, ref.role);
|
|
146
|
-
});
|
|
147
|
-
const items = feedback.map((entry) => {
|
|
148
|
-
const message = messageByRefId.get(entry.messageRefId);
|
|
149
|
-
const role = message?.role ?? roleByRefId.get(entry.messageRefId);
|
|
150
|
-
return { entry, message, role };
|
|
151
|
-
});
|
|
152
|
-
return items.sort((a, b) => {
|
|
153
|
-
const aKey = a.entry.createdAt ?? "";
|
|
154
|
-
const bKey = b.entry.createdAt ?? "";
|
|
155
|
-
return bKey.localeCompare(aKey);
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
if (feedbackItems !== undefined)
|
|
159
|
-
return feedbackItems;
|
|
160
|
-
if (!messages?.length)
|
|
161
|
-
return [];
|
|
162
|
-
const items = [];
|
|
163
|
-
messages.forEach((message, index) => {
|
|
164
|
-
if (!message?.feedback)
|
|
165
|
-
return;
|
|
166
|
-
items.push({
|
|
167
|
-
entry: message.feedback,
|
|
168
|
-
message: { content: message.content },
|
|
169
|
-
role: message.role,
|
|
170
|
-
_sortIndex: index,
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
return items.sort((a, b) => {
|
|
174
|
-
const aKey = a.entry.createdAt ?? "";
|
|
175
|
-
const bKey = b.entry.createdAt ?? "";
|
|
176
|
-
if (aKey && bKey && aKey !== bKey) {
|
|
177
|
-
return bKey.localeCompare(aKey);
|
|
178
|
-
}
|
|
179
|
-
return (b._sortIndex ?? 0) - (a._sortIndex ?? 0);
|
|
180
|
-
});
|
|
181
|
-
}, [feedbackItems, messages, sessionDetail]);
|
|
182
|
-
const resolvedGradingFlags = useMemo(() => {
|
|
183
|
-
if (sessionDetail) {
|
|
184
|
-
return extractGradingFlags(sessionDetail.meta);
|
|
185
|
-
}
|
|
186
|
-
return gradingFlags ?? [];
|
|
187
|
-
}, [gradingFlags, sessionDetail]);
|
|
188
|
-
const resolvedRunLabelById = useMemo(() => {
|
|
189
|
-
if (runLabelById.size > 0)
|
|
190
|
-
return runLabelById;
|
|
191
|
-
const meta = sessionDetail?.meta;
|
|
192
|
-
const runs = meta && typeof meta === "object"
|
|
193
|
-
? meta.gradingRuns
|
|
194
|
-
: undefined;
|
|
195
|
-
if (!Array.isArray(runs))
|
|
196
|
-
return runLabelById;
|
|
197
|
-
const map = new Map();
|
|
198
|
-
runs.forEach((run) => {
|
|
199
|
-
if (!run || typeof run !== "object")
|
|
200
|
-
return;
|
|
201
|
-
const record = run;
|
|
202
|
-
if (typeof record.id !== "string")
|
|
203
|
-
return;
|
|
204
|
-
const label = typeof record.graderLabel === "string"
|
|
205
|
-
? record.graderLabel
|
|
206
|
-
: typeof record.graderId === "string"
|
|
207
|
-
? record.graderId
|
|
208
|
-
: record.id;
|
|
209
|
-
map.set(record.id, label);
|
|
210
|
-
});
|
|
211
|
-
return map;
|
|
212
|
-
}, [runLabelById, sessionDetail]);
|
|
213
|
-
const resolvedRunItemByRefId = useMemo(() => {
|
|
214
|
-
if (runItemByRefId.size > 0)
|
|
215
|
-
return runItemByRefId;
|
|
216
|
-
const meta = sessionDetail?.meta;
|
|
217
|
-
const runs = meta && typeof meta === "object"
|
|
218
|
-
? meta.gradingRuns
|
|
219
|
-
: undefined;
|
|
220
|
-
if (!Array.isArray(runs))
|
|
221
|
-
return runItemByRefId;
|
|
222
|
-
const map = new Map();
|
|
223
|
-
runs.forEach((run) => {
|
|
224
|
-
if (!run || typeof run !== "object")
|
|
225
|
-
return;
|
|
226
|
-
const record = run;
|
|
227
|
-
if (typeof record.id !== "string")
|
|
228
|
-
return;
|
|
229
|
-
const result = record.result;
|
|
230
|
-
if (result &&
|
|
231
|
-
typeof result === "object" &&
|
|
232
|
-
result.mode === "turns" &&
|
|
233
|
-
Array.isArray(result.turns)) {
|
|
234
|
-
const turns = result
|
|
235
|
-
.turns;
|
|
236
|
-
turns.forEach((turn, idx) => {
|
|
237
|
-
const index = typeof turn.index === "number" ? turn.index : idx;
|
|
238
|
-
map.set(`gradingRun:${record.id}#turn:${index}`, {
|
|
239
|
-
turnNumber: index + 1,
|
|
240
|
-
input: turn.input,
|
|
241
|
-
result: turn.result,
|
|
242
|
-
});
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
else {
|
|
246
|
-
map.set(`gradingRun:${record.id}`, {
|
|
247
|
-
input: record.input,
|
|
248
|
-
result: record.result,
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
return map;
|
|
253
|
-
}, [runItemByRefId, sessionDetail]);
|
|
254
|
-
const mergeComposerChip = useCallback((base, chip) => {
|
|
255
|
-
const next = [...base];
|
|
256
|
-
const existingIndex = next.findIndex((entry) => entry.chipId === chip.chipId);
|
|
257
|
-
if (existingIndex >= 0) {
|
|
258
|
-
next[existingIndex] = {
|
|
259
|
-
...next[existingIndex],
|
|
260
|
-
...chip,
|
|
261
|
-
enabled: true,
|
|
262
|
-
};
|
|
263
|
-
return next;
|
|
264
|
-
}
|
|
265
|
-
next.push(chip);
|
|
266
|
-
return next;
|
|
267
|
-
}, []);
|
|
268
|
-
const addComposerChip = useCallback((chip) => {
|
|
269
|
-
if (!onComposerChipsChange)
|
|
270
|
-
return;
|
|
271
|
-
onComposerChipsChange(mergeComposerChip(composerChips, chip));
|
|
272
|
-
}, [composerChips, mergeComposerChip, onComposerChipsChange]);
|
|
273
|
-
const removeComposerChip = useCallback((chipId) => {
|
|
274
|
-
if (!onComposerChipsChange)
|
|
275
|
-
return;
|
|
276
|
-
onComposerChipsChange(composerChips.filter((chip) => chip.chipId !== chipId));
|
|
277
|
-
}, [composerChips, onComposerChipsChange]);
|
|
278
|
-
const composerChipIds = useMemo(() => new Set(composerChips.map((chip) => chip.chipId)), [composerChips]);
|
|
279
|
-
const buildRatingChip = useCallback((entry) => {
|
|
280
|
-
const capturedAt = entry.createdAt ?? new Date().toISOString();
|
|
281
|
-
return {
|
|
282
|
-
chipId: `rating:${entry.messageRefId}:${entry.id}`,
|
|
283
|
-
source: "message_rating",
|
|
284
|
-
workspaceId: sessionId ?? undefined,
|
|
285
|
-
runId: entry.runId,
|
|
286
|
-
capturedAt,
|
|
287
|
-
messageRefId: entry.messageRefId,
|
|
288
|
-
statePath: resolvedStatePath ?? undefined,
|
|
289
|
-
statePointer: `messageRef:${entry.messageRefId}`,
|
|
290
|
-
score: entry.score,
|
|
291
|
-
reason: entry.reason,
|
|
292
|
-
enabled: true,
|
|
293
|
-
};
|
|
294
|
-
}, [resolvedStatePath, sessionId]);
|
|
295
|
-
const resolveFlagMessage = useCallback((flag) => {
|
|
296
|
-
if (flag.reason?.trim())
|
|
297
|
-
return flag.reason;
|
|
298
|
-
const flaggedItem = resolvedRunItemByRefId.get(flag.refId);
|
|
299
|
-
const gradedAssistant = extractTurnContext(flaggedItem?.input).gradedAssistant;
|
|
300
|
-
if (gradedAssistant?.trim())
|
|
301
|
-
return formatSnippet(gradedAssistant);
|
|
302
|
-
return "Flagged by grader";
|
|
303
|
-
}, [resolvedRunItemByRefId]);
|
|
304
|
-
const buildFlagChip = useCallback((flag) => {
|
|
305
|
-
const capturedAt = flag.createdAt ?? new Date().toISOString();
|
|
306
|
-
return {
|
|
307
|
-
// Use refId so optimistic and persisted updates collapse to one chip.
|
|
308
|
-
chipId: `flag:${flag.refId}`,
|
|
309
|
-
source: "grading_flag",
|
|
310
|
-
workspaceId: sessionId ?? undefined,
|
|
311
|
-
runId: flag.runId,
|
|
312
|
-
capturedAt,
|
|
313
|
-
flagId: flag.id,
|
|
314
|
-
refId: flag.refId,
|
|
315
|
-
score: extractScoreAndReason(resolvedRunItemByRefId.get(flag.refId)?.result)
|
|
316
|
-
.score,
|
|
317
|
-
message: resolveFlagMessage(flag),
|
|
318
|
-
enabled: true,
|
|
319
|
-
};
|
|
320
|
-
}, [resolveFlagMessage, resolvedRunItemByRefId, sessionId]);
|
|
321
|
-
useEffect(() => {
|
|
322
|
-
initializedChipTrackingRef.current = false;
|
|
323
|
-
seenRatingChipIdsRef.current.clear();
|
|
324
|
-
seenFlagChipIdsRef.current.clear();
|
|
325
|
-
dispatchCodexOverlay({ type: "reset_for_session" });
|
|
326
|
-
}, [sessionId]);
|
|
327
|
-
useEffect(() => {
|
|
328
|
-
if (!open)
|
|
329
|
-
return;
|
|
330
|
-
let canceled = false;
|
|
331
|
-
dispatchCodexOverlay({ type: "status_fetch_start" });
|
|
332
|
-
fetch(codexStatusEndpoint)
|
|
333
|
-
.then(async (response) => {
|
|
334
|
-
const payload = await response.json();
|
|
335
|
-
if (!response.ok || payload.ok === false) {
|
|
336
|
-
throw new Error(payload.error || response.statusText);
|
|
337
|
-
}
|
|
338
|
-
if (canceled)
|
|
339
|
-
return;
|
|
340
|
-
dispatchCodexOverlay({
|
|
341
|
-
type: "status_fetch_success",
|
|
342
|
-
loggedIn: payload.codexLoggedIn === true,
|
|
343
|
-
statusText: typeof payload.codexLoginStatus === "string"
|
|
344
|
-
? payload.codexLoginStatus
|
|
345
|
-
: null,
|
|
346
|
-
});
|
|
347
|
-
})
|
|
348
|
-
.catch((err) => {
|
|
349
|
-
if (canceled)
|
|
350
|
-
return;
|
|
351
|
-
dispatchCodexOverlay({
|
|
352
|
-
type: "status_fetch_error",
|
|
353
|
-
error: err instanceof Error ? err.message : String(err),
|
|
354
|
-
});
|
|
355
|
-
})
|
|
356
|
-
.finally(() => {
|
|
357
|
-
if (canceled)
|
|
358
|
-
return;
|
|
359
|
-
});
|
|
360
|
-
return () => {
|
|
361
|
-
canceled = true;
|
|
362
|
-
};
|
|
363
|
-
}, [codexStatusEndpoint, open]);
|
|
364
|
-
useEffect(() => {
|
|
365
|
-
if (!showCodexLoginOverlay)
|
|
366
|
-
return;
|
|
367
|
-
if (codexWorkspaceLoggedIn !== false)
|
|
368
|
-
return;
|
|
369
|
-
if (showCodexLoginRecheck)
|
|
370
|
-
return;
|
|
371
|
-
const timeout = globalThis.setTimeout(() => {
|
|
372
|
-
dispatchCodexOverlay({ type: "show_recheck" });
|
|
373
|
-
}, 5000);
|
|
374
|
-
return () => globalThis.clearTimeout(timeout);
|
|
375
|
-
}, [codexWorkspaceLoggedIn, showCodexLoginOverlay, showCodexLoginRecheck]);
|
|
376
|
-
useEffect(() => {
|
|
377
|
-
if (loading)
|
|
378
|
-
return;
|
|
379
|
-
const currentRatingChipIds = new Set(resolvedFeedbackItems.map(({ entry }) => `rating:${entry.messageRefId}:${entry.id}`));
|
|
380
|
-
const currentFlagChipIds = new Set(resolvedGradingFlags.map((flag) => `flag:${flag.refId}`));
|
|
381
|
-
if (!initializedChipTrackingRef.current) {
|
|
382
|
-
seenRatingChipIdsRef.current = currentRatingChipIds;
|
|
383
|
-
seenFlagChipIdsRef.current = currentFlagChipIds;
|
|
384
|
-
initializedChipTrackingRef.current = true;
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
const newRatingEntries = resolvedFeedbackItems.filter(({ entry }) => !seenRatingChipIdsRef.current.has(`rating:${entry.messageRefId}:${entry.id}`));
|
|
388
|
-
const newFlagEntries = resolvedGradingFlags.filter((flag) => !seenFlagChipIdsRef.current.has(`flag:${flag.refId}`));
|
|
389
|
-
if ((newRatingEntries.length > 0 || newFlagEntries.length > 0) &&
|
|
390
|
-
onComposerChipsChange) {
|
|
391
|
-
let nextChips = [...composerChips];
|
|
392
|
-
newRatingEntries.forEach(({ entry }) => {
|
|
393
|
-
nextChips = mergeComposerChip(nextChips, buildRatingChip(entry));
|
|
394
|
-
});
|
|
395
|
-
newFlagEntries.forEach((flag) => {
|
|
396
|
-
nextChips = mergeComposerChip(nextChips, buildFlagChip(flag));
|
|
397
|
-
});
|
|
398
|
-
onComposerChipsChange(nextChips);
|
|
399
|
-
}
|
|
400
|
-
if (onComposerChipsChange) {
|
|
401
|
-
const ratingByChipId = new Map(resolvedFeedbackItems.map(({ entry }) => [
|
|
402
|
-
`rating:${entry.messageRefId}:${entry.id}`,
|
|
403
|
-
buildRatingChip(entry),
|
|
404
|
-
]));
|
|
405
|
-
const flagByChipId = new Map(resolvedGradingFlags.map((flag) => [
|
|
406
|
-
`flag:${flag.refId}`,
|
|
407
|
-
buildFlagChip(flag),
|
|
408
|
-
]));
|
|
409
|
-
let didChange = false;
|
|
410
|
-
const syncedChips = composerChips.filter((chip) => {
|
|
411
|
-
if (chip.source === "message_rating") {
|
|
412
|
-
if (!chip.chipId.startsWith("rating:"))
|
|
413
|
-
return true;
|
|
414
|
-
const stillExists = ratingByChipId.has(chip.chipId);
|
|
415
|
-
if (!stillExists)
|
|
416
|
-
didChange = true;
|
|
417
|
-
return stillExists;
|
|
418
|
-
}
|
|
419
|
-
if (chip.source === "grading_flag") {
|
|
420
|
-
if (!chip.chipId.startsWith("flag:"))
|
|
421
|
-
return true;
|
|
422
|
-
const stillExists = flagByChipId.has(chip.chipId);
|
|
423
|
-
if (!stillExists)
|
|
424
|
-
didChange = true;
|
|
425
|
-
return stillExists;
|
|
426
|
-
}
|
|
427
|
-
return true;
|
|
428
|
-
}).map((chip) => {
|
|
429
|
-
const latest = chip.source === "message_rating" &&
|
|
430
|
-
chip.chipId.startsWith("rating:")
|
|
431
|
-
? ratingByChipId.get(chip.chipId)
|
|
432
|
-
: chip.source === "grading_flag" && chip.chipId.startsWith("flag:")
|
|
433
|
-
? flagByChipId.get(chip.chipId)
|
|
434
|
-
: undefined;
|
|
435
|
-
if (!latest)
|
|
436
|
-
return chip;
|
|
437
|
-
const next = { ...chip, ...latest, enabled: chip.enabled };
|
|
438
|
-
const changed = JSON.stringify(next) !== JSON.stringify(chip);
|
|
439
|
-
if (changed)
|
|
440
|
-
didChange = true;
|
|
441
|
-
return next;
|
|
442
|
-
});
|
|
443
|
-
if (didChange) {
|
|
444
|
-
onComposerChipsChange(syncedChips);
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
seenRatingChipIdsRef.current = currentRatingChipIds;
|
|
448
|
-
seenFlagChipIdsRef.current = currentFlagChipIds;
|
|
449
|
-
}, [
|
|
450
|
-
buildFlagChip,
|
|
451
|
-
buildRatingChip,
|
|
452
|
-
composerChips,
|
|
453
|
-
loading,
|
|
454
|
-
mergeComposerChip,
|
|
455
|
-
onComposerChipsChange,
|
|
456
|
-
resolvedFeedbackItems,
|
|
457
|
-
resolvedGradingFlags,
|
|
458
|
-
]);
|
|
459
|
-
const loadChatHistory = useCallback(async () => {
|
|
460
|
-
if (!chatAccordionEnabled)
|
|
461
|
-
return;
|
|
462
|
-
setChatHistoryLoading(true);
|
|
463
|
-
setChatHistoryError(null);
|
|
464
|
-
try {
|
|
465
|
-
const res = await fetch(WORKSPACES_API_BASE);
|
|
466
|
-
if (!res.ok)
|
|
467
|
-
throw new Error(res.statusText);
|
|
468
|
-
const data = await res.json();
|
|
469
|
-
const runs = Array.isArray(data.workspaces)
|
|
470
|
-
? data.workspaces.filter((entry) => typeof entry?.id === "string").map((entry) => ({
|
|
471
|
-
id: entry.id,
|
|
472
|
-
updatedAt: entry.createdAt,
|
|
473
|
-
startedAt: entry.createdAt,
|
|
474
|
-
}))
|
|
475
|
-
: [];
|
|
476
|
-
setChatHistory(runs);
|
|
477
|
-
}
|
|
478
|
-
catch (err) {
|
|
479
|
-
setChatHistoryError(err instanceof Error ? err.message : "Failed to load chat history");
|
|
480
|
-
}
|
|
481
|
-
finally {
|
|
482
|
-
setChatHistoryLoading(false);
|
|
483
|
-
}
|
|
484
|
-
}, []);
|
|
485
|
-
useEffect(() => {
|
|
486
|
-
if (!open)
|
|
487
|
-
return;
|
|
488
|
-
if (!chatAccordionEnabled)
|
|
489
|
-
return;
|
|
490
|
-
loadChatHistory().catch(() => { });
|
|
491
|
-
}, [loadChatHistory, open]);
|
|
492
|
-
const runStatusLabel = run.status === "running"
|
|
493
|
-
? "Running…"
|
|
494
|
-
: run.status === "completed"
|
|
495
|
-
? "Completed"
|
|
496
|
-
: run.status === "error"
|
|
497
|
-
? "Failed"
|
|
498
|
-
: run.status === "canceled"
|
|
499
|
-
? "Stopped"
|
|
500
|
-
: "Idle";
|
|
501
|
-
const showCopyStatePath = Boolean(resolvedStatePath);
|
|
502
|
-
const handleCopyStatePath = useMemo(() => {
|
|
503
|
-
if (!resolvedStatePath)
|
|
504
|
-
return null;
|
|
505
|
-
return () => {
|
|
506
|
-
navigator.clipboard?.writeText(resolvedStatePath);
|
|
507
|
-
setCopiedStatePath(true);
|
|
508
|
-
globalThis.setTimeout(() => setCopiedStatePath(false), 1200);
|
|
509
|
-
};
|
|
510
|
-
}, [resolvedStatePath]);
|
|
511
|
-
const handleCopyCodexLoginCommand = useCallback(() => {
|
|
512
|
-
navigator.clipboard?.writeText(codexLoginCommand);
|
|
513
|
-
dispatchCodexOverlay({ type: "copy_login_command" });
|
|
514
|
-
globalThis.setTimeout(() => {
|
|
515
|
-
dispatchCodexOverlay({ type: "clear_copied_login_command" });
|
|
516
|
-
}, 1200);
|
|
517
|
-
}, [codexLoginCommand]);
|
|
518
|
-
const handleRecheckCodexLogin = useCallback(async () => {
|
|
519
|
-
dispatchCodexOverlay({ type: "start_recheck" });
|
|
520
|
-
try {
|
|
521
|
-
const response = await fetch(codexStatusEndpoint);
|
|
522
|
-
const payload = await response.json();
|
|
523
|
-
if (!response.ok || payload.ok === false) {
|
|
524
|
-
throw new Error(payload.error || response.statusText);
|
|
525
|
-
}
|
|
526
|
-
dispatchCodexOverlay({
|
|
527
|
-
type: "status_fetch_success",
|
|
528
|
-
loggedIn: payload.codexLoggedIn === true,
|
|
529
|
-
statusText: typeof payload.codexLoginStatus === "string"
|
|
530
|
-
? payload.codexLoginStatus
|
|
531
|
-
: null,
|
|
532
|
-
});
|
|
533
|
-
}
|
|
534
|
-
catch (err) {
|
|
535
|
-
dispatchCodexOverlay({
|
|
536
|
-
type: "status_fetch_error",
|
|
537
|
-
error: err instanceof Error ? err.message : String(err),
|
|
538
|
-
});
|
|
539
|
-
}
|
|
540
|
-
finally {
|
|
541
|
-
dispatchCodexOverlay({ type: "finish_recheck" });
|
|
542
|
-
}
|
|
543
|
-
}, [codexStatusEndpoint]);
|
|
544
|
-
useEffect(() => {
|
|
545
|
-
if (!codexAutoRecheckActive)
|
|
546
|
-
return;
|
|
547
|
-
if (!showCodexLoginOverlay)
|
|
548
|
-
return;
|
|
549
|
-
if (codexWorkspaceLoggedIn !== false)
|
|
550
|
-
return;
|
|
551
|
-
const interval = globalThis.setInterval(() => {
|
|
552
|
-
if (codexLoginRecheckPending)
|
|
553
|
-
return;
|
|
554
|
-
void handleRecheckCodexLogin();
|
|
555
|
-
}, 2000);
|
|
556
|
-
return () => globalThis.clearInterval(interval);
|
|
557
|
-
}, [
|
|
558
|
-
codexAutoRecheckActive,
|
|
559
|
-
codexLoginRecheckPending,
|
|
560
|
-
codexWorkspaceLoggedIn,
|
|
561
|
-
handleRecheckCodexLogin,
|
|
562
|
-
showCodexLoginOverlay,
|
|
563
|
-
]);
|
|
564
|
-
useEffect(() => {
|
|
565
|
-
if (!open)
|
|
566
|
-
return;
|
|
567
|
-
if (!onClose)
|
|
568
|
-
return;
|
|
569
|
-
const handler = (event) => {
|
|
570
|
-
if (event.key === "Escape") {
|
|
571
|
-
onClose();
|
|
572
|
-
}
|
|
573
|
-
};
|
|
574
|
-
globalThis.addEventListener("keydown", handler);
|
|
575
|
-
return () => globalThis.removeEventListener("keydown", handler);
|
|
576
|
-
}, [onClose, open]);
|
|
577
|
-
if (!open)
|
|
578
|
-
return null;
|
|
579
|
-
return (React.createElement("aside", { className: "workbench-drawer-docked", role: "dialog" },
|
|
580
|
-
React.createElement(Accordion, { allowMultiple: true, className: "workbench-accordion equal-open", items: [
|
|
581
|
-
...(chatAccordionEnabled
|
|
582
|
-
? [{
|
|
583
|
-
id: "workbench-chat",
|
|
584
|
-
title: (React.createElement("div", { className: "workbench-accordion-title" },
|
|
585
|
-
chatHistory.length > 0 && (React.createElement("span", { role: "button", tabIndex: 0, className: "workbench-chat-history-toggle", onClick: (event) => {
|
|
586
|
-
event.preventDefault();
|
|
587
|
-
event.stopPropagation();
|
|
588
|
-
setChatHistoryOpen((prev) => !prev);
|
|
589
|
-
}, onKeyDown: (event) => {
|
|
590
|
-
if (event.key !== "Enter" && event.key !== " ")
|
|
591
|
-
return;
|
|
592
|
-
event.preventDefault();
|
|
593
|
-
event.stopPropagation();
|
|
594
|
-
setChatHistoryOpen((prev) => !prev);
|
|
595
|
-
}, "aria-label": chatHistoryOpen
|
|
596
|
-
? "Hide chat history"
|
|
597
|
-
: "Show chat history" },
|
|
598
|
-
React.createElement(Icon, { name: "chevronDown", size: 12, className: "workbench-chat-history-arrow" }))),
|
|
599
|
-
React.createElement("span", null, "Chat"),
|
|
600
|
-
React.createElement(Badge, { status: run.status }, runStatusLabel))),
|
|
601
|
-
defaultOpen: true,
|
|
602
|
-
contentClassName: "workbench-chat-content",
|
|
603
|
-
headerActions: (React.createElement("div", { className: "workbench-chat-header-actions gds-accordion-open-only" },
|
|
604
|
-
React.createElement("label", { className: "workbench-provider-select-label" },
|
|
605
|
-
React.createElement("div", { className: "workbench-provider-select", onClick: (event) => event.stopPropagation(), onMouseDown: (event) => event.stopPropagation(), onKeyDown: (event) => event.stopPropagation() },
|
|
606
|
-
React.createElement(Listbox, { value: buildChatProvider, onChange: (value) => setBuildChatProvider(value), options: buildProviderOptions, disabled: chatSending || run.status === "running", size: "small", popoverMatchTriggerWidth: false, popoverMinWidth: 200, popoverAlign: "right" }))),
|
|
607
|
-
React.createElement(Button, { variant: "secondary", size: "small", onClick: (event) => {
|
|
608
|
-
event.stopPropagation();
|
|
609
|
-
resetChat().then(() => {
|
|
610
|
-
loadChatHistory().catch(() => { });
|
|
611
|
-
});
|
|
612
|
-
}, disabled: chatSending || run.status === "running" }, "New chat"))),
|
|
613
|
-
content: (React.createElement("div", { className: "workbench-chat-panel" },
|
|
614
|
-
React.createElement("div", { className: "workbench-chat-overlay" },
|
|
615
|
-
React.createElement("div", { className: "workbench-chat-history" },
|
|
616
|
-
chatHistoryLoading && (React.createElement(Callout, null, "Loading chat history\u2026")),
|
|
617
|
-
chatHistoryError && (React.createElement("div", { className: "error" }, chatHistoryError)),
|
|
618
|
-
!chatHistoryLoading &&
|
|
619
|
-
!chatHistoryError &&
|
|
620
|
-
chatHistory.length === 0 && (React.createElement(Callout, null, "No previous chats yet.")),
|
|
621
|
-
!chatHistoryLoading &&
|
|
622
|
-
!chatHistoryError &&
|
|
623
|
-
chatHistory.length > 0 && (React.createElement(List, { className: "workbench-chat-history-list" }, chatHistory.map((entry) => {
|
|
624
|
-
const timestamp = entry.updatedAt ??
|
|
625
|
-
entry.startedAt;
|
|
626
|
-
const label = timestamp
|
|
627
|
-
? formatTimestampShort(timestamp)
|
|
628
|
-
: "Unknown date";
|
|
629
|
-
return (React.createElement("button", { key: entry.id, type: "button", className: "workbench-chat-history-row gds-list-item-button", onClick: () => {
|
|
630
|
-
setChatHistoryOpen(false);
|
|
631
|
-
loadChat(entry.id).catch(() => { });
|
|
632
|
-
} },
|
|
633
|
-
React.createElement(ListItem, { title: `Chat - ${label}` })));
|
|
634
|
-
})))),
|
|
635
|
-
React.createElement("div", { className: `workbench-chat-current${chatHistoryOpen ? " is-history" : ""}` },
|
|
636
|
-
React.createElement(ProviderLoginPanel, { key: `${sessionId ?? "sessionless"}:${buildChatProvider}`, open: open, buildChatProvider: buildChatProvider, workspaceId: (sessionId ?? run.id) || undefined }),
|
|
637
|
-
showCodexLoginOverlay && (React.createElement(CodexLoginRequiredOverlay, { codexWorkspaceLoggedIn: codexWorkspaceLoggedIn, codexLoginCommand: codexLoginCommand, copiedCodexLoginCommand: copiedCodexLoginCommand, showCodexLoginRecheck: showCodexLoginRecheck, codexLoginRecheckPending: codexLoginRecheckPending, codexLoginStatusText: codexLoginStatusText, codexLoginError: codexLoginError, onCopyCodexLoginCommand: handleCopyCodexLoginCommand, onRecheckCodexLogin: () => {
|
|
638
|
-
void handleRecheckCodexLogin();
|
|
639
|
-
}, onDismiss: () => {
|
|
640
|
-
dispatchCodexOverlay({ type: "dismiss_overlay" });
|
|
641
|
-
} })),
|
|
642
|
-
React.createElement(Chat, { composerChips: composerChips, onComposerChipsChange: onComposerChipsChange }))))),
|
|
643
|
-
}]
|
|
644
|
-
: []),
|
|
645
|
-
{
|
|
646
|
-
id: "workbench-ratings",
|
|
647
|
-
title: "Ratings & flags",
|
|
648
|
-
defaultOpen: false,
|
|
649
|
-
content: (React.createElement("div", { className: "workbench-ratings" },
|
|
650
|
-
showCopyStatePath && handleCopyStatePath && (React.createElement(React.Fragment, null,
|
|
651
|
-
React.createElement(Button, { variant: "secondary", onClick: handleCopyStatePath },
|
|
652
|
-
React.createElement(Icon, { name: copiedStatePath ? "copied" : "copy", size: 14 }),
|
|
653
|
-
copiedStatePath ? "Copied" : "Copy state path"),
|
|
654
|
-
React.createElement("p", { className: "workbench-button-meta" }, "Paste this in your coding assistant to debug the agent."))),
|
|
655
|
-
loading && React.createElement(Callout, null, "Loading ratings and flags\u2026"),
|
|
656
|
-
error && React.createElement("div", { className: "error" }, error),
|
|
657
|
-
!loading &&
|
|
658
|
-
!error &&
|
|
659
|
-
resolvedFeedbackItems.length === 0 &&
|
|
660
|
-
resolvedGradingFlags.length === 0 && (React.createElement(Callout, null, "No ratings or flags yet.")),
|
|
661
|
-
resolvedFeedbackItems.length > 0 && (React.createElement("div", { className: "workbench-summary-list" }, resolvedFeedbackItems.map(({ entry, message, role }) => {
|
|
662
|
-
const ratingChip = buildRatingChip(entry);
|
|
663
|
-
const inChat = composerChipIds.has(ratingChip.chipId);
|
|
664
|
-
const roleLabel = role === "assistant"
|
|
665
|
-
? "Assistant message"
|
|
666
|
-
: "Scenario message";
|
|
667
|
-
const displayScore = entry.score;
|
|
668
|
-
const scoreLabel = displayScore > 0
|
|
669
|
-
? `+${displayScore}`
|
|
670
|
-
: displayScore;
|
|
671
|
-
const scoreClass = getScoreClass(displayScore);
|
|
672
|
-
return (React.createElement("div", { key: `${entry.id}-${entry.messageRefId}`, className: "workbench-summary-card" },
|
|
673
|
-
React.createElement("div", { className: "workbench-summary-title", title: entry.createdAt &&
|
|
674
|
-
formatTimestampShort(entry.createdAt) }, roleLabel),
|
|
675
|
-
React.createElement("div", { className: "workbench-summary-score-row" },
|
|
676
|
-
React.createElement("div", { className: `workbench-score-badge workbench-score-badge--small ${scoreClass}` }, scoreLabel),
|
|
677
|
-
entry.reason && (React.createElement(ScrollingText, { as: "div", text: entry.reason, className: "workbench-summary-reason" }))),
|
|
678
|
-
message?.content && (React.createElement(ScrollingText, { as: "div", text: formatSnippet(message.content), className: "workbench-summary-meta" })),
|
|
679
|
-
React.createElement("div", { className: "workbench-summary-actions" },
|
|
680
|
-
React.createElement(Button, { variant: "secondary", size: "small", onClick: () => inChat
|
|
681
|
-
? removeComposerChip(ratingChip.chipId)
|
|
682
|
-
: addComposerChip(ratingChip), disabled: !onComposerChipsChange }, inChat ? "Remove from chat" : "Add to chat"))));
|
|
683
|
-
}))),
|
|
684
|
-
resolvedGradingFlags.length > 0 && (React.createElement("div", { className: "workbench-summary-list" }, resolvedGradingFlags.map((flag) => {
|
|
685
|
-
const flagChip = buildFlagChip(flag);
|
|
686
|
-
const inChat = composerChipIds.has(flagChip.chipId);
|
|
687
|
-
const runLabel = flag.runId
|
|
688
|
-
? resolvedRunLabelById.get(flag.runId)
|
|
689
|
-
: undefined;
|
|
690
|
-
const flaggedItem = resolvedRunItemByRefId.get(flag.refId);
|
|
691
|
-
const turnLabel = flaggedItem?.turnNumber
|
|
692
|
-
? `Assistant turn ${flaggedItem.turnNumber}`
|
|
693
|
-
: undefined;
|
|
694
|
-
const gradedAssistant = extractTurnContext(flaggedItem?.input).gradedAssistant;
|
|
695
|
-
return (React.createElement("div", { key: flag.id, className: "workbench-summary-card workbench-flag-card" },
|
|
696
|
-
React.createElement("div", { className: "workbench-summary-title" }, "Grader flag"),
|
|
697
|
-
(runLabel || turnLabel)
|
|
698
|
-
? (React.createElement("div", { className: "workbench-summary-subtitle", title: flag.createdAt &&
|
|
699
|
-
formatTimestampShort(flag.createdAt) },
|
|
700
|
-
runLabel,
|
|
701
|
-
runLabel && turnLabel && " • ",
|
|
702
|
-
turnLabel))
|
|
703
|
-
: "Flagged grader",
|
|
704
|
-
React.createElement("div", { className: "workbench-summary-score-row" },
|
|
705
|
-
React.createElement("div", { className: "workbench-score-badge workbench-score-badge--small" },
|
|
706
|
-
React.createElement(Icon, { name: "flag", size: 10 })),
|
|
707
|
-
flag.reason && (React.createElement(ScrollingText, { as: "div", text: flag.reason, className: "workbench-summary-reason" }))),
|
|
708
|
-
gradedAssistant && (React.createElement(ScrollingText, { as: "div", text: formatSnippet(gradedAssistant), className: "workbench-summary-meta" })),
|
|
709
|
-
React.createElement("div", { className: "workbench-summary-actions" },
|
|
710
|
-
React.createElement(Button, { variant: "secondary", size: "small", onClick: () => inChat
|
|
711
|
-
? removeComposerChip(flagChip.chipId)
|
|
712
|
-
: addComposerChip(flagChip), disabled: !onComposerChipsChange }, inChat ? "Remove from chat" : "Add to chat"))));
|
|
713
|
-
}))))),
|
|
714
|
-
},
|
|
715
|
-
] })));
|
|
716
|
-
}
|