Skip to content

Commit 815596b

Browse files
committed
Merge fork branch before push
# Conflicts: # src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.ts
2 parents a2aa58e + afaf61a commit 815596b

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,20 @@ export class RunInTerminalTool extends Disposable implements IToolImpl {
10821082
chatModel.acceptResponseProgress(request, progress);
10831083
}
10841084

1085+
private _prependAutomaticUnsandboxRetryNote(result: IToolResult): IToolResult {
1086+
const note = localize(
1087+
'runInTerminal.unsandboxed.autoRetry.note',
1088+
'Note: The first sandboxed execution appeared blocked by the sandbox, so after you approved it, the command was retried outside the sandbox.\n\n'
1089+
);
1090+
const firstTextPart = result.content.find(part => part.kind === 'text');
1091+
if (firstTextPart?.kind === 'text') {
1092+
firstTextPart.value = `${note}${firstTextPart.value}`;
1093+
} else {
1094+
result.content.unshift({ kind: 'text', value: note });
1095+
}
1096+
return result;
1097+
}
1098+
10851099
async invoke(invocation: IToolInvocation, _countTokens: CountTokensCallback, _progress: ToolProgress, token: CancellationToken): Promise<IToolResult> {
10861100
const toolSpecificData = invocation.toolSpecificData as IChatTerminalToolInvocationData | undefined;
10871101
if (!toolSpecificData) {
@@ -1672,7 +1686,7 @@ export class RunInTerminalTool extends Disposable implements IToolImpl {
16721686
const retryToolCallId = `automatic-unsandbox-retry-${generateUuid()}`;
16731687
this._acceptAutomaticUnsandboxRetryToolInvocationUpdate(invocation.context.sessionResource, retryToolCallId, retryToolSpecificData, false);
16741688

1675-
return await this.invoke({
1689+
const retryResult = await this.invoke({
16761690
...invocation,
16771691
parameters: {
16781692
...args,
@@ -1682,6 +1696,9 @@ export class RunInTerminalTool extends Disposable implements IToolImpl {
16821696
},
16831697
toolSpecificData: retryToolSpecificData,
16841698
}, _countTokens, _progress, token);
1699+
this._acceptAutomaticUnsandboxRetryToolInvocationUpdate(invocation.context.sessionResource, retryToolCallId, retryToolSpecificData, true, retryResult.toolResultMessage);
1700+
1701+
return this._prependAutomaticUnsandboxRetryNote(retryResult);
16851702
}
16861703
}
16871704

0 commit comments

Comments
 (0)