@vybestack/llxprt-code 0.10.0 → 0.11.0-nightly.260728.ffaa8d5d7
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/package.json +13 -13
- package/src/commands/mcp/add.ts +8 -4
- package/src/config/cliArgParser.ts +2 -0
- package/src/config/config.ts +2 -0
- package/src/config/configBuilder.ts +3 -0
- package/src/config/configError.ts +23 -0
- package/src/config/extensions/extensionEnablement.ts +62 -1
- package/src/config/interactiveContext.ts +2 -1
- package/src/config/intermediateConfig.ts +4 -0
- package/src/config/keyBindings.ts +29 -3
- package/src/config/policy.ts +7 -1
- package/src/config/postConfigRuntime.ts +20 -14
- package/src/config/settings-schema/schema-ui.ts +9 -0
- package/src/config/settingsLoader.ts +21 -17
- package/src/config/settingsSchema.ts +2 -2
- package/src/config/trustedFolders.ts +275 -58
- package/src/config/yargsOptions.ts +7 -0
- package/src/generated/git-commit.json +1 -1
- package/src/nonInteractiveCli.ts +1 -0
- package/src/nonInteractiveCliSupport.ts +171 -51
- package/src/runtime/interactiveToolScheduler.ts +6 -6
- package/src/services/BuiltinCommandLoader.ts +33 -25
- package/src/services/FileCommandLoader.ts +34 -7
- package/src/test-utils/async.ts +20 -0
- package/src/test-utils/render.tsx +10 -1
- package/src/ui/App.tsx +17 -10
- package/src/ui/AppContainerRuntime.tsx +7 -9
- package/src/ui/cliUiRuntime.ts +28 -0
- package/src/ui/commands/authCommand.ts +240 -3
- package/src/ui/commands/compressCommand.ts +9 -1
- package/src/ui/commands/directoryCommand.tsx +1 -1
- package/src/ui/commands/logoutCommand.ts +2 -2
- package/src/ui/commands/permissionsCommand.ts +77 -20
- package/src/ui/commands/policiesCommand.ts +6 -1
- package/src/ui/commands/quotaCommand.ts +501 -0
- package/src/ui/commands/statsCommand.ts +2 -2
- package/src/ui/commands/statsQuota.ts +1 -1
- package/src/ui/commands/subagentCommand.ts +59 -27
- package/src/ui/components/AuthDialog.tsx +3 -3
- package/src/ui/components/Composer.tsx +1 -0
- package/src/ui/components/DialogManager.tsx +9 -2
- package/src/ui/components/FolderTrustDialog.tsx +71 -60
- package/src/ui/components/PermissionsModifyTrustDialog.tsx +211 -146
- package/src/ui/components/ProfileCreateWizard/constants.ts +13 -1
- package/src/ui/components/QueuedMessagesPanel.tsx +388 -0
- package/src/ui/components/inputPromptHooks.ts +2 -0
- package/src/ui/components/inputPromptKeyHandlers.ts +14 -0
- package/src/ui/components/inputPromptTypes.ts +6 -0
- package/src/ui/components/messages/AiMessage.tsx +24 -12
- package/src/ui/components/messages/ToolMessage.tsx +26 -40
- package/src/ui/containers/AppContainer/builders/buildUIActions.ts +3 -1
- package/src/ui/containers/AppContainer/builders/buildUIState.ts +5 -4
- package/src/ui/containers/AppContainer/hooks/useAppBootstrap.ts +3 -33
- package/src/ui/containers/AppContainer/hooks/useAppDialogs.ts +2 -14
- package/src/ui/containers/AppContainer/hooks/useAppInput.ts +31 -25
- package/src/ui/containers/AppContainer/hooks/useAppLayout.ts +90 -60
- package/src/ui/containers/AppContainer/hooks/useDisplayPreferences.ts +10 -0
- package/src/ui/containers/AppContainer/hooks/useInputHandling.ts +3 -17
- package/src/ui/containers/AppContainer/hooks/useKeybindings.ts +51 -38
- package/src/ui/containers/AppContainer/hooks/useSteer.ts +51 -0
- package/src/ui/contexts/KeypressContext.tsx +13 -2
- package/src/ui/contexts/ShellCommandDisplayContext.tsx +103 -0
- package/src/ui/contexts/TodoContext.tsx +0 -13
- package/src/ui/contexts/TodoProvider.tsx +1 -34
- package/src/ui/contexts/UIActionsContext.tsx +2 -1
- package/src/ui/contexts/UIStateContext.tsx +3 -2
- package/src/ui/hooks/agentStream/streamUtils.ts +0 -24
- package/src/ui/hooks/agentStream/thoughtState.ts +110 -30
- package/src/ui/hooks/agentStream/types.ts +1 -0
- package/src/ui/hooks/agentStream/useAgentEventStream.ts +8 -17
- package/src/ui/hooks/agentStream/useAgentStream.ts +2 -2
- package/src/ui/hooks/agentStream/useAgentStreamLifecycle.ts +4 -5
- package/src/ui/hooks/agentStream/useAgentStreamOrchestration.ts +12 -5
- package/src/ui/hooks/agentStream/useQueuedSubmissions.ts +99 -0
- package/src/ui/hooks/agentStream/useStreamEventHandlers.ts +4 -13
- package/src/ui/hooks/agentStream/useStreamState.ts +60 -41
- package/src/ui/hooks/agentStream/useSubmitQuery.ts +284 -59
- package/src/ui/hooks/slashCommandProcessorSupport.ts +4 -0
- package/src/ui/hooks/useAgentStream-test-helpers.ts +1 -0
- package/src/ui/hooks/useAutoAcceptIndicator.ts +13 -0
- package/src/ui/hooks/useFolderTrust.ts +118 -81
- package/src/ui/hooks/useGitBranchName.ts +79 -33
- package/src/ui/hooks/useIdeTrustListener.ts +5 -19
- package/src/ui/hooks/usePermissionsModifyTrust.ts +223 -85
- package/src/ui/hooks/useReactToolScheduler.ts +13 -17
- package/src/ui/hooks/useTodoPausePreserver.ts +0 -55
- package/src/ui/layouts/DefaultAppLayout.tsx +2 -0
- package/src/ui/layouts/DefaultAppLayoutHelpers.tsx +37 -162
- package/src/ui/layouts/InlineContent.tsx +198 -0
- package/src/ui/trustDialogHelpers.ts +190 -0
- package/src/utils/cleanup-state.ts +115 -0
- package/src/utils/cleanup.ts +32 -34
- package/src/utils/sandbox-containers.ts +183 -53
- package/src/utils/sandbox-exec.ts +9 -3
- package/src/zed-integration/acp-terminal-shell-host.ts +112 -0
- package/src/zed-integration/acp-types.ts +35 -0
- package/src/zed-integration/fileSystemService.ts +1 -1
- package/src/zed-integration/runZedIntegration.ts +142 -0
- package/src/zed-integration/zed-agent-event-handler.ts +179 -0
- package/src/zed-integration/zed-agent-setup.ts +43 -0
- package/src/zed-integration/zed-command-registry.ts +167 -0
- package/src/zed-integration/zed-config-options.ts +280 -0
- package/src/zed-integration/zed-content-utils.ts +2 -2
- package/src/zed-integration/zed-helpers.ts +132 -0
- package/src/zed-integration/zed-initialize.ts +64 -0
- package/src/zed-integration/zed-plan-update.ts +20 -0
- package/src/zed-integration/zed-prompt-command.ts +77 -0
- package/src/zed-integration/zed-session-config.ts +119 -0
- package/src/zed-integration/zed-session-errors.ts +337 -0
- package/src/zed-integration/zed-session-events.ts +216 -0
- package/src/zed-integration/zed-session-info.ts +255 -0
- package/src/zed-integration/zed-session-lifecycle.ts +186 -0
- package/src/zed-integration/zed-session-listing.ts +153 -0
- package/src/zed-integration/zed-session-loader.ts +193 -0
- package/src/zed-integration/zed-session-pagination.ts +240 -0
- package/src/zed-integration/zed-session-replay.ts +564 -0
- package/src/zed-integration/zed-stream-batcher.ts +236 -0
- package/src/zed-integration/zed-terminal-manager.ts +416 -0
- package/src/zed-integration/zed-terminal-setup.ts +72 -0
- package/src/zed-integration/zed-test-helpers.ts +349 -4
- package/src/zed-integration/zed-tool-handler.ts +47 -5
- package/src/zed-integration/zedIntegration.ts +538 -587
- package/src/services/todo-continuation/todoContinuationService.ts +0 -610
- package/src/ui/containers/AppContainer/hooks/useIdeRestartHotkey.ts +0 -33
- package/src/ui/containers/AppContainer/hooks/useTodoContinuationFlow.ts +0 -160
- package/src/ui/hooks/useTodoContinuation.ts +0 -299
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import type React from 'react';
|
|
8
|
-
import { useCallback, useState, useMemo } from 'react';
|
|
8
|
+
import { useCallback, useEffect, useState, useMemo, useRef } from 'react';
|
|
9
9
|
import { Box, Text } from 'ink';
|
|
10
10
|
import * as path from 'node:path';
|
|
11
11
|
import { Colors } from '../colors.js';
|
|
@@ -13,92 +13,45 @@ import type { RadioSelectItem } from './shared/RadioButtonSelect.js';
|
|
|
13
13
|
import { RadioButtonSelect } from './shared/RadioButtonSelect.js';
|
|
14
14
|
import { useKeypress } from '../hooks/useKeypress.js';
|
|
15
15
|
import { usePermissionsModifyTrust } from '../hooks/usePermissionsModifyTrust.js';
|
|
16
|
-
import { TrustLevel } from '../../config/trustedFolders.js';
|
|
16
|
+
import { isTrustLevel, type TrustLevel } from '../../config/trustedFolders.js';
|
|
17
17
|
import type { HistoryItemWithoutId } from '../types.js';
|
|
18
18
|
import { MessageType } from '../types.js';
|
|
19
19
|
import type { UseHistoryManagerReturn } from '../hooks/useHistoryManager.js';
|
|
20
|
+
import type {
|
|
21
|
+
PermissionsTrustRuntime,
|
|
22
|
+
UsePermissionsModifyTrustReturn,
|
|
23
|
+
} from '../hooks/usePermissionsModifyTrust.js';
|
|
24
|
+
import {
|
|
25
|
+
getLocalTrustLevelDisplay,
|
|
26
|
+
getTrustLevelDisplay,
|
|
27
|
+
getWarningMessage,
|
|
28
|
+
getTrustUpdateDisplay,
|
|
29
|
+
getTrustCommitErrorMessage,
|
|
30
|
+
shouldDismissTrustDialog,
|
|
31
|
+
buildTrustLevelOptions,
|
|
32
|
+
findInitialTrustOptionIndex,
|
|
33
|
+
} from '../trustDialogHelpers.js';
|
|
20
34
|
|
|
21
35
|
interface PermissionsModifyTrustDialogProps {
|
|
22
36
|
onExit: () => void;
|
|
23
37
|
addItem: UseHistoryManagerReturn['addItem'];
|
|
24
|
-
|
|
38
|
+
config?: PermissionsTrustRuntime;
|
|
25
39
|
}
|
|
26
40
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
isParentTrusted: boolean | undefined,
|
|
31
|
-
): string {
|
|
32
|
-
if (isIdeTrusted === true) {
|
|
33
|
-
return 'Trusted (via IDE)';
|
|
34
|
-
}
|
|
35
|
-
if (isParentTrusted === true && level == null) {
|
|
36
|
-
return 'Trusted (via parent folder)';
|
|
37
|
-
}
|
|
38
|
-
switch (level) {
|
|
39
|
-
case TrustLevel.TRUST_FOLDER:
|
|
40
|
-
return 'Trusted';
|
|
41
|
-
case TrustLevel.TRUST_PARENT:
|
|
42
|
-
return 'Trust parent';
|
|
43
|
-
case TrustLevel.DO_NOT_TRUST:
|
|
44
|
-
return 'Not trusted';
|
|
45
|
-
default:
|
|
46
|
-
return 'Not set';
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function buildOptions(
|
|
51
|
-
folderName: string,
|
|
52
|
-
parentFolderName: string,
|
|
53
|
-
): Array<RadioSelectItem<TrustLevel>> {
|
|
54
|
-
return [
|
|
55
|
-
{
|
|
56
|
-
label: `Trust this folder (${folderName})`,
|
|
57
|
-
value: TrustLevel.TRUST_FOLDER,
|
|
58
|
-
key: TrustLevel.TRUST_FOLDER,
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
label: `Trust parent folder (${parentFolderName})`,
|
|
62
|
-
value: TrustLevel.TRUST_PARENT,
|
|
63
|
-
key: TrustLevel.TRUST_PARENT,
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
label: "Don't trust",
|
|
67
|
-
value: TrustLevel.DO_NOT_TRUST,
|
|
68
|
-
key: TrustLevel.DO_NOT_TRUST,
|
|
69
|
-
},
|
|
70
|
-
];
|
|
41
|
+
interface UpdatedPromptProps {
|
|
42
|
+
committedTrustLevel: TrustLevel | undefined;
|
|
43
|
+
effectiveTrustDisplay: string;
|
|
71
44
|
}
|
|
72
45
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
): string | null {
|
|
77
|
-
if (isIdeTrusted === true) {
|
|
78
|
-
return 'This folder is trusted via your IDE settings. Changes here will only take effect when not using the IDE.';
|
|
79
|
-
}
|
|
80
|
-
if (isParentTrusted === true) {
|
|
81
|
-
return 'This folder is trusted via a parent folder setting. You can override it with a more specific rule.';
|
|
82
|
-
}
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
interface RestartPromptProps {
|
|
87
|
-
getDisplayText: (level: TrustLevel | undefined) => string;
|
|
88
|
-
pendingTrustLevel: TrustLevel | undefined;
|
|
89
|
-
onRestart?: () => void;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const RestartPrompt: React.FC<RestartPromptProps> = ({
|
|
93
|
-
getDisplayText,
|
|
94
|
-
pendingTrustLevel,
|
|
95
|
-
onRestart: _onRestart,
|
|
46
|
+
const UpdatedPrompt: React.FC<UpdatedPromptProps> = ({
|
|
47
|
+
committedTrustLevel,
|
|
48
|
+
effectiveTrustDisplay,
|
|
96
49
|
}) => (
|
|
97
50
|
<Box flexDirection="column">
|
|
98
51
|
<Box
|
|
99
52
|
flexDirection="column"
|
|
100
53
|
borderStyle="round"
|
|
101
|
-
borderColor={Colors.
|
|
54
|
+
borderColor={Colors.AccentGreen}
|
|
102
55
|
padding={1}
|
|
103
56
|
width="100%"
|
|
104
57
|
marginLeft={1}
|
|
@@ -107,17 +60,16 @@ const RestartPrompt: React.FC<RestartPromptProps> = ({
|
|
|
107
60
|
Trust level updated
|
|
108
61
|
</Text>
|
|
109
62
|
<Text color={Colors.Comment}>
|
|
110
|
-
|
|
63
|
+
Saved local fallback:{' '}
|
|
111
64
|
<Text color={Colors.AccentGreen}>
|
|
112
|
-
{
|
|
65
|
+
{getLocalTrustLevelDisplay(committedTrustLevel)}
|
|
113
66
|
</Text>
|
|
114
67
|
</Text>
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
To see changes, llxprt must be restarted. Press 'r' to exit
|
|
119
|
-
and apply changes now, or Esc to continue without restart.
|
|
68
|
+
<Text color={Colors.Comment}>
|
|
69
|
+
Effective now:{' '}
|
|
70
|
+
<Text color={Colors.AccentGreen}>{effectiveTrustDisplay}</Text>
|
|
120
71
|
</Text>
|
|
72
|
+
<Text color={Colors.Comment}>Press Enter to continue.</Text>
|
|
121
73
|
</Box>
|
|
122
74
|
</Box>
|
|
123
75
|
);
|
|
@@ -129,7 +81,8 @@ interface TrustFormProps {
|
|
|
129
81
|
warningMessage: string | null;
|
|
130
82
|
options: Array<RadioSelectItem<TrustLevel>>;
|
|
131
83
|
initialIndex: number;
|
|
132
|
-
onSelect: (level: TrustLevel) => void
|
|
84
|
+
onSelect: (level: TrustLevel) => void | Promise<void>;
|
|
85
|
+
isCommitting: boolean;
|
|
133
86
|
}
|
|
134
87
|
|
|
135
88
|
const TrustForm: React.FC<TrustFormProps> = ({
|
|
@@ -140,6 +93,7 @@ const TrustForm: React.FC<TrustFormProps> = ({
|
|
|
140
93
|
options,
|
|
141
94
|
initialIndex,
|
|
142
95
|
onSelect,
|
|
96
|
+
isCommitting,
|
|
143
97
|
}) => (
|
|
144
98
|
<Box flexDirection="column">
|
|
145
99
|
<Box
|
|
@@ -175,8 +129,12 @@ const TrustForm: React.FC<TrustFormProps> = ({
|
|
|
175
129
|
<RadioButtonSelect
|
|
176
130
|
items={options}
|
|
177
131
|
initialIndex={initialIndex}
|
|
178
|
-
onSelect={
|
|
179
|
-
|
|
132
|
+
onSelect={(level) => {
|
|
133
|
+
if (isTrustLevel(level) && !isCommitting) {
|
|
134
|
+
void onSelect(level);
|
|
135
|
+
}
|
|
136
|
+
}}
|
|
137
|
+
isFocused={!isCommitting}
|
|
180
138
|
/>
|
|
181
139
|
</Box>
|
|
182
140
|
</Box>
|
|
@@ -186,83 +144,190 @@ const TrustForm: React.FC<TrustFormProps> = ({
|
|
|
186
144
|
</Box>
|
|
187
145
|
);
|
|
188
146
|
|
|
189
|
-
function
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
currentTrustLevel,
|
|
195
|
-
pendingTrustLevel,
|
|
196
|
-
commitTrustLevel,
|
|
197
|
-
isIdeTrusted,
|
|
198
|
-
isParentTrusted,
|
|
199
|
-
requiresRestart: _requiresRestart,
|
|
200
|
-
workingDirectory,
|
|
201
|
-
parentFolderName,
|
|
202
|
-
} = usePermissionsModifyTrust();
|
|
203
|
-
|
|
204
|
-
const [showRestartPrompt, setShowRestartPrompt] = useState(false);
|
|
205
|
-
|
|
206
|
-
const getDisplayText = useCallback(
|
|
207
|
-
(level: TrustLevel | undefined): string =>
|
|
208
|
-
getTrustLevelDisplay(level, isIdeTrusted, isParentTrusted),
|
|
209
|
-
[isIdeTrusted, isParentTrusted],
|
|
210
|
-
);
|
|
211
|
-
|
|
147
|
+
function useTrustFormOptions(
|
|
148
|
+
workingDirectory: string,
|
|
149
|
+
parentFolderName: string,
|
|
150
|
+
currentTrustLevel: TrustLevel | undefined,
|
|
151
|
+
): { options: Array<RadioSelectItem<TrustLevel>>; initialIndex: number } {
|
|
212
152
|
const folderName = path.basename(workingDirectory);
|
|
213
153
|
const options = useMemo(
|
|
214
|
-
() =>
|
|
154
|
+
() => buildTrustLevelOptions(folderName, parentFolderName),
|
|
215
155
|
[parentFolderName, folderName],
|
|
216
156
|
);
|
|
157
|
+
const initialIndex = useMemo(
|
|
158
|
+
() => findInitialTrustOptionIndex(options, currentTrustLevel),
|
|
159
|
+
[currentTrustLevel, options],
|
|
160
|
+
);
|
|
161
|
+
return { options, initialIndex };
|
|
162
|
+
}
|
|
217
163
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
164
|
+
function recordTrustSelection(
|
|
165
|
+
addItem: UseHistoryManagerReturn['addItem'],
|
|
166
|
+
workingDirectory: string,
|
|
167
|
+
level: TrustLevel,
|
|
168
|
+
previousTrustLevel: TrustLevel | undefined,
|
|
169
|
+
displayText: string,
|
|
170
|
+
): boolean {
|
|
171
|
+
const changed = level !== previousTrustLevel;
|
|
172
|
+
addItem(
|
|
173
|
+
{
|
|
174
|
+
type: MessageType.INFO,
|
|
175
|
+
text: changed
|
|
176
|
+
? `Trust level for ${workingDirectory} set to ${displayText}.`
|
|
177
|
+
: `Trust level unchanged for ${workingDirectory}`,
|
|
178
|
+
} as HistoryItemWithoutId,
|
|
179
|
+
Date.now(),
|
|
180
|
+
);
|
|
181
|
+
return changed;
|
|
182
|
+
}
|
|
223
183
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
184
|
+
function useTrustSelectionHandler({
|
|
185
|
+
addItem,
|
|
186
|
+
commitTrustLevel,
|
|
187
|
+
onExit,
|
|
188
|
+
pendingTrustLevel,
|
|
189
|
+
setIsCommitting,
|
|
190
|
+
setShowUpdatedPrompt,
|
|
191
|
+
committingRef,
|
|
192
|
+
mountedRef,
|
|
193
|
+
workingDirectory,
|
|
194
|
+
}: {
|
|
195
|
+
addItem: UseHistoryManagerReturn['addItem'];
|
|
196
|
+
commitTrustLevel: UsePermissionsModifyTrustReturn['commitTrustLevel'];
|
|
197
|
+
onExit: () => void;
|
|
198
|
+
pendingTrustLevel: TrustLevel | undefined;
|
|
199
|
+
setIsCommitting: React.Dispatch<React.SetStateAction<boolean>>;
|
|
200
|
+
setShowUpdatedPrompt: React.Dispatch<React.SetStateAction<boolean>>;
|
|
201
|
+
committingRef: React.MutableRefObject<boolean>;
|
|
202
|
+
mountedRef: React.MutableRefObject<boolean>;
|
|
203
|
+
workingDirectory: string;
|
|
204
|
+
}) {
|
|
205
|
+
return useCallback(
|
|
206
|
+
async (level: TrustLevel) => {
|
|
207
|
+
if (committingRef.current) return;
|
|
208
|
+
committingRef.current = true;
|
|
209
|
+
setIsCommitting(true);
|
|
210
|
+
try {
|
|
211
|
+
const result = await commitTrustLevel(level);
|
|
212
|
+
if (!mountedRef.current) return;
|
|
213
|
+
if (!result.success) {
|
|
214
|
+
addItem(
|
|
215
|
+
{
|
|
216
|
+
type: MessageType.ERROR,
|
|
217
|
+
text: getTrustCommitErrorMessage(
|
|
218
|
+
result.phase,
|
|
219
|
+
result.error,
|
|
220
|
+
result.rollbackSucceeded,
|
|
221
|
+
),
|
|
222
|
+
} as HistoryItemWithoutId,
|
|
223
|
+
Date.now(),
|
|
224
|
+
);
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
const changed = recordTrustSelection(
|
|
228
|
+
addItem,
|
|
229
|
+
workingDirectory,
|
|
230
|
+
level,
|
|
231
|
+
pendingTrustLevel,
|
|
232
|
+
getLocalTrustLevelDisplay(level),
|
|
234
233
|
);
|
|
235
|
-
|
|
236
|
-
|
|
234
|
+
if (changed) setShowUpdatedPrompt(true);
|
|
235
|
+
else onExit();
|
|
236
|
+
} catch (error) {
|
|
237
|
+
if (!mountedRef.current) return;
|
|
237
238
|
addItem(
|
|
238
239
|
{
|
|
239
|
-
type: MessageType.
|
|
240
|
-
text:
|
|
240
|
+
type: MessageType.ERROR,
|
|
241
|
+
text: getTrustCommitErrorMessage('live', error, false),
|
|
241
242
|
} as HistoryItemWithoutId,
|
|
242
243
|
Date.now(),
|
|
243
244
|
);
|
|
244
|
-
|
|
245
|
+
} finally {
|
|
246
|
+
committingRef.current = false;
|
|
247
|
+
if (mountedRef.current) setIsCommitting(false);
|
|
245
248
|
}
|
|
246
249
|
},
|
|
247
250
|
[
|
|
248
|
-
commitTrustLevel,
|
|
249
|
-
currentTrustLevel,
|
|
250
251
|
addItem,
|
|
251
|
-
|
|
252
|
+
commitTrustLevel,
|
|
253
|
+
committingRef,
|
|
254
|
+
mountedRef,
|
|
252
255
|
onExit,
|
|
253
|
-
|
|
256
|
+
pendingTrustLevel,
|
|
257
|
+
setIsCommitting,
|
|
258
|
+
setShowUpdatedPrompt,
|
|
259
|
+
workingDirectory,
|
|
254
260
|
],
|
|
255
261
|
);
|
|
262
|
+
}
|
|
256
263
|
|
|
257
|
-
|
|
258
|
-
|
|
264
|
+
function useTrustDialogState(
|
|
265
|
+
onExit: () => void,
|
|
266
|
+
addItem: UseHistoryManagerReturn['addItem'],
|
|
267
|
+
config?: PermissionsTrustRuntime,
|
|
268
|
+
) {
|
|
269
|
+
const trust = usePermissionsModifyTrust(config);
|
|
270
|
+
const {
|
|
271
|
+
pendingTrustLevel,
|
|
272
|
+
effectiveLocalTrustLevel,
|
|
273
|
+
isIdeTrusted,
|
|
274
|
+
isParentTrusted,
|
|
275
|
+
committedTrustLevel,
|
|
276
|
+
effectiveTrust,
|
|
277
|
+
workingDirectory,
|
|
278
|
+
parentFolderName,
|
|
279
|
+
} = trust;
|
|
280
|
+
const [showUpdatedPrompt, setShowUpdatedPrompt] = useState(false);
|
|
281
|
+
const [isCommitting, setIsCommitting] = useState(false);
|
|
282
|
+
const committingRef = useRef(false);
|
|
283
|
+
const mountedRef = useRef(true);
|
|
284
|
+
useEffect(() => {
|
|
285
|
+
mountedRef.current = true;
|
|
286
|
+
return () => {
|
|
287
|
+
mountedRef.current = false;
|
|
288
|
+
};
|
|
289
|
+
}, []);
|
|
290
|
+
const getDisplayText = useCallback(
|
|
291
|
+
(level: TrustLevel | undefined): string =>
|
|
292
|
+
getTrustLevelDisplay(level, isIdeTrusted, isParentTrusted),
|
|
259
293
|
[isIdeTrusted, isParentTrusted],
|
|
260
294
|
);
|
|
295
|
+
const { options, initialIndex } = useTrustFormOptions(
|
|
296
|
+
workingDirectory,
|
|
297
|
+
parentFolderName,
|
|
298
|
+
pendingTrustLevel ?? effectiveLocalTrustLevel,
|
|
299
|
+
);
|
|
300
|
+
const handleSelect = useTrustSelectionHandler({
|
|
301
|
+
addItem,
|
|
302
|
+
commitTrustLevel: trust.commitTrustLevel,
|
|
303
|
+
onExit,
|
|
304
|
+
pendingTrustLevel,
|
|
305
|
+
setIsCommitting,
|
|
306
|
+
setShowUpdatedPrompt,
|
|
307
|
+
committingRef,
|
|
308
|
+
mountedRef,
|
|
309
|
+
workingDirectory,
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
const warningMessage = getWarningMessage(
|
|
313
|
+
isIdeTrusted,
|
|
314
|
+
isParentTrusted,
|
|
315
|
+
effectiveLocalTrustLevel,
|
|
316
|
+
);
|
|
317
|
+
const trustUpdateDisplay = getTrustUpdateDisplay(
|
|
318
|
+
committedTrustLevel,
|
|
319
|
+
effectiveTrust,
|
|
320
|
+
isIdeTrusted,
|
|
321
|
+
isParentTrusted,
|
|
322
|
+
);
|
|
261
323
|
|
|
262
324
|
return {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
325
|
+
effectiveLocalTrustLevel,
|
|
326
|
+
committedTrustLevel,
|
|
327
|
+
effectiveTrustDisplay: trustUpdateDisplay.effectiveNow,
|
|
328
|
+
showUpdatedPrompt,
|
|
329
|
+
isCommitting,
|
|
330
|
+
isCommitPending: () => committingRef.current,
|
|
266
331
|
getDisplayText,
|
|
267
332
|
options,
|
|
268
333
|
initialIndex,
|
|
@@ -274,27 +339,26 @@ function useTrustDialogState(
|
|
|
274
339
|
|
|
275
340
|
export const PermissionsModifyTrustDialog: React.FC<
|
|
276
341
|
PermissionsModifyTrustDialogProps
|
|
277
|
-
> = ({ onExit, addItem,
|
|
278
|
-
const state = useTrustDialogState(onExit, addItem);
|
|
342
|
+
> = ({ onExit, addItem, config }) => {
|
|
343
|
+
const state = useTrustDialogState(onExit, addItem, config);
|
|
279
344
|
|
|
280
345
|
useKeypress(
|
|
281
346
|
(key) => {
|
|
282
|
-
if (
|
|
283
|
-
|
|
347
|
+
if (state.isCommitPending()) {
|
|
348
|
+
return;
|
|
284
349
|
}
|
|
285
|
-
if (key.name
|
|
286
|
-
|
|
350
|
+
if (shouldDismissTrustDialog(state.showUpdatedPrompt, key.name)) {
|
|
351
|
+
onExit();
|
|
287
352
|
}
|
|
288
353
|
},
|
|
289
354
|
{ isActive: true },
|
|
290
355
|
);
|
|
291
356
|
|
|
292
|
-
if (state.
|
|
357
|
+
if (state.showUpdatedPrompt) {
|
|
293
358
|
return (
|
|
294
|
-
<
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
onRestart={_onRestartParam}
|
|
359
|
+
<UpdatedPrompt
|
|
360
|
+
committedTrustLevel={state.committedTrustLevel}
|
|
361
|
+
effectiveTrustDisplay={state.effectiveTrustDisplay}
|
|
298
362
|
/>
|
|
299
363
|
);
|
|
300
364
|
}
|
|
@@ -302,12 +366,13 @@ export const PermissionsModifyTrustDialog: React.FC<
|
|
|
302
366
|
return (
|
|
303
367
|
<TrustForm
|
|
304
368
|
workingDirectory={state.workingDirectory}
|
|
305
|
-
currentTrustLevel={state.
|
|
369
|
+
currentTrustLevel={state.effectiveLocalTrustLevel}
|
|
306
370
|
getDisplayText={state.getDisplayText}
|
|
307
371
|
warningMessage={state.warningMessage}
|
|
308
372
|
options={state.options}
|
|
309
373
|
initialIndex={state.initialIndex}
|
|
310
374
|
onSelect={state.handleSelect}
|
|
375
|
+
isCommitting={state.isCommitting}
|
|
311
376
|
/>
|
|
312
377
|
);
|
|
313
378
|
};
|
|
@@ -11,7 +11,7 @@ export const PROVIDER_OPTIONS: ProviderOption[] = [
|
|
|
11
11
|
value: 'anthropic',
|
|
12
12
|
label: 'Anthropic',
|
|
13
13
|
needsBaseUrl: false,
|
|
14
|
-
supportsOAuth:
|
|
14
|
+
supportsOAuth: false,
|
|
15
15
|
knownModels: [
|
|
16
16
|
'claude-opus-5',
|
|
17
17
|
'claude-sonnet-5',
|
|
@@ -20,6 +20,13 @@ export const PROVIDER_OPTIONS: ProviderOption[] = [
|
|
|
20
20
|
'claude-opus-4-5-20251101',
|
|
21
21
|
],
|
|
22
22
|
},
|
|
23
|
+
{
|
|
24
|
+
value: 'claudecode',
|
|
25
|
+
label: 'Claude Code (Claude.ai OAuth)',
|
|
26
|
+
needsBaseUrl: false,
|
|
27
|
+
supportsOAuth: true,
|
|
28
|
+
knownModels: ['claude-opus-5', 'claude-sonnet-4-20250514'],
|
|
29
|
+
},
|
|
23
30
|
{
|
|
24
31
|
value: 'gemini',
|
|
25
32
|
label: 'Google Gemini',
|
|
@@ -171,6 +178,11 @@ export const PARAMETER_DEFAULTS: Record<string, AdvancedParams> = {
|
|
|
171
178
|
maxTokens: 4096,
|
|
172
179
|
contextLimit: 200000,
|
|
173
180
|
},
|
|
181
|
+
claudecode: {
|
|
182
|
+
temperature: 0.7,
|
|
183
|
+
maxTokens: 4096,
|
|
184
|
+
contextLimit: 200000,
|
|
185
|
+
},
|
|
174
186
|
openai: {
|
|
175
187
|
temperature: 0.7,
|
|
176
188
|
maxTokens: 4096,
|