Skip to content

Commit 645afc8

Browse files
committed
Pre-release 0.43.143
1 parent 93d919b commit 645afc8

File tree

15 files changed

+104
-45
lines changed

15 files changed

+104
-45
lines changed

Core/Sources/ChatService/ChatService.swift

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -229,15 +229,12 @@ public final class ChatService: ChatServiceType, ObservableObject {
229229
}
230230

231231
public func updateToolCallStatus(toolCallId: String, status: AgentToolCall.ToolCallStatus, payload: Any? = nil) {
232-
if status == .cancelled {
233-
resetOngoingRequest(with: .cancelled)
234-
return
235-
}
236-
237232
// Send the tool call result back to the server
238-
if let toolCallRequest = self.pendingToolCallRequests[toolCallId], status == .accepted {
233+
if let toolCallRequest = self.pendingToolCallRequests[toolCallId], status == .accepted || status == .cancelled {
239234
self.pendingToolCallRequests.removeValue(forKey: toolCallId)
240-
let toolResult = LanguageModelToolConfirmationResult(result: .Accept)
235+
let toolResult = LanguageModelToolConfirmationResult(
236+
result: status == .accepted ? .Accept : .Dismiss
237+
)
241238
let jsonResult = try? JSONEncoder().encode(toolResult)
242239
let jsonValue = (try? JSONDecoder().decode(JSONValue.self, from: jsonResult ?? Data())) ?? JSONValue.null
243240
toolCallRequest.completion(

Core/Sources/ConversationTab/Chat.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,9 +784,12 @@ struct Chat {
784784
let chatContext: ChatContext = .from(message, projectURL: projectURL)
785785
state.editor.setContext(chatContext, for: mode)
786786
state.editorMode = mode
787+
let isReceivingMessage = service.isReceivingMessage
787788

788789
return .run { send in
789-
await send(.stopRespondingButtonTapped)
790+
if isReceivingMessage {
791+
await send(.stopRespondingButtonTapped)
792+
}
790793
}
791794
}
792795

Core/Sources/ConversationTab/ChatPanel.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,20 @@ public struct ChatPanel: View {
4343
if let _ = chat.history.last?.followUp {
4444
ChatFollowUp(chat: chat)
4545
.scaledPadding(.vertical, 8)
46+
.scaledPadding(.horizontal, 16)
4647
.dimWithExitEditMode(chat)
4748
}
4849
}
4950

5051
if chat.fileEditMap.count > 0 {
5152
WorkingSetView(chat: chat)
5253
.dimWithExitEditMode(chat)
54+
.scaledPadding(.horizontal, 16)
5355
}
5456

5557
ChatPanelInputArea(chat: chat, r: r, editorMode: .input)
56-
.chatPanelInputAreaPadding(.input)
5758
.dimWithExitEditMode(chat)
59+
.scaledPadding(.horizontal, 16)
5860
}
5961
.scaledPadding(.vertical, 12)
6062
.background(Color.chatWindowBackgroundColor)
@@ -183,7 +185,7 @@ struct ChatPanelMessages: View {
183185
}
184186
}
185187
.listStyle(.plain)
186-
.padding(.horizontal, -8)
188+
.scaledPadding(.leading, 8)
187189
.listRowBackground(EmptyView())
188190
.modify { view in
189191
if #available(macOS 13.0, *) {
@@ -406,13 +408,15 @@ struct ChatHistory: View {
406408
// check point
407409
CheckPoint(chat: chat, messageId: message.id)
408410
.padding(.vertical, 8)
411+
.padding(.trailing, 8)
409412
}
410413
}
411414

412415
// Show up check point for redo
413416
if message.id == pendingCheckpointMessageId {
414417
CheckPoint(chat: chat, messageId: message.id)
415418
.padding(.vertical, 8)
419+
.padding(.trailing, 8)
416420
}
417421
}
418422
.dimWithExitEditMode(
@@ -445,6 +449,7 @@ struct ChatHistoryItem: View {
445449
requestType: message.requestType
446450
)
447451
.scaledPadding(.leading, chat.editorMode.isEditingUserMessage && chat.editorMode.editingUserMessageId == message.id ? 0 : 20)
452+
.scaledPadding(.trailing, 8)
448453
case .assistant:
449454
BotMessage(
450455
message: message,

Core/Sources/ConversationTab/ModelPicker/ModelPicker.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,13 @@ struct ModelPicker: View {
302302
HStack(spacing: 0) {
303303
// Custom segmented control with color change
304304
ChatModePicker(chatMode: $chatMode, onScopeChange: switchModelsForScope)
305-
.onAppear() {
305+
.onAppear {
306306
updateAgentPicker()
307307
}
308+
.onReceive(
309+
NotificationCenter.default.publisher(for: .gitHubCopilotChatModeDidChange)) { _ in
310+
updateAgentPicker()
311+
}
308312

309313
if chatMode == "Agent" {
310314
mcpButton

Core/Sources/ConversationTab/TerminalViews/RunInTerminalToolView.swift

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ struct RunInTerminalToolView: View {
8282

8383
toolView
8484
}
85-
.padding(8)
85+
.scaledPadding(8)
8686
.cornerRadius(8)
8787
.overlay(
8888
RoundedRectangle(cornerRadius: 8)
@@ -123,7 +123,7 @@ struct RunInTerminalToolView: View {
123123
Text(command!)
124124
.textSelection(.enabled)
125125
.scaledFont(size: chatFontSize, design: .monospaced)
126-
.padding(8)
126+
.scaledPadding(8)
127127
.frame(maxWidth: .infinity, alignment: .leading)
128128
.foregroundStyle(codeForegroundColor)
129129
.background(codeBackgroundColor)
@@ -147,19 +147,23 @@ struct RunInTerminalToolView: View {
147147
.frame(maxWidth: .infinity, alignment: .leading)
148148

149149
HStack {
150-
Button("Cancel") {
150+
Button(action: {
151151
chat.send(.toolCallCancelled(tool.id))
152+
}) {
153+
Text("Skip")
154+
.scaledFont(.body)
152155
}
153-
.scaledFont(.body)
154-
155-
Button("Continue") {
156+
157+
Button(action: {
156158
chat.send(.toolCallAccepted(tool.id))
159+
}) {
160+
Text("Allow")
161+
.scaledFont(.body)
157162
}
158-
.scaledFont(.body)
159163
.buttonStyle(BorderedProminentButtonStyle())
160164
}
161165
.frame(maxWidth: .infinity, alignment: .leading)
162-
.padding(.top, 4)
166+
.scaledPadding(.top, 4)
163167
}
164168
}
165169
}

Core/Sources/ConversationTab/ViewExtension.swift

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,6 @@ extension View {
8484
self.hoverForeground(isHovered: isHovered, defaultColor: .secondary)
8585
}
8686

87-
// MARK: - Chat Panel Input Area
88-
func chatPanelInputAreaPadding(_ mode: Chat.EditorMode) -> some View {
89-
var trailingPadding: CGFloat
90-
switch mode {
91-
case .input:
92-
trailingPadding = 16
93-
case .editUserMessage:
94-
trailingPadding = 8
95-
}
96-
return self.padding(.trailing, trailingPadding)
97-
}
98-
9987
// MARK: - Editor Mode
10088

10189
/// Dims the view when in edit mode and provides tap/keyboard exit functionality

Core/Sources/ConversationTab/Views/BotMessage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ private struct TurnStatusView: View {
387387
}
388388

389389
private var cancelStatus: some View {
390-
statusView(icon: "slash.circle", iconColor: .secondary, text: "Cancelled")
390+
statusView(icon: "slash.circle", iconColor: .secondary, text: "Stopped")
391391
}
392392

393393
private var errorStatus: some View {

Core/Sources/ConversationTab/Views/ChatPanelInputArea/InputAreaTextEditor.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ struct InputAreaTextEditor: View {
211211
}
212212
.overlay {
213213
RoundedRectangle(cornerRadius: 6)
214-
.stroke(Color(nsColor: .controlColor), lineWidth: 1)
214+
.stroke(.quaternary, lineWidth: 1)
215215
}
216216
.background {
217217
if isEditorActive {
@@ -452,14 +452,22 @@ struct InputAreaTextEditor: View {
452452

453453
@ViewBuilder
454454
func makeCurrentEditorView(_ ref: ConversationFileReference) -> some View {
455+
let toggleTrailingPadding: CGFloat = {
456+
if #available(macOS 26.0, *) {
457+
return 8
458+
} else {
459+
return 4
460+
}
461+
}()
462+
455463
HStack(spacing: 0) {
456464
makeContextFileNameView(url: ref.url, isCurrentEditor: true, selection: ref.selection)
457465

458466
Toggle("", isOn: $isCurrentEditorContextEnabled)
459467
.toggleStyle(SwitchToggleStyle(tint: .blue))
460468
.controlSize(.mini)
461469
.frame(width: 34)
462-
.padding(.trailing, 4)
470+
.padding(.trailing, toggleTrailingPadding)
463471
.onChange(of: isCurrentEditorContextEnabled) { newValue in
464472
enableCurrentEditorContext = newValue
465473
}

Core/Sources/ConversationTab/Views/ConversationAgentProgressView.swift

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ struct ProgressToolCalls: View {
3939
RunInTerminalToolView(tool: tool, chat: chat)
4040
} else if tool.invokeParams != nil && tool.status == .waitForConfirmation {
4141
ToolConfirmationView(tool: tool, chat: chat)
42-
.scaledPadding(8)
4342
} else {
4443
ToolStatusItemView(tool: tool)
4544
}
@@ -64,20 +63,26 @@ struct ToolConfirmationView: View {
6463
.frame(maxWidth: .infinity, alignment: .leading)
6564

6665
HStack {
67-
Button("Cancel") {
66+
Button(action: {
6867
chat.send(.toolCallCancelled(tool.id))
68+
}) {
69+
Text("Skip")
70+
.scaledFont(.body)
6971
}
70-
.scaledFont(.body)
71-
72-
Button("Continue") {
72+
73+
Button(action: {
7374
chat.send(.toolCallAccepted(tool.id))
75+
}) {
76+
Text("Allow")
77+
.scaledFont(.body)
7478
}
7579
.buttonStyle(BorderedProminentButtonStyle())
76-
.scaledFont(.body)
80+
7781
}
7882
.frame(maxWidth: .infinity, alignment: .leading)
7983
.scaledPadding(.top, 4)
8084
}
85+
.scaledPadding(8)
8186
.cornerRadius(8)
8287
.overlay(
8388
RoundedRectangle(cornerRadius: 8)

Core/Sources/ConversationTab/Views/UserMessage.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ private struct MessageInputArea: View {
112112
editorMode: editorMode
113113
)
114114
.frame(maxWidth: .infinity)
115-
.chatPanelInputAreaPadding(editorMode)
116115
}
117116
}
118117

0 commit comments

Comments
 (0)